From aab3277024a58e58cc8a31ed2a42c7ce73575413 Mon Sep 17 00:00:00 2001 From: emu1337 Date: Mon, 11 Oct 2021 03:12:57 +0200 Subject: [PATCH 0001/2328] changed speed acc scaling to be closer to worst case scenario --- .../Difficulty/OsuDifficultyAttributes.cs | 1 + .../Difficulty/OsuDifficultyCalculator.cs | 2 ++ .../Difficulty/OsuPerformanceCalculator.cs | 9 ++++++++- osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs | 16 +++++++++++++++- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs index bd4c0f2ad5..1f8b66edb7 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs @@ -9,6 +9,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty { public double AimStrain { get; set; } public double SpeedStrain { get; set; } + public double SpeedNoteCount { get; set; } public double FlashlightRating { get; set; } public double ApproachRate { get; set; } public double OverallDifficulty { get; set; } diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 790aa0eb7d..4160da9d5e 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -36,6 +36,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier; double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier; double flashlightRating = Math.Sqrt(skills[2].DifficultyValue()) * difficulty_multiplier; + double speedNotes = (skills[1] as Speed).RelevantNoteCount(); if (mods.Any(h => h is OsuModRelax)) speedRating = 0.0; @@ -72,6 +73,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty Mods = mods, AimStrain = aimRating, SpeedStrain = speedRating, + SpeedNoteCount = speedNotes, FlashlightRating = flashlightRating, ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5, OverallDifficulty = (80 - hitWindowGreat) / 6, diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs index 4e4dbc02a1..140c49393b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs @@ -168,8 +168,15 @@ namespace osu.Game.Rulesets.Osu.Difficulty speedValue *= 1.0 + 0.04 * (12.0 - Attributes.ApproachRate); } + // Calculate accuracy assuming the worst case scenario + double relevantTotalDiff = totalHits - Attributes.SpeedNoteCount; + double relevantCountGreat = Math.Max(0, countGreat - relevantTotalDiff); + double relevantCountOk = Math.Max(0, countOk - Math.Max(0, relevantTotalDiff - countGreat)); + double relevantCountMeh = Math.Max(0, countMeh - Math.Max(0, relevantTotalDiff - countGreat - countOk)); + double relevantAccuracy = (relevantCountGreat * 6.0 + relevantCountOk * 2.0 + relevantCountMeh) / (Attributes.SpeedNoteCount * 6.0); + // Scale the speed value with accuracy and OD. - speedValue *= (0.95 + Math.Pow(Attributes.OverallDifficulty, 2) / 750) * Math.Pow(accuracy, (14.5 - Math.Max(Attributes.OverallDifficulty, 8)) / 2); + speedValue *= (0.95 + Math.Pow(Attributes.OverallDifficulty, 2) / 750) * Math.Pow((accuracy + relevantAccuracy) / 2.0, (14.5 - Math.Max(Attributes.OverallDifficulty, 8)) / 2); // Scale the speed value with # of 50s to punish doubletapping. speedValue *= Math.Pow(0.98, countMeh < totalHits / 500.0 ? 0 : countMeh - totalHits / 500.0); diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index cae6b8e01c..f8c1042a10 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -7,6 +7,8 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; using osu.Game.Rulesets.Osu.Objects; using osu.Framework.Utils; +using System.Collections.Generic; +using System.Linq; namespace osu.Game.Rulesets.Osu.Difficulty.Skills { @@ -33,6 +35,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private readonly double greatWindow; + private List objectStrains = new List(); + public Speed(Mod[] mods, double hitWindowGreat) : base(mods) { @@ -170,7 +174,17 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills currentRhythm = calculateRhythmBonus(current); - return currentStrain * currentRhythm; + double totalStrain = currentStrain * currentRhythm; + + objectStrains.Add(totalStrain); + + return totalStrain; + } + + public double RelevantNoteCount() + { + double maxStrain = objectStrains.Max(); + return objectStrains.Aggregate((total, next) => total + (1.0 / (1.0 + Math.Pow(Math.E, -(next/maxStrain * 12.0 - 6.0))))); } } } From d7483a6c5da7ace483c9e6cac31edf4f3ca0a67c Mon Sep 17 00:00:00 2001 From: emu1337 Date: Mon, 11 Oct 2021 19:58:03 +0200 Subject: [PATCH 0002/2328] changed pow to exp function --- osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index f8c1042a10..f477f8e17d 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -184,7 +184,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills public double RelevantNoteCount() { double maxStrain = objectStrains.Max(); - return objectStrains.Aggregate((total, next) => total + (1.0 / (1.0 + Math.Pow(Math.E, -(next/maxStrain * 12.0 - 6.0))))); + return objectStrains.Aggregate((total, next) => total + (1.0 / (1.0 + Math.Exp(-(next/maxStrain * 12.0 - 6.0))))); } } } From 131e64e56c14760ffc408993ca5416d44f863528 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Fri, 12 Nov 2021 21:29:51 +1100 Subject: [PATCH 0003/2328] Add bonus based on opacity of hit objects --- .../Difficulty/OsuDifficultyCalculator.cs | 17 ++++---- .../Difficulty/OsuPerformanceCalculator.cs | 14 ------- .../Difficulty/Skills/Flashlight.cs | 39 +++++++++++++++++-- 3 files changed, 43 insertions(+), 27 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 558ddc16ef..19e92d4365 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -22,6 +22,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty { private const double difficulty_multiplier = 0.0675; private double hitWindowGreat; + private double preempt; public OsuDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) @@ -34,11 +35,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty return new OsuDifficultyAttributes { Mods = mods, Skills = skills }; double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier; - double aimRatingNoSliders = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier; - double speedRating = Math.Sqrt(skills[2].DifficultyValue()) * difficulty_multiplier; - double flashlightRating = Math.Sqrt(skills[3].DifficultyValue()) * difficulty_multiplier; - - double sliderFactor = aimRating > 0 ? aimRatingNoSliders / aimRating : 1; + double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier; + double flashlightRating = Math.Sqrt(skills[2].DifficultyValue()) * difficulty_multiplier; if (mods.Any(h => h is OsuModRelax)) speedRating = 0.0; @@ -77,7 +75,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty AimStrain = aimRating, SpeedStrain = speedRating, FlashlightRating = flashlightRating, - SliderFactor = sliderFactor, ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5, OverallDifficulty = (80 - hitWindowGreat) / 6, DrainRate = drainRate, @@ -110,12 +107,13 @@ namespace osu.Game.Rulesets.Osu.Difficulty hitWindowGreat = hitWindows.WindowFor(HitResult.Great) / clockRate; + preempt = IBeatmapDifficultyInfo.DifficultyRange(beatmap.Difficulty.ApproachRate, 1800, 1200, 450) / clockRate; + return new Skill[] { - new Aim(mods, true), - new Aim(mods, false), + new Aim(mods), new Speed(mods, hitWindowGreat), - new Flashlight(mods) + new Flashlight(mods, preempt) }; } @@ -126,6 +124,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty new OsuModEasy(), new OsuModHardRock(), new OsuModFlashlight(), + new OsuModHidden(), }; } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs index 8d45c7a8cc..817b0b63a8 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs @@ -125,16 +125,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty aimValue *= 1.0 + 0.04 * (12.0 - Attributes.ApproachRate); } - // We assume 15% of sliders in a map are difficult since there's no way to tell from the performance calculator. - double estimateDifficultSliders = Attributes.SliderCount * 0.15; - - if (Attributes.SliderCount > 0) - { - double estimateSliderEndsDropped = Math.Clamp(Math.Min(countOk + countMeh + countMiss, Attributes.MaxCombo - scoreMaxCombo), 0, estimateDifficultSliders); - double sliderNerfFactor = (1 - Attributes.SliderFactor) * Math.Pow(1 - estimateSliderEndsDropped / estimateDifficultSliders, 3) + Attributes.SliderFactor; - aimValue *= sliderNerfFactor; - } - aimValue *= accuracy; // It is important to also consider accuracy difficulty when doing that. aimValue *= 0.98 + Math.Pow(Attributes.OverallDifficulty, 2) / 2500; @@ -234,10 +224,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty double flashlightValue = Math.Pow(rawFlashlight, 2.0) * 25.0; - // Add an additional bonus for HDFL. - if (mods.Any(h => h is OsuModHidden)) - flashlightValue *= 1.3; - // Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses. if (effectiveMissCount > 0) flashlightValue *= 0.97 * Math.Pow(1 - Math.Pow((double)effectiveMissCount / totalHits, 0.775), Math.Pow(effectiveMissCount, .875)); diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 466f0556ab..55ef8db129 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -2,8 +2,10 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Linq; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; using osu.Game.Rulesets.Osu.Objects; @@ -14,16 +16,24 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills /// public class Flashlight : OsuStrainSkill { - public Flashlight(Mod[] mods) + public Flashlight(Mod[] mods, double preemptTime) : base(mods) { + this.mods = mods; + this.preemptTime = preemptTime; } - private double skillMultiplier => 0.15; + private double skillMultiplier => 0.12; private double strainDecayBase => 0.15; protected override double DecayWeight => 1.0; protected override int HistoryLength => 10; // Look back for 10 notes is added for the sake of flashlight calculations. + private Mod[] mods; + private bool hidden; + private double preemptTime; + + private const double max_opacity_bonus = 0.4; + private double currentStrain; private double strainValueOf(DifficultyHitObject current) @@ -31,6 +41,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills if (current.BaseObject is Spinner) return 0; + hidden = mods.Any(m => m is OsuModHidden); + var osuCurrent = (OsuDifficultyHitObject)current; var osuHitObject = (OsuHitObject)(osuCurrent.BaseObject); @@ -58,11 +70,30 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills // We also want to nerf stacks so that only the first object of the stack is accounted for. double stackNerf = Math.Min(1.0, (osuPrevious.JumpDistance / scalingFactor) / 25.0); - result += Math.Pow(0.8, i) * stackNerf * scalingFactor * jumpDistance / cumulativeStrainTime; + // Bonus based on how visible the object is. + double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - opacity(cumulativeStrainTime, preemptTime, hidden)); + + result += Math.Pow(0.8, i) * stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime; } } - return Math.Pow(smallDistNerf * result, 2.0); + result = Math.Pow(smallDistNerf * result, 2.0); + + if (hidden) { + result *= 1.0 + max_opacity_bonus; + } + + return result; + } + + private double opacity(double ms, double preemptTime, bool hidden) { + if (hidden) { + return Math.Clamp(Math.Min((1 - ms / preemptTime) * 2.5, (ms / preemptTime) * (1.0 / 0.3)), 0.0, 1.0); + } + else + { + return Math.Clamp((1.0 - ms / preemptTime) * 1.5, 0.0, 1.0); + } } private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); From 5a3be778a172405402bdcaadfdfdb7bb04ce190d Mon Sep 17 00:00:00 2001 From: MBmasher Date: Fri, 12 Nov 2021 21:41:01 +1100 Subject: [PATCH 0004/2328] Resolve conflicts with recent slider hotfix --- .../Difficulty/OsuDifficultyCalculator.cs | 15 ++++++++++----- .../Difficulty/OsuPerformanceCalculator.cs | 10 ++++++++++ .../Difficulty/Skills/Flashlight.cs | 2 +- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 19e92d4365..4e916af813 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -35,8 +35,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty return new OsuDifficultyAttributes { Mods = mods, Skills = skills }; double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier; - double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier; - double flashlightRating = Math.Sqrt(skills[2].DifficultyValue()) * difficulty_multiplier; + double aimRatingNoSliders = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier; + double speedRating = Math.Sqrt(skills[2].DifficultyValue()) * difficulty_multiplier; + double flashlightRating = Math.Sqrt(skills[3].DifficultyValue()) * difficulty_multiplier; + + double sliderFactor = aimRating > 0 ? aimRatingNoSliders / aimRating : 1; if (mods.Any(h => h is OsuModRelax)) speedRating = 0.0; @@ -75,6 +78,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty AimStrain = aimRating, SpeedStrain = speedRating, FlashlightRating = flashlightRating, + SliderFactor = sliderFactor, ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5, OverallDifficulty = (80 - hitWindowGreat) / 6, DrainRate = drainRate, @@ -111,7 +115,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty return new Skill[] { - new Aim(mods), + new Aim(mods, true), + new Aim(mods, false), new Speed(mods, hitWindowGreat), new Flashlight(mods, preempt) }; @@ -124,7 +129,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty new OsuModEasy(), new OsuModHardRock(), new OsuModFlashlight(), - new OsuModHidden(), + new OsuModHidden() }; } -} +} \ No newline at end of file diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs index 817b0b63a8..f4c451f80b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs @@ -125,6 +125,16 @@ namespace osu.Game.Rulesets.Osu.Difficulty aimValue *= 1.0 + 0.04 * (12.0 - Attributes.ApproachRate); } + // We assume 15% of sliders in a map are difficult since there's no way to tell from the performance calculator. + double estimateDifficultSliders = Attributes.SliderCount * 0.15; + + if (Attributes.SliderCount > 0) + { + double estimateSliderEndsDropped = Math.Clamp(Math.Min(countOk + countMeh + countMiss, Attributes.MaxCombo - scoreMaxCombo), 0, estimateDifficultSliders); + double sliderNerfFactor = (1 - Attributes.SliderFactor) * Math.Pow(1 - estimateSliderEndsDropped / estimateDifficultSliders, 3) + Attributes.SliderFactor; + aimValue *= sliderNerfFactor; + } + aimValue *= accuracy; // It is important to also consider accuracy difficulty when doing that. aimValue *= 0.98 + Math.Pow(Attributes.OverallDifficulty, 2) / 2500; diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 55ef8db129..e0d2a084bd 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.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 System; From efac11e886f887673b36d5d42d840bc85ead9688 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Fri, 12 Nov 2021 21:42:27 +1100 Subject: [PATCH 0005/2328] Add extra bonus for hidden+flashlight --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index e0d2a084bd..caae53516d 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills this.preemptTime = preemptTime; } - private double skillMultiplier => 0.12; + private double skillMultiplier => 0.11; private double strainDecayBase => 0.15; protected override double DecayWeight => 1.0; protected override int HistoryLength => 10; // Look back for 10 notes is added for the sake of flashlight calculations. @@ -33,6 +33,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private double preemptTime; private const double max_opacity_bonus = 0.4; + private const double hidden_bonus = 0.3; private double currentStrain; @@ -81,6 +82,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills if (hidden) { result *= 1.0 + max_opacity_bonus; + // Additional bonus for Hidden due to there being no approach circles. + result *= 1.0 + hidden_bonus; } return result; From f2d05ea899ba2aaa93deb9680042c1ce6a5cba8f Mon Sep 17 00:00:00 2001 From: MBmasher Date: Wed, 17 Nov 2021 11:27:48 +1100 Subject: [PATCH 0006/2328] Remove strain being multiplied by max opacity bonus --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index caae53516d..6d6f2b0f6c 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -80,11 +80,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills result = Math.Pow(smallDistNerf * result, 2.0); - if (hidden) { - result *= 1.0 + max_opacity_bonus; - // Additional bonus for Hidden due to there being no approach circles. + // Additional bonus for Hidden due to there being no approach circles. + if (hidden) result *= 1.0 + hidden_bonus; - } return result; } From 63c5f7d9d7b16309f045fa22faf39e4809a0a631 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Wed, 17 Nov 2021 11:39:12 +1100 Subject: [PATCH 0007/2328] Balancing opacity and hidden bonus --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 6d6f2b0f6c..12580cb450 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private double preemptTime; private const double max_opacity_bonus = 0.4; - private const double hidden_bonus = 0.3; + private const double hidden_bonus = 0.4; private double currentStrain; From 6a444b9edbc2c8b780e965b08dcef1ade102e990 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Thu, 18 Nov 2021 09:47:41 +1100 Subject: [PATCH 0008/2328] Further balancing opacity/hidden bonus --- .../Difficulty/Flashlight.cs | 112 ++++++++++++++++++ .../Difficulty/Skills/Flashlight.cs | 8 +- 2 files changed, 116 insertions(+), 4 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Difficulty/Flashlight.cs diff --git a/osu.Game.Rulesets.Osu/Difficulty/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Flashlight.cs new file mode 100644 index 0000000000..da7ab3d1fc --- /dev/null +++ b/osu.Game.Rulesets.Osu/Difficulty/Flashlight.cs @@ -0,0 +1,112 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Linq; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu.Mods; +using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; +using osu.Game.Rulesets.Osu.Objects; + +namespace osu.Game.Rulesets.Osu.Difficulty.Skills +{ + /// + /// Represents the skill required to memorise and hit every object in a map with the Flashlight mod enabled. + /// + public class Flashlight : OsuStrainSkill + { + public Flashlight(Mod[] mods, double preemptTime) + : base(mods) + { + this.mods = mods; + this.preemptTime = preemptTime; + } + + private double skillMultiplier => 0.07; + private double strainDecayBase => 0.15; + protected override double DecayWeight => 1.0; + protected override int HistoryLength => 10; // Look back for 10 notes is added for the sake of flashlight calculations. + + private Mod[] mods; + private bool hidden; + private double preemptTime; + + private const double max_opacity_bonus = 1.0; + private const double hidden_bonus = 0.8; + + private double currentStrain; + + private double strainValueOf(DifficultyHitObject current) + { + if (current.BaseObject is Spinner) + return 0; + + hidden = mods.Any(m => m is OsuModHidden); + + var osuCurrent = (OsuDifficultyHitObject)current; + var osuHitObject = (OsuHitObject)(osuCurrent.BaseObject); + + double scalingFactor = 52.0 / osuHitObject.Radius; + double smallDistNerf = 1.0; + double cumulativeStrainTime = 0.0; + + double result = 0.0; + + for (int i = 0; i < Previous.Count; i++) + { + var osuPrevious = (OsuDifficultyHitObject)Previous[i]; + var osuPreviousHitObject = (OsuHitObject)(osuPrevious.BaseObject); + + if (!(osuPrevious.BaseObject is Spinner)) + { + double jumpDistance = (osuHitObject.StackedPosition - osuPreviousHitObject.EndPosition).Length; + + cumulativeStrainTime += osuPrevious.StrainTime; + + // We want to nerf objects that can be easily seen within the Flashlight circle radius. + if (i == 0) + smallDistNerf = Math.Min(1.0, jumpDistance / 75.0); + + // We also want to nerf stacks so that only the first object of the stack is accounted for. + double stackNerf = Math.Min(1.0, (osuPrevious.JumpDistance / scalingFactor) / 25.0); + + // Bonus based on how visible the object is. + double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - opacity(cumulativeStrainTime, preemptTime, hidden)); + + result += Math.Pow(0.8, i) * stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime; + } + } + + result = Math.Pow(smallDistNerf * result, 2.0); + + // Additional bonus for Hidden due to there being no approach circles. + if (hidden) + result *= 1.0 + hidden_bonus; + + return result; + } + + private double opacity(double ms, double preemptTime, bool hidden) { + if (hidden) { + return Math.Clamp(Math.Min((1 - ms / preemptTime) * 2.5, (ms / preemptTime) * (1.0 / 0.3)), 0.0, 1.0); + } + else + { + return Math.Clamp((1.0 - ms / preemptTime) * 1.5, 0.0, 1.0); + } + } + + private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); + + protected override double CalculateInitialStrain(double time) => currentStrain * strainDecay(time - Previous[0].StartTime); + + protected override double StrainValueAt(DifficultyHitObject current) + { + currentStrain *= strainDecay(current.DeltaTime); + currentStrain += strainValueOf(current) * skillMultiplier; + + return currentStrain; + } + } +} diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 12580cb450..209374714d 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.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 System; @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills this.preemptTime = preemptTime; } - private double skillMultiplier => 0.11; + private double skillMultiplier => 0.09; private double strainDecayBase => 0.15; protected override double DecayWeight => 1.0; protected override int HistoryLength => 10; // Look back for 10 notes is added for the sake of flashlight calculations. @@ -32,8 +32,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private bool hidden; private double preemptTime; - private const double max_opacity_bonus = 0.4; - private const double hidden_bonus = 0.4; + private const double max_opacity_bonus = 0.7; + private const double hidden_bonus = 0.5; private double currentStrain; From 8e8571543d526ee218cceb1c56b0ae784bc870bc Mon Sep 17 00:00:00 2001 From: MBmasher Date: Thu, 18 Nov 2021 09:48:18 +1100 Subject: [PATCH 0009/2328] Removing unnecessary file --- .../Difficulty/Flashlight.cs | 112 ------------------ 1 file changed, 112 deletions(-) delete mode 100644 osu.Game.Rulesets.Osu/Difficulty/Flashlight.cs diff --git a/osu.Game.Rulesets.Osu/Difficulty/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Flashlight.cs deleted file mode 100644 index da7ab3d1fc..0000000000 --- a/osu.Game.Rulesets.Osu/Difficulty/Flashlight.cs +++ /dev/null @@ -1,112 +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 System; -using System.Linq; -using osu.Game.Rulesets.Difficulty.Preprocessing; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Osu.Mods; -using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; -using osu.Game.Rulesets.Osu.Objects; - -namespace osu.Game.Rulesets.Osu.Difficulty.Skills -{ - /// - /// Represents the skill required to memorise and hit every object in a map with the Flashlight mod enabled. - /// - public class Flashlight : OsuStrainSkill - { - public Flashlight(Mod[] mods, double preemptTime) - : base(mods) - { - this.mods = mods; - this.preemptTime = preemptTime; - } - - private double skillMultiplier => 0.07; - private double strainDecayBase => 0.15; - protected override double DecayWeight => 1.0; - protected override int HistoryLength => 10; // Look back for 10 notes is added for the sake of flashlight calculations. - - private Mod[] mods; - private bool hidden; - private double preemptTime; - - private const double max_opacity_bonus = 1.0; - private const double hidden_bonus = 0.8; - - private double currentStrain; - - private double strainValueOf(DifficultyHitObject current) - { - if (current.BaseObject is Spinner) - return 0; - - hidden = mods.Any(m => m is OsuModHidden); - - var osuCurrent = (OsuDifficultyHitObject)current; - var osuHitObject = (OsuHitObject)(osuCurrent.BaseObject); - - double scalingFactor = 52.0 / osuHitObject.Radius; - double smallDistNerf = 1.0; - double cumulativeStrainTime = 0.0; - - double result = 0.0; - - for (int i = 0; i < Previous.Count; i++) - { - var osuPrevious = (OsuDifficultyHitObject)Previous[i]; - var osuPreviousHitObject = (OsuHitObject)(osuPrevious.BaseObject); - - if (!(osuPrevious.BaseObject is Spinner)) - { - double jumpDistance = (osuHitObject.StackedPosition - osuPreviousHitObject.EndPosition).Length; - - cumulativeStrainTime += osuPrevious.StrainTime; - - // We want to nerf objects that can be easily seen within the Flashlight circle radius. - if (i == 0) - smallDistNerf = Math.Min(1.0, jumpDistance / 75.0); - - // We also want to nerf stacks so that only the first object of the stack is accounted for. - double stackNerf = Math.Min(1.0, (osuPrevious.JumpDistance / scalingFactor) / 25.0); - - // Bonus based on how visible the object is. - double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - opacity(cumulativeStrainTime, preemptTime, hidden)); - - result += Math.Pow(0.8, i) * stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime; - } - } - - result = Math.Pow(smallDistNerf * result, 2.0); - - // Additional bonus for Hidden due to there being no approach circles. - if (hidden) - result *= 1.0 + hidden_bonus; - - return result; - } - - private double opacity(double ms, double preemptTime, bool hidden) { - if (hidden) { - return Math.Clamp(Math.Min((1 - ms / preemptTime) * 2.5, (ms / preemptTime) * (1.0 / 0.3)), 0.0, 1.0); - } - else - { - return Math.Clamp((1.0 - ms / preemptTime) * 1.5, 0.0, 1.0); - } - } - - private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); - - protected override double CalculateInitialStrain(double time) => currentStrain * strainDecay(time - Previous[0].StartTime); - - protected override double StrainValueAt(DifficultyHitObject current) - { - currentStrain *= strainDecay(current.DeltaTime); - currentStrain += strainValueOf(current) * skillMultiplier; - - return currentStrain; - } - } -} From 92cf447180144a3b2a00fff624aacd531eda8406 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Thu, 18 Nov 2021 10:32:41 +1100 Subject: [PATCH 0010/2328] Remove unnecessary braces --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 209374714d..d8e73ffad4 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -88,13 +88,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills } private double opacity(double ms, double preemptTime, bool hidden) { - if (hidden) { + if (hidden) return Math.Clamp(Math.Min((1 - ms / preemptTime) * 2.5, (ms / preemptTime) * (1.0 / 0.3)), 0.0, 1.0); - } else - { return Math.Clamp((1.0 - ms / preemptTime) * 1.5, 0.0, 1.0); - } } private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); From 30e18f16d9b6c42eec1b5cace8836cbc1151f7bf Mon Sep 17 00:00:00 2001 From: MBmasher Date: Thu, 18 Nov 2021 10:33:44 +1100 Subject: [PATCH 0011/2328] Change mods and preemptTime to readonly --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index d8e73ffad4..3ae9c0eca9 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -28,9 +28,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double DecayWeight => 1.0; protected override int HistoryLength => 10; // Look back for 10 notes is added for the sake of flashlight calculations. - private Mod[] mods; + private readonly Mod[] mods; private bool hidden; - private double preemptTime; + private readonly double preemptTime; private const double max_opacity_bonus = 0.7; private const double hidden_bonus = 0.5; From f4b23f09607ca514c62e2da8f1e8b07a707f2036 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Thu, 18 Nov 2021 10:37:07 +1100 Subject: [PATCH 0012/2328] Remove setting preempt in CreateDifficultyAttributes --- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 4e916af813..fe20ce112e 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -60,7 +60,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty double starRating = basePerformance > 0.00001 ? Math.Cbrt(1.12) * 0.027 * (Math.Cbrt(100000 / Math.Pow(2, 1 / 1.1) * basePerformance) + 4) : 0; - double preempt = IBeatmapDifficultyInfo.DifficultyRange(beatmap.Difficulty.ApproachRate, 1800, 1200, 450) / clockRate; double drainRate = beatmap.Difficulty.DrainRate; int maxCombo = beatmap.HitObjects.Count; From fe83b8fc77c8e247bcf48fe597f35a4c381b49c3 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Thu, 18 Nov 2021 10:50:32 +1100 Subject: [PATCH 0013/2328] Add line break --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 3ae9c0eca9..b45a54f9e7 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -87,7 +87,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills return result; } - private double opacity(double ms, double preemptTime, bool hidden) { + private double opacity(double ms, double preemptTime, bool hidden) + { if (hidden) return Math.Clamp(Math.Min((1 - ms / preemptTime) * 2.5, (ms / preemptTime) * (1.0 / 0.3)), 0.0, 1.0); else From abbc13c60feeaf42ddb57d21d160020fcd5c6cf7 Mon Sep 17 00:00:00 2001 From: David Paiva Date: Sat, 20 Nov 2021 12:41:01 +0000 Subject: [PATCH 0014/2328] Added Beatmap Link button to Discord Rich Presence --- osu.Desktop/DiscordRichPresence.cs | 31 +++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index e1e7e6ad18..f58633ae9e 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -47,6 +47,8 @@ namespace osu.Desktop SkipIdenticalPresence = false // handles better on discord IPC loss, see updateStatus call in onReady. }; + client.RegisterUriScheme(); + client.OnReady += onReady; // safety measure for now, until we performance test / improve backoff for failed connections. @@ -90,10 +92,22 @@ namespace osu.Desktop return; } - if (status.Value is UserStatusOnline && activity.Value != null) + if (/*status.Value is UserStatusOnline &&*/ activity.Value != null) { presence.State = truncate(activity.Value.Status); presence.Details = truncate(getDetails(activity.Value)); + + if (getOnlineID(activity.Value) != string.Empty) + { + presence.Buttons = new Button[] + { + new Button() { Label = "Beatmap Link", Url = $"https://osu.ppy.sh/b/{getOnlineID(activity.Value)}" } + }; + } + else + { + presence.Buttons = null; + } } else { @@ -109,6 +123,7 @@ namespace osu.Desktop // update ruleset presence.Assets.SmallImageKey = ruleset.Value.ID <= 3 ? $"mode_{ruleset.Value.ID}" : "mode_custom"; + presence.Assets.SmallImageText = ruleset.Value.Name; client.SetPresence(presence); @@ -152,6 +167,20 @@ namespace osu.Desktop return string.Empty; } + private string getOnlineID(UserActivity activity) + { + switch (activity) + { + case UserActivity.InGame game: + if (!(game.BeatmapInfo.OnlineID < 1)) + return game.BeatmapInfo.OnlineID.ToString(); + + return string.Empty; + } + + return string.Empty; + } + protected override void Dispose(bool isDisposing) { client.Dispose(); From e65826979e8162c92613e19df322fb3546e3c0bb Mon Sep 17 00:00:00 2001 From: David Paiva Date: Sat, 20 Nov 2021 12:41:31 +0000 Subject: [PATCH 0015/2328] Whoops, forgot that comment --- osu.Desktop/DiscordRichPresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index f58633ae9e..dd3fca095e 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -92,7 +92,7 @@ namespace osu.Desktop return; } - if (/*status.Value is UserStatusOnline &&*/ activity.Value != null) + if (status.Value is UserStatusOnline && activity.Value != null) { presence.State = truncate(activity.Value.Status); presence.Details = truncate(getDetails(activity.Value)); From 5276300c081ce7d3cfd2042d89c7189fa9866e33 Mon Sep 17 00:00:00 2001 From: David Paiva Date: Sat, 20 Nov 2021 14:11:02 +0000 Subject: [PATCH 0016/2328] Added required changes. --- osu.Desktop/DiscordRichPresence.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index dd3fca095e..d72774e96f 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -97,7 +97,7 @@ namespace osu.Desktop presence.State = truncate(activity.Value.Status); presence.Details = truncate(getDetails(activity.Value)); - if (getOnlineID(activity.Value) != string.Empty) + if (getOnlineID(activity.Value) != null) { presence.Buttons = new Button[] { @@ -167,18 +167,14 @@ namespace osu.Desktop return string.Empty; } - private string getOnlineID(UserActivity activity) + private int? getOnlineID(UserActivity activity) { - switch (activity) + if (activity is UserActivity.InGame game && game.BeatmapInfo.OnlineID > 0) { - case UserActivity.InGame game: - if (!(game.BeatmapInfo.OnlineID < 1)) - return game.BeatmapInfo.OnlineID.ToString(); - - return string.Empty; + return game.BeatmapInfo.OnlineID; } - return string.Empty; + return null; } protected override void Dispose(bool isDisposing) From 58d3e66d8b194a07a83d52e6953a99d9c52261c4 Mon Sep 17 00:00:00 2001 From: David Paiva Date: Sun, 21 Nov 2021 09:36:05 +0000 Subject: [PATCH 0017/2328] Update osu.Desktop/DiscordRichPresence.cs Co-authored-by: Salman Ahmed --- osu.Desktop/DiscordRichPresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index d72774e96f..46aa080dfe 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -101,7 +101,7 @@ namespace osu.Desktop { presence.Buttons = new Button[] { - new Button() { Label = "Beatmap Link", Url = $"https://osu.ppy.sh/b/{getOnlineID(activity.Value)}" } + new Button() { Label = "Open Beatmap", Url = $"https://osu.ppy.sh/b/{getOnlineID(activity.Value)}" } }; } else From afbec941249b1d309ed31be7fcd0e84e180805f6 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Sun, 21 Nov 2021 23:40:15 +1100 Subject: [PATCH 0018/2328] Move opacity function to OsuDifficultyHitObject --- .../Preprocessing/OsuDifficultyHitObject.cs | 11 +++++++++++ osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 10 +--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index d073d751d0..dc8188929a 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -56,12 +56,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing private readonly OsuHitObject lastLastObject; private readonly OsuHitObject lastObject; + private readonly double clockRate; public OsuDifficultyHitObject(HitObject hitObject, HitObject lastLastObject, HitObject lastObject, double clockRate) : base(hitObject, lastObject, clockRate) { this.lastLastObject = (OsuHitObject)lastLastObject; this.lastObject = (OsuHitObject)lastObject; + this.clockRate = clockRate; // Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects. StrainTime = Math.Max(DeltaTime, min_delta_time); @@ -69,6 +71,15 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing setDistances(clockRate); } + public double opacity(double ms, bool hidden) + { + double preemptTime = BaseObject.TimePreempt / clockRate; + if (hidden) + return Math.Clamp(Math.Min((1 - ms / preemptTime) * 2.5, (ms / preemptTime) * (1.0 / 0.3)), 0.0, 1.0); + else + return Math.Clamp((1.0 - ms / preemptTime) * 1.5, 0.0, 1.0); + } + private void setDistances(double clockRate) { // We don't need to calculate either angle or distance when one of the last->curr objects is a spinner diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index b45a54f9e7..701670974b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills double stackNerf = Math.Min(1.0, (osuPrevious.JumpDistance / scalingFactor) / 25.0); // Bonus based on how visible the object is. - double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - opacity(cumulativeStrainTime, preemptTime, hidden)); + double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.opacity(cumulativeStrainTime, hidden)); result += Math.Pow(0.8, i) * stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime; } @@ -87,14 +87,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills return result; } - private double opacity(double ms, double preemptTime, bool hidden) - { - if (hidden) - return Math.Clamp(Math.Min((1 - ms / preemptTime) * 2.5, (ms / preemptTime) * (1.0 / 0.3)), 0.0, 1.0); - else - return Math.Clamp((1.0 - ms / preemptTime) * 1.5, 0.0, 1.0); - } - private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); protected override double CalculateInitialStrain(double time) => currentStrain * strainDecay(time - Previous[0].StartTime); From a57c277a585573b3081f6834b1cab6f09be60cf8 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Sun, 21 Nov 2021 23:43:09 +1100 Subject: [PATCH 0019/2328] Move preempt back to CreateDifficultyAttributes --- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 6 ++---- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index fe20ce112e..14101f8302 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -22,7 +22,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty { private const double difficulty_multiplier = 0.0675; private double hitWindowGreat; - private double preempt; public OsuDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) @@ -60,6 +59,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty double starRating = basePerformance > 0.00001 ? Math.Cbrt(1.12) * 0.027 * (Math.Cbrt(100000 / Math.Pow(2, 1 / 1.1) * basePerformance) + 4) : 0; + double preempt = IBeatmapDifficultyInfo.DifficultyRange(beatmap.Difficulty.ApproachRate, 1800, 1200, 450) / clockRate; double drainRate = beatmap.Difficulty.DrainRate; int maxCombo = beatmap.HitObjects.Count; @@ -110,14 +110,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty hitWindowGreat = hitWindows.WindowFor(HitResult.Great) / clockRate; - preempt = IBeatmapDifficultyInfo.DifficultyRange(beatmap.Difficulty.ApproachRate, 1800, 1200, 450) / clockRate; - return new Skill[] { new Aim(mods, true), new Aim(mods, false), new Speed(mods, hitWindowGreat), - new Flashlight(mods, preempt) + new Flashlight(mods) }; } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 701670974b..8969e95aba 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -16,11 +16,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills /// public class Flashlight : OsuStrainSkill { - public Flashlight(Mod[] mods, double preemptTime) + public Flashlight(Mod[] mods) : base(mods) { this.mods = mods; - this.preemptTime = preemptTime; } private double skillMultiplier => 0.09; @@ -30,7 +29,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private readonly Mod[] mods; private bool hidden; - private readonly double preemptTime; private const double max_opacity_bonus = 0.7; private const double hidden_bonus = 0.5; From e9a4ee68004b998264f6577fe79050b276b7c1a0 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Sun, 21 Nov 2021 23:53:40 +1100 Subject: [PATCH 0020/2328] Cleaning up code --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 3 ++- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index dc8188929a..cc699aa3f9 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -71,9 +71,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing setDistances(clockRate); } - public double opacity(double ms, bool hidden) + public double Opacity(double ms, bool hidden) { double preemptTime = BaseObject.TimePreempt / clockRate; + if (hidden) return Math.Clamp(Math.Min((1 - ms / preemptTime) * 2.5, (ms / preemptTime) * (1.0 / 0.3)), 0.0, 1.0); else diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 8969e95aba..2523f66bf6 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills double stackNerf = Math.Min(1.0, (osuPrevious.JumpDistance / scalingFactor) / 25.0); // Bonus based on how visible the object is. - double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.opacity(cumulativeStrainTime, hidden)); + double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.Opacity(cumulativeStrainTime, hidden)); result += Math.Pow(0.8, i) * stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime; } From e9745a3ac41c93ec5860505cf833ec5618c5a177 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Mon, 22 Nov 2021 08:32:35 +1100 Subject: [PATCH 0021/2328] Fix wrong opacity formula --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index cc699aa3f9..4109c068ea 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -74,11 +74,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing public double Opacity(double ms, bool hidden) { double preemptTime = BaseObject.TimePreempt / clockRate; + double fadeInTime = BaseObject.TimeFadeIn / clockRate; if (hidden) - return Math.Clamp(Math.Min((1 - ms / preemptTime) * 2.5, (ms / preemptTime) * (1.0 / 0.3)), 0.0, 1.0); + return Math.Clamp(Math.Min((1.0 - ms / preemptTime) * 2.5, (ms / preemptTime - 0.3) * (1.0 / 0.3)), 0.0, 1.0); else - return Math.Clamp((1.0 - ms / preemptTime) * 1.5, 0.0, 1.0); + return Math.Clamp((preemptTime - ms) / fadeInTime, 0.0, 1.0); } private void setDistances(double clockRate) From 7833fab02d0f1e3add202aa2f24118b67f4f404d Mon Sep 17 00:00:00 2001 From: MBmasher Date: Mon, 22 Nov 2021 08:41:56 +1100 Subject: [PATCH 0022/2328] Balancing bonuses to adjust for corrected opacity formula --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 2523f66bf6..7518364dd1 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills this.mods = mods; } - private double skillMultiplier => 0.09; + private double skillMultiplier => 0.11; private double strainDecayBase => 0.15; protected override double DecayWeight => 1.0; protected override int HistoryLength => 10; // Look back for 10 notes is added for the sake of flashlight calculations. @@ -30,8 +30,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private readonly Mod[] mods; private bool hidden; - private const double max_opacity_bonus = 0.7; - private const double hidden_bonus = 0.5; + private const double max_opacity_bonus = 0.5; + private const double hidden_bonus = 0.1; private double currentStrain; From 65ef03034187ed9e65e288b1eee96d030eef145f Mon Sep 17 00:00:00 2001 From: MBmasher Date: Mon, 22 Nov 2021 08:59:41 +1100 Subject: [PATCH 0023/2328] Further balancing --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 7518364dd1..7b4119d354 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills this.mods = mods; } - private double skillMultiplier => 0.11; + private double skillMultiplier => 0.1; private double strainDecayBase => 0.15; protected override double DecayWeight => 1.0; protected override int HistoryLength => 10; // Look back for 10 notes is added for the sake of flashlight calculations. @@ -30,8 +30,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private readonly Mod[] mods; private bool hidden; - private const double max_opacity_bonus = 0.5; - private const double hidden_bonus = 0.1; + private const double max_opacity_bonus = 0.4; + private const double hidden_bonus = 0.2; private double currentStrain; From 383bf7cdfc7f71d3528ad054fcfd7c16aef751ff Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 30 Nov 2021 10:39:48 +0900 Subject: [PATCH 0024/2328] Only allow HD combination alongside FL --- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 1b6eb2915b..79314344ea 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -125,7 +125,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty new OsuModEasy(), new OsuModHardRock(), new OsuModFlashlight(), - new OsuModHidden() + new MultiMod(new OsuModFlashlight(), new OsuModHidden()) }; } -} \ No newline at end of file +} From b0dc8bf0616cbf5ac9cb07edc8f26a7b33845223 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Tue, 30 Nov 2021 12:58:49 +1100 Subject: [PATCH 0025/2328] Change Opacity function to take in absolute map time rather than relative time --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 5 ++++- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 4109c068ea..c94fd10db5 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -71,8 +71,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing setDistances(clockRate); } - public double Opacity(double ms, bool hidden) + public double Opacity(double T, bool hidden) { + double ms = (BaseObject.StartTime - T) / clockRate; + if (ms < 0) + return 0.0; double preemptTime = BaseObject.TimePreempt / clockRate; double fadeInTime = BaseObject.TimeFadeIn / clockRate; diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 7b4119d354..d7f515602e 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills double stackNerf = Math.Min(1.0, (osuPrevious.JumpDistance / scalingFactor) / 25.0); // Bonus based on how visible the object is. - double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.Opacity(cumulativeStrainTime, hidden)); + double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.Opacity(osuPreviousHitObject.StartTime, hidden)); result += Math.Pow(0.8, i) * stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime; } From 3339afd6485270b4b3ac9db1d1dbffe599dc31da Mon Sep 17 00:00:00 2001 From: MBmasher Date: Tue, 30 Nov 2021 13:52:58 +1100 Subject: [PATCH 0026/2328] Change input variable name in Opacity function --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index c94fd10db5..7ab12f109f 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -71,9 +71,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing setDistances(clockRate); } - public double Opacity(double T, bool hidden) + public double Opacity(double mapTime, bool hidden) { - double ms = (BaseObject.StartTime - T) / clockRate; + double ms = (BaseObject.StartTime - mapTime) / clockRate; if (ms < 0) return 0.0; double preemptTime = BaseObject.TimePreempt / clockRate; From 5884b058b9f15ab2d518316d5e62c690431367b0 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Tue, 30 Nov 2021 13:54:41 +1100 Subject: [PATCH 0027/2328] Add blank line --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 7ab12f109f..a497c95990 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -76,6 +76,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing double ms = (BaseObject.StartTime - mapTime) / clockRate; if (ms < 0) return 0.0; + double preemptTime = BaseObject.TimePreempt / clockRate; double fadeInTime = BaseObject.TimeFadeIn / clockRate; From 9824d805eac344ab727d87d2b269ac0fca34d6b2 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Tue, 30 Nov 2021 14:36:38 +1100 Subject: [PATCH 0028/2328] Remove unnecessary clockRate in Opacity function --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index a497c95990..dacbb4c51f 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -56,14 +56,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing private readonly OsuHitObject lastLastObject; private readonly OsuHitObject lastObject; - private readonly double clockRate; public OsuDifficultyHitObject(HitObject hitObject, HitObject lastLastObject, HitObject lastObject, double clockRate) : base(hitObject, lastObject, clockRate) { this.lastLastObject = (OsuHitObject)lastLastObject; this.lastObject = (OsuHitObject)lastObject; - this.clockRate = clockRate; // Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects. StrainTime = Math.Max(DeltaTime, min_delta_time); @@ -73,12 +71,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing public double Opacity(double mapTime, bool hidden) { - double ms = (BaseObject.StartTime - mapTime) / clockRate; + double ms = BaseObject.StartTime - mapTime; if (ms < 0) return 0.0; - double preemptTime = BaseObject.TimePreempt / clockRate; - double fadeInTime = BaseObject.TimeFadeIn / clockRate; + double preemptTime = BaseObject.TimePreempt; + double fadeInTime = BaseObject.TimeFadeIn; if (hidden) return Math.Clamp(Math.Min((1.0 - ms / preemptTime) * 2.5, (ms / preemptTime - 0.3) * (1.0 / 0.3)), 0.0, 1.0); From a7aea49cb38be1108d91bcc884a25b9526019ee4 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Tue, 21 Dec 2021 20:06:07 +1100 Subject: [PATCH 0029/2328] Rename `osuPreviousHitObject` to `currentHitObject` --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 76ce6dc057..1a707b26b5 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills double stackNerf = Math.Min(1.0, (currentObj.LazyJumpDistance / scalingFactor) / 25.0); // Bonus based on how visible the object is. - double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.Opacity(osuPreviousHitObject.StartTime, hidden)); + double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.Opacity(currentHitObject.StartTime, hidden)); result += stackNerf * scalingFactor * jumpDistance / cumulativeStrainTime; } From 3d3de00581648712338aa5237926a143f8275710 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Tue, 21 Dec 2021 20:06:53 +1100 Subject: [PATCH 0030/2328] Move `hidden` initialisation to Flashlight constructor --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 1a707b26b5..3b23ec505b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -20,6 +20,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills : base(mods) { this.mods = mods; + this.hidden = mods.Any(m => m is OsuModHidden); } private double skillMultiplier => 0.1; @@ -40,8 +41,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills if (current.BaseObject is Spinner) return 0; - hidden = mods.Any(m => m is OsuModHidden); - var osuCurrent = (OsuDifficultyHitObject)current; var osuHitObject = (OsuHitObject)(osuCurrent.BaseObject); From 5d8968498cacbadfa704f4aa730652d6a6709228 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Tue, 21 Dec 2021 20:08:57 +1100 Subject: [PATCH 0031/2328] Adjust `skillMultiplier` after merging #15728, #15867 --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 3b23ec505b..266f4e8960 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills this.hidden = mods.Any(m => m is OsuModHidden); } - private double skillMultiplier => 0.1; + private double skillMultiplier => 0.05; private double strainDecayBase => 0.15; protected override double DecayWeight => 1.0; protected override int HistoryLength => 10; // Look back for 10 notes is added for the sake of flashlight calculations. From c5de203aa5258b66a2b7067c6306c12b75e158f3 Mon Sep 17 00:00:00 2001 From: MBmasher Date: Tue, 21 Dec 2021 20:10:19 +1100 Subject: [PATCH 0032/2328] Multiply `opacityBonus` to base strain --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 266f4e8960..8b2e66e0a7 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills // Bonus based on how visible the object is. double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.Opacity(currentHitObject.StartTime, hidden)); - result += stackNerf * scalingFactor * jumpDistance / cumulativeStrainTime; + result += stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime; } lastObj = currentObj; From 2aafcd3628463ccd2c5c0c8c88b32495ebc8694c Mon Sep 17 00:00:00 2001 From: MBmasher Date: Tue, 21 Dec 2021 20:58:05 +1100 Subject: [PATCH 0033/2328] Refactor code regarding `hidden` boolean --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 8b2e66e0a7..5d2052046b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -19,8 +19,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills public Flashlight(Mod[] mods) : base(mods) { - this.mods = mods; - this.hidden = mods.Any(m => m is OsuModHidden); + hidden = mods.Any(m => m is OsuModHidden); } private double skillMultiplier => 0.05; @@ -28,8 +27,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double DecayWeight => 1.0; protected override int HistoryLength => 10; // Look back for 10 notes is added for the sake of flashlight calculations. - private readonly Mod[] mods; - private bool hidden; + private readonly bool hidden; private const double max_opacity_bonus = 0.4; private const double hidden_bonus = 0.2; From f3eaa950416971ccfd10f8e492c4b8b61b53e92d Mon Sep 17 00:00:00 2001 From: Susko3 <16479013+Susko3@users.noreply.github.com> Date: Fri, 14 Jan 2022 23:16:07 +0100 Subject: [PATCH 0034/2328] Move input handler settings creation to `OsuGameBase` --- osu.Desktop/OsuGameDesktop.cs | 25 +++++++++++ osu.Game/OsuGameBase.cs | 21 ++++++++++ .../Settings/Sections/InputSection.cs | 41 ++----------------- 3 files changed, 49 insertions(+), 38 deletions(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index b234207848..a0c2a80bb8 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -20,8 +20,15 @@ using osu.Framework.Screens; using osu.Game.Screens.Menu; using osu.Game.Updater; using osu.Desktop.Windows; +using osu.Framework.Input.Handlers; +using osu.Framework.Input.Handlers.Joystick; +using osu.Framework.Input.Handlers.Mouse; +using osu.Framework.Input.Handlers.Tablet; using osu.Framework.Threading; using osu.Game.IO; +using osu.Game.Overlays.Settings; +using osu.Game.Overlays.Settings.Sections; +using osu.Game.Overlays.Settings.Sections.Input; namespace osu.Desktop { @@ -156,6 +163,24 @@ namespace osu.Desktop desktopWindow.DragDrop += f => fileDrop(new[] { f }); } + public override SettingsSubsection CreateSettingsSubsectionFor(InputHandler handler) + { + switch (handler) + { + case ITabletHandler th: + return new TabletSettings(th); + + case MouseHandler mh: + return new MouseSettings(mh); + + case JoystickHandler _: + return new InputSection.HandlerSection(handler); + + default: + return base.CreateSettingsSubsectionFor(handler); + } + } + private readonly List importableFiles = new List(); private ScheduledDelegate importSchedule; diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 9256514a0a..0059fc2204 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -17,6 +17,8 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Performance; using osu.Framework.Graphics.Textures; using osu.Framework.Input; +using osu.Framework.Input.Handlers; +using osu.Framework.Input.Handlers.Midi; using osu.Framework.IO.Stores; using osu.Framework.Logging; using osu.Framework.Platform; @@ -35,6 +37,8 @@ using osu.Game.Online.Chat; using osu.Game.Online.Multiplayer; using osu.Game.Online.Spectator; using osu.Game.Overlays; +using osu.Game.Overlays.Settings; +using osu.Game.Overlays.Settings.Sections; using osu.Game.Resources; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; @@ -448,6 +452,23 @@ namespace osu.Game protected override Storage CreateStorage(GameHost host, Storage defaultStorage) => new OsuStorage(host, defaultStorage); + /// + /// Creates an input settings subsection for an . + /// + /// Should be overriden per-platform to provide settings for platform-specific handlers. + public virtual SettingsSubsection CreateSettingsSubsectionFor(InputHandler handler) + { + switch (handler) + { + case MidiHandler _: + return new InputSection.HandlerSection(handler); + + // return null for handlers that shouldn't have settings. + default: + return null; + } + } + private void onRulesetChanged(ValueChangedEvent r) { if (r.NewValue?.Available != true) diff --git a/osu.Game/Overlays/Settings/Sections/InputSection.cs b/osu.Game/Overlays/Settings/Sections/InputSection.cs index d282ba5318..77076ae920 100644 --- a/osu.Game/Overlays/Settings/Sections/InputSection.cs +++ b/osu.Game/Overlays/Settings/Sections/InputSection.cs @@ -5,10 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Handlers; -using osu.Framework.Input.Handlers.Joystick; -using osu.Framework.Input.Handlers.Midi; -using osu.Framework.Input.Handlers.Mouse; -using osu.Framework.Input.Handlers.Tablet; using osu.Framework.Localisation; using osu.Framework.Platform; using osu.Game.Localisation; @@ -22,9 +18,6 @@ namespace osu.Game.Overlays.Settings.Sections public override LocalisableString Header => InputSettingsStrings.InputSectionHeader; - [Resolved] - private GameHost host { get; set; } - public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.Solid.Keyboard @@ -36,7 +29,7 @@ namespace osu.Game.Overlays.Settings.Sections } [BackgroundDependencyLoader] - private void load() + private void load(GameHost host, OsuGameBase game) { Children = new Drawable[] { @@ -45,42 +38,14 @@ namespace osu.Game.Overlays.Settings.Sections foreach (var handler in host.AvailableInputHandlers) { - var handlerSection = createSectionFor(handler); + var handlerSection = game.CreateSettingsSubsectionFor(handler); if (handlerSection != null) Add(handlerSection); } } - private SettingsSubsection createSectionFor(InputHandler handler) - { - SettingsSubsection section; - - switch (handler) - { - // ReSharper disable once SuspiciousTypeConversion.Global (net standard fuckery) - case ITabletHandler th: - section = new TabletSettings(th); - break; - - case MouseHandler mh: - section = new MouseSettings(mh); - break; - - // whitelist the handlers which should be displayed to avoid any weird cases of users touching settings they shouldn't. - case JoystickHandler _: - case MidiHandler _: - section = new HandlerSection(handler); - break; - - default: - return null; - } - - return section; - } - - private class HandlerSection : SettingsSubsection + public class HandlerSection : SettingsSubsection { private readonly InputHandler handler; From 037e56f13eca292e9b8b4a43a0eb4da262ac0fa8 Mon Sep 17 00:00:00 2001 From: Susko3 <16479013+Susko3@users.noreply.github.com> Date: Sat, 15 Jan 2022 14:38:38 +0100 Subject: [PATCH 0035/2328] Add Android mouse settings --- osu.Android/AndroidMouseSettings.cs | 97 +++++++++++++++++++ osu.Android/OsuGameAndroid.cs | 22 +++++ osu.Android/osu.Android.csproj | 1 + .../Settings/Sections/Input/MouseSettings.cs | 4 +- 4 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 osu.Android/AndroidMouseSettings.cs diff --git a/osu.Android/AndroidMouseSettings.cs b/osu.Android/AndroidMouseSettings.cs new file mode 100644 index 0000000000..7dff929cd4 --- /dev/null +++ b/osu.Android/AndroidMouseSettings.cs @@ -0,0 +1,97 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Android.OS; +using osu.Framework.Allocation; +using osu.Framework.Android.Input; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Localisation; +using osu.Game.Configuration; +using osu.Game.Localisation; +using osu.Game.Overlays.Settings; +using osu.Game.Overlays.Settings.Sections.Input; + +namespace osu.Android +{ + public class AndroidMouseSettings : SettingsSubsection + { + private readonly AndroidMouseHandler mouseHandler; + + protected override LocalisableString Header => MouseSettingsStrings.Mouse; + + private Bindable handlerSensitivity; + + private Bindable localSensitivity; + + private Bindable relativeMode; + + public AndroidMouseSettings(AndroidMouseHandler mouseHandler) + { + this.mouseHandler = mouseHandler; + } + + [BackgroundDependencyLoader] + private void load(OsuConfigManager osuConfig) + { + // use local bindable to avoid changing enabled state of game host's bindable. + handlerSensitivity = mouseHandler.Sensitivity.GetBoundCopy(); + localSensitivity = handlerSensitivity.GetUnboundCopy(); + + relativeMode = mouseHandler.UseRelativeMode.GetBoundCopy(); + + // High precision/pointer capture is only available on Android 8.0 and up + if (Build.VERSION.SdkInt >= BuildVersionCodes.O) + { + AddRange(new Drawable[] + { + new SettingsCheckbox + { + LabelText = MouseSettingsStrings.HighPrecisionMouse, + TooltipText = MouseSettingsStrings.HighPrecisionMouseTooltip, + Current = relativeMode, + Keywords = new[] { @"raw", @"input", @"relative", @"cursor", @"captured", @"pointer" }, + }, + new MouseSettings.SensitivitySetting + { + LabelText = MouseSettingsStrings.CursorSensitivity, + Current = localSensitivity, + }, + }); + } + + AddRange(new Drawable[] + { + new SettingsCheckbox + { + LabelText = MouseSettingsStrings.DisableMouseWheelVolumeAdjust, + TooltipText = MouseSettingsStrings.DisableMouseWheelVolumeAdjustTooltip, + Current = osuConfig.GetBindable(OsuSetting.MouseDisableWheel), + }, + new SettingsCheckbox + { + LabelText = MouseSettingsStrings.DisableMouseButtons, + Current = osuConfig.GetBindable(OsuSetting.MouseDisableButtons), + }, + }); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + relativeMode.BindValueChanged(relative => localSensitivity.Disabled = !relative.NewValue, true); + + handlerSensitivity.BindValueChanged(val => + { + bool disabled = localSensitivity.Disabled; + + localSensitivity.Disabled = false; + localSensitivity.Value = val.NewValue; + localSensitivity.Disabled = disabled; + }, true); + + localSensitivity.BindValueChanged(val => handlerSensitivity.Value = val.NewValue); + } + } +} diff --git a/osu.Android/OsuGameAndroid.cs b/osu.Android/OsuGameAndroid.cs index 050bf2b787..ba2527d71e 100644 --- a/osu.Android/OsuGameAndroid.cs +++ b/osu.Android/OsuGameAndroid.cs @@ -5,7 +5,11 @@ using System; using Android.App; using Android.OS; using osu.Framework.Allocation; +using osu.Framework.Android.Input; +using osu.Framework.Input.Handlers; +using osu.Framework.Platform; using osu.Game; +using osu.Game.Overlays.Settings; using osu.Game.Updater; using osu.Game.Utils; using Xamarin.Essentials; @@ -73,10 +77,28 @@ namespace osu.Android LoadComponentAsync(new GameplayScreenRotationLocker(), Add); } + public override void SetHost(GameHost host) + { + base.SetHost(host); + host.Window.CursorState |= CursorState.Hidden; + } + protected override UpdateManager CreateUpdateManager() => new SimpleUpdateManager(); protected override BatteryInfo CreateBatteryInfo() => new AndroidBatteryInfo(); + public override SettingsSubsection CreateSettingsSubsectionFor(InputHandler handler) + { + switch (handler) + { + case AndroidMouseHandler mh: + return new AndroidMouseSettings(mh); + + default: + return base.CreateSettingsSubsectionFor(handler); + } + } + private class AndroidBatteryInfo : BatteryInfo { public override double ChargeLevel => Battery.ChargeLevel; diff --git a/osu.Android/osu.Android.csproj b/osu.Android/osu.Android.csproj index fc50ca9fa1..90b02c527b 100644 --- a/osu.Android/osu.Android.csproj +++ b/osu.Android/osu.Android.csproj @@ -26,6 +26,7 @@ true + diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 4235dc0a05..6bb97c1137 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -124,7 +124,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input }, true); } - private class SensitivitySetting : SettingsSlider + public class SensitivitySetting : SettingsSlider { public SensitivitySetting() { @@ -133,7 +133,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input } } - private class SensitivitySlider : OsuSliderBar + public class SensitivitySlider : OsuSliderBar { public override LocalisableString TooltipText => Current.Disabled ? MouseSettingsStrings.EnableHighPrecisionForSensitivityAdjust : $"{base.TooltipText}x"; } From d4af8498af6795213d648844d1c11da99f65f4e6 Mon Sep 17 00:00:00 2001 From: Susko3 <16479013+Susko3@users.noreply.github.com> Date: Sat, 15 Jan 2022 14:48:41 +0100 Subject: [PATCH 0036/2328] Add iOS mouse settings Functionality is currently limited to some OsuSettings, but will expand in the future when high precision mouse is added. --- osu.iOS/IOSMouseSettings.cs | 36 ++++++++++++++++++++++++++++++++++++ osu.iOS/OsuGameIOS.cs | 15 +++++++++++++++ osu.iOS/osu.iOS.csproj | 1 + 3 files changed, 52 insertions(+) create mode 100644 osu.iOS/IOSMouseSettings.cs diff --git a/osu.iOS/IOSMouseSettings.cs b/osu.iOS/IOSMouseSettings.cs new file mode 100644 index 0000000000..1979a881f7 --- /dev/null +++ b/osu.iOS/IOSMouseSettings.cs @@ -0,0 +1,36 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Localisation; +using osu.Game.Configuration; +using osu.Game.Localisation; +using osu.Game.Overlays.Settings; + +namespace osu.iOS +{ + public class IOSMouseSettings : SettingsSubsection + { + protected override LocalisableString Header => MouseSettingsStrings.Mouse; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager osuConfig) + { + Children = new Drawable[] + { + new SettingsCheckbox + { + LabelText = MouseSettingsStrings.DisableMouseWheelVolumeAdjust, + TooltipText = MouseSettingsStrings.DisableMouseWheelVolumeAdjustTooltip, + Current = osuConfig.GetBindable(OsuSetting.MouseDisableWheel), + }, + new SettingsCheckbox + { + LabelText = MouseSettingsStrings.DisableMouseButtons, + Current = osuConfig.GetBindable(OsuSetting.MouseDisableButtons), + }, + }; + } + } +} diff --git a/osu.iOS/OsuGameIOS.cs b/osu.iOS/OsuGameIOS.cs index 702aef45f5..c3f7033752 100644 --- a/osu.iOS/OsuGameIOS.cs +++ b/osu.iOS/OsuGameIOS.cs @@ -3,7 +3,10 @@ using System; using Foundation; +using osu.Framework.Input.Handlers; +using osu.Framework.iOS.Input; using osu.Game; +using osu.Game.Overlays.Settings; using osu.Game.Updater; using osu.Game.Utils; using Xamarin.Essentials; @@ -18,6 +21,18 @@ namespace osu.iOS protected override BatteryInfo CreateBatteryInfo() => new IOSBatteryInfo(); + public override SettingsSubsection CreateSettingsSubsectionFor(InputHandler handler) + { + switch (handler) + { + case IOSMouseHandler _: + return new IOSMouseSettings(); + + default: + return base.CreateSettingsSubsectionFor(handler); + } + } + private class IOSBatteryInfo : BatteryInfo { public override double ChargeLevel => Battery.ChargeLevel; diff --git a/osu.iOS/osu.iOS.csproj b/osu.iOS/osu.iOS.csproj index 1203c3659b..b9da874f30 100644 --- a/osu.iOS/osu.iOS.csproj +++ b/osu.iOS/osu.iOS.csproj @@ -23,6 +23,7 @@ + From 19ee05c232eb86710001bdad3bef2e135f7bc97a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 17 Jan 2022 20:09:02 +0300 Subject: [PATCH 0037/2328] Add "distance spacing" multiplier for osu! ruleset While osu!catch also implements a distance snap grid, it doesn't rely on `GetBeatSnapDistanceAt` (unlike osu!), therefore it can't have the "distance spacing" multiplier yet. --- .../Edit/CatchHitObjectComposer.cs | 2 + .../Edit/ManiaHitObjectComposer.cs | 2 + .../Edit/OsuHitObjectComposer.cs | 2 + .../Edit/TaikoHitObjectComposer.cs | 2 + .../UserInterface/ExpandableSlider.cs | 9 ++ osu.Game/Rulesets/Edit/HitObjectComposer.cs | 101 +++++++++++++++++- 6 files changed, 116 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs index 164f465438..19595de3b1 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs @@ -32,6 +32,8 @@ namespace osu.Game.Rulesets.Catch.Edit private readonly Bindable distanceSnapToggle = new Bindable(); + protected override bool SupportsDistanceSpacing => false; + private InputManager inputManager; public CatchHitObjectComposer(CatchRuleset ruleset) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 2baec95c94..5752f9f014 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -26,6 +26,8 @@ namespace osu.Game.Rulesets.Mania.Edit private ManiaBeatSnapGrid beatSnapGrid; private InputManager inputManager; + protected override bool SupportsDistanceSpacing => false; + public ManiaHitObjectComposer(Ruleset ruleset) : base(ruleset) { diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 1e84ec80e1..e7eabdc748 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -26,6 +26,8 @@ namespace osu.Game.Rulesets.Osu.Edit { public class OsuHitObjectComposer : HitObjectComposer { + protected override bool SupportsDistanceSpacing => true; + public OsuHitObjectComposer(Ruleset ruleset) : base(ruleset) { diff --git a/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs b/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs index 161799c980..af9bc6c3a3 100644 --- a/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs +++ b/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs @@ -11,6 +11,8 @@ namespace osu.Game.Rulesets.Taiko.Edit { public class TaikoHitObjectComposer : HitObjectComposer { + protected override bool SupportsDistanceSpacing => false; + public TaikoHitObjectComposer(TaikoRuleset ruleset) : base(ruleset) { diff --git a/osu.Game/Graphics/UserInterface/ExpandableSlider.cs b/osu.Game/Graphics/UserInterface/ExpandableSlider.cs index 60e83f9c81..a05c0cfab0 100644 --- a/osu.Game/Graphics/UserInterface/ExpandableSlider.cs +++ b/osu.Game/Graphics/UserInterface/ExpandableSlider.cs @@ -70,6 +70,15 @@ namespace osu.Game.Graphics.UserInterface set => slider.Current = value; } + /// + /// A custom step value for each key press which actuates a change on this control. + /// + public float KeyboardStep + { + get => slider.KeyboardStep; + set => slider.KeyboardStep = value; + } + public BindableBool Expanded { get; } = new BindableBool(); public override bool HandlePositionalInput => true; diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 39783cc8bb..528ba2fb8b 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -14,6 +14,8 @@ using osu.Framework.Input.Events; using osu.Framework.Logging; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Settings.Sections; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Mods; @@ -56,6 +58,26 @@ namespace osu.Game.Rulesets.Edit [Resolved] protected IBeatSnapProvider BeatSnapProvider { get; private set; } + /// + /// Whether this composer supports a "distance spacing" multiplier for distance snap grids. + /// + /// + /// Setting this to displays a "distance spacing" slider and allows this composer to configure the value of . + /// + protected abstract bool SupportsDistanceSpacing { get; } + + private readonly BindableFloat distanceSpacing = new BindableFloat + { + Default = 1.0f, + MinValue = 0.1f, + MaxValue = 6.0f, + Precision = 0.01f, + }; + + public override IBindable DistanceSpacingMultiplier => distanceSpacing; + + private SnappingToolboxContainer snappingToolboxContainer; + protected ComposeBlueprintContainer BlueprintContainer { get; private set; } private DrawableEditorRulesetWrapper drawableRulesetWrapper; @@ -117,6 +139,8 @@ namespace osu.Game.Rulesets.Edit }, new LeftToolboxFlow { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, Children = new Drawable[] { new EditorToolboxGroup("toolbox (1-9)") @@ -132,11 +156,41 @@ namespace osu.Game.Rulesets.Edit Direction = FillDirection.Vertical, Spacing = new Vector2(0, 5), }, - } + }, } }, }; + distanceSpacing.Value = (float)EditorBeatmap.BeatmapInfo.DistanceSpacing; + + if (SupportsDistanceSpacing) + { + ExpandableSlider distanceSpacingSlider; + + AddInternal(snappingToolboxContainer = new SnappingToolboxContainer + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Child = new EditorToolboxGroup("snapping") + { + Child = distanceSpacingSlider = new ExpandableSlider + { + Current = { BindTarget = distanceSpacing }, + KeyboardStep = 0.01f, + } + } + }); + + distanceSpacing.BindValueChanged(v => + { + distanceSpacingSlider.ContractedLabelText = $"D. S. ({v.NewValue:0.##x})"; + distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({v.NewValue:0.##x})"; + EditorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue; + }, true); + } + else + distanceSpacing.Disabled = true; + toolboxCollection.Items = CompositionTools .Prepend(new SelectTool()) .Select(t => new RadioButton(t.Name, () => toolSelected(t), t.CreateIcon)) @@ -211,8 +265,17 @@ namespace osu.Game.Rulesets.Edit #region Tool selection logic + private bool distanceSpacingScrollActive; + protected override bool OnKeyDown(KeyDownEvent e) { + if (SupportsDistanceSpacing && e.AltPressed && e.Key == Key.D && !e.Repeat) + { + snappingToolboxContainer.Expanded.Value = true; + distanceSpacingScrollActive = true; + return true; + } + if (e.ControlPressed || e.AltPressed || e.SuperPressed) return false; @@ -242,6 +305,28 @@ namespace osu.Game.Rulesets.Edit return base.OnKeyDown(e); } + protected override void OnKeyUp(KeyUpEvent e) + { + if (distanceSpacingScrollActive && (e.Key == Key.AltLeft || e.Key == Key.AltRight || e.Key == Key.D)) + { + snappingToolboxContainer.Expanded.Value = false; + distanceSpacingScrollActive = false; + } + + base.OnKeyUp(e); + } + + protected override bool OnScroll(ScrollEvent e) + { + if (distanceSpacingScrollActive) + { + distanceSpacing.Value += e.ScrollDelta.Y * (e.ShiftPressed || e.IsPrecise ? 0.01f : 0.1f); + return true; + } + + return base.OnScroll(e); + } + private bool checkLeftToggleFromKey(Key key, out int index) { if (key < Key.Number1 || key > Key.Number9) @@ -383,7 +468,7 @@ namespace osu.Game.Rulesets.Edit public override float GetBeatSnapDistanceAt(HitObject referenceObject) { - return (float)(100 * EditorBeatmap.Difficulty.SliderMultiplier * referenceObject.DifficultyControlPoint.SliderVelocity / BeatSnapProvider.BeatDivisor); + return (float)(100 * referenceObject.DifficultyControlPoint.SliderVelocity * EditorBeatmap.Difficulty.SliderMultiplier * distanceSpacing.Value / BeatSnapProvider.BeatDivisor); } public override float DurationToDistance(HitObject referenceObject, double duration) @@ -432,6 +517,18 @@ namespace osu.Game.Rulesets.Edit FillFlow.Spacing = new Vector2(10); } } + + private class SnappingToolboxContainer : ExpandingContainer + { + public SnappingToolboxContainer() + : base(130, 250) + { + RelativeSizeAxes = Axes.Y; + Padding = new MarginPadding { Left = 10 }; + + FillFlow.Spacing = new Vector2(10); + } + } } /// From 528dc03b8c06b94d1b45c0d07e8b681ba109fe00 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 18 Jan 2022 15:25:32 +0300 Subject: [PATCH 0038/2328] Expose distance spacing in `IPositionSnapProvider` for updating distance grid Alternate method is to expose a `SnapDistancesChanged` event in `IPositionSnapProvider` instead, but I chose this way as an analogue to `IBeatSnapProvider.BeatDivisor`, which might even make sense to be exposed as `BindableBeatDivisor` instead of caching that separately. --- .../Editor/TestSceneManiaBeatSnapGrid.cs | 3 +++ .../Editor/TestSceneOsuDistanceSnapGrid.cs | 3 +++ .../Visual/Editing/TestSceneDistanceSnapGrid.cs | 3 +++ osu.Game/Rulesets/Edit/HitObjectComposer.cs | 2 ++ osu.Game/Rulesets/Edit/IPositionSnapProvider.cs | 8 ++++++++ .../Screens/Edit/Compose/Components/DistanceSnapGrid.cs | 6 ++++++ .../Screens/Edit/Compose/Components/Timeline/Timeline.cs | 2 ++ 7 files changed, 27 insertions(+) diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs index 50be13c4e0..38779ab47b 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Framework.Timing; @@ -98,6 +99,8 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor set => InternalChild = value; } + public override IBindable DistanceSpacingMultiplier => throw new System.NotImplementedException(); + public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) { throw new System.NotImplementedException(); diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs index c770e2d96f..c5829d5351 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs @@ -4,6 +4,7 @@ using System; using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -186,6 +187,8 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); + public IBindable DistanceSpacingMultiplier { get; } = new BindableFloat(1); + public float GetBeatSnapDistanceAt(HitObject referenceObject) => (float)beat_length; public float DurationToDistance(HitObject referenceObject, double duration) => (float)duration; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs index 0d9e06e471..cba6d7692d 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs @@ -3,6 +3,7 @@ using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps.ControlPoints; @@ -166,6 +167,8 @@ namespace osu.Game.Tests.Visual.Editing public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); + public IBindable DistanceSpacingMultiplier { get; } = new BindableFloat(1); + public float GetBeatSnapDistanceAt(HitObject referenceObject) => 10; public float DurationToDistance(HitObject referenceObject, double duration) => (float)duration; diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 528ba2fb8b..6cdc2699aa 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -563,6 +563,8 @@ namespace osu.Game.Rulesets.Edit #region IPositionSnapProvider + public abstract IBindable DistanceSpacingMultiplier { get; } + public abstract SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition); public virtual SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) => diff --git a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs index 743a2f41fc..1cfcb86e10 100644 --- a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Bindables; +using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using osuTK; @@ -8,6 +10,12 @@ namespace osu.Game.Rulesets.Edit { public interface IPositionSnapProvider { + /// + /// The spacing multiplier applied to beat snap distances. + /// + /// + IBindable DistanceSpacingMultiplier { get; } + /// /// Given a position, find a valid time and position snap. /// diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index 05bf405f3c..afbe83ec83 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; @@ -52,6 +53,8 @@ namespace osu.Game.Screens.Edit.Compose.Components [Resolved] private BindableBeatDivisor beatDivisor { get; set; } + private IBindable distanceSpacingMultiplier; + private readonly LayoutValue gridCache = new LayoutValue(Invalidation.RequiredParentSizeToFit); private readonly double? endTime; @@ -82,6 +85,9 @@ namespace osu.Game.Screens.Edit.Compose.Components base.LoadComplete(); beatDivisor.BindValueChanged(_ => updateSpacing(), true); + + distanceSpacingMultiplier = SnapProvider.DistanceSpacingMultiplier.GetBoundCopy(); + distanceSpacingMultiplier.BindValueChanged(_ => updateSpacing(), true); } private void updateSpacing() diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index 51cca4ceff..f3a328c6bc 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -317,6 +317,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline private double getTimeFromPosition(Vector2 localPosition) => (localPosition.X / Content.DrawWidth) * track.Length; + public IBindable DistanceSpacingMultiplier => throw new NotImplementedException(); + public float GetBeatSnapDistanceAt(HitObject referenceObject) => throw new NotImplementedException(); public float DurationToDistance(HitObject referenceObject, double duration) => throw new NotImplementedException(); From 9504942cfda38af4e6c5c15450a8258f1082de8c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 18 Jan 2022 18:30:31 +0300 Subject: [PATCH 0039/2328] Add test case for distance spacing hotkeys scrolling behaviour --- .../Editing/TestSceneHitObjectComposer.cs | 24 +++++++++++++++++++ osu.Game/Overlays/SettingsToolboxGroup.cs | 7 ++++++ 2 files changed, 31 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs index 145d738f60..7ac511e761 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs @@ -8,6 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Edit; @@ -21,6 +22,7 @@ using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Components.RadioButtons; using osu.Game.Screens.Edit.Compose.Components; using osuTK; +using osuTK.Input; namespace osu.Game.Tests.Visual.Editing { @@ -86,6 +88,28 @@ namespace osu.Game.Tests.Visual.Editing AddAssert("Tool changed", () => hitObjectComposer.ChildrenOfType().First().CurrentTool is HitCircleCompositionTool); } + [Test] + public void TestDistanceSpacingHotkeys() + { + float originalSpacing = 0; + + AddStep("retrieve original spacing", () => originalSpacing = (float)editorBeatmap.BeatmapInfo.DistanceSpacing); + + AddStep("hold alt", () => InputManager.PressKey(Key.LAlt)); + AddStep("hold D", () => InputManager.PressKey(Key.D)); + + AddStep("scroll mouse 5 steps", () => InputManager.ScrollVerticalBy(5)); + AddAssert("distance spacing increased by 0.5", () => Precision.AlmostEquals(editorBeatmap.BeatmapInfo.DistanceSpacing, originalSpacing + 0.5f)); + + AddStep("hold shift", () => InputManager.PressKey(Key.LShift)); + AddStep("scroll mouse 5 steps", () => InputManager.ScrollVerticalBy(5)); + AddAssert("distance spacing increased by 0.05", () => Precision.AlmostEquals(editorBeatmap.BeatmapInfo.DistanceSpacing, originalSpacing + 0.55f)); + + AddStep("release shift", () => InputManager.ReleaseKey(Key.LShift)); + AddStep("release alt", () => InputManager.ReleaseKey(Key.LAlt)); + AddStep("release D", () => InputManager.ReleaseKey(Key.D)); + } + public class EditorBeatmapContainer : Container { private readonly IWorkingBeatmap working; diff --git a/osu.Game/Overlays/SettingsToolboxGroup.cs b/osu.Game/Overlays/SettingsToolboxGroup.cs index 08321f68fe..509410ec20 100644 --- a/osu.Game/Overlays/SettingsToolboxGroup.cs +++ b/osu.Game/Overlays/SettingsToolboxGroup.cs @@ -22,6 +22,11 @@ namespace osu.Game.Overlays { public class SettingsToolboxGroup : Container, IExpandable { + /// + /// The title of this toolbox group. + /// + public string Title { get; } + private const float transition_duration = 250; private const int container_width = 270; private const int border_thickness = 2; @@ -48,6 +53,8 @@ namespace osu.Game.Overlays /// The title to be displayed in the header of this group. public SettingsToolboxGroup(string title) { + Title = title; + AutoSizeAxes = Axes.Y; Width = container_width; Masking = true; From 500322ff214753e17a78ca5bb601412ba27e7447 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 23 Jan 2022 06:13:56 +0300 Subject: [PATCH 0040/2328] Update failing snap test scenes --- .../Editor/TestSceneObjectObjectSnap.cs | 7 +++++++ .../Editor/TestSceneSliderSnapping.cs | 10 +++++++++- .../TestSceneHitObjectComposerDistanceSnapping.cs | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs index 7bdf131e0d..41304dcd24 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs @@ -3,9 +3,11 @@ using System.Linq; using NUnit.Framework; +using osu.Framework.Bindables; using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Beatmaps; +using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.UI; using osu.Game.Tests.Beatmaps; @@ -26,6 +28,11 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor base.SetUpSteps(); AddStep("get playfield", () => playfield = Editor.ChildrenOfType().First()); AddStep("seek to first control point", () => EditorClock.Seek(Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints.First().Time)); + AddStep("set distance spacing to 1", () => + { + var distanceSpacing = (BindableFloat)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; + distanceSpacing.Value = 1; + }); } [TestCase(true)] diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs index b43b2b1461..23131668a0 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs @@ -3,12 +3,15 @@ using System.Linq; using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Input.Events; using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Input.Bindings; +using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components; @@ -61,9 +64,14 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor })); AddStep("set beat divisor to 1/1", () => { - var beatDivisor = (BindableBeatDivisor)Editor.Dependencies.Get(typeof(BindableBeatDivisor)); + var beatDivisor = Editor.Dependencies.Get(); beatDivisor.Value = 1; }); + AddStep("set distance spacing to 1", () => + { + var distanceSpacing = (BindableFloat)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; + distanceSpacing.Value = 1; + }); } [Test] diff --git a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs index 43f22e4e90..d9312cb7ae 100644 --- a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs +++ b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs @@ -61,6 +61,7 @@ namespace osu.Game.Tests.Editing BeatDivisor.Value = 1; composer.EditorBeatmap.Difficulty.SliderMultiplier = 1; + composer.EditorBeatmap.BeatmapInfo.DistanceSpacing = 1; composer.EditorBeatmap.ControlPointInfo.Clear(); composer.EditorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 1000 }); }); From 868dcd20f56d208d41bdc769f4266b91fd355c84 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 26 Jan 2022 11:39:31 +0300 Subject: [PATCH 0041/2328] Remove `e.ShiftPressed` handling for now Broken on macOS, will be handled differently later on as discussed. --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 6cdc2699aa..948e1d770f 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -320,7 +320,7 @@ namespace osu.Game.Rulesets.Edit { if (distanceSpacingScrollActive) { - distanceSpacing.Value += e.ScrollDelta.Y * (e.ShiftPressed || e.IsPrecise ? 0.01f : 0.1f); + distanceSpacing.Value += e.ScrollDelta.Y * (e.IsPrecise ? 0.01f : 0.1f); return true; } From cbc8f7ff90e95b0d0b1876ac8f0634ac5575f643 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 15 Feb 2022 02:29:09 +0300 Subject: [PATCH 0042/2328] Remove test coverage of "shift" hotkey behaviour --- osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs index 7ac511e761..d542732e19 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs @@ -101,11 +101,6 @@ namespace osu.Game.Tests.Visual.Editing AddStep("scroll mouse 5 steps", () => InputManager.ScrollVerticalBy(5)); AddAssert("distance spacing increased by 0.5", () => Precision.AlmostEquals(editorBeatmap.BeatmapInfo.DistanceSpacing, originalSpacing + 0.5f)); - AddStep("hold shift", () => InputManager.PressKey(Key.LShift)); - AddStep("scroll mouse 5 steps", () => InputManager.ScrollVerticalBy(5)); - AddAssert("distance spacing increased by 0.05", () => Precision.AlmostEquals(editorBeatmap.BeatmapInfo.DistanceSpacing, originalSpacing + 0.55f)); - - AddStep("release shift", () => InputManager.ReleaseKey(Key.LShift)); AddStep("release alt", () => InputManager.ReleaseKey(Key.LAlt)); AddStep("release D", () => InputManager.ReleaseKey(Key.D)); } From f7edf25d4c84e2bc61a3f95efd22de52409fc66b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 16 Feb 2022 03:23:02 +0300 Subject: [PATCH 0043/2328] Remove no longer required property --- osu.Game/Overlays/SettingsToolboxGroup.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/osu.Game/Overlays/SettingsToolboxGroup.cs b/osu.Game/Overlays/SettingsToolboxGroup.cs index 509410ec20..08321f68fe 100644 --- a/osu.Game/Overlays/SettingsToolboxGroup.cs +++ b/osu.Game/Overlays/SettingsToolboxGroup.cs @@ -22,11 +22,6 @@ namespace osu.Game.Overlays { public class SettingsToolboxGroup : Container, IExpandable { - /// - /// The title of this toolbox group. - /// - public string Title { get; } - private const float transition_duration = 250; private const int container_width = 270; private const int border_thickness = 2; @@ -53,8 +48,6 @@ namespace osu.Game.Overlays /// The title to be displayed in the header of this group. public SettingsToolboxGroup(string title) { - Title = title; - AutoSizeAxes = Axes.Y; Width = container_width; Masking = true; From 7654584e40e8860a20f6bfce1322d6b331da92af Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 16 Feb 2022 03:25:03 +0300 Subject: [PATCH 0044/2328] Allow using `SizeSlider` on different value types --- .../Visual/UserInterface/TestSceneExpandingContainer.cs | 4 ++-- .../Overlays/Settings/Sections/Gameplay/InputSettings.cs | 2 +- osu.Game/Overlays/Settings/Sections/SizeSlider.cs | 6 ++++-- .../Settings/Sections/UserInterface/GeneralSettings.cs | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs index f4920b4412..288c0cb140 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs @@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.UserInterface private TestExpandingContainer container; private SettingsToolboxGroup toolboxGroup; - private ExpandableSlider slider1; + private ExpandableSlider> slider1; private ExpandableSlider slider2; [SetUp] @@ -34,7 +34,7 @@ namespace osu.Game.Tests.Visual.UserInterface Width = 1, Children = new Drawable[] { - slider1 = new ExpandableSlider + slider1 = new ExpandableSlider> { Current = new BindableFloat { diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs index 962572ca6e..83ea655601 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { Children = new Drawable[] { - new SettingsSlider + new SettingsSlider> { LabelText = SkinSettingsStrings.GameplayCursorSize, Current = config.GetBindable(OsuSetting.GameplayCursorSize), diff --git a/osu.Game/Overlays/Settings/Sections/SizeSlider.cs b/osu.Game/Overlays/Settings/Sections/SizeSlider.cs index 8aeb440be1..cc2c77adf2 100644 --- a/osu.Game/Overlays/Settings/Sections/SizeSlider.cs +++ b/osu.Game/Overlays/Settings/Sections/SizeSlider.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Localisation; using osu.Game.Graphics.UserInterface; @@ -9,8 +10,9 @@ namespace osu.Game.Overlays.Settings.Sections /// /// A slider intended to show a "size" multiplier number, where 1x is 1.0. /// - internal class SizeSlider : OsuSliderBar + internal class SizeSlider : OsuSliderBar + where T : struct, IEquatable, IComparable, IConvertible, IFormattable { - public override LocalisableString TooltipText => Current.Value.ToString(@"0.##x"); + public override LocalisableString TooltipText => Current.Value.ToString(@"0.##x", null); } } diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs index 0afbed5df5..66702744d3 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface LabelText = UserInterfaceStrings.CursorRotation, Current = config.GetBindable(OsuSetting.CursorRotation) }, - new SettingsSlider + new SettingsSlider> { LabelText = UserInterfaceStrings.MenuCursorSize, Current = config.GetBindable(OsuSetting.MenuCursorSize), From 0992bec2c849d9e5a7be97d1d9396027a1f8f4e1 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 16 Feb 2022 03:28:05 +0300 Subject: [PATCH 0045/2328] Change "distance spacing" multipler type to `double` Avoids losing precision on initial load, causing an unnecessary hash change in `EditorChangeHandler`. Resolves test failures in `TestSceneEditorChangeStates` (https://github.com/ppy/osu/runs/5192493482?check_suite_focus=true). --- .../Editor/TestSceneManiaBeatSnapGrid.cs | 2 +- .../Editor/TestSceneOsuDistanceSnapGrid.cs | 2 +- .../Editing/TestSceneDistanceSnapGrid.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 20 +++++++++---------- .../Rulesets/Edit/IPositionSnapProvider.cs | 2 +- .../Compose/Components/DistanceSnapGrid.cs | 2 +- .../Compose/Components/Timeline/Timeline.cs | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs index 38779ab47b..f32a1a823e 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs @@ -99,7 +99,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor set => InternalChild = value; } - public override IBindable DistanceSpacingMultiplier => throw new System.NotImplementedException(); + public override IBindable DistanceSpacingMultiplier => throw new System.NotImplementedException(); public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) { diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs index c5829d5351..38a442d48b 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs @@ -187,7 +187,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); - public IBindable DistanceSpacingMultiplier { get; } = new BindableFloat(1); + public IBindable DistanceSpacingMultiplier { get; } = new BindableDouble(1); public float GetBeatSnapDistanceAt(HitObject referenceObject) => (float)beat_length; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs index cba6d7692d..69fd642143 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs @@ -167,7 +167,7 @@ namespace osu.Game.Tests.Visual.Editing public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); - public IBindable DistanceSpacingMultiplier { get; } = new BindableFloat(1); + public IBindable DistanceSpacingMultiplier { get; } = new BindableDouble(1); public float GetBeatSnapDistanceAt(HitObject referenceObject) => 10; diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 948e1d770f..ab82fbad04 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -66,15 +66,15 @@ namespace osu.Game.Rulesets.Edit /// protected abstract bool SupportsDistanceSpacing { get; } - private readonly BindableFloat distanceSpacing = new BindableFloat + private readonly BindableDouble distanceSpacing = new BindableDouble { - Default = 1.0f, - MinValue = 0.1f, - MaxValue = 6.0f, - Precision = 0.01f, + Default = 1.0, + MinValue = 0.1, + MaxValue = 6.0, + Precision = 0.01, }; - public override IBindable DistanceSpacingMultiplier => distanceSpacing; + public override IBindable DistanceSpacingMultiplier => distanceSpacing; private SnappingToolboxContainer snappingToolboxContainer; @@ -161,11 +161,11 @@ namespace osu.Game.Rulesets.Edit }, }; - distanceSpacing.Value = (float)EditorBeatmap.BeatmapInfo.DistanceSpacing; + distanceSpacing.Value = EditorBeatmap.BeatmapInfo.DistanceSpacing; if (SupportsDistanceSpacing) { - ExpandableSlider distanceSpacingSlider; + ExpandableSlider> distanceSpacingSlider; AddInternal(snappingToolboxContainer = new SnappingToolboxContainer { @@ -173,7 +173,7 @@ namespace osu.Game.Rulesets.Edit Origin = Anchor.TopRight, Child = new EditorToolboxGroup("snapping") { - Child = distanceSpacingSlider = new ExpandableSlider + Child = distanceSpacingSlider = new ExpandableSlider> { Current = { BindTarget = distanceSpacing }, KeyboardStep = 0.01f, @@ -563,7 +563,7 @@ namespace osu.Game.Rulesets.Edit #region IPositionSnapProvider - public abstract IBindable DistanceSpacingMultiplier { get; } + public abstract IBindable DistanceSpacingMultiplier { get; } public abstract SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition); diff --git a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs index 1cfcb86e10..e4adbba47d 100644 --- a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Edit /// The spacing multiplier applied to beat snap distances. /// /// - IBindable DistanceSpacingMultiplier { get; } + IBindable DistanceSpacingMultiplier { get; } /// /// Given a position, find a valid time and position snap. diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index afbe83ec83..f9e4ef086c 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Edit.Compose.Components [Resolved] private BindableBeatDivisor beatDivisor { get; set; } - private IBindable distanceSpacingMultiplier; + private IBindable distanceSpacingMultiplier; private readonly LayoutValue gridCache = new LayoutValue(Invalidation.RequiredParentSizeToFit); private readonly double? endTime; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index f3a328c6bc..8832c4e89c 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -317,7 +317,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline private double getTimeFromPosition(Vector2 localPosition) => (localPosition.X / Content.DrawWidth) * track.Length; - public IBindable DistanceSpacingMultiplier => throw new NotImplementedException(); + public IBindable DistanceSpacingMultiplier => throw new NotImplementedException(); public float GetBeatSnapDistanceAt(HitObject referenceObject) => throw new NotImplementedException(); From 8b30c847f9ab3829b8fc8bc0e5f944a217cba8e5 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 16 Feb 2022 08:39:08 +0300 Subject: [PATCH 0046/2328] Update outdated bindable casts in tests --- osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs | 2 +- osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs index 41304dcd24..aa0e35102e 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor AddStep("seek to first control point", () => EditorClock.Seek(Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints.First().Time)); AddStep("set distance spacing to 1", () => { - var distanceSpacing = (BindableFloat)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; + var distanceSpacing = (BindableDouble)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; distanceSpacing.Value = 1; }); } diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs index 23131668a0..13ce340362 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs @@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor }); AddStep("set distance spacing to 1", () => { - var distanceSpacing = (BindableFloat)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; + var distanceSpacing = (BindableDouble)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; distanceSpacing.Value = 1; }); } From b66566e96d4f22d7e4351443ea8d999fd7f9bce7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 16 Feb 2022 10:35:57 +0300 Subject: [PATCH 0047/2328] Use explicit culture info rather than `null` --- osu.Game/Overlays/Settings/Sections/SizeSlider.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/SizeSlider.cs b/osu.Game/Overlays/Settings/Sections/SizeSlider.cs index cc2c77adf2..26db1aa755 100644 --- a/osu.Game/Overlays/Settings/Sections/SizeSlider.cs +++ b/osu.Game/Overlays/Settings/Sections/SizeSlider.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Globalization; using osu.Framework.Localisation; using osu.Game.Graphics.UserInterface; @@ -13,6 +14,6 @@ namespace osu.Game.Overlays.Settings.Sections internal class SizeSlider : OsuSliderBar where T : struct, IEquatable, IComparable, IConvertible, IFormattable { - public override LocalisableString TooltipText => Current.Value.ToString(@"0.##x", null); + public override LocalisableString TooltipText => Current.Value.ToString(@"0.##x", NumberFormatInfo.CurrentInfo); } } From 1025e1939ba90b96595c3ab0d9fc5a86a3f0527a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 16 Mar 2022 11:54:18 +0300 Subject: [PATCH 0048/2328] Disable "Adaptive Speed" mod in multiplayer --- .../OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs index e30ec36e9c..5ccf89e703 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs @@ -117,6 +117,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea(); + protected override bool IsValidMod(Mod mod) => base.IsValidMod(mod) && !(mod is ModAdaptiveSpeed); + protected override bool IsValidFreeMod(Mod mod) => base.IsValidFreeMod(mod) && !(mod is ModTimeRamp) && !(mod is ModRateAdjust); } } From d90a33485318f926e51c6f9da270876756bfab30 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 17 Mar 2022 03:40:15 +0300 Subject: [PATCH 0049/2328] Introduce multiplayer playability and free mod validity in `Mod` --- osu.Game/Rulesets/Mods/IMod.cs | 12 ++++++++++++ osu.Game/Rulesets/Mods/Mod.cs | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/osu.Game/Rulesets/Mods/IMod.cs b/osu.Game/Rulesets/Mods/IMod.cs index d5d1de91de..cda59bae55 100644 --- a/osu.Game/Rulesets/Mods/IMod.cs +++ b/osu.Game/Rulesets/Mods/IMod.cs @@ -39,6 +39,18 @@ namespace osu.Game.Rulesets.Mods /// bool UserPlayable { get; } + /// + /// Whether this mod is playable in a multiplayer match. + /// Should be false for mods that affect the gameplay progress based on user input (e.g. ). + /// + bool PlayableInMultiplayer { get; } + + /// + /// Whether this mod is valid to be a "free mod" in a multiplayer match. + /// Should be false for mods that affect the gameplay progress (e.g. and ). + /// + bool ValidFreeModInMultiplayer { get; } + /// /// Create a fresh instance based on this mod. /// diff --git a/osu.Game/Rulesets/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs index b2d4be54ce..a6562b4f4c 100644 --- a/osu.Game/Rulesets/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -94,6 +94,12 @@ namespace osu.Game.Rulesets.Mods [JsonIgnore] public virtual bool UserPlayable => true; + [JsonIgnore] + public virtual bool PlayableInMultiplayer => UserPlayable; + + [JsonIgnore] + public virtual bool ValidFreeModInMultiplayer => PlayableInMultiplayer; + [Obsolete("Going forward, the concept of \"ranked\" doesn't exist. The only exceptions are automation mods, which should now override and set UserPlayable to false.")] // Can be removed 20211009 public virtual bool Ranked => false; From 187059a37f69ed4ceff8ea4e2e2a0b8dda3b0085 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 17 Mar 2022 03:40:40 +0300 Subject: [PATCH 0050/2328] Replace hardcoded overrides with the newly introduced `Mod` properties --- osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs | 2 ++ osu.Game/Rulesets/Mods/ModRateAdjust.cs | 2 ++ osu.Game/Rulesets/Mods/ModTimeRamp.cs | 2 ++ .../OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs | 4 ++-- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs index 1115b95e6f..54a4c054c9 100644 --- a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs +++ b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs @@ -31,6 +31,8 @@ namespace osu.Game.Rulesets.Mods public override double ScoreMultiplier => 1; + public override bool PlayableInMultiplayer => false; + public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModTimeRamp) }; [SettingSource("Initial rate", "The starting speed of the track")] diff --git a/osu.Game/Rulesets/Mods/ModRateAdjust.cs b/osu.Game/Rulesets/Mods/ModRateAdjust.cs index ebe18f2188..3a11c3034b 100644 --- a/osu.Game/Rulesets/Mods/ModRateAdjust.cs +++ b/osu.Game/Rulesets/Mods/ModRateAdjust.cs @@ -11,6 +11,8 @@ namespace osu.Game.Rulesets.Mods { public abstract class ModRateAdjust : Mod, IApplicableToRate { + public override bool ValidFreeModInMultiplayer => false; + public abstract BindableNumber SpeedChange { get; } public virtual void ApplyToTrack(ITrack track) diff --git a/osu.Game/Rulesets/Mods/ModTimeRamp.cs b/osu.Game/Rulesets/Mods/ModTimeRamp.cs index b6b2decede..59aac62686 100644 --- a/osu.Game/Rulesets/Mods/ModTimeRamp.cs +++ b/osu.Game/Rulesets/Mods/ModTimeRamp.cs @@ -30,6 +30,8 @@ namespace osu.Game.Rulesets.Mods [SettingSource("Adjust pitch", "Should pitch be adjusted with speed")] public abstract BindableBool AdjustPitch { get; } + public override bool ValidFreeModInMultiplayer => false; + public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModAdaptiveSpeed) }; public override string SettingDescription => $"{InitialRate.Value:N2}x to {FinalRate.Value:N2}x"; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs index 5ccf89e703..e4f1d9587d 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs @@ -117,8 +117,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea(); - protected override bool IsValidMod(Mod mod) => base.IsValidMod(mod) && !(mod is ModAdaptiveSpeed); + protected override bool IsValidMod(Mod mod) => base.IsValidMod(mod) && mod.PlayableInMultiplayer; - protected override bool IsValidFreeMod(Mod mod) => base.IsValidFreeMod(mod) && !(mod is ModTimeRamp) && !(mod is ModRateAdjust); + protected override bool IsValidFreeMod(Mod mod) => base.IsValidFreeMod(mod) && mod.ValidFreeModInMultiplayer; } } From 59741ccee60d9b05466d9b7a1fea6157106ba5d8 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 17 Mar 2022 05:15:05 +0300 Subject: [PATCH 0051/2328] Add multiplayer mod validity check methods for server consumption --- osu.Game/OsuGame.cs | 15 ++++++++++----- osu.Game/Utils/ModUtils.cs | 26 +++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index ae117d03d2..bc2d2083fe 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -575,11 +575,16 @@ namespace osu.Game if (SelectedMods.Disabled) return; - if (!ModUtils.CheckValidForGameplay(mods.NewValue, out var invalid)) - { - // ensure we always have a valid set of mods. - SelectedMods.Value = mods.NewValue.Except(invalid).ToArray(); - } + var validMods = mods.NewValue; + + if (!ModUtils.CheckCompatibleSet(validMods, out var incompatible)) + validMods = validMods.Except(incompatible).ToArray(); + + if (!ModUtils.CheckValidForGameplay(validMods, out var invalid)) + validMods = validMods.Except(invalid).ToArray(); + + // ensure we always have a valid set of mods. + SelectedMods.Value = validMods; } #endregion diff --git a/osu.Game/Utils/ModUtils.cs b/osu.Game/Utils/ModUtils.cs index d5ea74c404..d169ace80a 100644 --- a/osu.Game/Utils/ModUtils.cs +++ b/osu.Game/Utils/ModUtils.cs @@ -112,14 +112,34 @@ namespace osu.Game.Utils /// Invalid mods, if any were found. Can be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidForGameplay(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) + => checkValid(mods, m => m.Type != ModType.System && m.HasImplementation && !(m is MultiMod), out invalidMods); + + /// + /// Check the provided combination of mods are valid for a multiplayer match session. + /// + /// The mods to check. + /// Invalid mods, if any were found. Can be null if all mods were valid. + /// Whether the input mods were all valid. If false, will contain all invalid entries. + public static bool CheckValidForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) + => checkValid(mods, m => m.PlayableInMultiplayer, out invalidMods); + + /// + /// Check the provided combination of mods are valid as "free mods" in a multiplayer match session. + /// + /// The mods to check. + /// Invalid mods, if any were found. Can be null if all mods were valid. + /// Whether the input mods were all valid. If false, will contain all invalid entries. + public static bool CheckValidFreeModsForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) + => checkValid(mods, m => m.ValidFreeModInMultiplayer, out invalidMods); + + private static bool checkValid(IEnumerable mods, Predicate valid, [NotNullWhen(false)] out List? invalidMods) { mods = mods.ToArray(); - - CheckCompatibleSet(mods, out invalidMods); + invalidMods = null; foreach (var mod in mods) { - if (mod.Type == ModType.System || !mod.HasImplementation || mod is MultiMod) + if (!valid(mod)) { invalidMods ??= new List(); invalidMods.Add(mod); From 07e9f3780a8335ca07d3e076193c0b7cbdc80982 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 17 Mar 2022 05:15:48 +0300 Subject: [PATCH 0052/2328] Consider `UnknownMod` to be "playable in multiplayer" --- osu.Game/Rulesets/Mods/UnknownMod.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Rulesets/Mods/UnknownMod.cs b/osu.Game/Rulesets/Mods/UnknownMod.cs index b426386d7a..790306c0ca 100644 --- a/osu.Game/Rulesets/Mods/UnknownMod.cs +++ b/osu.Game/Rulesets/Mods/UnknownMod.cs @@ -16,6 +16,7 @@ namespace osu.Game.Rulesets.Mods public override double ScoreMultiplier => 0; public override bool UserPlayable => false; + public override bool PlayableInMultiplayer => true; public override ModType Type => ModType.System; From b3ac544d655e6846a94b6bf2d31332b471d90de4 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 17 Mar 2022 06:31:51 +0300 Subject: [PATCH 0053/2328] Revert "Consider `UnknownMod` to be "playable in multiplayer"" This reverts commit 07e9f3780a8335ca07d3e076193c0b7cbdc80982. --- osu.Game/Rulesets/Mods/UnknownMod.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Rulesets/Mods/UnknownMod.cs b/osu.Game/Rulesets/Mods/UnknownMod.cs index 790306c0ca..b426386d7a 100644 --- a/osu.Game/Rulesets/Mods/UnknownMod.cs +++ b/osu.Game/Rulesets/Mods/UnknownMod.cs @@ -16,7 +16,6 @@ namespace osu.Game.Rulesets.Mods public override double ScoreMultiplier => 0; public override bool UserPlayable => false; - public override bool PlayableInMultiplayer => true; public override ModType Type => ModType.System; From e3a5299b1acc6bba39f5b9de2726159add8ecb89 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 17 Mar 2022 19:23:43 +0900 Subject: [PATCH 0054/2328] Expose the loading player in `PlayerLoader` --- osu.Game/Screens/Play/PlayerLoader.cs | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 41eb822e39..384561d616 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -90,7 +90,7 @@ namespace osu.Game.Screens.Play private bool readyForPush => !playerConsumed // don't push unless the player is completely loaded - && player?.LoadState == LoadState.Ready + && CurrentPlayer?.LoadState == LoadState.Ready // don't push if the user is hovering one of the panes, unless they are idle. && (IsHovered || idleTracker.IsIdle.Value) // don't push if the user is dragging a slider or otherwise. @@ -100,10 +100,14 @@ namespace osu.Game.Screens.Play private readonly Func createPlayer; - private Player player; + /// + /// The instance being loaded by this screen. + /// + [CanBeNull] + public Player CurrentPlayer { get; private set; } /// - /// Whether the curent player instance has been consumed via . + /// Whether the current player instance has been consumed via . /// private bool playerConsumed; @@ -237,12 +241,12 @@ namespace osu.Game.Screens.Play { base.OnResuming(last); - var lastScore = player.Score; + var lastScore = CurrentPlayer.Score; AudioSettings.ReferenceScore.Value = lastScore?.ScoreInfo; // prepare for a retry. - player = null; + CurrentPlayer = null; playerConsumed = false; cancelLoad(); @@ -346,7 +350,7 @@ namespace osu.Game.Screens.Play Debug.Assert(!playerConsumed); playerConsumed = true; - return player; + return CurrentPlayer; } private void prepareNewPlayer() @@ -354,11 +358,11 @@ namespace osu.Game.Screens.Play if (!this.IsCurrentScreen()) return; - player = createPlayer(); - player.RestartCount = restartCount++; - player.RestartRequested = restartRequested; + CurrentPlayer = createPlayer(); + CurrentPlayer.RestartCount = restartCount++; + CurrentPlayer.RestartRequested = restartRequested; - LoadTask = LoadComponentAsync(player, _ => MetadataInfo.Loading = false); + LoadTask = LoadComponentAsync(CurrentPlayer, _ => MetadataInfo.Loading = false); } private void restartRequested() @@ -472,7 +476,7 @@ namespace osu.Game.Screens.Play if (isDisposing) { // if the player never got pushed, we should explicitly dispose it. - DisposalTask = LoadTask?.ContinueWith(_ => player?.Dispose()); + DisposalTask = LoadTask?.ContinueWith(_ => CurrentPlayer?.Dispose()); } } From 5164b4d6403bcb83fedbd8f83a35999eb1eeb58f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 17 Mar 2022 19:36:33 +0900 Subject: [PATCH 0055/2328] Use `nullable` in `PlayerLoader` --- osu.Game/Screens/Play/PlayerLoader.cs | 54 ++++++++++++++------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 384561d616..ba720af2a1 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -1,10 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Diagnostics; using System.Threading.Tasks; -using JetBrains.Annotations; using ManagedBass.Fx; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -48,31 +49,31 @@ namespace osu.Game.Screens.Play public override bool HandlePositionalInput => true; // We show the previous screen status - protected override UserActivity InitialActivity => null; + protected override UserActivity? InitialActivity => null; protected override bool PlayResumeSound => false; - protected BeatmapMetadataDisplay MetadataInfo { get; private set; } + protected BeatmapMetadataDisplay MetadataInfo { get; private set; } = null!; /// /// A fill flow containing the player settings groups, exposed for the ability to hide it from inheritors of the player loader. /// - protected FillFlowContainer PlayerSettings { get; private set; } + protected FillFlowContainer PlayerSettings { get; private set; } = null!; - protected VisualSettings VisualSettings { get; private set; } + protected VisualSettings VisualSettings { get; private set; } = null!; - protected AudioSettings AudioSettings { get; private set; } + protected AudioSettings AudioSettings { get; private set; } = null!; - protected Task LoadTask { get; private set; } + protected Task? LoadTask { get; private set; } - protected Task DisposalTask { get; private set; } + protected Task? DisposalTask { get; private set; } private bool backgroundBrightnessReduction; private readonly BindableDouble volumeAdjustment = new BindableDouble(1); - private AudioFilter lowPassFilter; - private AudioFilter highPassFilter; + private AudioFilter lowPassFilter = null!; + private AudioFilter highPassFilter = null!; protected bool BackgroundBrightnessReduction { @@ -94,47 +95,45 @@ namespace osu.Game.Screens.Play // don't push if the user is hovering one of the panes, unless they are idle. && (IsHovered || idleTracker.IsIdle.Value) // don't push if the user is dragging a slider or otherwise. - && inputManager?.DraggedDrawable == null + && inputManager.DraggedDrawable == null // don't push if a focused overlay is visible, like settings. - && inputManager?.FocusedDrawable == null; + && inputManager.FocusedDrawable == null; private readonly Func createPlayer; /// /// The instance being loaded by this screen. /// - [CanBeNull] - public Player CurrentPlayer { get; private set; } + public Player? CurrentPlayer { get; private set; } /// /// Whether the current player instance has been consumed via . /// private bool playerConsumed; - private LogoTrackingContainer content; + private LogoTrackingContainer content = null!; private bool hideOverlays; - private InputManager inputManager; + private InputManager inputManager = null!; - private IdleTracker idleTracker; + private IdleTracker idleTracker = null!; - private ScheduledDelegate scheduledPushPlayer; + private ScheduledDelegate? scheduledPushPlayer; - [CanBeNull] - private EpilepsyWarning epilepsyWarning; + private EpilepsyWarning? epilepsyWarning; [Resolved(CanBeNull = true)] - private NotificationOverlay notificationOverlay { get; set; } + private NotificationOverlay? notificationOverlay { get; set; } [Resolved(CanBeNull = true)] - private VolumeOverlay volumeOverlay { get; set; } + private VolumeOverlay? volumeOverlay { get; set; } [Resolved] - private AudioManager audioManager { get; set; } + private AudioManager audioManager { get; set; } = null!; [Resolved(CanBeNull = true)] - private BatteryInfo batteryInfo { get; set; } + private BatteryInfo? batteryInfo { get; set; } public PlayerLoader(Func createPlayer) { @@ -241,6 +240,8 @@ namespace osu.Game.Screens.Play { base.OnResuming(last); + Debug.Assert(CurrentPlayer != null); + var lastScore = CurrentPlayer.Score; AudioSettings.ReferenceScore.Value = lastScore?.ScoreInfo; @@ -348,6 +349,7 @@ namespace osu.Game.Screens.Play private Player consumePlayer() { Debug.Assert(!playerConsumed); + Debug.Assert(CurrentPlayer != null); playerConsumed = true; return CurrentPlayer; @@ -484,7 +486,7 @@ namespace osu.Game.Screens.Play #region Mute warning - private Bindable muteWarningShownOnce; + private Bindable muteWarningShownOnce = null!; private int restartCount; @@ -539,7 +541,7 @@ namespace osu.Game.Screens.Play #region Low battery warning - private Bindable batteryWarningShownOnce; + private Bindable batteryWarningShownOnce = null!; private void showBatteryWarningIfNeeded() { From e3a8bb2d1c36c4995177a2826126e47dc2a0c6eb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 17 Mar 2022 19:23:49 +0900 Subject: [PATCH 0056/2328] Add test coverage of `SpectatorPlayer` failing to seek on inopportune frame arrival time --- .../Visual/Gameplay/TestSceneSpectator.cs | 54 ++++++++++++++++++- .../Visual/Spectator/TestSpectatorClient.cs | 5 +- 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs index d614815316..8b420cebc8 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs @@ -70,6 +70,56 @@ namespace osu.Game.Tests.Visual.Gameplay }); } + [Test] + public void TestSeekToGameplayStartFramesArriveAfterPlayerLoad() + { + const double gameplay_start = 10000; + + loadSpectatingScreen(); + + start(); + + waitForPlayer(); + + sendFrames(startTime: gameplay_start); + + AddAssert("time is greater than seek target", () => currentFrameStableTime > gameplay_start); + } + + /// + /// Tests the same as but with the frames arriving just as is transitioning into existence. + /// + [Test] + public void TestSeekToGameplayStartFramesArriveAsPlayerLoaded() + { + const double gameplay_start = 10000; + + loadSpectatingScreen(); + + start(); + + AddUntilStep("wait for player loader", () => (Stack.CurrentScreen as PlayerLoader)?.IsLoaded == true); + + AddUntilStep("queue send frames on player load", () => + { + var loadingPlayer = (Stack.CurrentScreen as PlayerLoader)?.CurrentPlayer; + + if (loadingPlayer == null) + return false; + + loadingPlayer.OnLoadComplete += _ => + { + spectatorClient.SendFramesFromUser(streamingUser.Id, 10, gameplay_start); + }; + return true; + }); + + waitForPlayer(); + + AddUntilStep("state is playing", () => spectatorClient.WatchedUserStates[streamingUser.Id].State == SpectatedUserState.Playing); + AddAssert("time is greater than seek target", () => currentFrameStableTime > gameplay_start); + } + [Test] public void TestFrameStarvationAndResume() { @@ -319,9 +369,9 @@ namespace osu.Game.Tests.Visual.Gameplay private void checkPaused(bool state) => AddUntilStep($"game is {(state ? "paused" : "playing")}", () => player.ChildrenOfType().First().IsPaused.Value == state); - private void sendFrames(int count = 10) + private void sendFrames(int count = 10, double startTime = 0) { - AddStep("send frames", () => spectatorClient.SendFramesFromUser(streamingUser.Id, count)); + AddStep("send frames", () => spectatorClient.SendFramesFromUser(streamingUser.Id, count, startTime)); } private void loadSpectatingScreen() diff --git a/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs b/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs index f5da95bd7b..ac7cb43e02 100644 --- a/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs +++ b/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs @@ -88,7 +88,8 @@ namespace osu.Game.Tests.Visual.Spectator /// /// The user to send frames for. /// The total number of frames to send. - public void SendFramesFromUser(int userId, int count) + /// The time to start gameplay frames from. + public void SendFramesFromUser(int userId, int count, double startTime = 0) { var frames = new List(); @@ -102,7 +103,7 @@ namespace osu.Game.Tests.Visual.Spectator flush(); var buttonState = currentFrameIndex == lastFrameIndex ? ReplayButtonState.None : ReplayButtonState.Left1; - frames.Add(new LegacyReplayFrame(currentFrameIndex * 100, RNG.Next(0, 512), RNG.Next(0, 512), buttonState)); + frames.Add(new LegacyReplayFrame(currentFrameIndex * 100 + startTime, RNG.Next(0, 512), RNG.Next(0, 512), buttonState)); } flush(); From a4a0241800934b62349ac11b913e5e0a1c94c929 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 17 Mar 2022 20:54:42 +0900 Subject: [PATCH 0057/2328] Use a more explicit flow to set and reset `GameplayClockContainer` start time --- .../Screens/Play/GameplayClockContainer.cs | 20 ++++++-- .../Play/MasterGameplayClockContainer.cs | 49 ++++++++++--------- osu.Game/Screens/Play/Player.cs | 10 ++-- osu.Game/Screens/Play/SpectatorPlayer.cs | 2 +- 4 files changed, 48 insertions(+), 33 deletions(-) diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index 0fd524f976..b60a3e306e 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -41,6 +41,15 @@ namespace osu.Game.Screens.Play /// public event Action OnSeek; + /// + /// The time from which gameplay should start. Will be seeked to on calling . + /// + /// + /// If not set, a value of zero will be used. + /// Importantly, the value will be inferred from the current ruleset in unless specified. + /// + protected double? GameplayStartTime { get; private set; } + /// /// Creates a new . /// @@ -106,15 +115,20 @@ namespace osu.Game.Screens.Play /// /// Resets this and the source to an initial state ready for gameplay. /// - public virtual void Reset() + /// Whether to start the clock immediately. + /// A time to use for future calls as the definite start of gameplay. + public void Reset(bool startClock = false, double? gameplayStartTime = null) { + if (gameplayStartTime != null) + GameplayStartTime = gameplayStartTime; + ensureSourceClockSet(); - Seek(0); + Seek(GameplayStartTime ?? 0); // Manually stop the source in order to not affect the IsPaused state. AdjustableSource.Stop(); - if (!IsPaused.Value) + if (!IsPaused.Value && startClock) Start(); } diff --git a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs index af58e9d910..ce7b6ef7f0 100644 --- a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs +++ b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs @@ -58,7 +58,6 @@ namespace osu.Game.Screens.Play private HardwareCorrectionOffsetClock platformOffsetClock; private MasterGameplayClock masterGameplayClock; private Bindable userAudioOffset; - private double startOffset; private IDisposable beatmapOffsetSubscription; @@ -90,26 +89,33 @@ namespace osu.Game.Screens.Play settings => settings.Offset, val => userBeatmapOffsetClock.Offset = val); - // sane default provided by ruleset. - startOffset = gameplayStartTime; - - if (!startAtGameplayStart) + if (GameplayStartTime == null) { - startOffset = Math.Min(0, startOffset); + // sane default provided by ruleset. + double offset = gameplayStartTime; - // if a storyboard is present, it may dictate the appropriate start time by having events in negative time space. - // this is commonly used to display an intro before the audio track start. - double? firstStoryboardEvent = beatmap.Storyboard.EarliestEventTime; - if (firstStoryboardEvent != null) - startOffset = Math.Min(startOffset, firstStoryboardEvent.Value); + if (!startAtGameplayStart) + { + offset = Math.Min(0, offset); - // some beatmaps specify a current lead-in time which should be used instead of the ruleset-provided value when available. - // this is not available as an option in the live editor but can still be applied via .osu editing. - if (beatmap.BeatmapInfo.AudioLeadIn > 0) - startOffset = Math.Min(startOffset, firstHitObjectTime - beatmap.BeatmapInfo.AudioLeadIn); + // if a storyboard is present, it may dictate the appropriate start time by having events in negative time space. + // this is commonly used to display an intro before the audio track start. + double? firstStoryboardEvent = beatmap.Storyboard.EarliestEventTime; + if (firstStoryboardEvent != null) + offset = Math.Min(offset, firstStoryboardEvent.Value); + + // some beatmaps specify a current lead-in time which should be used instead of the ruleset-provided value when available. + // this is not available as an option in the live editor but can still be applied via .osu editing. + if (beatmap.BeatmapInfo.AudioLeadIn > 0) + offset = Math.Min(offset, firstHitObjectTime - beatmap.BeatmapInfo.AudioLeadIn); + } + + // Reset may have been called externally before LoadComplete. + // If it was and the clock is in a playing state, we want to ensure that it isn't stopped here. + bool isStarted = !IsPaused.Value; + + Reset(startClock: isStarted, gameplayStartTime: offset); } - - Seek(startOffset); } protected override void OnIsPausedChanged(ValueChangedEvent isPaused) @@ -164,12 +170,6 @@ namespace osu.Game.Screens.Play Seek(skipTarget); } - public override void Reset() - { - base.Reset(); - Seek(startOffset); - } - protected override GameplayClock CreateGameplayClock(IFrameBasedClock source) { // Lazer's audio timings in general doesn't match stable. This is the result of user testing, albeit limited. @@ -231,6 +231,7 @@ namespace osu.Game.Screens.Play } private class HardwareCorrectionOffsetClock : FramedOffsetClock + { private readonly BindableDouble pauseRateAdjust; @@ -276,9 +277,9 @@ namespace osu.Game.Screens.Play } private class MasterGameplayClock : GameplayClock + { public readonly List> MutableNonGameplayAdjustments = new List>(); - public override IEnumerable> NonGameplayAdjustments => MutableNonGameplayAdjustments; public MasterGameplayClock(FramedOffsetClock underlyingClock) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index cb8f4b6020..6ec21ef924 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -607,13 +607,13 @@ namespace osu.Game.Screens.Play private ScheduledDelegate frameStablePlaybackResetDelegate; /// - /// Seeks to a specific time in gameplay, bypassing frame stability. + /// Specify and seek to a custom start time from which gameplay should be observed. /// /// - /// Intermediate hitobject judgements may not be applied or reverted correctly during this seek. + /// This performance a non-frame-stable seek. Intermediate hitobject judgements may not be applied or reverted correctly during this seek. /// /// The destination time to seek to. - internal void NonFrameStableSeek(double time) + protected void SetGameplayStartTime(double time) { if (frameStablePlaybackResetDelegate?.Cancelled == false && !frameStablePlaybackResetDelegate.Completed) frameStablePlaybackResetDelegate.RunTask(); @@ -621,7 +621,7 @@ namespace osu.Game.Screens.Play bool wasFrameStable = DrawableRuleset.FrameStablePlayback; DrawableRuleset.FrameStablePlayback = false; - Seek(time); + GameplayClockContainer.Reset(gameplayStartTime: time); // Delay resetting frame-stable playback for one frame to give the FrameStabilityContainer a chance to seek. frameStablePlaybackResetDelegate = ScheduleAfterChildren(() => DrawableRuleset.FrameStablePlayback = wasFrameStable); @@ -981,7 +981,7 @@ namespace osu.Game.Screens.Play if (GameplayClockContainer.GameplayClock.IsRunning) throw new InvalidOperationException($"{nameof(StartGameplay)} should not be called when the gameplay clock is already running"); - GameplayClockContainer.Reset(); + GameplayClockContainer.Reset(true); } public override void OnSuspending(IScreen next) diff --git a/osu.Game/Screens/Play/SpectatorPlayer.cs b/osu.Game/Screens/Play/SpectatorPlayer.cs index c415041081..c0682952c3 100644 --- a/osu.Game/Screens/Play/SpectatorPlayer.cs +++ b/osu.Game/Screens/Play/SpectatorPlayer.cs @@ -78,7 +78,7 @@ namespace osu.Game.Screens.Play } if (isFirstBundle && score.Replay.Frames.Count > 0) - NonFrameStableSeek(score.Replay.Frames[0].Time); + SetGameplayStartTime(score.Replay.Frames[0].Time); } protected override Score CreateScore(IBeatmap beatmap) => score; From e3ab5de8cd944a35228d47bba2623fbd5ee712ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 17 Mar 2022 23:39:45 +0900 Subject: [PATCH 0058/2328] Tidy up constructor logic overlap with `gameplayStartTime` --- .../TestSceneMultiSpectatorScreen.cs | 2 +- .../Screens/Play/GameplayClockContainer.cs | 8 +-- .../Play/MasterGameplayClockContainer.cs | 69 ++++++++++--------- 3 files changed, 43 insertions(+), 36 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs index e5e3fecd06..ed8b0bdd96 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs @@ -473,7 +473,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } protected override MasterGameplayClockContainer CreateMasterGameplayClockContainer(WorkingBeatmap beatmap) - => new MasterGameplayClockContainer(beatmap, gameplayStartTime ?? 0, gameplayStartTime.HasValue); + => new MasterGameplayClockContainer(beatmap, gameplayStartTime ?? 0); } } } diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index b60a3e306e..66f5cb0bd4 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -42,13 +42,13 @@ namespace osu.Game.Screens.Play public event Action OnSeek; /// - /// The time from which gameplay should start. Will be seeked to on calling . + /// The time from which the clock should start. Will be seeked to on calling . /// /// /// If not set, a value of zero will be used. /// Importantly, the value will be inferred from the current ruleset in unless specified. /// - protected double? GameplayStartTime { get; private set; } + protected double? StartTime { get; set; } /// /// Creates a new . @@ -120,10 +120,10 @@ namespace osu.Game.Screens.Play public void Reset(bool startClock = false, double? gameplayStartTime = null) { if (gameplayStartTime != null) - GameplayStartTime = gameplayStartTime; + StartTime = gameplayStartTime; ensureSourceClockSet(); - Seek(GameplayStartTime ?? 0); + Seek(StartTime ?? 0); // Manually stop the source in order to not affect the IsPaused state. AdjustableSource.Stop(); diff --git a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs index ce7b6ef7f0..58e8b5f1ad 100644 --- a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs +++ b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs @@ -49,9 +49,6 @@ namespace osu.Game.Screens.Play private readonly BindableDouble pauseFreqAdjust = new BindableDouble(1); private readonly WorkingBeatmap beatmap; - private readonly double gameplayStartTime; - private readonly bool startAtGameplayStart; - private readonly double firstHitObjectTime; private HardwareCorrectionOffsetClock userGlobalOffsetClock; private HardwareCorrectionOffsetClock userBeatmapOffsetClock; @@ -61,20 +58,29 @@ namespace osu.Game.Screens.Play private IDisposable beatmapOffsetSubscription; + private readonly double latestGameplayStartTime; + [Resolved] private RealmAccess realm { get; set; } [Resolved] private OsuConfigManager config { get; set; } - public MasterGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStartTime, bool startAtGameplayStart = false) + /// + /// Create a new master gameplay clock container. + /// + /// The beatmap to be used for time and metadata references. + /// The latest time which should be used when introducing gameplay. Will be used when skipping forward. + /// Whether to start from the provided latest start time rather than zero. + public MasterGameplayClockContainer(WorkingBeatmap beatmap, double latestGameplayStartTime, bool startFromLatestStartTime = false) : base(beatmap.Track) { this.beatmap = beatmap; - this.gameplayStartTime = gameplayStartTime; - this.startAtGameplayStart = startAtGameplayStart; - firstHitObjectTime = beatmap.Beatmap.HitObjects.First().StartTime; + this.latestGameplayStartTime = latestGameplayStartTime; + + if (startFromLatestStartTime) + StartTime = latestGameplayStartTime; } protected override void LoadComplete() @@ -89,33 +95,34 @@ namespace osu.Game.Screens.Play settings => settings.Offset, val => userBeatmapOffsetClock.Offset = val); - if (GameplayStartTime == null) - { - // sane default provided by ruleset. - double offset = gameplayStartTime; + // Reset may have been called externally before LoadComplete. + // If it was, and the clock is in a playing state, we want to ensure that it isn't stopped here. + bool isStarted = !IsPaused.Value; - if (!startAtGameplayStart) - { - offset = Math.Min(0, offset); + // If a custom start time was not specified, calculate the best value to use. + double gameplayStartTime = StartTime ?? findBeatmapStartTime(); - // if a storyboard is present, it may dictate the appropriate start time by having events in negative time space. - // this is commonly used to display an intro before the audio track start. - double? firstStoryboardEvent = beatmap.Storyboard.EarliestEventTime; - if (firstStoryboardEvent != null) - offset = Math.Min(offset, firstStoryboardEvent.Value); + Reset(startClock: isStarted, gameplayStartTime: gameplayStartTime); + } - // some beatmaps specify a current lead-in time which should be used instead of the ruleset-provided value when available. - // this is not available as an option in the live editor but can still be applied via .osu editing. - if (beatmap.BeatmapInfo.AudioLeadIn > 0) - offset = Math.Min(offset, firstHitObjectTime - beatmap.BeatmapInfo.AudioLeadIn); - } + private double findBeatmapStartTime() + { + // start with the originally provided latest time as a sane default. + double time = latestGameplayStartTime; - // Reset may have been called externally before LoadComplete. - // If it was and the clock is in a playing state, we want to ensure that it isn't stopped here. - bool isStarted = !IsPaused.Value; + // if a storyboard is present, it may dictate the appropriate start time by having events in negative time space. + // this is commonly used to display an intro before the audio track start. + double? firstStoryboardEvent = beatmap.Storyboard.EarliestEventTime; + if (firstStoryboardEvent != null) + time = Math.Min(time, firstStoryboardEvent.Value); - Reset(startClock: isStarted, gameplayStartTime: offset); - } + // some beatmaps specify a current lead-in time which should be used instead of the ruleset-provided value when available. + // this is not available as an option in the live editor but can still be applied via .osu editing. + double firstHitObjectTime = beatmap.Beatmap.HitObjects.First().StartTime; + if (beatmap.BeatmapInfo.AudioLeadIn > 0) + time = Math.Min(time, firstHitObjectTime - beatmap.BeatmapInfo.AudioLeadIn); + + return time; } protected override void OnIsPausedChanged(ValueChangedEvent isPaused) @@ -158,10 +165,10 @@ namespace osu.Game.Screens.Play /// public void Skip() { - if (GameplayClock.CurrentTime > gameplayStartTime - MINIMUM_SKIP_TIME) + if (GameplayClock.CurrentTime > latestGameplayStartTime - MINIMUM_SKIP_TIME) return; - double skipTarget = gameplayStartTime - MINIMUM_SKIP_TIME; + double skipTarget = latestGameplayStartTime - MINIMUM_SKIP_TIME; if (GameplayClock.CurrentTime < 0 && skipTarget > 6000) // double skip exception for storyboards with very long intros From c6be26eb018a4f26701f0b2bcbe58c742fa4a2e1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 18 Mar 2022 01:15:17 +0900 Subject: [PATCH 0059/2328] Rename start time calculation method and add more commenting to explain purpose better --- osu.Game/Screens/Play/MasterGameplayClockContainer.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs index 58e8b5f1ad..529503e020 100644 --- a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs +++ b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs @@ -100,15 +100,18 @@ namespace osu.Game.Screens.Play bool isStarted = !IsPaused.Value; // If a custom start time was not specified, calculate the best value to use. - double gameplayStartTime = StartTime ?? findBeatmapStartTime(); + double gameplayStartTime = StartTime ?? findEarliestStartTime(); Reset(startClock: isStarted, gameplayStartTime: gameplayStartTime); } - private double findBeatmapStartTime() + private double findEarliestStartTime() { - // start with the originally provided latest time as a sane default. - double time = latestGameplayStartTime; + // here we are trying to find the time to start playback from the "zero" point. + // generally this is either zero, or some point earlier than zero in the case of storyboards, lead-ins etc. + + // start with the originally provided latest time (if before zero). + double time = Math.Min(0, latestGameplayStartTime); // if a storyboard is present, it may dictate the appropriate start time by having events in negative time space. // this is commonly used to display an intro before the audio track start. From d90f21e140bea785d07fd33c8ef1af126c16a16b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 18 Mar 2022 00:13:40 +0300 Subject: [PATCH 0060/2328] Reword mod documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- osu.Game/Rulesets/Mods/IMod.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Mods/IMod.cs b/osu.Game/Rulesets/Mods/IMod.cs index cda59bae55..5f4fecb649 100644 --- a/osu.Game/Rulesets/Mods/IMod.cs +++ b/osu.Game/Rulesets/Mods/IMod.cs @@ -41,13 +41,13 @@ namespace osu.Game.Rulesets.Mods /// /// Whether this mod is playable in a multiplayer match. - /// Should be false for mods that affect the gameplay progress based on user input (e.g. ). + /// Should be false for mods that make gameplay duration dependent on user input (e.g. ). /// bool PlayableInMultiplayer { get; } /// /// Whether this mod is valid to be a "free mod" in a multiplayer match. - /// Should be false for mods that affect the gameplay progress (e.g. and ). + /// Should be false for mods that affect the gameplay duration (e.g. and ). /// bool ValidFreeModInMultiplayer { get; } From b0d04a78f7d2e4b7fadaee32841dca3387c44f34 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 18 Mar 2022 00:21:16 +0300 Subject: [PATCH 0061/2328] Reword mod utility documentation regarding nullability --- osu.Game/Utils/ModUtils.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Utils/ModUtils.cs b/osu.Game/Utils/ModUtils.cs index d169ace80a..81b78c18ac 100644 --- a/osu.Game/Utils/ModUtils.cs +++ b/osu.Game/Utils/ModUtils.cs @@ -109,7 +109,7 @@ namespace osu.Game.Utils /// Check the provided combination of mods are valid for a local gameplay session. /// /// The mods to check. - /// Invalid mods, if any were found. Can be null if all mods were valid. + /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidForGameplay(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) => checkValid(mods, m => m.Type != ModType.System && m.HasImplementation && !(m is MultiMod), out invalidMods); @@ -118,7 +118,7 @@ namespace osu.Game.Utils /// Check the provided combination of mods are valid for a multiplayer match session. /// /// The mods to check. - /// Invalid mods, if any were found. Can be null if all mods were valid. + /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) => checkValid(mods, m => m.PlayableInMultiplayer, out invalidMods); @@ -127,7 +127,7 @@ namespace osu.Game.Utils /// Check the provided combination of mods are valid as "free mods" in a multiplayer match session. /// /// The mods to check. - /// Invalid mods, if any were found. Can be null if all mods were valid. + /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidFreeModsForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) => checkValid(mods, m => m.ValidFreeModInMultiplayer, out invalidMods); From 51e5dd7d0e58fb681db6da9e34e9d435e1026a58 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 18 Mar 2022 02:08:11 +0300 Subject: [PATCH 0062/2328] Introduce `IsPlayable(...)` and obsolete `UserPlayable` --- .../BeatmapSet/LeaderboardModSelector.cs | 2 +- osu.Game/Rulesets/Mods/IMod.cs | 26 ++++++++++--------- osu.Game/Rulesets/Mods/Mod.cs | 11 +++----- osu.Game/Rulesets/Mods/ModUsage.cs | 26 +++++++++++++++++++ 4 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 osu.Game/Rulesets/Mods/ModUsage.cs diff --git a/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs b/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs index 25aed4c980..97b89c6f74 100644 --- a/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs +++ b/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs @@ -63,7 +63,7 @@ namespace osu.Game.Overlays.BeatmapSet return; modsContainer.Add(new ModButton(new ModNoMod())); - modsContainer.AddRange(rulesetInstance.AllMods.Where(m => m.UserPlayable).Select(m => new ModButton(m))); + modsContainer.AddRange(rulesetInstance.AllMods.Where(m => m.IsPlayable(ModUsage.Solo)).Select(m => new ModButton(m))); modsContainer.ForEach(button => { diff --git a/osu.Game/Rulesets/Mods/IMod.cs b/osu.Game/Rulesets/Mods/IMod.cs index 5f4fecb649..bdfb273b13 100644 --- a/osu.Game/Rulesets/Mods/IMod.cs +++ b/osu.Game/Rulesets/Mods/IMod.cs @@ -33,24 +33,26 @@ namespace osu.Game.Rulesets.Mods /// IconUsage? Icon { get; } + /// + /// Whether this mod is playable for the given usage. + /// + /// + /// + /// Should be always false for cases where the user is not interacting with the game. + /// Should be false in for mods that make gameplay duration dependent on user input (e.g. ). + /// Should be false in for mods that affect the gameplay duration (e.g. and ). + /// + /// + /// The mod usage. + bool IsPlayable(ModUsage usage); + /// /// Whether this mod is playable by an end user. /// Should be false for cases where the user is not interacting with the game (so it can be excluded from multiplayer selection, for example). /// + [Obsolete("Override IsPlayable instead.")] // Can be removed 20220918 bool UserPlayable { get; } - /// - /// Whether this mod is playable in a multiplayer match. - /// Should be false for mods that make gameplay duration dependent on user input (e.g. ). - /// - bool PlayableInMultiplayer { get; } - - /// - /// Whether this mod is valid to be a "free mod" in a multiplayer match. - /// Should be false for mods that affect the gameplay duration (e.g. and ). - /// - bool ValidFreeModInMultiplayer { get; } - /// /// Create a fresh instance based on this mod. /// diff --git a/osu.Game/Rulesets/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs index a6562b4f4c..00aef1a598 100644 --- a/osu.Game/Rulesets/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -91,16 +91,13 @@ namespace osu.Game.Rulesets.Mods [JsonIgnore] public virtual bool HasImplementation => this is IApplicableMod; + public virtual bool IsPlayable(ModUsage usage) => true; + [JsonIgnore] + [Obsolete("Override IsPlayable instead.")] // Can be removed 20220918 public virtual bool UserPlayable => true; - [JsonIgnore] - public virtual bool PlayableInMultiplayer => UserPlayable; - - [JsonIgnore] - public virtual bool ValidFreeModInMultiplayer => PlayableInMultiplayer; - - [Obsolete("Going forward, the concept of \"ranked\" doesn't exist. The only exceptions are automation mods, which should now override and set UserPlayable to false.")] // Can be removed 20211009 + [Obsolete("Going forward, the concept of \"ranked\" doesn't exist. The only exceptions are automation mods, which should now override IsPlayable to false.")] // Can be removed 20211009 public virtual bool Ranked => false; /// diff --git a/osu.Game/Rulesets/Mods/ModUsage.cs b/osu.Game/Rulesets/Mods/ModUsage.cs new file mode 100644 index 0000000000..82ff6bc418 --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModUsage.cs @@ -0,0 +1,26 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace osu.Game.Rulesets.Mods +{ + /// + /// The usage of this mod to determine its playability. + /// + public enum ModUsage + { + /// + /// In a solo gameplay session. + /// + Solo, + + /// + /// In a multiplayer match, as a required mod. + /// + MultiplayerRequired, + + /// + /// In a multiplayer match, as a "free" mod. + /// + MultiplayerFree, + } +} From f2248ecc08000c1c259e306ad8d599b0a1c48c8c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 18 Mar 2022 02:11:18 +0300 Subject: [PATCH 0063/2328] Update usages to use `IsPlayable` instead --- osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs | 2 +- osu.Game/Rulesets/Mods/ModAutoplay.cs | 2 +- osu.Game/Rulesets/Mods/ModRateAdjust.cs | 2 +- osu.Game/Rulesets/Mods/ModTimeRamp.cs | 2 +- osu.Game/Rulesets/Mods/UnknownMod.cs | 2 +- osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs | 2 +- .../OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs | 4 ++-- osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs | 2 +- .../Screens/Play/PlayerSettings/BeatmapOffsetControl.cs | 3 ++- osu.Game/Screens/Play/SubmittingPlayer.cs | 3 ++- osu.Game/Screens/Ranking/ResultsScreen.cs | 3 ++- osu.Game/Utils/ModUtils.cs | 8 ++++---- 12 files changed, 19 insertions(+), 16 deletions(-) diff --git a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs index 54a4c054c9..17ef9f926e 100644 --- a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs +++ b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mods public override double ScoreMultiplier => 1; - public override bool PlayableInMultiplayer => false; + public override bool IsPlayable(ModUsage usage) => usage == ModUsage.Solo; public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModTimeRamp) }; diff --git a/osu.Game/Rulesets/Mods/ModAutoplay.cs b/osu.Game/Rulesets/Mods/ModAutoplay.cs index 60b9c29fe0..5491cbec07 100644 --- a/osu.Game/Rulesets/Mods/ModAutoplay.cs +++ b/osu.Game/Rulesets/Mods/ModAutoplay.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Mods public bool RestartOnFail => false; - public override bool UserPlayable => false; + public override bool IsPlayable(ModUsage usage) => false; public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModFailCondition), typeof(ModNoFail) }; diff --git a/osu.Game/Rulesets/Mods/ModRateAdjust.cs b/osu.Game/Rulesets/Mods/ModRateAdjust.cs index 3a11c3034b..810b93c4dd 100644 --- a/osu.Game/Rulesets/Mods/ModRateAdjust.cs +++ b/osu.Game/Rulesets/Mods/ModRateAdjust.cs @@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Mods { public abstract class ModRateAdjust : Mod, IApplicableToRate { - public override bool ValidFreeModInMultiplayer => false; + public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerFree; public abstract BindableNumber SpeedChange { get; } diff --git a/osu.Game/Rulesets/Mods/ModTimeRamp.cs b/osu.Game/Rulesets/Mods/ModTimeRamp.cs index 59aac62686..fa6a9f3e5b 100644 --- a/osu.Game/Rulesets/Mods/ModTimeRamp.cs +++ b/osu.Game/Rulesets/Mods/ModTimeRamp.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mods [SettingSource("Adjust pitch", "Should pitch be adjusted with speed")] public abstract BindableBool AdjustPitch { get; } - public override bool ValidFreeModInMultiplayer => false; + public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerFree; public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModAdaptiveSpeed) }; diff --git a/osu.Game/Rulesets/Mods/UnknownMod.cs b/osu.Game/Rulesets/Mods/UnknownMod.cs index b426386d7a..75d86e67bc 100644 --- a/osu.Game/Rulesets/Mods/UnknownMod.cs +++ b/osu.Game/Rulesets/Mods/UnknownMod.cs @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Mods public override string Description => "This mod could not be resolved by the game."; public override double ScoreMultiplier => 0; - public override bool UserPlayable => false; + public override bool IsPlayable(ModUsage usage) => false; public override ModType Type => ModType.System; diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs index d5abaaab4e..974e2b9305 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.OnlinePlay public new Func IsValidMod { get => base.IsValidMod; - set => base.IsValidMod = m => m.HasImplementation && m.UserPlayable && value(m); + set => base.IsValidMod = m => m.HasImplementation && m.IsPlayable(ModUsage.Solo) && value(m); } public FreeModSelectOverlay() diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs index e4f1d9587d..4c1350a56b 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs @@ -117,8 +117,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea(); - protected override bool IsValidMod(Mod mod) => base.IsValidMod(mod) && mod.PlayableInMultiplayer; + protected override bool IsValidMod(Mod mod) => base.IsValidMod(mod) && mod.IsPlayable(ModUsage.MultiplayerRequired); - protected override bool IsValidFreeMod(Mod mod) => base.IsValidFreeMod(mod) && mod.ValidFreeModInMultiplayer; + protected override bool IsValidFreeMod(Mod mod) => base.IsValidFreeMod(mod) && mod.IsPlayable(ModUsage.MultiplayerFree); } } diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs index 7b64784316..75e5ea60a4 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs @@ -170,7 +170,7 @@ namespace osu.Game.Screens.OnlinePlay /// /// The to check. /// Whether is a valid mod for online play. - protected virtual bool IsValidMod(Mod mod) => mod.HasImplementation && ModUtils.FlattenMod(mod).All(m => m.UserPlayable); + protected virtual bool IsValidMod(Mod mod) => mod.HasImplementation && ModUtils.FlattenMod(mod).All(m => m.IsPlayable(ModUsage.Solo)); /// /// Checks whether a given is valid for per-player free-mod selection. diff --git a/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs b/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs index 42091c521f..27aa4fe1f1 100644 --- a/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs +++ b/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs @@ -20,6 +20,7 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Localisation; using osu.Game.Overlays.Settings; +using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; using osu.Game.Screens.Ranking.Statistics; @@ -187,7 +188,7 @@ namespace osu.Game.Screens.Play.PlayerSettings if (score.NewValue == null) return; - if (score.NewValue.Mods.Any(m => !m.UserPlayable)) + if (score.NewValue.Mods.Any(m => !m.IsPlayable(ModUsage.Solo))) return; var hitEvents = score.NewValue.HitEvents; diff --git a/osu.Game/Screens/Play/SubmittingPlayer.cs b/osu.Game/Screens/Play/SubmittingPlayer.cs index b1f2bccddf..5de8aa1dc1 100644 --- a/osu.Game/Screens/Play/SubmittingPlayer.cs +++ b/osu.Game/Screens/Play/SubmittingPlayer.cs @@ -11,6 +11,7 @@ using osu.Framework.Logging; using osu.Framework.Screens; using osu.Game.Online.API; using osu.Game.Online.Rooms; +using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; @@ -47,7 +48,7 @@ namespace osu.Game.Screens.Play // Token request construction should happen post-load to allow derived classes to potentially prepare DI backings that are used to create the request. var tcs = new TaskCompletionSource(); - if (Mods.Value.Any(m => !m.UserPlayable)) + if (Mods.Value.Any(m => !m.IsPlayable(ModUsage.Solo))) { handleTokenFailure(new InvalidOperationException("Non-user playable mod selected.")); return false; diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index cb842ce4a0..09b6cc0f23 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -18,6 +18,7 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; using osu.Game.Online.API; +using osu.Game.Rulesets.Mods; using osu.Game.Scoring; using osu.Game.Screens.Play; using osu.Game.Screens.Ranking.Statistics; @@ -145,7 +146,7 @@ namespace osu.Game.Screens.Ranking if (Score != null) { // only show flair / animation when arriving after watching a play that isn't autoplay. - bool shouldFlair = player != null && Score.Mods.All(m => m.UserPlayable); + bool shouldFlair = player != null && Score.Mods.All(m => m.IsPlayable(ModUsage.Solo)); ScorePanelList.AddScore(Score, shouldFlair); } diff --git a/osu.Game/Utils/ModUtils.cs b/osu.Game/Utils/ModUtils.cs index 81b78c18ac..4915f5bdc6 100644 --- a/osu.Game/Utils/ModUtils.cs +++ b/osu.Game/Utils/ModUtils.cs @@ -115,13 +115,13 @@ namespace osu.Game.Utils => checkValid(mods, m => m.Type != ModType.System && m.HasImplementation && !(m is MultiMod), out invalidMods); /// - /// Check the provided combination of mods are valid for a multiplayer match session. + /// Check the provided combination of mods are valid as "required mods" in a multiplayer match session. /// /// The mods to check. /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. - public static bool CheckValidForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) - => checkValid(mods, m => m.PlayableInMultiplayer, out invalidMods); + public static bool CheckValidRequiredModsForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) + => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerRequired), out invalidMods); /// /// Check the provided combination of mods are valid as "free mods" in a multiplayer match session. @@ -130,7 +130,7 @@ namespace osu.Game.Utils /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidFreeModsForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) - => checkValid(mods, m => m.ValidFreeModInMultiplayer, out invalidMods); + => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerFree), out invalidMods); private static bool checkValid(IEnumerable mods, Predicate valid, [NotNullWhen(false)] out List? invalidMods) { From b5ff9ed13a0d6e936d949606af3ca44fe5a00df0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 18 Mar 2022 14:27:58 +0900 Subject: [PATCH 0064/2328] Add test coverage of multiplayer being paused when users are still loading --- .../Multiplayer/TestSceneMultiplayer.cs | 44 +++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs index e38da96bd5..2a3dbdaf95 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs @@ -494,17 +494,20 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("wait for song select", () => this.ChildrenOfType().FirstOrDefault()?.BeatmapSetsLoaded == true); - AddAssert("Mods match current item", () => SelectedMods.Value.Select(m => m.Acronym).SequenceEqual(multiplayerClient.Room.AsNonNull().Playlist.First().RequiredMods.Select(m => m.Acronym))); + AddAssert("Mods match current item", + () => SelectedMods.Value.Select(m => m.Acronym).SequenceEqual(multiplayerClient.Room.AsNonNull().Playlist.First().RequiredMods.Select(m => m.Acronym))); AddStep("Switch required mods", () => ((MultiplayerMatchSongSelect)multiplayerComponents.MultiplayerScreen.CurrentSubScreen).Mods.Value = new Mod[] { new OsuModDoubleTime() }); - AddAssert("Mods don't match current item", () => !SelectedMods.Value.Select(m => m.Acronym).SequenceEqual(multiplayerClient.Room.AsNonNull().Playlist.First().RequiredMods.Select(m => m.Acronym))); + AddAssert("Mods don't match current item", + () => !SelectedMods.Value.Select(m => m.Acronym).SequenceEqual(multiplayerClient.Room.AsNonNull().Playlist.First().RequiredMods.Select(m => m.Acronym))); AddStep("start match externally", () => multiplayerClient.StartMatch()); AddUntilStep("play started", () => multiplayerComponents.CurrentScreen is Player); - AddAssert("Mods match current item", () => SelectedMods.Value.Select(m => m.Acronym).SequenceEqual(multiplayerClient.Room.AsNonNull().Playlist.First().RequiredMods.Select(m => m.Acronym))); + AddAssert("Mods match current item", + () => SelectedMods.Value.Select(m => m.Acronym).SequenceEqual(multiplayerClient.Room.AsNonNull().Playlist.First().RequiredMods.Select(m => m.Acronym))); } [Test] @@ -664,6 +667,41 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("wait for results", () => multiplayerComponents.CurrentScreen is ResultsScreen); } + [Test] + public void TestGameplayDoesntStartWithNonLoadedUser() + { + createRoom(() => new Room + { + Name = { Value = "Test Room" }, + Playlist = + { + new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo) + { + RulesetID = new OsuRuleset().RulesetInfo.OnlineID, + } + } + }); + + pressReadyButton(); + + AddStep("join other user and ready", () => + { + multiplayerClient.AddUser(new APIUser { Id = 1234 }); + multiplayerClient.ChangeUserState(1234, MultiplayerUserState.Ready); + }); + + AddStep("start match", () => + { + multiplayerClient.StartMatch(); + }); + + AddUntilStep("wait for player", () => multiplayerComponents.CurrentScreen is Player); + + AddWaitStep("wait some", 20); + + AddAssert("ensure gameplay hasn't started", () => this.ChildrenOfType().SingleOrDefault()?.IsRunning == false); + } + [Test] public void TestRoomSettingsReQueriedWhenJoiningRoom() { From 59aef88504a8408eb49b61d7362941ef177d7520 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 18 Mar 2022 15:07:57 +0900 Subject: [PATCH 0065/2328] Simplify clock reset/start flow in `MultiSpectatorScreen` --- .../OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs index 6747b8fc66..523301f4fd 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs @@ -164,7 +164,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate base.LoadComplete(); masterClockContainer.Reset(); - masterClockContainer.Stop(); syncManager.ReadyToStart += onReadyToStart; syncManager.MasterState.BindValueChanged(onMasterStateChanged, true); @@ -198,8 +197,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate .DefaultIfEmpty(0) .Min(); - masterClockContainer.Seek(startTime); - masterClockContainer.Start(); + masterClockContainer.Reset(true, startTime); // Although the clock has been started, this flag is set to allow for later synchronisation state changes to also be able to start it. canStartMasterClock = true; From f09a9467226f335c95c823bb03b09fc99f13de4e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 18 Mar 2022 15:08:25 +0900 Subject: [PATCH 0066/2328] Start `GameplayClockContainer` paused for better state control --- .../Gameplay/TestSceneMasterGameplayClockContainer.cs | 5 +---- .../OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayer.cs | 2 -- osu.Game/Screens/Play/GameplayClockContainer.cs | 6 +++--- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs b/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs index 77b402ad3c..0ed432bbea 100644 --- a/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs +++ b/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs @@ -85,10 +85,7 @@ namespace osu.Game.Tests.Gameplay Add(gameplayClockContainer = new MasterGameplayClockContainer(working, 0)); - if (whileStopped) - gameplayClockContainer.Stop(); - - gameplayClockContainer.Reset(); + gameplayClockContainer.Reset(startClock: !whileStopped); }); AddStep($"set clock rate to {clockRate}", () => working.Track.AddAdjustment(AdjustableProperty.Frequency, new BindableDouble(clockRate))); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayer.cs index 615bd41f3f..ececa1e497 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayer.cs @@ -55,8 +55,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate public SpectatorGameplayClockContainer([NotNull] IClock sourceClock) : base(sourceClock) { - // the container should initially be in a stopped state until the catch-up clock is started by the sync manager. - Stop(); } protected override void Update() diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index 66f5cb0bd4..226f5709c7 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Play /// /// Whether gameplay is paused. /// - public readonly BindableBool IsPaused = new BindableBool(); + public readonly BindableBool IsPaused = new BindableBool(true); /// /// The adjustable source clock used for gameplay. Should be used for seeks and clock control. @@ -115,7 +115,7 @@ namespace osu.Game.Screens.Play /// /// Resets this and the source to an initial state ready for gameplay. /// - /// Whether to start the clock immediately. + /// Whether to start the clock immediately, if not already started. /// A time to use for future calls as the definite start of gameplay. public void Reset(bool startClock = false, double? gameplayStartTime = null) { @@ -128,7 +128,7 @@ namespace osu.Game.Screens.Play // Manually stop the source in order to not affect the IsPaused state. AdjustableSource.Stop(); - if (!IsPaused.Value && startClock) + if (!IsPaused.Value || startClock) Start(); } From 0988c2b0fabd104792f7ebd7a4b3be49b1a26fb9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 18 Mar 2022 15:28:48 +0900 Subject: [PATCH 0067/2328] Move `DrawableRuleset` binding to `LoadComplete` to avoid exceptions on `InputManager` access --- osu.Game/Rulesets/UI/DrawableRuleset.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index 29559f5036..be1105e7ff 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -133,6 +133,11 @@ namespace osu.Game.Rulesets.UI p.NewResult += (_, r) => NewResult?.Invoke(r); p.RevertResult += (_, r) => RevertResult?.Invoke(r); })); + } + + protected override void LoadComplete() + { + base.LoadComplete(); IsPaused.ValueChanged += paused => { From 611562c6502aaedeeba6f1c8ff883d51fb539518 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 18 Mar 2022 16:21:14 +0900 Subject: [PATCH 0068/2328] Add more comments around catch up logic --- .../OnlinePlay/Multiplayer/Spectate/ISpectatorPlayerClock.cs | 5 ++++- .../OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayer.cs | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISpectatorPlayerClock.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISpectatorPlayerClock.cs index 1a5231e602..de23b4fef7 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISpectatorPlayerClock.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISpectatorPlayerClock.cs @@ -17,8 +17,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate Bindable WaitingOnFrames { get; } /// - /// Whether this clock is resynchronising to the master clock. + /// Whether this clock is behind the master clock and running at a higher rate to catch up to it. /// + /// + /// Of note, this will be false if this clock is *ahead* of the master clock. + /// bool IsCatchingUp { get; set; } /// diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayer.cs index ececa1e497..29afaf00d8 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayer.cs @@ -59,6 +59,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate protected override void Update() { + // The SourceClock here is always a CatchUpSpectatorPlayerClock. // The player clock's running state is controlled externally, but the local pausing state needs to be updated to stop gameplay. if (SourceClock.IsRunning) Start(); From 4bc7c69bf70e7aa1bf91deec0e587523da0ea368 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 18 Mar 2022 16:27:14 +0900 Subject: [PATCH 0069/2328] Fix test regression due to missing argument --- .../Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs index ed8b0bdd96..653a35417e 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs @@ -473,7 +473,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } protected override MasterGameplayClockContainer CreateMasterGameplayClockContainer(WorkingBeatmap beatmap) - => new MasterGameplayClockContainer(beatmap, gameplayStartTime ?? 0); + => new MasterGameplayClockContainer(beatmap, gameplayStartTime ?? 0, true); } } } From 7cb7b03cee678db55530d8134d39295089a6a216 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 18 Mar 2022 18:16:45 +0900 Subject: [PATCH 0070/2328] Fix `TestSceneMasterGameplayClockContainer` not clearing previous test clocks --- .../Gameplay/TestSceneMasterGameplayClockContainer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs b/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs index 0ed432bbea..b2dd6cbd97 100644 --- a/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs +++ b/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs @@ -36,7 +36,7 @@ namespace osu.Game.Tests.Gameplay var working = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo); working.LoadTrack(); - Add(gameplayClockContainer = new MasterGameplayClockContainer(working, 0)); + Child = gameplayClockContainer = new MasterGameplayClockContainer(working, 0); }); AddStep("start clock", () => gameplayClockContainer.Start()); @@ -53,7 +53,7 @@ namespace osu.Game.Tests.Gameplay var working = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo); working.LoadTrack(); - Add(gameplayClockContainer = new MasterGameplayClockContainer(working, 0)); + Child = gameplayClockContainer = new MasterGameplayClockContainer(working, 0); }); AddStep("start clock", () => gameplayClockContainer.Start()); @@ -83,7 +83,7 @@ namespace osu.Game.Tests.Gameplay working = new ClockBackedTestWorkingBeatmap(new OsuRuleset().RulesetInfo, new FramedClock(new ManualClock()), Audio); working.LoadTrack(); - Add(gameplayClockContainer = new MasterGameplayClockContainer(working, 0)); + Child = gameplayClockContainer = new MasterGameplayClockContainer(working, 0); gameplayClockContainer.Reset(startClock: !whileStopped); }); From 70e943fbccb1d1e2746aeb605f63b208cf8b6a76 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 20 Mar 2022 06:36:51 +0300 Subject: [PATCH 0071/2328] `ModUsage.Solo` -> `ModUsage.User` --- osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs | 2 +- osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs | 2 +- osu.Game/Rulesets/Mods/ModUsage.cs | 2 +- osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs | 2 +- osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs | 2 +- osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs | 2 +- osu.Game/Screens/Play/SubmittingPlayer.cs | 2 +- osu.Game/Screens/Ranking/ResultsScreen.cs | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs b/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs index 97b89c6f74..caeb757d7a 100644 --- a/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs +++ b/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs @@ -63,7 +63,7 @@ namespace osu.Game.Overlays.BeatmapSet return; modsContainer.Add(new ModButton(new ModNoMod())); - modsContainer.AddRange(rulesetInstance.AllMods.Where(m => m.IsPlayable(ModUsage.Solo)).Select(m => new ModButton(m))); + modsContainer.AddRange(rulesetInstance.AllMods.Where(m => m.IsPlayable(ModUsage.User)).Select(m => new ModButton(m))); modsContainer.ForEach(button => { diff --git a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs index 17ef9f926e..801cd3cba7 100644 --- a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs +++ b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mods public override double ScoreMultiplier => 1; - public override bool IsPlayable(ModUsage usage) => usage == ModUsage.Solo; + public override bool IsPlayable(ModUsage usage) => usage == ModUsage.User; public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModTimeRamp) }; diff --git a/osu.Game/Rulesets/Mods/ModUsage.cs b/osu.Game/Rulesets/Mods/ModUsage.cs index 82ff6bc418..714a99056b 100644 --- a/osu.Game/Rulesets/Mods/ModUsage.cs +++ b/osu.Game/Rulesets/Mods/ModUsage.cs @@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Mods /// /// In a solo gameplay session. /// - Solo, + User, /// /// In a multiplayer match, as a required mod. diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs index 974e2b9305..37cffd8343 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.OnlinePlay public new Func IsValidMod { get => base.IsValidMod; - set => base.IsValidMod = m => m.HasImplementation && m.IsPlayable(ModUsage.Solo) && value(m); + set => base.IsValidMod = m => m.HasImplementation && m.IsPlayable(ModUsage.User) && value(m); } public FreeModSelectOverlay() diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs index 75e5ea60a4..d4f89b5206 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs @@ -170,7 +170,7 @@ namespace osu.Game.Screens.OnlinePlay /// /// The to check. /// Whether is a valid mod for online play. - protected virtual bool IsValidMod(Mod mod) => mod.HasImplementation && ModUtils.FlattenMod(mod).All(m => m.IsPlayable(ModUsage.Solo)); + protected virtual bool IsValidMod(Mod mod) => mod.HasImplementation && ModUtils.FlattenMod(mod).All(m => m.IsPlayable(ModUsage.User)); /// /// Checks whether a given is valid for per-player free-mod selection. diff --git a/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs b/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs index 27aa4fe1f1..bab391337a 100644 --- a/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs +++ b/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs @@ -188,7 +188,7 @@ namespace osu.Game.Screens.Play.PlayerSettings if (score.NewValue == null) return; - if (score.NewValue.Mods.Any(m => !m.IsPlayable(ModUsage.Solo))) + if (score.NewValue.Mods.Any(m => !m.IsPlayable(ModUsage.User))) return; var hitEvents = score.NewValue.HitEvents; diff --git a/osu.Game/Screens/Play/SubmittingPlayer.cs b/osu.Game/Screens/Play/SubmittingPlayer.cs index 5de8aa1dc1..205ee9ab9c 100644 --- a/osu.Game/Screens/Play/SubmittingPlayer.cs +++ b/osu.Game/Screens/Play/SubmittingPlayer.cs @@ -48,7 +48,7 @@ namespace osu.Game.Screens.Play // Token request construction should happen post-load to allow derived classes to potentially prepare DI backings that are used to create the request. var tcs = new TaskCompletionSource(); - if (Mods.Value.Any(m => !m.IsPlayable(ModUsage.Solo))) + if (Mods.Value.Any(m => !m.IsPlayable(ModUsage.User))) { handleTokenFailure(new InvalidOperationException("Non-user playable mod selected.")); return false; diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index 09b6cc0f23..ac3816c4ec 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -146,7 +146,7 @@ namespace osu.Game.Screens.Ranking if (Score != null) { // only show flair / animation when arriving after watching a play that isn't autoplay. - bool shouldFlair = player != null && Score.Mods.All(m => m.IsPlayable(ModUsage.Solo)); + bool shouldFlair = player != null && Score.Mods.All(m => m.IsPlayable(ModUsage.User)); ScorePanelList.AddScore(Score, shouldFlair); } From 820a672940b151a43b54f510dc03b8476bd95ce9 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 20 Mar 2022 06:37:08 +0300 Subject: [PATCH 0072/2328] Reword xmldoc to make more sense --- osu.Game/Rulesets/Mods/ModUsage.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Mods/ModUsage.cs b/osu.Game/Rulesets/Mods/ModUsage.cs index 714a99056b..0892f528d5 100644 --- a/osu.Game/Rulesets/Mods/ModUsage.cs +++ b/osu.Game/Rulesets/Mods/ModUsage.cs @@ -4,22 +4,22 @@ namespace osu.Game.Rulesets.Mods { /// - /// The usage of this mod to determine its playability. + /// The usage of this mod to determine whether it's playable in such context. /// public enum ModUsage { /// - /// In a solo gameplay session. + /// Used for a per-user gameplay session. Determines whether the mod is playable by an end user. /// User, /// - /// In a multiplayer match, as a required mod. + /// Used as a "required mod" for a multiplayer match. /// MultiplayerRequired, /// - /// In a multiplayer match, as a "free" mod. + /// Used as a "free mod" for a multiplayer match. /// MultiplayerFree, } From add9f3ec9177815f7dab386927c47ad436d9576f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 20 Mar 2022 13:12:24 +0300 Subject: [PATCH 0073/2328] Rename multiplayer mod usages to make more sense --- osu.Game/Rulesets/Mods/IMod.cs | 4 ++-- osu.Game/Rulesets/Mods/ModRateAdjust.cs | 2 +- osu.Game/Rulesets/Mods/ModTimeRamp.cs | 2 +- osu.Game/Rulesets/Mods/ModUsage.cs | 12 +++++++----- .../Multiplayer/MultiplayerMatchSongSelect.cs | 4 ++-- osu.Game/Utils/ModUtils.cs | 4 ++-- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/osu.Game/Rulesets/Mods/IMod.cs b/osu.Game/Rulesets/Mods/IMod.cs index bdfb273b13..325b75b76e 100644 --- a/osu.Game/Rulesets/Mods/IMod.cs +++ b/osu.Game/Rulesets/Mods/IMod.cs @@ -39,8 +39,8 @@ namespace osu.Game.Rulesets.Mods /// /// /// Should be always false for cases where the user is not interacting with the game. - /// Should be false in for mods that make gameplay duration dependent on user input (e.g. ). - /// Should be false in for mods that affect the gameplay duration (e.g. and ). + /// Should be false in for mods that make gameplay duration dependent on user input (e.g. ). + /// Should be false in for mods that affect the gameplay duration (e.g. and ). /// /// /// The mod usage. diff --git a/osu.Game/Rulesets/Mods/ModRateAdjust.cs b/osu.Game/Rulesets/Mods/ModRateAdjust.cs index 810b93c4dd..ab724673b6 100644 --- a/osu.Game/Rulesets/Mods/ModRateAdjust.cs +++ b/osu.Game/Rulesets/Mods/ModRateAdjust.cs @@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Mods { public abstract class ModRateAdjust : Mod, IApplicableToRate { - public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerFree; + public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerPerPlayer; public abstract BindableNumber SpeedChange { get; } diff --git a/osu.Game/Rulesets/Mods/ModTimeRamp.cs b/osu.Game/Rulesets/Mods/ModTimeRamp.cs index fa6a9f3e5b..96b38301b5 100644 --- a/osu.Game/Rulesets/Mods/ModTimeRamp.cs +++ b/osu.Game/Rulesets/Mods/ModTimeRamp.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mods [SettingSource("Adjust pitch", "Should pitch be adjusted with speed")] public abstract BindableBool AdjustPitch { get; } - public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerFree; + public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerPerPlayer; public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModAdaptiveSpeed) }; diff --git a/osu.Game/Rulesets/Mods/ModUsage.cs b/osu.Game/Rulesets/Mods/ModUsage.cs index 0892f528d5..59a62bfc6f 100644 --- a/osu.Game/Rulesets/Mods/ModUsage.cs +++ b/osu.Game/Rulesets/Mods/ModUsage.cs @@ -9,18 +9,20 @@ namespace osu.Game.Rulesets.Mods public enum ModUsage { /// - /// Used for a per-user gameplay session. Determines whether the mod is playable by an end user. + /// Used for a per-user gameplay session. + /// Determines whether the mod is playable by an end user. /// User, /// - /// Used as a "required mod" for a multiplayer match. + /// Used in multiplayer but must be applied to all users. + /// This is generally the case for mods which affect the length of gameplay. /// - MultiplayerRequired, + MultiplayerRoomWide, /// - /// Used as a "free mod" for a multiplayer match. + /// Used in multiplayer either at a room or per-player level (i.e. "free mod"). /// - MultiplayerFree, + MultiplayerPerPlayer, } } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs index 4c1350a56b..63467dbb9d 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs @@ -117,8 +117,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea(); - protected override bool IsValidMod(Mod mod) => base.IsValidMod(mod) && mod.IsPlayable(ModUsage.MultiplayerRequired); + protected override bool IsValidMod(Mod mod) => base.IsValidMod(mod) && mod.IsPlayable(ModUsage.MultiplayerRoomWide); - protected override bool IsValidFreeMod(Mod mod) => base.IsValidFreeMod(mod) && mod.IsPlayable(ModUsage.MultiplayerFree); + protected override bool IsValidFreeMod(Mod mod) => base.IsValidFreeMod(mod) && mod.IsPlayable(ModUsage.MultiplayerPerPlayer); } } diff --git a/osu.Game/Utils/ModUtils.cs b/osu.Game/Utils/ModUtils.cs index 4915f5bdc6..946386a7ce 100644 --- a/osu.Game/Utils/ModUtils.cs +++ b/osu.Game/Utils/ModUtils.cs @@ -121,7 +121,7 @@ namespace osu.Game.Utils /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidRequiredModsForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) - => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerRequired), out invalidMods); + => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerRoomWide), out invalidMods); /// /// Check the provided combination of mods are valid as "free mods" in a multiplayer match session. @@ -130,7 +130,7 @@ namespace osu.Game.Utils /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidFreeModsForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) - => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerFree), out invalidMods); + => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerPerPlayer), out invalidMods); private static bool checkValid(IEnumerable mods, Predicate valid, [NotNullWhen(false)] out List? invalidMods) { From 5f878ed82b98a1d3ec14af96879c4d68bee8d167 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 20 Mar 2022 16:07:08 +0300 Subject: [PATCH 0074/2328] Delegate `IsPlayable` to the obsoleted `UserPlayable` by default Handles consumers who still haven't updated to use `IsPlayable` yet. --- osu.Game/Rulesets/Mods/Mod.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs index 00aef1a598..debb1a1e48 100644 --- a/osu.Game/Rulesets/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -91,7 +91,9 @@ namespace osu.Game.Rulesets.Mods [JsonIgnore] public virtual bool HasImplementation => this is IApplicableMod; - public virtual bool IsPlayable(ModUsage usage) => true; +#pragma warning disable 618 + public virtual bool IsPlayable(ModUsage usage) => UserPlayable; +#pragma warning restore 618 [JsonIgnore] [Obsolete("Override IsPlayable instead.")] // Can be removed 20220918 From 145fca2704457fe58baaf294b960812ce41dd49d Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 20 Mar 2022 16:17:19 +0300 Subject: [PATCH 0075/2328] Fix failing test scenes --- osu.Game.Tests/Mods/ModUtilsTest.cs | 12 ------------ osu.Game/Utils/ModUtils.cs | 6 +++--- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/osu.Game.Tests/Mods/ModUtilsTest.cs b/osu.Game.Tests/Mods/ModUtilsTest.cs index 4c126f0a3b..e858abfe44 100644 --- a/osu.Game.Tests/Mods/ModUtilsTest.cs +++ b/osu.Game.Tests/Mods/ModUtilsTest.cs @@ -134,18 +134,6 @@ namespace osu.Game.Tests.Mods private static readonly object[] invalid_mod_test_scenarios = { - // incompatible pair. - new object[] - { - new Mod[] { new OsuModDoubleTime(), new OsuModHalfTime() }, - new[] { typeof(OsuModDoubleTime), typeof(OsuModHalfTime) } - }, - // incompatible pair with derived class. - new object[] - { - new Mod[] { new OsuModNightcore(), new OsuModHalfTime() }, - new[] { typeof(OsuModNightcore), typeof(OsuModHalfTime) } - }, // system mod. new object[] { diff --git a/osu.Game/Utils/ModUtils.cs b/osu.Game/Utils/ModUtils.cs index 946386a7ce..0d46494319 100644 --- a/osu.Game/Utils/ModUtils.cs +++ b/osu.Game/Utils/ModUtils.cs @@ -106,7 +106,7 @@ namespace osu.Game.Utils } /// - /// Check the provided combination of mods are valid for a local gameplay session. + /// Checks that all s in a combination are valid for a local gameplay session. /// /// The mods to check. /// Invalid mods, if any were found. Will be null if all mods were valid. @@ -115,7 +115,7 @@ namespace osu.Game.Utils => checkValid(mods, m => m.Type != ModType.System && m.HasImplementation && !(m is MultiMod), out invalidMods); /// - /// Check the provided combination of mods are valid as "required mods" in a multiplayer match session. + /// Checks that all s in a combination are valid as "required mods" in a multiplayer match session. /// /// The mods to check. /// Invalid mods, if any were found. Will be null if all mods were valid. @@ -124,7 +124,7 @@ namespace osu.Game.Utils => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerRoomWide), out invalidMods); /// - /// Check the provided combination of mods are valid as "free mods" in a multiplayer match session. + /// Checks that all s in a combination are valid as "free mods" in a multiplayer match session. /// /// The mods to check. /// Invalid mods, if any were found. Will be null if all mods were valid. From b218046fa28ef9ebb257663adf5388d9174345ee Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 23 Mar 2022 15:38:48 +0300 Subject: [PATCH 0076/2328] Remove redundant line from mod usage --- osu.Game/Rulesets/Mods/ModUsage.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Rulesets/Mods/ModUsage.cs b/osu.Game/Rulesets/Mods/ModUsage.cs index 59a62bfc6f..746387a062 100644 --- a/osu.Game/Rulesets/Mods/ModUsage.cs +++ b/osu.Game/Rulesets/Mods/ModUsage.cs @@ -10,7 +10,6 @@ namespace osu.Game.Rulesets.Mods { /// /// Used for a per-user gameplay session. - /// Determines whether the mod is playable by an end user. /// User, From 6cd67928aba27e2936fd8f0a6cfc0ae7838e1e67 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 23 Mar 2022 15:48:50 +0300 Subject: [PATCH 0077/2328] Simplify documentation of `ModUsage` --- osu.Game/Rulesets/Mods/ModUsage.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Mods/ModUsage.cs b/osu.Game/Rulesets/Mods/ModUsage.cs index 746387a062..04d99149dd 100644 --- a/osu.Game/Rulesets/Mods/ModUsage.cs +++ b/osu.Game/Rulesets/Mods/ModUsage.cs @@ -4,23 +4,23 @@ namespace osu.Game.Rulesets.Mods { /// - /// The usage of this mod to determine whether it's playable in such context. + /// The context in which a is playable. /// public enum ModUsage { /// - /// Used for a per-user gameplay session. + /// This mod can be used for a per-user gameplay session. /// User, /// - /// Used in multiplayer but must be applied to all users. + /// This mod can be used in multiplayer but must be applied to all users. /// This is generally the case for mods which affect the length of gameplay. /// MultiplayerRoomWide, /// - /// Used in multiplayer either at a room or per-player level (i.e. "free mod"). + /// This mod can be used in multiplayer either at a room or per-player level (i.e. "free mod"). /// MultiplayerPerPlayer, } From 8ca9cbc866e089338b09585890c97fc5dfce8da4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Mar 2022 14:43:33 +0900 Subject: [PATCH 0078/2328] Set a more correct initial value for `pauseFreqAdjust` As the `GameplayClock` now starts paused, this value needs to match to ensure things work correctly. For a better explanation of how we got here, see discussion at https://github.com/ppy/osu/pull/17302#discussion_r830017735. --- osu.Game/Screens/Play/MasterGameplayClockContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs index 529503e020..9bcbbf789b 100644 --- a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs +++ b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs @@ -46,7 +46,7 @@ namespace osu.Game.Screens.Play private double totalAppliedOffset => userBeatmapOffsetClock.RateAdjustedOffset + userGlobalOffsetClock.RateAdjustedOffset + platformOffsetClock.RateAdjustedOffset; - private readonly BindableDouble pauseFreqAdjust = new BindableDouble(1); + private readonly BindableDouble pauseFreqAdjust = new BindableDouble(); // Important that this starts at zero, matching the paused state of the clock. private readonly WorkingBeatmap beatmap; From 16dc2f6ef50bccada9e9cba2f3e934324204140c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Mar 2022 14:51:21 +0900 Subject: [PATCH 0079/2328] Adjust `TestSceneFailAnimation` to account for initial frequency change --- osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs index 744227c55e..83d7d769df 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs @@ -56,10 +56,11 @@ namespace osu.Game.Tests.Visual.Gameplay private double lastFrequency = double.MaxValue; - protected override void Update() + protected override void UpdateAfterChildren() { - base.Update(); + base.UpdateAfterChildren(); + // This must be done in UpdateAfterChildren to allow the gameplay clock to have updated before checking values. double freq = Beatmap.Value.Track.AggregateFrequency.Value; FrequencyIncreased |= freq > lastFrequency; From 1049e349e39a8944c223b71ad8d0a621a3965781 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Mar 2022 14:55:01 +0900 Subject: [PATCH 0080/2328] Add test coverage of user offset being set before construction of `MasterGameplayClockContainer` --- .../Gameplay/TestSceneMasterGameplayClockContainer.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs b/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs index b2dd6cbd97..75be7b0362 100644 --- a/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs +++ b/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs @@ -73,11 +73,15 @@ namespace osu.Game.Tests.Gameplay public void TestSeekPerformsInGameplayTime( [Values(1.0, 0.5, 2.0)] double clockRate, [Values(0.0, 200.0, -200.0)] double userOffset, - [Values(false, true)] bool whileStopped) + [Values(false, true)] bool whileStopped, + [Values(false, true)] bool setAudioOffsetBeforeConstruction) { ClockBackedTestWorkingBeatmap working = null; GameplayClockContainer gameplayClockContainer = null; + if (setAudioOffsetBeforeConstruction) + AddStep($"preset audio offset to {userOffset}", () => localConfig.SetValue(OsuSetting.AudioOffset, userOffset)); + AddStep("create container", () => { working = new ClockBackedTestWorkingBeatmap(new OsuRuleset().RulesetInfo, new FramedClock(new ManualClock()), Audio); @@ -89,7 +93,9 @@ namespace osu.Game.Tests.Gameplay }); AddStep($"set clock rate to {clockRate}", () => working.Track.AddAdjustment(AdjustableProperty.Frequency, new BindableDouble(clockRate))); - AddStep($"set audio offset to {userOffset}", () => localConfig.SetValue(OsuSetting.AudioOffset, userOffset)); + + if (!setAudioOffsetBeforeConstruction) + AddStep($"set audio offset to {userOffset}", () => localConfig.SetValue(OsuSetting.AudioOffset, userOffset)); AddStep("seek to 2500", () => gameplayClockContainer.Seek(2500)); AddAssert("gameplay clock time = 2500", () => Precision.AlmostEquals(gameplayClockContainer.CurrentTime, 2500, 10f)); From 5b3eb2d6f443ea90322787f28033e77335648cbe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 30 Mar 2022 23:54:00 +0900 Subject: [PATCH 0081/2328] Add helper class to handle firing async multiplayer methods --- .../MultiplayerClientExtensions.cs | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs diff --git a/osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs b/osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs new file mode 100644 index 0000000000..98c593236a --- /dev/null +++ b/osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs @@ -0,0 +1,43 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable +using System; +using System.Diagnostics; +using System.Threading.Tasks; +using Microsoft.AspNetCore.SignalR; +using osu.Framework.Logging; + +namespace osu.Game.Online.Multiplayer +{ + public static class MultiplayerClientExtensions + { + public static void FireAndForget(this Task task, Action? onSuccess = null, Action? onError = null) => + task.ContinueWith(t => + { + if (t.IsFaulted) + { + Exception? exception = t.Exception; + + if (exception is AggregateException ae) + exception = ae.InnerException; + + Debug.Assert(exception != null); + + string message = exception is HubException + // HubExceptions arrive with additional message context added, but we want to display the human readable message: + // "An unexpected error occurred invoking 'AddPlaylistItem' on the server.InvalidStateException: Can't enqueue more than 3 items at once." + // We generally use the message field for a user-parseable error (eventually to be replaced), so drop the first part for now. + ? exception.Message.Substring(exception.Message.IndexOf(':') + 1).Trim() + : exception.Message; + + Logger.Log(message, level: LogLevel.Important); + onError?.Invoke(exception); + } + else + { + onSuccess?.Invoke(); + } + }); + } +} From e0c125a628c5848f01b4f8c9616c4cf75e6c2667 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 30 Mar 2022 23:57:19 +0900 Subject: [PATCH 0082/2328] Replace existing usage with helper method --- .../Multiplayer/MultiplayerMatchSongSelect.cs | 49 ++++++------------- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs index d49c122bd1..2e8f625eba 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs @@ -1,13 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using System.Diagnostics; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.SignalR; using osu.Framework.Allocation; -using osu.Framework.Logging; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; @@ -76,40 +72,23 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer Task task = itemToEdit != null ? client.EditPlaylistItem(multiplayerItem) : client.AddPlaylistItem(multiplayerItem); - task.ContinueWith(t => + task.FireAndForget(onSuccess: () => Schedule(() => { - Schedule(() => - { - // If an error or server side trigger occurred this screen may have already exited by external means. - if (!this.IsCurrentScreen()) - return; + // If an error or server side trigger occurred this screen may have already exited by external means. + if (!this.IsCurrentScreen()) + return; - loadingLayer.Hide(); + loadingLayer.Hide(); + this.Exit(); + }), onError: _ => Schedule(() => + { + // If an error or server side trigger occurred this screen may have already exited by external means. + if (!this.IsCurrentScreen()) + return; - if (t.IsFaulted) - { - Exception exception = t.Exception; - - if (exception is AggregateException ae) - exception = ae.InnerException; - - Debug.Assert(exception != null); - - string message = exception is HubException - // HubExceptions arrive with additional message context added, but we want to display the human readable message: - // "An unexpected error occurred invoking 'AddPlaylistItem' on the server.InvalidStateException: Can't enqueue more than 3 items at once." - // We generally use the message field for a user-parseable error (eventually to be replaced), so drop the first part for now. - ? exception.Message.Substring(exception.Message.IndexOf(':') + 1).Trim() - : exception.Message; - - Logger.Log(message, level: LogLevel.Important); - Carousel.AllowSelection = true; - return; - } - - this.Exit(); - }); - }); + loadingLayer.Hide(); + Carousel.AllowSelection = true; + })); } else { From 0b6db315111cdc4756c7eda240836f2a633a6d59 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 30 Mar 2022 23:58:30 +0900 Subject: [PATCH 0083/2328] Guard other multiplayer client calls with exception handling --- .../Multiplayer/Match/MatchStartControl.cs | 17 ++++++++--------- .../Match/Playlist/MultiplayerQueueList.cs | 2 +- .../OnlinePlay/Multiplayer/Multiplayer.cs | 2 +- .../Multiplayer/MultiplayerMatchSubScreen.cs | 6 +++--- .../Participants/ParticipantPanel.cs | 6 +++--- .../Multiplayer/Participants/TeamDisplay.cs | 2 +- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MatchStartControl.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MatchStartControl.cs index 1201279929..d048676872 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MatchStartControl.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MatchStartControl.cs @@ -114,18 +114,17 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match bool isReady() => Client.LocalUser?.State == MultiplayerUserState.Ready || Client.LocalUser?.State == MultiplayerUserState.Spectating; - void toggleReady() => Client.ToggleReady().ContinueWith(_ => endOperation()); + void toggleReady() => Client.ToggleReady().FireAndForget( + onSuccess: endOperation, + onError: _ => endOperation()); - void startMatch() => Client.StartMatch().ContinueWith(t => + void startMatch() => Client.StartMatch().FireAndForget(onSuccess: () => { - // accessing Exception here silences any potential errors from the antecedent task - if (t.Exception != null) - { - // gameplay was not started due to an exception; unblock button. - endOperation(); - } - // gameplay is starting, the button will be unblocked on load requested. + }, onError: _ => + { + // gameplay was not started due to an exception; unblock button. + endOperation(); }); } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerQueueList.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerQueueList.cs index 1653d416d8..d72ce5e960 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerQueueList.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerQueueList.cs @@ -62,7 +62,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist { base.LoadComplete(); - RequestDeletion = item => multiplayerClient.RemovePlaylistItem(item.ID); + RequestDeletion = item => multiplayerClient.RemovePlaylistItem(item.ID).FireAndForget(); multiplayerClient.RoomUpdated += onRoomUpdated; onRoomUpdated(); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs index 28c9bef3f0..2482d52492 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs @@ -48,7 +48,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer // If gameplay wasn't finished, then we have a simple path back to the idle state by aborting gameplay. if (!playerLoader.GameplayPassed) { - client.AbortGameplay(); + client.AbortGameplay().FireAndForget(); return; } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs index e53153e017..7ef0bb5923 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs @@ -281,7 +281,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer if (client.Room == null) return; - client.ChangeUserMods(mods.NewValue); + client.ChangeUserMods(mods.NewValue).FireAndForget(); modSettingChangeTracker = new ModSettingChangeTracker(mods.NewValue); modSettingChangeTracker.SettingChanged += onModSettingsChanged; @@ -296,7 +296,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer if (client.Room == null) return; - client.ChangeUserMods(UserMods.Value); + client.ChangeUserMods(UserMods.Value).FireAndForget(); }, 500); } @@ -305,7 +305,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer if (client.Room == null) return; - client.ChangeBeatmapAvailability(availability.NewValue); + client.ChangeBeatmapAvailability(availability.NewValue).FireAndForget(); if (availability.NewValue.State != DownloadState.LocallyAvailable) { diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs index 7ba0a63856..e091559046 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs @@ -169,7 +169,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants Origin = Anchor.Centre, Alpha = 0, Margin = new MarginPadding(4), - Action = () => Client.KickUser(User.UserID), + Action = () => Client.KickUser(User.UserID).FireAndForget(), }, }, } @@ -231,7 +231,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants if (!Client.IsHost) return; - Client.TransferHost(targetUser); + Client.TransferHost(targetUser).FireAndForget(); }), new OsuMenuItem("Kick", MenuItemType.Destructive, () => { @@ -239,7 +239,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants if (!Client.IsHost) return; - Client.KickUser(targetUser); + Client.KickUser(targetUser).FireAndForget(); }) }; } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/TeamDisplay.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/TeamDisplay.cs index 73aca0acdc..aca2c6073a 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/TeamDisplay.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/TeamDisplay.cs @@ -83,7 +83,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants Client.SendMatchRequest(new ChangeTeamRequest { TeamID = ((Client.LocalUser?.MatchState as TeamVersusUserState)?.TeamID + 1) % 2 ?? 0, - }); + }).FireAndForget(); } public int? DisplayedTeam { get; private set; } From d0873d67e1569b1345113d34407bc0878bbf718c Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Sun, 20 Mar 2022 13:36:18 -0700 Subject: [PATCH 0084/2328] Move difficulty graph toggle to individual skin settings --- osu.Game/Configuration/OsuConfigManager.cs | 2 -- osu.Game/Localisation/GameplaySettingsStrings.cs | 5 ----- .../Overlays/Settings/Sections/Gameplay/HUDSettings.cs | 5 ----- osu.Game/Screens/Play/SongProgress.cs | 7 +++---- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index e8f13ba902..1b10456c8e 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -109,7 +109,6 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.HitLighting, true); SetDefault(OsuSetting.HUDVisibilityMode, HUDVisibilityMode.Always); - SetDefault(OsuSetting.ShowProgressGraph, true); SetDefault(OsuSetting.ShowHealthDisplayWhenCantFail, true); SetDefault(OsuSetting.FadePlayfieldWhenHealthLow, true); SetDefault(OsuSetting.KeyOverlay, false); @@ -266,7 +265,6 @@ namespace osu.Game.Configuration AlwaysPlayFirstComboBreak, FloatingComments, HUDVisibilityMode, - ShowProgressGraph, ShowHealthDisplayWhenCantFail, FadePlayfieldWhenHealthLow, MouseDisableButtons, diff --git a/osu.Game/Localisation/GameplaySettingsStrings.cs b/osu.Game/Localisation/GameplaySettingsStrings.cs index 84c3704e26..8a0f773551 100644 --- a/osu.Game/Localisation/GameplaySettingsStrings.cs +++ b/osu.Game/Localisation/GameplaySettingsStrings.cs @@ -64,11 +64,6 @@ namespace osu.Game.Localisation /// public static LocalisableString HUDVisibilityMode => new TranslatableString(getKey(@"hud_visibility_mode"), @"HUD overlay visibility mode"); - /// - /// "Show difficulty graph on progress bar" - /// - public static LocalisableString ShowDifficultyGraph => new TranslatableString(getKey(@"show_difficulty_graph"), @"Show difficulty graph on progress bar"); - /// /// "Show health display even when you can't fail" /// diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs index ba9779d650..e30df6b868 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs @@ -24,11 +24,6 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay Current = config.GetBindable(OsuSetting.HUDVisibilityMode) }, new SettingsCheckbox - { - LabelText = GameplaySettingsStrings.ShowDifficultyGraph, - Current = config.GetBindable(OsuSetting.ShowProgressGraph) - }, - new SettingsCheckbox { LabelText = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail, Current = config.GetBindable(OsuSetting.ShowHealthDisplayWhenCantFail), diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index e620abb90f..9470c60fe6 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -42,7 +42,8 @@ namespace osu.Game.Screens.Play /// public readonly Bindable AllowSeeking = new Bindable(); - public readonly Bindable ShowGraph = new Bindable(); + [SettingSource("Show difficulty graph", "Whether a graph should show difficulty throughout the beatmap")] + public Bindable ShowGraph { get; } = new BindableBool(true); public override bool HandleNonPositionalInput => AllowSeeking.Value; public override bool HandlePositionalInput => AllowSeeking.Value; @@ -116,7 +117,7 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader(true)] - private void load(OsuColour colours, OsuConfigManager config) + private void load(OsuColour colours) { base.LoadComplete(); @@ -129,8 +130,6 @@ namespace osu.Game.Screens.Play Objects = drawableRuleset.Objects; } - config.BindWith(OsuSetting.ShowProgressGraph, ShowGraph); - graph.FillColour = bar.FillColour = colours.BlueLighter; } From cabbc486e9d1940f4d95429c6691758ff7ee6b85 Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Fri, 1 Apr 2022 11:36:20 +0800 Subject: [PATCH 0085/2328] Rotate sliders in random mod --- .../Utils/OsuHitObjectGenerationUtils.cs | 35 +++++++++ .../OsuHitObjectGenerationUtils_Reposition.cs | 72 +++++++++++++++++-- 2 files changed, 103 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs index da73c2addb..19d3390f56 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs @@ -146,5 +146,40 @@ namespace osu.Game.Rulesets.Osu.Utils slider.Path = new SliderPath(controlPoints, slider.Path.ExpectedDistance.Value); } + + /// + /// Rotate a slider about its start position by the specified angle. + /// + /// The slider to be rotated. + /// The angle to rotate the slider by. + public static void RotateSlider(Slider slider, float rotation) + { + void rotateNestedObject(OsuHitObject nested) => nested.Position = rotateVector(nested.Position - slider.Position, rotation) + slider.Position; + + slider.NestedHitObjects.OfType().ForEach(rotateNestedObject); + slider.NestedHitObjects.OfType().ForEach(rotateNestedObject); + + var controlPoints = slider.Path.ControlPoints.Select(p => new PathControlPoint(p.Position, p.Type)).ToArray(); + foreach (var point in controlPoints) + point.Position = rotateVector(point.Position, rotation); + + slider.Path = new SliderPath(controlPoints, slider.Path.ExpectedDistance.Value); + } + + /// + /// Rotate a vector by the specified angle. + /// + /// The vector to be rotated. + /// The angle to rotate the vector by. + /// The rotated vector. + private static Vector2 rotateVector(Vector2 vector, float rotation) + { + float angle = (float)Math.Atan2(vector.Y, vector.X) + rotation; + float length = vector.Length; + return new Vector2( + length * (float)Math.Cos(angle), + length * (float)Math.Sin(angle) + ); + } } } diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs index d1bc3b45df..ef1c258a8d 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs @@ -40,12 +40,21 @@ namespace osu.Game.Rulesets.Osu.Utils float absoluteAngle = (float)Math.Atan2(relativePosition.Y, relativePosition.X); float relativeAngle = absoluteAngle - previousAngle; - positionInfos.Add(new ObjectPositionInfo(hitObject) + ObjectPositionInfo positionInfo; + positionInfos.Add(positionInfo = new ObjectPositionInfo(hitObject) { RelativeAngle = relativeAngle, DistanceFromPrevious = relativePosition.Length }); + if (hitObject is Slider) + { + var endPositionVector = hitObject.EndPosition - hitObject.Position; + float absoluteRotation = (float)Math.Atan2(endPositionVector.Y, endPositionVector.X); + positionInfo.Rotation = absoluteRotation - absoluteAngle; + absoluteAngle = absoluteRotation; + } + previousPosition = hitObject.EndPosition; previousAngle = absoluteAngle; } @@ -124,9 +133,16 @@ namespace osu.Game.Rulesets.Osu.Utils if (previous != null) { - Vector2 earliestPosition = beforePrevious?.HitObject.EndPosition ?? playfield_centre; - Vector2 relativePosition = previous.HitObject.Position - earliestPosition; - previousAbsoluteAngle = (float)Math.Atan2(relativePosition.Y, relativePosition.X); + if (previous.HitObject is Slider s) + { + previousAbsoluteAngle = getSliderRotation(s); + } + else + { + Vector2 earliestPosition = beforePrevious?.HitObject.EndPosition ?? playfield_centre; + Vector2 relativePosition = previous.HitObject.Position - earliestPosition; + previousAbsoluteAngle = (float)Math.Atan2(relativePosition.Y, relativePosition.X); + } } float absoluteAngle = previousAbsoluteAngle + current.PositionInfo.RelativeAngle; @@ -141,6 +157,16 @@ namespace osu.Game.Rulesets.Osu.Utils posRelativeToPrev = RotateAwayFromEdge(lastEndPosition, posRelativeToPrev); current.PositionModified = lastEndPosition + posRelativeToPrev; + + if (!(current.HitObject is Slider slider)) + return; + + Vector2 centreOfMassOriginal = calculateCentreOfMass(slider); + Vector2 centreOfMassModified = rotateVector(centreOfMassOriginal, current.PositionInfo.Rotation - current.RotationOriginal); + centreOfMassModified = RotateAwayFromEdge(current.PositionModified, centreOfMassModified); + + float relativeRotation = (float)Math.Atan2(centreOfMassModified.Y, centreOfMassModified.X) - (float)Math.Atan2(centreOfMassOriginal.Y, centreOfMassOriginal.X); + RotateSlider(slider, relativeRotation); } /// @@ -287,6 +313,27 @@ namespace osu.Game.Rulesets.Osu.Utils ); } + private static Vector2 calculateCentreOfMass(Slider slider) + { + int count = 0; + Vector2 sum = Vector2.Zero; + double pathDistance = slider.Distance; + + for (double i = 0; i < pathDistance; i++) + { + sum += slider.Path.PositionAt(i / pathDistance); + count++; + } + + return sum / count; + } + + private static float getSliderRotation(Slider slider) + { + var endPositionVector = slider.EndPosition - slider.Position; + return (float)Math.Atan2(endPositionVector.Y, endPositionVector.X); + } + public class ObjectPositionInfo { /// @@ -309,6 +356,13 @@ namespace osu.Game.Rulesets.Osu.Utils /// public float DistanceFromPrevious { get; set; } + /// + /// The rotation of the hit object, relative to its jump angle. + /// For sliders, this is defined as the angle from the slider's start position to its end position, relative to its jump angle. + /// For hit circles and spinners, this property is ignored. + /// + public float Rotation { get; set; } + /// /// The hit object associated with this . /// @@ -325,6 +379,7 @@ namespace osu.Game.Rulesets.Osu.Utils public Vector2 PositionOriginal { get; } public Vector2 PositionModified { get; set; } public Vector2 EndPositionModified { get; set; } + public float RotationOriginal { get; } public ObjectPositionInfo PositionInfo { get; } public OsuHitObject HitObject => PositionInfo.HitObject; @@ -334,6 +389,15 @@ namespace osu.Game.Rulesets.Osu.Utils PositionInfo = positionInfo; PositionModified = PositionOriginal = HitObject.Position; EndPositionModified = HitObject.EndPosition; + + if (HitObject is Slider slider) + { + RotationOriginal = getSliderRotation(slider); + } + else + { + RotationOriginal = 0; + } } } } From 998df5a4fef7627a897c23afa4f8b57c01e2a6f7 Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Fri, 1 Apr 2022 11:37:10 +0800 Subject: [PATCH 0086/2328] Fix large slider clamping --- .../Utils/OsuHitObjectGenerationUtils_Reposition.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs index ef1c258a8d..9f308df985 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs @@ -198,13 +198,13 @@ namespace osu.Game.Rulesets.Osu.Utils var previousPosition = workingObject.PositionModified; // Clamp slider position to the placement area - // If the slider is larger than the playfield, force it to stay at the original position + // If the slider is larger than the playfield, at least make sure that the head circle is inside the playfield float newX = possibleMovementBounds.Width < 0 - ? workingObject.PositionOriginal.X + ? Math.Clamp(possibleMovementBounds.Left, 0, OsuPlayfield.BASE_SIZE.X) : Math.Clamp(previousPosition.X, possibleMovementBounds.Left, possibleMovementBounds.Right); float newY = possibleMovementBounds.Height < 0 - ? workingObject.PositionOriginal.Y + ? Math.Clamp(possibleMovementBounds.Top, 0, OsuPlayfield.BASE_SIZE.Y) : Math.Clamp(previousPosition.Y, possibleMovementBounds.Top, possibleMovementBounds.Bottom); slider.Position = workingObject.PositionModified = new Vector2(newX, newY); From af3835083ccd246810758b0156adbca2b3117587 Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Fri, 1 Apr 2022 11:41:45 +0800 Subject: [PATCH 0087/2328] Fix slider relative rotation calculation --- .../OsuHitObjectGenerationUtils_Reposition.cs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs index 9f308df985..fe5841daac 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs @@ -47,10 +47,9 @@ namespace osu.Game.Rulesets.Osu.Utils DistanceFromPrevious = relativePosition.Length }); - if (hitObject is Slider) + if (hitObject is Slider slider) { - var endPositionVector = hitObject.EndPosition - hitObject.Position; - float absoluteRotation = (float)Math.Atan2(endPositionVector.Y, endPositionVector.X); + float absoluteRotation = getSliderRotation(slider); positionInfo.Rotation = absoluteRotation - absoluteAngle; absoluteAngle = absoluteRotation; } @@ -161,8 +160,10 @@ namespace osu.Game.Rulesets.Osu.Utils if (!(current.HitObject is Slider slider)) return; + absoluteAngle = (float)Math.Atan2(posRelativeToPrev.Y, posRelativeToPrev.X); + Vector2 centreOfMassOriginal = calculateCentreOfMass(slider); - Vector2 centreOfMassModified = rotateVector(centreOfMassOriginal, current.PositionInfo.Rotation - current.RotationOriginal); + Vector2 centreOfMassModified = rotateVector(centreOfMassOriginal, current.PositionInfo.Rotation + absoluteAngle - getSliderRotation(slider)); centreOfMassModified = RotateAwayFromEdge(current.PositionModified, centreOfMassModified); float relativeRotation = (float)Math.Atan2(centreOfMassModified.Y, centreOfMassModified.X) - (float)Math.Atan2(centreOfMassOriginal.Y, centreOfMassOriginal.X); @@ -379,7 +380,6 @@ namespace osu.Game.Rulesets.Osu.Utils public Vector2 PositionOriginal { get; } public Vector2 PositionModified { get; set; } public Vector2 EndPositionModified { get; set; } - public float RotationOriginal { get; } public ObjectPositionInfo PositionInfo { get; } public OsuHitObject HitObject => PositionInfo.HitObject; @@ -389,15 +389,6 @@ namespace osu.Game.Rulesets.Osu.Utils PositionInfo = positionInfo; PositionModified = PositionOriginal = HitObject.Position; EndPositionModified = HitObject.EndPosition; - - if (HitObject is Slider slider) - { - RotationOriginal = getSliderRotation(slider); - } - else - { - RotationOriginal = 0; - } } } } From c0a78924aa2e5fe9ea9f6fe671e7fa770e472cac Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Fri, 1 Apr 2022 11:47:21 +0800 Subject: [PATCH 0088/2328] Fix generation for zero-length sliders --- .../Utils/OsuHitObjectGenerationUtils_Reposition.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs index fe5841daac..5f3719146f 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics.Primitives; +using osu.Framework.Utils; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.UI; using osuTK; @@ -167,7 +168,8 @@ namespace osu.Game.Rulesets.Osu.Utils centreOfMassModified = RotateAwayFromEdge(current.PositionModified, centreOfMassModified); float relativeRotation = (float)Math.Atan2(centreOfMassModified.Y, centreOfMassModified.X) - (float)Math.Atan2(centreOfMassOriginal.Y, centreOfMassOriginal.X); - RotateSlider(slider, relativeRotation); + if (!Precision.AlmostEquals(relativeRotation, 0)) + RotateSlider(slider, relativeRotation); } /// @@ -316,6 +318,8 @@ namespace osu.Game.Rulesets.Osu.Utils private static Vector2 calculateCentreOfMass(Slider slider) { + if (slider.Distance < 1) return Vector2.Zero; + int count = 0; Vector2 sum = Vector2.Zero; double pathDistance = slider.Distance; From 0015f627b04a23f407ff514255650003fb610c0b Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Fri, 1 Apr 2022 11:49:27 +0800 Subject: [PATCH 0089/2328] Add xmldoc --- .../Utils/OsuHitObjectGenerationUtils_Reposition.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs index 5f3719146f..ccc2529768 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs @@ -316,6 +316,11 @@ namespace osu.Game.Rulesets.Osu.Utils ); } + /// + /// Estimate the centre of mass of a slider relative to its start position. + /// + /// The slider to process. + /// The centre of mass of the slider. private static Vector2 calculateCentreOfMass(Slider slider) { if (slider.Distance < 1) return Vector2.Zero; @@ -333,6 +338,11 @@ namespace osu.Game.Rulesets.Osu.Utils return sum / count; } + /// + /// Get the absolute rotation of a slider, defined as the angle from its start position to its end position. + /// + /// The slider to process. + /// The angle in radians. private static float getSliderRotation(Slider slider) { var endPositionVector = slider.EndPosition - slider.Position; From 031a977009d466796eb90aa9386d24ce16410f6c Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Fri, 1 Apr 2022 11:50:30 +0800 Subject: [PATCH 0090/2328] Calculate slider rotation using end point of path instead of EndPosition --- .../Utils/OsuHitObjectGenerationUtils_Reposition.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs index ccc2529768..45285e5e0c 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs @@ -339,13 +339,13 @@ namespace osu.Game.Rulesets.Osu.Utils } /// - /// Get the absolute rotation of a slider, defined as the angle from its start position to its end position. + /// Get the absolute rotation of a slider, defined as the angle from its start position to the end of its path. /// /// The slider to process. /// The angle in radians. private static float getSliderRotation(Slider slider) { - var endPositionVector = slider.EndPosition - slider.Position; + var endPositionVector = slider.Path.PositionAt(1); return (float)Math.Atan2(endPositionVector.Y, endPositionVector.X); } @@ -373,7 +373,7 @@ namespace osu.Game.Rulesets.Osu.Utils /// /// The rotation of the hit object, relative to its jump angle. - /// For sliders, this is defined as the angle from the slider's start position to its end position, relative to its jump angle. + /// For sliders, this is defined as the angle from the slider's start position to the end of its path, relative to its jump angle. /// For hit circles and spinners, this property is ignored. /// public float Rotation { get; set; } From ee6567788425bd24b198493bdd7f565fd6f0b4a5 Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Fri, 1 Apr 2022 11:57:45 +0800 Subject: [PATCH 0091/2328] Use height of playfield instead of width when randomizing the first object This is the change discussed in #17194. The effect of this change is barely noticeable, but it makes more sense to generate the object within playfield from the start. --- osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs index fea9246035..ccc56bd64f 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Osu.Mods if (positionInfo == positionInfos.First()) { - positionInfo.DistanceFromPrevious = (float)(rng.NextDouble() * OsuPlayfield.BASE_SIZE.X / 2); + positionInfo.DistanceFromPrevious = (float)(rng.NextDouble() * OsuPlayfield.BASE_SIZE.Y / 2); positionInfo.RelativeAngle = (float)(rng.NextDouble() * 2 * Math.PI - Math.PI); } else From 3bebc88306c9abb2543686ba22fbbcbd51d2b0da Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Fri, 1 Apr 2022 11:59:24 +0800 Subject: [PATCH 0092/2328] Consider spinners when calculating jump angles Spinners are considered in `GeneratePositionInfos`, so they should also be considered in `RepositionHitObjects` --- .../Utils/OsuHitObjectGenerationUtils_Reposition.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs index 45285e5e0c..664bfae35a 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs @@ -79,7 +79,7 @@ namespace osu.Game.Rulesets.Osu.Utils if (hitObject is Spinner) { - previous = null; + previous = current; continue; } From 293ef4483609737f34bf5796d0f8fa09b84b177c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 26 Mar 2022 22:43:17 +0100 Subject: [PATCH 0093/2328] Implement new mod select screen --- .../UserInterface/TestSceneModSelectScreen.cs | 28 ++ osu.Game/Overlays/Mods/ModColumn.cs | 11 +- osu.Game/Overlays/Mods/ModSelectScreen.cs | 315 ++++++++++++++++++ osu.Game/Overlays/Mods/ModSettingsArea.cs | 4 +- 4 files changed, 356 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs create mode 100644 osu.Game/Overlays/Mods/ModSelectScreen.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs new file mode 100644 index 0000000000..e6a5784536 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -0,0 +1,28 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Overlays.Mods; + +namespace osu.Game.Tests.Visual.UserInterface +{ + [TestFixture] + public class TestSceneModSelectScreen : OsuTestScene + { + [Test] + public void TestModSelectScreen() + { + ModSelectScreen modSelectScreen = null; + + AddStep("create screen", () => Child = modSelectScreen = new ModSelectScreen + { + RelativeSizeAxes = Axes.Both, + State = { Value = Visibility.Visible } + }); + + AddToggleStep("toggle state", visible => modSelectScreen.State.Value = visible ? Visibility.Visible : Visibility.Hidden); + } + } +} diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 736a0205e2..9cf9e6a268 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -48,6 +48,8 @@ namespace osu.Game.Overlays.Mods } } + public Action? ModStateChanged { get; set; } + private readonly ModType modType; private readonly Key[]? toggleKeys; @@ -251,7 +253,14 @@ namespace osu.Game.Overlays.Mods panelFlow.ChildrenEnumerable = loaded; foreach (var panel in panelFlow) - panel.Active.BindValueChanged(_ => updateToggleState()); + { + panel.Active.BindValueChanged(_ => + { + updateToggleState(); + ModStateChanged?.Invoke(panel.Mod, panel.Active.Value); + }); + } + updateToggleState(); updateFilter(); diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs new file mode 100644 index 0000000000..bd27407965 --- /dev/null +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -0,0 +1,315 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; +using osu.Framework.Layout; +using osu.Game.Configuration; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; +using osu.Game.Rulesets.Mods; +using osuTK; +using osuTK.Input; + +namespace osu.Game.Overlays.Mods +{ + public class ModSelectScreen : OsuFocusedOverlayContainer + { + [Cached] + private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); + + [Cached] + private Bindable> selectedMods = new Bindable>(Array.Empty()); + + private readonly BindableBool customisationVisible = new BindableBool(); + + private DifficultyMultiplierDisplay multiplierDisplay; + private ModSettingsArea modSettingsArea; + private Container columnContainer; + private FillFlowContainer columnFlow; + private GridContainer grid; + private Container mainContent; + + [BackgroundDependencyLoader] + private void load() + { + RelativeSizeAxes = Axes.Both; + RelativePositionAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + mainContent = new Container + { + Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomCentre, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + grid = new GridContainer + { + RelativeSizeAxes = Axes.Both, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.AutoSize), + new Dimension(), + new Dimension(GridSizeMode.Absolute, 75), + }, + Content = new[] + { + new Drawable[] + { + new PopupScreenTitle + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Title = "Mod Select", + Description = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play. Others are just for fun.", + Close = Hide + } + }, + new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Horizontal = 100, Vertical = 10 }, + Child = multiplierDisplay = new DifficultyMultiplierDisplay + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight + } + } + }, + new Drawable[] + { + columnContainer = new Container + { + RelativeSizeAxes = Axes.Both, + RelativePositionAxes = Axes.Both, + X = 1, + Padding = new MarginPadding { Horizontal = 70 }, + Children = new Drawable[] + { + new OsuScrollContainer(Direction.Horizontal) + { + RelativeSizeAxes = Axes.Both, + Masking = false, + ScrollbarOverlapsContent = false, + Child = columnFlow = new ModColumnContainer + { + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Spacing = new Vector2(10, 0), + Children = new[] + { + new ModColumn(ModType.DifficultyReduction, false, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }), + new ModColumn(ModType.DifficultyIncrease, false, new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }), + new ModColumn(ModType.Automation, false, new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }), + new ModColumn(ModType.Conversion, false), + new ModColumn(ModType.Fun, false) + } + } + } + } + } + }, + new[] { Empty() } + } + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.X, + Height = 50, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Colour = colourProvider.Background5 + }, + new ShearedToggleButton(200) + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Margin = new MarginPadding { Vertical = 14, Left = 70 }, + Text = "Mod Customisation", + Active = { BindTarget = customisationVisible } + } + } + }, + new ClickToReturnContainer + { + RelativeSizeAxes = Axes.Both, + HandleMouse = { BindTarget = customisationVisible }, + OnClicked = () => customisationVisible.Value = false + } + } + }, + modSettingsArea = new ModSettingsArea + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre + } + }; + + foreach (var column in columnFlow) + { + column.ModStateChanged = (mod, active) => selectedMods.Value = active + ? selectedMods.Value.Append(mod).ToArray() + : selectedMods.Value.Except(new[] { mod }).ToArray(); + } + + columnFlow.Shear = new Vector2(ModPanel.SHEAR_X, 0); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + ((IBindable>)modSettingsArea.SelectedMods).BindTo(selectedMods); + selectedMods.BindValueChanged(val => + { + updateMultiplier(); + updateCustomisation(val); + }, true); + customisationVisible.BindValueChanged(_ => updateCustomisationVisualState(), true); + + FinishTransforms(true); + } + + private void updateMultiplier() + { + double multiplier = 1.0; + + foreach (var mod in selectedMods.Value) + multiplier *= mod.ScoreMultiplier; + + multiplierDisplay.Current.Value = multiplier; + } + + private void updateCustomisation(ValueChangedEvent> valueChangedEvent) + { + bool anyCustomisableMod = false; + bool anyModWithRequiredCustomisationAdded = false; + + foreach (var mod in selectedMods.Value) + { + anyCustomisableMod |= mod.GetSettingsSourceProperties().Any(); + anyModWithRequiredCustomisationAdded |= !valueChangedEvent.OldValue.Contains(mod) && mod.RequiresConfiguration; + } + + if (anyCustomisableMod) + { + customisationVisible.Disabled = false; + + if (anyModWithRequiredCustomisationAdded && !customisationVisible.Value) + customisationVisible.Value = true; + } + else + { + if (customisationVisible.Value) + customisationVisible.Value = false; + + customisationVisible.Disabled = true; + } + } + + private void updateCustomisationVisualState() + { + grid.FadeColour(customisationVisible.Value ? Colour4.Gray : Colour4.White, 800, Easing.OutQuint); + + float modAreaHeight = customisationVisible.Value ? ModSettingsArea.HEIGHT : 0; + + modSettingsArea.ResizeHeightTo(modAreaHeight, 800, Easing.InOutCubic); + mainContent.TransformTo(nameof(Margin), new MarginPadding { Bottom = modAreaHeight }, 800, Easing.InOutCubic); + } + + protected override void PopIn() + { + base.PopIn(); + this.MoveToY(0, 800, Easing.OutQuint); + columnContainer.MoveToX(0, 800, Easing.OutQuint); + } + + protected override void PopOut() + { + base.PopOut(); + this.MoveToY(1.2f, 800, Easing.OutQuint); + columnContainer.MoveToX(1, 800, Easing.OutQuint); + } + + private class ModColumnContainer : FillFlowContainer + { + private readonly LayoutValue drawSizeLayout = new LayoutValue(Invalidation.DrawSize); + + public ModColumnContainer() + { + AddLayout(drawSizeLayout); + } + + public override void Add(ModColumn column) + { + base.Add(column); + + Debug.Assert(column != null); + column.Shear = Vector2.Zero; + } + + protected override void Update() + { + base.Update(); + + if (!drawSizeLayout.IsValid) + { + Padding = new MarginPadding + { + Left = DrawHeight * ModPanel.SHEAR_X, + Bottom = 10 + }; + + drawSizeLayout.Validate(); + } + } + } + + private class ClickToReturnContainer : Container + { + public BindableBool HandleMouse { get; } = new BindableBool(); + + public Action OnClicked { get; set; } + + protected override bool Handle(UIEvent e) + { + if (!HandleMouse.Value) + return base.Handle(e); + + switch (e) + { + case ClickEvent _: + OnClicked?.Invoke(); + return true; + + case MouseEvent _: + return true; + } + + return base.Handle(e); + } + } + } +} diff --git a/osu.Game/Overlays/Mods/ModSettingsArea.cs b/osu.Game/Overlays/Mods/ModSettingsArea.cs index e0a30f60c2..9b0382c6a4 100644 --- a/osu.Game/Overlays/Mods/ModSettingsArea.cs +++ b/osu.Game/Overlays/Mods/ModSettingsArea.cs @@ -23,6 +23,8 @@ namespace osu.Game.Overlays.Mods { public Bindable> SelectedMods { get; } = new Bindable>(); + public const float HEIGHT = 250; + private readonly Box background; private readonly FillFlowContainer modSettingsFlow; @@ -32,7 +34,7 @@ namespace osu.Game.Overlays.Mods public ModSettingsArea() { RelativeSizeAxes = Axes.X; - Height = 250; + Height = HEIGHT; Anchor = Anchor.BottomRight; Origin = Anchor.BottomRight; From e46c2df409afe3bcf50e3a8bb40bb8f1bf90d0d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 26 Mar 2022 23:21:17 +0100 Subject: [PATCH 0094/2328] Add testing for customisation panel show/hide logic --- .../UserInterface/TestSceneModSelectScreen.cs | 62 ++++++++++++++++--- osu.Game/Overlays/Mods/ModSelectScreen.cs | 16 ++--- 2 files changed, 63 insertions(+), 15 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index e6a5784536..25b2e92c0c 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -1,28 +1,76 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Testing; +using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; +using osu.Game.Rulesets.Osu.Mods; +using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] - public class TestSceneModSelectScreen : OsuTestScene + public class TestSceneModSelectScreen : OsuManualInputManagerTestScene { - [Test] - public void TestModSelectScreen() - { - ModSelectScreen modSelectScreen = null; + private ModSelectScreen modSelectScreen; + [SetUpSteps] + public void SetUpSteps() + { AddStep("create screen", () => Child = modSelectScreen = new ModSelectScreen { RelativeSizeAxes = Axes.Both, - State = { Value = Visibility.Visible } + State = { Value = Visibility.Visible }, + SelectedMods = { BindTarget = SelectedMods } + }); + } + + [Test] + public void TestStateChange() + { + AddToggleStep("toggle state", visible => modSelectScreen.State.Value = visible ? Visibility.Visible : Visibility.Hidden); + } + + [Test] + public void TestCustomisationToggleState() + { + assertCustomisationToggleState(disabled: true, active: false); + + AddStep("select customisable mod", () => SelectedMods.Value = new[] { new OsuModDoubleTime() }); + assertCustomisationToggleState(disabled: false, active: false); + + AddStep("select mod requiring configuration", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() }); + assertCustomisationToggleState(disabled: false, active: true); + + AddStep("dismiss mod customisation", () => + { + InputManager.MoveMouseTo(modSelectScreen.ChildrenOfType().Single()); + InputManager.Click(MouseButton.Left); }); - AddToggleStep("toggle state", visible => modSelectScreen.State.Value = visible ? Visibility.Visible : Visibility.Hidden); + AddStep("append another mod not requiring config", () => SelectedMods.Value = SelectedMods.Value.Append(new OsuModFlashlight()).ToArray()); + assertCustomisationToggleState(disabled: false, active: false); + + AddStep("select mod without configuration", () => SelectedMods.Value = new[] { new OsuModAutoplay() }); + assertCustomisationToggleState(disabled: true, active: false); + + AddStep("select mod requiring configuration", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() }); + assertCustomisationToggleState(disabled: false, active: true); + + AddStep("select mod without configuration", () => SelectedMods.Value = new[] { new OsuModAutoplay() }); + assertCustomisationToggleState(disabled: true, active: false); // config was dismissed without explicit user action. + } + + private void assertCustomisationToggleState(bool disabled, bool active) + { + ShearedToggleButton getToggle() => modSelectScreen.ChildrenOfType().Single(); + + AddAssert($"customisation toggle is {(disabled ? "" : "not ")}disabled", () => getToggle().Active.Disabled == disabled); + AddAssert($"customisation toggle is {(active ? "" : "not ")}active", () => getToggle().Active.Value == active); } } } diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index bd27407965..0a9b1ddbcb 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Mods private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); [Cached] - private Bindable> selectedMods = new Bindable>(Array.Empty()); + public Bindable> SelectedMods { get; private set; } = new Bindable>(Array.Empty()); private readonly BindableBool customisationVisible = new BindableBool(); @@ -169,9 +169,9 @@ namespace osu.Game.Overlays.Mods foreach (var column in columnFlow) { - column.ModStateChanged = (mod, active) => selectedMods.Value = active - ? selectedMods.Value.Append(mod).ToArray() - : selectedMods.Value.Except(new[] { mod }).ToArray(); + column.ModStateChanged = (mod, active) => SelectedMods.Value = active + ? SelectedMods.Value.Append(mod).ToArray() + : SelectedMods.Value.Except(new[] { mod }).ToArray(); } columnFlow.Shear = new Vector2(ModPanel.SHEAR_X, 0); @@ -181,8 +181,8 @@ namespace osu.Game.Overlays.Mods { base.LoadComplete(); - ((IBindable>)modSettingsArea.SelectedMods).BindTo(selectedMods); - selectedMods.BindValueChanged(val => + ((IBindable>)modSettingsArea.SelectedMods).BindTo(SelectedMods); + SelectedMods.BindValueChanged(val => { updateMultiplier(); updateCustomisation(val); @@ -196,7 +196,7 @@ namespace osu.Game.Overlays.Mods { double multiplier = 1.0; - foreach (var mod in selectedMods.Value) + foreach (var mod in SelectedMods.Value) multiplier *= mod.ScoreMultiplier; multiplierDisplay.Current.Value = multiplier; @@ -207,7 +207,7 @@ namespace osu.Game.Overlays.Mods bool anyCustomisableMod = false; bool anyModWithRequiredCustomisationAdded = false; - foreach (var mod in selectedMods.Value) + foreach (var mod in SelectedMods.Value) { anyCustomisableMod |= mod.GetSettingsSourceProperties().Any(); anyModWithRequiredCustomisationAdded |= !valueChangedEvent.OldValue.Contains(mod) && mod.RequiresConfiguration; From 2921a1360917b915852e678bed4b453c9e777235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 3 Apr 2022 17:43:13 +0200 Subject: [PATCH 0095/2328] Add testing for mod bindable state propagation --- .../UserInterface/TestSceneModSelectScreen.cs | 46 ++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index 25b2e92c0c..a5f5048961 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -6,8 +6,10 @@ using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; +using osu.Framework.Utils; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; +using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Mods; using osuTK.Input; @@ -21,23 +23,55 @@ namespace osu.Game.Tests.Visual.UserInterface [SetUpSteps] public void SetUpSteps() { - AddStep("create screen", () => Child = modSelectScreen = new ModSelectScreen - { - RelativeSizeAxes = Axes.Both, - State = { Value = Visibility.Visible }, - SelectedMods = { BindTarget = SelectedMods } - }); + AddStep("reset mods", () => SelectedMods.SetDefault()); } + private void createScreen() => AddStep("create screen", () => Child = modSelectScreen = new ModSelectScreen + { + RelativeSizeAxes = Axes.Both, + State = { Value = Visibility.Visible }, + SelectedMods = { BindTarget = SelectedMods } + }); + [Test] public void TestStateChange() { + createScreen(); AddToggleStep("toggle state", visible => modSelectScreen.State.Value = visible ? Visibility.Visible : Visibility.Hidden); } + [Test] + public void TestPreexistingSelection() + { + AddStep("set mods", () => SelectedMods.Value = new Mod[] { new OsuModAlternate(), new OsuModDaycore() }); + createScreen(); + AddUntilStep("two panels active", () => modSelectScreen.ChildrenOfType().Count(panel => panel.Active.Value) == 2); + AddAssert("mod multiplier correct", () => + { + double multiplier = SelectedMods.Value.Aggregate(1d, (multiplier, mod) => multiplier * mod.ScoreMultiplier); + return Precision.AlmostEquals(multiplier, modSelectScreen.ChildrenOfType().Single().Current.Value); + }); + assertCustomisationToggleState(disabled: false, active: false); + } + + [Test] + public void TestExternalSelection() + { + createScreen(); + AddStep("set mods", () => SelectedMods.Value = new Mod[] { new OsuModAlternate(), new OsuModDaycore() }); + AddUntilStep("two panels active", () => modSelectScreen.ChildrenOfType().Count(panel => panel.Active.Value) == 2); + AddAssert("mod multiplier correct", () => + { + double multiplier = SelectedMods.Value.Aggregate(1d, (multiplier, mod) => multiplier * mod.ScoreMultiplier); + return Precision.AlmostEquals(multiplier, modSelectScreen.ChildrenOfType().Single().Current.Value); + }); + assertCustomisationToggleState(disabled: false, active: false); + } + [Test] public void TestCustomisationToggleState() { + createScreen(); assertCustomisationToggleState(disabled: true, active: false); AddStep("select customisable mod", () => SelectedMods.Value = new[] { new OsuModDoubleTime() }); From cd776d21a6c5268277644bebd1fe3336cb75dbdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 28 Mar 2022 00:16:10 +0200 Subject: [PATCH 0096/2328] Fix propagation of selected mods to columns --- osu.Game/Overlays/Mods/ModColumn.cs | 43 +++++++++++++++-------- osu.Game/Overlays/Mods/ModSelectScreen.cs | 42 ++++++++++++++++++---- 2 files changed, 64 insertions(+), 21 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 9cf9e6a268..46a562ac98 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -31,6 +31,8 @@ namespace osu.Game.Overlays.Mods { public class ModColumn : CompositeDrawable { + public readonly ModType ModType; + private Func? filter; /// @@ -48,9 +50,8 @@ namespace osu.Game.Overlays.Mods } } - public Action? ModStateChanged { get; set; } + public Bindable> SelectedMods = new Bindable>(Array.Empty()); - private readonly ModType modType; private readonly Key[]? toggleKeys; private readonly Bindable>> availableMods = new Bindable>>(); @@ -71,7 +72,7 @@ namespace osu.Game.Overlays.Mods public ModColumn(ModType modType, bool allowBulkSelection, Key[]? toggleKeys = null) { - this.modType = modType; + ModType = modType; this.toggleKeys = toggleKeys; Width = 320; @@ -195,7 +196,7 @@ namespace osu.Game.Overlays.Mods private void createHeaderText() { - IEnumerable headerTextWords = modType.Humanize(LetterCasing.Title).Split(' '); + IEnumerable headerTextWords = ModType.Humanize(LetterCasing.Title).Split(' '); if (headerTextWords.Count() > 1) { @@ -211,7 +212,7 @@ namespace osu.Game.Overlays.Mods { availableMods.BindTo(game.AvailableMods); - headerBackground.Colour = accentColour = colours.ForModType(modType); + headerBackground.Colour = accentColour = colours.ForModType(ModType); if (toggleAllCheckbox != null) { @@ -227,6 +228,12 @@ namespace osu.Game.Overlays.Mods { base.LoadComplete(); availableMods.BindValueChanged(_ => Scheduler.AddOnce(updateMods)); + SelectedMods.BindValueChanged(_ => + { + // if a load is in progress, don't try to update the selection - the load flow will do so. + if (latestLoadTask == null) + updateActiveState(); + }); updateMods(); } @@ -234,7 +241,7 @@ namespace osu.Game.Overlays.Mods private void updateMods() { - var newMods = ModUtils.FlattenMods(availableMods.Value.GetValueOrDefault(modType) ?? Array.Empty()).ToList(); + var newMods = ModUtils.FlattenMods(availableMods.Value.GetValueOrDefault(ModType) ?? Array.Empty()).ToList(); if (newMods.SequenceEqual(panelFlow.Children.Select(p => p.Mod))) return; @@ -252,18 +259,20 @@ namespace osu.Game.Overlays.Mods { panelFlow.ChildrenEnumerable = loaded; + updateActiveState(); + updateToggleAllState(); + updateFilter(); + foreach (var panel in panelFlow) { panel.Active.BindValueChanged(_ => { - updateToggleState(); - ModStateChanged?.Invoke(panel.Mod, panel.Active.Value); + updateToggleAllState(); + SelectedMods.Value = panel.Active.Value + ? SelectedMods.Value.Append(panel.Mod).ToArray() + : SelectedMods.Value.Except(new[] { panel.Mod }).ToArray(); }); } - - updateToggleState(); - - updateFilter(); }, (cancellationTokenSource = new CancellationTokenSource()).Token); loadTask.ContinueWith(_ => { @@ -272,6 +281,12 @@ namespace osu.Game.Overlays.Mods }); } + private void updateActiveState() + { + foreach (var panel in panelFlow) + panel.Active.Value = SelectedMods.Value.Contains(panel.Mod, EqualityComparer.Default); + } + #region Bulk select / deselect private const double initial_multiple_selection_delay = 120; @@ -306,7 +321,7 @@ namespace osu.Game.Overlays.Mods } } - private void updateToggleState() + private void updateToggleAllState() { if (toggleAllCheckbox != null && !SelectionAnimationRunning) { @@ -408,7 +423,7 @@ namespace osu.Game.Overlays.Mods foreach (var modPanel in panelFlow) modPanel.ApplyFilter(Filter); - updateToggleState(); + updateToggleAllState(); } #endregion diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 0a9b1ddbcb..659c88e070 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -167,13 +167,6 @@ namespace osu.Game.Overlays.Mods } }; - foreach (var column in columnFlow) - { - column.ModStateChanged = (mod, active) => SelectedMods.Value = active - ? SelectedMods.Value.Append(mod).ToArray() - : SelectedMods.Value.Except(new[] { mod }).ToArray(); - } - columnFlow.Shear = new Vector2(ModPanel.SHEAR_X, 0); } @@ -182,11 +175,19 @@ namespace osu.Game.Overlays.Mods base.LoadComplete(); ((IBindable>)modSettingsArea.SelectedMods).BindTo(SelectedMods); + SelectedMods.BindValueChanged(val => { updateMultiplier(); updateCustomisation(val); + updateSelectionFromBindable(); }, true); + + foreach (var column in columnFlow) + { + column.SelectedMods.BindValueChanged(_ => updateBindableFromSelection()); + } + customisationVisible.BindValueChanged(_ => updateCustomisationVisualState(), true); FinishTransforms(true); @@ -239,6 +240,33 @@ namespace osu.Game.Overlays.Mods mainContent.TransformTo(nameof(Margin), new MarginPadding { Bottom = modAreaHeight }, 800, Easing.InOutCubic); } + private bool selectionBindableSyncInProgress; + + private void updateSelectionFromBindable() + { + if (selectionBindableSyncInProgress) + return; + + selectionBindableSyncInProgress = true; + + foreach (var column in columnFlow) + column.SelectedMods.Value = SelectedMods.Value.Where(mod => mod.Type == column.ModType).ToArray(); + + selectionBindableSyncInProgress = false; + } + + private void updateBindableFromSelection() + { + if (selectionBindableSyncInProgress) + return; + + selectionBindableSyncInProgress = true; + + SelectedMods.Value = columnFlow.SelectMany(column => column.SelectedMods.Value).ToArray(); + + selectionBindableSyncInProgress = false; + } + protected override void PopIn() { base.PopIn(); From a172b194f0a97d546e7af99ee34f93512cb8c594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 3 Apr 2022 18:38:23 +0200 Subject: [PATCH 0097/2328] Add testing for different rulesets --- .../UserInterface/TestSceneModSelectScreen.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index a5f5048961..0d568cd030 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -9,8 +9,12 @@ using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; +using osu.Game.Rulesets.Catch; +using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; +using osu.Game.Rulesets.Taiko; using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface @@ -68,6 +72,16 @@ namespace osu.Game.Tests.Visual.UserInterface assertCustomisationToggleState(disabled: false, active: false); } + [Test] + public void TestRulesetChange() + { + createScreen(); + AddStep("change to osu!", () => Ruleset.Value = new OsuRuleset().RulesetInfo); + AddStep("change to osu!taiko", () => Ruleset.Value = new TaikoRuleset().RulesetInfo); + AddStep("change to osu!catch", () => Ruleset.Value = new CatchRuleset().RulesetInfo); + AddStep("change to osu!mania", () => Ruleset.Value = new ManiaRuleset().RulesetInfo); + } + [Test] public void TestCustomisationToggleState() { From 90e44b67ea0c883128e7e2fe11da91e2e18101e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 3 Apr 2022 20:24:32 +0200 Subject: [PATCH 0098/2328] Improve robustness of test code --- .../UserInterface/TestSceneModSelectScreen.cs | 42 +++++++++++++------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index 0d568cd030..47cff40873 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -3,18 +3,16 @@ using System.Linq; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; -using osu.Game.Rulesets.Catch; -using osu.Game.Rulesets.Mania; +using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; -using osu.Game.Rulesets.Taiko; using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface @@ -22,20 +20,29 @@ namespace osu.Game.Tests.Visual.UserInterface [TestFixture] public class TestSceneModSelectScreen : OsuManualInputManagerTestScene { + [Resolved] + private RulesetStore rulesetStore { get; set; } + private ModSelectScreen modSelectScreen; [SetUpSteps] public void SetUpSteps() { + AddStep("clear contents", Clear); + AddStep("reset ruleset", () => Ruleset.Value = rulesetStore.GetRuleset(0)); AddStep("reset mods", () => SelectedMods.SetDefault()); } - private void createScreen() => AddStep("create screen", () => Child = modSelectScreen = new ModSelectScreen + private void createScreen() { - RelativeSizeAxes = Axes.Both, - State = { Value = Visibility.Visible }, - SelectedMods = { BindTarget = SelectedMods } - }); + AddStep("create screen", () => Child = modSelectScreen = new ModSelectScreen + { + RelativeSizeAxes = Axes.Both, + State = { Value = Visibility.Visible }, + SelectedMods = { BindTarget = SelectedMods } + }); + waitForColumnLoad(); + } [Test] public void TestStateChange() @@ -76,10 +83,10 @@ namespace osu.Game.Tests.Visual.UserInterface public void TestRulesetChange() { createScreen(); - AddStep("change to osu!", () => Ruleset.Value = new OsuRuleset().RulesetInfo); - AddStep("change to osu!taiko", () => Ruleset.Value = new TaikoRuleset().RulesetInfo); - AddStep("change to osu!catch", () => Ruleset.Value = new CatchRuleset().RulesetInfo); - AddStep("change to osu!mania", () => Ruleset.Value = new ManiaRuleset().RulesetInfo); + changeRuleset(0); + changeRuleset(1); + changeRuleset(2); + changeRuleset(3); } [Test] @@ -113,6 +120,15 @@ namespace osu.Game.Tests.Visual.UserInterface assertCustomisationToggleState(disabled: true, active: false); // config was dismissed without explicit user action. } + private void waitForColumnLoad() => AddUntilStep("all column content loaded", + () => modSelectScreen.ChildrenOfType().Any() && modSelectScreen.ChildrenOfType().All(column => column.IsLoaded && column.ItemsLoaded)); + + private void changeRuleset(int id) + { + AddStep($"set ruleset to {id}", () => Ruleset.Value = rulesetStore.GetRuleset(id)); + waitForColumnLoad(); + } + private void assertCustomisationToggleState(bool disabled, bool active) { ShearedToggleButton getToggle() => modSelectScreen.ChildrenOfType().Single(); From 3ba81f3fdce3791d50f526849a320919a1e9d9fb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Apr 2022 15:29:03 +0900 Subject: [PATCH 0099/2328] Fix overlapping variable usage --- .../Visual/UserInterface/TestSceneModSelectScreen.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index 47cff40873..1e9357b6c4 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -59,7 +59,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddUntilStep("two panels active", () => modSelectScreen.ChildrenOfType().Count(panel => panel.Active.Value) == 2); AddAssert("mod multiplier correct", () => { - double multiplier = SelectedMods.Value.Aggregate(1d, (multiplier, mod) => multiplier * mod.ScoreMultiplier); + double multiplier = SelectedMods.Value.Aggregate(1d, (m, mod) => m * mod.ScoreMultiplier); return Precision.AlmostEquals(multiplier, modSelectScreen.ChildrenOfType().Single().Current.Value); }); assertCustomisationToggleState(disabled: false, active: false); @@ -73,7 +73,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddUntilStep("two panels active", () => modSelectScreen.ChildrenOfType().Count(panel => panel.Active.Value) == 2); AddAssert("mod multiplier correct", () => { - double multiplier = SelectedMods.Value.Aggregate(1d, (multiplier, mod) => multiplier * mod.ScoreMultiplier); + double multiplier = SelectedMods.Value.Aggregate(1d, (m, mod) => m * mod.ScoreMultiplier); return Precision.AlmostEquals(multiplier, modSelectScreen.ChildrenOfType().Single().Current.Value); }); assertCustomisationToggleState(disabled: false, active: false); From b5df3500079489c969ba95666a7c94c0cf977d41 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Apr 2022 15:45:44 +0900 Subject: [PATCH 0100/2328] Adjust pop in/out transitions --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 26 +++++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 659c88e070..fb991f60ba 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -38,6 +38,9 @@ namespace osu.Game.Overlays.Mods private GridContainer grid; private Container mainContent; + private PopupScreenTitle header; + private Container footer; + [BackgroundDependencyLoader] private void load() { @@ -67,7 +70,7 @@ namespace osu.Game.Overlays.Mods { new Drawable[] { - new PopupScreenTitle + header = new PopupScreenTitle { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, @@ -96,7 +99,6 @@ namespace osu.Game.Overlays.Mods { RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, - X = 1, Padding = new MarginPadding { Horizontal = 70 }, Children = new Drawable[] { @@ -126,7 +128,7 @@ namespace osu.Game.Overlays.Mods new[] { Empty() } } }, - new Container + footer = new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -269,16 +271,26 @@ namespace osu.Game.Overlays.Mods protected override void PopIn() { + const double fade_in_duration = 500; + base.PopIn(); - this.MoveToY(0, 800, Easing.OutQuint); - columnContainer.MoveToX(0, 800, Easing.OutQuint); + + header.MoveToY(0, fade_in_duration, Easing.OutQuint); + footer.MoveToY(0, fade_in_duration, Easing.OutQuint); + + this.FadeIn(fade_in_duration, Easing.OutQuint); } protected override void PopOut() { + const double fade_out_duration = 500; + base.PopOut(); - this.MoveToY(1.2f, 800, Easing.OutQuint); - columnContainer.MoveToX(1, 800, Easing.OutQuint); + + header.MoveToY(-header.DrawHeight, fade_out_duration, Easing.OutQuint); + footer.MoveToY(footer.DrawHeight, fade_out_duration, Easing.OutQuint); + + this.FadeOut(fade_out_duration, Easing.OutQuint); } private class ModColumnContainer : FillFlowContainer From bc53adb72a14e5bbc16d320243a76388d2cc063e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Apr 2022 15:50:40 +0900 Subject: [PATCH 0101/2328] Adjust customisation transition slightly --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index fb991f60ba..b3435affff 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -234,12 +234,14 @@ namespace osu.Game.Overlays.Mods private void updateCustomisationVisualState() { - grid.FadeColour(customisationVisible.Value ? Colour4.Gray : Colour4.White, 800, Easing.OutQuint); + const double transition_duration = 700; + + grid.FadeColour(customisationVisible.Value ? Colour4.Gray : Colour4.White, transition_duration, Easing.InOutCubic); float modAreaHeight = customisationVisible.Value ? ModSettingsArea.HEIGHT : 0; - modSettingsArea.ResizeHeightTo(modAreaHeight, 800, Easing.InOutCubic); - mainContent.TransformTo(nameof(Margin), new MarginPadding { Bottom = modAreaHeight }, 800, Easing.InOutCubic); + modSettingsArea.ResizeHeightTo(modAreaHeight, transition_duration, Easing.InOutCubic); + mainContent.TransformTo(nameof(Margin), new MarginPadding { Bottom = modAreaHeight }, transition_duration, Easing.InOutCubic); } private bool selectionBindableSyncInProgress; From 57b8c32f253f94df284fe1a9c9b4b739f9b4ac54 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Apr 2022 20:42:12 +0900 Subject: [PATCH 0102/2328] Remove unused fields --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index b3435affff..8baf141c61 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -33,7 +33,6 @@ namespace osu.Game.Overlays.Mods private DifficultyMultiplierDisplay multiplierDisplay; private ModSettingsArea modSettingsArea; - private Container columnContainer; private FillFlowContainer columnFlow; private GridContainer grid; private Container mainContent; @@ -95,7 +94,7 @@ namespace osu.Game.Overlays.Mods }, new Drawable[] { - columnContainer = new Container + new Container { RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, From 9b367d645d464bfcdeec61742de7768b928a8f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 4 Apr 2022 20:02:47 +0200 Subject: [PATCH 0103/2328] Always play pop in sequence --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 8baf141c61..7915fb755c 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -29,6 +29,8 @@ namespace osu.Game.Overlays.Mods [Cached] public Bindable> SelectedMods { get; private set; } = new Bindable>(Array.Empty()); + protected override bool StartHidden => true; + private readonly BindableBool customisationVisible = new BindableBool(); private DifficultyMultiplierDisplay multiplierDisplay; @@ -164,7 +166,8 @@ namespace osu.Game.Overlays.Mods modSettingsArea = new ModSettingsArea { Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre + Origin = Anchor.BottomCentre, + Height = 0 } }; @@ -190,8 +193,6 @@ namespace osu.Game.Overlays.Mods } customisationVisible.BindValueChanged(_ => updateCustomisationVisualState(), true); - - FinishTransforms(true); } private void updateMultiplier() From 29b7460cc7454a8b4371c72f2f30858a04b146c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 4 Apr 2022 20:05:54 +0200 Subject: [PATCH 0104/2328] Fix weird test step --- osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index 1e9357b6c4..34d9ddcc4e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual.UserInterface public void TestStateChange() { createScreen(); - AddToggleStep("toggle state", visible => modSelectScreen.State.Value = visible ? Visibility.Visible : Visibility.Hidden); + AddStep("toggle state", () => modSelectScreen.ToggleVisibility()); } [Test] From 23dad7bdc4cab9bbbac3f8c707c17f2d23eb2c53 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Apr 2022 16:39:02 +0900 Subject: [PATCH 0105/2328] Move scroll view padding to content level Without doing this, there is a non-masked but also non-interactive area to the left or right of the view. --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 7915fb755c..5197cb6c3e 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -100,7 +100,6 @@ namespace osu.Game.Overlays.Mods { RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, - Padding = new MarginPadding { Horizontal = 70 }, Children = new Drawable[] { new OsuScrollContainer(Direction.Horizontal) @@ -113,6 +112,7 @@ namespace osu.Game.Overlays.Mods RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Spacing = new Vector2(10, 0), + Margin = new MarginPadding { Horizontal = 70 }, Children = new[] { new ModColumn(ModType.DifficultyReduction, false, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }), From f156cb797df13c31e43856e58037cec9b490bf7d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Apr 2022 16:40:09 +0900 Subject: [PATCH 0106/2328] Improve nested scroll behaviour --- osu.Game/Overlays/Mods/ModColumn.cs | 60 ++++++++++++++++++++++- osu.Game/Overlays/Mods/ModSelectScreen.cs | 1 + 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 46a562ac98..513dd2ca3f 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -151,9 +151,10 @@ namespace osu.Game.Overlays.Mods }, new Drawable[] { - new OsuScrollContainer + new NestedVerticalScrollContainer { RelativeSizeAxes = Axes.Both, + ClampExtension = 100, ScrollbarOverlapsContent = false, Child = panelFlow = new FillFlowContainer { @@ -194,6 +195,63 @@ namespace osu.Game.Overlays.Mods } } + /// + /// A scroll container that handles the case of vertically scrolling content inside a larger horizontally scrolling parent container. + /// + private class NestedVerticalScrollContainer : OsuScrollContainer + { + private OsuScrollContainer? parentScrollContainer; + + protected override void LoadComplete() + { + base.LoadComplete(); + + parentScrollContainer = findClosestParent(); + } + + protected override bool OnScroll(ScrollEvent e) + { + if (parentScrollContainer == null) + return base.OnScroll(e); + + // If not on screen, handle scroll but also allow parent to scroll at the same time. + bool topRightOutsideOfView = parentScrollContainer.ScreenSpaceDrawQuad.Contains(ScreenSpaceDrawQuad.TopRight) == false; + bool bottomLeftOutsideOfView = parentScrollContainer.ScreenSpaceDrawQuad.Contains(ScreenSpaceDrawQuad.BottomLeft) == false; + + if (topRightOutsideOfView || bottomLeftOutsideOfView) + { + base.OnScroll(e); + return false; + } + + bool scrollingPastEnd = e.ScrollDelta.Y < 0 && IsScrolledToEnd(); + bool scrollingPastStart = e.ScrollDelta.Y > 0 && Target <= 0; + + // Same deal if at one of the two extents of the view. + if (scrollingPastStart || scrollingPastEnd) + { + base.OnScroll(e); + return false; + } + + return base.OnScroll(e); + } + + // TODO: remove when https://github.com/ppy/osu-framework/pull/5092 is available. + private T? findClosestParent() where T : class, IDrawable + { + Drawable cursor = this; + + while ((cursor = cursor.Parent) != null) + { + if (cursor is T match) + return match; + } + + return default; + } + } + private void createHeaderText() { IEnumerable headerTextWords = ModType.Humanize(LetterCasing.Title).Split(' '); diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 5197cb6c3e..1d6f784133 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -106,6 +106,7 @@ namespace osu.Game.Overlays.Mods { RelativeSizeAxes = Axes.Both, Masking = false, + ClampExtension = 100, ScrollbarOverlapsContent = false, Child = columnFlow = new ModColumnContainer { From 58e9147b12a613e6ae2dc590d82f5672304963b0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Apr 2022 16:48:25 +0900 Subject: [PATCH 0107/2328] Simplify and better comment nested scroll conditionals --- osu.Game/Overlays/Mods/ModColumn.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 513dd2ca3f..e915e88e99 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -214,11 +214,11 @@ namespace osu.Game.Overlays.Mods if (parentScrollContainer == null) return base.OnScroll(e); - // If not on screen, handle scroll but also allow parent to scroll at the same time. - bool topRightOutsideOfView = parentScrollContainer.ScreenSpaceDrawQuad.Contains(ScreenSpaceDrawQuad.TopRight) == false; - bool bottomLeftOutsideOfView = parentScrollContainer.ScreenSpaceDrawQuad.Contains(ScreenSpaceDrawQuad.BottomLeft) == false; + bool topRightInView = parentScrollContainer.ScreenSpaceDrawQuad.Contains(ScreenSpaceDrawQuad.TopRight); + bool bottomLeftInView = parentScrollContainer.ScreenSpaceDrawQuad.Contains(ScreenSpaceDrawQuad.BottomLeft); - if (topRightOutsideOfView || bottomLeftOutsideOfView) + // If not completely on-screen, handle scroll but also allow parent to scroll at the same time (to hopefully bring our content into full view). + if (!topRightInView || !bottomLeftInView) { base.OnScroll(e); return false; @@ -227,7 +227,7 @@ namespace osu.Game.Overlays.Mods bool scrollingPastEnd = e.ScrollDelta.Y < 0 && IsScrolledToEnd(); bool scrollingPastStart = e.ScrollDelta.Y > 0 && Target <= 0; - // Same deal if at one of the two extents of the view. + // If at either of our extents, allow the parent scroll to handle as a horizontal scroll to view more content. if (scrollingPastStart || scrollingPastEnd) { base.OnScroll(e); From 388322cd61eeec61aa7bc53597f49b4c0f463619 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Apr 2022 16:56:24 +0900 Subject: [PATCH 0108/2328] Speed up customisation panel toggle a bit --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 1d6f784133..1f0dcea6c2 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -235,7 +235,7 @@ namespace osu.Game.Overlays.Mods private void updateCustomisationVisualState() { - const double transition_duration = 700; + const double transition_duration = 300; grid.FadeColour(customisationVisible.Value ? Colour4.Gray : Colour4.White, transition_duration, Easing.InOutCubic); From a408776734b8d7285d8f1af98560dae8405aeb09 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Apr 2022 17:14:59 +0900 Subject: [PATCH 0109/2328] Limit `FillFlow` of columns to applicable direction --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 1f0dcea6c2..8468448bbb 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -110,6 +110,7 @@ namespace osu.Game.Overlays.Mods ScrollbarOverlapsContent = false, Child = columnFlow = new ModColumnContainer { + Direction = FillDirection.Horizontal, RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Spacing = new Vector2(10, 0), From 497e5e3a36731490881e8afe3da2cd087446b197 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Apr 2022 17:15:24 +0900 Subject: [PATCH 0110/2328] Slightly adjust scroll handling and also apply to `ModSettingsContainer` --- osu.Game/Overlays/Mods/ModColumn.cs | 57 ----------------- osu.Game/Overlays/Mods/ModSettingsArea.cs | 4 +- .../Mods/NestedVerticalScrollContainer.cs | 61 +++++++++++++++++++ 3 files changed, 64 insertions(+), 58 deletions(-) create mode 100644 osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index e915e88e99..8531ae1e3f 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -195,63 +195,6 @@ namespace osu.Game.Overlays.Mods } } - /// - /// A scroll container that handles the case of vertically scrolling content inside a larger horizontally scrolling parent container. - /// - private class NestedVerticalScrollContainer : OsuScrollContainer - { - private OsuScrollContainer? parentScrollContainer; - - protected override void LoadComplete() - { - base.LoadComplete(); - - parentScrollContainer = findClosestParent(); - } - - protected override bool OnScroll(ScrollEvent e) - { - if (parentScrollContainer == null) - return base.OnScroll(e); - - bool topRightInView = parentScrollContainer.ScreenSpaceDrawQuad.Contains(ScreenSpaceDrawQuad.TopRight); - bool bottomLeftInView = parentScrollContainer.ScreenSpaceDrawQuad.Contains(ScreenSpaceDrawQuad.BottomLeft); - - // If not completely on-screen, handle scroll but also allow parent to scroll at the same time (to hopefully bring our content into full view). - if (!topRightInView || !bottomLeftInView) - { - base.OnScroll(e); - return false; - } - - bool scrollingPastEnd = e.ScrollDelta.Y < 0 && IsScrolledToEnd(); - bool scrollingPastStart = e.ScrollDelta.Y > 0 && Target <= 0; - - // If at either of our extents, allow the parent scroll to handle as a horizontal scroll to view more content. - if (scrollingPastStart || scrollingPastEnd) - { - base.OnScroll(e); - return false; - } - - return base.OnScroll(e); - } - - // TODO: remove when https://github.com/ppy/osu-framework/pull/5092 is available. - private T? findClosestParent() where T : class, IDrawable - { - Drawable cursor = this; - - while ((cursor = cursor.Parent) != null) - { - if (cursor is T match) - return match; - } - - return default; - } - } - private void createHeaderText() { IEnumerable headerTextWords = ModType.Humanize(LetterCasing.Title).Split(' '); diff --git a/osu.Game/Overlays/Mods/ModSettingsArea.cs b/osu.Game/Overlays/Mods/ModSettingsArea.cs index 9b0382c6a4..be72c1e3e3 100644 --- a/osu.Game/Overlays/Mods/ModSettingsArea.cs +++ b/osu.Game/Overlays/Mods/ModSettingsArea.cs @@ -54,6 +54,7 @@ namespace osu.Game.Overlays.Mods { RelativeSizeAxes = Axes.Both, ScrollbarOverlapsContent = false, + ClampExtension = 100, Child = modSettingsFlow = new FillFlowContainer { AutoSizeAxes = Axes.X, @@ -157,9 +158,10 @@ namespace osu.Game.Overlays.Mods new[] { Empty() }, new Drawable[] { - new OsuScrollContainer(Direction.Vertical) + new NestedVerticalScrollContainer { RelativeSizeAxes = Axes.Both, + ClampExtension = 100, Child = new FillFlowContainer { RelativeSizeAxes = Axes.X, diff --git a/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs b/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs new file mode 100644 index 0000000000..c62b52ef27 --- /dev/null +++ b/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs @@ -0,0 +1,61 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable +using osu.Framework.Graphics; +using osu.Framework.Input.Events; +using osu.Game.Graphics.Containers; + +namespace osu.Game.Overlays.Mods +{ + /// + /// A scroll container that handles the case of vertically scrolling content inside a larger horizontally scrolling parent container. + /// + public class NestedVerticalScrollContainer : OsuScrollContainer + { + private OsuScrollContainer? parentScrollContainer; + + protected override void LoadComplete() + { + base.LoadComplete(); + + parentScrollContainer = findClosestParent(); + } + + protected override bool OnScroll(ScrollEvent e) + { + if (parentScrollContainer == null) + return base.OnScroll(e); + + bool topRightInView = parentScrollContainer.ScreenSpaceDrawQuad.Contains(ScreenSpaceDrawQuad.TopRight); + bool bottomLeftInView = parentScrollContainer.ScreenSpaceDrawQuad.Contains(ScreenSpaceDrawQuad.BottomLeft); + + // If not completely on-screen, handle scroll but also allow parent to scroll at the same time (to hopefully bring our content into full view). + if (!topRightInView || !bottomLeftInView) + return false; + + bool scrollingPastEnd = e.ScrollDelta.Y < 0 && IsScrolledToEnd(); + bool scrollingPastStart = e.ScrollDelta.Y > 0 && Target <= 0; + + // If at either of our extents, delegate scroll to the horizontal parent container. + if (scrollingPastStart || scrollingPastEnd) + return false; + + return base.OnScroll(e); + } + + // TODO: remove when https://github.com/ppy/osu-framework/pull/5092 is available. + private T? findClosestParent() where T : class, IDrawable + { + Drawable cursor = this; + + while ((cursor = cursor.Parent) != null) + { + if (cursor is T match) + return match; + } + + return default; + } + } +} From 901032bfa21e0916efa9ce1b5b184f1978f53e8f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Apr 2022 18:25:27 +0900 Subject: [PATCH 0111/2328] Animate multiplier display --- .../Mods/DifficultyMultiplierDisplay.cs | 5 ++-- osu.Game/Overlays/Mods/ModSelectScreen.cs | 27 +++++++++++++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs b/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs index 4fc3a904fa..4d3f630a55 100644 --- a/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs +++ b/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs @@ -20,6 +20,8 @@ namespace osu.Game.Overlays.Mods { public class DifficultyMultiplierDisplay : CompositeDrawable, IHasCurrentValue { + public const float HEIGHT = 42; + public Bindable Current { get => current.Current; @@ -42,13 +44,12 @@ namespace osu.Game.Overlays.Mods [Resolved] private OverlayColourProvider colourProvider { get; set; } - private const float height = 42; private const float multiplier_value_area_width = 56; private const float transition_duration = 200; public DifficultyMultiplierDisplay() { - Height = height; + Height = HEIGHT; AutoSizeAxes = Axes.X; InternalChild = new Container diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 8468448bbb..3437922cc8 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -84,13 +84,21 @@ namespace osu.Game.Overlays.Mods { new Container { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Horizontal = 100, Vertical = 10 }, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.X, + RelativePositionAxes = Axes.X, + X = 0.3f, + Height = DifficultyMultiplierDisplay.HEIGHT, + Margin = new MarginPadding + { + Horizontal = 100, + Vertical = 10 + }, Child = multiplierDisplay = new DifficultyMultiplierDisplay { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight + Anchor = Anchor.Centre, + Origin = Anchor.Centre } } }, @@ -283,6 +291,11 @@ namespace osu.Game.Overlays.Mods footer.MoveToY(0, fade_in_duration, Easing.OutQuint); this.FadeIn(fade_in_duration, Easing.OutQuint); + + multiplierDisplay + .Delay(300) + .FadeIn(200, Easing.OutQuint) + .ScaleTo(1, fade_in_duration, Easing.OutElastic); } protected override void PopOut() @@ -291,6 +304,10 @@ namespace osu.Game.Overlays.Mods base.PopOut(); + multiplierDisplay + .FadeOut(200, Easing.OutQuint) + .ScaleTo(0.75f, fade_out_duration, Easing.OutQuint); + header.MoveToY(-header.DrawHeight, fade_out_duration, Easing.OutQuint); footer.MoveToY(footer.DrawHeight, fade_out_duration, Easing.OutQuint); From 9fdeb2053746f6e0b35366cbedb4026034640ef9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Apr 2022 18:27:34 +0900 Subject: [PATCH 0112/2328] Animate individual `ModColumn`s during togle of oerlay --- osu.Game/Overlays/Mods/ModColumn.cs | 143 ++++++++++++---------- osu.Game/Overlays/Mods/ModSelectScreen.cs | 15 +++ 2 files changed, 91 insertions(+), 67 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 8531ae1e3f..f84ae4ac8a 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -31,6 +31,8 @@ namespace osu.Game.Overlays.Mods { public class ModColumn : CompositeDrawable { + public readonly Container TopLevelContent; + public readonly ModType ModType; private Func? filter; @@ -78,90 +80,97 @@ namespace osu.Game.Overlays.Mods Width = 320; RelativeSizeAxes = Axes.Y; Shear = new Vector2(ModPanel.SHEAR_X, 0); - CornerRadius = ModPanel.CORNER_RADIUS; - Masking = true; Container controlContainer; InternalChildren = new Drawable[] { - new Container - { - RelativeSizeAxes = Axes.X, - Height = header_height + ModPanel.CORNER_RADIUS, - Children = new Drawable[] - { - headerBackground = new Box - { - RelativeSizeAxes = Axes.X, - Height = header_height + ModPanel.CORNER_RADIUS - }, - headerText = new OsuTextFlowContainer(t => - { - t.Font = OsuFont.TorusAlternate.With(size: 17); - t.Shadow = false; - t.Colour = Colour4.Black; - }) - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Shear = new Vector2(-ModPanel.SHEAR_X, 0), - Padding = new MarginPadding - { - Horizontal = 17, - Bottom = ModPanel.CORNER_RADIUS - } - } - } - }, - new Container + TopLevelContent = new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = header_height }, - Child = contentContainer = new Container + CornerRadius = ModPanel.CORNER_RADIUS, + Masking = true, + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Masking = true, - CornerRadius = ModPanel.CORNER_RADIUS, - BorderThickness = 3, - Children = new Drawable[] + new Container { - contentBackground = new Box + RelativeSizeAxes = Axes.X, + Height = header_height + ModPanel.CORNER_RADIUS, + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both - }, - new GridContainer + headerBackground = new Box + { + RelativeSizeAxes = Axes.X, + Height = header_height + ModPanel.CORNER_RADIUS + }, + headerText = new OsuTextFlowContainer(t => + { + t.Font = OsuFont.TorusAlternate.With(size: 17); + t.Shadow = false; + t.Colour = Colour4.Black; + }) + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Shear = new Vector2(-ModPanel.SHEAR_X, 0), + Padding = new MarginPadding + { + Horizontal = 17, + Bottom = ModPanel.CORNER_RADIUS + } + } + } + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Top = header_height }, + Child = contentContainer = new Container { RelativeSizeAxes = Axes.Both, - RowDimensions = new[] + Masking = true, + CornerRadius = ModPanel.CORNER_RADIUS, + BorderThickness = 3, + Children = new Drawable[] { - new Dimension(GridSizeMode.AutoSize), - new Dimension() - }, - Content = new[] - { - new Drawable[] + contentBackground = new Box { - controlContainer = new Container - { - RelativeSizeAxes = Axes.X, - Padding = new MarginPadding { Horizontal = 14 } - } + RelativeSizeAxes = Axes.Both }, - new Drawable[] + new GridContainer { - new NestedVerticalScrollContainer + RelativeSizeAxes = Axes.Both, + RowDimensions = new[] { - RelativeSizeAxes = Axes.Both, - ClampExtension = 100, - ScrollbarOverlapsContent = false, - Child = panelFlow = new FillFlowContainer + new Dimension(GridSizeMode.AutoSize), + new Dimension() + }, + Content = new[] + { + new Drawable[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Spacing = new Vector2(0, 7), - Padding = new MarginPadding(7) + controlContainer = new Container + { + RelativeSizeAxes = Axes.X, + Padding = new MarginPadding { Horizontal = 14 } + } + }, + new Drawable[] + { + new NestedVerticalScrollContainer + { + RelativeSizeAxes = Axes.Both, + ClampExtension = 100, + ScrollbarOverlapsContent = false, + Child = panelFlow = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Spacing = new Vector2(0, 7), + Padding = new MarginPadding(7) + } + } } } } diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 3437922cc8..1009c2edf6 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -106,6 +106,7 @@ namespace osu.Game.Overlays.Mods { new Container { + Depth = float.MaxValue, RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Children = new Drawable[] @@ -296,6 +297,13 @@ namespace osu.Game.Overlays.Mods .Delay(300) .FadeIn(200, Easing.OutQuint) .ScaleTo(1, fade_in_duration, Easing.OutElastic); + + for (int i = 0; i < columnFlow.Count; i++) + { + columnFlow[i].TopLevelContent + .Delay(i * 30) + .MoveToY(0, fade_in_duration, Easing.OutQuint); + } } protected override void PopOut() @@ -312,6 +320,13 @@ namespace osu.Game.Overlays.Mods footer.MoveToY(footer.DrawHeight, fade_out_duration, Easing.OutQuint); this.FadeOut(fade_out_duration, Easing.OutQuint); + + for (int i = 0; i < columnFlow.Count; i++) + { + const float distance = 700; + + columnFlow[i].TopLevelContent.MoveToY(i % 2 == 0 ? -distance : distance, fade_out_duration, Easing.OutQuint); + } } private class ModColumnContainer : FillFlowContainer From 7a1820e6bb99a48101033da2abf8a9a6cd4670fe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Apr 2022 18:25:27 +0900 Subject: [PATCH 0113/2328] Fix multiplier display resetting transformations --- osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs b/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs index 4d3f630a55..248d4f288e 100644 --- a/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs +++ b/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs @@ -146,8 +146,9 @@ namespace osu.Game.Overlays.Mods protected override void LoadComplete() { base.LoadComplete(); + current.BindValueChanged(_ => updateState(), true); - FinishTransforms(true); + // required to prevent the counter initially rolling up from 0 to 1 // due to `Current.Value` having a nonstandard default value of 1. multiplierCounter.SetCountWithoutRolling(Current.Value); From 54715885af16463759bb1aa99ed70f298232bb6d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Apr 2022 18:38:31 +0900 Subject: [PATCH 0114/2328] Adjust animation metrics slightly --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 1009c2edf6..c43987ea60 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -284,25 +284,25 @@ namespace osu.Game.Overlays.Mods protected override void PopIn() { - const double fade_in_duration = 500; + const double fade_in_duration = 400; base.PopIn(); + this.FadeIn(fade_in_duration, Easing.OutQuint); header.MoveToY(0, fade_in_duration, Easing.OutQuint); footer.MoveToY(0, fade_in_duration, Easing.OutQuint); - this.FadeIn(fade_in_duration, Easing.OutQuint); - multiplierDisplay - .Delay(300) - .FadeIn(200, Easing.OutQuint) + .Delay(fade_in_duration * 0.65f) + .FadeIn(fade_in_duration / 2, Easing.OutQuint) .ScaleTo(1, fade_in_duration, Easing.OutElastic); for (int i = 0; i < columnFlow.Count; i++) { columnFlow[i].TopLevelContent .Delay(i * 30) - .MoveToY(0, fade_in_duration, Easing.OutQuint); + .MoveToY(0, fade_in_duration, Easing.OutQuint) + .FadeIn(fade_in_duration, Easing.OutQuint); } } @@ -311,21 +311,22 @@ namespace osu.Game.Overlays.Mods const double fade_out_duration = 500; base.PopOut(); + this.FadeOut(fade_out_duration, Easing.OutQuint); multiplierDisplay - .FadeOut(200, Easing.OutQuint) + .FadeOut(fade_out_duration / 2, Easing.OutQuint) .ScaleTo(0.75f, fade_out_duration, Easing.OutQuint); header.MoveToY(-header.DrawHeight, fade_out_duration, Easing.OutQuint); footer.MoveToY(footer.DrawHeight, fade_out_duration, Easing.OutQuint); - this.FadeOut(fade_out_duration, Easing.OutQuint); - for (int i = 0; i < columnFlow.Count; i++) { const float distance = 700; - columnFlow[i].TopLevelContent.MoveToY(i % 2 == 0 ? -distance : distance, fade_out_duration, Easing.OutQuint); + columnFlow[i].TopLevelContent + .MoveToY(i % 2 == 0 ? -distance : distance, fade_out_duration, Easing.OutQuint) + .FadeOut(fade_out_duration, Easing.OutQuint); } } From 631aa2a6ec8e35be514953c4c4b40e35a51cdb4d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Apr 2022 18:44:25 +0900 Subject: [PATCH 0115/2328] Remove left padding to allow left-most column to exist further to the.. left --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index c43987ea60..62080ec1b5 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -123,7 +123,7 @@ namespace osu.Game.Overlays.Mods RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Spacing = new Vector2(10, 0), - Margin = new MarginPadding { Horizontal = 70 }, + Margin = new MarginPadding { Right = 70 }, Children = new[] { new ModColumn(ModType.DifficultyReduction, false, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }), From 32daf64a31a09cc459461957d0aa709c52f015f1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Apr 2022 19:23:35 +0900 Subject: [PATCH 0116/2328] Use newly exposed framework helper function to find closest parent --- osu.Android.props | 2 +- .../Mods/NestedVerticalScrollContainer.cs | 16 +--------------- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 6a3b113fa2..a168d351fc 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs b/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs index c62b52ef27..1bf965beeb 100644 --- a/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs +++ b/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Mods { base.LoadComplete(); - parentScrollContainer = findClosestParent(); + parentScrollContainer = this.FindClosestParent(); } protected override bool OnScroll(ScrollEvent e) @@ -43,19 +43,5 @@ namespace osu.Game.Overlays.Mods return base.OnScroll(e); } - - // TODO: remove when https://github.com/ppy/osu-framework/pull/5092 is available. - private T? findClosestParent() where T : class, IDrawable - { - Drawable cursor = this; - - while ((cursor = cursor.Parent) != null) - { - if (cursor is T match) - return match; - } - - return default; - } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 3c01f29671..e968c6602d 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index c8f170497d..e441ed81ab 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From ac799aaf7a412db957203074b9110776ad61dfbf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Apr 2022 19:25:47 +0900 Subject: [PATCH 0117/2328] Add missing newline --- osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs b/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs index 1bf965beeb..aba47d5423 100644 --- a/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs +++ b/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. #nullable enable + using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; From 74706f72e6450befc842511bdc0077b100180ac9 Mon Sep 17 00:00:00 2001 From: Perry MacMurray Date: Tue, 5 Apr 2022 15:10:55 -0400 Subject: [PATCH 0118/2328] Add 12-hour display setting (TODO add toggle) --- osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs b/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs index 81a362450c..b535c5c6a2 100644 --- a/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs +++ b/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs @@ -29,6 +29,8 @@ namespace osu.Game.Overlays.Toolbar } } + private bool format12H = true; + [BackgroundDependencyLoader] private void load(OsuColour colours) { @@ -50,13 +52,17 @@ namespace osu.Game.Overlays.Toolbar protected override void UpdateDisplay(DateTimeOffset now) { - realTime.Text = $"{now:HH:mm:ss}"; + realTime.Text = format12H ? $"{now:hh:mm:ss tt}" : $"{now:HH:mm:ss}"; gameTime.Text = $"running {new TimeSpan(TimeSpan.TicksPerSecond * (int)(Clock.CurrentTime / 1000)):c}"; } private void updateMetrics() { - Width = showRuntime ? 66 : 45; // Allows for space for game time up to 99 days (in the padding area since this is quite rare). + if (format12H) + Width = 74; + else + Width = showRuntime ? 66 : 45; // Allows for space for game time up to 99 days (in the padding area since this is quite rare). + gameTime.FadeTo(showRuntime ? 1 : 0); } } From 9d475f7b336b196a06f99801a64c7cd280641d9a Mon Sep 17 00:00:00 2001 From: Perry MacMurray Date: Tue, 5 Apr 2022 16:21:28 -0400 Subject: [PATCH 0119/2328] Add config in settings for forcing 24H time, determines default off CurrentCulture --- osu.Game/Configuration/OsuConfigManager.cs | 3 +++ osu.Game/Localisation/UserInterfaceStrings.cs | 5 +++++ .../Sections/UserInterface/GeneralSettings.cs | 5 +++++ .../Overlays/Toolbar/DigitalClockDisplay.cs | 20 ++++++++++++++++--- osu.Game/Overlays/Toolbar/ToolbarClock.cs | 6 ++++++ 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 2f966ac0a9..99372c92d9 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -102,6 +102,8 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.MenuParallax, true); + SetDefault(OsuSetting.Prefer24HourTime, false); + // Gameplay SetDefault(OsuSetting.PositionalHitsounds, true); // replaced by level setting below, can be removed 20220703. SetDefault(OsuSetting.PositionalHitsoundsLevel, 0.2f, 0, 1); @@ -287,6 +289,7 @@ namespace osu.Game.Configuration MenuVoice, CursorRotation, MenuParallax, + Prefer24HourTime, BeatmapDetailTab, BeatmapDetailModsFilter, Username, diff --git a/osu.Game/Localisation/UserInterfaceStrings.cs b/osu.Game/Localisation/UserInterfaceStrings.cs index 4be403edb4..ac79f9f45d 100644 --- a/osu.Game/Localisation/UserInterfaceStrings.cs +++ b/osu.Game/Localisation/UserInterfaceStrings.cs @@ -24,6 +24,11 @@ namespace osu.Game.Localisation /// public static LocalisableString CursorRotation => new TranslatableString(getKey(@"cursor_rotation"), @"Rotate cursor when dragging"); + /// + /// "Prefer 24-hour time" + /// + public static LocalisableString Prefer24HourTime => new TranslatableString(getKey(@"prefer_24_hour_time"), @"Prefer 24-hour time"); + /// /// "Menu cursor size" /// diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs index 59894cbcae..d6d38c8e12 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs @@ -41,6 +41,11 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface Current = config.GetBindable(OsuSetting.UIHoldActivationDelay), KeyboardStep = 50 }, + new SettingsCheckbox + { + LabelText = UserInterfaceStrings.Prefer24HourTime, + Current = config.GetBindable(OsuSetting.Prefer24HourTime) + }, }; } } diff --git a/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs b/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs index b535c5c6a2..66f40532d0 100644 --- a/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs +++ b/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs @@ -29,7 +29,21 @@ namespace osu.Game.Overlays.Toolbar } } - private bool format12H = true; + private bool format12H = false; + + public bool Format12H + { + get => format12H; + set + { + if (format12H == value) + return; + + format12H = value; + updateMetrics(); + UpdateDisplay(DateTimeOffset.Now); //Update realTime.Text immediately instead of waiting until next second + } + } [BackgroundDependencyLoader] private void load(OsuColour colours) @@ -52,14 +66,14 @@ namespace osu.Game.Overlays.Toolbar protected override void UpdateDisplay(DateTimeOffset now) { - realTime.Text = format12H ? $"{now:hh:mm:ss tt}" : $"{now:HH:mm:ss}"; + realTime.Text = format12H ? $"{now:h:mm:ss tt}" : $"{now:HH:mm:ss}"; gameTime.Text = $"running {new TimeSpan(TimeSpan.TicksPerSecond * (int)(Clock.CurrentTime / 1000)):c}"; } private void updateMetrics() { if (format12H) - Width = 74; + Width = 70; else Width = showRuntime ? 66 : 45; // Allows for space for game time up to 99 days (in the padding area since this is quite rare). diff --git a/osu.Game/Overlays/Toolbar/ToolbarClock.cs b/osu.Game/Overlays/Toolbar/ToolbarClock.cs index 22a96603dc..b256d6fbc4 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarClock.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarClock.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; @@ -20,6 +21,7 @@ namespace osu.Game.Overlays.Toolbar public class ToolbarClock : OsuClickableContainer { private Bindable clockDisplayMode; + private Bindable digitalPrefer24Hour; private Box hoverBackground; private Box flashBackground; @@ -38,6 +40,7 @@ namespace osu.Game.Overlays.Toolbar private void load(OsuConfigManager config) { clockDisplayMode = config.GetBindable(OsuSetting.ToolbarClockDisplayMode); + digitalPrefer24Hour = config.GetBindable(OsuSetting.Prefer24HourTime); Children = new Drawable[] { @@ -94,6 +97,9 @@ namespace osu.Game.Overlays.Toolbar analog.FadeTo(showAnalog ? 1 : 0); }, true); + + digitalPrefer24Hour.BindValueChanged(prefer24H => + digital.Format12H = prefer24H.NewValue ? false : CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("tt"), true); } protected override bool OnClick(ClickEvent e) From 2525ec0d18db76a64e50be272dbf457204e1579a Mon Sep 17 00:00:00 2001 From: Perry MacMurray Date: Tue, 5 Apr 2022 17:07:58 -0400 Subject: [PATCH 0120/2328] Switch 24H toggle from UI settings to language settings --- osu.Game/Localisation/GeneralSettingsStrings.cs | 5 +++++ osu.Game/Localisation/UserInterfaceStrings.cs | 5 ----- .../Settings/Sections/General/LanguageSettings.cs | 8 +++++++- .../Settings/Sections/UserInterface/GeneralSettings.cs | 5 ----- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/osu.Game/Localisation/GeneralSettingsStrings.cs b/osu.Game/Localisation/GeneralSettingsStrings.cs index a60e4891f4..cca8c8efd1 100644 --- a/osu.Game/Localisation/GeneralSettingsStrings.cs +++ b/osu.Game/Localisation/GeneralSettingsStrings.cs @@ -29,6 +29,11 @@ namespace osu.Game.Localisation /// public static LocalisableString PreferOriginalMetadataLanguage => new TranslatableString(getKey(@"prefer_original"), @"Prefer metadata in original language"); + /// + /// "Prefer 24-hour time" + /// + public static LocalisableString Prefer24HourTime => new TranslatableString(getKey(@"prefer_24_hour_time"), @"Prefer 24-hour time"); + /// /// "Updates" /// diff --git a/osu.Game/Localisation/UserInterfaceStrings.cs b/osu.Game/Localisation/UserInterfaceStrings.cs index ac79f9f45d..4be403edb4 100644 --- a/osu.Game/Localisation/UserInterfaceStrings.cs +++ b/osu.Game/Localisation/UserInterfaceStrings.cs @@ -24,11 +24,6 @@ namespace osu.Game.Localisation /// public static LocalisableString CursorRotation => new TranslatableString(getKey(@"cursor_rotation"), @"Rotate cursor when dragging"); - /// - /// "Prefer 24-hour time" - /// - public static LocalisableString Prefer24HourTime => new TranslatableString(getKey(@"prefer_24_hour_time"), @"Prefer 24-hour time"); - /// /// "Menu cursor size" /// diff --git a/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs index 200618c469..e7cc1bce10 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs @@ -6,6 +6,7 @@ using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Localisation; +using osu.Game.Configuration; using osu.Game.Extensions; using osu.Game.Localisation; @@ -19,7 +20,7 @@ namespace osu.Game.Overlays.Settings.Sections.General protected override LocalisableString Header => GeneralSettingsStrings.LanguageHeader; [BackgroundDependencyLoader] - private void load(FrameworkConfigManager frameworkConfig) + private void load(FrameworkConfigManager frameworkConfig, OsuConfigManager config) { frameworkLocale = frameworkConfig.GetBindable(FrameworkSetting.Locale); @@ -34,6 +35,11 @@ namespace osu.Game.Overlays.Settings.Sections.General LabelText = GeneralSettingsStrings.PreferOriginalMetadataLanguage, Current = frameworkConfig.GetBindable(FrameworkSetting.ShowUnicode) }, + new SettingsCheckbox + { + LabelText = GeneralSettingsStrings.Prefer24HourTime, + Current = config.GetBindable(OsuSetting.Prefer24HourTime) + }, }; if (!LanguageExtensions.TryParseCultureCode(frameworkLocale.Value, out var locale)) diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs index d6d38c8e12..59894cbcae 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs @@ -41,11 +41,6 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface Current = config.GetBindable(OsuSetting.UIHoldActivationDelay), KeyboardStep = 50 }, - new SettingsCheckbox - { - LabelText = UserInterfaceStrings.Prefer24HourTime, - Current = config.GetBindable(OsuSetting.Prefer24HourTime) - }, }; } } From 01da3924ccf7ccf91431ffb22db3fd15cf468b50 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Apr 2022 11:32:35 +0900 Subject: [PATCH 0121/2328] Simplify `IsCurrentScreen` check to only apply to relevant call --- .../Multiplayer/MultiplayerMatchSongSelect.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs index 2e8f625eba..289b8730ce 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs @@ -74,18 +74,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer task.FireAndForget(onSuccess: () => Schedule(() => { + loadingLayer.Hide(); + // If an error or server side trigger occurred this screen may have already exited by external means. if (!this.IsCurrentScreen()) - return; - - loadingLayer.Hide(); - this.Exit(); + this.Exit(); }), onError: _ => Schedule(() => { - // If an error or server side trigger occurred this screen may have already exited by external means. - if (!this.IsCurrentScreen()) - return; - loadingLayer.Hide(); Carousel.AllowSelection = true; })); From f795f77cf99d5dbd902860f7e685b1d0c2130393 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Apr 2022 14:00:54 +0900 Subject: [PATCH 0122/2328] Add missing newline --- osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs b/osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs index 98c593236a..4729765084 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. #nullable enable + using System; using System.Diagnostics; using System.Threading.Tasks; From 220d7bc6db4a2fbfb5c84a58c7c7058c3b7218f1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Apr 2022 14:01:25 +0900 Subject: [PATCH 0123/2328] Fix dangerous realm operation in `TestSceneMultiplayerMatchSongSelect` The import process was running on the async load thread, but then accessed from the access thread later on. This seemed to somehow pass fine in headless runs, but would fail on visual test execution (specifically on `TestBeatmapConfirmed()`). --- .../Multiplayer/TestSceneMultiplayerMatchSongSelect.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs index 381b9b58bd..84c53ce22e 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs @@ -15,6 +15,7 @@ using osu.Framework.Screens; using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Beatmaps; +using osu.Game.Database; using osu.Game.Online.Rooms; using osu.Game.Overlays.Mods; using osu.Game.Rulesets; @@ -35,10 +36,12 @@ namespace osu.Game.Tests.Visual.Multiplayer private BeatmapManager manager; private RulesetStore rulesets; - private List beatmaps; + private IList beatmaps => importedBeatmapSet?.PerformRead(s => s.Beatmaps) ?? new List(); private TestMultiplayerMatchSongSelect songSelect; + private Live importedBeatmapSet; + [BackgroundDependencyLoader] private void load(GameHost host, AudioManager audio) { @@ -46,8 +49,6 @@ namespace osu.Game.Tests.Visual.Multiplayer Dependencies.Cache(manager = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default)); Dependencies.Cache(Realm); - beatmaps = new List(); - var metadata = new BeatmapMetadata { Artist = "Some Artist", @@ -79,11 +80,10 @@ namespace osu.Game.Tests.Visual.Multiplayer Difficulty = new BeatmapDifficulty() }; - beatmaps.Add(beatmap); beatmapSetInfo.Beatmaps.Add(beatmap); } - manager.Import(beatmapSetInfo); + importedBeatmapSet = manager.Import(beatmapSetInfo); } public override void SetUpSteps() From 552ec5282f1d7fcb9a11cac2859f0ed570d3abde Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Apr 2022 14:44:00 +0900 Subject: [PATCH 0124/2328] Change `WorkingBeatmap.GetVirtualTrack` to use length provided by `BeatmapInfo` A lot of tests are using test resources that populate the length field, but do not populate hitobjects. The general expectation is that components should be using the cached length in cases where hitobjects are not relevant, but `GetVirtualTrack` was doing its own local calculation. This could cause tests to fail due to `MusicController` changing track in the background. --- osu.Game/Beatmaps/WorkingBeatmap.cs | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 397d47c389..bb64ec796c 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -17,7 +17,6 @@ using osu.Framework.Logging; using osu.Framework.Testing; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.UI; using osu.Game.Skinning; using osu.Game.Storyboards; @@ -152,24 +151,7 @@ namespace osu.Game.Beatmaps { const double excess_length = 1000; - var lastObject = Beatmap?.HitObjects.LastOrDefault(); - - double length; - - switch (lastObject) - { - case null: - length = emptyLength; - break; - - case IHasDuration endTime: - length = endTime.EndTime + excess_length; - break; - - default: - length = lastObject.StartTime + excess_length; - break; - } + double length = (BeatmapInfo?.Length + excess_length) ?? emptyLength; return audioManager.Tracks.GetVirtual(length); } From d17890ca9acd9d30ce2269dab25712cce966cbe1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Apr 2022 14:51:08 +0900 Subject: [PATCH 0125/2328] Replace a couple more local test beatmap cases which can instead use `TestResources` methods --- .../TestSceneMultiplayerMatchSongSelect.cs | 39 +------------------ .../TestSceneDeleteLocalScore.cs | 17 +------- 2 files changed, 3 insertions(+), 53 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs index 84c53ce22e..714951cc42 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs @@ -8,12 +8,10 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; -using osu.Framework.Extensions; using osu.Framework.Extensions.TypeExtensions; using osu.Framework.Platform; using osu.Framework.Screens; using osu.Framework.Testing; -using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Online.Rooms; @@ -28,6 +26,7 @@ using osu.Game.Rulesets.Taiko.Mods; using osu.Game.Screens.OnlinePlay; using osu.Game.Screens.OnlinePlay.Multiplayer; using osu.Game.Screens.Select; +using osu.Game.Tests.Resources; namespace osu.Game.Tests.Visual.Multiplayer { @@ -49,41 +48,7 @@ namespace osu.Game.Tests.Visual.Multiplayer Dependencies.Cache(manager = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default)); Dependencies.Cache(Realm); - var metadata = new BeatmapMetadata - { - Artist = "Some Artist", - Title = "Some Beatmap", - Author = { Username = "Some Author" }, - }; - - var beatmapSetInfo = new BeatmapSetInfo - { - OnlineID = 10, - Hash = Guid.NewGuid().ToString().ComputeMD5Hash(), - DateAdded = DateTimeOffset.UtcNow - }; - - for (int i = 0; i < 8; ++i) - { - int beatmapId = 10 * 10 + i; - - int length = RNG.Next(30000, 200000); - double bpm = RNG.NextSingle(80, 200); - - var beatmap = new BeatmapInfo - { - Ruleset = rulesets.GetRuleset(i % 4) ?? throw new InvalidOperationException(), - OnlineID = beatmapId, - Length = length, - BPM = bpm, - Metadata = metadata, - Difficulty = new BeatmapDifficulty() - }; - - beatmapSetInfo.Beatmaps.Add(beatmap); - } - - importedBeatmapSet = manager.Import(beatmapSetInfo); + importedBeatmapSet = manager.Import(TestResources.CreateTestBeatmapSetInfo(8, rulesets.AvailableRulesets.ToArray())); } public override void SetUpSteps() diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index 13404a9810..72dfc53c01 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; @@ -17,7 +16,6 @@ using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; -using osu.Game.Models; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Leaderboards; using osu.Game.Overlays; @@ -60,20 +58,7 @@ namespace osu.Game.Tests.Visual.UserInterface Anchor = Anchor.Centre, Size = new Vector2(550f, 450f), Scope = BeatmapLeaderboardScope.Local, - BeatmapInfo = new BeatmapInfo - { - ID = Guid.NewGuid(), - Metadata = new BeatmapMetadata - { - Title = "TestSong", - Artist = "TestArtist", - Author = new RealmUser - { - Username = "TestAuthor" - }, - }, - DifficultyName = "Insane" - }, + BeatmapInfo = TestResources.CreateTestBeatmapSetInfo().Beatmaps.First() } }, dialogOverlay = new DialogOverlay() From 2b8a5833ddd4794c89fbb452d6a7d2d52bb107be Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Apr 2022 15:13:02 +0900 Subject: [PATCH 0126/2328] Fix back-to-front conditional check --- .../OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs index 289b8730ce..848424bc76 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer loadingLayer.Hide(); // If an error or server side trigger occurred this screen may have already exited by external means. - if (!this.IsCurrentScreen()) + if (this.IsCurrentScreen()) this.Exit(); }), onError: _ => Schedule(() => { From c2b2d443ed070da9b8fafa5b871e235f40ca13f8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Apr 2022 15:31:12 +0900 Subject: [PATCH 0127/2328] Add more comprehensive assert output to try and discern CI issues --- .../Visual/Gameplay/TestSceneLeadIn.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs index 5a1fc1b1e5..58d2e4a1da 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs @@ -36,10 +36,10 @@ namespace osu.Game.Tests.Visual.Gameplay BeatmapInfo = { AudioLeadIn = leadIn } }); - AddAssert($"first frame is {expectedStartTime}", () => + AddStep($"check first frame time", () => { - Debug.Assert(player.FirstFrameClockTime != null); - return Precision.AlmostEquals(player.FirstFrameClockTime.Value, expectedStartTime, lenience_ms); + Assert.That(player.FirstFrameClockTime, Is.Not.Null); + Assert.That(player.FirstFrameClockTime.Value, Is.EqualTo(expectedStartTime).Within(lenience_ms)); }); } @@ -59,10 +59,10 @@ namespace osu.Game.Tests.Visual.Gameplay loadPlayerWithBeatmap(new TestBeatmap(new OsuRuleset().RulesetInfo), storyboard); - AddAssert($"first frame is {expectedStartTime}", () => + AddStep($"check first frame time", () => { - Debug.Assert(player.FirstFrameClockTime != null); - return Precision.AlmostEquals(player.FirstFrameClockTime.Value, expectedStartTime, lenience_ms); + Assert.That(player.FirstFrameClockTime, Is.Not.Null); + Assert.That(player.FirstFrameClockTime.Value, Is.EqualTo(expectedStartTime).Within(lenience_ms)); }); } @@ -97,10 +97,10 @@ namespace osu.Game.Tests.Visual.Gameplay loadPlayerWithBeatmap(new TestBeatmap(new OsuRuleset().RulesetInfo), storyboard); - AddAssert($"first frame is {expectedStartTime}", () => + AddStep($"check first frame time", () => { - Debug.Assert(player.FirstFrameClockTime != null); - return Precision.AlmostEquals(player.FirstFrameClockTime.Value, expectedStartTime, lenience_ms); + Assert.That(player.FirstFrameClockTime, Is.Not.Null); + Assert.That(player.FirstFrameClockTime.Value, Is.EqualTo(expectedStartTime).Within(lenience_ms)); }); } From 065bb60324c6f62393aee92799b4a6d916a9fa77 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Apr 2022 16:05:11 +0900 Subject: [PATCH 0128/2328] Remove unused using statements --- osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs index 58d2e4a1da..5ec9c6c474 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs @@ -1,12 +1,10 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Diagnostics; using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Timing; -using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Osu; From c42ef43faaeedd1ff18ccd6c1ceb16bd0e44a790 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Apr 2022 16:46:52 +0900 Subject: [PATCH 0129/2328] Ensure intro beatmap has protected flag set In cases this isn't set, the beatmap has likely entered a bad state. Closes https://github.com/ppy/osu/issues/17659. --- osu.Game/Screens/Menu/IntroScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs index a6b54dd1f2..e569b0e517 100644 --- a/osu.Game/Screens/Menu/IntroScreen.cs +++ b/osu.Game/Screens/Menu/IntroScreen.cs @@ -147,7 +147,7 @@ namespace osu.Game.Screens.Menu bool loadThemedIntro() { - var setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == BeatmapHash); + var setInfo = beatmaps.QueryBeatmapSet(b => b.Protected && b.Hash == BeatmapHash); if (setInfo == null) return false; From 43724f477a1cb7870a64d0878159ad4606678d87 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 6 Apr 2022 19:14:00 +0800 Subject: [PATCH 0130/2328] Remove outdated NU1701 warning. --- Directory.Build.props | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 5bdf12218c..3ab3dc3d13 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -26,14 +26,6 @@ true $(NoWarn);CS1591 - - - $(NoWarn);NU1701 - false ppy Pty Ltd From ec4f1bcbc8209dce61b5cc8ce6862a15aaa2d50c Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 6 Apr 2022 19:18:18 +0800 Subject: [PATCH 0131/2328] Remove outdated NETCore packages. --- osu.Desktop/osu.Desktop.csproj | 2 -- osu.Game/osu.Game.csproj | 1 - 2 files changed, 3 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index a06484214b..3ca6411812 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -25,7 +25,6 @@ - @@ -33,7 +32,6 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 7b0f8c72c5..db1a945765 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -29,7 +29,6 @@ - all From edb556643edf509ed77eb3da3e926658d08e45b6 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Tue, 5 Apr 2022 01:00:33 -0700 Subject: [PATCH 0132/2328] Add failing replay button enabled test asserts --- osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs index 8b7e1c4e58..5d25287e45 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs @@ -150,10 +150,12 @@ namespace osu.Game.Tests.Visual.Gameplay AddStep("import score", () => imported = scoreManager.Import(getScoreInfo(true))); AddUntilStep("state is available", () => downloadButton.State.Value == DownloadState.LocallyAvailable); + AddAssert("button is enabled", () => downloadButton.ChildrenOfType().First().Enabled.Value); AddStep("delete score", () => scoreManager.Delete(imported.Value)); AddUntilStep("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded); + AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType().First().Enabled.Value); } [Test] From 4432a93d096ed81f1a94d11914c48e19c1e346dd Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Tue, 5 Apr 2022 01:04:19 -0700 Subject: [PATCH 0133/2328] Fix replay button being disabled when available locally but not online --- osu.Game/Screens/Ranking/ReplayDownloadButton.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Ranking/ReplayDownloadButton.cs b/osu.Game/Screens/Ranking/ReplayDownloadButton.cs index 6a74fdaf75..222115daca 100644 --- a/osu.Game/Screens/Ranking/ReplayDownloadButton.cs +++ b/osu.Game/Screens/Ranking/ReplayDownloadButton.cs @@ -87,19 +87,20 @@ namespace osu.Game.Screens.Ranking }); } - button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable; - updateTooltip(); + updateState(); }, true); State.BindValueChanged(state => { button.State.Value = state.NewValue; - updateTooltip(); + updateState(); }, true); } - private void updateTooltip() + private void updateState() { + button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable; + switch (replayAvailability) { case ReplayAvailability.Local: From 8a73831115ab15eff3059e938786c235646862b6 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 7 Apr 2022 13:12:33 +0900 Subject: [PATCH 0134/2328] Add MP lobby 'warning' SFX for the final seconds of countdown --- .../Multiplayer/Match/MultiplayerReadyButton.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs index d275f309cb..22a0243f8f 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs @@ -30,13 +30,15 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match private MultiplayerRoom room => multiplayerClient.Room; private Sample countdownTickSample; + private Sample countdownWarnSample; + private Sample countdownWarnFinalSample; [BackgroundDependencyLoader] private void load(AudioManager audio) { countdownTickSample = audio.Samples.Get(@"Multiplayer/countdown-tick"); - // disabled for now pending further work on sound effect - // countdownTickFinalSample = audio.Samples.Get(@"Multiplayer/countdown-tick-final"); + countdownWarnSample = audio.Samples.Get(@"Multiplayer/countdown-warn"); + countdownWarnFinalSample = audio.Samples.Get(@"Multiplayer/countdown-warn-final"); } protected override void LoadComplete() @@ -102,8 +104,14 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match private void playTickSound(int secondsRemaining) { if (secondsRemaining < 10) countdownTickSample?.Play(); - // disabled for now pending further work on sound effect - // if (secondsRemaining <= 3) countdownTickFinalSample?.Play(); + + if (secondsRemaining <= 3) + { + if (secondsRemaining > 0) + countdownWarnSample?.Play(); + else + countdownWarnFinalSample?.Play(); + } } private void updateButtonText() From 358931842fc1936b8141cf58d6fe2c67ca6851ce Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Wed, 6 Apr 2022 21:22:56 -0700 Subject: [PATCH 0135/2328] Move enabled setting to each case --- osu.Game/Screens/Ranking/ReplayDownloadButton.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Ranking/ReplayDownloadButton.cs b/osu.Game/Screens/Ranking/ReplayDownloadButton.cs index 222115daca..0c9c909395 100644 --- a/osu.Game/Screens/Ranking/ReplayDownloadButton.cs +++ b/osu.Game/Screens/Ranking/ReplayDownloadButton.cs @@ -99,20 +99,21 @@ namespace osu.Game.Screens.Ranking private void updateState() { - button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable; - switch (replayAvailability) { case ReplayAvailability.Local: button.TooltipText = @"watch replay"; + button.Enabled.Value = true; break; case ReplayAvailability.Online: button.TooltipText = @"download replay"; + button.Enabled.Value = true; break; default: button.TooltipText = @"replay unavailable"; + button.Enabled.Value = false; break; } } From 9ed4f310488e9c53223893674d21dea7f2a9617f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Apr 2022 13:35:07 +0900 Subject: [PATCH 0136/2328] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index f1cbe1c9eb..10685d5990 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a009307cfe..7fd2647a8a 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 6e35fba86f..a5efc40d51 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -62,7 +62,7 @@ - + From b7f8716de9cd1f32c4ea9ad7f6b32b43b842167c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Apr 2022 14:10:08 +0900 Subject: [PATCH 0137/2328] Add test coverage of skin lookups failing when `@2x` and extension are present --- .../Skinning/LegacySkinTextureFallbackTest.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs b/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs index 7516e7500b..db7fc0b4a0 100644 --- a/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs +++ b/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs @@ -69,6 +69,20 @@ namespace osu.Game.Tests.NonVisual.Skinning "Gameplay/osu/followpoint", "followpoint", 1 }, + new object[] + { + // Looking up a filename with extension specified should work. + new[] { "followpoint.png" }, + "followpoint.png", + "followpoint.png", 1 + }, + new object[] + { + // Looking up a filename with extension specified should also work with @2x sprites. + new[] { "followpoint@2x.png" }, + "followpoint.png", + "followpoint@2x.png", 2 + }, }; [TestCaseSource(nameof(fallbackTestCases))] From 205edb65a2d800eb7bf54bdf3d1b8e56f4c81f19 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Apr 2022 14:16:16 +0900 Subject: [PATCH 0138/2328] Fix filename lookups on `LegacySkin`s going awry when extension is specified Due to the logic present to handle `@2x` fallback, the extension was potentially being added at the wrong point in the filename. This change ensures that the lookup filenames are always correct. Closes https://github.com/ppy/osu/issues/17690. --- osu.Game/Skinning/LegacySkin.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 92713023f4..a97b5d44ce 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -443,7 +443,11 @@ namespace osu.Game.Skinning string lookupName = name.Replace(@"@2x", string.Empty); float ratio = 2; - var texture = Textures?.Get(@$"{lookupName}@2x", wrapModeS, wrapModeT); + string twoTimesFilename = Path.HasExtension(lookupName) + ? @$"{Path.GetFileNameWithoutExtension(lookupName)}@2x{Path.GetExtension(lookupName)}" + : @$"{lookupName}@2x"; + + var texture = Textures?.Get(twoTimesFilename, wrapModeS, wrapModeT); if (texture == null) { From a7e262627fe34e05c91497366b67054beb962fd9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Apr 2022 15:13:39 +0900 Subject: [PATCH 0139/2328] Fix `DrawableStoryboardAnimation` not specifying sizing correctly Usually this would be handled by `TextureAnimation`, but because we are inheriting from `DrawableAnimation` here for reasons, we needed to implement this ourselves. Follows the implementation in `TextureAnimation`. --- .../Drawables/DrawableStoryboardAnimation.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs index 88cb5f40a1..2ef6f28720 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs @@ -5,8 +5,10 @@ using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Animations; +using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Utils; +using osu.Game.Skinning; using osuTK; namespace osu.Game.Storyboards.Drawables @@ -88,6 +90,14 @@ namespace osu.Game.Storyboards.Drawables LifetimeEnd = animation.EndTime; } + protected override Vector2 GetCurrentDisplaySize() + { + Texture texture = (CurrentFrame as Sprite)?.Texture + ?? ((CurrentFrame as SkinnableSprite)?.Drawable as Sprite)?.Texture; + + return new Vector2(texture?.DisplayWidth ?? 0, texture?.DisplayHeight ?? 0); + } + [BackgroundDependencyLoader] private void load(TextureStore textureStore, Storyboard storyboard) { From 93bdca5211c52c37c5e0fc358693affe9366ad5b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Apr 2022 17:26:23 +0900 Subject: [PATCH 0140/2328] Split out `GetTextures` helper function for `LegacySkin`s --- osu.Game/Skinning/LegacySkinExtensions.cs | 86 ++++++++++++++--------- 1 file changed, 54 insertions(+), 32 deletions(-) diff --git a/osu.Game/Skinning/LegacySkinExtensions.cs b/osu.Game/Skinning/LegacySkinExtensions.cs index 479afabb00..514a06a4ee 100644 --- a/osu.Game/Skinning/LegacySkinExtensions.cs +++ b/osu.Game/Skinning/LegacySkinExtensions.cs @@ -1,10 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -18,39 +20,32 @@ namespace osu.Game.Skinning { public static class LegacySkinExtensions { - [CanBeNull] - public static Drawable GetAnimation(this ISkin source, string componentName, bool animatable, bool looping, bool applyConfigFrameRate = false, string animationSeparator = "-", - bool startAtCurrentTime = true, double? frameLength = null) + public static Drawable? GetAnimation(this ISkin? source, string componentName, bool animatable, bool looping, bool applyConfigFrameRate = false, string animationSeparator = "-", + bool startAtCurrentTime = true, double? frameLength = null) => source.GetAnimation(componentName, default, default, animatable, looping, applyConfigFrameRate, animationSeparator, startAtCurrentTime, frameLength); - [CanBeNull] - public static Drawable GetAnimation(this ISkin source, string componentName, WrapMode wrapModeS, WrapMode wrapModeT, bool animatable, bool looping, bool applyConfigFrameRate = false, - string animationSeparator = "-", - bool startAtCurrentTime = true, double? frameLength = null) + public static Drawable? GetAnimation(this ISkin? source, string componentName, WrapMode wrapModeS, WrapMode wrapModeT, bool animatable, bool looping, bool applyConfigFrameRate = false, + string animationSeparator = "-", bool startAtCurrentTime = true, double? frameLength = null) { - Texture texture; - - // find the first source which provides either the animated or non-animated version. - ISkin skin = (source as ISkinSource)?.FindProvider(s => - { - if (animatable && s.GetTexture(getFrameName(0)) != null) - return true; - - return s.GetTexture(componentName, wrapModeS, wrapModeT) != null; - }) ?? source; - - if (skin == null) + if (source == null) return null; - if (animatable) - { - var textures = getTextures().ToArray(); + var textures = GetTextures(source, componentName, wrapModeS, wrapModeT, animatable, animationSeparator, out var retrievalSource); + + switch (textures.Length) + { + case 0: + return null; + + case 1: + return new Sprite { Texture = textures[0] }; + + default: + Debug.Assert(retrievalSource != null); - if (textures.Length > 0) - { var animation = new SkinnableTextureAnimation(startAtCurrentTime) { - DefaultFrameLength = frameLength ?? getFrameLength(skin, applyConfigFrameRate, textures), + DefaultFrameLength = frameLength ?? getFrameLength(retrievalSource, applyConfigFrameRate, textures), Loop = looping, }; @@ -58,19 +53,46 @@ namespace osu.Game.Skinning animation.AddFrame(t); return animation; - } + } + } + + public static Texture[] GetTextures(this ISkin? source, string componentName, WrapMode wrapModeS, WrapMode wrapModeT, bool animatable, string animationSeparator, out ISkin? retrievalSource) + { + retrievalSource = null; + + if (source == null) + return Array.Empty(); + + // find the first source which provides either the animated or non-animated version. + retrievalSource = (source as ISkinSource)?.FindProvider(s => + { + if (animatable && s.GetTexture(getFrameName(0)) != null) + return true; + + return s.GetTexture(componentName, wrapModeS, wrapModeT) != null; + }) ?? source; + + if (animatable) + { + var textures = getTextures(retrievalSource).ToArray(); + + if (textures.Length > 0) + return textures; } // if an animation was not allowed or not found, fall back to a sprite retrieval. - if ((texture = skin.GetTexture(componentName, wrapModeS, wrapModeT)) != null) - return new Sprite { Texture = texture }; + var singleTexture = retrievalSource.GetTexture(componentName, wrapModeS, wrapModeT); - return null; + return singleTexture != null + ? new[] { singleTexture } + : Array.Empty(); - IEnumerable getTextures() + IEnumerable getTextures(ISkin skin) { for (int i = 0; true; i++) { + Texture? texture; + if ((texture = skin.GetTexture(getFrameName(i), wrapModeS, wrapModeT)) == null) break; @@ -130,7 +152,7 @@ namespace osu.Game.Skinning public class SkinnableTextureAnimation : TextureAnimation { [Resolved(canBeNull: true)] - private IAnimationTimeReference timeReference { get; set; } + private IAnimationTimeReference? timeReference { get; set; } private readonly Bindable animationStartTime = new BindableDouble(); From cbc4e5319d1fa8d7b0f77ca9a5549cc56acaedad Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Apr 2022 17:26:31 +0900 Subject: [PATCH 0141/2328] Fix `DrawableStoryboardAnimation` to handle skin fallback frame count similar to stable Reasoning is explained in the inline comment (basically, stable doesn't care what the user specifies as the frame count when falling back to skin resources). This change also removes on to two layers of drawables, which should be a win in heavy storyboards. --- .../Drawables/DrawableStoryboardAnimation.cs | 47 +++++++++++++++++-- .../Drawables/DrawableStoryboardSprite.cs | 27 ++++++++--- osu.Game/Storyboards/Storyboard.cs | 20 ++------ 3 files changed, 66 insertions(+), 28 deletions(-) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs index 2ef6f28720..28e65a7910 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.IO; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Animations; @@ -98,17 +99,55 @@ namespace osu.Game.Storyboards.Drawables return new Vector2(texture?.DisplayWidth ?? 0, texture?.DisplayHeight ?? 0); } + [Resolved] + private ISkinSource skin { get; set; } + [BackgroundDependencyLoader] private void load(TextureStore textureStore, Storyboard storyboard) { - for (int frameIndex = 0; frameIndex < Animation.FrameCount; frameIndex++) + int frameIndex = 0; + + Texture frameTexture = storyboard.GetTextureFromPath(getFramePath(frameIndex), textureStore); + + if (frameTexture != null) { - string framePath = Animation.Path.Replace(".", frameIndex + "."); - Drawable frame = storyboard.CreateSpriteFromResourcePath(framePath, textureStore) ?? Empty(); - AddFrame(frame, Animation.FrameDelay); + // sourcing from storyboard. + for (frameIndex = 0; frameIndex < Animation.FrameCount; frameIndex++) + { + frameTexture = storyboard.GetTextureFromPath(getFramePath(frameIndex), textureStore); + AddFrame(new Sprite { Texture = frameTexture }, Animation.FrameDelay); + } + } + else if (storyboard.UseSkinSprites) + { + // fallback to skin if required. + skin.SourceChanged += skinSourceChanged; + skinSourceChanged(); } Animation.ApplyTransforms(this); } + + private void skinSourceChanged() + { + ClearFrames(); + + // ClearFrames doesn't clear the last displayed frame. + // Clear manually for now, in case the skin doesn't provide any frames. + DisplayFrame(Empty()); + + // When reading from a skin, we match stables weird behaviour where `FrameCount` is ignored + // and resources are retrieved until the end of the animation. + foreach (var texture in skin.GetTextures(Path.GetFileNameWithoutExtension(Animation.Path), default, default, true, string.Empty, out _)) + AddFrame(new Sprite { Texture = texture }, Animation.FrameDelay); + } + + private string getFramePath(int i) => Animation.Path.Replace(".", $"{i}."); + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + skin.SourceChanged -= skinSourceChanged; + } } } diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs index db10f13896..6622cfb6be 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs @@ -4,14 +4,15 @@ using System; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Utils; +using osu.Game.Skinning; using osuTK; namespace osu.Game.Storyboards.Drawables { - public class DrawableStoryboardSprite : CompositeDrawable, IFlippable, IVectorScalable + public class DrawableStoryboardSprite : Sprite, IFlippable, IVectorScalable { public StoryboardSprite Sprite { get; } @@ -85,19 +86,31 @@ namespace osu.Game.Storyboards.Drawables LifetimeStart = sprite.StartTime; LifetimeEnd = sprite.EndTime; - - AutoSizeAxes = Axes.Both; } + [Resolved] + private ISkinSource skin { get; set; } + [BackgroundDependencyLoader] private void load(TextureStore textureStore, Storyboard storyboard) { - var drawable = storyboard.CreateSpriteFromResourcePath(Sprite.Path, textureStore); + Texture = storyboard.GetTextureFromPath(Sprite.Path, textureStore); - if (drawable != null) - InternalChild = drawable; + if (Texture == null && storyboard.UseSkinSprites) + { + skin.SourceChanged += skinSourceChanged; + skinSourceChanged(); + } Sprite.ApplyTransforms(this); } + + private void skinSourceChanged() => Texture = skin.GetTexture(Sprite.Path); + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + skin.SourceChanged -= skinSourceChanged; + } } } diff --git a/osu.Game/Storyboards/Storyboard.cs b/osu.Game/Storyboards/Storyboard.cs index b662b98e4e..1d21b5dce2 100644 --- a/osu.Game/Storyboards/Storyboard.cs +++ b/osu.Game/Storyboards/Storyboard.cs @@ -4,13 +4,10 @@ using System; using System.Collections.Generic; using System.Linq; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps; using osu.Game.Extensions; using osu.Game.Rulesets.Mods; -using osu.Game.Skinning; using osu.Game.Storyboards.Drawables; namespace osu.Game.Storyboards @@ -94,25 +91,14 @@ namespace osu.Game.Storyboards public DrawableStoryboard CreateDrawable(IReadOnlyList mods = null) => new DrawableStoryboard(this, mods); - public Drawable CreateSpriteFromResourcePath(string path, TextureStore textureStore) + public Texture GetTextureFromPath(string path, TextureStore textureStore) { - Drawable drawable = null; - string storyboardPath = BeatmapInfo.BeatmapSet?.Files.FirstOrDefault(f => f.Filename.Equals(path, StringComparison.OrdinalIgnoreCase))?.File.GetStoragePath(); if (!string.IsNullOrEmpty(storyboardPath)) - drawable = new Sprite { Texture = textureStore.Get(storyboardPath) }; - // if the texture isn't available locally in the beatmap, some storyboards choose to source from the underlying skin lookup hierarchy. - else if (UseSkinSprites) - { - drawable = new SkinnableSprite(path) - { - RelativeSizeAxes = Axes.None, - AutoSizeAxes = Axes.Both, - }; - } + return textureStore.Get(storyboardPath); - return drawable; + return null; } } } From 040afff670d37335aaa5b8f5aab4ec21af087517 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Apr 2022 17:34:50 +0900 Subject: [PATCH 0142/2328] Change `DrawableStoryboardAnimation` to derive from `TextureAnimation` --- .../Drawables/DrawableStoryboardAnimation.cs | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs index 28e65a7910..5ebca4d860 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs @@ -6,7 +6,6 @@ using System.IO; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Animations; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Utils; using osu.Game.Skinning; @@ -14,7 +13,7 @@ using osuTK; namespace osu.Game.Storyboards.Drawables { - public class DrawableStoryboardAnimation : DrawableAnimation, IFlippable, IVectorScalable + public class DrawableStoryboardAnimation : TextureAnimation, IFlippable, IVectorScalable { public StoryboardAnimation Animation { get; } @@ -91,14 +90,6 @@ namespace osu.Game.Storyboards.Drawables LifetimeEnd = animation.EndTime; } - protected override Vector2 GetCurrentDisplaySize() - { - Texture texture = (CurrentFrame as Sprite)?.Texture - ?? ((CurrentFrame as SkinnableSprite)?.Drawable as Sprite)?.Texture; - - return new Vector2(texture?.DisplayWidth ?? 0, texture?.DisplayHeight ?? 0); - } - [Resolved] private ISkinSource skin { get; set; } @@ -114,8 +105,7 @@ namespace osu.Game.Storyboards.Drawables // sourcing from storyboard. for (frameIndex = 0; frameIndex < Animation.FrameCount; frameIndex++) { - frameTexture = storyboard.GetTextureFromPath(getFramePath(frameIndex), textureStore); - AddFrame(new Sprite { Texture = frameTexture }, Animation.FrameDelay); + AddFrame(storyboard.GetTextureFromPath(getFramePath(frameIndex), textureStore), Animation.FrameDelay); } } else if (storyboard.UseSkinSprites) @@ -132,14 +122,10 @@ namespace osu.Game.Storyboards.Drawables { ClearFrames(); - // ClearFrames doesn't clear the last displayed frame. - // Clear manually for now, in case the skin doesn't provide any frames. - DisplayFrame(Empty()); - // When reading from a skin, we match stables weird behaviour where `FrameCount` is ignored // and resources are retrieved until the end of the animation. foreach (var texture in skin.GetTextures(Path.GetFileNameWithoutExtension(Animation.Path), default, default, true, string.Empty, out _)) - AddFrame(new Sprite { Texture = texture }, Animation.FrameDelay); + AddFrame(texture, Animation.FrameDelay); } private string getFramePath(int i) => Animation.Path.Replace(".", $"{i}."); From 0674862b6c69ab7df325fa9d7506deee79b36aae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Apr 2022 17:51:10 +0900 Subject: [PATCH 0143/2328] Fix failing tests --- .../Gameplay/TestSceneDrawableStoryboardSprite.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableStoryboardSprite.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableStoryboardSprite.cs index 34e6d1996d..cfe9e35298 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableStoryboardSprite.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableStoryboardSprite.cs @@ -7,6 +7,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Rulesets; @@ -36,7 +37,8 @@ namespace osu.Game.Tests.Visual.Gameplay AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero))); - assertSpritesFromSkin(false); + AddAssert("sprite didn't find texture", () => + sprites.All(sprite => sprite.ChildrenOfType().All(s => s.Texture == null))); } [Test] @@ -48,9 +50,12 @@ namespace osu.Game.Tests.Visual.Gameplay AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero))); - assertSpritesFromSkin(true); + // Only checking for at least one sprite that succeeded, as not all skins in this test provide the hitcircleoverlay texture. + AddAssert("sprite found texture", () => + sprites.Any(sprite => sprite.ChildrenOfType().All(s => s.Texture != null))); - AddAssert("skinnable sprite has correct size", () => sprites.Any(s => Precision.AlmostEquals(s.ChildrenOfType().Single().Size, new Vector2(128, 128)))); + AddAssert("skinnable sprite has correct size", () => + sprites.Any(sprite => sprite.ChildrenOfType().All(s => s.Size == new Vector2(128)))); } [Test] @@ -104,9 +109,5 @@ namespace osu.Game.Tests.Visual.Gameplay s.LifetimeStart = double.MinValue; s.LifetimeEnd = double.MaxValue; }); - - private void assertSpritesFromSkin(bool fromSkin) => - AddAssert($"sprites are {(fromSkin ? "from skin" : "from storyboard")}", - () => sprites.All(sprite => sprite.ChildrenOfType().Any() == fromSkin)); } } From 37509e04a934ec1e51c080866316589d69a70003 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Apr 2022 18:11:30 +0900 Subject: [PATCH 0144/2328] Rename variable and fix inspections --- osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs | 14 +++++++------- osu.Game/Overlays/Toolbar/ToolbarClock.cs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs b/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs index 66f40532d0..4392c5811a 100644 --- a/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs +++ b/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs @@ -29,17 +29,17 @@ namespace osu.Game.Overlays.Toolbar } } - private bool format12H = false; + private bool use24HourDisplay; - public bool Format12H + public bool Use24HourDisplay { - get => format12H; + get => use24HourDisplay; set { - if (format12H == value) + if (use24HourDisplay == value) return; - format12H = value; + use24HourDisplay = value; updateMetrics(); UpdateDisplay(DateTimeOffset.Now); //Update realTime.Text immediately instead of waiting until next second } @@ -66,13 +66,13 @@ namespace osu.Game.Overlays.Toolbar protected override void UpdateDisplay(DateTimeOffset now) { - realTime.Text = format12H ? $"{now:h:mm:ss tt}" : $"{now:HH:mm:ss}"; + realTime.Text = use24HourDisplay ? $"{now:h:mm:ss tt}" : $"{now:HH:mm:ss}"; gameTime.Text = $"running {new TimeSpan(TimeSpan.TicksPerSecond * (int)(Clock.CurrentTime / 1000)):c}"; } private void updateMetrics() { - if (format12H) + if (use24HourDisplay) Width = 70; else Width = showRuntime ? 66 : 45; // Allows for space for game time up to 99 days (in the padding area since this is quite rare). diff --git a/osu.Game/Overlays/Toolbar/ToolbarClock.cs b/osu.Game/Overlays/Toolbar/ToolbarClock.cs index b256d6fbc4..264e4bffde 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarClock.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarClock.cs @@ -99,7 +99,7 @@ namespace osu.Game.Overlays.Toolbar }, true); digitalPrefer24Hour.BindValueChanged(prefer24H => - digital.Format12H = prefer24H.NewValue ? false : CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("tt"), true); + digital.Use24HourDisplay = !prefer24H.NewValue && CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("tt"), true); } protected override bool OnClick(ClickEvent e) From 7530fe5adf4ea66d7f5cc02034aefef8eed0c969 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Apr 2022 18:13:23 +0900 Subject: [PATCH 0145/2328] Move default specification to configuration initial value --- osu.Game/Configuration/OsuConfigManager.cs | 4 +++- osu.Game/Overlays/Toolbar/ToolbarClock.cs | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 99372c92d9..9aacb50684 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -3,6 +3,7 @@ using System; using System.Diagnostics; +using System.Globalization; using osu.Framework.Configuration; using osu.Framework.Configuration.Tracking; using osu.Framework.Extensions; @@ -102,7 +103,8 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.MenuParallax, true); - SetDefault(OsuSetting.Prefer24HourTime, false); + // See https://stackoverflow.com/a/63307411 for default sourcing. + SetDefault(OsuSetting.Prefer24HourTime, CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains(@"tt")); // Gameplay SetDefault(OsuSetting.PositionalHitsounds, true); // replaced by level setting below, can be removed 20220703. diff --git a/osu.Game/Overlays/Toolbar/ToolbarClock.cs b/osu.Game/Overlays/Toolbar/ToolbarClock.cs index 264e4bffde..d726a95f46 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarClock.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarClock.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; @@ -21,7 +20,7 @@ namespace osu.Game.Overlays.Toolbar public class ToolbarClock : OsuClickableContainer { private Bindable clockDisplayMode; - private Bindable digitalPrefer24Hour; + private Bindable prefer24HourTime; private Box hoverBackground; private Box flashBackground; @@ -40,7 +39,7 @@ namespace osu.Game.Overlays.Toolbar private void load(OsuConfigManager config) { clockDisplayMode = config.GetBindable(OsuSetting.ToolbarClockDisplayMode); - digitalPrefer24Hour = config.GetBindable(OsuSetting.Prefer24HourTime); + prefer24HourTime = config.GetBindable(OsuSetting.Prefer24HourTime); Children = new Drawable[] { @@ -98,8 +97,7 @@ namespace osu.Game.Overlays.Toolbar analog.FadeTo(showAnalog ? 1 : 0); }, true); - digitalPrefer24Hour.BindValueChanged(prefer24H => - digital.Use24HourDisplay = !prefer24H.NewValue && CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("tt"), true); + prefer24HourTime.BindValueChanged(prefer24H => digital.Use24HourDisplay = !prefer24H.NewValue, true); } protected override bool OnClick(ClickEvent e) From 555aee7b6a98056587d1077a71faff2c44f0b0a5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Apr 2022 18:16:14 +0900 Subject: [PATCH 0146/2328] Remove incorrect and pointless complexity to width changes --- osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs b/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs index 4392c5811a..68b36c2a04 100644 --- a/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs +++ b/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs @@ -72,10 +72,7 @@ namespace osu.Game.Overlays.Toolbar private void updateMetrics() { - if (use24HourDisplay) - Width = 70; - else - Width = showRuntime ? 66 : 45; // Allows for space for game time up to 99 days (in the padding area since this is quite rare). + Width = showRuntime || use24HourDisplay ? 66 : 45; // Allows for space for game time up to 99 days (in the padding area since this is quite rare). gameTime.FadeTo(showRuntime ? 1 : 0); } From b2c0eaeab4abf7f05cdec587acda9b1c19a29bbc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Apr 2022 18:20:15 +0900 Subject: [PATCH 0147/2328] Make string read better --- osu.Game/Localisation/GeneralSettingsStrings.cs | 4 ++-- .../Overlays/Settings/Sections/General/LanguageSettings.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Localisation/GeneralSettingsStrings.cs b/osu.Game/Localisation/GeneralSettingsStrings.cs index cca8c8efd1..c65e6c77f4 100644 --- a/osu.Game/Localisation/GeneralSettingsStrings.cs +++ b/osu.Game/Localisation/GeneralSettingsStrings.cs @@ -30,9 +30,9 @@ namespace osu.Game.Localisation public static LocalisableString PreferOriginalMetadataLanguage => new TranslatableString(getKey(@"prefer_original"), @"Prefer metadata in original language"); /// - /// "Prefer 24-hour time" + /// "Prefer 24-hour time display" /// - public static LocalisableString Prefer24HourTime => new TranslatableString(getKey(@"prefer_24_hour_time"), @"Prefer 24-hour time"); + public static LocalisableString Prefer24HourTimeDisplay => new TranslatableString(getKey(@"prefer_24_hour_time_display"), @"Prefer 24-hour time display"); /// /// "Updates" diff --git a/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs index e7cc1bce10..cdce187a35 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs @@ -37,7 +37,7 @@ namespace osu.Game.Overlays.Settings.Sections.General }, new SettingsCheckbox { - LabelText = GeneralSettingsStrings.Prefer24HourTime, + LabelText = GeneralSettingsStrings.Prefer24HourTimeDisplay, Current = config.GetBindable(OsuSetting.Prefer24HourTime) }, }; From a4d3afd06d63059ca2b2cff0b4fb2577dd74818e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Apr 2022 19:12:10 +0900 Subject: [PATCH 0148/2328] Fix multiple issues with bindable safety in `SkinEditor` components --- .../Skinning/Editor/SkinBlueprintContainer.cs | 23 ++++++++++++------- osu.Game/Skinning/Editor/SkinEditor.cs | 3 +++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/osu.Game/Skinning/Editor/SkinBlueprintContainer.cs b/osu.Game/Skinning/Editor/SkinBlueprintContainer.cs index d67bfb89ab..ebf3c9c319 100644 --- a/osu.Game/Skinning/Editor/SkinBlueprintContainer.cs +++ b/osu.Game/Skinning/Editor/SkinBlueprintContainer.cs @@ -21,21 +21,20 @@ namespace osu.Game.Skinning.Editor private readonly List> targetComponents = new List>(); + [Resolved] + private SkinEditor editor { get; set; } + public SkinBlueprintContainer(Drawable target) { this.target = target; } - [BackgroundDependencyLoader(true)] - private void load(SkinEditor editor) - { - SelectedItems.BindTo(editor.SelectedComponents); - } - protected override void LoadComplete() { base.LoadComplete(); + SelectedItems.BindTo(editor.SelectedComponents); + // track each target container on the current screen. var targetContainers = target.ChildrenOfType().ToArray(); @@ -56,7 +55,7 @@ namespace osu.Game.Skinning.Editor } } - private void componentsChanged(object sender, NotifyCollectionChangedEventArgs e) + private void componentsChanged(object sender, NotifyCollectionChangedEventArgs e) => Schedule(() => { switch (e.Action) { @@ -79,7 +78,7 @@ namespace osu.Game.Skinning.Editor AddBlueprintFor(item); break; } - } + }); protected override void AddBlueprintFor(ISkinnableDrawable item) { @@ -93,5 +92,13 @@ namespace osu.Game.Skinning.Editor protected override SelectionBlueprint CreateBlueprintFor(ISkinnableDrawable component) => new SkinBlueprint(component); + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + foreach (var list in targetComponents) + list.UnbindAll(); + } } } diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index bcff70c008..4602366413 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -203,6 +203,9 @@ namespace osu.Game.Skinning.Editor SelectedComponents.Clear(); + // Immediately clear the previous blueprint container to ensure it doesn't try to interact with the old target. + content.Clear(); + Scheduler.AddOnce(loadBlueprintContainer); Scheduler.AddOnce(populateSettings); From 5b29ddd2ed91fae0d1fbe840d4575bce6d18be7d Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 7 Apr 2022 15:05:08 +0300 Subject: [PATCH 0149/2328] Add further test coverage against paths with extensions --- .../Skinning/LegacySkinTextureFallbackTest.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs b/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs index db7fc0b4a0..76c49edf78 100644 --- a/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs +++ b/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs @@ -83,6 +83,20 @@ namespace osu.Game.Tests.NonVisual.Skinning "followpoint.png", "followpoint@2x.png", 2 }, + new object[] + { + // Looking up a path with extension specified should work. + new[] { "Gameplay/osu/followpoint.png" }, + "Gameplay/osu/followpoint.png", + "Gameplay/osu/followpoint.png", 1 + }, + new object[] + { + // Looking up a path with extension specified should also work with @2x sprites. + new[] { "Gameplay/osu/followpoint@2x.png" }, + "Gameplay/osu/followpoint.png", + "Gameplay/osu/followpoint@2x.png", 2 + }, }; [TestCaseSource(nameof(fallbackTestCases))] From fb9fe4213df4b89ddfec65c71765322aeb38742e Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 7 Apr 2022 15:07:14 +0300 Subject: [PATCH 0150/2328] Fix skin texture lookups not handling paths with extensions --- osu.Game/Skinning/LegacySkin.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index a97b5d44ce..f7d5581621 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -443,9 +443,7 @@ namespace osu.Game.Skinning string lookupName = name.Replace(@"@2x", string.Empty); float ratio = 2; - string twoTimesFilename = Path.HasExtension(lookupName) - ? @$"{Path.GetFileNameWithoutExtension(lookupName)}@2x{Path.GetExtension(lookupName)}" - : @$"{lookupName}@2x"; + string twoTimesFilename = $"{Path.ChangeExtension(lookupName, null)}@2x{Path.GetExtension(lookupName)}"; var texture = Textures?.Get(twoTimesFilename, wrapModeS, wrapModeT); From c323020fcf362ee4f570fc0f495127a555cd3d5e Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 7 Apr 2022 15:56:12 +0300 Subject: [PATCH 0151/2328] Fix `Use24HourDisplay` conditional flipped --- osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs | 3 ++- osu.Game/Overlays/Toolbar/ToolbarClock.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs b/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs index 68b36c2a04..10de35ee50 100644 --- a/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs +++ b/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs @@ -40,6 +40,7 @@ namespace osu.Game.Overlays.Toolbar return; use24HourDisplay = value; + updateMetrics(); UpdateDisplay(DateTimeOffset.Now); //Update realTime.Text immediately instead of waiting until next second } @@ -66,7 +67,7 @@ namespace osu.Game.Overlays.Toolbar protected override void UpdateDisplay(DateTimeOffset now) { - realTime.Text = use24HourDisplay ? $"{now:h:mm:ss tt}" : $"{now:HH:mm:ss}"; + realTime.Text = use24HourDisplay ? $"{now:HH:mm:ss}" : $"{now:h:mm:ss tt}"; gameTime.Text = $"running {new TimeSpan(TimeSpan.TicksPerSecond * (int)(Clock.CurrentTime / 1000)):c}"; } diff --git a/osu.Game/Overlays/Toolbar/ToolbarClock.cs b/osu.Game/Overlays/Toolbar/ToolbarClock.cs index d726a95f46..308359570f 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarClock.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarClock.cs @@ -97,7 +97,7 @@ namespace osu.Game.Overlays.Toolbar analog.FadeTo(showAnalog ? 1 : 0); }, true); - prefer24HourTime.BindValueChanged(prefer24H => digital.Use24HourDisplay = !prefer24H.NewValue, true); + prefer24HourTime.BindValueChanged(prefer24H => digital.Use24HourDisplay = prefer24H.NewValue, true); } protected override bool OnClick(ClickEvent e) From 0e9248624076d27261c872a3a763ad6051251dfc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Apr 2022 22:05:04 +0900 Subject: [PATCH 0152/2328] Update various licence years to 2022 --- Directory.Build.props | 2 +- LICENCE | 2 +- Templates/osu.Game.Templates.csproj | 2 +- osu.Desktop/osu.nuspec | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 3ab3dc3d13..709545bf1d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -34,7 +34,7 @@ https://github.com/ppy/osu Automated release. ppy Pty Ltd - Copyright (c) 2021 ppy Pty Ltd + Copyright (c) 2022 ppy Pty Ltd osu game diff --git a/LICENCE b/LICENCE index b5962ad3b2..d3e7537cef 100644 --- a/LICENCE +++ b/LICENCE @@ -1,4 +1,4 @@ -Copyright (c) 2021 ppy Pty Ltd . +Copyright (c) 2022 ppy Pty Ltd . Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Templates/osu.Game.Templates.csproj b/Templates/osu.Game.Templates.csproj index 4624d3d771..b8c3ad373a 100644 --- a/Templates/osu.Game.Templates.csproj +++ b/Templates/osu.Game.Templates.csproj @@ -8,7 +8,7 @@ https://github.com/ppy/osu/blob/master/Templates https://github.com/ppy/osu Automated release. - Copyright (c) 2021 ppy Pty Ltd + Copyright (c) 2022 ppy Pty Ltd Templates to use when creating a ruleset for consumption in osu!. dotnet-new;templates;osu netstandard2.1 diff --git a/osu.Desktop/osu.nuspec b/osu.Desktop/osu.nuspec index 1757fd7c73..dc1ec17e2c 100644 --- a/osu.Desktop/osu.nuspec +++ b/osu.Desktop/osu.nuspec @@ -11,7 +11,7 @@ false A free-to-win rhythm game. Rhythm is just a *click* away! testing - Copyright (c) 2021 ppy Pty Ltd + Copyright (c) 2022 ppy Pty Ltd en-AU From 11b4c5ca875b8a4f2a61ba8184f5f1b2865809be Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Apr 2022 23:42:42 +0900 Subject: [PATCH 0153/2328] Fix potential null ref if `UpdateTargetScreen` is called too early --- osu.Game/Skinning/Editor/SkinEditor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index 4602366413..e36d5ca3c6 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -204,7 +204,7 @@ namespace osu.Game.Skinning.Editor SelectedComponents.Clear(); // Immediately clear the previous blueprint container to ensure it doesn't try to interact with the old target. - content.Clear(); + content?.Clear(); Scheduler.AddOnce(loadBlueprintContainer); Scheduler.AddOnce(populateSettings); From a616f5bc2a4eb90824ed0d7ae62fcd4a972c7720 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 7 Apr 2022 19:24:15 +0300 Subject: [PATCH 0154/2328] Fix regressed digital clock width conditional --- osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs b/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs index 10de35ee50..ac6f563336 100644 --- a/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs +++ b/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs @@ -73,7 +73,7 @@ namespace osu.Game.Overlays.Toolbar private void updateMetrics() { - Width = showRuntime || use24HourDisplay ? 66 : 45; // Allows for space for game time up to 99 days (in the padding area since this is quite rare). + Width = showRuntime || !use24HourDisplay ? 66 : 45; // Allows for space for game time up to 99 days (in the padding area since this is quite rare). gameTime.FadeTo(showRuntime ? 1 : 0); } From 04db80848bade5ee16f46621339cf4c5622bbd99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 7 Apr 2022 21:24:50 +0200 Subject: [PATCH 0155/2328] Remove unused using directives --- .../Visual/Gameplay/TestSceneDrawableStoryboardSprite.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableStoryboardSprite.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableStoryboardSprite.cs index cfe9e35298..b2f4fa2738 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableStoryboardSprite.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableStoryboardSprite.cs @@ -9,10 +9,8 @@ using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Testing; -using osu.Framework.Utils; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; -using osu.Game.Skinning; using osu.Game.Storyboards; using osu.Game.Storyboards.Drawables; using osuTK; From 71c0216c559449c8286a816d0d592ebaad41fdfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 7 Apr 2022 21:37:42 +0200 Subject: [PATCH 0156/2328] Add null check guards to unsubscriptions in `Dispose()` --- osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs | 4 +++- osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs index 5ebca4d860..8a14b8b183 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs @@ -133,7 +133,9 @@ namespace osu.Game.Storyboards.Drawables protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - skin.SourceChanged -= skinSourceChanged; + + if (skin != null) + skin.SourceChanged -= skinSourceChanged; } } } diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs index 6622cfb6be..a6f2b8fcbd 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs @@ -110,7 +110,9 @@ namespace osu.Game.Storyboards.Drawables protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - skin.SourceChanged -= skinSourceChanged; + + if (skin != null) + skin.SourceChanged -= skinSourceChanged; } } } From 112096768b2107645ec0cafcad8bd9a8893c18ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 7 Apr 2022 22:38:00 +0200 Subject: [PATCH 0157/2328] Add test checking incompatibility of multi mods --- .../Mods/MultiModIncompatibilityTest.cs | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 osu.Game.Tests/Mods/MultiModIncompatibilityTest.cs diff --git a/osu.Game.Tests/Mods/MultiModIncompatibilityTest.cs b/osu.Game.Tests/Mods/MultiModIncompatibilityTest.cs new file mode 100644 index 0000000000..312b939315 --- /dev/null +++ b/osu.Game.Tests/Mods/MultiModIncompatibilityTest.cs @@ -0,0 +1,65 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Catch; +using osu.Game.Rulesets.Mania; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu; +using osu.Game.Rulesets.Taiko; +using osu.Game.Utils; + +namespace osu.Game.Tests.Mods +{ + [TestFixture] + public class MultiModIncompatibilityTest + { + /// + /// Ensures that all mods grouped into s, as declared by the default rulesets, are pairwise incompatible with each other. + /// + [TestCase(typeof(OsuRuleset))] + [TestCase(typeof(TaikoRuleset))] + [TestCase(typeof(CatchRuleset))] + [TestCase(typeof(ManiaRuleset))] + public void TestAllMultiModsFromRulesetAreIncompatible(Type rulesetType) + { + var ruleset = (Ruleset)Activator.CreateInstance(rulesetType); + Assert.That(ruleset, Is.Not.Null); + + var allMultiMods = getMultiMods(ruleset); + + Assert.Multiple(() => + { + foreach (var multiMod in allMultiMods) + { + int modCount = multiMod.Mods.Length; + + for (int i = 0; i < modCount; ++i) + { + // indexing from i + 1 ensures that only pairs of different mods are checked, and are checked only once + // (indexing from 0 would check each pair twice, and also check each mod against itself). + for (int j = i + 1; j < modCount; ++j) + { + var firstMod = multiMod.Mods[i]; + var secondMod = multiMod.Mods[j]; + + Assert.That( + ModUtils.CheckCompatibleSet(new[] { firstMod, secondMod }), Is.False, + $"{firstMod.Name} ({firstMod.Acronym}) and {secondMod.Name} ({secondMod.Acronym}) should be incompatible."); + } + } + } + }); + } + + /// + /// This local helper is used rather than , because the aforementioned method flattens multi mods. + /// > + private static IEnumerable getMultiMods(Ruleset ruleset) + => Enum.GetValues(typeof(ModType)).Cast().SelectMany(ruleset.GetModsFor).OfType(); + } +} From 6630b38c08d02c7f975ccd7b9d7f4031fbd08eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 3 Apr 2022 19:08:54 +0200 Subject: [PATCH 0158/2328] Make all `ModRateAdjust` implementations incompatible with each other --- osu.Game/Rulesets/Mods/ModDoubleTime.cs | 4 ---- osu.Game/Rulesets/Mods/ModHalfTime.cs | 4 ---- osu.Game/Rulesets/Mods/ModRateAdjust.cs | 2 +- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/osu.Game/Rulesets/Mods/ModDoubleTime.cs b/osu.Game/Rulesets/Mods/ModDoubleTime.cs index d4c4dce0f5..1c71f5d055 100644 --- a/osu.Game/Rulesets/Mods/ModDoubleTime.cs +++ b/osu.Game/Rulesets/Mods/ModDoubleTime.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; @@ -18,8 +16,6 @@ namespace osu.Game.Rulesets.Mods public override ModType Type => ModType.DifficultyIncrease; public override string Description => "Zoooooooooom..."; - public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModHalfTime)).ToArray(); - [SettingSource("Speed increase", "The actual increase to apply")] public override BindableNumber SpeedChange { get; } = new BindableDouble { diff --git a/osu.Game/Rulesets/Mods/ModHalfTime.cs b/osu.Game/Rulesets/Mods/ModHalfTime.cs index c240cdbe6e..13d89e30d6 100644 --- a/osu.Game/Rulesets/Mods/ModHalfTime.cs +++ b/osu.Game/Rulesets/Mods/ModHalfTime.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; @@ -18,8 +16,6 @@ namespace osu.Game.Rulesets.Mods public override ModType Type => ModType.DifficultyReduction; public override string Description => "Less zoom..."; - public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModDoubleTime)).ToArray(); - [SettingSource("Speed decrease", "The actual decrease to apply")] public override BindableNumber SpeedChange { get; } = new BindableDouble { diff --git a/osu.Game/Rulesets/Mods/ModRateAdjust.cs b/osu.Game/Rulesets/Mods/ModRateAdjust.cs index ebe18f2188..88fb609c07 100644 --- a/osu.Game/Rulesets/Mods/ModRateAdjust.cs +++ b/osu.Game/Rulesets/Mods/ModRateAdjust.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Mods public double ApplyToRate(double time, double rate) => rate * SpeedChange.Value; - public override Type[] IncompatibleMods => new[] { typeof(ModTimeRamp), typeof(ModAdaptiveSpeed) }; + public override Type[] IncompatibleMods => new[] { typeof(ModTimeRamp), typeof(ModAdaptiveSpeed), typeof(ModRateAdjust) }; public override string SettingDescription => SpeedChange.IsDefault ? string.Empty : $"{SpeedChange.Value:N2}x"; } From 5e02ba353bd234008cf42dc422fe9bc1c42ae0be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 3 Apr 2022 19:12:24 +0200 Subject: [PATCH 0159/2328] Make `OsuMod{Blinds,Flashlight}` incompatible --- osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs index ad4c5dfd5d..7567c96b50 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs @@ -29,6 +29,8 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.DifficultyIncrease; public override double ScoreMultiplier => 1.12; + public override Type[] IncompatibleMods => new[] { typeof(OsuModFlashlight) }; + private DrawableOsuBlinds blinds; public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index 38c84be295..44d72fae61 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input; @@ -19,6 +20,7 @@ namespace osu.Game.Rulesets.Osu.Mods public class OsuModFlashlight : ModFlashlight, IApplicableToDrawableHitObject { public override double ScoreMultiplier => 1.12; + public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModBlinds)).ToArray(); private const double default_follow_delay = 120; From e99d0f9faeb115d551ecd6fe26f27141666646ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 3 Apr 2022 19:14:45 +0200 Subject: [PATCH 0160/2328] Make all `OsuModObjectScaleTween` implementations incompatible with each other --- osu.Game.Rulesets.Osu/Mods/OsuModObjectScaleTween.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModObjectScaleTween.cs b/osu.Game.Rulesets.Osu/Mods/OsuModObjectScaleTween.cs index 778447e444..70c075276f 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModObjectScaleTween.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModObjectScaleTween.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Mods protected virtual float EndScale => 1; - public override Type[] IncompatibleMods => new[] { typeof(IRequiresApproachCircles), typeof(OsuModSpinIn) }; + public override Type[] IncompatibleMods => new[] { typeof(IRequiresApproachCircles), typeof(OsuModSpinIn), typeof(OsuModObjectScaleTween) }; protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) { From 282b220d9436105b441588d64b3a7b515a1550c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 8 Apr 2022 00:16:25 +0200 Subject: [PATCH 0161/2328] Fix test failure due to checking incompaatibility of flattened multi mods --- osu.Game/Utils/ModUtils.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Utils/ModUtils.cs b/osu.Game/Utils/ModUtils.cs index ff8e04cc58..8df44216b6 100644 --- a/osu.Game/Utils/ModUtils.cs +++ b/osu.Game/Utils/ModUtils.cs @@ -115,7 +115,9 @@ namespace osu.Game.Utils { mods = mods.ToArray(); - CheckCompatibleSet(mods, out invalidMods); + // exclude multi mods from compatibility checks. + // the loop below automatically marks all multi mods as not valid for gameplay anyway. + CheckCompatibleSet(mods.Where(m => !(m is MultiMod)), out invalidMods); foreach (var mod in mods) { From 9ba99ed57d0abc9e67ee9bbab633077a7103976c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Apr 2022 14:42:54 +0900 Subject: [PATCH 0162/2328] Ensure all access to `MultiplayerClient.Room` is on the update thread This was an implicit requirement until now, but not well documented everywhere. Adding this makes it much easier to understand the requirement (and probably safer). --- .../Online/Multiplayer/MultiplayerClient.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index d6099e5f72..2084ba048d 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -11,6 +11,7 @@ using System.Threading; using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Development; using osu.Framework.Graphics; using osu.Framework.Logging; using osu.Game.Database; @@ -87,7 +88,21 @@ namespace osu.Game.Online.Multiplayer /// /// The joined . /// - public MultiplayerRoom? Room { get; private set; } + public MultiplayerRoom? Room + { + get + { + Debug.Assert(ThreadSafety.IsUpdateThread); + return room; + } + private set + { + Debug.Assert(ThreadSafety.IsUpdateThread); + room = value; + } + } + + private MultiplayerRoom? room; /// /// The users in the joined which are participating in the current gameplay loop. From d50f41225ffe644d1abb31681637c0cebeeacc38 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Apr 2022 14:43:53 +0900 Subject: [PATCH 0163/2328] Rename `scheduleAsync` to `runOnUpdateThreadAsync` --- osu.Game/Online/Multiplayer/MultiplayerClient.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index 2084ba048d..5cbf65478c 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -181,7 +181,7 @@ namespace osu.Game.Online.Multiplayer await Task.WhenAll(joinedRoom.Users.Select(PopulateUser)).ConfigureAwait(false); // Update the stored room (must be done on update thread for thread-safety). - await scheduleAsync(() => + await runOnUpdateThreadAsync(() => { Room = joinedRoom; APIRoom = room; @@ -228,7 +228,7 @@ namespace osu.Game.Online.Multiplayer // Leaving rooms is expected to occur instantaneously whilst the operation is finalised in the background. // However a few members need to be reset immediately to prevent other components from entering invalid states whilst the operation hasn't yet completed. // For example, if a room was left and the user immediately pressed the "create room" button, then the user could be taken into the lobby if the value of Room is not reset in time. - var scheduledReset = scheduleAsync(() => + var scheduledReset = runOnUpdateThreadAsync(() => { APIRoom = null; Room = null; @@ -799,7 +799,7 @@ namespace osu.Game.Online.Multiplayer PlayingUserIds.Remove(userId); } - private Task scheduleAsync(Action action, CancellationToken cancellationToken = default) + private Task runOnUpdateThreadAsync(Action action, CancellationToken cancellationToken = default) { var tcs = new TaskCompletionSource(); From 64c63fe93a4ae35a01a86ab5c25a0e65a633a036 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Apr 2022 14:52:56 +0900 Subject: [PATCH 0164/2328] Move null check in `JoinRoom` on to update thread --- osu.Game/Online/Multiplayer/MultiplayerClient.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index 5cbf65478c..996a4e312f 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -163,13 +163,13 @@ namespace osu.Game.Online.Multiplayer /// An optional password to use for the join operation. public async Task JoinRoom(Room room, string? password = null) { + if (Room != null) + throw new InvalidOperationException("Cannot join a multiplayer room while already in one."); + var cancellationSource = joinCancellationSource = new CancellationTokenSource(); await joinOrLeaveTaskChain.Add(async () => { - if (Room != null) - throw new InvalidOperationException("Cannot join a multiplayer room while already in one."); - Debug.Assert(room.RoomID.Value != null); // Join the server-side room. @@ -183,6 +183,8 @@ namespace osu.Game.Online.Multiplayer // Update the stored room (must be done on update thread for thread-safety). await runOnUpdateThreadAsync(() => { + Debug.Assert(Room == null); + Room = joinedRoom; APIRoom = room; From 24c2d465a9c04f61aad3fde9c87243a458447505 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Apr 2022 14:53:14 +0900 Subject: [PATCH 0165/2328] Move null assert in `MultiplayerPlayer` on to update thread --- osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs index 043315c790..70f8f1b752 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs @@ -133,6 +133,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer failAndBail(); } }), true); + } + + protected override void LoadComplete() + { + base.LoadComplete(); Debug.Assert(client.Room != null); } From 933a722cfcecb2911fcb2db9ebecfb1e50b76922 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Apr 2022 14:56:04 +0900 Subject: [PATCH 0166/2328] Remove secondary null checks which cannot exist (were on wrong thread) --- .../Online/Multiplayer/MultiplayerClient.cs | 48 ------------------- 1 file changed, 48 deletions(-) diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index 996a4e312f..7808d8939c 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -360,9 +360,6 @@ namespace osu.Game.Online.Multiplayer Task IMultiplayerClient.RoomStateChanged(MultiplayerRoomState state) { - if (Room == null) - return Task.CompletedTask; - Scheduler.Add(() => { if (Room == null) @@ -395,9 +392,6 @@ namespace osu.Game.Online.Multiplayer async Task IMultiplayerClient.UserJoined(MultiplayerRoomUser user) { - if (Room == null) - return; - await PopulateUser(user).ConfigureAwait(false); Scheduler.Add(() => @@ -446,9 +440,6 @@ namespace osu.Game.Online.Multiplayer private Task handleUserLeft(MultiplayerRoomUser user, Action? callback) { - if (Room == null) - return Task.CompletedTask; - Scheduler.Add(() => { if (Room == null) @@ -470,9 +461,6 @@ namespace osu.Game.Online.Multiplayer Task IMultiplayerClient.HostChanged(int userId) { - if (Room == null) - return Task.CompletedTask; - Scheduler.Add(() => { if (Room == null) @@ -503,9 +491,6 @@ namespace osu.Game.Online.Multiplayer Task IMultiplayerClient.UserStateChanged(int userId, MultiplayerUserState state) { - if (Room == null) - return Task.CompletedTask; - Scheduler.Add(() => { if (Room == null) @@ -523,9 +508,6 @@ namespace osu.Game.Online.Multiplayer Task IMultiplayerClient.MatchUserStateChanged(int userId, MatchUserState state) { - if (Room == null) - return Task.CompletedTask; - Scheduler.Add(() => { if (Room == null) @@ -540,9 +522,6 @@ namespace osu.Game.Online.Multiplayer Task IMultiplayerClient.MatchRoomStateChanged(MatchRoomState state) { - if (Room == null) - return Task.CompletedTask; - Scheduler.Add(() => { if (Room == null) @@ -557,9 +536,6 @@ namespace osu.Game.Online.Multiplayer public Task MatchEvent(MatchServerEvent e) { - if (Room == null) - return Task.CompletedTask; - Scheduler.Add(() => { if (Room == null) @@ -580,9 +556,6 @@ namespace osu.Game.Online.Multiplayer Task IMultiplayerClient.UserBeatmapAvailabilityChanged(int userId, BeatmapAvailability beatmapAvailability) { - if (Room == null) - return Task.CompletedTask; - Scheduler.Add(() => { var user = Room?.Users.SingleOrDefault(u => u.UserID == userId); @@ -601,9 +574,6 @@ namespace osu.Game.Online.Multiplayer public Task UserModsChanged(int userId, IEnumerable mods) { - if (Room == null) - return Task.CompletedTask; - Scheduler.Add(() => { var user = Room?.Users.SingleOrDefault(u => u.UserID == userId); @@ -622,9 +592,6 @@ namespace osu.Game.Online.Multiplayer Task IMultiplayerClient.LoadRequested() { - if (Room == null) - return Task.CompletedTask; - Scheduler.Add(() => { if (Room == null) @@ -638,9 +605,6 @@ namespace osu.Game.Online.Multiplayer Task IMultiplayerClient.MatchStarted() { - if (Room == null) - return Task.CompletedTask; - Scheduler.Add(() => { if (Room == null) @@ -654,9 +618,6 @@ namespace osu.Game.Online.Multiplayer Task IMultiplayerClient.ResultsReady() { - if (Room == null) - return Task.CompletedTask; - Scheduler.Add(() => { if (Room == null) @@ -670,9 +631,6 @@ namespace osu.Game.Online.Multiplayer public Task PlaylistItemAdded(MultiplayerPlaylistItem item) { - if (Room == null) - return Task.CompletedTask; - Scheduler.Add(() => { if (Room == null) @@ -692,9 +650,6 @@ namespace osu.Game.Online.Multiplayer public Task PlaylistItemRemoved(long playlistItemId) { - if (Room == null) - return Task.CompletedTask; - Scheduler.Add(() => { if (Room == null) @@ -716,9 +671,6 @@ namespace osu.Game.Online.Multiplayer public Task PlaylistItemChanged(MultiplayerPlaylistItem item) { - if (Room == null) - return Task.CompletedTask; - Scheduler.Add(() => { if (Room == null) From 879267862c62fff490bbec9032bf48b07a53bf6e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Apr 2022 15:20:22 +0900 Subject: [PATCH 0167/2328] Fix typo in `DrawableOsuHitObject` --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 628d95dff4..a1c8879105 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public readonly IBindable ScaleBindable = new BindableFloat(); public readonly IBindable IndexInCurrentComboBindable = new Bindable(); - // Must be set to update IsHovered as it's used in relax mdo to detect osu hit objects. + // Must be set to update IsHovered as it's used in relax mod to detect osu hit objects. public override bool HandlePositionalInput => true; protected override float SamplePlaybackPosition => HitObject.X / OsuPlayfield.BASE_SIZE.X; From 6bb82432125b7a5957a9472751b2f44ed48ff9fc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Apr 2022 17:41:03 +0900 Subject: [PATCH 0168/2328] Fix potential assert failure due to `Room` access from disconnection event --- osu.Game/Online/Multiplayer/MultiplayerClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index 7808d8939c..7d4084aeb4 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -142,7 +142,7 @@ namespace osu.Game.Online.Multiplayer [BackgroundDependencyLoader] private void load() { - IsConnected.BindValueChanged(connected => + IsConnected.BindValueChanged(connected => Scheduler.Add(() => { // clean up local room state on server disconnect. if (!connected.NewValue && Room != null) @@ -150,7 +150,7 @@ namespace osu.Game.Online.Multiplayer Logger.Log("Connection to multiplayer server was lost.", LoggingTarget.Runtime, LogLevel.Important); LeaveRoom(); } - }); + })); } private readonly TaskChain joinOrLeaveTaskChain = new TaskChain(); From 5c571996d8398287e8a7b5ed9eb2a36fe3959a5c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Apr 2022 17:55:43 +0900 Subject: [PATCH 0169/2328] Avoid multiplayer crashes when events arrive in unexpected order Intended to be a temporary fix for https://github.com/ppy/osu/issues/17713 while a more permanent solution is established. A proper fix is actually quite simple, but updating the test to work with it is... *slightly* more complicated. This hotfix will mean that if a `UserJoined` event arrives during the unobserved window during room join (of the local user), the local user still won't see the joining user, but the game won't crash as a result. --- osu.Game/Online/Multiplayer/MultiplayerClient.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index 7808d8939c..7bd93c2e34 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -493,11 +493,13 @@ namespace osu.Game.Online.Multiplayer { Scheduler.Add(() => { - if (Room == null) + var user = Room?.Users.SingleOrDefault(u => u.UserID == userId); + + // TODO: user should NEVER be null here, see https://github.com/ppy/osu/issues/17713. + if (user == null) return; - Room.Users.Single(u => u.UserID == userId).State = state; - + user.State = state; updateUserPlayingState(userId, state); RoomUpdated?.Invoke(); @@ -510,10 +512,13 @@ namespace osu.Game.Online.Multiplayer { Scheduler.Add(() => { - if (Room == null) + var user = Room?.Users.SingleOrDefault(u => u.UserID == userId); + + // TODO: user should NEVER be null here, see https://github.com/ppy/osu/issues/17713. + if (user == null) return; - Room.Users.Single(u => u.UserID == userId).MatchState = state; + user.MatchState = state; RoomUpdated?.Invoke(); }, false); From ea4ca6d2ad0b7b14ea448f6f2de7612affc72b56 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Apr 2022 18:09:57 +0900 Subject: [PATCH 0170/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 10685d5990..331c4db01f 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 7fd2647a8a..308ec7e7d6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index a5efc40d51..311c9ba345 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 9ea6f9b1fe0e3411a94ed07ecf1286105bfd071e Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 8 Apr 2022 21:44:44 +0900 Subject: [PATCH 0171/2328] Remove some incorrectly-firing asserts --- osu.Game/Online/Multiplayer/MultiplayerClient.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index 0e9ba323ae..1bd1952832 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -481,11 +481,7 @@ namespace osu.Game.Online.Multiplayer Task IMultiplayerClient.SettingsChanged(MultiplayerRoomSettings newSettings) { - Debug.Assert(APIRoom != null); - Debug.Assert(Room != null); - Scheduler.Add(() => updateLocalRoomSettings(newSettings)); - return Task.CompletedTask; } From ae1e1268374f632294aedadf0c228ae724000bd9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 9 Apr 2022 00:30:28 +0900 Subject: [PATCH 0172/2328] Make `HighlightMessage` implicitly show chat overlay --- osu.Game/Online/Chat/MessageNotifier.cs | 2 -- osu.Game/Overlays/ChatOverlay.cs | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/Chat/MessageNotifier.cs b/osu.Game/Online/Chat/MessageNotifier.cs index bcfec3cc0f..20c33db61f 100644 --- a/osu.Game/Online/Chat/MessageNotifier.cs +++ b/osu.Game/Online/Chat/MessageNotifier.cs @@ -178,8 +178,6 @@ namespace osu.Game.Online.Chat { notificationOverlay.Hide(); chatOverlay.HighlightMessage(message, channel); - chatOverlay.Show(); - return true; }; } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 3d39c7ce3a..8eb33453de 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -313,6 +313,8 @@ namespace osu.Game.Overlays /// The channel containing the message. public void HighlightMessage(Message message, Channel channel) { + Show(); + Debug.Assert(channel.Id == message.ChannelId); if (currentChannel.Value.Id != channel.Id) From 57fb8616b86c0a43fc51e3679984c88839efe0d0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 9 Apr 2022 00:31:00 +0900 Subject: [PATCH 0173/2328] Fix potential null reference when attempting to highlight a message before overlay has been displayed --- 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 8eb33453de..1ad6be132e 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -317,7 +317,7 @@ namespace osu.Game.Overlays Debug.Assert(channel.Id == message.ChannelId); - if (currentChannel.Value.Id != channel.Id) + if (currentChannel.Value?.Id != channel.Id) { if (!channel.Joined.Value) channel = channelManager.JoinChannel(channel); From 34adc1d41070b37024065528da9e96965375a652 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 8 Apr 2022 19:21:37 +0300 Subject: [PATCH 0174/2328] Add quick test coverage --- .../Visual/Online/TestSceneChatOverlay.cs | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs index 80a6698761..4d1dee1650 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs @@ -534,11 +534,33 @@ namespace osu.Game.Tests.Visual.Online }); }); - AddStep("Highlight message and open chat", () => + AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, channel1)); + } + + [Test] + public void TestHighlightWithNullChannel() + { + Message message = null; + + AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); + + AddStep("Send message in channel 1", () => { - chatOverlay.HighlightMessage(message, channel1); - chatOverlay.Show(); + channel1.AddNewMessages(message = new Message + { + ChannelId = channel1.Id, + Content = "Message to highlight!", + Timestamp = DateTimeOffset.Now, + Sender = new APIUser + { + Id = 2, + Username = "Someone", + } + }); }); + + AddStep("Set null channel", () => channelManager.CurrentChannel.Value = null); + AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, channel1)); } private void pressChannelHotkey(int number) From 134d9b5ddf16ea0ea8e27e764bdef755c0b3f17f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 8 Apr 2022 19:27:59 +0300 Subject: [PATCH 0175/2328] Perform `Show()` at the bottom of the method Probably not affecting behaviour, but makes more sense. --- osu.Game/Overlays/ChatOverlay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 1ad6be132e..64b972262b 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -313,8 +313,6 @@ namespace osu.Game.Overlays /// The channel containing the message. public void HighlightMessage(Message message, Channel channel) { - Show(); - Debug.Assert(channel.Id == message.ChannelId); if (currentChannel.Value?.Id != channel.Id) @@ -326,6 +324,8 @@ namespace osu.Game.Overlays } channel.HighlightedMessage.Value = message; + + Show(); } private float startDragChatHeight; From d482ab02877b3f231dd4d177b352e28ef5a4af4a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sat, 9 Apr 2022 22:29:55 +0900 Subject: [PATCH 0176/2328] Fix ParticleSpewer outputting NaN in vertices --- osu.Game/Graphics/ParticleSpewer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Graphics/ParticleSpewer.cs b/osu.Game/Graphics/ParticleSpewer.cs index 4fc6c4527f..369a4b21c7 100644 --- a/osu.Game/Graphics/ParticleSpewer.cs +++ b/osu.Game/Graphics/ParticleSpewer.cs @@ -109,6 +109,9 @@ namespace osu.Game.Graphics { foreach (var p in particles) { + if (p.Duration == 0) + continue; + float timeSinceStart = currentTime - p.StartTime; // ignore particles from the future. From 19b655d75bd589f25fa76057fe3e66ec5d98eb96 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Apr 2022 13:30:21 +0900 Subject: [PATCH 0177/2328] Avoid throwing unobserved exception when `PerformancePointsCounter` requests timed attributes --- osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs b/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs index 7a1f724cfb..8b1e0ae83e 100644 --- a/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs +++ b/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; -using System.Threading.Tasks; using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Audio.Track; @@ -80,13 +79,16 @@ namespace osu.Game.Screens.Play.HUD difficultyCache.GetTimedDifficultyAttributesAsync(gameplayWorkingBeatmap, gameplayState.Ruleset, clonedMods, loadCancellationSource.Token) .ContinueWith(task => Schedule(() => { + if (task.Exception != null) + return; + timedAttributes = task.GetResultSafely(); IsValid = true; if (lastJudgement != null) onJudgementChanged(lastJudgement); - }), TaskContinuationOptions.OnlyOnRanToCompletion); + })); } } From 779f7390b78425e9340f9172e536fd9bb733beae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Apr 2022 13:43:43 +0900 Subject: [PATCH 0178/2328] Add test coverage of `DrawableRoom` actually showing post-retrieval text --- .../Visual/Multiplayer/TestSceneDrawableRoom.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs index d8ec0ad1f0..7d010592ae 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Framework.Utils; +using osu.Game.Graphics.Sprites; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Multiplayer; using osu.Game.Online.Rooms; @@ -34,9 +35,11 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestMultipleStatuses() { + FillFlowContainer rooms = null; + AddStep("create rooms", () => { - Child = new FillFlowContainer + Child = rooms = new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -124,6 +127,10 @@ namespace osu.Game.Tests.Visual.Multiplayer } }; }); + + AddUntilStep("wait for panel load", () => rooms.Count == 5); + AddUntilStep("correct status text", () => rooms.ChildrenOfType().Count(s => s.Text.ToString().StartsWith("Currently playing", StringComparison.Ordinal)) == 2); + AddUntilStep("correct status text", () => rooms.ChildrenOfType().Count(s => s.Text.ToString().StartsWith("Ready to play", StringComparison.Ordinal)) == 3); } [Test] From 2b74dbca28c24f1d3f2077ab272ed99deac5b33d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Apr 2022 13:36:01 +0900 Subject: [PATCH 0179/2328] Fix potential crash in `DrawableRoom` due to lack of null check on post-lookup beatmap --- .../OnlinePlay/Lounge/Components/DrawableRoom.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs index 5adce862a0..8e3aa77e7b 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs @@ -418,10 +418,16 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components var retrievedBeatmap = task.GetResultSafely(); statusText.Text = "Currently playing "; - beatmapText.AddLink(retrievedBeatmap.GetDisplayTitleRomanisable(), - LinkAction.OpenBeatmap, - retrievedBeatmap.OnlineID.ToString(), - creationParameters: s => s.Truncate = true); + + if (retrievedBeatmap != null) + { + beatmapText.AddLink(retrievedBeatmap.GetDisplayTitleRomanisable(), + LinkAction.OpenBeatmap, + retrievedBeatmap.OnlineID.ToString(), + creationParameters: s => s.Truncate = true); + } + else + beatmapText.AddText("unknown beatmap"); }), cancellationSource.Token); } } From 808f0ecb74d2f2c65fdc9558d1eb07a616b6ac18 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Apr 2022 14:10:50 +0900 Subject: [PATCH 0180/2328] Ensure running state is updated before performing `Seek` in `GameplayClockContainer.Reset` --- osu.Game/Screens/Play/GameplayClockContainer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index 226f5709c7..f2df00d691 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -122,14 +122,14 @@ namespace osu.Game.Screens.Play if (gameplayStartTime != null) StartTime = gameplayStartTime; - ensureSourceClockSet(); - Seek(StartTime ?? 0); - // Manually stop the source in order to not affect the IsPaused state. AdjustableSource.Stop(); if (!IsPaused.Value || startClock) Start(); + + ensureSourceClockSet(); + Seek(StartTime ?? 0); } /// From cb6e557212a5156ba2f59dd542943c878414b40f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Apr 2022 14:11:23 +0900 Subject: [PATCH 0181/2328] Fix `MasterGameplayClockContainer` having incorrect rate-based offsets immediately after `LoadComplete` I've attempted to explain why this is required using inline comments. There's also further conversation at https://github.com/ppy/osu/pull/17302#issuecomment-1091850927. --- .../Play/MasterGameplayClockContainer.cs | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs index 9bcbbf789b..54901746fc 100644 --- a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs +++ b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs @@ -130,17 +130,32 @@ namespace osu.Game.Screens.Play protected override void OnIsPausedChanged(ValueChangedEvent isPaused) { - // The source is stopped by a frequency fade first. - if (isPaused.NewValue) + if (IsLoaded) { - this.TransformBindableTo(pauseFreqAdjust, 0, 200, Easing.Out).OnComplete(_ => + // During normal operation, the source is stopped after performing a frequency ramp. + if (isPaused.NewValue) { - if (IsPaused.Value == isPaused.NewValue) - AdjustableSource.Stop(); - }); + this.TransformBindableTo(pauseFreqAdjust, 0, 200, Easing.Out).OnComplete(_ => + { + if (IsPaused.Value == isPaused.NewValue) + AdjustableSource.Stop(); + }); + } + else + this.TransformBindableTo(pauseFreqAdjust, 1, 200, Easing.In); } else - this.TransformBindableTo(pauseFreqAdjust, 1, 200, Easing.In); + { + if (isPaused.NewValue) + AdjustableSource.Stop(); + + // If not yet loaded, we still want to ensure relevant state is correct, as it is used for offset calculations. + pauseFreqAdjust.Value = isPaused.NewValue ? 0 : 1; + + // We must also process underlying gameplay clocks to update rate-adjusted offsets with the new frequency adjustment. + // Without doing this, an initial seek may be performed with the wrong offset. + GameplayClock.UnderlyingClock.ProcessFrame(); + } } public override void Start() From 72cb3d6ad63dc0967a74980d67ae3c097c02e41b Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Mon, 11 Apr 2022 14:15:08 +0800 Subject: [PATCH 0182/2328] USe `MathF` in all applicable places --- .../Utils/OsuHitObjectGenerationUtils.cs | 6 +++--- .../OsuHitObjectGenerationUtils_Reposition.cs | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs index 19d3390f56..6129e6bfc4 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs @@ -174,11 +174,11 @@ namespace osu.Game.Rulesets.Osu.Utils /// The rotated vector. private static Vector2 rotateVector(Vector2 vector, float rotation) { - float angle = (float)Math.Atan2(vector.Y, vector.X) + rotation; + float angle = MathF.Atan2(vector.Y, vector.X) + rotation; float length = vector.Length; return new Vector2( - length * (float)Math.Cos(angle), - length * (float)Math.Sin(angle) + length * MathF.Cos(angle), + length * MathF.Sin(angle) ); } } diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs index 664bfae35a..2abbd61c59 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Utils foreach (OsuHitObject hitObject in hitObjects) { Vector2 relativePosition = hitObject.Position - previousPosition; - float absoluteAngle = (float)Math.Atan2(relativePosition.Y, relativePosition.X); + float absoluteAngle = MathF.Atan2(relativePosition.Y, relativePosition.X); float relativeAngle = absoluteAngle - previousAngle; ObjectPositionInfo positionInfo; @@ -141,15 +141,15 @@ namespace osu.Game.Rulesets.Osu.Utils { Vector2 earliestPosition = beforePrevious?.HitObject.EndPosition ?? playfield_centre; Vector2 relativePosition = previous.HitObject.Position - earliestPosition; - previousAbsoluteAngle = (float)Math.Atan2(relativePosition.Y, relativePosition.X); + previousAbsoluteAngle = MathF.Atan2(relativePosition.Y, relativePosition.X); } } float absoluteAngle = previousAbsoluteAngle + current.PositionInfo.RelativeAngle; var posRelativeToPrev = new Vector2( - current.PositionInfo.DistanceFromPrevious * (float)Math.Cos(absoluteAngle), - current.PositionInfo.DistanceFromPrevious * (float)Math.Sin(absoluteAngle) + current.PositionInfo.DistanceFromPrevious * MathF.Cos(absoluteAngle), + current.PositionInfo.DistanceFromPrevious * MathF.Sin(absoluteAngle) ); Vector2 lastEndPosition = previous?.EndPositionModified ?? playfield_centre; @@ -161,13 +161,13 @@ namespace osu.Game.Rulesets.Osu.Utils if (!(current.HitObject is Slider slider)) return; - absoluteAngle = (float)Math.Atan2(posRelativeToPrev.Y, posRelativeToPrev.X); + absoluteAngle = MathF.Atan2(posRelativeToPrev.Y, posRelativeToPrev.X); Vector2 centreOfMassOriginal = calculateCentreOfMass(slider); Vector2 centreOfMassModified = rotateVector(centreOfMassOriginal, current.PositionInfo.Rotation + absoluteAngle - getSliderRotation(slider)); centreOfMassModified = RotateAwayFromEdge(current.PositionModified, centreOfMassModified); - float relativeRotation = (float)Math.Atan2(centreOfMassModified.Y, centreOfMassModified.X) - (float)Math.Atan2(centreOfMassOriginal.Y, centreOfMassOriginal.X); + float relativeRotation = MathF.Atan2(centreOfMassModified.Y, centreOfMassModified.X) - MathF.Atan2(centreOfMassOriginal.Y, centreOfMassOriginal.X); if (!Precision.AlmostEquals(relativeRotation, 0)) RotateSlider(slider, relativeRotation); } @@ -346,7 +346,7 @@ namespace osu.Game.Rulesets.Osu.Utils private static float getSliderRotation(Slider slider) { var endPositionVector = slider.Path.PositionAt(1); - return (float)Math.Atan2(endPositionVector.Y, endPositionVector.X); + return MathF.Atan2(endPositionVector.Y, endPositionVector.X); } public class ObjectPositionInfo From d1de516b1109d69b4c09391cb7997dec590d77e8 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 11 Apr 2022 15:38:11 +0900 Subject: [PATCH 0183/2328] Fix incorrect cursor parameterisation in test scene --- .../TestScenePlaylistsResultsScreen.cs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs index ee9a0e263b..f5fe00458a 100644 --- a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs +++ b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs @@ -259,7 +259,7 @@ namespace osu.Game.Tests.Visual.Playlists { multiplayerUserScore.ScoresAround.Lower.Scores.Add(new MultiplayerScore { - ID = --highestScoreId, + ID = getNextLowestScoreId(), Accuracy = userScore.Accuracy, Passed = true, Rank = userScore.Rank, @@ -274,7 +274,7 @@ namespace osu.Game.Tests.Visual.Playlists multiplayerUserScore.ScoresAround.Higher.Scores.Add(new MultiplayerScore { - ID = ++lowestScoreId, + ID = getNextHighestScoreId(), Accuracy = userScore.Accuracy, Passed = true, Rank = userScore.Rank, @@ -306,7 +306,7 @@ namespace osu.Game.Tests.Visual.Playlists { result.Scores.Add(new MultiplayerScore { - ID = sort == "score_asc" ? --highestScoreId : ++lowestScoreId, + ID = sort == "score_asc" ? getNextHighestScoreId() : getNextLowestScoreId(), Accuracy = 1, Passed = true, Rank = ScoreRank.X, @@ -327,6 +327,17 @@ namespace osu.Game.Tests.Visual.Playlists return result; } + /// + /// The next highest score ID to appear at the left of the list. Monotonically decreasing. + /// + private int getNextHighestScoreId() => --highestScoreId; + + /// + /// The next lowest score ID to appear at the right of the list. Monotonically increasing. + /// + /// + private int getNextLowestScoreId() => ++lowestScoreId; + private void addCursor(MultiplayerScores scores) { scores.Cursor = new Cursor @@ -342,7 +353,9 @@ namespace osu.Game.Tests.Visual.Playlists { Properties = new Dictionary { - { "sort", JToken.FromObject(scores.Scores[^1].ID > scores.Scores[^2].ID ? "score_asc" : "score_desc") } + // [ 1, 2, 3, ... ] => score_desc (will be added to the right of the list) + // [ 3, 2, 1, ... ] => score_asc (will be added to the left of the list) + { "sort", JToken.FromObject(scores.Scores[^1].ID > scores.Scores[^2].ID ? "score_desc" : "score_asc") } } }; } From abb42a54fde43f6613fd76a4389b4a0a9575f24a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Apr 2022 16:47:34 +0900 Subject: [PATCH 0184/2328] Fix `MultiplayerTestScene` not actually setting match type correctly --- osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs b/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs index 6c40546325..a26c6f9be9 100644 --- a/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs +++ b/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs @@ -44,6 +44,7 @@ namespace osu.Game.Tests.Visual.Multiplayer return new Room { Name = { Value = "test name" }, + Type = { Value = MatchType.HeadToHead }, Playlist = { new PlaylistItem(new TestBeatmap(Ruleset.Value).BeatmapInfo) From 34457b474229b383e14a18e2d6cefd4760e1abee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Apr 2022 18:51:37 +0900 Subject: [PATCH 0185/2328] Expose mocked members as `virtual` on `Multiplayer` and `SpectatorClient` --- osu.Game/Online/Multiplayer/MultiplayerClient.cs | 4 ++-- osu.Game/Online/Spectator/SpectatorClient.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index 1bd1952832..18db710cee 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -42,7 +42,7 @@ namespace osu.Game.Online.Multiplayer /// /// Invoked when a user leaves the room of their own accord. /// - public event Action? UserLeft; + public virtual event Action? UserLeft; /// /// Invoked when a user was kicked from the room forcefully. @@ -107,7 +107,7 @@ namespace osu.Game.Online.Multiplayer /// /// The users in the joined which are participating in the current gameplay loop. /// - public IBindableList CurrentMatchPlayingUserIds => PlayingUserIds; + public virtual IBindableList CurrentMatchPlayingUserIds => PlayingUserIds; protected readonly BindableList PlayingUserIds = new BindableList(); diff --git a/osu.Game/Online/Spectator/SpectatorClient.cs b/osu.Game/Online/Spectator/SpectatorClient.cs index 8f22078010..138e8ac7d6 100644 --- a/osu.Game/Online/Spectator/SpectatorClient.cs +++ b/osu.Game/Online/Spectator/SpectatorClient.cs @@ -54,17 +54,17 @@ namespace osu.Game.Online.Spectator /// /// Called whenever new frames arrive from the server. /// - public event Action? OnNewFrames; + public virtual event Action? OnNewFrames; /// /// Called whenever a user starts a play session, or immediately if the user is being watched and currently in a play session. /// - public event Action? OnUserBeganPlaying; + public virtual event Action? OnUserBeganPlaying; /// /// Called whenever a user finishes a play session. /// - public event Action? OnUserFinishedPlaying; + public virtual event Action? OnUserFinishedPlaying; /// /// All users currently being watched. From 0ccac24f76dbd8f137cd59cda946a1a7d416aaae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Apr 2022 19:15:46 +0900 Subject: [PATCH 0186/2328] Split out base implementation of `MultiplayerGameplayLeaderboard` test --- ...MultiplayerGameplayLeaderboardTestScene.cs | 191 ++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs diff --git a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs new file mode 100644 index 0000000000..eb15282f75 --- /dev/null +++ b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs @@ -0,0 +1,191 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Diagnostics; +using System.Linq; +using Moq; +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Testing; +using osu.Framework.Utils; +using osu.Game.Configuration; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; +using osu.Game.Online.Multiplayer; +using osu.Game.Online.Spectator; +using osu.Game.Replays.Legacy; +using osu.Game.Rulesets.Osu.Scoring; +using osu.Game.Rulesets.Scoring; +using osu.Game.Scoring; +using osu.Game.Screens.Play.HUD; + +namespace osu.Game.Tests.Visual.Multiplayer +{ + public abstract class MultiplayerGameplayLeaderboardTestScene : OsuTestScene + { + protected readonly BindableList MultiplayerUsers = new BindableList(); + private readonly BindableList multiplayerUserIds = new BindableList(); + + protected MultiplayerGameplayLeaderboard Leaderboard { get; private set; } + + private OsuConfigManager config; + + private readonly Mock spectatorClient = new Mock(); + private readonly Mock multiplayerClient = new Mock(); + + private readonly Dictionary lastHeaders = new Dictionary(); + + [BackgroundDependencyLoader] + private void load() + { + Dependencies.Cache(config = new OsuConfigManager(LocalStorage)); + Dependencies.CacheAs(spectatorClient.Object); + Dependencies.CacheAs(multiplayerClient.Object); + + // To emulate `MultiplayerClient.CurrentMatchPlayingUserIds` we need a bindable list of *only IDs*. + // This tracks the list of users 1:1. + MultiplayerUsers.BindCollectionChanged((c, e) => + { + switch (e.Action) + { + case NotifyCollectionChangedAction.Add: + Debug.Assert(e.NewItems != null); + + foreach (var user in e.NewItems.OfType()) + multiplayerUserIds.Add(user.UserID); + break; + + case NotifyCollectionChangedAction.Remove: + Debug.Assert(e.OldItems != null); + + foreach (var user in e.OldItems.OfType()) + multiplayerUserIds.Remove(user.UserID); + break; + + case NotifyCollectionChangedAction.Reset: + multiplayerUserIds.Clear(); + break; + } + }); + + multiplayerClient.SetupGet(c => c.CurrentMatchPlayingUserIds) + .Returns(() => multiplayerUserIds); + } + + [SetUpSteps] + public virtual void SetUpSteps() + { + AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = new APIUser + { + Username = "local", + }); + + AddStep("populate users", () => + { + MultiplayerUsers.Clear(); + for (int i = 0; i < 16; i++) + MultiplayerUsers.Add(CreateUser(i)); + }); + + AddStep("create leaderboard", () => + { + Leaderboard?.Expire(); + + OsuScoreProcessor scoreProcessor; + Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value); + + var playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value); + + Child = scoreProcessor = new OsuScoreProcessor(); + + scoreProcessor.ApplyBeatmap(playableBeatmap); + + LoadComponentAsync(Leaderboard = CreateLeaderboard(scoreProcessor), Add); + }); + + AddUntilStep("wait for load", () => Leaderboard.IsLoaded); + } + + protected virtual MultiplayerRoomUser CreateUser(int i) => new MultiplayerRoomUser(i); + + protected abstract MultiplayerGameplayLeaderboard CreateLeaderboard(OsuScoreProcessor scoreProcessor); + + [Test] + public void TestScoreUpdates() + { + AddRepeatStep("update state", UpdateUserStatesRandomly, 100); + AddToggleStep("switch compact mode", expanded => Leaderboard.Expanded.Value = expanded); + } + + [Test] + public void TestUserQuit() + { + AddUntilStep("mark users quit", () => + { + if (MultiplayerUsers.Count == 0) + return true; + + MultiplayerUsers.RemoveAt(0); + return false; + }); + } + + [Test] + public void TestChangeScoringMode() + { + AddRepeatStep("update state", UpdateUserStatesRandomly, 5); + AddStep("change to classic", () => config.SetValue(OsuSetting.ScoreDisplayMode, ScoringMode.Classic)); + AddStep("change to standardised", () => config.SetValue(OsuSetting.ScoreDisplayMode, ScoringMode.Standardised)); + } + + protected void UpdateUserStatesRandomly() + { + foreach (var user in MultiplayerUsers) + { + if (RNG.NextBool()) + continue; + + int userId = user.UserID; + + if (!lastHeaders.TryGetValue(userId, out var header)) + { + lastHeaders[userId] = header = new FrameHeader(new ScoreInfo + { + Statistics = new Dictionary + { + [HitResult.Miss] = 0, + [HitResult.Meh] = 0, + [HitResult.Great] = 0 + } + }); + } + + switch (RNG.Next(0, 3)) + { + case 0: + header.Combo = 0; + header.Statistics[HitResult.Miss]++; + break; + + case 1: + header.Combo++; + header.MaxCombo = Math.Max(header.MaxCombo, header.Combo); + header.Statistics[HitResult.Meh]++; + break; + + default: + header.Combo++; + header.MaxCombo = Math.Max(header.MaxCombo, header.Combo); + header.Statistics[HitResult.Great]++; + break; + } + + spectatorClient.Raise(s => s.OnNewFrames -= null, userId, new FrameDataBundle(header, new[] { new LegacyReplayFrame(Time.Current, 0, 0, ReplayButtonState.None) })); + } + } + } +} From b52f070fdb79fa28aafc18d85ba0da7ac0a97d5f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Apr 2022 19:15:57 +0900 Subject: [PATCH 0187/2328] Update existing multiplayer leaderboard tests to use new mocked implementation --- ...TestSceneMultiplayerGameplayLeaderboard.cs | 151 +----------------- ...ceneMultiplayerGameplayLeaderboardTeams.cs | 116 +++----------- 2 files changed, 31 insertions(+), 236 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs index bcd4474876..6e4aa48b0e 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs @@ -1,161 +1,22 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using System.Collections.Generic; using System.Linq; -using NUnit.Framework; -using osu.Framework.Allocation; -using osu.Framework.Extensions; -using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; -using osu.Framework.Utils; -using osu.Game.Configuration; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests.Responses; -using osu.Game.Online.Multiplayer; -using osu.Game.Online.Spectator; -using osu.Game.Replays.Legacy; using osu.Game.Rulesets.Osu.Scoring; -using osu.Game.Rulesets.Scoring; -using osu.Game.Scoring; using osu.Game.Screens.Play.HUD; -using osu.Game.Tests.Visual.OnlinePlay; -using osu.Game.Tests.Visual.Spectator; namespace osu.Game.Tests.Visual.Multiplayer { - public class TestSceneMultiplayerGameplayLeaderboard : MultiplayerTestScene + public class TestSceneMultiplayerGameplayLeaderboard : MultiplayerGameplayLeaderboardTestScene { - private static IEnumerable users => Enumerable.Range(0, 16); - - public new TestMultiplayerSpectatorClient SpectatorClient => (TestMultiplayerSpectatorClient)OnlinePlayDependencies?.SpectatorClient; - - private MultiplayerGameplayLeaderboard leaderboard; - private OsuConfigManager config; - - [BackgroundDependencyLoader] - private void load() + protected override MultiplayerGameplayLeaderboard CreateLeaderboard(OsuScoreProcessor scoreProcessor) { - Dependencies.Cache(config = new OsuConfigManager(LocalStorage)); - } - - public override void SetUpSteps() - { - base.SetUpSteps(); - - AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = UserLookupCache.GetUserAsync(1).GetResultSafely()); - - AddStep("create leaderboard", () => + return new MultiplayerGameplayLeaderboard(Ruleset.Value, scoreProcessor, MultiplayerUsers.ToArray()) { - leaderboard?.Expire(); - - OsuScoreProcessor scoreProcessor; - Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value); - - var playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value); - var multiplayerUsers = new List(); - - foreach (int user in users) - { - SpectatorClient.SendStartPlay(user, Beatmap.Value.BeatmapInfo.OnlineID); - multiplayerUsers.Add(OnlinePlayDependencies.MultiplayerClient.AddUser(new APIUser { Id = user }, true)); - } - - Children = new Drawable[] - { - scoreProcessor = new OsuScoreProcessor(), - }; - - scoreProcessor.ApplyBeatmap(playableBeatmap); - - LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(Ruleset.Value, scoreProcessor, multiplayerUsers.ToArray()) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }, Add); - }); - - AddUntilStep("wait for load", () => leaderboard.IsLoaded); - AddUntilStep("wait for user population", () => MultiplayerClient.CurrentMatchPlayingUserIds.Count > 0); - } - - [Test] - public void TestScoreUpdates() - { - AddRepeatStep("update state", () => SpectatorClient.RandomlyUpdateState(), 100); - AddToggleStep("switch compact mode", expanded => leaderboard.Expanded.Value = expanded); - } - - [Test] - public void TestUserQuit() - { - foreach (int user in users) - AddStep($"mark user {user} quit", () => MultiplayerClient.RemoveUser(UserLookupCache.GetUserAsync(user).GetResultSafely().AsNonNull())); - } - - [Test] - public void TestChangeScoringMode() - { - AddRepeatStep("update state", () => SpectatorClient.RandomlyUpdateState(), 5); - AddStep("change to classic", () => config.SetValue(OsuSetting.ScoreDisplayMode, ScoringMode.Classic)); - AddStep("change to standardised", () => config.SetValue(OsuSetting.ScoreDisplayMode, ScoringMode.Standardised)); - } - - protected override OnlinePlayTestSceneDependencies CreateOnlinePlayDependencies() => new TestDependencies(); - - protected class TestDependencies : MultiplayerTestSceneDependencies - { - protected override TestSpectatorClient CreateSpectatorClient() => new TestMultiplayerSpectatorClient(); - } - - public class TestMultiplayerSpectatorClient : TestSpectatorClient - { - private readonly Dictionary lastHeaders = new Dictionary(); - - public void RandomlyUpdateState() - { - foreach ((int userId, _) in WatchedUserStates) - { - if (RNG.NextBool()) - continue; - - if (!lastHeaders.TryGetValue(userId, out var header)) - { - lastHeaders[userId] = header = new FrameHeader(new ScoreInfo - { - Statistics = new Dictionary - { - [HitResult.Miss] = 0, - [HitResult.Meh] = 0, - [HitResult.Great] = 0 - } - }); - } - - switch (RNG.Next(0, 3)) - { - case 0: - header.Combo = 0; - header.Statistics[HitResult.Miss]++; - break; - - case 1: - header.Combo++; - header.MaxCombo = Math.Max(header.MaxCombo, header.Combo); - header.Statistics[HitResult.Meh]++; - break; - - default: - header.Combo++; - header.MaxCombo = Math.Max(header.MaxCombo, header.Combo); - header.Statistics[HitResult.Great]++; - break; - } - - ((ISpectatorClient)this).UserSentFrames(userId, new FrameDataBundle(header, new[] { new LegacyReplayFrame(Time.Current, 0, 0, ReplayButtonState.None) })); - } - } + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }; } } } diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs index 7f5aced925..56a4f053c5 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs @@ -1,121 +1,55 @@ // 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.Linq; -using NUnit.Framework; -using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Utils; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus; -using osu.Game.Online.Rooms; using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Screens.OnlinePlay.Multiplayer; using osu.Game.Screens.Play.HUD; -using osu.Game.Tests.Visual.OnlinePlay; -using osu.Game.Tests.Visual.Spectator; namespace osu.Game.Tests.Visual.Multiplayer { - public class TestSceneMultiplayerGameplayLeaderboardTeams : MultiplayerTestScene + public class TestSceneMultiplayerGameplayLeaderboardTeams : MultiplayerGameplayLeaderboardTestScene { - private static IEnumerable users => Enumerable.Range(0, 16); - - public new TestSceneMultiplayerGameplayLeaderboard.TestMultiplayerSpectatorClient SpectatorClient => - (TestSceneMultiplayerGameplayLeaderboard.TestMultiplayerSpectatorClient)OnlinePlayDependencies?.SpectatorClient; - - protected override OnlinePlayTestSceneDependencies CreateOnlinePlayDependencies() => new TestDependencies(); - - protected class TestDependencies : MultiplayerTestSceneDependencies + protected override MultiplayerRoomUser CreateUser(int i) { - protected override TestSpectatorClient CreateSpectatorClient() => new TestSceneMultiplayerGameplayLeaderboard.TestMultiplayerSpectatorClient(); + var user = base.CreateUser(i); + user.MatchState = new TeamVersusUserState + { + TeamID = RNG.Next(0, 2) + }; + return user; } - private MultiplayerGameplayLeaderboard leaderboard; - private GameplayMatchScoreDisplay gameplayScoreDisplay; - - protected override Room CreateRoom() - { - var room = base.CreateRoom(); - room.Type.Value = MatchType.TeamVersus; - return room; - } + protected override MultiplayerGameplayLeaderboard CreateLeaderboard(OsuScoreProcessor scoreProcessor) => + new MultiplayerGameplayLeaderboard(Ruleset.Value, scoreProcessor, MultiplayerUsers.ToArray()) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }; public override void SetUpSteps() { base.SetUpSteps(); - AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = UserLookupCache.GetUserAsync(1).GetResultSafely()); - - AddStep("create leaderboard", () => + AddStep("Add external display components", () => { - leaderboard?.Expire(); - - OsuScoreProcessor scoreProcessor; - Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value); - - var playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value); - var multiplayerUsers = new List(); - - foreach (int user in users) + LoadComponentAsync(new MatchScoreDisplay { - SpectatorClient.SendStartPlay(user, Beatmap.Value.BeatmapInfo.OnlineID); - var roomUser = OnlinePlayDependencies.MultiplayerClient.AddUser(new APIUser { Id = user }, true); + Team1Score = { BindTarget = Leaderboard.TeamScores[0] }, + Team2Score = { BindTarget = Leaderboard.TeamScores[1] } + }, Add); - roomUser.MatchState = new TeamVersusUserState - { - TeamID = RNG.Next(0, 2) - }; - - multiplayerUsers.Add(roomUser); - } - - Children = new Drawable[] + LoadComponentAsync(new GameplayMatchScoreDisplay { - scoreProcessor = new OsuScoreProcessor(), - }; - - scoreProcessor.ApplyBeatmap(playableBeatmap); - - LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(Ruleset.Value, scoreProcessor, multiplayerUsers.ToArray()) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }, gameplayLeaderboard => - { - LoadComponentAsync(new MatchScoreDisplay - { - Team1Score = { BindTarget = leaderboard.TeamScores[0] }, - Team2Score = { BindTarget = leaderboard.TeamScores[1] } - }, Add); - - LoadComponentAsync(gameplayScoreDisplay = new GameplayMatchScoreDisplay - { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - Team1Score = { BindTarget = leaderboard.TeamScores[0] }, - Team2Score = { BindTarget = leaderboard.TeamScores[1] } - }, Add); - - Add(gameplayLeaderboard); - }); - }); - - AddUntilStep("wait for load", () => leaderboard.IsLoaded); - AddUntilStep("wait for user population", () => MultiplayerClient.CurrentMatchPlayingUserIds.Count > 0); - } - - [Test] - public void TestScoreUpdates() - { - AddRepeatStep("update state", () => SpectatorClient.RandomlyUpdateState(), 100); - AddToggleStep("switch compact mode", expanded => - { - leaderboard.Expanded.Value = expanded; - gameplayScoreDisplay.Expanded.Value = expanded; + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Team1Score = { BindTarget = Leaderboard.TeamScores[0] }, + Team2Score = { BindTarget = Leaderboard.TeamScores[1] } + }, Add); }); } } From 6a61fd95eb3e5b0b6bfdab55c8ed78b89ce9025c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Apr 2022 19:19:45 +0900 Subject: [PATCH 0188/2328] Tidy up base implementation --- ...MultiplayerGameplayLeaderboardTestScene.cs | 21 +++++++++---------- ...ceneMultiplayerGameplayLeaderboardTeams.cs | 4 ++-- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs index eb15282f75..7c8a61b231 100644 --- a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs +++ b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs @@ -28,10 +28,15 @@ namespace osu.Game.Tests.Visual.Multiplayer public abstract class MultiplayerGameplayLeaderboardTestScene : OsuTestScene { protected readonly BindableList MultiplayerUsers = new BindableList(); - private readonly BindableList multiplayerUserIds = new BindableList(); protected MultiplayerGameplayLeaderboard Leaderboard { get; private set; } + protected virtual MultiplayerRoomUser CreateUser(int userId) => new MultiplayerRoomUser(userId); + + protected abstract MultiplayerGameplayLeaderboard CreateLeaderboard(OsuScoreProcessor scoreProcessor); + + private readonly BindableList multiplayerUserIds = new BindableList(); + private OsuConfigManager config; private readonly Mock spectatorClient = new Mock(); @@ -81,7 +86,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = new APIUser { - Username = "local", + Id = 1, }); AddStep("populate users", () => @@ -95,25 +100,19 @@ namespace osu.Game.Tests.Visual.Multiplayer { Leaderboard?.Expire(); - OsuScoreProcessor scoreProcessor; Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value); - var playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value); - - Child = scoreProcessor = new OsuScoreProcessor(); - + OsuScoreProcessor scoreProcessor = new OsuScoreProcessor(); scoreProcessor.ApplyBeatmap(playableBeatmap); + Child = scoreProcessor; + LoadComponentAsync(Leaderboard = CreateLeaderboard(scoreProcessor), Add); }); AddUntilStep("wait for load", () => Leaderboard.IsLoaded); } - protected virtual MultiplayerRoomUser CreateUser(int i) => new MultiplayerRoomUser(i); - - protected abstract MultiplayerGameplayLeaderboard CreateLeaderboard(OsuScoreProcessor scoreProcessor); - [Test] public void TestScoreUpdates() { diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs index 56a4f053c5..b37ba470ed 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs @@ -14,9 +14,9 @@ namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneMultiplayerGameplayLeaderboardTeams : MultiplayerGameplayLeaderboardTestScene { - protected override MultiplayerRoomUser CreateUser(int i) + protected override MultiplayerRoomUser CreateUser(int userId) { - var user = base.CreateUser(i); + var user = base.CreateUser(userId); user.MatchState = new TeamVersusUserState { TeamID = RNG.Next(0, 2) From 09d560c93e7a04f7fa9389ba68678c13b76a6f7c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Apr 2022 19:27:14 +0900 Subject: [PATCH 0189/2328] Add test coverage of spectator requests --- .../MultiplayerGameplayLeaderboardTestScene.cs | 14 ++++++++++++++ osu.Game/Online/Spectator/SpectatorClient.cs | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs index 7c8a61b231..98e6cd514b 100644 --- a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs +++ b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs @@ -84,6 +84,8 @@ namespace osu.Game.Tests.Visual.Multiplayer [SetUpSteps] public virtual void SetUpSteps() { + AddStep("reset counts", () => spectatorClient.Invocations.Clear()); + AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = new APIUser { Id = 1, @@ -111,6 +113,12 @@ namespace osu.Game.Tests.Visual.Multiplayer }); AddUntilStep("wait for load", () => Leaderboard.IsLoaded); + + AddStep("check watch requests were sent", () => + { + foreach (var user in MultiplayerUsers) + spectatorClient.Verify(s => s.WatchUser(user.UserID), Times.Once); + }); } [Test] @@ -131,6 +139,12 @@ namespace osu.Game.Tests.Visual.Multiplayer MultiplayerUsers.RemoveAt(0); return false; }); + + AddStep("check stop watching requests were sent", () => + { + foreach (var user in MultiplayerUsers) + spectatorClient.Verify(s => s.StopWatchingUser(user.UserID), Times.Once); + }); } [Test] diff --git a/osu.Game/Online/Spectator/SpectatorClient.cs b/osu.Game/Online/Spectator/SpectatorClient.cs index 138e8ac7d6..78beda6298 100644 --- a/osu.Game/Online/Spectator/SpectatorClient.cs +++ b/osu.Game/Online/Spectator/SpectatorClient.cs @@ -221,7 +221,7 @@ namespace osu.Game.Online.Spectator }); } - public void WatchUser(int userId) + public virtual void WatchUser(int userId) { Debug.Assert(ThreadSafety.IsUpdateThread); From 01cec7d3fb0e11f8e8f0b55a4ad509b6f6865a8e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Apr 2022 19:37:01 +0900 Subject: [PATCH 0190/2328] Remove unnecessary string literals --- osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs index 5ec9c6c474..b90bd93002 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs @@ -34,7 +34,7 @@ namespace osu.Game.Tests.Visual.Gameplay BeatmapInfo = { AudioLeadIn = leadIn } }); - AddStep($"check first frame time", () => + AddStep("check first frame time", () => { Assert.That(player.FirstFrameClockTime, Is.Not.Null); Assert.That(player.FirstFrameClockTime.Value, Is.EqualTo(expectedStartTime).Within(lenience_ms)); @@ -57,7 +57,7 @@ namespace osu.Game.Tests.Visual.Gameplay loadPlayerWithBeatmap(new TestBeatmap(new OsuRuleset().RulesetInfo), storyboard); - AddStep($"check first frame time", () => + AddStep("check first frame time", () => { Assert.That(player.FirstFrameClockTime, Is.Not.Null); Assert.That(player.FirstFrameClockTime.Value, Is.EqualTo(expectedStartTime).Within(lenience_ms)); @@ -95,7 +95,7 @@ namespace osu.Game.Tests.Visual.Gameplay loadPlayerWithBeatmap(new TestBeatmap(new OsuRuleset().RulesetInfo), storyboard); - AddStep($"check first frame time", () => + AddStep("check first frame time", () => { Assert.That(player.FirstFrameClockTime, Is.Not.Null); Assert.That(player.FirstFrameClockTime.Value, Is.EqualTo(expectedStartTime).Within(lenience_ms)); From 4ab6c1107905210e10ea4286521bac7fb4d14550 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Apr 2022 23:57:15 +0900 Subject: [PATCH 0191/2328] Add failing test coverage of skin import after exporting from lazer --- osu.Game.Tests/Skins/IO/ImportSkinTest.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/osu.Game.Tests/Skins/IO/ImportSkinTest.cs b/osu.Game.Tests/Skins/IO/ImportSkinTest.cs index 9b0facd625..dde8715764 100644 --- a/osu.Game.Tests/Skins/IO/ImportSkinTest.cs +++ b/osu.Game.Tests/Skins/IO/ImportSkinTest.cs @@ -11,6 +11,7 @@ using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Platform; using osu.Game.Database; +using osu.Game.Extensions; using osu.Game.IO; using osu.Game.IO.Archives; using osu.Game.Skinning; @@ -110,6 +111,27 @@ namespace osu.Game.Tests.Skins.IO assertImportedOnce(import1, import2); }); + [Test] + public Task TestImportExportedSkinFilename() => runSkinTest(async osu => + { + MemoryStream exportStream = new MemoryStream(); + + var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("name 1", "author 1"), "custom.osk")); + assertCorrectMetadata(import1, "name 1 [custom]", "author 1", osu); + + import1.PerformRead(s => + { + new LegacySkinExporter(osu.Dependencies.Get()).ExportModelTo(s, exportStream); + }); + + string exportFilename = import1.GetDisplayString(); + + var import2 = await loadSkinIntoOsu(osu, new ZipArchiveReader(exportStream, $"{exportFilename}.osk")); + assertCorrectMetadata(import2, "name 1 [custom]", "author 1", osu); + + assertImportedOnce(import1, import2); + }); + [Test] public Task TestSameMetadataNameSameFolderName() => runSkinTest(async osu => { From 82939b05567eea3dd6ccd2773f4139cd5e9af250 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Apr 2022 23:57:27 +0900 Subject: [PATCH 0192/2328] Fix skins getting duplicated when importing after export Closes #17614. --- osu.Game/Skinning/SkinModelManager.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Skinning/SkinModelManager.cs b/osu.Game/Skinning/SkinModelManager.cs index 33e49ce486..23813e8eb2 100644 --- a/osu.Game/Skinning/SkinModelManager.cs +++ b/osu.Game/Skinning/SkinModelManager.cs @@ -104,7 +104,9 @@ namespace osu.Game.Skinning // For imports, we want to use the archive or folder name as part of the metadata, in addition to any existing skin.ini metadata. // In an ideal world, skin.ini would be the only source of metadata, but a lot of skin creators and users don't update it when making modifications. // In both of these cases, the expectation from the user is that the filename or folder name is displayed somewhere to identify the skin. - if (archiveName != item.Name) + if (archiveName != item.Name + // lazer exports use this format + && archiveName != item.GetDisplayString()) item.Name = @$"{item.Name} [{archiveName}]"; } From 74dfa79f17c36949189e247b4ab9cdd0aaa8b949 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 11 Apr 2022 20:50:19 +0300 Subject: [PATCH 0193/2328] Add failing test case --- .../UserInterface/TestScenePopupDialog.cs | 46 ++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestScenePopupDialog.cs b/osu.Game.Tests/Visual/UserInterface/TestScenePopupDialog.cs index 6bd6115e68..b5f2544071 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestScenePopupDialog.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestScenePopupDialog.cs @@ -4,25 +4,58 @@ using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; +using osu.Framework.Testing; using osu.Game.Overlays.Dialog; +using osuTK; +using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface { - [TestFixture] - public class TestScenePopupDialog : OsuTestScene + public class TestScenePopupDialog : OsuManualInputManagerTestScene { - public TestScenePopupDialog() + private TestPopupDialog dialog; + + [SetUpSteps] + public void SetUpSteps() { AddStep("new popup", () => - Add(new TestPopupDialog + { + Add(dialog = new TestPopupDialog { RelativeSizeAxes = Axes.Both, State = { Value = Framework.Graphics.Containers.Visibility.Visible }, - })); + }); + }); + } + + [Test] + public void TestDangerousButton([Values(false, true)] bool atEdge) + { + if (atEdge) + { + AddStep("move mouse to button edge", () => + { + var dangerousButtonQuad = dialog.DangerousButton.ScreenSpaceDrawQuad; + InputManager.MoveMouseTo(new Vector2(dangerousButtonQuad.TopLeft.X + 5, dangerousButtonQuad.Centre.Y)); + }); + } + else + AddStep("move mouse to button", () => InputManager.MoveMouseTo(dialog.DangerousButton)); + + AddStep("click button", () => InputManager.Click(MouseButton.Left)); + AddAssert("action not invoked", () => !dialog.DangerousButtonInvoked); + + AddStep("hold button", () => InputManager.PressButton(MouseButton.Left)); + AddUntilStep("action invoked", () => dialog.DangerousButtonInvoked); + AddStep("release button", () => InputManager.ReleaseButton(MouseButton.Left)); } private class TestPopupDialog : PopupDialog { + public PopupDialogDangerousButton DangerousButton { get; } + + public bool DangerousButtonInvoked; + public TestPopupDialog() { Icon = FontAwesome.Solid.AssistiveListeningSystems; @@ -40,9 +73,10 @@ namespace osu.Game.Tests.Visual.UserInterface { Text = @"You're a fake!", }, - new PopupDialogDangerousButton + DangerousButton = new PopupDialogDangerousButton { Text = @"Careful with this one..", + Action = () => DangerousButtonInvoked = true, }, }; } From bad30d9e602537a6e2afbfb41333d89d9235a4c4 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 11 Apr 2022 21:05:37 +0300 Subject: [PATCH 0194/2328] Fix dialog dangerous button being clickable at edges --- .../Dialog/PopupDialogDangerousButton.cs | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs index 1911a4fa56..adc627e15b 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs @@ -12,37 +12,38 @@ namespace osu.Game.Overlays.Dialog { public class PopupDialogDangerousButton : PopupDialogButton { + private Box progressBox; + private DangerousConfirmContainer confirmContainer; + [BackgroundDependencyLoader] private void load(OsuColour colours) { ButtonColour = colours.Red3; - ColourContainer.Add(new ConfirmFillBox + ColourContainer.Add(progressBox = new Box { - Action = () => Action(), RelativeSizeAxes = Axes.Both, Blending = BlendingParameters.Additive, }); + + AddInternal(confirmContainer = new DangerousConfirmContainer + { + Action = () => Action(), + RelativeSizeAxes = Axes.Both, + }); } - private class ConfirmFillBox : HoldToConfirmContainer + protected override void LoadComplete() { - private Box box; + base.LoadComplete(); + confirmContainer.Progress.BindValueChanged(progress => progressBox.Width = (float)progress.NewValue, true); + } + + private class DangerousConfirmContainer : HoldToConfirmContainer + { protected override double? HoldActivationDelay => 500; - protected override void LoadComplete() - { - base.LoadComplete(); - - Child = box = new Box - { - RelativeSizeAxes = Axes.Both, - }; - - Progress.BindValueChanged(progress => box.Width = (float)progress.NewValue, true); - } - protected override bool OnMouseDown(MouseDownEvent e) { BeginConfirm(); From a0e3a2102acd70cf3fc24e35bd70c647d7d40db3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Apr 2022 10:49:57 +0900 Subject: [PATCH 0195/2328] Also expand match score component when leaderboard is (in test) --- .../TestSceneMultiplayerGameplayLeaderboardTeams.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs index b37ba470ed..5cd3bb2f0f 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs @@ -48,7 +48,8 @@ namespace osu.Game.Tests.Visual.Multiplayer Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Team1Score = { BindTarget = Leaderboard.TeamScores[0] }, - Team2Score = { BindTarget = Leaderboard.TeamScores[1] } + Team2Score = { BindTarget = Leaderboard.TeamScores[1] }, + Expanded = { BindTarget = Leaderboard.Expanded }, }, Add); }); } From ebee9e68886925a368e87596c0e68d03c3fe025f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Apr 2022 11:04:53 +0900 Subject: [PATCH 0196/2328] Fix `MultiplayerGameplayLeaderboard` not immediately updating totals on scoring mode change --- osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs index 4f5edab526..d0726248aa 100644 --- a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs +++ b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs @@ -75,7 +75,10 @@ namespace osu.Game.Screens.Play.HUD foreach (var user in playingUsers) { var trackedUser = CreateUserData(user, ruleset, scoreProcessor); + trackedUser.ScoringMode.BindTo(scoringMode); + trackedUser.Score.BindValueChanged(_ => Scheduler.AddOnce(updateTotals)); + UserScores[user.UserID] = trackedUser; if (trackedUser.Team is int team && !TeamScores.ContainsKey(team)) @@ -175,8 +178,6 @@ namespace osu.Game.Screens.Play.HUD trackedData.Frames.Add(new TimedFrame(bundle.Frames.First().Time, bundle.Header)); trackedData.UpdateScore(); - - updateTotals(); }); private void updateTotals() From 577e29351ef5cf6e64336572b71a35214d94a1c6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Apr 2022 11:46:21 +0900 Subject: [PATCH 0197/2328] Ensure players are always on both leaderboard teams In a very rare case, the randomisation may cause all users to be on one team, causing a test failure. The odds make it basically impossible, but if adjusting the number of users in the test scene this can more readily be hit. --- .../TestSceneMultiplayerGameplayLeaderboardTeams.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs index 5cd3bb2f0f..5caab9487e 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs @@ -3,7 +3,6 @@ using System.Linq; using osu.Framework.Graphics; -using osu.Framework.Utils; using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus; using osu.Game.Rulesets.Osu.Scoring; @@ -14,12 +13,14 @@ namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneMultiplayerGameplayLeaderboardTeams : MultiplayerGameplayLeaderboardTestScene { + private int team; + protected override MultiplayerRoomUser CreateUser(int userId) { var user = base.CreateUser(userId); user.MatchState = new TeamVersusUserState { - TeamID = RNG.Next(0, 2) + TeamID = team++ % 2 }; return user; } From 0ba95a448306c888163b442a2c8bb8c6b3768c23 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Apr 2022 11:54:30 +0900 Subject: [PATCH 0198/2328] Ensure all users are shown on leaderboard (even when API lookup fails) --- .../Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs index d0726248aa..11498a02cd 100644 --- a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs +++ b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs @@ -89,10 +89,13 @@ namespace osu.Game.Screens.Play.HUD { var users = task.GetResultSafely(); - foreach (var user in users) + for (int i = 0; i < users.Length; i++) { - if (user == null) - continue; + var user = users[i] ??= new APIUser + { + Id = playingUsers[i].UserID, + Username = "Unknown user", + }; var trackedUser = UserScores[user.Id]; From f29e32970003986caf7297139b3fa3c57c6f7a2d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Apr 2022 12:11:51 +0900 Subject: [PATCH 0199/2328] Move user count to a constant to allow easier adjustment --- .../Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs index 98e6cd514b..ab187a2f76 100644 --- a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs +++ b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs @@ -27,6 +27,8 @@ namespace osu.Game.Tests.Visual.Multiplayer { public abstract class MultiplayerGameplayLeaderboardTestScene : OsuTestScene { + private const int total_users = 16; + protected readonly BindableList MultiplayerUsers = new BindableList(); protected MultiplayerGameplayLeaderboard Leaderboard { get; private set; } @@ -94,7 +96,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("populate users", () => { MultiplayerUsers.Clear(); - for (int i = 0; i < 16; i++) + for (int i = 0; i < total_users; i++) MultiplayerUsers.Add(CreateUser(i)); }); From 22c75a518ed4fd35f59eaa0fa1a98a4f404b1b53 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Apr 2022 12:38:15 +0900 Subject: [PATCH 0200/2328] Fix headers not getting reset on re-run of test --- .../Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs index ab187a2f76..4e6342868a 100644 --- a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs +++ b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs @@ -86,7 +86,11 @@ namespace osu.Game.Tests.Visual.Multiplayer [SetUpSteps] public virtual void SetUpSteps() { - AddStep("reset counts", () => spectatorClient.Invocations.Clear()); + AddStep("reset counts", () => + { + spectatorClient.Invocations.Clear(); + lastHeaders.Clear(); + }); AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = new APIUser { From 0e1d17d1d191f87bcff7c324b9ad7a2da5de0b37 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 12 Apr 2022 13:11:22 +0900 Subject: [PATCH 0201/2328] Use zh-Hant instead of zh-TW --- osu.Game/Localisation/Language.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Localisation/Language.cs b/osu.Game/Localisation/Language.cs index dc1fac47a8..ab96d01c82 100644 --- a/osu.Game/Localisation/Language.cs +++ b/osu.Game/Localisation/Language.cs @@ -110,6 +110,6 @@ namespace osu.Game.Localisation // zh_hk, [Description(@"繁體中文(台灣)")] - zh_tw + zh_hant } } From 8b1cee75faa0b855d29a4d288f773d03cba348b3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Apr 2022 14:13:07 +0900 Subject: [PATCH 0202/2328] Use `BindableLong` instead of `BindableInt` for user score tracking --- .../Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs | 6 +++--- .../OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs | 4 ++-- osu.Game/Screens/Play/HUD/MatchScoreDisplay.cs | 6 +++--- osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs index bdc348b043..bcb36a585f 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs @@ -26,10 +26,10 @@ namespace osu.Game.Tests.Visual.Multiplayer var beatmapInfo = CreateBeatmap(rulesetInfo).BeatmapInfo; var score = TestResources.CreateTestScoreInfo(beatmapInfo); - SortedDictionary teamScores = new SortedDictionary + SortedDictionary teamScores = new SortedDictionary { - { 0, new BindableInt(team1Score) }, - { 1, new BindableInt(team2Score) } + { 0, new BindableLong(team1Score) }, + { 1, new BindableLong(team2Score) } }; Stack.Push(screen = new MultiplayerTeamResultsScreen(score, 1, new PlaylistItem(beatmapInfo), teamScores)); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs index 14a779dedf..3f0f3e043c 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs @@ -24,12 +24,12 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer { public class MultiplayerTeamResultsScreen : MultiplayerResultsScreen { - private readonly SortedDictionary teamScores; + private readonly SortedDictionary teamScores; private Container winnerBackground; private Drawable winnerText; - public MultiplayerTeamResultsScreen(ScoreInfo score, long roomId, PlaylistItem playlistItem, SortedDictionary teamScores) + public MultiplayerTeamResultsScreen(ScoreInfo score, long roomId, PlaylistItem playlistItem, SortedDictionary teamScores) : base(score, roomId, playlistItem) { if (teamScores.Count != 2) diff --git a/osu.Game/Screens/Play/HUD/MatchScoreDisplay.cs b/osu.Game/Screens/Play/HUD/MatchScoreDisplay.cs index 88cf9529bf..2129000268 100644 --- a/osu.Game/Screens/Play/HUD/MatchScoreDisplay.cs +++ b/osu.Game/Screens/Play/HUD/MatchScoreDisplay.cs @@ -19,8 +19,8 @@ namespace osu.Game.Screens.Play.HUD private const float bar_height = 18; private const float font_size = 50; - public BindableInt Team1Score = new BindableInt(); - public BindableInt Team2Score = new BindableInt(); + public BindableLong Team1Score = new BindableLong(); + public BindableLong Team2Score = new BindableLong(); protected MatchScoreCounter Score1Text; protected MatchScoreCounter Score2Text; @@ -133,7 +133,7 @@ namespace osu.Game.Screens.Play.HUD var winningBar = Team1Score.Value > Team2Score.Value ? score1Bar : score2Bar; var losingBar = Team1Score.Value <= Team2Score.Value ? score1Bar : score2Bar; - int diff = Math.Max(Team1Score.Value, Team2Score.Value) - Math.Min(Team1Score.Value, Team2Score.Value); + long diff = Math.Max(Team1Score.Value, Team2Score.Value) - Math.Min(Team1Score.Value, Team2Score.Value); losingBar.ResizeWidthTo(0, 400, Easing.OutQuint); winningBar.ResizeWidthTo(Math.Min(0.4f, MathF.Pow(diff / 1500000f, 0.5f) / 2), 400, Easing.OutQuint); diff --git a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs index 11498a02cd..e569e5368b 100644 --- a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs +++ b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Play.HUD { protected readonly Dictionary UserScores = new Dictionary(); - public readonly SortedDictionary TeamScores = new SortedDictionary(); + public readonly SortedDictionary TeamScores = new SortedDictionary(); [Resolved] private OsuColour colours { get; set; } @@ -82,7 +82,7 @@ namespace osu.Game.Screens.Play.HUD UserScores[user.UserID] = trackedUser; if (trackedUser.Team is int team && !TeamScores.ContainsKey(team)) - TeamScores.Add(team, new BindableInt()); + TeamScores.Add(team, new BindableLong()); } userLookupCache.GetUsersAsync(playingUsers.Select(u => u.UserID).ToArray()).ContinueWith(task => Schedule(() => From 45d79c1a737a8e6128e1ce631b5e37185fd48d9f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Apr 2022 18:01:29 +0900 Subject: [PATCH 0203/2328] Ensure previous test score is cleaned up to allow visual test runs to work better --- .../Gameplay/TestSceneReplayDownloadButton.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs index 5d25287e45..e89350de1a 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs @@ -26,6 +26,8 @@ namespace osu.Game.Tests.Visual.Gameplay [TestFixture] public class TestSceneReplayDownloadButton : OsuManualInputManagerTestScene { + private const long online_score_id = 2553163309; + [Resolved] private RulesetStore rulesets { get; set; } @@ -43,6 +45,15 @@ namespace osu.Game.Tests.Visual.Gameplay beatmapManager.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely(); } + [SetUpSteps] + public void SetUpSteps() + { + AddStep("delete previous imports", () => + { + scoreManager.Delete(s => s.OnlineID == online_score_id); + }); + } + [Test] public void TestDisplayStates() { @@ -180,7 +191,7 @@ namespace osu.Game.Tests.Visual.Gameplay { return new APIScore { - OnlineID = 2553163309, + OnlineID = online_score_id, RulesetID = 0, Beatmap = CreateAPIBeatmapSet(new OsuRuleset().RulesetInfo).Beatmaps.First(), HasReplay = replayAvailable, From b51abfc72220646e1af51663fdc317bf58b0b3bd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Apr 2022 18:01:13 +0900 Subject: [PATCH 0204/2328] Fix `ScoreDownloadTracker` matching on empty hash equality --- osu.Game/Online/ScoreDownloadTracker.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/ScoreDownloadTracker.cs b/osu.Game/Online/ScoreDownloadTracker.cs index d7e31c8a59..ed1c566dbe 100644 --- a/osu.Game/Online/ScoreDownloadTracker.cs +++ b/osu.Game/Online/ScoreDownloadTracker.cs @@ -47,7 +47,10 @@ namespace osu.Game.Online Downloader.DownloadBegan += downloadBegan; Downloader.DownloadFailed += downloadFailed; - realmSubscription = realm.RegisterForNotifications(r => r.All().Where(s => ((s.OnlineID > 0 && s.OnlineID == TrackedItem.OnlineID) || s.Hash == TrackedItem.Hash) && !s.DeletePending), (items, changes, ___) => + realmSubscription = realm.RegisterForNotifications(r => r.All().Where(s => + ((s.OnlineID > 0 && s.OnlineID == TrackedItem.OnlineID) + || (!string.IsNullOrEmpty(s.Hash) && s.Hash == TrackedItem.Hash)) + && !s.DeletePending), (items, changes, ___) => { if (items.Any()) Schedule(() => UpdateState(DownloadState.LocallyAvailable)); From 6dbfc261585fd239e8b7b13a6f400938f581e238 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Apr 2022 18:07:55 +0900 Subject: [PATCH 0205/2328] Add log output when a model is undeleted --- osu.Game/Stores/RealmArchiveModelImporter.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Stores/RealmArchiveModelImporter.cs b/osu.Game/Stores/RealmArchiveModelImporter.cs index 1d0e16d549..353a2164bb 100644 --- a/osu.Game/Stores/RealmArchiveModelImporter.cs +++ b/osu.Game/Stores/RealmArchiveModelImporter.cs @@ -389,7 +389,10 @@ namespace osu.Game.Stores LogForModel(item, @$"Found existing {HumanisedModelName} for {item} (ID {existing.ID}) – skipping import."); if (existing.DeletePending) + { + LogForModel(item, $@"Existing {HumanisedModelName}'s deletion flag has been removed"); UndeleteForReuse(existing); + } transaction.Commit(); From 20eca9bf6a3b7cde91545a85b58648f72fda7ac2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Apr 2022 19:26:02 +0900 Subject: [PATCH 0206/2328] Refactor `TestSceneRankRangePill` to not depend on `TestMultiplayerClient` --- .../Multiplayer/TestSceneRankRangePill.cs | 76 ++++++++++--------- .../Online/Multiplayer/MultiplayerClient.cs | 4 +- 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs index f95e73ff3c..b758c83a0a 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs @@ -1,67 +1,68 @@ // 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.Linq; +using Moq; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Online.Multiplayer; +using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Lounge.Components; namespace osu.Game.Tests.Visual.Multiplayer { - public class TestSceneRankRangePill : MultiplayerTestScene + public class TestSceneRankRangePill : OsuTestScene { - [SetUp] - public new void Setup() => Schedule(() => + private readonly Mock multiplayerClient = new Mock(); + + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => + // not used but required by the component. + new CachedModelDependencyContainer(base.CreateChildDependencies(parent)); + + [BackgroundDependencyLoader] + private void load() { + Dependencies.CacheAs(multiplayerClient.Object); + Child = new RankRangePill { Anchor = Anchor.Centre, Origin = Anchor.Centre }; - }); + } [Test] public void TestSingleUser() { - AddStep("add user", () => + setupRoomWithUsers(new APIUser { - MultiplayerClient.AddUser(new APIUser - { - Id = 2, - Statistics = { GlobalRank = 1234 } - }); - - // Remove the local user so only the one above is displayed. - MultiplayerClient.RemoveUser(API.LocalUser.Value); + Id = 2, + Statistics = { GlobalRank = 1234 } }); } [Test] public void TestMultipleUsers() { - AddStep("add users", () => - { - MultiplayerClient.AddUser(new APIUser + setupRoomWithUsers( + new APIUser { Id = 2, Statistics = { GlobalRank = 1234 } - }); - - MultiplayerClient.AddUser(new APIUser + }, + new APIUser { Id = 3, Statistics = { GlobalRank = 3333 } - }); - - MultiplayerClient.AddUser(new APIUser + }, + new APIUser { Id = 4, Statistics = { GlobalRank = 4321 } }); - - // Remove the local user so only the ones above are displayed. - MultiplayerClient.RemoveUser(API.LocalUser.Value); - }); } [TestCase(1, 10)] @@ -73,22 +74,29 @@ namespace osu.Game.Tests.Visual.Multiplayer [TestCase(1000000, 10000000)] public void TestRange(int min, int max) { - AddStep("add users", () => - { - MultiplayerClient.AddUser(new APIUser + setupRoomWithUsers( + new APIUser { Id = 2, Statistics = { GlobalRank = min } - }); - - MultiplayerClient.AddUser(new APIUser + }, + new APIUser { Id = 3, Statistics = { GlobalRank = max } }); + } - // Remove the local user so only the ones above are displayed. - MultiplayerClient.RemoveUser(API.LocalUser.Value); + private void setupRoomWithUsers(params APIUser[] users) + { + AddStep("setup room", () => + { + multiplayerClient.SetupGet(m => m.Room).Returns(new MultiplayerRoom(0) + { + Users = new List(users.Select(apiUser => new MultiplayerRoomUser(apiUser.Id) { User = apiUser })) + }); + + multiplayerClient.Raise(m => m.RoomUpdated -= null); }); } } diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index 18db710cee..4c10949225 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -32,7 +32,7 @@ namespace osu.Game.Online.Multiplayer /// /// Invoked when any change occurs to the multiplayer room. /// - public event Action? RoomUpdated; + public virtual event Action? RoomUpdated; /// /// Invoked when a new user joins the room. @@ -88,7 +88,7 @@ namespace osu.Game.Online.Multiplayer /// /// The joined . /// - public MultiplayerRoom? Room + public virtual MultiplayerRoom? Room { get { From bf677ad0ac8dc6383e5c249492f03d544becda9b Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 12 Apr 2022 20:28:14 +0800 Subject: [PATCH 0207/2328] Remove usages of BinaryFormatter. --- osu.Game/IO/Legacy/SerializationReader.cs | 91 +---------------------- osu.Game/IO/Legacy/SerializationWriter.cs | 11 +-- 2 files changed, 2 insertions(+), 100 deletions(-) diff --git a/osu.Game/IO/Legacy/SerializationReader.cs b/osu.Game/IO/Legacy/SerializationReader.cs index f7b3f33e87..64e25d5add 100644 --- a/osu.Game/IO/Legacy/SerializationReader.cs +++ b/osu.Game/IO/Legacy/SerializationReader.cs @@ -3,11 +3,8 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; -using System.Reflection; using System.Runtime.Serialization; -using System.Runtime.Serialization.Formatters.Binary; using System.Text; namespace osu.Game.IO.Legacy @@ -186,98 +183,12 @@ namespace osu.Game.IO.Legacy return ReadCharArray(); case ObjType.otherType: - return DynamicDeserializer.Deserialize(BaseStream); + throw new IOException("Deserialization of arbitrary type is not supported."); default: return null; } } - - public static class DynamicDeserializer - { - private static VersionConfigToNamespaceAssemblyObjectBinder versionBinder; - private static BinaryFormatter formatter; - - private static void initialize() - { - versionBinder = new VersionConfigToNamespaceAssemblyObjectBinder(); - formatter = new BinaryFormatter - { - // AssemblyFormat = FormatterAssemblyStyle.Simple, - Binder = versionBinder - }; - } - - public static object Deserialize(Stream stream) - { - if (formatter == null) - initialize(); - - Debug.Assert(formatter != null, "formatter != null"); - - // ReSharper disable once PossibleNullReferenceException - return formatter.Deserialize(stream); - } - - #region Nested type: VersionConfigToNamespaceAssemblyObjectBinder - - public sealed class VersionConfigToNamespaceAssemblyObjectBinder : SerializationBinder - { - private readonly Dictionary cache = new Dictionary(); - - public override Type BindToType(string assemblyName, string typeName) - { - if (cache.TryGetValue(assemblyName + typeName, out var typeToDeserialize)) - return typeToDeserialize; - - List tmpTypes = new List(); - Type genType = null; - - if (typeName.Contains("System.Collections.Generic") && typeName.Contains("[[")) - { - string[] splitTypes = typeName.Split('['); - - foreach (string typ in splitTypes) - { - if (typ.Contains("Version")) - { - string asmTmp = typ.Substring(typ.IndexOf(',') + 1); - string asmName = asmTmp.Remove(asmTmp.IndexOf(']')).Trim(); - string typName = typ.Remove(typ.IndexOf(',')); - tmpTypes.Add(BindToType(asmName, typName)); - } - else if (typ.Contains("Generic")) - { - genType = BindToType(assemblyName, typ); - } - } - - if (genType != null && tmpTypes.Count > 0) - { - return genType.MakeGenericType(tmpTypes.ToArray()); - } - } - - string toAssemblyName = assemblyName.Split(',')[0]; - Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); - - foreach (Assembly a in assemblies) - { - if (a.FullName.Split(',')[0] == toAssemblyName) - { - typeToDeserialize = a.GetType(typeName); - break; - } - } - - cache.Add(assemblyName + typeName, typeToDeserialize); - - return typeToDeserialize; - } - } - - #endregion - } } public enum ObjType : byte diff --git a/osu.Game/IO/Legacy/SerializationWriter.cs b/osu.Game/IO/Legacy/SerializationWriter.cs index 9ebeaf616e..6dfb21e5bd 100644 --- a/osu.Game/IO/Legacy/SerializationWriter.cs +++ b/osu.Game/IO/Legacy/SerializationWriter.cs @@ -5,8 +5,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization; -using System.Runtime.Serialization.Formatters; -using System.Runtime.Serialization.Formatters.Binary; using System.Text; // ReSharper disable ConditionIsAlwaysTrueOrFalse (we're allowing nulls to be passed to the writer where the underlying class doesn't). @@ -218,14 +216,7 @@ namespace osu.Game.IO.Legacy break; default: - Write((byte)ObjType.otherType); - BinaryFormatter b = new BinaryFormatter - { - // AssemblyFormat = FormatterAssemblyStyle.Simple, - TypeFormat = FormatterTypeStyle.TypesWhenNeeded - }; - b.Serialize(BaseStream, obj); - break; + throw new IOException("Serialization of arbitrary type is not supported."); } // switch } // if obj==null } // WriteObject From 80e312dbbc5737e6d6c093a92961ace301b1482a Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 12 Apr 2022 20:29:13 +0800 Subject: [PATCH 0208/2328] Remove unused binary serialization related code. --- osu.Game/IO/Legacy/SerializationReader.cs | 10 ---------- osu.Game/IO/Legacy/SerializationWriter.cs | 8 -------- 2 files changed, 18 deletions(-) diff --git a/osu.Game/IO/Legacy/SerializationReader.cs b/osu.Game/IO/Legacy/SerializationReader.cs index 64e25d5add..5423485c95 100644 --- a/osu.Game/IO/Legacy/SerializationReader.cs +++ b/osu.Game/IO/Legacy/SerializationReader.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Runtime.Serialization; using System.Text; namespace osu.Game.IO.Legacy @@ -23,15 +22,6 @@ namespace osu.Game.IO.Legacy public int RemainingBytes => (int)(stream.Length - stream.Position); - /// Static method to take a SerializationInfo object (an input to an ISerializable constructor) - /// and produce a SerializationReader from which serialized objects can be read . - public static SerializationReader GetReader(SerializationInfo info) - { - byte[] byteArray = (byte[])info.GetValue("X", typeof(byte[])); - MemoryStream ms = new MemoryStream(byteArray); - return new SerializationReader(ms); - } - /// Reads a string from the buffer. Overrides the base implementation so it can cope with nulls. public override string ReadString() { diff --git a/osu.Game/IO/Legacy/SerializationWriter.cs b/osu.Game/IO/Legacy/SerializationWriter.cs index 6dfb21e5bd..c9fff05bcc 100644 --- a/osu.Game/IO/Legacy/SerializationWriter.cs +++ b/osu.Game/IO/Legacy/SerializationWriter.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Runtime.Serialization; using System.Text; // ReSharper disable ConditionIsAlwaysTrueOrFalse (we're allowing nulls to be passed to the writer where the underlying class doesn't). @@ -221,13 +220,6 @@ namespace osu.Game.IO.Legacy } // if obj==null } // WriteObject - /// Adds the SerializationWriter buffer to the SerializationInfo at the end of GetObjectData(). - public void AddToInfo(SerializationInfo info) - { - byte[] b = ((MemoryStream)BaseStream).ToArray(); - info.AddValue("X", b, typeof(byte[])); - } - public void WriteRawBytes(byte[] b) { base.Write(b); From 1ebbef88ec75034295826c319b2a42189e505804 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Apr 2022 22:56:48 +0900 Subject: [PATCH 0209/2328] Refactor `GameplayChatDisplay` test scene to not require `MultiplayerTestScene` inheritance --- .../Visual/Multiplayer/TestSceneGameplayChatDisplay.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneGameplayChatDisplay.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneGameplayChatDisplay.cs index 512d206a06..c3487751b9 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneGameplayChatDisplay.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneGameplayChatDisplay.cs @@ -9,13 +9,14 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; +using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Multiplayer; using osu.Game.Screens.Play; using osuTK.Input; namespace osu.Game.Tests.Visual.Multiplayer { - public class TestSceneGameplayChatDisplay : MultiplayerTestScene + public class TestSceneGameplayChatDisplay : OsuManualInputManagerTestScene { private GameplayChatDisplay chatDisplay; @@ -35,11 +36,9 @@ namespace osu.Game.Tests.Visual.Multiplayer } [SetUpSteps] - public override void SetUpSteps() + public void SetUpSteps() { - base.SetUpSteps(); - - AddStep("load chat display", () => Child = chatDisplay = new GameplayChatDisplay(SelectedRoom.Value) + AddStep("load chat display", () => Child = chatDisplay = new GameplayChatDisplay(new Room()) { Anchor = Anchor.Centre, Origin = Anchor.Centre, From ef7ab12b40c92c87c5cf2db5a57585efeec7466f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Apr 2022 23:01:37 +0900 Subject: [PATCH 0210/2328] Fix `MultiplayerMatchFooter` test crash due to missing `PopoverContainer` Clicking the countdown button would crash. I did consider removing the test altogether but maybe it'll be useful in the future? --- .../Visual/Multiplayer/TestSceneMultiplayerMatchFooter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchFooter.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchFooter.cs index 6536ef2ca1..ff834d71a1 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchFooter.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchFooter.cs @@ -3,7 +3,7 @@ using NUnit.Framework; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Game.Screens.OnlinePlay.Multiplayer.Match; namespace osu.Game.Tests.Visual.Multiplayer @@ -13,7 +13,7 @@ namespace osu.Game.Tests.Visual.Multiplayer [SetUp] public new void Setup() => Schedule(() => { - Child = new Container + Child = new PopoverContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, From 63e2a84d7f4784f8bb824b70509f6d57c0a8d0b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 12 Apr 2022 20:54:54 +0200 Subject: [PATCH 0211/2328] Nest one more container to fix popover not being dismissable --- .../Multiplayer/TestSceneMultiplayerMatchFooter.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchFooter.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchFooter.cs index ff834d71a1..111f51675d 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchFooter.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchFooter.cs @@ -3,6 +3,7 @@ using NUnit.Framework; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Game.Screens.OnlinePlay.Multiplayer.Match; @@ -17,9 +18,15 @@ namespace osu.Game.Tests.Visual.Multiplayer { Anchor = Anchor.Centre, Origin = Anchor.Centre, - RelativeSizeAxes = Axes.X, - Height = 50, - Child = new MultiplayerMatchFooter() + RelativeSizeAxes = Axes.Both, + Child = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Height = 50, + Child = new MultiplayerMatchFooter() + } }; }); } From d73be7f1773425012c69d1aa25ff9efe0f3138cb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 09:36:44 +0900 Subject: [PATCH 0212/2328] Reword comment to read clearer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs index b758c83a0a..b0a977dcbb 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs @@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.Multiplayer private readonly Mock multiplayerClient = new Mock(); protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => - // not used but required by the component. + // not used directly in component, but required due to it inheriting from OnlinePlayComposite. new CachedModelDependencyContainer(base.CreateChildDependencies(parent)); [BackgroundDependencyLoader] From 282fccb4c8842ff30cde671989a620303f4dc0f4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 12:24:47 +0900 Subject: [PATCH 0213/2328] Fix typo in xmldoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- osu.Game/Screens/Play/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 6ec21ef924..be19565657 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -610,7 +610,7 @@ namespace osu.Game.Screens.Play /// Specify and seek to a custom start time from which gameplay should be observed. /// /// - /// This performance a non-frame-stable seek. Intermediate hitobject judgements may not be applied or reverted correctly during this seek. + /// This performs a non-frame-stable seek. Intermediate hitobject judgements may not be applied or reverted correctly during this seek. /// /// The destination time to seek to. protected void SetGameplayStartTime(double time) From 017f3852c8a8354b08cb6a3f22a1624dea4b45db Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 13:32:34 +0900 Subject: [PATCH 0214/2328] Replace incorrectly chosen `??=` with `??` --- osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs index e569e5368b..41b40e9a91 100644 --- a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs +++ b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs @@ -91,7 +91,7 @@ namespace osu.Game.Screens.Play.HUD for (int i = 0; i < users.Length; i++) { - var user = users[i] ??= new APIUser + var user = users[i] ?? new APIUser { Id = playingUsers[i].UserID, Username = "Unknown user", From d4286255a094ac759e40e34c9be3aaa9caaf85b0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 13:49:58 +0900 Subject: [PATCH 0215/2328] Expose and set `GameplayStartTime` directly, rather than via `Reset` parameter --- .../Multiplayer/Spectate/MultiSpectatorScreen.cs | 3 ++- osu.Game/Screens/Play/GameplayClockContainer.cs | 8 ++------ osu.Game/Screens/Play/MasterGameplayClockContainer.cs | 4 ++-- osu.Game/Screens/Play/Player.cs | 3 ++- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs index 523301f4fd..2d03276fe5 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs @@ -197,7 +197,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate .DefaultIfEmpty(0) .Min(); - masterClockContainer.Reset(true, startTime); + masterClockContainer.StartTime = startTime; + masterClockContainer.Reset(true); // Although the clock has been started, this flag is set to allow for later synchronisation state changes to also be able to start it. canStartMasterClock = true; diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index f2df00d691..721abc66f8 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -48,7 +48,7 @@ namespace osu.Game.Screens.Play /// If not set, a value of zero will be used. /// Importantly, the value will be inferred from the current ruleset in unless specified. /// - protected double? StartTime { get; set; } + public double? StartTime { get; set; } /// /// Creates a new . @@ -116,12 +116,8 @@ namespace osu.Game.Screens.Play /// Resets this and the source to an initial state ready for gameplay. /// /// Whether to start the clock immediately, if not already started. - /// A time to use for future calls as the definite start of gameplay. - public void Reset(bool startClock = false, double? gameplayStartTime = null) + public void Reset(bool startClock = false) { - if (gameplayStartTime != null) - StartTime = gameplayStartTime; - // Manually stop the source in order to not affect the IsPaused state. AdjustableSource.Stop(); diff --git a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs index 54901746fc..88dc6db0f7 100644 --- a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs +++ b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs @@ -100,9 +100,9 @@ namespace osu.Game.Screens.Play bool isStarted = !IsPaused.Value; // If a custom start time was not specified, calculate the best value to use. - double gameplayStartTime = StartTime ?? findEarliestStartTime(); + StartTime ??= findEarliestStartTime(); - Reset(startClock: isStarted, gameplayStartTime: gameplayStartTime); + Reset(startClock: isStarted); } private double findEarliestStartTime() diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index be19565657..f99b07c313 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -621,7 +621,8 @@ namespace osu.Game.Screens.Play bool wasFrameStable = DrawableRuleset.FrameStablePlayback; DrawableRuleset.FrameStablePlayback = false; - GameplayClockContainer.Reset(gameplayStartTime: time); + GameplayClockContainer.StartTime = time; + GameplayClockContainer.Reset(); // Delay resetting frame-stable playback for one frame to give the FrameStabilityContainer a chance to seek. frameStablePlaybackResetDelegate = ScheduleAfterChildren(() => DrawableRuleset.FrameStablePlayback = wasFrameStable); From a59c6013c790f305d8567d98ec4e3a846c29fdeb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 14:03:52 +0900 Subject: [PATCH 0216/2328] Rename `latestGameplayStartTime` to `skipTargetTime` --- .../Play/MasterGameplayClockContainer.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs index 88dc6db0f7..61f31db435 100644 --- a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs +++ b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs @@ -58,7 +58,7 @@ namespace osu.Game.Screens.Play private IDisposable beatmapOffsetSubscription; - private readonly double latestGameplayStartTime; + private readonly double skipTargetTime; [Resolved] private RealmAccess realm { get; set; } @@ -70,17 +70,17 @@ namespace osu.Game.Screens.Play /// Create a new master gameplay clock container. /// /// The beatmap to be used for time and metadata references. - /// The latest time which should be used when introducing gameplay. Will be used when skipping forward. - /// Whether to start from the provided latest start time rather than zero. - public MasterGameplayClockContainer(WorkingBeatmap beatmap, double latestGameplayStartTime, bool startFromLatestStartTime = false) + /// The latest time which should be used when introducing gameplay. Will be used when skipping forward. + /// Whether to start from the provided latest start time rather than zero. + public MasterGameplayClockContainer(WorkingBeatmap beatmap, double skipTargetTime, bool startFromSkipTarget = false) : base(beatmap.Track) { this.beatmap = beatmap; - this.latestGameplayStartTime = latestGameplayStartTime; + this.skipTargetTime = skipTargetTime; - if (startFromLatestStartTime) - StartTime = latestGameplayStartTime; + if (startFromSkipTarget) + StartTime = skipTargetTime; } protected override void LoadComplete() @@ -111,7 +111,7 @@ namespace osu.Game.Screens.Play // generally this is either zero, or some point earlier than zero in the case of storyboards, lead-ins etc. // start with the originally provided latest time (if before zero). - double time = Math.Min(0, latestGameplayStartTime); + double time = Math.Min(0, skipTargetTime); // if a storyboard is present, it may dictate the appropriate start time by having events in negative time space. // this is commonly used to display an intro before the audio track start. @@ -183,10 +183,10 @@ namespace osu.Game.Screens.Play /// public void Skip() { - if (GameplayClock.CurrentTime > latestGameplayStartTime - MINIMUM_SKIP_TIME) + if (GameplayClock.CurrentTime > skipTargetTime - MINIMUM_SKIP_TIME) return; - double skipTarget = latestGameplayStartTime - MINIMUM_SKIP_TIME; + double skipTarget = skipTargetTime - MINIMUM_SKIP_TIME; if (GameplayClock.CurrentTime < 0 && skipTarget > 6000) // double skip exception for storyboards with very long intros From fbf0e5a45cf4f4f073126a717b35c6edf258c412 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 14:09:49 +0900 Subject: [PATCH 0217/2328] Remove `startFromSkipTarget` parameter and update usages that required said behaviour --- osu.Game.Tests/Gameplay/TestSceneStoryboardSamples.cs | 7 +++++-- .../Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs | 8 ++++---- osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs | 2 +- osu.Game/Screens/Play/MasterGameplayClockContainer.cs | 7 +------ 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Gameplay/TestSceneStoryboardSamples.cs b/osu.Game.Tests/Gameplay/TestSceneStoryboardSamples.cs index 76ec35d87d..e0a497cf24 100644 --- a/osu.Game.Tests/Gameplay/TestSceneStoryboardSamples.cs +++ b/osu.Game.Tests/Gameplay/TestSceneStoryboardSamples.cs @@ -88,7 +88,7 @@ namespace osu.Game.Tests.Gameplay [Test] public void TestSampleHasLifetimeEndWithInitialClockTime() { - GameplayClockContainer gameplayContainer = null; + MasterGameplayClockContainer gameplayContainer = null; DrawableStoryboardSample sample = null; AddStep("create container", () => @@ -96,8 +96,11 @@ namespace osu.Game.Tests.Gameplay var working = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo); working.LoadTrack(); - Add(gameplayContainer = new MasterGameplayClockContainer(working, 1000, true) + const double start_time = 1000; + + Add(gameplayContainer = new MasterGameplayClockContainer(working, start_time) { + StartTime = start_time, IsPaused = { Value = true }, Child = new FrameStabilityContainer { diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs index 653a35417e..703b526e8c 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs @@ -464,16 +464,16 @@ namespace osu.Game.Tests.Visual.Multiplayer private class TestMultiSpectatorScreen : MultiSpectatorScreen { - private readonly double? gameplayStartTime; + private readonly double? startTime; - public TestMultiSpectatorScreen(Room room, MultiplayerRoomUser[] users, double? gameplayStartTime = null) + public TestMultiSpectatorScreen(Room room, MultiplayerRoomUser[] users, double? startTime = null) : base(room, users) { - this.gameplayStartTime = gameplayStartTime; + this.startTime = startTime; } protected override MasterGameplayClockContainer CreateMasterGameplayClockContainer(WorkingBeatmap beatmap) - => new MasterGameplayClockContainer(beatmap, gameplayStartTime ?? 0, true); + => new MasterGameplayClockContainer(beatmap, 0) { StartTime = startTime ?? 0 }; } } } diff --git a/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs b/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs index f49603c754..d9e19df350 100644 --- a/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs +++ b/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.Edit.GameplayTest } protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart) - => new MasterGameplayClockContainer(beatmap, editorState.Time, true); + => new MasterGameplayClockContainer(beatmap, gameplayStart) { StartTime = editorState.Time }; protected override void LoadComplete() { diff --git a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs index 61f31db435..c5a5c14070 100644 --- a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs +++ b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs @@ -71,16 +71,11 @@ namespace osu.Game.Screens.Play /// /// The beatmap to be used for time and metadata references. /// The latest time which should be used when introducing gameplay. Will be used when skipping forward. - /// Whether to start from the provided latest start time rather than zero. - public MasterGameplayClockContainer(WorkingBeatmap beatmap, double skipTargetTime, bool startFromSkipTarget = false) + public MasterGameplayClockContainer(WorkingBeatmap beatmap, double skipTargetTime) : base(beatmap.Track) { this.beatmap = beatmap; - this.skipTargetTime = skipTargetTime; - - if (startFromSkipTarget) - StartTime = skipTargetTime; } protected override void LoadComplete() From 56427becbba54e042c167edf8c59b03e37136aba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 14:33:28 +0900 Subject: [PATCH 0218/2328] Move logging and early return into `UndeleteForReuse` method itself --- osu.Game/Stores/RealmArchiveModelImporter.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/osu.Game/Stores/RealmArchiveModelImporter.cs b/osu.Game/Stores/RealmArchiveModelImporter.cs index 353a2164bb..6d1449a4b4 100644 --- a/osu.Game/Stores/RealmArchiveModelImporter.cs +++ b/osu.Game/Stores/RealmArchiveModelImporter.cs @@ -351,8 +351,7 @@ namespace osu.Game.Stores using (var transaction = realm.BeginWrite()) { - if (existing.DeletePending) - UndeleteForReuse(existing); + UndeleteForReuse(existing); transaction.Commit(); } @@ -388,12 +387,7 @@ namespace osu.Game.Stores { LogForModel(item, @$"Found existing {HumanisedModelName} for {item} (ID {existing.ID}) – skipping import."); - if (existing.DeletePending) - { - LogForModel(item, $@"Existing {HumanisedModelName}'s deletion flag has been removed"); - UndeleteForReuse(existing); - } - + UndeleteForReuse(existing); transaction.Commit(); return existing.ToLive(Realm); @@ -539,6 +533,10 @@ namespace osu.Game.Stores /// The existing model. protected virtual void UndeleteForReuse(TModel existing) { + if (!existing.DeletePending) + return; + + LogForModel(existing, $@"Existing {HumanisedModelName}'s deletion flag has been removed to allow for reuse."); existing.DeletePending = false; } From 2bb0d9e6d3d52a4e9da8f7405a95cedc1a8cfe2d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 17:02:33 +0900 Subject: [PATCH 0219/2328] Expose required classes/properties for mocking --- osu.Game/Online/Multiplayer/MultiplayerClient.cs | 4 ++-- osu.Game/Online/Rooms/OnlinePlayBeatmapAvailabilityTracker.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index 4c10949225..e29aee2c6d 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -114,12 +114,12 @@ namespace osu.Game.Online.Multiplayer /// /// The corresponding to the local player, if available. /// - public MultiplayerRoomUser? LocalUser => Room?.Users.SingleOrDefault(u => u.User?.Id == API.LocalUser.Value.Id); + public virtual MultiplayerRoomUser? LocalUser => Room?.Users.SingleOrDefault(u => u.User?.Id == API.LocalUser.Value.Id); /// /// Whether the is the host in . /// - public bool IsHost + public virtual bool IsHost { get { diff --git a/osu.Game/Online/Rooms/OnlinePlayBeatmapAvailabilityTracker.cs b/osu.Game/Online/Rooms/OnlinePlayBeatmapAvailabilityTracker.cs index 07506ba1f0..4ca6d79b19 100644 --- a/osu.Game/Online/Rooms/OnlinePlayBeatmapAvailabilityTracker.cs +++ b/osu.Game/Online/Rooms/OnlinePlayBeatmapAvailabilityTracker.cs @@ -25,7 +25,7 @@ namespace osu.Game.Online.Rooms /// This differs from a regular download tracking composite as this accounts for the /// databased beatmap set's checksum, to disallow from playing with an altered version of the beatmap. /// - public sealed class OnlinePlayBeatmapAvailabilityTracker : CompositeDrawable + public class OnlinePlayBeatmapAvailabilityTracker : CompositeDrawable { public readonly IBindable SelectedItem = new Bindable(); @@ -41,7 +41,7 @@ namespace osu.Game.Online.Rooms /// /// The availability state of the currently selected playlist item. /// - public IBindable Availability => availability; + public virtual IBindable Availability => availability; private readonly Bindable availability = new Bindable(BeatmapAvailability.NotDownloaded()); From 1f01714ec207c4fb4090efe72769234037bc9071 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 17:02:53 +0900 Subject: [PATCH 0220/2328] Apply initial structural changes to `TestSceneMatchStartControl` --- .../Multiplayer/TestSceneMatchStartControl.cs | 233 +++++++++++------- 1 file changed, 148 insertions(+), 85 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs index 5c2fd26857..dcf73f9633 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs @@ -3,74 +3,119 @@ using System; using System.Linq; +using Moq; using NUnit.Framework; using osu.Framework.Allocation; -using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Platform; using osu.Framework.Testing; using osu.Framework.Utils; -using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer.Countdown; using osu.Game.Online.Rooms; -using osu.Game.Rulesets; +using osu.Game.Screens.OnlinePlay; using osu.Game.Screens.OnlinePlay.Multiplayer.Match; -using osu.Game.Tests.Resources; using osuTK; using osuTK.Input; namespace osu.Game.Tests.Visual.Multiplayer { - public class TestSceneMatchStartControl : MultiplayerTestScene + public class TestSceneMatchStartControl : OsuManualInputManagerTestScene { + private readonly Mock multiplayerClient = new Mock(); + private readonly Mock availabilityTracker = new Mock(); + + private readonly Bindable beatmapAvailability = new Bindable(); + private readonly Bindable room = new Bindable(); + + private MultiplayerRoom multiplayerRoom; + private MultiplayerRoomUser localUser; + private OngoingOperationTracker ongoingOperationTracker; + + private PopoverContainer content; private MatchStartControl control; - private BeatmapSetInfo importedSet; - private readonly Bindable selectedItem = new Bindable(); - - private BeatmapManager beatmaps; - private RulesetStore rulesets; + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => + new CachedModelDependencyContainer(base.CreateChildDependencies(parent)) { Model = { BindTarget = room } }; [BackgroundDependencyLoader] - private void load(GameHost host, AudioManager audio) + private void load() { - Dependencies.Cache(rulesets = new RealmRulesetStore(Realm)); - Dependencies.Cache(beatmaps = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default)); - Dependencies.Cache(Realm); + Dependencies.CacheAs(multiplayerClient.Object); + Dependencies.CacheAs(ongoingOperationTracker = new OngoingOperationTracker()); + + availabilityTracker.SetupGet(a => a.Availability).Returns(beatmapAvailability); + Dependencies.CacheAs(availabilityTracker.Object); + + multiplayerClient.SetupGet(m => m.LocalUser).Returns(() => localUser); + multiplayerClient.SetupGet(m => m.Room).Returns(() => multiplayerRoom); + + // By default, the local user is to be the host. + multiplayerClient.SetupGet(m => m.IsHost).Returns(true); + + // Assume all state changes are accepted by the server. + multiplayerClient.Setup(m => m.ChangeState(It.IsAny())) + .Callback((MultiplayerUserState r) => + { + localUser.State = r; + raiseRoomUpdated(); + }); + + Children = new Drawable[] + { + ongoingOperationTracker, + content = new PopoverContainer { RelativeSizeAxes = Axes.Both } + }; } - [SetUp] - public new void Setup() => Schedule(() => + [SetUpSteps] + public void SetUpSteps() { - AvailabilityTracker.SelectedItem.BindTo(selectedItem); - - beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely(); - importedSet = beatmaps.GetAllUsableBeatmapSets().First(); - Beatmap.Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First()); - - selectedItem.Value = new PlaylistItem(Beatmap.Value.BeatmapInfo) + AddStep("reset state", () => { - RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID - }; + multiplayerClient.Invocations.Clear(); - Child = new PopoverContainer + beatmapAvailability.Value = BeatmapAvailability.LocallyAvailable(); + + var playlistItem = new PlaylistItem(Beatmap.Value.BeatmapInfo) + { + RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID + }; + + room.Value = new Room + { + Playlist = { playlistItem }, + CurrentPlaylistItem = { Value = playlistItem } + }; + + multiplayerRoom = new MultiplayerRoom(0) + { + Playlist = + { + new MultiplayerPlaylistItem(playlistItem), + }, + Users = + { + (localUser = new MultiplayerRoomUser(API.LocalUser.Value.Id) { User = API.LocalUser.Value }), + } + }; + }); + + AddStep("create control", () => { - RelativeSizeAxes = Axes.Both, - Child = control = new MatchStartControl + content.Child = control = new MatchStartControl { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(250, 50), - } - }; - }); + }; + }); + } [Test] public void TestStartWithCountdown() @@ -85,8 +130,12 @@ namespace osu.Game.Tests.Visual.Multiplayer InputManager.Click(MouseButton.Left); }); - AddStep("finish countdown", () => MultiplayerClient.SkipToEndOfCountdown()); - AddUntilStep("match started", () => MultiplayerClient.LocalUser?.State == MultiplayerUserState.WaitingForLoad); + AddStep("check request received", () => + { + multiplayerClient.Verify(m => m.SendMatchRequest(It.Is(req => + req.Duration == TimeSpan.FromSeconds(10) + )), Times.Once); + }); } [Test] @@ -110,7 +159,7 @@ namespace osu.Game.Tests.Visual.Multiplayer InputManager.Click(MouseButton.Left); }); - AddStep("finish countdown", () => MultiplayerClient.SkipToEndOfCountdown()); + // AddStep("finish countdown", skipToEndOfCountdown); AddUntilStep("match not started", () => MultiplayerClient.LocalUser?.State == MultiplayerUserState.Ready); } @@ -119,32 +168,32 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("add second user as host", () => { - MultiplayerClient.AddUser(new APIUser { Id = 2, Username = "Another user" }); - MultiplayerClient.TransferHost(2); + addUser(new APIUser { Id = 2, Username = "Another user" }); + multiplayerClient.Object.TransferHost(2); }); - AddStep("start with countdown", () => MultiplayerClient.SendMatchRequest(new StartMatchCountdownRequest { Duration = TimeSpan.FromMinutes(2) }).WaitSafely()); + AddStep("start with countdown", () => multiplayerClient.Object.SendMatchRequest(new StartMatchCountdownRequest { Duration = TimeSpan.FromMinutes(2) }).WaitSafely()); ClickButtonWhenEnabled(); - AddUntilStep("user is ready", () => MultiplayerClient.Room?.Users[0].State == MultiplayerUserState.Ready); + AddUntilStep("user is ready", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Ready); ClickButtonWhenEnabled(); - AddUntilStep("user is idle", () => MultiplayerClient.Room?.Users[0].State == MultiplayerUserState.Idle); + AddUntilStep("user is idle", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Idle); } [Test] public void TestCountdownWhileSpectating() { - AddStep("set spectating", () => MultiplayerClient.ChangeUserState(API.LocalUser.Value.OnlineID, MultiplayerUserState.Spectating)); - AddUntilStep("local user is spectating", () => MultiplayerClient.LocalUser?.State == MultiplayerUserState.Spectating); + AddStep("set spectating", () => changeUserState(API.LocalUser.Value.OnlineID, MultiplayerUserState.Spectating)); + AddUntilStep("local user is spectating", () => multiplayerClient.Object.LocalUser?.State == MultiplayerUserState.Spectating); AddAssert("countdown button is visible", () => this.ChildrenOfType().Single().IsPresent); AddAssert("countdown button enabled", () => this.ChildrenOfType().Single().Enabled.Value); - AddStep("add second user", () => MultiplayerClient.AddUser(new APIUser { Id = 2, Username = "Another user" })); + AddStep("add second user", () => addUser(new APIUser { Id = 2, Username = "Another user" })); AddAssert("countdown button enabled", () => this.ChildrenOfType().Single().Enabled.Value); - AddStep("set second user ready", () => MultiplayerClient.ChangeUserState(2, MultiplayerUserState.Ready)); + AddStep("set second user ready", () => changeUserState(2, MultiplayerUserState.Ready)); AddAssert("countdown button enabled", () => this.ChildrenOfType().Single().Enabled.Value); } @@ -153,44 +202,44 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("add second user as host", () => { - MultiplayerClient.AddUser(new APIUser { Id = 2, Username = "Another user" }); - MultiplayerClient.TransferHost(2); + addUser(new APIUser { Id = 2, Username = "Another user" }); + multiplayerClient.Object.TransferHost(2); }); - AddStep("start countdown", () => MultiplayerClient.SendMatchRequest(new StartMatchCountdownRequest { Duration = TimeSpan.FromMinutes(1) }).WaitSafely()); - AddUntilStep("countdown started", () => MultiplayerClient.Room?.Countdown != null); + AddStep("start countdown", () => multiplayerClient.Object.SendMatchRequest(new StartMatchCountdownRequest { Duration = TimeSpan.FromMinutes(1) }).WaitSafely()); + AddUntilStep("countdown started", () => multiplayerClient.Object.Room?.Countdown != null); - AddStep("transfer host to local user", () => MultiplayerClient.TransferHost(API.LocalUser.Value.OnlineID)); - AddUntilStep("local user is host", () => MultiplayerClient.Room?.Host?.Equals(MultiplayerClient.LocalUser) == true); + AddStep("transfer host to local user", () => multiplayerClient.Object.TransferHost(API.LocalUser.Value.OnlineID)); + AddUntilStep("local user is host", () => multiplayerClient.Object.Room?.Host?.Equals(multiplayerClient.Object.LocalUser) == true); ClickButtonWhenEnabled(); - AddUntilStep("local user became ready", () => MultiplayerClient.LocalUser?.State == MultiplayerUserState.Ready); - AddAssert("countdown still active", () => MultiplayerClient.Room?.Countdown != null); + AddUntilStep("local user became ready", () => multiplayerClient.Object.LocalUser?.State == MultiplayerUserState.Ready); + AddAssert("countdown still active", () => multiplayerClient.Object.Room?.Countdown != null); } [Test] public void TestCountdownButtonVisibilityWithAutoStartEnablement() { ClickButtonWhenEnabled(); - AddUntilStep("local user became ready", () => MultiplayerClient.LocalUser?.State == MultiplayerUserState.Ready); + AddUntilStep("local user became ready", () => multiplayerClient.Object.LocalUser?.State == MultiplayerUserState.Ready); AddUntilStep("countdown button visible", () => this.ChildrenOfType().Single().IsPresent); - AddStep("enable auto start", () => MultiplayerClient.ChangeSettings(new MultiplayerRoomSettings { AutoStartDuration = TimeSpan.FromMinutes(1) }).WaitSafely()); + AddStep("enable auto start", () => multiplayerClient.Object.ChangeSettings(new MultiplayerRoomSettings { AutoStartDuration = TimeSpan.FromMinutes(1) }).WaitSafely()); ClickButtonWhenEnabled(); - AddUntilStep("local user became ready", () => MultiplayerClient.LocalUser?.State == MultiplayerUserState.Ready); + AddUntilStep("local user became ready", () => multiplayerClient.Object.LocalUser?.State == MultiplayerUserState.Ready); AddUntilStep("countdown button not visible", () => !this.ChildrenOfType().Single().IsPresent); } [Test] public void TestClickingReadyButtonUnReadiesDuringAutoStart() { - AddStep("enable auto start", () => MultiplayerClient.ChangeSettings(new MultiplayerRoomSettings { AutoStartDuration = TimeSpan.FromMinutes(1) }).WaitSafely()); + AddStep("enable auto start", () => multiplayerClient.Object.ChangeSettings(new MultiplayerRoomSettings { AutoStartDuration = TimeSpan.FromMinutes(1) }).WaitSafely()); ClickButtonWhenEnabled(); - AddUntilStep("local user became ready", () => MultiplayerClient.LocalUser?.State == MultiplayerUserState.Ready); + AddUntilStep("local user became ready", () => multiplayerClient.Object.LocalUser?.State == MultiplayerUserState.Ready); ClickButtonWhenEnabled(); - AddUntilStep("local user became idle", () => MultiplayerClient.LocalUser?.State == MultiplayerUserState.Idle); + AddUntilStep("local user became idle", () => multiplayerClient.Object.LocalUser?.State == MultiplayerUserState.Idle); } [Test] @@ -204,9 +253,9 @@ namespace osu.Game.Tests.Visual.Multiplayer return readyButton.Enabled.Value; }); - AddStep("delete beatmap", () => beatmaps.Delete(importedSet)); + // TODO: AddStep("delete beatmap", () => beatmaps.Delete(importedSet)); AddUntilStep("ready button disabled", () => !readyButton.Enabled.Value); - AddStep("undelete beatmap", () => beatmaps.Undelete(importedSet)); + // TODO: AddStep("undelete beatmap", () => beatmaps.Undelete(importedSet)); AddUntilStep("ready button enabled back", () => readyButton.Enabled.Value); } @@ -215,15 +264,15 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("add second user as host", () => { - MultiplayerClient.AddUser(new APIUser { Id = 2, Username = "Another user" }); - MultiplayerClient.TransferHost(2); + addUser(new APIUser { Id = 2, Username = "Another user" }); + multiplayerClient.Object.TransferHost(2); }); ClickButtonWhenEnabled(); - AddUntilStep("user is ready", () => MultiplayerClient.Room?.Users[0].State == MultiplayerUserState.Ready); + AddUntilStep("user is ready", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Ready); ClickButtonWhenEnabled(); - AddUntilStep("user is idle", () => MultiplayerClient.Room?.Users[0].State == MultiplayerUserState.Idle); + AddUntilStep("user is idle", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Idle); } [TestCase(true)] @@ -232,14 +281,14 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("setup", () => { - MultiplayerClient.TransferHost(MultiplayerClient.Room?.Users[0].UserID ?? 0); + multiplayerClient.Object.TransferHost(multiplayerClient.Object.Room?.Users[0].UserID ?? 0); if (!allReady) - MultiplayerClient.AddUser(new APIUser { Id = 2, Username = "Another user" }); + addUser(new APIUser { Id = 2, Username = "Another user" }); }); ClickButtonWhenEnabled(); - AddUntilStep("user is ready", () => MultiplayerClient.Room?.Users[0].State == MultiplayerUserState.Ready); + AddUntilStep("user is ready", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Ready); verifyGameplayStartFlow(); } @@ -249,12 +298,12 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("add host", () => { - MultiplayerClient.AddUser(new APIUser { Id = 2, Username = "Another user" }); - MultiplayerClient.TransferHost(2); + addUser(new APIUser { Id = 2, Username = "Another user" }); + multiplayerClient.Object.TransferHost(2); }); ClickButtonWhenEnabled(); - AddStep("make user host", () => MultiplayerClient.TransferHost(MultiplayerClient.Room?.Users[0].UserID ?? 0)); + AddStep("make user host", () => multiplayerClient.Object.TransferHost(multiplayerClient.Object.Room?.Users[0].UserID ?? 0)); verifyGameplayStartFlow(); } @@ -264,17 +313,17 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("setup", () => { - MultiplayerClient.TransferHost(MultiplayerClient.Room?.Users[0].UserID ?? 0); - MultiplayerClient.AddUser(new APIUser { Id = 2, Username = "Another user" }); + multiplayerClient.Object.TransferHost(multiplayerClient.Object.Room?.Users[0].UserID ?? 0); + addUser(new APIUser { Id = 2, Username = "Another user" }); }); ClickButtonWhenEnabled(); - AddUntilStep("user is ready", () => MultiplayerClient.Room?.Users[0].State == MultiplayerUserState.Ready); + AddUntilStep("user is ready", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Ready); - AddStep("transfer host", () => MultiplayerClient.TransferHost(MultiplayerClient.Room?.Users[1].UserID ?? 0)); + AddStep("transfer host", () => multiplayerClient.Object.TransferHost(multiplayerClient.Object.Room?.Users[1].UserID ?? 0)); ClickButtonWhenEnabled(); - AddUntilStep("user is idle (match not started)", () => MultiplayerClient.Room?.Users[0].State == MultiplayerUserState.Idle); + AddUntilStep("user is idle (match not started)", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Idle); AddUntilStep("ready button enabled", () => control.ChildrenOfType().Single().Enabled.Value); } @@ -285,42 +334,56 @@ namespace osu.Game.Tests.Visual.Multiplayer const int users = 10; AddStep("setup", () => { - MultiplayerClient.TransferHost(MultiplayerClient.Room?.Users[0].UserID ?? 0); + multiplayerClient.Object.TransferHost(multiplayerClient.Object.Room?.Users[0].UserID ?? 0); for (int i = 0; i < users; i++) - MultiplayerClient.AddUser(new APIUser { Id = i, Username = "Another user" }); + addUser(new APIUser { Id = i, Username = "Another user" }); }); if (!isHost) - AddStep("transfer host", () => MultiplayerClient.TransferHost(2)); + AddStep("transfer host", () => multiplayerClient.Object.TransferHost(2)); ClickButtonWhenEnabled(); AddRepeatStep("change user ready state", () => { - MultiplayerClient.ChangeUserState(RNG.Next(0, users), RNG.NextBool() ? MultiplayerUserState.Ready : MultiplayerUserState.Idle); + changeUserState(RNG.Next(0, users), RNG.NextBool() ? MultiplayerUserState.Ready : MultiplayerUserState.Idle); }, 20); AddRepeatStep("ready all users", () => { - var nextUnready = MultiplayerClient.Room?.Users.FirstOrDefault(c => c.State == MultiplayerUserState.Idle); + var nextUnready = multiplayerClient.Object.Room?.Users.FirstOrDefault(c => c.State == MultiplayerUserState.Idle); if (nextUnready != null) - MultiplayerClient.ChangeUserState(nextUnready.UserID, MultiplayerUserState.Ready); + changeUserState(nextUnready.UserID, MultiplayerUserState.Ready); }, users); } private void verifyGameplayStartFlow() { - AddUntilStep("user is ready", () => MultiplayerClient.Room?.Users[0].State == MultiplayerUserState.Ready); + AddUntilStep("user is ready", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Ready); ClickButtonWhenEnabled(); - AddUntilStep("user waiting for load", () => MultiplayerClient.Room?.Users[0].State == MultiplayerUserState.WaitingForLoad); + AddUntilStep("user waiting for load", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.WaitingForLoad); AddStep("finish gameplay", () => { - MultiplayerClient.ChangeUserState(MultiplayerClient.Room?.Users[0].UserID ?? 0, MultiplayerUserState.Loaded); - MultiplayerClient.ChangeUserState(MultiplayerClient.Room?.Users[0].UserID ?? 0, MultiplayerUserState.FinishedPlay); + changeUserState(multiplayerClient.Object.Room?.Users[0].UserID ?? 0, MultiplayerUserState.Loaded); + changeUserState(multiplayerClient.Object.Room?.Users[0].UserID ?? 0, MultiplayerUserState.FinishedPlay); }); AddUntilStep("ready button enabled", () => control.ChildrenOfType().Single().Enabled.Value); } + + private void changeUserState(int userId, MultiplayerUserState newState) + { + multiplayerRoom.Users.Single(u => u.UserID == userId).State = newState; + raiseRoomUpdated(); + } + + private void addUser(APIUser user) + { + multiplayerRoom.Users.Add(new MultiplayerRoomUser(user.Id) { User = user }); + raiseRoomUpdated(); + } + + private void raiseRoomUpdated() => multiplayerClient.Raise(m => m.RoomUpdated -= null); } } From ca44d2c4dcda8df808ce615f25ef5002e534b98a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 17:32:04 +0900 Subject: [PATCH 0221/2328] Setup start/stop requests --- .../Multiplayer/TestSceneMatchStartControl.cs | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs index dcf73f9633..dabf8c5267 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs @@ -66,6 +66,23 @@ namespace osu.Game.Tests.Visual.Multiplayer raiseRoomUpdated(); }); + multiplayerClient.Setup(m => m.SendMatchRequest(It.IsAny())) + .Callback((MatchUserRequest request) => + { + switch (request) + { + case StartMatchCountdownRequest countdownStart: + multiplayerRoom.Countdown = new MatchStartCountdown { TimeRemaining = countdownStart.Duration }; + raiseRoomUpdated(); + break; + + case StopCountdownRequest _: + multiplayerRoom.Countdown = null; + raiseRoomUpdated(); + break; + } + }); + Children = new Drawable[] { ongoingOperationTracker, @@ -151,6 +168,13 @@ namespace osu.Game.Tests.Visual.Multiplayer InputManager.Click(MouseButton.Left); }); + AddStep("check request received", () => + { + multiplayerClient.Verify(m => m.SendMatchRequest(It.Is(req => + req.Duration == TimeSpan.FromSeconds(10) + )), Times.Once); + }); + ClickButtonWhenEnabled(); AddStep("click the cancel button", () => { @@ -159,8 +183,10 @@ namespace osu.Game.Tests.Visual.Multiplayer InputManager.Click(MouseButton.Left); }); - // AddStep("finish countdown", skipToEndOfCountdown); - AddUntilStep("match not started", () => MultiplayerClient.LocalUser?.State == MultiplayerUserState.Ready); + AddStep("check request received", () => + { + multiplayerClient.Verify(m => m.SendMatchRequest(It.IsAny()), Times.Once); + }); } [Test] From 0a5a3415f8e5a54374f22f841a10850aea1a1430 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 20:28:53 +0900 Subject: [PATCH 0222/2328] Setup host switching and avoid starting gameplay --- .../Multiplayer/TestSceneMatchStartControl.cs | 47 ++++++++++++------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs index dabf8c5267..dccfd98c4d 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs @@ -3,6 +3,7 @@ using System; using System.Linq; +using System.Threading.Tasks; using Moq; using NUnit.Framework; using osu.Framework.Allocation; @@ -11,6 +12,7 @@ using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Logging; using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Graphics.UserInterface; @@ -62,18 +64,22 @@ namespace osu.Game.Tests.Visual.Multiplayer multiplayerClient.Setup(m => m.ChangeState(It.IsAny())) .Callback((MultiplayerUserState r) => { + Logger.Log($"Changing local user state from {localUser.State} to {r}"); localUser.State = r; raiseRoomUpdated(); }); + // We don't want to have to handle entering into actual gameplay in this test. + // Returning a failed task should always allow the button to always stay in a clickable state. + multiplayerClient.Setup(m => m.StartMatch()).Returns(Task.FromException(new InvalidOperationException())); + multiplayerClient.Setup(m => m.SendMatchRequest(It.IsAny())) .Callback((MatchUserRequest request) => { switch (request) { case StartMatchCountdownRequest countdownStart: - multiplayerRoom.Countdown = new MatchStartCountdown { TimeRemaining = countdownStart.Duration }; - raiseRoomUpdated(); + setRoomCountdown(countdownStart.Duration); break; case StopCountdownRequest _: @@ -110,16 +116,16 @@ namespace osu.Game.Tests.Visual.Multiplayer CurrentPlaylistItem = { Value = playlistItem } }; + localUser = new MultiplayerRoomUser(API.LocalUser.Value.Id) { User = API.LocalUser.Value }; + multiplayerRoom = new MultiplayerRoom(0) { Playlist = { new MultiplayerPlaylistItem(playlistItem), }, - Users = - { - (localUser = new MultiplayerRoomUser(API.LocalUser.Value.Id) { User = API.LocalUser.Value }), - } + Users = { localUser }, + Host = localUser, }; }); @@ -160,6 +166,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { ClickButtonWhenEnabled(); AddUntilStep("countdown button shown", () => this.ChildrenOfType().SingleOrDefault()?.IsPresent == true); + ClickButtonWhenEnabled(); AddStep("click the first countdown button", () => { @@ -192,19 +199,15 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestReadyAndUnReadyDuringCountdown() { - AddStep("add second user as host", () => - { - addUser(new APIUser { Id = 2, Username = "Another user" }); - multiplayerClient.Object.TransferHost(2); - }); + AddStep("add second user as host", () => addUser(new APIUser { Id = 2, Username = "Another user" }, true)); - AddStep("start with countdown", () => multiplayerClient.Object.SendMatchRequest(new StartMatchCountdownRequest { Duration = TimeSpan.FromMinutes(2) }).WaitSafely()); + AddStep("start countdown", () => setRoomCountdown(TimeSpan.FromMinutes(1))); ClickButtonWhenEnabled(); - AddUntilStep("user is ready", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Ready); + AddUntilStep("user is ready", () => localUser.State == MultiplayerUserState.Ready); ClickButtonWhenEnabled(); - AddUntilStep("user is idle", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Idle); + AddUntilStep("user is idle", () => localUser.State == MultiplayerUserState.Idle); } [Test] @@ -398,15 +401,27 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("ready button enabled", () => control.ChildrenOfType().Single().Enabled.Value); } + private void setRoomCountdown(TimeSpan duration) + { + multiplayerRoom.Countdown = new MatchStartCountdown { TimeRemaining = duration }; + raiseRoomUpdated(); + } + private void changeUserState(int userId, MultiplayerUserState newState) { multiplayerRoom.Users.Single(u => u.UserID == userId).State = newState; raiseRoomUpdated(); } - private void addUser(APIUser user) + private void addUser(APIUser user, bool asHost = false) { - multiplayerRoom.Users.Add(new MultiplayerRoomUser(user.Id) { User = user }); + var multiplayerRoomUser = new MultiplayerRoomUser(user.Id) { User = user }; + + multiplayerRoom.Users.Add(multiplayerRoomUser); + + if (asHost) + multiplayerRoom.Host = multiplayerRoomUser; + raiseRoomUpdated(); } From 331242d585ab23d8f11d8863ac991bb74600d038 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 20:38:39 +0900 Subject: [PATCH 0223/2328] Update transfer host logic and simplify local user checks --- .../Multiplayer/TestSceneMatchStartControl.cs | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs index dccfd98c4d..e10a63d010 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs @@ -231,14 +231,13 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("add second user as host", () => { - addUser(new APIUser { Id = 2, Username = "Another user" }); - multiplayerClient.Object.TransferHost(2); + addUser(new APIUser { Id = 2, Username = "Another user" }, true); }); AddStep("start countdown", () => multiplayerClient.Object.SendMatchRequest(new StartMatchCountdownRequest { Duration = TimeSpan.FromMinutes(1) }).WaitSafely()); AddUntilStep("countdown started", () => multiplayerClient.Object.Room?.Countdown != null); - AddStep("transfer host to local user", () => multiplayerClient.Object.TransferHost(API.LocalUser.Value.OnlineID)); + AddStep("transfer host to local user", () => transferHost(localUser)); AddUntilStep("local user is host", () => multiplayerClient.Object.Room?.Host?.Equals(multiplayerClient.Object.LocalUser) == true); ClickButtonWhenEnabled(); @@ -293,15 +292,14 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("add second user as host", () => { - addUser(new APIUser { Id = 2, Username = "Another user" }); - multiplayerClient.Object.TransferHost(2); + addUser(new APIUser { Id = 2, Username = "Another user" }, true); }); ClickButtonWhenEnabled(); - AddUntilStep("user is ready", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Ready); + AddUntilStep("user is ready", () => localUser.State == MultiplayerUserState.Ready); ClickButtonWhenEnabled(); - AddUntilStep("user is idle", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Idle); + AddUntilStep("user is idle", () => localUser.State == MultiplayerUserState.Idle); } [TestCase(true)] @@ -310,14 +308,14 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("setup", () => { - multiplayerClient.Object.TransferHost(multiplayerClient.Object.Room?.Users[0].UserID ?? 0); + transferHost(multiplayerRoom.Users[0]); if (!allReady) addUser(new APIUser { Id = 2, Username = "Another user" }); }); ClickButtonWhenEnabled(); - AddUntilStep("user is ready", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Ready); + AddUntilStep("user is ready", () => localUser.State == MultiplayerUserState.Ready); verifyGameplayStartFlow(); } @@ -327,12 +325,12 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("add host", () => { - addUser(new APIUser { Id = 2, Username = "Another user" }); - multiplayerClient.Object.TransferHost(2); + addUser(new APIUser { Id = 2, Username = "Another user" }, true); }); ClickButtonWhenEnabled(); - AddStep("make user host", () => multiplayerClient.Object.TransferHost(multiplayerClient.Object.Room?.Users[0].UserID ?? 0)); + + AddStep("make user host", () => transferHost(localUser)); verifyGameplayStartFlow(); } @@ -342,17 +340,16 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("setup", () => { - multiplayerClient.Object.TransferHost(multiplayerClient.Object.Room?.Users[0].UserID ?? 0); addUser(new APIUser { Id = 2, Username = "Another user" }); }); ClickButtonWhenEnabled(); - AddUntilStep("user is ready", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Ready); + AddUntilStep("user is ready", () => localUser.State == MultiplayerUserState.Ready); - AddStep("transfer host", () => multiplayerClient.Object.TransferHost(multiplayerClient.Object.Room?.Users[1].UserID ?? 0)); + AddStep("transfer host", () => transferHost(multiplayerRoom.Users[1])); ClickButtonWhenEnabled(); - AddUntilStep("user is idle (match not started)", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Idle); + AddUntilStep("user is idle (match not started)", () => localUser.State == MultiplayerUserState.Idle); AddUntilStep("ready button enabled", () => control.ChildrenOfType().Single().Enabled.Value); } @@ -363,14 +360,11 @@ namespace osu.Game.Tests.Visual.Multiplayer const int users = 10; AddStep("setup", () => { - multiplayerClient.Object.TransferHost(multiplayerClient.Object.Room?.Users[0].UserID ?? 0); + transferHost(localUser); for (int i = 0; i < users; i++) - addUser(new APIUser { Id = i, Username = "Another user" }); + addUser(new APIUser { Id = i, Username = "Another user" }, !isHost && i == 2); }); - if (!isHost) - AddStep("transfer host", () => multiplayerClient.Object.TransferHost(2)); - ClickButtonWhenEnabled(); AddRepeatStep("change user ready state", () => @@ -388,14 +382,14 @@ namespace osu.Game.Tests.Visual.Multiplayer private void verifyGameplayStartFlow() { - AddUntilStep("user is ready", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.Ready); + AddUntilStep("user is ready", () => localUser.State == MultiplayerUserState.Ready); ClickButtonWhenEnabled(); - AddUntilStep("user waiting for load", () => multiplayerClient.Object.Room?.Users[0].State == MultiplayerUserState.WaitingForLoad); + AddUntilStep("user waiting for load", () => localUser.State == MultiplayerUserState.WaitingForLoad); AddStep("finish gameplay", () => { - changeUserState(multiplayerClient.Object.Room?.Users[0].UserID ?? 0, MultiplayerUserState.Loaded); - changeUserState(multiplayerClient.Object.Room?.Users[0].UserID ?? 0, MultiplayerUserState.FinishedPlay); + changeUserState(localUser.UserID, MultiplayerUserState.Loaded); + changeUserState(localUser.UserID, MultiplayerUserState.FinishedPlay); }); AddUntilStep("ready button enabled", () => control.ChildrenOfType().Single().Enabled.Value); @@ -420,11 +414,17 @@ namespace osu.Game.Tests.Visual.Multiplayer multiplayerRoom.Users.Add(multiplayerRoomUser); if (asHost) - multiplayerRoom.Host = multiplayerRoomUser; + transferHost(multiplayerRoomUser); raiseRoomUpdated(); } + private void transferHost(MultiplayerRoomUser user) + { + multiplayerRoom.Host = user; + raiseRoomUpdated(); + } + private void raiseRoomUpdated() => multiplayerClient.Raise(m => m.RoomUpdated -= null); } } From 4b6a9fbf474031d3df852a099cce731a95c7fa91 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 20:41:56 +0900 Subject: [PATCH 0224/2328] Reimplement beatmap availability test --- .../Visual/Multiplayer/TestSceneMatchStartControl.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs index e10a63d010..16f7426360 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs @@ -281,9 +281,9 @@ namespace osu.Game.Tests.Visual.Multiplayer return readyButton.Enabled.Value; }); - // TODO: AddStep("delete beatmap", () => beatmaps.Delete(importedSet)); + AddStep("mark beatmap not available", () => beatmapAvailability.Value = BeatmapAvailability.NotDownloaded()); AddUntilStep("ready button disabled", () => !readyButton.Enabled.Value); - // TODO: AddStep("undelete beatmap", () => beatmaps.Undelete(importedSet)); + AddStep("mark beatmap available", () => beatmapAvailability.Value = BeatmapAvailability.LocallyAvailable()); AddUntilStep("ready button enabled back", () => readyButton.Enabled.Value); } From 8a7b37856c8902681a35f5f9b786af5f79fc23bd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 20:51:05 +0900 Subject: [PATCH 0225/2328] Implement `IsHost` to return correct value for current state --- osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs index 16f7426360..bf980b0694 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs @@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.Multiplayer multiplayerClient.SetupGet(m => m.Room).Returns(() => multiplayerRoom); // By default, the local user is to be the host. - multiplayerClient.SetupGet(m => m.IsHost).Returns(true); + multiplayerClient.SetupGet(m => m.IsHost).Returns(() => ReferenceEquals(multiplayerRoom.Host, localUser)); // Assume all state changes are accepted by the server. multiplayerClient.Setup(m => m.ChangeState(It.IsAny())) From c0ad91796d75e2f38b5117c0b484589cba1c588b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 20:57:40 +0900 Subject: [PATCH 0226/2328] Fix gameplay start flow --- .../Multiplayer/TestSceneMatchStartControl.cs | 16 +++++++--------- osu.Game/Online/Multiplayer/MultiplayerClient.cs | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs index bf980b0694..8af1187b67 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs @@ -3,7 +3,6 @@ using System; using System.Linq; -using System.Threading.Tasks; using Moq; using NUnit.Framework; using osu.Framework.Allocation; @@ -69,9 +68,8 @@ namespace osu.Game.Tests.Visual.Multiplayer raiseRoomUpdated(); }); - // We don't want to have to handle entering into actual gameplay in this test. - // Returning a failed task should always allow the button to always stay in a clickable state. - multiplayerClient.Setup(m => m.StartMatch()).Returns(Task.FromException(new InvalidOperationException())); + multiplayerClient.Setup(m => m.StartMatch()) + .Callback(() => multiplayerClient.Raise(m => m.LoadRequested -= null)); multiplayerClient.Setup(m => m.SendMatchRequest(It.IsAny())) .Callback((MatchUserRequest request) => @@ -384,13 +382,13 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddUntilStep("user is ready", () => localUser.State == MultiplayerUserState.Ready); ClickButtonWhenEnabled(); + + AddStep("check start request received", () => multiplayerClient.Verify(m => m.StartMatch(), Times.Once)); AddUntilStep("user waiting for load", () => localUser.State == MultiplayerUserState.WaitingForLoad); - AddStep("finish gameplay", () => - { - changeUserState(localUser.UserID, MultiplayerUserState.Loaded); - changeUserState(localUser.UserID, MultiplayerUserState.FinishedPlay); - }); + AddUntilStep("ready button disabled", () => !control.ChildrenOfType().Single().Enabled.Value); + + AddStep("finish gameplay", () => changeUserState(localUser.UserID, MultiplayerUserState.Idle)); AddUntilStep("ready button enabled", () => control.ChildrenOfType().Single().Enabled.Value); } diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index e29aee2c6d..967220abbf 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -67,7 +67,7 @@ namespace osu.Game.Online.Multiplayer /// /// Invoked when the multiplayer server requests the current beatmap to be loaded into play. /// - public event Action? LoadRequested; + public virtual event Action? LoadRequested; /// /// Invoked when the multiplayer server requests gameplay to be started. From 8b1fd051c65c40febb3193a7cb25910135768f9b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 21:04:15 +0900 Subject: [PATCH 0227/2328] Fix remaining autostart and gameplay tests --- .../Multiplayer/TestSceneMatchStartControl.cs | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs index 8af1187b67..acee35d3ba 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs @@ -69,7 +69,13 @@ namespace osu.Game.Tests.Visual.Multiplayer }); multiplayerClient.Setup(m => m.StartMatch()) - .Callback(() => multiplayerClient.Raise(m => m.LoadRequested -= null)); + .Callback(() => + { + multiplayerClient.Raise(m => m.LoadRequested -= null); + + // immediately "end" gameplay, as we don't care about that part of the process. + changeUserState(localUser.UserID, MultiplayerUserState.Idle); + }); multiplayerClient.Setup(m => m.SendMatchRequest(It.IsAny())) .Callback((MatchUserRequest request) => @@ -244,13 +250,13 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] - public void TestCountdownButtonVisibilityWithAutoStartEnablement() + public void TestCountdownButtonVisibilityWithAutoStart() { ClickButtonWhenEnabled(); AddUntilStep("local user became ready", () => multiplayerClient.Object.LocalUser?.State == MultiplayerUserState.Ready); AddUntilStep("countdown button visible", () => this.ChildrenOfType().Single().IsPresent); - AddStep("enable auto start", () => multiplayerClient.Object.ChangeSettings(new MultiplayerRoomSettings { AutoStartDuration = TimeSpan.FromMinutes(1) }).WaitSafely()); + AddStep("enable auto start", () => changeRoomSettings(new MultiplayerRoomSettings { AutoStartDuration = TimeSpan.FromMinutes(1) })); ClickButtonWhenEnabled(); AddUntilStep("local user became ready", () => multiplayerClient.Object.LocalUser?.State == MultiplayerUserState.Ready); @@ -260,7 +266,7 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestClickingReadyButtonUnReadiesDuringAutoStart() { - AddStep("enable auto start", () => multiplayerClient.Object.ChangeSettings(new MultiplayerRoomSettings { AutoStartDuration = TimeSpan.FromMinutes(1) }).WaitSafely()); + AddStep("enable auto start", () => changeRoomSettings(new MultiplayerRoomSettings { AutoStartDuration = TimeSpan.FromMinutes(1) })); ClickButtonWhenEnabled(); AddUntilStep("local user became ready", () => multiplayerClient.Object.LocalUser?.State == MultiplayerUserState.Ready); @@ -384,13 +390,6 @@ namespace osu.Game.Tests.Visual.Multiplayer ClickButtonWhenEnabled(); AddStep("check start request received", () => multiplayerClient.Verify(m => m.StartMatch(), Times.Once)); - AddUntilStep("user waiting for load", () => localUser.State == MultiplayerUserState.WaitingForLoad); - - AddUntilStep("ready button disabled", () => !control.ChildrenOfType().Single().Enabled.Value); - - AddStep("finish gameplay", () => changeUserState(localUser.UserID, MultiplayerUserState.Idle)); - - AddUntilStep("ready button enabled", () => control.ChildrenOfType().Single().Enabled.Value); } private void setRoomCountdown(TimeSpan duration) @@ -423,6 +422,20 @@ namespace osu.Game.Tests.Visual.Multiplayer raiseRoomUpdated(); } + private void changeRoomSettings(MultiplayerRoomSettings settings) + { + multiplayerRoom.Settings = settings; + + // Changing settings should reset all user ready statuses. + foreach (var user in multiplayerRoom.Users) + { + if (user.State == MultiplayerUserState.Ready) + user.State = MultiplayerUserState.Idle; + } + + raiseRoomUpdated(); + } + private void raiseRoomUpdated() => multiplayerClient.Raise(m => m.RoomUpdated -= null); } } From c77a7b75d326c90b5444bc26302b4ce7d38e38a7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 21:11:45 +0900 Subject: [PATCH 0228/2328] Tidy things up --- .../Multiplayer/TestSceneMatchStartControl.cs | 70 +++++++++---------- 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs index acee35d3ba..ff6c02c4e5 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs @@ -41,6 +41,8 @@ namespace osu.Game.Tests.Visual.Multiplayer private PopoverContainer content; private MatchStartControl control; + private OsuButton readyButton => control.ChildrenOfType().Single(); + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => new CachedModelDependencyContainer(base.CreateChildDependencies(parent)) { Model = { BindTarget = room } }; @@ -49,9 +51,9 @@ namespace osu.Game.Tests.Visual.Multiplayer { Dependencies.CacheAs(multiplayerClient.Object); Dependencies.CacheAs(ongoingOperationTracker = new OngoingOperationTracker()); + Dependencies.CacheAs(availabilityTracker.Object); availabilityTracker.SetupGet(a => a.Availability).Returns(beatmapAvailability); - Dependencies.CacheAs(availabilityTracker.Object); multiplayerClient.SetupGet(m => m.LocalUser).Returns(() => localUser); multiplayerClient.SetupGet(m => m.Room).Returns(() => multiplayerRoom); @@ -149,6 +151,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { ClickButtonWhenEnabled(); AddUntilStep("countdown button shown", () => this.ChildrenOfType().SingleOrDefault()?.IsPresent == true); + ClickButtonWhenEnabled(); AddStep("click the first countdown button", () => { @@ -208,17 +211,17 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("start countdown", () => setRoomCountdown(TimeSpan.FromMinutes(1))); ClickButtonWhenEnabled(); - AddUntilStep("user is ready", () => localUser.State == MultiplayerUserState.Ready); + checkLocalUserState(MultiplayerUserState.Ready); ClickButtonWhenEnabled(); - AddUntilStep("user is idle", () => localUser.State == MultiplayerUserState.Idle); + checkLocalUserState(MultiplayerUserState.Idle); } [Test] public void TestCountdownWhileSpectating() { AddStep("set spectating", () => changeUserState(API.LocalUser.Value.OnlineID, MultiplayerUserState.Spectating)); - AddUntilStep("local user is spectating", () => multiplayerClient.Object.LocalUser?.State == MultiplayerUserState.Spectating); + checkLocalUserState(MultiplayerUserState.Spectating); AddAssert("countdown button is visible", () => this.ChildrenOfType().Single().IsPresent); AddAssert("countdown button enabled", () => this.ChildrenOfType().Single().Enabled.Value); @@ -239,27 +242,27 @@ namespace osu.Game.Tests.Visual.Multiplayer }); AddStep("start countdown", () => multiplayerClient.Object.SendMatchRequest(new StartMatchCountdownRequest { Duration = TimeSpan.FromMinutes(1) }).WaitSafely()); - AddUntilStep("countdown started", () => multiplayerClient.Object.Room?.Countdown != null); + AddUntilStep("countdown started", () => multiplayerRoom.Countdown != null); AddStep("transfer host to local user", () => transferHost(localUser)); - AddUntilStep("local user is host", () => multiplayerClient.Object.Room?.Host?.Equals(multiplayerClient.Object.LocalUser) == true); + AddUntilStep("local user is host", () => multiplayerRoom.Host?.Equals(multiplayerClient.Object.LocalUser) == true); ClickButtonWhenEnabled(); - AddUntilStep("local user became ready", () => multiplayerClient.Object.LocalUser?.State == MultiplayerUserState.Ready); - AddAssert("countdown still active", () => multiplayerClient.Object.Room?.Countdown != null); + checkLocalUserState(MultiplayerUserState.Ready); + AddAssert("countdown still active", () => multiplayerRoom.Countdown != null); } [Test] public void TestCountdownButtonVisibilityWithAutoStart() { ClickButtonWhenEnabled(); - AddUntilStep("local user became ready", () => multiplayerClient.Object.LocalUser?.State == MultiplayerUserState.Ready); + checkLocalUserState(MultiplayerUserState.Ready); AddUntilStep("countdown button visible", () => this.ChildrenOfType().Single().IsPresent); AddStep("enable auto start", () => changeRoomSettings(new MultiplayerRoomSettings { AutoStartDuration = TimeSpan.FromMinutes(1) })); ClickButtonWhenEnabled(); - AddUntilStep("local user became ready", () => multiplayerClient.Object.LocalUser?.State == MultiplayerUserState.Ready); + checkLocalUserState(MultiplayerUserState.Ready); AddUntilStep("countdown button not visible", () => !this.ChildrenOfType().Single().IsPresent); } @@ -268,25 +271,20 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("enable auto start", () => changeRoomSettings(new MultiplayerRoomSettings { AutoStartDuration = TimeSpan.FromMinutes(1) })); ClickButtonWhenEnabled(); - AddUntilStep("local user became ready", () => multiplayerClient.Object.LocalUser?.State == MultiplayerUserState.Ready); + checkLocalUserState(MultiplayerUserState.Ready); ClickButtonWhenEnabled(); - AddUntilStep("local user became idle", () => multiplayerClient.Object.LocalUser?.State == MultiplayerUserState.Idle); + checkLocalUserState(MultiplayerUserState.Idle); } [Test] public void TestDeletedBeatmapDisableReady() { - OsuButton readyButton = null; - - AddUntilStep("ensure ready button enabled", () => - { - readyButton = control.ChildrenOfType().Single(); - return readyButton.Enabled.Value; - }); + AddUntilStep("ready button enabled", () => readyButton.Enabled.Value); AddStep("mark beatmap not available", () => beatmapAvailability.Value = BeatmapAvailability.NotDownloaded()); AddUntilStep("ready button disabled", () => !readyButton.Enabled.Value); + AddStep("mark beatmap available", () => beatmapAvailability.Value = BeatmapAvailability.LocallyAvailable()); AddUntilStep("ready button enabled back", () => readyButton.Enabled.Value); } @@ -300,26 +298,21 @@ namespace osu.Game.Tests.Visual.Multiplayer }); ClickButtonWhenEnabled(); - AddUntilStep("user is ready", () => localUser.State == MultiplayerUserState.Ready); + checkLocalUserState(MultiplayerUserState.Ready); ClickButtonWhenEnabled(); - AddUntilStep("user is idle", () => localUser.State == MultiplayerUserState.Idle); + checkLocalUserState(MultiplayerUserState.Idle); } [TestCase(true)] [TestCase(false)] public void TestToggleStateWhenHost(bool allReady) { - AddStep("setup", () => - { - transferHost(multiplayerRoom.Users[0]); - - if (!allReady) - addUser(new APIUser { Id = 2, Username = "Another user" }); - }); + if (!allReady) + AddStep("add other user", () => addUser(new APIUser { Id = 2, Username = "Another user" })); ClickButtonWhenEnabled(); - AddUntilStep("user is ready", () => localUser.State == MultiplayerUserState.Ready); + checkLocalUserState(MultiplayerUserState.Ready); verifyGameplayStartFlow(); } @@ -334,7 +327,7 @@ namespace osu.Game.Tests.Visual.Multiplayer ClickButtonWhenEnabled(); - AddStep("make user host", () => transferHost(localUser)); + AddStep("make local user host", () => transferHost(localUser)); verifyGameplayStartFlow(); } @@ -348,13 +341,13 @@ namespace osu.Game.Tests.Visual.Multiplayer }); ClickButtonWhenEnabled(); - AddUntilStep("user is ready", () => localUser.State == MultiplayerUserState.Ready); + checkLocalUserState(MultiplayerUserState.Ready); AddStep("transfer host", () => transferHost(multiplayerRoom.Users[1])); ClickButtonWhenEnabled(); - AddUntilStep("user is idle (match not started)", () => localUser.State == MultiplayerUserState.Idle); - AddUntilStep("ready button enabled", () => control.ChildrenOfType().Single().Enabled.Value); + checkLocalUserState(MultiplayerUserState.Idle); + AddUntilStep("ready button enabled", () => readyButton.Enabled.Value); } [TestCase(true)] @@ -362,9 +355,9 @@ namespace osu.Game.Tests.Visual.Multiplayer public void TestManyUsersChangingState(bool isHost) { const int users = 10; - AddStep("setup", () => + + AddStep("add many users", () => { - transferHost(localUser); for (int i = 0; i < users; i++) addUser(new APIUser { Id = i, Username = "Another user" }, !isHost && i == 2); }); @@ -378,7 +371,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddRepeatStep("ready all users", () => { - var nextUnready = multiplayerClient.Object.Room?.Users.FirstOrDefault(c => c.State == MultiplayerUserState.Idle); + var nextUnready = multiplayerRoom.Users.FirstOrDefault(c => c.State == MultiplayerUserState.Idle); if (nextUnready != null) changeUserState(nextUnready.UserID, MultiplayerUserState.Ready); }, users); @@ -386,12 +379,15 @@ namespace osu.Game.Tests.Visual.Multiplayer private void verifyGameplayStartFlow() { - AddUntilStep("user is ready", () => localUser.State == MultiplayerUserState.Ready); + checkLocalUserState(MultiplayerUserState.Ready); ClickButtonWhenEnabled(); AddStep("check start request received", () => multiplayerClient.Verify(m => m.StartMatch(), Times.Once)); } + private void checkLocalUserState(MultiplayerUserState state) => + AddUntilStep($"local user is {state}", () => localUser.State == state); + private void setRoomCountdown(TimeSpan duration) { multiplayerRoom.Countdown = new MatchStartCountdown { TimeRemaining = duration }; From 9b433280bdd9623b0a296b9a78ceccdec2a4215d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Apr 2022 21:24:33 +0900 Subject: [PATCH 0229/2328] Remove countdown implementation from `TestMultiplayerClient` --- .../Multiplayer/TestMultiplayerClient.cs | 89 +------------------ 1 file changed, 1 insertion(+), 88 deletions(-) diff --git a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs index 4a974cf61d..21774b73a0 100644 --- a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs +++ b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs @@ -7,19 +7,16 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using System.Threading; using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Bindables; -using osu.Framework.Development; using osu.Framework.Extensions; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Multiplayer; -using osu.Game.Online.Multiplayer.Countdown; using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus; using osu.Game.Online.Rooms; using osu.Game.Rulesets.Mods; -using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tests.Visual.Multiplayer { @@ -141,16 +138,6 @@ namespace osu.Game.Tests.Visual.Multiplayer switch (Room.State) { case MultiplayerRoomState.Open: - // If there are no remaining ready users or the host is not ready, stop any existing countdown. - // Todo: This doesn't yet support non-match-start countdowns. - if (Room.Settings.AutoStartEnabled) - { - bool shouldHaveCountdown = !APIRoom.Playlist.GetCurrentItem()!.Expired && Room.Users.Any(u => u.State == MultiplayerUserState.Ready); - - if (shouldHaveCountdown && Room.Countdown == null) - startCountdown(new MatchStartCountdown { TimeRemaining = Room.Settings.AutoStartDuration }, StartMatch); - } - break; case MultiplayerRoomState.WaitingForLoad: @@ -317,16 +304,6 @@ namespace osu.Game.Tests.Visual.Multiplayer return Task.CompletedTask; } - private CancellationTokenSource? countdownSkipSource; - private CancellationTokenSource? countdownStopSource; - private Task countdownTask = Task.CompletedTask; - - /// - /// Skips to the end of the currently-running countdown, if one is running, - /// and runs the callback (e.g. to start the match) as soon as possible unless the countdown has been cancelled. - /// - public void SkipToEndOfCountdown() => countdownSkipSource?.Cancel(); - public override async Task SendMatchRequest(MatchUserRequest request) { Debug.Assert(Room != null); @@ -334,14 +311,6 @@ namespace osu.Game.Tests.Visual.Multiplayer switch (request) { - case StartMatchCountdownRequest matchCountdownRequest: - startCountdown(new MatchStartCountdown { TimeRemaining = matchCountdownRequest.Duration }, StartMatch); - break; - - case StopCountdownRequest _: - stopCountdown(); - break; - case ChangeTeamRequest changeTeam: TeamVersusRoomState roomState = (TeamVersusRoomState)Room.MatchState!; @@ -360,62 +329,6 @@ namespace osu.Game.Tests.Visual.Multiplayer } } - private void startCountdown(MultiplayerCountdown countdown, Func continuation) - { - Debug.Assert(Room != null); - Debug.Assert(ThreadSafety.IsUpdateThread); - - stopCountdown(); - - // Note that this will leak CTSs, however this is a test method and we haven't noticed foregoing disposal of non-linked CTSs to be detrimental. - // If necessary, this can be moved into the final schedule below, and the class-level fields be nulled out accordingly. - var stopSource = countdownStopSource = new CancellationTokenSource(); - var skipSource = countdownSkipSource = new CancellationTokenSource(); - - Task lastCountdownTask = countdownTask; - countdownTask = start(); - - async Task start() - { - await lastCountdownTask; - - Schedule(() => - { - if (stopSource.IsCancellationRequested) - return; - - Room.Countdown = countdown; - MatchEvent(new CountdownChangedEvent { Countdown = countdown }); - }); - - try - { - using (var cancellationSource = CancellationTokenSource.CreateLinkedTokenSource(stopSource.Token, skipSource.Token)) - await Task.Delay(countdown.TimeRemaining, cancellationSource.Token).ConfigureAwait(false); - } - catch (OperationCanceledException) - { - // Clients need to be notified of cancellations in the following code. - } - - Schedule(() => - { - if (Room.Countdown != countdown) - return; - - Room.Countdown = null; - MatchEvent(new CountdownChangedEvent { Countdown = null }); - - if (stopSource.IsCancellationRequested) - return; - - continuation().WaitSafely(); - }); - } - } - - private void stopCountdown() => countdownStopSource?.Cancel(); - public override Task StartMatch() { Debug.Assert(Room != null); From 9c28c5b8470b76a915d0239e960551c9ebe44500 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 14 Apr 2022 11:52:05 +0900 Subject: [PATCH 0230/2328] Upgrade to Resharper 2022.1.0-EAP10 --- .config/dotnet-tools.json | 4 ++-- .github/workflows/ci.yml | 2 +- InspectCode.ps1 | 2 +- InspectCode.sh | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 4177c402aa..7b94ee5bdd 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -9,7 +9,7 @@ ] }, "jetbrains.resharper.globaltools": { - "version": "2020.3.2", + "version": "2022.1.0-eap10", "commands": [ "jb" ] @@ -33,4 +33,4 @@ ] } } -} +} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec3816d541..95864a79f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -138,7 +138,7 @@ jobs: # run: dotnet format --dry-run --check - name: InspectCode - run: dotnet jb inspectcode $(pwd)/osu.Desktop.slnf --output=$(pwd)/inspectcodereport.xml --cachesDir=$(pwd)/inspectcode --verbosity=WARN + run: dotnet jb inspectcode $(pwd)/osu.Desktop.slnf --no-build --output="inspectcodereport.xml" --verbosity=WARN - name: NVika run: dotnet nvika parsereport "${{github.workspace}}/inspectcodereport.xml" --treatwarningsaserrors diff --git a/InspectCode.ps1 b/InspectCode.ps1 index 8316f48ff3..e311bd8755 100644 --- a/InspectCode.ps1 +++ b/InspectCode.ps1 @@ -5,7 +5,7 @@ dotnet tool restore # - cmd: dotnet format --dry-run --check dotnet CodeFileSanity -dotnet jb inspectcode "osu.Desktop.slnf" --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN +dotnet jb inspectcode "osu.Desktop.slnf" --no-build --output="inspectcodereport.xml" --verbosity=WARN dotnet nvika parsereport "inspectcodereport.xml" --treatwarningsaserrors exit $LASTEXITCODE diff --git a/InspectCode.sh b/InspectCode.sh index cf2bc18175..1985b14e1e 100755 --- a/InspectCode.sh +++ b/InspectCode.sh @@ -2,5 +2,5 @@ dotnet tool restore dotnet CodeFileSanity -dotnet jb inspectcode "osu.Desktop.slnf" --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN +dotnet jb inspectcode "osu.Desktop.slnf" --no-build --output="inspectcodereport.xml" --verbosity=WARN dotnet nvika parsereport "inspectcodereport.xml" --treatwarningsaserrors From fb409db14872e55d6fb6d443fca0b54b09e1bb2d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 14 Apr 2022 12:31:18 +0900 Subject: [PATCH 0231/2328] Add caches-home --- InspectCode.ps1 | 2 +- InspectCode.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/InspectCode.ps1 b/InspectCode.ps1 index e311bd8755..df0d73ea43 100644 --- a/InspectCode.ps1 +++ b/InspectCode.ps1 @@ -5,7 +5,7 @@ dotnet tool restore # - cmd: dotnet format --dry-run --check dotnet CodeFileSanity -dotnet jb inspectcode "osu.Desktop.slnf" --no-build --output="inspectcodereport.xml" --verbosity=WARN +dotnet jb inspectcode "osu.Desktop.slnf" --no-build --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN dotnet nvika parsereport "inspectcodereport.xml" --treatwarningsaserrors exit $LASTEXITCODE diff --git a/InspectCode.sh b/InspectCode.sh index 1985b14e1e..65b55e0da0 100755 --- a/InspectCode.sh +++ b/InspectCode.sh @@ -2,5 +2,5 @@ dotnet tool restore dotnet CodeFileSanity -dotnet jb inspectcode "osu.Desktop.slnf" --no-build --output="inspectcodereport.xml" --verbosity=WARN +dotnet jb inspectcode "osu.Desktop.slnf" --no-build --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN dotnet nvika parsereport "inspectcodereport.xml" --treatwarningsaserrors From 494955aff1eaf1d321183590bec88ce5cd7d034f Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 14 Apr 2022 13:11:11 +0900 Subject: [PATCH 0232/2328] Resolve inspection issues --- .../EmptyFreeformDifficultyCalculator.cs | 3 ++- .../PippidonDifficultyCalculator.cs | 3 ++- .../EmptyScrollingDifficultyCalculator.cs | 3 ++- .../PippidonDifficultyCalculator.cs | 3 ++- osu.Game.Rulesets.Taiko.Tests/TestSceneFlyingHits.cs | 4 +--- osu.Game.Tests/Online/TestAPIModJsonSerialization.cs | 5 +++-- .../Visual/Gameplay/TestSceneGameplaySamplePlayback.cs | 2 +- .../Screens/Ladder/Components/ProgressionPath.cs | 6 +----- osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs | 2 +- osu.Game/Screens/Play/BeatmapMetadataDisplay.cs | 4 ++-- osu.sln.DotSettings | 1 + 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform/EmptyFreeformDifficultyCalculator.cs b/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform/EmptyFreeformDifficultyCalculator.cs index fae3784f5e..312d3d5e9a 100644 --- a/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform/EmptyFreeformDifficultyCalculator.cs +++ b/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform/EmptyFreeformDifficultyCalculator.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; @@ -25,6 +26,6 @@ namespace osu.Game.Rulesets.EmptyFreeform protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) => Enumerable.Empty(); - protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => new Skill[0]; + protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => Array.Empty(); } } diff --git a/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon/PippidonDifficultyCalculator.cs b/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon/PippidonDifficultyCalculator.cs index ca64636076..f6addab279 100644 --- a/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon/PippidonDifficultyCalculator.cs +++ b/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon/PippidonDifficultyCalculator.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; @@ -25,6 +26,6 @@ namespace osu.Game.Rulesets.Pippidon protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) => Enumerable.Empty(); - protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => new Skill[0]; + protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => Array.Empty(); } } diff --git a/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling/EmptyScrollingDifficultyCalculator.cs b/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling/EmptyScrollingDifficultyCalculator.cs index 63a8b48b3c..a4dc1762d5 100644 --- a/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling/EmptyScrollingDifficultyCalculator.cs +++ b/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling/EmptyScrollingDifficultyCalculator.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; @@ -25,6 +26,6 @@ namespace osu.Game.Rulesets.EmptyScrolling protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) => Enumerable.Empty(); - protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => new Skill[0]; + protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => Array.Empty(); } } diff --git a/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon/PippidonDifficultyCalculator.cs b/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon/PippidonDifficultyCalculator.cs index ca64636076..f6addab279 100644 --- a/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon/PippidonDifficultyCalculator.cs +++ b/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon/PippidonDifficultyCalculator.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; @@ -25,6 +26,6 @@ namespace osu.Game.Rulesets.Pippidon protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) => Enumerable.Empty(); - protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => new Skill[0]; + protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => Array.Empty(); } } diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneFlyingHits.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneFlyingHits.cs index 63854e7ead..5c7e3954e8 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneFlyingHits.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneFlyingHits.cs @@ -28,9 +28,7 @@ namespace osu.Game.Rulesets.Taiko.Tests // flying hits all land in one common scrolling container (and stay there for rewind purposes), // so we need to manually get the latest one. - flyingHit = this.ChildrenOfType() - .OrderByDescending(h => h.HitObject.StartTime) - .FirstOrDefault(); + flyingHit = this.ChildrenOfType().MaxBy(h => h.HitObject.StartTime); }); AddAssert("hit type is correct", () => flyingHit.HitObject.Type == hitType); diff --git a/osu.Game.Tests/Online/TestAPIModJsonSerialization.cs b/osu.Game.Tests/Online/TestAPIModJsonSerialization.cs index e98ea98bb2..0622514783 100644 --- a/osu.Game.Tests/Online/TestAPIModJsonSerialization.cs +++ b/osu.Game.Tests/Online/TestAPIModJsonSerialization.cs @@ -33,9 +33,10 @@ namespace osu.Game.Tests.Online var converted = deserialized?.ToMod(new TestRuleset()); + Assert.NotNull(converted); Assert.That(converted, Is.TypeOf(typeof(UnknownMod))); - Assert.That(converted?.Type, Is.EqualTo(ModType.System)); - Assert.That(converted?.Acronym, Is.EqualTo("WNG??")); + Assert.That(converted.Type, Is.EqualTo(ModType.System)); + Assert.That(converted.Acronym, Is.EqualTo("WNG??")); } [Test] diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs index 6b3fc304e0..ae2bc60fc6 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs @@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.Gameplay AddUntilStep("get variables", () => { sampleDisabler = Player; - slider = Player.ChildrenOfType().OrderBy(s => s.HitObject.StartTime).FirstOrDefault(); + slider = Player.ChildrenOfType().MinBy(s => s.HitObject.StartTime); samples = slider?.ChildrenOfType().ToArray(); return slider != null; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs index cb73985b11..960c4f41cc 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs @@ -36,11 +36,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components bool progressionToRight = q2.TopLeft.X > q1.TopLeft.X; if (!progressionToRight) - { - var temp = q2; - q2 = q1; - q1 = temp; - } + (q2, q1) = (q1, q2); var c1 = getCenteredVector(q1.TopRight, q1.BottomRight) + new Vector2(padding, 0); var c2 = getCenteredVector(q2.TopLeft, q2.BottomLeft) - new Vector2(padding, 0); diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index 7d59c95396..591e4cf73e 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -253,7 +253,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores noScoresPlaceholder.Hide(); - if (Beatmap.Value == null || Beatmap.Value.OnlineID <= 0 || (Beatmap.Value?.BeatmapSet as IBeatmapSetOnlineInfo)?.Status <= BeatmapOnlineStatus.Pending) + if (Beatmap.Value == null || Beatmap.Value.OnlineID <= 0 || (Beatmap.Value.BeatmapSet as IBeatmapSetOnlineInfo)?.Status <= BeatmapOnlineStatus.Pending) { Scores = null; Hide(); diff --git a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs index 795dddfaf5..0d759bacf0 100644 --- a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs +++ b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs @@ -106,7 +106,7 @@ namespace osu.Game.Screens.Play new Sprite { RelativeSizeAxes = Axes.Both, - Texture = beatmap?.Background, + Texture = beatmap.Background, Origin = Anchor.Centre, Anchor = Anchor.Centre, FillMode = FillMode.Fill, @@ -126,7 +126,7 @@ namespace osu.Game.Screens.Play { new OsuSpriteText { - Text = beatmap?.BeatmapInfo?.DifficultyName, + Text = beatmap.BeatmapInfo.DifficultyName, Font = OsuFont.GetFont(size: 26, italics: true), Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 2ff0f4d30b..68cf8138e2 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -118,6 +118,7 @@ WARNING WARNING WARNING + HINT WARNING WARNING WARNING From 7160a48bab4fc69166e30c19954d0585528097f2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 12:33:59 +0900 Subject: [PATCH 0233/2328] Adjust hold to confirm animation curve to better show intention --- osu.Game/Graphics/Containers/HoldToConfirmContainer.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs index b2f08eee0a..1b802a0a14 100644 --- a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs +++ b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs @@ -70,7 +70,10 @@ namespace osu.Game.Graphics.Containers confirming = false; Fired = false; - this.TransformBindableTo(Progress, 0, fadeout_delay, Easing.Out); + this + .TransformBindableTo(Progress, Progress.Value) + .Delay(200) + .TransformBindableTo(Progress, 0, fadeout_delay, Easing.InSine); } } } From 46cce94a75ee41c1b13501a5e18f8c7c3f58dfd1 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 14 Apr 2022 14:34:43 +0900 Subject: [PATCH 0234/2328] Add inspectcode CI cache --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95864a79f5..5e7f9628fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,6 +120,12 @@ jobs: - name: Restore Packages run: dotnet restore + - name: Restore inspectcode cache + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/inspectcode + key: inspectcode-${{ hashFiles('.config/dotnet-tools.json') }}-${{ hashFiles('.github/workflows/ci.yml' ) }} + - name: CodeFileSanity run: | # TODO: Add ignore filters and GitHub Workflow Command Reporting in CFS. That way we don't have to do this workaround. @@ -138,7 +144,7 @@ jobs: # run: dotnet format --dry-run --check - name: InspectCode - run: dotnet jb inspectcode $(pwd)/osu.Desktop.slnf --no-build --output="inspectcodereport.xml" --verbosity=WARN + run: dotnet jb inspectcode $(pwd)/osu.Desktop.slnf --no-build --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN - name: NVika run: dotnet nvika parsereport "${{github.workspace}}/inspectcodereport.xml" --treatwarningsaserrors From f48a9ba90a611424d57e55832316d0177e645dac Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 16:19:32 +0900 Subject: [PATCH 0235/2328] Add test coverage of nested screen stacks not handling dialog dismissal properly --- .../Navigation/TestScenePerformFromScreen.cs | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs index 1ebceed15d..5c5d6679aa 100644 --- a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs +++ b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs @@ -10,6 +10,7 @@ using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Overlays; using osu.Game.Screens; +using osu.Game.Screens.Edit; using osu.Game.Screens.Menu; using osu.Game.Screens.Play; using osu.Game.Tests.Beatmaps.IO; @@ -171,6 +172,46 @@ namespace osu.Game.Tests.Visual.Navigation } } + [TestCase(true)] + [TestCase(false)] + public void TestPerformBlockedByDialogSubScreen(bool confirm) + { + TestScreenWithNestedStack screenWithNestedStack = null; + + PushAndConfirm(() => screenWithNestedStack = new TestScreenWithNestedStack()); + + AddAssert("wait for nested screen", () => screenWithNestedStack.SubScreenStack.CurrentScreen == screenWithNestedStack.Blocker); + + AddStep("try to perform", () => Game.PerformFromScreen(_ => actionPerformed = true)); + + AddUntilStep("wait for dialog", () => screenWithNestedStack.Blocker.ExitAttempts == 1); + + AddWaitStep("wait a bit", 10); + + AddUntilStep("wait for dialog display", () => Game.Dependencies.Get().IsLoaded); + + AddAssert("screen didn't change", () => Game.ScreenStack.CurrentScreen == screenWithNestedStack); + AddAssert("nested screen didn't change", () => screenWithNestedStack.SubScreenStack.CurrentScreen == screenWithNestedStack.Blocker); + + AddAssert("did not perform", () => !actionPerformed); + + AddAssert("only one exit attempt", () => screenWithNestedStack.Blocker.ExitAttempts == 1); + + if (confirm) + { + AddStep("accept dialog", () => InputManager.Key(Key.Number1)); + AddAssert("nested screen changed", () => screenWithNestedStack.SubScreenStack.CurrentScreen != screenWithNestedStack.Blocker); + AddUntilStep("did perform", () => actionPerformed); + } + else + { + AddStep("cancel dialog", () => InputManager.Key(Key.Number2)); + AddAssert("screen didn't change", () => Game.ScreenStack.CurrentScreen == screenWithNestedStack); + AddAssert("nested screen didn't change", () => screenWithNestedStack.SubScreenStack.CurrentScreen == screenWithNestedStack.Blocker); + AddAssert("did not perform", () => !actionPerformed); + } + } + private void importAndWaitForSongSelect() { AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely()); @@ -200,5 +241,30 @@ namespace osu.Game.Tests.Visual.Navigation return base.OnExiting(next); } } + + public class TestScreenWithNestedStack : OsuScreen, IHasSubScreenStack + { + public DialogBlockingScreen Blocker { get; private set; } + + public ScreenStack SubScreenStack { get; } = new ScreenStack(); + + public TestScreenWithNestedStack() + { + AddInternal(SubScreenStack); + + SubScreenStack.Push(Blocker = new DialogBlockingScreen()); + } + + public override bool OnExiting(IScreen next) + { + if (SubScreenStack.CurrentScreen != null) + { + SubScreenStack.CurrentScreen.Exit(); + return true; + } + + return base.OnExiting(next); + } + } } } From f9d9e6aa61ee45c7d605441ea77a6892a1f07ce8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 15:58:03 +0900 Subject: [PATCH 0236/2328] Ensure popup dialogs are hidden before running any associated actions --- osu.Game/Overlays/Dialog/PopupDialog.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index a70a7f26cc..f5e6aed41b 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -87,10 +87,13 @@ namespace osu.Game.Overlays.Dialog { if (actionInvoked) return; + // Hide the dialog before running the action. + // This is important as the code which is performed may check for a dialog being present (ie. `OsuGame.PerformFromScreen`) + // and we don't want it to see the already dismissed dialog. + Hide(); + actionInvoked = true; action?.Invoke(); - - Hide(); }; } } From 2bc4bb9e206dd4c7ec337ddd44c8690ffe8ad787 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 16:03:34 +0900 Subject: [PATCH 0237/2328] Consider `SubScreenStack`s when allowing for exit confirmation sequence in `PerformFromMenuRunner` --- osu.Game/PerformFromMenuRunner.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osu.Game/PerformFromMenuRunner.cs b/osu.Game/PerformFromMenuRunner.cs index 6f979b8dc8..7f0db96e6d 100644 --- a/osu.Game/PerformFromMenuRunner.cs +++ b/osu.Game/PerformFromMenuRunner.cs @@ -125,6 +125,18 @@ namespace osu.Game /// Whether a dialog blocked interaction. private bool checkForDialog(IScreen current) { + // An exit process may traverse multiple levels. + // When checking for dismissing dialogs, let's also consider sub screens. + while (current is IHasSubScreenStack currentWithSubScreenStack) + { + var nestedCurrent = currentWithSubScreenStack.SubScreenStack.CurrentScreen; + + if (nestedCurrent == null) + break; + + current = nestedCurrent; + } + var currentDialog = dialogOverlay.CurrentDialog; if (lastEncounteredDialog != null) From 8b901fe60b2b4de540008ac3efab127213e02bdb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 16:22:40 +0900 Subject: [PATCH 0238/2328] Fix potential null reference when running recursive `findValidTarget` --- osu.Game/PerformFromMenuRunner.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/PerformFromMenuRunner.cs b/osu.Game/PerformFromMenuRunner.cs index 7f0db96e6d..528470768c 100644 --- a/osu.Game/PerformFromMenuRunner.cs +++ b/osu.Game/PerformFromMenuRunner.cs @@ -97,11 +97,14 @@ namespace osu.Game // if this has a sub stack, recursively check the screens within it. if (current is IHasSubScreenStack currentSubScreen) { - if (findValidTarget(currentSubScreen.SubScreenStack.CurrentScreen)) + var nestedCurrent = currentSubScreen.SubScreenStack.CurrentScreen; + + if (nestedCurrent != null) { // should be correct in theory, but currently untested/unused in existing implementations. - current.MakeCurrent(); - return true; + // note that calling findValidTarget actually performs the final operation. + if (findValidTarget(nestedCurrent)) + return true; } } From 58d5cf4560d35f5100681d1dd069e8424f31d16d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 16:37:59 +0900 Subject: [PATCH 0239/2328] Remove unused using statement --- osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs index 5c5d6679aa..f045e3a3e8 100644 --- a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs +++ b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs @@ -10,7 +10,6 @@ using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Overlays; using osu.Game.Screens; -using osu.Game.Screens.Edit; using osu.Game.Screens.Menu; using osu.Game.Screens.Play; using osu.Game.Tests.Beatmaps.IO; From e010dfb1500c445ba8016ae9eb3eee2305d113ed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 17:32:47 +0900 Subject: [PATCH 0240/2328] Handle virtual track string to avoid throwing later in lookup --- osu.Game/Beatmaps/WorkingBeatmapCache.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmapCache.cs b/osu.Game/Beatmaps/WorkingBeatmapCache.cs index 7d28208157..bc810ee35e 100644 --- a/osu.Game/Beatmaps/WorkingBeatmapCache.cs +++ b/osu.Game/Beatmaps/WorkingBeatmapCache.cs @@ -26,6 +26,11 @@ namespace osu.Game.Beatmaps { private readonly WeakList workingCache = new WeakList(); + /// + /// Beatmap files may specify this filename to denote that they don't have an audio track. + /// + private const string virtual_track_filename = @"virtual"; + /// /// A default representation of a WorkingBeatmap to use when no beatmap is available. /// @@ -40,7 +45,8 @@ namespace osu.Game.Beatmaps [CanBeNull] private readonly GameHost host; - public WorkingBeatmapCache(ITrackStore trackStore, AudioManager audioManager, IResourceStore resources, IResourceStore files, WorkingBeatmap defaultBeatmap = null, GameHost host = null) + public WorkingBeatmapCache(ITrackStore trackStore, AudioManager audioManager, IResourceStore resources, IResourceStore files, WorkingBeatmap defaultBeatmap = null, + GameHost host = null) { DefaultBeatmap = defaultBeatmap; @@ -157,6 +163,9 @@ namespace osu.Game.Beatmaps if (string.IsNullOrEmpty(Metadata?.AudioFile)) return null; + if (Metadata.AudioFile == virtual_track_filename) + return null; + try { return resources.Tracks.Get(BeatmapSetInfo.GetPathForFile(Metadata.AudioFile)); @@ -173,6 +182,9 @@ namespace osu.Game.Beatmaps if (string.IsNullOrEmpty(Metadata?.AudioFile)) return null; + if (Metadata.AudioFile == virtual_track_filename) + return null; + try { var trackData = GetStream(BeatmapSetInfo.GetPathForFile(Metadata.AudioFile)); From 1fdf742d3888fca4cf89e26f441ab4ef0b8e3a7d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 17:51:50 +0900 Subject: [PATCH 0241/2328] Fix potentially incorrect button being pressed during `PopupDialog` hide due to flag set too late --- osu.Game/Overlays/Dialog/PopupDialog.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index f5e6aed41b..6159ab59f0 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -87,12 +87,13 @@ namespace osu.Game.Overlays.Dialog { if (actionInvoked) return; + actionInvoked = true; + // Hide the dialog before running the action. // This is important as the code which is performed may check for a dialog being present (ie. `OsuGame.PerformFromScreen`) // and we don't want it to see the already dismissed dialog. Hide(); - actionInvoked = true; action?.Invoke(); }; } From c8db7cf2a89dec23eec10b0ec217ef28802dd47a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 18:09:23 +0900 Subject: [PATCH 0242/2328] Reset audio offset before each test run in `TestSceneMasterGameplayClockContainer` --- .../Gameplay/TestSceneMasterGameplayClockContainer.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs b/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs index 75be7b0362..5c04ac88a7 100644 --- a/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs +++ b/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs @@ -26,6 +26,12 @@ namespace osu.Game.Tests.Gameplay Dependencies.Cache(localConfig = new OsuConfigManager(LocalStorage)); } + [SetUpSteps] + public void SetUpSteps() + { + AddStep("reset audio offset", () => localConfig.SetValue(OsuSetting.AudioOffset, 0.0)); + } + [Test] public void TestStartThenElapsedTime() { From 2abdbe53e7e90a7dfb86541ee475a93fe4ec6665 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 14 Apr 2022 18:55:12 +0900 Subject: [PATCH 0243/2328] Cleanup whitespace --- osu.Game/Screens/Play/MasterGameplayClockContainer.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs index c5a5c14070..ea43fb1546 100644 --- a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs +++ b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs @@ -251,7 +251,6 @@ namespace osu.Game.Screens.Play } private class HardwareCorrectionOffsetClock : FramedOffsetClock - { private readonly BindableDouble pauseRateAdjust; @@ -297,7 +296,6 @@ namespace osu.Game.Screens.Play } private class MasterGameplayClock : GameplayClock - { public readonly List> MutableNonGameplayAdjustments = new List>(); public override IEnumerable> NonGameplayAdjustments => MutableNonGameplayAdjustments; From 392ce7390e179d58ae582afcb3bd8e393f844236 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 18:58:16 +0900 Subject: [PATCH 0244/2328] Add test scene covering `ScalingContainer` delayed animations --- .../TestSceneScalingContainer.cs | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneScalingContainer.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneScalingContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneScalingContainer.cs new file mode 100644 index 0000000000..5d554719a5 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneScalingContainer.cs @@ -0,0 +1,114 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Shapes; +using osu.Game.Configuration; +using osu.Game.Graphics.Containers; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Tests.Visual.UserInterface +{ + [TestFixture] + public class TestSceneScalingContainer : OsuTestScene + { + private OsuConfigManager osuConfigManager { get; set; } + + private ScalingContainer scaling1; + private ScalingContainer scaling2; + private Box scaleTarget; + + [BackgroundDependencyLoader] + private void load() + { + osuConfigManager = new OsuConfigManager(LocalStorage); + + Dependencies.CacheAs(osuConfigManager); + + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + scaling1 = new ScalingContainer(ScalingMode.Everything) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Scale = new Vector2(0.8f), + Children = new Drawable[] + { + scaling2 = new ScalingContainer(ScalingMode.Everything) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Scale = new Vector2(0.8f), + Children = new Drawable[] + { + new Box + { + Colour = Color4.Purple, + RelativeSizeAxes = Axes.Both, + }, + scaleTarget = new Box + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Colour = Color4.White, + Size = new Vector2(100), + }, + } + } + } + } + } + }, + }; + } + + [Test] + public void TestScaling() + { + AddStep("adjust scale", () => osuConfigManager.SetValue(OsuSetting.UIScale, 2f)); + + checkForCorrectness(); + + AddStep("adjust scale", () => osuConfigManager.SetValue(OsuSetting.UIScale, 0.5f)); + + checkForCorrectness(); + } + + private void checkForCorrectness() + { + Quad? scaling1LastQuad = null; + Quad? scaling2LastQuad = null; + Quad? scalingTargetLastQuad = null; + + AddUntilStep("ensure dimensions don't change", () => + { + if (scaling1LastQuad.HasValue && scaling2LastQuad.HasValue) + { + // check inter-frame changes to make sure they match expectations. + Assert.That(scaling1.ScreenSpaceDrawQuad.AlmostEquals(scaling1LastQuad.Value), Is.True); + Assert.That(scaling2.ScreenSpaceDrawQuad.AlmostEquals(scaling2LastQuad.Value), Is.True); + } + + scaling1LastQuad = scaling1.ScreenSpaceDrawQuad; + scaling2LastQuad = scaling2.ScreenSpaceDrawQuad; + + // wait for scaling to stop. + bool scalingFinished = scalingTargetLastQuad.HasValue && scaleTarget.ScreenSpaceDrawQuad.AlmostEquals(scalingTargetLastQuad.Value); + + scalingTargetLastQuad = scaleTarget.ScreenSpaceDrawQuad; + + return scalingFinished; + }); + } + } +} From bb4322a4c488a429580bbd191e4e5415de96679f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 18:58:20 +0900 Subject: [PATCH 0245/2328] Fix UI scale being applied unevenly, causing elements to move around relative to each other --- .../Graphics/Containers/ScalingContainer.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index 58d18e1b21..12e570d62d 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -21,6 +21,8 @@ namespace osu.Game.Graphics.Containers /// public class ScalingContainer : Container { + private const float duration = 500; + private Bindable sizeX; private Bindable sizeY; private Bindable posX; @@ -82,6 +84,8 @@ namespace osu.Game.Graphics.Containers private readonly bool applyUIScale; private Bindable uiScale; + private readonly Bindable currentScale = new Bindable(1); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; public ScalingDrawSizePreservingFillContainer(bool applyUIScale) @@ -101,8 +105,15 @@ namespace osu.Game.Graphics.Containers private void scaleChanged(ValueChangedEvent args) { - this.ScaleTo(new Vector2(args.NewValue), 500, Easing.Out); - this.ResizeTo(new Vector2(1 / args.NewValue), 500, Easing.Out); + this.TransformBindableTo(currentScale, args.NewValue, duration, Easing.OutQuart); + } + + protected override void Update() + { + Scale = new Vector2(currentScale.Value); + Size = new Vector2(1 / currentScale.Value); + + base.Update(); } } @@ -140,8 +151,6 @@ namespace osu.Game.Graphics.Containers private void updateSize() { - const float duration = 500; - if (targetMode == ScalingMode.Everything) { // the top level scaling container manages the background to be displayed while scaling. From 7582c2a5e8f5cab06caeda0d3831026f6e644b6d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 19:13:54 +0900 Subject: [PATCH 0246/2328] Remove unnecessary bindable --- osu.Game/Graphics/Containers/ScalingContainer.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index 12e570d62d..ca8b6f388f 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -84,7 +84,7 @@ namespace osu.Game.Graphics.Containers private readonly bool applyUIScale; private Bindable uiScale; - private readonly Bindable currentScale = new Bindable(1); + private float currentScale = 1; public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; @@ -99,19 +99,14 @@ namespace osu.Game.Graphics.Containers if (applyUIScale) { uiScale = osuConfig.GetBindable(OsuSetting.UIScale); - uiScale.BindValueChanged(scaleChanged, true); + uiScale.BindValueChanged(args => this.TransformTo(nameof(currentScale), args.NewValue, duration, Easing.OutQuart), true); } } - private void scaleChanged(ValueChangedEvent args) - { - this.TransformBindableTo(currentScale, args.NewValue, duration, Easing.OutQuart); - } - protected override void Update() { - Scale = new Vector2(currentScale.Value); - Size = new Vector2(1 / currentScale.Value); + Scale = new Vector2(currentScale); + Size = new Vector2(1 / currentScale); base.Update(); } From 566a20a623a5d82f73d4e11f6c2ea9836ce14566 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Apr 2022 13:27:06 +0300 Subject: [PATCH 0247/2328] Add keyword "delay" to hold-to-confirm activation time setting --- .../Overlays/Settings/Sections/UserInterface/GeneralSettings.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs index 59894cbcae..6e1558f7d7 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs @@ -39,6 +39,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface { LabelText = UserInterfaceStrings.HoldToConfirmActivationTime, Current = config.GetBindable(OsuSetting.UIHoldActivationDelay), + Keywords = new[] { @"delay" }, KeyboardStep = 50 }, }; From 74bfb25c78d58ad5cc8dacb1f04428f703f6a586 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 19:30:02 +0900 Subject: [PATCH 0248/2328] Commit new rider metadata changes --- .idea/.idea.osu.Desktop/.idea/misc.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.idea/.idea.osu.Desktop/.idea/misc.xml b/.idea/.idea.osu.Desktop/.idea/misc.xml index 1d8c84d0af..4e1d56f4dd 100644 --- a/.idea/.idea.osu.Desktop/.idea/misc.xml +++ b/.idea/.idea.osu.Desktop/.idea/misc.xml @@ -1,5 +1,10 @@ + + + From 59bb6b8f7cbbde0078a51c88e51245bdc9ea88c3 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Apr 2022 13:43:09 +0300 Subject: [PATCH 0249/2328] Add background dim effect to inactive settings sections --- osu.Game/Overlays/Settings/SettingsSection.cs | 53 +++++++++++++------ 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index 2539c32806..50a82b3d96 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -13,6 +13,7 @@ using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osuTK; +using osuTK.Graphics; namespace osu.Game.Overlays.Settings { @@ -23,6 +24,8 @@ namespace osu.Game.Overlays.Settings private IBindable selectedSection; + private Box dim; + private OsuSpriteText header; public abstract Drawable CreateIcon(); @@ -78,25 +81,40 @@ namespace osu.Game.Overlays.Settings }, new Container { - Padding = new MarginPadding - { - Top = 28, - Bottom = 40, - }, + Padding = new MarginPadding { Top = border_size }, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new Drawable[] { - header = new OsuSpriteText + dim = new Box { - Font = OsuFont.TorusAlternate.With(size: header_size), - Text = Header, - Margin = new MarginPadding - { - Horizontal = SettingsPanel.CONTENT_MARGINS - } + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Alpha = 0f, }, - FlowContent + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding + { + Top = 24, + Bottom = 40, + }, + Children = new Drawable[] + { + header = new OsuSpriteText + { + Font = OsuFont.TorusAlternate.With(size: header_size), + Text = Header, + Margin = new MarginPadding + { + Horizontal = SettingsPanel.CONTENT_MARGINS + } + }, + FlowContent + } + } } }, }); @@ -135,15 +153,16 @@ namespace osu.Game.Overlays.Settings private void updateContentFade() { float contentFade = 1; - float headerFade = 1; + float dimFade = 0; if (!isCurrentSection) { - contentFade = 0.25f; - headerFade = IsHovered ? 0.5f : 0.25f; + contentFade = IsHovered ? 0.5f : 0.25f; + dimFade = IsHovered ? 0.125f : 0.25f; } - header.FadeTo(headerFade, 500, Easing.OutQuint); + dim.FadeTo(dimFade, 500, Easing.OutQuint); + header.FadeTo(contentFade, 500, Easing.OutQuint); FlowContent.FadeTo(contentFade, 500, Easing.OutQuint); } } From 50a478ea5f3a5538eca5d9254644f9286680809c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 20:05:13 +0900 Subject: [PATCH 0250/2328] Add failing test coverage of searching too fast not hiding filtered settings --- .../Visual/Settings/TestSceneSettingsPanel.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs index f9c9b2a68b..0de1cedd0c 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs @@ -4,10 +4,12 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; +using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings.Sections; using osu.Game.Overlays.Settings.Sections.Input; using osuTK.Input; @@ -34,6 +36,26 @@ namespace osu.Game.Tests.Visual.Settings }); } + [Test] + public void TestQuickFiltering() + { + AddStep("set filter", () => + { + settings.SectionsContainer.ChildrenOfType().First().Current.Value = "scaling"; + }); + + AddUntilStep("wait for items to load", () => settings.SectionsContainer.ChildrenOfType().Any()); + + AddAssert("ensure all items match filter", () => settings.SectionsContainer + .ChildrenOfType().Where(f => f.IsPresent) + .All(section => + section.ChildrenOfType().Where(f => f.IsPresent) + .OfType() + .Where(f => !(f is IHasFilterableChildren)) + .All(f => f.FilterTerms.Any(t => t.Contains("scaling"))) + )); + } + [Test] public void ToggleVisibility() { From 296420ae08b41305e179dfcd0cf0f935971e8ed1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 20:06:00 +0900 Subject: [PATCH 0251/2328] Fix settings textbox focus operation running too late --- osu.Game/Overlays/SettingsPanel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SettingsPanel.cs b/osu.Game/Overlays/SettingsPanel.cs index b11b6fde27..ea386e26c6 100644 --- a/osu.Game/Overlays/SettingsPanel.cs +++ b/osu.Game/Overlays/SettingsPanel.cs @@ -163,6 +163,7 @@ namespace osu.Game.Overlays Sidebar?.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint); this.FadeTo(1, TRANSITION_LENGTH, Easing.OutQuint); + searchTextBox.TakeFocus(); searchTextBox.HoldFocus = true; } @@ -213,7 +214,6 @@ namespace osu.Game.Overlays loading.Hide(); searchTextBox.Current.BindValueChanged(term => SectionsContainer.SearchTerm = term.NewValue, true); - searchTextBox.TakeFocus(); loadSidebarButtons(); }); From 9c7af9898213d92e214e6e8683a52c8265292f29 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 20:06:15 +0900 Subject: [PATCH 0252/2328] Fix alpha cross-talk causing settings to potentially not filter when they should --- osu.Game/Overlays/Settings/SettingsItem.cs | 7 +++---- osu.Game/Overlays/Settings/SettingsSection.cs | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 098090bf78..2d139a01e9 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -100,10 +100,9 @@ namespace osu.Game.Overlays.Settings public IEnumerable Keywords { get; set; } - public bool MatchingFilter - { - set => Alpha = value ? 1 : 0; - } + public override bool IsPresent => MatchingFilter; + + public bool MatchingFilter { get; set; } public bool FilteringActive { get; set; } diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index 2539c32806..a39aacf6b8 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -21,6 +21,8 @@ namespace osu.Game.Overlays.Settings protected FillFlowContainer FlowContent; protected override Container Content => FlowContent; + public override bool IsPresent => MatchingFilter; + private IBindable selectedSection; private OsuSpriteText header; @@ -36,10 +38,7 @@ namespace osu.Game.Overlays.Settings private const int header_size = 24; private const int border_size = 4; - public bool MatchingFilter - { - set => this.FadeTo(value ? 1 : 0); - } + public bool MatchingFilter { get; set; } public bool FilteringActive { get; set; } From 21a5a2fd697322acdbc535797b9b6727a7023e97 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 20:36:48 +0900 Subject: [PATCH 0253/2328] Add failing test coverage of incorrect current section after quick setting search --- osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs index 0de1cedd0c..66242b19cd 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs @@ -54,6 +54,8 @@ namespace osu.Game.Tests.Visual.Settings .Where(f => !(f is IHasFilterableChildren)) .All(f => f.FilterTerms.Any(t => t.Contains("scaling"))) )); + + AddAssert("ensure section is current", () => settings.CurrentSection.Value != null); } [Test] From 316c0845ec8f56c92d36ea702038b3ec545e24e1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 20:36:11 +0900 Subject: [PATCH 0254/2328] Fix current section not being correct after early search --- osu.Game/Overlays/SettingsPanel.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SettingsPanel.cs b/osu.Game/Overlays/SettingsPanel.cs index ea386e26c6..8c1129508a 100644 --- a/osu.Game/Overlays/SettingsPanel.cs +++ b/osu.Game/Overlays/SettingsPanel.cs @@ -287,7 +287,10 @@ namespace osu.Game.Overlays set { SearchContainer.SearchTerm = value; - InvalidateScrollPosition(); + + // Schedule required as search term takes a frame to update. + // Without this sections may not be in the correct state to ascertain CurrentSection. + Schedule(InvalidateScrollPosition); } } From f19208a2451d26a7973f2361b3d7e4250964ffed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 21:04:52 +0900 Subject: [PATCH 0255/2328] Move dim layer to top and only apply dimming at one location --- osu.Game/Overlays/Settings/SettingsSection.cs | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index 50a82b3d96..49f0d5c153 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -13,7 +13,6 @@ using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osuTK; -using osuTK.Graphics; namespace osu.Game.Overlays.Settings { @@ -26,8 +25,6 @@ namespace osu.Game.Overlays.Settings private Box dim; - private OsuSpriteText header; - public abstract Drawable CreateIcon(); public abstract LocalisableString Header { get; } @@ -86,12 +83,6 @@ namespace osu.Game.Overlays.Settings AutoSizeAxes = Axes.Y, Children = new Drawable[] { - dim = new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - Alpha = 0f, - }, new Container { RelativeSizeAxes = Axes.X, @@ -103,7 +94,7 @@ namespace osu.Game.Overlays.Settings }, Children = new Drawable[] { - header = new OsuSpriteText + new OsuSpriteText { Font = OsuFont.TorusAlternate.With(size: header_size), Text = Header, @@ -114,7 +105,13 @@ namespace osu.Game.Overlays.Settings }, FlowContent } - } + }, + dim = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Background5, + Alpha = 0f, + }, } }, }); @@ -152,18 +149,12 @@ namespace osu.Game.Overlays.Settings private void updateContentFade() { - float contentFade = 1; float dimFade = 0; if (!isCurrentSection) - { - contentFade = IsHovered ? 0.5f : 0.25f; - dimFade = IsHovered ? 0.125f : 0.25f; - } + dimFade = IsHovered ? 0.5f : 0.8f; - dim.FadeTo(dimFade, 500, Easing.OutQuint); - header.FadeTo(contentFade, 500, Easing.OutQuint); - FlowContent.FadeTo(contentFade, 500, Easing.OutQuint); + dim.FadeTo(dimFade, 300, Easing.OutQuint); } } } From 9240148c8e817869fcddc59f093f2eeb916c13dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 21:16:54 +0900 Subject: [PATCH 0256/2328] Avoid initial fade of dim layer --- osu.Game/Overlays/Settings/SettingsSection.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index 49f0d5c153..6645d20dbe 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -25,6 +25,8 @@ namespace osu.Game.Overlays.Settings private Box dim; + private const float inactive_alpha = 0.8f; + public abstract Drawable CreateIcon(); public abstract LocalisableString Header { get; } @@ -110,7 +112,7 @@ namespace osu.Game.Overlays.Settings { RelativeSizeAxes = Axes.Both, Colour = colourProvider.Background5, - Alpha = 0f, + Alpha = inactive_alpha, }, } }, @@ -152,7 +154,9 @@ namespace osu.Game.Overlays.Settings float dimFade = 0; if (!isCurrentSection) - dimFade = IsHovered ? 0.5f : 0.8f; + { + dimFade = IsHovered ? 0.5f : inactive_alpha; + } dim.FadeTo(dimFade, 300, Easing.OutQuint); } From b0889590458b16f1c43acb3ec5966af00e72a196 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 21:17:06 +0900 Subject: [PATCH 0257/2328] Reduce settings fade in duration to higher alpha/colour cross-talk --- osu.Game/Overlays/SettingsPanel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SettingsPanel.cs b/osu.Game/Overlays/SettingsPanel.cs index b11b6fde27..d5b36713f3 100644 --- a/osu.Game/Overlays/SettingsPanel.cs +++ b/osu.Game/Overlays/SettingsPanel.cs @@ -197,7 +197,7 @@ namespace osu.Game.Overlays ContentContainer.Margin = new MarginPadding { Left = Sidebar?.DrawWidth ?? 0 }; } - private const double fade_in_duration = 1000; + private const double fade_in_duration = 500; private void loadSections() { From c57a918bbba4d3cb329b0c5a130e825d06571f7f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Apr 2022 23:02:00 +0900 Subject: [PATCH 0258/2328] Mark settings elements as matching filter by default to handle cases where no filtering is provided --- osu.Game/Overlays/Settings/SettingsItem.cs | 2 +- osu.Game/Overlays/Settings/SettingsSection.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 2d139a01e9..329917d50a 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -102,7 +102,7 @@ namespace osu.Game.Overlays.Settings public override bool IsPresent => MatchingFilter; - public bool MatchingFilter { get; set; } + public bool MatchingFilter { get; set; } = true; public bool FilteringActive { get; set; } diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index a39aacf6b8..cd012f10c7 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Settings private const int header_size = 24; private const int border_size = 4; - public bool MatchingFilter { get; set; } + public bool MatchingFilter { get; set; } = true; public bool FilteringActive { get; set; } From a0ac316d6e9eed23f86bfe334d34fab6129d834e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Apr 2022 01:41:55 +0900 Subject: [PATCH 0259/2328] Fix test matching conditions --- osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs index 66242b19cd..71c001887a 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs @@ -49,7 +49,8 @@ namespace osu.Game.Tests.Visual.Settings AddAssert("ensure all items match filter", () => settings.SectionsContainer .ChildrenOfType().Where(f => f.IsPresent) .All(section => - section.ChildrenOfType().Where(f => f.IsPresent) + section.Children.Where(f => f.IsPresent) + .OfType() .OfType() .Where(f => !(f is IHasFilterableChildren)) .All(f => f.FilterTerms.Any(t => t.Contains("scaling"))) From 6081c29ae17fe8e202d0bc2ebc9b050a6c7a70b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Apr 2022 10:18:29 +0900 Subject: [PATCH 0260/2328] Remove ununsed using statement --- osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs index 71c001887a..6e2ba88ea0 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs @@ -4,7 +4,6 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; -using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; From 423fae52f7269ea0ce638afb3b0128e3dc41583a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Apr 2022 10:19:36 +0900 Subject: [PATCH 0261/2328] Add back `base.IsPresent` call --- osu.Game/Overlays/Settings/SettingsItem.cs | 2 +- osu.Game/Overlays/Settings/SettingsSection.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 329917d50a..1c5668479f 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -100,7 +100,7 @@ namespace osu.Game.Overlays.Settings public IEnumerable Keywords { get; set; } - public override bool IsPresent => MatchingFilter; + public override bool IsPresent => base.IsPresent && MatchingFilter; public bool MatchingFilter { get; set; } = true; diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index cd012f10c7..ace618aa46 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Settings protected FillFlowContainer FlowContent; protected override Container Content => FlowContent; - public override bool IsPresent => MatchingFilter; + public override bool IsPresent => base.IsPresent && MatchingFilter; private IBindable selectedSection; From a7b04a8c19848c29443378b9c993c81842909c2f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Apr 2022 19:59:38 +0900 Subject: [PATCH 0262/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 331c4db01f..77deec031b 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 308ec7e7d6..cf2245aa3a 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 311c9ba345..b77dff9f41 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 8e6c0158568462e42d50a23307400de8f2c7cb76 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Fri, 15 Apr 2022 20:31:59 +0900 Subject: [PATCH 0263/2328] Use a fallback sample when a MainMenuButton doesn't provide a click sample --- osu.Game/Screens/Menu/MainMenuButton.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Menu/MainMenuButton.cs b/osu.Game/Screens/Menu/MainMenuButton.cs index 88bea43b23..c07ada9419 100644 --- a/osu.Game/Screens/Menu/MainMenuButton.cs +++ b/osu.Game/Screens/Menu/MainMenuButton.cs @@ -185,8 +185,7 @@ namespace osu.Game.Screens.Menu private void load(AudioManager audio) { sampleHover = audio.Samples.Get(@"Menu/button-hover"); - if (!string.IsNullOrEmpty(sampleName)) - sampleClick = audio.Samples.Get($@"Menu/{sampleName}"); + sampleClick = audio.Samples.Get(!string.IsNullOrEmpty(sampleName) ? $@"Menu/{sampleName}" : @"UI/button-select"); } protected override bool OnMouseDown(MouseDownEvent e) From ef5ed262ca83d09bf6cda980fbbbd9201b3eea9e Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Fri, 15 Apr 2022 20:32:41 +0900 Subject: [PATCH 0264/2328] Add pitch randomisation to the OsuLogo hover sample --- osu.Game/Screens/Menu/OsuLogo.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index c82efe2d32..1d3aef0653 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -283,9 +283,15 @@ namespace osu.Game.Screens.Menu this.Delay(early_activation).Schedule(() => { if (beatIndex % timingPoint.TimeSignature.Numerator == 0) - sampleDownbeat.Play(); + { + sampleDownbeat?.Play(); + } else - sampleBeat.Play(); + { + var channel = sampleBeat.GetChannel(); + channel.Frequency.Value = 0.95 + RNG.NextDouble(0.1); + channel.Play(); + } }); } From ceb5b4f9b404b949571c0654858eda885777ea89 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Apr 2022 20:46:49 +0900 Subject: [PATCH 0265/2328] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 77deec031b..ec638f7736 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index cf2245aa3a..be4bee7c9d 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index b77dff9f41..0a0cab91a4 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -62,7 +62,7 @@ - + From f1dd319fd99393c2a9ae2a6741f5621c6d47c77d Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Fri, 15 Apr 2022 15:38:47 +0100 Subject: [PATCH 0266/2328] Implement `ChannelList` for new chat design Reference design: https://www.figma.com/file/f8b2dHp9LJCMOqYP4mdrPZ/Client%2FChat?node-id=1%3A297 Adds new component `ChannelList` which makes up the sidebar channel selector of the new chat design. Contains two separate fill flows for public and private `ChannelItem` child components. Exposed bindable `SelectorActive` to indicate current state of the "Add more channels" button. Requires `Bindable` from parent component. Renames and updates the `TestSceneChannelListItem` to `TestSceneChannelList` to make use of new component and having both tests seemed redundant. --- .../Visual/Online/TestSceneChannelList.cs | 187 ++++++++++++++++++ .../Visual/Online/TestSceneChannelListItem.cs | 163 --------------- .../Overlays/Chat/ChannelList/ChannelList.cs | 174 ++++++++++++++++ .../Chat/ChannelList/ChannelListSelector.cs | 84 ++++++++ 4 files changed, 445 insertions(+), 163 deletions(-) create mode 100644 osu.Game.Tests/Visual/Online/TestSceneChannelList.cs delete mode 100644 osu.Game.Tests/Visual/Online/TestSceneChannelListItem.cs create mode 100644 osu.Game/Overlays/Chat/ChannelList/ChannelList.cs create mode 100644 osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs new file mode 100644 index 0000000000..d6a1e71f0d --- /dev/null +++ b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs @@ -0,0 +1,187 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Testing; +using osu.Framework.Utils; +using osu.Game.Graphics.Sprites; +using osu.Game.Online.API.Requests.Responses; +using osu.Game.Online.Chat; +using osu.Game.Overlays; +using osu.Game.Overlays.Chat.ChannelList; + +namespace osu.Game.Tests.Visual.Online +{ + [TestFixture] + public class TestSceneChannelList : OsuTestScene + { + [Cached] + private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Pink); + + [Cached] + private readonly Bindable selected = new Bindable(); + + private OsuSpriteText selectorText; + private OsuSpriteText selectedText; + private OsuSpriteText leaveText; + private ChannelList channelList; + + [SetUp] + public void SetUp() + { + Schedule(() => + { + Child = new GridContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Height = 0.7f, + RowDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, 20), + new Dimension(GridSizeMode.Absolute, 20), + new Dimension(GridSizeMode.Absolute, 20), + new Dimension(), + }, + Content = new[] + { + new Drawable[] + { + selectorText = new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }, + }, + new Drawable[] + { + selectedText = new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }, + }, + new Drawable[] + { + leaveText = new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }, + }, + new Drawable[] + { + channelList = new ChannelList + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.Y, + Width = 190, + }, + }, + }, + }; + + channelList.OnRequestSelect += channel => + { + channelList.SelectorActive.Value = false; + selected.Value = channel; + }; + + channelList.OnRequestLeave += channel => + { + leaveText.Text = $"OnRequestLeave: {channel.Name}"; + leaveText.FadeOutFromOne(1000, Easing.InQuint); + selected.Value = null; + channelList.RemoveChannel(channel); + }; + + channelList.SelectorActive.BindValueChanged(change => + { + selectorText.Text = $"Channel Selector Active: {change.NewValue}"; + }, true); + + selected.BindValueChanged(change => + { + selectedText.Text = $"Selected Channel: {change.NewValue?.Name ?? "[null]"}"; + }, true); + }); + } + + [SetUpSteps] + public void SetUpSteps() + { + AddStep("Add Public Channels", () => + { + for (int i = 0; i < 10; i++) + channelList.AddChannel(createRandomPublicChannel()); + }); + + AddStep("Add Private Channels", () => + { + for (int i = 0; i < 10; i++) + channelList.AddChannel(createRandomPrivateChannel()); + }); + } + + [Test] + public void TestVisual() + { + AddStep("Unread Selected", () => + { + if (selected.Value != null) + channelList.GetItem(selected.Value).Unread.Value = true; + }); + + AddStep("Read Selected", () => + { + if (selected.Value != null) + channelList.GetItem(selected.Value).Unread.Value = false; + }); + + AddStep("Add Mention Selected", () => + { + if (selected.Value != null) + channelList.GetItem(selected.Value).Mentions.Value++; + }); + + AddStep("Add 98 Mentions Selected", () => + { + if (selected.Value != null) + channelList.GetItem(selected.Value).Mentions.Value += 98; + }); + + AddStep("Clear Mentions Selected", () => + { + if (selected.Value != null) + channelList.GetItem(selected.Value).Mentions.Value = 0; + }); + } + + private Channel createRandomPublicChannel() + { + int id = RNG.Next(0, 10000); + return new Channel + { + Name = $"#channel-{id}", + Type = ChannelType.Public, + Id = id, + }; + } + + private Channel createRandomPrivateChannel() + { + int id = RNG.Next(0, 10000); + return new Channel(new APIUser + { + Id = id, + Username = $"test user {id}", + }); + } + } +} diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelListItem.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelListItem.cs deleted file mode 100644 index af419c8b91..0000000000 --- a/osu.Game.Tests/Visual/Online/TestSceneChannelListItem.cs +++ /dev/null @@ -1,163 +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 NUnit.Framework; -using System.Collections.Generic; -using System.Linq; -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics.Sprites; -using osu.Game.Online.API.Requests.Responses; -using osu.Game.Online.Chat; -using osu.Game.Overlays; -using osu.Game.Overlays.Chat.ChannelList; -using osuTK; - -namespace osu.Game.Tests.Visual.Online -{ - [TestFixture] - public class TestSceneChannelListItem : OsuTestScene - { - [Cached] - private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Pink); - - [Cached] - private readonly Bindable selected = new Bindable(); - - private static readonly List channels = new List - { - createPublicChannel("#public-channel"), - createPublicChannel("#public-channel-long-name"), - createPrivateChannel("test user", 2), - createPrivateChannel("test user long name", 3), - }; - - private readonly Dictionary channelMap = new Dictionary(); - - private FillFlowContainer flow; - private OsuSpriteText selectedText; - private OsuSpriteText leaveText; - - [SetUp] - public void SetUp() - { - Schedule(() => - { - foreach (var item in channelMap.Values) - item.Expire(); - - channelMap.Clear(); - - Child = new FillFlowContainer - { - Direction = FillDirection.Vertical, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Spacing = new Vector2(10), - Children = new Drawable[] - { - selectedText = new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - }, - leaveText = new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Height = 16, - AlwaysPresent = true, - }, - new Container - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - AutoSizeAxes = Axes.Y, - Width = 190, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = colourProvider.Background6, - }, - flow = new FillFlowContainer - { - Direction = FillDirection.Vertical, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - }, - }, - }, - }, - }; - - selected.BindValueChanged(change => - { - selectedText.Text = $"Selected Channel: {change.NewValue?.Name ?? "[null]"}"; - }, true); - - foreach (var channel in channels) - { - var item = new ChannelListItem(channel); - flow.Add(item); - channelMap.Add(channel, item); - item.OnRequestSelect += c => selected.Value = c; - item.OnRequestLeave += leaveChannel; - } - }); - } - - [Test] - public void TestVisual() - { - AddStep("Select second item", () => selected.Value = channels.Skip(1).First()); - - AddStep("Unread Selected", () => - { - if (selected.Value != null) - channelMap[selected.Value].Unread.Value = true; - }); - - AddStep("Read Selected", () => - { - if (selected.Value != null) - channelMap[selected.Value].Unread.Value = false; - }); - - AddStep("Add Mention Selected", () => - { - if (selected.Value != null) - channelMap[selected.Value].Mentions.Value++; - }); - - AddStep("Add 98 Mentions Selected", () => - { - if (selected.Value != null) - channelMap[selected.Value].Mentions.Value += 98; - }); - - AddStep("Clear Mentions Selected", () => - { - if (selected.Value != null) - channelMap[selected.Value].Mentions.Value = 0; - }); - } - - private void leaveChannel(Channel channel) - { - leaveText.Text = $"OnRequestLeave: {channel.Name}"; - leaveText.FadeOutFromOne(1000, Easing.InQuint); - } - - private static Channel createPublicChannel(string name) => - new Channel { Name = name, Type = ChannelType.Public, Id = 1234 }; - - private static Channel createPrivateChannel(string username, int id) - => new Channel(new APIUser { Id = id, Username = username }); - } -} diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs new file mode 100644 index 0000000000..4ffb6be451 --- /dev/null +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -0,0 +1,174 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using System; +using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Online.Chat; +using osuTK; + +namespace osu.Game.Overlays.Chat.ChannelList +{ + public class ChannelList : Container + { + public Action? OnRequestSelect; + public Action? OnRequestLeave; + + public readonly BindableBool SelectorActive = new BindableBool(); + + private readonly Dictionary channelMap = new Dictionary(); + + private ChannelListItemFlow publicChannelFlow = null!; + private ChannelListItemFlow privateChannelFlow = null!; + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Background6, + }, + new ChannelListScrollContainer + { + Padding = new MarginPadding { Vertical = 7 }, + RelativeSizeAxes = Axes.Both, + ScrollbarAnchor = Anchor.TopLeft, + ScrollDistance = 35f, + Child = new FillFlowContainer + { + Direction = FillDirection.Vertical, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + publicChannelFlow = new ChannelListItemFlow("CHANNELS"), + new ChannelListSelector + { + Margin = new MarginPadding { Bottom = 10 }, + SelectorActive = { BindTarget = SelectorActive }, + }, + privateChannelFlow = new ChannelListItemFlow("DIRECT MESSAGES"), + }, + }, + }, + }; + } + + public void AddChannel(Channel channel) + { + if (channelMap.ContainsKey(channel)) + return; + + ChannelListItem item = new ChannelListItem(channel); + item.OnRequestSelect += channel => this.OnRequestSelect?.Invoke(channel); + item.OnRequestLeave += channel => this.OnRequestLeave?.Invoke(channel); + + ChannelListItemFlow flow = getFlowForChannel(channel); + channelMap.Add(channel, item); + flow.Add(item); + } + + public void RemoveChannel(Channel channel) + { + if (!channelMap.ContainsKey(channel)) + return; + + ChannelListItem item = channelMap[channel]; + ChannelListItemFlow flow = getFlowForChannel(channel); + + channelMap.Remove(channel); + flow.Remove(item); + item.Expire(); + } + + public ChannelListItem GetItem(Channel channel) + { + if (!channelMap.ContainsKey(channel)) + throw new ArgumentOutOfRangeException(); + + return channelMap[channel]; + } + + private ChannelListItemFlow getFlowForChannel(Channel channel) + { + switch (channel.Type) + { + case ChannelType.Public: + return publicChannelFlow; + + case ChannelType.PM: + return privateChannelFlow; + + default: + throw new ArgumentOutOfRangeException(); + } + } + + private class ChannelListItemFlow : FillFlowContainer + { + public ChannelListItemFlow(string label) + { + Direction = FillDirection.Vertical; + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + + Add(new OsuSpriteText + { + Text = label, + Margin = new MarginPadding { Left = 18, Bottom = 5 }, + Font = OsuFont.Torus.With(size: 12), + }); + } + } + + private class ChannelListScrollContainer : OsuScrollContainer + { + protected override bool OnHover(HoverEvent e) + { + ScrollbarVisible = true; + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + ScrollbarVisible = false; + base.OnHoverLost(e); + } + + protected override ScrollbarContainer CreateScrollbar(Direction direction) + => new ChannelListScrollBar(direction); + + protected class ChannelListScrollBar : OsuScrollbar + { + private const float BAR_SIZE = 4; + private const float BAR_MARGIN = 7; + + public ChannelListScrollBar(Direction scrollDir) : base(scrollDir) + { + Size = new Vector2(BAR_SIZE); + Margin = new MarginPadding { Left = BAR_MARGIN }; + CornerRadius = 2; + } + + public override void ResizeTo(float val, int duration = 0, Easing easing = Easing.None) + { + Vector2 size = new Vector2(BAR_SIZE, val); + this.ResizeTo(size, duration, easing); + } + } + } + } +} diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs new file mode 100644 index 0000000000..5bc9a01598 --- /dev/null +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs @@ -0,0 +1,84 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Overlays.Chat.ChannelList +{ + public class ChannelListSelector : OsuClickableContainer + { + public readonly BindableBool SelectorActive = new BindableBool(); + + private Box hoverBox = null!; + private Box selectBox = null!; + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + Height = 30; + RelativeSizeAxes = Axes.X; + + Children = new Drawable[] + { + hoverBox = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Background3, + Alpha = 0f, + }, + selectBox = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Background4, + Alpha = 0f, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = 18, Right = 10 }, + Child = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = "Add More Channels", + Font = OsuFont.Torus.With(size: 17, weight: FontWeight.SemiBold), + Colour = colourProvider.Light3, + Margin = new MarginPadding { Bottom = 2 }, + RelativeSizeAxes = Axes.X, + Truncate = true, + }, + }, + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + SelectorActive.BindValueChanged(selected => selectBox.FadeTo(selected.NewValue ? 1 : 0)); + Action = () => SelectorActive.Value = true; + } + + protected override bool OnHover(HoverEvent e) + { + hoverBox.FadeIn(300, Easing.OutQuint); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + hoverBox.FadeOut(200, Easing.OutQuint); + base.OnHoverLost(e); + } + } +} From a0a2f8118e520003c23993bb2074d5664803758f Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Fri, 15 Apr 2022 22:05:20 +0100 Subject: [PATCH 0267/2328] Code quality fixes --- osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 4ffb6be451..9fcd675dc5 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -73,8 +73,8 @@ namespace osu.Game.Overlays.Chat.ChannelList return; ChannelListItem item = new ChannelListItem(channel); - item.OnRequestSelect += channel => this.OnRequestSelect?.Invoke(channel); - item.OnRequestLeave += channel => this.OnRequestLeave?.Invoke(channel); + item.OnRequestSelect += chan => OnRequestSelect?.Invoke(chan); + item.OnRequestLeave += chan => OnRequestLeave?.Invoke(chan); ChannelListItemFlow flow = getFlowForChannel(channel); channelMap.Add(channel, item); @@ -153,19 +153,19 @@ namespace osu.Game.Overlays.Chat.ChannelList protected class ChannelListScrollBar : OsuScrollbar { - private const float BAR_SIZE = 4; - private const float BAR_MARGIN = 7; + private const float bar_size = 4; + private const float bar_margin = 7; public ChannelListScrollBar(Direction scrollDir) : base(scrollDir) { - Size = new Vector2(BAR_SIZE); - Margin = new MarginPadding { Left = BAR_MARGIN }; + Size = new Vector2(bar_size); + Margin = new MarginPadding { Left = bar_margin }; CornerRadius = 2; } public override void ResizeTo(float val, int duration = 0, Easing easing = Easing.None) { - Vector2 size = new Vector2(BAR_SIZE, val); + Vector2 size = new Vector2(bar_size, val); this.ResizeTo(size, duration, easing); } } From b6631fb9f97e5add211cc4187fef2f03210b71fd Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Fri, 15 Apr 2022 22:22:20 +0100 Subject: [PATCH 0268/2328] Add newline for base class call --- osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 9fcd675dc5..94c05770ab 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -156,7 +156,8 @@ namespace osu.Game.Overlays.Chat.ChannelList private const float bar_size = 4; private const float bar_margin = 7; - public ChannelListScrollBar(Direction scrollDir) : base(scrollDir) + public ChannelListScrollBar(Direction scrollDir) + : base(scrollDir) { Size = new Vector2(bar_size); Margin = new MarginPadding { Left = bar_margin }; From 4a0c5a07813fb94107e40acc9295f3f315abdf08 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sat, 16 Apr 2022 19:16:06 +0100 Subject: [PATCH 0269/2328] Remove hover override for `ChannelListScrollContainer` --- osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 94c05770ab..ef2f132501 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -10,7 +10,6 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -136,18 +135,6 @@ namespace osu.Game.Overlays.Chat.ChannelList private class ChannelListScrollContainer : OsuScrollContainer { - protected override bool OnHover(HoverEvent e) - { - ScrollbarVisible = true; - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - ScrollbarVisible = false; - base.OnHoverLost(e); - } - protected override ScrollbarContainer CreateScrollbar(Direction direction) => new ChannelListScrollBar(direction); From 36aea9009e754ebd18872d259a137e2df8f52a88 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sat, 16 Apr 2022 19:19:18 +0100 Subject: [PATCH 0270/2328] Move `ChannelList` scrollbar to the right --- osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index ef2f132501..759242a779 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -44,7 +44,7 @@ namespace osu.Game.Overlays.Chat.ChannelList { Padding = new MarginPadding { Vertical = 7 }, RelativeSizeAxes = Axes.Both, - ScrollbarAnchor = Anchor.TopLeft, + ScrollbarAnchor = Anchor.TopRight, ScrollDistance = 35f, Child = new FillFlowContainer { @@ -147,7 +147,7 @@ namespace osu.Game.Overlays.Chat.ChannelList : base(scrollDir) { Size = new Vector2(bar_size); - Margin = new MarginPadding { Left = bar_margin }; + Margin = new MarginPadding { Horizontal = bar_margin }; CornerRadius = 2; } From 2f41cddb00124179b13ae5c69a633f00805dbec9 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sat, 16 Apr 2022 19:28:24 +0100 Subject: [PATCH 0271/2328] Remove redundant `Expire` call --- osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 759242a779..250e0cdf21 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -90,7 +90,6 @@ namespace osu.Game.Overlays.Chat.ChannelList channelMap.Remove(channel); flow.Remove(item); - item.Expire(); } public ChannelListItem GetItem(Channel channel) From 47c8b8010f1580ee9c7e583d0340f85f4c791e1d Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sat, 16 Apr 2022 19:30:03 +0100 Subject: [PATCH 0272/2328] Use semibold font weight for `ChannelListItemFlow` label --- osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 250e0cdf21..5c2a1ad89f 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -127,7 +127,7 @@ namespace osu.Game.Overlays.Chat.ChannelList { Text = label, Margin = new MarginPadding { Left = 18, Bottom = 5 }, - Font = OsuFont.Torus.With(size: 12), + Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold), }); } } From 610d2dc1a310d918604f758705bab41b8d2af451 Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Sun, 17 Apr 2022 10:34:48 +0800 Subject: [PATCH 0273/2328] Use a bigger sample step to calculate slider center of mass --- .../Utils/OsuHitObjectGenerationUtils_Reposition.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs index 2abbd61c59..a77d1f8b0f 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs @@ -323,13 +323,19 @@ namespace osu.Game.Rulesets.Osu.Utils /// The centre of mass of the slider. private static Vector2 calculateCentreOfMass(Slider slider) { - if (slider.Distance < 1) return Vector2.Zero; + const double sample_step = 50; + + // just sample the start and end positions if the slider is too short + if (slider.Distance <= sample_step) + { + return Vector2.Divide(slider.Path.PositionAt(1), 2); + } int count = 0; Vector2 sum = Vector2.Zero; double pathDistance = slider.Distance; - for (double i = 0; i < pathDistance; i++) + for (double i = 0; i < pathDistance; i += sample_step) { sum += slider.Path.PositionAt(i / pathDistance); count++; From 1d79266d422fe8dbe06eec2d259c2aab348df106 Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Sun, 17 Apr 2022 10:40:43 +0800 Subject: [PATCH 0274/2328] Clarify in the xmldoc that angles are measured in radians --- osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs index 6129e6bfc4..7b0d061e9a 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs @@ -151,7 +151,7 @@ namespace osu.Game.Rulesets.Osu.Utils /// Rotate a slider about its start position by the specified angle. /// /// The slider to be rotated. - /// The angle to rotate the slider by. + /// The angle, measured in radians, to rotate the slider by. public static void RotateSlider(Slider slider, float rotation) { void rotateNestedObject(OsuHitObject nested) => nested.Position = rotateVector(nested.Position - slider.Position, rotation) + slider.Position; @@ -170,7 +170,7 @@ namespace osu.Game.Rulesets.Osu.Utils /// Rotate a vector by the specified angle. /// /// The vector to be rotated. - /// The angle to rotate the vector by. + /// The angle, measured in radians, to rotate the vector by. /// The rotated vector. private static Vector2 rotateVector(Vector2 vector, float rotation) { From 399d8eac36d8171a806b004843dc9ab747d0e500 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 17 Apr 2022 14:44:28 +0900 Subject: [PATCH 0275/2328] Update `LocalisationAnalyser` with dotnet 6 compatibility changes --- .config/dotnet-tools.json | 4 ++-- osu.Game/osu.Game.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 7b94ee5bdd..5a3eadf607 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -27,10 +27,10 @@ ] }, "ppy.localisationanalyser.tools": { - "version": "2022.320.0", + "version": "2022.417.0", "commands": [ "localisation" ] } } -} \ No newline at end of file +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index be4bee7c9d..94614bea76 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -30,7 +30,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive From a3cc07ff3f6adcf9c42355772eb0e489cfd35931 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 17 Apr 2022 15:08:15 +0900 Subject: [PATCH 0276/2328] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index ec638f7736..a8952df329 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 94614bea76..3246255815 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 0a0cab91a4..668d23f82e 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -62,7 +62,7 @@ - + From f37444938fb20b951fa7de9bdcba609173681967 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 02:05:09 +0900 Subject: [PATCH 0277/2328] Update squirrel to latest version Includes disk space checks and better erroring. --- osu.Desktop/osu.Desktop.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 3ca6411812..a4f309c6ac 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -24,7 +24,7 @@ - + From 67c44db8d5aad22d8eb381574fb7421495840c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 27 Mar 2022 22:55:52 +0200 Subject: [PATCH 0278/2328] Add extension points required for replacing old mod overlay --- osu.Game/Overlays/Mods/ModColumn.cs | 7 +- osu.Game/Overlays/Mods/ModSelectScreen.cs | 89 +++++++++++++++++------ 2 files changed, 71 insertions(+), 25 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index f84ae4ac8a..abd243e1f7 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -54,6 +54,8 @@ namespace osu.Game.Overlays.Mods public Bindable> SelectedMods = new Bindable>(Array.Empty()); + protected virtual ModPanel CreateModPanel(Mod mod) => new ModPanel(mod); + private readonly Key[]? toggleKeys; private readonly Bindable>> availableMods = new Bindable>>(); @@ -258,10 +260,7 @@ namespace osu.Game.Overlays.Mods cancellationTokenSource?.Cancel(); - var panels = newMods.Select(mod => new ModPanel(mod) - { - Shear = new Vector2(-ModPanel.SHEAR_X, 0) - }); + var panels = newMods.Select(mod => CreateModPanel(mod).With(panel => panel.Shear = new Vector2(-ModPanel.SHEAR_X, 0))); Task? loadTask; diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 62080ec1b5..d174474076 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Collections.Generic; using System.Diagnostics; @@ -31,16 +33,43 @@ namespace osu.Game.Overlays.Mods protected override bool StartHidden => true; + private Func isValidMod = m => true; + + public Func IsValidMod + { + get => isValidMod; + set + { + isValidMod = value ?? throw new ArgumentNullException(nameof(value)); + + if (IsLoaded) + updateAvailableMods(); + } + } + + /// + /// Whether configurable s can be configured by the local user. + /// + protected virtual bool AllowConfiguration => true; + + /// + /// Whether the total score multiplier calculated from the current selected set of mods should be shown. + /// + protected virtual bool ShowTotalMultiplier => true; + + protected virtual ModColumn CreateModColumn(ModType modType, Key[]? toggleKeys = null) => new ModColumn(modType, false, toggleKeys); + private readonly BindableBool customisationVisible = new BindableBool(); - private DifficultyMultiplierDisplay multiplierDisplay; - private ModSettingsArea modSettingsArea; - private FillFlowContainer columnFlow; - private GridContainer grid; - private Container mainContent; + private DifficultyMultiplierDisplay? multiplierDisplay; + private ModSettingsArea modSettingsArea = null!; + private Container aboveColumnsContainer = null!; + private FillFlowContainer columnFlow = null!; + private GridContainer grid = null!; + private Container mainContent = null!; - private PopupScreenTitle header; - private Container footer; + private PopupScreenTitle header = null!; + private Container footer = null!; [BackgroundDependencyLoader] private void load() @@ -82,7 +111,7 @@ namespace osu.Game.Overlays.Mods }, new Drawable[] { - new Container + aboveColumnsContainer = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -94,11 +123,6 @@ namespace osu.Game.Overlays.Mods { Horizontal = 100, Vertical = 10 - }, - Child = multiplierDisplay = new DifficultyMultiplierDisplay - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre } } }, @@ -126,11 +150,11 @@ namespace osu.Game.Overlays.Mods Margin = new MarginPadding { Right = 70 }, Children = new[] { - new ModColumn(ModType.DifficultyReduction, false, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }), - new ModColumn(ModType.DifficultyIncrease, false, new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }), - new ModColumn(ModType.Automation, false, new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }), - new ModColumn(ModType.Conversion, false), - new ModColumn(ModType.Fun, false) + CreateModColumn(ModType.DifficultyReduction, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }), + CreateModColumn(ModType.DifficultyIncrease, new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }), + CreateModColumn(ModType.Automation, new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }), + CreateModColumn(ModType.Conversion), + CreateModColumn(ModType.Fun) } } } @@ -182,6 +206,15 @@ namespace osu.Game.Overlays.Mods } }; + if (ShowTotalMultiplier) + { + aboveColumnsContainer.Add(multiplierDisplay = new DifficultyMultiplierDisplay + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight + }); + } + columnFlow.Shear = new Vector2(ModPanel.SHEAR_X, 0); } @@ -204,10 +237,15 @@ namespace osu.Game.Overlays.Mods } customisationVisible.BindValueChanged(_ => updateCustomisationVisualState(), true); + + updateAvailableMods(); } private void updateMultiplier() { + if (multiplierDisplay == null) + return; + double multiplier = 1.0; foreach (var mod in SelectedMods.Value) @@ -216,8 +254,17 @@ namespace osu.Game.Overlays.Mods multiplierDisplay.Current.Value = multiplier; } + private void updateAvailableMods() + { + foreach (var column in columnFlow) + column.Filter = isValidMod; + } + private void updateCustomisation(ValueChangedEvent> valueChangedEvent) { + if (!AllowConfiguration) + return; + bool anyCustomisableMod = false; bool anyModWithRequiredCustomisationAdded = false; @@ -292,7 +339,7 @@ namespace osu.Game.Overlays.Mods header.MoveToY(0, fade_in_duration, Easing.OutQuint); footer.MoveToY(0, fade_in_duration, Easing.OutQuint); - multiplierDisplay + multiplierDisplay? .Delay(fade_in_duration * 0.65f) .FadeIn(fade_in_duration / 2, Easing.OutQuint) .ScaleTo(1, fade_in_duration, Easing.OutElastic); @@ -313,7 +360,7 @@ namespace osu.Game.Overlays.Mods base.PopOut(); this.FadeOut(fade_out_duration, Easing.OutQuint); - multiplierDisplay + multiplierDisplay? .FadeOut(fade_out_duration / 2, Easing.OutQuint) .ScaleTo(0.75f, fade_out_duration, Easing.OutQuint); @@ -368,7 +415,7 @@ namespace osu.Game.Overlays.Mods { public BindableBool HandleMouse { get; } = new BindableBool(); - public Action OnClicked { get; set; } + public Action? OnClicked { get; set; } protected override bool Handle(UIEvent e) { From 7eebc2012465f58c95b6ff3bc2bb452f30d1a314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 27 Mar 2022 23:07:52 +0200 Subject: [PATCH 0279/2328] Add replacements for mod overlays used by game --- osu.Game/Overlays/Mods/UserModSelectScreen.cs | 24 +++++++++++++++ .../Screens/OnlinePlay/FreeModSelectScreen.cs | 29 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 osu.Game/Overlays/Mods/UserModSelectScreen.cs create mode 100644 osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs diff --git a/osu.Game/Overlays/Mods/UserModSelectScreen.cs b/osu.Game/Overlays/Mods/UserModSelectScreen.cs new file mode 100644 index 0000000000..81943da514 --- /dev/null +++ b/osu.Game/Overlays/Mods/UserModSelectScreen.cs @@ -0,0 +1,24 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using JetBrains.Annotations; +using osu.Game.Rulesets.Mods; +using osuTK.Input; + +namespace osu.Game.Overlays.Mods +{ + public class UserModSelectScreen : ModSelectScreen + { + protected override ModColumn CreateModColumn(ModType modType, Key[] toggleKeys = null) => new UserModColumn(modType, false, toggleKeys); + + private class UserModColumn : ModColumn + { + public UserModColumn(ModType modType, bool allowBulkSelection, [CanBeNull] Key[] toggleKeys = null) + : base(modType, allowBulkSelection, toggleKeys) + { + } + + protected override ModPanel CreateModPanel(Mod mod) => new IncompatibilityDisplayingModPanel(mod); + } + } +} diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs new file mode 100644 index 0000000000..438b334e0b --- /dev/null +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs @@ -0,0 +1,29 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Game.Overlays.Mods; +using osu.Game.Rulesets.Mods; +using osuTK.Input; + +namespace osu.Game.Screens.OnlinePlay +{ + public class FreeModSelectScreen : ModSelectScreen + { + protected override bool AllowConfiguration => false; + protected override bool ShowTotalMultiplier => false; + + public new Func IsValidMod + { + get => base.IsValidMod; + set => base.IsValidMod = m => m.HasImplementation && m.UserPlayable && value.Invoke(m); + } + + public FreeModSelectScreen() + { + IsValidMod = _ => true; + } + + protected override ModColumn CreateModColumn(ModType modType, Key[] toggleKeys = null) => new ModColumn(modType, true, toggleKeys); + } +} From 20c17b8c98448f7ad1a93b53ebb259b8961765db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 3 Apr 2022 19:42:52 +0200 Subject: [PATCH 0280/2328] Make base mod select screen abstract --- .../Visual/UserInterface/TestSceneModSelectScreen.cs | 4 ++-- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index 34d9ddcc4e..4a738cb29d 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -23,7 +23,7 @@ namespace osu.Game.Tests.Visual.UserInterface [Resolved] private RulesetStore rulesetStore { get; set; } - private ModSelectScreen modSelectScreen; + private UserModSelectScreen modSelectScreen; [SetUpSteps] public void SetUpSteps() @@ -35,7 +35,7 @@ namespace osu.Game.Tests.Visual.UserInterface private void createScreen() { - AddStep("create screen", () => Child = modSelectScreen = new ModSelectScreen + AddStep("create screen", () => Child = modSelectScreen = new UserModSelectScreen { RelativeSizeAxes = Axes.Both, State = { Value = Visibility.Visible }, diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index d174474076..ad111cd5b9 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -23,7 +23,7 @@ using osuTK.Input; namespace osu.Game.Overlays.Mods { - public class ModSelectScreen : OsuFocusedOverlayContainer + public abstract class ModSelectScreen : OsuFocusedOverlayContainer { [Cached] private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); From 9942b0a9467cf51fb6284d157fbc67ea78107af6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 3 Apr 2022 19:53:05 +0200 Subject: [PATCH 0281/2328] Add test scene for free mod select screen --- .../TestSceneFreeModSelectScreen.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs new file mode 100644 index 0000000000..974cd710f7 --- /dev/null +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs @@ -0,0 +1,28 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Graphics.Containers; +using osu.Game.Screens.OnlinePlay; + +namespace osu.Game.Tests.Visual.Multiplayer +{ + public class TestSceneFreeModSelectScreen : MultiplayerTestScene + { + [Test] + public void TestFreeModSelect() + { + FreeModSelectScreen freeModSelectScreen = null; + + AddStep("create free mod select screen", () => Child = freeModSelectScreen = new FreeModSelectScreen + { + State = { Value = Visibility.Visible } + }); + AddToggleStep("toggle visibility", visible => + { + if (freeModSelectScreen != null) + freeModSelectScreen.State.Value = visible ? Visibility.Visible : Visibility.Hidden; + }); + } + } +} From 4b6d42c7e890bcd797535fc6c5203e4fc70112aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 17 Apr 2022 16:54:30 +0200 Subject: [PATCH 0282/2328] Add assertion covering free mod selection mod validity filter --- .../Visual/Multiplayer/TestSceneFreeModSelectScreen.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs index 974cd710f7..0db05e3a6a 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs @@ -1,8 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Linq; using NUnit.Framework; using osu.Framework.Graphics.Containers; +using osu.Framework.Testing; +using osu.Game.Overlays.Mods; using osu.Game.Screens.OnlinePlay; namespace osu.Game.Tests.Visual.Multiplayer @@ -18,6 +21,12 @@ namespace osu.Game.Tests.Visual.Multiplayer { State = { Value = Visibility.Visible } }); + + AddAssert("all visible mods are playable", + () => this.ChildrenOfType() + .Where(panel => panel.IsPresent) + .All(panel => panel.Mod.HasImplementation && panel.Mod.UserPlayable)); + AddToggleStep("toggle visibility", visible => { if (freeModSelectScreen != null) From ffb5c1e86c71003c6d6f8cda6e173948936e64f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 17 Apr 2022 16:58:02 +0200 Subject: [PATCH 0283/2328] Tweak colours on incompatibility displaying mod panel --- osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs b/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs index 4b6759c209..6c6c36eec9 100644 --- a/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs +++ b/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs @@ -46,8 +46,8 @@ namespace osu.Game.Overlays.Mods if (incompatible.Value) { - Colour4 backgroundColour = ColourProvider.Background5; - Colour4 textBackgroundColour = ColourProvider.Background4; + Colour4 backgroundColour = ColourProvider.Background6; + Colour4 textBackgroundColour = ColourProvider.Background5; Content.TransformTo(nameof(BorderColour), ColourInfo.GradientVertical(backgroundColour, textBackgroundColour), TRANSITION_DURATION, Easing.OutQuint); Background.FadeColour(backgroundColour, TRANSITION_DURATION, Easing.OutQuint); From 8af865a1c5766d850743f2654b48a50a63aa3316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 17 Apr 2022 21:20:16 +0200 Subject: [PATCH 0284/2328] Fix incompatibility panel using reference equality --- osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs b/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs index 6c6c36eec9..38781455fa 100644 --- a/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs +++ b/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs @@ -37,7 +37,9 @@ namespace osu.Game.Overlays.Mods private void updateIncompatibility() { - incompatible.Value = selectedMods.Value.Count > 0 && !selectedMods.Value.Contains(Mod) && !ModUtils.CheckCompatibleSet(selectedMods.Value.Append(Mod)); + incompatible.Value = selectedMods.Value.Count > 0 + && selectedMods.Value.All(selected => selected.GetType() != Mod.GetType()) + && !ModUtils.CheckCompatibleSet(selectedMods.Value.Append(Mod)); } protected override void UpdateState() From 881df7663d8ee8fab93759c57651e78c4ddfcab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 17 Apr 2022 22:30:02 +0200 Subject: [PATCH 0285/2328] Fix filter not taking effect if applied before panel load completion --- osu.Game/Overlays/Mods/ModPanel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModPanel.cs b/osu.Game/Overlays/Mods/ModPanel.cs index 312171cf74..c9aaa1c6c0 100644 --- a/osu.Game/Overlays/Mods/ModPanel.cs +++ b/osu.Game/Overlays/Mods/ModPanel.cs @@ -159,7 +159,7 @@ namespace osu.Game.Overlays.Mods playStateChangeSamples(); UpdateState(); }); - Filtered.BindValueChanged(_ => updateFilterState()); + Filtered.BindValueChanged(_ => updateFilterState(), true); UpdateState(); FinishTransforms(true); From 0d5ce336f49cfe4a475c6b587fc9c1e3dc52f3bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 17 Apr 2022 23:26:25 +0200 Subject: [PATCH 0286/2328] Hide mod customisation toggle if customisation not permitted --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index ad111cd5b9..237af2a71d 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -180,14 +180,6 @@ namespace osu.Game.Overlays.Mods Origin = Anchor.BottomCentre, Colour = colourProvider.Background5 }, - new ShearedToggleButton(200) - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Margin = new MarginPadding { Vertical = 14, Left = 70 }, - Text = "Mod Customisation", - Active = { BindTarget = customisationVisible } - } } }, new ClickToReturnContainer @@ -206,6 +198,18 @@ namespace osu.Game.Overlays.Mods } }; + if (AllowConfiguration) + { + footer.Add(new ShearedToggleButton(200) + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Margin = new MarginPadding { Vertical = 14, Left = 70 }, + Text = "Mod Customisation", + Active = { BindTarget = customisationVisible } + }); + } + if (ShowTotalMultiplier) { aboveColumnsContainer.Add(multiplierDisplay = new DifficultyMultiplierDisplay From e5e196097584484bc9062328b887cd806232b960 Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Mon, 18 Apr 2022 09:38:51 +0800 Subject: [PATCH 0287/2328] Add inline comments --- osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs index 7b0d061e9a..266f7d1251 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs @@ -116,6 +116,7 @@ namespace osu.Game.Rulesets.Osu.Utils if (!(osuObject is Slider slider)) return; + // No need to update the head and tail circles, since slider handles that when the new slider path is set slider.NestedHitObjects.OfType().ForEach(h => h.Position = new Vector2(OsuPlayfield.BASE_SIZE.X - h.Position.X, h.Position.Y)); slider.NestedHitObjects.OfType().ForEach(h => h.Position = new Vector2(OsuPlayfield.BASE_SIZE.X - h.Position.X, h.Position.Y)); @@ -137,6 +138,7 @@ namespace osu.Game.Rulesets.Osu.Utils if (!(osuObject is Slider slider)) return; + // No need to update the head and tail circles, since slider handles that when the new slider path is set slider.NestedHitObjects.OfType().ForEach(h => h.Position = new Vector2(h.Position.X, OsuPlayfield.BASE_SIZE.Y - h.Position.Y)); slider.NestedHitObjects.OfType().ForEach(h => h.Position = new Vector2(h.Position.X, OsuPlayfield.BASE_SIZE.Y - h.Position.Y)); @@ -156,6 +158,7 @@ namespace osu.Game.Rulesets.Osu.Utils { void rotateNestedObject(OsuHitObject nested) => nested.Position = rotateVector(nested.Position - slider.Position, rotation) + slider.Position; + // No need to update the head and tail circles, since slider handles that when the new slider path is set slider.NestedHitObjects.OfType().ForEach(rotateNestedObject); slider.NestedHitObjects.OfType().ForEach(rotateNestedObject); From 338d94626e5cb5f86ce924c76e0cea3b16970a1f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Apr 2022 06:42:06 +0300 Subject: [PATCH 0288/2328] Expose underlying skin of `EditorBeatmapSkin` --- osu.Game/Screens/Edit/EditorBeatmapSkin.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/EditorBeatmapSkin.cs b/osu.Game/Screens/Edit/EditorBeatmapSkin.cs index 429df85904..243a994a7f 100644 --- a/osu.Game/Screens/Edit/EditorBeatmapSkin.cs +++ b/osu.Game/Screens/Edit/EditorBeatmapSkin.cs @@ -21,13 +21,18 @@ namespace osu.Game.Screens.Edit { public event Action BeatmapSkinChanged; + /// + /// The underlying beatmap skin. + /// + protected internal ISkin Skin => skin; + + private readonly Skin skin; + /// /// The combo colours of this skin. /// If empty, the default combo colours will be used. /// - public readonly BindableList ComboColours; - - private readonly Skin skin; + public BindableList ComboColours { get; } public EditorBeatmapSkin(Skin skin) { From 80cce7c3cb1d5c840ec6bbb599a3bcdf3baf1e17 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Apr 2022 06:46:06 +0300 Subject: [PATCH 0289/2328] Add failing test case --- .../Visual/Editing/TestSceneComposeScreen.cs | 63 +++++++++++++------ 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs b/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs index d100fba8d6..30c8539d85 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs @@ -1,44 +1,71 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Extensions.ObjectExtensions; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Testing; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Compose; +using osu.Game.Skinning; namespace osu.Game.Tests.Visual.Editing { [TestFixture] public class TestSceneComposeScreen : EditorClockTestScene { - [Cached(typeof(EditorBeatmap))] - [Cached(typeof(IBeatSnapProvider))] - private readonly EditorBeatmap editorBeatmap = - new EditorBeatmap(new OsuBeatmap - { - BeatmapInfo = - { - Ruleset = new OsuRuleset().RulesetInfo - } - }); + private EditorBeatmap editorBeatmap; [Cached] private EditorClipboard clipboard = new EditorClipboard(); - protected override void LoadComplete() + [SetUpSteps] + public void SetUpSteps() { - base.LoadComplete(); - - Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap); - - Child = new ComposeScreen + AddStep("setup compose screen", () => { - State = { Value = Visibility.Visible }, - }; + var beatmap = new OsuBeatmap + { + BeatmapInfo = { Ruleset = new OsuRuleset().RulesetInfo } + }; + + editorBeatmap = new EditorBeatmap(beatmap, new LegacyBeatmapSkin(beatmap.BeatmapInfo, null)); + + Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap); + + Child = new DependencyProvidingContainer + { + RelativeSizeAxes = Axes.Both, + CachedDependencies = new (Type, object)[] + { + (typeof(EditorBeatmap), editorBeatmap), + (typeof(IBeatSnapProvider), editorBeatmap), + }, + Child = new ComposeScreen { State = { Value = Visibility.Visible } }, + }; + }); + + AddUntilStep("wait for composer", () => this.ChildrenOfType().SingleOrDefault()?.IsLoaded == true); + } + + /// + /// Ensures that the skin of the edited beatmap is properly wrapped in a . + /// + [Test] + public void TestLegacyBeatmapSkinHasTransformer() + { + AddAssert("legacy beatmap skin has transformer", () => + { + var sources = this.ChildrenOfType().First().AllSources; + return sources.OfType().Count(t => t.Skin == editorBeatmap.BeatmapSkin.AsNonNull().Skin) == 1; + }); } } } From 2cb217e06c04d63de4bc4151c7631b9abc448062 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Apr 2022 06:59:44 +0300 Subject: [PATCH 0290/2328] Fix editor legacy beatmap skins not receiving transformer --- osu.Game/Screens/Edit/EditorSkinProvidingContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/EditorSkinProvidingContainer.cs b/osu.Game/Screens/Edit/EditorSkinProvidingContainer.cs index decfa879a8..694d0253e0 100644 --- a/osu.Game/Screens/Edit/EditorSkinProvidingContainer.cs +++ b/osu.Game/Screens/Edit/EditorSkinProvidingContainer.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.Edit private readonly EditorBeatmapSkin? beatmapSkin; public EditorSkinProvidingContainer(EditorBeatmap editorBeatmap) - : base(editorBeatmap.PlayableBeatmap.BeatmapInfo.Ruleset.CreateInstance(), editorBeatmap.PlayableBeatmap, editorBeatmap.BeatmapSkin) + : base(editorBeatmap.PlayableBeatmap.BeatmapInfo.Ruleset.CreateInstance(), editorBeatmap.PlayableBeatmap, editorBeatmap.BeatmapSkin?.Skin) { beatmapSkin = editorBeatmap.BeatmapSkin; } From 90093c1d9d3fab7757218cdb021f08c64cdd1fe7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 13:32:37 +0900 Subject: [PATCH 0291/2328] Combine `private` skin variable into exposed one --- osu.Game/Screens/Edit/EditorBeatmapSkin.cs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Edit/EditorBeatmapSkin.cs b/osu.Game/Screens/Edit/EditorBeatmapSkin.cs index 243a994a7f..f650ffa5a3 100644 --- a/osu.Game/Screens/Edit/EditorBeatmapSkin.cs +++ b/osu.Game/Screens/Edit/EditorBeatmapSkin.cs @@ -24,9 +24,7 @@ namespace osu.Game.Screens.Edit /// /// The underlying beatmap skin. /// - protected internal ISkin Skin => skin; - - private readonly Skin skin; + protected internal readonly Skin Skin; /// /// The combo colours of this skin. @@ -36,11 +34,11 @@ namespace osu.Game.Screens.Edit public EditorBeatmapSkin(Skin skin) { - this.skin = skin; + Skin = skin; ComboColours = new BindableList(); - if (skin.Configuration.ComboColours != null) - ComboColours.AddRange(skin.Configuration.ComboColours.Select(c => (Colour4)c)); + if (Skin.Configuration.ComboColours != null) + ComboColours.AddRange(Skin.Configuration.ComboColours.Select(c => (Colour4)c)); ComboColours.BindCollectionChanged((_, __) => updateColours()); } @@ -48,16 +46,16 @@ namespace osu.Game.Screens.Edit private void updateColours() { - skin.Configuration.CustomComboColours = ComboColours.Select(c => (Color4)c).ToList(); + Skin.Configuration.CustomComboColours = ComboColours.Select(c => (Color4)c).ToList(); invokeSkinChanged(); } #region Delegated ISkin implementation - public Drawable GetDrawableComponent(ISkinComponent component) => skin.GetDrawableComponent(component); - public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => skin.GetTexture(componentName, wrapModeS, wrapModeT); - public ISample GetSample(ISampleInfo sampleInfo) => skin.GetSample(sampleInfo); - public IBindable GetConfig(TLookup lookup) => skin.GetConfig(lookup); + public Drawable GetDrawableComponent(ISkinComponent component) => Skin.GetDrawableComponent(component); + public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => Skin.GetTexture(componentName, wrapModeS, wrapModeT); + public ISample GetSample(ISampleInfo sampleInfo) => Skin.GetSample(sampleInfo); + public IBindable GetConfig(TLookup lookup) => Skin.GetConfig(lookup); #endregion } From fcb48c69cf8e30b4ae9a42bd7f2484b8ecdba175 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Apr 2022 07:57:13 +0300 Subject: [PATCH 0292/2328] Calculate sample playback position using screen-space drawable rectangles --- .../Objects/Drawables/DrawableOsuHitObject.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index a1c8879105..ff87f441d6 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -6,10 +6,10 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Graphics; +using osu.Framework.Graphics.Primitives; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Graphics.Containers; -using osu.Game.Rulesets.Osu.UI; using osuTK; namespace osu.Game.Rulesets.Osu.Objects.Drawables @@ -24,7 +24,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables // Must be set to update IsHovered as it's used in relax mod to detect osu hit objects. public override bool HandlePositionalInput => true; - protected override float SamplePlaybackPosition => HitObject.X / OsuPlayfield.BASE_SIZE.X; + protected override float SamplePlaybackPosition => (ScreenSpaceDrawQuad.Centre.X - parentScreenSpaceRectangle.X) / parentScreenSpaceRectangle.Width; + + private RectangleF parentScreenSpaceRectangle => ((DrawableOsuHitObject)ParentHitObject)?.parentScreenSpaceRectangle ?? Parent.ScreenSpaceDrawQuad.AABBFloat; /// /// Whether this can be hit, given a time value. From 3a00931e3898fc4d7e8fc30500e2d3526378d699 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Apr 2022 09:18:56 +0300 Subject: [PATCH 0293/2328] Update slider sliding samples balance calculation to use screen-space as well --- .../Objects/Drawables/DrawableOsuHitObject.cs | 12 +++++++++--- .../Objects/Drawables/DrawableSlider.cs | 3 +-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index ff87f441d6..fa2d2ba38c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -24,9 +24,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables // Must be set to update IsHovered as it's used in relax mod to detect osu hit objects. public override bool HandlePositionalInput => true; - protected override float SamplePlaybackPosition => (ScreenSpaceDrawQuad.Centre.X - parentScreenSpaceRectangle.X) / parentScreenSpaceRectangle.Width; - - private RectangleF parentScreenSpaceRectangle => ((DrawableOsuHitObject)ParentHitObject)?.parentScreenSpaceRectangle ?? Parent.ScreenSpaceDrawQuad.AABBFloat; + protected override float SamplePlaybackPosition => CalculateDrawableRelativePosition(this); /// /// Whether this can be hit, given a time value. @@ -91,6 +89,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables /// public void MissForcefully() => ApplyResult(r => r.Type = r.Judgement.MinResult); + private RectangleF parentScreenSpaceRectangle => ((DrawableOsuHitObject)ParentHitObject)?.parentScreenSpaceRectangle ?? Parent.ScreenSpaceDrawQuad.AABBFloat; + + /// + /// Calculates the position of the given relative to the playfield area. + /// + /// The drawable to calculate its relative position. + protected float CalculateDrawableRelativePosition(Drawable drawable) => (drawable.ScreenSpaceDrawQuad.Centre.X - parentScreenSpaceRectangle.X) / parentScreenSpaceRectangle.Width; + protected override JudgementResult CreateResult(Judgement judgement) => new OsuJudgementResult(HitObject, judgement); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 1447f131c6..c48ab998ba 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -13,7 +13,6 @@ using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Skinning; using osu.Game.Rulesets.Osu.Skinning.Default; -using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; using osuTK; @@ -208,7 +207,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (Tracking.Value && slidingSample != null) // keep the sliding sample playing at the current tracking position - slidingSample.Balance.Value = CalculateSamplePlaybackBalance(Ball.X / OsuPlayfield.BASE_SIZE.X); + slidingSample.Balance.Value = CalculateSamplePlaybackBalance(CalculateDrawableRelativePosition(Ball)); double completionProgress = Math.Clamp((Time.Current - HitObject.StartTime) / HitObject.Duration, 0, 1); From 2202863e1a1caf323aa341dec967fdaaefd4a237 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 17:49:28 +0900 Subject: [PATCH 0294/2328] Split out `IPerformFromScreenRunner` to allow for easier testing --- osu.Game/OsuGame.cs | 8 +----- .../Dashboard/CurrentlyPlayingDisplay.cs | 5 ++-- .../Sections/DebugSettings/GeneralSettings.cs | 5 ++-- .../StableDirectoryLocationDialog.cs | 7 ++--- osu.Game/Screens/IPerformFromScreenRunner.cs | 26 +++++++++++++++++++ osu.Game/Screens/Menu/MainMenu.cs | 4 +-- .../Skinning/Editor/SkinEditorSceneLibrary.cs | 7 ++--- 7 files changed, 43 insertions(+), 19 deletions(-) create mode 100644 osu.Game/Screens/IPerformFromScreenRunner.cs diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 73121f6e7d..76ccbe0a08 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -63,7 +63,7 @@ namespace osu.Game /// The full osu! experience. Builds on top of to add menus and binding logic /// for initial components that are generally retrieved via DI. /// - public class OsuGame : OsuGameBase, IKeyBindingHandler, ILocalUserPlayInfo + public class OsuGame : OsuGameBase, IKeyBindingHandler, ILocalUserPlayInfo, IPerformFromScreenRunner { /// /// The amount of global offset to apply when a left/right anchored overlay is displayed (ie. settings or notifications). @@ -586,12 +586,6 @@ namespace osu.Game private PerformFromMenuRunner performFromMainMenuTask; - /// - /// Perform an action only after returning to a specific screen as indicated by . - /// Eagerly tries to exit the current screen until it succeeds. - /// - /// The action to perform once we are in the correct state. - /// An optional collection of valid screen types. If any of these screens are already current we can perform the action immediately, else the first valid parent will be made current before performing the action. is used if not specified. public void PerformFromScreen(Action action, IEnumerable validScreens = null) { performFromMainMenuTask?.Cancel(); diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index 117de88166..786401b7a8 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -14,6 +14,7 @@ using osu.Game.Database; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Spectator; +using osu.Game.Screens; using osu.Game.Screens.OnlinePlay.Match.Components; using osu.Game.Screens.Play; using osu.Game.Users; @@ -106,7 +107,7 @@ namespace osu.Game.Overlays.Dashboard public readonly APIUser User; [Resolved(canBeNull: true)] - private OsuGame game { get; set; } + private IPerformFromScreenRunner performer { get; set; } public PlayingUserPanel(APIUser user) { @@ -140,7 +141,7 @@ namespace osu.Game.Overlays.Dashboard Text = "Watch", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Action = () => game?.PerformFromScreen(s => s.Push(new SoloSpectator(User))), + Action = () => performer?.PerformFromScreen(s => s.Push(new SoloSpectator(User))), Enabled = { Value = User.Id != api.LocalUser.Value.Id } } } diff --git a/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs index 60540a089e..8833420523 100644 --- a/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Game.Localisation; +using osu.Game.Screens; using osu.Game.Screens.Import; namespace osu.Game.Overlays.Settings.Sections.DebugSettings @@ -16,7 +17,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings protected override LocalisableString Header => DebugSettingsStrings.GeneralHeader; [BackgroundDependencyLoader(true)] - private void load(FrameworkDebugConfigManager config, FrameworkConfigManager frameworkConfig, OsuGame game) + private void load(FrameworkDebugConfigManager config, FrameworkConfigManager frameworkConfig, IPerformFromScreenRunner performer) { Children = new Drawable[] { @@ -34,7 +35,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings Add(new SettingsButton { Text = DebugSettingsStrings.ImportFiles, - Action = () => game?.PerformFromScreen(menu => menu.Push(new FileImportScreen())) + Action = () => performer?.PerformFromScreen(menu => menu.Push(new FileImportScreen())) }); } } diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectoryLocationDialog.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectoryLocationDialog.cs index 904c9deaae..4e81cd63b8 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectoryLocationDialog.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectoryLocationDialog.cs @@ -6,13 +6,14 @@ using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osu.Framework.Screens; using osu.Game.Overlays.Dialog; +using osu.Game.Screens; namespace osu.Game.Overlays.Settings.Sections.Maintenance { public class StableDirectoryLocationDialog : PopupDialog { - [Resolved] - private OsuGame game { get; set; } + [Resolved(canBeNull: true)] + private IPerformFromScreenRunner performer { get; set; } public StableDirectoryLocationDialog(TaskCompletionSource taskCompletionSource) { @@ -25,7 +26,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance new PopupDialogOkButton { Text = "Sure! I know where it is located!", - Action = () => Schedule(() => game.PerformFromScreen(screen => screen.Push(new StableDirectorySelectScreen(taskCompletionSource)))) + Action = () => Schedule(() => performer.PerformFromScreen(screen => screen.Push(new StableDirectorySelectScreen(taskCompletionSource)))) }, new PopupDialogCancelButton { diff --git a/osu.Game/Screens/IPerformFromScreenRunner.cs b/osu.Game/Screens/IPerformFromScreenRunner.cs new file mode 100644 index 0000000000..655bebdeb0 --- /dev/null +++ b/osu.Game/Screens/IPerformFromScreenRunner.cs @@ -0,0 +1,26 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Framework.Screens; +using osu.Game.Screens.Menu; + +namespace osu.Game.Screens +{ + /// + /// Manages a global screen stack to allow nested components a guarantee of where work is executed. + /// + [Cached] + public interface IPerformFromScreenRunner + { + /// + /// Perform an action only after returning to a specific screen as indicated by . + /// Eagerly tries to exit the current screen until it succeeds. + /// + /// The action to perform once we are in the correct state. + /// An optional collection of valid screen types. If any of these screens are already current we can perform the action immediately, else the first valid parent will be made current before performing the action. is used if not specified. + void PerformFromScreen(Action action, IEnumerable validScreens = null); + } +} diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index e2d79b4015..442a536cf9 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -148,14 +148,14 @@ namespace osu.Game.Screens.Menu } [Resolved(canBeNull: true)] - private OsuGame game { get; set; } + private IPerformFromScreenRunner performer { get; set; } private void confirmAndExit() { if (exitConfirmed) return; exitConfirmed = true; - game?.PerformFromScreen(menu => menu.Exit()); + performer?.PerformFromScreen(menu => menu.Exit()); } private void preloadSongSelect() diff --git a/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs b/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs index 0808cd157f..4507526806 100644 --- a/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs +++ b/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs @@ -15,6 +15,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; +using osu.Game.Screens; using osu.Game.Screens.Play; using osu.Game.Screens.Select; using osuTK; @@ -28,7 +29,7 @@ namespace osu.Game.Skinning.Editor private const float padding = 10; [Resolved(canBeNull: true)] - private OsuGame game { get; set; } + private IPerformFromScreenRunner performer { get; set; } [Resolved] private IBindable ruleset { get; set; } @@ -75,7 +76,7 @@ namespace osu.Game.Skinning.Editor Text = "Song Select", Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Action = () => game?.PerformFromScreen(screen => + Action = () => performer?.PerformFromScreen(screen => { if (screen is SongSelect) return; @@ -88,7 +89,7 @@ namespace osu.Game.Skinning.Editor Text = "Gameplay", Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Action = () => game?.PerformFromScreen(screen => + Action = () => performer?.PerformFromScreen(screen => { if (screen is Player) return; From e3153132666a911dc2ac47d759d6a7654b128f59 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 18:09:14 +0900 Subject: [PATCH 0295/2328] Split out `IDialogOverlay` to allow for easier testing --- .../TestSceneManageCollectionsDialog.cs | 2 +- .../Visual/Navigation/TestSceneOsuGame.cs | 2 +- .../Navigation/TestScenePerformFromScreen.cs | 11 ++++--- .../Navigation/TestSceneScreenNavigation.cs | 13 ++++---- .../TestSceneDeleteLocalScore.cs | 2 +- .../UserInterface/TestSceneDialogOverlay.cs | 2 +- .../Collections/DrawableCollectionListItem.cs | 2 +- osu.Game/Database/LegacyImportManager.cs | 2 +- osu.Game/Online/Chat/ExternalLinkOpener.cs | 2 +- .../Online/Leaderboards/LeaderboardScore.cs | 2 +- osu.Game/Overlays/Dialog/PopupDialog.cs | 2 +- osu.Game/Overlays/DialogOverlay.cs | 2 +- osu.Game/Overlays/IDialogOverlay.cs | 31 +++++++++++++++++++ .../Sections/Maintenance/GeneralSettings.cs | 2 +- .../Maintenance/MigrationSelectScreen.cs | 2 +- osu.Game/PerformFromMenuRunner.cs | 2 +- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/Menu/MainMenu.cs | 2 +- osu.Game/Screens/Menu/StorageErrorDialog.cs | 2 +- .../Multiplayer/MultiplayerMatchSubScreen.cs | 2 +- .../Carousel/DrawableCarouselBeatmapSet.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 4 +-- osu.Game/Tests/Visual/EditorTestScene.cs | 2 +- osu.Game/Tests/Visual/ScreenTestScene.cs | 2 +- 24 files changed, 66 insertions(+), 33 deletions(-) create mode 100644 osu.Game/Overlays/IDialogOverlay.cs diff --git a/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs b/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs index e40dd58663..51ca55f37f 100644 --- a/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs +++ b/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs @@ -50,7 +50,7 @@ namespace osu.Game.Tests.Visual.Collections }); Dependencies.Cache(manager); - Dependencies.Cache(dialogOverlay); + Dependencies.CacheAs(dialogOverlay); } [SetUp] diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs b/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs index b8d1636ea0..921d088fc7 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs @@ -49,7 +49,7 @@ namespace osu.Game.Tests.Visual.Navigation typeof(LoginOverlay), typeof(MusicController), typeof(AccountCreationOverlay), - typeof(DialogOverlay), + typeof(IDialogOverlay), typeof(ScreenshotManager) }; diff --git a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs index f045e3a3e8..c4099b55c7 100644 --- a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs +++ b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs @@ -5,6 +5,7 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Extensions; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Screens; using osu.Framework.Testing; @@ -113,12 +114,12 @@ namespace osu.Game.Tests.Visual.Navigation AddAssert("did not perform", () => !actionPerformed); AddAssert("only one exit attempt", () => blocker.ExitAttempts == 1); - AddUntilStep("wait for dialog display", () => Game.Dependencies.Get().IsLoaded); + AddUntilStep("wait for dialog display", () => ((Drawable)Game.Dependencies.Get()).IsLoaded); if (confirmed) { AddStep("accept dialog", () => InputManager.Key(Key.Number1)); - AddUntilStep("wait for dialog dismissed", () => Game.Dependencies.Get().CurrentDialog == null); + AddUntilStep("wait for dialog dismissed", () => Game.Dependencies.Get().CurrentDialog == null); AddUntilStep("did perform", () => actionPerformed); } else @@ -145,7 +146,7 @@ namespace osu.Game.Tests.Visual.Navigation AddWaitStep("wait a bit", 10); - AddUntilStep("wait for dialog display", () => Game.Dependencies.Get().IsLoaded); + AddUntilStep("wait for dialog display", () => ((Drawable)Game.Dependencies.Get()).IsLoaded); AddAssert("screen didn't change", () => Game.ScreenStack.CurrentScreen == blocker2); AddAssert("did not perform", () => !actionPerformed); @@ -187,7 +188,7 @@ namespace osu.Game.Tests.Visual.Navigation AddWaitStep("wait a bit", 10); - AddUntilStep("wait for dialog display", () => Game.Dependencies.Get().IsLoaded); + AddUntilStep("wait for dialog display", () => ((Drawable)Game.Dependencies.Get()).IsLoaded); AddAssert("screen didn't change", () => Game.ScreenStack.CurrentScreen == screenWithNestedStack); AddAssert("nested screen didn't change", () => screenWithNestedStack.SubScreenStack.CurrentScreen == screenWithNestedStack.Blocker); @@ -221,7 +222,7 @@ namespace osu.Game.Tests.Visual.Navigation public class DialogBlockingScreen : OsuScreen { [Resolved] - private DialogOverlay dialogOverlay { get; set; } + private IDialogOverlay dialogOverlay { get; set; } private int dialogDisplayCount; diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs index 394976eb43..0b7242eee0 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs @@ -6,6 +6,7 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Extensions; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; using osu.Framework.Screens; @@ -200,10 +201,10 @@ namespace osu.Game.Tests.Visual.Navigation AddStep("choose clear all scores", () => InputManager.Key(Key.Number4)); - AddUntilStep("wait for dialog display", () => Game.Dependencies.Get().IsLoaded); - AddUntilStep("wait for dialog", () => Game.Dependencies.Get().CurrentDialog != null); + AddUntilStep("wait for dialog display", () => ((Drawable)Game.Dependencies.Get()).IsLoaded); + AddUntilStep("wait for dialog", () => Game.Dependencies.Get().CurrentDialog != null); AddStep("confirm deletion", () => InputManager.Key(Key.Number1)); - AddUntilStep("wait for dialog dismissed", () => Game.Dependencies.Get().CurrentDialog == null); + AddUntilStep("wait for dialog dismissed", () => Game.Dependencies.Get().CurrentDialog == null); AddUntilStep("ensure score is pending deletion", () => Game.Realm.Run(r => r.Find(score.ID)?.DeletePending == true)); @@ -246,10 +247,10 @@ namespace osu.Game.Tests.Visual.Navigation InputManager.Click(MouseButton.Left); }); - AddUntilStep("wait for dialog display", () => Game.Dependencies.Get().IsLoaded); - AddUntilStep("wait for dialog", () => Game.Dependencies.Get().CurrentDialog != null); + AddUntilStep("wait for dialog display", () => ((Drawable)Game.Dependencies.Get()).IsLoaded); + AddUntilStep("wait for dialog", () => Game.Dependencies.Get().CurrentDialog != null); AddStep("confirm deletion", () => InputManager.Key(Key.Number1)); - AddUntilStep("wait for dialog dismissed", () => Game.Dependencies.Get().CurrentDialog == null); + AddUntilStep("wait for dialog dismissed", () => Game.Dependencies.Get().CurrentDialog == null); AddUntilStep("ensure score is pending deletion", () => Game.Realm.Run(r => r.Find(score.ID)?.DeletePending == true)); diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index 72dfc53c01..1350052ae6 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.UserInterface private BeatmapInfo beatmapInfo; - [Cached] + [Cached(typeof(IDialogOverlay))] private readonly DialogOverlay dialogOverlay; public TestSceneDeleteLocalScore() diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs index 405461eec8..17234f4022 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs @@ -11,7 +11,7 @@ using osu.Game.Overlays.Dialog; namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] - public class TestSceneDialogOverlay : OsuTestScene + public class TestSceneIDialogOverlay : OsuTestScene { private DialogOverlay overlay; diff --git a/osu.Game/Collections/DrawableCollectionListItem.cs b/osu.Game/Collections/DrawableCollectionListItem.cs index c4cb040b52..5a20b7e7bd 100644 --- a/osu.Game/Collections/DrawableCollectionListItem.cs +++ b/osu.Game/Collections/DrawableCollectionListItem.cs @@ -158,7 +158,7 @@ namespace osu.Game.Collections public Func IsTextBoxHovered; [Resolved(CanBeNull = true)] - private DialogOverlay dialogOverlay { get; set; } + private IDialogOverlay dialogOverlay { get; set; } [Resolved(CanBeNull = true)] private CollectionManager collectionManager { get; set; } diff --git a/osu.Game/Database/LegacyImportManager.cs b/osu.Game/Database/LegacyImportManager.cs index 4dc26b18bb..59394c2952 100644 --- a/osu.Game/Database/LegacyImportManager.cs +++ b/osu.Game/Database/LegacyImportManager.cs @@ -40,7 +40,7 @@ namespace osu.Game.Database private OsuGame game { get; set; } [Resolved] - private DialogOverlay dialogOverlay { get; set; } + private IDialogOverlay dialogOverlay { get; set; } [Resolved(CanBeNull = true)] private DesktopGameHost desktopGameHost { get; set; } diff --git a/osu.Game/Online/Chat/ExternalLinkOpener.cs b/osu.Game/Online/Chat/ExternalLinkOpener.cs index 328b43c4e8..20d8459132 100644 --- a/osu.Game/Online/Chat/ExternalLinkOpener.cs +++ b/osu.Game/Online/Chat/ExternalLinkOpener.cs @@ -17,7 +17,7 @@ namespace osu.Game.Online.Chat private GameHost host { get; set; } [Resolved(CanBeNull = true)] - private DialogOverlay dialogOverlay { get; set; } + private IDialogOverlay dialogOverlay { get; set; } private Bindable externalLinkWarning; diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index ddd9d9a2b2..eecb7ff6b3 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -64,7 +64,7 @@ namespace osu.Game.Online.Leaderboards private List statisticsLabels; [Resolved(CanBeNull = true)] - private DialogOverlay dialogOverlay { get; set; } + private IDialogOverlay dialogOverlay { get; set; } [Resolved(CanBeNull = true)] private SongSelect songSelect { get; set; } diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index 6159ab59f0..9fd1a32e84 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -216,7 +216,7 @@ namespace osu.Game.Overlays.Dialog }; // It's important we start in a visible state so our state fires on hide, even before load. - // This is used by the DialogOverlay to know when the dialog was dismissed. + // This is used by the IDialogOverlay to know when the dialog was dismissed. Show(); } diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 9dea1ca00a..15d89a561a 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -14,7 +14,7 @@ using osu.Game.Audio.Effects; namespace osu.Game.Overlays { - public class DialogOverlay : OsuFocusedOverlayContainer + public class DialogOverlay : OsuFocusedOverlayContainer, IDialogOverlay { private readonly Container dialogContainer; diff --git a/osu.Game/Overlays/IDialogOverlay.cs b/osu.Game/Overlays/IDialogOverlay.cs new file mode 100644 index 0000000000..07f28a7204 --- /dev/null +++ b/osu.Game/Overlays/IDialogOverlay.cs @@ -0,0 +1,31 @@ +#nullable enable +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Game.Overlays.Dialog; + +namespace osu.Game.Overlays +{ + /// + /// A global overlay that can show popup dialogs. + /// + [Cached] + public interface IDialogOverlay + { + /// + /// Push a new dialog for display. + /// + /// + /// This will immediate dismiss any already displayed dialog (cancelling the action). + /// If the dialog instance provided is already displayed, it will be a noop. + /// + /// The dialog to be presented. + void Push(PopupDialog dialog); + + /// + /// The currently displayed dialog, if any. + /// + PopupDialog? CurrentDialog { get; } + } +} diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs index aa02d086f4..be4b0decd9 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance private SettingsButton undeleteButton; [BackgroundDependencyLoader(permitNulls: true)] - private void load(BeatmapManager beatmaps, ScoreManager scores, SkinManager skins, [CanBeNull] CollectionManager collectionManager, [CanBeNull] LegacyImportManager legacyImportManager, DialogOverlay dialogOverlay) + private void load(BeatmapManager beatmaps, ScoreManager scores, SkinManager skins, [CanBeNull] CollectionManager collectionManager, [CanBeNull] LegacyImportManager legacyImportManager, IDialogOverlay dialogOverlay) { if (legacyImportManager?.SupportsImportFromStable == true) { diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs index 0304a4291a..3cb5521e51 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs @@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance private OsuGameBase game { get; set; } [Resolved(canBeNull: true)] - private DialogOverlay dialogOverlay { get; set; } + private IDialogOverlay dialogOverlay { get; set; } protected override DirectoryInfo InitialPath => new DirectoryInfo(storage.GetFullPath(string.Empty)).Parent; diff --git a/osu.Game/PerformFromMenuRunner.cs b/osu.Game/PerformFromMenuRunner.cs index 528470768c..7039d5379c 100644 --- a/osu.Game/PerformFromMenuRunner.cs +++ b/osu.Game/PerformFromMenuRunner.cs @@ -26,7 +26,7 @@ namespace osu.Game private NotificationOverlay notifications { get; set; } [Resolved] - private DialogOverlay dialogOverlay { get; set; } + private IDialogOverlay dialogOverlay { get; set; } [Resolved(canBeNull: true)] private OsuGame game { get; set; } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 57f7429e06..255571dfdb 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -84,7 +84,7 @@ namespace osu.Game.Screens.Edit private Storage storage { get; set; } [Resolved(canBeNull: true)] - private DialogOverlay dialogOverlay { get; set; } + private IDialogOverlay dialogOverlay { get; set; } [Resolved(canBeNull: true)] private NotificationOverlay notifications { get; set; } diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index e2d79b4015..9e6af860fc 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -60,7 +60,7 @@ namespace osu.Game.Screens.Menu private IAPIProvider api { get; set; } [Resolved(canBeNull: true)] - private DialogOverlay dialogOverlay { get; set; } + private IDialogOverlay dialogOverlay { get; set; } private BackgroundScreenDefault background; diff --git a/osu.Game/Screens/Menu/StorageErrorDialog.cs b/osu.Game/Screens/Menu/StorageErrorDialog.cs index 250623ec68..f4c77d5d8f 100644 --- a/osu.Game/Screens/Menu/StorageErrorDialog.cs +++ b/osu.Game/Screens/Menu/StorageErrorDialog.cs @@ -13,7 +13,7 @@ namespace osu.Game.Screens.Menu public class StorageErrorDialog : PopupDialog { [Resolved] - private DialogOverlay dialogOverlay { get; set; } + private IDialogOverlay dialogOverlay { get; set; } public StorageErrorDialog(OsuStorage storage, OsuStorageError error) { diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs index 7ef0bb5923..0dbf73fc5b 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs @@ -238,7 +238,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer } [Resolved(canBeNull: true)] - private DialogOverlay dialogOverlay { get; set; } + private IDialogOverlay dialogOverlay { get; set; } private bool exitConfirmed; diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 618c5cf5ec..2d70b1aecb 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Select.Carousel private Action viewDetails; [Resolved(CanBeNull = true)] - private DialogOverlay dialogOverlay { get; set; } + private IDialogOverlay dialogOverlay { get; set; } [Resolved(CanBeNull = true)] private CollectionManager collectionManager { get; set; } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 2d1a2bce4e..dc505063d1 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -87,7 +87,7 @@ namespace osu.Game.Screens.Select protected Container LeftArea { get; private set; } private BeatmapInfoWedge beatmapInfoWedge; - private DialogOverlay dialogOverlay; + private IDialogOverlay dialogOverlay; [Resolved] private BeatmapManager beatmaps { get; set; } @@ -114,7 +114,7 @@ namespace osu.Game.Screens.Select private MusicController music { get; set; } [BackgroundDependencyLoader(true)] - private void load(AudioManager audio, DialogOverlay dialog, OsuColour colours, ManageCollectionsDialog manageCollectionsDialog, DifficultyRecommender recommender) + private void load(AudioManager audio, IDialogOverlay dialog, OsuColour colours, ManageCollectionsDialog manageCollectionsDialog, DifficultyRecommender recommender) { // initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter). transferRulesetValue(); diff --git a/osu.Game/Tests/Visual/EditorTestScene.cs b/osu.Game/Tests/Visual/EditorTestScene.cs index 51221cb8fe..ca12bc73fe 100644 --- a/osu.Game/Tests/Visual/EditorTestScene.cs +++ b/osu.Game/Tests/Visual/EditorTestScene.cs @@ -98,7 +98,7 @@ namespace osu.Game.Tests.Visual { [Resolved(canBeNull: true)] [CanBeNull] - private DialogOverlay dialogOverlay { get; set; } + private IDialogOverlay dialogOverlay { get; set; } public new void Undo() => base.Undo(); diff --git a/osu.Game/Tests/Visual/ScreenTestScene.cs b/osu.Game/Tests/Visual/ScreenTestScene.cs index b6f6ca6daa..e9069d8c9c 100644 --- a/osu.Game/Tests/Visual/ScreenTestScene.cs +++ b/osu.Game/Tests/Visual/ScreenTestScene.cs @@ -23,7 +23,7 @@ namespace osu.Game.Tests.Visual protected override Container Content => content; - [Cached] + [Cached(typeof(IDialogOverlay))] protected DialogOverlay DialogOverlay { get; private set; } protected ScreenTestScene() From 25f1f772f3d6cad2a0bb9728057e106588555bd0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 18:36:22 +0900 Subject: [PATCH 0296/2328] Allow caching via `loadComponentSingleFile` with interface specification --- osu.Game/OsuGame.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 73121f6e7d..f8bc32431c 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -825,7 +825,7 @@ namespace osu.Game }, rightFloatingOverlayContent.Add, true); loadComponentSingleFile(new AccountCreationOverlay(), topMostOverlayContent.Add, true); - loadComponentSingleFile(new DialogOverlay(), topMostOverlayContent.Add, true); + loadComponentSingleFile(new DialogOverlay(), topMostOverlayContent.Add, true); loadComponentSingleFile(CreateHighPerformanceSession(), Add); @@ -982,12 +982,15 @@ namespace osu.Game /// The component to load. /// An action to invoke on load completion (generally to add the component to the hierarchy). /// Whether to cache the component as type into the game dependencies before any scheduling. - private T loadComponentSingleFile(T component, Action loadCompleteAction, bool cache = false) - where T : Drawable + private T loadComponentSingleFile(T component, Action loadCompleteAction, bool cache = false) + where T : class { if (cache) dependencies.CacheAs(component); + var drawableComponent = component as Drawable; + Debug.Assert(drawableComponent != null); + if (component is OsuFocusedOverlayContainer overlay) focusedOverlays.Add(overlay); @@ -1011,7 +1014,7 @@ namespace osu.Game // Since this is running in a separate thread, it is possible for OsuGame to be disposed after LoadComponentAsync has been called // throwing an exception. To avoid this, the call is scheduled on the update thread, which does not run if IsDisposed = true Task task = null; - var del = new ScheduledDelegate(() => task = LoadComponentAsync(component, loadCompleteAction)); + var del = new ScheduledDelegate(() => task = LoadComponentAsync(drawableComponent, loadCompleteAction)); Scheduler.Add(del); // The delegate won't complete if OsuGame has been disposed in the meantime From fea4632e839207ae1b183878aff42a437e271fa6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 20:04:19 +0900 Subject: [PATCH 0297/2328] Convert assert to hard throw --- osu.Game/OsuGame.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index f8bc32431c..e10da39055 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -988,8 +988,7 @@ namespace osu.Game if (cache) dependencies.CacheAs(component); - var drawableComponent = component as Drawable; - Debug.Assert(drawableComponent != null); + var drawableComponent = component as Drawable ?? throw new ArgumentException($"Component must be a {nameof(Drawable)}", nameof(component)); if (component is OsuFocusedOverlayContainer overlay) focusedOverlays.Add(overlay); From d86e3abf2c5d4857062cf23d680fa40f94006a0e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 20:04:38 +0900 Subject: [PATCH 0298/2328] Fix invalid rename --- osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs index 17234f4022..405461eec8 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs @@ -11,7 +11,7 @@ using osu.Game.Overlays.Dialog; namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] - public class TestSceneIDialogOverlay : OsuTestScene + public class TestSceneDialogOverlay : OsuTestScene { private DialogOverlay overlay; From 72a33c0926dde589b5dc1c2ffabdcf5184bdb474 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 20:06:08 +0900 Subject: [PATCH 0299/2328] Split out step for dialog overlay load wait --- .../Visual/Navigation/TestScenePerformFromScreen.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs index c4099b55c7..559e6ddd89 100644 --- a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs +++ b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs @@ -114,7 +114,7 @@ namespace osu.Game.Tests.Visual.Navigation AddAssert("did not perform", () => !actionPerformed); AddAssert("only one exit attempt", () => blocker.ExitAttempts == 1); - AddUntilStep("wait for dialog display", () => ((Drawable)Game.Dependencies.Get()).IsLoaded); + waitForDialogOverlayLoad(); if (confirmed) { @@ -146,7 +146,7 @@ namespace osu.Game.Tests.Visual.Navigation AddWaitStep("wait a bit", 10); - AddUntilStep("wait for dialog display", () => ((Drawable)Game.Dependencies.Get()).IsLoaded); + waitForDialogOverlayLoad(); AddAssert("screen didn't change", () => Game.ScreenStack.CurrentScreen == blocker2); AddAssert("did not perform", () => !actionPerformed); @@ -188,7 +188,7 @@ namespace osu.Game.Tests.Visual.Navigation AddWaitStep("wait a bit", 10); - AddUntilStep("wait for dialog display", () => ((Drawable)Game.Dependencies.Get()).IsLoaded); + waitForDialogOverlayLoad(); AddAssert("screen didn't change", () => Game.ScreenStack.CurrentScreen == screenWithNestedStack); AddAssert("nested screen didn't change", () => screenWithNestedStack.SubScreenStack.CurrentScreen == screenWithNestedStack.Blocker); @@ -212,6 +212,8 @@ namespace osu.Game.Tests.Visual.Navigation } } + private void waitForDialogOverlayLoad() => AddUntilStep("wait for dialog overlay loaded", () => ((Drawable)Game.Dependencies.Get()).IsLoaded); + private void importAndWaitForSongSelect() { AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely()); From 043599081bc29f81fa6888d48d214d1cc505edb3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 19:59:57 +0900 Subject: [PATCH 0300/2328] Split out `INotificationOverlay` to allow for easier testing --- .../Security/ElevatedPrivilegesChecker.cs | 2 +- osu.Desktop/Updater/SquirrelUpdateManager.cs | 2 +- osu.Game.Tests/Visual/Menus/IntroTestScene.cs | 2 +- .../Visual/Navigation/TestSceneOsuGame.cs | 2 +- .../Visual/Online/TestSceneMessageNotifier.cs | 2 +- osu.Game/Database/EFToRealmMigrator.cs | 2 +- osu.Game/Graphics/ScreenshotManager.cs | 2 +- osu.Game/Online/Chat/MessageNotifier.cs | 4 +-- osu.Game/OsuGame.cs | 2 +- .../BeatmapSet/Buttons/FavouriteButton.cs | 2 +- osu.Game/Overlays/INotificationOverlay.cs | 26 +++++++++++++++++++ osu.Game/Overlays/NotificationOverlay.cs | 6 +---- .../Sections/General/UpdateSettings.cs | 2 +- .../Maintenance/MigrationRunScreen.cs | 2 +- osu.Game/PerformFromMenuRunner.cs | 2 +- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/Menu/ButtonSystem.cs | 2 +- osu.Game/Screens/Menu/IntroScreen.cs | 2 +- osu.Game/Screens/Play/HUDOverlay.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 4 +-- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- osu.Game/Updater/UpdateManager.cs | 4 +-- 22 files changed, 50 insertions(+), 28 deletions(-) create mode 100644 osu.Game/Overlays/INotificationOverlay.cs diff --git a/osu.Desktop/Security/ElevatedPrivilegesChecker.cs b/osu.Desktop/Security/ElevatedPrivilegesChecker.cs index 8f3ad853dc..ba37a14442 100644 --- a/osu.Desktop/Security/ElevatedPrivilegesChecker.cs +++ b/osu.Desktop/Security/ElevatedPrivilegesChecker.cs @@ -19,7 +19,7 @@ namespace osu.Desktop.Security public class ElevatedPrivilegesChecker : Component { [Resolved] - private NotificationOverlay notifications { get; set; } + private INotificationOverlay notifications { get; set; } private bool elevated; diff --git a/osu.Desktop/Updater/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs index b307146b10..bae850fce1 100644 --- a/osu.Desktop/Updater/SquirrelUpdateManager.cs +++ b/osu.Desktop/Updater/SquirrelUpdateManager.cs @@ -25,7 +25,7 @@ namespace osu.Desktop.Updater public class SquirrelUpdateManager : osu.Game.Updater.UpdateManager { private UpdateManager updateManager; - private NotificationOverlay notificationOverlay; + private INotificationOverlay notificationOverlay; public Task PrepareUpdateAsync() => UpdateManager.RestartAppWhenExited(); diff --git a/osu.Game.Tests/Visual/Menus/IntroTestScene.cs b/osu.Game.Tests/Visual/Menus/IntroTestScene.cs index 82accceb23..c68cd39c65 100644 --- a/osu.Game.Tests/Visual/Menus/IntroTestScene.cs +++ b/osu.Game.Tests/Visual/Menus/IntroTestScene.cs @@ -26,7 +26,7 @@ namespace osu.Game.Tests.Visual.Menus private IntroScreen intro; - [Cached] + [Cached(typeof(INotificationOverlay))] private NotificationOverlay notifications; private ScheduledDelegate trackResetDelegate; diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs b/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs index 921d088fc7..0f8337deb6 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs @@ -37,7 +37,7 @@ namespace osu.Game.Tests.Visual.Navigation typeof(OsuLogo), typeof(IdleTracker), typeof(OnScreenDisplay), - typeof(NotificationOverlay), + typeof(INotificationOverlay), typeof(BeatmapListingOverlay), typeof(DashboardOverlay), typeof(NewsOverlay), diff --git a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs index 2c253650d5..79f62a16e3 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs @@ -200,7 +200,7 @@ namespace osu.Game.Tests.Visual.Online [Cached] public ChannelManager ChannelManager { get; } = new ChannelManager(); - [Cached] + [Cached(typeof(INotificationOverlay))] public NotificationOverlay NotificationOverlay { get; } = new NotificationOverlay { Anchor = Anchor.TopRight, diff --git a/osu.Game/Database/EFToRealmMigrator.cs b/osu.Game/Database/EFToRealmMigrator.cs index ae73e13b77..4e98b7d3d2 100644 --- a/osu.Game/Database/EFToRealmMigrator.cs +++ b/osu.Game/Database/EFToRealmMigrator.cs @@ -52,7 +52,7 @@ namespace osu.Game.Database private OsuConfigManager config { get; set; } = null!; [Resolved] - private NotificationOverlay notificationOverlay { get; set; } = null!; + private INotificationOverlay notificationOverlay { get; set; } = null!; [Resolved] private OsuGame game { get; set; } = null!; diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index b0f20de685..a2f1a3d7b9 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -43,7 +43,7 @@ namespace osu.Game.Graphics private Storage storage; [Resolved] - private NotificationOverlay notificationOverlay { get; set; } + private INotificationOverlay notificationOverlay { get; set; } private Sample shutter; diff --git a/osu.Game/Online/Chat/MessageNotifier.cs b/osu.Game/Online/Chat/MessageNotifier.cs index 20c33db61f..ca6082e19b 100644 --- a/osu.Game/Online/Chat/MessageNotifier.cs +++ b/osu.Game/Online/Chat/MessageNotifier.cs @@ -24,7 +24,7 @@ namespace osu.Game.Online.Chat public class MessageNotifier : Component { [Resolved] - private NotificationOverlay notifications { get; set; } + private INotificationOverlay notifications { get; set; } [Resolved] private ChatOverlay chatOverlay { get; set; } @@ -170,7 +170,7 @@ namespace osu.Game.Online.Chat public override bool IsImportant => false; [BackgroundDependencyLoader] - private void load(OsuColour colours, ChatOverlay chatOverlay, NotificationOverlay notificationOverlay) + private void load(OsuColour colours, ChatOverlay chatOverlay, INotificationOverlay notificationOverlay) { IconBackground.Colour = colours.PurpleDark; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index e10da39055..45d76cc15b 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -778,7 +778,7 @@ namespace osu.Game loadComponentSingleFile(onScreenDisplay, Add, true); - loadComponentSingleFile(Notifications.With(d => + loadComponentSingleFile(Notifications.With(d => { d.Anchor = Anchor.TopRight; d.Origin = Anchor.TopRight; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs index 8fe7450873..28100e5fff 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons } [BackgroundDependencyLoader(true)] - private void load(IAPIProvider api, NotificationOverlay notifications) + private void load(IAPIProvider api, INotificationOverlay notifications) { SpriteIcon icon; diff --git a/osu.Game/Overlays/INotificationOverlay.cs b/osu.Game/Overlays/INotificationOverlay.cs new file mode 100644 index 0000000000..432dd2be54 --- /dev/null +++ b/osu.Game/Overlays/INotificationOverlay.cs @@ -0,0 +1,26 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Game.Overlays.Notifications; + +namespace osu.Game.Overlays +{ + /// + /// An overlay which is capable of showing notifications to the user. + /// + [Cached] + public interface INotificationOverlay + { + /// + /// Post a new notification for display. + /// + /// The notification to display. + void Post(Notification notification); + + /// + /// Hide the overlay, if it is currently visible. + /// + void Hide(); + } +} diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index e4e3931048..0e8fbc6680 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -19,7 +19,7 @@ using osu.Game.Localisation; namespace osu.Game.Overlays { - public class NotificationOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent + public class NotificationOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent, INotificationOverlay { public string IconTexture => "Icons/Hexacons/notification"; public LocalisableString Title => NotificationsStrings.HeaderTitle; @@ -111,10 +111,6 @@ namespace osu.Game.Overlays private double? lastSamplePlayback; - /// - /// Post a new notification for display. - /// - /// The notification to display. public void Post(Notification notification) => postScheduler.Add(() => { ++runningDepth; diff --git a/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs b/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs index 0b4eca6379..5bc88b8692 100644 --- a/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections.General private SettingsButton checkForUpdatesButton; [Resolved(CanBeNull = true)] - private NotificationOverlay notifications { get; set; } + private INotificationOverlay notifications { get; set; } [BackgroundDependencyLoader(true)] private void load(Storage storage, OsuConfigManager config, OsuGame game) diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationRunScreen.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationRunScreen.cs index fb7ff0dbd1..10d6f0aef5 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationRunScreen.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationRunScreen.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance private OsuGame game { get; set; } [Resolved] - private NotificationOverlay notifications { get; set; } + private INotificationOverlay notifications { get; set; } [Resolved] private Storage storage { get; set; } diff --git a/osu.Game/PerformFromMenuRunner.cs b/osu.Game/PerformFromMenuRunner.cs index 7039d5379c..ae9879fb5a 100644 --- a/osu.Game/PerformFromMenuRunner.cs +++ b/osu.Game/PerformFromMenuRunner.cs @@ -23,7 +23,7 @@ namespace osu.Game private readonly Func getCurrentScreen; [Resolved] - private NotificationOverlay notifications { get; set; } + private INotificationOverlay notifications { get; set; } [Resolved] private IDialogOverlay dialogOverlay { get; set; } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 255571dfdb..602b7563ac 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -87,7 +87,7 @@ namespace osu.Game.Screens.Edit private IDialogOverlay dialogOverlay { get; set; } [Resolved(canBeNull: true)] - private NotificationOverlay notifications { get; set; } + private INotificationOverlay notifications { get; set; } public readonly Bindable Mode = new Bindable(); diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 8eeb90a3fd..598c441042 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -118,7 +118,7 @@ namespace osu.Game.Screens.Menu private IAPIProvider api { get; set; } [Resolved(CanBeNull = true)] - private NotificationOverlay notifications { get; set; } + private INotificationOverlay notifications { get; set; } [Resolved(CanBeNull = true)] private LoginOverlay loginOverlay { get; set; } diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs index e569b0e517..5575d3681f 100644 --- a/osu.Game/Screens/Menu/IntroScreen.cs +++ b/osu.Game/Screens/Menu/IntroScreen.cs @@ -171,7 +171,7 @@ namespace osu.Game.Screens.Menu } [Resolved] - private NotificationOverlay notifications { get; set; } + private INotificationOverlay notifications { get; set; } private void ensureEventuallyArrivingAtMenu() { diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 628452fbc8..676a08b434 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -119,7 +119,7 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader(true)] - private void load(OsuConfigManager config, NotificationOverlay notificationOverlay) + private void load(OsuConfigManager config, INotificationOverlay notificationOverlay) { if (drawableRuleset != null) { diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index ba720af2a1..b72ec373d7 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -515,7 +515,7 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader] - private void load(OsuColour colours, AudioManager audioManager, NotificationOverlay notificationOverlay, VolumeOverlay volumeOverlay) + private void load(OsuColour colours, AudioManager audioManager, INotificationOverlay notificationOverlay, VolumeOverlay volumeOverlay) { Icon = FontAwesome.Solid.VolumeMute; IconBackground.Colour = colours.RedDark; @@ -567,7 +567,7 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader] - private void load(OsuColour colours, NotificationOverlay notificationOverlay) + private void load(OsuColour colours, INotificationOverlay notificationOverlay) { Icon = FontAwesome.Solid.BatteryQuarter; IconBackground.Colour = colours.RedDark; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 593436bbb7..4a991ffc66 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.Select private OsuScreen playerLoader; [Resolved(CanBeNull = true)] - private NotificationOverlay notifications { get; set; } + private INotificationOverlay notifications { get; set; } public override bool AllowExternalScreenChange => true; diff --git a/osu.Game/Updater/UpdateManager.cs b/osu.Game/Updater/UpdateManager.cs index 9b9f354d23..c17d8304b9 100644 --- a/osu.Game/Updater/UpdateManager.cs +++ b/osu.Game/Updater/UpdateManager.cs @@ -31,7 +31,7 @@ namespace osu.Game.Updater private OsuGameBase game { get; set; } [Resolved] - protected NotificationOverlay Notifications { get; private set; } + protected INotificationOverlay Notifications { get; private set; } protected override void LoadComplete() { @@ -94,7 +94,7 @@ namespace osu.Game.Updater } [BackgroundDependencyLoader] - private void load(OsuColour colours, ChangelogOverlay changelog, NotificationOverlay notificationOverlay) + private void load(OsuColour colours, ChangelogOverlay changelog, INotificationOverlay notificationOverlay) { Icon = FontAwesome.Solid.CheckSquare; IconBackground.Colour = colours.BlueDark; From d29312e0709eb11e63effe51fb6c806966e3689d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 21:47:47 +0900 Subject: [PATCH 0301/2328] Fix rider incompetency --- osu.Game/Overlays/IDialogOverlay.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/IDialogOverlay.cs b/osu.Game/Overlays/IDialogOverlay.cs index 07f28a7204..dedc164510 100644 --- a/osu.Game/Overlays/IDialogOverlay.cs +++ b/osu.Game/Overlays/IDialogOverlay.cs @@ -1,7 +1,8 @@ -#nullable enable // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using osu.Framework.Allocation; using osu.Game.Overlays.Dialog; From aaf5577e6a035606f19e3fd249b7a4f464f35a13 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 21:48:46 +0900 Subject: [PATCH 0302/2328] Remove unnecessary `canBeNull` specification --- .../Sections/Maintenance/StableDirectoryLocationDialog.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectoryLocationDialog.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectoryLocationDialog.cs index 4e81cd63b8..b16fd9a5a1 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectoryLocationDialog.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectoryLocationDialog.cs @@ -12,7 +12,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance { public class StableDirectoryLocationDialog : PopupDialog { - [Resolved(canBeNull: true)] + [Resolved] private IPerformFromScreenRunner performer { get; set; } public StableDirectoryLocationDialog(TaskCompletionSource taskCompletionSource) From 5d5e46ede71bd05ac9846da73eb03119f96cad7b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 21:47:47 +0900 Subject: [PATCH 0303/2328] Fix rider incompetency --- osu.Game/Overlays/IDialogOverlay.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/IDialogOverlay.cs b/osu.Game/Overlays/IDialogOverlay.cs index 07f28a7204..dedc164510 100644 --- a/osu.Game/Overlays/IDialogOverlay.cs +++ b/osu.Game/Overlays/IDialogOverlay.cs @@ -1,7 +1,8 @@ -#nullable enable // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using osu.Framework.Allocation; using osu.Game.Overlays.Dialog; From 3cbc6cd29767a7d47ba624dc1680c22f4a02cedd Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Apr 2022 21:04:22 +0300 Subject: [PATCH 0304/2328] Update further tests to cache using `IDialogOverlay` --- osu.Game.Tests/Visual/Online/TestSceneChatLink.cs | 2 +- osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs | 2 +- osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs | 2 +- .../Visual/SongSelect/TestSceneUserTopScoreContainer.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs b/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs index d077868175..6818147da4 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs @@ -49,7 +49,7 @@ namespace osu.Game.Tests.Visual.Online Dependencies.Cache(chatManager); Dependencies.Cache(new ChatOverlay()); - Dependencies.Cache(dialogOverlay); + Dependencies.CacheAs(dialogOverlay); } [SetUp] diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs index f9c9b2a68b..2106043544 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs @@ -97,7 +97,7 @@ namespace osu.Game.Tests.Visual.Settings Depth = -1 }); - Dependencies.Cache(dialogOverlay); + Dependencies.CacheAs(dialogOverlay); } } } diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs index 1ed6648131..3b15ee9c45 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs @@ -31,7 +31,7 @@ namespace osu.Game.Tests.Visual.SongSelect { private readonly FailableLeaderboard leaderboard; - [Cached] + [Cached(typeof(IDialogOverlay))] private readonly DialogOverlay dialogOverlay; private ScoreManager scoreManager; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs index dd7f9951bf..c71e54e9a8 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs @@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.SongSelect { public class TestSceneUserTopScoreContainer : OsuTestScene { - [Cached] + [Cached(typeof(IDialogOverlay))] private readonly DialogOverlay dialogOverlay; public TestSceneUserTopScoreContainer() From 16a0efc5621ba8a751f874bb8fef91218766efa2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Apr 2022 21:06:27 +0300 Subject: [PATCH 0305/2328] Cache `IDialogOverlay` as its type in interface --- osu.Game/Overlays/IDialogOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/IDialogOverlay.cs b/osu.Game/Overlays/IDialogOverlay.cs index dedc164510..1c6a84cd64 100644 --- a/osu.Game/Overlays/IDialogOverlay.cs +++ b/osu.Game/Overlays/IDialogOverlay.cs @@ -11,7 +11,7 @@ namespace osu.Game.Overlays /// /// A global overlay that can show popup dialogs. /// - [Cached] + [Cached(typeof(IDialogOverlay))] public interface IDialogOverlay { /// From 1fc28552b54400ca6e49f40ad5e40f4c88d3bd6e Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Apr 2022 21:07:20 +0300 Subject: [PATCH 0306/2328] Minor reword inline comment --- osu.Game/Overlays/Dialog/PopupDialog.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index 9fd1a32e84..d08b6b7beb 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -216,7 +216,7 @@ namespace osu.Game.Overlays.Dialog }; // It's important we start in a visible state so our state fires on hide, even before load. - // This is used by the IDialogOverlay to know when the dialog was dismissed. + // This is used by the dialog overlay to know when the dialog was dismissed. Show(); } From 9d59cd408fda8b931d77f9001ac38a31a4a91fb7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Apr 2022 22:59:49 +0300 Subject: [PATCH 0307/2328] Add concept of "initial items count" in paginated API requests --- .../Online/API/Requests/GetUserBeatmapsRequest.cs | 4 ++-- .../API/Requests/GetUserKudosuHistoryRequest.cs | 4 ++-- .../Requests/GetUserMostPlayedBeatmapsRequest.cs | 4 ++-- .../API/Requests/GetUserRecentActivitiesRequest.cs | 4 ++-- .../Online/API/Requests/GetUserScoresRequest.cs | 4 ++-- osu.Game/Online/API/Requests/PaginatedAPIRequest.cs | 13 ++++++++++--- 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs index e2c0ed4301..b7681cb71b 100644 --- a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs @@ -13,8 +13,8 @@ namespace osu.Game.Online.API.Requests private readonly BeatmapSetType type; - public GetUserBeatmapsRequest(long userId, BeatmapSetType type, int page = 0, int itemsPerPage = 6) - : base(page, itemsPerPage) + public GetUserBeatmapsRequest(long userId, BeatmapSetType type, int page, int itemsPerPage, int initialItems) + : base(page, itemsPerPage, initialItems) { this.userId = userId; this.type = type; diff --git a/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs b/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs index e90e297672..d2102d7697 100644 --- a/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs @@ -10,8 +10,8 @@ namespace osu.Game.Online.API.Requests { private readonly long userId; - public GetUserKudosuHistoryRequest(long userId, int page = 0, int itemsPerPage = 5) - : base(page, itemsPerPage) + public GetUserKudosuHistoryRequest(long userId, int page, int itemsPerPage, int initialItems) + : base(page, itemsPerPage, initialItems) { this.userId = userId; } diff --git a/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs index 9f094e51c4..a9b6dd7edc 100644 --- a/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs @@ -10,8 +10,8 @@ namespace osu.Game.Online.API.Requests { private readonly long userId; - public GetUserMostPlayedBeatmapsRequest(long userId, int page = 0, int itemsPerPage = 5) - : base(page, itemsPerPage) + public GetUserMostPlayedBeatmapsRequest(long userId, int page, int itemsPerPage, int initialItems) + : base(page, itemsPerPage, initialItems) { this.userId = userId; } diff --git a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs index f2fa51bde7..60acc27182 100644 --- a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs @@ -10,8 +10,8 @@ namespace osu.Game.Online.API.Requests { private readonly long userId; - public GetUserRecentActivitiesRequest(long userId, int page = 0, int itemsPerPage = 5) - : base(page, itemsPerPage) + public GetUserRecentActivitiesRequest(long userId, int page, int itemsPerPage, int initialItems) + : base(page, itemsPerPage, initialItems) { this.userId = userId; } diff --git a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs index 5d39799f6b..85b58fc596 100644 --- a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs @@ -14,8 +14,8 @@ namespace osu.Game.Online.API.Requests private readonly ScoreType type; private readonly RulesetInfo ruleset; - public GetUserScoresRequest(long userId, ScoreType type, int page = 0, int itemsPerPage = 5, RulesetInfo ruleset = null) - : base(page, itemsPerPage) + public GetUserScoresRequest(long userId, ScoreType type, int page, int itemsPerPage, int initialItems, RulesetInfo ruleset = null) + : base(page, itemsPerPage, initialItems) { this.userId = userId; this.type = type; diff --git a/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs b/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs index bddc34a0dc..ea59fcfc25 100644 --- a/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs +++ b/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs @@ -9,11 +9,13 @@ namespace osu.Game.Online.API.Requests public abstract class PaginatedAPIRequest : APIRequest where T : class { private readonly int page; + private readonly int initialItems; private readonly int itemsPerPage; - protected PaginatedAPIRequest(int page, int itemsPerPage) + protected PaginatedAPIRequest(int page, int itemsPerPage, int initialItems) { this.page = page; + this.initialItems = initialItems; this.itemsPerPage = itemsPerPage; } @@ -21,8 +23,13 @@ namespace osu.Game.Online.API.Requests { var req = base.CreateWebRequest(); - req.AddParameter("offset", (page * itemsPerPage).ToString(CultureInfo.InvariantCulture)); - req.AddParameter("limit", itemsPerPage.ToString(CultureInfo.InvariantCulture)); + if (page == 0) + req.AddParameter("limit", initialItems.ToString(CultureInfo.InvariantCulture)); + else + { + req.AddParameter("offset", (initialItems + (page - 1) * itemsPerPage).ToString(CultureInfo.InvariantCulture)); + req.AddParameter("limit", itemsPerPage.ToString(CultureInfo.InvariantCulture)); + } return req; } From f08449e432d11625ec3b3fa3ad5d95df1ef091c8 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Apr 2022 23:04:21 +0300 Subject: [PATCH 0308/2328] Update paginated profile subsections to display items inline with web --- .../Beatmaps/PaginatedBeatmapContainer.cs | 7 ++++--- .../PaginatedMostPlayedBeatmapContainer.cs | 5 ++--- .../Kudosu/PaginatedKudosuHistoryContainer.cs | 5 ++--- .../Sections/PaginatedProfileSubsection.cs | 19 +++++++++++++++---- .../Sections/Ranks/PaginatedScoreContainer.cs | 6 ++---- .../PaginatedRecentActivityContainer.cs | 5 ++--- 6 files changed, 27 insertions(+), 20 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index d39074bd49..deeb63b5bf 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -20,11 +20,12 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps private const float panel_padding = 10f; private readonly BeatmapSetType type; + protected override int InitialItemsCount => type == BeatmapSetType.Graveyard ? 2 : 6; + public PaginatedBeatmapContainer(BeatmapSetType type, Bindable user, LocalisableString headerText) : base(user, headerText) { this.type = type; - ItemsPerPage = 6; } [BackgroundDependencyLoader] @@ -57,8 +58,8 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps } } - protected override APIRequest> CreateRequest() => - new GetUserBeatmapsRequest(User.Value.Id, type, VisiblePages++, ItemsPerPage); + protected override APIRequest> CreateRequest(int itemsPerPage, int initialItems) => + new GetUserBeatmapsRequest(User.Value.Id, type, VisiblePages++, itemsPerPage, initialItems); protected override Drawable CreateDrawableItem(APIBeatmapSet model) => model.OnlineID > 0 ? new BeatmapCardNormal(model) diff --git a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs index ad1192a13a..ccd60fcd89 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs @@ -19,7 +19,6 @@ namespace osu.Game.Overlays.Profile.Sections.Historical public PaginatedMostPlayedBeatmapContainer(Bindable user) : base(user, UsersStrings.ShowExtraHistoricalMostPlayedTitle) { - ItemsPerPage = 5; } [BackgroundDependencyLoader] @@ -30,8 +29,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical protected override int GetCount(APIUser user) => user.BeatmapPlayCountsCount; - protected override APIRequest> CreateRequest() => - new GetUserMostPlayedBeatmapsRequest(User.Value.Id, VisiblePages++, ItemsPerPage); + protected override APIRequest> CreateRequest(int itemsPerPage, int initialItems) => + new GetUserMostPlayedBeatmapsRequest(User.Value.Id, VisiblePages++, itemsPerPage, initialItems); protected override Drawable CreateDrawableItem(APIUserMostPlayedBeatmap mostPlayed) => new DrawableMostPlayedBeatmap(mostPlayed); diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs index c4837cc0e2..311a64a10d 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs @@ -17,11 +17,10 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu public PaginatedKudosuHistoryContainer(Bindable user) : base(user, missingText: UsersStrings.ShowExtraKudosuEntryEmpty) { - ItemsPerPage = 5; } - protected override APIRequest> CreateRequest() - => new GetUserKudosuHistoryRequest(User.Value.Id, VisiblePages++, ItemsPerPage); + protected override APIRequest> CreateRequest(int itemsPerPage, int initialItems) + => new GetUserKudosuHistoryRequest(User.Value.Id, VisiblePages++, itemsPerPage, initialItems); protected override Drawable CreateDrawableItem(APIKudosuHistory item) => new DrawableKudosuHistoryItem(item); } diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs b/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs index 9dcbf6142d..646c16fbd7 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs @@ -21,11 +21,20 @@ namespace osu.Game.Overlays.Profile.Sections { public abstract class PaginatedProfileSubsection : ProfileSubsection { + /// + /// The number of items displayed per page. + /// + protected virtual int ItemsPerPage => 50; + + /// + /// The number of items displayed initially. + /// + protected virtual int InitialItemsCount => 5; + [Resolved] private IAPIProvider api { get; set; } protected int VisiblePages; - protected int ItemsPerPage; protected ReverseChildIDFillFlowContainer ItemsContainer { get; private set; } @@ -101,7 +110,7 @@ namespace osu.Game.Overlays.Profile.Sections { loadCancellation = new CancellationTokenSource(); - retrievalRequest = CreateRequest(); + retrievalRequest = CreateRequest(ItemsPerPage, InitialItemsCount); retrievalRequest.Success += UpdateItems; api.Queue(retrievalRequest); @@ -125,7 +134,9 @@ namespace osu.Game.Overlays.Profile.Sections LoadComponentsAsync(items.Select(CreateDrawableItem).Where(d => d != null), drawables => { missing.Hide(); - moreButton.FadeTo(items.Count == ItemsPerPage ? 1 : 0); + + int maxCount = VisiblePages == 1 ? InitialItemsCount : ItemsPerPage; + moreButton.FadeTo(items.Count == maxCount ? 1 : 0); moreButton.IsLoading = false; ItemsContainer.AddRange(drawables); @@ -138,7 +149,7 @@ namespace osu.Game.Overlays.Profile.Sections { } - protected abstract APIRequest> CreateRequest(); + protected abstract APIRequest> CreateRequest(int itemsPerPage, int initialItems); protected abstract Drawable CreateDrawableItem(TModel model); diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index 5c67da1911..cc5952017d 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -23,8 +23,6 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks : base(user, headerText) { this.type = type; - - ItemsPerPage = 5; } [BackgroundDependencyLoader] @@ -62,8 +60,8 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks base.OnItemsReceived(items); } - protected override APIRequest> CreateRequest() => - new GetUserScoresRequest(User.Value.Id, type, VisiblePages++, ItemsPerPage); + protected override APIRequest> CreateRequest(int itemsPerPage, int initialItems) => + new GetUserScoresRequest(User.Value.Id, type, VisiblePages++, itemsPerPage, initialItems); private int drawableItemIndex; diff --git a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs index c5ff896654..60cba95fda 100644 --- a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs @@ -19,7 +19,6 @@ namespace osu.Game.Overlays.Profile.Sections.Recent public PaginatedRecentActivityContainer(Bindable user) : base(user, missingText: EventsStrings.Empty) { - ItemsPerPage = 10; } [BackgroundDependencyLoader] @@ -28,8 +27,8 @@ namespace osu.Game.Overlays.Profile.Sections.Recent ItemsContainer.Spacing = new Vector2(0, 8); } - protected override APIRequest> CreateRequest() => - new GetUserRecentActivitiesRequest(User.Value.Id, VisiblePages++, ItemsPerPage); + protected override APIRequest> CreateRequest(int itemsPerPage, int initialItems) => + new GetUserRecentActivitiesRequest(User.Value.Id, VisiblePages++, itemsPerPage, initialItems); protected override Drawable CreateDrawableItem(APIRecentActivity model) => new DrawableRecentActivity(model); } From c4d89b8c3c446d6440b023c2fb5508da4c99add6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 05:57:03 +0900 Subject: [PATCH 0309/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index a8952df329..8b22df418f 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 3246255815..0a102510e7 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 668d23f82e..2f0facea18 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 94335c293848a5475aa0df3f8c71f6726a544ec8 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 19 Apr 2022 00:18:10 +0300 Subject: [PATCH 0310/2328] Update further usages to cache/resolve via interface --- osu.Desktop/Updater/SquirrelUpdateManager.cs | 4 ++-- osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs | 2 +- osu.Game.Tests/Visual/Settings/TestSceneMigrationScreens.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Desktop/Updater/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs index bae850fce1..c09cce1235 100644 --- a/osu.Desktop/Updater/SquirrelUpdateManager.cs +++ b/osu.Desktop/Updater/SquirrelUpdateManager.cs @@ -39,9 +39,9 @@ namespace osu.Desktop.Updater private readonly SquirrelLogger squirrelLogger = new SquirrelLogger(); [BackgroundDependencyLoader] - private void load(NotificationOverlay notification) + private void load(INotificationOverlay notifications) { - notificationOverlay = notification; + notificationOverlay = notifications; SquirrelLocator.CurrentMutable.Register(() => squirrelLogger, typeof(ILogger)); } diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs index 958d617d63..950c755cc1 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs @@ -43,7 +43,7 @@ namespace osu.Game.Tests.Visual.Gameplay [Resolved] private SessionStatics sessionStatics { get; set; } - [Cached] + [Cached(typeof(INotificationOverlay))] private readonly NotificationOverlay notificationOverlay; [Cached] diff --git a/osu.Game.Tests/Visual/Settings/TestSceneMigrationScreens.cs b/osu.Game.Tests/Visual/Settings/TestSceneMigrationScreens.cs index a68090504d..ac0956502e 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneMigrationScreens.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneMigrationScreens.cs @@ -14,7 +14,7 @@ namespace osu.Game.Tests.Visual.Settings { public class TestSceneMigrationScreens : ScreenTestScene { - [Cached] + [Cached(typeof(INotificationOverlay))] private readonly NotificationOverlay notifications; public TestSceneMigrationScreens() diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index b72ec373d7..aea39bc8ff 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -124,7 +124,7 @@ namespace osu.Game.Screens.Play private EpilepsyWarning? epilepsyWarning; [Resolved(CanBeNull = true)] - private NotificationOverlay? notificationOverlay { get; set; } + private INotificationOverlay? notificationOverlay { get; set; } [Resolved(CanBeNull = true)] private VolumeOverlay? volumeOverlay { get; set; } From 96d4369cc823d71370f1c2fa9f8faaecba66f828 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 19 Apr 2022 02:04:23 +0300 Subject: [PATCH 0311/2328] Introduce `Pagination` and simplify paginated API requests --- .../API/Requests/GetUserBeatmapsRequest.cs | 4 +- .../Requests/GetUserKudosuHistoryRequest.cs | 4 +- .../GetUserMostPlayedBeatmapsRequest.cs | 4 +- .../GetUserRecentActivitiesRequest.cs | 4 +- .../API/Requests/GetUserScoresRequest.cs | 4 +- .../API/Requests/PaginatedAPIRequest.cs | 19 +++------- osu.Game/Online/API/Requests/Pagination.cs | 38 +++++++++++++++++++ .../Beatmaps/PaginatedBeatmapContainer.cs | 4 +- .../PaginatedMostPlayedBeatmapContainer.cs | 4 +- .../Kudosu/PaginatedKudosuHistoryContainer.cs | 4 +- .../Sections/PaginatedProfileSubsection.cs | 16 ++++---- .../Sections/Ranks/PaginatedScoreContainer.cs | 6 +-- .../PaginatedRecentActivityContainer.cs | 4 +- 13 files changed, 73 insertions(+), 42 deletions(-) create mode 100644 osu.Game/Online/API/Requests/Pagination.cs diff --git a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs index b7681cb71b..019c805c9a 100644 --- a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs @@ -13,8 +13,8 @@ namespace osu.Game.Online.API.Requests private readonly BeatmapSetType type; - public GetUserBeatmapsRequest(long userId, BeatmapSetType type, int page, int itemsPerPage, int initialItems) - : base(page, itemsPerPage, initialItems) + public GetUserBeatmapsRequest(long userId, BeatmapSetType type, Pagination pagination) + : base(pagination) { this.userId = userId; this.type = type; diff --git a/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs b/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs index d2102d7697..3759c59722 100644 --- a/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs @@ -10,8 +10,8 @@ namespace osu.Game.Online.API.Requests { private readonly long userId; - public GetUserKudosuHistoryRequest(long userId, int page, int itemsPerPage, int initialItems) - : base(page, itemsPerPage, initialItems) + public GetUserKudosuHistoryRequest(long userId, Pagination pagination) + : base(pagination) { this.userId = userId; } diff --git a/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs index a9b6dd7edc..37359e2cd0 100644 --- a/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs @@ -10,8 +10,8 @@ namespace osu.Game.Online.API.Requests { private readonly long userId; - public GetUserMostPlayedBeatmapsRequest(long userId, int page, int itemsPerPage, int initialItems) - : base(page, itemsPerPage, initialItems) + public GetUserMostPlayedBeatmapsRequest(long userId, Pagination pagination) + : base(pagination) { this.userId = userId; } diff --git a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs index 60acc27182..c16633c17a 100644 --- a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs @@ -10,8 +10,8 @@ namespace osu.Game.Online.API.Requests { private readonly long userId; - public GetUserRecentActivitiesRequest(long userId, int page, int itemsPerPage, int initialItems) - : base(page, itemsPerPage, initialItems) + public GetUserRecentActivitiesRequest(long userId, Pagination pagination) + : base(pagination) { this.userId = userId; } diff --git a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs index 85b58fc596..af01969a1a 100644 --- a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs @@ -14,8 +14,8 @@ namespace osu.Game.Online.API.Requests private readonly ScoreType type; private readonly RulesetInfo ruleset; - public GetUserScoresRequest(long userId, ScoreType type, int page, int itemsPerPage, int initialItems, RulesetInfo ruleset = null) - : base(page, itemsPerPage, initialItems) + public GetUserScoresRequest(long userId, ScoreType type, Pagination pagination, RulesetInfo ruleset = null) + : base(pagination) { this.userId = userId; this.type = type; diff --git a/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs b/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs index ea59fcfc25..ddc453bf17 100644 --- a/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs +++ b/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs @@ -8,28 +8,19 @@ namespace osu.Game.Online.API.Requests { public abstract class PaginatedAPIRequest : APIRequest where T : class { - private readonly int page; - private readonly int initialItems; - private readonly int itemsPerPage; + private readonly Pagination pagination; - protected PaginatedAPIRequest(int page, int itemsPerPage, int initialItems) + protected PaginatedAPIRequest(Pagination pagination) { - this.page = page; - this.initialItems = initialItems; - this.itemsPerPage = itemsPerPage; + this.pagination = pagination; } protected override WebRequest CreateWebRequest() { var req = base.CreateWebRequest(); - if (page == 0) - req.AddParameter("limit", initialItems.ToString(CultureInfo.InvariantCulture)); - else - { - req.AddParameter("offset", (initialItems + (page - 1) * itemsPerPage).ToString(CultureInfo.InvariantCulture)); - req.AddParameter("limit", itemsPerPage.ToString(CultureInfo.InvariantCulture)); - } + req.AddParameter("offset", pagination.Offset.ToString(CultureInfo.InvariantCulture)); + req.AddParameter("limit", pagination.Limit.ToString(CultureInfo.InvariantCulture)); return req; } diff --git a/osu.Game/Online/API/Requests/Pagination.cs b/osu.Game/Online/API/Requests/Pagination.cs new file mode 100644 index 0000000000..a1caac7592 --- /dev/null +++ b/osu.Game/Online/API/Requests/Pagination.cs @@ -0,0 +1,38 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace osu.Game.Online.API.Requests +{ + /// + /// Represents a pagination data used for . + /// + public readonly struct Pagination + { + /// + /// The starting point of the request. + /// + public int Offset { get; } + + /// + /// The maximum number of items to return in this request. + /// + public int Limit { get; } + + public Pagination(int offset, int limit) + { + Offset = offset; + Limit = limit; + } + + public Pagination(int limit) + : this(0, limit) + { + } + + /// + /// Returns a of the next number of items defined by after this. + /// + /// The limit of the next pagination. + public Pagination TakeNext(int limit) => new Pagination(Offset + Limit, limit); + } +} diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index deeb63b5bf..f1c2b4bf7a 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -58,8 +58,8 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps } } - protected override APIRequest> CreateRequest(int itemsPerPage, int initialItems) => - new GetUserBeatmapsRequest(User.Value.Id, type, VisiblePages++, itemsPerPage, initialItems); + protected override APIRequest> CreateRequest(Pagination pagination) => + new GetUserBeatmapsRequest(User.Value.Id, type, pagination); protected override Drawable CreateDrawableItem(APIBeatmapSet model) => model.OnlineID > 0 ? new BeatmapCardNormal(model) diff --git a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs index ccd60fcd89..281bcc3a03 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs @@ -29,8 +29,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical protected override int GetCount(APIUser user) => user.BeatmapPlayCountsCount; - protected override APIRequest> CreateRequest(int itemsPerPage, int initialItems) => - new GetUserMostPlayedBeatmapsRequest(User.Value.Id, VisiblePages++, itemsPerPage, initialItems); + protected override APIRequest> CreateRequest(Pagination pagination) => + new GetUserMostPlayedBeatmapsRequest(User.Value.Id, pagination); protected override Drawable CreateDrawableItem(APIUserMostPlayedBeatmap mostPlayed) => new DrawableMostPlayedBeatmap(mostPlayed); diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs index 311a64a10d..5aada2b655 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs @@ -19,8 +19,8 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu { } - protected override APIRequest> CreateRequest(int itemsPerPage, int initialItems) - => new GetUserKudosuHistoryRequest(User.Value.Id, VisiblePages++, itemsPerPage, initialItems); + protected override APIRequest> CreateRequest(Pagination pagination) + => new GetUserKudosuHistoryRequest(User.Value.Id, pagination); protected override Drawable CreateDrawableItem(APIKudosuHistory item) => new DrawableKudosuHistoryItem(item); } diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs b/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs index 646c16fbd7..a1f9e7546a 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs @@ -14,6 +14,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Graphics.Containers; +using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osuTK; @@ -34,7 +35,7 @@ namespace osu.Game.Overlays.Profile.Sections [Resolved] private IAPIProvider api { get; set; } - protected int VisiblePages; + protected Pagination? CurrentPage { get; private set; } protected ReverseChildIDFillFlowContainer ItemsContainer { get; private set; } @@ -96,7 +97,7 @@ namespace osu.Game.Overlays.Profile.Sections loadCancellation?.Cancel(); retrievalRequest?.Cancel(); - VisiblePages = 0; + CurrentPage = null; ItemsContainer.Clear(); if (e.NewValue != null) @@ -110,7 +111,9 @@ namespace osu.Game.Overlays.Profile.Sections { loadCancellation = new CancellationTokenSource(); - retrievalRequest = CreateRequest(ItemsPerPage, InitialItemsCount); + CurrentPage = CurrentPage?.TakeNext(ItemsPerPage) ?? new Pagination(InitialItemsCount); + + retrievalRequest = CreateRequest(CurrentPage.Value); retrievalRequest.Success += UpdateItems; api.Queue(retrievalRequest); @@ -120,7 +123,7 @@ namespace osu.Game.Overlays.Profile.Sections { OnItemsReceived(items); - if (!items.Any() && VisiblePages == 1) + if (!items.Any() && CurrentPage?.Offset == 0) { moreButton.Hide(); moreButton.IsLoading = false; @@ -135,8 +138,7 @@ namespace osu.Game.Overlays.Profile.Sections { missing.Hide(); - int maxCount = VisiblePages == 1 ? InitialItemsCount : ItemsPerPage; - moreButton.FadeTo(items.Count == maxCount ? 1 : 0); + moreButton.FadeTo(items.Count == CurrentPage?.Limit ? 1 : 0); moreButton.IsLoading = false; ItemsContainer.AddRange(drawables); @@ -149,7 +151,7 @@ namespace osu.Game.Overlays.Profile.Sections { } - protected abstract APIRequest> CreateRequest(int itemsPerPage, int initialItems); + protected abstract APIRequest> CreateRequest(Pagination pagination); protected abstract Drawable CreateDrawableItem(TModel model); diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index cc5952017d..c3a5e3f8b8 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -54,14 +54,14 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks protected override void OnItemsReceived(List items) { - if (VisiblePages == 0) + if (CurrentPage == null || CurrentPage?.Offset == 0) drawableItemIndex = 0; base.OnItemsReceived(items); } - protected override APIRequest> CreateRequest(int itemsPerPage, int initialItems) => - new GetUserScoresRequest(User.Value.Id, type, VisiblePages++, itemsPerPage, initialItems); + protected override APIRequest> CreateRequest(Pagination pagination) => + new GetUserScoresRequest(User.Value.Id, type, pagination); private int drawableItemIndex; diff --git a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs index 60cba95fda..e5118094ce 100644 --- a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs @@ -27,8 +27,8 @@ namespace osu.Game.Overlays.Profile.Sections.Recent ItemsContainer.Spacing = new Vector2(0, 8); } - protected override APIRequest> CreateRequest(int itemsPerPage, int initialItems) => - new GetUserRecentActivitiesRequest(User.Value.Id, VisiblePages++, itemsPerPage, initialItems); + protected override APIRequest> CreateRequest(Pagination pagination) => + new GetUserRecentActivitiesRequest(User.Value.Id, pagination); protected override Drawable CreateDrawableItem(APIRecentActivity model) => new DrawableRecentActivity(model); } From c858ec24833b2020a434180d9f63a8a472ec7173 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 19 Apr 2022 02:48:34 +0300 Subject: [PATCH 0312/2328] `Pagination` -> `PaginationParameters --- osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs | 2 +- .../Online/API/Requests/GetUserKudosuHistoryRequest.cs | 2 +- .../API/Requests/GetUserMostPlayedBeatmapsRequest.cs | 2 +- .../API/Requests/GetUserRecentActivitiesRequest.cs | 2 +- osu.Game/Online/API/Requests/GetUserScoresRequest.cs | 2 +- osu.Game/Online/API/Requests/PaginatedAPIRequest.cs | 4 ++-- .../{Pagination.cs => PaginationParameters.cs} | 10 +++++----- .../Sections/Beatmaps/PaginatedBeatmapContainer.cs | 2 +- .../Historical/PaginatedMostPlayedBeatmapContainer.cs | 2 +- .../Sections/Kudosu/PaginatedKudosuHistoryContainer.cs | 2 +- .../Profile/Sections/PaginatedProfileSubsection.cs | 6 +++--- .../Profile/Sections/Ranks/PaginatedScoreContainer.cs | 2 +- .../Recent/PaginatedRecentActivityContainer.cs | 2 +- 13 files changed, 20 insertions(+), 20 deletions(-) rename osu.Game/Online/API/Requests/{Pagination.cs => PaginationParameters.cs} (68%) diff --git a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs index 019c805c9a..ffb3a3be9b 100644 --- a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs @@ -13,7 +13,7 @@ namespace osu.Game.Online.API.Requests private readonly BeatmapSetType type; - public GetUserBeatmapsRequest(long userId, BeatmapSetType type, Pagination pagination) + public GetUserBeatmapsRequest(long userId, BeatmapSetType type, PaginationParameters pagination) : base(pagination) { this.userId = userId; diff --git a/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs b/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs index 3759c59722..67d3ad26b0 100644 --- a/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs @@ -10,7 +10,7 @@ namespace osu.Game.Online.API.Requests { private readonly long userId; - public GetUserKudosuHistoryRequest(long userId, Pagination pagination) + public GetUserKudosuHistoryRequest(long userId, PaginationParameters pagination) : base(pagination) { this.userId = userId; diff --git a/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs index 37359e2cd0..bef3df42fb 100644 --- a/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs @@ -10,7 +10,7 @@ namespace osu.Game.Online.API.Requests { private readonly long userId; - public GetUserMostPlayedBeatmapsRequest(long userId, Pagination pagination) + public GetUserMostPlayedBeatmapsRequest(long userId, PaginationParameters pagination) : base(pagination) { this.userId = userId; diff --git a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs index c16633c17a..79f0549d4a 100644 --- a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs @@ -10,7 +10,7 @@ namespace osu.Game.Online.API.Requests { private readonly long userId; - public GetUserRecentActivitiesRequest(long userId, Pagination pagination) + public GetUserRecentActivitiesRequest(long userId, PaginationParameters pagination) : base(pagination) { this.userId = userId; diff --git a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs index af01969a1a..7250929f11 100644 --- a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs @@ -14,7 +14,7 @@ namespace osu.Game.Online.API.Requests private readonly ScoreType type; private readonly RulesetInfo ruleset; - public GetUserScoresRequest(long userId, ScoreType type, Pagination pagination, RulesetInfo ruleset = null) + public GetUserScoresRequest(long userId, ScoreType type, PaginationParameters pagination, RulesetInfo ruleset = null) : base(pagination) { this.userId = userId; diff --git a/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs b/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs index ddc453bf17..3d719de958 100644 --- a/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs +++ b/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs @@ -8,9 +8,9 @@ namespace osu.Game.Online.API.Requests { public abstract class PaginatedAPIRequest : APIRequest where T : class { - private readonly Pagination pagination; + private readonly PaginationParameters pagination; - protected PaginatedAPIRequest(Pagination pagination) + protected PaginatedAPIRequest(PaginationParameters pagination) { this.pagination = pagination; } diff --git a/osu.Game/Online/API/Requests/Pagination.cs b/osu.Game/Online/API/Requests/PaginationParameters.cs similarity index 68% rename from osu.Game/Online/API/Requests/Pagination.cs rename to osu.Game/Online/API/Requests/PaginationParameters.cs index a1caac7592..3593a4fe83 100644 --- a/osu.Game/Online/API/Requests/Pagination.cs +++ b/osu.Game/Online/API/Requests/PaginationParameters.cs @@ -6,7 +6,7 @@ namespace osu.Game.Online.API.Requests /// /// Represents a pagination data used for . /// - public readonly struct Pagination + public readonly struct PaginationParameters { /// /// The starting point of the request. @@ -18,21 +18,21 @@ namespace osu.Game.Online.API.Requests /// public int Limit { get; } - public Pagination(int offset, int limit) + public PaginationParameters(int offset, int limit) { Offset = offset; Limit = limit; } - public Pagination(int limit) + public PaginationParameters(int limit) : this(0, limit) { } /// - /// Returns a of the next number of items defined by after this. + /// Returns a of the next number of items defined by after this. /// /// The limit of the next pagination. - public Pagination TakeNext(int limit) => new Pagination(Offset + Limit, limit); + public PaginationParameters TakeNext(int limit) => new PaginationParameters(Offset + Limit, limit); } } diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index f1c2b4bf7a..0424fe8bd9 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -58,7 +58,7 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps } } - protected override APIRequest> CreateRequest(Pagination pagination) => + protected override APIRequest> CreateRequest(PaginationParameters pagination) => new GetUserBeatmapsRequest(User.Value.Id, type, pagination); protected override Drawable CreateDrawableItem(APIBeatmapSet model) => model.OnlineID > 0 diff --git a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs index 281bcc3a03..06de0f62dc 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical protected override int GetCount(APIUser user) => user.BeatmapPlayCountsCount; - protected override APIRequest> CreateRequest(Pagination pagination) => + protected override APIRequest> CreateRequest(PaginationParameters pagination) => new GetUserMostPlayedBeatmapsRequest(User.Value.Id, pagination); protected override Drawable CreateDrawableItem(APIUserMostPlayedBeatmap mostPlayed) => diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs index 5aada2b655..9af854e6b9 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu { } - protected override APIRequest> CreateRequest(Pagination pagination) + protected override APIRequest> CreateRequest(PaginationParameters pagination) => new GetUserKudosuHistoryRequest(User.Value.Id, pagination); protected override Drawable CreateDrawableItem(APIKudosuHistory item) => new DrawableKudosuHistoryItem(item); diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs b/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs index a1f9e7546a..33bd155d71 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Profile.Sections [Resolved] private IAPIProvider api { get; set; } - protected Pagination? CurrentPage { get; private set; } + protected PaginationParameters? CurrentPage { get; private set; } protected ReverseChildIDFillFlowContainer ItemsContainer { get; private set; } @@ -111,7 +111,7 @@ namespace osu.Game.Overlays.Profile.Sections { loadCancellation = new CancellationTokenSource(); - CurrentPage = CurrentPage?.TakeNext(ItemsPerPage) ?? new Pagination(InitialItemsCount); + CurrentPage = CurrentPage?.TakeNext(ItemsPerPage) ?? new PaginationParameters(InitialItemsCount); retrievalRequest = CreateRequest(CurrentPage.Value); retrievalRequest.Success += UpdateItems; @@ -151,7 +151,7 @@ namespace osu.Game.Overlays.Profile.Sections { } - protected abstract APIRequest> CreateRequest(Pagination pagination); + protected abstract APIRequest> CreateRequest(PaginationParameters pagination); protected abstract Drawable CreateDrawableItem(TModel model); diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index c3a5e3f8b8..ef9f4b5ff3 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks base.OnItemsReceived(items); } - protected override APIRequest> CreateRequest(Pagination pagination) => + protected override APIRequest> CreateRequest(PaginationParameters pagination) => new GetUserScoresRequest(User.Value.Id, type, pagination); private int drawableItemIndex; diff --git a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs index e5118094ce..77008d5f34 100644 --- a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Profile.Sections.Recent ItemsContainer.Spacing = new Vector2(0, 8); } - protected override APIRequest> CreateRequest(Pagination pagination) => + protected override APIRequest> CreateRequest(PaginationParameters pagination) => new GetUserRecentActivitiesRequest(User.Value.Id, pagination); protected override Drawable CreateDrawableItem(APIRecentActivity model) => new DrawableRecentActivity(model); From 83e89b3e80c737b626fe1962d2652a64a381058e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 11:10:11 +0900 Subject: [PATCH 0313/2328] Add unread count to `INotificationOverlay` and fix toolbar button DI logic --- .../Visual/Menus/TestSceneToolbar.cs | 18 +++++++++++++----- osu.Game/Overlays/INotificationOverlay.cs | 6 ++++++ osu.Game/Overlays/NotificationOverlay.cs | 6 ++++-- .../Toolbar/ToolbarNotificationButton.cs | 8 ++++---- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs index c65595d82e..dbc7e54b5e 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Linq; +using Moq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -22,6 +23,17 @@ namespace osu.Game.Tests.Visual.Menus [Resolved] private IRulesetStore rulesets { get; set; } + private readonly Mock notifications = new Mock(); + + private readonly BindableInt unreadNotificationCount = new BindableInt(); + + [BackgroundDependencyLoader] + private void load() + { + Dependencies.CacheAs(notifications.Object); + notifications.SetupGet(n => n.UnreadCount).Returns(unreadNotificationCount); + } + [SetUp] public void SetUp() => Schedule(() => { @@ -31,10 +43,6 @@ namespace osu.Game.Tests.Visual.Menus [Test] public void TestNotificationCounter() { - ToolbarNotificationButton notificationButton = null; - - AddStep("retrieve notification button", () => notificationButton = toolbar.ChildrenOfType().Single()); - setNotifications(1); setNotifications(2); setNotifications(3); @@ -43,7 +51,7 @@ namespace osu.Game.Tests.Visual.Menus void setNotifications(int count) => AddStep($"set notification count to {count}", - () => notificationButton.NotificationCount.Value = count); + () => unreadNotificationCount.Value = count); } [TestCase(false)] diff --git a/osu.Game/Overlays/INotificationOverlay.cs b/osu.Game/Overlays/INotificationOverlay.cs index 432dd2be54..1d8e33ea3a 100644 --- a/osu.Game/Overlays/INotificationOverlay.cs +++ b/osu.Game/Overlays/INotificationOverlay.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Game.Overlays.Notifications; namespace osu.Game.Overlays @@ -22,5 +23,10 @@ namespace osu.Game.Overlays /// Hide the overlay, if it is currently visible. /// void Hide(); + + /// + /// Current number of unread notifications. + /// + IBindable UnreadCount { get; } } } diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 0e8fbc6680..2b5909f45a 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -99,7 +99,9 @@ namespace osu.Game.Overlays OverlayActivationMode.BindValueChanged(_ => updateProcessingMode(), true); } - public readonly BindableInt UnreadCount = new BindableInt(); + public IBindable UnreadCount => unreadCount; + + private readonly BindableInt unreadCount = new BindableInt(); private int runningDepth; @@ -180,7 +182,7 @@ namespace osu.Game.Overlays private void updateCounts() { - UnreadCount.Value = sections.Select(c => c.UnreadCount).Sum(); + unreadCount.Value = sections.Select(c => c.UnreadCount).Sum(); } private void markAllRead() diff --git a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs index 79d0fc74c1..313a2bc3f4 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs @@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Toolbar { protected override Anchor TooltipAnchor => Anchor.TopRight; - public BindableInt NotificationCount = new BindableInt(); + public IBindable NotificationCount = new BindableInt(); private readonly CountCircle countDisplay; @@ -36,10 +36,10 @@ namespace osu.Game.Overlays.Toolbar }); } - [BackgroundDependencyLoader(true)] - private void load(NotificationOverlay notificationOverlay) + [BackgroundDependencyLoader] + private void load(INotificationOverlay notificationOverlay) { - StateContainer = notificationOverlay; + StateContainer = notificationOverlay as NotificationOverlay; if (notificationOverlay != null) NotificationCount.BindTo(notificationOverlay.UnreadCount); From 8d0dd3961e056b2670f67412a48cfdf000ec1694 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 19 Apr 2022 03:25:18 +0300 Subject: [PATCH 0314/2328] Add failing test cases --- .../LegacyMainCirclePieceTest.cs | 133 ++++++++++++++++++ .../Skinning/Legacy/LegacyMainCirclePiece.cs | 19 ++- 2 files changed, 146 insertions(+), 6 deletions(-) create mode 100644 osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs diff --git a/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs b/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs new file mode 100644 index 0000000000..200dd2f593 --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs @@ -0,0 +1,133 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using NUnit.Framework; +using osu.Framework.Audio.Sample; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.OpenGL.Textures; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.Testing; +using osu.Game.Audio; +using osu.Game.Rulesets.Osu.Skinning.Legacy; +using osu.Game.Skinning; +using osu.Game.Tests.Visual; + +#nullable enable + +namespace osu.Game.Rulesets.Osu.Tests +{ + [HeadlessTest] + public class LegacyMainCirclePieceTest : OsuTestScene + { + private static readonly object?[][] texture_priority_cases = + { + // default priority lookup + new object?[] + { + // available textures + new[] { @"hitcircle", @"hitcircleoverlay" }, + // priority lookup + @"", + // expected circle and overlay + @"hitcircle", @"hitcircleoverlay", + }, + // custom priority lookup + new object?[] + { + new[] { @"hitcircle", @"hitcircleoverlay", @"sliderstartcircle", @"sliderstartcircleoverlay" }, + @"sliderstartcircle", + @"sliderstartcircle", @"sliderstartcircleoverlay", + }, + // when no sprites are available for the specified prefix, fall back to "hitcircle"/"hitcircleoverlay". + new object?[] + { + new[] { @"hitcircle", @"hitcircleoverlay" }, + @"sliderstartcircle", + @"hitcircle", @"hitcircleoverlay", + }, + // when a circle is available for the specified prefix but no overlay exists, no overlay is displayed. + new object?[] + { + new[] { @"hitcircle", @"hitcircleoverlay", @"sliderstartcircle" }, + @"sliderstartcircle", + @"sliderstartcircle", null + }, + // when no circle is available for the specified prefix but an overlay exists, the overlay is ignored. + new object?[] + { + new[] { @"hitcircle", @"hitcircleoverlay", @"sliderstartcircleoverlay" }, + @"sliderstartcircle", + @"hitcircle", @"hitcircleoverlay", + } + }; + + [TestCaseSource(nameof(texture_priority_cases))] + public void TestTexturePriorities(string[] textureFilenames, string priorityLookup, string? expectedCircle, string? expectedOverlay) + { + Sprite? circleSprite = null; + Sprite? overlaySprite = null; + + AddStep("load circle piece", () => + { + Child = new DependencyProvidingContainer + { + CachedDependencies = new (Type, object)[] + { + (typeof(ISkinSource), new TestSkin(textureFilenames)) + }, + Child = new LegacyMainCirclePiece(priorityLookup, false), + }; + + var sprites = this.ChildrenOfType().Where(s => s.Texture.AssetName != null).DistinctBy(s => s.Texture.AssetName).ToArray(); + Debug.Assert(sprites.Length <= 2); + + circleSprite = sprites.ElementAtOrDefault(0); + overlaySprite = sprites.ElementAtOrDefault(1); + }); + + AddAssert("check circle sprite", () => circleSprite?.Texture?.AssetName == expectedCircle); + AddAssert("check overlay sprite", () => overlaySprite?.Texture?.AssetName == expectedOverlay); + } + + private class TestSkin : ISkinSource + { + private readonly string[] textureFilenames; + + public TestSkin(string[] textureFilenames) + { + this.textureFilenames = textureFilenames; + } + + public Texture? GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) + { + if (textureFilenames.Contains(componentName)) + return new Texture(1, 1) { AssetName = componentName }; + + return null; + } + + public event Action SourceChanged + { + add { } + remove { } + } + + public IEnumerable AllSources { get; } = Enumerable.Empty(); + public Drawable? GetDrawableComponent(ISkinComponent component) => null; + public ISample? GetSample(ISampleInfo sampleInfo) => null; + + public IBindable? GetConfig(TLookup lookup) + where TLookup : notnull + where TValue : notnull + => null; + + public ISkin? FindProvider(Func lookupFunction) => lookupFunction(this) ? this : null; + } + } +} diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs index c6007885be..829dbb02f1 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -43,7 +44,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy private readonly Bindable accentColour = new Bindable(); private readonly IBindable indexInCurrentCombo = new Bindable(); - [Resolved] + [Resolved(canBeNull: true)] + [CanBeNull] private DrawableHitObject drawableObject { get; set; } [Resolved] @@ -107,8 +109,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy if (overlayAboveNumber) OverlayLayer.ChangeChildDepth(hitCircleOverlay, float.MinValue); - accentColour.BindTo(drawableObject.AccentColour); - indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable); + if (drawableOsuObject != null) + { + accentColour.BindTo(drawableOsuObject.AccentColour); + indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable); + } Texture getTextureWithFallback(string name) { @@ -149,15 +154,17 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy if (hasNumber) indexInCurrentCombo.BindValueChanged(index => hitCircleText.Text = (index.NewValue + 1).ToString(), true); - drawableObject.ApplyCustomUpdateState += updateStateTransforms; - updateStateTransforms(drawableObject, drawableObject.State.Value); + if (drawableObject != null) + drawableObject.ApplyCustomUpdateState += updateStateTransforms; + + updateStateTransforms(drawableObject, drawableObject?.State.Value ?? ArmedState.Idle); } private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state) { const double legacy_fade_duration = 240; - using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime)) + using (BeginAbsoluteSequence(drawableObject?.HitStateUpdateTime ?? 0)) { switch (state) { From ec7bb876b5f76416255fa04e71876f6f39980465 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 19 Apr 2022 07:12:05 +0300 Subject: [PATCH 0315/2328] Improve legacy circle texture lookup to match 1:1 with stable --- .../Skinning/Legacy/LegacyMainCirclePiece.cs | 49 +++++-------------- 1 file changed, 12 insertions(+), 37 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs index 829dbb02f1..5fe4a4b5df 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs @@ -23,9 +23,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy { public override bool RemoveCompletedTransforms => false; - private readonly string priorityLookup; private readonly bool hasNumber; + private string priorityLookup; + public LegacyMainCirclePiece(string priorityLookup = null, bool hasNumber = true) { this.priorityLookup = priorityLookup; @@ -56,21 +57,19 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy { var drawableOsuObject = (DrawableOsuHitObject)drawableObject; - bool allowFallback = false; - // attempt lookup using priority specification - Texture baseTexture = getTextureWithFallback(string.Empty); + Texture baseTexture = getTexture(string.Empty); - // if the base texture was not found without a fallback, switch on fallback mode and re-perform the lookup. + // if the base texture was not found using the priority specification, nullify the specification and fall back to "hitcircle". if (baseTexture == null) { - allowFallback = true; - baseTexture = getTextureWithFallback(string.Empty); + priorityLookup = null; + baseTexture = getTexture(string.Empty); } // at this point, any further texture fetches should be correctly using the priority source if the base texture was retrieved using it. // the flow above handles the case where a sliderendcircle.png is retrieved from the skin, but sliderendcircleoverlay.png doesn't exist. - // expected behaviour in this scenario is not showing the overlay, rather than using hitcircleoverlay.png (potentially from the default/fall-through skin). + // expected behaviour in this scenario is not showing the overlay, rather than using hitcircleoverlay.png. InternalChildren = new[] { @@ -83,7 +82,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Child = hitCircleOverlay = new KiaiFlashingDrawable(() => getAnimationWithFallback(@"overlay", 1000 / 2d)) + Child = hitCircleOverlay = new KiaiFlashingDrawable(() => getAnimation(@"overlay", 1000 / 2d)) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -115,35 +114,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable); } - Texture getTextureWithFallback(string name) - { - Texture tex = null; + Texture getTexture(string name) + => skin.GetTexture($"{priorityLookup ?? @"hitcircle"}{name}"); - if (!string.IsNullOrEmpty(priorityLookup)) - { - tex = skin.GetTexture($"{priorityLookup}{name}"); - - if (!allowFallback) - return tex; - } - - return tex ?? skin.GetTexture($"hitcircle{name}"); - } - - Drawable getAnimationWithFallback(string name, double frameLength) - { - Drawable animation = null; - - if (!string.IsNullOrEmpty(priorityLookup)) - { - animation = skin.GetAnimation($"{priorityLookup}{name}", true, true, frameLength: frameLength); - - if (!allowFallback) - return animation; - } - - return animation ?? skin.GetAnimation($"hitcircle{name}", true, true, frameLength: frameLength); - } + Drawable getAnimation(string name, double frameLength) + => skin.GetAnimation($"{priorityLookup ?? @"hitcircle"}{name}", true, true, frameLength: frameLength); } protected override void LoadComplete() From f92a41b6c3758027e315347fafb01abbac7aa678 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 19 Apr 2022 08:03:50 +0300 Subject: [PATCH 0316/2328] Replace local `TestSkin` implementation with simplified Moq setups --- .../LegacyMainCirclePieceTest.cs | 56 ++++--------------- 1 file changed, 10 insertions(+), 46 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs b/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs index 200dd2f593..766db25d71 100644 --- a/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs @@ -1,25 +1,21 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; -using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using Moq; using NUnit.Framework; -using osu.Framework.Audio.Sample; -using osu.Framework.Bindables; -using osu.Framework.Graphics; using osu.Framework.Graphics.OpenGL.Textures; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Testing; -using osu.Game.Audio; using osu.Game.Rulesets.Osu.Skinning.Legacy; using osu.Game.Skinning; using osu.Game.Tests.Visual; -#nullable enable - namespace osu.Game.Rulesets.Osu.Tests { [HeadlessTest] @@ -75,12 +71,15 @@ namespace osu.Game.Rulesets.Osu.Tests AddStep("load circle piece", () => { + var skin = new Mock(); + + skin.Setup(s => s.GetTexture(It.IsAny())).CallBase(); + skin.Setup(s => s.GetTexture(It.IsIn(textureFilenames), It.IsAny(), It.IsAny())) + .Returns((string componentName, WrapMode _, WrapMode __) => new Texture(1, 1) { AssetName = componentName }); + Child = new DependencyProvidingContainer { - CachedDependencies = new (Type, object)[] - { - (typeof(ISkinSource), new TestSkin(textureFilenames)) - }, + CachedDependencies = new (Type, object)[] { (typeof(ISkinSource), skin.Object) }, Child = new LegacyMainCirclePiece(priorityLookup, false), }; @@ -94,40 +93,5 @@ namespace osu.Game.Rulesets.Osu.Tests AddAssert("check circle sprite", () => circleSprite?.Texture?.AssetName == expectedCircle); AddAssert("check overlay sprite", () => overlaySprite?.Texture?.AssetName == expectedOverlay); } - - private class TestSkin : ISkinSource - { - private readonly string[] textureFilenames; - - public TestSkin(string[] textureFilenames) - { - this.textureFilenames = textureFilenames; - } - - public Texture? GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) - { - if (textureFilenames.Contains(componentName)) - return new Texture(1, 1) { AssetName = componentName }; - - return null; - } - - public event Action SourceChanged - { - add { } - remove { } - } - - public IEnumerable AllSources { get; } = Enumerable.Empty(); - public Drawable? GetDrawableComponent(ISkinComponent component) => null; - public ISample? GetSample(ISampleInfo sampleInfo) => null; - - public IBindable? GetConfig(TLookup lookup) - where TLookup : notnull - where TValue : notnull - => null; - - public ISkin? FindProvider(Func lookupFunction) => lookupFunction(this) ? this : null; - } } } From fd113953ace591b867081da881821f15dd356511 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 19 Apr 2022 08:06:39 +0300 Subject: [PATCH 0317/2328] Rename `prioritiyLookup` and add xmldoc --- .../Skinning/Legacy/LegacyMainCirclePiece.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs index 5fe4a4b5df..82bb4dcf2d 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs @@ -25,11 +25,18 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy private readonly bool hasNumber; - private string priorityLookup; + /// + /// A prioritised prefix to perform texture lookups with. + /// + /// + /// If the "circle" texture could not be found with this prefix, + /// then it is nullified and the default prefix "hitcircle" is used instead. + /// + private string priorityLookupPrefix; - public LegacyMainCirclePiece(string priorityLookup = null, bool hasNumber = true) + public LegacyMainCirclePiece(string priorityLookupPrefix = null, bool hasNumber = true) { - this.priorityLookup = priorityLookup; + this.priorityLookupPrefix = priorityLookupPrefix; this.hasNumber = hasNumber; Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2); @@ -63,7 +70,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy // if the base texture was not found using the priority specification, nullify the specification and fall back to "hitcircle". if (baseTexture == null) { - priorityLookup = null; + priorityLookupPrefix = null; baseTexture = getTexture(string.Empty); } @@ -115,10 +122,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy } Texture getTexture(string name) - => skin.GetTexture($"{priorityLookup ?? @"hitcircle"}{name}"); + => skin.GetTexture($"{priorityLookupPrefix ?? @"hitcircle"}{name}"); Drawable getAnimation(string name, double frameLength) - => skin.GetAnimation($"{priorityLookup ?? @"hitcircle"}{name}", true, true, frameLength: frameLength); + => skin.GetAnimation($"{priorityLookupPrefix ?? @"hitcircle"}{name}", true, true, frameLength: frameLength); } protected override void LoadComplete() From b067924adacb6ecdc38d3d9ccdf52a30b44458f7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 19 Apr 2022 08:08:02 +0300 Subject: [PATCH 0318/2328] Avoid applying state transforms when no object is present --- .../Skinning/Legacy/LegacyMainCirclePiece.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs index 82bb4dcf2d..9d14041dd8 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs @@ -4,6 +4,7 @@ using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -137,16 +138,17 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy indexInCurrentCombo.BindValueChanged(index => hitCircleText.Text = (index.NewValue + 1).ToString(), true); if (drawableObject != null) + { drawableObject.ApplyCustomUpdateState += updateStateTransforms; - - updateStateTransforms(drawableObject, drawableObject?.State.Value ?? ArmedState.Idle); + updateStateTransforms(drawableObject, drawableObject.State.Value); + } } private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state) { const double legacy_fade_duration = 240; - using (BeginAbsoluteSequence(drawableObject?.HitStateUpdateTime ?? 0)) + using (BeginAbsoluteSequence(drawableObject.AsNonNull().HitStateUpdateTime)) { switch (state) { From feeff1647697ef1c45156091cce88da20464caee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 14:30:45 +0900 Subject: [PATCH 0319/2328] Add debug language to help with localisation efforts The idea is to allow a developer to immediately see which text on a component or screen has already got localisation support. It can be a bit of a challenge to see this when creating a new component that doesn't yet have any translations populated. Curious to hear thoughts on this. I could see it working very well as a visual tests checkbox (implemented at o!f side), potentially in addition to having this at the game level, or replacing this PR. --- .../Localisation/DebugLocalisationStore.cs | 30 +++++++++++++++++++ osu.Game/Localisation/Language.cs | 7 ++++- osu.Game/OsuGame.cs | 8 +++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Localisation/DebugLocalisationStore.cs diff --git a/osu.Game/Localisation/DebugLocalisationStore.cs b/osu.Game/Localisation/DebugLocalisationStore.cs new file mode 100644 index 0000000000..99dca6265e --- /dev/null +++ b/osu.Game/Localisation/DebugLocalisationStore.cs @@ -0,0 +1,30 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using osu.Framework.Localisation; + +namespace osu.Game.Localisation +{ + public class DebugLocalisationStore : ILocalisationStore + { + public string Get(string lookup) => $@"[[{lookup.Substring(lookup.LastIndexOf('.') + 1)}]]"; + + public Task GetAsync(string lookup, CancellationToken cancellationToken = default) => Task.FromResult(Get(lookup)); + + public Stream GetStream(string name) => throw new NotImplementedException(); + + public IEnumerable GetAvailableResources() => throw new NotImplementedException(); + + public CultureInfo EffectiveCulture { get; } = new CultureInfo(@"debug"); + + public void Dispose() + { + } + } +} diff --git a/osu.Game/Localisation/Language.cs b/osu.Game/Localisation/Language.cs index ab96d01c82..c98586457e 100644 --- a/osu.Game/Localisation/Language.cs +++ b/osu.Game/Localisation/Language.cs @@ -110,6 +110,11 @@ namespace osu.Game.Localisation // zh_hk, [Description(@"繁體中文(台灣)")] - zh_hant + zh_hant, + +#if DEBUG + [Description(@"Debug (show raw keys)")] + DebugLocalisation +#endif } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index eee86de7ff..b591b09584 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -628,6 +628,14 @@ namespace osu.Game foreach (var language in Enum.GetValues(typeof(Language)).OfType()) { +#if DEBUG + if (language == Language.DebugLocalisation) + { + Localisation.AddLanguage(Language.DebugLocalisation.ToString(), new DebugLocalisationStore()); + continue; + } +#endif + string cultureCode = language.ToCultureCode(); try From ae07b2b512b61ff86bd36632d67c6f01664c8d3c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Apr 2022 17:42:10 +0900 Subject: [PATCH 0320/2328] Initial setup --- .../Visual/Navigation/TestFirstRunSetup.cs | 15 ++ osu.Game/OsuGame.cs | 3 + .../FirstRunSetup/FirstRunSetupScreen.cs | 51 +++++++ .../Overlays/FirstRunSetup/ScreenWelcome.cs | 58 ++++++++ osu.Game/Overlays/FirstRunSetupOverlay.cs | 134 ++++++++++++++++++ 5 files changed, 261 insertions(+) create mode 100644 osu.Game.Tests/Visual/Navigation/TestFirstRunSetup.cs create mode 100644 osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs create mode 100644 osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs create mode 100644 osu.Game/Overlays/FirstRunSetupOverlay.cs diff --git a/osu.Game.Tests/Visual/Navigation/TestFirstRunSetup.cs b/osu.Game.Tests/Visual/Navigation/TestFirstRunSetup.cs new file mode 100644 index 0000000000..ab49334af1 --- /dev/null +++ b/osu.Game.Tests/Visual/Navigation/TestFirstRunSetup.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 NUnit.Framework; + +namespace osu.Game.Tests.Visual.Navigation +{ + public class TestFirstRunSetup : OsuGameTestScene + { + [Test] + public void TestOverlay() + { + } + } +} diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 5a150b0c49..52aa6b8f07 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -149,6 +149,8 @@ namespace osu.Game protected SettingsOverlay Settings; + private FirstRunSetupOverlay firstRunOverlay; + private VolumeOverlay volume; private OsuLogo osuLogo; @@ -791,6 +793,7 @@ namespace osu.Game loadComponentSingleFile(CreateUpdateManager(), Add, true); // overlay elements + loadComponentSingleFile(firstRunOverlay = new FirstRunSetupOverlay(), overlayContent.Add, true); loadComponentSingleFile(new ManageCollectionsDialog(), overlayContent.Add, true); loadComponentSingleFile(beatmapListing = new BeatmapListingOverlay(), overlayContent.Add, true); loadComponentSingleFile(dashboard = new DashboardOverlay(), overlayContent.Add, true); diff --git a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs new file mode 100644 index 0000000000..d00d21d347 --- /dev/null +++ b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs @@ -0,0 +1,51 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Input.Events; +using osu.Framework.Screens; + +namespace osu.Game.Overlays.FirstRunSetup +{ + public abstract class FirstRunSetupScreen : Screen + { + [Resolved] + protected FirstRunSetupOverlay Overlay { get; private set; } + + protected Container Content { get; private set; } + + protected FirstRunSetupScreen() + { + InternalChildren = new Drawable[] + { + Content = new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(20), + }, + }; + } + + protected override bool OnClick(ClickEvent e) => true; + + public override void OnEntering(IScreen last) + { + base.OnEntering(last); + this.FadeOut().Delay(200).FadeIn(200); + } + + public override void OnResuming(IScreen last) + { + base.OnResuming(last); + this.FadeIn(200); + } + + public override void OnSuspending(IScreen next) + { + base.OnSuspending(next); + this.FadeOut(200); + } + } +} diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs new file mode 100644 index 0000000000..be21712c95 --- /dev/null +++ b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs @@ -0,0 +1,58 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Screens; +using osu.Framework.Utils; +using osu.Game.Graphics.Containers; +using osu.Game.Screens.OnlinePlay.Match.Components; +using osuTK; + +namespace osu.Game.Overlays.FirstRunSetup +{ + public class ScreenWelcome : FirstRunSetupScreen + { + public ScreenWelcome() + { + Content.Children = new Drawable[] + { + new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new OsuTextFlowContainer + { + Text = "Welcome to the first-run setup guide!\n\nThis will help you get osu! setup in a way that suits you.", + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + }, + } + }, + new PurpleTriangleButton + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Margin = new MarginPadding(10), + Text = "Get started", + Action = () => this.Push(new ScreenWelcome()), + } + }; + } + + public override void OnEntering(IScreen last) + { + base.OnEntering(last); + Overlay.MoveDisplayTo(new Vector2(RNG.NextSingle(), RNG.NextSingle())); + } + + public override void OnResuming(IScreen last) + { + base.OnResuming(last); + Overlay.MoveDisplayTo(new Vector2(RNG.NextSingle(), RNG.NextSingle())); + } + } +} diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs new file mode 100644 index 0000000000..218e6018e2 --- /dev/null +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -0,0 +1,134 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Effects; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; +using osu.Framework.Screens; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Online.API; +using osu.Game.Overlays.Dialog; +using osu.Game.Overlays.FirstRunSetup; +using osu.Game.Rulesets.UI; +using osu.Game.Screens.Menu; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Overlays +{ + [Cached] + public class FirstRunSetupOverlay : OsuFocusedOverlayContainer + { + protected override bool StartHidden => true; + + [Resolved] + private DialogOverlay dialogOverlay { get; set; } + + [Resolved] + private OsuGame osuGame { get; set; } + + private ScreenWelcome welcomeScreen; + + private Container currentDisplayContainer; + + private PlayfieldBorder border; + + public FirstRunSetupOverlay() + { + RelativeSizeAxes = Axes.Both; + } + + [BackgroundDependencyLoader] + private void load(IAPIProvider api, OsuColour colours) + { + Children = new Drawable[] + { + border = new PlayfieldBorder + { + PlayfieldBorderStyle = { Value = PlayfieldBorderStyle.Full }, + Colour = colours.Blue, + }, + currentDisplayContainer = new Container + { + Origin = Anchor.Centre, + RelativePositionAxes = Axes.Both, + Size = new Vector2(400, 300), + Position = new Vector2(0.5f), + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Radius = 5, + Colour = Color4.Black.Opacity(0.2f), + }, + Masking = true, + CornerRadius = 10, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Alpha = 0.8f, + }, + new ScreenStack(welcomeScreen = new ScreenWelcome()) + { + RelativeSizeAxes = Axes.Both, + }, + } + } + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + // if we are valid for display, only do so after reaching the main menu. + osuGame.PerformFromScreen(_ => + { + Show(); + }, new[] { typeof(MainMenu) }); + + border + .FadeInFromZero(500) + .Delay(1000) + .FadeOut(500) + .Loop(); + } + + protected override bool OnClick(ClickEvent e) + { + if (dialogOverlay.CurrentDialog == null) + { + dialogOverlay.Push(new ConfirmDialog("Are you sure you want to exit the setup process?", + Hide, + () => { })); + } + + return base.OnClick(e); + } + + protected override void PopIn() + { + base.PopIn(); + this.FadeIn(400, Easing.OutQuint); + + if (welcomeScreen.GetChildScreen() != null) + welcomeScreen.MakeCurrent(); + } + + protected override void PopOut() + { + base.PopOut(); + this.FadeOut(100); + } + + public void MoveDisplayTo(Vector2 position) => + currentDisplayContainer.MoveTo(position, 1000, Easing.OutElasticQuarter); + } +} From c2df3465b281fe8523e51379785780005cb98041 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Apr 2022 18:11:32 +0900 Subject: [PATCH 0321/2328] Add ui scaling setup screen, kind of --- .../FirstRunSetup/ScreenSetupUIScale.cs | 87 +++++++++++++++++++ .../Overlays/FirstRunSetup/ScreenWelcome.cs | 11 +-- osu.Game/Overlays/FirstRunSetupOverlay.cs | 6 +- 3 files changed, 94 insertions(+), 10 deletions(-) create mode 100644 osu.Game/Overlays/FirstRunSetup/ScreenSetupUIScale.cs diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenSetupUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenSetupUIScale.cs new file mode 100644 index 0000000000..7c703f65bd --- /dev/null +++ b/osu.Game/Overlays/FirstRunSetup/ScreenSetupUIScale.cs @@ -0,0 +1,87 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Localisation; +using osu.Framework.Screens; +using osu.Game.Configuration; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; +using osu.Game.Localisation; +using osu.Game.Overlays.Settings; +using osu.Game.Screens; +using osu.Game.Screens.OnlinePlay.Match.Components; +using osu.Game.Screens.Select; +using osuTK; + +namespace osu.Game.Overlays.FirstRunSetup +{ + public class ScreenSetupUIScale : FirstRunSetupScreen + { + [Resolved] + private OsuConfigManager osuConfig { get; set; } + + [BackgroundDependencyLoader] + private void load() + { + OsuScreenStack stack; + Content.Children = new Drawable[] + { + new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(20), + Children = new Drawable[] + { + new OsuTextFlowContainer + { + Text = "The osu! user interface size can be adjusted to your liking.", + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + }, + new SettingsSlider + { + LabelText = GraphicsSettingsStrings.UIScaling, + TransferValueOnCommit = true, + Current = osuConfig.GetBindable(OsuSetting.UIScale), + KeyboardStep = 0.01f, + }, + new DrawSizePreservingFillContainer + { + Masking = true, + RelativeSizeAxes = Axes.X, + Height = 300, + Child = stack = new OsuScreenStack() + } + } + }, + new PurpleTriangleButton + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Margin = new MarginPadding(10), + Text = "Finish", + Action = () => Overlay.Hide() + } + }; + + stack.Push(new PlaySongSelect()); + } + + public override void OnEntering(IScreen last) + { + base.OnEntering(last); + Overlay.MoveDisplayTo(new Vector2(0.5f)); + Overlay.ResizeDisplayTo(new Vector2(0.8f)); + } + + private class UIScaleSlider : OsuSliderBar + { + public override LocalisableString TooltipText => base.TooltipText + "x"; + } + } +} diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs index be21712c95..b436db2431 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs @@ -4,7 +4,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Screens; -using osu.Framework.Utils; using osu.Game.Graphics.Containers; using osu.Game.Screens.OnlinePlay.Match.Components; using osuTK; @@ -38,7 +37,7 @@ namespace osu.Game.Overlays.FirstRunSetup RelativeSizeAxes = Axes.X, Margin = new MarginPadding(10), Text = "Get started", - Action = () => this.Push(new ScreenWelcome()), + Action = () => this.Push(new ScreenSetupUIScale()), } }; } @@ -46,13 +45,7 @@ namespace osu.Game.Overlays.FirstRunSetup public override void OnEntering(IScreen last) { base.OnEntering(last); - Overlay.MoveDisplayTo(new Vector2(RNG.NextSingle(), RNG.NextSingle())); - } - - public override void OnResuming(IScreen last) - { - base.OnResuming(last); - Overlay.MoveDisplayTo(new Vector2(RNG.NextSingle(), RNG.NextSingle())); + Overlay.MoveDisplayTo(new Vector2(0.5f)); } } } diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 218e6018e2..1578ef8cbf 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -57,7 +57,8 @@ namespace osu.Game.Overlays { Origin = Anchor.Centre, RelativePositionAxes = Axes.Both, - Size = new Vector2(400, 300), + RelativeSizeAxes = Axes.Both, + Size = new Vector2(0.5f), Position = new Vector2(0.5f), EdgeEffect = new EdgeEffectParameters { @@ -130,5 +131,8 @@ namespace osu.Game.Overlays public void MoveDisplayTo(Vector2 position) => currentDisplayContainer.MoveTo(position, 1000, Easing.OutElasticQuarter); + + public void ResizeDisplayTo(Vector2 scale) => + currentDisplayContainer.ScaleTo(scale, 1000, Easing.OutElasticQuarter); } } From e064f2f23efac42cca67225d59854852edb61092 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 15:20:54 +0900 Subject: [PATCH 0322/2328] Improve general layout and allow overlay to be displayed without dependencies for now --- .../Visual/Navigation/TestFirstRunSetup.cs | 7 +- .../Overlays/FirstRunSetup/ScreenWelcome.cs | 13 +- osu.Game/Overlays/FirstRunSetupOverlay.cs | 118 ++++++++++++------ 3 files changed, 91 insertions(+), 47 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestFirstRunSetup.cs b/osu.Game.Tests/Visual/Navigation/TestFirstRunSetup.cs index ab49334af1..9855865284 100644 --- a/osu.Game.Tests/Visual/Navigation/TestFirstRunSetup.cs +++ b/osu.Game.Tests/Visual/Navigation/TestFirstRunSetup.cs @@ -2,14 +2,19 @@ // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; +using osu.Game.Overlays; namespace osu.Game.Tests.Visual.Navigation { - public class TestFirstRunSetup : OsuGameTestScene + public class TestFirstRunSetup : OsuTestScene { [Test] public void TestOverlay() { + AddStep("add overlay", () => + { + Child = new FirstRunSetupOverlay(); + }); } } } diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs index b436db2431..f67ab1cd7f 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs @@ -4,9 +4,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Screens; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Screens.OnlinePlay.Match.Components; -using osuTK; namespace osu.Game.Overlays.FirstRunSetup { @@ -22,9 +22,10 @@ namespace osu.Game.Overlays.FirstRunSetup Direction = FillDirection.Vertical, Children = new Drawable[] { - new OsuTextFlowContainer + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { - Text = "Welcome to the first-run setup guide!\n\nThis will help you get osu! setup in a way that suits you.", + Text = + "Welcome to the first-run setup guide!\n\nosu! is a very configurable game, and diving straight into the settings can sometimes be overwhelming. This guide will help you get the important choices out of the way to ensure a great first experience!", RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, @@ -41,11 +42,5 @@ namespace osu.Game.Overlays.FirstRunSetup } }; } - - public override void OnEntering(IScreen last) - { - base.OnEntering(last); - Overlay.MoveDisplayTo(new Vector2(0.5f)); - } } } diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 1578ef8cbf..d213f87fe5 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -11,10 +11,10 @@ using osu.Framework.Input.Events; using osu.Framework.Screens; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; using osu.Game.Online.API; using osu.Game.Overlays.Dialog; using osu.Game.Overlays.FirstRunSetup; -using osu.Game.Rulesets.UI; using osu.Game.Screens.Menu; using osuTK; using osuTK.Graphics; @@ -26,18 +26,17 @@ namespace osu.Game.Overlays { protected override bool StartHidden => true; - [Resolved] + [Resolved(canBeNull: true)] private DialogOverlay dialogOverlay { get; set; } - [Resolved] + [Resolved(canBeNull: true)] private OsuGame osuGame { get; set; } + [Cached] + private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); + private ScreenWelcome welcomeScreen; - private Container currentDisplayContainer; - - private PlayfieldBorder border; - public FirstRunSetupOverlay() { RelativeSizeAxes = Axes.Both; @@ -48,18 +47,12 @@ namespace osu.Game.Overlays { Children = new Drawable[] { - border = new PlayfieldBorder + new Container { - PlayfieldBorderStyle = { Value = PlayfieldBorderStyle.Full }, - Colour = colours.Blue, - }, - currentDisplayContainer = new Container - { - Origin = Anchor.Centre, - RelativePositionAxes = Axes.Both, RelativeSizeAxes = Axes.Both, - Size = new Vector2(0.5f), - Position = new Vector2(0.5f), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(0.95f), EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, @@ -73,12 +66,68 @@ namespace osu.Game.Overlays new Box { RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - Alpha = 0.8f, + Colour = colourProvider.Background5, }, - new ScreenStack(welcomeScreen = new ScreenWelcome()) + new GridContainer { RelativeSizeAxes = Axes.Both, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize), + new Dimension(), + }, + Content = new[] + { + new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + new Box + { + Colour = colourProvider.Background6, + RelativeSizeAxes = Axes.Both, + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + Margin = new MarginPadding(10), + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new OsuSpriteText + { + Text = "First run setup", + Font = OsuFont.Default.With(size: 32), + Colour = colourProvider.Content2, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }, + new OsuTextFlowContainer + { + Text = "Setup osu! to suit you", + Colour = colourProvider.Content1, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + AutoSizeAxes = Axes.Both, + }, + } + }, + } + }, + }, + new Drawable[] + { + new ScreenStack(welcomeScreen = new ScreenWelcome()) + { + RelativeSizeAxes = Axes.Both, + }, + } + } }, } } @@ -89,24 +138,25 @@ namespace osu.Game.Overlays { base.LoadComplete(); - // if we are valid for display, only do so after reaching the main menu. - osuGame.PerformFromScreen(_ => + if (osuGame != null) + { + // if we are valid for display, only do so after reaching the main menu. + osuGame.PerformFromScreen(_ => + { + Show(); + }, new[] { typeof(MainMenu) }); + } + else { Show(); - }, new[] { typeof(MainMenu) }); - - border - .FadeInFromZero(500) - .Delay(1000) - .FadeOut(500) - .Loop(); + } } protected override bool OnClick(ClickEvent e) { - if (dialogOverlay.CurrentDialog == null) + if (dialogOverlay?.CurrentDialog == null) { - dialogOverlay.Push(new ConfirmDialog("Are you sure you want to exit the setup process?", + dialogOverlay?.Push(new ConfirmDialog("Are you sure you want to exit the setup process?", Hide, () => { })); } @@ -128,11 +178,5 @@ namespace osu.Game.Overlays base.PopOut(); this.FadeOut(100); } - - public void MoveDisplayTo(Vector2 position) => - currentDisplayContainer.MoveTo(position, 1000, Easing.OutElasticQuarter); - - public void ResizeDisplayTo(Vector2 scale) => - currentDisplayContainer.ScaleTo(scale, 1000, Easing.OutElasticQuarter); } } From 3b94e01fe64ad1094e895f6822444c36b45cf042 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 15:21:09 +0900 Subject: [PATCH 0323/2328] Improve layout of ui scale step --- .../FirstRunSetup/ScreenSetupUIScale.cs | 55 ++++++++++++++----- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenSetupUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenSetupUIScale.cs index 7c703f65bd..1a8ef0338c 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenSetupUIScale.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenSetupUIScale.cs @@ -5,13 +5,14 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Localisation; -using osu.Framework.Screens; using osu.Game.Configuration; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; using osu.Game.Overlays.Settings; using osu.Game.Screens; +using osu.Game.Screens.Menu; using osu.Game.Screens.OnlinePlay.Match.Components; using osu.Game.Screens.Select; using osuTK; @@ -23,6 +24,9 @@ namespace osu.Game.Overlays.FirstRunSetup [Resolved] private OsuConfigManager osuConfig { get; set; } + [Cached] + private OsuLogo osuLogo = new OsuLogo(); + [BackgroundDependencyLoader] private void load() { @@ -36,7 +40,7 @@ namespace osu.Game.Overlays.FirstRunSetup Spacing = new Vector2(20), Children = new Drawable[] { - new OsuTextFlowContainer + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 32)) { Text = "The osu! user interface size can be adjusted to your liking.", RelativeSizeAxes = Axes.X, @@ -49,12 +53,42 @@ namespace osu.Game.Overlays.FirstRunSetup Current = osuConfig.GetBindable(OsuSetting.UIScale), KeyboardStep = 0.01f, }, - new DrawSizePreservingFillContainer + new GridContainer { - Masking = true, - RelativeSizeAxes = Axes.X, - Height = 300, - Child = stack = new OsuScreenStack() + RelativeSizeAxes = Axes.Both, + Content = new[] + { + new Drawable[] + { + new ScalingContainer(ScalingMode.Off) + { + Masking = true, + RelativeSizeAxes = Axes.Both, + Child = stack = new OsuScreenStack() + }, + new ScalingContainer(ScalingMode.Off) + { + Masking = true, + RelativeSizeAxes = Axes.Both, + Child = stack = new OsuScreenStack() + } + }, + new Drawable[] + { + new ScalingContainer(ScalingMode.Off) + { + Masking = true, + RelativeSizeAxes = Axes.Both, + Child = stack = new OsuScreenStack() + }, + new ScalingContainer(ScalingMode.Off) + { + Masking = true, + RelativeSizeAxes = Axes.Both, + Child = stack = new OsuScreenStack() + } + } + } } } }, @@ -72,13 +106,6 @@ namespace osu.Game.Overlays.FirstRunSetup stack.Push(new PlaySongSelect()); } - public override void OnEntering(IScreen last) - { - base.OnEntering(last); - Overlay.MoveDisplayTo(new Vector2(0.5f)); - Overlay.ResizeDisplayTo(new Vector2(0.8f)); - } - private class UIScaleSlider : OsuSliderBar { public override LocalisableString TooltipText => base.TooltipText + "x"; From 07da1cd731b7acf89337a066fd3ed677216c5e67 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 16:07:30 +0900 Subject: [PATCH 0324/2328] Move buttons to top level and add backwards navigation --- .../FirstRunSetup/FirstRunSetupScreen.cs | 28 ++-- .../Overlays/FirstRunSetup/ScreenWelcome.cs | 13 +- osu.Game/Overlays/FirstRunSetupOverlay.cs | 128 +++++++++++++++++- 3 files changed, 133 insertions(+), 36 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs index d00d21d347..5cf3d562a9 100644 --- a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs +++ b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs @@ -3,7 +3,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; using osu.Framework.Screens; @@ -14,38 +13,31 @@ namespace osu.Game.Overlays.FirstRunSetup [Resolved] protected FirstRunSetupOverlay Overlay { get; private set; } - protected Container Content { get; private set; } - - protected FirstRunSetupScreen() - { - InternalChildren = new Drawable[] - { - Content = new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding(20), - }, - }; - } - protected override bool OnClick(ClickEvent e) => true; public override void OnEntering(IScreen last) { base.OnEntering(last); - this.FadeOut().Delay(200).FadeIn(200); + this + .FadeInFromZero(500) + .MoveToX(100) + .MoveToX(0, 500, Easing.OutQuint); } public override void OnResuming(IScreen last) { base.OnResuming(last); - this.FadeIn(200); + this + .FadeInFromZero(500) + .MoveToX(0, 500, Easing.OutQuint); } public override void OnSuspending(IScreen next) { base.OnSuspending(next); - this.FadeOut(200); + this + .FadeOut(100) + .MoveToX(-100, 500, Easing.OutQuint); } } } diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs index f67ab1cd7f..879ffdf198 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs @@ -3,10 +3,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Screens; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Screens.OnlinePlay.Match.Components; namespace osu.Game.Overlays.FirstRunSetup { @@ -14,7 +12,7 @@ namespace osu.Game.Overlays.FirstRunSetup { public ScreenWelcome() { - Content.Children = new Drawable[] + InternalChildren = new Drawable[] { new FillFlowContainer { @@ -31,15 +29,6 @@ namespace osu.Game.Overlays.FirstRunSetup }, } }, - new PurpleTriangleButton - { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - RelativeSizeAxes = Axes.X, - Margin = new MarginPadding(10), - Text = "Get started", - Action = () => this.Push(new ScreenSetupUIScale()), - } }; } } diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index d213f87fe5..4eb46c38f3 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -1,6 +1,10 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + +using System; +using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -8,14 +12,17 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; +using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Overlays.Dialog; using osu.Game.Overlays.FirstRunSetup; using osu.Game.Screens.Menu; +using osu.Game.Screens.OnlinePlay.Match.Components; using osuTK; using osuTK.Graphics; @@ -27,15 +34,26 @@ namespace osu.Game.Overlays protected override bool StartHidden => true; [Resolved(canBeNull: true)] - private DialogOverlay dialogOverlay { get; set; } + private DialogOverlay? dialogOverlay { get; set; } [Resolved(canBeNull: true)] - private OsuGame osuGame { get; set; } + private OsuGame? osuGame { get; set; } + + private ScreenStack stack = null!; + + private PurpleTriangleButton nextButton = null!; + private DangerousTriangleButton backButton = null!; [Cached] private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); - private ScreenWelcome welcomeScreen; + private int? currentStepIndex; + + private readonly FirstRunStep[] steps = + { + new FirstRunStep(typeof(ScreenWelcome), "Welcome"), + new FirstRunStep(typeof(ScreenSetupUIScale), "UI Scale"), + }; public FirstRunSetupOverlay() { @@ -75,6 +93,7 @@ namespace osu.Game.Overlays { new Dimension(GridSizeMode.AutoSize), new Dimension(), + new Dimension(GridSizeMode.AutoSize), }, Content = new[] { @@ -122,10 +141,60 @@ namespace osu.Game.Overlays }, new Drawable[] { - new ScreenStack(welcomeScreen = new ScreenWelcome()) + new Container { RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(20), + Child = stack = new ScreenStack + { + RelativeSizeAxes = Axes.Both, + }, }, + }, + new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding(20), + Child = new GridContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.Absolute, 10), + new Dimension(), + }, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize), + }, + Content = new[] + { + new[] + { + backButton = new DangerousTriangleButton + { + Width = 200, + Text = "Back", + Action = showLastStep, + Enabled = { Value = false }, + }, + Empty(), + nextButton = new PurpleTriangleButton + { + RelativeSizeAxes = Axes.X, + Width = 1, + Text = "Get started", + Action = showNextStep + } + }, + } + }, + } } } }, @@ -169,8 +238,43 @@ namespace osu.Game.Overlays base.PopIn(); this.FadeIn(400, Easing.OutQuint); - if (welcomeScreen.GetChildScreen() != null) - welcomeScreen.MakeCurrent(); + if (currentStepIndex == null) + showNextStep(); + } + + private void showLastStep() + { + Debug.Assert(currentStepIndex > 0); + + stack.CurrentScreen.Exit(); + currentStepIndex--; + + backButton.Enabled.Value = currentStepIndex != 0; + } + + private void showNextStep() + { + if (currentStepIndex == null) + currentStepIndex = 0; + else + currentStepIndex++; + + Debug.Assert(currentStepIndex != null); + backButton.Enabled.Value = currentStepIndex > 0; + + if (currentStepIndex < steps.Length) + { + var nextStep = steps[currentStepIndex.Value]; + stack.Push((Screen)Activator.CreateInstance(nextStep.ScreenType)); + } + else + { + Hide(); + } + + nextButton.Text = currentStepIndex + 1 < steps.Length + ? $"Next ({steps[currentStepIndex.Value + 1].Description})" + : "Finish"; } protected override void PopOut() @@ -178,5 +282,17 @@ namespace osu.Game.Overlays base.PopOut(); this.FadeOut(100); } + + private class FirstRunStep + { + public readonly Type ScreenType; + public readonly LocalisableString Description; + + public FirstRunStep(Type screenType, LocalisableString description) + { + ScreenType = screenType; + Description = description; + } + } } } From 288f759bb4bd8480e4157faf6e1e3d4681028299 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 16:34:13 +0900 Subject: [PATCH 0325/2328] Add test coverage of navigation --- .../Visual/Navigation/TestFirstRunSetup.cs | 20 ------ .../TestSceneFirstRunSetupOverlay.cs | 63 +++++++++++++++++++ osu.Game/Overlays/FirstRunSetupOverlay.cs | 19 +++--- 3 files changed, 75 insertions(+), 27 deletions(-) delete mode 100644 osu.Game.Tests/Visual/Navigation/TestFirstRunSetup.cs create mode 100644 osu.Game.Tests/Visual/Navigation/TestSceneFirstRunSetupOverlay.cs diff --git a/osu.Game.Tests/Visual/Navigation/TestFirstRunSetup.cs b/osu.Game.Tests/Visual/Navigation/TestFirstRunSetup.cs deleted file mode 100644 index 9855865284..0000000000 --- a/osu.Game.Tests/Visual/Navigation/TestFirstRunSetup.cs +++ /dev/null @@ -1,20 +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 NUnit.Framework; -using osu.Game.Overlays; - -namespace osu.Game.Tests.Visual.Navigation -{ - public class TestFirstRunSetup : OsuTestScene - { - [Test] - public void TestOverlay() - { - AddStep("add overlay", () => - { - Child = new FirstRunSetupOverlay(); - }); - } - } -} diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunSetupOverlay.cs new file mode 100644 index 0000000000..c9aba315eb --- /dev/null +++ b/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunSetupOverlay.cs @@ -0,0 +1,63 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Graphics.Containers; +using osu.Framework.Testing; +using osu.Game.Overlays; +using osu.Game.Overlays.FirstRunSetup; + +namespace osu.Game.Tests.Visual.Navigation +{ + public class TestSceneFirstRunSetupOverlay : OsuTestScene + { + private FirstRunSetupOverlay overlay; + + [SetUpSteps] + public void SetUpSteps() + { + AddStep("add overlay", () => + { + Child = overlay = new FirstRunSetupOverlay(); + }); + } + + [Test] + public void TestOverlayRunsToFinish() + { + AddUntilStep("step through", () => + { + if (overlay.CurrentScreen?.IsLoaded != false) + overlay.NextButton.TriggerClick(); + + return overlay.State.Value == Visibility.Hidden; + }); + } + + [Test] + public void TestBackButton() + { + AddAssert("back button disabled", () => !overlay.BackButton.Enabled.Value); + + AddUntilStep("step to last", () => + { + var nextButton = overlay.NextButton; + + if (overlay.CurrentScreen?.IsLoaded != false) + nextButton.TriggerClick(); + + return nextButton.Text.ToString() == "Finish"; + }); + + AddUntilStep("step back to start", () => + { + if (overlay.CurrentScreen?.IsLoaded != false) + overlay.BackButton.TriggerClick(); + + return overlay.CurrentScreen is ScreenWelcome; + }); + + AddAssert("back button disabled", () => !overlay.BackButton.Enabled.Value); + } + } +} diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 4eb46c38f3..bd6cb0b4d7 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -41,14 +41,19 @@ namespace osu.Game.Overlays private ScreenStack stack = null!; - private PurpleTriangleButton nextButton = null!; - private DangerousTriangleButton backButton = null!; + public PurpleTriangleButton NextButton = null!; + public DangerousTriangleButton BackButton = null!; [Cached] private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); private int? currentStepIndex; + /// + /// The currently displayed screen, if any. + /// + public FirstRunSetupScreen? CurrentScreen => (FirstRunSetupScreen?)stack.CurrentScreen; + private readonly FirstRunStep[] steps = { new FirstRunStep(typeof(ScreenWelcome), "Welcome"), @@ -176,7 +181,7 @@ namespace osu.Game.Overlays { new[] { - backButton = new DangerousTriangleButton + BackButton = new DangerousTriangleButton { Width = 200, Text = "Back", @@ -184,7 +189,7 @@ namespace osu.Game.Overlays Enabled = { Value = false }, }, Empty(), - nextButton = new PurpleTriangleButton + NextButton = new PurpleTriangleButton { RelativeSizeAxes = Axes.X, Width = 1, @@ -249,7 +254,7 @@ namespace osu.Game.Overlays stack.CurrentScreen.Exit(); currentStepIndex--; - backButton.Enabled.Value = currentStepIndex != 0; + BackButton.Enabled.Value = currentStepIndex != 0; } private void showNextStep() @@ -260,7 +265,7 @@ namespace osu.Game.Overlays currentStepIndex++; Debug.Assert(currentStepIndex != null); - backButton.Enabled.Value = currentStepIndex > 0; + BackButton.Enabled.Value = currentStepIndex > 0; if (currentStepIndex < steps.Length) { @@ -272,7 +277,7 @@ namespace osu.Game.Overlays Hide(); } - nextButton.Text = currentStepIndex + 1 < steps.Length + NextButton.Text = currentStepIndex + 1 < steps.Length ? $"Next ({steps[currentStepIndex.Value + 1].Description})" : "Finish"; } From 56c4283764752f6a1eb2282df17e2db40196c794 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 17:10:08 +0900 Subject: [PATCH 0326/2328] Only exit dialog from click if outside the dialog content --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index bd6cb0b4d7..0efeded062 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -60,6 +60,8 @@ namespace osu.Game.Overlays new FirstRunStep(typeof(ScreenSetupUIScale), "UI Scale"), }; + private Container mainContent; + public FirstRunSetupOverlay() { RelativeSizeAxes = Axes.Both; @@ -70,7 +72,7 @@ namespace osu.Game.Overlays { Children = new Drawable[] { - new Container + mainContent = new Container { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, @@ -228,7 +230,7 @@ namespace osu.Game.Overlays protected override bool OnClick(ClickEvent e) { - if (dialogOverlay?.CurrentDialog == null) + if (!mainContent.IsHovered && dialogOverlay?.CurrentDialog == null) { dialogOverlay?.Push(new ConfirmDialog("Are you sure you want to exit the setup process?", Hide, From ea52fab5b1202268f43fadeb9f47cb7c516e3717 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 18:58:14 +0900 Subject: [PATCH 0327/2328] Tidy up dependencies and test naming --- .../TestSceneFirstRunSetupOverlay.cs | 63 -------- .../TestSceneFirstRunScreenUIScale.cs | 19 +++ .../TestSceneFirstRunSetupOverlay.cs | 111 +++++++++++++ .../FirstRunSetup/FirstRunSetupScreen.cs | 25 +-- .../FirstRunSetup/ScreenSetupUIScale.cs | 114 -------------- .../Overlays/FirstRunSetup/ScreenUIScale.cs | 146 ++++++++++++++++++ osu.Game/Overlays/FirstRunSetupOverlay.cs | 38 ++--- 7 files changed, 304 insertions(+), 212 deletions(-) delete mode 100644 osu.Game.Tests/Visual/Navigation/TestSceneFirstRunSetupOverlay.cs create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenUIScale.cs create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs delete mode 100644 osu.Game/Overlays/FirstRunSetup/ScreenSetupUIScale.cs create mode 100644 osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunSetupOverlay.cs deleted file mode 100644 index c9aba315eb..0000000000 --- a/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunSetupOverlay.cs +++ /dev/null @@ -1,63 +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 NUnit.Framework; -using osu.Framework.Graphics.Containers; -using osu.Framework.Testing; -using osu.Game.Overlays; -using osu.Game.Overlays.FirstRunSetup; - -namespace osu.Game.Tests.Visual.Navigation -{ - public class TestSceneFirstRunSetupOverlay : OsuTestScene - { - private FirstRunSetupOverlay overlay; - - [SetUpSteps] - public void SetUpSteps() - { - AddStep("add overlay", () => - { - Child = overlay = new FirstRunSetupOverlay(); - }); - } - - [Test] - public void TestOverlayRunsToFinish() - { - AddUntilStep("step through", () => - { - if (overlay.CurrentScreen?.IsLoaded != false) - overlay.NextButton.TriggerClick(); - - return overlay.State.Value == Visibility.Hidden; - }); - } - - [Test] - public void TestBackButton() - { - AddAssert("back button disabled", () => !overlay.BackButton.Enabled.Value); - - AddUntilStep("step to last", () => - { - var nextButton = overlay.NextButton; - - if (overlay.CurrentScreen?.IsLoaded != false) - nextButton.TriggerClick(); - - return nextButton.Text.ToString() == "Finish"; - }); - - AddUntilStep("step back to start", () => - { - if (overlay.CurrentScreen?.IsLoaded != false) - overlay.BackButton.TriggerClick(); - - return overlay.CurrentScreen is ScreenWelcome; - }); - - AddAssert("back button disabled", () => !overlay.BackButton.Enabled.Value); - } - } -} diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenUIScale.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenUIScale.cs new file mode 100644 index 0000000000..5ca09b34aa --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenUIScale.cs @@ -0,0 +1,19 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Screens; +using osu.Game.Overlays.FirstRunSetup; + +namespace osu.Game.Tests.Visual.UserInterface +{ + public class TestSceneFirstRunScreenUIScale : OsuManualInputManagerTestScene + { + public TestSceneFirstRunScreenUIScale() + { + AddStep("load screen", () => + { + Child = new ScreenStack(new ScreenUIScale()); + }); + } + } +} diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs new file mode 100644 index 0000000000..d892301a81 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -0,0 +1,111 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using Moq; +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Containers; +using osu.Framework.Screens; +using osu.Framework.Testing; +using osu.Game.Overlays; +using osu.Game.Overlays.Dialog; +using osu.Game.Overlays.FirstRunSetup; +using osu.Game.Screens; +using osuTK; +using osuTK.Input; + +namespace osu.Game.Tests.Visual.UserInterface +{ + public class TestSceneFirstRunSetupOverlay : OsuManualInputManagerTestScene + { + private FirstRunSetupOverlay overlay; + + private readonly Mock perfomer = new Mock(); + private readonly Mock dialogOverlay = new Mock(); + + [BackgroundDependencyLoader] + private void load() + { + Dependencies.CacheAs(perfomer.Object); + Dependencies.CacheAs(dialogOverlay.Object); + + perfomer.Setup(g => g.PerformFromScreen(It.IsAny>(), It.IsAny>())) + .Callback((Action action, IEnumerable types) => action(null)); + + dialogOverlay.Setup(d => d.Push(It.IsAny())) + .Callback((PopupDialog dialog) => dialog.PerformOkAction()); + } + + [SetUpSteps] + public void SetUpSteps() + { + AddStep("add overlay", () => + { + Child = overlay = new FirstRunSetupOverlay + { + State = { Value = Visibility.Visible } + }; + }); + } + + [Test] + public void TestOverlayRunsToFinish() + { + AddUntilStep("step through", () => + { + if (overlay.CurrentScreen?.IsLoaded != false) + overlay.NextButton.TriggerClick(); + + return overlay.State.Value == Visibility.Hidden; + }); + } + + [Test] + public void TestBackButton() + { + AddAssert("back button disabled", () => !overlay.BackButton.Enabled.Value); + + AddUntilStep("step to last", () => + { + var nextButton = overlay.NextButton; + + if (overlay.CurrentScreen?.IsLoaded != false) + nextButton.TriggerClick(); + + return nextButton.Text.ToString() == "Finish"; + }); + + AddUntilStep("step back to start", () => + { + if (overlay.CurrentScreen?.IsLoaded != false) + overlay.BackButton.TriggerClick(); + + return overlay.CurrentScreen is ScreenWelcome; + }); + + AddAssert("back button disabled", () => !overlay.BackButton.Enabled.Value); + } + + [Test] + public void TestClickAwayToExit() + { + AddStep("click inside content", () => + { + InputManager.MoveMouseTo(overlay.ScreenSpaceDrawQuad.Centre); + InputManager.Click(MouseButton.Left); + }); + + AddAssert("overlay not dismissed", () => overlay.State.Value == Visibility.Visible); + + AddStep("click outside content", () => + { + InputManager.MoveMouseTo(overlay.ScreenSpaceDrawQuad.TopLeft - new Vector2(1)); + InputManager.Click(MouseButton.Left); + }); + + AddAssert("overlay dismissed", () => overlay.State.Value == Visibility.Hidden); + } + } +} diff --git a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs index 5cf3d562a9..2d025d46ef 100644 --- a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs +++ b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs @@ -1,26 +1,21 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Input.Events; using osu.Framework.Screens; namespace osu.Game.Overlays.FirstRunSetup { public abstract class FirstRunSetupScreen : Screen { - [Resolved] - protected FirstRunSetupOverlay Overlay { get; private set; } - - protected override bool OnClick(ClickEvent e) => true; + private const float offset = 100; public override void OnEntering(IScreen last) { base.OnEntering(last); this .FadeInFromZero(500) - .MoveToX(100) + .MoveToX(offset) .MoveToX(0, 500, Easing.OutQuint); } @@ -32,12 +27,22 @@ namespace osu.Game.Overlays.FirstRunSetup .MoveToX(0, 500, Easing.OutQuint); } - public override void OnSuspending(IScreen next) + public override bool OnExiting(IScreen next) { - base.OnSuspending(next); this .FadeOut(100) - .MoveToX(-100, 500, Easing.OutQuint); + .MoveToX(offset, 500, Easing.OutQuint); + + return base.OnExiting(next); + } + + public override void OnSuspending(IScreen next) + { + this + .FadeOut(100) + .MoveToX(-offset, 500, Easing.OutQuint); + + base.OnSuspending(next); } } } diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenSetupUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenSetupUIScale.cs deleted file mode 100644 index 1a8ef0338c..0000000000 --- a/osu.Game/Overlays/FirstRunSetup/ScreenSetupUIScale.cs +++ /dev/null @@ -1,114 +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.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Localisation; -using osu.Game.Configuration; -using osu.Game.Graphics; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.UserInterface; -using osu.Game.Localisation; -using osu.Game.Overlays.Settings; -using osu.Game.Screens; -using osu.Game.Screens.Menu; -using osu.Game.Screens.OnlinePlay.Match.Components; -using osu.Game.Screens.Select; -using osuTK; - -namespace osu.Game.Overlays.FirstRunSetup -{ - public class ScreenSetupUIScale : FirstRunSetupScreen - { - [Resolved] - private OsuConfigManager osuConfig { get; set; } - - [Cached] - private OsuLogo osuLogo = new OsuLogo(); - - [BackgroundDependencyLoader] - private void load() - { - OsuScreenStack stack; - Content.Children = new Drawable[] - { - new FillFlowContainer - { - RelativeSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Spacing = new Vector2(20), - Children = new Drawable[] - { - new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 32)) - { - Text = "The osu! user interface size can be adjusted to your liking.", - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y - }, - new SettingsSlider - { - LabelText = GraphicsSettingsStrings.UIScaling, - TransferValueOnCommit = true, - Current = osuConfig.GetBindable(OsuSetting.UIScale), - KeyboardStep = 0.01f, - }, - new GridContainer - { - RelativeSizeAxes = Axes.Both, - Content = new[] - { - new Drawable[] - { - new ScalingContainer(ScalingMode.Off) - { - Masking = true, - RelativeSizeAxes = Axes.Both, - Child = stack = new OsuScreenStack() - }, - new ScalingContainer(ScalingMode.Off) - { - Masking = true, - RelativeSizeAxes = Axes.Both, - Child = stack = new OsuScreenStack() - } - }, - new Drawable[] - { - new ScalingContainer(ScalingMode.Off) - { - Masking = true, - RelativeSizeAxes = Axes.Both, - Child = stack = new OsuScreenStack() - }, - new ScalingContainer(ScalingMode.Off) - { - Masking = true, - RelativeSizeAxes = Axes.Both, - Child = stack = new OsuScreenStack() - } - } - } - } - } - }, - new PurpleTriangleButton - { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - RelativeSizeAxes = Axes.X, - Margin = new MarginPadding(10), - Text = "Finish", - Action = () => Overlay.Hide() - } - }; - - stack.Push(new PlaySongSelect()); - } - - private class UIScaleSlider : OsuSliderBar - { - public override LocalisableString TooltipText => base.TooltipText + "x"; - } - } -} diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs new file mode 100644 index 0000000000..5070856087 --- /dev/null +++ b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs @@ -0,0 +1,146 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Localisation; +using osu.Framework.Screens; +using osu.Game.Configuration; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; +using osu.Game.Localisation; +using osu.Game.Overlays.Settings; +using osu.Game.Screens; +using osu.Game.Screens.Menu; +using osu.Game.Screens.Select; +using osu.Game.Tests.Visual; +using osuTK; + +namespace osu.Game.Overlays.FirstRunSetup +{ + public class ScreenUIScale : FirstRunSetupScreen + { + [Resolved] + private OsuConfigManager osuConfig { get; set; } + + [BackgroundDependencyLoader] + private void load() + { + InternalChildren = new Drawable[] + { + new GridContainer + { + RelativeSizeAxes = Axes.Both, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize), + new Dimension() + }, + Content = new[] + { + new Drawable[] + { + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(20), + Children = new Drawable[] + { + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 24)) + { + Text = "The osu! user interface size can be adjusted to your liking.", + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + }, + new SettingsSlider + { + LabelText = GraphicsSettingsStrings.UIScaling, + Current = osuConfig.GetBindable(OsuSetting.UIScale), + KeyboardStep = 0.01f, + }, + } + } + }, + new Drawable[] + { + new GridContainer + { + RelativeSizeAxes = Axes.Both, + Content = new[] + { + new Drawable[] + { + new SampleScreenContainer(new MainMenu()), + new SampleScreenContainer(new PlaySongSelect()), + }, + new Drawable[] + { + new SampleScreenContainer(new MainMenu()), + new SampleScreenContainer(new MainMenu()), + } + } + } + }, + } + } + }; + } + + private class SampleScreenContainer : CompositeDrawable + { + public override bool HandlePositionalInput => false; + public override bool HandleNonPositionalInput => false; + public override bool PropagatePositionalInputSubTree => false; + public override bool PropagateNonPositionalInputSubTree => false; + + public SampleScreenContainer(Screen screen) + { + OsuScreenStack stack; + RelativeSizeAxes = Axes.Both; + + OsuLogo logo; + + InternalChildren = new Drawable[] + { + new DependencyProvidingContainer + { + CachedDependencies = new (Type, object)[] + { + (typeof(OsuLogo), logo = new OsuLogo + { + RelativePositionAxes = Axes.Both, + Position = new Vector2(0.5f), + }) + }, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new ScalingContainer(ScalingMode.Off) + { + Masking = true, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + stack = new OsuScreenStack(), + logo + }, + }, + } + }, + }; + + stack.Push(screen); + } + } + + private class UIScaleSlider : OsuSliderBar + { + public override LocalisableString TooltipText => base.TooltipText + "x"; + } + } +} diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 0efeded062..b391f71437 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -21,6 +21,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Overlays.Dialog; using osu.Game.Overlays.FirstRunSetup; +using osu.Game.Screens; using osu.Game.Screens.Menu; using osu.Game.Screens.OnlinePlay.Match.Components; using osuTK; @@ -33,16 +34,17 @@ namespace osu.Game.Overlays { protected override bool StartHidden => true; - [Resolved(canBeNull: true)] - private DialogOverlay? dialogOverlay { get; set; } + [Resolved] + private IDialogOverlay dialogOverlay { get; set; } = null!; - [Resolved(canBeNull: true)] - private OsuGame? osuGame { get; set; } + [Resolved] + private IPerformFromScreenRunner performer { get; set; } = null!; private ScreenStack stack = null!; public PurpleTriangleButton NextButton = null!; public DangerousTriangleButton BackButton = null!; + private Container mainContent = null!; [Cached] private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); @@ -57,11 +59,9 @@ namespace osu.Game.Overlays private readonly FirstRunStep[] steps = { new FirstRunStep(typeof(ScreenWelcome), "Welcome"), - new FirstRunStep(typeof(ScreenSetupUIScale), "UI Scale"), + new FirstRunStep(typeof(ScreenUIScale), "UI Scale"), }; - private Container mainContent; - public FirstRunSetupOverlay() { RelativeSizeAxes = Axes.Both; @@ -91,7 +91,7 @@ namespace osu.Game.Overlays new Box { RelativeSizeAxes = Axes.Both, - Colour = colourProvider.Background5, + Colour = colourProvider.Background6, }, new GridContainer { @@ -114,7 +114,7 @@ namespace osu.Game.Overlays { new Box { - Colour = colourProvider.Background6, + Colour = colourProvider.Background5, RelativeSizeAxes = Axes.Both, }, new FillFlowContainer @@ -214,27 +214,15 @@ namespace osu.Game.Overlays { base.LoadComplete(); - if (osuGame != null) - { - // if we are valid for display, only do so after reaching the main menu. - osuGame.PerformFromScreen(_ => - { - Show(); - }, new[] { typeof(MainMenu) }); - } - else - { - Show(); - } + // if we are valid for display, only do so after reaching the main menu. + performer.PerformFromScreen(_ => { Show(); }, new[] { typeof(MainMenu) }); } protected override bool OnClick(ClickEvent e) { - if (!mainContent.IsHovered && dialogOverlay?.CurrentDialog == null) + if (!mainContent.IsHovered && dialogOverlay.CurrentDialog == null) { - dialogOverlay?.Push(new ConfirmDialog("Are you sure you want to exit the setup process?", - Hide, - () => { })); + dialogOverlay.Push(new ConfirmDialog("Are you sure you want to exit the setup process?", Hide, () => { })); } return base.OnClick(e); From 11395c40b7e4586c7c3c1030bc7e36d9e51ac5d3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 18:58:24 +0900 Subject: [PATCH 0328/2328] Add button to access first run setup on demand --- osu.Game/Overlays/Settings/Sections/GeneralSection.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game/Overlays/Settings/Sections/GeneralSection.cs b/osu.Game/Overlays/Settings/Sections/GeneralSection.cs index 87e9f34833..786db85bbf 100644 --- a/osu.Game/Overlays/Settings/Sections/GeneralSection.cs +++ b/osu.Game/Overlays/Settings/Sections/GeneralSection.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; @@ -11,6 +12,9 @@ namespace osu.Game.Overlays.Settings.Sections { public class GeneralSection : SettingsSection { + [Resolved(CanBeNull = true)] + private FirstRunSetupOverlay firstRunSetupOverlay { get; set; } + public override LocalisableString Header => GeneralSettingsStrings.GeneralSectionHeader; public override Drawable CreateIcon() => new SpriteIcon @@ -22,6 +26,11 @@ namespace osu.Game.Overlays.Settings.Sections { Children = new Drawable[] { + new SettingsButton + { + Text = "Run setup wizard", + Action = () => firstRunSetupOverlay?.Show(), + }, new LanguageSettings(), new UpdateSettings(), }; From 671662144443d40ef313773a6674c7c5dc741f73 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 19:06:13 +0900 Subject: [PATCH 0329/2328] Re-fix clicking inside display also dismissing --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index b391f71437..d7fd7ed104 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -18,7 +18,6 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using osu.Game.Online.API; using osu.Game.Overlays.Dialog; using osu.Game.Overlays.FirstRunSetup; using osu.Game.Screens; @@ -68,11 +67,11 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(IAPIProvider api, OsuColour colours) + private void load() { Children = new Drawable[] { - mainContent = new Container + mainContent = new BlockingContainer { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, @@ -210,6 +209,11 @@ namespace osu.Game.Overlays }; } + private class BlockingContainer : Container + { + protected override bool OnMouseDown(MouseDownEvent e) => true; + } + protected override void LoadComplete() { base.LoadComplete(); @@ -220,10 +224,7 @@ namespace osu.Game.Overlays protected override bool OnClick(ClickEvent e) { - if (!mainContent.IsHovered && dialogOverlay.CurrentDialog == null) - { - dialogOverlay.Push(new ConfirmDialog("Are you sure you want to exit the setup process?", Hide, () => { })); - } + dialogOverlay.Push(new ConfirmDialog("Are you sure you want to exit the setup process?", Hide, () => { })); return base.OnClick(e); } From fb7dc895036aae174fa77f10189b253eebb6f8a9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 19:08:34 +0900 Subject: [PATCH 0330/2328] Ensure wizard returns to initial screen after completion --- .../UserInterface/TestSceneFirstRunSetupOverlay.cs | 4 ++++ osu.Game/Overlays/FirstRunSetupOverlay.cs | 9 +++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index d892301a81..d22dd260eb 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -60,6 +60,10 @@ namespace osu.Game.Tests.Visual.UserInterface return overlay.State.Value == Visibility.Hidden; }); + + AddStep("display again on demand", () => overlay.Show()); + + AddUntilStep("back at start", () => overlay.CurrentScreen is ScreenWelcome); } [Test] diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index d7fd7ed104..0c800888ee 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -262,15 +262,16 @@ namespace osu.Game.Overlays { var nextStep = steps[currentStepIndex.Value]; stack.Push((Screen)Activator.CreateInstance(nextStep.ScreenType)); + + NextButton.Text = currentStepIndex + 1 < steps.Length + ? $"Next ({steps[currentStepIndex.Value + 1].Description})" + : "Finish"; } else { Hide(); + currentStepIndex = null; } - - NextButton.Text = currentStepIndex + 1 < steps.Length - ? $"Next ({steps[currentStepIndex.Value + 1].Description})" - : "Finish"; } protected override void PopOut() From 3ea4eabdb6aba9f384ae376b062a452dcbea3c46 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 19:18:13 +0900 Subject: [PATCH 0331/2328] Ensure button text is updated on going backwards --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 0c800888ee..abde9636ba 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -246,6 +246,8 @@ namespace osu.Game.Overlays currentStepIndex--; BackButton.Enabled.Value = currentStepIndex != 0; + + updateButtonText(); } private void showNextStep() @@ -260,12 +262,8 @@ namespace osu.Game.Overlays if (currentStepIndex < steps.Length) { - var nextStep = steps[currentStepIndex.Value]; - stack.Push((Screen)Activator.CreateInstance(nextStep.ScreenType)); - - NextButton.Text = currentStepIndex + 1 < steps.Length - ? $"Next ({steps[currentStepIndex.Value + 1].Description})" - : "Finish"; + stack.Push((Screen)Activator.CreateInstance(steps[currentStepIndex.Value].ScreenType)); + updateButtonText(); } else { @@ -274,6 +272,15 @@ namespace osu.Game.Overlays } } + private void updateButtonText() + { + Debug.Assert(currentStepIndex != null); + + NextButton.Text = currentStepIndex + 1 < steps.Length + ? $"Next ({steps[currentStepIndex.Value + 1].Description})" + : "Finish"; + } + protected override void PopOut() { base.PopOut(); From 8bfa59d12f6165f7f30cca862264b9d84c73bd41 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 19:35:09 +0900 Subject: [PATCH 0332/2328] Ensure all other dialogs and overlays are dismissed when the first run wizard is shown --- osu.Game/OsuGame.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 52aa6b8f07..7aa488d7a8 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -844,7 +844,7 @@ namespace osu.Game Add(new MusicKeyBindingHandler()); // side overlays which cancel each other. - var singleDisplaySideOverlays = new OverlayContainer[] { Settings, Notifications }; + var singleDisplaySideOverlays = new OverlayContainer[] { Settings, Notifications, firstRunOverlay }; foreach (var overlay in singleDisplaySideOverlays) { @@ -869,7 +869,7 @@ namespace osu.Game } // ensure only one of these overlays are open at once. - var singleDisplayOverlays = new OverlayContainer[] { chatOverlay, news, dashboard, beatmapListing, changelogOverlay, rankingsOverlay, wikiOverlay }; + var singleDisplayOverlays = new OverlayContainer[] { firstRunOverlay, chatOverlay, news, dashboard, beatmapListing, changelogOverlay, rankingsOverlay, wikiOverlay }; foreach (var overlay in singleDisplayOverlays) { From 9074eb283dd43e2f0f593c26e3cfddd7b81ec22f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 19:35:51 +0900 Subject: [PATCH 0333/2328] Show a notification instead of blocking exit of wizard --- .../TestSceneFirstRunSetupOverlay.cs | 6 ------ osu.Game/Overlays/FirstRunSetupOverlay.cs | 21 ++++++++++++------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index d22dd260eb..3a4dc09e26 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Overlays; -using osu.Game.Overlays.Dialog; using osu.Game.Overlays.FirstRunSetup; using osu.Game.Screens; using osuTK; @@ -23,19 +22,14 @@ namespace osu.Game.Tests.Visual.UserInterface private FirstRunSetupOverlay overlay; private readonly Mock perfomer = new Mock(); - private readonly Mock dialogOverlay = new Mock(); [BackgroundDependencyLoader] private void load() { Dependencies.CacheAs(perfomer.Object); - Dependencies.CacheAs(dialogOverlay.Object); perfomer.Setup(g => g.PerformFromScreen(It.IsAny>(), It.IsAny>())) .Callback((Action action, IEnumerable types) => action(null)); - - dialogOverlay.Setup(d => d.Push(It.IsAny())) - .Callback((PopupDialog dialog) => dialog.PerformOkAction()); } [SetUpSteps] diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index abde9636ba..b7d7a21493 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -222,13 +222,6 @@ namespace osu.Game.Overlays performer.PerformFromScreen(_ => { Show(); }, new[] { typeof(MainMenu) }); } - protected override bool OnClick(ClickEvent e) - { - dialogOverlay.Push(new ConfirmDialog("Are you sure you want to exit the setup process?", Hide, () => { })); - - return base.OnClick(e); - } - protected override void PopIn() { base.PopIn(); @@ -283,6 +276,20 @@ namespace osu.Game.Overlays protected override void PopOut() { + if (currentStepIndex != null) + { + notificationOverlay?.Post(new SimpleNotification + { + Text = "Click here to resume initial setup at any point", + Icon = FontAwesome.Solid.Horse, + Activated = () => + { + Show(); + return true; + }, + }); + } + base.PopOut(); this.FadeOut(100); } From 2682373bf25102647c142cdecdaf442be1428725 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 19:36:12 +0900 Subject: [PATCH 0334/2328] Use existing blocking / exit logic provided by `OsuFocusedOverlayContainer` --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 230 +++++++++++----------- 1 file changed, 115 insertions(+), 115 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index b7d7a21493..4a9e8d0efd 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -11,15 +11,15 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.Events; +using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using osu.Game.Overlays.Dialog; using osu.Game.Overlays.FirstRunSetup; +using osu.Game.Overlays.Notifications; using osu.Game.Screens; using osu.Game.Screens.Menu; using osu.Game.Screens.OnlinePlay.Match.Components; @@ -33,17 +33,16 @@ namespace osu.Game.Overlays { protected override bool StartHidden => true; - [Resolved] - private IDialogOverlay dialogOverlay { get; set; } = null!; - [Resolved] private IPerformFromScreenRunner performer { get; set; } = null!; + [Resolved(canBeNull: true)] + private NotificationOverlay notificationOverlay { get; set; } = null!; + private ScreenStack stack = null!; public PurpleTriangleButton NextButton = null!; public DangerousTriangleButton BackButton = null!; - private Container mainContent = null!; [Cached] private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); @@ -61,6 +60,8 @@ namespace osu.Game.Overlays new FirstRunStep(typeof(ScreenUIScale), "UI Scale"), }; + private Container stackContainer = null!; + public FirstRunSetupOverlay() { RelativeSizeAxes = Axes.Both; @@ -69,151 +70,140 @@ namespace osu.Game.Overlays [BackgroundDependencyLoader] private void load() { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + RelativeSizeAxes = Axes.Both; + Size = new Vector2(0.95f); + + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Radius = 5, + Colour = Color4.Black.Opacity(0.2f), + }; + + Masking = true; + CornerRadius = 10; + Children = new Drawable[] { - mainContent = new BlockingContainer + new Box { RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(0.95f), - EdgeEffect = new EdgeEffectParameters + Colour = colourProvider.Background6, + }, + new GridContainer + { + RelativeSizeAxes = Axes.Both, + RowDimensions = new[] { - Type = EdgeEffectType.Shadow, - Radius = 5, - Colour = Color4.Black.Opacity(0.2f), + new Dimension(GridSizeMode.AutoSize), + new Dimension(), + new Dimension(GridSizeMode.AutoSize), }, - Masking = true, - CornerRadius = 10, - Children = new Drawable[] + Content = new[] { - new Box + new Drawable[] { - RelativeSizeAxes = Axes.Both, - Colour = colourProvider.Background6, - }, - new GridContainer - { - RelativeSizeAxes = Axes.Both, - RowDimensions = new[] + new Container { - new Dimension(GridSizeMode.AutoSize), - new Dimension(), - new Dimension(GridSizeMode.AutoSize), - }, - Content = new[] - { - new Drawable[] + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] { - new Container + new Box + { + Colour = colourProvider.Background5, + RelativeSizeAxes = Axes.Both, + }, + new FillFlowContainer { RelativeSizeAxes = Axes.X, + Margin = new MarginPadding(10), AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, Children = new Drawable[] { - new Box + new OsuSpriteText { - Colour = colourProvider.Background5, - RelativeSizeAxes = Axes.Both, + Text = "First run setup", + Font = OsuFont.Default.With(size: 32), + Colour = colourProvider.Content2, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, }, - new FillFlowContainer + new OsuTextFlowContainer { - RelativeSizeAxes = Axes.X, - Margin = new MarginPadding(10), - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Children = new Drawable[] - { - new OsuSpriteText - { - Text = "First run setup", - Font = OsuFont.Default.With(size: 32), - Colour = colourProvider.Content2, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - }, - new OsuTextFlowContainer - { - Text = "Setup osu! to suit you", - Colour = colourProvider.Content1, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - AutoSizeAxes = Axes.Both, - }, - } + Text = "Setup osu! to suit you", + Colour = colourProvider.Content1, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + AutoSizeAxes = Axes.Both, }, } }, - }, - new Drawable[] + } + }, + }, + new Drawable[] + { + stackContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(20), + }, + }, + new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding(20), + Child = new GridContainer { - new Container + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + ColumnDimensions = new[] { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding(20), - Child = stack = new ScreenStack - { - RelativeSizeAxes = Axes.Both, - }, + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.Absolute, 10), + new Dimension(), }, - }, - new Drawable[] - { - new Container + RowDimensions = new[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding(20), - Child = new GridContainer + new Dimension(GridSizeMode.AutoSize), + }, + Content = new[] + { + new[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - ColumnDimensions = new[] + BackButton = new DangerousTriangleButton { - new Dimension(GridSizeMode.AutoSize), - new Dimension(GridSizeMode.Absolute, 10), - new Dimension(), + Width = 200, + Text = "Back", + Action = showLastStep, + Enabled = { Value = false }, }, - RowDimensions = new[] + Empty(), + NextButton = new PurpleTriangleButton { - new Dimension(GridSizeMode.AutoSize), - }, - Content = new[] - { - new[] - { - BackButton = new DangerousTriangleButton - { - Width = 200, - Text = "Back", - Action = showLastStep, - Enabled = { Value = false }, - }, - Empty(), - NextButton = new PurpleTriangleButton - { - RelativeSizeAxes = Axes.X, - Width = 1, - Text = "Get started", - Action = showNextStep - } - }, + RelativeSizeAxes = Axes.X, + Width = 1, + Text = "Get started", + Action = showNextStep } }, } - } + }, } - }, + } } - } + }, }; } - private class BlockingContainer : Container - { - protected override bool OnMouseDown(MouseDownEvent e) => true; - } - protected override void LoadComplete() { base.LoadComplete(); @@ -246,7 +236,14 @@ namespace osu.Game.Overlays private void showNextStep() { if (currentStepIndex == null) + { + stackContainer.Child = stack = new ScreenStack + { + RelativeSizeAxes = Axes.Both, + }; + currentStepIndex = 0; + } else currentStepIndex++; @@ -260,8 +257,11 @@ namespace osu.Game.Overlays } else { - Hide(); + stack.FadeOut(500); + stack.Expire(); + currentStepIndex = null; + Hide(); } } From 5fd64a4c782cb67e9d88ac9751c4955165553d5f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 19:41:07 +0900 Subject: [PATCH 0335/2328] Add test coverage to ensure we don't leave any screens in the first run overlay --- .../Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index 3a4dc09e26..dfe7ba0252 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using Moq; using NUnit.Framework; using osu.Framework.Allocation; @@ -55,6 +56,8 @@ namespace osu.Game.Tests.Visual.UserInterface return overlay.State.Value == Visibility.Hidden; }); + AddUntilStep("wait for screens removed", () => !overlay.ChildrenOfType().Any()); + AddStep("display again on demand", () => overlay.Show()); AddUntilStep("back at start", () => overlay.CurrentScreen is ScreenWelcome); From 02f8367d66abbd278751092cb06b2f17ca97aabb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 19:47:47 +0900 Subject: [PATCH 0336/2328] Improve animation when showing/hiding first run overlay --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 43 ++++++++++++++--------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 4a9e8d0efd..ee78865618 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -36,8 +36,8 @@ namespace osu.Game.Overlays [Resolved] private IPerformFromScreenRunner performer { get; set; } = null!; - [Resolved(canBeNull: true)] - private NotificationOverlay notificationOverlay { get; set; } = null!; + [Resolved] + private INotificationOverlay notificationOverlay { get; set; } = null!; private ScreenStack stack = null!; @@ -49,6 +49,8 @@ namespace osu.Game.Overlays private int? currentStepIndex; + private const float scale_when_hidden = 0.9f; + /// /// The currently displayed screen, if any. /// @@ -212,15 +214,6 @@ namespace osu.Game.Overlays performer.PerformFromScreen(_ => { Show(); }, new[] { typeof(MainMenu) }); } - protected override void PopIn() - { - base.PopIn(); - this.FadeIn(400, Easing.OutQuint); - - if (currentStepIndex == null) - showNextStep(); - } - private void showLastStep() { Debug.Assert(currentStepIndex > 0); @@ -257,9 +250,6 @@ namespace osu.Game.Overlays } else { - stack.FadeOut(500); - stack.Expire(); - currentStepIndex = null; Hide(); } @@ -274,11 +264,24 @@ namespace osu.Game.Overlays : "Finish"; } + protected override void PopIn() + { + base.PopIn(); + + this.ScaleTo(scale_when_hidden) + .ScaleTo(1, 400, Easing.OutElasticHalf); + + this.FadeIn(400, Easing.OutQuint); + + if (currentStepIndex == null) + showNextStep(); + } + protected override void PopOut() { if (currentStepIndex != null) { - notificationOverlay?.Post(new SimpleNotification + notificationOverlay.Post(new SimpleNotification { Text = "Click here to resume initial setup at any point", Icon = FontAwesome.Solid.Horse, @@ -289,9 +292,17 @@ namespace osu.Game.Overlays }, }); } + else + { + stack? + .FadeOut(100) + .Expire(); + } base.PopOut(); - this.FadeOut(100); + + this.ScaleTo(0.96f, 400, Easing.OutQuint); + this.FadeOut(200, Easing.OutQuint); } private class FirstRunStep From a8d32a20611650c6bf3af729e0cb4c9bcfb79f19 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Apr 2022 23:37:08 +0900 Subject: [PATCH 0337/2328] Add test coverage of notification resume flow --- .../TestSceneFirstRunSetupOverlay.cs | 45 ++++++++++++++++--- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index dfe7ba0252..77a37e7420 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -12,6 +12,7 @@ using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Overlays; using osu.Game.Overlays.FirstRunSetup; +using osu.Game.Overlays.Notifications; using osu.Game.Screens; using osuTK; using osuTK.Input; @@ -22,20 +23,34 @@ namespace osu.Game.Tests.Visual.UserInterface { private FirstRunSetupOverlay overlay; - private readonly Mock perfomer = new Mock(); + private readonly Mock performer = new Mock(); + + private readonly Mock notificationOverlay = new Mock(); + + private Notification lastNotification; [BackgroundDependencyLoader] private void load() { - Dependencies.CacheAs(perfomer.Object); - - perfomer.Setup(g => g.PerformFromScreen(It.IsAny>(), It.IsAny>())) - .Callback((Action action, IEnumerable types) => action(null)); + Dependencies.CacheAs(performer.Object); + Dependencies.CacheAs(notificationOverlay.Object); } [SetUpSteps] public void SetUpSteps() { + AddStep("setup dependencies", () => + { + performer.Reset(); + notificationOverlay.Reset(); + + performer.Setup(g => g.PerformFromScreen(It.IsAny>(), It.IsAny>())) + .Callback((Action action, IEnumerable types) => action(null)); + + notificationOverlay.Setup(n => n.Post(It.IsAny())) + .Callback((Notification n) => lastNotification = n); + }); + AddStep("add overlay", () => { Child = overlay = new FirstRunSetupOverlay @@ -58,6 +73,8 @@ namespace osu.Game.Tests.Visual.UserInterface AddUntilStep("wait for screens removed", () => !overlay.ChildrenOfType().Any()); + AddStep("no notifications", () => notificationOverlay.VerifyNoOtherCalls()); + AddStep("display again on demand", () => overlay.Show()); AddUntilStep("back at start", () => overlay.CurrentScreen is ScreenWelcome); @@ -108,5 +125,23 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("overlay dismissed", () => overlay.State.Value == Visibility.Hidden); } + + [Test] + public void TestResumeViaNotification() + { + AddStep("step to next", () => overlay.NextButton.TriggerClick()); + + AddAssert("is at known screen", () => overlay.CurrentScreen is ScreenUIScale); + + AddStep("hide", () => overlay.Hide()); + AddAssert("overlay hidden", () => overlay.State.Value == Visibility.Hidden); + + AddStep("notification arrived", () => notificationOverlay.Verify(n => n.Post(It.IsAny()), Times.Once)); + + AddStep("run notification action", () => lastNotification.Activated()); + + AddAssert("overlay shown", () => overlay.State.Value == Visibility.Visible); + AddAssert("is resumed", () => overlay.CurrentScreen is ScreenUIScale); + } } } From 5dc38050056e4bb524e48af24bb385c65c5c276b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 13:48:43 +0900 Subject: [PATCH 0338/2328] Fix `stack` nullability --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index ee78865618..27ff4aaabf 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -39,7 +39,7 @@ namespace osu.Game.Overlays [Resolved] private INotificationOverlay notificationOverlay { get; set; } = null!; - private ScreenStack stack = null!; + private ScreenStack? stack; public PurpleTriangleButton NextButton = null!; public DangerousTriangleButton BackButton = null!; @@ -54,7 +54,7 @@ namespace osu.Game.Overlays /// /// The currently displayed screen, if any. /// - public FirstRunSetupScreen? CurrentScreen => (FirstRunSetupScreen?)stack.CurrentScreen; + public FirstRunSetupScreen? CurrentScreen => (FirstRunSetupScreen?)stack?.CurrentScreen; private readonly FirstRunStep[] steps = { @@ -217,6 +217,7 @@ namespace osu.Game.Overlays private void showLastStep() { Debug.Assert(currentStepIndex > 0); + Debug.Assert(stack != null); stack.CurrentScreen.Exit(); currentStepIndex--; @@ -241,6 +242,8 @@ namespace osu.Game.Overlays currentStepIndex++; Debug.Assert(currentStepIndex != null); + Debug.Assert(stack != null); + BackButton.Enabled.Value = currentStepIndex > 0; if (currentStepIndex < steps.Length) @@ -294,9 +297,8 @@ namespace osu.Game.Overlays } else { - stack? - .FadeOut(100) - .Expire(); + stack?.FadeOut(100) + .Expire(); } base.PopOut(); From e67cc293b8215e57d412165989754071d748f254 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 13:52:55 +0900 Subject: [PATCH 0339/2328] Add localisation support for all new strings --- osu.Game/Localisation/CommonStrings.cs | 10 ++++ .../FirstRunSetupOverlayStrings.cs | 58 +++++++++++++++++++ .../Localisation/GeneralSettingsStrings.cs | 5 ++ .../Overlays/FirstRunSetup/ScreenUIScale.cs | 2 +- .../Overlays/FirstRunSetup/ScreenWelcome.cs | 4 +- osu.Game/Overlays/FirstRunSetupOverlay.cs | 19 +++--- .../Settings/Sections/GeneralSection.cs | 2 +- 7 files changed, 87 insertions(+), 13 deletions(-) create mode 100644 osu.Game/Localisation/FirstRunSetupOverlayStrings.cs diff --git a/osu.Game/Localisation/CommonStrings.cs b/osu.Game/Localisation/CommonStrings.cs index 3ea337c279..05c4d97ccc 100644 --- a/osu.Game/Localisation/CommonStrings.cs +++ b/osu.Game/Localisation/CommonStrings.cs @@ -19,6 +19,16 @@ namespace osu.Game.Localisation /// public static LocalisableString Clear => new TranslatableString(getKey(@"clear"), @"Clear"); + /// + /// "Back" + /// + public static LocalisableString Back => new TranslatableString(getKey(@"back"), @"Back"); + + /// + /// "Finish" + /// + public static LocalisableString Finish => new TranslatableString(getKey(@"finish"), @"Finish"); + /// /// "Enabled" /// diff --git a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs new file mode 100644 index 0000000000..ec2e97d82a --- /dev/null +++ b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs @@ -0,0 +1,58 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Localisation; + +namespace osu.Game.Localisation +{ + public static class FirstRunSetupOverlayStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.FirstRunSetupOverlay"; + + /// + /// "Get started" + /// + public static LocalisableString GetStarted => new TranslatableString(getKey(@"get_started"), @"Get started"); + + /// + /// "Click to resume first-run setup at any point" + /// + public static LocalisableString ClickToResumeFirstRunSetupAtAnyPoint => new TranslatableString(getKey(@"click_to_resume_first_run_setup_at_any_point"), @"Click to resume first-run setup at any point"); + + /// + /// "First-run setup" + /// + public static LocalisableString FirstRunSetup => new TranslatableString(getKey(@"first_run_setup"), @"First-run setup"); + + /// + /// "Setup osu! to suit you" + /// + public static LocalisableString SetupOsuToSuitYou => new TranslatableString(getKey(@"setup_osu_to_suit_you"), @"Setup osu! to suit you"); + + /// + /// "Welcome" + /// + public static LocalisableString Welcome => new TranslatableString(getKey(@"welcome"), @"Welcome"); + + /// + /// "Welcome to the first-run setup guide! + /// + /// osu! is a very configurable game, and diving straight into the settings can sometimes be overwhelming. This guide will help you get the important choices out of the way to ensure a great first experience!" + /// + public static LocalisableString WelcomeDescription => new TranslatableString(getKey(@"welcome_description"), @"Welcome to the first-run setup guide! + +osu! is a very configurable game, and diving straight into the settings can sometimes be overwhelming. This guide will help you get the important choices out of the way to ensure a great first experience!"); + + /// + /// "The size of the osu! user interface size can be adjusted to your liking." + /// + public static LocalisableString UIScaleDescription => new TranslatableString(getKey(@"ui_scale_description"), @"The size of the osu! user interface size can be adjusted to your liking."); + + /// + /// "Next ({0})" + /// + public static LocalisableString Next(LocalisableString nextStepDescription) => new TranslatableString(getKey(@"next"), @"Next ({0})", nextStepDescription); + + private static string getKey(string key) => $@"{prefix}:{key}"; + } +} diff --git a/osu.Game/Localisation/GeneralSettingsStrings.cs b/osu.Game/Localisation/GeneralSettingsStrings.cs index c65e6c77f4..2aa91f5245 100644 --- a/osu.Game/Localisation/GeneralSettingsStrings.cs +++ b/osu.Game/Localisation/GeneralSettingsStrings.cs @@ -59,6 +59,11 @@ namespace osu.Game.Localisation /// public static LocalisableString ChangeFolderLocation => new TranslatableString(getKey(@"change_folder_location"), @"Change folder location..."); + /// + /// "Run setup wizard" + /// + public static LocalisableString RunSetupWizard => new TranslatableString(getKey(@"run_setup_wizard"), @"Run setup wizard"); + private static string getKey(string key) => $"{prefix}:{key}"; } } diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs index 5070856087..80ff7bdf25 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs @@ -53,7 +53,7 @@ namespace osu.Game.Overlays.FirstRunSetup { new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 24)) { - Text = "The osu! user interface size can be adjusted to your liking.", + Text = FirstRunSetupOverlayStrings.UIScaleDescription, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs index 879ffdf198..9f80c80a02 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Localisation; namespace osu.Game.Overlays.FirstRunSetup { @@ -22,8 +23,7 @@ namespace osu.Game.Overlays.FirstRunSetup { new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { - Text = - "Welcome to the first-run setup guide!\n\nosu! is a very configurable game, and diving straight into the settings can sometimes be overwhelming. This guide will help you get the important choices out of the way to ensure a great first experience!", + Text = FirstRunSetupOverlayStrings.WelcomeDescription, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 27ff4aaabf..e8829136f0 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -18,6 +18,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Localisation; using osu.Game.Overlays.FirstRunSetup; using osu.Game.Overlays.Notifications; using osu.Game.Screens; @@ -58,8 +59,8 @@ namespace osu.Game.Overlays private readonly FirstRunStep[] steps = { - new FirstRunStep(typeof(ScreenWelcome), "Welcome"), - new FirstRunStep(typeof(ScreenUIScale), "UI Scale"), + new FirstRunStep(typeof(ScreenWelcome), FirstRunSetupOverlayStrings.Welcome), + new FirstRunStep(typeof(ScreenUIScale), GraphicsSettingsStrings.UIScaling), }; private Container stackContainer = null!; @@ -129,7 +130,7 @@ namespace osu.Game.Overlays { new OsuSpriteText { - Text = "First run setup", + Text = FirstRunSetupOverlayStrings.FirstRunSetup, Font = OsuFont.Default.With(size: 32), Colour = colourProvider.Content2, Anchor = Anchor.TopCentre, @@ -137,7 +138,7 @@ namespace osu.Game.Overlays }, new OsuTextFlowContainer { - Text = "Setup osu! to suit you", + Text = FirstRunSetupOverlayStrings.SetupOsuToSuitYou, Colour = colourProvider.Content1, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, @@ -184,7 +185,7 @@ namespace osu.Game.Overlays BackButton = new DangerousTriangleButton { Width = 200, - Text = "Back", + Text = CommonStrings.Back, Action = showLastStep, Enabled = { Value = false }, }, @@ -193,7 +194,7 @@ namespace osu.Game.Overlays { RelativeSizeAxes = Axes.X, Width = 1, - Text = "Get started", + Text = FirstRunSetupOverlayStrings.GetStarted, Action = showNextStep } }, @@ -263,8 +264,8 @@ namespace osu.Game.Overlays Debug.Assert(currentStepIndex != null); NextButton.Text = currentStepIndex + 1 < steps.Length - ? $"Next ({steps[currentStepIndex.Value + 1].Description})" - : "Finish"; + ? FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].Description) + : CommonStrings.Finish; } protected override void PopIn() @@ -286,7 +287,7 @@ namespace osu.Game.Overlays { notificationOverlay.Post(new SimpleNotification { - Text = "Click here to resume initial setup at any point", + Text = FirstRunSetupOverlayStrings.ClickToResumeFirstRunSetupAtAnyPoint, Icon = FontAwesome.Solid.Horse, Activated = () => { diff --git a/osu.Game/Overlays/Settings/Sections/GeneralSection.cs b/osu.Game/Overlays/Settings/Sections/GeneralSection.cs index 786db85bbf..ced3116728 100644 --- a/osu.Game/Overlays/Settings/Sections/GeneralSection.cs +++ b/osu.Game/Overlays/Settings/Sections/GeneralSection.cs @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections { new SettingsButton { - Text = "Run setup wizard", + Text = GeneralSettingsStrings.RunSetupWizard, Action = () => firstRunSetupOverlay?.Show(), }, new LanguageSettings(), From 6d534046ff2cedc67315f4d6e10f8f810afab33a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 14:46:01 +0900 Subject: [PATCH 0340/2328] Add keyboard traversal support for first run dialog (and tidy up step traversal logic) --- .../TestSceneFirstRunSetupOverlay.cs | 30 ++++- osu.Game/Overlays/FirstRunSetupOverlay.cs | 125 +++++++++++------- 2 files changed, 103 insertions(+), 52 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index 77a37e7420..ff54e34ca0 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -60,13 +60,19 @@ namespace osu.Game.Tests.Visual.UserInterface }); } - [Test] - public void TestOverlayRunsToFinish() + [TestCase(false)] + [TestCase(true)] + public void TestOverlayRunsToFinish(bool keyboard) { AddUntilStep("step through", () => { if (overlay.CurrentScreen?.IsLoaded != false) - overlay.NextButton.TriggerClick(); + { + if (keyboard) + InputManager.Key(Key.Enter); + else + overlay.NextButton.TriggerClick(); + } return overlay.State.Value == Visibility.Hidden; }); @@ -80,8 +86,9 @@ namespace osu.Game.Tests.Visual.UserInterface AddUntilStep("back at start", () => overlay.CurrentScreen is ScreenWelcome); } - [Test] - public void TestBackButton() + [TestCase(false)] + [TestCase(true)] + public void TestBackButton(bool keyboard) { AddAssert("back button disabled", () => !overlay.BackButton.Enabled.Value); @@ -98,12 +105,23 @@ namespace osu.Game.Tests.Visual.UserInterface AddUntilStep("step back to start", () => { if (overlay.CurrentScreen?.IsLoaded != false) - overlay.BackButton.TriggerClick(); + { + if (keyboard) + InputManager.Key(Key.Escape); + else + overlay.BackButton.TriggerClick(); + } return overlay.CurrentScreen is ScreenWelcome; }); AddAssert("back button disabled", () => !overlay.BackButton.Enabled.Value); + + if (keyboard) + { + AddStep("exit via keyboard", () => InputManager.Key(Key.Escape)); + AddAssert("overlay dismissed", () => overlay.State.Value == Visibility.Hidden); + } } [Test] diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index e8829136f0..00396e6d85 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -12,12 +12,14 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Input.Bindings; using osu.Game.Localisation; using osu.Game.Overlays.FirstRunSetup; using osu.Game.Overlays.Notifications; @@ -215,57 +217,30 @@ namespace osu.Game.Overlays performer.PerformFromScreen(_ => { Show(); }, new[] { typeof(MainMenu) }); } - private void showLastStep() + public override bool OnPressed(KeyBindingPressEvent e) { - Debug.Assert(currentStepIndex > 0); - Debug.Assert(stack != null); - - stack.CurrentScreen.Exit(); - currentStepIndex--; - - BackButton.Enabled.Value = currentStepIndex != 0; - - updateButtonText(); - } - - private void showNextStep() - { - if (currentStepIndex == null) + if (!e.Repeat) { - stackContainer.Child = stack = new ScreenStack + switch (e.Action) { - RelativeSizeAxes = Axes.Both, - }; + case GlobalAction.Select: + NextButton.TriggerClick(); + return true; - currentStepIndex = 0; + case GlobalAction.Back: + if (BackButton.Enabled.Value) + { + BackButton.TriggerClick(); + return true; + } + + // If back button is disabled, we are at the first step. + // The base call will handle dismissal of the overlay. + break; + } } - else - currentStepIndex++; - Debug.Assert(currentStepIndex != null); - Debug.Assert(stack != null); - - BackButton.Enabled.Value = currentStepIndex > 0; - - if (currentStepIndex < steps.Length) - { - stack.Push((Screen)Activator.CreateInstance(steps[currentStepIndex.Value].ScreenType)); - updateButtonText(); - } - else - { - currentStepIndex = null; - Hide(); - } - } - - private void updateButtonText() - { - Debug.Assert(currentStepIndex != null); - - NextButton.Text = currentStepIndex + 1 < steps.Length - ? FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].Description) - : CommonStrings.Finish; + return base.OnPressed(e); } protected override void PopIn() @@ -278,7 +253,7 @@ namespace osu.Game.Overlays this.FadeIn(400, Easing.OutQuint); if (currentStepIndex == null) - showNextStep(); + showFirstStep(); } protected override void PopOut() @@ -308,6 +283,64 @@ namespace osu.Game.Overlays this.FadeOut(200, Easing.OutQuint); } + private void showFirstStep() + { + Debug.Assert(currentStepIndex == null); + + stackContainer.Child = stack = new ScreenStack + { + RelativeSizeAxes = Axes.Both, + }; + + currentStepIndex = -1; + showNextStep(); + } + + private void showLastStep() + { + if (currentStepIndex == 0) + return; + + Debug.Assert(stack != null); + + stack.CurrentScreen.Exit(); + currentStepIndex--; + + BackButton.Enabled.Value = currentStepIndex != 0; + + updateButtonText(); + } + + private void showNextStep() + { + Debug.Assert(currentStepIndex != null); + Debug.Assert(stack != null); + + currentStepIndex++; + + BackButton.Enabled.Value = currentStepIndex > 0; + + if (currentStepIndex < steps.Length) + { + stack.Push((Screen)Activator.CreateInstance(steps[currentStepIndex.Value].ScreenType)); + updateButtonText(); + } + else + { + currentStepIndex = null; + Hide(); + } + } + + private void updateButtonText() + { + Debug.Assert(currentStepIndex != null); + + NextButton.Text = currentStepIndex + 1 < steps.Length + ? FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].Description) + : CommonStrings.Finish; + } + private class FirstRunStep { public readonly Type ScreenType; From c4bade099574fa36af497f4d8fe8d97493041ee2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 15:46:03 +0900 Subject: [PATCH 0341/2328] Expose `MainMenu` buttons --- osu.Game/Screens/Menu/ButtonSystem.cs | 14 +++++++++++--- osu.Game/Screens/Menu/MainMenu.cs | 26 +++++++++++++------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 598c441042..a153eda0c4 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -88,6 +88,8 @@ namespace osu.Game.Screens.Menu private readonly LogoTrackingContainer logoTrackingContainer; + public bool ReturnToTopOnIdle { get; set; } = true; + public ButtonSystem() { RelativeSizeAxes = Axes.Both; @@ -101,7 +103,8 @@ namespace osu.Game.Screens.Menu buttonArea.AddRange(new Drawable[] { new MainMenuButton(ButtonSystemStrings.Settings, string.Empty, FontAwesome.Solid.Cog, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O), - backButton = new MainMenuButton(ButtonSystemStrings.Back, @"button-back-select", OsuIcon.LeftCircle, new Color4(51, 58, 94, 255), () => State = ButtonSystemState.TopLevel, -WEDGE_WIDTH) + backButton = new MainMenuButton(ButtonSystemStrings.Back, @"button-back-select", OsuIcon.LeftCircle, new Color4(51, 58, 94, 255), () => State = ButtonSystemState.TopLevel, + -WEDGE_WIDTH) { VisibleState = ButtonSystemState.Play, }, @@ -131,9 +134,11 @@ namespace osu.Game.Screens.Menu buttonsPlay.Add(new MainMenuButton(ButtonSystemStrings.Playlists, @"button-generic-select", OsuIcon.Charts, new Color4(94, 63, 186, 255), onPlaylists, 0, Key.L)); buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play); - buttonsTopLevel.Add(new MainMenuButton(ButtonSystemStrings.Play, @"button-play-select", OsuIcon.Logo, new Color4(102, 68, 204, 255), () => State = ButtonSystemState.Play, WEDGE_WIDTH, Key.P)); + buttonsTopLevel.Add(new MainMenuButton(ButtonSystemStrings.Play, @"button-play-select", OsuIcon.Logo, new Color4(102, 68, 204, 255), () => State = ButtonSystemState.Play, WEDGE_WIDTH, + Key.P)); buttonsTopLevel.Add(new MainMenuButton(ButtonSystemStrings.Edit, @"button-edit-select", OsuIcon.EditCircle, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E)); - buttonsTopLevel.Add(new MainMenuButton(ButtonSystemStrings.Browse, @"button-direct-select", OsuIcon.ChevronDownCircle, new Color4(165, 204, 0, 255), () => OnBeatmapListing?.Invoke(), 0, Key.D)); + buttonsTopLevel.Add(new MainMenuButton(ButtonSystemStrings.Browse, @"button-direct-select", OsuIcon.ChevronDownCircle, new Color4(165, 204, 0, 255), () => OnBeatmapListing?.Invoke(), 0, + Key.D)); if (host.CanExit) buttonsTopLevel.Add(new MainMenuButton(ButtonSystemStrings.Exit, string.Empty, OsuIcon.CrossCircle, new Color4(238, 51, 153, 255), () => OnExit?.Invoke(), 0, Key.Q)); @@ -201,6 +206,9 @@ namespace osu.Game.Screens.Menu private void updateIdleState(bool isIdle) { + if (!ReturnToTopOnIdle) + return; + if (isIdle && State != ButtonSystemState.Exit && State != ButtonSystemState.EnteringMode) State = ButtonSystemState.Initial; } diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 08df06816b..422508b60e 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Menu public const float FADE_OUT_DURATION = 400; - public override bool HideOverlaysOnEnter => buttons == null || buttons.State == ButtonSystemState.Initial; + public override bool HideOverlaysOnEnter => Buttons == null || Buttons.State == ButtonSystemState.Initial; public override bool AllowBackButton => false; @@ -45,7 +45,7 @@ namespace osu.Game.Screens.Menu private MenuSideFlashes sideFlashes; - private ButtonSystem buttons; + protected ButtonSystem Buttons; [Resolved] private GameHost host { get; set; } @@ -101,7 +101,7 @@ namespace osu.Game.Screens.Menu ParallaxAmount = 0.01f, Children = new Drawable[] { - buttons = new ButtonSystem + Buttons = new ButtonSystem { OnEdit = delegate { @@ -125,7 +125,7 @@ namespace osu.Game.Screens.Menu exitConfirmOverlay?.CreateProxy() ?? Empty() }); - buttons.StateChanged += state => + Buttons.StateChanged += state => { switch (state) { @@ -140,8 +140,8 @@ namespace osu.Game.Screens.Menu } }; - buttons.OnSettings = () => settings?.ToggleVisibility(); - buttons.OnBeatmapListing = () => beatmapListing?.ToggleVisibility(); + Buttons.OnSettings = () => settings?.ToggleVisibility(); + Buttons.OnBeatmapListing = () => beatmapListing?.ToggleVisibility(); LoadComponentAsync(background = new BackgroundScreenDefault()); preloadSongSelect(); @@ -179,7 +179,7 @@ namespace osu.Game.Screens.Menu public override void OnEntering(IScreen last) { base.OnEntering(last); - buttons.FadeInFromZero(500); + Buttons.FadeInFromZero(500); if (last is IntroScreen && musicController.TrackLoaded) { @@ -203,14 +203,14 @@ namespace osu.Game.Screens.Menu { base.LogoArriving(logo, resuming); - buttons.SetOsuLogo(logo); + Buttons.SetOsuLogo(logo); logo.FadeColour(Color4.White, 100, Easing.OutQuint); logo.FadeIn(100, Easing.OutQuint); if (resuming) { - buttons.State = ButtonSystemState.TopLevel; + Buttons.State = ButtonSystemState.TopLevel; this.FadeIn(FADE_IN_DURATION, Easing.OutQuint); buttonsContainer.MoveTo(new Vector2(0, 0), FADE_IN_DURATION, Easing.OutQuint); @@ -245,15 +245,15 @@ namespace osu.Game.Screens.Menu var seq = logo.FadeOut(300, Easing.InSine) .ScaleTo(0.2f, 300, Easing.InSine); - seq.OnComplete(_ => buttons.SetOsuLogo(null)); - seq.OnAbort(_ => buttons.SetOsuLogo(null)); + seq.OnComplete(_ => Buttons.SetOsuLogo(null)); + seq.OnAbort(_ => Buttons.SetOsuLogo(null)); } public override void OnSuspending(IScreen next) { base.OnSuspending(next); - buttons.State = ButtonSystemState.EnteringMode; + Buttons.State = ButtonSystemState.EnteringMode; this.FadeOut(FADE_OUT_DURATION, Easing.InSine); buttonsContainer.MoveTo(new Vector2(-800, 0), FADE_OUT_DURATION, Easing.InSine); @@ -285,7 +285,7 @@ namespace osu.Game.Screens.Menu return true; } - buttons.State = ButtonSystemState.Exit; + Buttons.State = ButtonSystemState.Exit; OverlayActivationMode.Value = OverlayActivation.Disabled; songTicker.Hide(); From c27831145ccd47975d0ba862d0b11408fe9c5368 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 16:37:29 +0900 Subject: [PATCH 0342/2328] Add scroll and flow at the `FirstRunSetupScreen` level --- .../FirstRunSetup/FirstRunSetupScreen.cs | 23 +++++++++++++++++++ .../Overlays/FirstRunSetup/ScreenWelcome.cs | 19 ++++----------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs index 2d025d46ef..b2284a999d 100644 --- a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs +++ b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs @@ -2,7 +2,10 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Screens; +using osu.Game.Graphics.Containers; +using osuTK; namespace osu.Game.Overlays.FirstRunSetup { @@ -10,6 +13,26 @@ namespace osu.Game.Overlays.FirstRunSetup { private const float offset = 100; + protected FillFlowContainer Content { get; private set; } + + protected FirstRunSetupScreen() + { + InternalChildren = new Drawable[] + { + new OsuScrollContainer(Direction.Vertical) + { + RelativeSizeAxes = Axes.Both, + Child = Content = new FillFlowContainer + { + Spacing = new Vector2(20), + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + }, + } + }; + } + public override void OnEntering(IScreen last) { base.OnEntering(last); diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs index 9f80c80a02..39da180f40 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Localisation; @@ -13,21 +12,13 @@ namespace osu.Game.Overlays.FirstRunSetup { public ScreenWelcome() { - InternalChildren = new Drawable[] + Content.Children = new Drawable[] { - new FillFlowContainer + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { - RelativeSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Children = new Drawable[] - { - new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) - { - Text = FirstRunSetupOverlayStrings.WelcomeDescription, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y - }, - } + Text = FirstRunSetupOverlayStrings.WelcomeDescription, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y }, }; } From a195d4f5aa5a132bf6860e23ab04f327cb84b8a8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 16:49:41 +0900 Subject: [PATCH 0343/2328] Use a culture name that doesn't cause everything to fall over --- osu.Game/Localisation/DebugLocalisationStore.cs | 2 +- osu.Game/Localisation/Language.cs | 2 +- osu.Game/OsuGame.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Localisation/DebugLocalisationStore.cs b/osu.Game/Localisation/DebugLocalisationStore.cs index 99dca6265e..2b114b1bd8 100644 --- a/osu.Game/Localisation/DebugLocalisationStore.cs +++ b/osu.Game/Localisation/DebugLocalisationStore.cs @@ -21,7 +21,7 @@ namespace osu.Game.Localisation public IEnumerable GetAvailableResources() => throw new NotImplementedException(); - public CultureInfo EffectiveCulture { get; } = new CultureInfo(@"debug"); + public CultureInfo EffectiveCulture { get; } = CultureInfo.CurrentCulture; public void Dispose() { diff --git a/osu.Game/Localisation/Language.cs b/osu.Game/Localisation/Language.cs index c98586457e..c13a1a10cb 100644 --- a/osu.Game/Localisation/Language.cs +++ b/osu.Game/Localisation/Language.cs @@ -114,7 +114,7 @@ namespace osu.Game.Localisation #if DEBUG [Description(@"Debug (show raw keys)")] - DebugLocalisation + debug #endif } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index b591b09584..ea21954b9c 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -629,9 +629,9 @@ namespace osu.Game foreach (var language in Enum.GetValues(typeof(Language)).OfType()) { #if DEBUG - if (language == Language.DebugLocalisation) + if (language == Language.debug) { - Localisation.AddLanguage(Language.DebugLocalisation.ToString(), new DebugLocalisationStore()); + Localisation.AddLanguage(Language.debug.ToString(), new DebugLocalisationStore()); continue; } #endif From 1490502d4ccc84472f34e23e04e91e04b001f7b4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 16:37:38 +0900 Subject: [PATCH 0344/2328] Improve overall usability of scale adjust screen --- .../Graphics/Containers/ScalingContainer.cs | 10 +- .../Overlays/FirstRunSetup/ScreenUIScale.cs | 153 +++++++++++------- 2 files changed, 101 insertions(+), 62 deletions(-) diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index ca8b6f388f..6589de40b7 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -79,12 +79,12 @@ namespace osu.Game.Graphics.Containers }; } - private class ScalingDrawSizePreservingFillContainer : DrawSizePreservingFillContainer + public class ScalingDrawSizePreservingFillContainer : DrawSizePreservingFillContainer { private readonly bool applyUIScale; private Bindable uiScale; - private float currentScale = 1; + protected float CurrentScale { get; private set; } = 1; public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; @@ -99,14 +99,14 @@ namespace osu.Game.Graphics.Containers if (applyUIScale) { uiScale = osuConfig.GetBindable(OsuSetting.UIScale); - uiScale.BindValueChanged(args => this.TransformTo(nameof(currentScale), args.NewValue, duration, Easing.OutQuart), true); + uiScale.BindValueChanged(args => this.TransformTo(nameof(CurrentScale), args.NewValue, duration, Easing.OutQuart), true); } } protected override void Update() { - Scale = new Vector2(currentScale); - Size = new Vector2(1 / currentScale); + Scale = new Vector2(CurrentScale); + Size = new Vector2(1 / CurrentScale); base.Update(); } diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs index 80ff7bdf25..52aeb8082e 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs @@ -2,17 +2,23 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Textures; using osu.Framework.Localisation; using osu.Framework.Screens; +using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; using osu.Game.Overlays.Settings; +using osu.Game.Rulesets; using osu.Game.Screens; using osu.Game.Screens.Menu; using osu.Game.Screens.Select; @@ -27,77 +33,113 @@ namespace osu.Game.Overlays.FirstRunSetup private OsuConfigManager osuConfig { get; set; } [BackgroundDependencyLoader] - private void load() + private void load(RulesetStore rulesets, BeatmapManager beatmaps) { - InternalChildren = new Drawable[] + Content.Children = new Drawable[] { - new GridContainer + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 24)) { - RelativeSizeAxes = Axes.Both, - RowDimensions = new[] + Text = FirstRunSetupOverlayStrings.UIScaleDescription, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + }, + new SettingsSlider + { + LabelText = GraphicsSettingsStrings.UIScaling, + Current = osuConfig.GetBindable(OsuSetting.UIScale), + KeyboardStep = 0.01f, + }, + new InverseScalingDrawSizePreservingFillContainer + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.None, + Size = new Vector2(960, 960 / 16f * 9 / 2), + Children = new Drawable[] { - new Dimension(GridSizeMode.AutoSize), - new Dimension() - }, - Content = new[] - { - new Drawable[] + new GridContainer { - new FillFlowContainer + RelativeSizeAxes = Axes.Both, + Content = new[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Spacing = new Vector2(20), - Children = new Drawable[] + new Drawable[] { - new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 24)) - { - Text = FirstRunSetupOverlayStrings.UIScaleDescription, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y - }, - new SettingsSlider - { - LabelText = GraphicsSettingsStrings.UIScaling, - Current = osuConfig.GetBindable(OsuSetting.UIScale), - KeyboardStep = 0.01f, - }, - } + new SampleScreenContainer(new PinnedMainMenu()), + new SampleScreenContainer(new PlaySongSelect()), + }, + // TODO: add more screens here in the future (gameplay / results) + // requires a bit more consideration to isolate their behaviour from the "parent" game. } - }, - new Drawable[] - { - new GridContainer - { - RelativeSizeAxes = Axes.Both, - Content = new[] - { - new Drawable[] - { - new SampleScreenContainer(new MainMenu()), - new SampleScreenContainer(new PlaySongSelect()), - }, - new Drawable[] - { - new SampleScreenContainer(new MainMenu()), - new SampleScreenContainer(new MainMenu()), - } - } - } - }, + } } } }; } + private class InverseScalingDrawSizePreservingFillContainer : ScalingContainer.ScalingDrawSizePreservingFillContainer + { + private Vector2 initialSize; + + public InverseScalingDrawSizePreservingFillContainer() + : base(true) + { + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + initialSize = Size; + } + + protected override void Update() + { + Size = initialSize / CurrentScale; + } + } + + private class PinnedMainMenu : MainMenu + { + public override void OnEntering(IScreen last) + { + base.OnEntering(last); + + Buttons.ReturnToTopOnIdle = false; + Buttons.State = ButtonSystemState.TopLevel; + } + } + + private class UIScaleSlider : OsuSliderBar + { + public override LocalisableString TooltipText => base.TooltipText + "x"; + } + private class SampleScreenContainer : CompositeDrawable { + // Minimal isolation from main game. + + [Cached] + [Cached(typeof(IBindable))] + protected readonly Bindable Ruleset = new Bindable(); + + [Cached] + [Cached(typeof(IBindable))] + protected Bindable Beatmap { get; private set; } = new Bindable(); + public override bool HandlePositionalInput => false; public override bool HandleNonPositionalInput => false; public override bool PropagatePositionalInputSubTree => false; public override bool PropagateNonPositionalInputSubTree => false; + [BackgroundDependencyLoader] + private void load(AudioManager audio, TextureStore textures, RulesetStore rulesets) + { + Beatmap.Value = new DummyWorkingBeatmap(audio, textures); + Beatmap.Value.LoadTrack(); + + Ruleset.Value = rulesets.AvailableRulesets.First(); + } + public SampleScreenContainer(Screen screen) { OsuScreenStack stack; @@ -105,6 +147,8 @@ namespace osu.Game.Overlays.FirstRunSetup OsuLogo logo; + Padding = new MarginPadding(5); + InternalChildren = new Drawable[] { new DependencyProvidingContainer @@ -120,7 +164,7 @@ namespace osu.Game.Overlays.FirstRunSetup RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new ScalingContainer(ScalingMode.Off) + new ScalingContainer.ScalingDrawSizePreservingFillContainer(true) { Masking = true, RelativeSizeAxes = Axes.Both, @@ -137,10 +181,5 @@ namespace osu.Game.Overlays.FirstRunSetup stack.Push(screen); } } - - private class UIScaleSlider : OsuSliderBar - { - public override LocalisableString TooltipText => base.TooltipText + "x"; - } } } From 3378c919013f67690a168fddd79d07d9baf2078c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 16:53:41 +0900 Subject: [PATCH 0345/2328] Fix double applied padding --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 00396e6d85..1411539b37 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -165,7 +165,10 @@ namespace osu.Game.Overlays { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding(20), + Padding = new MarginPadding(20) + { + Top = 0 // provided by the stack container above. + }, Child = new GridContainer { RelativeSizeAxes = Axes.X, From e2da1d76ca34999f4e3d45531b65ea8795838299 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 16:59:25 +0900 Subject: [PATCH 0346/2328] Only show first run setup once per install --- osu.Game/Configuration/OsuConfigManager.cs | 3 +++ osu.Game/Overlays/FirstRunSetupOverlay.cs | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 9aacb50684..2c04b03646 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -134,6 +134,8 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.Version, string.Empty); + SetDefault(OsuSetting.ShowFirstRunSetup, true); + SetDefault(OsuSetting.ScreenshotFormat, ScreenshotFormat.Jpg); SetDefault(OsuSetting.ScreenshotCaptureMenuCursor, false); @@ -308,6 +310,7 @@ namespace osu.Game.Configuration BeatmapListingCardSize, ToolbarClockDisplayMode, Version, + ShowFirstRunSetup, ShowConvertedBeatmaps, Skin, ScreenshotFormat, diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 1411539b37..207eeb0f6e 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -6,6 +6,7 @@ using System; using System.Diagnostics; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -15,6 +16,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Framework.Screens; +using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -42,6 +44,9 @@ namespace osu.Game.Overlays [Resolved] private INotificationOverlay notificationOverlay { get; set; } = null!; + [Resolved] + private OsuConfigManager config { get; set; } = null!; + private ScreenStack? stack; public PurpleTriangleButton NextButton = null!; @@ -50,6 +55,8 @@ namespace osu.Game.Overlays [Cached] private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); + private readonly Bindable showFirstRunSetup = new Bindable(); + private int? currentStepIndex; private const float scale_when_hidden = 0.9f; @@ -216,8 +223,13 @@ namespace osu.Game.Overlays { base.LoadComplete(); - // if we are valid for display, only do so after reaching the main menu. - performer.PerformFromScreen(_ => { Show(); }, new[] { typeof(MainMenu) }); + config.BindWith(OsuSetting.ShowFirstRunSetup, showFirstRunSetup); + + if (showFirstRunSetup.Value) + { + // if we are valid for display, only do so after reaching the main menu. + performer.PerformFromScreen(_ => { Show(); }, new[] { typeof(MainMenu) }); + } } public override bool OnPressed(KeyBindingPressEvent e) @@ -330,6 +342,7 @@ namespace osu.Game.Overlays } else { + showFirstRunSetup.Value = false; currentStepIndex = null; Hide(); } From c562004fe9784065fddc14fe56950148ed50eca2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 17:08:38 +0900 Subject: [PATCH 0347/2328] Add test coverage of only showing on first run --- .../TestSceneFirstRunSetupOverlay.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index ff54e34ca0..00f1d4ac4e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -10,6 +10,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Screens; using osu.Framework.Testing; +using osu.Game.Configuration; using osu.Game.Overlays; using osu.Game.Overlays.FirstRunSetup; using osu.Game.Overlays.Notifications; @@ -29,9 +30,12 @@ namespace osu.Game.Tests.Visual.UserInterface private Notification lastNotification; + protected OsuConfigManager LocalConfig; + [BackgroundDependencyLoader] private void load() { + Dependencies.Cache(LocalConfig = new OsuConfigManager(LocalStorage)); Dependencies.CacheAs(performer.Object); Dependencies.CacheAs(notificationOverlay.Object); } @@ -60,6 +64,29 @@ namespace osu.Game.Tests.Visual.UserInterface }); } + [Test] + public void TestDoesntOpenOnSecondRun() + { + AddStep("set first run", () => LocalConfig.SetValue(OsuSetting.ShowFirstRunSetup, true)); + + AddUntilStep("step through", () => + { + if (overlay.CurrentScreen?.IsLoaded != false) overlay.NextButton.TriggerClick(); + return overlay.State.Value == Visibility.Hidden; + }); + + AddAssert("first run false", () => !LocalConfig.Get(OsuSetting.ShowFirstRunSetup)); + + AddStep("add overlay", () => + { + Child = overlay = new FirstRunSetupOverlay(); + }); + + AddWaitStep("wait some", 5); + + AddAssert("overlay didn't show", () => overlay.State.Value == Visibility.Hidden); + } + [TestCase(false)] [TestCase(true)] public void TestOverlayRunsToFinish(bool keyboard) From 17eaa44af1c773d581a8a54455ef505fbf000b4f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 17:40:35 +0900 Subject: [PATCH 0348/2328] Ensure notifications don't interrupt the first run setup process --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 35 +++++++++++++++++++---- osu.Game/Screens/OsuScreen.cs | 2 +- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 207eeb0f6e..b118e61fba 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -74,6 +74,8 @@ namespace osu.Game.Overlays private Container stackContainer = null!; + private Bindable? overlayActivationMode; + public FirstRunSetupOverlay() { RelativeSizeAxes = Axes.Both; @@ -225,11 +227,7 @@ namespace osu.Game.Overlays config.BindWith(OsuSetting.ShowFirstRunSetup, showFirstRunSetup); - if (showFirstRunSetup.Value) - { - // if we are valid for display, only do so after reaching the main menu. - performer.PerformFromScreen(_ => { Show(); }, new[] { typeof(MainMenu) }); - } + if (showFirstRunSetup.Value) Show(); } public override bool OnPressed(KeyBindingPressEvent e) @@ -258,6 +256,26 @@ namespace osu.Game.Overlays return base.OnPressed(e); } + public override void Show() + { + // if we are valid for display, only do so after reaching the main menu. + performer.PerformFromScreen(screen => + { + MainMenu menu = (MainMenu)screen; + + // Eventually I'd like to replace this with a better method that doesn't access the screen. + // Either this dialog would be converted to its own screen, or at very least be "hosted" by a screen pushed to the main menu. + // Alternatively, another method of disabling notifications could be added to `INotificationOverlay`. + if (menu != null) + { + overlayActivationMode = menu.OverlayActivationMode.GetBoundCopy(); + overlayActivationMode.Value = OverlayActivation.UserTriggered; + } + + base.Show(); + }, new[] { typeof(MainMenu) }); + } + protected override void PopIn() { base.PopIn(); @@ -273,6 +291,13 @@ namespace osu.Game.Overlays protected override void PopOut() { + if (overlayActivationMode != null) + { + // If this is non-null we are guaranteed to have come from the main menu. + overlayActivationMode.Value = OverlayActivation.All; + overlayActivationMode = null; + } + if (currentStepIndex != null) { notificationOverlay.Post(new SimpleNotification diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index ed4901e1fa..d87a86cedf 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -48,7 +48,7 @@ namespace osu.Game.Screens /// protected virtual OverlayActivation InitialOverlayActivationMode => OverlayActivation.All; - protected readonly Bindable OverlayActivationMode; + public readonly Bindable OverlayActivationMode; IBindable IOsuScreen.OverlayActivationMode => OverlayActivationMode; From 2a3a0c1cd38dbe61d4941913b18785ed3a5732a6 Mon Sep 17 00:00:00 2001 From: chickensalt Date: Tue, 19 Apr 2022 18:44:20 +1000 Subject: [PATCH 0349/2328] remove notification on trying to multi when logged out fixes #17877 --- osu.Game/Screens/Menu/ButtonSystem.cs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 598c441042..6d09b6de9f 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -161,17 +161,7 @@ namespace osu.Game.Screens.Menu { if (api.State.Value != APIState.Online) { - notifications?.Post(new SimpleNotification - { - Text = "You gotta be online to multi 'yo!", - Icon = FontAwesome.Solid.Globe, - Activated = () => - { - loginOverlay?.Show(); - return true; - } - }); - + loginOverlay?.Show(); return; } From ce70c10afae4bc91f6cb751f8b59fd46c0488689 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 18:00:39 +0900 Subject: [PATCH 0350/2328] Tidy up unused dependencies --- osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs index 52aeb8082e..e632170975 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs @@ -29,11 +29,8 @@ namespace osu.Game.Overlays.FirstRunSetup { public class ScreenUIScale : FirstRunSetupScreen { - [Resolved] - private OsuConfigManager osuConfig { get; set; } - [BackgroundDependencyLoader] - private void load(RulesetStore rulesets, BeatmapManager beatmaps) + private void load(OsuConfigManager config) { Content.Children = new Drawable[] { @@ -46,7 +43,7 @@ namespace osu.Game.Overlays.FirstRunSetup new SettingsSlider { LabelText = GraphicsSettingsStrings.UIScaling, - Current = osuConfig.GetBindable(OsuSetting.UIScale), + Current = config.GetBindable(OsuSetting.UIScale), KeyboardStep = 0.01f, }, new InverseScalingDrawSizePreservingFillContainer From 75a6e9fd7f7bbf82325051c89fe7eab3caa60dcc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 18:10:10 +0900 Subject: [PATCH 0351/2328] Convert to use `nullable` and rearrange fields --- .../Skinning/Legacy/LegacyMainCirclePiece.cs | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs index 9d14041dd8..1fedc7daae 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs @@ -1,7 +1,7 @@ +#nullable enable // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.ObjectExtensions; @@ -33,9 +33,25 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy /// If the "circle" texture could not be found with this prefix, /// then it is nullified and the default prefix "hitcircle" is used instead. /// - private string priorityLookupPrefix; + private string? priorityLookupPrefix; - public LegacyMainCirclePiece(string priorityLookupPrefix = null, bool hasNumber = true) + private Drawable hitCircleSprite = null!; + + protected Container OverlayLayer { get; private set; } = null!; + + private Drawable hitCircleOverlay = null!; + private SkinnableSpriteText hitCircleText = null!; + + private readonly Bindable accentColour = new Bindable(); + private readonly IBindable indexInCurrentCombo = new Bindable(); + + [Resolved(canBeNull: true)] + private DrawableHitObject? drawableObject { get; set; } + + [Resolved] + private ISkinSource skin { get; set; } = null!; + + public LegacyMainCirclePiece(string? priorityLookupPrefix = null, bool hasNumber = true) { this.priorityLookupPrefix = priorityLookupPrefix; this.hasNumber = hasNumber; @@ -43,30 +59,13 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2); } - private Drawable hitCircleSprite; - - protected Container OverlayLayer { get; private set; } - - private Drawable hitCircleOverlay; - private SkinnableSpriteText hitCircleText; - - private readonly Bindable accentColour = new Bindable(); - private readonly IBindable indexInCurrentCombo = new Bindable(); - - [Resolved(canBeNull: true)] - [CanBeNull] - private DrawableHitObject drawableObject { get; set; } - - [Resolved] - private ISkinSource skin { get; set; } - [BackgroundDependencyLoader] private void load() { - var drawableOsuObject = (DrawableOsuHitObject)drawableObject; + var drawableOsuObject = (DrawableOsuHitObject?)drawableObject; // attempt lookup using priority specification - Texture baseTexture = getTexture(string.Empty); + Texture? baseTexture = getTexture(string.Empty); // if the base texture was not found using the priority specification, nullify the specification and fall back to "hitcircle". if (baseTexture == null) @@ -122,10 +121,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable); } - Texture getTexture(string name) + Texture? getTexture(string name) => skin.GetTexture($"{priorityLookupPrefix ?? @"hitcircle"}{name}"); - Drawable getAnimation(string name, double frameLength) + Drawable? getAnimation(string name, double frameLength) => skin.GetAnimation($"{priorityLookupPrefix ?? @"hitcircle"}{name}", true, true, frameLength: frameLength); } From e8adbb319bd1a4d6eb6c16218cda13870a8dcdd4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 22:57:04 +0900 Subject: [PATCH 0352/2328] Skip first run setup in `OsuGameTestScene`s --- osu.Game/Tests/Visual/OsuGameTestScene.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Tests/Visual/OsuGameTestScene.cs b/osu.Game/Tests/Visual/OsuGameTestScene.cs index 34d7723fa3..7a6f8c8cfb 100644 --- a/osu.Game/Tests/Visual/OsuGameTestScene.cs +++ b/osu.Game/Tests/Visual/OsuGameTestScene.cs @@ -156,6 +156,7 @@ namespace osu.Game.Tests.Visual base.LoadComplete(); LocalConfig.SetValue(OsuSetting.IntroSequence, IntroSequence.Circles); + LocalConfig.SetValue(OsuSetting.ShowFirstRunSetup, false); API.Login("Rhythm Champion", "osu!"); From 44c822f34d7a332ba41381d871c42814e9a6daea Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Tue, 19 Apr 2022 16:56:55 +0100 Subject: [PATCH 0353/2328] Use normal `OsuScrollContainer` for `ChannelList` --- .../Overlays/Chat/ChannelList/ChannelList.cs | 28 +------------------ 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 5c2a1ad89f..94c1a99a81 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -40,7 +40,7 @@ namespace osu.Game.Overlays.Chat.ChannelList RelativeSizeAxes = Axes.Both, Colour = colourProvider.Background6, }, - new ChannelListScrollContainer + new OsuScrollContainer { Padding = new MarginPadding { Vertical = 7 }, RelativeSizeAxes = Axes.Both, @@ -131,31 +131,5 @@ namespace osu.Game.Overlays.Chat.ChannelList }); } } - - private class ChannelListScrollContainer : OsuScrollContainer - { - protected override ScrollbarContainer CreateScrollbar(Direction direction) - => new ChannelListScrollBar(direction); - - protected class ChannelListScrollBar : OsuScrollbar - { - private const float bar_size = 4; - private const float bar_margin = 7; - - public ChannelListScrollBar(Direction scrollDir) - : base(scrollDir) - { - Size = new Vector2(bar_size); - Margin = new MarginPadding { Horizontal = bar_margin }; - CornerRadius = 2; - } - - public override void ResizeTo(float val, int duration = 0, Easing easing = Easing.None) - { - Vector2 size = new Vector2(bar_size, val); - this.ResizeTo(size, duration, easing); - } - } - } } } From 033b556be58fe1b780d52d0b6c90b75eaea23f31 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 19 Apr 2022 19:39:06 +0300 Subject: [PATCH 0354/2328] Simplify texture lookup further --- .../Skinning/Legacy/LegacyMainCirclePiece.cs | 35 +++++-------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs index 1fedc7daae..2107de61b6 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs @@ -8,7 +8,6 @@ using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Objects.Drawables; @@ -24,16 +23,12 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy { public override bool RemoveCompletedTransforms => false; - private readonly bool hasNumber; - /// /// A prioritised prefix to perform texture lookups with. /// - /// - /// If the "circle" texture could not be found with this prefix, - /// then it is nullified and the default prefix "hitcircle" is used instead. - /// - private string? priorityLookupPrefix; + private readonly string? priorityLookupPrefix; + + private readonly bool hasNumber; private Drawable hitCircleSprite = null!; @@ -64,23 +59,17 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy { var drawableOsuObject = (DrawableOsuHitObject?)drawableObject; - // attempt lookup using priority specification - Texture? baseTexture = getTexture(string.Empty); - - // if the base texture was not found using the priority specification, nullify the specification and fall back to "hitcircle". - if (baseTexture == null) - { - priorityLookupPrefix = null; - baseTexture = getTexture(string.Empty); - } + // if a base texture for the specified prefix exists, continue using it for subsequent lookups. + // otherwise fall back to the default prefix "hitcircle". + string circleName = (priorityLookupPrefix != null && skin.GetTexture(priorityLookupPrefix) != null) ? priorityLookupPrefix : @"hitcircle"; // at this point, any further texture fetches should be correctly using the priority source if the base texture was retrieved using it. - // the flow above handles the case where a sliderendcircle.png is retrieved from the skin, but sliderendcircleoverlay.png doesn't exist. + // the conditional above handles the case where a sliderendcircle.png is retrieved from the skin, but sliderendcircleoverlay.png doesn't exist. // expected behaviour in this scenario is not showing the overlay, rather than using hitcircleoverlay.png. InternalChildren = new[] { - hitCircleSprite = new KiaiFlashingDrawable(() => new Sprite { Texture = baseTexture }) + hitCircleSprite = new KiaiFlashingDrawable(() => new Sprite { Texture = skin.GetTexture(circleName) }) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -89,7 +78,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Child = hitCircleOverlay = new KiaiFlashingDrawable(() => getAnimation(@"overlay", 1000 / 2d)) + Child = hitCircleOverlay = new KiaiFlashingDrawable(() => skin.GetAnimation(@$"{circleName}overlay", true, true, frameLength: 1000 / 2d)) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -120,12 +109,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy accentColour.BindTo(drawableOsuObject.AccentColour); indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable); } - - Texture? getTexture(string name) - => skin.GetTexture($"{priorityLookupPrefix ?? @"hitcircle"}{name}"); - - Drawable? getAnimation(string name, double frameLength) - => skin.GetAnimation($"{priorityLookupPrefix ?? @"hitcircle"}{name}", true, true, frameLength: frameLength); } protected override void LoadComplete() From 813dc2dd78fd0ba65bcae4caddd289be67447310 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 19 Apr 2022 19:46:29 +0300 Subject: [PATCH 0355/2328] Fix wrong prefix for default priority lookup in test --- osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs b/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs index 766db25d71..c9eeef3c01 100644 --- a/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Osu.Tests // available textures new[] { @"hitcircle", @"hitcircleoverlay" }, // priority lookup - @"", + null, // expected circle and overlay @"hitcircle", @"hitcircleoverlay", }, From a96664295bfd6cec5adc4b9c222ca47707e5f207 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 19 Apr 2022 19:48:44 +0300 Subject: [PATCH 0356/2328] Fix nullability preprocessor placed over the copyright header --- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs index 2107de61b6..db4d643046 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs @@ -1,4 +1,3 @@ -#nullable enable // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. @@ -17,6 +16,8 @@ using osu.Game.Skinning; using osuTK; using osuTK.Graphics; +#nullable enable + namespace osu.Game.Rulesets.Osu.Skinning.Legacy { public class LegacyMainCirclePiece : CompositeDrawable From fd20c2bdcd7c174b27efded6d8e371ec2233ba1f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 20 Apr 2022 00:24:18 +0300 Subject: [PATCH 0357/2328] Change circle/overlay sprite fields to `protected` for better test assertion --- .../LegacyMainCirclePieceTest.cs | 25 ++++++++++++------- .../Skinning/Legacy/LegacyMainCirclePiece.cs | 20 +++++++-------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs b/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs index c9eeef3c01..fd5b6fd752 100644 --- a/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Tests { // available textures new[] { @"hitcircle", @"hitcircleoverlay" }, - // priority lookup + // priority lookup prefix null, // expected circle and overlay @"hitcircle", @"hitcircleoverlay", @@ -66,8 +66,7 @@ namespace osu.Game.Rulesets.Osu.Tests [TestCaseSource(nameof(texture_priority_cases))] public void TestTexturePriorities(string[] textureFilenames, string priorityLookup, string? expectedCircle, string? expectedOverlay) { - Sprite? circleSprite = null; - Sprite? overlaySprite = null; + TestLegacyMainCirclePiece piece = null!; AddStep("load circle piece", () => { @@ -80,18 +79,26 @@ namespace osu.Game.Rulesets.Osu.Tests Child = new DependencyProvidingContainer { CachedDependencies = new (Type, object)[] { (typeof(ISkinSource), skin.Object) }, - Child = new LegacyMainCirclePiece(priorityLookup, false), + Child = piece = new TestLegacyMainCirclePiece(priorityLookup), }; var sprites = this.ChildrenOfType().Where(s => s.Texture.AssetName != null).DistinctBy(s => s.Texture.AssetName).ToArray(); Debug.Assert(sprites.Length <= 2); - - circleSprite = sprites.ElementAtOrDefault(0); - overlaySprite = sprites.ElementAtOrDefault(1); }); - AddAssert("check circle sprite", () => circleSprite?.Texture?.AssetName == expectedCircle); - AddAssert("check overlay sprite", () => overlaySprite?.Texture?.AssetName == expectedOverlay); + AddAssert("check circle sprite", () => piece.CircleSprite?.Texture?.AssetName == expectedCircle); + AddAssert("check overlay sprite", () => piece.OverlaySprite?.Texture?.AssetName == expectedOverlay); + } + + private class TestLegacyMainCirclePiece : LegacyMainCirclePiece + { + public new Sprite? CircleSprite => base.CircleSprite.ChildrenOfType().DistinctBy(s => s.Texture.AssetName).SingleOrDefault(); + public new Sprite? OverlaySprite => base.OverlaySprite.ChildrenOfType().DistinctBy(s => s.Texture.AssetName).SingleOrDefault(); + + public TestLegacyMainCirclePiece(string? priorityLookupPrefix) + : base(priorityLookupPrefix, false) + { + } } } } diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs index db4d643046..391147648f 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs @@ -31,11 +31,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy private readonly bool hasNumber; - private Drawable hitCircleSprite = null!; + protected Drawable CircleSprite = null!; + protected Drawable OverlaySprite = null!; protected Container OverlayLayer { get; private set; } = null!; - private Drawable hitCircleOverlay = null!; private SkinnableSpriteText hitCircleText = null!; private readonly Bindable accentColour = new Bindable(); @@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy InternalChildren = new[] { - hitCircleSprite = new KiaiFlashingDrawable(() => new Sprite { Texture = skin.GetTexture(circleName) }) + CircleSprite = new KiaiFlashingDrawable(() => new Sprite { Texture = skin.GetTexture(circleName) }) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -79,7 +79,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Child = hitCircleOverlay = new KiaiFlashingDrawable(() => skin.GetAnimation(@$"{circleName}overlay", true, true, frameLength: 1000 / 2d)) + Child = OverlaySprite = new KiaiFlashingDrawable(() => skin.GetAnimation(@$"{circleName}overlay", true, true, frameLength: 1000 / 2d)) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -103,7 +103,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy bool overlayAboveNumber = skin.GetConfig(OsuSkinConfiguration.HitCircleOverlayAboveNumber)?.Value ?? true; if (overlayAboveNumber) - OverlayLayer.ChangeChildDepth(hitCircleOverlay, float.MinValue); + OverlayLayer.ChangeChildDepth(OverlaySprite, float.MinValue); if (drawableOsuObject != null) { @@ -116,7 +116,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy { base.LoadComplete(); - accentColour.BindValueChanged(colour => hitCircleSprite.Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue), true); + accentColour.BindValueChanged(colour => CircleSprite.Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue), true); if (hasNumber) indexInCurrentCombo.BindValueChanged(index => hitCircleText.Text = (index.NewValue + 1).ToString(), true); @@ -136,11 +136,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy switch (state) { case ArmedState.Hit: - hitCircleSprite.FadeOut(legacy_fade_duration, Easing.Out); - hitCircleSprite.ScaleTo(1.4f, legacy_fade_duration, Easing.Out); + CircleSprite.FadeOut(legacy_fade_duration, Easing.Out); + CircleSprite.ScaleTo(1.4f, legacy_fade_duration, Easing.Out); - hitCircleOverlay.FadeOut(legacy_fade_duration, Easing.Out); - hitCircleOverlay.ScaleTo(1.4f, legacy_fade_duration, Easing.Out); + OverlaySprite.FadeOut(legacy_fade_duration, Easing.Out); + OverlaySprite.ScaleTo(1.4f, legacy_fade_duration, Easing.Out); if (hasNumber) { From 858c8f927f7baccc9328cb85847d0ea510d2b0a9 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 20 Apr 2022 00:27:02 +0300 Subject: [PATCH 0358/2328] Attach comment explaining purpose of `CallBase` --- osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs b/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs index fd5b6fd752..d8c10b814d 100644 --- a/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs @@ -72,7 +72,11 @@ namespace osu.Game.Rulesets.Osu.Tests { var skin = new Mock(); + // shouldn't be required as GetTexture(string) calls GetTexture(string, WrapMode, WrapMode) by default, + // but moq doesn't handle that well, therefore explicitly requiring to use `CallBase`: + // https://github.com/moq/moq4/issues/972 skin.Setup(s => s.GetTexture(It.IsAny())).CallBase(); + skin.Setup(s => s.GetTexture(It.IsIn(textureFilenames), It.IsAny(), It.IsAny())) .Returns((string componentName, WrapMode _, WrapMode __) => new Texture(1, 1) { AssetName = componentName }); From 4f8065160684cbc49e7a20cad355663e245a5578 Mon Sep 17 00:00:00 2001 From: chickensalt Date: Wed, 20 Apr 2022 10:33:06 +1000 Subject: [PATCH 0359/2328] implement 2a3a0c1 for playlists as well --- osu.Game/Screens/Menu/ButtonSystem.cs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 6d09b6de9f..6d9941ba87 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -172,17 +172,7 @@ namespace osu.Game.Screens.Menu { if (api.State.Value != APIState.Online) { - notifications?.Post(new SimpleNotification - { - Text = "You gotta be online to view playlists 'yo!", - Icon = FontAwesome.Solid.Globe, - Activated = () => - { - loginOverlay?.Show(); - return true; - } - }); - + loginOverlay?.Show(); return; } From f5863c20307b8e4ad8123fb25641b588a782dbd7 Mon Sep 17 00:00:00 2001 From: chickensalt Date: Wed, 20 Apr 2022 13:40:02 +1000 Subject: [PATCH 0360/2328] remove unused import --- osu.Game/Screens/Menu/ButtonSystem.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 6d9941ba87..b59e42551a 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -26,7 +26,6 @@ using osu.Game.Input.Bindings; using osu.Game.Localisation; using osu.Game.Online.API; using osu.Game.Overlays; -using osu.Game.Overlays.Notifications; using osuTK; using osuTK.Graphics; using osuTK.Input; From d46329f55a4fc651b34ac654e963eb79a6e73f23 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Apr 2022 12:51:55 +0900 Subject: [PATCH 0361/2328] Remove unused dependency --- osu.Game/Screens/Menu/ButtonSystem.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index b59e42551a..2d18dce6da 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -116,9 +116,6 @@ namespace osu.Game.Screens.Menu [Resolved] private IAPIProvider api { get; set; } - [Resolved(CanBeNull = true)] - private INotificationOverlay notifications { get; set; } - [Resolved(CanBeNull = true)] private LoginOverlay loginOverlay { get; set; } From 488fc9db67b82baebdc59f71477569960580c439 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Apr 2022 14:48:51 +0900 Subject: [PATCH 0362/2328] Reverse content colours to match design spec --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index b118e61fba..7ad7e6f770 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -143,14 +143,14 @@ namespace osu.Game.Overlays { Text = FirstRunSetupOverlayStrings.FirstRunSetup, Font = OsuFont.Default.With(size: 32), - Colour = colourProvider.Content2, + Colour = colourProvider.Content1, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, new OsuTextFlowContainer { Text = FirstRunSetupOverlayStrings.SetupOsuToSuitYou, - Colour = colourProvider.Content1, + Colour = colourProvider.Content2, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, AutoSizeAxes = Axes.Both, From 9797e2d8871682f9a036a625e5230f324788ec52 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Apr 2022 14:49:17 +0900 Subject: [PATCH 0363/2328] Rename `showLastStep` method to avoid ambiguity --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 7ad7e6f770..0e8919fd82 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -200,7 +200,7 @@ namespace osu.Game.Overlays { Width = 200, Text = CommonStrings.Back, - Action = showLastStep, + Action = showPreviousStep, Enabled = { Value = false }, }, Empty(), @@ -336,7 +336,7 @@ namespace osu.Game.Overlays showNextStep(); } - private void showLastStep() + private void showPreviousStep() { if (currentStepIndex == 0) return; From 66373bf038f01e1ff5b26bdc134530db504ff6c4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Apr 2022 14:50:41 +0900 Subject: [PATCH 0364/2328] Move back button enable handling to shared method --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 0e8919fd82..c74adbabae 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -346,8 +346,6 @@ namespace osu.Game.Overlays stack.CurrentScreen.Exit(); currentStepIndex--; - BackButton.Enabled.Value = currentStepIndex != 0; - updateButtonText(); } @@ -358,8 +356,6 @@ namespace osu.Game.Overlays currentStepIndex++; - BackButton.Enabled.Value = currentStepIndex > 0; - if (currentStepIndex < steps.Length) { stack.Push((Screen)Activator.CreateInstance(steps[currentStepIndex.Value].ScreenType)); @@ -377,6 +373,8 @@ namespace osu.Game.Overlays { Debug.Assert(currentStepIndex != null); + BackButton.Enabled.Value = currentStepIndex != 0; + NextButton.Text = currentStepIndex + 1 < steps.Length ? FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].Description) : CommonStrings.Finish; From 7e7fa633f0b2fdde41d9a22c4ce052cb46762201 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Apr 2022 14:51:16 +0900 Subject: [PATCH 0365/2328] Use direct localised string reference in test --- .../Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index 00f1d4ac4e..8a9ed50725 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Configuration; +using osu.Game.Localisation; using osu.Game.Overlays; using osu.Game.Overlays.FirstRunSetup; using osu.Game.Overlays.Notifications; @@ -126,7 +127,7 @@ namespace osu.Game.Tests.Visual.UserInterface if (overlay.CurrentScreen?.IsLoaded != false) nextButton.TriggerClick(); - return nextButton.Text.ToString() == "Finish"; + return nextButton.Text.ToString() == CommonStrings.Finish; }); AddUntilStep("step back to start", () => From 8d31b0bc015461a5c05bb7e0ff9747823cdded5e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Apr 2022 15:05:07 +0900 Subject: [PATCH 0366/2328] Split out the base design of sheared overlay into its own abstract class This will allow for reuse with the first-run overlay. --- .../UserInterface/PopupScreenTitle.cs | 4 +- osu.Game/Overlays/Mods/ModSelectScreen.cs | 101 ++++--------- .../Overlays/Mods/ShearedOverlayContainer.cs | 136 ++++++++++++++++++ 3 files changed, 165 insertions(+), 76 deletions(-) create mode 100644 osu.Game/Overlays/Mods/ShearedOverlayContainer.cs diff --git a/osu.Game/Graphics/UserInterface/PopupScreenTitle.cs b/osu.Game/Graphics/UserInterface/PopupScreenTitle.cs index 5b7db09e77..2e5519726b 100644 --- a/osu.Game/Graphics/UserInterface/PopupScreenTitle.cs +++ b/osu.Game/Graphics/UserInterface/PopupScreenTitle.cs @@ -21,6 +21,8 @@ namespace osu.Game.Graphics.UserInterface { public class PopupScreenTitle : CompositeDrawable { + public const float HEIGHT = main_area_height + 2 * corner_radius; + public LocalisableString Title { set => titleSpriteText.Text = value; @@ -67,7 +69,7 @@ namespace osu.Game.Graphics.UserInterface underlayContainer = new Container { RelativeSizeAxes = Axes.X, - Height = main_area_height + 2 * corner_radius, + Height = HEIGHT, CornerRadius = corner_radius, Masking = true, BorderThickness = 2, diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 62080ec1b5..6e8684478e 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -9,7 +9,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Framework.Layout; using osu.Game.Configuration; @@ -21,39 +20,27 @@ using osuTK.Input; namespace osu.Game.Overlays.Mods { - public class ModSelectScreen : OsuFocusedOverlayContainer + public class ModSelectScreen : ShearedOverlayContainer { - [Cached] - private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); + protected override OverlayColourScheme ColourScheme => OverlayColourScheme.Green; [Cached] public Bindable> SelectedMods { get; private set; } = new Bindable>(Array.Empty()); - protected override bool StartHidden => true; - private readonly BindableBool customisationVisible = new BindableBool(); private DifficultyMultiplierDisplay multiplierDisplay; private ModSettingsArea modSettingsArea; private FillFlowContainer columnFlow; private GridContainer grid; - private Container mainContent; - - private PopupScreenTitle header; - private Container footer; [BackgroundDependencyLoader] private void load() { - RelativeSizeAxes = Axes.Both; - RelativePositionAxes = Axes.Both; - - InternalChildren = new Drawable[] + MainAreaContent.AddRange(new Drawable[] { - mainContent = new Container + new Container { - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, RelativeSizeAxes = Axes.Both, Children = new Drawable[] { @@ -62,24 +49,11 @@ namespace osu.Game.Overlays.Mods RelativeSizeAxes = Axes.Both, RowDimensions = new[] { - new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.AutoSize), new Dimension(), - new Dimension(GridSizeMode.Absolute, 75), }, Content = new[] { - new Drawable[] - { - header = new PopupScreenTitle - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Title = "Mod Select", - Description = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play. Others are just for fun.", - Close = Hide - } - }, new Drawable[] { new Container @@ -120,6 +94,7 @@ namespace osu.Game.Overlays.Mods Child = columnFlow = new ModColumnContainer { Direction = FillDirection.Horizontal, + Shear = new Vector2(ModPanel.SHEAR_X, 0), RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Spacing = new Vector2(10, 0), @@ -137,52 +112,36 @@ namespace osu.Game.Overlays.Mods } } }, - new[] { Empty() } } }, - footer = new Container - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.X, - Height = 50, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - Colour = colourProvider.Background5 - }, - new ShearedToggleButton(200) - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Margin = new MarginPadding { Vertical = 14, Left = 70 }, - Text = "Mod Customisation", - Active = { BindTarget = customisationVisible } - } - } - }, - new ClickToReturnContainer - { - RelativeSizeAxes = Axes.Both, - HandleMouse = { BindTarget = customisationVisible }, - OnClicked = () => customisationVisible.Value = false - } } }, + }); + + Footer.Add(new ShearedToggleButton(200) + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Margin = new MarginPadding { Vertical = 14, Left = 70 }, + Text = "Mod Customisation", + Active = { BindTarget = customisationVisible } + }); + + AddRange(new Drawable[] + { + new ClickToReturnContainer + { + RelativeSizeAxes = Axes.Both, + HandleMouse = { BindTarget = customisationVisible }, + OnClicked = () => customisationVisible.Value = false + }, modSettingsArea = new ModSettingsArea { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Height = 0 } - }; - - columnFlow.Shear = new Vector2(ModPanel.SHEAR_X, 0); + }); } protected override void LoadComplete() @@ -252,7 +211,7 @@ namespace osu.Game.Overlays.Mods float modAreaHeight = customisationVisible.Value ? ModSettingsArea.HEIGHT : 0; modSettingsArea.ResizeHeightTo(modAreaHeight, transition_duration, Easing.InOutCubic); - mainContent.TransformTo(nameof(Margin), new MarginPadding { Bottom = modAreaHeight }, transition_duration, Easing.InOutCubic); + TopLevelContent.MoveToY(-modAreaHeight, transition_duration, Easing.InOutCubic); } private bool selectionBindableSyncInProgress; @@ -287,10 +246,6 @@ namespace osu.Game.Overlays.Mods const double fade_in_duration = 400; base.PopIn(); - this.FadeIn(fade_in_duration, Easing.OutQuint); - - header.MoveToY(0, fade_in_duration, Easing.OutQuint); - footer.MoveToY(0, fade_in_duration, Easing.OutQuint); multiplierDisplay .Delay(fade_in_duration * 0.65f) @@ -311,15 +266,11 @@ namespace osu.Game.Overlays.Mods const double fade_out_duration = 500; base.PopOut(); - this.FadeOut(fade_out_duration, Easing.OutQuint); multiplierDisplay .FadeOut(fade_out_duration / 2, Easing.OutQuint) .ScaleTo(0.75f, fade_out_duration, Easing.OutQuint); - header.MoveToY(-header.DrawHeight, fade_out_duration, Easing.OutQuint); - footer.MoveToY(footer.DrawHeight, fade_out_duration, Easing.OutQuint); - for (int i = 0; i < columnFlow.Count; i++) { const float distance = 700; diff --git a/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs new file mode 100644 index 0000000000..46a3ad3c8d --- /dev/null +++ b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs @@ -0,0 +1,136 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Overlays.Mods +{ + /// + /// A sheared overlay which provides a header and footer and basic animations. + /// Exposes , and as valid targets for content. + /// + public abstract class ShearedOverlayContainer : OsuFocusedOverlayContainer + { + [Cached] + protected readonly OverlayColourProvider ColourProvider; + + /// + /// The overlay's header. + /// + protected PopupScreenTitle Header { get; private set; } + + /// + /// The overlay's footer. + /// + protected Container Footer { get; private set; } + + /// + /// A container containing all content, including the header and footer. + /// May be used for overlay-wide animations. + /// + protected Container TopLevelContent { get; private set; } + + /// + /// A container for content that is to be displayed between the header and footer. + /// + protected Container MainAreaContent { get; private set; } + + /// + /// A container for content that is to be displayed inside the footer. + /// + protected Container FooterContent { get; private set; } + + protected abstract OverlayColourScheme ColourScheme { get; } + + protected override bool StartHidden => true; + + protected override bool BlockNonPositionalInput => true; + + protected ShearedOverlayContainer() + { + RelativeSizeAxes = Axes.Both; + + ColourProvider = new OverlayColourProvider(ColourScheme); + } + + [BackgroundDependencyLoader] + private void load() + { + const float footer_height = 50; + + Child = TopLevelContent = new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + Header = new PopupScreenTitle + { + Anchor = Anchor.TopCentre, + Depth = float.MinValue, + Origin = Anchor.TopCentre, + Title = "Mod Select", + Description = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play. Others are just for fun.", + Close = Hide + }, + MainAreaContent = new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding + { + Top = PopupScreenTitle.HEIGHT, + Bottom = footer_height, + } + }, + Footer = new Container + { + RelativeSizeAxes = Axes.X, + Depth = float.MinValue, + Height = footer_height, + Margin = new MarginPadding { Top = 10 }, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = ColourProvider.Background5 + }, + FooterContent = new Container + { + RelativeSizeAxes = Axes.Both, + }, + } + } + } + }; + } + + protected override void PopIn() + { + const double fade_in_duration = 400; + + base.PopIn(); + this.FadeIn(fade_in_duration, Easing.OutQuint); + + Header.MoveToY(0, fade_in_duration, Easing.OutQuint); + Footer.MoveToY(0, fade_in_duration, Easing.OutQuint); + } + + protected override void PopOut() + { + const double fade_out_duration = 500; + + base.PopOut(); + this.FadeOut(fade_out_duration, Easing.OutQuint); + + Header.MoveToY(-Header.DrawHeight, fade_out_duration, Easing.OutQuint); + Footer.MoveToY(Footer.DrawHeight, fade_out_duration, Easing.OutQuint); + } + } +} From 1032dc235dae06d61460c0fd019472bb4994ad04 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Apr 2022 15:50:57 +0900 Subject: [PATCH 0367/2328] Rename `PopupScreenTitle` to `ShearedOverlayHeader` --- ...reenTitle.cs => TestSceneShearedOverlayHeader.cs} | 12 ++++++------ .../{PopupScreenTitle.cs => ShearedOverlayHeader.cs} | 4 ++-- osu.Game/Overlays/Mods/ShearedOverlayContainer.cs | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) rename osu.Game.Tests/Visual/UserInterface/{TestScenePopupScreenTitle.cs => TestSceneShearedOverlayHeader.cs} (76%) rename osu.Game/Graphics/UserInterface/{PopupScreenTitle.cs => ShearedOverlayHeader.cs} (98%) diff --git a/osu.Game.Tests/Visual/UserInterface/TestScenePopupScreenTitle.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayHeader.cs similarity index 76% rename from osu.Game.Tests/Visual/UserInterface/TestScenePopupScreenTitle.cs rename to osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayHeader.cs index 22a8fa8a46..ef2b25cd92 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestScenePopupScreenTitle.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayHeader.cs @@ -10,19 +10,19 @@ using osu.Game.Overlays; namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] - public class TestScenePopupScreenTitle : OsuTestScene + public class TestSceneShearedOverlayHeader : OsuTestScene { [Cached] private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); [Test] - public void TestPopupScreenTitle() + public void TestShearedOverlayHeader() { AddStep("create content", () => { - Child = new PopupScreenTitle + Child = new ShearedOverlayHeader { - Title = "Popup Screen Title", + Title = "Sheared overlay header", Description = string.Join(" ", Enumerable.Repeat("This is a description.", 20)), Close = () => { } }; @@ -34,9 +34,9 @@ namespace osu.Game.Tests.Visual.UserInterface { AddStep("create content", () => { - Child = new PopupScreenTitle + Child = new ShearedOverlayHeader { - Title = "Popup Screen Title", + Title = "Sheared overlay header", Description = "This is a description." }; }); diff --git a/osu.Game/Graphics/UserInterface/PopupScreenTitle.cs b/osu.Game/Graphics/UserInterface/ShearedOverlayHeader.cs similarity index 98% rename from osu.Game/Graphics/UserInterface/PopupScreenTitle.cs rename to osu.Game/Graphics/UserInterface/ShearedOverlayHeader.cs index 2e5519726b..9ed7bb35de 100644 --- a/osu.Game/Graphics/UserInterface/PopupScreenTitle.cs +++ b/osu.Game/Graphics/UserInterface/ShearedOverlayHeader.cs @@ -19,7 +19,7 @@ using osuTK; namespace osu.Game.Graphics.UserInterface { - public class PopupScreenTitle : CompositeDrawable + public class ShearedOverlayHeader : CompositeDrawable { public const float HEIGHT = main_area_height + 2 * corner_radius; @@ -50,7 +50,7 @@ namespace osu.Game.Graphics.UserInterface private readonly OsuTextFlowContainer descriptionText; private readonly IconButton closeButton; - public PopupScreenTitle() + public ShearedOverlayHeader() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; diff --git a/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs index 46a3ad3c8d..b6f6cf1468 100644 --- a/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs +++ b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Mods /// /// The overlay's header. /// - protected PopupScreenTitle Header { get; private set; } + protected ShearedOverlayHeader Header { get; private set; } /// /// The overlay's footer. @@ -68,7 +68,7 @@ namespace osu.Game.Overlays.Mods RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - Header = new PopupScreenTitle + Header = new ShearedOverlayHeader { Anchor = Anchor.TopCentre, Depth = float.MinValue, @@ -82,7 +82,7 @@ namespace osu.Game.Overlays.Mods RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { - Top = PopupScreenTitle.HEIGHT, + Top = ShearedOverlayHeader.HEIGHT, Bottom = footer_height, } }, From 2ee37aeceb5c30f1f36eaa94707a02484f4c217e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Apr 2022 15:57:45 +0900 Subject: [PATCH 0368/2328] Reduce nesting and usage of `GridContainer` --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 159 +++++++++------------- 1 file changed, 67 insertions(+), 92 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 6e8684478e..452c6e32a6 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -32,101 +32,10 @@ namespace osu.Game.Overlays.Mods private DifficultyMultiplierDisplay multiplierDisplay; private ModSettingsArea modSettingsArea; private FillFlowContainer columnFlow; - private GridContainer grid; [BackgroundDependencyLoader] private void load() { - MainAreaContent.AddRange(new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - grid = new GridContainer - { - RelativeSizeAxes = Axes.Both, - RowDimensions = new[] - { - new Dimension(GridSizeMode.AutoSize), - new Dimension(), - }, - Content = new[] - { - new Drawable[] - { - new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.X, - RelativePositionAxes = Axes.X, - X = 0.3f, - Height = DifficultyMultiplierDisplay.HEIGHT, - Margin = new MarginPadding - { - Horizontal = 100, - Vertical = 10 - }, - Child = multiplierDisplay = new DifficultyMultiplierDisplay - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre - } - } - }, - new Drawable[] - { - new Container - { - Depth = float.MaxValue, - RelativeSizeAxes = Axes.Both, - RelativePositionAxes = Axes.Both, - Children = new Drawable[] - { - new OsuScrollContainer(Direction.Horizontal) - { - RelativeSizeAxes = Axes.Both, - Masking = false, - ClampExtension = 100, - ScrollbarOverlapsContent = false, - Child = columnFlow = new ModColumnContainer - { - Direction = FillDirection.Horizontal, - Shear = new Vector2(ModPanel.SHEAR_X, 0), - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, - Spacing = new Vector2(10, 0), - Margin = new MarginPadding { Right = 70 }, - Children = new[] - { - new ModColumn(ModType.DifficultyReduction, false, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }), - new ModColumn(ModType.DifficultyIncrease, false, new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }), - new ModColumn(ModType.Automation, false, new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }), - new ModColumn(ModType.Conversion, false), - new ModColumn(ModType.Fun, false) - } - } - } - } - } - }, - } - }, - } - }, - }); - - Footer.Add(new ShearedToggleButton(200) - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Margin = new MarginPadding { Vertical = 14, Left = 70 }, - Text = "Mod Customisation", - Active = { BindTarget = customisationVisible } - }); - AddRange(new Drawable[] { new ClickToReturnContainer @@ -142,6 +51,72 @@ namespace osu.Game.Overlays.Mods Height = 0 } }); + + MainAreaContent.AddRange(new Drawable[] + { + new Container + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.X, + Height = DifficultyMultiplierDisplay.HEIGHT, + Margin = new MarginPadding + { + Horizontal = 100, + }, + Child = multiplierDisplay = new DifficultyMultiplierDisplay + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + } + }, + new Container + { + Margin = new MarginPadding + { + Vertical = DifficultyMultiplierDisplay.HEIGHT + 10, + }, + Depth = float.MaxValue, + RelativeSizeAxes = Axes.Both, + RelativePositionAxes = Axes.Both, + Children = new Drawable[] + { + new OsuScrollContainer(Direction.Horizontal) + { + RelativeSizeAxes = Axes.Both, + Masking = false, + ClampExtension = 100, + ScrollbarOverlapsContent = false, + Child = columnFlow = new ModColumnContainer + { + Direction = FillDirection.Horizontal, + Shear = new Vector2(ModPanel.SHEAR_X, 0), + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Spacing = new Vector2(10, 0), + Margin = new MarginPadding { Right = 70 }, + Children = new[] + { + new ModColumn(ModType.DifficultyReduction, false, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }), + new ModColumn(ModType.DifficultyIncrease, false, new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }), + new ModColumn(ModType.Automation, false, new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }), + new ModColumn(ModType.Conversion, false), + new ModColumn(ModType.Fun, false) + } + } + } + } + } + }); + + Footer.Add(new ShearedToggleButton(200) + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Margin = new MarginPadding { Vertical = 14, Left = 70 }, + Text = "Mod Customisation", + Active = { BindTarget = customisationVisible } + }); } protected override void LoadComplete() @@ -206,7 +181,7 @@ namespace osu.Game.Overlays.Mods { const double transition_duration = 300; - grid.FadeColour(customisationVisible.Value ? Colour4.Gray : Colour4.White, transition_duration, Easing.InOutCubic); + MainAreaContent.FadeColour(customisationVisible.Value ? Colour4.Gray : Colour4.White, transition_duration, Easing.InOutCubic); float modAreaHeight = customisationVisible.Value ? ModSettingsArea.HEIGHT : 0; From 5c7ff363ce406ca8ef4c6c21bc6f76eb7b42f58d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Apr 2022 16:08:00 +0900 Subject: [PATCH 0369/2328] Move title/description to correct class --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 3 +++ osu.Game/Overlays/Mods/ShearedOverlayContainer.cs | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 452c6e32a6..7c857d5a90 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -36,6 +36,9 @@ namespace osu.Game.Overlays.Mods [BackgroundDependencyLoader] private void load() { + Header.Title = "Mod Select"; + Header.Description = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play. Others are just for fun."; + AddRange(new Drawable[] { new ClickToReturnContainer diff --git a/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs index b6f6cf1468..76a81421fa 100644 --- a/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs +++ b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs @@ -73,8 +73,6 @@ namespace osu.Game.Overlays.Mods Anchor = Anchor.TopCentre, Depth = float.MinValue, Origin = Anchor.TopCentre, - Title = "Mod Select", - Description = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play. Others are just for fun.", Close = Hide }, MainAreaContent = new Container From e17f224793bc31ebf92b8ae5113f221d61d908b0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Apr 2022 16:28:52 +0900 Subject: [PATCH 0370/2328] Fix padding mismatches --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 6 +++--- osu.Game/Overlays/Mods/ShearedOverlayContainer.cs | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 7c857d5a90..a9992d70bc 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -75,9 +75,9 @@ namespace osu.Game.Overlays.Mods }, new Container { - Margin = new MarginPadding + Padding = new MarginPadding { - Vertical = DifficultyMultiplierDisplay.HEIGHT + 10, + Top = DifficultyMultiplierDisplay.HEIGHT + PADDING, }, Depth = float.MaxValue, RelativeSizeAxes = Axes.Both, @@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Mods { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - Margin = new MarginPadding { Vertical = 14, Left = 70 }, + Margin = new MarginPadding { Vertical = PADDING, Left = 70 }, Text = "Mod Customisation", Active = { BindTarget = customisationVisible } }); diff --git a/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs index 76a81421fa..0bdd4189a0 100644 --- a/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs +++ b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs @@ -16,6 +16,8 @@ namespace osu.Game.Overlays.Mods /// public abstract class ShearedOverlayContainer : OsuFocusedOverlayContainer { + protected const float PADDING = 14; + [Cached] protected readonly OverlayColourProvider ColourProvider; @@ -81,7 +83,7 @@ namespace osu.Game.Overlays.Mods Padding = new MarginPadding { Top = ShearedOverlayHeader.HEIGHT, - Bottom = footer_height, + Bottom = footer_height + PADDING, } }, Footer = new Container @@ -89,7 +91,7 @@ namespace osu.Game.Overlays.Mods RelativeSizeAxes = Axes.X, Depth = float.MinValue, Height = footer_height, - Margin = new MarginPadding { Top = 10 }, + Margin = new MarginPadding { Top = PADDING }, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Children = new Drawable[] From 65b2db5e71fc86dab1d1f2c7416123f002c83d93 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Apr 2022 16:30:58 +0900 Subject: [PATCH 0371/2328] Move shear constant to overlay (this is going to likely be used everywhere ever) --- osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs | 6 +++--- osu.Game/Overlays/Mods/ModColumn.cs | 8 ++++---- osu.Game/Overlays/Mods/ModPanel.cs | 11 +++++------ osu.Game/Overlays/Mods/ModSelectScreen.cs | 4 ++-- osu.Game/Overlays/Mods/ShearedOverlayContainer.cs | 2 ++ 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs b/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs index 248d4f288e..66fd6a202d 100644 --- a/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs +++ b/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs @@ -58,7 +58,7 @@ namespace osu.Game.Overlays.Mods AutoSizeAxes = Axes.X, Masking = true, CornerRadius = ModPanel.CORNER_RADIUS, - Shear = new Vector2(ModPanel.SHEAR_X, 0), + Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0), Children = new Drawable[] { underlayBackground = new Box @@ -98,7 +98,7 @@ namespace osu.Game.Overlays.Mods Anchor = Anchor.Centre, Origin = Anchor.Centre, Margin = new MarginPadding { Horizontal = 18 }, - Shear = new Vector2(-ModPanel.SHEAR_X, 0), + Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0), Text = "Difficulty Multiplier", Font = OsuFont.Default.With(size: 17, weight: FontWeight.SemiBold) } @@ -109,7 +109,7 @@ namespace osu.Game.Overlays.Mods AutoSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Shear = new Vector2(-ModPanel.SHEAR_X, 0), + Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0), Direction = FillDirection.Horizontal, Spacing = new Vector2(2, 0), Children = new Drawable[] diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index f84ae4ac8a..78b4e24a4e 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -79,7 +79,7 @@ namespace osu.Game.Overlays.Mods Width = 320; RelativeSizeAxes = Axes.Y; - Shear = new Vector2(ModPanel.SHEAR_X, 0); + Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0); Container controlContainer; InternalChildren = new Drawable[] @@ -113,7 +113,7 @@ namespace osu.Game.Overlays.Mods AutoSizeAxes = Axes.Y, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Shear = new Vector2(-ModPanel.SHEAR_X, 0), + Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0), Padding = new MarginPadding { Horizontal = 17, @@ -193,7 +193,7 @@ namespace osu.Game.Overlays.Mods Scale = new Vector2(0.8f), RelativeSizeAxes = Axes.X, LabelText = "Enable All", - Shear = new Vector2(-ModPanel.SHEAR_X, 0) + Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0) }); panelFlow.Padding = new MarginPadding { @@ -260,7 +260,7 @@ namespace osu.Game.Overlays.Mods var panels = newMods.Select(mod => new ModPanel(mod) { - Shear = new Vector2(-ModPanel.SHEAR_X, 0) + Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0) }); Task? loadTask; diff --git a/osu.Game/Overlays/Mods/ModPanel.cs b/osu.Game/Overlays/Mods/ModPanel.cs index 312171cf74..7c4f2dcb7e 100644 --- a/osu.Game/Overlays/Mods/ModPanel.cs +++ b/osu.Game/Overlays/Mods/ModPanel.cs @@ -42,7 +42,6 @@ namespace osu.Game.Overlays.Mods protected const double TRANSITION_DURATION = 150; - public const float SHEAR_X = 0.2f; public const float CORNER_RADIUS = 7; protected const float HEIGHT = 42; @@ -67,7 +66,7 @@ namespace osu.Game.Overlays.Mods Content.Masking = true; Content.CornerRadius = CORNER_RADIUS; Content.BorderThickness = 2; - Content.Shear = new Vector2(SHEAR_X, 0); + Content.Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0); Children = new Drawable[] { @@ -83,7 +82,7 @@ namespace osu.Game.Overlays.Mods Anchor = Anchor.Centre, Origin = Anchor.Centre, Active = { BindTarget = Active }, - Shear = new Vector2(-SHEAR_X, 0), + Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0), Scale = new Vector2(HEIGHT / ModSwitchSmall.DEFAULT_SIZE) } }, @@ -116,10 +115,10 @@ namespace osu.Game.Overlays.Mods { Text = mod.Name, Font = OsuFont.TorusAlternate.With(size: 18, weight: FontWeight.SemiBold), - Shear = new Vector2(-SHEAR_X, 0), + Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0), Margin = new MarginPadding { - Left = -18 * SHEAR_X + Left = -18 * ShearedOverlayContainer.SHEAR } }, new OsuSpriteText @@ -128,7 +127,7 @@ namespace osu.Game.Overlays.Mods Font = OsuFont.Default.With(size: 12), RelativeSizeAxes = Axes.X, Truncate = true, - Shear = new Vector2(-SHEAR_X, 0) + Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0) } } } diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index a9992d70bc..94f877a08c 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -93,7 +93,7 @@ namespace osu.Game.Overlays.Mods Child = columnFlow = new ModColumnContainer { Direction = FillDirection.Horizontal, - Shear = new Vector2(ModPanel.SHEAR_X, 0), + Shear = new Vector2(SHEAR, 0), RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Spacing = new Vector2(10, 0), @@ -284,7 +284,7 @@ namespace osu.Game.Overlays.Mods { Padding = new MarginPadding { - Left = DrawHeight * ModPanel.SHEAR_X, + Left = DrawHeight * SHEAR, Bottom = 10 }; diff --git a/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs index 0bdd4189a0..62ed736dc2 100644 --- a/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs +++ b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs @@ -18,6 +18,8 @@ namespace osu.Game.Overlays.Mods { protected const float PADDING = 14; + public const float SHEAR = 0.2f; + [Cached] protected readonly OverlayColourProvider ColourProvider; From 8c2d70e93fb01036538638dc50f399cc0bffa023 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Apr 2022 17:50:31 +0900 Subject: [PATCH 0372/2328] Disable forward button when already at end --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index c74adbabae..d5aa1178e0 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -346,7 +346,7 @@ namespace osu.Game.Overlays stack.CurrentScreen.Exit(); currentStepIndex--; - updateButtonText(); + updateButtons(); } private void showNextStep() @@ -359,7 +359,6 @@ namespace osu.Game.Overlays if (currentStepIndex < steps.Length) { stack.Push((Screen)Activator.CreateInstance(steps[currentStepIndex.Value].ScreenType)); - updateButtonText(); } else { @@ -367,17 +366,21 @@ namespace osu.Game.Overlays currentStepIndex = null; Hide(); } + + updateButtons(); } - private void updateButtonText() + private void updateButtons() { - Debug.Assert(currentStepIndex != null); + BackButton.Enabled.Value = currentStepIndex > 0; + NextButton.Enabled.Value = currentStepIndex != null; - BackButton.Enabled.Value = currentStepIndex != 0; - - NextButton.Text = currentStepIndex + 1 < steps.Length - ? FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].Description) - : CommonStrings.Finish; + if (currentStepIndex != null) + { + NextButton.Text = currentStepIndex + 1 < steps.Length + ? FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].Description) + : CommonStrings.Finish; + } } private class FirstRunStep From 2906af323af33c835473b28bdc67ff88cb168cb1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Apr 2022 17:51:08 +0900 Subject: [PATCH 0373/2328] Fix incorrectly written string equality logic --- .../Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index 8a9ed50725..efce4f350b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -127,7 +127,7 @@ namespace osu.Game.Tests.Visual.UserInterface if (overlay.CurrentScreen?.IsLoaded != false) nextButton.TriggerClick(); - return nextButton.Text.ToString() == CommonStrings.Finish; + return nextButton.Text == CommonStrings.Finish; }); AddUntilStep("step back to start", () => From 4466e15bfcf3a0b7c93ba3c9cfc1da87509a6393 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Apr 2022 23:17:29 +0900 Subject: [PATCH 0374/2328] Rename `AllowConfiguration` to `AllowCustomisation` and simplify drawable addition --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 57 ++++++++++--------- .../Screens/OnlinePlay/FreeModSelectScreen.cs | 2 +- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 41cbfdafb3..693c85fafc 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -46,7 +46,7 @@ namespace osu.Game.Overlays.Mods /// /// Whether configurable s can be configured by the local user. /// - protected virtual bool AllowConfiguration => true; + protected virtual bool AllowCustomisation => true; /// /// Whether the total score multiplier calculated from the current selected set of mods should be shown. @@ -85,29 +85,12 @@ namespace osu.Game.Overlays.Mods MainAreaContent.AddRange(new Drawable[] { - new Container - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - AutoSizeAxes = Axes.X, - Height = DifficultyMultiplierDisplay.HEIGHT, - Margin = new MarginPadding - { - Horizontal = 100, - }, - Child = multiplierDisplay = new DifficultyMultiplierDisplay - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre - } - }, new Container { Padding = new MarginPadding { - Top = DifficultyMultiplierDisplay.HEIGHT + PADDING, + Top = (ShowTotalMultiplier ? DifficultyMultiplierDisplay.HEIGHT : 0) + PADDING, }, - Depth = float.MaxValue, RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Children = new Drawable[] @@ -140,14 +123,34 @@ namespace osu.Game.Overlays.Mods } }); - Footer.Add(new ShearedToggleButton(200) + if (ShowTotalMultiplier) { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Margin = new MarginPadding { Vertical = PADDING, Left = 70 }, - Text = "Mod Customisation", - Active = { BindTarget = customisationVisible } - }); + MainAreaContent.Add(new Container + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.X, + Height = DifficultyMultiplierDisplay.HEIGHT, + Margin = new MarginPadding { Horizontal = 100 }, + Child = multiplierDisplay = new DifficultyMultiplierDisplay + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }, + }); + } + + if (AllowCustomisation) + { + Footer.Add(new ShearedToggleButton(200) + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Margin = new MarginPadding { Vertical = PADDING, Left = 70 }, + Text = "Mod Customisation", + Active = { BindTarget = customisationVisible } + }); + } } protected override void LoadComplete() @@ -194,7 +197,7 @@ namespace osu.Game.Overlays.Mods private void updateCustomisation(ValueChangedEvent> valueChangedEvent) { - if (!AllowConfiguration) + if (!AllowCustomisation) return; bool anyCustomisableMod = false; diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs index 438b334e0b..c85a4fc38b 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs @@ -10,7 +10,7 @@ namespace osu.Game.Screens.OnlinePlay { public class FreeModSelectScreen : ModSelectScreen { - protected override bool AllowConfiguration => false; + protected override bool AllowCustomisation => false; protected override bool ShowTotalMultiplier => false; public new Func IsValidMod From e596c9d1713f82f3000f1c5029ee20d4a96ebdb3 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 20 Apr 2022 19:12:43 +0100 Subject: [PATCH 0375/2328] Use `Bindable` to control selector active visibility --- .../Visual/Online/TestSceneChannelList.cs | 9 +++-- .../Overlays/Chat/ChannelList/ChannelList.cs | 8 +++- .../Chat/ChannelList/ChannelListItem.cs | 38 +++++++++++-------- .../Chat/ChannelList/ChannelListSelector.cs | 14 ++++++- 4 files changed, 46 insertions(+), 23 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs index d6a1e71f0d..2bfe42e6d4 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs @@ -25,6 +25,9 @@ namespace osu.Game.Tests.Visual.Online [Cached] private readonly Bindable selected = new Bindable(); + [Cached] + private readonly Bindable selector = new Bindable(); + private OsuSpriteText selectorText; private OsuSpriteText selectedText; private OsuSpriteText leaveText; @@ -89,7 +92,7 @@ namespace osu.Game.Tests.Visual.Online channelList.OnRequestSelect += channel => { - channelList.SelectorActive.Value = false; + selector.Value = ChannelSelectorState.Hidden; selected.Value = channel; }; @@ -101,9 +104,9 @@ namespace osu.Game.Tests.Visual.Online channelList.RemoveChannel(channel); }; - channelList.SelectorActive.BindValueChanged(change => + selector.BindValueChanged(change => { - selectorText.Text = $"Channel Selector Active: {change.NewValue}"; + selectorText.Text = $"Channel Selector State: {change.NewValue}"; }, true); selected.BindValueChanged(change => diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 94c1a99a81..578ac2aa45 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -14,7 +14,6 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; -using osuTK; namespace osu.Game.Overlays.Chat.ChannelList { @@ -57,7 +56,6 @@ namespace osu.Game.Overlays.Chat.ChannelList new ChannelListSelector { Margin = new MarginPadding { Bottom = 10 }, - SelectorActive = { BindTarget = SelectorActive }, }, privateChannelFlow = new ChannelListItemFlow("DIRECT MESSAGES"), }, @@ -132,4 +130,10 @@ namespace osu.Game.Overlays.Chat.ChannelList } } } + + public enum ChannelSelectorState + { + Visibile, + Hidden, + } } diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs index 43574351ed..3d59d1dc4c 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs @@ -31,14 +31,17 @@ namespace osu.Game.Overlays.Chat.ChannelList private readonly Channel channel; - private Box? hoverBox; - private Box? selectBox; - private OsuSpriteText? text; - private ChannelListItemCloseButton? close; + private Box hoverBox = null!; + private Box selectBox = null!; + private OsuSpriteText text = null!; + private ChannelListItemCloseButton close = null!; [Resolved] private Bindable selectedChannel { get; set; } = null!; + [Resolved] + private Bindable selectorState { get; set; } = null!; + [Resolved] private OverlayColourProvider colourProvider { get; set; } = null!; @@ -124,31 +127,26 @@ namespace osu.Game.Overlays.Chat.ChannelList { base.LoadComplete(); - selectedChannel.BindValueChanged(change => - { - if (change.NewValue == channel) - selectBox?.FadeIn(300, Easing.OutQuint); - else - selectBox?.FadeOut(200, Easing.OutQuint); - }, true); + selectedChannel.BindValueChanged(_ => updateSelectState(), true); + selectorState.BindValueChanged(_ => updateSelectState(), true); Unread.BindValueChanged(change => { - text!.FadeColour(change.NewValue ? colourProvider.Content1 : colourProvider.Light3, 300, Easing.OutQuint); + text.FadeColour(change.NewValue ? colourProvider.Content1 : colourProvider.Light3, 300, Easing.OutQuint); }, true); } protected override bool OnHover(HoverEvent e) { - hoverBox?.FadeIn(300, Easing.OutQuint); - close?.FadeIn(300, Easing.OutQuint); + hoverBox.FadeIn(300, Easing.OutQuint); + close.FadeIn(300, Easing.OutQuint); return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { - hoverBox?.FadeOut(200, Easing.OutQuint); - close?.FadeOut(200, Easing.OutQuint); + hoverBox.FadeOut(200, Easing.OutQuint); + close.FadeOut(200, Easing.OutQuint); base.OnHoverLost(e); } @@ -167,5 +165,13 @@ namespace osu.Game.Overlays.Chat.ChannelList Masking = true, }; } + + private void updateSelectState() + { + if (selectedChannel.Value == channel && selectorState.Value == ChannelSelectorState.Hidden) + selectBox.FadeIn(300, Easing.OutQuint); + else + selectBox.FadeOut(200, Easing.OutQuint); + } } } diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs index 5bc9a01598..4529a34f84 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs @@ -22,6 +22,9 @@ namespace osu.Game.Overlays.Chat.ChannelList private Box hoverBox = null!; private Box selectBox = null!; + [Resolved] + private Bindable selectorState { get; set; } = null!; + [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) { @@ -65,8 +68,15 @@ namespace osu.Game.Overlays.Chat.ChannelList { base.LoadComplete(); - SelectorActive.BindValueChanged(selected => selectBox.FadeTo(selected.NewValue ? 1 : 0)); - Action = () => SelectorActive.Value = true; + selectorState.BindValueChanged(selector => + { + if (selector.NewValue == ChannelSelectorState.Visibile) + selectBox.FadeIn(300, Easing.OutQuint); + else + selectBox.FadeOut(200, Easing.OutQuint); + }, true); + + Action = () => selectorState.Value = ChannelSelectorState.Visibile; } protected override bool OnHover(HoverEvent e) From 5319bce772d9e91857108628997c78a8284c79fc Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 20 Apr 2022 21:05:33 +0100 Subject: [PATCH 0376/2328] Revert DI usage of `ChannelSelectorState` in favour of directly binding `BindableBool` `SelectorActive` --- osu.Game.Tests/Visual/Online/TestSceneChannelList.cs | 9 +++------ osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 8 ++------ osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs | 9 ++++----- .../Overlays/Chat/ChannelList/ChannelListSelector.cs | 9 +++------ 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs index 2bfe42e6d4..d6a1e71f0d 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs @@ -25,9 +25,6 @@ namespace osu.Game.Tests.Visual.Online [Cached] private readonly Bindable selected = new Bindable(); - [Cached] - private readonly Bindable selector = new Bindable(); - private OsuSpriteText selectorText; private OsuSpriteText selectedText; private OsuSpriteText leaveText; @@ -92,7 +89,7 @@ namespace osu.Game.Tests.Visual.Online channelList.OnRequestSelect += channel => { - selector.Value = ChannelSelectorState.Hidden; + channelList.SelectorActive.Value = false; selected.Value = channel; }; @@ -104,9 +101,9 @@ namespace osu.Game.Tests.Visual.Online channelList.RemoveChannel(channel); }; - selector.BindValueChanged(change => + channelList.SelectorActive.BindValueChanged(change => { - selectorText.Text = $"Channel Selector State: {change.NewValue}"; + selectorText.Text = $"Channel Selector Active: {change.NewValue}"; }, true); selected.BindValueChanged(change => diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 578ac2aa45..076dc5719e 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -56,6 +56,7 @@ namespace osu.Game.Overlays.Chat.ChannelList new ChannelListSelector { Margin = new MarginPadding { Bottom = 10 }, + SelectorActive = { BindTarget = SelectorActive }, }, privateChannelFlow = new ChannelListItemFlow("DIRECT MESSAGES"), }, @@ -72,6 +73,7 @@ namespace osu.Game.Overlays.Chat.ChannelList ChannelListItem item = new ChannelListItem(channel); item.OnRequestSelect += chan => OnRequestSelect?.Invoke(chan); item.OnRequestLeave += chan => OnRequestLeave?.Invoke(chan); + item.SelectorActive.BindTarget = SelectorActive; ChannelListItemFlow flow = getFlowForChannel(channel); channelMap.Add(channel, item); @@ -130,10 +132,4 @@ namespace osu.Game.Overlays.Chat.ChannelList } } } - - public enum ChannelSelectorState - { - Visibile, - Hidden, - } } diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs index 3d59d1dc4c..7c4a72559b 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs @@ -29,6 +29,8 @@ namespace osu.Game.Overlays.Chat.ChannelList public readonly BindableBool Unread = new BindableBool(); + public readonly BindableBool SelectorActive = new BindableBool(); + private readonly Channel channel; private Box hoverBox = null!; @@ -39,9 +41,6 @@ namespace osu.Game.Overlays.Chat.ChannelList [Resolved] private Bindable selectedChannel { get; set; } = null!; - [Resolved] - private Bindable selectorState { get; set; } = null!; - [Resolved] private OverlayColourProvider colourProvider { get; set; } = null!; @@ -128,7 +127,7 @@ namespace osu.Game.Overlays.Chat.ChannelList base.LoadComplete(); selectedChannel.BindValueChanged(_ => updateSelectState(), true); - selectorState.BindValueChanged(_ => updateSelectState(), true); + SelectorActive.BindValueChanged(_ => updateSelectState(), true); Unread.BindValueChanged(change => { @@ -168,7 +167,7 @@ namespace osu.Game.Overlays.Chat.ChannelList private void updateSelectState() { - if (selectedChannel.Value == channel && selectorState.Value == ChannelSelectorState.Hidden) + if (selectedChannel.Value == channel && !SelectorActive.Value) selectBox.FadeIn(300, Easing.OutQuint); else selectBox.FadeOut(200, Easing.OutQuint); diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs index 4529a34f84..57ab7584b5 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs @@ -22,9 +22,6 @@ namespace osu.Game.Overlays.Chat.ChannelList private Box hoverBox = null!; private Box selectBox = null!; - [Resolved] - private Bindable selectorState { get; set; } = null!; - [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) { @@ -68,15 +65,15 @@ namespace osu.Game.Overlays.Chat.ChannelList { base.LoadComplete(); - selectorState.BindValueChanged(selector => + SelectorActive.BindValueChanged(selector => { - if (selector.NewValue == ChannelSelectorState.Visibile) + if (selector.NewValue) selectBox.FadeIn(300, Easing.OutQuint); else selectBox.FadeOut(200, Easing.OutQuint); }, true); - Action = () => selectorState.Value = ChannelSelectorState.Visibile; + Action = () => SelectorActive.Value = true; } protected override bool OnHover(HoverEvent e) From 5e5c8e78a6538b4bcda713375f59b1b2828ec9fa Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Thu, 27 Jan 2022 20:53:48 -0800 Subject: [PATCH 0377/2328] Use existing web localisation for most hardcoded strings --- osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs | 5 +++-- osu.Game/Beatmaps/BeatmapStatistic.cs | 3 ++- .../Drawables/BeatmapDownloadButton.cs | 3 ++- osu.Game/Graphics/UserInterface/OsuMenuItem.cs | 3 ++- .../UserInterface/PageSelector/PageSelector.cs | 5 +++-- .../PageSelector/PageSelectorPrevNextButton.cs | 6 ++++-- .../Graphics/UserInterface/SearchTextBox.cs | 3 ++- .../Graphics/UserInterface/ShowMoreButton.cs | 4 +++- .../Graphics/UserInterfaceV2/ColourDisplay.cs | 3 ++- osu.Game/Localisation/CommonStrings.cs | 10 ---------- .../API/Requests/Responses/APIPlayStyle.cs | 11 ++++++----- osu.Game/Online/Chat/StandAloneChatDisplay.cs | 3 ++- .../Online/Leaderboards/LeaderboardScore.cs | 11 ++++++----- osu.Game/Online/Rooms/MatchType.cs | 7 ++++--- .../Overlays/AccountCreation/ScreenEntry.cs | 3 ++- .../Overlays/BeatmapSet/BeatmapAvailability.cs | 7 ++++--- .../Scores/NotSupporterPlaceholder.cs | 3 ++- osu.Game/Overlays/ChatOverlay.cs | 2 +- .../Comments/Buttons/LoadRepliesButton.cs | 3 ++- .../Comments/Buttons/ShowMoreRepliesButton.cs | 3 ++- .../Comments/CancellableCommentEditor.cs | 3 ++- .../Overlays/Comments/CommentsContainer.cs | 3 ++- osu.Game/Overlays/Comments/CommentsHeader.cs | 10 ++++++++-- .../Comments/CommentsShowMoreButton.cs | 6 +++++- osu.Game/Overlays/Comments/DrawableComment.cs | 2 +- .../Overlays/Comments/TotalCommentsCounter.cs | 3 ++- .../Dashboard/CurrentlyPlayingDisplay.cs | 3 ++- .../Dashboard/Home/DrawableBeatmapList.cs | 3 ++- .../Dashboard/Home/DrawableNewBeatmapList.cs | 4 +++- .../Home/DrawablePopularBeatmapList.cs | 4 +++- .../Dashboard/Home/News/ShowMoreNewsPanel.cs | 3 ++- osu.Game/Overlays/Dialog/ConfirmDialog.cs | 3 ++- osu.Game/Overlays/Login/LoginForm.cs | 7 ++++--- osu.Game/Overlays/Login/UserAction.cs | 3 +++ osu.Game/Overlays/Mods/ModSelectOverlay.cs | 3 ++- osu.Game/Overlays/NotificationOverlay.cs | 5 +++-- .../Notifications/NotificationSection.cs | 7 ++++--- .../Profile/Header/BottomHeaderContainer.cs | 18 ++++++++++++++---- .../Settings/Sections/Input/KeyBindingRow.cs | 6 +++--- osu.Game/Overlays/Toolbar/ToolbarUserButton.cs | 3 ++- .../Wiki/Markdown/WikiNoticeContainer.cs | 8 +++++--- osu.Game/Overlays/Wiki/WikiSidebar.cs | 4 +++- .../Compose/Components/SelectionHandler.cs | 3 ++- osu.Game/Screens/Edit/Editor.cs | 3 ++- .../Screens/Edit/Setup/DifficultySection.cs | 9 +++++---- osu.Game/Screens/Edit/Setup/MetadataSection.cs | 7 ++++--- .../OnlinePlay/Components/OverlinedHeader.cs | 3 ++- .../OnlinePlay/DrawableRoomPlaylistItem.cs | 3 ++- .../Match/Components/MatchLeaderboardScore.cs | 5 +++-- .../OnlinePlay/Match/DrawableMatchRoom.cs | 3 ++- .../Participants/ParticipantsListHeader.cs | 3 ++- .../Screens/Play/BeatmapMetadataDisplay.cs | 9 +++++---- osu.Game/Screens/Play/Break/BreakInfo.cs | 3 ++- osu.Game/Screens/Play/Break/BreakInfoLine.cs | 4 ++-- .../Play/HUD/PerformancePointsCounter.cs | 3 ++- .../Play/PlayerSettings/AudioSettings.cs | 3 ++- .../Play/PlayerSettings/VisualSettings.cs | 11 ++++++----- .../Contracted/ContractedPanelMiddleContent.cs | 8 +++++--- .../Expanded/Statistics/AccuracyStatistic.cs | 3 ++- .../Expanded/Statistics/ComboStatistic.cs | 3 ++- .../Expanded/Statistics/CounterStatistic.cs | 3 ++- .../Statistics/PerformanceStatistic.cs | 3 ++- .../Expanded/Statistics/StatisticDisplay.cs | 8 +++++--- osu.Game/Screens/Select/BeatmapDetails.cs | 3 ++- .../Select/Carousel/DrawableCarouselBeatmap.cs | 14 ++++---------- .../Screens/Select/Details/AdvancedStats.cs | 13 +++++++------ osu.Game/Screens/Select/Filter/SortMode.cs | 16 +++++++++------- osu.Game/Screens/Select/FilterControl.cs | 3 ++- .../Select/Options/BeatmapOptionsOverlay.cs | 3 ++- osu.Game/Users/UserStatus.cs | 10 ++++++---- 70 files changed, 224 insertions(+), 147 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs index 2d3cc3c103..a5282877ee 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Beatmaps @@ -20,13 +21,13 @@ namespace osu.Game.Rulesets.Osu.Beatmaps { new BeatmapStatistic { - Name = @"Circle Count", + Name = BeatmapsetsStrings.ShowStatsCountCircles, Content = circles.ToString(), CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Circles), }, new BeatmapStatistic { - Name = @"Slider Count", + Name = BeatmapsetsStrings.ShowStatsCountSliders, Content = sliders.ToString(), CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Sliders), }, diff --git a/osu.Game/Beatmaps/BeatmapStatistic.cs b/osu.Game/Beatmaps/BeatmapStatistic.cs index 7d7ba09fcf..94ebb56a5c 100644 --- a/osu.Game/Beatmaps/BeatmapStatistic.cs +++ b/osu.Game/Beatmaps/BeatmapStatistic.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Graphics; +using osu.Framework.Localisation; namespace osu.Game.Beatmaps { @@ -14,6 +15,6 @@ namespace osu.Game.Beatmaps public Func CreateIcon; public string Content; - public string Name; + public LocalisableString Name; } } diff --git a/osu.Game/Beatmaps/Drawables/BeatmapDownloadButton.cs b/osu.Game/Beatmaps/Drawables/BeatmapDownloadButton.cs index e2485e7a77..6ab92a2ba2 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapDownloadButton.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapDownloadButton.cs @@ -12,6 +12,7 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Online; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Beatmaps.Drawables { @@ -104,7 +105,7 @@ namespace osu.Game.Beatmaps.Drawables if ((beatmapSet as IBeatmapSetOnlineInfo)?.Availability.DownloadDisabled == true) { button.Enabled.Value = false; - button.TooltipText = "this beatmap is currently not available for download."; + button.TooltipText = BeatmapsetsStrings.AvailabilityDisabled; } break; diff --git a/osu.Game/Graphics/UserInterface/OsuMenuItem.cs b/osu.Game/Graphics/UserInterface/OsuMenuItem.cs index 0fe41937ce..1da60415ba 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenuItem.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Localisation; namespace osu.Game.Graphics.UserInterface { @@ -15,7 +16,7 @@ namespace osu.Game.Graphics.UserInterface { } - public OsuMenuItem(string text, MenuItemType type, Action action) + public OsuMenuItem(LocalisableString text, MenuItemType type, Action action) : base(text, action) { Type = type; diff --git a/osu.Game/Graphics/UserInterface/PageSelector/PageSelector.cs b/osu.Game/Graphics/UserInterface/PageSelector/PageSelector.cs index 005729580c..5c6d087279 100644 --- a/osu.Game/Graphics/UserInterface/PageSelector/PageSelector.cs +++ b/osu.Game/Graphics/UserInterface/PageSelector/PageSelector.cs @@ -5,6 +5,7 @@ using System; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Framework.Bindables; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Graphics.UserInterface.PageSelector { @@ -29,7 +30,7 @@ namespace osu.Game.Graphics.UserInterface.PageSelector Direction = FillDirection.Horizontal, Children = new Drawable[] { - previousPageButton = new PageSelectorPrevNextButton(false, "prev") + previousPageButton = new PageSelectorPrevNextButton(false, CommonStrings.PaginationPrevious) { Action = () => CurrentPage.Value -= 1, }, @@ -38,7 +39,7 @@ namespace osu.Game.Graphics.UserInterface.PageSelector AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, }, - nextPageButton = new PageSelectorPrevNextButton(true, "next") + nextPageButton = new PageSelectorPrevNextButton(true, CommonStrings.PaginationNext) { Action = () => CurrentPage.Value += 1 } diff --git a/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorPrevNextButton.cs b/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorPrevNextButton.cs index 7503ab8135..889917c397 100644 --- a/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorPrevNextButton.cs +++ b/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorPrevNextButton.cs @@ -2,9 +2,11 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Localisation; using osu.Game.Graphics.Sprites; using osuTK; @@ -13,12 +15,12 @@ namespace osu.Game.Graphics.UserInterface.PageSelector public class PageSelectorPrevNextButton : PageSelectorButton { private readonly bool rightAligned; - private readonly string text; + private readonly LocalisableString text; private SpriteIcon icon; private OsuSpriteText name; - public PageSelectorPrevNextButton(bool rightAligned, string text) + public PageSelectorPrevNextButton(bool rightAligned, LocalisableString text) { this.rightAligned = rightAligned; this.text = text; diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index 6937782be6..dd9ed7c9e9 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Framework.Input.Events; +using osu.Game.Resources.Localisation.Web; using osuTK; using osuTK.Input; @@ -27,7 +28,7 @@ namespace osu.Game.Graphics.UserInterface }); TextFlow.Padding = new MarginPadding { Right = 35 }; - PlaceholderText = "type to search"; + PlaceholderText = HomeStrings.SearchPlaceholder; } public override bool OnPressed(KeyBindingPressEvent e) diff --git a/osu.Game/Graphics/UserInterface/ShowMoreButton.cs b/osu.Game/Graphics/UserInterface/ShowMoreButton.cs index 615895074c..05dda324d4 100644 --- a/osu.Game/Graphics/UserInterface/ShowMoreButton.cs +++ b/osu.Game/Graphics/UserInterface/ShowMoreButton.cs @@ -11,7 +11,9 @@ using osu.Game.Graphics.Sprites; using osu.Game.Overlays; using osuTK; using System.Collections.Generic; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Localisation; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Graphics.UserInterface { @@ -80,7 +82,7 @@ namespace osu.Game.Graphics.UserInterface Anchor = Anchor.Centre, Origin = Anchor.Centre, Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold), - Text = "show more".ToUpper(), + Text = CommonStrings.ButtonsShowMore.ToUpper(), }, rightIcon = new ChevronIcon { diff --git a/osu.Game/Graphics/UserInterfaceV2/ColourDisplay.cs b/osu.Game/Graphics/UserInterfaceV2/ColourDisplay.cs index 5240df74a2..cec319f28e 100644 --- a/osu.Game/Graphics/UserInterfaceV2/ColourDisplay.cs +++ b/osu.Game/Graphics/UserInterfaceV2/ColourDisplay.cs @@ -14,6 +14,7 @@ using osu.Framework.Localisation; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Resources.Localisation.Web; using osuTK; namespace osu.Game.Graphics.UserInterfaceV2 @@ -139,7 +140,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 public MenuItem[] ContextMenuItems => new MenuItem[] { - new OsuMenuItem("Delete", MenuItemType.Destructive, () => DeleteRequested?.Invoke()) + new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, () => DeleteRequested?.Invoke()) }; } } diff --git a/osu.Game/Localisation/CommonStrings.cs b/osu.Game/Localisation/CommonStrings.cs index 3ea337c279..b717bb83dd 100644 --- a/osu.Game/Localisation/CommonStrings.cs +++ b/osu.Game/Localisation/CommonStrings.cs @@ -9,16 +9,6 @@ namespace osu.Game.Localisation { private const string prefix = @"osu.Game.Resources.Localisation.Common"; - /// - /// "Cancel" - /// - public static LocalisableString Cancel => new TranslatableString(getKey(@"cancel"), @"Cancel"); - - /// - /// "Clear" - /// - public static LocalisableString Clear => new TranslatableString(getKey(@"clear"), @"Clear"); - /// /// "Enabled" /// diff --git a/osu.Game/Online/API/Requests/Responses/APIPlayStyle.cs b/osu.Game/Online/API/Requests/Responses/APIPlayStyle.cs index 9573ae1825..a9d66f3d6a 100644 --- a/osu.Game/Online/API/Requests/Responses/APIPlayStyle.cs +++ b/osu.Game/Online/API/Requests/Responses/APIPlayStyle.cs @@ -1,22 +1,23 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.ComponentModel; +using osu.Framework.Localisation; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Online.API.Requests.Responses { public enum APIPlayStyle { - [Description("Keyboard")] + [LocalisableDescription(typeof(CommonStrings), nameof(CommonStrings.DeviceKeyboard))] Keyboard, - [Description("Mouse")] + [LocalisableDescription(typeof(CommonStrings), nameof(CommonStrings.DeviceMouse))] Mouse, - [Description("Tablet")] + [LocalisableDescription(typeof(CommonStrings), nameof(CommonStrings.DeviceTablet))] Tablet, - [Description("Touch Screen")] + [LocalisableDescription(typeof(CommonStrings), nameof(CommonStrings.DeviceTouch))] Touch, } } diff --git a/osu.Game/Online/Chat/StandAloneChatDisplay.cs b/osu.Game/Online/Chat/StandAloneChatDisplay.cs index f83bf4877e..6a7da52416 100644 --- a/osu.Game/Online/Chat/StandAloneChatDisplay.cs +++ b/osu.Game/Online/Chat/StandAloneChatDisplay.cs @@ -12,6 +12,7 @@ using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Chat; +using osu.Game.Resources.Localisation.Web; using osuTK.Graphics; namespace osu.Game.Online.Chat @@ -63,7 +64,7 @@ namespace osu.Game.Online.Chat { RelativeSizeAxes = Axes.X, Height = text_box_height, - PlaceholderText = "type your message", + PlaceholderText = ChatStrings.InputPlaceholder, CornerRadius = corner_radius, ReleaseFocusOnCommit = false, HoldFocus = true, diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index eecb7ff6b3..c75e98cdaa 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -30,6 +30,7 @@ using osu.Game.Users.Drawables; using osuTK; using osuTK.Graphics; using osu.Game.Online.API; +using osu.Game.Resources.Localisation.Web; using osu.Game.Utils; namespace osu.Game.Online.Leaderboards @@ -291,8 +292,8 @@ namespace osu.Game.Online.Leaderboards protected virtual IEnumerable GetStatistics(ScoreInfo model) => new[] { - new LeaderboardScoreStatistic(FontAwesome.Solid.Link, "Max Combo", model.MaxCombo.ToString()), - new LeaderboardScoreStatistic(FontAwesome.Solid.Crosshairs, "Accuracy", model.DisplayAccuracy) + new LeaderboardScoreStatistic(FontAwesome.Solid.Link, BeatmapsetsStrings.ShowScoreboardHeadersCombo, model.MaxCombo.ToString()), + new LeaderboardScoreStatistic(FontAwesome.Solid.Crosshairs, BeatmapsetsStrings.ShowScoreboardHeadersAccuracy, model.DisplayAccuracy) }; protected override bool OnHover(HoverEvent e) @@ -403,9 +404,9 @@ namespace osu.Game.Online.Leaderboards { public IconUsage Icon; public LocalisableString Value; - public string Name; + public LocalisableString Name; - public LeaderboardScoreStatistic(IconUsage icon, string name, LocalisableString value) + public LeaderboardScoreStatistic(IconUsage icon, LocalisableString name, LocalisableString value) { Icon = icon; Name = name; @@ -426,7 +427,7 @@ namespace osu.Game.Online.Leaderboards items.Add(new OsuMenuItem("Export", MenuItemType.Standard, () => new LegacyScoreExporter(storage).Export(Score))); if (!isOnlineScope) - items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new LocalScoreDeleteDialog(Score)))); + items.Add(new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, () => dialogOverlay?.Push(new LocalScoreDeleteDialog(Score)))); return items.ToArray(); } diff --git a/osu.Game/Online/Rooms/MatchType.cs b/osu.Game/Online/Rooms/MatchType.cs index 36f0dc0c81..278f0693eb 100644 --- a/osu.Game/Online/Rooms/MatchType.cs +++ b/osu.Game/Online/Rooms/MatchType.cs @@ -1,7 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.ComponentModel; +using osu.Framework.Localisation; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Online.Rooms { @@ -11,10 +12,10 @@ namespace osu.Game.Online.Rooms Playlists, - [Description("Head to head")] + [LocalisableDescription(typeof(MatchesStrings), nameof(MatchesStrings.MatchTeamTypesHeadToHead))] HeadToHead, - [Description("Team VS")] + [LocalisableDescription(typeof(MatchesStrings), nameof(MatchesStrings.MatchTeamTypesTeamVs))] TeamVersus, } } diff --git a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs index a2c04c6989..6cf3fb4267 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs @@ -16,6 +16,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Overlays.Settings; +using osu.Game.Resources.Localisation.Web; using osuTK; using osuTK.Graphics; @@ -68,7 +69,7 @@ namespace osu.Game.Overlays.AccountCreation }, usernameTextBox = new OsuTextBox { - PlaceholderText = "username", + PlaceholderText = UsersStrings.LoginUsername, RelativeSizeAxes = Axes.X, TabbableContentContainer = this }, diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs b/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs index dc46452dcb..b6e768d632 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Resources.Localisation.Web; using osuTK.Graphics; namespace osu.Game.Overlays.BeatmapSet @@ -69,14 +70,14 @@ namespace osu.Game.Overlays.BeatmapSet { textContainer.Clear(); textContainer.AddParagraph(downloadDisabled - ? "This beatmap is currently not available for download." - : "Portions of this beatmap have been removed at the request of the creator or a third-party rights holder.", t => t.Colour = Color4.Orange); + ? BeatmapsetsStrings.AvailabilityDisabled + : BeatmapsetsStrings.AvailabilityPartsRemoved, t => t.Colour = Color4.Orange); if (hasExternalLink) { textContainer.NewParagraph(); textContainer.NewParagraph(); - textContainer.AddLink("Check here for more information.", BeatmapSet.Availability.ExternalLink, creationParameters: t => t.Font = OsuFont.GetFont(size: 10)); + textContainer.AddLink(BeatmapsetsStrings.AvailabilityMoreInfo, BeatmapSet.Availability.ExternalLink, creationParameters: t => t.Font = OsuFont.GetFont(size: 10)); } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/NotSupporterPlaceholder.cs b/osu.Game/Overlays/BeatmapSet/Scores/NotSupporterPlaceholder.cs index b2c87a1477..d1a0960a08 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/NotSupporterPlaceholder.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/NotSupporterPlaceholder.cs @@ -7,6 +7,7 @@ using osu.Game.Graphics.Sprites; using osuTK; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.BeatmapSet.Scores { @@ -28,7 +29,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = @"You need to be an osu!supporter to access the friend and country rankings!", + Text = BeatmapsetsStrings.ShowScoreboardSupporterOnly, Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold), }, text = new LinkFlowContainer(t => t.Font = t.Font.With(size: 11)) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 64b972262b..034670cf37 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -160,7 +160,7 @@ namespace osu.Game.Overlays { RelativeSizeAxes = Axes.Both, Height = 1, - PlaceholderText = "type your message", + PlaceholderText = Resources.Localisation.Web.ChatStrings.InputPlaceholder, ReleaseFocusOnCommit = false, HoldFocus = true, } diff --git a/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs index 4998e5391e..4bb5b9d66d 100644 --- a/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs @@ -3,6 +3,7 @@ using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.Comments.Buttons { @@ -25,7 +26,7 @@ namespace osu.Game.Overlays.Comments.Buttons { public ButtonContent() { - Text = "load replies"; + Text = CommentsStrings.LoadReplies; } } } diff --git a/osu.Game/Overlays/Comments/Buttons/ShowMoreRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/ShowMoreRepliesButton.cs index c115a8bb8f..4908e29b7d 100644 --- a/osu.Game/Overlays/Comments/Buttons/ShowMoreRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/ShowMoreRepliesButton.cs @@ -9,6 +9,7 @@ using osu.Game.Graphics.Sprites; using System.Collections.Generic; using osuTK; using osu.Framework.Allocation; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.Comments.Buttons { @@ -38,7 +39,7 @@ namespace osu.Game.Overlays.Comments.Buttons { AlwaysPresent = true, Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold), - Text = "show more" + Text = CommonStrings.ButtonsShowMore } }; diff --git a/osu.Game/Overlays/Comments/CancellableCommentEditor.cs b/osu.Game/Overlays/Comments/CancellableCommentEditor.cs index c226b7f07f..74c221bd82 100644 --- a/osu.Game/Overlays/Comments/CancellableCommentEditor.cs +++ b/osu.Game/Overlays/Comments/CancellableCommentEditor.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.Comments { @@ -54,7 +55,7 @@ namespace osu.Game.Overlays.Comments Origin = Anchor.Centre, Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), Margin = new MarginPadding { Horizontal = 20 }, - Text = @"Cancel" + Text = CommonStrings.ButtonsCancel } } }; diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs index 6a5734b553..a28b13fc12 100644 --- a/osu.Game/Overlays/Comments/CommentsContainer.cs +++ b/osu.Game/Overlays/Comments/CommentsContainer.cs @@ -16,6 +16,7 @@ using osu.Framework.Threading; using System.Collections.Generic; using JetBrains.Annotations; using osu.Game.Graphics.Sprites; +using osu.Game.Resources.Localisation.Web; using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Overlays.Comments @@ -328,7 +329,7 @@ namespace osu.Game.Overlays.Comments Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Margin = new MarginPadding { Left = 50 }, - Text = @"No comments yet." + Text = CommentsStrings.Empty } }); } diff --git a/osu.Game/Overlays/Comments/CommentsHeader.cs b/osu.Game/Overlays/Comments/CommentsHeader.cs index bf80655c3d..e7d9e72dcc 100644 --- a/osu.Game/Overlays/Comments/CommentsHeader.cs +++ b/osu.Game/Overlays/Comments/CommentsHeader.cs @@ -12,7 +12,9 @@ using osu.Game.Graphics; using osu.Framework.Graphics.Sprites; using osuTK; using osu.Framework.Input.Events; +using osu.Framework.Localisation; using osu.Game.Graphics.Sprites; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.Comments { @@ -91,7 +93,7 @@ namespace osu.Game.Overlays.Comments Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold), - Text = @"Show deleted" + Text = CommonStrings.ButtonsShowDeleted } }, }); @@ -126,9 +128,13 @@ namespace osu.Game.Overlays.Comments public enum CommentsSortCriteria { - [System.ComponentModel.Description(@"Recent")] + [LocalisableDescription(typeof(SortStrings), nameof(SortStrings.New))] New, + + [LocalisableDescription(typeof(SortStrings), nameof(SortStrings.Old))] Old, + + [LocalisableDescription(typeof(SortStrings), nameof(SortStrings.Top))] Top } } diff --git a/osu.Game/Overlays/Comments/CommentsShowMoreButton.cs b/osu.Game/Overlays/Comments/CommentsShowMoreButton.cs index adf64eabb1..b1ca39c3bf 100644 --- a/osu.Game/Overlays/Comments/CommentsShowMoreButton.cs +++ b/osu.Game/Overlays/Comments/CommentsShowMoreButton.cs @@ -2,7 +2,10 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; +using osu.Framework.Extensions.LocalisationExtensions; +using osu.Framework.Localisation; using osu.Game.Graphics.UserInterface; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.Comments { @@ -18,7 +21,8 @@ namespace osu.Game.Overlays.Comments private void onCurrentChanged(ValueChangedEvent count) { - Text = $@"Show More ({count.NewValue})".ToUpper(); + Text = new TranslatableString(@"_", "{0} ({1})", + CommonStrings.ButtonsShowMore.ToUpper(), count.NewValue); } } } diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs index 3286b6c5c0..3ec91c8e63 100644 --- a/osu.Game/Overlays/Comments/DrawableComment.cs +++ b/osu.Game/Overlays/Comments/DrawableComment.cs @@ -150,7 +150,7 @@ namespace osu.Game.Overlays.Comments { Alpha = Comment.IsDeleted ? 1 : 0, Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold), - Text = "deleted" + Text = CommentsStrings.Deleted } } }, diff --git a/osu.Game/Overlays/Comments/TotalCommentsCounter.cs b/osu.Game/Overlays/Comments/TotalCommentsCounter.cs index 1bb9b52689..221a745189 100644 --- a/osu.Game/Overlays/Comments/TotalCommentsCounter.cs +++ b/osu.Game/Overlays/Comments/TotalCommentsCounter.cs @@ -9,6 +9,7 @@ using osuTK; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Graphics.Sprites; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.Comments { @@ -39,7 +40,7 @@ namespace osu.Game.Overlays.Comments Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(size: 20, italics: true), Colour = colourProvider.Light1, - Text = @"Comments" + Text = CommentsStrings.Title }, new CircularContainer { diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index 786401b7a8..e036f1d304 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -14,6 +14,7 @@ using osu.Game.Database; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Spectator; +using osu.Game.Resources.Localisation.Web; using osu.Game.Screens; using osu.Game.Screens.OnlinePlay.Match.Components; using osu.Game.Screens.Play; @@ -138,7 +139,7 @@ namespace osu.Game.Overlays.Dashboard new PurpleTriangleButton { RelativeSizeAxes = Axes.X, - Text = "Watch", + Text = CommonStrings.ButtonsWatchTo1, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Action = () => performer?.PerformFromScreen(s => s.Push(new SoloSpectator(User))), diff --git a/osu.Game/Overlays/Dashboard/Home/DrawableBeatmapList.cs b/osu.Game/Overlays/Dashboard/Home/DrawableBeatmapList.cs index c73cc828e2..382bc00b1d 100644 --- a/osu.Game/Overlays/Dashboard/Home/DrawableBeatmapList.cs +++ b/osu.Game/Overlays/Dashboard/Home/DrawableBeatmapList.cs @@ -6,6 +6,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.API.Requests.Responses; @@ -49,7 +50,7 @@ namespace osu.Game.Overlays.Dashboard.Home flow.AddRange(beatmapSets.Select(CreateBeatmapPanel)); } - protected abstract string Title { get; } + protected abstract LocalisableString Title { get; } protected abstract DashboardBeatmapPanel CreateBeatmapPanel(APIBeatmapSet beatmapSet); } diff --git a/osu.Game/Overlays/Dashboard/Home/DrawableNewBeatmapList.cs b/osu.Game/Overlays/Dashboard/Home/DrawableNewBeatmapList.cs index 714e07a7ed..331fff0aea 100644 --- a/osu.Game/Overlays/Dashboard/Home/DrawableNewBeatmapList.cs +++ b/osu.Game/Overlays/Dashboard/Home/DrawableNewBeatmapList.cs @@ -2,7 +2,9 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using osu.Framework.Localisation; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.Dashboard.Home { @@ -15,6 +17,6 @@ namespace osu.Game.Overlays.Dashboard.Home protected override DashboardBeatmapPanel CreateBeatmapPanel(APIBeatmapSet beatmapSet) => new DashboardNewBeatmapPanel(beatmapSet); - protected override string Title => "New Ranked Beatmaps"; + protected override LocalisableString Title => HomeStrings.UserBeatmapsNew; } } diff --git a/osu.Game/Overlays/Dashboard/Home/DrawablePopularBeatmapList.cs b/osu.Game/Overlays/Dashboard/Home/DrawablePopularBeatmapList.cs index 48b100b04e..154813dea1 100644 --- a/osu.Game/Overlays/Dashboard/Home/DrawablePopularBeatmapList.cs +++ b/osu.Game/Overlays/Dashboard/Home/DrawablePopularBeatmapList.cs @@ -2,7 +2,9 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using osu.Framework.Localisation; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.Dashboard.Home { @@ -15,6 +17,6 @@ namespace osu.Game.Overlays.Dashboard.Home protected override DashboardBeatmapPanel CreateBeatmapPanel(APIBeatmapSet beatmapSet) => new DashboardPopularBeatmapPanel(beatmapSet); - protected override string Title => "Popular Beatmaps"; + protected override LocalisableString Title => HomeStrings.UserBeatmapsPopular; } } diff --git a/osu.Game/Overlays/Dashboard/Home/News/ShowMoreNewsPanel.cs b/osu.Game/Overlays/Dashboard/Home/News/ShowMoreNewsPanel.cs index d25df6f189..f6e966957e 100644 --- a/osu.Game/Overlays/Dashboard/Home/News/ShowMoreNewsPanel.cs +++ b/osu.Game/Overlays/Dashboard/Home/News/ShowMoreNewsPanel.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Resources.Localisation.Web; using osuTK.Graphics; namespace osu.Game.Overlays.Dashboard.Home.News @@ -35,7 +36,7 @@ namespace osu.Game.Overlays.Dashboard.Home.News Anchor = Anchor.Centre, Origin = Anchor.Centre, Margin = new MarginPadding { Vertical = 20 }, - Text = "see more" + Text = CommonStrings.ButtonsSeeMore } }; diff --git a/osu.Game/Overlays/Dialog/ConfirmDialog.cs b/osu.Game/Overlays/Dialog/ConfirmDialog.cs index d1c0d746d1..58ce84e13a 100644 --- a/osu.Game/Overlays/Dialog/ConfirmDialog.cs +++ b/osu.Game/Overlays/Dialog/ConfirmDialog.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Graphics.Sprites; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.Dialog { @@ -33,7 +34,7 @@ namespace osu.Game.Overlays.Dialog }, new PopupDialogCancelButton { - Text = Localisation.CommonStrings.Cancel, + Text = CommonStrings.ButtonsCancel, Action = onCancel }, }; diff --git a/osu.Game/Overlays/Login/LoginForm.cs b/osu.Game/Overlays/Login/LoginForm.cs index f7842dcd30..c31416e078 100644 --- a/osu.Game/Overlays/Login/LoginForm.cs +++ b/osu.Game/Overlays/Login/LoginForm.cs @@ -13,6 +13,7 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Overlays.Settings; +using osu.Game.Resources.Localisation.Web; using osuTK; namespace osu.Game.Overlays.Login @@ -50,14 +51,14 @@ namespace osu.Game.Overlays.Login { username = new OsuTextBox { - PlaceholderText = "username", + PlaceholderText = UsersStrings.LoginUsername, RelativeSizeAxes = Axes.X, Text = api?.ProvidedUsername ?? string.Empty, TabbableContentContainer = this }, password = new OsuPasswordTextBox { - PlaceholderText = "password", + PlaceholderText = UsersStrings.LoginPassword, RelativeSizeAxes = Axes.X, TabbableContentContainer = this, }, @@ -88,7 +89,7 @@ namespace osu.Game.Overlays.Login AutoSizeAxes = Axes.Y, Child = new SettingsButton { - Text = "Sign in", + Text = UsersStrings.LoginButton, Action = performLogin }, } diff --git a/osu.Game/Overlays/Login/UserAction.cs b/osu.Game/Overlays/Login/UserAction.cs index 07b6b4bf7e..d216670a28 100644 --- a/osu.Game/Overlays/Login/UserAction.cs +++ b/osu.Game/Overlays/Login/UserAction.cs @@ -2,11 +2,14 @@ // See the LICENCE file in the repository root for full licence text. using System.ComponentModel; +using osu.Framework.Localisation; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.Login { public enum UserAction { + [LocalisableDescription(typeof(UsersStrings), nameof(UsersStrings.StatusOnline))] Online, [Description(@"Do not disturb")] diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index ec7e49920c..9ce79c25f7 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -20,6 +20,7 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets.Mods; using osu.Game.Screens; using osu.Game.Utils; @@ -317,7 +318,7 @@ namespace osu.Game.Overlays.Mods CloseButton = new TriangleButton { Width = 180, - Text = "Close", + Text = CommonStrings.ButtonsClose, Action = Hide, Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 2b5909f45a..f1ed5c4ba6 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -15,7 +15,8 @@ using osu.Framework.Localisation; using osu.Framework.Logging; using osu.Framework.Threading; using osu.Game.Graphics; -using osu.Game.Localisation; +using osu.Game.Resources.Localisation.Web; +using NotificationsStrings = osu.Game.Localisation.NotificationsStrings; namespace osu.Game.Overlays { @@ -61,7 +62,7 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.X, Children = new[] { - new NotificationSection(@"Notifications", @"Clear All") + new NotificationSection(AccountsStrings.NotificationsTitle, "Clear All") { AcceptTypes = new[] { typeof(SimpleNotification) } }, diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index a23ff07a64..a4851ab365 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Localisation; @@ -34,9 +35,9 @@ namespace osu.Game.Overlays.Notifications private readonly string clearButtonText; - private readonly string titleText; + private readonly LocalisableString titleText; - public NotificationSection(string title, string clearButtonText) + public NotificationSection(LocalisableString title, string clearButtonText) { this.clearButtonText = clearButtonText.ToUpperInvariant(); titleText = title; @@ -84,7 +85,7 @@ namespace osu.Game.Overlays.Notifications { new OsuSpriteText { - Text = titleText.ToUpperInvariant(), + Text = titleText.ToUpper(), Font = OsuFont.GetFont(weight: FontWeight.Bold) }, countDrawable = new OsuSpriteText diff --git a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs index ea52cec2e1..a70d57661b 100644 --- a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Linq; using Humanizer; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -11,10 +10,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Resources.Localisation.Web; using osuTK; using osuTK.Graphics; @@ -83,7 +84,7 @@ namespace osu.Game.Overlays.Profile.Header if (user == null) return; if (user.JoinDate.ToUniversalTime().Year < 2008) - topLinkContainer.AddText("Here since the beginning"); + topLinkContainer.AddText(UsersStrings.ShowFirstMembers); else { topLinkContainer.AddText("Joined "); @@ -94,7 +95,7 @@ namespace osu.Game.Overlays.Profile.Header if (user.IsOnline) { - topLinkContainer.AddText("Currently online"); + topLinkContainer.AddText(UsersStrings.ShowLastvisitOnline); addSpacer(topLinkContainer); } else if (user.LastVisit.HasValue) @@ -108,7 +109,16 @@ namespace osu.Game.Overlays.Profile.Header if (user.PlayStyles?.Length > 0) { topLinkContainer.AddText("Plays with "); - topLinkContainer.AddText(string.Join(", ", user.PlayStyles.Select(style => style.GetDescription())), embolden); + + LocalisableString playStylesString = user.PlayStyles[0].GetLocalisableDescription(); + + for (int i = 1; i < user.PlayStyles.Length; i++) + { + playStylesString = new TranslatableString(@"_", @"{0}{1}", playStylesString, CommonStrings.ArrayAndWordsConnector); + playStylesString = new TranslatableString(@"_", @"{0}{1}", playStylesString, user.PlayStyles[i].GetLocalisableDescription()); + } + + topLinkContainer.AddText(playStylesString, embolden); addSpacer(topLinkContainer); } diff --git a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs index 2405618917..459405f57d 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs @@ -21,7 +21,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Input; using osu.Game.Input.Bindings; -using osu.Game.Localisation; +using osu.Game.Resources.Localisation.Web; using osuTK; using osuTK.Graphics; using osuTK.Input; @@ -402,7 +402,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input { public CancelButton() { - Text = CommonStrings.Cancel; + Text = CommonStrings.ButtonsCancel; Size = new Vector2(80, 20); } } @@ -411,7 +411,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input { public ClearButton() { - Text = CommonStrings.Clear; + Text = CommonStrings.ButtonsClear; Size = new Vector2(80, 20); } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index b0c9a04285..d8ba07dc3b 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics.Effects; using osu.Game.Graphics; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Resources.Localisation.Web; using osu.Game.Users.Drawables; using osuTK; using osuTK.Graphics; @@ -62,7 +63,7 @@ namespace osu.Game.Overlays.Toolbar switch (state.NewValue) { default: - Text = @"Guest"; + Text = UsersStrings.AnonymousUsername; avatar.User = new APIUser(); break; diff --git a/osu.Game/Overlays/Wiki/Markdown/WikiNoticeContainer.cs b/osu.Game/Overlays/Wiki/Markdown/WikiNoticeContainer.cs index a22c18b0a4..11cab80a57 100644 --- a/osu.Game/Overlays/Wiki/Markdown/WikiNoticeContainer.cs +++ b/osu.Game/Overlays/Wiki/Markdown/WikiNoticeContainer.cs @@ -7,7 +7,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers.Markdown; using osu.Framework.Graphics.Shapes; +using osu.Framework.Localisation; using osu.Game.Graphics; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.Wiki.Markdown { @@ -46,14 +48,14 @@ namespace osu.Game.Overlays.Wiki.Markdown { Add(new NoticeBox { - Text = "The content on this page is incomplete or outdated. If you are able to help out, please consider updating the article!", + Text = WikiStrings.ShowIncompleteOrOutdated, }); } else if (needsCleanup) { Add(new NoticeBox { - Text = "This page does not meet the standards of the osu! wiki and needs to be cleaned up or rewritten. If you are able to help out, please consider updating the article!", + Text = WikiStrings.ShowNeedsCleanupOrRewrite, }); } } @@ -63,7 +65,7 @@ namespace osu.Game.Overlays.Wiki.Markdown [Resolved] private IMarkdownTextFlowComponent parentFlowComponent { get; set; } - public string Text { get; set; } + public LocalisableString Text { get; set; } [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider, OsuColour colour) diff --git a/osu.Game/Overlays/Wiki/WikiSidebar.cs b/osu.Game/Overlays/Wiki/WikiSidebar.cs index ee4e195f3f..da96885fb5 100644 --- a/osu.Game/Overlays/Wiki/WikiSidebar.cs +++ b/osu.Game/Overlays/Wiki/WikiSidebar.cs @@ -3,11 +3,13 @@ using Markdig.Syntax; using Markdig.Syntax.Inlines; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers.Markdown; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.Wiki { @@ -24,7 +26,7 @@ namespace osu.Game.Overlays.Wiki { new OsuSpriteText { - Text = "CONTENTS", + Text = WikiStrings.ShowToc.ToUpper(), Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), Margin = new MarginPadding { Bottom = 5 }, }, diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs index 9d5d8013b7..78b98a3649 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs @@ -17,6 +17,7 @@ using osu.Framework.Input.Events; using osu.Framework.Utils; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets.Edit; using osuTK; using osuTK.Input; @@ -358,7 +359,7 @@ namespace osu.Game.Screens.Edit.Compose.Components if (SelectedBlueprints.Count == 1) items.AddRange(SelectedBlueprints[0].ContextMenuItems); - items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, DeleteSelected)); + items.Add(new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, DeleteSelected)); return items.ToArray(); } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 602b7563ac..30c57733ed 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -29,6 +29,7 @@ using osu.Game.Input.Bindings; using osu.Game.Online.API; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets; using osu.Game.Rulesets.Edit; using osu.Game.Screens.Edit.Components; @@ -252,7 +253,7 @@ namespace osu.Game.Screens.Edit { Items = createFileMenuItems() }, - new MenuItem("Edit") + new MenuItem(CommonStrings.ButtonsEdit) { Items = new[] { diff --git a/osu.Game/Screens/Edit/Setup/DifficultySection.cs b/osu.Game/Screens/Edit/Setup/DifficultySection.cs index 75c6a89a66..e799081115 100644 --- a/osu.Game/Screens/Edit/Setup/DifficultySection.cs +++ b/osu.Game/Screens/Edit/Setup/DifficultySection.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Screens.Edit.Setup { @@ -27,7 +28,7 @@ namespace osu.Game.Screens.Edit.Setup { circleSizeSlider = new LabelledSliderBar { - Label = "Object Size", + Label = BeatmapsetsStrings.ShowStatsCs, FixedLabelWidth = LABEL_WIDTH, Description = "The size of all hit objects", Current = new BindableFloat(Beatmap.Difficulty.CircleSize) @@ -40,7 +41,7 @@ namespace osu.Game.Screens.Edit.Setup }, healthDrainSlider = new LabelledSliderBar { - Label = "Health Drain", + Label = BeatmapsetsStrings.ShowStatsDrain, FixedLabelWidth = LABEL_WIDTH, Description = "The rate of passive health drain throughout playable time", Current = new BindableFloat(Beatmap.Difficulty.DrainRate) @@ -53,7 +54,7 @@ namespace osu.Game.Screens.Edit.Setup }, approachRateSlider = new LabelledSliderBar { - Label = "Approach Rate", + Label = BeatmapsetsStrings.ShowStatsAr, FixedLabelWidth = LABEL_WIDTH, Description = "The speed at which objects are presented to the player", Current = new BindableFloat(Beatmap.Difficulty.ApproachRate) @@ -66,7 +67,7 @@ namespace osu.Game.Screens.Edit.Setup }, overallDifficultySlider = new LabelledSliderBar { - Label = "Overall Difficulty", + Label = BeatmapsetsStrings.ShowStatsAccuracy, FixedLabelWidth = LABEL_WIDTH, Description = "The harshness of hit windows and difficulty of special objects (ie. spinners)", Current = new BindableFloat(Beatmap.Difficulty.OverallDifficulty) diff --git a/osu.Game/Screens/Edit/Setup/MetadataSection.cs b/osu.Game/Screens/Edit/Setup/MetadataSection.cs index 571dfb3f6f..6262b4c18b 100644 --- a/osu.Game/Screens/Edit/Setup/MetadataSection.cs +++ b/osu.Game/Screens/Edit/Setup/MetadataSection.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Screens.Edit.Setup { @@ -48,15 +49,15 @@ namespace osu.Game.Screens.Edit.Setup creatorTextBox = createTextBox("Creator", metadata.Author.Username), difficultyTextBox = createTextBox("Difficulty Name", Beatmap.BeatmapInfo.DifficultyName), - sourceTextBox = createTextBox("Source", metadata.Source), - tagsTextBox = createTextBox("Tags", metadata.Tags) + sourceTextBox = createTextBox(BeatmapsetsStrings.ShowInfoSource, metadata.Source), + tagsTextBox = createTextBox(BeatmapsetsStrings.ShowInfoTags, metadata.Tags) }; foreach (var item in Children.OfType()) item.OnCommit += onCommit; } - private TTextBox createTextBox(string label, string initialValue) + private TTextBox createTextBox(LocalisableString label, string initialValue) where TTextBox : LabelledTextBox, new() => new TTextBox { diff --git a/osu.Game/Screens/OnlinePlay/Components/OverlinedHeader.cs b/osu.Game/Screens/OnlinePlay/Components/OverlinedHeader.cs index 08a0a3405e..f667a3c1d2 100644 --- a/osu.Game/Screens/OnlinePlay/Components/OverlinedHeader.cs +++ b/osu.Game/Screens/OnlinePlay/Components/OverlinedHeader.cs @@ -6,6 +6,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osuTK; @@ -34,7 +35,7 @@ namespace osu.Game.Screens.OnlinePlay.Components private readonly Circle line; private readonly OsuSpriteText details; - public OverlinedHeader(string title) + public OverlinedHeader(LocalisableString title) { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs index 25b36e0774..459b861d96 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs @@ -26,6 +26,7 @@ using osu.Game.Online; using osu.Game.Online.Chat; using osu.Game.Online.Rooms; using osu.Game.Overlays.BeatmapSet; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Screens.Play.HUD; @@ -449,7 +450,7 @@ namespace osu.Game.Screens.OnlinePlay Size = new Vector2(30, 30), Alpha = AllowEditing ? 1 : 0, Action = () => RequestEdit?.Invoke(Item), - TooltipText = "Edit" + TooltipText = CommonStrings.ButtonsEdit }, removeButton = new PlaylistRemoveButton { diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboardScore.cs b/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboardScore.cs index cf7e33fd63..799983342b 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboardScore.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboardScore.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Leaderboards; +using osu.Game.Resources.Localisation.Web; using osu.Game.Scoring; namespace osu.Game.Screens.OnlinePlay.Match.Components @@ -30,8 +31,8 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components protected override IEnumerable GetStatistics(ScoreInfo model) => new[] { - new LeaderboardScoreStatistic(FontAwesome.Solid.Crosshairs, "Accuracy", model.DisplayAccuracy), - new LeaderboardScoreStatistic(FontAwesome.Solid.Sync, "Total Attempts", score.TotalAttempts.ToString()), + new LeaderboardScoreStatistic(FontAwesome.Solid.Crosshairs, RankingsStrings.StatAccuracy, model.DisplayAccuracy), + new LeaderboardScoreStatistic(FontAwesome.Solid.Sync, RankingsStrings.StatPlayCount, score.TotalAttempts.ToString()), new LeaderboardScoreStatistic(FontAwesome.Solid.Check, "Completed Beatmaps", score.CompletedBeatmaps.ToString()), }; } diff --git a/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs b/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs index cdd2ae0c9c..1828a072f8 100644 --- a/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs @@ -10,6 +10,7 @@ using osu.Game.Beatmaps.Drawables; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms; +using osu.Game.Resources.Localisation.Web; using osu.Game.Screens.OnlinePlay.Lounge.Components; using osu.Game.Screens.OnlinePlay.Match.Components; using osuTK; @@ -49,7 +50,7 @@ namespace osu.Game.Screens.OnlinePlay.Match { RelativeSizeAxes = Axes.Y, Size = new Vector2(100, 1), - Text = "Edit", + Text = CommonStrings.ButtonsEdit, Action = () => OnEdit?.Invoke() }); } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsListHeader.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsListHeader.cs index 7e442c6568..ef84c4b4fa 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsListHeader.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsListHeader.cs @@ -3,6 +3,7 @@ using osu.Framework.Allocation; using osu.Game.Online.Multiplayer; +using osu.Game.Resources.Localisation.Web; using osu.Game.Screens.OnlinePlay.Components; namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants @@ -13,7 +14,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants private MultiplayerClient client { get; set; } public ParticipantsListHeader() - : base("Participants") + : base(RankingsStrings.SpotlightParticipants) { } diff --git a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs index 0d759bacf0..4a0bab84fa 100644 --- a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs +++ b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs @@ -14,6 +14,7 @@ using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets.Mods; using osu.Game.Screens.Play.HUD; using osuTK; @@ -158,7 +159,7 @@ namespace osu.Game.Screens.Play { new Drawable[] { - new MetadataLineLabel("Source"), + new MetadataLineLabel(BeatmapsetsStrings.ShowInfoSource), new MetadataLineInfo(metadata.Source) }, new Drawable[] @@ -213,7 +214,7 @@ namespace osu.Game.Screens.Play private class MetadataLineLabel : OsuSpriteText { - public MetadataLineLabel(string text) + public MetadataLineLabel(LocalisableString text) { Anchor = Anchor.TopRight; Origin = Anchor.TopRight; @@ -225,10 +226,10 @@ namespace osu.Game.Screens.Play private class MetadataLineInfo : OsuSpriteText { - public MetadataLineInfo(string text) + public MetadataLineInfo(LocalisableString text) { Margin = new MarginPadding { Left = 5 }; - Text = string.IsNullOrEmpty(text) ? @"-" : text; + Text = string.IsNullOrEmpty(text.ToString()) ? @"-" : text; } } } diff --git a/osu.Game/Screens/Play/Break/BreakInfo.cs b/osu.Game/Screens/Play/Break/BreakInfo.cs index 6349ebd9a7..f95e949920 100644 --- a/osu.Game/Screens/Play/Break/BreakInfo.cs +++ b/osu.Game/Screens/Play/Break/BreakInfo.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Resources.Localisation.Web; using osu.Game.Scoring; using osuTK; @@ -42,7 +43,7 @@ namespace osu.Game.Screens.Play.Break Direction = FillDirection.Vertical, Children = new Drawable[] { - AccuracyDisplay = new PercentageBreakInfoLine("Accuracy"), + AccuracyDisplay = new PercentageBreakInfoLine(BeatmapsetsStrings.ShowStatsAccuracy), // See https://github.com/ppy/osu/discussions/15185 // RankDisplay = new BreakInfoLine("Rank"), diff --git a/osu.Game/Screens/Play/Break/BreakInfoLine.cs b/osu.Game/Screens/Play/Break/BreakInfoLine.cs index 87f514ffd5..4cae90e50f 100644 --- a/osu.Game/Screens/Play/Break/BreakInfoLine.cs +++ b/osu.Game/Screens/Play/Break/BreakInfoLine.cs @@ -26,7 +26,7 @@ namespace osu.Game.Screens.Play.Break private readonly string prefix; - public BreakInfoLine(string name, string prefix = @"") + public BreakInfoLine(LocalisableString name, string prefix = @"") { this.prefix = prefix; @@ -82,7 +82,7 @@ namespace osu.Game.Screens.Play.Break public class PercentageBreakInfoLine : BreakInfoLine { - public PercentageBreakInfoLine(string name, string prefix = "") + public PercentageBreakInfoLine(LocalisableString name, string prefix = "") : base(name, prefix) { } diff --git a/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs b/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs index 8b1e0ae83e..019a9f9730 100644 --- a/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs +++ b/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs @@ -19,6 +19,7 @@ using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Judgements; @@ -200,7 +201,7 @@ namespace osu.Game.Screens.Play.HUD { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - Text = @"pp", + Text = BeatmapsetsStrings.ShowScoreboardHeaderspp, Font = OsuFont.Numeric.With(size: 8), Padding = new MarginPadding { Bottom = 1.5f }, // align baseline better } diff --git a/osu.Game/Screens/Play/PlayerSettings/AudioSettings.cs b/osu.Game/Screens/Play/PlayerSettings/AudioSettings.cs index 32de5333e1..90caf6f0f3 100644 --- a/osu.Game/Screens/Play/PlayerSettings/AudioSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/AudioSettings.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Configuration; +using osu.Game.Localisation; using osu.Game.Scoring; namespace osu.Game.Screens.Play.PlayerSettings @@ -20,7 +21,7 @@ namespace osu.Game.Screens.Play.PlayerSettings { Children = new Drawable[] { - beatmapHitsoundsToggle = new PlayerCheckbox { LabelText = "Beatmap hitsounds" }, + beatmapHitsoundsToggle = new PlayerCheckbox { LabelText = SkinSettingsStrings.BeatmapHitsounds }, new BeatmapOffsetControl { ReferenceScore = { BindTarget = ReferenceScore }, diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs index 81950efa9e..a999b32cb4 100644 --- a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Graphics.Sprites; +using osu.Game.Localisation; namespace osu.Game.Screens.Play.PlayerSettings { @@ -23,7 +24,7 @@ namespace osu.Game.Screens.Play.PlayerSettings { new OsuSpriteText { - Text = "Background dim:" + Text = GameplaySettingsStrings.BackgroundDim }, dimSliderBar = new PlayerSliderBar { @@ -31,7 +32,7 @@ namespace osu.Game.Screens.Play.PlayerSettings }, new OsuSpriteText { - Text = "Background blur:" + Text = GameplaySettingsStrings.BackgroundBlur }, blurSliderBar = new PlayerSliderBar { @@ -41,9 +42,9 @@ namespace osu.Game.Screens.Play.PlayerSettings { Text = "Toggles:" }, - showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboard / Video" }, - beatmapSkinsToggle = new PlayerCheckbox { LabelText = "Beatmap skins" }, - beatmapColorsToggle = new PlayerCheckbox { LabelText = "Beatmap colours" }, + showStoryboardToggle = new PlayerCheckbox { LabelText = GraphicsSettingsStrings.StoryboardVideo }, + beatmapSkinsToggle = new PlayerCheckbox { LabelText = SkinSettingsStrings.BeatmapSkins }, + beatmapColorsToggle = new PlayerCheckbox { LabelText = SkinSettingsStrings.BeatmapColours }, }; } diff --git a/osu.Game/Screens/Ranking/Contracted/ContractedPanelMiddleContent.cs b/osu.Game/Screens/Ranking/Contracted/ContractedPanelMiddleContent.cs index f9aff28bef..bb286f41c0 100644 --- a/osu.Game/Screens/Ranking/Contracted/ContractedPanelMiddleContent.cs +++ b/osu.Game/Screens/Ranking/Contracted/ContractedPanelMiddleContent.cs @@ -9,9 +9,11 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; +using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.Leaderboards; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; using osu.Game.Screens.Play.HUD; @@ -127,8 +129,8 @@ namespace osu.Game.Screens.Ranking.Contracted Spacing = new Vector2(0, 5), Children = new[] { - createStatistic("Max Combo", $"x{score.MaxCombo}"), - createStatistic("Accuracy", $"{score.Accuracy.FormatAccuracy()}"), + createStatistic(BeatmapsetsStrings.ShowScoreboardHeadersCombo, $"x{score.MaxCombo}"), + createStatistic(BeatmapsetsStrings.ShowScoreboardHeadersAccuracy, $"{score.Accuracy.FormatAccuracy()}"), } }, new ModFlowDisplay @@ -200,7 +202,7 @@ namespace osu.Game.Screens.Ranking.Contracted private Drawable createStatistic(HitResultDisplayStatistic result) => createStatistic(result.DisplayName, result.MaxCount == null ? $"{result.Count}" : $"{result.Count}/{result.MaxCount}"); - private Drawable createStatistic(string key, string value) => new Container + private Drawable createStatistic(LocalisableString key, string value) => new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/AccuracyStatistic.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/AccuracyStatistic.cs index 476c9fb42f..25a644d8d9 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/AccuracyStatistic.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/AccuracyStatistic.cs @@ -6,6 +6,7 @@ using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Resources.Localisation.Web; using osu.Game.Screens.Ranking.Expanded.Accuracy; using osu.Game.Utils; using osuTK; @@ -26,7 +27,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics /// /// The accuracy to display. public AccuracyStatistic(double accuracy) - : base("accuracy") + : base(BeatmapsetsStrings.ShowScoreboardHeadersAccuracy) { this.accuracy = accuracy; } diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs index 0e42ec026a..cb25736f6e 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Resources.Localisation.Web; using osu.Game.Screens.Ranking.Expanded.Accuracy; using osuTK; @@ -27,7 +28,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics /// The combo to be displayed. /// The maximum value of . public ComboStatistic(int combo, int? maxCombo) - : base("combo", combo, maxCombo) + : base(BeatmapsetsStrings.ShowScoreboardHeadersCombo, combo, maxCombo) { isPerfect = combo == maxCombo; } diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/CounterStatistic.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/CounterStatistic.cs index d37f6c5e5f..b1c72173da 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/CounterStatistic.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/CounterStatistic.cs @@ -3,6 +3,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -26,7 +27,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics /// The name of the statistic. /// The value to display. /// The maximum value of . Not displayed if null. - public CounterStatistic(string header, int count, int? maxCount = null) + public CounterStatistic(LocalisableString header, int count, int? maxCount = null) : base(header) { this.count = count; diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/PerformanceStatistic.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/PerformanceStatistic.cs index 95f017d625..c681946a2f 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/PerformanceStatistic.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/PerformanceStatistic.cs @@ -8,6 +8,7 @@ using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; +using osu.Game.Resources.Localisation.Web; using osu.Game.Scoring; namespace osu.Game.Screens.Ranking.Expanded.Statistics @@ -23,7 +24,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics private RollingCounter counter; public PerformanceStatistic(ScoreInfo score) - : base("PP") + : base(BeatmapsetsStrings.ShowScoreboardHeaderspp) { this.score = score; } diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/StatisticDisplay.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/StatisticDisplay.cs index 9206c58bc9..c034abc916 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/StatisticDisplay.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/StatisticDisplay.cs @@ -3,10 +3,12 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -19,14 +21,14 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics { protected SpriteText HeaderText { get; private set; } - private readonly string header; + private readonly LocalisableString header; private Drawable content; /// /// Creates a new . /// /// The name of the statistic. - protected StatisticDisplay(string header) + protected StatisticDisplay(LocalisableString header) { this.header = header; RelativeSizeAxes = Axes.X; @@ -60,7 +62,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics Anchor = Anchor.Centre, Origin = Anchor.Centre, Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold), - Text = header.ToUpperInvariant(), + Text = header.ToUpper(), } } }, diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index bbe0a37d8e..9ff1574fe4 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -16,6 +16,7 @@ using osu.Game.Online; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Overlays.BeatmapSet; +using osu.Game.Resources.Localisation.Web; using osu.Game.Screens.Select.Details; using osuTK; using osuTK.Graphics; @@ -155,7 +156,7 @@ namespace osu.Game.Screens.Select { new OsuSpriteText { - Text = "Points of Failure", + Text = BeatmapsetsStrings.ShowInfoPointsOfFailure, Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14), }, failRetryGraph = new FailRetryGraph diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 3576b77ae8..c6037d1bd6 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -24,6 +24,7 @@ using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; +using osu.Game.Resources.Localisation.Web; using osuTK; using osuTK.Graphics; @@ -136,14 +137,7 @@ namespace osu.Game.Screens.Select.Carousel }, new OsuSpriteText { - Text = "mapped by", - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft - }, - new OsuSpriteText - { - Text = $"{beatmapInfo.Metadata.Author.Username}", - Font = OsuFont.GetFont(italics: true), + Text = BeatmapsetsStrings.ShowDetailsMappedBy(beatmapInfo.Metadata.Author.Username), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft }, @@ -235,7 +229,7 @@ namespace osu.Game.Screens.Select.Carousel items.Add(new OsuMenuItem("Play", MenuItemType.Highlighted, () => startRequested(beatmapInfo))); if (editRequested != null) - items.Add(new OsuMenuItem("Edit", MenuItemType.Standard, () => editRequested(beatmapInfo))); + items.Add(new OsuMenuItem(CommonStrings.ButtonsEdit, MenuItemType.Standard, () => editRequested(beatmapInfo))); if (beatmapInfo.OnlineID > 0 && beatmapOverlay != null) items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(beatmapInfo.OnlineID))); @@ -250,7 +244,7 @@ namespace osu.Game.Screens.Select.Carousel } if (hideRequested != null) - items.Add(new OsuMenuItem("Hide", MenuItemType.Destructive, () => hideRequested(beatmapInfo))); + items.Add(new OsuMenuItem(CommonStrings.ButtonsHide, MenuItemType.Destructive, () => hideRequested(beatmapInfo))); return items.ToArray(); } diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index adaaa6425c..a6f2520472 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -21,6 +21,7 @@ using osu.Framework.Localisation; using osu.Framework.Threading; using osu.Framework.Utils; using osu.Game.Configuration; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets; namespace osu.Game.Screens.Select.Details @@ -63,10 +64,10 @@ namespace osu.Game.Screens.Select.Details Children = new[] { FirstValue = new StatisticRow(), // circle size/key amount - HpDrain = new StatisticRow { Title = "HP Drain" }, - Accuracy = new StatisticRow { Title = "Accuracy" }, - ApproachRate = new StatisticRow { Title = "Approach Rate" }, - starDifficulty = new StatisticRow(10, true) { Title = "Star Difficulty" }, + HpDrain = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsDrain }, + Accuracy = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsAccuracy }, + ApproachRate = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsAr }, + starDifficulty = new StatisticRow(10, true) { Title = BeatmapsetsStrings.ShowStatsStars }, }, }; } @@ -120,12 +121,12 @@ namespace osu.Game.Screens.Select.Details case 3: // Account for mania differences locally for now // Eventually this should be handled in a more modular way, allowing rulesets to return arbitrary difficulty attributes - FirstValue.Title = "Key Count"; + FirstValue.Title = BeatmapsetsStrings.ShowStatsCsMania; FirstValue.Value = (baseDifficulty?.CircleSize ?? 0, null); break; default: - FirstValue.Title = "Circle Size"; + FirstValue.Title = BeatmapsetsStrings.ShowStatsCs; FirstValue.Value = (baseDifficulty?.CircleSize ?? 0, adjustedDifficulty?.CircleSize); break; } diff --git a/osu.Game/Screens/Select/Filter/SortMode.cs b/osu.Game/Screens/Select/Filter/SortMode.cs index 18c5d713e1..1ab54fa069 100644 --- a/osu.Game/Screens/Select/Filter/SortMode.cs +++ b/osu.Game/Screens/Select/Filter/SortMode.cs @@ -2,36 +2,38 @@ // See the LICENCE file in the repository root for full licence text. using System.ComponentModel; +using osu.Framework.Localisation; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Screens.Select.Filter { public enum SortMode { - [Description("Artist")] + [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingArtist))] Artist, [Description("Author")] Author, - [Description("BPM")] + [LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowStatsBpm))] BPM, [Description("Date Added")] DateAdded, - [Description("Difficulty")] + [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingDifficulty))] Difficulty, - [Description("Length")] + [LocalisableDescription(typeof(SortStrings), nameof(SortStrings.ArtistTracksLength))] Length, - [Description("Rank Achieved")] + [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchFiltersRank))] RankAchieved, - [Description("Source")] + [LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowInfoSource))] Source, - [Description("Title")] + [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingTitle))] Title, } } diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index b53d64260a..65dde146bb 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -14,6 +14,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets; using osu.Game.Screens.Select.Filter; using osuTK; @@ -139,7 +140,7 @@ namespace osu.Game.Screens.Select }, new OsuSpriteText { - Text = "Sort by", + Text = SortStrings.Default, Font = OsuFont.GetFont(size: 14), Margin = new MarginPadding(5), Anchor = Anchor.BottomRight, diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs index b5fdbd225f..1a8b69d859 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs @@ -13,6 +13,7 @@ using osuTK.Input; using osu.Game.Graphics.Containers; using osu.Framework.Input.Events; using System.Linq; +using osu.Framework.Localisation; namespace osu.Game.Screens.Select.Options { @@ -63,7 +64,7 @@ namespace osu.Game.Screens.Select.Options /// Colour of the button. /// Icon of the button. /// Binding the button does. - public void AddButton(string firstLine, string secondLine, IconUsage icon, Color4 colour, Action action) + public void AddButton(LocalisableString firstLine, string secondLine, IconUsage icon, Color4 colour, Action action) { var button = new BeatmapOptionsButton { diff --git a/osu.Game/Users/UserStatus.cs b/osu.Game/Users/UserStatus.cs index 21c18413f4..7f275b3b2a 100644 --- a/osu.Game/Users/UserStatus.cs +++ b/osu.Game/Users/UserStatus.cs @@ -1,20 +1,22 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Localisation; using osuTK.Graphics; using osu.Game.Graphics; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Users { public abstract class UserStatus { - public abstract string Message { get; } + public abstract LocalisableString Message { get; } public abstract Color4 GetAppropriateColour(OsuColour colours); } public class UserStatusOnline : UserStatus { - public override string Message => @"Online"; + public override LocalisableString Message => UsersStrings.StatusOnline; public override Color4 GetAppropriateColour(OsuColour colours) => colours.GreenLight; } @@ -25,13 +27,13 @@ namespace osu.Game.Users public class UserStatusOffline : UserStatus { - public override string Message => @"Offline"; + public override LocalisableString Message => UsersStrings.StatusOffline; public override Color4 GetAppropriateColour(OsuColour colours) => Color4.Black; } public class UserStatusDoNotDisturb : UserStatus { - public override string Message => @"Do not disturb"; + public override LocalisableString Message => "Do not disturb"; public override Color4 GetAppropriateColour(OsuColour colours) => colours.RedDark; } } From 0146949ad60c45e788230e6336bfb29aaaa3491e Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Wed, 20 Apr 2022 16:52:24 -0700 Subject: [PATCH 0378/2328] Fix failing string comparison tests --- osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs index 7ceae0a69b..8af70df48a 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Graphics; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Mods; @@ -55,7 +56,7 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep("no mods selected", () => SelectedMods.Value = Array.Empty()); - AddAssert("first bar text is Circle Size", () => advancedStats.ChildrenOfType().First().Text == "Circle Size"); + AddAssert("first bar text is correct", () => advancedStats.ChildrenOfType().First().Text == BeatmapsetsStrings.ShowStatsCs); AddAssert("circle size bar is white", () => barIsWhite(advancedStats.FirstValue)); AddAssert("HP drain bar is white", () => barIsWhite(advancedStats.HpDrain)); AddAssert("accuracy bar is white", () => barIsWhite(advancedStats.Accuracy)); @@ -78,7 +79,7 @@ namespace osu.Game.Tests.Visual.SongSelect StarRating = 8 }); - AddAssert("first bar text is Key Count", () => advancedStats.ChildrenOfType().First().Text == "Key Count"); + AddAssert("first bar text is correct", () => advancedStats.ChildrenOfType().First().Text == BeatmapsetsStrings.ShowStatsCsMania); } [Test] From 56d8de23e2b649f305c87111fd31dd3a0abbaec1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Apr 2022 12:18:54 +0900 Subject: [PATCH 0379/2328] Replace horse with "more suitable" icon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index d5aa1178e0..f73d82b793 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -303,7 +303,7 @@ namespace osu.Game.Overlays notificationOverlay.Post(new SimpleNotification { Text = FirstRunSetupOverlayStrings.ClickToResumeFirstRunSetupAtAnyPoint, - Icon = FontAwesome.Solid.Horse, + Icon = FontAwesome.Solid.Redo, Activated = () => { Show(); From a9163727db6195bee3a4212ad6d4c3cf8b1d0804 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Apr 2022 13:44:14 +0900 Subject: [PATCH 0380/2328] Mark selected channel null in test when selector is activated --- osu.Game.Tests/Visual/Online/TestSceneChannelList.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs index d6a1e71f0d..a3bfbd47a3 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs @@ -104,6 +104,7 @@ namespace osu.Game.Tests.Visual.Online channelList.SelectorActive.BindValueChanged(change => { selectorText.Text = $"Channel Selector Active: {change.NewValue}"; + selected.Value = null; }, true); selected.BindValueChanged(change => From 9f525ee26743ce70b1f200979c1664841fef0896 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Apr 2022 14:09:51 +0900 Subject: [PATCH 0381/2328] Revert localisation of spectate/watch button --- osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index e036f1d304..9807a65250 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -139,7 +139,7 @@ namespace osu.Game.Overlays.Dashboard new PurpleTriangleButton { RelativeSizeAxes = Axes.X, - Text = CommonStrings.ButtonsWatchTo1, + Text = "Spectate", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Action = () => performer?.PerformFromScreen(s => s.Push(new SoloSpectator(User))), From 848366416e7595b1dce036fa186e0f1369b66c5c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Apr 2022 14:10:58 +0900 Subject: [PATCH 0382/2328] Revert string type changes in `MetadataLineInfo` --- osu.Game/Screens/Play/BeatmapMetadataDisplay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs index 4a0bab84fa..e8021d4065 100644 --- a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs +++ b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs @@ -226,10 +226,10 @@ namespace osu.Game.Screens.Play private class MetadataLineInfo : OsuSpriteText { - public MetadataLineInfo(LocalisableString text) + public MetadataLineInfo(string text) { Margin = new MarginPadding { Left = 5 }; - Text = string.IsNullOrEmpty(text.ToString()) ? @"-" : text; + Text = string.IsNullOrEmpty(text) ? @"-" : text; } } } From e54d3702a6fa6ec1b72432c4bde79428aa7927b3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Apr 2022 15:16:39 +0900 Subject: [PATCH 0383/2328] Specify web proxy in SignalR connection building Might solve https://github.com/ppy/osu/discussions/17897 (depends on how adeptly signalr falls back to long polling if/when is fails to websocket via the proxy, or maybe succeed). As with the framework side change, I've tested this to not break a zero-proxy flow. Intending to have the user test this after next release. Reference: https://stackoverflow.com/questions/59343807/get-system-default-web-proxy-in-net-core / https://stackoverflow.com/questions/13515058/using-signalr-client-through-a-web-proxy --- osu.Game/Online/HubClientConnector.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Online/HubClientConnector.cs b/osu.Game/Online/HubClientConnector.cs index c79660568c..ca9bf00b23 100644 --- a/osu.Game/Online/HubClientConnector.cs +++ b/osu.Game/Online/HubClientConnector.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.Net; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.SignalR.Client; @@ -144,6 +145,12 @@ namespace osu.Game.Online var builder = new HubConnectionBuilder() .WithUrl(endpoint, options => { + // Use HttpClient.DefaultProxy once on net6 everywhere. + // The credential setter can also be removed at this point. + options.Proxy = WebRequest.DefaultWebProxy; + if (options.Proxy != null) + options.Proxy.Credentials = CredentialCache.DefaultCredentials; + options.Headers.Add("Authorization", $"Bearer {api.AccessToken}"); options.Headers.Add("OsuVersionHash", versionHash); }); From b4c208be63db5babf41d3301de4f07f59379a7c9 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 21 Apr 2022 15:34:01 +0900 Subject: [PATCH 0384/2328] Move Code Quality check to top of checks list --- .github/workflows/ci.yml | 110 +++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e7f9628fc..f2066f27de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,60 @@ on: [push, pull_request] name: Continuous Integration jobs: + inspect-code: + name: Code Quality + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + # FIXME: Tools won't run in .NET 6.0 unless you install 3.1.x LTS side by side. + # https://itnext.io/how-to-support-multiple-net-sdks-in-github-actions-workflows-b988daa884e + - name: Install .NET 3.1.x LTS + uses: actions/setup-dotnet@v1 + with: + dotnet-version: "3.1.x" + + - name: Install .NET 6.0.x + uses: actions/setup-dotnet@v1 + with: + dotnet-version: "6.0.x" + + - name: Restore Tools + run: dotnet tool restore + + - name: Restore Packages + run: dotnet restore + + - name: Restore inspectcode cache + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/inspectcode + key: inspectcode-${{ hashFiles('.config/dotnet-tools.json') }}-${{ hashFiles('.github/workflows/ci.yml' ) }} + + - name: CodeFileSanity + run: | + # TODO: Add ignore filters and GitHub Workflow Command Reporting in CFS. That way we don't have to do this workaround. + # FIXME: Suppress warnings from templates project + exit_code=0 + while read -r line; do + if [[ ! -z "$line" ]]; then + echo "::error::$line" + exit_code=1 + fi + done <<< $(dotnet codefilesanity) + exit $exit_code + + # Temporarily disabled due to test failures, but it won't work anyway until the tool is upgraded. + # - name: .NET Format (Dry Run) + # run: dotnet format --dry-run --check + + - name: InspectCode + run: dotnet jb inspectcode $(pwd)/osu.Desktop.slnf --no-build --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN + + - name: NVika + run: dotnet nvika parsereport "${{github.workspace}}/inspectcodereport.xml" --treatwarningsaserrors + test: name: Test runs-on: ${{matrix.os.fullname}} @@ -93,58 +147,4 @@ jobs: # cannot accept .sln(f) files as arguments. # Build just the main game for now. - name: Build - run: msbuild osu.iOS/osu.iOS.csproj /restore /p:Configuration=Debug - - inspect-code: - name: Code Quality - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - # FIXME: Tools won't run in .NET 6.0 unless you install 3.1.x LTS side by side. - # https://itnext.io/how-to-support-multiple-net-sdks-in-github-actions-workflows-b988daa884e - - name: Install .NET 3.1.x LTS - uses: actions/setup-dotnet@v1 - with: - dotnet-version: "3.1.x" - - - name: Install .NET 6.0.x - uses: actions/setup-dotnet@v1 - with: - dotnet-version: "6.0.x" - - - name: Restore Tools - run: dotnet tool restore - - - name: Restore Packages - run: dotnet restore - - - name: Restore inspectcode cache - uses: actions/cache@v3 - with: - path: ${{ github.workspace }}/inspectcode - key: inspectcode-${{ hashFiles('.config/dotnet-tools.json') }}-${{ hashFiles('.github/workflows/ci.yml' ) }} - - - name: CodeFileSanity - run: | - # TODO: Add ignore filters and GitHub Workflow Command Reporting in CFS. That way we don't have to do this workaround. - # FIXME: Suppress warnings from templates project - exit_code=0 - while read -r line; do - if [[ ! -z "$line" ]]; then - echo "::error::$line" - exit_code=1 - fi - done <<< $(dotnet codefilesanity) - exit $exit_code - - # Temporarily disabled due to test failures, but it won't work anyway until the tool is upgraded. - # - name: .NET Format (Dry Run) - # run: dotnet format --dry-run --check - - - name: InspectCode - run: dotnet jb inspectcode $(pwd)/osu.Desktop.slnf --no-build --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN - - - name: NVika - run: dotnet nvika parsereport "${{github.workspace}}/inspectcodereport.xml" --treatwarningsaserrors + run: msbuild osu.iOS/osu.iOS.csproj /restore /p:Configuration=Debug \ No newline at end of file From 54ca4b9d36f55bd9e3636b1c88eea0ef553753e6 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 21 Apr 2022 15:34:14 +0900 Subject: [PATCH 0385/2328] Remove unused using --- osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index 9807a65250..a9312e9a3a 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -14,7 +14,6 @@ using osu.Game.Database; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Spectator; -using osu.Game.Resources.Localisation.Web; using osu.Game.Screens; using osu.Game.Screens.OnlinePlay.Match.Components; using osu.Game.Screens.Play; From 414408140e0e66e394dafc1738c2a2c574496f87 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Thu, 21 Apr 2022 10:16:52 +0300 Subject: [PATCH 0386/2328] Improve AnchorOriginVisualiser --- osu.Game/Skinning/Editor/SkinBlueprint.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Skinning/Editor/SkinBlueprint.cs b/osu.Game/Skinning/Editor/SkinBlueprint.cs index 0a4bd1d75f..1860c6006c 100644 --- a/osu.Game/Skinning/Editor/SkinBlueprint.cs +++ b/osu.Game/Skinning/Editor/SkinBlueprint.cs @@ -146,8 +146,10 @@ namespace osu.Game.Skinning.Editor { anchorLine = new Box { - Colour = Color4.Yellow, Height = 2, + Origin = Anchor.CentreLeft, + Colour = Color4.Yellow, + EdgeSmoothness = Vector2.One }, originBox = new Box { From 2769d8e8cfdbded19d1ba4407053efb8c162ae43 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Apr 2022 16:24:21 +0900 Subject: [PATCH 0387/2328] Add test coverage of `ShearedOverlayContainer` --- .../TestSceneShearedOverlayContainer.cs | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayContainer.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayContainer.cs new file mode 100644 index 0000000000..5a9cafde27 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayContainer.cs @@ -0,0 +1,102 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Testing; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; +using osu.Game.Overlays.Mods; +using osuTK; +using osuTK.Graphics; +using osuTK.Input; + +namespace osu.Game.Tests.Visual.UserInterface +{ + [TestFixture] + public class TestSceneShearedOverlayContainer : OsuManualInputManagerTestScene + { + private TestShearedOverlayContainer overlay; + + [SetUpSteps] + public void SetUpSteps() + { + AddStep("create overlay", () => + { + Child = overlay = new TestShearedOverlayContainer + { + State = { Value = Visibility.Visible } + }; + }); + } + + [Test] + public void TestClickAwayToExit() + { + AddStep("click inside header", () => + { + InputManager.MoveMouseTo(overlay.ChildrenOfType().First().ScreenSpaceDrawQuad.Centre); + InputManager.Click(MouseButton.Left); + }); + + AddAssert("overlay not dismissed", () => overlay.State.Value == Visibility.Visible); + + AddStep("click inside content", () => + { + InputManager.MoveMouseTo(overlay.ScreenSpaceDrawQuad.Centre); + InputManager.Click(MouseButton.Left); + }); + + AddAssert("overlay not dismissed", () => overlay.State.Value == Visibility.Visible); + + AddStep("click outside header", () => + { + InputManager.MoveMouseTo(new Vector2(overlay.ScreenSpaceDrawQuad.TopLeft.X, overlay.ScreenSpaceDrawQuad.Centre.Y)); + InputManager.Click(MouseButton.Left); + }); + + AddAssert("overlay dismissed", () => overlay.State.Value == Visibility.Hidden); + } + + public class TestShearedOverlayContainer : ShearedOverlayContainer + { + protected override OverlayColourScheme ColourScheme => OverlayColourScheme.Green; + + [BackgroundDependencyLoader] + private void load() + { + Header.Title = "Sheared overlay header"; + Header.Description = string.Join(" ", Enumerable.Repeat("This is a description.", 20)); + + MainAreaContent.Child = new InputBlockingContainer + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(0.9f), + Children = new Drawable[] + { + new Box + { + Colour = Color4.Blue, + RelativeSizeAxes = Axes.Both, + }, + new OsuSpriteText + { + Font = OsuFont.Default.With(size: 24), + Text = "Content", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + } + } + }; + } + } + } +} From 0f4b40ab15b2727d5cf66c2f0a3bf606403e9c51 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Apr 2022 16:15:10 +0900 Subject: [PATCH 0388/2328] Add better click-to-dismiss logic for sheared overlays --- osu.Game/Graphics/InputBlockingContainer.cs | 21 +++++++++++++++++++ .../UserInterface/ShearedOverlayHeader.cs | 2 +- .../Overlays/Mods/ShearedOverlayContainer.cs | 15 ++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 osu.Game/Graphics/InputBlockingContainer.cs diff --git a/osu.Game/Graphics/InputBlockingContainer.cs b/osu.Game/Graphics/InputBlockingContainer.cs new file mode 100644 index 0000000000..d8387b1401 --- /dev/null +++ b/osu.Game/Graphics/InputBlockingContainer.cs @@ -0,0 +1,21 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable +using osu.Framework.Graphics.Containers; +using osu.Framework.Input.Events; + +namespace osu.Game.Graphics +{ + /// + /// A simple container which blocks input events from travelling through it. + /// + public class InputBlockingContainer : Container + { + protected override bool OnHover(HoverEvent e) => true; + + protected override bool OnMouseDown(MouseDownEvent e) => true; + + protected override bool OnClick(ClickEvent e) => true; + } +} diff --git a/osu.Game/Graphics/UserInterface/ShearedOverlayHeader.cs b/osu.Game/Graphics/UserInterface/ShearedOverlayHeader.cs index 9ed7bb35de..452a1dd394 100644 --- a/osu.Game/Graphics/UserInterface/ShearedOverlayHeader.cs +++ b/osu.Game/Graphics/UserInterface/ShearedOverlayHeader.cs @@ -66,7 +66,7 @@ namespace osu.Game.Graphics.UserInterface }, Children = new Drawable[] { - underlayContainer = new Container + underlayContainer = new InputBlockingContainer { RelativeSizeAxes = Axes.X, Height = HEIGHT, diff --git a/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs index 62ed736dc2..eca192c8e5 100644 --- a/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs +++ b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs @@ -5,6 +5,8 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -88,7 +90,7 @@ namespace osu.Game.Overlays.Mods Bottom = footer_height + PADDING, } }, - Footer = new Container + Footer = new InputBlockingContainer { RelativeSizeAxes = Axes.X, Depth = float.MinValue, @@ -113,6 +115,17 @@ namespace osu.Game.Overlays.Mods }; } + protected override bool OnClick(ClickEvent e) + { + if (State.Value == Visibility.Visible) + { + Hide(); + return true; + } + + return base.OnClick(e); + } + protected override void PopIn() { const double fade_in_duration = 400; From 0b81ae9de2af8883ceb5931ed964e9949672b85c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Apr 2022 16:51:26 +0900 Subject: [PATCH 0389/2328] Convert to using sheared overlay container Add better click-to-dismiss logic for sheader overlays --- .../TestSceneFirstRunSetupOverlay.cs | 2 +- osu.Game/Overlays/FirstRunSetupOverlay.cs | 221 ++++++------------ 2 files changed, 75 insertions(+), 148 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index efce4f350b..e925859d71 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -165,7 +165,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("click outside content", () => { - InputManager.MoveMouseTo(overlay.ScreenSpaceDrawQuad.TopLeft - new Vector2(1)); + InputManager.MoveMouseTo(new Vector2(overlay.ScreenSpaceDrawQuad.TopLeft.X, overlay.ScreenSpaceDrawQuad.Centre.Y)); InputManager.Click(MouseButton.Left); }); diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index f73d82b793..d0e721cf46 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -7,10 +7,8 @@ using System; using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Bindables; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; @@ -18,25 +16,22 @@ using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Game.Configuration; using osu.Game.Graphics; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; using osu.Game.Localisation; using osu.Game.Overlays.FirstRunSetup; +using osu.Game.Overlays.Mods; using osu.Game.Overlays.Notifications; using osu.Game.Screens; using osu.Game.Screens.Menu; using osu.Game.Screens.OnlinePlay.Match.Components; -using osuTK; -using osuTK.Graphics; namespace osu.Game.Overlays { [Cached] - public class FirstRunSetupOverlay : OsuFocusedOverlayContainer + public class FirstRunSetupOverlay : ShearedOverlayContainer { - protected override bool StartHidden => true; + protected override OverlayColourScheme ColourScheme => OverlayColourScheme.Purple; [Resolved] private IPerformFromScreenRunner performer { get; set; } = null!; @@ -52,15 +47,10 @@ namespace osu.Game.Overlays public PurpleTriangleButton NextButton = null!; public DangerousTriangleButton BackButton = null!; - [Cached] - private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); - private readonly Bindable showFirstRunSetup = new Bindable(); private int? currentStepIndex; - private const float scale_when_hidden = 0.9f; - /// /// The currently displayed screen, if any. /// @@ -76,149 +66,89 @@ namespace osu.Game.Overlays private Bindable? overlayActivationMode; - public FirstRunSetupOverlay() - { - RelativeSizeAxes = Axes.Both; - } + private Container content = null!; [BackgroundDependencyLoader] private void load() { - Anchor = Anchor.Centre; - Origin = Anchor.Centre; + Header.Title = FirstRunSetupOverlayStrings.FirstRunSetup; + Header.Description = FirstRunSetupOverlayStrings.SetupOsuToSuitYou; - RelativeSizeAxes = Axes.Both; - Size = new Vector2(0.95f); - - EdgeEffect = new EdgeEffectParameters + MainAreaContent.AddRange(new Drawable[] { - Type = EdgeEffectType.Shadow, - Radius = 5, - Colour = Color4.Black.Opacity(0.2f), - }; - - Masking = true; - CornerRadius = 10; - - Children = new Drawable[] - { - new Box + content = new Container { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, - Colour = colourProvider.Background6, - }, - new GridContainer - { - RelativeSizeAxes = Axes.Both, - RowDimensions = new[] + Padding = new MarginPadding { Horizontal = 50 }, + Child = new InputBlockingContainer { - new Dimension(GridSizeMode.AutoSize), - new Dimension(), - new Dimension(GridSizeMode.AutoSize), - }, - Content = new[] - { - new Drawable[] + Masking = true, + CornerRadius = 14, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] { - new Container - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Children = new Drawable[] - { - new Box - { - Colour = colourProvider.Background5, - RelativeSizeAxes = Axes.Both, - }, - new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - Margin = new MarginPadding(10), - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Children = new Drawable[] - { - new OsuSpriteText - { - Text = FirstRunSetupOverlayStrings.FirstRunSetup, - Font = OsuFont.Default.With(size: 32), - Colour = colourProvider.Content1, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - }, - new OsuTextFlowContainer - { - Text = FirstRunSetupOverlayStrings.SetupOsuToSuitYou, - Colour = colourProvider.Content2, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - AutoSizeAxes = Axes.Both, - }, - } - }, - } - }, - }, - new Drawable[] - { - stackContainer = new Container + new Box { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding(20), + Colour = ColourProvider.Background6, }, - }, - new Drawable[] - { - new Container + stackContainer = new Container { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding(20) + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { - Top = 0 // provided by the stack container above. - }, - Child = new GridContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - ColumnDimensions = new[] - { - new Dimension(GridSizeMode.AutoSize), - new Dimension(GridSizeMode.Absolute, 10), - new Dimension(), - }, - RowDimensions = new[] - { - new Dimension(GridSizeMode.AutoSize), - }, - Content = new[] - { - new[] - { - BackButton = new DangerousTriangleButton - { - Width = 200, - Text = CommonStrings.Back, - Action = showPreviousStep, - Enabled = { Value = false }, - }, - Empty(), - NextButton = new PurpleTriangleButton - { - RelativeSizeAxes = Axes.X, - Width = 1, - Text = FirstRunSetupOverlayStrings.GetStarted, - Action = showNextStep - } - }, - } + Vertical = 20, + Horizontal = 20, }, } - } - } + }, + }, }, - }; + }); + + FooterContent.Add(new GridContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Width = 0.98f, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.Absolute, 10), + new Dimension(), + }, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize), + }, + Content = new[] + { + new[] + { + BackButton = new DangerousTriangleButton + { + Width = 200, + Text = CommonStrings.Back, + Action = showPreviousStep, + Enabled = { Value = false }, + }, + Empty(), + NextButton = new PurpleTriangleButton + { + RelativeSizeAxes = Axes.X, + Width = 1, + Text = FirstRunSetupOverlayStrings.GetStarted, + Action = showNextStep + } + }, + } + }); } protected override void LoadComplete() @@ -280,10 +210,8 @@ namespace osu.Game.Overlays { base.PopIn(); - this.ScaleTo(scale_when_hidden) - .ScaleTo(1, 400, Easing.OutElasticHalf); - - this.FadeIn(400, Easing.OutQuint); + content.ScaleTo(0.99f) + .ScaleTo(1, 400, Easing.OutQuint); if (currentStepIndex == null) showFirstStep(); @@ -291,6 +219,10 @@ namespace osu.Game.Overlays protected override void PopOut() { + base.PopOut(); + + content.ScaleTo(0.99f, 400, Easing.OutQuint); + if (overlayActivationMode != null) { // If this is non-null we are guaranteed to have come from the main menu. @@ -316,11 +248,6 @@ namespace osu.Game.Overlays stack?.FadeOut(100) .Expire(); } - - base.PopOut(); - - this.ScaleTo(0.96f, 400, Easing.OutQuint); - this.FadeOut(200, Easing.OutQuint); } private void showFirstStep() From f5d24add58766dfdf8822271907a32349a9df27f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Apr 2022 16:49:21 +0900 Subject: [PATCH 0390/2328] Fix `TestSceneSkinnableSound` not working under visual tests oops --- osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs index ccf13e1e8f..64afe1235b 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs @@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.Gameplay private TestSkinSourceContainer skinSource; private PausableSkinnableSound skinnableSound; - [SetUp] + [SetUpSteps] public void SetUpSteps() { AddStep("setup hierarchy", () => From 5ae3d0eb274785ac3bb55cf26e8860ca7e35456e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Apr 2022 19:36:19 +0900 Subject: [PATCH 0391/2328] Fix wording of ui scale screen description Co-authored-by: Walavouchey <36758269+Walavouchey@users.noreply.github.com> --- osu.Game/Localisation/FirstRunSetupOverlayStrings.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs index ec2e97d82a..b55102db20 100644 --- a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs +++ b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs @@ -44,9 +44,9 @@ namespace osu.Game.Localisation osu! is a very configurable game, and diving straight into the settings can sometimes be overwhelming. This guide will help you get the important choices out of the way to ensure a great first experience!"); /// - /// "The size of the osu! user interface size can be adjusted to your liking." + /// "The size of the osu! user interface can be adjusted to your liking." /// - public static LocalisableString UIScaleDescription => new TranslatableString(getKey(@"ui_scale_description"), @"The size of the osu! user interface size can be adjusted to your liking."); + public static LocalisableString UIScaleDescription => new TranslatableString(getKey(@"ui_scale_description"), @"The size of the osu! user interface can be adjusted to your liking."); /// /// "Next ({0})" From 1f967ecba3f4b30821640091d94ee55d238e44cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Apr 2022 19:52:28 +0900 Subject: [PATCH 0392/2328] Update string keys and change "setup" to "set up" to fix grammar --- osu.Game/Localisation/FirstRunSetupOverlayStrings.cs | 6 +++--- osu.Game/Overlays/FirstRunSetupOverlay.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs index b55102db20..d2fb0e7467 100644 --- a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs +++ b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs @@ -22,12 +22,12 @@ namespace osu.Game.Localisation /// /// "First-run setup" /// - public static LocalisableString FirstRunSetup => new TranslatableString(getKey(@"first_run_setup"), @"First-run setup"); + public static LocalisableString FirstRunSetupTitle => new TranslatableString(getKey(@"first_run_setup_title"), @"First-run setup"); /// - /// "Setup osu! to suit you" + /// "Set up osu! to suit you" /// - public static LocalisableString SetupOsuToSuitYou => new TranslatableString(getKey(@"setup_osu_to_suit_you"), @"Setup osu! to suit you"); + public static LocalisableString FirstRunSetupDescription => new TranslatableString(getKey(@"first_run_setup_description"), @"Set up osu! to suit you"); /// /// "Welcome" diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index f73d82b793..dd36475a23 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -141,7 +141,7 @@ namespace osu.Game.Overlays { new OsuSpriteText { - Text = FirstRunSetupOverlayStrings.FirstRunSetup, + Text = FirstRunSetupOverlayStrings.FirstRunSetupTitle, Font = OsuFont.Default.With(size: 32), Colour = colourProvider.Content1, Anchor = Anchor.TopCentre, @@ -149,7 +149,7 @@ namespace osu.Game.Overlays }, new OsuTextFlowContainer { - Text = FirstRunSetupOverlayStrings.SetupOsuToSuitYou, + Text = FirstRunSetupOverlayStrings.FirstRunSetupDescription, Colour = colourProvider.Content2, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, From ed6481f7084277a063d26c63515d6631f560d9d6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Apr 2022 19:55:15 +0900 Subject: [PATCH 0393/2328] Also rename `Welcome` to `WelcomeTitle` to match other usages --- osu.Game/Localisation/FirstRunSetupOverlayStrings.cs | 2 +- osu.Game/Overlays/FirstRunSetupOverlay.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs index d2fb0e7467..001de93c16 100644 --- a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs +++ b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs @@ -32,7 +32,7 @@ namespace osu.Game.Localisation /// /// "Welcome" /// - public static LocalisableString Welcome => new TranslatableString(getKey(@"welcome"), @"Welcome"); + public static LocalisableString WelcomeTitle => new TranslatableString(getKey(@"welcome_title"), @"Welcome"); /// /// "Welcome to the first-run setup guide! diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index dd36475a23..a12fec4507 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -68,7 +68,7 @@ namespace osu.Game.Overlays private readonly FirstRunStep[] steps = { - new FirstRunStep(typeof(ScreenWelcome), FirstRunSetupOverlayStrings.Welcome), + new FirstRunStep(typeof(ScreenWelcome), FirstRunSetupOverlayStrings.WelcomeTitle), new FirstRunStep(typeof(ScreenUIScale), GraphicsSettingsStrings.UIScaling), }; From 8c3b541312ebcfe59cea912c755de5dcfb37ee1c Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 21 Apr 2022 22:35:07 +0900 Subject: [PATCH 0394/2328] Add state for when user is ready for gameplay --- .../Online/Multiplayer/MultiplayerRoomUser.cs | 16 ++++++++++++++++ .../Online/Multiplayer/MultiplayerUserState.cs | 8 +++++++- .../Multiplayer/Participants/StateDisplay.cs | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/Multiplayer/MultiplayerRoomUser.cs b/osu.Game/Online/Multiplayer/MultiplayerRoomUser.cs index f0b7dcbff8..50e539e8a6 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerRoomUser.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerRoomUser.cs @@ -65,5 +65,21 @@ namespace osu.Game.Online.Multiplayer } public override int GetHashCode() => UserID.GetHashCode(); + + /// + /// Whether this user has finished loading and can start gameplay. + /// + public bool CanStartGameplay() + { + switch (State) + { + case MultiplayerUserState.Loaded: + case MultiplayerUserState.ReadyForGameplay: + return true; + + default: + return false; + } + } } } diff --git a/osu.Game/Online/Multiplayer/MultiplayerUserState.cs b/osu.Game/Online/Multiplayer/MultiplayerUserState.cs index c467ff84bb..d1369a7970 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerUserState.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerUserState.cs @@ -29,10 +29,16 @@ namespace osu.Game.Online.Multiplayer WaitingForLoad, /// - /// The user's client has marked itself as loaded and ready to begin gameplay. + /// The user has marked itself as loaded, but may still be adjusting settings prior to being ready for gameplay. + /// Players remaining in this state for an extended period of time will be automatically transitioned to the state by the server. /// Loaded, + /// + /// The user has finished adjusting settings and is ready to start gameplay. + /// + ReadyForGameplay, + /// /// The user is currently playing in a game. This is a reserved state, and is set by the server. /// diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/StateDisplay.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/StateDisplay.cs index 2616b07c1f..658fc43e8d 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/StateDisplay.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/StateDisplay.cs @@ -112,6 +112,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants break; case MultiplayerUserState.Loaded: + case MultiplayerUserState.ReadyForGameplay: text.Text = "loaded"; icon.Icon = FontAwesome.Solid.DotCircle; icon.Colour = colours.YellowLight; From 08d250fe587e854affd32332f6d10dfd51bc5e61 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 21 Apr 2022 22:37:26 +0900 Subject: [PATCH 0395/2328] Rename MatchStarted() -> GameplayStarted() --- .../Visual/Multiplayer/TestSceneMultiplayerPlayer.cs | 2 +- osu.Game/Online/Multiplayer/IMultiplayerClient.cs | 5 +++-- osu.Game/Online/Multiplayer/MultiplayerClient.cs | 6 +++--- osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs | 2 +- .../Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs | 6 +++--- osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs index 312281ac18..e05580fed6 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs @@ -35,7 +35,7 @@ namespace osu.Game.Tests.Visual.Multiplayer }); AddUntilStep("wait for player to be current", () => player.IsCurrentScreen() && player.IsLoaded); - AddStep("start gameplay", () => ((IMultiplayerClient)MultiplayerClient).MatchStarted()); + AddStep("start gameplay", () => ((IMultiplayerClient)MultiplayerClient).GameplayStarted()); } [Test] diff --git a/osu.Game/Online/Multiplayer/IMultiplayerClient.cs b/osu.Game/Online/Multiplayer/IMultiplayerClient.cs index 3e6821b1cd..43ccfd36ed 100644 --- a/osu.Game/Online/Multiplayer/IMultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/IMultiplayerClient.cs @@ -98,9 +98,10 @@ namespace osu.Game.Online.Multiplayer Task LoadRequested(); /// - /// Signals that a match has started. All users in the state should begin gameplay as soon as possible. + /// Signals that gameplay has started. + /// All users in the or states should begin gameplay as soon as possible. /// - Task MatchStarted(); + Task GameplayStarted(); /// /// Signals that the match has ended, all players have finished and results are ready to be displayed. diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index 967220abbf..a9fdf1110f 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -72,7 +72,7 @@ namespace osu.Game.Online.Multiplayer /// /// Invoked when the multiplayer server requests gameplay to be started. /// - public event Action? MatchStarted; + public event Action? GameplayStarted; /// /// Invoked when the multiplayer server has finished collating results. @@ -604,14 +604,14 @@ namespace osu.Game.Online.Multiplayer return Task.CompletedTask; } - Task IMultiplayerClient.MatchStarted() + Task IMultiplayerClient.GameplayStarted() { Scheduler.Add(() => { if (Room == null) return; - MatchStarted?.Invoke(); + GameplayStarted?.Invoke(); }, false); return Task.CompletedTask; diff --git a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs index 7e62908ecd..de93233830 100644 --- a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs @@ -54,7 +54,7 @@ namespace osu.Game.Online.Multiplayer connection.On(nameof(IMultiplayerClient.SettingsChanged), ((IMultiplayerClient)this).SettingsChanged); connection.On(nameof(IMultiplayerClient.UserStateChanged), ((IMultiplayerClient)this).UserStateChanged); connection.On(nameof(IMultiplayerClient.LoadRequested), ((IMultiplayerClient)this).LoadRequested); - connection.On(nameof(IMultiplayerClient.MatchStarted), ((IMultiplayerClient)this).MatchStarted); + connection.On(nameof(IMultiplayerClient.GameplayStarted), ((IMultiplayerClient)this).GameplayStarted); connection.On(nameof(IMultiplayerClient.ResultsReady), ((IMultiplayerClient)this).ResultsReady); connection.On>(nameof(IMultiplayerClient.UserModsChanged), ((IMultiplayerClient)this).UserModsChanged); connection.On(nameof(IMultiplayerClient.UserBeatmapAvailabilityChanged), ((IMultiplayerClient)this).UserBeatmapAvailabilityChanged); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs index 70f8f1b752..d3a78a43a5 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs @@ -115,7 +115,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer if (!ValidForResume) return; // token retrieval may have failed. - client.MatchStarted += onMatchStarted; + client.GameplayStarted += onGameplayStarted; client.ResultsReady += onResultsReady; ScoreProcessor.HasCompleted.BindValueChanged(completed => @@ -175,7 +175,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer leaderboardFlow.Position = new Vector2(padding, padding + HUDOverlay.TopScoringElementsHeight); } - private void onMatchStarted() => Scheduler.Add(() => + private void onGameplayStarted() => Scheduler.Add(() => { if (!this.IsCurrentScreen()) return; @@ -223,7 +223,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer if (client != null) { - client.MatchStarted -= onMatchStarted; + client.GameplayStarted -= onGameplayStarted; client.ResultsReady -= onResultsReady; } } diff --git a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs index 21774b73a0..725499d0e5 100644 --- a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs +++ b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs @@ -155,7 +155,7 @@ namespace osu.Game.Tests.Visual.Multiplayer foreach (var u in Room.Users.Where(u => u.State == MultiplayerUserState.Loaded)) ChangeUserState(u.UserID, MultiplayerUserState.Playing); - ((IMultiplayerClient)this).MatchStarted(); + ((IMultiplayerClient)this).GameplayStarted(); ChangeRoomState(MultiplayerRoomState.Playing); } From 59622deb1fcf0d06b60302698bad24238e66e49e Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 21 Apr 2022 22:38:58 +0900 Subject: [PATCH 0396/2328] Add LoadAborted() event --- .../Online/Multiplayer/IMultiplayerClient.cs | 7 ++++++- .../Online/Multiplayer/MultiplayerClient.cs | 18 ++++++++++++++++++ .../Multiplayer/OnlineMultiplayerClient.cs | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/Multiplayer/IMultiplayerClient.cs b/osu.Game/Online/Multiplayer/IMultiplayerClient.cs index 43ccfd36ed..2f454ea835 100644 --- a/osu.Game/Online/Multiplayer/IMultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/IMultiplayerClient.cs @@ -93,10 +93,15 @@ namespace osu.Game.Online.Multiplayer Task UserModsChanged(int userId, IEnumerable mods); /// - /// Signals that a match is to be started. This will *only* be sent to clients which are to begin loading at this point. + /// Signals that the match is starting and the loading of gameplay should be started. This will *only* be sent to clients which are to begin loading at this point. /// Task LoadRequested(); + /// + /// Signals that loading of gameplay is to be aborted. + /// + Task LoadAborted(); + /// /// Signals that gameplay has started. /// All users in the or states should begin gameplay as soon as possible. diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index a9fdf1110f..cae675b406 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -69,6 +69,11 @@ namespace osu.Game.Online.Multiplayer /// public virtual event Action? LoadRequested; + /// + /// Invoked when the multiplayer server requests loading of play to be aborted. + /// + public event Action? LoadAborted; + /// /// Invoked when the multiplayer server requests gameplay to be started. /// @@ -604,6 +609,19 @@ namespace osu.Game.Online.Multiplayer return Task.CompletedTask; } + Task IMultiplayerClient.LoadAborted() + { + Scheduler.Add(() => + { + if (Room == null) + return; + + LoadAborted?.Invoke(); + }, false); + + return Task.CompletedTask; + } + Task IMultiplayerClient.GameplayStarted() { Scheduler.Add(() => diff --git a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs index de93233830..4dc23d8b85 100644 --- a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs @@ -55,6 +55,7 @@ namespace osu.Game.Online.Multiplayer connection.On(nameof(IMultiplayerClient.UserStateChanged), ((IMultiplayerClient)this).UserStateChanged); connection.On(nameof(IMultiplayerClient.LoadRequested), ((IMultiplayerClient)this).LoadRequested); connection.On(nameof(IMultiplayerClient.GameplayStarted), ((IMultiplayerClient)this).GameplayStarted); + connection.On(nameof(IMultiplayerClient.LoadAborted), ((IMultiplayerClient)this).LoadAborted); connection.On(nameof(IMultiplayerClient.ResultsReady), ((IMultiplayerClient)this).ResultsReady); connection.On>(nameof(IMultiplayerClient.UserModsChanged), ((IMultiplayerClient)this).UserModsChanged); connection.On(nameof(IMultiplayerClient.UserBeatmapAvailabilityChanged), ((IMultiplayerClient)this).UserBeatmapAvailabilityChanged); From 41355384bdab55039c78b59f11500d2d1d497761 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 21 Apr 2022 22:55:13 +0900 Subject: [PATCH 0397/2328] Add support for gameplay abort/force start --- .../OnlinePlay/Multiplayer/Multiplayer.cs | 18 ++++++++++++++++++ .../Multiplayer/MultiplayerPlayer.cs | 13 +++++++++---- .../Multiplayer/MultiplayerPlayerLoader.cs | 10 ++++++++++ osu.Game/Screens/Play/PlayerLoader.cs | 12 ++++++++---- 4 files changed, 45 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs index 2482d52492..c78756771a 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using osu.Framework.Allocation; +using osu.Framework.Logging; using osu.Framework.Screens; using osu.Game.Online.Multiplayer; using osu.Game.Screens.OnlinePlay.Components; @@ -20,6 +21,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer base.LoadComplete(); client.RoomUpdated += onRoomUpdated; + client.LoadAborted += onLoadAborted; onRoomUpdated(); } @@ -35,6 +37,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer transitionFromResults(); } + private void onLoadAborted() + { + // If the server aborts gameplay for this user (due to loading too slow), exit gameplay screens. + if (!this.IsCurrentScreen()) + { + Logger.Log("Gameplay aborted because loading the beatmap took too long.", LoggingTarget.Runtime, LogLevel.Important); + this.MakeCurrent(); + } + } + public override void OnResuming(IScreen last) { base.OnResuming(last); @@ -42,9 +54,15 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer if (client.Room == null) return; + Debug.Assert(client.LocalUser != null); + if (!(last is MultiplayerPlayerLoader playerLoader)) return; + // Nothing needs to be done if already in the idle state (e.g. via load being aborted by the server). + if (client.LocalUser.State == MultiplayerUserState.Idle) + return; + // If gameplay wasn't finished, then we have a simple path back to the idle state by aborting gameplay. if (!playerLoader.GameplayPassed) { diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs index d3a78a43a5..7dd57ee50f 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs @@ -133,6 +133,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer failAndBail(); } }), true); + + client.ChangeState(MultiplayerUserState.Loaded) + .ContinueWith(task => failAndBail(task.Exception?.Message ?? "Server error"), TaskContinuationOptions.NotOnRanToCompletion); } protected override void LoadComplete() @@ -144,10 +147,12 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer protected override void StartGameplay() { - // block base call, but let the server know we are ready to start. - loadingDisplay.Show(); - - client.ChangeState(MultiplayerUserState.Loaded).ContinueWith(task => failAndBail(task.Exception?.Message ?? "Server error"), TaskContinuationOptions.NotOnRanToCompletion); + if (client.LocalUser?.State == MultiplayerUserState.Loaded) + { + // block base call, but let the server know we are ready to start. + loadingDisplay.Show(); + client.ChangeState(MultiplayerUserState.ReadyForGameplay); + } } private void failAndBail(string message = null) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs index 772651727e..9964452f61 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs @@ -2,7 +2,9 @@ // See the LICENCE file in the repository root for full licence text. using System; +using osu.Framework.Allocation; using osu.Framework.Screens; +using osu.Game.Online.Multiplayer; using osu.Game.Screens.Play; namespace osu.Game.Screens.OnlinePlay.Multiplayer @@ -11,6 +13,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer { public bool GameplayPassed => player?.GameplayState.HasPassed == true; + [Resolved] + private MultiplayerClient multiplayerClient { get; set; } + private Player player; public MultiplayerPlayerLoader(Func createPlayer) @@ -18,6 +23,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer { } + protected override bool ReadyForGameplay => + base.ReadyForGameplay + // The server is forcefully starting gameplay. + || multiplayerClient.LocalUser?.State == MultiplayerUserState.Playing; + public override void OnSuspending(IScreen next) { base.OnSuspending(next); diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index aea39bc8ff..f7dae6eaa9 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -92,11 +92,15 @@ namespace osu.Game.Screens.Play !playerConsumed // don't push unless the player is completely loaded && CurrentPlayer?.LoadState == LoadState.Ready - // don't push if the user is hovering one of the panes, unless they are idle. - && (IsHovered || idleTracker.IsIdle.Value) - // don't push if the user is dragging a slider or otherwise. + // don't push unless the player is ready to start gameplay + && ReadyForGameplay; + + protected virtual bool ReadyForGameplay => + // not ready if the user is hovering one of the panes, unless they are idle. + (IsHovered || idleTracker.IsIdle.Value) + // not ready if the user is dragging a slider or otherwise. && inputManager.DraggedDrawable == null - // don't push if a focused overlay is visible, like settings. + // not ready if a focused overlay is visible, like settings. && inputManager.FocusedDrawable == null; private readonly Func createPlayer; From cbb07d4011a8db5de79c775f659eaa6ea7f0da34 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 21 Apr 2022 22:56:24 +0900 Subject: [PATCH 0398/2328] Add countdown classes --- .../Online/Multiplayer/GameplayStartCountdown.cs | 15 +++++++++++++++ .../Online/Multiplayer/MultiplayerCountdown.cs | 1 + osu.Game/Online/SignalRWorkaroundTypes.cs | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Online/Multiplayer/GameplayStartCountdown.cs diff --git a/osu.Game/Online/Multiplayer/GameplayStartCountdown.cs b/osu.Game/Online/Multiplayer/GameplayStartCountdown.cs new file mode 100644 index 0000000000..d3d7f78507 --- /dev/null +++ b/osu.Game/Online/Multiplayer/GameplayStartCountdown.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 MessagePack; + +namespace osu.Game.Online.Multiplayer +{ + /// + /// A indicating that gameplay will start after a given period of time. + /// + [MessagePackObject] + public class GameplayStartCountdown : MultiplayerCountdown + { + } +} diff --git a/osu.Game/Online/Multiplayer/MultiplayerCountdown.cs b/osu.Game/Online/Multiplayer/MultiplayerCountdown.cs index 81190e64c9..308eea3aef 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerCountdown.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerCountdown.cs @@ -14,6 +14,7 @@ namespace osu.Game.Online.Multiplayer /// [MessagePackObject] [Union(0, typeof(MatchStartCountdown))] // IMPORTANT: Add rules to SignalRUnionWorkaroundResolver for new derived types. + [Union(1, typeof(GameplayStartCountdown))] public abstract class MultiplayerCountdown { /// diff --git a/osu.Game/Online/SignalRWorkaroundTypes.cs b/osu.Game/Online/SignalRWorkaroundTypes.cs index 156f916cef..00fdadb87e 100644 --- a/osu.Game/Online/SignalRWorkaroundTypes.cs +++ b/osu.Game/Online/SignalRWorkaroundTypes.cs @@ -24,7 +24,8 @@ namespace osu.Game.Online (typeof(CountdownChangedEvent), typeof(MatchServerEvent)), (typeof(TeamVersusRoomState), typeof(MatchRoomState)), (typeof(TeamVersusUserState), typeof(MatchUserState)), - (typeof(MatchStartCountdown), typeof(MultiplayerCountdown)) + (typeof(MatchStartCountdown), typeof(MultiplayerCountdown)), + (typeof(GameplayStartCountdown), typeof(MultiplayerCountdown)) }; } } From ef1955d8ab2651a9ceff1386acd152762577bf45 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 21 Apr 2022 23:01:16 +0900 Subject: [PATCH 0399/2328] Make buttons only respond to MatchStartCountdown --- .../Match/MultiplayerCountdownButton.cs | 2 +- .../Multiplayer/Match/MultiplayerReadyButton.cs | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs index c84fcff11e..1a51aebb76 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match private void onRoomUpdated() => Scheduler.AddOnce(() => { - bool countdownActive = multiplayerClient.Room?.Countdown != null; + bool countdownActive = multiplayerClient.Room?.Countdown is MatchStartCountdown; if (countdownActive) { diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs index 22a0243f8f..a7e18622dc 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs @@ -55,7 +55,21 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match private void onRoomUpdated() => Scheduler.AddOnce(() => { - if (countdown != room?.Countdown) + MultiplayerCountdown newCountdown; + + switch (room?.Countdown) + { + case MatchStartCountdown _: + newCountdown = room.Countdown; + break; + + // Clear the countdown with any other (including non-null) countdown values. + default: + newCountdown = null; + break; + } + + if (newCountdown != countdown) { countdown = room?.Countdown; countdownChangeTime = Time.Current; From a0a83fb51fa1d69f4ade683fb5dd7e3db4e19130 Mon Sep 17 00:00:00 2001 From: 63411 <62799417+molneya@users.noreply.github.com> Date: Thu, 21 Apr 2022 23:03:28 +0800 Subject: [PATCH 0400/2328] Use closest endTime for holdAddition validity --- osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs index ab6bd78ece..2e252acdc8 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs @@ -37,6 +37,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Skills var maniaCurrent = (ManiaDifficultyHitObject)current; double endTime = maniaCurrent.EndTime; int column = maniaCurrent.BaseObject.Column; + double closestEndTime = 100; double holdFactor = 1.0; // Factor to all additional strains in case something else is held double holdAddition = 0; // Addition to the current note in case it's a hold and has to be released awkwardly @@ -44,24 +45,26 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Skills // Fill up the holdEndTimes array for (int i = 0; i < holdEndTimes.Length; ++i) { - // If there is at least one other overlapping end or note, then we get an addition, buuuuuut... + // If there is at least one other overlapping end or note, then we get an addition if (Precision.DefinitelyBigger(holdEndTimes[i], maniaCurrent.StartTime, 1) && Precision.DefinitelyBigger(endTime, holdEndTimes[i], 1)) holdAddition = 1.0; - // ... this addition only is valid if there is _no_ other note with the same ending. Releasing multiple notes at the same time is just as easy as releasing 1 - if (Precision.AlmostEquals(endTime, holdEndTimes[i], 1)) - holdAddition = 0; - // We give a slight bonus to everything if something is held meanwhile if (Precision.DefinitelyBigger(holdEndTimes[i], endTime, 1)) holdFactor = 1.25; + closestEndTime = Math.Min(closestEndTime, Math.Abs(endTime - holdEndTimes[i])); + // Decay individual strains individualStrains[i] = applyDecay(individualStrains[i], current.DeltaTime, individual_decay_base); } holdEndTimes[column] = endTime; + // The hold addition only is valid if there is _no_ other note with the same ending. Releasing multiple notes at the same time is just as easy as releasing 1 + if (closestEndTime < 1) + holdAddition = 0; + // Increase individual strain in own column individualStrains[column] += 2.0 * holdFactor; individualStrain = individualStrains[column]; From e7a149af6c1c7091a4406df3fddb980b8ac5fb9f Mon Sep 17 00:00:00 2001 From: 63411 <62799417+molneya@users.noreply.github.com> Date: Thu, 21 Apr 2022 23:05:20 +0800 Subject: [PATCH 0401/2328] Use curve for holdAddition validity cutoff --- osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs index 2e252acdc8..d5d5d5751d 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs @@ -62,8 +62,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Skills holdEndTimes[column] = endTime; // The hold addition only is valid if there is _no_ other note with the same ending. Releasing multiple notes at the same time is just as easy as releasing 1 - if (closestEndTime < 1) - holdAddition = 0; + holdAddition *= 1 / (1 + Math.Exp(0.5 * (24 - closestEndTime))); // Increase individual strain in own column individualStrains[column] += 2.0 * holdFactor; From 4d3044b841c4f5d9b73a144aaabf7bd1fc7b1725 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Apr 2022 00:49:15 +0900 Subject: [PATCH 0402/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 8b22df418f..6b06305bf9 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 0a102510e7..c57acb3b7f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 2f0facea18..d7f89b802b 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 832d37b2c2c9b5f2cde6bec90804e6dab36e8e0e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Apr 2022 00:52:44 +0900 Subject: [PATCH 0403/2328] Update screen transition events to use new event args --- .../Background/TestSceneUserDimBackgrounds.cs | 4 ++-- .../Visual/Gameplay/TestScenePause.cs | 4 ++-- .../Navigation/TestScenePerformFromScreen.cs | 8 ++++---- .../Visual/TestMultiplayerComponents.cs | 4 ++-- .../Graphics/Containers/ScalingContainer.cs | 2 +- .../AccountCreation/AccountCreationScreen.cs | 12 +++++------ .../Overlays/AccountCreation/ScreenEntry.cs | 4 ++-- .../Overlays/AccountCreation/ScreenWarning.cs | 4 ++-- .../Maintenance/DirectorySelectScreen.cs | 4 ++-- .../Maintenance/MigrationRunScreen.cs | 8 ++++---- .../StableDirectorySelectScreen.cs | 4 ++-- osu.Game/Screens/BackgroundScreen.cs | 16 +++++++-------- .../Backgrounds/BackgroundScreenBlack.cs | 2 +- osu.Game/Screens/Edit/Editor.cs | 16 +++++++-------- .../Screens/Edit/GameplayTest/EditorPlayer.cs | 8 ++++---- .../Edit/GameplayTest/EditorPlayerLoader.cs | 4 ++-- osu.Game/Screens/Import/FileImportScreen.cs | 8 ++++---- osu.Game/Screens/Loader.cs | 4 ++-- osu.Game/Screens/Menu/Disclaimer.cs | 4 ++-- osu.Game/Screens/Menu/IntroCircles.cs | 4 ++-- osu.Game/Screens/Menu/IntroScreen.cs | 12 +++++------ osu.Game/Screens/Menu/IntroTriangles.cs | 8 ++++---- osu.Game/Screens/Menu/IntroWelcome.cs | 4 ++-- osu.Game/Screens/Menu/MainMenu.cs | 18 ++++++++--------- .../Components/OnlinePlayBackgroundScreen.cs | 8 ++++---- .../Lounge/LoungeBackgroundScreen.cs | 2 +- .../OnlinePlay/Lounge/LoungeSubScreen.cs | 16 +++++++-------- .../Screens/OnlinePlay/Match/RoomSubScreen.cs | 16 +++++++-------- .../OnlinePlay/Multiplayer/Multiplayer.cs | 6 +++--- .../Multiplayer/MultiplayerLoungeSubScreen.cs | 6 +++--- .../Multiplayer/MultiplayerMatchSubScreen.cs | 6 +++--- .../Multiplayer/MultiplayerPlayerLoader.cs | 6 +++--- .../Screens/OnlinePlay/OnlinePlayScreen.cs | 20 +++++++++---------- .../OnlinePlay/OnlinePlaySongSelect.cs | 4 ++-- .../Screens/OnlinePlay/OnlinePlaySubScreen.cs | 16 +++++++-------- .../OnlinePlay/Playlists/PlaylistsPlayer.cs | 4 ++-- osu.Game/Screens/OsuScreen.cs | 16 +++++++-------- osu.Game/Screens/Play/Player.cs | 12 +++++------ osu.Game/Screens/Play/PlayerLoader.cs | 16 +++++++-------- osu.Game/Screens/Play/ReplayPlayerLoader.cs | 4 ++-- osu.Game/Screens/Play/SoloSpectator.cs | 4 ++-- osu.Game/Screens/Play/SoloSpectatorPlayer.cs | 4 ++-- osu.Game/Screens/Play/SpectatorPlayer.cs | 4 ++-- .../Screens/Play/SpectatorPlayerLoader.cs | 4 ++-- osu.Game/Screens/Play/SubmittingPlayer.cs | 4 ++-- osu.Game/Screens/Ranking/ResultsScreen.cs | 8 ++++---- osu.Game/Screens/ScreenWhiteBox.cs | 12 +++++------ osu.Game/Screens/Select/PlaySongSelect.cs | 4 ++-- osu.Game/Screens/Select/SongSelect.cs | 16 +++++++-------- osu.Game/Tests/Visual/EditorTestScene.cs | 4 ++-- 50 files changed, 194 insertions(+), 194 deletions(-) diff --git a/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs b/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs index 9f708ace70..f7140537ee 100644 --- a/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs +++ b/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs @@ -359,9 +359,9 @@ namespace osu.Game.Tests.Visual.Background protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); ApplyToBackground(b => ReplacesBackground.BindTo(b.StoryboardReplacesBackground)); } diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs index ea0255ab76..a224a78531 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs @@ -389,9 +389,9 @@ namespace osu.Game.Tests.Visual.Gameplay public void ExitViaQuickExit() => PerformExit(false); - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); GameplayClockContainer.Stop(); } } diff --git a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs index 559e6ddd89..2ce914ba3d 100644 --- a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs +++ b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs @@ -230,7 +230,7 @@ namespace osu.Game.Tests.Visual.Navigation public int ExitAttempts { get; private set; } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { ExitAttempts++; @@ -240,7 +240,7 @@ namespace osu.Game.Tests.Visual.Navigation return true; } - return base.OnExiting(next); + return base.OnExiting(e); } } @@ -257,7 +257,7 @@ namespace osu.Game.Tests.Visual.Navigation SubScreenStack.Push(Blocker = new DialogBlockingScreen()); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { if (SubScreenStack.CurrentScreen != null) { @@ -265,7 +265,7 @@ namespace osu.Game.Tests.Visual.Navigation return true; } - return base.OnExiting(next); + return base.OnExiting(e); } } } diff --git a/osu.Game.Tests/Visual/TestMultiplayerComponents.cs b/osu.Game.Tests/Visual/TestMultiplayerComponents.cs index c43ed744bd..4ab201ef46 100644 --- a/osu.Game.Tests/Visual/TestMultiplayerComponents.cs +++ b/osu.Game.Tests/Visual/TestMultiplayerComponents.cs @@ -80,10 +80,10 @@ namespace osu.Game.Tests.Visual public override bool OnBackButton() => (screenStack.CurrentScreen as OsuScreen)?.OnBackButton() ?? base.OnBackButton(); - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { if (screenStack.CurrentScreen == null) - return base.OnExiting(next); + return base.OnExiting(e); screenStack.Exit(); return true; diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index ca8b6f388f..89432595f3 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -209,7 +209,7 @@ namespace osu.Game.Graphics.Containers { protected override bool AllowStoryboardBackground => false; - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { this.FadeInFromZero(4000, Easing.OutQuint); } diff --git a/osu.Game/Overlays/AccountCreation/AccountCreationScreen.cs b/osu.Game/Overlays/AccountCreation/AccountCreationScreen.cs index 7e2ae405cb..6aef358b2e 100644 --- a/osu.Game/Overlays/AccountCreation/AccountCreationScreen.cs +++ b/osu.Game/Overlays/AccountCreation/AccountCreationScreen.cs @@ -8,21 +8,21 @@ namespace osu.Game.Overlays.AccountCreation { public abstract class AccountCreationScreen : Screen { - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); this.FadeOut().Delay(200).FadeIn(200); } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { - base.OnResuming(last); + base.OnResuming(e); this.FadeIn(200); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { - base.OnSuspending(next); + base.OnSuspending(e); this.FadeOut(200); } } diff --git a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs index 6cf3fb4267..1be1321d85 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs @@ -147,9 +147,9 @@ namespace osu.Game.Overlays.AccountCreation d.Colour = password.Length == 0 ? Color4.White : Interpolation.ValueAt(password.Length, Color4.OrangeRed, Color4.YellowGreen, 0, 8, Easing.In); } - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); loadingLayer.Hide(); if (host?.OnScreenKeyboardOverlapsGameWindow != true) diff --git a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs index 3d46e9ed94..780a79f8f9 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs @@ -31,7 +31,7 @@ namespace osu.Game.Overlays.AccountCreation private const string help_centre_url = "/help/wiki/Help_Centre#login"; - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { if (string.IsNullOrEmpty(api?.ProvidedUsername) || game?.UseDevelopmentServer == true) { @@ -40,7 +40,7 @@ namespace osu.Game.Overlays.AccountCreation return; } - base.OnEntering(last); + base.OnEntering(e); } [BackgroundDependencyLoader(true)] diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs index 98bc8d88be..c7fd248842 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs @@ -124,9 +124,9 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance base.LoadComplete(); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { - base.OnSuspending(next); + base.OnSuspending(e); this.FadeOut(250); } diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationRunScreen.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationRunScreen.cs index 10d6f0aef5..b7b797936e 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationRunScreen.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationRunScreen.cs @@ -124,20 +124,20 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance protected virtual bool PerformMigration() => game?.Migrate(destination.FullName) != false; - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); this.FadeOut().Delay(250).Then().FadeIn(250); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { // block until migration is finished if (migrationTask?.IsCompleted == false) return true; - return base.OnExiting(next); + return base.OnExiting(e); } } } diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectorySelectScreen.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectorySelectScreen.cs index 4aea05fb14..86934ae514 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectorySelectScreen.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectorySelectScreen.cs @@ -30,10 +30,10 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance this.Exit(); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { taskCompletionSource.TrySetCanceled(); - return base.OnExiting(next); + return base.OnExiting(e); } } } diff --git a/osu.Game/Screens/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index a706934cce..6084ec4b01 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -48,7 +48,7 @@ namespace osu.Game.Screens Scale = new Vector2(1 + x_movement_amount / DrawSize.X * 2); } - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { if (animateOnEnter) { @@ -59,16 +59,16 @@ namespace osu.Game.Screens this.MoveToX(0, TRANSITION_LENGTH, Easing.InOutQuart); } - base.OnEntering(last); + base.OnEntering(e); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { this.MoveToX(-x_movement_amount, TRANSITION_LENGTH, Easing.InOutQuart); - base.OnSuspending(next); + base.OnSuspending(e); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { if (IsLoaded) { @@ -76,14 +76,14 @@ namespace osu.Game.Screens this.MoveToX(x_movement_amount, TRANSITION_LENGTH, Easing.OutExpo); } - return base.OnExiting(next); + return base.OnExiting(e); } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { if (IsLoaded) this.MoveToX(0, TRANSITION_LENGTH, Easing.OutExpo); - base.OnResuming(last); + base.OnResuming(e); } } } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBlack.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBlack.cs index 9e2559cc56..d946fd41d9 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBlack.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBlack.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Backgrounds }; } - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { Show(); } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 30c57733ed..3fde033587 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -560,16 +560,16 @@ namespace osu.Game.Screens.Edit { } - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); dimBackground(); resetTrack(true); } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { - base.OnResuming(last); + base.OnResuming(e); dimBackground(); } @@ -585,7 +585,7 @@ namespace osu.Game.Screens.Edit }); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { if (!ExitConfirmed) { @@ -613,12 +613,12 @@ namespace osu.Game.Screens.Edit refetchBeatmap(); - return base.OnExiting(next); + return base.OnExiting(e); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { - base.OnSuspending(next); + base.OnSuspending(e); clock.Stop(); refetchBeatmap(); } diff --git a/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs b/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs index d9e19df350..f7e450b0e2 100644 --- a/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs +++ b/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs @@ -44,9 +44,9 @@ namespace osu.Game.Screens.Edit.GameplayTest protected override bool CheckModsAllowFailure() => false; // never fail. - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); // finish alpha transforms on entering to avoid gameplay starting in a half-hidden state. // the finish calls are purposefully not propagated to children to avoid messing up their state. @@ -54,13 +54,13 @@ namespace osu.Game.Screens.Edit.GameplayTest GameplayClockContainer.FinishTransforms(false, nameof(Alpha)); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { musicController.Stop(); editorState.Time = GameplayClockContainer.CurrentTime; editor.RestoreState(editorState); - return base.OnExiting(next); + return base.OnExiting(e); } } } diff --git a/osu.Game/Screens/Edit/GameplayTest/EditorPlayerLoader.cs b/osu.Game/Screens/Edit/GameplayTest/EditorPlayerLoader.cs index addc79ba61..c16bb8677c 100644 --- a/osu.Game/Screens/Edit/GameplayTest/EditorPlayerLoader.cs +++ b/osu.Game/Screens/Edit/GameplayTest/EditorPlayerLoader.cs @@ -19,9 +19,9 @@ namespace osu.Game.Screens.Edit.GameplayTest { } - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); MetadataInfo.FinishTransforms(true); } diff --git a/osu.Game/Screens/Import/FileImportScreen.cs b/osu.Game/Screens/Import/FileImportScreen.cs index 09870e0bab..32ce54aa29 100644 --- a/osu.Game/Screens/Import/FileImportScreen.cs +++ b/osu.Game/Screens/Import/FileImportScreen.cs @@ -118,20 +118,20 @@ namespace osu.Game.Screens.Import fileSelector.CurrentPath.BindValueChanged(directoryChanged); } - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); contentContainer.ScaleTo(0.95f).ScaleTo(1, duration, Easing.OutQuint); this.FadeInFromZero(duration); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { contentContainer.ScaleTo(0.95f, duration, Easing.OutQuint); this.FadeOut(duration, Easing.OutQuint); - return base.OnExiting(next); + return base.OnExiting(e); } private void directoryChanged(ValueChangedEvent _) diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index a72ba89dfa..52e83c9e98 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -69,9 +69,9 @@ namespace osu.Game.Screens private EFToRealmMigrator realmMigrator; - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); LoadComponentAsync(precompiler = CreateShaderPrecompiler(), AddInternal); diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 22151db0dd..24412cd85e 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -171,9 +171,9 @@ namespace osu.Game.Screens.Menu ((IBindable)currentUser).BindTo(api.LocalUser); } - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); icon.RotateTo(10); icon.FadeOut(); diff --git a/osu.Game/Screens/Menu/IntroCircles.cs b/osu.Game/Screens/Menu/IntroCircles.cs index 2792d05f75..00e2de62f0 100644 --- a/osu.Game/Screens/Menu/IntroCircles.cs +++ b/osu.Game/Screens/Menu/IntroCircles.cs @@ -57,10 +57,10 @@ namespace osu.Game.Screens.Menu } } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { this.FadeOut(300); - base.OnSuspending(next); + base.OnSuspending(e); } } } diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs index 5575d3681f..d4072d6202 100644 --- a/osu.Game/Screens/Menu/IntroScreen.cs +++ b/osu.Game/Screens/Menu/IntroScreen.cs @@ -164,9 +164,9 @@ namespace osu.Game.Screens.Menu } } - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); ensureEventuallyArrivingAtMenu(); } @@ -194,7 +194,7 @@ namespace osu.Game.Screens.Menu }, 5000); } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { this.FadeIn(300); @@ -237,12 +237,12 @@ namespace osu.Game.Screens.Menu //don't want to fade out completely else we will stop running updates. Game.FadeTo(0.01f, fadeOutTime).OnComplete(_ => this.Exit()); - base.OnResuming(last); + base.OnResuming(e); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { - base.OnSuspending(next); + base.OnSuspending(e); initialBeatmap = null; } diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index b6b6bf2ad7..ba8314f103 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -89,9 +89,9 @@ namespace osu.Game.Screens.Menu } } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { - base.OnSuspending(next); + base.OnSuspending(e); // ensure the background is shown, even if the TriangleIntroSequence failed to do so. background.ApplyToBackground(b => b.Show()); @@ -100,9 +100,9 @@ namespace osu.Game.Screens.Menu intro.Expire(); } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { - base.OnResuming(last); + base.OnResuming(e); background.FadeOut(100); } diff --git a/osu.Game/Screens/Menu/IntroWelcome.cs b/osu.Game/Screens/Menu/IntroWelcome.cs index 27eaa7eb3a..9a6c949cad 100644 --- a/osu.Game/Screens/Menu/IntroWelcome.cs +++ b/osu.Game/Screens/Menu/IntroWelcome.cs @@ -106,9 +106,9 @@ namespace osu.Game.Screens.Menu } } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { - base.OnResuming(last); + base.OnResuming(e); background.FadeOut(100); } diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 08df06816b..c9ce077695 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -176,12 +176,12 @@ namespace osu.Game.Screens.Menu [Resolved] private Storage storage { get; set; } - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); buttons.FadeInFromZero(500); - if (last is IntroScreen && musicController.TrackLoaded) + if (e.Last is IntroScreen && musicController.TrackLoaded) { var track = musicController.CurrentTrack; @@ -249,9 +249,9 @@ namespace osu.Game.Screens.Menu seq.OnAbort(_ => buttons.SetOsuLogo(null)); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { - base.OnSuspending(next); + base.OnSuspending(e); buttons.State = ButtonSystemState.EnteringMode; @@ -261,9 +261,9 @@ namespace osu.Game.Screens.Menu sideFlashes.FadeOut(64, Easing.OutQuint); } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { - base.OnResuming(last); + base.OnResuming(e); ApplyToBackground(b => (b as BackgroundScreenDefault)?.Next()); @@ -273,7 +273,7 @@ namespace osu.Game.Screens.Menu musicController.EnsurePlayingSomething(); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { if (!exitConfirmed && dialogOverlay != null) { @@ -291,7 +291,7 @@ namespace osu.Game.Screens.Menu songTicker.Hide(); this.FadeOut(3000); - return base.OnExiting(next); + return base.OnExiting(e); } public void PresentBeatmap(WorkingBeatmap beatmap, RulesetInfo ruleset) diff --git a/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundScreen.cs b/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundScreen.cs index 8906bebf0e..9e964de31e 100644 --- a/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundScreen.cs @@ -91,15 +91,15 @@ namespace osu.Game.Screens.OnlinePlay.Components AddInternal(background = newBackground); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { - base.OnSuspending(next); + base.OnSuspending(e); this.MoveToX(0, TRANSITION_LENGTH); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { - bool result = base.OnExiting(next); + bool result = base.OnExiting(e); this.MoveToX(0); return result; } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs b/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs index 926c35c5da..52a902f5da 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge playlist.Clear(); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { // This screen never exits. return true; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs index a2d3b7f4fc..ec55ae79ce 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs @@ -238,15 +238,15 @@ namespace osu.Game.Screens.OnlinePlay.Lounge #endregion - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); onReturning(); } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { - base.OnResuming(last); + base.OnResuming(e); Debug.Assert(selectionLease != null); @@ -261,16 +261,16 @@ namespace osu.Game.Screens.OnlinePlay.Lounge onReturning(); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { onLeaving(); - return base.OnExiting(next); + return base.OnExiting(e); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { onLeaving(); - base.OnSuspending(next); + base.OnSuspending(e); } protected override void OnFocus(FocusEvent e) diff --git a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs index a382f65d84..cc1f842f8c 100644 --- a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs @@ -290,35 +290,35 @@ namespace osu.Game.Screens.OnlinePlay.Match protected void ShowUserModSelect() => userModsSelectOverlay.Show(); - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); beginHandlingTrack(); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { endHandlingTrack(); - base.OnSuspending(next); + base.OnSuspending(e); } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { - base.OnResuming(last); + base.OnResuming(e); updateWorkingBeatmap(); beginHandlingTrack(); Scheduler.AddOnce(UpdateMods); Scheduler.AddOnce(updateRuleset); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { RoomManager?.PartRoom(); Mods.Value = Array.Empty(); endHandlingTrack(); - return base.OnExiting(next); + return base.OnExiting(e); } protected void StartPlay() diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs index 2482d52492..66f6935bcc 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs @@ -35,14 +35,14 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer transitionFromResults(); } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { - base.OnResuming(last); + base.OnResuming(e); if (client.Room == null) return; - if (!(last is MultiplayerPlayerLoader playerLoader)) + if (!(e.Last is MultiplayerPlayerLoader playerLoader)) return; // If gameplay wasn't finished, then we have a simple path back to the idle state by aborting gameplay. diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs index 5cdec52bc2..a05f248d3a 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs @@ -25,13 +25,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer [Resolved] private MultiplayerClient client { get; set; } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { - base.OnResuming(last); + base.OnResuming(e); // Upon having left a room, we don't know whether we were the only participant, and whether the room is now closed as a result of leaving it. // To work around this, temporarily remove the room and trigger an immediate listing poll. - if (last is MultiplayerMatchSubScreen match) + if (e.Last is MultiplayerMatchSubScreen match) { RoomManager.RemoveRoom(match.Room); ListingPollingComponent.PollImmediately(); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs index 0dbf73fc5b..769873f74c 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs @@ -242,14 +242,14 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer private bool exitConfirmed; - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { // the room may not be left immediately after a disconnection due to async flow, // so checking the IsConnected status is also required. if (client.Room == null || !client.IsConnected.Value) { // room has not been created yet; exit immediately. - return base.OnExiting(next); + return base.OnExiting(e); } if (!exitConfirmed && dialogOverlay != null) @@ -268,7 +268,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer return true; } - return base.OnExiting(next); + return base.OnExiting(e); } private ModSettingChangeTracker modSettingChangeTracker; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs index 772651727e..53dea83f18 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs @@ -18,10 +18,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer { } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { - base.OnSuspending(next); - player = (Player)next; + base.OnSuspending(e); + player = (Player)e.Next; } } } diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlayScreen.cs b/osu.Game/Screens/OnlinePlay/OnlinePlayScreen.cs index c56d04d5ac..ff4225e155 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlayScreen.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlayScreen.cs @@ -110,7 +110,7 @@ namespace osu.Game.Screens.OnlinePlay } } - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { this.FadeIn(); waves.Show(); @@ -118,35 +118,35 @@ namespace osu.Game.Screens.OnlinePlay Mods.SetDefault(); if (loungeSubScreen.IsCurrentScreen()) - loungeSubScreen.OnEntering(last); + loungeSubScreen.OnEntering(e); else loungeSubScreen.MakeCurrent(); } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { this.FadeIn(250); this.ScaleTo(1, 250, Easing.OutSine); Debug.Assert(screenStack.CurrentScreen != null); - screenStack.CurrentScreen.OnResuming(last); + screenStack.CurrentScreen.OnResuming(e); - base.OnResuming(last); + base.OnResuming(e); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { this.ScaleTo(1.1f, 250, Easing.InSine); this.FadeOut(250); Debug.Assert(screenStack.CurrentScreen != null); - screenStack.CurrentScreen.OnSuspending(next); + screenStack.CurrentScreen.OnSuspending(e); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { var subScreen = screenStack.CurrentScreen as Drawable; - if (subScreen?.IsLoaded == true && screenStack.CurrentScreen.OnExiting(next)) + if (subScreen?.IsLoaded == true && screenStack.CurrentScreen.OnExiting(e)) return true; RoomManager.PartRoom(); @@ -155,7 +155,7 @@ namespace osu.Game.Screens.OnlinePlay this.Delay(WaveContainer.DISAPPEAR_DURATION).FadeOut(); - base.OnExiting(next); + base.OnExiting(e); return false; } diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs index 7b64784316..6a559dbb2c 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs @@ -141,7 +141,7 @@ namespace osu.Game.Screens.OnlinePlay return base.OnBackButton(); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { if (!itemSelected) { @@ -150,7 +150,7 @@ namespace osu.Game.Screens.OnlinePlay Mods.Value = initialMods; } - return base.OnExiting(next); + return base.OnExiting(e); } protected override ModSelectOverlay CreateModSelectOverlay() => new UserModSelectOverlay diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySubScreen.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySubScreen.cs index 3411c4afb1..07e0f60011 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySubScreen.cs @@ -27,28 +27,28 @@ namespace osu.Game.Screens.OnlinePlay public const double DISAPPEAR_DURATION = 500; - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); this.FadeInFromZero(APPEAR_DURATION, Easing.OutQuint); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { - base.OnExiting(next); + base.OnExiting(e); this.FadeOut(DISAPPEAR_DURATION, Easing.OutQuint); return false; } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { - base.OnResuming(last); + base.OnResuming(e); this.FadeIn(APPEAR_DURATION, Easing.OutQuint); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { - base.OnSuspending(next); + base.OnSuspending(e); this.FadeOut(DISAPPEAR_DURATION, Easing.OutQuint); } diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsPlayer.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsPlayer.cs index 5a7762a3d8..5cba8676c5 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsPlayer.cs @@ -45,9 +45,9 @@ namespace osu.Game.Screens.OnlinePlay.Playlists throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods"); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { - if (base.OnExiting(next)) + if (base.OnExiting(e)) return true; Exited?.Invoke(); diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index ed4901e1fa..4035d168e1 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -171,7 +171,7 @@ namespace osu.Game.Screens background.ApplyToBackground(action); } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { if (PlayResumeSound) sampleExit?.Play(); @@ -183,19 +183,19 @@ namespace osu.Game.Screens if (trackAdjustmentStateAtSuspend != null) musicController.AllowTrackAdjustments = trackAdjustmentStateAtSuspend.Value; - base.OnResuming(last); + base.OnResuming(e); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { - base.OnSuspending(next); + base.OnSuspending(e); trackAdjustmentStateAtSuspend = musicController.AllowTrackAdjustments; onSuspendingLogo(); } - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { applyArrivingDefaults(false); @@ -210,15 +210,15 @@ namespace osu.Game.Screens } background = backgroundStack?.CurrentScreen as BackgroundScreen; - base.OnEntering(last); + base.OnEntering(e); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { if (ValidForResume && logo != null) onExitingLogo(); - if (base.OnExiting(next)) + if (base.OnExiting(e)) return true; if (ownedBackground != null && backgroundStack?.CurrentScreen == ownedBackground) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index f99b07c313..2d5a67758a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -917,9 +917,9 @@ namespace osu.Game.Screens.Play #region Screen Logic - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); if (!LoadedBeatmapSuccessfully) return; @@ -985,15 +985,15 @@ namespace osu.Game.Screens.Play GameplayClockContainer.Reset(true); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { screenSuspension?.RemoveAndDisposeImmediately(); fadeOut(); - base.OnSuspending(next); + base.OnSuspending(e); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { screenSuspension?.RemoveAndDisposeImmediately(); failAnimationLayer?.RemoveFilters(); @@ -1024,7 +1024,7 @@ namespace osu.Game.Screens.Play musicController.ResetTrackAdjustments(); fadeOut(); - return base.OnExiting(next); + return base.OnExiting(e); } /// diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index aea39bc8ff..494ab51a10 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -210,9 +210,9 @@ namespace osu.Game.Screens.Play #region Screen handling - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); ApplyToBackground(b => { @@ -236,9 +236,9 @@ namespace osu.Game.Screens.Play showBatteryWarningIfNeeded(); } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { - base.OnResuming(last); + base.OnResuming(e); Debug.Assert(CurrentPlayer != null); @@ -254,9 +254,9 @@ namespace osu.Game.Screens.Play contentIn(); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { - base.OnSuspending(next); + base.OnSuspending(e); BackgroundBrightnessReduction = false; @@ -268,7 +268,7 @@ namespace osu.Game.Screens.Play highPassFilter.CutoffTo(0); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { cancelLoad(); ContentOut(); @@ -284,7 +284,7 @@ namespace osu.Game.Screens.Play BackgroundBrightnessReduction = false; Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment); - return base.OnExiting(next); + return base.OnExiting(e); } protected override void LogoArriving(OsuLogo logo, bool resuming) diff --git a/osu.Game/Screens/Play/ReplayPlayerLoader.cs b/osu.Game/Screens/Play/ReplayPlayerLoader.cs index 9eff4cb8fc..e78f700af2 100644 --- a/osu.Game/Screens/Play/ReplayPlayerLoader.cs +++ b/osu.Game/Screens/Play/ReplayPlayerLoader.cs @@ -20,13 +20,13 @@ namespace osu.Game.Screens.Play Score = score.ScoreInfo; } - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { // these will be reverted thanks to PlayerLoader's lease. Mods.Value = Score.Mods; Ruleset.Value = Score.Ruleset; - base.OnEntering(last); + base.OnEntering(e); } } } diff --git a/osu.Game/Screens/Play/SoloSpectator.cs b/osu.Game/Screens/Play/SoloSpectator.cs index a0b07fcbd9..202527f308 100644 --- a/osu.Game/Screens/Play/SoloSpectator.cs +++ b/osu.Game/Screens/Play/SoloSpectator.cs @@ -249,10 +249,10 @@ namespace osu.Game.Screens.Play beatmapDownloader.Download(beatmapSet); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { previewTrackManager.StopAnyPlaying(this); - return base.OnExiting(next); + return base.OnExiting(e); } } } diff --git a/osu.Game/Screens/Play/SoloSpectatorPlayer.cs b/osu.Game/Screens/Play/SoloSpectatorPlayer.cs index 969a5bf2b4..5b601083c2 100644 --- a/osu.Game/Screens/Play/SoloSpectatorPlayer.cs +++ b/osu.Game/Screens/Play/SoloSpectatorPlayer.cs @@ -24,11 +24,11 @@ namespace osu.Game.Screens.Play SpectatorClient.OnUserBeganPlaying += userBeganPlaying; } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { SpectatorClient.OnUserBeganPlaying -= userBeganPlaying; - return base.OnExiting(next); + return base.OnExiting(e); } private void userBeganPlaying(int userId, SpectatorState state) diff --git a/osu.Game/Screens/Play/SpectatorPlayer.cs b/osu.Game/Screens/Play/SpectatorPlayer.cs index c0682952c3..09bec9b89f 100644 --- a/osu.Game/Screens/Play/SpectatorPlayer.cs +++ b/osu.Game/Screens/Play/SpectatorPlayer.cs @@ -91,11 +91,11 @@ namespace osu.Game.Screens.Play DrawableRuleset?.SetReplayScore(score); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { SpectatorClient.OnNewFrames -= userSentFrames; - return base.OnExiting(next); + return base.OnExiting(e); } protected override void Dispose(bool isDisposing) diff --git a/osu.Game/Screens/Play/SpectatorPlayerLoader.cs b/osu.Game/Screens/Play/SpectatorPlayerLoader.cs index 10cc36c9a9..9ca5475ee4 100644 --- a/osu.Game/Screens/Play/SpectatorPlayerLoader.cs +++ b/osu.Game/Screens/Play/SpectatorPlayerLoader.cs @@ -20,13 +20,13 @@ namespace osu.Game.Screens.Play Score = score.ScoreInfo; } - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { // these will be reverted thanks to PlayerLoader's lease. Mods.Value = Score.Mods; Ruleset.Value = Score.Ruleset; - base.OnEntering(last); + base.OnEntering(e); } } } diff --git a/osu.Game/Screens/Play/SubmittingPlayer.cs b/osu.Game/Screens/Play/SubmittingPlayer.cs index b1f2bccddf..b62dc1e5a6 100644 --- a/osu.Game/Screens/Play/SubmittingPlayer.cs +++ b/osu.Game/Screens/Play/SubmittingPlayer.cs @@ -115,9 +115,9 @@ namespace osu.Game.Screens.Play await submitScore(score).ConfigureAwait(false); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { - bool exiting = base.OnExiting(next); + bool exiting = base.OnExiting(e); if (LoadedBeatmapSuccessfully) submitScore(Score.DeepClone()); diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index cb842ce4a0..98514cd846 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -231,9 +231,9 @@ namespace osu.Game.Screens.Ranking lastFetchCompleted = true; }); - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); ApplyToBackground(b => { @@ -244,9 +244,9 @@ namespace osu.Game.Screens.Ranking bottomPanel.FadeTo(1, 250); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { - if (base.OnExiting(next)) + if (base.OnExiting(e)) return true; this.FadeOut(100); diff --git a/osu.Game/Screens/ScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs index 8b38b67f5c..3a9e7b8f18 100644 --- a/osu.Game/Screens/ScreenWhiteBox.cs +++ b/osu.Game/Screens/ScreenWhiteBox.cs @@ -28,25 +28,25 @@ namespace osu.Game.Screens protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg2"); - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { message.TextContainer.MoveTo(new Vector2(DrawSize.X / 16, 0), transition_time, Easing.OutExpo); this.FadeOut(transition_time, Easing.OutExpo); - return base.OnExiting(next); + return base.OnExiting(e); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { - base.OnSuspending(next); + base.OnSuspending(e); message.TextContainer.MoveTo(new Vector2(-(DrawSize.X / 16), 0), transition_time, Easing.OutExpo); this.FadeOut(transition_time, Easing.OutExpo); } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { - base.OnResuming(last); + base.OnResuming(e); message.TextContainer.MoveTo(Vector2.Zero, transition_time, Easing.OutExpo); this.FadeIn(transition_time, Easing.OutExpo); diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 4a991ffc66..ec8b2e029a 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -109,9 +109,9 @@ namespace osu.Game.Screens.Select } } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { - base.OnResuming(last); + base.OnResuming(e); if (playerLoader != null) { diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index dc505063d1..928978cd08 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -543,9 +543,9 @@ namespace osu.Game.Screens.Select } } - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); this.FadeInFromZero(250); FilterControl.Activate(); @@ -591,9 +591,9 @@ namespace osu.Game.Screens.Select logo.FadeOut(logo_transition / 2, Easing.Out); } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { - base.OnResuming(last); + base.OnResuming(e); // required due to https://github.com/ppy/osu-framework/issues/3218 ModSelect.SelectedMods.Disabled = false; @@ -622,7 +622,7 @@ namespace osu.Game.Screens.Select FilterControl.Activate(); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { // Handle the case where FinaliseSelection is never called (ie. when a screen is pushed externally). // Without this, it's possible for a transfer to happen while we are not the current screen. @@ -640,12 +640,12 @@ namespace osu.Game.Screens.Select this.FadeOut(250); FilterControl.Deactivate(); - base.OnSuspending(next); + base.OnSuspending(e); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { - if (base.OnExiting(next)) + if (base.OnExiting(e)) return true; beatmapInfoWedge.Hide(); diff --git a/osu.Game/Tests/Visual/EditorTestScene.cs b/osu.Game/Tests/Visual/EditorTestScene.cs index ca12bc73fe..46f31ae53b 100644 --- a/osu.Game/Tests/Visual/EditorTestScene.cs +++ b/osu.Game/Tests/Visual/EditorTestScene.cs @@ -118,7 +118,7 @@ namespace osu.Game.Tests.Visual public new bool HasUnsavedChanges => base.HasUnsavedChanges; - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { // For testing purposes allow the screen to exit without saving on second attempt. if (!ExitConfirmed && dialogOverlay?.CurrentDialog is PromptForSaveDialog saveDialog) @@ -127,7 +127,7 @@ namespace osu.Game.Tests.Visual return true; } - return base.OnExiting(next); + return base.OnExiting(e); } public TestEditor(EditorLoader loader = null) From 749b86f0f41c7bed292d3eff81b40ceaf5b20fc4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Apr 2022 00:48:41 +0900 Subject: [PATCH 0404/2328] Use new framework exposed event instead of schedule --- osu.Game/Overlays/SettingsPanel.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/SettingsPanel.cs b/osu.Game/Overlays/SettingsPanel.cs index 7cf233a061..a5a6f9bce7 100644 --- a/osu.Game/Overlays/SettingsPanel.cs +++ b/osu.Game/Overlays/SettingsPanel.cs @@ -284,14 +284,7 @@ namespace osu.Game.Overlays public string SearchTerm { get => SearchContainer.SearchTerm; - set - { - SearchContainer.SearchTerm = value; - - // Schedule required as search term takes a frame to update. - // Without this sections may not be in the correct state to ascertain CurrentSection. - Schedule(InvalidateScrollPosition); - } + set => SearchContainer.SearchTerm = value; } protected override FlowContainer CreateScrollContentContainer() @@ -310,6 +303,8 @@ namespace osu.Game.Overlays Colour = colourProvider.Background4, RelativeSizeAxes = Axes.Both }; + + SearchContainer.FilterCompleted += InvalidateScrollPosition; } protected override void UpdateAfterChildren() From 574007c07a15efd125bfa6c7076428747fe89e54 Mon Sep 17 00:00:00 2001 From: 63411 <62799417+molneya@users.noreply.github.com> Date: Fri, 22 Apr 2022 02:02:23 +0800 Subject: [PATCH 0405/2328] Optimise holdAddition calculation --- osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs index d5d5d5751d..04d1329eec 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs @@ -62,7 +62,9 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Skills holdEndTimes[column] = endTime; // The hold addition only is valid if there is _no_ other note with the same ending. Releasing multiple notes at the same time is just as easy as releasing 1 - holdAddition *= 1 / (1 + Math.Exp(0.5 * (24 - closestEndTime))); + // Nerfs the hold addition by half if the closest release is 24ms away + if (holdAddition > 0) + holdAddition *= 1 / (1 + Math.Exp(0.5 * (24 - closestEndTime))); // Increase individual strain in own column individualStrains[column] += 2.0 * holdFactor; From 8fe4443029420bf4d1df46eda7c3a73b4018279a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 21 Apr 2022 22:29:23 +0200 Subject: [PATCH 0406/2328] Update screen method signatures to match framework API changes --- .../FirstRunSetup/FirstRunSetupScreen.cs | 16 ++++++++-------- osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs index b2284a999d..eb4b97069c 100644 --- a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs +++ b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs @@ -33,39 +33,39 @@ namespace osu.Game.Overlays.FirstRunSetup }; } - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); this .FadeInFromZero(500) .MoveToX(offset) .MoveToX(0, 500, Easing.OutQuint); } - public override void OnResuming(IScreen last) + public override void OnResuming(ScreenTransitionEvent e) { - base.OnResuming(last); + base.OnResuming(e); this .FadeInFromZero(500) .MoveToX(0, 500, Easing.OutQuint); } - public override bool OnExiting(IScreen next) + public override bool OnExiting(ScreenExitEvent e) { this .FadeOut(100) .MoveToX(offset, 500, Easing.OutQuint); - return base.OnExiting(next); + return base.OnExiting(e); } - public override void OnSuspending(IScreen next) + public override void OnSuspending(ScreenTransitionEvent e) { this .FadeOut(100) .MoveToX(-offset, 500, Easing.OutQuint); - base.OnSuspending(next); + base.OnSuspending(e); } } } diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs index e632170975..d9a612ea26 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs @@ -97,9 +97,9 @@ namespace osu.Game.Overlays.FirstRunSetup private class PinnedMainMenu : MainMenu { - public override void OnEntering(IScreen last) + public override void OnEntering(ScreenTransitionEvent e) { - base.OnEntering(last); + base.OnEntering(e); Buttons.ReturnToTopOnIdle = false; Buttons.State = ButtonSystemState.TopLevel; From 32722adba90c3b0f3da0a80438693cff8d39c1fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 20 Apr 2022 22:59:37 +0200 Subject: [PATCH 0407/2328] Allow mod panels to be clicked in incompatible state --- .../Mods/IncompatibilityDisplayingModPanel.cs | 39 ++----------------- osu.Game/Overlays/Mods/ModPanel.cs | 20 ++++++---- 2 files changed, 16 insertions(+), 43 deletions(-) diff --git a/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs b/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs index 38781455fa..aeb983d352 100644 --- a/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs +++ b/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs @@ -1,15 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Cursor; -using osu.Framework.Input.Events; using osu.Game.Rulesets.Mods; using osu.Game.Utils; @@ -42,41 +39,13 @@ namespace osu.Game.Overlays.Mods && !ModUtils.CheckCompatibleSet(selectedMods.Value.Append(Mod)); } + protected override Colour4 BackgroundColour => incompatible.Value ? (Colour4)ColourProvider.Background6 : base.BackgroundColour; + protected override Colour4 ForegroundColour => incompatible.Value ? (Colour4)ColourProvider.Background5 : base.ForegroundColour; + protected override void UpdateState() { - Action = incompatible.Value ? () => { } : (Action)Active.Toggle; - - if (incompatible.Value) - { - Colour4 backgroundColour = ColourProvider.Background6; - Colour4 textBackgroundColour = ColourProvider.Background5; - - Content.TransformTo(nameof(BorderColour), ColourInfo.GradientVertical(backgroundColour, textBackgroundColour), TRANSITION_DURATION, Easing.OutQuint); - Background.FadeColour(backgroundColour, TRANSITION_DURATION, Easing.OutQuint); - - SwitchContainer.ResizeWidthTo(IDLE_SWITCH_WIDTH, TRANSITION_DURATION, Easing.OutQuint); - SwitchContainer.FadeColour(Colour4.Gray, TRANSITION_DURATION, Easing.OutQuint); - MainContentContainer.TransformTo(nameof(Padding), new MarginPadding - { - Left = IDLE_SWITCH_WIDTH, - Right = CORNER_RADIUS - }, TRANSITION_DURATION, Easing.OutQuint); - - TextBackground.FadeColour(textBackgroundColour, TRANSITION_DURATION, Easing.OutQuint); - TextFlow.FadeColour(Colour4.White.Opacity(0.5f), TRANSITION_DURATION, Easing.OutQuint); - return; - } - - SwitchContainer.FadeColour(Colour4.White, TRANSITION_DURATION, Easing.OutQuint); base.UpdateState(); - } - - protected override bool OnMouseDown(MouseDownEvent e) - { - if (incompatible.Value) - return true; // bypasses base call purposely in order to not play out the intermediate state animation. - - return base.OnMouseDown(e); + SwitchContainer.FadeColour(incompatible.Value ? Colour4.Gray : Colour4.White, TRANSITION_DURATION, Easing.OutQuint); } #region IHasCustomTooltip diff --git a/osu.Game/Overlays/Mods/ModPanel.cs b/osu.Game/Overlays/Mods/ModPanel.cs index 7ae325bde7..f2a97da3b2 100644 --- a/osu.Game/Overlays/Mods/ModPanel.cs +++ b/osu.Game/Overlays/Mods/ModPanel.cs @@ -203,20 +203,24 @@ namespace osu.Game.Overlays.Mods base.OnMouseUp(e); } + protected virtual Colour4 BackgroundColour => Active.Value ? activeColour.Darken(0.3f) : (Colour4)ColourProvider.Background3; + protected virtual Colour4 ForegroundColour => Active.Value ? activeColour : (Colour4)ColourProvider.Background2; + protected virtual Colour4 TextColour => Active.Value ? (Colour4)ColourProvider.Background6 : Colour4.White; + protected virtual void UpdateState() { float targetWidth = Active.Value ? EXPANDED_SWITCH_WIDTH : IDLE_SWITCH_WIDTH; double transitionDuration = TRANSITION_DURATION; - Colour4 textBackgroundColour = Active.Value ? activeColour : (Colour4)ColourProvider.Background2; - Colour4 mainBackgroundColour = Active.Value ? activeColour.Darken(0.3f) : (Colour4)ColourProvider.Background3; - Colour4 textColour = Active.Value ? (Colour4)ColourProvider.Background6 : Colour4.White; + Colour4 backgroundColour = BackgroundColour; + Colour4 foregroundColour = ForegroundColour; + Colour4 textColour = TextColour; // Hover affects colour of button background if (IsHovered) { - textBackgroundColour = textBackgroundColour.Lighten(0.1f); - mainBackgroundColour = mainBackgroundColour.Lighten(0.1f); + backgroundColour = backgroundColour.Lighten(0.1f); + foregroundColour = foregroundColour.Lighten(0.1f); } // Mouse down adds a halfway tween of the movement @@ -226,15 +230,15 @@ namespace osu.Game.Overlays.Mods transitionDuration *= 4; } - Content.TransformTo(nameof(BorderColour), ColourInfo.GradientVertical(mainBackgroundColour, textBackgroundColour), transitionDuration, Easing.OutQuint); - Background.FadeColour(mainBackgroundColour, transitionDuration, Easing.OutQuint); + Content.TransformTo(nameof(BorderColour), ColourInfo.GradientVertical(backgroundColour, foregroundColour), transitionDuration, Easing.OutQuint); + Background.FadeColour(backgroundColour, transitionDuration, Easing.OutQuint); SwitchContainer.ResizeWidthTo(targetWidth, transitionDuration, Easing.OutQuint); MainContentContainer.TransformTo(nameof(Padding), new MarginPadding { Left = targetWidth, Right = CORNER_RADIUS }, transitionDuration, Easing.OutQuint); - TextBackground.FadeColour(textBackgroundColour, transitionDuration, Easing.OutQuint); + TextBackground.FadeColour(foregroundColour, transitionDuration, Easing.OutQuint); TextFlow.FadeColour(textColour, transitionDuration, Easing.OutQuint); } From b7c11cdb8e2736df2ec96e187bb2adb549507276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 20 Apr 2022 23:34:43 +0200 Subject: [PATCH 0408/2328] Deselect old incompatible mods if any on user mod select screen --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 27 ++++++++++--------- osu.Game/Overlays/Mods/UserModSelectScreen.cs | 21 +++++++++++++++ 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 693c85fafc..8a83071109 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -168,7 +168,7 @@ namespace osu.Game.Overlays.Mods foreach (var column in columnFlow) { - column.SelectedMods.BindValueChanged(_ => updateBindableFromSelection()); + column.SelectedMods.BindValueChanged(updateBindableFromSelection); } customisationVisible.BindValueChanged(_ => updateCustomisationVisualState(), true); @@ -237,33 +237,36 @@ namespace osu.Game.Overlays.Mods TopLevelContent.MoveToY(-modAreaHeight, transition_duration, Easing.InOutCubic); } - private bool selectionBindableSyncInProgress; - private void updateSelectionFromBindable() { - if (selectionBindableSyncInProgress) - return; - - selectionBindableSyncInProgress = true; - + // note that selectionBindableSyncInProgress is purposefully not checked here. + // this is because in the case of mod selection in solo gameplay, a user selection of a mod can actually lead to deselection of other incompatible mods. + // to synchronise state correctly, updateBindableFromSelection() computes the final mods (including incompatibility rules) and updates SelectedMods, + // and this method then runs unconditionally again to make sure the new visual selection accurately reflects the final set of selected mods. + // selectionBindableSyncInProgress ensures that mutual infinite recursion does not happen after that unconditional call. foreach (var column in columnFlow) column.SelectedMods.Value = SelectedMods.Value.Where(mod => mod.Type == column.ModType).ToArray(); - - selectionBindableSyncInProgress = false; } - private void updateBindableFromSelection() + private bool selectionBindableSyncInProgress; + + private void updateBindableFromSelection(ValueChangedEvent> modSelectionChange) { if (selectionBindableSyncInProgress) return; selectionBindableSyncInProgress = true; - SelectedMods.Value = columnFlow.SelectMany(column => column.SelectedMods.Value).ToArray(); + SelectedMods.Value = ComputeNewModsFromSelection( + modSelectionChange.NewValue.Except(modSelectionChange.OldValue), + modSelectionChange.OldValue.Except(modSelectionChange.NewValue)); selectionBindableSyncInProgress = false; } + protected virtual IReadOnlyList ComputeNewModsFromSelection(IEnumerable addedMods, IEnumerable removedMods) + => columnFlow.SelectMany(column => column.SelectedMods.Value).ToArray(); + protected override void PopIn() { const double fade_in_duration = 400; diff --git a/osu.Game/Overlays/Mods/UserModSelectScreen.cs b/osu.Game/Overlays/Mods/UserModSelectScreen.cs index 81943da514..ed0a07521b 100644 --- a/osu.Game/Overlays/Mods/UserModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/UserModSelectScreen.cs @@ -1,8 +1,11 @@ // 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.Linq; using JetBrains.Annotations; using osu.Game.Rulesets.Mods; +using osu.Game.Utils; using osuTK.Input; namespace osu.Game.Overlays.Mods @@ -11,6 +14,24 @@ namespace osu.Game.Overlays.Mods { protected override ModColumn CreateModColumn(ModType modType, Key[] toggleKeys = null) => new UserModColumn(modType, false, toggleKeys); + protected override IReadOnlyList ComputeNewModsFromSelection(IEnumerable addedMods, IEnumerable removedMods) + { + IEnumerable modsAfterRemoval = SelectedMods.Value.Except(removedMods).ToList(); + + // the preference is that all new mods should override potential incompatible old mods. + // in general that's a bit difficult to compute if more than one mod is added at a time, + // so be conservative and just remove all mods that aren't compatible with any one added mod. + foreach (var addedMod in addedMods) + { + if (!ModUtils.CheckCompatibleSet(modsAfterRemoval.Append(addedMod), out var invalidMods)) + modsAfterRemoval = modsAfterRemoval.Except(invalidMods); + + modsAfterRemoval = modsAfterRemoval.Append(addedMod).ToList(); + } + + return modsAfterRemoval.ToList(); + } + private class UserModColumn : ModColumn { public UserModColumn(ModType modType, bool allowBulkSelection, [CanBeNull] Key[] toggleKeys = null) From cd898344cb60663f0c300cd524c2d8e16d3d984c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 21 Apr 2022 23:49:40 +0200 Subject: [PATCH 0409/2328] Add test coverage of new incompatibility behaviour --- .../UserInterface/TestSceneModSelectScreen.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index 4a738cb29d..514538161e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; @@ -89,6 +90,27 @@ namespace osu.Game.Tests.Visual.UserInterface changeRuleset(3); } + [Test] + public void TestIncompatibilityToggling() + { + createScreen(); + changeRuleset(0); + + AddStep("activate DT", () => getPanelForMod(typeof(OsuModDoubleTime)).TriggerClick()); + AddAssert("DT active", () => SelectedMods.Value.Single().GetType() == typeof(OsuModDoubleTime)); + + AddStep("activate NC", () => getPanelForMod(typeof(OsuModNightcore)).TriggerClick()); + AddAssert("only NC active", () => SelectedMods.Value.Single().GetType() == typeof(OsuModNightcore)); + + AddStep("activate HR", () => getPanelForMod(typeof(OsuModHardRock)).TriggerClick()); + AddAssert("NC+HR active", () => SelectedMods.Value.Any(mod => mod.GetType() == typeof(OsuModNightcore)) + && SelectedMods.Value.Any(mod => mod.GetType() == typeof(OsuModHardRock))); + + AddStep("activate MR", () => getPanelForMod(typeof(OsuModMirror)).TriggerClick()); + AddAssert("NC+MR active", () => SelectedMods.Value.Any(mod => mod.GetType() == typeof(OsuModNightcore)) + && SelectedMods.Value.Any(mod => mod.GetType() == typeof(OsuModMirror))); + } + [Test] public void TestCustomisationToggleState() { @@ -136,5 +158,8 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert($"customisation toggle is {(disabled ? "" : "not ")}disabled", () => getToggle().Active.Disabled == disabled); AddAssert($"customisation toggle is {(active ? "" : "not ")}active", () => getToggle().Active.Value == active); } + + private ModPanel getPanelForMod(Type modType) + => modSelectScreen.ChildrenOfType().Single(panel => panel.Mod.GetType() == modType); } } From e9bd87545e47af17f8226f3850b906a147217883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 22 Apr 2022 00:07:00 +0200 Subject: [PATCH 0410/2328] Fix flaky test in free mod select test scene --- .../Visual/Multiplayer/TestSceneFreeModSelectScreen.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs index 0db05e3a6a..b5f901e51d 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs @@ -21,8 +21,11 @@ namespace osu.Game.Tests.Visual.Multiplayer { State = { Value = Visibility.Visible } }); + AddUntilStep("all column content loaded", + () => freeModSelectScreen.ChildrenOfType().Any() + && freeModSelectScreen.ChildrenOfType().All(column => column.IsLoaded && column.ItemsLoaded)); - AddAssert("all visible mods are playable", + AddUntilStep("all visible mods are playable", () => this.ChildrenOfType() .Where(panel => panel.IsPresent) .All(panel => panel.Mod.HasImplementation && panel.Mod.UserPlayable)); From a9ea0ab91b962e10806ea14698064b13e4d617d0 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 22 Apr 2022 07:55:39 +0300 Subject: [PATCH 0411/2328] Add support for fetching user guest participations --- osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs | 1 + osu.Game/Online/API/Requests/Responses/APIUser.cs | 3 +++ .../Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs | 3 +++ 3 files changed, 7 insertions(+) diff --git a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs index ffb3a3be9b..205fdc9f2b 100644 --- a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs @@ -29,6 +29,7 @@ namespace osu.Game.Online.API.Requests Ranked, Loved, Pending, + Guest, Graveyard } } diff --git a/osu.Game/Online/API/Requests/Responses/APIUser.cs b/osu.Game/Online/API/Requests/Responses/APIUser.cs index a87f0811a1..41f486c709 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUser.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUser.cs @@ -148,6 +148,9 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"pending_beatmapset_count")] public int PendingBeatmapsetCount; + [JsonProperty(@"guest_beatmapset_count")] + public int GuestBeatmapsetCount; + [JsonProperty(@"scores_best_count")] public int ScoresBestCount; diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index 0424fe8bd9..8224cd5eb5 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -53,6 +53,9 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps case BeatmapSetType.Pending: return user.PendingBeatmapsetCount; + case BeatmapSetType.Guest: + return user.GuestBeatmapsetCount; + default: return 0; } From 2c21bd89e74a6f8330f23d2d98b64a4138f510b8 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 22 Apr 2022 07:56:01 +0300 Subject: [PATCH 0412/2328] Display beatmap guest participations in user profile --- osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs index af6ab4aad1..64e5f3e52e 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs @@ -22,6 +22,7 @@ namespace osu.Game.Overlays.Profile.Sections new PaginatedBeatmapContainer(BeatmapSetType.Ranked, User, UsersStrings.ShowExtraBeatmapsRankedTitle), new PaginatedBeatmapContainer(BeatmapSetType.Loved, User, UsersStrings.ShowExtraBeatmapsLovedTitle), new PaginatedBeatmapContainer(BeatmapSetType.Pending, User, UsersStrings.ShowExtraBeatmapsPendingTitle), + new PaginatedBeatmapContainer(BeatmapSetType.Guest, User, "Guest Participation Beatmaps"), new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, UsersStrings.ShowExtraBeatmapsGraveyardTitle) }; } From 97b4a2a105c26c4a6b56eabec85b4e0df2c424a3 Mon Sep 17 00:00:00 2001 From: 63411 <62799417+molneya@users.noreply.github.com> Date: Fri, 22 Apr 2022 12:59:00 +0800 Subject: [PATCH 0413/2328] Use better initial value for closestEndTime --- osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs index 04d1329eec..f295af5f4d 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Skills var maniaCurrent = (ManiaDifficultyHitObject)current; double endTime = maniaCurrent.EndTime; int column = maniaCurrent.BaseObject.Column; - double closestEndTime = 100; + double closestEndTime = endTime - maniaCurrent.LastObject.StartTime; // Lowest value we can assume with the current information double holdFactor = 1.0; // Factor to all additional strains in case something else is held double holdAddition = 0; // Addition to the current note in case it's a hold and has to be released awkwardly From 56bbfa58e5cb08c499e6806a91725a5c186abafc Mon Sep 17 00:00:00 2001 From: 63411 <62799417+molneya@users.noreply.github.com> Date: Fri, 22 Apr 2022 13:01:41 +0800 Subject: [PATCH 0414/2328] Add missing absolute value of closestEndTime --- osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs index f295af5f4d..ba964a4edd 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Skills var maniaCurrent = (ManiaDifficultyHitObject)current; double endTime = maniaCurrent.EndTime; int column = maniaCurrent.BaseObject.Column; - double closestEndTime = endTime - maniaCurrent.LastObject.StartTime; // Lowest value we can assume with the current information + double closestEndTime = Math.Abs(endTime - maniaCurrent.LastObject.StartTime); // Lowest value we can assume with the current information double holdFactor = 1.0; // Factor to all additional strains in case something else is held double holdAddition = 0; // Addition to the current note in case it's a hold and has to be released awkwardly From 8b55d3855a7112bab2e41fad4c62fc17916d5fb8 Mon Sep 17 00:00:00 2001 From: 63411 <62799417+molneya@users.noreply.github.com> Date: Fri, 22 Apr 2022 13:27:59 +0800 Subject: [PATCH 0415/2328] Use isOverlapping bool to determine holdAddition --- .../Difficulty/Skills/Strain.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs index ba964a4edd..a5b9675836 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs @@ -41,13 +41,13 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Skills double holdFactor = 1.0; // Factor to all additional strains in case something else is held double holdAddition = 0; // Addition to the current note in case it's a hold and has to be released awkwardly + bool isOverlapping = false; // Fill up the holdEndTimes array for (int i = 0; i < holdEndTimes.Length; ++i) { - // If there is at least one other overlapping end or note, then we get an addition - if (Precision.DefinitelyBigger(holdEndTimes[i], maniaCurrent.StartTime, 1) && Precision.DefinitelyBigger(endTime, holdEndTimes[i], 1)) - holdAddition = 1.0; + // The current note is overlapped if a previous note or end is overlapping the current note body + isOverlapping |= Precision.DefinitelyBigger(holdEndTimes[i], maniaCurrent.StartTime, 1) && Precision.DefinitelyBigger(endTime, holdEndTimes[i], 1); // We give a slight bonus to everything if something is held meanwhile if (Precision.DefinitelyBigger(holdEndTimes[i], endTime, 1)) @@ -61,10 +61,10 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Skills holdEndTimes[column] = endTime; - // The hold addition only is valid if there is _no_ other note with the same ending. Releasing multiple notes at the same time is just as easy as releasing 1 - // Nerfs the hold addition by half if the closest release is 24ms away - if (holdAddition > 0) - holdAddition *= 1 / (1 + Math.Exp(0.5 * (24 - closestEndTime))); + // The hold addition is given if there was an overlap, however it is only valid if there are no other note with a similar ending. + // Releasing multiple notes is just as easy as releasing 1. Nerfs the hold addition by half if the closest release is 24ms away. + if (isOverlapping) + holdAddition = 1 / (1 + Math.Exp(0.5 * (24 - closestEndTime))); // Increase individual strain in own column individualStrains[column] += 2.0 * holdFactor; From 893a95df408fce4c3a0b280d248c9008670b6f18 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 22 Apr 2022 09:17:30 +0300 Subject: [PATCH 0416/2328] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 6b06305bf9..8d79eb94a8 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c57acb3b7f..c6c18f6061 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index d7f89b802b..64af0d70f3 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -62,7 +62,7 @@ - + From 40d823bf693da2a1af210b7b0e5f3d3218f7b717 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 22 Apr 2022 09:18:42 +0300 Subject: [PATCH 0417/2328] Use localised string for guest participation beatmaps header --- osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs index 64e5f3e52e..4db00df1b5 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Profile.Sections new PaginatedBeatmapContainer(BeatmapSetType.Ranked, User, UsersStrings.ShowExtraBeatmapsRankedTitle), new PaginatedBeatmapContainer(BeatmapSetType.Loved, User, UsersStrings.ShowExtraBeatmapsLovedTitle), new PaginatedBeatmapContainer(BeatmapSetType.Pending, User, UsersStrings.ShowExtraBeatmapsPendingTitle), - new PaginatedBeatmapContainer(BeatmapSetType.Guest, User, "Guest Participation Beatmaps"), + new PaginatedBeatmapContainer(BeatmapSetType.Guest, User, UsersStrings.ShowExtraBeatmapsGuestTitle), new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, UsersStrings.ShowExtraBeatmapsGraveyardTitle) }; } From 82a1d1cc2eab41622c5b69a2867a0a25521e97f0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Apr 2022 15:22:58 +0900 Subject: [PATCH 0418/2328] Fix multiplier display not blocking input --- osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs b/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs index 66fd6a202d..1d848fe456 100644 --- a/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs +++ b/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs @@ -52,7 +52,7 @@ namespace osu.Game.Overlays.Mods Height = HEIGHT; AutoSizeAxes = Axes.X; - InternalChild = new Container + InternalChild = new InputBlockingContainer { RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, From 33d516eecb0b11541c733de1797b9706c8c69763 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 22 Apr 2022 09:28:27 +0300 Subject: [PATCH 0419/2328] Move guest participation beatmap up to below loved --- osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs index 4db00df1b5..6b93c24a78 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs @@ -21,8 +21,8 @@ namespace osu.Game.Overlays.Profile.Sections new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, UsersStrings.ShowExtraBeatmapsFavouriteTitle), new PaginatedBeatmapContainer(BeatmapSetType.Ranked, User, UsersStrings.ShowExtraBeatmapsRankedTitle), new PaginatedBeatmapContainer(BeatmapSetType.Loved, User, UsersStrings.ShowExtraBeatmapsLovedTitle), - new PaginatedBeatmapContainer(BeatmapSetType.Pending, User, UsersStrings.ShowExtraBeatmapsPendingTitle), new PaginatedBeatmapContainer(BeatmapSetType.Guest, User, UsersStrings.ShowExtraBeatmapsGuestTitle), + new PaginatedBeatmapContainer(BeatmapSetType.Pending, User, UsersStrings.ShowExtraBeatmapsPendingTitle), new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, UsersStrings.ShowExtraBeatmapsGraveyardTitle) }; } From 06594ca0c8aa9635f3403db0575f322ad0c34d59 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Apr 2022 15:30:12 +0900 Subject: [PATCH 0420/2328] Refine assertion to ensure correct section is current, rather than any section --- osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs index 8d91b55877..cdeaafd828 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs @@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual.Settings .All(f => f.FilterTerms.Any(t => t.Contains("scaling"))) )); - AddAssert("ensure section is current", () => settings.CurrentSection.Value != null); + AddAssert("ensure section is current", () => settings.CurrentSection.Value is GraphicsSection); } [Test] From f282e5b0133785d8c9e6474cbe04bf5c79dc4811 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Apr 2022 15:32:23 +0900 Subject: [PATCH 0421/2328] Remove one more unnecessary schedule --- osu.Game/Graphics/Containers/SectionsContainer.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 540ca85809..823ba33216 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -195,11 +195,8 @@ namespace osu.Game.Graphics.Containers protected void InvalidateScrollPosition() { - Schedule(() => - { - lastKnownScroll = null; - lastClickedSection = null; - }); + lastKnownScroll = null; + lastClickedSection = null; } protected override void UpdateAfterChildren() From c44f7d9f93c83c74eb25b30c73247506cc474766 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Apr 2022 15:56:03 +0900 Subject: [PATCH 0422/2328] Fix high star ratings not being easily visible on tooltips Resolves issue mentioned in https://github.com/ppy/osu/discussions/17920. --- .../Drawables/DifficultyIconTooltip.cs | 59 +++++-------------- 1 file changed, 15 insertions(+), 44 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIconTooltip.cs b/osu.Game/Beatmaps/Drawables/DifficultyIconTooltip.cs index aba01a1294..5479644772 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIconTooltip.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIconTooltip.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osuTK; @@ -16,11 +15,11 @@ namespace osu.Game.Beatmaps.Drawables { internal class DifficultyIconTooltip : VisibilityContainer, ITooltip { - private readonly OsuSpriteText difficultyName, starRating; - private readonly Box background; - private readonly FillFlowContainer difficultyFlow; + private OsuSpriteText difficultyName; + private StarRatingDisplay starRating; - public DifficultyIconTooltip() + [BackgroundDependencyLoader] + private void load(OsuColour colours) { AutoSizeAxes = Axes.Both; Masking = true; @@ -28,9 +27,10 @@ namespace osu.Game.Beatmaps.Drawables Children = new Drawable[] { - background = new Box + new Box { Alpha = 0.9f, + Colour = colours.Gray3, RelativeSizeAxes = Axes.Both }, new FillFlowContainer @@ -40,6 +40,7 @@ namespace osu.Game.Beatmaps.Drawables AutoSizeEasing = Easing.OutQuint, Direction = FillDirection.Vertical, Padding = new MarginPadding(10), + Spacing = new Vector2(5), Children = new Drawable[] { difficultyName = new OsuSpriteText @@ -48,57 +49,27 @@ namespace osu.Game.Beatmaps.Drawables Origin = Anchor.Centre, Font = OsuFont.GetFont(size: 16, weight: FontWeight.Bold), }, - difficultyFlow = new FillFlowContainer + starRating = new StarRatingDisplay(default, StarRatingDisplaySize.Small) { - AutoSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Direction = FillDirection.Horizontal, - Children = new Drawable[] - { - starRating = new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular), - }, - new SpriteIcon - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Margin = new MarginPadding { Left = 4 }, - Icon = FontAwesome.Solid.Star, - Size = new Vector2(12), - }, - } } } } }; } - [Resolved] - private OsuColour colours { get; set; } - - [BackgroundDependencyLoader] - private void load() - { - background.Colour = colours.Gray3; - } - - private readonly IBindable starDifficulty = new Bindable(); + private DifficultyIconTooltipContent displayedContent; public void SetContent(DifficultyIconTooltipContent content) { - difficultyName.Text = content.BeatmapInfo.DifficultyName; + if (displayedContent != null) + starRating.Current.UnbindFrom(displayedContent.Difficulty); - starDifficulty.UnbindAll(); - starDifficulty.BindTo(content.Difficulty); - starDifficulty.BindValueChanged(difficulty => - { - starRating.Text = $"{difficulty.NewValue.Stars:0.##}"; - difficultyFlow.Colour = colours.ForStarDifficulty(difficulty.NewValue.Stars); - }, true); + displayedContent = content; + + starRating.Current.BindTarget = displayedContent.Difficulty; + difficultyName.Text = displayedContent.BeatmapInfo.DifficultyName; } public void Move(Vector2 pos) => Position = pos; From 14e17c8b7b4892c8485ff907a6790d1d5b041708 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Apr 2022 16:22:12 +0900 Subject: [PATCH 0423/2328] Update `TestIncompatibilityDisplay` in line with new functionality --- .../Visual/UserInterface/TestSceneModPanel.cs | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModPanel.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModPanel.cs index 95323e5dfa..f56d9c8a91 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModPanel.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModPanel.cs @@ -47,12 +47,22 @@ namespace osu.Game.Tests.Visual.UserInterface { IncompatibilityDisplayingModPanel panel = null; - AddStep("create panel with DT", () => Child = panel = new IncompatibilityDisplayingModPanel(new OsuModDoubleTime()) + AddStep("create panel with DT", () => { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.None, - Width = 300 + Child = panel = new IncompatibilityDisplayingModPanel(new OsuModDoubleTime()) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.None, + Width = 300, + }; + + panel.Active.BindValueChanged(active => + { + SelectedMods.Value = active.NewValue + ? Array.Empty() + : new[] { panel.Mod }; + }); }); clickPanel(); @@ -63,11 +73,6 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("set incompatible mod", () => SelectedMods.Value = new[] { new OsuModHalfTime() }); - clickPanel(); - AddAssert("panel not active", () => !panel.Active.Value); - - AddStep("reset mods", () => SelectedMods.Value = Array.Empty()); - clickPanel(); AddAssert("panel active", () => panel.Active.Value); From 7258a097489655632d89def6cdbac09cd54f3d3a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Apr 2022 18:04:07 +0900 Subject: [PATCH 0424/2328] Allow `SettingsSection`s to exit without a parent `SettingsPanel` --- osu.Game/Overlays/Settings/SettingsSection.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index 28c42a0e47..dc3af9104f 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -44,7 +45,7 @@ namespace osu.Game.Overlays.Settings public bool FilteringActive { get; set; } - [Resolved] + [Resolved(canBeNull: true)] private SettingsPanel settingsPanel { get; set; } protected SettingsSection() @@ -117,7 +118,7 @@ namespace osu.Game.Overlays.Settings }, }); - selectedSection = settingsPanel.CurrentSection.GetBoundCopy(); + selectedSection = settingsPanel?.CurrentSection.GetBoundCopy() ?? new Bindable(this); selectedSection.BindValueChanged(_ => updateContentFade(), true); } @@ -138,7 +139,10 @@ namespace osu.Game.Overlays.Settings protected override bool OnClick(ClickEvent e) { if (!isCurrentSection) + { + Debug.Assert(settingsPanel != null); settingsPanel.SectionsContainer.ScrollTo(this); + } return base.OnClick(e); } From 2a043aa6de7ae64990a6069e7cb0402d4e8f06fd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Apr 2022 18:04:43 +0900 Subject: [PATCH 0425/2328] Add a method of finding and applying settings with classic default value --- osu.Game/Overlays/Settings/ISettingsItem.cs | 6 ++++ osu.Game/Overlays/Settings/SettingsItem.cs | 36 ++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/ISettingsItem.cs b/osu.Game/Overlays/Settings/ISettingsItem.cs index e7afa48502..e6b1e68741 100644 --- a/osu.Game/Overlays/Settings/ISettingsItem.cs +++ b/osu.Game/Overlays/Settings/ISettingsItem.cs @@ -9,5 +9,11 @@ namespace osu.Game.Overlays.Settings public interface ISettingsItem : IDrawable, IDisposable { event Action SettingChanged; + + /// + /// Apply the default values of a setting item, if the setting item specifies a "classic" default via . + /// + /// Whether to apply the classic value. If false, the standard default is applied. + void ApplyClassicDefault(bool useClassicDefault); } } diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 1c5668479f..845a7f5cdf 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -30,6 +30,8 @@ namespace osu.Game.Overlays.Settings /// public object SettingSourceObject { get; internal set; } + public const string CLASSIC_DEFAULT_SEARCH_TERM = @"has-classic-default"; + private IHasCurrentValue controlWithCurrent => Control as IHasCurrentValue; protected override Container Content => FlowContent; @@ -96,7 +98,23 @@ namespace osu.Game.Overlays.Settings set => controlWithCurrent.Current = value; } - public virtual IEnumerable FilterTerms => Keywords == null ? new[] { LabelText.ToString() } : new List(Keywords) { LabelText.ToString() }.ToArray(); + public virtual IEnumerable FilterTerms + { + get + { + var keywords = new List(Keywords ?? Array.Empty()) + { + LabelText.ToString() + }; + + if (GetClassicDefault != null) + { + keywords.Add(CLASSIC_DEFAULT_SEARCH_TERM); + } + + return keywords; + } + } public IEnumerable Keywords { get; set; } @@ -108,6 +126,22 @@ namespace osu.Game.Overlays.Settings public event Action SettingChanged; + /// + /// An action which when invoked will apply a classic default value to this setting. + /// + public Func GetClassicDefault { get; set; } + + public void ApplyClassicDefault(bool useClassicDefault) + { + if (GetClassicDefault != null) + { + if (useClassicDefault) + Current.Value = GetClassicDefault(); + else + Current.SetDefault(); + } + } + protected SettingsItem() { RelativeSizeAxes = Axes.X; From e0b9ab022de2f610b294a53c065ae07d4e81f999 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Apr 2022 18:05:24 +0900 Subject: [PATCH 0426/2328] Add classic default values against setting controls --- osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs | 1 + osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs | 1 + .../Overlays/Settings/Sections/UserInterface/GeneralSettings.cs | 1 + 3 files changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs index a4c0381d16..33db74c530 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs @@ -33,6 +33,7 @@ namespace osu.Game.Rulesets.Osu.UI }, new SettingsCheckbox { + GetClassicDefault = () => false, LabelText = "Snaking out sliders", Current = config.GetBindable(OsuRulesetSetting.SnakingOutSliders) }, diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index d4e4fd571d..3ca677ef7b 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -21,6 +21,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { new SettingsEnumDropdown { + GetClassicDefault = () => ScoringMode.Classic, LabelText = GameplaySettingsStrings.ScoreDisplayMode, Current = config.GetBindable(OsuSetting.ScoreDisplayMode), Keywords = new[] { "scoring" } diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs index 6e1558f7d7..06f2c9794c 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs @@ -37,6 +37,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface }, new SettingsSlider { + GetClassicDefault = () => 0, LabelText = UserInterfaceStrings.HoldToConfirmActivationTime, Current = config.GetBindable(OsuSetting.UIHoldActivationDelay), Keywords = new[] { @"delay" }, From 1caee3876802ca5ac8aa81c9bb932f8a558192ad Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Apr 2022 18:05:52 +0900 Subject: [PATCH 0427/2328] Add first-run "behaviour" screen to allow users a choice of more familiar UX --- .../TestSceneFirstRunScreenBehaviour.cs | 19 ++++ .../FirstRunSetupOverlayStrings.cs | 28 ++++- .../Overlays/FirstRunSetup/ScreenBehaviour.cs | 104 ++++++++++++++++++ osu.Game/Overlays/FirstRunSetupOverlay.cs | 1 + 4 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs create mode 100644 osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs new file mode 100644 index 0000000000..d7f0c5ba03 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs @@ -0,0 +1,19 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Screens; +using osu.Game.Overlays.FirstRunSetup; + +namespace osu.Game.Tests.Visual.UserInterface +{ + public class TestSceneFirstRunScreenBehaviour : OsuManualInputManagerTestScene + { + public TestSceneFirstRunScreenBehaviour() + { + AddStep("load screen", () => + { + Child = new ScreenStack(new ScreenBehaviour()); + }); + } + } +} diff --git a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs index 001de93c16..15b8d0ba67 100644 --- a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs +++ b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs @@ -17,7 +17,8 @@ namespace osu.Game.Localisation /// /// "Click to resume first-run setup at any point" /// - public static LocalisableString ClickToResumeFirstRunSetupAtAnyPoint => new TranslatableString(getKey(@"click_to_resume_first_run_setup_at_any_point"), @"Click to resume first-run setup at any point"); + public static LocalisableString ClickToResumeFirstRunSetupAtAnyPoint => + new TranslatableString(getKey(@"click_to_resume_first_run_setup_at_any_point"), @"Click to resume first-run setup at any point"); /// /// "First-run setup" @@ -53,6 +54,31 @@ osu! is a very configurable game, and diving straight into the settings can some /// public static LocalisableString Next(LocalisableString nextStepDescription) => new TranslatableString(getKey(@"next"), @"Next ({0})", nextStepDescription); + /// + /// "Behaviour" + /// + public static LocalisableString Behaviour => new TranslatableString(getKey(@"behaviour"), @"Behaviour"); + + /// + /// "Some new defaults for game behaviours have been implemented, with the aim of improving the game experience and making it more accessible to everyone. + /// + /// We recommend you give the new defaults a try, but if you'd like to have things feel more like classic versions of osu!, you can easily apply some sane defaults below." + /// + public static LocalisableString BehaviourDescription => new TranslatableString(getKey(@"behaviour_description"), + @"Some new defaults for game behaviours have been implemented, with the aim of improving the game experience and making it more accessible to everyone. + +We recommend you give the new defaults a try, but if you'd like to have things feel more like classic versions of osu!, you can easily apply some sane defaults below."); + + /// + /// "New defaults" + /// + public static LocalisableString NewDefaults => new TranslatableString(getKey(@"new_defaults"), @"New defaults"); + + /// + /// "Classic defaults" + /// + public static LocalisableString ClassicDefaults => new TranslatableString(getKey(@"classic_defaults"), @"Classic defaults"); + private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs new file mode 100644 index 0000000000..61177c821b --- /dev/null +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs @@ -0,0 +1,104 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Testing; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; +using osu.Game.Localisation; +using osu.Game.Overlays.Settings; +using osu.Game.Overlays.Settings.Sections; + +namespace osu.Game.Overlays.FirstRunSetup +{ + public class ScreenBehaviour : FirstRunSetupScreen + { + private SearchContainer searchContainer; + + [BackgroundDependencyLoader] + private void load() + { + Content.Children = new Drawable[] + { + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 24)) + { + Text = FirstRunSetupOverlayStrings.BehaviourDescription, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + }, + new GridContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + ColumnDimensions = new[] + { + new Dimension(), + new Dimension(GridSizeMode.Absolute, 10), + new Dimension(), + }, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize), + }, + Content = new[] + { + new[] + { + new TriangleButton + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Text = FirstRunSetupOverlayStrings.NewDefaults, + RelativeSizeAxes = Axes.X, + Action = applyStandard, + }, + Empty(), + new DangerousTriangleButton + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Text = FirstRunSetupOverlayStrings.ClassicDefaults, + RelativeSizeAxes = Axes.X, + Action = applyClassic + } + }, + }, + }, + searchContainer = new SearchContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new SettingsSection[] + { + new GeneralSection(), + new SkinSection(), + new UserInterfaceSection(), + new GameplaySection(), + new RulesetSection(), + new AudioSection(), + new GraphicsSection(), + new OnlineSection(), + new MaintenanceSection(), + new DebugSection(), + }, + SearchTerm = SettingsItem.CLASSIC_DEFAULT_SEARCH_TERM, + } + }; + } + + private void applyClassic() + { + foreach (var i in searchContainer.ChildrenOfType()) + i.ApplyClassicDefault(true); + } + + private void applyStandard() + { + foreach (var i in searchContainer.ChildrenOfType()) + i.ApplyClassicDefault(false); + } + } +} diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index a12fec4507..26b1eb2d45 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -70,6 +70,7 @@ namespace osu.Game.Overlays { new FirstRunStep(typeof(ScreenWelcome), FirstRunSetupOverlayStrings.WelcomeTitle), new FirstRunStep(typeof(ScreenUIScale), GraphicsSettingsStrings.UIScaling), + new FirstRunStep(typeof(ScreenBehaviour), FirstRunSetupOverlayStrings.Behaviour), }; private Container stackContainer = null!; From bcdd1fb183b0b612290f23c2129c3948d2210262 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Apr 2022 18:37:40 +0900 Subject: [PATCH 0428/2328] Fix nested song select in first-run dialog fiddling with global audio --- osu.Game/Screens/Select/SongSelect.cs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 928978cd08..2a1ed2a7a8 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -50,6 +50,12 @@ namespace osu.Game.Screens.Select public FilterControl FilterControl { get; private set; } + /// + /// Whether this song select instance should take control of the global track, + /// applying looping and preview offsets. + /// + protected virtual bool ControlGlobalMusic => true; + protected virtual bool ShowFooter => true; protected virtual bool DisplayStableImportPrompt => legacyImportManager?.SupportsImportFromStable == true; @@ -604,15 +610,18 @@ namespace osu.Game.Screens.Select BeatmapDetails.Refresh(); beginLooping(); - music.ResetTrackAdjustments(); if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending) { updateComponentFromBeatmap(Beatmap.Value); - // restart playback on returning to song select, regardless. - // not sure this should be a permanent thing (we may want to leave a user pause paused even on returning) - music.Play(requestedByUser: true); + if (ControlGlobalMusic) + { + // restart playback on returning to song select, regardless. + // not sure this should be a permanent thing (we may want to leave a user pause paused even on returning) + music.ResetTrackAdjustments(); + music.Play(requestedByUser: true); + } } this.FadeIn(250); @@ -663,6 +672,9 @@ namespace osu.Game.Screens.Select private void beginLooping() { + if (!ControlGlobalMusic) + return; + Debug.Assert(!isHandlingLooping); isHandlingLooping = true; @@ -733,6 +745,9 @@ namespace osu.Game.Screens.Select /// private void ensurePlayingSelected() { + if (!ControlGlobalMusic) + return; + ITrack track = music.CurrentTrack; bool isNewTrack = !lastTrack.TryGetTarget(out var last) || last != track; From 5f3ff51f7e1f1c416b2be768b7433aabf7fbb5be Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Apr 2022 21:24:58 +0900 Subject: [PATCH 0429/2328] Revert "Remove one more unnecessary schedule" This reverts commit f282e5b0133785d8c9e6474cbe04bf5c79dc4811. --- osu.Game/Graphics/Containers/SectionsContainer.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 823ba33216..540ca85809 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -195,8 +195,11 @@ namespace osu.Game.Graphics.Containers protected void InvalidateScrollPosition() { - lastKnownScroll = null; - lastClickedSection = null; + Schedule(() => + { + lastKnownScroll = null; + lastClickedSection = null; + }); } protected override void UpdateAfterChildren() From 0dc3d1041fe22d4c0bbc245327b6a2cd46f49e36 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 22 Apr 2022 19:23:54 +0300 Subject: [PATCH 0430/2328] Revert "Revert "Remove one more unnecessary schedule"" This reverts commit 5f3ff51f7e1f1c416b2be768b7433aabf7fbb5be. --- osu.Game/Graphics/Containers/SectionsContainer.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 540ca85809..823ba33216 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -195,11 +195,8 @@ namespace osu.Game.Graphics.Containers protected void InvalidateScrollPosition() { - Schedule(() => - { - lastKnownScroll = null; - lastClickedSection = null; - }); + lastKnownScroll = null; + lastClickedSection = null; } protected override void UpdateAfterChildren() From 2961c383f68891bdc954ecab928fda81cad765ba Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 22 Apr 2022 20:04:04 +0300 Subject: [PATCH 0431/2328] Add failing test case --- .../Visual/Settings/TestSceneSettingsPanel.cs | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs index cdeaafd828..377873f64a 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs @@ -33,18 +33,21 @@ namespace osu.Game.Tests.Visual.Settings State = { Value = Visibility.Visible } }); }); + + AddStep("reset mouse", () => InputManager.MoveMouseTo(settings)); } [Test] - public void TestQuickFiltering() + public void TestFiltering([Values] bool beforeLoad) { - AddStep("set filter", () => - { - settings.SectionsContainer.ChildrenOfType().First().Current.Value = "scaling"; - }); + if (beforeLoad) + AddStep("set filter", () => settings.SectionsContainer.ChildrenOfType().First().Current.Value = "scaling"); AddUntilStep("wait for items to load", () => settings.SectionsContainer.ChildrenOfType().Any()); + if (!beforeLoad) + AddStep("set filter", () => settings.SectionsContainer.ChildrenOfType().First().Current.Value = "scaling"); + AddAssert("ensure all items match filter", () => settings.SectionsContainer .ChildrenOfType().Where(f => f.IsPresent) .All(section => @@ -56,6 +59,15 @@ namespace osu.Game.Tests.Visual.Settings )); AddAssert("ensure section is current", () => settings.CurrentSection.Value is GraphicsSection); + AddAssert("ensure section is placed first", () => settings.CurrentSection.Value.Y == 0); + } + + [Test] + public void TestFilterAfterLoad() + { + AddUntilStep("wait for items to load", () => settings.SectionsContainer.ChildrenOfType().Any()); + + AddStep("set filter", () => settings.SectionsContainer.ChildrenOfType().First().Current.Value = "scaling"); } [Test] From 4c7c611218fbf0b4e73aca928f2e1b2081f9d370 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 22 Apr 2022 20:34:00 +0300 Subject: [PATCH 0432/2328] Fix settings overlay not invalidating presence on filter change --- osu.Game/Overlays/Settings/SettingsItem.cs | 18 +++++++++++++++-- osu.Game/Overlays/Settings/SettingsSection.cs | 20 ++++++++++++++++--- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 1c5668479f..7795b7b4c5 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -100,9 +100,23 @@ namespace osu.Game.Overlays.Settings public IEnumerable Keywords { get; set; } - public override bool IsPresent => base.IsPresent && MatchingFilter; + private bool matchingFilter; - public bool MatchingFilter { get; set; } = true; + public bool MatchingFilter + { + get => matchingFilter; + set + { + bool wasPresent = IsPresent; + + matchingFilter = value; + + if (IsPresent != wasPresent) + Invalidate(Invalidation.Presence); + } + } + + public override bool IsPresent => base.IsPresent && MatchingFilter; public bool FilteringActive { get; set; } diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index 28c42a0e47..694823314e 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -21,8 +21,6 @@ namespace osu.Game.Overlays.Settings protected FillFlowContainer FlowContent; protected override Container Content => FlowContent; - public override bool IsPresent => base.IsPresent && MatchingFilter; - private IBindable selectedSection; private Box dim; @@ -40,7 +38,23 @@ namespace osu.Game.Overlays.Settings private const int header_size = 24; private const int border_size = 4; - public bool MatchingFilter { get; set; } = true; + private bool matchingFilter; + + public bool MatchingFilter + { + get => matchingFilter; + set + { + bool wasPresent = IsPresent; + + matchingFilter = value; + + if (IsPresent != wasPresent) + Invalidate(Invalidation.Presence); + } + } + + public override bool IsPresent => base.IsPresent && MatchingFilter; public bool FilteringActive { get; set; } From 7be25963121626e9f024787d1c24f13409e7952b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 22 Apr 2022 23:50:58 +0300 Subject: [PATCH 0433/2328] Fix `MatchingFilter` being false by default --- osu.Game/Overlays/Settings/SettingsItem.cs | 2 +- osu.Game/Overlays/Settings/SettingsSection.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 7795b7b4c5..f7824d79e7 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -100,7 +100,7 @@ namespace osu.Game.Overlays.Settings public IEnumerable Keywords { get; set; } - private bool matchingFilter; + private bool matchingFilter = true; public bool MatchingFilter { diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index 694823314e..b5f3d8e003 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Settings private const int header_size = 24; private const int border_size = 4; - private bool matchingFilter; + private bool matchingFilter = true; public bool MatchingFilter { From 56358ef19ed9ebe69a74b25eff50e537b5e63fe2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 23 Apr 2022 00:35:45 +0300 Subject: [PATCH 0434/2328] Fix legacy skin hit animation lookup falling back to `LookupName` --- osu.Game/Skinning/LegacySkin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index f7d5581621..aed6026d69 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -390,7 +390,7 @@ namespace osu.Game.Skinning return new LegacyJudgementPieceOld(resultComponent.Component, createDrawable); } - break; + return null; } return this.GetAnimation(component.LookupName, false, false); From 69e2e309717382f6ae63d5b24205a249f089b562 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 23 Apr 2022 01:06:35 +0300 Subject: [PATCH 0435/2328] Remove legacy skin component fallback lookup Has always been a source of hiding actual issues like in https://github.com/ppy/osu/issues/17745 (`sliderfollowcircle` looked up from fallback because there's no transformer), and https://github.com/ppy/osu/issues/17934 (because there's a texture `ok` and that matches the component name `HitResult.Ok`). --- osu.Game/Skinning/LegacySkin.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index aed6026d69..1b3b0eea18 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -391,9 +391,10 @@ namespace osu.Game.Skinning } return null; - } - return this.GetAnimation(component.LookupName, false, false); + default: + throw new ArgumentOutOfRangeException(nameof(component)); + } } private Texture? getParticleTexture(HitResult result) From 61078910a64de149e999f970146837b3334d8bfa Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 23 Apr 2022 01:08:53 +0300 Subject: [PATCH 0436/2328] Handle all skin component types explicitly --- .../Skinning/Legacy/CatchLegacySkinTransformer.cs | 3 +++ .../Skinning/Legacy/ManiaLegacySkinTransformer.cs | 5 +++-- .../Skinning/Legacy/OsuLegacySkinTransformer.cs | 6 ++++++ .../Skinning/Legacy/TaikoLegacySkinTransformer.cs | 7 +++++++ osu.Game/Skinning/DefaultSkin.cs | 2 +- osu.Game/Skinning/LegacySkin.cs | 5 ++++- osu.Game/Skinning/SkinnableSprite.cs | 2 +- .../Skinning/UnsupportedSkinComponentException.cs | 15 +++++++++++++++ 8 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 osu.Game/Skinning/UnsupportedSkinComponentException.cs diff --git a/osu.Game.Rulesets.Catch/Skinning/Legacy/CatchLegacySkinTransformer.cs b/osu.Game.Rulesets.Catch/Skinning/Legacy/CatchLegacySkinTransformer.cs index b2a555f89d..04b522b404 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Legacy/CatchLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Legacy/CatchLegacySkinTransformer.cs @@ -90,6 +90,9 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy return new LegacyHitExplosion(); return null; + + default: + throw new UnsupportedSkinComponentException(component); } } diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/ManiaLegacySkinTransformer.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/ManiaLegacySkinTransformer.cs index 431bd77402..315b4444c2 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/ManiaLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/ManiaLegacySkinTransformer.cs @@ -116,9 +116,10 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy case ManiaSkinComponents.StageForeground: return new LegacyStageForeground(); - } - break; + default: + throw new UnsupportedSkinComponentException(component); + } } return base.GetDrawableComponent(component); diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs index 900ad6f6d3..572185e6e1 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs @@ -35,6 +35,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy case OsuSkinComponents.FollowPoint: return this.GetAnimation(component.LookupName, true, true, true, startAtCurrentTime: false); + case OsuSkinComponents.SliderScorePoint: + return this.GetAnimation(component.LookupName, false, false); + case OsuSkinComponents.SliderFollowCircle: var followCircle = this.GetAnimation("sliderfollowcircle", true, true, true); if (followCircle != null) @@ -123,6 +126,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy case OsuSkinComponents.ApproachCircle: return new LegacyApproachCircle(); + + default: + throw new UnsupportedSkinComponentException(component); } } diff --git a/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacySkinTransformer.cs b/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacySkinTransformer.cs index bbc8f0abea..af5921b0fb 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacySkinTransformer.cs @@ -57,6 +57,10 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy case TaikoSkinComponents.DrumRollTick: return this.GetAnimation("sliderscorepoint", false, false); + case TaikoSkinComponents.Swell: + // todo: support taiko legacy swell (https://github.com/ppy/osu/issues/13601). + return null; + case TaikoSkinComponents.HitTarget: if (GetTexture("taikobigcircle") != null) return new TaikoLegacyHitTarget(); @@ -119,6 +123,9 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy case TaikoSkinComponents.Mascot: return new DrawableTaikoMascot(); + + default: + throw new UnsupportedSkinComponentException(component); } } diff --git a/osu.Game/Skinning/DefaultSkin.cs b/osu.Game/Skinning/DefaultSkin.cs index 119b0ec9ad..fb24084659 100644 --- a/osu.Game/Skinning/DefaultSkin.cs +++ b/osu.Game/Skinning/DefaultSkin.cs @@ -155,7 +155,7 @@ namespace osu.Game.Skinning return skinnableTargetWrapper; } - break; + return null; } switch (component.LookupName) diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 1b3b0eea18..b65ba8b04c 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -392,8 +392,11 @@ namespace osu.Game.Skinning return null; + case SkinnableSprite.SpriteComponent sprite: + return this.GetAnimation(sprite.LookupName, false, false); + default: - throw new ArgumentOutOfRangeException(nameof(component)); + throw new UnsupportedSkinComponentException(component); } } diff --git a/osu.Game/Skinning/SkinnableSprite.cs b/osu.Game/Skinning/SkinnableSprite.cs index 4b4d7fe2c6..af9ff0f1d7 100644 --- a/osu.Game/Skinning/SkinnableSprite.cs +++ b/osu.Game/Skinning/SkinnableSprite.cs @@ -65,7 +65,7 @@ namespace osu.Game.Skinning public bool UsesFixedAnchor { get; set; } - private class SpriteComponent : ISkinComponent + public class SpriteComponent : ISkinComponent { public string LookupName { get; set; } diff --git a/osu.Game/Skinning/UnsupportedSkinComponentException.cs b/osu.Game/Skinning/UnsupportedSkinComponentException.cs new file mode 100644 index 0000000000..643f29c3db --- /dev/null +++ b/osu.Game/Skinning/UnsupportedSkinComponentException.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 System; + +namespace osu.Game.Skinning +{ + public class UnsupportedSkinComponentException : Exception + { + public UnsupportedSkinComponentException(ISkinComponent component) + : base($@"Unsupported component type: {component.GetType()}(""{component.LookupName}"").") + { + } + } +} From 89519086c89fd8897e65816677f1ca088e743907 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 23 Apr 2022 03:16:58 +0300 Subject: [PATCH 0437/2328] Fix `SkinnableTestScene` unnecessarily adding a base raw skin layer --- osu.Game/Tests/Visual/SkinnableTestScene.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/osu.Game/Tests/Visual/SkinnableTestScene.cs b/osu.Game/Tests/Visual/SkinnableTestScene.cs index 2e1ca09fe4..296ed80e37 100644 --- a/osu.Game/Tests/Visual/SkinnableTestScene.cs +++ b/osu.Game/Tests/Visual/SkinnableTestScene.cs @@ -74,11 +74,15 @@ namespace osu.Game.Tests.Visual createdDrawables.Add(created); - SkinProvidingContainer mainProvider; Container childContainer; OutlineBox outlineBox; SkinProvidingContainer skinProvider; + ISkin provider = skin; + + if (provider is LegacySkin legacyProvider) + provider = Ruleset.Value.CreateInstance().CreateLegacySkinProvider(legacyProvider, beatmap); + var children = new Container { RelativeSizeAxes = Axes.Both, @@ -107,12 +111,10 @@ namespace osu.Game.Tests.Visual Children = new Drawable[] { outlineBox = new OutlineBox(), - (mainProvider = new SkinProvidingContainer(skin)).WithChild( - skinProvider = new SkinProvidingContainer(Ruleset.Value.CreateInstance().CreateLegacySkinProvider(mainProvider, beatmap)) - { - Child = created, - } - ) + skinProvider = new SkinProvidingContainer(provider) + { + Child = created, + } } }, } @@ -130,7 +132,7 @@ namespace osu.Game.Tests.Visual { bool autoSize = created.RelativeSizeAxes == Axes.None; - foreach (var c in new[] { mainProvider, childContainer, skinProvider }) + foreach (var c in new[] { childContainer, skinProvider }) { c.RelativeSizeAxes = Axes.None; c.AutoSizeAxes = Axes.None; From 610d61dce9dcc1be01acf3dce37ea254b6125942 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 23 Apr 2022 03:17:18 +0300 Subject: [PATCH 0438/2328] Fix `TestSceneSliderApplication` not applying legacy skin transformer --- osu.Game.Rulesets.Osu.Tests/TestSceneSliderApplication.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderApplication.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderApplication.cs index d673b7a6ac..a40ae611d8 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderApplication.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderApplication.cs @@ -70,7 +70,9 @@ namespace osu.Game.Rulesets.Osu.Tests var tintingSkin = skinManager.GetSkin(DefaultLegacySkin.CreateInfo()); tintingSkin.Configuration.ConfigDictionary["AllowSliderBallTint"] = "1"; - Child = new SkinProvidingContainer(tintingSkin) + var provider = Ruleset.Value.CreateInstance().CreateLegacySkinProvider(tintingSkin, Beatmap.Value.Beatmap); + + Child = new SkinProvidingContainer(provider) { RelativeSizeAxes = Axes.Both, Child = dho = new DrawableSlider(prepareObject(new Slider From 6cca56ab77d0317a2dba6cfc114f9c3bd105d248 Mon Sep 17 00:00:00 2001 From: 63411 <62799417+molneya@users.noreply.github.com> Date: Sat, 23 Apr 2022 10:46:12 +0800 Subject: [PATCH 0439/2328] Move release_threshold to const --- osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs index a5b9675836..31550a8105 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs @@ -14,6 +14,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Skills { private const double individual_decay_base = 0.125; private const double overall_decay_base = 0.30; + private const double release_threshold = 24; protected override double SkillMultiplier => 1; protected override double StrainDecayBase => 1; @@ -62,9 +63,17 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Skills holdEndTimes[column] = endTime; // The hold addition is given if there was an overlap, however it is only valid if there are no other note with a similar ending. - // Releasing multiple notes is just as easy as releasing 1. Nerfs the hold addition by half if the closest release is 24ms away. + // Releasing multiple notes is just as easy as releasing 1. Nerfs the hold addition by half if the closest release is release_threshold away. + // holdAddition + // ^ + // 1.0 + - - - - - -+----------- + // | / + // 0.5 + - - - - -/ Sigmoid Curve + // | /| + // 0.0 +--------+-+---------------> Release Difference / ms + // release_threshold if (isOverlapping) - holdAddition = 1 / (1 + Math.Exp(0.5 * (24 - closestEndTime))); + holdAddition = 1 / (1 + Math.Exp(0.5 * (release_threshold - closestEndTime))); // Increase individual strain in own column individualStrains[column] += 2.0 * holdFactor; From 27f3499330536b0ab2e86e600478a751fcb1e9d5 Mon Sep 17 00:00:00 2001 From: maromalo <54760464+maromalo@users.noreply.github.com> Date: Sat, 23 Apr 2022 00:17:00 -0300 Subject: [PATCH 0440/2328] Add joystick/gamepad deadzone setting Also splits joystick/gamepad into a new sub-section. --- .../Localisation/JoystickSettingsStrings.cs | 21 +++++++ .../Sections/Input/JoystickSettings.cs | 62 +++++++++++++++++++ .../Settings/Sections/InputSection.cs | 5 +- 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Localisation/JoystickSettingsStrings.cs create mode 100644 osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs diff --git a/osu.Game/Localisation/JoystickSettingsStrings.cs b/osu.Game/Localisation/JoystickSettingsStrings.cs new file mode 100644 index 0000000000..6ae8bb66dc --- /dev/null +++ b/osu.Game/Localisation/JoystickSettingsStrings.cs @@ -0,0 +1,21 @@ +using osu.Framework.Localisation; + +namespace osu.Game.Localisation +{ + public static class JoystickSettingsStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.JoystickSettings"; + + /// + /// "Joystick / Gamepad" + /// + public static LocalisableString JoystickGamepad => new TranslatableString(getKey(@"joystick_gamepad"), @"Joystick / Gamepad"); + + /// + /// "Deadzone Threshold" + /// + public static LocalisableString DeadzoneThreshold => new TranslatableString(getKey(@"deadzone_threshold"), @"Deadzone Threshold"); + + private static string getKey(string key) => $@"{prefix}:{key}"; + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs new file mode 100644 index 0000000000..fd1dbc876a --- /dev/null +++ b/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs @@ -0,0 +1,62 @@ +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Input.Handlers.Joystick; +using osu.Framework.Localisation; +using osu.Game.Graphics.UserInterface; +using osu.Game.Localisation; + +namespace osu.Game.Overlays.Settings.Sections.Input +{ + public class JoystickSettings : SettingsSubsection + { + private readonly JoystickHandler joystickHandler; + + protected override LocalisableString Header => JoystickSettingsStrings.JoystickGamepad; + private readonly BindableNumber deadzoneThreshold = new BindableNumber(); + private readonly Bindable enabled = new BindableBool(true); + public JoystickSettings(JoystickHandler joystickHandler) + { + this.joystickHandler = joystickHandler; + } + [BackgroundDependencyLoader] + private void load() + { + Children = new Drawable[] + { + new SettingsCheckbox + { + LabelText = CommonStrings.Enabled, + Current = enabled + }, + new DeadzoneSetting + { + LabelText = JoystickSettingsStrings.DeadzoneThreshold, + Current = deadzoneThreshold + }, + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + enabled.BindTo(joystickHandler.Enabled); + deadzoneThreshold.BindTo(joystickHandler.DeadzoneThreshold); + enabled.BindValueChanged(e => deadzoneThreshold.Disabled = !e.NewValue, true); + } + + private class DeadzoneSetting : SettingsSlider + { + public DeadzoneSetting() + { + KeyboardStep = 0.005f; + TransferValueOnCommit = true; + } + } + + private class DeadzoneSlider : OsuSliderBar + { + public override LocalisableString TooltipText => Current.Disabled ? "" : base.TooltipText; + } + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Settings/Sections/InputSection.cs b/osu.Game/Overlays/Settings/Sections/InputSection.cs index d282ba5318..d2c5d2fcf7 100644 --- a/osu.Game/Overlays/Settings/Sections/InputSection.cs +++ b/osu.Game/Overlays/Settings/Sections/InputSection.cs @@ -68,7 +68,10 @@ namespace osu.Game.Overlays.Settings.Sections break; // whitelist the handlers which should be displayed to avoid any weird cases of users touching settings they shouldn't. - case JoystickHandler _: + case JoystickHandler jh: + section = new JoystickSettings(jh); + break; + case MidiHandler _: section = new HandlerSection(handler); break; From 99f276a570950a93f5fdf9022aad10e356da7ae7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 23 Apr 2022 13:30:23 +0900 Subject: [PATCH 0441/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 8d79eb94a8..82dec74855 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c6c18f6061..325e834fa5 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 64af0d70f3..8775442be2 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 23ef1e194db1ef1fdaefe0664622547c59c3caed Mon Sep 17 00:00:00 2001 From: maromalo <54760464+maromalo@users.noreply.github.com> Date: Sat, 23 Apr 2022 01:52:59 -0300 Subject: [PATCH 0442/2328] Code Quality Whoops. --- .../Localisation/JoystickSettingsStrings.cs | 3 + .../Sections/Input/JoystickSettings.cs | 85 ++++++++++--------- 2 files changed, 46 insertions(+), 42 deletions(-) diff --git a/osu.Game/Localisation/JoystickSettingsStrings.cs b/osu.Game/Localisation/JoystickSettingsStrings.cs index 6ae8bb66dc..ee2096ef89 100644 --- a/osu.Game/Localisation/JoystickSettingsStrings.cs +++ b/osu.Game/Localisation/JoystickSettingsStrings.cs @@ -1,3 +1,6 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs index fd1dbc876a..aa6d602b6d 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs @@ -1,3 +1,6 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -11,52 +14,50 @@ namespace osu.Game.Overlays.Settings.Sections.Input public class JoystickSettings : SettingsSubsection { private readonly JoystickHandler joystickHandler; - - protected override LocalisableString Header => JoystickSettingsStrings.JoystickGamepad; - private readonly BindableNumber deadzoneThreshold = new BindableNumber(); - private readonly Bindable enabled = new BindableBool(true); - public JoystickSettings(JoystickHandler joystickHandler) + protected override LocalisableString Header => JoystickSettingsStrings.JoystickGamepad; + private readonly BindableNumber deadzoneThreshold = new BindableNumber(); + private readonly Bindable enabled = new BindableBool(true); + public JoystickSettings(JoystickHandler joystickHandler) + { + this.joystickHandler = joystickHandler; + } + [BackgroundDependencyLoader] + private void load() + { + Children = new Drawable[] { - this.joystickHandler = joystickHandler; - } - [BackgroundDependencyLoader] - private void load() - { - Children = new Drawable[] + new SettingsCheckbox { - new SettingsCheckbox - { - LabelText = CommonStrings.Enabled, - Current = enabled - }, - new DeadzoneSetting - { - LabelText = JoystickSettingsStrings.DeadzoneThreshold, - Current = deadzoneThreshold - }, - }; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - enabled.BindTo(joystickHandler.Enabled); - deadzoneThreshold.BindTo(joystickHandler.DeadzoneThreshold); - enabled.BindValueChanged(e => deadzoneThreshold.Disabled = !e.NewValue, true); - } - - private class DeadzoneSetting : SettingsSlider - { - public DeadzoneSetting() + LabelText = CommonStrings.Enabled, + Current = enabled + }, + new DeadzoneSetting { - KeyboardStep = 0.005f; - TransferValueOnCommit = true; - } - } - - private class DeadzoneSlider : OsuSliderBar + LabelText = JoystickSettingsStrings.DeadzoneThreshold, + Current = deadzoneThreshold + }, + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + enabled.BindTo(joystickHandler.Enabled); + deadzoneThreshold.BindTo(joystickHandler.DeadzoneThreshold); + enabled.BindValueChanged(e => deadzoneThreshold.Disabled = !e.NewValue, true); + } + + private class DeadzoneSetting : SettingsSlider + { + public DeadzoneSetting() { - public override LocalisableString TooltipText => Current.Disabled ? "" : base.TooltipText; + KeyboardStep = 0.005f; + TransferValueOnCommit = true; } + } + private class DeadzoneSlider : OsuSliderBar + { + public override LocalisableString TooltipText => Current.Disabled ? "" : base.TooltipText; + } } } \ No newline at end of file From 6a87dfdabb8c56d54fffb2355181a9cde95e4eee Mon Sep 17 00:00:00 2001 From: maromalo <54760464+maromalo@users.noreply.github.com> Date: Sat, 23 Apr 2022 02:14:41 -0300 Subject: [PATCH 0443/2328] More Code Quality Double whoops. --- osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs index aa6d602b6d..aaa8048019 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs @@ -17,10 +17,12 @@ namespace osu.Game.Overlays.Settings.Sections.Input protected override LocalisableString Header => JoystickSettingsStrings.JoystickGamepad; private readonly BindableNumber deadzoneThreshold = new BindableNumber(); private readonly Bindable enabled = new BindableBool(true); + public JoystickSettings(JoystickHandler joystickHandler) { this.joystickHandler = joystickHandler; } + [BackgroundDependencyLoader] private void load() { @@ -55,6 +57,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input TransferValueOnCommit = true; } } + private class DeadzoneSlider : OsuSliderBar { public override LocalisableString TooltipText => Current.Disabled ? "" : base.TooltipText; From 0133ee962da47e25fcc6255a94833f34db73955b Mon Sep 17 00:00:00 2001 From: maromalo <54760464+maromalo@users.noreply.github.com> Date: Sat, 23 Apr 2022 02:23:07 -0300 Subject: [PATCH 0444/2328] Change JoystickSettingsStrings.cs text Co-authored-by: Salman Ahmed --- osu.Game/Localisation/JoystickSettingsStrings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Localisation/JoystickSettingsStrings.cs b/osu.Game/Localisation/JoystickSettingsStrings.cs index ee2096ef89..410cd0a6f5 100644 --- a/osu.Game/Localisation/JoystickSettingsStrings.cs +++ b/osu.Game/Localisation/JoystickSettingsStrings.cs @@ -17,7 +17,7 @@ namespace osu.Game.Localisation /// /// "Deadzone Threshold" /// - public static LocalisableString DeadzoneThreshold => new TranslatableString(getKey(@"deadzone_threshold"), @"Deadzone Threshold"); + public static LocalisableString DeadzoneThreshold => new TranslatableString(getKey(@"deadzone_threshold"), @"Deadzone"); private static string getKey(string key) => $@"{prefix}:{key}"; } From d97dc22e79021f94249a99cae827d1d25003bac7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 23 Apr 2022 21:23:41 +0900 Subject: [PATCH 0445/2328] Add missing dependencies for behaviour screen test --- .../Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs index d7f0c5ba03..9747b5cc53 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs @@ -1,13 +1,18 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; using osu.Framework.Screens; +using osu.Game.Overlays; using osu.Game.Overlays.FirstRunSetup; namespace osu.Game.Tests.Visual.UserInterface { public class TestSceneFirstRunScreenBehaviour : OsuManualInputManagerTestScene { + [Cached] + private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); + public TestSceneFirstRunScreenBehaviour() { AddStep("load screen", () => From 5d0842ac447f2912872e6e37d029305baf69b0b7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 23 Apr 2022 21:53:47 +0900 Subject: [PATCH 0446/2328] Add a few more classic defaults to missed settings --- osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs | 1 + osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs | 1 + .../Settings/Sections/UserInterface/SongSelectSettings.cs | 1 + 3 files changed, 3 insertions(+) diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs index 5029c6a617..6978c77aad 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs @@ -28,6 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay }, new SettingsCheckbox { + GetClassicDefault = () => false, LabelText = GameplaySettingsStrings.AlwaysPlayFirstComboBreak, Current = config.GetBindable(OsuSetting.AlwaysPlayFirstComboBreak) } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs index ba9779d650..285cdfa3f8 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs @@ -30,6 +30,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay }, new SettingsCheckbox { + GetClassicDefault = () => false, LabelText = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail, Current = config.GetBindable(OsuSetting.ShowHealthDisplayWhenCantFail), Keywords = new[] { "hp", "bar" } diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs index 6290046987..213234db4f 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs @@ -32,6 +32,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface { new SettingsCheckbox { + GetClassicDefault = () => true, LabelText = UserInterfaceStrings.RightMouseScroll, Current = config.GetBindable(OsuSetting.SongSelectRightMouseScroll), }, From 4bf11df57c9ac2ac19646f2ac83a94b75be2279c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 23 Apr 2022 19:11:54 +0300 Subject: [PATCH 0447/2328] Change `SpriteComponent` accessibility to `internal` --- osu.Game/Skinning/SkinnableSprite.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Skinning/SkinnableSprite.cs b/osu.Game/Skinning/SkinnableSprite.cs index af9ff0f1d7..21b34fcd27 100644 --- a/osu.Game/Skinning/SkinnableSprite.cs +++ b/osu.Game/Skinning/SkinnableSprite.cs @@ -65,7 +65,7 @@ namespace osu.Game.Skinning public bool UsesFixedAnchor { get; set; } - public class SpriteComponent : ISkinComponent + internal class SpriteComponent : ISkinComponent { public string LookupName { get; set; } From 5addcbf460d569a385c01b1db5a0918d8343d89c Mon Sep 17 00:00:00 2001 From: maromalo <54760464+maromalo@users.noreply.github.com> Date: Sat, 23 Apr 2022 13:16:20 -0300 Subject: [PATCH 0448/2328] Changed KeyboardStep to 0.01 --- osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs index aaa8048019..ad01c25ac9 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs @@ -53,7 +53,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input { public DeadzoneSetting() { - KeyboardStep = 0.005f; + KeyboardStep = 0.01f; TransferValueOnCommit = true; } } From e89441951cab3b2f3142d3b15c535c6cf867cf45 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Wed, 20 Apr 2022 22:00:37 +0200 Subject: [PATCH 0449/2328] Allow any key to trigger the initial osu! cookie --- osu.Game/Screens/Menu/ButtonSystem.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 885f4903b0..b48aef330a 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -196,11 +196,8 @@ namespace osu.Game.Screens.Menu if (State == ButtonSystemState.Initial) { - if (buttonsTopLevel.Any(b => e.Key == b.TriggerKey)) - { - logo?.TriggerClick(); - return true; - } + logo?.TriggerClick(); + return true; } return base.OnKeyDown(e); From cdfef088464046ee468ca016579d8362441a8c3e Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 23 Apr 2022 18:44:50 +0200 Subject: [PATCH 0450/2328] Add tests for shortcut keys --- .../UserInterface/TestSceneButtonSystem.cs | 63 ++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs index 1bb5cadc6a..1a879e2e70 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs @@ -10,11 +10,12 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Screens.Menu; using osuTK; using osuTK.Graphics; +using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] - public class TestSceneButtonSystem : OsuTestScene + public class TestSceneButtonSystem : OsuManualInputManagerTestScene { private OsuLogo logo; private ButtonSystem buttons; @@ -64,6 +65,66 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("Enter mode", performEnterMode); } + [TestCase(Key.P, true)] + [TestCase(Key.M, true)] + [TestCase(Key.L, true)] + [TestCase(Key.E, false)] + [TestCase(Key.D, false)] + [TestCase(Key.Q, false)] + [TestCase(Key.O, false)] + public void TestShortcutKeys(Key key, bool entersPlay) + { + int activationCount = -1; + AddStep("set up action", () => + { + activationCount = 0; + void action() => activationCount++; + + switch (key) + { + case Key.P: + buttons.OnSolo = action; + break; + + case Key.M: + buttons.OnMultiplayer = action; + break; + + case Key.L: + buttons.OnPlaylists = action; + break; + + case Key.E: + buttons.OnEdit = action; + break; + + case Key.D: + buttons.OnBeatmapListing = action; + break; + + case Key.Q: + buttons.OnExit = action; + break; + + case Key.O: + buttons.OnSettings = action; + break; + } + }); + + AddStep($"press {key}", () => InputManager.Key(key)); + AddAssert("state is top level", () => buttons.State == ButtonSystemState.TopLevel); + + if (entersPlay) + { + AddStep("press P", () => InputManager.Key(Key.P)); + AddAssert("state is play", () => buttons.State == ButtonSystemState.Play); + } + + AddStep($"press {key}", () => InputManager.Key(key)); + AddAssert("action triggered", () => activationCount == 1); + } + private void performEnterMode() { buttons.State = ButtonSystemState.EnteringMode; From 684d88ba7586eb361091f8e235b35c9dc3af54c5 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 23 Apr 2022 19:01:55 +0200 Subject: [PATCH 0451/2328] Add full OsuGame tests These tests ensure the expected behaviour is not broken in the future. --- .../TestSceneButtonSystemNavigation.cs | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 osu.Game.Tests/Visual/Navigation/TestSceneButtonSystemNavigation.cs diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneButtonSystemNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneButtonSystemNavigation.cs new file mode 100644 index 0000000000..8c96ec699f --- /dev/null +++ b/osu.Game.Tests/Visual/Navigation/TestSceneButtonSystemNavigation.cs @@ -0,0 +1,46 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using NUnit.Framework; +using osu.Framework.Testing; +using osu.Game.Screens.Menu; +using osu.Game.Screens.Select; +using osuTK.Input; + +namespace osu.Game.Tests.Visual.Navigation +{ + public class TestSceneButtonSystemNavigation : OsuGameTestScene + { + private ButtonSystem buttons => ((MainMenu)Game.ScreenStack.CurrentScreen).ChildrenOfType().Single(); + + [Test] + public void TestGlobalActionHasPriority() + { + AddAssert("state is initial", () => buttons.State == ButtonSystemState.Initial); + + // triggering the cookie in the initial state with any key should only happen if no other action is bound to that key. + // here, F10 is bound to GlobalAction.ToggleGameplayMouseButtons. + AddStep("press F10", () => InputManager.Key(Key.F10)); + AddAssert("state is initial", () => buttons.State == ButtonSystemState.Initial); + + AddStep("press P", () => InputManager.Key(Key.P)); + AddAssert("state is top level", () => buttons.State == ButtonSystemState.TopLevel); + } + + [Test] + public void TestShortcutKeys() + { + AddAssert("state is initial", () => buttons.State == ButtonSystemState.Initial); + + AddStep("press P", () => InputManager.Key(Key.P)); + AddAssert("state is top level", () => buttons.State == ButtonSystemState.TopLevel); + + AddStep("press P", () => InputManager.Key(Key.P)); + AddAssert("state is play", () => buttons.State == ButtonSystemState.Play); + + AddStep("press P", () => InputManager.Key(Key.P)); + AddAssert("entered song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect); + } + } +} From daadc3fc21c35824de511b930ffa06a1fe85c00a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 23 Apr 2022 23:14:14 +0300 Subject: [PATCH 0452/2328] Simplfiy and share notification dimsiss method across test scenes Might as well inline, but I feel like it will require adding the same comment across all usages, because just `State.Value = Hidden` in an until step feels off, dunno. --- .../TestSceneChangeAndUseGameplayBindings.cs | 9 +-------- .../Navigation/TestSceneMouseWheelVolumeAdjust.cs | 9 +-------- .../Navigation/TestSceneScreenNavigation.cs | 15 +++------------ osu.Game/Tests/Visual/OsuGameTestScene.cs | 7 +++++++ 4 files changed, 12 insertions(+), 28 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneChangeAndUseGameplayBindings.cs b/osu.Game.Tests/Visual/Navigation/TestSceneChangeAndUseGameplayBindings.cs index 347b4b6c54..b7a74dcd27 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneChangeAndUseGameplayBindings.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneChangeAndUseGameplayBindings.cs @@ -59,8 +59,7 @@ namespace osu.Game.Tests.Visual.Navigation AddUntilStep("wait for player", () => { - // dismiss any notifications that may appear (ie. muted notification). - clickMouseInCentre(); + DismissAnyNotifications(); return player != null; }); @@ -73,12 +72,6 @@ namespace osu.Game.Tests.Visual.Navigation AddAssert("key counter did increase", () => keyCounter.CountPresses == 1); } - private void clickMouseInCentre() - { - InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.Centre); - InputManager.Click(MouseButton.Left); - } - private KeyBindingsSubsection osuBindingSubsection => keyBindingPanel .ChildrenOfType() .FirstOrDefault(s => s.Ruleset.ShortName == "osu"); diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneMouseWheelVolumeAdjust.cs b/osu.Game.Tests/Visual/Navigation/TestSceneMouseWheelVolumeAdjust.cs index 22a00a3e5a..2662b3930c 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneMouseWheelVolumeAdjust.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneMouseWheelVolumeAdjust.cs @@ -89,18 +89,11 @@ namespace osu.Game.Tests.Visual.Navigation AddUntilStep("wait for player", () => { - // dismiss any notifications that may appear (ie. muted notification). - clickMouseInCentre(); + DismissAnyNotifications(); return (player = Game.ScreenStack.CurrentScreen as Player) != null; }); AddUntilStep("wait for play time active", () => !player.IsBreakTime.Value); } - - private void clickMouseInCentre() - { - InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.Centre); - InputManager.Click(MouseButton.Left); - } } } diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs index 0b7242eee0..296a184f4b 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs @@ -155,8 +155,7 @@ namespace osu.Game.Tests.Visual.Navigation AddUntilStep("wait for player", () => { - // dismiss any notifications that may appear (ie. muted notification). - clickMouseInCentre(); + DismissAnyNotifications(); return (player = Game.ScreenStack.CurrentScreen as Player) != null; }); @@ -280,8 +279,7 @@ namespace osu.Game.Tests.Visual.Navigation AddUntilStep("wait for player", () => { - // dismiss any notifications that may appear (ie. muted notification). - clickMouseInCentre(); + DismissAnyNotifications(); return (player = Game.ScreenStack.CurrentScreen as Player) != null; }); @@ -596,8 +594,7 @@ namespace osu.Game.Tests.Visual.Navigation AddUntilStep("wait for player", () => { - // dismiss any notifications that may appear (ie. muted notification). - clickMouseInCentre(); + DismissAnyNotifications(); return (player = Game.ScreenStack.CurrentScreen as Player) != null; }); @@ -607,12 +604,6 @@ namespace osu.Game.Tests.Visual.Navigation return () => player; } - private void clickMouseInCentre() - { - InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.Centre); - InputManager.Click(MouseButton.Left); - } - private void pushEscape() => AddStep("Press escape", () => InputManager.Key(Key.Escape)); diff --git a/osu.Game/Tests/Visual/OsuGameTestScene.cs b/osu.Game/Tests/Visual/OsuGameTestScene.cs index 7a6f8c8cfb..1b8f8bfd07 100644 --- a/osu.Game/Tests/Visual/OsuGameTestScene.cs +++ b/osu.Game/Tests/Visual/OsuGameTestScene.cs @@ -23,7 +23,9 @@ using osu.Game.Rulesets.Mods; using osu.Game.Scoring; using osu.Game.Screens; using osu.Game.Screens.Menu; +using osu.Game.Screens.Play; using osuTK.Graphics; +using osuTK.Input; using IntroSequence = osu.Game.Configuration.IntroSequence; namespace osu.Game.Tests.Visual @@ -106,6 +108,11 @@ namespace osu.Game.Tests.Visual protected void ConfirmAtMainMenu() => AddUntilStep("Wait for main menu", () => Game.ScreenStack.CurrentScreen is MainMenu menu && menu.IsLoaded); + /// + /// Dismisses any notifications pushed which block from interacting with the game (or block screens from loading, e.g. ). + /// + protected void DismissAnyNotifications() => Game.Notifications.State.Value = Visibility.Hidden; + public class TestOsuGame : OsuGame { public new const float SIDE_OVERLAY_OFFSET_RATIO = OsuGame.SIDE_OVERLAY_OFFSET_RATIO; From 6ab188f8f9c52651a64dc26b27534d47a228a133 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 23 Apr 2022 23:15:31 +0300 Subject: [PATCH 0453/2328] Split skin editor scene library test to own file Rather than stuffing more random cases to `TestSceneScreenNavigation`. --- .../Navigation/TestSceneScreenNavigation.cs | 71 -------------- .../TestSceneSkinEditorSceneLibrary.cs | 97 +++++++++++++++++++ 2 files changed, 97 insertions(+), 71 deletions(-) create mode 100644 osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs index 296a184f4b..a1f41d4caf 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs @@ -8,7 +8,6 @@ using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.UserInterface; using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Beatmaps; @@ -16,7 +15,6 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Online.Leaderboards; using osu.Game.Overlays; using osu.Game.Overlays.Mods; -using osu.Game.Overlays.Settings; using osu.Game.Overlays.Toolbar; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Mods; @@ -24,12 +22,10 @@ using osu.Game.Scoring; using osu.Game.Screens.Menu; using osu.Game.Screens.OnlinePlay.Lounge; using osu.Game.Screens.Play; -using osu.Game.Screens.Play.HUD.HitErrorMeters; using osu.Game.Screens.Ranking; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Screens.Select.Options; -using osu.Game.Skinning.Editor; using osu.Game.Tests.Beatmaps.IO; using osuTK; using osuTK.Input; @@ -71,73 +67,6 @@ namespace osu.Game.Tests.Visual.Navigation AddAssert("Overlay was shown", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible); } - [Test] - public void TestEditComponentDuringGameplay() - { - Screens.Select.SongSelect songSelect = null; - PushAndConfirm(() => songSelect = new TestPlaySongSelect()); - AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded); - - AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely()); - - AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault); - - SkinEditor skinEditor = null; - - AddStep("open skin editor", () => - { - InputManager.PressKey(Key.ControlLeft); - InputManager.PressKey(Key.ShiftLeft); - InputManager.Key(Key.S); - InputManager.ReleaseKey(Key.ControlLeft); - InputManager.ReleaseKey(Key.ShiftLeft); - }); - - AddUntilStep("get skin editor", () => (skinEditor = Game.ChildrenOfType().FirstOrDefault()) != null); - - AddStep("Click gameplay scene button", () => - { - skinEditor.ChildrenOfType().First(b => b.Text == "Gameplay").TriggerClick(); - }); - - AddUntilStep("wait for player", () => - { - // dismiss any notifications that may appear (ie. muted notification). - clickMouseInCentre(); - return Game.ScreenStack.CurrentScreen is Player; - }); - - BarHitErrorMeter hitErrorMeter = null; - - AddUntilStep("select bar hit error blueprint", () => - { - var blueprint = skinEditor.ChildrenOfType().FirstOrDefault(b => b.Item is BarHitErrorMeter); - - if (blueprint == null) - return false; - - hitErrorMeter = (BarHitErrorMeter)blueprint.Item; - skinEditor.SelectedComponents.Clear(); - skinEditor.SelectedComponents.Add(blueprint.Item); - return true; - }); - - AddAssert("value is default", () => hitErrorMeter.JudgementLineThickness.IsDefault); - - AddStep("hover first slider", () => - { - InputManager.MoveMouseTo( - skinEditor.ChildrenOfType().First() - .ChildrenOfType>().First() - .ChildrenOfType>().First() - ); - }); - - AddStep("adjust slider via keyboard", () => InputManager.Key(Key.Left)); - - AddAssert("value is less than default", () => hitErrorMeter.JudgementLineThickness.Value < hitErrorMeter.JudgementLineThickness.Default); - } - [Test] public void TestRetryCountIncrements() { diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs new file mode 100644 index 0000000000..ed3eae528f --- /dev/null +++ b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs @@ -0,0 +1,97 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Linq; +using NUnit.Framework; +using osu.Framework.Extensions; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Testing; +using osu.Game.Overlays.Settings; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu.Mods; +using osu.Game.Screens.Play; +using osu.Game.Screens.Play.HUD.HitErrorMeters; +using osu.Game.Skinning.Editor; +using osu.Game.Tests.Beatmaps.IO; +using osuTK.Input; +using static osu.Game.Tests.Visual.Navigation.TestSceneScreenNavigation; + +namespace osu.Game.Tests.Visual.Navigation +{ + public class TestSceneSkinEditorSceneLibrary : OsuGameTestScene + { + private SkinEditor skinEditor; + + public override void SetUpSteps() + { + base.SetUpSteps(); + + Screens.Select.SongSelect songSelect = null; + PushAndConfirm(() => songSelect = new TestPlaySongSelect()); + AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded); + + AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely()); + + AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault); + + AddStep("open skin editor", () => + { + InputManager.PressKey(Key.ControlLeft); + InputManager.PressKey(Key.ShiftLeft); + InputManager.Key(Key.S); + InputManager.ReleaseKey(Key.ControlLeft); + InputManager.ReleaseKey(Key.ShiftLeft); + }); + + AddUntilStep("get skin editor", () => (skinEditor = Game.ChildrenOfType().FirstOrDefault()) != null); + } + + [Test] + public void TestEditComponentDuringGameplay() + { + switchToGameplayScene(); + + BarHitErrorMeter hitErrorMeter = null; + + AddUntilStep("select bar hit error blueprint", () => + { + var blueprint = skinEditor.ChildrenOfType().FirstOrDefault(b => b.Item is BarHitErrorMeter); + + if (blueprint == null) + return false; + + hitErrorMeter = (BarHitErrorMeter)blueprint.Item; + skinEditor.SelectedComponents.Clear(); + skinEditor.SelectedComponents.Add(blueprint.Item); + return true; + }); + + AddAssert("value is default", () => hitErrorMeter.JudgementLineThickness.IsDefault); + + AddStep("hover first slider", () => + { + InputManager.MoveMouseTo( + skinEditor.ChildrenOfType().First() + .ChildrenOfType>().First() + .ChildrenOfType>().First() + ); + }); + + AddStep("adjust slider via keyboard", () => InputManager.Key(Key.Left)); + + AddAssert("value is less than default", () => hitErrorMeter.JudgementLineThickness.Value < hitErrorMeter.JudgementLineThickness.Default); + } + + private void switchToGameplayScene() + { + AddStep("Click gameplay scene button", () => skinEditor.ChildrenOfType().First(b => b.Text == "Gameplay").TriggerClick()); + + AddUntilStep("wait for player", () => + { + DismissAnyNotifications(); + return Game.ScreenStack.CurrentScreen is Player; + }); + } + } +} From 60e76d62c1231ce81e1c7725136fb160f8d4e750 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 23 Apr 2022 23:16:06 +0300 Subject: [PATCH 0454/2328] Add failing test cases --- .../TestSceneSkinEditorSceneLibrary.cs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs index ed3eae528f..448d6b1e68 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs @@ -83,6 +83,46 @@ namespace osu.Game.Tests.Visual.Navigation AddAssert("value is less than default", () => hitErrorMeter.JudgementLineThickness.Value < hitErrorMeter.JudgementLineThickness.Default); } + [Test] + public void TestAutoplayCompatibleModsRetainedOnEnteringGameplay() + { + AddStep("select DT", () => Game.SelectedMods.Value = new Mod[] { new OsuModDoubleTime() }); + + switchToGameplayScene(); + + AddAssert("DT still selected", () => ((Player)Game.ScreenStack.CurrentScreen).Mods.Value.Single() is OsuModDoubleTime); + } + + [Test] + public void TestAutoplayIncompatibleModsRemovedOnEnteringGameplay() + { + AddStep("select no fail and spun out", () => Game.SelectedMods.Value = new Mod[] { new OsuModNoFail(), new OsuModSpunOut() }); + + switchToGameplayScene(); + + AddAssert("no mod selected", () => !((Player)Game.ScreenStack.CurrentScreen).Mods.Value.Any()); + } + + [Test] + public void TestDuplicateAutoplayModRemovedOnEnteringGameplay() + { + AddStep("select autoplay", () => Game.SelectedMods.Value = new Mod[] { new OsuModAutoplay() }); + + switchToGameplayScene(); + + AddAssert("no mod selected", () => !((Player)Game.ScreenStack.CurrentScreen).Mods.Value.Any()); + } + + [Test] + public void TestCinemaModRemovedOnEnteringGameplay() + { + AddStep("select cinema", () => Game.SelectedMods.Value = new Mod[] { new OsuModCinema() }); + + switchToGameplayScene(); + + AddAssert("no mod selected", () => !((Player)Game.ScreenStack.CurrentScreen).Mods.Value.Any()); + } + private void switchToGameplayScene() { AddStep("Click gameplay scene button", () => skinEditor.ChildrenOfType().First(b => b.Text == "Gameplay").TriggerClick()); From 0ecda46d93261dce4ebae52eaec3da768c16da1e Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 23 Apr 2022 23:16:32 +0300 Subject: [PATCH 0455/2328] Deselect mods incompatible with "Autoplay" when entering gameplay via scene library --- osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs b/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs index 4507526806..2124ba9b6d 100644 --- a/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs +++ b/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs @@ -1,6 +1,8 @@ // 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.Linq; using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -18,6 +20,7 @@ using osu.Game.Rulesets.Mods; using osu.Game.Screens; using osu.Game.Screens.Play; using osu.Game.Screens.Select; +using osu.Game.Utils; using osuTK; namespace osu.Game.Skinning.Editor @@ -34,6 +37,9 @@ namespace osu.Game.Skinning.Editor [Resolved] private IBindable ruleset { get; set; } + [Resolved] + private Bindable> mods { get; set; } + public SkinEditorSceneLibrary() { Height = BUTTON_HEIGHT + padding * 2; @@ -95,6 +101,10 @@ namespace osu.Game.Skinning.Editor return; var replayGeneratingMod = ruleset.Value.CreateInstance().GetAutoplayMod(); + + if (!ModUtils.CheckCompatibleSet(mods.Value.Append(replayGeneratingMod), out var invalid)) + mods.Value = mods.Value.Except(invalid).ToArray(); + if (replayGeneratingMod != null) screen.Push(new PlayerLoader(() => new ReplayPlayer((beatmap, mods) => replayGeneratingMod.CreateScoreFromReplayData(beatmap, mods)))); }, new[] { typeof(Player), typeof(SongSelect) }) From e8cf4466b0caee3478ca109329b237608748b12a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 22 Apr 2022 23:19:03 +0300 Subject: [PATCH 0456/2328] Make sections container test scene more usable Head busted the moment I opened this test scene. Cleaned it up a bit to make it easier to test changes. --- .../TestSceneSectionsContainer.cs | 146 ++++++++++++++---- 1 file changed, 115 insertions(+), 31 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneSectionsContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneSectionsContainer.cs index 2312c57af2..fc2b5e5e09 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneSectionsContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneSectionsContainer.cs @@ -3,45 +3,79 @@ using System.Linq; using NUnit.Framework; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Testing; +using osu.Framework.Utils; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; using osuTK.Graphics; +using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface { public class TestSceneSectionsContainer : OsuManualInputManagerTestScene { - private readonly SectionsContainer container; + private SectionsContainer container; private float custom; - private const float header_height = 100; - public TestSceneSectionsContainer() + private const float header_expandable_height = 300; + private const float header_fixed_height = 100; + + [SetUpSteps] + public void SetUpSteps() { - container = new SectionsContainer + AddStep("setup container", () => { - RelativeSizeAxes = Axes.Y, - Width = 300, - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - FixedHeader = new Box + container = new SectionsContainer { - Alpha = 0.5f, + RelativeSizeAxes = Axes.Y, Width = 300, - Height = header_height, - Colour = Color4.Red - } - }; - container.SelectedSection.ValueChanged += section => - { - if (section.OldValue != null) - section.OldValue.Selected = false; - if (section.NewValue != null) - section.NewValue.Selected = true; - }; - Add(container); + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + }; + + container.SelectedSection.ValueChanged += section => + { + if (section.OldValue != null) + section.OldValue.Selected = false; + if (section.NewValue != null) + section.NewValue.Selected = true; + }; + + Child = container; + }); + + AddToggleStep("disable expandable header", v => container.ExpandableHeader = v + ? null + : new TestBox(@"Expandable Header") + { + RelativeSizeAxes = Axes.X, + Height = header_expandable_height, + BackgroundColour = new OsuColour().GreySky, + }); + + AddToggleStep("disable fixed header", v => container.FixedHeader = v + ? null + : new TestBox(@"Fixed Header") + { + RelativeSizeAxes = Axes.X, + Height = header_fixed_height, + BackgroundColour = new OsuColour().Red.Opacity(0.5f), + }); + + AddToggleStep("disable footer", v => container.Footer = v + ? null + : new TestBox("Footer") + { + RelativeSizeAxes = Axes.X, + Height = 200, + BackgroundColour = new OsuColour().Green4, + }); } [Test] @@ -71,7 +105,6 @@ namespace osu.Game.Tests.Visual.UserInterface { const int sections_count = 11; float[] alternating = { 0.07f, 0.33f, 0.16f, 0.33f }; - AddStep("clear", () => container.Clear()); AddStep("fill with sections", () => { for (int i = 0; i < sections_count; i++) @@ -84,9 +117,9 @@ namespace osu.Game.Tests.Visual.UserInterface AddUntilStep("correct section selected", () => container.SelectedSection.Value == container.Children[scrollIndex]); AddUntilStep("section top is visible", () => { - float scrollPosition = container.ChildrenOfType().First().Current; - float sectionTop = container.Children[scrollIndex].BoundingBox.Top; - return scrollPosition < sectionTop; + var scrollContainer = container.ChildrenOfType().Single(); + float sectionPosition = scrollContainer.GetChildPosInContent(container.Children[scrollIndex]); + return scrollContainer.Current < sectionPosition; }); } @@ -101,15 +134,27 @@ namespace osu.Game.Tests.Visual.UserInterface AddUntilStep("correct section selected", () => container.SelectedSection.Value == container.Children[sections_count - 1]); } - private static readonly ColourInfo selected_colour = ColourInfo.GradientVertical(Color4.Yellow, Color4.Gold); + private static readonly ColourInfo selected_colour = ColourInfo.GradientVertical(new OsuColour().Orange2, new OsuColour().Orange3); private static readonly ColourInfo default_colour = ColourInfo.GradientVertical(Color4.White, Color4.DarkGray); private void append(float multiplier) { - container.Add(new TestSection + float fixedHeaderHeight = container.FixedHeader?.Height ?? 0; + float expandableHeaderHeight = container.ExpandableHeader?.Height ?? 0; + + float totalHeaderHeight = expandableHeaderHeight + fixedHeaderHeight; + float effectiveHeaderHeight = totalHeaderHeight; + + // if we're in the "next page" of the sections container, + // height of the expandable header should not be accounted. + var scrollContent = container.ChildrenOfType().Single().ScrollContent; + if (totalHeaderHeight + scrollContent.Height >= Content.DrawHeight) + effectiveHeaderHeight -= expandableHeaderHeight; + + container.Add(new TestSection($"Section #{container.Children.Count + 1}") { Width = 300, - Height = (container.ChildSize.Y - header_height) * multiplier, + Height = (Content.DrawHeight - effectiveHeaderHeight) * multiplier, Colour = default_colour }); } @@ -120,11 +165,50 @@ namespace osu.Game.Tests.Visual.UserInterface InputManager.ScrollVerticalBy(direction); } - private class TestSection : Box + private class TestSection : TestBox { public bool Selected { - set => Colour = value ? selected_colour : default_colour; + set => BackgroundColour = value ? selected_colour : default_colour; + } + + public TestSection(string label) + : base(label) + { + BackgroundColour = default_colour; + } + } + + private class TestBox : Container + { + private readonly Box background; + private readonly OsuSpriteText text; + + public ColourInfo BackgroundColour + { + set + { + background.Colour = value; + text.Colour = OsuColour.ForegroundTextColourFor(value.AverageColour); + } + } + + public TestBox(string label) + { + Children = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both, + }, + text = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = label, + Font = OsuFont.Default.With(size: 36), + } + }; } } } From 05736fb84ce8404070d38180efa663a5a3d67dd6 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 24 Apr 2022 01:09:24 +0300 Subject: [PATCH 0457/2328] Add failing test case for navigation via PageUp/PageDown --- .../TestSceneSectionsContainer.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneSectionsContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneSectionsContainer.cs index fc2b5e5e09..1f3736bd9b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneSectionsContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneSectionsContainer.cs @@ -134,6 +134,35 @@ namespace osu.Game.Tests.Visual.UserInterface AddUntilStep("correct section selected", () => container.SelectedSection.Value == container.Children[sections_count - 1]); } + [Test] + public void TestNavigation() + { + AddRepeatStep("add sections", () => append(1f), 3); + AddUntilStep("wait for load", () => container.Children.Any()); + + AddStep("hover sections container", () => InputManager.MoveMouseTo(container)); + AddStep("press page down", () => InputManager.Key(Key.PageDown)); + AddUntilStep("scrolled one page down", () => + { + var scroll = container.ChildrenOfType().First(); + return Precision.AlmostEquals(scroll.Current, Content.DrawHeight - header_fixed_height, 1f); + }); + + AddStep("press page down", () => InputManager.Key(Key.PageDown)); + AddUntilStep("scrolled two pages down", () => + { + var scroll = container.ChildrenOfType().First(); + return Precision.AlmostEquals(scroll.Current, (Content.DrawHeight - header_fixed_height) * 2, 1f); + }); + + AddStep("press page up", () => InputManager.Key(Key.PageUp)); + AddUntilStep("scrolled one page up", () => + { + var scroll = container.ChildrenOfType().First(); + return Precision.AlmostEquals(scroll.Current, Content.DrawHeight - header_fixed_height, 1f); + }); + } + private static readonly ColourInfo selected_colour = ColourInfo.GradientVertical(new OsuColour().Orange2, new OsuColour().Orange3); private static readonly ColourInfo default_colour = ColourInfo.GradientVertical(Color4.White, Color4.DarkGray); From 3700c607d8fc9844d406496a8c6ff0d843aa9d06 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 23 Apr 2022 06:03:54 +0300 Subject: [PATCH 0458/2328] Fix sections scroll container not handling fixed header in scrolls --- osu.Game/Graphics/Containers/SectionsContainer.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 540ca85809..9fa8b352cf 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -149,13 +149,11 @@ namespace osu.Game.Graphics.Containers { lastKnownScroll = null; - float fixedHeaderSize = FixedHeader?.BoundingBox.Height ?? 0; - // implementation similar to ScrollIntoView but a bit more nuanced. float top = scrollContainer.GetChildPosInContent(target); - float bottomScrollExtent = scrollContainer.ScrollableExtent - fixedHeaderSize; - float scrollTarget = top - fixedHeaderSize - scrollContainer.DisplayableContent * scroll_y_centre; + float bottomScrollExtent = scrollContainer.ScrollableExtent; + float scrollTarget = top - scrollContainer.DisplayableContent * scroll_y_centre; if (scrollTarget > bottomScrollExtent) scrollContainer.ScrollToEnd(); @@ -270,9 +268,13 @@ namespace osu.Game.Graphics.Containers { if (!Children.Any()) return; - var newMargin = originalSectionsMargin; + // if a fixed header is present, apply top padding for it + // to make the scroll container aware of its displayable area. + // (i.e. for page up/down to work properly) + scrollContainer.Padding = new MarginPadding { Top = FixedHeader?.LayoutSize.Y ?? 0 }; - newMargin.Top += (headerHeight ?? 0); + var newMargin = originalSectionsMargin; + newMargin.Top += (ExpandableHeader?.LayoutSize.Y ?? 0); newMargin.Bottom += (footerHeight ?? 0); scrollContentContainer.Margin = newMargin; From 70a93c0e7eb66c3316e5c4d0a38a96dc7ebc0db7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 24 Apr 2022 07:08:53 +0300 Subject: [PATCH 0459/2328] Move `DistanceSpacingMultiplier` bindable to its own `IDistanceSnapProvider` interface --- .../Editor/TestSceneManiaBeatSnapGrid.cs | 3 --- .../Editor/TestSceneOsuDistanceSnapGrid.cs | 4 ++-- .../Visual/Editing/TestSceneDistanceSnapGrid.cs | 4 ++-- osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs | 17 +++++++++++++++++ osu.Game/Rulesets/Edit/IPositionSnapProvider.cs | 10 ++-------- .../Edit/Compose/Components/DistanceSnapGrid.cs | 2 +- 6 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs index f32a1a823e..50be13c4e0 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Framework.Timing; @@ -99,8 +98,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor set => InternalChild = value; } - public override IBindable DistanceSpacingMultiplier => throw new System.NotImplementedException(); - public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) { throw new System.NotImplementedException(); diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs index 38a442d48b..2ba30c5f74 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor [Cached] private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor(); - [Cached(typeof(IPositionSnapProvider))] + [Cached(typeof(IDistanceSnapProvider))] private readonly SnapProvider snapProvider = new SnapProvider(); private TestOsuDistanceSnapGrid grid; @@ -180,7 +180,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor } } - private class SnapProvider : IPositionSnapProvider + private class SnapProvider : IDistanceSnapProvider { public SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, null); diff --git a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs index 69fd642143..b9cfa84a5d 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs @@ -26,7 +26,7 @@ namespace osu.Game.Tests.Visual.Editing [Cached(typeof(EditorBeatmap))] private readonly EditorBeatmap editorBeatmap; - [Cached(typeof(IPositionSnapProvider))] + [Cached(typeof(IDistanceSnapProvider))] private readonly SnapProvider snapProvider = new SnapProvider(); public TestSceneDistanceSnapGrid() @@ -160,7 +160,7 @@ namespace osu.Game.Tests.Visual.Editing => (Vector2.Zero, 0); } - private class SnapProvider : IPositionSnapProvider + private class SnapProvider : IDistanceSnapProvider { public SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, null); diff --git a/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs new file mode 100644 index 0000000000..70921a6170 --- /dev/null +++ b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs @@ -0,0 +1,17 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Bindables; +using osu.Game.Beatmaps; + +namespace osu.Game.Rulesets.Edit +{ + public interface IDistanceSnapProvider : IPositionSnapProvider + { + /// + /// The spacing multiplier applied to beat snap distances. + /// + /// + IBindable DistanceSpacingMultiplier { get; } + } +} diff --git a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs index e4adbba47d..944619a3ca 100644 --- a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Bindables; -using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using osuTK; @@ -10,12 +8,6 @@ namespace osu.Game.Rulesets.Edit { public interface IPositionSnapProvider { - /// - /// The spacing multiplier applied to beat snap distances. - /// - /// - IBindable DistanceSpacingMultiplier { get; } - /// /// Given a position, find a valid time and position snap. /// @@ -38,6 +30,8 @@ namespace osu.Game.Rulesets.Edit /// /// An object to be used as a reference point for this operation. /// The distance between two points residing in the timing point that are one beat length apart. + // todo: this, and other distance-related methods below it, should move to IDistanceSnapProvider. + // needs thought on how to properly share implementation, since not all composers inherit IDistanceSnapProvider. float GetBeatSnapDistanceAt(HitObject referenceObject); /// diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index f9e4ef086c..9dd6cec8ce 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -45,7 +45,7 @@ namespace osu.Game.Screens.Edit.Compose.Components protected OsuColour Colours { get; private set; } [Resolved] - protected IPositionSnapProvider SnapProvider { get; private set; } + protected IDistanceSnapProvider SnapProvider { get; private set; } [Resolved] private EditorBeatmap beatmap { get; set; } From 8ed39009fd5301396d5d98be2a98c9dd6e3a3d87 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 24 Apr 2022 07:10:30 +0300 Subject: [PATCH 0460/2328] Encapsulate distance spacing control handling to a "distance toolbox composite" Encapsulated in a way which can allow further extensibility for the right-side area of toolboxes. --- .../Edit/CatchHitObjectComposer.cs | 5 +- .../Edit/ManiaHitObjectComposer.cs | 2 - .../Editor/TestSceneObjectObjectSnap.cs | 4 +- .../Editor/TestSceneSliderSnapping.cs | 3 +- .../Edit/OsuHitObjectComposer.cs | 12 +- .../Edit/OsuToolboxComposite.cs | 119 ++++++++++++++++++ .../Edit/TaikoHitObjectComposer.cs | 2 - .../Overlays/Settings/Sections/SizeSlider.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 99 +-------------- 9 files changed, 137 insertions(+), 111 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs index 19595de3b1..b3e6fe382a 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs @@ -24,6 +24,9 @@ using osuTK; namespace osu.Game.Rulesets.Catch.Edit { + /// + /// todo: should inherit once it supports distance spacing properly. + /// public class CatchHitObjectComposer : HitObjectComposer { private const float distance_snap_radius = 50; @@ -32,8 +35,6 @@ namespace osu.Game.Rulesets.Catch.Edit private readonly Bindable distanceSnapToggle = new Bindable(); - protected override bool SupportsDistanceSpacing => false; - private InputManager inputManager; public CatchHitObjectComposer(CatchRuleset ruleset) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 5752f9f014..2baec95c94 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -26,8 +26,6 @@ namespace osu.Game.Rulesets.Mania.Edit private ManiaBeatSnapGrid beatSnapGrid; private InputManager inputManager; - protected override bool SupportsDistanceSpacing => false; - public ManiaHitObjectComposer(Ruleset ruleset) : base(ruleset) { diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs index aa0e35102e..954bb53dd5 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs @@ -7,7 +7,7 @@ using osu.Framework.Bindables; using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Beatmaps; -using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.UI; using osu.Game.Tests.Beatmaps; @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor AddStep("seek to first control point", () => EditorClock.Seek(Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints.First().Time)); AddStep("set distance spacing to 1", () => { - var distanceSpacing = (BindableDouble)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; + var distanceSpacing = (BindableDouble)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; distanceSpacing.Value = 1; }); } diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs index 13ce340362..2632e556c6 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs @@ -11,7 +11,6 @@ using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Input.Bindings; -using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components; @@ -69,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor }); AddStep("set distance spacing to 1", () => { - var distanceSpacing = (BindableDouble)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; + var distanceSpacing = (BindableDouble)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; distanceSpacing.Value = 1; }); } diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index e7eabdc748..a52c916ca0 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -24,9 +24,12 @@ using osuTK; namespace osu.Game.Rulesets.Osu.Edit { - public class OsuHitObjectComposer : HitObjectComposer + [Cached(typeof(IDistanceSnapProvider))] + public class OsuHitObjectComposer : HitObjectComposer, IDistanceSnapProvider { - protected override bool SupportsDistanceSpacing => true; + private OsuToolboxComposite osuToolboxComposite; + + public IBindable DistanceSpacingMultiplier => osuToolboxComposite.DistanceSpacing; public OsuHitObjectComposer(Ruleset ruleset) : base(ruleset) @@ -76,6 +79,8 @@ namespace osu.Game.Rulesets.Osu.Edit } }); + AddInternal(osuToolboxComposite = new OsuToolboxComposite()); + selectedHitObjects = EditorBeatmap.SelectedHitObjects.GetBoundCopy(); selectedHitObjects.CollectionChanged += (_, __) => updateDistanceSnapGrid(); @@ -130,6 +135,9 @@ namespace osu.Game.Rulesets.Osu.Edit } } + public override float GetBeatSnapDistanceAt(HitObject referenceObject) + => (float)(base.GetBeatSnapDistanceAt(referenceObject) * DistanceSpacingMultiplier.Value); + public override SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) { if (snapToVisibleBlueprints(screenSpacePosition, out var snapResult)) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs b/osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs new file mode 100644 index 0000000000..b0298e4034 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs @@ -0,0 +1,119 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Input.Events; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Settings.Sections; +using osu.Game.Rulesets.Edit; +using osu.Game.Screens.Edit; +using osuTK; +using osuTK.Input; + +namespace osu.Game.Rulesets.Osu.Edit +{ + /// + /// A toolbox composite for osu!-specific controls. + /// + // todo: once catch supports distance spacing, the control here should move out to a base "DistancingRulesetToolboxComposite" class or something better. + public class OsuToolboxComposite : CompositeDrawable + { + private ExpandingToolboxContainer expandingContainer; + private ExpandableSlider> distanceSpacingSlider; + + private readonly Bindable distanceSpacing = new BindableDouble(1.0) + { + MinValue = 0.1, + MaxValue = 6.0, + Precision = 0.01, + }; + + public IBindable DistanceSpacing => distanceSpacing; + + private bool distanceSpacingScrollActive; + + [Resolved] + private EditorBeatmap editorBeatmap { get; set; } + + [BackgroundDependencyLoader] + private void load() + { + RelativeSizeAxes = Axes.Both; + + InternalChild = expandingContainer = new ExpandingToolboxContainer + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Child = new EditorToolboxGroup("snapping") + { + Child = distanceSpacingSlider = new ExpandableSlider> + { + Current = { BindTarget = distanceSpacing }, + KeyboardStep = 0.1f, + } + } + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + distanceSpacing.Value = editorBeatmap.BeatmapInfo.DistanceSpacing; + distanceSpacing.BindValueChanged(v => + { + distanceSpacingSlider.ContractedLabelText = $"D. S. ({v.NewValue:0.##x})"; + distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({v.NewValue:0.##x})"; + editorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue; + }, true); + } + + protected override bool OnKeyDown(KeyDownEvent e) + { + if (e.AltPressed && e.Key == Key.D && !e.Repeat) + { + expandingContainer.Expanded.Value = true; + distanceSpacingScrollActive = true; + return true; + } + + return base.OnKeyDown(e); + } + + protected override void OnKeyUp(KeyUpEvent e) + { + if (distanceSpacingScrollActive && (!e.AltPressed || e.Key == Key.D)) + { + expandingContainer.Expanded.Value = false; + distanceSpacingScrollActive = false; + } + } + + protected override bool OnScroll(ScrollEvent e) + { + if (distanceSpacingScrollActive) + { + distanceSpacing.Value += e.ScrollDelta.Y * (e.IsPrecise ? 0.01f : 0.1f); + return true; + } + + return base.OnScroll(e); + } + + private class ExpandingToolboxContainer : ExpandingContainer + { + public ExpandingToolboxContainer() + : base(130, 250) + { + RelativeSizeAxes = Axes.Y; + Padding = new MarginPadding { Left = 10 }; + + FillFlow.Spacing = new Vector2(10); + } + } + } +} diff --git a/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs b/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs index af9bc6c3a3..161799c980 100644 --- a/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs +++ b/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs @@ -11,8 +11,6 @@ namespace osu.Game.Rulesets.Taiko.Edit { public class TaikoHitObjectComposer : HitObjectComposer { - protected override bool SupportsDistanceSpacing => false; - public TaikoHitObjectComposer(TaikoRuleset ruleset) : base(ruleset) { diff --git a/osu.Game/Overlays/Settings/Sections/SizeSlider.cs b/osu.Game/Overlays/Settings/Sections/SizeSlider.cs index 26db1aa755..c8a46162af 100644 --- a/osu.Game/Overlays/Settings/Sections/SizeSlider.cs +++ b/osu.Game/Overlays/Settings/Sections/SizeSlider.cs @@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Settings.Sections /// /// A slider intended to show a "size" multiplier number, where 1x is 1.0. /// - internal class SizeSlider : OsuSliderBar + public class SizeSlider : OsuSliderBar where T : struct, IEquatable, IComparable, IConvertible, IFormattable { public override LocalisableString TooltipText => Current.Value.ToString(@"0.##x", NumberFormatInfo.CurrentInfo); diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index ab82fbad04..8d2bd1e5d1 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -14,8 +14,6 @@ using osu.Framework.Input.Events; using osu.Framework.Logging; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.UserInterface; -using osu.Game.Overlays.Settings.Sections; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Mods; @@ -58,26 +56,6 @@ namespace osu.Game.Rulesets.Edit [Resolved] protected IBeatSnapProvider BeatSnapProvider { get; private set; } - /// - /// Whether this composer supports a "distance spacing" multiplier for distance snap grids. - /// - /// - /// Setting this to displays a "distance spacing" slider and allows this composer to configure the value of . - /// - protected abstract bool SupportsDistanceSpacing { get; } - - private readonly BindableDouble distanceSpacing = new BindableDouble - { - Default = 1.0, - MinValue = 0.1, - MaxValue = 6.0, - Precision = 0.01, - }; - - public override IBindable DistanceSpacingMultiplier => distanceSpacing; - - private SnappingToolboxContainer snappingToolboxContainer; - protected ComposeBlueprintContainer BlueprintContainer { get; private set; } private DrawableEditorRulesetWrapper drawableRulesetWrapper; @@ -161,36 +139,6 @@ namespace osu.Game.Rulesets.Edit }, }; - distanceSpacing.Value = EditorBeatmap.BeatmapInfo.DistanceSpacing; - - if (SupportsDistanceSpacing) - { - ExpandableSlider> distanceSpacingSlider; - - AddInternal(snappingToolboxContainer = new SnappingToolboxContainer - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Child = new EditorToolboxGroup("snapping") - { - Child = distanceSpacingSlider = new ExpandableSlider> - { - Current = { BindTarget = distanceSpacing }, - KeyboardStep = 0.01f, - } - } - }); - - distanceSpacing.BindValueChanged(v => - { - distanceSpacingSlider.ContractedLabelText = $"D. S. ({v.NewValue:0.##x})"; - distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({v.NewValue:0.##x})"; - EditorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue; - }, true); - } - else - distanceSpacing.Disabled = true; - toolboxCollection.Items = CompositionTools .Prepend(new SelectTool()) .Select(t => new RadioButton(t.Name, () => toolSelected(t), t.CreateIcon)) @@ -265,17 +213,8 @@ namespace osu.Game.Rulesets.Edit #region Tool selection logic - private bool distanceSpacingScrollActive; - protected override bool OnKeyDown(KeyDownEvent e) { - if (SupportsDistanceSpacing && e.AltPressed && e.Key == Key.D && !e.Repeat) - { - snappingToolboxContainer.Expanded.Value = true; - distanceSpacingScrollActive = true; - return true; - } - if (e.ControlPressed || e.AltPressed || e.SuperPressed) return false; @@ -305,28 +244,6 @@ namespace osu.Game.Rulesets.Edit return base.OnKeyDown(e); } - protected override void OnKeyUp(KeyUpEvent e) - { - if (distanceSpacingScrollActive && (e.Key == Key.AltLeft || e.Key == Key.AltRight || e.Key == Key.D)) - { - snappingToolboxContainer.Expanded.Value = false; - distanceSpacingScrollActive = false; - } - - base.OnKeyUp(e); - } - - protected override bool OnScroll(ScrollEvent e) - { - if (distanceSpacingScrollActive) - { - distanceSpacing.Value += e.ScrollDelta.Y * (e.IsPrecise ? 0.01f : 0.1f); - return true; - } - - return base.OnScroll(e); - } - private bool checkLeftToggleFromKey(Key key, out int index) { if (key < Key.Number1 || key > Key.Number9) @@ -468,7 +385,7 @@ namespace osu.Game.Rulesets.Edit public override float GetBeatSnapDistanceAt(HitObject referenceObject) { - return (float)(100 * referenceObject.DifficultyControlPoint.SliderVelocity * EditorBeatmap.Difficulty.SliderMultiplier * distanceSpacing.Value / BeatSnapProvider.BeatDivisor); + return (float)(100 * referenceObject.DifficultyControlPoint.SliderVelocity * EditorBeatmap.Difficulty.SliderMultiplier / BeatSnapProvider.BeatDivisor); } public override float DurationToDistance(HitObject referenceObject, double duration) @@ -517,18 +434,6 @@ namespace osu.Game.Rulesets.Edit FillFlow.Spacing = new Vector2(10); } } - - private class SnappingToolboxContainer : ExpandingContainer - { - public SnappingToolboxContainer() - : base(130, 250) - { - RelativeSizeAxes = Axes.Y; - Padding = new MarginPadding { Left = 10 }; - - FillFlow.Spacing = new Vector2(10); - } - } } /// @@ -563,8 +468,6 @@ namespace osu.Game.Rulesets.Edit #region IPositionSnapProvider - public abstract IBindable DistanceSpacingMultiplier { get; } - public abstract SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition); public virtual SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) => From 0738cd028f5824cf6f9a0511ee9321d8e6876000 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 24 Apr 2022 08:53:10 +0300 Subject: [PATCH 0461/2328] Give snapping toolbox enough hover delay for interaction with expand button With 0 delay, if the `SettingsToolboxGroup` has been contracted via button, there's no chance to be able to expand it via button again. This is temporary at best just to keep things working somewhat, not sure if the expansion logic will still be required in editor redesign, so deciding to roll with it for now. --- osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs b/osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs index b0298e4034..542f98207e 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs @@ -106,6 +106,8 @@ namespace osu.Game.Rulesets.Osu.Edit private class ExpandingToolboxContainer : ExpandingContainer { + protected override double HoverExpansionDelay => 250; + public ExpandingToolboxContainer() : base(130, 250) { From 2200067c52759a32eb1adfa12fd79347b7f51200 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Apr 2022 16:31:20 +0900 Subject: [PATCH 0462/2328] Display deadzone as percentage and simplify surrounding code --- .../Sections/Input/JoystickSettings.cs | 34 +++++++------------ 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs index ad01c25ac9..c136ca6a19 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs @@ -6,18 +6,20 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Handlers.Joystick; using osu.Framework.Localisation; -using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Input { public class JoystickSettings : SettingsSubsection { - private readonly JoystickHandler joystickHandler; protected override LocalisableString Header => JoystickSettingsStrings.JoystickGamepad; - private readonly BindableNumber deadzoneThreshold = new BindableNumber(); + + private readonly JoystickHandler joystickHandler; + private readonly Bindable enabled = new BindableBool(true); + private SettingsSlider deadzoneSlider; + public JoystickSettings(JoystickHandler joystickHandler) { this.joystickHandler = joystickHandler; @@ -33,10 +35,12 @@ namespace osu.Game.Overlays.Settings.Sections.Input LabelText = CommonStrings.Enabled, Current = enabled }, - new DeadzoneSetting + deadzoneSlider = new SettingsSlider { LabelText = JoystickSettingsStrings.DeadzoneThreshold, - Current = deadzoneThreshold + KeyboardStep = 0.01f, + DisplayAsPercentage = true, + Current = joystickHandler.DeadzoneThreshold, }, }; } @@ -44,23 +48,9 @@ namespace osu.Game.Overlays.Settings.Sections.Input protected override void LoadComplete() { base.LoadComplete(); + enabled.BindTo(joystickHandler.Enabled); - deadzoneThreshold.BindTo(joystickHandler.DeadzoneThreshold); - enabled.BindValueChanged(e => deadzoneThreshold.Disabled = !e.NewValue, true); - } - - private class DeadzoneSetting : SettingsSlider - { - public DeadzoneSetting() - { - KeyboardStep = 0.01f; - TransferValueOnCommit = true; - } - } - - private class DeadzoneSlider : OsuSliderBar - { - public override LocalisableString TooltipText => Current.Disabled ? "" : base.TooltipText; + enabled.BindValueChanged(e => deadzoneSlider.Current.Disabled = !e.NewValue, true); } } -} \ No newline at end of file +} From 1b2467d3ed7df7e2c2171947e606b296ce48983c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Apr 2022 16:35:41 +0900 Subject: [PATCH 0463/2328] Disable first run screen from appearing on startup until it is more complete --- .../Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs | 1 + osu.Game/Overlays/FirstRunSetupOverlay.cs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index e925859d71..31c4d66784 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -66,6 +66,7 @@ namespace osu.Game.Tests.Visual.UserInterface } [Test] + [Ignore("Enable when first run setup is being displayed on first run.")] public void TestDoesntOpenOnSecondRun() { AddStep("set first run", () => LocalConfig.SetValue(OsuSetting.ShowFirstRunSetup, true)); diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index c4e3626996..dc1ae2be37 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -157,7 +157,8 @@ namespace osu.Game.Overlays config.BindWith(OsuSetting.ShowFirstRunSetup, showFirstRunSetup); - if (showFirstRunSetup.Value) Show(); + // TODO: uncomment when happy with the whole flow. + // if (showFirstRunSetup.Value) Show(); } public override bool OnPressed(KeyBindingPressEvent e) @@ -289,7 +290,8 @@ namespace osu.Game.Overlays } else { - showFirstRunSetup.Value = false; + // TODO: uncomment when happy with the whole flow. + // showFirstRunSetup.Value = false; currentStepIndex = null; Hide(); } From 999b4505d139ae7779958690de8d130b180a09fa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Apr 2022 16:37:11 +0900 Subject: [PATCH 0464/2328] Remove localisation of "hide" string to fix incorrect case --- osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index c6037d1bd6..9772b1feb3 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -244,7 +244,7 @@ namespace osu.Game.Screens.Select.Carousel } if (hideRequested != null) - items.Add(new OsuMenuItem(CommonStrings.ButtonsHide, MenuItemType.Destructive, () => hideRequested(beatmapInfo))); + items.Add(new OsuMenuItem("Hide", MenuItemType.Destructive, () => hideRequested(beatmapInfo))); return items.ToArray(); } From 66b47d22d78bc45d2e890e0aaa7ac565b1fb2e82 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Apr 2022 17:11:25 +0900 Subject: [PATCH 0465/2328] Also fix case of login form username/password --- osu.Game/Overlays/Login/LoginForm.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Login/LoginForm.cs b/osu.Game/Overlays/Login/LoginForm.cs index c31416e078..502f0cd22e 100644 --- a/osu.Game/Overlays/Login/LoginForm.cs +++ b/osu.Game/Overlays/Login/LoginForm.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; @@ -51,14 +52,14 @@ namespace osu.Game.Overlays.Login { username = new OsuTextBox { - PlaceholderText = UsersStrings.LoginUsername, + PlaceholderText = UsersStrings.LoginUsername.ToLower(), RelativeSizeAxes = Axes.X, Text = api?.ProvidedUsername ?? string.Empty, TabbableContentContainer = this }, password = new OsuPasswordTextBox { - PlaceholderText = UsersStrings.LoginPassword, + PlaceholderText = UsersStrings.LoginPassword.ToLower(), RelativeSizeAxes = Axes.X, TabbableContentContainer = this, }, From d92c9056005839fc6410c5de133fb7ee8a9c3533 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Apr 2022 18:15:35 +0900 Subject: [PATCH 0466/2328] Actually use exposed property --- osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs index d9a612ea26..ef48d9ced5 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs @@ -62,7 +62,7 @@ namespace osu.Game.Overlays.FirstRunSetup new Drawable[] { new SampleScreenContainer(new PinnedMainMenu()), - new SampleScreenContainer(new PlaySongSelect()), + new SampleScreenContainer(new NestedSongSelect()), }, // TODO: add more screens here in the future (gameplay / results) // requires a bit more consideration to isolate their behaviour from the "parent" game. @@ -95,6 +95,11 @@ namespace osu.Game.Overlays.FirstRunSetup } } + private class NestedSongSelect : PlaySongSelect + { + protected override bool ControlGlobalMusic => false; + } + private class PinnedMainMenu : MainMenu { public override void OnEntering(ScreenTransitionEvent e) From 51aa17eb524e70899f09c1058842e0d55f58109b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Apr 2022 22:17:01 +0900 Subject: [PATCH 0467/2328] Fix context menus not working --- osu.Game/Graphics/UserInterface/OsuDropdown.cs | 18 +++++++++++++++++- osu.Game/Graphics/UserInterface/OsuMenu.cs | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index b1d4691938..20fa7d5148 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -130,7 +131,22 @@ namespace osu.Game.Graphics.UserInterface BackgroundColourSelected = SelectionColour }; - protected override ScrollContainer CreateScrollContainer(Direction direction) => new OsuScrollContainer(direction); + protected override ScrollContainer CreateScrollContainer(Direction direction) => new DropdownScrollContainer(direction); + + // Hotfix for https://github.com/ppy/osu/issues/17961 + public class DropdownScrollContainer : OsuScrollContainer + { + public DropdownScrollContainer(Direction direction) + : base(direction) + { + } + + protected override bool OnMouseDown(MouseDownEvent e) + { + base.OnMouseDown(e); + return true; + } + } #region DrawableOsuDropdownMenuItem diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index a16adcbd57..bfdfd32fb3 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -9,6 +9,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osuTK; @@ -81,7 +82,22 @@ namespace osu.Game.Graphics.UserInterface return new DrawableOsuMenuItem(item); } - protected override ScrollContainer CreateScrollContainer(Direction direction) => new OsuScrollContainer(direction); + protected override ScrollContainer CreateScrollContainer(Direction direction) => new OsuMenuScrollContainer(direction); + + // Hotfix for https://github.com/ppy/osu/issues/17961 + public class OsuMenuScrollContainer : OsuScrollContainer + { + public OsuMenuScrollContainer(Direction direction) + : base(direction) + { + } + + protected override bool OnMouseDown(MouseDownEvent e) + { + base.OnMouseDown(e); + return true; + } + } protected override Menu CreateSubMenu() => new OsuMenu(Direction.Vertical) { From 7e9d51f33f31a21f883826a755cf3f39c67b307b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Apr 2022 18:37:35 +0900 Subject: [PATCH 0468/2328] Fix windows taskbar context menu not popping up correctly Closes https://github.com/ppy/osu/issues/17965. Note that this will cause a second osu! icon to appear after running the application (after any update). As per the inline comment, this will eventually be resolved via https://github.com/clowd/Clowd.Squirrel/issues/24. I do think having context menus working is more important than duplicate icons. Note that for anyone who already has a pinned taskbar icon, it will need to be manually unpinned and repinned after a future update to actually fix this issue. Thanks to @caesay for help with investigation. --- osu.Desktop/Program.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index e317a44bc3..eb9045d9ce 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -123,7 +123,12 @@ namespace osu.Desktop tools.RemoveUninstallerRegistryEntry(); }, onEveryRun: (version, tools, firstRun) => { - tools.SetProcessAppUserModelId(); + // While setting the `ProcessAppUserModelId` fixes duplicate icons/shortcuts on the taskbar, it currently + // causes the right-click context menu to function incorrectly. + // + // This may turn out to be non-required after an alternative solution is implemented. + // see https://github.com/clowd/Clowd.Squirrel/issues/24 + // tools.SetProcessAppUserModelId(); }); } From 7ac3ba132ce70a2ba150c6567decde647cb62f3c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Apr 2022 18:55:12 +0900 Subject: [PATCH 0469/2328] Remove unused using statements --- .../Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs | 1 - osu.Game/Tests/Visual/OsuGameTestScene.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs index 448d6b1e68..d3aeba2c0f 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Linq; using NUnit.Framework; using osu.Framework.Extensions; diff --git a/osu.Game/Tests/Visual/OsuGameTestScene.cs b/osu.Game/Tests/Visual/OsuGameTestScene.cs index 1b8f8bfd07..6e4adb4d4c 100644 --- a/osu.Game/Tests/Visual/OsuGameTestScene.cs +++ b/osu.Game/Tests/Visual/OsuGameTestScene.cs @@ -25,7 +25,6 @@ using osu.Game.Screens; using osu.Game.Screens.Menu; using osu.Game.Screens.Play; using osuTK.Graphics; -using osuTK.Input; using IntroSequence = osu.Game.Configuration.IntroSequence; namespace osu.Game.Tests.Visual From d2780c2c50557b1bdbfc1bec444ae9814dd08e80 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Apr 2022 19:06:47 +0900 Subject: [PATCH 0470/2328] Add a touch more detail to the unsupported skin component exception --- osu.Game/Skinning/UnsupportedSkinComponentException.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Skinning/UnsupportedSkinComponentException.cs b/osu.Game/Skinning/UnsupportedSkinComponentException.cs index 643f29c3db..7f0dd51d5b 100644 --- a/osu.Game/Skinning/UnsupportedSkinComponentException.cs +++ b/osu.Game/Skinning/UnsupportedSkinComponentException.cs @@ -8,7 +8,7 @@ namespace osu.Game.Skinning public class UnsupportedSkinComponentException : Exception { public UnsupportedSkinComponentException(ISkinComponent component) - : base($@"Unsupported component type: {component.GetType()}(""{component.LookupName}"").") + : base($@"Unsupported component type: {component.GetType()} (lookup: ""{component.LookupName}"").") { } } From 5e48b37569a549cd8388985a6efc7b4eca5be72f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Apr 2022 23:58:12 +0900 Subject: [PATCH 0471/2328] Show "Get Started" text on first run button --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index dc1ae2be37..87e62cbddf 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -304,12 +304,15 @@ namespace osu.Game.Overlays BackButton.Enabled.Value = currentStepIndex > 0; NextButton.Enabled.Value = currentStepIndex != null; - if (currentStepIndex != null) - { - NextButton.Text = currentStepIndex + 1 < steps.Length - ? FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].Description) - : CommonStrings.Finish; - } + if (currentStepIndex == null) + return; + + if (currentStepIndex == 0) + NextButton.Text = FirstRunSetupOverlayStrings.GetStarted; + else if (currentStepIndex < steps.Length - 1) + NextButton.Text = FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].Description); + else + NextButton.Text = CommonStrings.Finish; } private class FirstRunStep From ebc8429495c1cde762d2273ed2a7c2fb37476f01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 24 Apr 2022 19:13:19 +0200 Subject: [PATCH 0472/2328] Dim offscreen columns & scroll to them if clicked --- osu.Game/Overlays/Mods/ModColumn.cs | 3 + osu.Game/Overlays/Mods/ModSelectScreen.cs | 138 ++++++++++++++++++---- 2 files changed, 115 insertions(+), 26 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 1157c0c0c6..fed2f9aff6 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -53,6 +53,9 @@ namespace osu.Game.Overlays.Mods } public Bindable> SelectedMods = new Bindable>(Array.Empty()); + public Bindable Active = new BindableBool(true); + + protected override bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) => base.ReceivePositionalInputAtSubTree(screenSpacePos) && Active.Value; protected virtual ModPanel CreateModPanel(Mod mod) => new ModPanel(mod); diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 8a83071109..ca3609aa75 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -13,7 +13,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; using osu.Framework.Layout; +using osu.Framework.Utils; using osu.Game.Configuration; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Mods; @@ -59,7 +61,8 @@ namespace osu.Game.Overlays.Mods private DifficultyMultiplierDisplay? multiplierDisplay; private ModSettingsArea modSettingsArea = null!; - private FillFlowContainer columnFlow = null!; + private OsuScrollContainer columnScroll = null!; + private ColumnFlowContainer columnFlow = null!; [BackgroundDependencyLoader] private void load() @@ -83,6 +86,9 @@ namespace osu.Game.Overlays.Mods } }); + // initialise the scroll early, as we will want to pass it to its children in the hierarchy initialisation below. + columnScroll = new OsuScrollContainer(Direction.Horizontal); + MainAreaContent.AddRange(new Drawable[] { new Container @@ -95,13 +101,13 @@ namespace osu.Game.Overlays.Mods RelativePositionAxes = Axes.Both, Children = new Drawable[] { - new OsuScrollContainer(Direction.Horizontal) + columnScroll.With(col => { - RelativeSizeAxes = Axes.Both, - Masking = false, - ClampExtension = 100, - ScrollbarOverlapsContent = false, - Child = columnFlow = new ModColumnContainer + col.RelativeSizeAxes = Axes.Both; + col.Masking = false; + col.ClampExtension = 100; + col.ScrollbarOverlapsContent = false; + col.Child = columnFlow = new ColumnFlowContainer { Direction = FillDirection.Horizontal, Shear = new Vector2(SHEAR, 0), @@ -111,14 +117,14 @@ namespace osu.Game.Overlays.Mods Margin = new MarginPadding { Right = 70 }, Children = new[] { - CreateModColumn(ModType.DifficultyReduction, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }), - CreateModColumn(ModType.DifficultyIncrease, new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }), - CreateModColumn(ModType.Automation, new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }), - CreateModColumn(ModType.Conversion), - CreateModColumn(ModType.Fun) + createModColumnContent(columnScroll, ModType.DifficultyReduction, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }), + createModColumnContent(columnScroll, ModType.DifficultyIncrease, new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }), + createModColumnContent(columnScroll, ModType.Automation, new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }), + createModColumnContent(columnScroll, ModType.Conversion), + createModColumnContent(columnScroll, ModType.Fun) } - } - } + }; + }) } } }); @@ -153,6 +159,13 @@ namespace osu.Game.Overlays.Mods } } + private ColumnDimContainer createModColumnContent(OsuScrollContainer scroll, ModType modType, Key[]? toggleKeys = null) + => new ColumnDimContainer(scroll, CreateModColumn(modType, toggleKeys)) + { + AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Y + }; + protected override void LoadComplete() { base.LoadComplete(); @@ -166,7 +179,7 @@ namespace osu.Game.Overlays.Mods updateSelectionFromBindable(); }, true); - foreach (var column in columnFlow) + foreach (var column in columnFlow.Columns) { column.SelectedMods.BindValueChanged(updateBindableFromSelection); } @@ -191,7 +204,7 @@ namespace osu.Game.Overlays.Mods private void updateAvailableMods() { - foreach (var column in columnFlow) + foreach (var column in columnFlow.Columns) column.Filter = isValidMod; } @@ -244,7 +257,7 @@ namespace osu.Game.Overlays.Mods // to synchronise state correctly, updateBindableFromSelection() computes the final mods (including incompatibility rules) and updates SelectedMods, // and this method then runs unconditionally again to make sure the new visual selection accurately reflects the final set of selected mods. // selectionBindableSyncInProgress ensures that mutual infinite recursion does not happen after that unconditional call. - foreach (var column in columnFlow) + foreach (var column in columnFlow.Columns) column.SelectedMods.Value = SelectedMods.Value.Where(mod => mod.Type == column.ModType).ToArray(); } @@ -265,7 +278,7 @@ namespace osu.Game.Overlays.Mods } protected virtual IReadOnlyList ComputeNewModsFromSelection(IEnumerable addedMods, IEnumerable removedMods) - => columnFlow.SelectMany(column => column.SelectedMods.Value).ToArray(); + => columnFlow.Columns.SelectMany(column => column.SelectedMods.Value).ToArray(); protected override void PopIn() { @@ -280,7 +293,8 @@ namespace osu.Game.Overlays.Mods for (int i = 0; i < columnFlow.Count; i++) { - columnFlow[i].TopLevelContent + columnFlow[i].Column + .TopLevelContent .Delay(i * 30) .MoveToY(0, fade_in_duration, Easing.OutQuint) .FadeIn(fade_in_duration, Easing.OutQuint); @@ -301,27 +315,30 @@ namespace osu.Game.Overlays.Mods { const float distance = 700; - columnFlow[i].TopLevelContent + columnFlow[i].Column + .TopLevelContent .MoveToY(i % 2 == 0 ? -distance : distance, fade_out_duration, Easing.OutQuint) .FadeOut(fade_out_duration, Easing.OutQuint); } } - private class ModColumnContainer : FillFlowContainer + private class ColumnFlowContainer : FillFlowContainer { + public IEnumerable Columns => Children.Select(dimWrapper => dimWrapper.Column); + private readonly LayoutValue drawSizeLayout = new LayoutValue(Invalidation.DrawSize); - public ModColumnContainer() + public ColumnFlowContainer() { AddLayout(drawSizeLayout); } - public override void Add(ModColumn column) + public override void Add(ColumnDimContainer dimContainer) { - base.Add(column); + base.Add(dimContainer); - Debug.Assert(column != null); - column.Shear = Vector2.Zero; + Debug.Assert(dimContainer != null); + dimContainer.Column.Shear = Vector2.Zero; } protected override void Update() @@ -341,6 +358,75 @@ namespace osu.Game.Overlays.Mods } } + private class ColumnDimContainer : Container + { + public ModColumn Column { get; } + + private readonly ScrollContainer parentScroll; + private readonly Bindable isFullyOnScreen = new BindableBool(true); + + [Resolved] + private OsuColour colours { get; set; } = null!; + + public ColumnDimContainer(ScrollContainer parentScroll, ModColumn column) + { + this.parentScroll = parentScroll; + Child = Column = column; + column.Active.BindTo(isFullyOnScreen); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + isFullyOnScreen.BindValueChanged(_ => updateDim(), true); + FinishTransforms(); + } + + private void updateDim() + { + Colour4 targetColour; + + if (isFullyOnScreen.Value) + targetColour = Colour4.White; + else + targetColour = IsHovered ? colours.GrayC : colours.Gray8; + + this.FadeColour(targetColour, 300, Easing.OutQuint); + } + + protected override void Update() + { + float leftX = DrawPosition.X; + // DrawWidth does not include shear effects, and we want to know the full extents of the columns post-shear, + // so we have to manually compensate. + float rightX = DrawPosition.X + DrawWidth + DrawHeight * SHEAR; + + isFullyOnScreen.Value = Precision.AlmostBigger(leftX, parentScroll.Current) + && Precision.DefinitelyBigger(parentScroll.Current + parentScroll.DrawWidth, rightX); + } + + protected override bool OnMouseDown(MouseDownEvent e) + { + if (!isFullyOnScreen.Value) + parentScroll.ScrollTo(DrawPosition.X - 70); + + return true; + } + + protected override bool OnHover(HoverEvent e) + { + base.OnHover(e); + updateDim(); + return isFullyOnScreen.Value; + } + + protected override void OnHoverLost(HoverLostEvent e) + { + base.OnHoverLost(e); + updateDim(); + } + } + private class ClickToReturnContainer : Container { public BindableBool HandleMouse { get; } = new BindableBool(); From 09c08248c4a54bd89582247c3dfee500186b2908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 24 Apr 2022 19:20:50 +0200 Subject: [PATCH 0473/2328] Fix bounce when scrolling to first/last column --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index ca3609aa75..f12f55a3a7 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -408,7 +408,7 @@ namespace osu.Game.Overlays.Mods protected override bool OnMouseDown(MouseDownEvent e) { if (!isFullyOnScreen.Value) - parentScroll.ScrollTo(DrawPosition.X - 70); + parentScroll.ScrollTo(Math.Clamp(DrawPosition.X - 70, 0, parentScroll.ScrollableExtent)); return true; } From e384e074fb9243521974d6af45051e8567aa6c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 24 Apr 2022 19:27:27 +0200 Subject: [PATCH 0474/2328] Fix asymmetric margin of column scroll --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index f12f55a3a7..324fc68885 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -114,7 +114,7 @@ namespace osu.Game.Overlays.Mods RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Spacing = new Vector2(10, 0), - Margin = new MarginPadding { Right = 70 }, + Margin = new MarginPadding { Horizontal = 70 }, Children = new[] { createModColumnContent(columnScroll, ModType.DifficultyReduction, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }), From e13d0d02ae7db2a6808c2d1834de6f19261a80d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 24 Apr 2022 19:27:51 +0200 Subject: [PATCH 0475/2328] Use better way of calculating whether columns are fully on screen --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 324fc68885..11cffe7959 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -396,13 +396,13 @@ namespace osu.Game.Overlays.Mods protected override void Update() { - float leftX = DrawPosition.X; - // DrawWidth does not include shear effects, and we want to know the full extents of the columns post-shear, + // DrawWidth/DrawPosition do not include shear effects, and we want to know the full extents of the columns post-shear, // so we have to manually compensate. - float rightX = DrawPosition.X + DrawWidth + DrawHeight * SHEAR; + var topLeft = ToSpaceOfOtherDrawable(new Vector2(-DrawHeight * SHEAR, 0), parentScroll); + var topRight = ToSpaceOfOtherDrawable(new Vector2(DrawWidth, 0), parentScroll); - isFullyOnScreen.Value = Precision.AlmostBigger(leftX, parentScroll.Current) - && Precision.DefinitelyBigger(parentScroll.Current + parentScroll.DrawWidth, rightX); + isFullyOnScreen.Value = Precision.AlmostBigger(topLeft.X, 0) + && Precision.DefinitelyBigger(parentScroll.DrawWidth, topRight.X); } protected override bool OnMouseDown(MouseDownEvent e) From 24a1eb8003c4bcddce3ea0e076d09c15a8bfe6fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 25 Apr 2022 23:41:40 +0200 Subject: [PATCH 0476/2328] Add test coverage for column dimming behaviour --- .../UserInterface/TestSceneModSelectScreen.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index 514538161e..d7ae131372 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -111,6 +111,35 @@ namespace osu.Game.Tests.Visual.UserInterface && SelectedMods.Value.Any(mod => mod.GetType() == typeof(OsuModMirror))); } + [Test] + public void TestDimmedState() + { + createScreen(); + changeRuleset(0); + + AddUntilStep("any column dimmed", () => this.ChildrenOfType().Any(column => !column.Active.Value)); + + ModColumn firstDimmed = null; + ModPanel firstPanel = null; + + AddStep("click first panel on dimmed column", () => + { + firstDimmed = this.ChildrenOfType().First(column => !column.Active.Value); + firstPanel = firstDimmed.ChildrenOfType().First(); + InputManager.MoveMouseTo(firstPanel); + InputManager.Click(MouseButton.Left); + }); + AddUntilStep("column undimmed", () => firstDimmed.Active.Value); + AddAssert("panel not selected", () => !firstPanel.Active.Value); + + AddStep("click panel again", () => + { + InputManager.MoveMouseTo(firstPanel); + InputManager.Click(MouseButton.Left); + }); + AddUntilStep("panel selected", () => firstPanel.Active.Value); + } + [Test] public void TestCustomisationToggleState() { From f958010d29ae5040c37b89e88f00fc29e1123d12 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 26 Apr 2022 04:52:48 +0300 Subject: [PATCH 0477/2328] Fix `AccuracyCircle` storing accuracy values in `float` --- .../Ranking/Expanded/Accuracy/AccuracyCircle.cs | 12 ++++++------ .../Screens/Ranking/Expanded/Accuracy/RankBadge.cs | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index e50520e0ca..b9248bd67e 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -212,12 +212,12 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy Padding = new MarginPadding { Vertical = -15, Horizontal = -20 }, Children = new[] { - new RankBadge(1f, getRank(ScoreRank.X)), - new RankBadge(0.95f, getRank(ScoreRank.S)), - new RankBadge(0.9f, getRank(ScoreRank.A)), - new RankBadge(0.8f, getRank(ScoreRank.B)), - new RankBadge(0.7f, getRank(ScoreRank.C)), - new RankBadge(0.35f, getRank(ScoreRank.D)), + new RankBadge(1, getRank(ScoreRank.X)), + new RankBadge(0.95, getRank(ScoreRank.S)), + new RankBadge(0.9, getRank(ScoreRank.A)), + new RankBadge(0.8, getRank(ScoreRank.B)), + new RankBadge(0.7, getRank(ScoreRank.C)), + new RankBadge(0.35, getRank(ScoreRank.D)), } }, rankText = new RankText(score.Rank) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/RankBadge.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/RankBadge.cs index 76cd408daa..d0b79aa4c7 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/RankBadge.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/RankBadge.cs @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy /// /// The accuracy value corresponding to the displayed by this badge. /// - public readonly float Accuracy; + public readonly double Accuracy; private readonly ScoreRank rank; @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy /// /// The accuracy value corresponding to . /// The to be displayed in this . - public RankBadge(float accuracy, ScoreRank rank) + public RankBadge(double accuracy, ScoreRank rank) { Accuracy = accuracy; this.rank = rank; @@ -90,7 +90,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy base.Update(); // Starts at -90deg (top) and moves counter-clockwise by the accuracy - rankContainer.Position = circlePosition(-MathF.PI / 2 - (1 - Accuracy) * MathF.PI * 2); + rankContainer.Position = circlePosition(-MathF.PI / 2 - (1 - (float)Accuracy) * MathF.PI * 2); } private Vector2 circlePosition(float t) From 7d3249019887d1ee8ce62f61c7e17d92e55908e0 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 26 Apr 2022 04:55:27 +0300 Subject: [PATCH 0478/2328] Change score accuracy grading logic to be inclusive --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 1e268bb2eb..1dd1d1aeb6 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -375,13 +375,13 @@ namespace osu.Game.Rulesets.Scoring { if (acc == 1) return ScoreRank.X; - if (acc > 0.95) + if (acc >= 0.95) return ScoreRank.S; - if (acc > 0.9) + if (acc >= 0.9) return ScoreRank.A; - if (acc > 0.8) + if (acc >= 0.8) return ScoreRank.B; - if (acc > 0.7) + if (acc >= 0.7) return ScoreRank.C; return ScoreRank.D; From d310886c26e7d971e41206cbed26d0483452b958 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 12:02:38 +0900 Subject: [PATCH 0479/2328] Add test coverage of `IsPlaying` state during fail and pause --- osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestScenePause.cs | 3 +++ 2 files changed, 5 insertions(+) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs index 79d7bb366d..bf491db45a 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs @@ -21,7 +21,9 @@ namespace osu.Game.Tests.Visual.Gameplay protected override void AddCheckSteps() { + AddUntilStep("player is playing", () => Player.LocalUserPlaying.Value); AddUntilStep("wait for fail", () => Player.GameplayState.HasFailed); + AddAssert("player is not playing", () => !Player.LocalUserPlaying.Value); AddUntilStep("wait for multiple judgements", () => ((FailPlayer)Player).ScoreProcessor.JudgedHits > 1); AddAssert("total number of results == 1", () => { diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs index a224a78531..ab5d766609 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs @@ -85,7 +85,10 @@ namespace osu.Game.Tests.Visual.Gameplay { AddStep("move cursor outside", () => InputManager.MoveMouseTo(Player.ScreenSpaceDrawQuad.TopLeft - new Vector2(10))); pauseAndConfirm(); + AddAssert("player not playing", () => !Player.LocalUserPlaying.Value); + resumeAndConfirm(); + AddUntilStep("player playing", () => Player.LocalUserPlaying.Value); } [Test] From 8ab3636f87b434878a4d2bb536ce9a0f1d7287d1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 11:19:19 +0900 Subject: [PATCH 0480/2328] Change conditions for HUD being shown to include pause/fail states As proposed in https://github.com/ppy/osu/discussions/17975. Feels pretty good to me, and probably how it should have been implemented from the start. --- osu.Game/Screens/Play/HUDOverlay.cs | 6 +++--- osu.Game/Screens/Play/Player.cs | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 676a08b434..abfed1acd0 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -66,7 +66,7 @@ namespace osu.Game.Screens.Play private readonly FillFlowContainer bottomRightElements; private readonly FillFlowContainer topRightElements; - internal readonly IBindable IsBreakTime = new Bindable(); + internal readonly IBindable IsPlaying = new Bindable(); private bool holdingForHUD; @@ -152,7 +152,7 @@ namespace osu.Game.Screens.Play ShowHud.BindValueChanged(visible => hideTargets.ForEach(d => d.FadeTo(visible.NewValue ? 1 : 0, FADE_DURATION, FADE_EASING))); - IsBreakTime.BindValueChanged(_ => updateVisibility()); + IsPlaying.BindValueChanged(_ => updateVisibility()); configVisibilityMode.BindValueChanged(_ => updateVisibility(), true); replayLoaded.BindValueChanged(replayLoadedValueChanged, true); @@ -218,7 +218,7 @@ namespace osu.Game.Screens.Play case HUDVisibilityMode.HideDuringGameplay: // always show during replay as we want the seek bar to be visible. - ShowHud.Value = replayLoaded.Value || IsBreakTime.Value; + ShowHud.Value = replayLoaded.Value || !IsPlaying.Value; break; case HUDVisibilityMode.Always: diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2d5a67758a..ae3eb1ed8b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -457,7 +457,7 @@ namespace osu.Game.Screens.Play private void updateGameplayState() { - bool inGameplay = !DrawableRuleset.HasReplayLoaded.Value && !DrawableRuleset.IsPaused.Value && !breakTracker.IsBreakTime.Value; + bool inGameplay = !DrawableRuleset.HasReplayLoaded.Value && !DrawableRuleset.IsPaused.Value && !breakTracker.IsBreakTime.Value && !GameplayState.HasFailed; OverlayActivationMode.Value = inGameplay ? OverlayActivation.Disabled : OverlayActivation.UserTriggered; localUserPlaying.Value = inGameplay; } @@ -812,6 +812,8 @@ namespace osu.Game.Screens.Play GameplayState.HasFailed = true; Score.ScoreInfo.Passed = false; + updateGameplayState(); + // There is a chance that we could be in a paused state as the ruleset's internal clock (see FrameStabilityContainer) // could process an extra frame after the GameplayClock is stopped. // In such cases we want the fail state to precede a user triggered pause. @@ -945,7 +947,7 @@ namespace osu.Game.Screens.Play failAnimationLayer.Background = b; }); - HUDOverlay.IsBreakTime.BindTo(breakTracker.IsBreakTime); + HUDOverlay.IsPlaying.BindTo(localUserPlaying); DimmableStoryboard.IsBreakTime.BindTo(breakTracker.IsBreakTime); DimmableStoryboard.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground); From b41e273086df007bb12b1521df7e31cd6bc53a04 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 15:06:27 +0900 Subject: [PATCH 0481/2328] Convert function weirdness to property + bool --- .../UI/OsuSettingsSubsection.cs | 2 +- .../Sections/Gameplay/AudioSettings.cs | 2 +- .../Sections/Gameplay/GeneralSettings.cs | 2 +- .../Settings/Sections/Gameplay/HUDSettings.cs | 2 +- .../Sections/UserInterface/GeneralSettings.cs | 2 +- .../UserInterface/SongSelectSettings.cs | 2 +- osu.Game/Overlays/Settings/SettingsItem.cs | 29 +++++++++++-------- 7 files changed, 23 insertions(+), 18 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs index 33db74c530..a638019e69 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.UI }, new SettingsCheckbox { - GetClassicDefault = () => false, + ClassicDefault = false, LabelText = "Snaking out sliders", Current = config.GetBindable(OsuRulesetSetting.SnakingOutSliders) }, diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs index 6978c77aad..e2e00813bd 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay }, new SettingsCheckbox { - GetClassicDefault = () => false, + ClassicDefault = false, LabelText = GameplaySettingsStrings.AlwaysPlayFirstComboBreak, Current = config.GetBindable(OsuSetting.AlwaysPlayFirstComboBreak) } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index 3ca677ef7b..5231ce1211 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { new SettingsEnumDropdown { - GetClassicDefault = () => ScoringMode.Classic, + ClassicDefault = ScoringMode.Classic, LabelText = GameplaySettingsStrings.ScoreDisplayMode, Current = config.GetBindable(OsuSetting.ScoreDisplayMode), Keywords = new[] { "scoring" } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs index 285cdfa3f8..829977e9b6 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs @@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay }, new SettingsCheckbox { - GetClassicDefault = () => false, + ClassicDefault = false, LabelText = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail, Current = config.GetBindable(OsuSetting.ShowHealthDisplayWhenCantFail), Keywords = new[] { "hp", "bar" } diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs index 06f2c9794c..7fc049915e 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs @@ -37,7 +37,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface }, new SettingsSlider { - GetClassicDefault = () => 0, + ClassicDefault = 0, LabelText = UserInterfaceStrings.HoldToConfirmActivationTime, Current = config.GetBindable(OsuSetting.UIHoldActivationDelay), Keywords = new[] { @"delay" }, diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs index 213234db4f..b91b5c5243 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs @@ -32,7 +32,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface { new SettingsCheckbox { - GetClassicDefault = () => true, + ClassicDefault = true, LabelText = UserInterfaceStrings.RightMouseScroll, Current = config.GetBindable(OsuSetting.SongSelectRightMouseScroll), }, diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 845a7f5cdf..0b9a553c2c 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -107,10 +107,8 @@ namespace osu.Game.Overlays.Settings LabelText.ToString() }; - if (GetClassicDefault != null) - { + if (hasClassicDefault) keywords.Add(CLASSIC_DEFAULT_SEARCH_TERM); - } return keywords; } @@ -126,20 +124,27 @@ namespace osu.Game.Overlays.Settings public event Action SettingChanged; + private T classicDefault; + private bool hasClassicDefault; + /// - /// An action which when invoked will apply a classic default value to this setting. + /// A "classic" default value for this setting. /// - public Func GetClassicDefault { get; set; } + public T ClassicDefault + { + set + { + classicDefault = value; + hasClassicDefault = true; + } + } public void ApplyClassicDefault(bool useClassicDefault) { - if (GetClassicDefault != null) - { - if (useClassicDefault) - Current.Value = GetClassicDefault(); - else - Current.SetDefault(); - } + if (hasClassicDefault && useClassicDefault) + Current.Value = classicDefault; + else + Current.SetDefault(); } protected SettingsItem() From 71aa7c813e24fe7636b7c938cd2e9ada83038240 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 15:33:39 +0900 Subject: [PATCH 0482/2328] Fix regressed logic for applying classic defaults --- osu.Game/Overlays/Settings/SettingsItem.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 0b9a553c2c..db9fbfcbb4 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -141,7 +141,10 @@ namespace osu.Game.Overlays.Settings public void ApplyClassicDefault(bool useClassicDefault) { - if (hasClassicDefault && useClassicDefault) + if (!hasClassicDefault) + return; + + if (useClassicDefault) Current.Value = classicDefault; else Current.SetDefault(); From 37ae39f5feb847926d6842e795523977268326a3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 15:48:40 +0900 Subject: [PATCH 0483/2328] Move "Next" localisation to common strings --- osu.Game/Localisation/CommonStrings.cs | 5 +++++ osu.Game/Localisation/FirstRunSetupOverlayStrings.cs | 5 ----- osu.Game/Overlays/FirstRunSetupOverlay.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Localisation/CommonStrings.cs b/osu.Game/Localisation/CommonStrings.cs index 6da2e4d272..52e9811cf7 100644 --- a/osu.Game/Localisation/CommonStrings.cs +++ b/osu.Game/Localisation/CommonStrings.cs @@ -14,6 +14,11 @@ namespace osu.Game.Localisation /// public static LocalisableString Back => new TranslatableString(getKey(@"back"), @"Back"); + /// + /// "Next" + /// + public static LocalisableString Next => new TranslatableString(getKey(@"next"), @"Next"); + /// /// "Finish" /// diff --git a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs index 001de93c16..ebce9e1ce1 100644 --- a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs +++ b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs @@ -48,11 +48,6 @@ osu! is a very configurable game, and diving straight into the settings can some /// public static LocalisableString UIScaleDescription => new TranslatableString(getKey(@"ui_scale_description"), @"The size of the osu! user interface can be adjusted to your liking."); - /// - /// "Next ({0})" - /// - public static LocalisableString Next(LocalisableString nextStepDescription) => new TranslatableString(getKey(@"next"), @"Next ({0})", nextStepDescription); - private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 87e62cbddf..5700fa3763 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -310,7 +310,7 @@ namespace osu.Game.Overlays if (currentStepIndex == 0) NextButton.Text = FirstRunSetupOverlayStrings.GetStarted; else if (currentStepIndex < steps.Length - 1) - NextButton.Text = FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].Description); + NextButton.Text = new TranslatableString(@"_", @"{0} ({1})", CommonStrings.Next, steps[currentStepIndex.Value + 1].Description); else NextButton.Text = CommonStrings.Finish; } From 2c836e2d6312fc0a162f322163385c484cb19a94 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 15:55:32 +0900 Subject: [PATCH 0484/2328] Fix scrollbar overlapping content --- osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs index eb4b97069c..8fcfdbf689 100644 --- a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs +++ b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs @@ -22,6 +22,7 @@ namespace osu.Game.Overlays.FirstRunSetup new OsuScrollContainer(Direction.Vertical) { RelativeSizeAxes = Axes.Both, + ScrollbarOverlapsContent = false, Child = Content = new FillFlowContainer { Spacing = new Vector2(20), From a078440012482f4b575f74eab6dbee0484c3541f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 16:03:15 +0900 Subject: [PATCH 0485/2328] Show last step on back button as well --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 5700fa3763..27a057bf09 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -133,7 +133,7 @@ namespace osu.Game.Overlays { BackButton = new DangerousTriangleButton { - Width = 200, + Width = 300, Text = CommonStrings.Back, Action = showPreviousStep, Enabled = { Value = false }, @@ -307,12 +307,22 @@ namespace osu.Game.Overlays if (currentStepIndex == null) return; - if (currentStepIndex == 0) + bool isFirstStep = currentStepIndex == 0; + bool isLastStep = currentStepIndex == steps.Length - 1; + + if (isFirstStep) + { + BackButton.Text = CommonStrings.Back; NextButton.Text = FirstRunSetupOverlayStrings.GetStarted; - else if (currentStepIndex < steps.Length - 1) - NextButton.Text = new TranslatableString(@"_", @"{0} ({1})", CommonStrings.Next, steps[currentStepIndex.Value + 1].Description); + } else - NextButton.Text = CommonStrings.Finish; + { + BackButton.Text = new TranslatableString(@"_", @"{0} ({1})", CommonStrings.Back, steps[currentStepIndex.Value - 1].Description); + + NextButton.Text = isLastStep + ? CommonStrings.Finish + : new TranslatableString(@"_", @"{0} ({1})", CommonStrings.Next, steps[currentStepIndex.Value + 1].Description); + } } private class FirstRunStep From 01fdb771ee4844ddd724548f1188bbdcd4705241 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 16:22:41 +0900 Subject: [PATCH 0486/2328] Add header text to first run setup screens --- .../FirstRunSetup/FirstRunSetupScreen.cs | 30 +++++++++++++++---- .../Overlays/FirstRunSetup/ScreenUIScale.cs | 1 + .../Overlays/FirstRunSetup/ScreenWelcome.cs | 6 +++- osu.Game/Overlays/FirstRunSetupOverlay.cs | 24 ++++----------- 4 files changed, 36 insertions(+), 25 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs index eb4b97069c..282ba52ddc 100644 --- a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs +++ b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs @@ -1,10 +1,14 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; +using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Screens; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; using osuTK; namespace osu.Game.Overlays.FirstRunSetup @@ -15,19 +19,33 @@ namespace osu.Game.Overlays.FirstRunSetup protected FillFlowContainer Content { get; private set; } - protected FirstRunSetupScreen() + [BackgroundDependencyLoader] + private void load(OverlayColourProvider overlayColourProvider) { + const float header_size = 40; + const float spacing = 20; + InternalChildren = new Drawable[] { new OsuScrollContainer(Direction.Vertical) { RelativeSizeAxes = Axes.Both, - Child = Content = new FillFlowContainer + Children = new Drawable[] { - Spacing = new Vector2(20), - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, + new OsuSpriteText + { + Text = this.GetLocalisableDescription(), + Font = OsuFont.Default.With(size: header_size), + Colour = overlayColourProvider.Light1, + }, + Content = new FillFlowContainer + { + Y = header_size + spacing, + Spacing = new Vector2(spacing), + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + } }, } }; diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs index ef48d9ced5..1bd82f6d99 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs @@ -27,6 +27,7 @@ using osuTK; namespace osu.Game.Overlays.FirstRunSetup { + [LocalisableDescription(typeof(GraphicsSettingsStrings), nameof(GraphicsSettingsStrings.UIScaling))] public class ScreenUIScale : FirstRunSetupScreen { [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs index 39da180f40..10e15a7555 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs @@ -1,16 +1,20 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Localisation; namespace osu.Game.Overlays.FirstRunSetup { + [LocalisableDescription(typeof(FirstRunSetupOverlayStrings), nameof(FirstRunSetupOverlayStrings.WelcomeTitle))] public class ScreenWelcome : FirstRunSetupScreen { - public ScreenWelcome() + [BackgroundDependencyLoader] + private void load() { Content.Children = new Drawable[] { diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index dc1ae2be37..7d5f4acee7 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -7,12 +7,12 @@ using System; using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; -using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Game.Configuration; using osu.Game.Graphics; @@ -56,10 +56,10 @@ namespace osu.Game.Overlays /// public FirstRunSetupScreen? CurrentScreen => (FirstRunSetupScreen?)stack?.CurrentScreen; - private readonly FirstRunStep[] steps = + private readonly Type[] steps = { - new FirstRunStep(typeof(ScreenWelcome), FirstRunSetupOverlayStrings.WelcomeTitle), - new FirstRunStep(typeof(ScreenUIScale), GraphicsSettingsStrings.UIScaling), + typeof(ScreenWelcome), + typeof(ScreenUIScale) }; private Container stackContainer = null!; @@ -286,7 +286,7 @@ namespace osu.Game.Overlays if (currentStepIndex < steps.Length) { - stack.Push((Screen)Activator.CreateInstance(steps[currentStepIndex.Value].ScreenType)); + stack.Push((Screen)Activator.CreateInstance(steps[currentStepIndex.Value])); } else { @@ -307,21 +307,9 @@ namespace osu.Game.Overlays if (currentStepIndex != null) { NextButton.Text = currentStepIndex + 1 < steps.Length - ? FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].Description) + ? FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].GetLocalisableDescription()) : CommonStrings.Finish; } } - - private class FirstRunStep - { - public readonly Type ScreenType; - public readonly LocalisableString Description; - - public FirstRunStep(Type screenType, LocalisableString description) - { - ScreenType = screenType; - Description = description; - } - } } } From 280cd048f662090d5bdde09191daa9ff978190dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 17:30:28 +0900 Subject: [PATCH 0487/2328] Fix joystick settings changing enabled state of config level bindables Just copied what we had in place for the mouse sensitivity setting. For tablet settings I believe I avoided this by just hiding the settings when not enabled. Might be a better way forward, but this is simplest for now. Run `TestSceneSettingsPanel` twice to get a crash without this change. --- .../Sections/Input/JoystickSettings.cs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs index c136ca6a19..60849cd6d4 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs @@ -20,6 +20,10 @@ namespace osu.Game.Overlays.Settings.Sections.Input private SettingsSlider deadzoneSlider; + private Bindable handlerDeadzone; + + private Bindable localDeadzone; + public JoystickSettings(JoystickHandler joystickHandler) { this.joystickHandler = joystickHandler; @@ -28,6 +32,10 @@ namespace osu.Game.Overlays.Settings.Sections.Input [BackgroundDependencyLoader] private void load() { + // use local bindable to avoid changing enabled state of game host's bindable. + handlerDeadzone = joystickHandler.DeadzoneThreshold.GetBoundCopy(); + localDeadzone = handlerDeadzone.GetUnboundCopy(); + Children = new Drawable[] { new SettingsCheckbox @@ -40,7 +48,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input LabelText = JoystickSettingsStrings.DeadzoneThreshold, KeyboardStep = 0.01f, DisplayAsPercentage = true, - Current = joystickHandler.DeadzoneThreshold, + Current = localDeadzone, }, }; } @@ -51,6 +59,17 @@ namespace osu.Game.Overlays.Settings.Sections.Input enabled.BindTo(joystickHandler.Enabled); enabled.BindValueChanged(e => deadzoneSlider.Current.Disabled = !e.NewValue, true); + + handlerDeadzone.BindValueChanged(val => + { + bool disabled = localDeadzone.Disabled; + + localDeadzone.Disabled = false; + localDeadzone.Value = val.NewValue; + localDeadzone.Disabled = disabled; + }, true); + + localDeadzone.BindValueChanged(val => handlerDeadzone.Value = val.NewValue); } } } From c52c08fe9785e35735ae1dcacd4db5cbe4463bc6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 16:41:50 +0900 Subject: [PATCH 0488/2328] Rename test to increase scope --- ...stSceneShearedToggleButton.cs => TestSceneShearedButtons.cs} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename osu.Game.Tests/Visual/UserInterface/{TestSceneShearedToggleButton.cs => TestSceneShearedButtons.cs} (97%) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedToggleButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs similarity index 97% rename from osu.Game.Tests/Visual/UserInterface/TestSceneShearedToggleButton.cs rename to osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs index b5109aa58d..ff83547087 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedToggleButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs @@ -11,7 +11,7 @@ using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] - public class TestSceneShearedToggleButton : OsuManualInputManagerTestScene + public class TestSceneShearedButtons : OsuManualInputManagerTestScene { [Cached] private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); From 9f33e627de61afbe107efc6557c48c8d06331572 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 17:31:55 +0900 Subject: [PATCH 0489/2328] Split out `ShearedButton` from `ShearedToggleButton` --- .../Graphics/UserInterface/ShearedButton.cs | 174 ++++++++++++++++++ .../UserInterface/ShearedToggleButton.cs | 131 ++----------- 2 files changed, 190 insertions(+), 115 deletions(-) create mode 100644 osu.Game/Graphics/UserInterface/ShearedButton.cs diff --git a/osu.Game/Graphics/UserInterface/ShearedButton.cs b/osu.Game/Graphics/UserInterface/ShearedButton.cs new file mode 100644 index 0000000000..5114e15e2e --- /dev/null +++ b/osu.Game/Graphics/UserInterface/ShearedButton.cs @@ -0,0 +1,174 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; +using osu.Framework.Localisation; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; +using osuTK; + +namespace osu.Game.Graphics.UserInterface +{ + public class ShearedButton : OsuClickableContainer + { + public LocalisableString Text + { + get => text.Text; + set => text.Text = value; + } + + public Colour4 DarkerColour + { + set + { + darkerColour = value; + Scheduler.AddOnce(updateState); + } + } + + public Colour4 LighterColour + { + set + { + lighterColour = value; + Scheduler.AddOnce(updateState); + } + } + + public Colour4 TextColour + { + set + { + textColour = value; + Scheduler.AddOnce(updateState); + } + } + + [Resolved] + protected OverlayColourProvider ColourProvider { get; private set; } = null!; + + private readonly Box background; + private readonly OsuSpriteText text; + + private const float shear = 0.2f; + + private Colour4? darkerColour; + private Colour4? lighterColour; + private Colour4? textColour; + + /// + /// Creates a new + /// + /// + /// The width of the button. + /// + /// If a non- value is provided, this button will have a fixed width equal to the provided value. + /// If a value is provided (or the argument is omitted entirely), the button will autosize in width to fit the text. + /// + /// + public ShearedButton(float? width = null) + { + Height = 50; + Padding = new MarginPadding { Horizontal = shear * 50 }; + + Content.CornerRadius = 7; + Content.Shear = new Vector2(shear, 0); + Content.Masking = true; + Content.BorderThickness = 2; + Content.Anchor = Content.Origin = Anchor.Centre; + + Children = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both + }, + text = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = OsuFont.TorusAlternate.With(size: 17), + Shear = new Vector2(-shear, 0) + } + }; + + if (width != null) + { + Width = width.Value; + } + else + { + AutoSizeAxes = Axes.X; + text.Margin = new MarginPadding { Horizontal = 15 }; + } + } + + protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverClickSounds(sampleSet); + + protected override void LoadComplete() + { + base.LoadComplete(); + + Enabled.BindValueChanged(_ => Scheduler.AddOnce(updateState)); + + updateState(); + FinishTransforms(true); + } + + protected override bool OnHover(HoverEvent e) + { + Scheduler.AddOnce(updateState); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + Scheduler.AddOnce(updateState); + base.OnHoverLost(e); + } + + protected override bool OnMouseDown(MouseDownEvent e) + { + Content.ScaleTo(0.8f, 2000, Easing.OutQuint); + return base.OnMouseDown(e); + } + + protected override void OnMouseUp(MouseUpEvent e) + { + Content.ScaleTo(1, 1000, Easing.OutElastic); + base.OnMouseUp(e); + } + + private void updateState() + { + var colourDark = darkerColour ?? ColourProvider.Background3; + var colourLight = lighterColour ?? ColourProvider.Background1; + var colourText = textColour ?? ColourProvider.Content1; + + if (!Enabled.Value) + { + colourDark = colourDark.Darken(0.3f); + colourLight = colourLight.Darken(0.3f); + } + else if (IsHovered) + { + colourDark = colourDark.Lighten(0.3f); + colourLight = colourLight.Lighten(0.3f); + } + + background.FadeColour(colourDark, 150, Easing.OutQuint); + Content.TransformTo(nameof(BorderColour), ColourInfo.GradientVertical(colourDark, colourLight), 150, Easing.OutQuint); + + if (!Enabled.Value) + colourText = colourText.Opacity(0.6f); + + text.FadeColour(colourText, 150, Easing.OutQuint); + } + } +} diff --git a/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs b/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs index aed3be20a0..c7273320fc 100644 --- a/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs +++ b/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs @@ -8,39 +8,18 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.Events; -using osu.Framework.Localisation; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; -using osu.Game.Overlays; -using osuTK; namespace osu.Game.Graphics.UserInterface { - public class ShearedToggleButton : OsuClickableContainer + public class ShearedToggleButton : ShearedButton { - public BindableBool Active { get; } = new BindableBool(); - - public LocalisableString Text - { - get => text.Text; - set => text.Text = value; - } - - private readonly Box background; - private readonly OsuSpriteText text; - private Sample? sampleOff; private Sample? sampleOn; - private const float shear = 0.2f; - - [Resolved] - private OverlayColourProvider colourProvider { get; set; } = null!; + /// + /// Whether this button is currently toggled to an active state. + /// + public BindableBool Active { get; } = new BindableBool(); /// /// Creates a new @@ -53,40 +32,8 @@ namespace osu.Game.Graphics.UserInterface /// /// public ShearedToggleButton(float? width = null) + : base(width) { - Height = 50; - Padding = new MarginPadding { Horizontal = shear * 50 }; - - Content.CornerRadius = 7; - Content.Shear = new Vector2(shear, 0); - Content.Masking = true; - Content.BorderThickness = 2; - Content.Anchor = Content.Origin = Anchor.Centre; - - Children = new Drawable[] - { - background = new Box - { - RelativeSizeAxes = Axes.Both - }, - text = new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Font = OsuFont.TorusAlternate.With(size: 17), - Shear = new Vector2(-shear, 0) - } - }; - - if (width != null) - { - Width = width.Value; - } - else - { - AutoSizeAxes = Axes.X; - text.Margin = new MarginPadding { Horizontal = 15 }; - } } [BackgroundDependencyLoader] @@ -100,70 +47,24 @@ namespace osu.Game.Graphics.UserInterface protected override void LoadComplete() { - base.LoadComplete(); - Active.BindValueChanged(_ => { - updateState(); + updateActiveState(); playSample(); }); - Active.BindDisabledChanged(disabled => - { - updateState(); - Action = disabled ? (Action?)null : Active.Toggle; - }, true); - FinishTransforms(true); + updateActiveState(); + + Active.BindDisabledChanged(disabled => Action = disabled ? (Action?)null : Active.Toggle, true); + + base.LoadComplete(); } - protected override bool OnHover(HoverEvent e) + private void updateActiveState() { - updateState(); - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - updateState(); - base.OnHoverLost(e); - } - - protected override bool OnMouseDown(MouseDownEvent e) - { - Content.ScaleTo(0.8f, 2000, Easing.OutQuint); - return base.OnMouseDown(e); - } - - protected override void OnMouseUp(MouseUpEvent e) - { - Content.ScaleTo(1, 1000, Easing.OutElastic); - base.OnMouseUp(e); - } - - private void updateState() - { - var darkerColour = Active.Value ? colourProvider.Highlight1 : colourProvider.Background3; - var lighterColour = Active.Value ? colourProvider.Colour0 : colourProvider.Background1; - - if (Active.Disabled) - { - darkerColour = darkerColour.Darken(0.3f); - lighterColour = lighterColour.Darken(0.3f); - } - else if (IsHovered) - { - darkerColour = darkerColour.Lighten(0.3f); - lighterColour = lighterColour.Lighten(0.3f); - } - - background.FadeColour(darkerColour, 150, Easing.OutQuint); - Content.TransformTo(nameof(BorderColour), ColourInfo.GradientVertical(darkerColour, lighterColour), 150, Easing.OutQuint); - - var textColour = Active.Value ? colourProvider.Background6 : colourProvider.Content1; - if (Active.Disabled) - textColour = textColour.Opacity(0.6f); - - text.FadeColour(textColour, 150, Easing.OutQuint); + DarkerColour = Active.Value ? ColourProvider.Highlight1 : ColourProvider.Background3; + LighterColour = Active.Value ? ColourProvider.Colour0 : ColourProvider.Background1; + TextColour = Active.Value ? ColourProvider.Background6 : ColourProvider.Content1; } private void playSample() From 4e260e741077cba720196c425a3e130f8bebbc79 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 17:32:20 +0900 Subject: [PATCH 0490/2328] Fix all buttons gamewide not animating properly on click Not sure how or when this happened. --- osu.Game/Graphics/UserInterface/OsuButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 7c1e8d90a0..29a797bd78 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -108,7 +108,7 @@ namespace osu.Game.Graphics.UserInterface if (Enabled.Value) { Debug.Assert(backgroundColour != null); - Background.FlashColour(backgroundColour.Value, 200); + Background.FlashColour(backgroundColour.Value.Lighten(0.4f), 200); } return base.OnClick(e); From 6864623bacac5d1c9ab488c84f29ac88a06cc115 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 17:32:02 +0900 Subject: [PATCH 0491/2328] Add `ShearedButton` test coverage --- .../UserInterface/TestSceneShearedButtons.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs index ff83547087..4540528918 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs @@ -16,6 +16,38 @@ namespace osu.Game.Tests.Visual.UserInterface [Cached] private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); + [Test] + public void TestShearedButton() + { + ShearedButton button = null; + bool actionFired = false; + + AddStep("create button", () => + { + actionFired = false; + + Child = button = new ShearedButton(200) + { + LighterColour = Colour4.FromHex("#FF86DD"), + DarkerColour = Colour4.FromHex("#DE31AE"), + TextColour = Colour4.White, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "Press me", + Height = 80, + Action = () => actionFired = true, + }; + }); + + AddStep("set disabled", () => button.Enabled.Value = false); + AddStep("press button", () => button.TriggerClick()); + AddAssert("action not fired", () => !actionFired); + + AddStep("set enabled", () => button.Enabled.Value = true); + AddStep("press button", () => button.TriggerClick()); + AddAssert("action fired", () => actionFired); + } + [Test] public void TestShearedToggleButton() { From 4bc4ff179a5a3f883af152090c07eacff4b57346 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 18:03:34 +0900 Subject: [PATCH 0492/2328] Add flash effect on click --- .../Graphics/UserInterface/ShearedButton.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedButton.cs b/osu.Game/Graphics/UserInterface/ShearedButton.cs index 5114e15e2e..e9120a3b7d 100644 --- a/osu.Game/Graphics/UserInterface/ShearedButton.cs +++ b/osu.Game/Graphics/UserInterface/ShearedButton.cs @@ -62,6 +62,8 @@ namespace osu.Game.Graphics.UserInterface private Colour4? lighterColour; private Colour4? textColour; + private readonly Box flashLayer; + /// /// Creates a new /// @@ -95,7 +97,14 @@ namespace osu.Game.Graphics.UserInterface Origin = Anchor.Centre, Font = OsuFont.TorusAlternate.With(size: 17), Shear = new Vector2(-shear, 0) - } + }, + flashLayer = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Colour4.White.Opacity(0.9f), + Blending = BlendingParameters.Additive, + Alpha = 0, + }, }; if (width != null) @@ -121,6 +130,14 @@ namespace osu.Game.Graphics.UserInterface FinishTransforms(true); } + protected override bool OnClick(ClickEvent e) + { + if (Enabled.Value) + flashLayer.FadeOutFromOne(800, Easing.OutQuint); + + return base.OnClick(e); + } + protected override bool OnHover(HoverEvent e) { Scheduler.AddOnce(updateState); From cd197a938046249950bbf395eb2c55277b2305cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 18:11:03 +0900 Subject: [PATCH 0493/2328] Reduce the hover lightening effect slightly --- osu.Game/Graphics/UserInterface/ShearedButton.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedButton.cs b/osu.Game/Graphics/UserInterface/ShearedButton.cs index e9120a3b7d..f995da9e4b 100644 --- a/osu.Game/Graphics/UserInterface/ShearedButton.cs +++ b/osu.Game/Graphics/UserInterface/ShearedButton.cs @@ -175,8 +175,8 @@ namespace osu.Game.Graphics.UserInterface } else if (IsHovered) { - colourDark = colourDark.Lighten(0.3f); - colourLight = colourLight.Lighten(0.3f); + colourDark = colourDark.Lighten(0.2f); + colourLight = colourLight.Lighten(0.2f); } background.FadeColour(colourDark, 150, Easing.OutQuint); From 52a8f3848d5989e38615bbbaaa8e1c5d892199fc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 18:14:57 +0900 Subject: [PATCH 0494/2328] Expose font size and add big button test --- .../UserInterface/TestSceneShearedButtons.cs | 43 +++++++++++++------ .../Graphics/UserInterface/ShearedButton.cs | 6 +++ 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs index 4540528918..5a4eeef4d9 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs @@ -16,8 +16,9 @@ namespace osu.Game.Tests.Visual.UserInterface [Cached] private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); - [Test] - public void TestShearedButton() + [TestCase(false)] + [TestCase(true)] + public void TestShearedButton(bool bigButton) { ShearedButton button = null; bool actionFired = false; @@ -26,17 +27,35 @@ namespace osu.Game.Tests.Visual.UserInterface { actionFired = false; - Child = button = new ShearedButton(200) + if (bigButton) { - LighterColour = Colour4.FromHex("#FF86DD"), - DarkerColour = Colour4.FromHex("#DE31AE"), - TextColour = Colour4.White, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Text = "Press me", - Height = 80, - Action = () => actionFired = true, - }; + Child = button = new ShearedButton(400) + { + LighterColour = Colour4.FromHex("#FFFFFF"), + DarkerColour = Colour4.FromHex("#FFCC22"), + TextColour = Colour4.Black, + TextSize = 36, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "Let's GO!", + Height = 80, + Action = () => actionFired = true, + }; + } + else + { + Child = button = new ShearedButton(200) + { + LighterColour = Colour4.FromHex("#FF86DD"), + DarkerColour = Colour4.FromHex("#DE31AE"), + TextColour = Colour4.White, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "Press me", + Height = 80, + Action = () => actionFired = true, + }; + } }); AddStep("set disabled", () => button.Enabled.Value = false); diff --git a/osu.Game/Graphics/UserInterface/ShearedButton.cs b/osu.Game/Graphics/UserInterface/ShearedButton.cs index f995da9e4b..c3c566782f 100644 --- a/osu.Game/Graphics/UserInterface/ShearedButton.cs +++ b/osu.Game/Graphics/UserInterface/ShearedButton.cs @@ -23,6 +23,12 @@ namespace osu.Game.Graphics.UserInterface set => text.Text = value; } + public float TextSize + { + get => text.Font.Size; + set => text.Font = OsuFont.TorusAlternate.With(size: value); + } + public Colour4 DarkerColour { set From 4a370f429eb3d484fc261af50fb53b809dd9a70b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Apr 2022 18:21:46 +0900 Subject: [PATCH 0495/2328] Reorder initialisation of bindable action binding to make more sense --- osu.Game/Graphics/UserInterface/ShearedToggleButton.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs b/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs index c7273320fc..4780270f66 100644 --- a/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs +++ b/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs @@ -47,6 +47,7 @@ namespace osu.Game.Graphics.UserInterface protected override void LoadComplete() { + Active.BindDisabledChanged(disabled => Action = disabled ? (Action?)null : Active.Toggle, true); Active.BindValueChanged(_ => { updateActiveState(); @@ -54,9 +55,6 @@ namespace osu.Game.Graphics.UserInterface }); updateActiveState(); - - Active.BindDisabledChanged(disabled => Action = disabled ? (Action?)null : Active.Toggle, true); - base.LoadComplete(); } From e646233722e2c24b789217d8d8a087b8b4cb6787 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 26 Apr 2022 19:16:36 +0300 Subject: [PATCH 0496/2328] Use correct translation for "Accuracy" label in break overlay --- osu.Game/Screens/Play/Break/BreakInfo.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Break/BreakInfo.cs b/osu.Game/Screens/Play/Break/BreakInfo.cs index f95e949920..ead41a826a 100644 --- a/osu.Game/Screens/Play/Break/BreakInfo.cs +++ b/osu.Game/Screens/Play/Break/BreakInfo.cs @@ -43,8 +43,7 @@ namespace osu.Game.Screens.Play.Break Direction = FillDirection.Vertical, Children = new Drawable[] { - AccuracyDisplay = new PercentageBreakInfoLine(BeatmapsetsStrings.ShowStatsAccuracy), - + AccuracyDisplay = new PercentageBreakInfoLine(BeatmapsetsStrings.ShowScoreboardHeadersAccuracy), // See https://github.com/ppy/osu/discussions/15185 // RankDisplay = new BreakInfoLine("Rank"), GradeDisplay = new BreakInfoLine("Grade"), From b0d6e16658a17299663ca3451de1b094918429bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 26 Apr 2022 21:57:19 +0200 Subject: [PATCH 0497/2328] Invert data flow in column dim implementation --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 82 ++++++++++++----------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 11cffe7959..ccd160a534 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -86,9 +86,6 @@ namespace osu.Game.Overlays.Mods } }); - // initialise the scroll early, as we will want to pass it to its children in the hierarchy initialisation below. - columnScroll = new OsuScrollContainer(Direction.Horizontal); - MainAreaContent.AddRange(new Drawable[] { new Container @@ -101,13 +98,13 @@ namespace osu.Game.Overlays.Mods RelativePositionAxes = Axes.Both, Children = new Drawable[] { - columnScroll.With(col => + columnScroll = new OsuScrollContainer(Direction.Horizontal) { - col.RelativeSizeAxes = Axes.Both; - col.Masking = false; - col.ClampExtension = 100; - col.ScrollbarOverlapsContent = false; - col.Child = columnFlow = new ColumnFlowContainer + RelativeSizeAxes = Axes.Both, + Masking = false, + ClampExtension = 100, + ScrollbarOverlapsContent = false, + Child = columnFlow = new ColumnFlowContainer { Direction = FillDirection.Horizontal, Shear = new Vector2(SHEAR, 0), @@ -117,14 +114,14 @@ namespace osu.Game.Overlays.Mods Margin = new MarginPadding { Horizontal = 70 }, Children = new[] { - createModColumnContent(columnScroll, ModType.DifficultyReduction, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }), - createModColumnContent(columnScroll, ModType.DifficultyIncrease, new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }), - createModColumnContent(columnScroll, ModType.Automation, new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }), - createModColumnContent(columnScroll, ModType.Conversion), - createModColumnContent(columnScroll, ModType.Fun) + createModColumnContent(ModType.DifficultyReduction, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }), + createModColumnContent(ModType.DifficultyIncrease, new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }), + createModColumnContent(ModType.Automation, new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }), + createModColumnContent(ModType.Conversion), + createModColumnContent(ModType.Fun) } - }; - }) + } + } } } }); @@ -159,11 +156,12 @@ namespace osu.Game.Overlays.Mods } } - private ColumnDimContainer createModColumnContent(OsuScrollContainer scroll, ModType modType, Key[]? toggleKeys = null) - => new ColumnDimContainer(scroll, CreateModColumn(modType, toggleKeys)) + private ColumnDimContainer createModColumnContent(ModType modType, Key[]? toggleKeys = null) + => new ColumnDimContainer(CreateModColumn(modType, toggleKeys)) { AutoSizeAxes = Axes.X, - RelativeSizeAxes = Axes.Y + RelativeSizeAxes = Axes.Y, + RequestScroll = column => columnScroll.ScrollTo(Math.Clamp(column.DrawPosition.X - 70, 0, columnScroll.ScrollableExtent)) }; protected override void LoadComplete() @@ -322,6 +320,22 @@ namespace osu.Game.Overlays.Mods } } + protected override void Update() + { + base.Update(); + + foreach (var column in columnFlow) + { + // DrawWidth/DrawPosition do not include shear effects, and we want to know the full extents of the columns post-shear, + // so we have to manually compensate. + var topLeft = column.ToSpaceOfOtherDrawable(new Vector2(-column.DrawHeight * SHEAR, 0), columnScroll); + var topRight = column.ToSpaceOfOtherDrawable(new Vector2(column.DrawWidth, 0), columnScroll); + + column.Active.Value = Precision.AlmostBigger(topLeft.X, 0) + && Precision.DefinitelyBigger(columnScroll.DrawWidth, topRight.X); + } + } + private class ColumnFlowContainer : FillFlowContainer { public IEnumerable Columns => Children.Select(dimWrapper => dimWrapper.Column); @@ -362,23 +376,22 @@ namespace osu.Game.Overlays.Mods { public ModColumn Column { get; } - private readonly ScrollContainer parentScroll; - private readonly Bindable isFullyOnScreen = new BindableBool(true); + public readonly Bindable Active = new BindableBool(); + public Action? RequestScroll { get; set; } [Resolved] private OsuColour colours { get; set; } = null!; - public ColumnDimContainer(ScrollContainer parentScroll, ModColumn column) + public ColumnDimContainer(ModColumn column) { - this.parentScroll = parentScroll; Child = Column = column; - column.Active.BindTo(isFullyOnScreen); + column.Active.BindTo(Active); } protected override void LoadComplete() { base.LoadComplete(); - isFullyOnScreen.BindValueChanged(_ => updateDim(), true); + Active.BindValueChanged(_ => updateDim(), true); FinishTransforms(); } @@ -386,7 +399,7 @@ namespace osu.Game.Overlays.Mods { Colour4 targetColour; - if (isFullyOnScreen.Value) + if (Active.Value) targetColour = Colour4.White; else targetColour = IsHovered ? colours.GrayC : colours.Gray8; @@ -394,21 +407,10 @@ namespace osu.Game.Overlays.Mods this.FadeColour(targetColour, 300, Easing.OutQuint); } - protected override void Update() - { - // DrawWidth/DrawPosition do not include shear effects, and we want to know the full extents of the columns post-shear, - // so we have to manually compensate. - var topLeft = ToSpaceOfOtherDrawable(new Vector2(-DrawHeight * SHEAR, 0), parentScroll); - var topRight = ToSpaceOfOtherDrawable(new Vector2(DrawWidth, 0), parentScroll); - - isFullyOnScreen.Value = Precision.AlmostBigger(topLeft.X, 0) - && Precision.DefinitelyBigger(parentScroll.DrawWidth, topRight.X); - } - protected override bool OnMouseDown(MouseDownEvent e) { - if (!isFullyOnScreen.Value) - parentScroll.ScrollTo(Math.Clamp(DrawPosition.X - 70, 0, parentScroll.ScrollableExtent)); + if (!Active.Value) + RequestScroll?.Invoke(this); return true; } @@ -417,7 +419,7 @@ namespace osu.Game.Overlays.Mods { base.OnHover(e); updateDim(); - return isFullyOnScreen.Value; + return Active.Value; } protected override void OnHoverLost(HoverLostEvent e) From 13a36f2e5124cb152490017f529beec799165989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 26 Apr 2022 22:01:24 +0200 Subject: [PATCH 0498/2328] Scroll to column when mouse is released rather than pressed --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index ccd160a534..4299bc05f1 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -407,7 +407,7 @@ namespace osu.Game.Overlays.Mods this.FadeColour(targetColour, 300, Easing.OutQuint); } - protected override bool OnMouseDown(MouseDownEvent e) + protected override bool OnClick(ClickEvent e) { if (!Active.Value) RequestScroll?.Invoke(this); From e9c9c764ca457277e39e2d965ef0e11f1a59ce32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 26 Apr 2022 22:15:58 +0200 Subject: [PATCH 0499/2328] Fix column dim state changing when scrolling past extent --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 4299bc05f1..828ed93ca8 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -324,15 +324,22 @@ namespace osu.Game.Overlays.Mods { base.Update(); + // the bounds below represent the horizontal range of scroll items to be considered fully visible/active, in the scroll's internal coordinate space. + // note that clamping is applied to the left scroll bound to ensure scrolling past extents does not change the set of active columns. + float leftScrollBound = Math.Clamp(columnScroll.Current, 0, columnScroll.ScrollableExtent); + float rightScrollBound = leftScrollBound + columnScroll.DrawWidth; + foreach (var column in columnFlow) { // DrawWidth/DrawPosition do not include shear effects, and we want to know the full extents of the columns post-shear, // so we have to manually compensate. - var topLeft = column.ToSpaceOfOtherDrawable(new Vector2(-column.DrawHeight * SHEAR, 0), columnScroll); - var topRight = column.ToSpaceOfOtherDrawable(new Vector2(column.DrawWidth, 0), columnScroll); + // additionally note that columnFlow.Parent is not columnScroll, but rather it is the scroll's internal container. + // this is intentional in order to include margin of the columnFlow in calculations correctly and operate in the "scroll internal content space". + var topLeft = column.ToSpaceOfOtherDrawable(new Vector2(-column.DrawHeight * SHEAR, 0), columnFlow.Parent); + var topRight = column.ToSpaceOfOtherDrawable(new Vector2(column.DrawWidth, 0), columnFlow.Parent); - column.Active.Value = Precision.AlmostBigger(topLeft.X, 0) - && Precision.DefinitelyBigger(columnScroll.DrawWidth, topRight.X); + column.Active.Value = Precision.AlmostBigger(topLeft.X, leftScrollBound) + && Precision.DefinitelyBigger(rightScrollBound, topRight.X); } } From a884f20c6541227ef42896b1d042ace7af3e0f6a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 26 Apr 2022 22:19:20 +0300 Subject: [PATCH 0500/2328] Add failing test case --- .../TestSceneDrainingHealthProcessor.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs b/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs index 296c5cef76..56fb68ea27 100644 --- a/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs +++ b/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs @@ -160,6 +160,43 @@ namespace osu.Game.Tests.Gameplay assertHealthNotEqualTo(1); } + [Test] + public void TestFailConditions() + { + var beatmap = createBeatmap(0, 1000); + createProcessor(beatmap); + + AddStep("setup fail conditions", () => processor.FailConditions += ((_, result) => result.Type == HitResult.Miss)); + + AddStep("apply perfect hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Perfect })); + AddAssert("not failed", () => !processor.HasFailed); + AddStep("apply miss hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Miss })); + AddAssert("failed", () => processor.HasFailed); + } + + [Test] + public void TestMultipleFailConditions([Values] bool applyFirstCondition) + { + var beatmap = createBeatmap(0, 1000); + createProcessor(beatmap); + + AddStep("setup multiple fail conditions", () => + { + processor.FailConditions += ((_, result) => result.Type == HitResult.Miss); + processor.FailConditions += ((_, result) => result.Type == HitResult.Meh); + }); + + AddStep("apply perfect hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Perfect })); + AddAssert("not failed", () => !processor.HasFailed); + + if (applyFirstCondition) + AddStep("apply miss hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Miss })); + else + AddStep("apply meh hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Meh })); + + AddAssert("failed", () => processor.HasFailed); + } + [Test] public void TestBonusObjectsExcludedFromDrain() { From 31f64b13819620d1eee947e84dae43220b371081 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 26 Apr 2022 22:49:14 +0300 Subject: [PATCH 0501/2328] Fix `HealthProcessor` fail conditions not handling multiple invocations --- osu.Game/Rulesets/Scoring/HealthProcessor.cs | 32 +++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/HealthProcessor.cs b/osu.Game/Rulesets/Scoring/HealthProcessor.cs index a92c30e593..5e4e40b3bb 100644 --- a/osu.Game/Rulesets/Scoring/HealthProcessor.cs +++ b/osu.Game/Rulesets/Scoring/HealthProcessor.cs @@ -43,11 +43,11 @@ namespace osu.Game.Rulesets.Scoring Health.Value += GetHealthIncreaseFor(result); - if (!DefaultFailCondition && FailConditions?.Invoke(this, result) != true) - return; - - if (Failed?.Invoke() != false) - HasFailed = true; + if (meetsFailConditions(result)) + { + if (Failed?.Invoke() != false) + HasFailed = true; + } } protected override void RevertResultInternal(JudgementResult result) @@ -69,6 +69,28 @@ namespace osu.Game.Rulesets.Scoring /// protected virtual bool DefaultFailCondition => Precision.AlmostBigger(Health.MinValue, Health.Value); + /// + /// Whether the current state of or the provided meets the fail conditions. + /// + /// The judgement result. + private bool meetsFailConditions(JudgementResult result) + { + if (DefaultFailCondition) + return true; + + if (FailConditions != null) + { + foreach (var condition in FailConditions.GetInvocationList()) + { + bool conditionResult = (bool)condition.Method.Invoke(condition.Target, new object[] { this, result }); + if (conditionResult) + return true; + } + } + + return false; + } + protected override void Reset(bool storeResults) { base.Reset(storeResults); From fb6a112708e5b1759fd5625f96d04a2788f5ebde Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 26 Apr 2022 23:09:51 +0300 Subject: [PATCH 0502/2328] Mark `OsuModTarget` and `OsuModSuddenDeath` as mutually exclusive `OsuModTarget` already fails on miss, so "Sudden Death" doesn't make sense to be enabled and may only cause issues. --- osu.Game.Rulesets.Osu/Mods/OsuModSuddenDeath.cs | 6 +++++- osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModSuddenDeath.cs b/osu.Game.Rulesets.Osu/Mods/OsuModSuddenDeath.cs index 0403e81229..429fe30fc5 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModSuddenDeath.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModSuddenDeath.cs @@ -9,6 +9,10 @@ namespace osu.Game.Rulesets.Osu.Mods { public class OsuModSuddenDeath : ModSuddenDeath { - public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).ToArray(); + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] + { + typeof(OsuModAutopilot), + typeof(OsuModTarget), + }).ToArray(); } } diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs index 5285380097..4fab9b6a5a 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => @"Practice keeping up with the beat of the song."; public override double ScoreMultiplier => 1; - public override Type[] IncompatibleMods => new[] { typeof(IRequiresApproachCircles) }; + public override Type[] IncompatibleMods => new[] { typeof(IRequiresApproachCircles), typeof(OsuModSuddenDeath) }; [SettingSource("Seed", "Use a custom seed instead of a random one", SettingControlType = typeof(SettingsNumberBox))] public Bindable Seed { get; } = new Bindable From 94d07e147f565fa89552b27d2ba89a2acda6c5ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 26 Apr 2022 22:35:18 +0200 Subject: [PATCH 0503/2328] Move dimming logic to custom scroll container --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 44 +++++++++++++---------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 828ed93ca8..3aaec5edfd 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -61,7 +61,7 @@ namespace osu.Game.Overlays.Mods private DifficultyMultiplierDisplay? multiplierDisplay; private ModSettingsArea modSettingsArea = null!; - private OsuScrollContainer columnScroll = null!; + private ColumnScrollContainer columnScroll = null!; private ColumnFlowContainer columnFlow = null!; [BackgroundDependencyLoader] @@ -98,7 +98,7 @@ namespace osu.Game.Overlays.Mods RelativePositionAxes = Axes.Both, Children = new Drawable[] { - columnScroll = new OsuScrollContainer(Direction.Horizontal) + columnScroll = new ColumnScrollContainer { RelativeSizeAxes = Axes.Both, Masking = false, @@ -320,26 +320,32 @@ namespace osu.Game.Overlays.Mods } } - protected override void Update() + private class ColumnScrollContainer : OsuScrollContainer { - base.Update(); - - // the bounds below represent the horizontal range of scroll items to be considered fully visible/active, in the scroll's internal coordinate space. - // note that clamping is applied to the left scroll bound to ensure scrolling past extents does not change the set of active columns. - float leftScrollBound = Math.Clamp(columnScroll.Current, 0, columnScroll.ScrollableExtent); - float rightScrollBound = leftScrollBound + columnScroll.DrawWidth; - - foreach (var column in columnFlow) + public ColumnScrollContainer() + : base(Direction.Horizontal) { - // DrawWidth/DrawPosition do not include shear effects, and we want to know the full extents of the columns post-shear, - // so we have to manually compensate. - // additionally note that columnFlow.Parent is not columnScroll, but rather it is the scroll's internal container. - // this is intentional in order to include margin of the columnFlow in calculations correctly and operate in the "scroll internal content space". - var topLeft = column.ToSpaceOfOtherDrawable(new Vector2(-column.DrawHeight * SHEAR, 0), columnFlow.Parent); - var topRight = column.ToSpaceOfOtherDrawable(new Vector2(column.DrawWidth, 0), columnFlow.Parent); + } - column.Active.Value = Precision.AlmostBigger(topLeft.X, leftScrollBound) - && Precision.DefinitelyBigger(rightScrollBound, topRight.X); + protected override void Update() + { + base.Update(); + + // the bounds below represent the horizontal range of scroll items to be considered fully visible/active, in the scroll's internal coordinate space. + // note that clamping is applied to the left scroll bound to ensure scrolling past extents does not change the set of active columns. + float leftScrollBound = Math.Clamp(Current, 0, ScrollableExtent); + float rightScrollBound = leftScrollBound + DrawWidth; + + foreach (var column in Child) + { + // DrawWidth/DrawPosition do not include shear effects, and we want to know the full extents of the columns post-shear, + // so we have to manually compensate. + var topLeft = column.ToSpaceOfOtherDrawable(new Vector2(-column.DrawHeight * SHEAR, 0), ScrollContent); + var topRight = column.ToSpaceOfOtherDrawable(new Vector2(column.DrawWidth, 0), ScrollContent); + + column.Active.Value = Precision.AlmostBigger(topLeft.X, leftScrollBound) + && Precision.DefinitelyBigger(rightScrollBound, topRight.X); + } } } From 21377d2a4d96f5265043ef4b360c6b2ab5754067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 26 Apr 2022 22:43:58 +0200 Subject: [PATCH 0504/2328] Fix inactive columns flickering on and off mid-scroll --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 3aaec5edfd..d0d487d1ad 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -333,8 +333,13 @@ namespace osu.Game.Overlays.Mods // the bounds below represent the horizontal range of scroll items to be considered fully visible/active, in the scroll's internal coordinate space. // note that clamping is applied to the left scroll bound to ensure scrolling past extents does not change the set of active columns. - float leftScrollBound = Math.Clamp(Current, 0, ScrollableExtent); - float rightScrollBound = leftScrollBound + DrawWidth; + float leftVisibleBound = Math.Clamp(Current, 0, ScrollableExtent); + float rightVisibleBound = leftVisibleBound + DrawWidth; + + // if a movement is occurring at this time, the bounds below represent the full range of columns that the scroll movement will encompass. + // this will be used to ensure that columns do not change state from active to inactive back and forth until they are fully scrolled past. + float leftMovementBound = Math.Min(Current, Target); + float rightMovementBound = Math.Max(Current, Target) + DrawWidth; foreach (var column in Child) { @@ -343,8 +348,12 @@ namespace osu.Game.Overlays.Mods var topLeft = column.ToSpaceOfOtherDrawable(new Vector2(-column.DrawHeight * SHEAR, 0), ScrollContent); var topRight = column.ToSpaceOfOtherDrawable(new Vector2(column.DrawWidth, 0), ScrollContent); - column.Active.Value = Precision.AlmostBigger(topLeft.X, leftScrollBound) - && Precision.DefinitelyBigger(rightScrollBound, topRight.X); + bool isCurrentlyVisible = Precision.AlmostBigger(topLeft.X, leftVisibleBound) + && Precision.DefinitelyBigger(rightVisibleBound, topRight.X); + bool isBeingScrolledToward = Precision.AlmostBigger(topLeft.X, leftMovementBound) + && Precision.DefinitelyBigger(rightMovementBound, topRight.X); + + column.Active.Value = isCurrentlyVisible || isBeingScrolledToward; } } } From 921e8af3b039b7c1f3ee10d23aaea2fcf3807d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 26 Apr 2022 22:54:54 +0200 Subject: [PATCH 0505/2328] Use more lenient column bounds for checking active state --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index d0d487d1ad..76f4a8cdd4 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -345,13 +345,13 @@ namespace osu.Game.Overlays.Mods { // DrawWidth/DrawPosition do not include shear effects, and we want to know the full extents of the columns post-shear, // so we have to manually compensate. - var topLeft = column.ToSpaceOfOtherDrawable(new Vector2(-column.DrawHeight * SHEAR, 0), ScrollContent); - var topRight = column.ToSpaceOfOtherDrawable(new Vector2(column.DrawWidth, 0), ScrollContent); + var topLeft = column.ToSpaceOfOtherDrawable(Vector2.Zero, ScrollContent); + var bottomRight = column.ToSpaceOfOtherDrawable(new Vector2(column.DrawWidth - column.DrawHeight * SHEAR, 0), ScrollContent); bool isCurrentlyVisible = Precision.AlmostBigger(topLeft.X, leftVisibleBound) - && Precision.DefinitelyBigger(rightVisibleBound, topRight.X); + && Precision.DefinitelyBigger(rightVisibleBound, bottomRight.X); bool isBeingScrolledToward = Precision.AlmostBigger(topLeft.X, leftMovementBound) - && Precision.DefinitelyBigger(rightMovementBound, topRight.X); + && Precision.DefinitelyBigger(rightMovementBound, bottomRight.X); column.Active.Value = isCurrentlyVisible || isBeingScrolledToward; } From cccc9d7d39dbde7a876c3b48a60273edb0a03a3a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 27 Apr 2022 00:03:48 +0300 Subject: [PATCH 0506/2328] Rename method to better reflect what it's doing --- osu.Game/Rulesets/Scoring/HealthProcessor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/HealthProcessor.cs b/osu.Game/Rulesets/Scoring/HealthProcessor.cs index 5e4e40b3bb..0f51560476 100644 --- a/osu.Game/Rulesets/Scoring/HealthProcessor.cs +++ b/osu.Game/Rulesets/Scoring/HealthProcessor.cs @@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Scoring Health.Value += GetHealthIncreaseFor(result); - if (meetsFailConditions(result)) + if (meetsAnyFailCondition(result)) { if (Failed?.Invoke() != false) HasFailed = true; @@ -70,10 +70,10 @@ namespace osu.Game.Rulesets.Scoring protected virtual bool DefaultFailCondition => Precision.AlmostBigger(Health.MinValue, Health.Value); /// - /// Whether the current state of or the provided meets the fail conditions. + /// Whether the current state of or the provided meets any fail condition. /// /// The judgement result. - private bool meetsFailConditions(JudgementResult result) + private bool meetsAnyFailCondition(JudgementResult result) { if (DefaultFailCondition) return true; From 1676c2c3f69ad7836e2199986f34f44edab73960 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 27 Apr 2022 00:05:15 +0300 Subject: [PATCH 0507/2328] Change boolean argument to `HitResult` instead --- .../Gameplay/TestSceneDrainingHealthProcessor.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs b/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs index 56fb68ea27..a7cd567635 100644 --- a/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs +++ b/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs @@ -174,8 +174,9 @@ namespace osu.Game.Tests.Gameplay AddAssert("failed", () => processor.HasFailed); } - [Test] - public void TestMultipleFailConditions([Values] bool applyFirstCondition) + [TestCase(HitResult.Miss)] + [TestCase(HitResult.Meh)] + public void TestMultipleFailConditions(HitResult resultApplied) { var beatmap = createBeatmap(0, 1000); createProcessor(beatmap); @@ -189,11 +190,7 @@ namespace osu.Game.Tests.Gameplay AddStep("apply perfect hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Perfect })); AddAssert("not failed", () => !processor.HasFailed); - if (applyFirstCondition) - AddStep("apply miss hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Miss })); - else - AddStep("apply meh hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Meh })); - + AddStep($"apply {resultApplied.ToString().ToLower()} hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Miss })); AddAssert("failed", () => processor.HasFailed); } From 8842847b1850e574f95e537fba07684ff9523c23 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 27 Apr 2022 00:05:49 +0300 Subject: [PATCH 0508/2328] Fix wrong result applied --- osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs b/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs index a7cd567635..a354464a8e 100644 --- a/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs +++ b/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs @@ -190,7 +190,7 @@ namespace osu.Game.Tests.Gameplay AddStep("apply perfect hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Perfect })); AddAssert("not failed", () => !processor.HasFailed); - AddStep($"apply {resultApplied.ToString().ToLower()} hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Miss })); + AddStep($"apply {resultApplied.ToString().ToLower()} hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = resultApplied })); AddAssert("failed", () => processor.HasFailed); } From a849bfcf60523da4b7b69d1ce92325cd75a71f7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 26 Apr 2022 23:11:38 +0200 Subject: [PATCH 0509/2328] Rewrite dim test to pass headless Unfortunately neuters the test a touch, but alas. --- .../UserInterface/TestSceneModSelectScreen.cs | 28 +++++++++---------- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 +- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index d7ae131372..ec6e962c6a 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -119,25 +119,23 @@ namespace osu.Game.Tests.Visual.UserInterface AddUntilStep("any column dimmed", () => this.ChildrenOfType().Any(column => !column.Active.Value)); - ModColumn firstDimmed = null; - ModPanel firstPanel = null; + ModColumn lastColumn = null; - AddStep("click first panel on dimmed column", () => + AddAssert("last column dimmed", () => !this.ChildrenOfType().Last().Active.Value); + AddStep("request scroll to last column", () => { - firstDimmed = this.ChildrenOfType().First(column => !column.Active.Value); - firstPanel = firstDimmed.ChildrenOfType().First(); - InputManager.MoveMouseTo(firstPanel); + var lastDimContainer = this.ChildrenOfType().Last(); + lastColumn = lastDimContainer.Column; + lastDimContainer.RequestScroll?.Invoke(lastDimContainer); + }); + AddUntilStep("column undimmed", () => lastColumn.Active.Value); + + AddStep("click panel", () => + { + InputManager.MoveMouseTo(lastColumn.ChildrenOfType().First()); InputManager.Click(MouseButton.Left); }); - AddUntilStep("column undimmed", () => firstDimmed.Active.Value); - AddAssert("panel not selected", () => !firstPanel.Active.Value); - - AddStep("click panel again", () => - { - InputManager.MoveMouseTo(firstPanel); - InputManager.Click(MouseButton.Left); - }); - AddUntilStep("panel selected", () => firstPanel.Active.Value); + AddUntilStep("panel selected", () => lastColumn.ChildrenOfType().First().Active.Value); } [Test] diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 76f4a8cdd4..e28b46436c 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -394,7 +394,7 @@ namespace osu.Game.Overlays.Mods } } - private class ColumnDimContainer : Container + internal class ColumnDimContainer : Container { public ModColumn Column { get; } From 0343687b85fd00349056b06da0ef3fda63317e4c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Apr 2022 15:59:39 +0900 Subject: [PATCH 0510/2328] Make apply default methods more explicit in behaviour --- .../Overlays/FirstRunSetup/ScreenBehaviour.cs | 9 +++++---- osu.Game/Overlays/Settings/ISettingsItem.cs | 15 +++++++++++--- osu.Game/Overlays/Settings/SettingsItem.cs | 20 +++++++++---------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs index 61177c821b..1316d14302 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -91,14 +92,14 @@ namespace osu.Game.Overlays.FirstRunSetup private void applyClassic() { - foreach (var i in searchContainer.ChildrenOfType()) - i.ApplyClassicDefault(true); + foreach (var i in searchContainer.ChildrenOfType().Where(s => s.HasClassicDefault)) + i.ApplyClassicDefault(); } private void applyStandard() { - foreach (var i in searchContainer.ChildrenOfType()) - i.ApplyClassicDefault(false); + foreach (var i in searchContainer.ChildrenOfType().Where(s => s.HasClassicDefault)) + i.ApplyDefault(); } } } diff --git a/osu.Game/Overlays/Settings/ISettingsItem.cs b/osu.Game/Overlays/Settings/ISettingsItem.cs index e6b1e68741..61191dcacf 100644 --- a/osu.Game/Overlays/Settings/ISettingsItem.cs +++ b/osu.Game/Overlays/Settings/ISettingsItem.cs @@ -11,9 +11,18 @@ namespace osu.Game.Overlays.Settings event Action SettingChanged; /// - /// Apply the default values of a setting item, if the setting item specifies a "classic" default via . + /// Whether this setting has a classic default (ie. a different default which better aligns with osu-stable expectations). /// - /// Whether to apply the classic value. If false, the standard default is applied. - void ApplyClassicDefault(bool useClassicDefault); + bool HasClassicDefault { get; } + + /// + /// Apply the classic default value of the associated setting. Will throw if is false. + /// + void ApplyClassicDefault(); + + /// + /// Apply the default value of the associated setting. + /// + void ApplyDefault(); } } diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 3c755ab570..afcd41af22 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -107,7 +107,7 @@ namespace osu.Game.Overlays.Settings LabelText.ToString() }; - if (hasClassicDefault) + if (HasClassicDefault) keywords.Add(CLASSIC_DEFAULT_SEARCH_TERM); return keywords; @@ -139,7 +139,8 @@ namespace osu.Game.Overlays.Settings public event Action SettingChanged; private T classicDefault; - private bool hasClassicDefault; + + public bool HasClassicDefault { get; private set; } /// /// A "classic" default value for this setting. @@ -149,21 +150,20 @@ namespace osu.Game.Overlays.Settings set { classicDefault = value; - hasClassicDefault = true; + HasClassicDefault = true; } } - public void ApplyClassicDefault(bool useClassicDefault) + public void ApplyClassicDefault() { - if (!hasClassicDefault) - return; + if (!HasClassicDefault) + throw new InvalidOperationException($"Cannot apply a classic default to a setting which doesn't have one defined via {nameof(ClassicDefault)}."); - if (useClassicDefault) - Current.Value = classicDefault; - else - Current.SetDefault(); + Current.Value = classicDefault; } + public void ApplyDefault() => Current.SetDefault(); + protected SettingsItem() { RelativeSizeAxes = Axes.X; From 0354dd5ce623830c0061e5414f59ba0372fe270e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Apr 2022 16:02:39 +0900 Subject: [PATCH 0511/2328] Add comment regarding section initialisation in `ScreenBehaviour` --- osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs | 2 ++ osu.Game/Overlays/SettingsOverlay.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs index 1316d14302..db7659e87a 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs @@ -74,8 +74,10 @@ namespace osu.Game.Overlays.FirstRunSetup AutoSizeAxes = Axes.Y, Children = new SettingsSection[] { + // This list should be kept in sync with SettingsOverlay. new GeneralSection(), new SkinSection(), + // InputSection is intentionally omitted for now due to its sub-panel being a pain to set up. new UserInterfaceSection(), new GameplaySection(), new RulesetSection(), diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index c84cba8189..7cd8fc6d66 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -23,6 +23,7 @@ namespace osu.Game.Overlays protected override IEnumerable CreateSections() => new SettingsSection[] { + // This list should be kept in sync with ScreenBehaviour. new GeneralSection(), new SkinSection(), new InputSection(createSubPanel(new KeyBindingPanel())), From b29af28028a172ed3ad756f5272a2286eecd833c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Apr 2022 16:55:15 +0900 Subject: [PATCH 0512/2328] Fix mod panels not ignoring super key presses Most other usages have this included. Noticed that the panel was changing state when exiting the game using cmd-w. Would probably be nice to have an exposed `HasAnyModifierPressed` helper property. --- osu.Game/Overlays/Mods/ModColumn.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 1157c0c0c6..6a2c2adcba 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -441,7 +441,7 @@ namespace osu.Game.Overlays.Mods protected override bool OnKeyDown(KeyDownEvent e) { - if (e.ControlPressed || e.AltPressed) return false; + if (e.ControlPressed || e.AltPressed || e.SuperPressed) return false; if (toggleKeys == null) return false; int index = Array.IndexOf(toggleKeys, e.Key); From 1a345c06c6c92c20593bb1f413e267498e2f2bfa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Apr 2022 17:10:27 +0900 Subject: [PATCH 0513/2328] Fix regression in nested scroll behaviour due to the top level scroll container's type changing --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 4 ++-- osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index e28b46436c..a47a399a23 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -320,7 +320,7 @@ namespace osu.Game.Overlays.Mods } } - private class ColumnScrollContainer : OsuScrollContainer + internal class ColumnScrollContainer : OsuScrollContainer { public ColumnScrollContainer() : base(Direction.Horizontal) @@ -358,7 +358,7 @@ namespace osu.Game.Overlays.Mods } } - private class ColumnFlowContainer : FillFlowContainer + internal class ColumnFlowContainer : FillFlowContainer { public IEnumerable Columns => Children.Select(dimWrapper => dimWrapper.Column); diff --git a/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs b/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs index aba47d5423..d27f97f3d2 100644 --- a/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs +++ b/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs @@ -14,13 +14,13 @@ namespace osu.Game.Overlays.Mods /// public class NestedVerticalScrollContainer : OsuScrollContainer { - private OsuScrollContainer? parentScrollContainer; + private ModSelectScreen.ColumnScrollContainer? parentScrollContainer; protected override void LoadComplete() { base.LoadComplete(); - parentScrollContainer = this.FindClosestParent(); + parentScrollContainer = this.FindClosestParent(); } protected override bool OnScroll(ScrollEvent e) From 7a23363d74ceed68fe84731c84f38e286d0d6f8c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Apr 2022 18:10:58 +0900 Subject: [PATCH 0514/2328] Add migration of song progress setting from config to component --- osu.Game/Configuration/OsuConfigManager.cs | 4 ++ osu.Game/Screens/Play/SongProgress.cs | 56 ++++++++++++++++++++-- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index bee4f914ce..64e77384a2 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -116,6 +116,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.HitLighting, true); SetDefault(OsuSetting.HUDVisibilityMode, HUDVisibilityMode.Always); + SetDefault(OsuSetting.ShowProgressGraph, true); SetDefault(OsuSetting.ShowHealthDisplayWhenCantFail, true); SetDefault(OsuSetting.FadePlayfieldWhenHealthLow, true); SetDefault(OsuSetting.KeyOverlay, false); @@ -274,6 +275,9 @@ namespace osu.Game.Configuration AlwaysPlayFirstComboBreak, FloatingComments, HUDVisibilityMode, + + // This has been migrated to the component itself. can be removed 20221027. + ShowProgressGraph, ShowHealthDisplayWhenCantFail, FadePlayfieldWhenHealthLow, MouseDisableButtons, diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 9470c60fe6..592071b02e 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -1,20 +1,20 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osuTK; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using System; using System.Collections.Generic; -using osu.Game.Graphics; -using osu.Framework.Allocation; using System.Linq; +using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Timing; using osu.Game.Configuration; +using osu.Game.Graphics; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI; using osu.Game.Skinning; +using osuTK; namespace osu.Game.Screens.Play { @@ -139,6 +139,52 @@ namespace osu.Game.Screens.Play AllowSeeking.BindValueChanged(_ => updateBarVisibility(), true); ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true); + + migrateSettingFromConfig(); + } + + [Resolved] + private OsuConfigManager config { get; set; } + + [Resolved] + private SkinManager skinManager { get; set; } + + /// + /// This setting has been migrated to a per-component level. + /// Only take the value from the config if it is in a non-default state (then reset it to default so it only applies once). + /// + /// Can be removed 20221027. + /// + private void migrateSettingFromConfig() + { + Bindable configShowGraph = config.GetBindable(OsuSetting.ShowProgressGraph); + + if (!configShowGraph.IsDefault) + { + ShowGraph.Value = configShowGraph.Value; + configShowGraph.SetDefault(); + + // This is pretty ugly, but the only way to make this stick... + if (skinManager != null) + { + var skinnableTarget = this.FindClosestParent(); + + if (skinnableTarget != null) + { + skinManager.EnsureMutableSkin(); + + // If `EnsureMutableSkin` actually changed the skin, default layout may take a frame to apply. + // See `SkinnableTargetComponentsContainer`'s use of ScheduleAfterChildren. + ScheduleAfterChildren(() => + { + var skin = skinManager.CurrentSkin.Value; + skin.UpdateDrawableTarget(skinnableTarget); + + skinManager.Save(skin); + }); + } + } + } } protected override void PopIn() From 20a50ddb6e0639adc5980a4e2c6c85ad2c4d13aa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Apr 2022 18:45:40 +0900 Subject: [PATCH 0515/2328] Add missing `OverlayColourProvider` in test scene --- .../Visual/UserInterface/TestSceneFirstRunScreenUIScale.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenUIScale.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenUIScale.cs index 5ca09b34aa..64ad4ff119 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenUIScale.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenUIScale.cs @@ -1,13 +1,18 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; using osu.Framework.Screens; +using osu.Game.Overlays; using osu.Game.Overlays.FirstRunSetup; namespace osu.Game.Tests.Visual.UserInterface { public class TestSceneFirstRunScreenUIScale : OsuManualInputManagerTestScene { + [Cached] + private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); + public TestSceneFirstRunScreenUIScale() { AddStep("load screen", () => From e9ec406046033632a19d062e6b4cd7ae2bd86514 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Apr 2022 19:20:08 +0900 Subject: [PATCH 0516/2328] Remove weird code --- osu.Game/Beatmaps/Drawables/DownloadProgressBar.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/DownloadProgressBar.cs b/osu.Game/Beatmaps/Drawables/DownloadProgressBar.cs index 54dcdc55e3..ad0ff876e8 100644 --- a/osu.Game/Beatmaps/Drawables/DownloadProgressBar.cs +++ b/osu.Game/Beatmaps/Drawables/DownloadProgressBar.cs @@ -28,11 +28,6 @@ namespace osu.Game.Beatmaps.Drawables }, downloadTracker = new BeatmapDownloadTracker(beatmapSet), }; - AddInternal(progressBar = new ProgressBar(false) - { - Height = 0, - Alpha = 0, - }); AutoSizeAxes = Axes.Y; RelativeSizeAxes = Axes.X; From 66c730c382cdd9ab74f74053e043b385e17586a6 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 27 Apr 2022 17:11:23 +0300 Subject: [PATCH 0517/2328] Change distance spacing keybind to Ctrl+Alt --- osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs | 5 ++--- osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs b/osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs index 542f98207e..17232db509 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs @@ -12,7 +12,6 @@ using osu.Game.Overlays.Settings.Sections; using osu.Game.Rulesets.Edit; using osu.Game.Screens.Edit; using osuTK; -using osuTK.Input; namespace osu.Game.Rulesets.Osu.Edit { @@ -74,7 +73,7 @@ namespace osu.Game.Rulesets.Osu.Edit protected override bool OnKeyDown(KeyDownEvent e) { - if (e.AltPressed && e.Key == Key.D && !e.Repeat) + if (e.ControlPressed && e.AltPressed && !e.Repeat) { expandingContainer.Expanded.Value = true; distanceSpacingScrollActive = true; @@ -86,7 +85,7 @@ namespace osu.Game.Rulesets.Osu.Edit protected override void OnKeyUp(KeyUpEvent e) { - if (distanceSpacingScrollActive && (!e.AltPressed || e.Key == Key.D)) + if (distanceSpacingScrollActive && (!e.AltPressed || !e.ControlPressed)) { expandingContainer.Expanded.Value = false; distanceSpacingScrollActive = false; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs index d542732e19..7039d7d8a4 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs @@ -95,14 +95,14 @@ namespace osu.Game.Tests.Visual.Editing AddStep("retrieve original spacing", () => originalSpacing = (float)editorBeatmap.BeatmapInfo.DistanceSpacing); + AddStep("hold ctrl", () => InputManager.PressKey(Key.LControl)); AddStep("hold alt", () => InputManager.PressKey(Key.LAlt)); - AddStep("hold D", () => InputManager.PressKey(Key.D)); AddStep("scroll mouse 5 steps", () => InputManager.ScrollVerticalBy(5)); AddAssert("distance spacing increased by 0.5", () => Precision.AlmostEquals(editorBeatmap.BeatmapInfo.DistanceSpacing, originalSpacing + 0.5f)); AddStep("release alt", () => InputManager.ReleaseKey(Key.LAlt)); - AddStep("release D", () => InputManager.ReleaseKey(Key.D)); + AddStep("release ctrl", () => InputManager.ReleaseKey(Key.LControl)); } public class EditorBeatmapContainer : Container From 59cf3ff50fad705e477d8b00c6fcfed55550e387 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 05:48:45 +0300 Subject: [PATCH 0518/2328] Move distancing methods from `IPositionSnapProvider` to `IDistanceSnapProvider` --- .../Editor/TestSceneManiaBeatSnapGrid.cs | 26 ----------- .../Components/PathControlPointVisualiser.cs | 2 +- .../Sliders/SliderPlacementBlueprint.cs | 4 +- .../Sliders/SliderSelectionBlueprint.cs | 6 +-- .../Edit/OsuSelectionHandler.cs | 6 +-- .../Rulesets/Edit/IDistanceSnapProvider.cs | 41 ++++++++++++++++++ .../Rulesets/Edit/IPositionSnapProvider.cs | 43 ------------------- .../Rulesets/Objects/SliderPathExtensions.cs | 2 +- .../Compose/Components/Timeline/Timeline.cs | 13 ------ 9 files changed, 51 insertions(+), 92 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs index 50be13c4e0..2e55f86bb6 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs @@ -13,7 +13,6 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Edit; using osu.Game.Rulesets.Mania.UI; -using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; @@ -107,30 +106,5 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor { throw new System.NotImplementedException(); } - - public override float GetBeatSnapDistanceAt(HitObject referenceObject) - { - throw new System.NotImplementedException(); - } - - public override float DurationToDistance(HitObject referenceObject, double duration) - { - throw new System.NotImplementedException(); - } - - public override double DistanceToDuration(HitObject referenceObject, float distance) - { - throw new System.NotImplementedException(); - } - - public override double GetSnappedDurationFromDistance(HitObject referenceObject, float distance) - { - throw new System.NotImplementedException(); - } - - public override float GetSnappedDistanceFromDistance(HitObject referenceObject, float distance) - { - throw new System.NotImplementedException(); - } } } diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs index ae4141073e..5de614722f 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs @@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components public Action> RemoveControlPointsRequested; [Resolved(CanBeNull = true)] - private IPositionSnapProvider snapProvider { get; set; } + private IDistanceSnapProvider snapProvider { get; set; } public PathControlPointVisualiser(Slider slider, bool allowSelection) { diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs index b868c9a7ee..73a4ea5434 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders private int currentSegmentLength; [Resolved(CanBeNull = true)] - private HitObjectComposer composer { get; set; } + private IDistanceSnapProvider snapProvider { get; set; } public SliderPlacementBlueprint() : base(new Objects.Slider()) @@ -220,7 +220,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders private void updateSlider() { - HitObject.Path.ExpectedDistance.Value = composer?.GetSnappedDistanceFromDistance(HitObject, (float)HitObject.Path.CalculatedDistance) ?? (float)HitObject.Path.CalculatedDistance; + HitObject.Path.ExpectedDistance.Value = snapProvider?.GetSnappedDistanceFromDistance(HitObject, (float)HitObject.Path.CalculatedDistance) ?? (float)HitObject.Path.CalculatedDistance; bodyPiece.UpdateFrom(HitObject); headCirclePiece.UpdateFrom(HitObject.HeadCircle); diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs index 6cf2a493a9..a019f2fb64 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders protected PathControlPointVisualiser ControlPointVisualiser { get; private set; } [Resolved(CanBeNull = true)] - private HitObjectComposer composer { get; set; } + private IDistanceSnapProvider snapProvider { get; set; } [Resolved(CanBeNull = true)] private IPlacementHandler placementHandler { get; set; } @@ -208,7 +208,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders // Move the control points from the insertion index onwards to make room for the insertion controlPoints.Insert(insertionIndex, pathControlPoint); - HitObject.SnapTo(composer); + HitObject.SnapTo(snapProvider); return pathControlPoint; } @@ -230,7 +230,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders } // Snap the slider to the current beat divisor before checking length validity. - HitObject.SnapTo(composer); + HitObject.SnapTo(snapProvider); // If there are 0 or 1 remaining control points, or the slider has an invalid length, it is in a degenerate form and should be deleted if (controlPoints.Count <= 1 || !HitObject.Path.HasValidLength) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuSelectionHandler.cs b/osu.Game.Rulesets.Osu/Edit/OsuSelectionHandler.cs index efbac5439c..70c60ab635 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuSelectionHandler.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuSelectionHandler.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Edit public class OsuSelectionHandler : EditorSelectionHandler { [Resolved(CanBeNull = true)] - private IPositionSnapProvider? positionSnapProvider { get; set; } + private IDistanceSnapProvider? snapProvider { get; set; } /// /// During a transform, the initial origin is stored so it can be used throughout the operation. @@ -206,7 +206,7 @@ namespace osu.Game.Rulesets.Osu.Edit // Snap the slider's length to the current beat divisor // to calculate the final resulting duration / bounding box before the final checks. - slider.SnapTo(positionSnapProvider); + slider.SnapTo(snapProvider); //if sliderhead or sliderend end up outside playfield, revert scaling. Quad scaledQuad = getSurroundingQuad(new OsuHitObject[] { slider }); @@ -219,7 +219,7 @@ namespace osu.Game.Rulesets.Osu.Edit point.Position = oldControlPoints.Dequeue(); // Snap the slider's length again to undo the potentially-invalid length applied by the previous snap. - slider.SnapTo(positionSnapProvider); + slider.SnapTo(snapProvider); } private void scaleHitObjects(OsuHitObject[] hitObjects, Anchor reference, Vector2 scale) diff --git a/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs index 70921a6170..c6e866561e 100644 --- a/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs @@ -3,6 +3,7 @@ using osu.Framework.Bindables; using osu.Game.Beatmaps; +using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Edit { @@ -13,5 +14,45 @@ namespace osu.Game.Rulesets.Edit /// /// IBindable DistanceSpacingMultiplier { get; } + + /// + /// Retrieves the distance between two points within a timing point that are one beat length apart. + /// + /// An object to be used as a reference point for this operation. + /// The distance between two points residing in the timing point that are one beat length apart. + float GetBeatSnapDistanceAt(HitObject referenceObject); + + /// + /// Converts a duration to a distance. + /// + /// An object to be used as a reference point for this operation. + /// The duration to convert. + /// A value that represents as a distance in the timing point. + float DurationToDistance(HitObject referenceObject, double duration); + + /// + /// Converts a distance to a duration. + /// + /// An object to be used as a reference point for this operation. + /// The distance to convert. + /// A value that represents as a duration in the timing point. + double DistanceToDuration(HitObject referenceObject, float distance); + + /// + /// Converts a distance to a snapped duration. + /// + /// An object to be used as a reference point for this operation. + /// The distance to convert. + /// A value that represents as a duration snapped to the closest beat of the timing point. + double GetSnappedDurationFromDistance(HitObject referenceObject, float distance); + + /// + /// Converts an unsnapped distance to a snapped distance. + /// The returned distance will always be floored (as to never exceed the provided . + /// + /// An object to be used as a reference point for this operation. + /// The distance to convert. + /// A value that represents snapped to the closest beat of the timing point. + float GetSnappedDistanceFromDistance(HitObject referenceObject, float distance); } } diff --git a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs index 944619a3ca..8a179ed424 100644 --- a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs @@ -1,7 +1,6 @@ // 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.Rulesets.Objects; using osuTK; namespace osu.Game.Rulesets.Edit @@ -24,47 +23,5 @@ namespace osu.Game.Rulesets.Edit /// The screen-space position to be snapped. /// The position post-snapping. Time will always be null. SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition); - - /// - /// Retrieves the distance between two points within a timing point that are one beat length apart. - /// - /// An object to be used as a reference point for this operation. - /// The distance between two points residing in the timing point that are one beat length apart. - // todo: this, and other distance-related methods below it, should move to IDistanceSnapProvider. - // needs thought on how to properly share implementation, since not all composers inherit IDistanceSnapProvider. - float GetBeatSnapDistanceAt(HitObject referenceObject); - - /// - /// Converts a duration to a distance. - /// - /// An object to be used as a reference point for this operation. - /// The duration to convert. - /// A value that represents as a distance in the timing point. - float DurationToDistance(HitObject referenceObject, double duration); - - /// - /// Converts a distance to a duration. - /// - /// An object to be used as a reference point for this operation. - /// The distance to convert. - /// A value that represents as a duration in the timing point. - double DistanceToDuration(HitObject referenceObject, float distance); - - /// - /// Converts a distance to a snapped duration. - /// - /// An object to be used as a reference point for this operation. - /// The distance to convert. - /// A value that represents as a duration snapped to the closest beat of the timing point. - double GetSnappedDurationFromDistance(HitObject referenceObject, float distance); - - /// - /// Converts an unsnapped distance to a snapped distance. - /// The returned distance will always be floored (as to never exceed the provided . - /// - /// An object to be used as a reference point for this operation. - /// The distance to convert. - /// A value that represents snapped to the closest beat of the timing point. - float GetSnappedDistanceFromDistance(HitObject referenceObject, float distance); } } diff --git a/osu.Game/Rulesets/Objects/SliderPathExtensions.cs b/osu.Game/Rulesets/Objects/SliderPathExtensions.cs index ba614900c0..3100d26a55 100644 --- a/osu.Game/Rulesets/Objects/SliderPathExtensions.cs +++ b/osu.Game/Rulesets/Objects/SliderPathExtensions.cs @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Objects /// /// Snaps the provided 's duration using the . /// - public static void SnapTo(this THitObject hitObject, IPositionSnapProvider? snapProvider) + public static void SnapTo(this THitObject hitObject, IDistanceSnapProvider? snapProvider) where THitObject : HitObject, IHasPath { hitObject.Path.ExpectedDistance.Value = snapProvider?.GetSnappedDistanceFromDistance(hitObject, (float)hitObject.Path.CalculatedDistance) ?? hitObject.Path.CalculatedDistance; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index 8832c4e89c..c2b2bdb861 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -15,7 +15,6 @@ using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Objects; using osuTK; namespace osu.Game.Screens.Edit.Compose.Components.Timeline @@ -316,17 +315,5 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline private double getTimeFromPosition(Vector2 localPosition) => (localPosition.X / Content.DrawWidth) * track.Length; - - public IBindable DistanceSpacingMultiplier => throw new NotImplementedException(); - - public float GetBeatSnapDistanceAt(HitObject referenceObject) => throw new NotImplementedException(); - - public float DurationToDistance(HitObject referenceObject, double duration) => throw new NotImplementedException(); - - public double DistanceToDuration(HitObject referenceObject, float distance) => throw new NotImplementedException(); - - public double GetSnappedDurationFromDistance(HitObject referenceObject, float distance) => throw new NotImplementedException(); - - public float GetSnappedDistanceFromDistance(HitObject referenceObject, float distance) => throw new NotImplementedException(); } } From d6395b14beae1116a3b7271363136c89642a1b98 Mon Sep 17 00:00:00 2001 From: Pasi4K5 Date: Thu, 28 Apr 2022 05:15:04 +0200 Subject: [PATCH 0519/2328] Add incompatibilities --- osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs | 10 +++++++++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs b/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs index f46573c494..5d262cd95e 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public class OsuModClassic : ModClassic, IApplicableToHitObject, IApplicableToDrawableHitObject, IApplicableToDrawableRuleset { - public override Type[] IncompatibleMods => new[] { typeof(OsuModStrictTracking) }; + public override Type[] IncompatibleMods => new[] { typeof(OsuModStrictTracking), typeof(OsuModTarget) }; [SettingSource("No slider head accuracy requirement", "Scores sliders proportionally to the number of ticks hit.")] public Bindable NoSliderHeadAccuracy { get; } = new BindableBool(true); diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs index fea9246035..7a7e189c29 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs @@ -22,6 +22,8 @@ namespace osu.Game.Rulesets.Osu.Mods { public override string Description => "It never gets boring!"; + public override Type[] IncompatibleMods => new[] { typeof(OsuModTarget) }; + private static readonly float playfield_diagonal = OsuPlayfield.BASE_SIZE.LengthFast; private Random? rng; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs b/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs index 9be0dc748a..d9ab749ad3 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Automation; public override string Description => @"Spinners will be automatically completed."; public override double ScoreMultiplier => 0.9; - public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(OsuModAutopilot) }; + public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(OsuModAutopilot), typeof(OsuModTarget) }; public void ApplyToDrawableHitObject(DrawableHitObject hitObject) { diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs b/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs index ee325db66a..ab45e5192d 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.DifficultyIncrease; public override string Description => @"Follow circles just got serious..."; public override double ScoreMultiplier => 1.0; - public override Type[] IncompatibleMods => new[] { typeof(ModClassic) }; + public override Type[] IncompatibleMods => new[] { typeof(ModClassic), typeof(OsuModTarget) }; public void ApplyToDrawableHitObject(DrawableHitObject drawable) { diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs index 4fab9b6a5a..4d6c09f919 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs @@ -42,7 +42,15 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => @"Practice keeping up with the beat of the song."; public override double ScoreMultiplier => 1; - public override Type[] IncompatibleMods => new[] { typeof(IRequiresApproachCircles), typeof(OsuModSuddenDeath) }; + public override Type[] IncompatibleMods => new[] + { + typeof(IRequiresApproachCircles), + typeof(OsuModClassic), + typeof(OsuModRandom), + typeof(OsuModSpunOut), + typeof(OsuModStrictTracking), + typeof(OsuModSuddenDeath) + }; [SettingSource("Seed", "Use a custom seed instead of a random one", SettingControlType = typeof(SettingsNumberBox))] public Bindable Seed { get; } = new Bindable From 835898dd30ae70170a6670178d19397d7a057361 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 05:49:37 +0300 Subject: [PATCH 0520/2328] Introduce `DistancedHitObjectComposer` and supersede `OsuToolboxComposite` --- .../Editor/TestSceneObjectObjectSnap.cs | 4 +- .../Editor/TestSceneSliderSnapping.cs | 3 +- .../Edit/OsuHitObjectComposer.cs | 12 +- .../Edit/OsuToolboxComposite.cs | 120 ------------- .../Edit/DistancedHitObjectComposer.cs | 158 ++++++++++++++++++ osu.Game/Rulesets/Edit/HitObjectComposer.cs | 48 ------ 6 files changed, 163 insertions(+), 182 deletions(-) delete mode 100644 osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs create mode 100644 osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs index 954bb53dd5..dfb6ecfcae 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs @@ -7,7 +7,7 @@ using osu.Framework.Bindables; using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Beatmaps; -using osu.Game.Rulesets.Osu.Edit; +using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.UI; using osu.Game.Tests.Beatmaps; @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor AddStep("seek to first control point", () => EditorClock.Seek(Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints.First().Time)); AddStep("set distance spacing to 1", () => { - var distanceSpacing = (BindableDouble)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; + var distanceSpacing = (BindableDouble)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; distanceSpacing.Value = 1; }); } diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs index 2632e556c6..702e2216ac 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs @@ -11,6 +11,7 @@ using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Input.Bindings; +using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components; @@ -68,7 +69,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor }); AddStep("set distance spacing to 1", () => { - var distanceSpacing = (BindableDouble)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; + var distanceSpacing = (BindableDouble)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; distanceSpacing.Value = 1; }); } diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index a52c916ca0..bd26a99e51 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -24,13 +24,8 @@ using osuTK; namespace osu.Game.Rulesets.Osu.Edit { - [Cached(typeof(IDistanceSnapProvider))] - public class OsuHitObjectComposer : HitObjectComposer, IDistanceSnapProvider + public class OsuHitObjectComposer : DistancedHitObjectComposer { - private OsuToolboxComposite osuToolboxComposite; - - public IBindable DistanceSpacingMultiplier => osuToolboxComposite.DistanceSpacing; - public OsuHitObjectComposer(Ruleset ruleset) : base(ruleset) { @@ -79,8 +74,6 @@ namespace osu.Game.Rulesets.Osu.Edit } }); - AddInternal(osuToolboxComposite = new OsuToolboxComposite()); - selectedHitObjects = EditorBeatmap.SelectedHitObjects.GetBoundCopy(); selectedHitObjects.CollectionChanged += (_, __) => updateDistanceSnapGrid(); @@ -135,9 +128,6 @@ namespace osu.Game.Rulesets.Osu.Edit } } - public override float GetBeatSnapDistanceAt(HitObject referenceObject) - => (float)(base.GetBeatSnapDistanceAt(referenceObject) * DistanceSpacingMultiplier.Value); - public override SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) { if (snapToVisibleBlueprints(screenSpacePosition, out var snapResult)) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs b/osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs deleted file mode 100644 index 17232db509..0000000000 --- a/osu.Game.Rulesets.Osu/Edit/OsuToolboxComposite.cs +++ /dev/null @@ -1,120 +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.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Input.Events; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.UserInterface; -using osu.Game.Overlays.Settings.Sections; -using osu.Game.Rulesets.Edit; -using osu.Game.Screens.Edit; -using osuTK; - -namespace osu.Game.Rulesets.Osu.Edit -{ - /// - /// A toolbox composite for osu!-specific controls. - /// - // todo: once catch supports distance spacing, the control here should move out to a base "DistancingRulesetToolboxComposite" class or something better. - public class OsuToolboxComposite : CompositeDrawable - { - private ExpandingToolboxContainer expandingContainer; - private ExpandableSlider> distanceSpacingSlider; - - private readonly Bindable distanceSpacing = new BindableDouble(1.0) - { - MinValue = 0.1, - MaxValue = 6.0, - Precision = 0.01, - }; - - public IBindable DistanceSpacing => distanceSpacing; - - private bool distanceSpacingScrollActive; - - [Resolved] - private EditorBeatmap editorBeatmap { get; set; } - - [BackgroundDependencyLoader] - private void load() - { - RelativeSizeAxes = Axes.Both; - - InternalChild = expandingContainer = new ExpandingToolboxContainer - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Child = new EditorToolboxGroup("snapping") - { - Child = distanceSpacingSlider = new ExpandableSlider> - { - Current = { BindTarget = distanceSpacing }, - KeyboardStep = 0.1f, - } - } - }; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - distanceSpacing.Value = editorBeatmap.BeatmapInfo.DistanceSpacing; - distanceSpacing.BindValueChanged(v => - { - distanceSpacingSlider.ContractedLabelText = $"D. S. ({v.NewValue:0.##x})"; - distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({v.NewValue:0.##x})"; - editorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue; - }, true); - } - - protected override bool OnKeyDown(KeyDownEvent e) - { - if (e.ControlPressed && e.AltPressed && !e.Repeat) - { - expandingContainer.Expanded.Value = true; - distanceSpacingScrollActive = true; - return true; - } - - return base.OnKeyDown(e); - } - - protected override void OnKeyUp(KeyUpEvent e) - { - if (distanceSpacingScrollActive && (!e.AltPressed || !e.ControlPressed)) - { - expandingContainer.Expanded.Value = false; - distanceSpacingScrollActive = false; - } - } - - protected override bool OnScroll(ScrollEvent e) - { - if (distanceSpacingScrollActive) - { - distanceSpacing.Value += e.ScrollDelta.Y * (e.IsPrecise ? 0.01f : 0.1f); - return true; - } - - return base.OnScroll(e); - } - - private class ExpandingToolboxContainer : ExpandingContainer - { - protected override double HoverExpansionDelay => 250; - - public ExpandingToolboxContainer() - : base(130, 250) - { - RelativeSizeAxes = Axes.Y; - Padding = new MarginPadding { Left = 10 }; - - FillFlow.Spacing = new Vector2(10); - } - } - } -} diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs new file mode 100644 index 0000000000..a3624f6d77 --- /dev/null +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -0,0 +1,158 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Input.Events; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Settings.Sections; +using osu.Game.Rulesets.Objects; +using osuTK; + +namespace osu.Game.Rulesets.Edit +{ + /// + /// Represents a for rulesets with the concept of distances between objects. + /// + /// The base type of supported objects. + [Cached(typeof(IDistanceSnapProvider))] + public abstract class DistancedHitObjectComposer : HitObjectComposer, IDistanceSnapProvider + where TObject : HitObject + { + protected Bindable DistanceSpacingMultiplier { get; } = new BindableDouble(1.0) + { + MinValue = 0.1, + MaxValue = 6.0, + Precision = 0.01, + }; + + IBindable IDistanceSnapProvider.DistanceSpacingMultiplier => DistanceSpacingMultiplier; + + protected ExpandingToolboxContainer RightSideToolboxContainer { get; private set; } + + private ExpandableSlider> distanceSpacingSlider; + private bool distanceSpacingScrollActive; + + protected DistancedHitObjectComposer(Ruleset ruleset) + : base(ruleset) + { + } + + [BackgroundDependencyLoader] + private void load() + { + AddInternal(RightSideToolboxContainer = new ExpandingToolboxContainer + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Child = new EditorToolboxGroup("snapping") + { + Child = distanceSpacingSlider = new ExpandableSlider> + { + Current = { BindTarget = DistanceSpacingMultiplier }, + KeyboardStep = 0.1f, + } + } + }); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + DistanceSpacingMultiplier.Value = EditorBeatmap.BeatmapInfo.DistanceSpacing; + DistanceSpacingMultiplier.BindValueChanged(v => + { + distanceSpacingSlider.ContractedLabelText = $"D. S. ({v.NewValue:0.##x})"; + distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({v.NewValue:0.##x})"; + EditorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue; + }, true); + } + + protected override bool OnKeyDown(KeyDownEvent e) + { + if (e.ControlPressed && e.AltPressed && !e.Repeat) + { + RightSideToolboxContainer.Expanded.Value = true; + distanceSpacingScrollActive = true; + return true; + } + + return base.OnKeyDown(e); + } + + protected override void OnKeyUp(KeyUpEvent e) + { + if (distanceSpacingScrollActive && (!e.AltPressed || !e.ControlPressed)) + { + RightSideToolboxContainer.Expanded.Value = false; + distanceSpacingScrollActive = false; + } + } + + protected override bool OnScroll(ScrollEvent e) + { + if (distanceSpacingScrollActive) + { + DistanceSpacingMultiplier.Value += e.ScrollDelta.Y * (e.IsPrecise ? 0.01f : 0.1f); + return true; + } + + return base.OnScroll(e); + } + + public virtual float GetBeatSnapDistanceAt(HitObject referenceObject) + { + return (float)(100 * EditorBeatmap.Difficulty.SliderMultiplier * referenceObject.DifficultyControlPoint.SliderVelocity * DistanceSpacingMultiplier.Value / BeatSnapProvider.BeatDivisor); + } + + public virtual float DurationToDistance(HitObject referenceObject, double duration) + { + double beatLength = BeatSnapProvider.GetBeatLengthAtTime(referenceObject.StartTime); + return (float)(duration / beatLength * GetBeatSnapDistanceAt(referenceObject)); + } + + public virtual double DistanceToDuration(HitObject referenceObject, float distance) + { + double beatLength = BeatSnapProvider.GetBeatLengthAtTime(referenceObject.StartTime); + return distance / GetBeatSnapDistanceAt(referenceObject) * beatLength; + } + + public virtual double GetSnappedDurationFromDistance(HitObject referenceObject, float distance) + => BeatSnapProvider.SnapTime(referenceObject.StartTime + DistanceToDuration(referenceObject, distance), referenceObject.StartTime) - referenceObject.StartTime; + + public virtual float GetSnappedDistanceFromDistance(HitObject referenceObject, float distance) + { + double startTime = referenceObject.StartTime; + + double actualDuration = startTime + DistanceToDuration(referenceObject, distance); + + double snappedEndTime = BeatSnapProvider.SnapTime(actualDuration, startTime); + + double beatLength = BeatSnapProvider.GetBeatLengthAtTime(startTime); + + // we don't want to exceed the actual duration and snap to a point in the future. + // as we are snapping to beat length via SnapTime (which will round-to-nearest), check for snapping in the forward direction and reverse it. + if (snappedEndTime > actualDuration + 1) + snappedEndTime -= beatLength; + + return DurationToDistance(referenceObject, snappedEndTime - startTime); + } + + protected class ExpandingToolboxContainer : ExpandingContainer + { + protected override double HoverExpansionDelay => 250; + + public ExpandingToolboxContainer() + : base(130, 250) + { + RelativeSizeAxes = Axes.Y; + Padding = new MarginPadding { Left = 10 }; + + FillFlow.Spacing = new Vector2(10); + } + } + } +} diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 8d2bd1e5d1..9fc332d726 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -383,44 +383,6 @@ namespace osu.Game.Rulesets.Edit return new SnapResult(screenSpacePosition, targetTime, playfield); } - public override float GetBeatSnapDistanceAt(HitObject referenceObject) - { - return (float)(100 * referenceObject.DifficultyControlPoint.SliderVelocity * EditorBeatmap.Difficulty.SliderMultiplier / BeatSnapProvider.BeatDivisor); - } - - public override float DurationToDistance(HitObject referenceObject, double duration) - { - double beatLength = BeatSnapProvider.GetBeatLengthAtTime(referenceObject.StartTime); - return (float)(duration / beatLength * GetBeatSnapDistanceAt(referenceObject)); - } - - public override double DistanceToDuration(HitObject referenceObject, float distance) - { - double beatLength = BeatSnapProvider.GetBeatLengthAtTime(referenceObject.StartTime); - return distance / GetBeatSnapDistanceAt(referenceObject) * beatLength; - } - - public override double GetSnappedDurationFromDistance(HitObject referenceObject, float distance) - => BeatSnapProvider.SnapTime(referenceObject.StartTime + DistanceToDuration(referenceObject, distance), referenceObject.StartTime) - referenceObject.StartTime; - - public override float GetSnappedDistanceFromDistance(HitObject referenceObject, float distance) - { - double startTime = referenceObject.StartTime; - - double actualDuration = startTime + DistanceToDuration(referenceObject, distance); - - double snappedEndTime = BeatSnapProvider.SnapTime(actualDuration, startTime); - - double beatLength = BeatSnapProvider.GetBeatLengthAtTime(startTime); - - // we don't want to exceed the actual duration and snap to a point in the future. - // as we are snapping to beat length via SnapTime (which will round-to-nearest), check for snapping in the forward direction and reverse it. - if (snappedEndTime > actualDuration + 1) - snappedEndTime -= beatLength; - - return DurationToDistance(referenceObject, snappedEndTime - startTime); - } - #endregion private class LeftToolboxFlow : ExpandingButtonContainer @@ -473,16 +435,6 @@ namespace osu.Game.Rulesets.Edit public virtual SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, null); - public abstract float GetBeatSnapDistanceAt(HitObject referenceObject); - - public abstract float DurationToDistance(HitObject referenceObject, double duration); - - public abstract double DistanceToDuration(HitObject referenceObject, float distance); - - public abstract double GetSnappedDurationFromDistance(HitObject referenceObject, float distance); - - public abstract float GetSnappedDistanceFromDistance(HitObject referenceObject, float distance); - #endregion } } From bfc6bfc91b19a1fc9fb57518e490b81d9c09b8c3 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 05:50:55 +0300 Subject: [PATCH 0521/2328] Let `CatchHitObjectComposer` inherit from `DistancedHitObjectComposer` and hide control --- .../Edit/CatchHitObjectComposer.cs | 9 +++++---- .../Edit/DistancedHitObjectComposer.cs | 20 +++++++++++-------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs index b3e6fe382a..a90b0d3e89 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs @@ -24,10 +24,7 @@ using osuTK; namespace osu.Game.Rulesets.Catch.Edit { - /// - /// todo: should inherit once it supports distance spacing properly. - /// - public class CatchHitObjectComposer : HitObjectComposer + public class CatchHitObjectComposer : DistancedHitObjectComposer { private const float distance_snap_radius = 50; @@ -45,6 +42,10 @@ namespace osu.Game.Rulesets.Catch.Edit [BackgroundDependencyLoader] private void load() { + // todo: enable distance spacing once catch supports it. + RightSideToolboxContainer.Alpha = 0; + DistanceSpacingMultiplier.Disabled = true; + LayerBelowRuleset.Add(new PlayfieldBorder { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index a3624f6d77..d0c9babf24 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -45,6 +45,7 @@ namespace osu.Game.Rulesets.Edit { AddInternal(RightSideToolboxContainer = new ExpandingToolboxContainer { + Alpha = DistanceSpacingMultiplier.Disabled ? 0 : 1, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Child = new EditorToolboxGroup("snapping") @@ -62,18 +63,21 @@ namespace osu.Game.Rulesets.Edit { base.LoadComplete(); - DistanceSpacingMultiplier.Value = EditorBeatmap.BeatmapInfo.DistanceSpacing; - DistanceSpacingMultiplier.BindValueChanged(v => + if (!DistanceSpacingMultiplier.Disabled) { - distanceSpacingSlider.ContractedLabelText = $"D. S. ({v.NewValue:0.##x})"; - distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({v.NewValue:0.##x})"; - EditorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue; - }, true); + DistanceSpacingMultiplier.Value = EditorBeatmap.BeatmapInfo.DistanceSpacing; + DistanceSpacingMultiplier.BindValueChanged(v => + { + distanceSpacingSlider.ContractedLabelText = $"D. S. ({v.NewValue:0.##x})"; + distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({v.NewValue:0.##x})"; + EditorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue; + }, true); + } } protected override bool OnKeyDown(KeyDownEvent e) { - if (e.ControlPressed && e.AltPressed && !e.Repeat) + if (!DistanceSpacingMultiplier.Disabled && e.ControlPressed && e.AltPressed && !e.Repeat) { RightSideToolboxContainer.Expanded.Value = true; distanceSpacingScrollActive = true; @@ -85,7 +89,7 @@ namespace osu.Game.Rulesets.Edit protected override void OnKeyUp(KeyUpEvent e) { - if (distanceSpacingScrollActive && (!e.AltPressed || !e.ControlPressed)) + if (!DistanceSpacingMultiplier.Disabled && distanceSpacingScrollActive && (!e.AltPressed || !e.ControlPressed)) { RightSideToolboxContainer.Expanded.Value = false; distanceSpacingScrollActive = false; From a5defbe4961b06d37a8a6c7f834196e00f63a806 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 06:44:02 +0300 Subject: [PATCH 0522/2328] Keep distance spacing reset to one on test scenes with slider snapping for now --- .../Editor/TestSceneObjectObjectSnap.cs | 12 ++++-------- .../Editor/TestSceneSliderSnapping.cs | 10 ++-------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs index dfb6ecfcae..21ba1e647d 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs @@ -3,11 +3,9 @@ using System.Linq; using NUnit.Framework; -using osu.Framework.Bindables; using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Beatmaps; -using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.UI; using osu.Game.Tests.Beatmaps; @@ -21,18 +19,16 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor { private OsuPlayfield playfield; - protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(Ruleset.Value, false); + protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(Ruleset.Value, false) + { + BeatmapInfo = { DistanceSpacing = 1 } + }; public override void SetUpSteps() { base.SetUpSteps(); AddStep("get playfield", () => playfield = Editor.ChildrenOfType().First()); AddStep("seek to first control point", () => EditorClock.Seek(Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints.First().Time)); - AddStep("set distance spacing to 1", () => - { - var distanceSpacing = (BindableDouble)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; - distanceSpacing.Value = 1; - }); } [TestCase(true)] diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs index 702e2216ac..4833266dca 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs @@ -4,14 +4,12 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Input.Events; using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Input.Bindings; -using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components; @@ -38,7 +36,8 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor controlPointInfo.Add(0, new TimingControlPoint { BeatLength = beat_length }); return new TestBeatmap(ruleset, false) { - ControlPointInfo = controlPointInfo + ControlPointInfo = controlPointInfo, + BeatmapInfo = { DistanceSpacing = 1 }, }; } @@ -67,11 +66,6 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor var beatDivisor = Editor.Dependencies.Get(); beatDivisor.Value = 1; }); - AddStep("set distance spacing to 1", () => - { - var distanceSpacing = (BindableDouble)Editor.ChildrenOfType().Single().DistanceSpacingMultiplier; - distanceSpacing.Value = 1; - }); } [Test] From 71533808e9958f7470c407750cc34cdc0a014804 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 06:46:20 +0300 Subject: [PATCH 0523/2328] Add test case for `DistanceSpacingMultiplier` in distance snapping test scene --- .../TestSceneHitObjectComposerDistanceSnapping.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs index d9312cb7ae..e2ff45c431 100644 --- a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs +++ b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs @@ -3,6 +3,7 @@ using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; @@ -70,7 +71,7 @@ namespace osu.Game.Tests.Editing [TestCase(2)] public void TestSliderMultiplier(float multiplier) { - AddStep($"set multiplier = {multiplier}", () => composer.EditorBeatmap.Difficulty.SliderMultiplier = multiplier); + AddStep($"set slider multiplier = {multiplier}", () => composer.EditorBeatmap.Difficulty.SliderMultiplier = multiplier); assertSnapDistance(100 * multiplier); } @@ -88,6 +89,15 @@ namespace osu.Game.Tests.Editing }); } + [TestCase(1)] + [TestCase(2)] + public void TestDistanceSpacingMultiplier(float multiplier) + { + AddStep($"set distance spacing = {multiplier}", () => composer.DistanceSpacingMultiplier.Value = multiplier); + + assertSnapDistance(100 * multiplier); + } + [TestCase(1)] [TestCase(2)] public void TestBeatDivisor(int divisor) @@ -222,6 +232,8 @@ namespace osu.Game.Tests.Editing { public new EditorBeatmap EditorBeatmap => base.EditorBeatmap; + public new Bindable DistanceSpacingMultiplier => base.DistanceSpacingMultiplier; + public TestHitObjectComposer() : base(new OsuRuleset()) { From dacca73838049da362da4f7628c5e8948fbe8322 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 06:46:34 +0300 Subject: [PATCH 0524/2328] Set default value of `DistanceSpacing` to 1 --- osu.Game/Beatmaps/BeatmapInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index f90208d0c0..1a9703f478 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -109,7 +109,7 @@ namespace osu.Game.Beatmaps public bool SamplesMatchPlaybackRate { get; set; } = true; - public double DistanceSpacing { get; set; } + public double DistanceSpacing { get; set; } = 1.0; public int BeatDivisor { get; set; } From 2e8372fe906996996553d275f333358b3699c9b3 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 06:52:42 +0300 Subject: [PATCH 0525/2328] Minor cleanup Just from reading diff. --- .../Editor/TestSceneSliderSnapping.cs | 3 +-- .../Visual/Editing/TestSceneHitObjectComposer.cs | 7 +++---- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 4 +--- .../Screens/Edit/Compose/Components/DistanceSnapGrid.cs | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs index 4833266dca..6b9a0ff531 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs @@ -3,7 +3,6 @@ using System.Linq; using NUnit.Framework; -using osu.Framework.Allocation; using osu.Framework.Input.Events; using osu.Framework.Testing; using osu.Framework.Utils; @@ -63,7 +62,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor })); AddStep("set beat divisor to 1/1", () => { - var beatDivisor = Editor.Dependencies.Get(); + var beatDivisor = (BindableBeatDivisor)Editor.Dependencies.Get(typeof(BindableBeatDivisor)); beatDivisor.Value = 1; }); } diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs index 7039d7d8a4..ae1b691767 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs @@ -8,7 +8,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; -using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Edit; @@ -91,15 +90,15 @@ namespace osu.Game.Tests.Visual.Editing [Test] public void TestDistanceSpacingHotkeys() { - float originalSpacing = 0; + double originalSpacing = 0; - AddStep("retrieve original spacing", () => originalSpacing = (float)editorBeatmap.BeatmapInfo.DistanceSpacing); + AddStep("retrieve original spacing", () => originalSpacing = editorBeatmap.BeatmapInfo.DistanceSpacing); AddStep("hold ctrl", () => InputManager.PressKey(Key.LControl)); AddStep("hold alt", () => InputManager.PressKey(Key.LAlt)); AddStep("scroll mouse 5 steps", () => InputManager.ScrollVerticalBy(5)); - AddAssert("distance spacing increased by 0.5", () => Precision.AlmostEquals(editorBeatmap.BeatmapInfo.DistanceSpacing, originalSpacing + 0.5f)); + AddAssert("distance spacing increased by 0.5", () => editorBeatmap.BeatmapInfo.DistanceSpacing == originalSpacing + 0.5); AddStep("release alt", () => InputManager.ReleaseKey(Key.LAlt)); AddStep("release ctrl", () => InputManager.ReleaseKey(Key.LControl)); diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 9fc332d726..a235a5bc60 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -117,8 +117,6 @@ namespace osu.Game.Rulesets.Edit }, new LeftToolboxFlow { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, Children = new Drawable[] { new EditorToolboxGroup("toolbox (1-9)") @@ -134,7 +132,7 @@ namespace osu.Game.Rulesets.Edit Direction = FillDirection.Vertical, Spacing = new Vector2(0, 5), }, - }, + } } }, }; diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index 9dd6cec8ce..4f348567b1 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -84,7 +84,7 @@ namespace osu.Game.Screens.Edit.Compose.Components { base.LoadComplete(); - beatDivisor.BindValueChanged(_ => updateSpacing(), true); + beatDivisor.BindValueChanged(_ => updateSpacing()); distanceSpacingMultiplier = SnapProvider.DistanceSpacingMultiplier.GetBoundCopy(); distanceSpacingMultiplier.BindValueChanged(_ => updateSpacing(), true); From aabe5865784ca5ed2729c507c2267ca14cc0d0c2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 14:09:30 +0900 Subject: [PATCH 0526/2328] Add return value to `EnsureMutableSkin` to understand whether a new skin was made --- osu.Game/Skinning/SkinManager.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index 01e7646644..77e60d179c 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -143,12 +143,15 @@ namespace osu.Game.Skinning /// Ensure that the current skin is in a state it can accept user modifications. /// This will create a copy of any internal skin and being tracking in the database if not already. /// - public void EnsureMutableSkin() + /// + /// Whether a new skin was created to allow for mutation. + /// + public bool EnsureMutableSkin() { - CurrentSkinInfo.Value.PerformRead(s => + return CurrentSkinInfo.Value.PerformRead(s => { if (!s.Protected) - return; + return false; string[] existingSkinNames = realm.Run(r => r.All() .Where(skin => !skin.DeletePending) @@ -160,7 +163,7 @@ namespace osu.Game.Skinning { Creator = s.Creator, InstantiationInfo = s.InstantiationInfo, - Name = NamingUtils.GetNextBestName(existingSkinNames, $"{s.Name} (modified)") + Name = NamingUtils.GetNextBestName(existingSkinNames, $@"{s.Name} (modified)") }; var result = skinModelManager.Import(skinInfo); @@ -172,6 +175,8 @@ namespace osu.Game.Skinning result.PerformRead(skin => Save(skin.CreateInstance(this))); CurrentSkinInfo.Value = result; } + + return true; }); } From 7c1b0b41ff1e52acb9cc5bc25fa166bf4d95637f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 14:09:41 +0900 Subject: [PATCH 0527/2328] Fix migration not working correctly when applying on a default skin --- osu.Game/Screens/Play/SongProgress.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 592071b02e..35d70976d2 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -162,7 +162,6 @@ namespace osu.Game.Screens.Play if (!configShowGraph.IsDefault) { ShowGraph.Value = configShowGraph.Value; - configShowGraph.SetDefault(); // This is pretty ugly, but the only way to make this stick... if (skinManager != null) @@ -171,17 +170,17 @@ namespace osu.Game.Screens.Play if (skinnableTarget != null) { - skinManager.EnsureMutableSkin(); + // If the skin is not mutable, a mutable instance will be created, causing this migration logic to run again on the correct skin. + // Therefore we want to avoid resetting the config value on this invocation. + if (skinManager.EnsureMutableSkin()) + return; - // If `EnsureMutableSkin` actually changed the skin, default layout may take a frame to apply. - // See `SkinnableTargetComponentsContainer`'s use of ScheduleAfterChildren. - ScheduleAfterChildren(() => - { - var skin = skinManager.CurrentSkin.Value; - skin.UpdateDrawableTarget(skinnableTarget); + var skin = skinManager.CurrentSkin.Value; + skin.UpdateDrawableTarget(skinnableTarget); - skinManager.Save(skin); - }); + skinManager.Save(skin); + + configShowGraph.SetDefault(); } } } From 3c45746ba10e889f6ca68172d40fa397b448ecb2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 14:29:57 +0900 Subject: [PATCH 0528/2328] Add back schedule for safety --- osu.Game/Screens/Play/SongProgress.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 35d70976d2..a21a08e558 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -175,10 +175,15 @@ namespace osu.Game.Screens.Play if (skinManager.EnsureMutableSkin()) return; - var skin = skinManager.CurrentSkin.Value; - skin.UpdateDrawableTarget(skinnableTarget); + // If `EnsureMutableSkin` actually changed the skin, default layout may take a frame to apply. + // See `SkinnableTargetComponentsContainer`'s use of ScheduleAfterChildren. + ScheduleAfterChildren(() => + { + var skin = skinManager.CurrentSkin.Value; + skin.UpdateDrawableTarget(skinnableTarget); - skinManager.Save(skin); + skinManager.Save(skin); + }); configShowGraph.SetDefault(); } From f3a0e2ed55ba0c99feaec64911d92575bbb3d72c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 14:59:39 +0900 Subject: [PATCH 0529/2328] Increase fade duration --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index a47a399a23..03a66575c4 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -426,7 +426,7 @@ namespace osu.Game.Overlays.Mods else targetColour = IsHovered ? colours.GrayC : colours.Gray8; - this.FadeColour(targetColour, 300, Easing.OutQuint); + this.FadeColour(targetColour, 800, Easing.OutQuint); } protected override bool OnClick(ClickEvent e) From 7aaa88cac2be239dcc778a1082585f8e8d5a7e55 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 10:24:36 +0300 Subject: [PATCH 0530/2328] Convert data type of `DistanceSpacing` to float --- .../Editor/TestSceneOsuDistanceSnapGrid.cs | 2 +- .../TestSceneHitObjectComposerDistanceSnapping.cs | 2 +- .../Visual/Editing/TestSceneDistanceSnapGrid.cs | 2 +- .../UserInterface/TestSceneExpandingContainer.cs | 4 ++-- osu.Game/Beatmaps/BeatmapInfo.cs | 2 +- osu.Game/Beatmaps/EFBeatmapInfo.cs | 2 +- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 2 +- .../Settings/Sections/Gameplay/InputSettings.cs | 2 +- osu.Game/Overlays/Settings/Sections/SizeSlider.cs | 7 ++----- .../Sections/UserInterface/GeneralSettings.cs | 2 +- .../Rulesets/Edit/DistancedHitObjectComposer.cs | 14 +++++++------- osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs | 2 +- .../Edit/Compose/Components/DistanceSnapGrid.cs | 2 +- 13 files changed, 21 insertions(+), 24 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs index 2ba30c5f74..4cccddddf3 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs @@ -187,7 +187,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); - public IBindable DistanceSpacingMultiplier { get; } = new BindableDouble(1); + public IBindable DistanceSpacingMultiplier { get; } = new BindableFloat(1); public float GetBeatSnapDistanceAt(HitObject referenceObject) => (float)beat_length; diff --git a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs index e2ff45c431..ffaf3ec41d 100644 --- a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs +++ b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs @@ -232,7 +232,7 @@ namespace osu.Game.Tests.Editing { public new EditorBeatmap EditorBeatmap => base.EditorBeatmap; - public new Bindable DistanceSpacingMultiplier => base.DistanceSpacingMultiplier; + public new Bindable DistanceSpacingMultiplier => base.DistanceSpacingMultiplier; public TestHitObjectComposer() : base(new OsuRuleset()) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs index b9cfa84a5d..20bf9b3fa0 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs @@ -167,7 +167,7 @@ namespace osu.Game.Tests.Visual.Editing public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); - public IBindable DistanceSpacingMultiplier { get; } = new BindableDouble(1); + public IBindable DistanceSpacingMultiplier { get; } = new BindableFloat(1); public float GetBeatSnapDistanceAt(HitObject referenceObject) => 10; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs index 288c0cb140..f4920b4412 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs @@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.UserInterface private TestExpandingContainer container; private SettingsToolboxGroup toolboxGroup; - private ExpandableSlider> slider1; + private ExpandableSlider slider1; private ExpandableSlider slider2; [SetUp] @@ -34,7 +34,7 @@ namespace osu.Game.Tests.Visual.UserInterface Width = 1, Children = new Drawable[] { - slider1 = new ExpandableSlider> + slider1 = new ExpandableSlider { Current = new BindableFloat { diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 1a9703f478..1b364247a8 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -109,7 +109,7 @@ namespace osu.Game.Beatmaps public bool SamplesMatchPlaybackRate { get; set; } = true; - public double DistanceSpacing { get; set; } = 1.0; + public float DistanceSpacing { get; set; } = 1.0f; public int BeatDivisor { get; set; } diff --git a/osu.Game/Beatmaps/EFBeatmapInfo.cs b/osu.Game/Beatmaps/EFBeatmapInfo.cs index 740adfd1c7..67c4dbe788 100644 --- a/osu.Game/Beatmaps/EFBeatmapInfo.cs +++ b/osu.Game/Beatmaps/EFBeatmapInfo.cs @@ -107,7 +107,7 @@ namespace osu.Game.Beatmaps [NotMapped] public int[] Bookmarks { get; set; } = Array.Empty(); - public double DistanceSpacing { get; set; } + public float DistanceSpacing { get; set; } public int BeatDivisor { get; set; } public int GridSize { get; set; } public double TimelineZoom { get; set; } diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 79d8bd3bb3..0ba7a07010 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -240,7 +240,7 @@ namespace osu.Game.Beatmaps.Formats break; case @"DistanceSpacing": - beatmap.BeatmapInfo.DistanceSpacing = Math.Max(0, Parsing.ParseDouble(pair.Value)); + beatmap.BeatmapInfo.DistanceSpacing = Math.Max(0, Parsing.ParseFloat(pair.Value)); break; case @"BeatDivisor": diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs index 83ea655601..962572ca6e 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { Children = new Drawable[] { - new SettingsSlider> + new SettingsSlider { LabelText = SkinSettingsStrings.GameplayCursorSize, Current = config.GetBindable(OsuSetting.GameplayCursorSize), diff --git a/osu.Game/Overlays/Settings/Sections/SizeSlider.cs b/osu.Game/Overlays/Settings/Sections/SizeSlider.cs index c8a46162af..8aeb440be1 100644 --- a/osu.Game/Overlays/Settings/Sections/SizeSlider.cs +++ b/osu.Game/Overlays/Settings/Sections/SizeSlider.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using System.Globalization; using osu.Framework.Localisation; using osu.Game.Graphics.UserInterface; @@ -11,9 +9,8 @@ namespace osu.Game.Overlays.Settings.Sections /// /// A slider intended to show a "size" multiplier number, where 1x is 1.0. /// - public class SizeSlider : OsuSliderBar - where T : struct, IEquatable, IComparable, IConvertible, IFormattable + internal class SizeSlider : OsuSliderBar { - public override LocalisableString TooltipText => Current.Value.ToString(@"0.##x", NumberFormatInfo.CurrentInfo); + public override LocalisableString TooltipText => Current.Value.ToString(@"0.##x"); } } diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs index 0e3b822c82..6e1558f7d7 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface LabelText = UserInterfaceStrings.CursorRotation, Current = config.GetBindable(OsuSetting.CursorRotation) }, - new SettingsSlider> + new SettingsSlider { LabelText = UserInterfaceStrings.MenuCursorSize, Current = config.GetBindable(OsuSetting.MenuCursorSize), diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index d0c9babf24..ce31318fb8 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -21,18 +21,18 @@ namespace osu.Game.Rulesets.Edit public abstract class DistancedHitObjectComposer : HitObjectComposer, IDistanceSnapProvider where TObject : HitObject { - protected Bindable DistanceSpacingMultiplier { get; } = new BindableDouble(1.0) + protected Bindable DistanceSpacingMultiplier { get; } = new BindableFloat(1.0f) { - MinValue = 0.1, - MaxValue = 6.0, - Precision = 0.01, + MinValue = 0.1f, + MaxValue = 6.0f, + Precision = 0.01f, }; - IBindable IDistanceSnapProvider.DistanceSpacingMultiplier => DistanceSpacingMultiplier; + IBindable IDistanceSnapProvider.DistanceSpacingMultiplier => DistanceSpacingMultiplier; protected ExpandingToolboxContainer RightSideToolboxContainer { get; private set; } - private ExpandableSlider> distanceSpacingSlider; + private ExpandableSlider distanceSpacingSlider; private bool distanceSpacingScrollActive; protected DistancedHitObjectComposer(Ruleset ruleset) @@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Edit Origin = Anchor.TopRight, Child = new EditorToolboxGroup("snapping") { - Child = distanceSpacingSlider = new ExpandableSlider> + Child = distanceSpacingSlider = new ExpandableSlider { Current = { BindTarget = DistanceSpacingMultiplier }, KeyboardStep = 0.1f, diff --git a/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs index c6e866561e..0eb572d22a 100644 --- a/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Edit /// The spacing multiplier applied to beat snap distances. /// /// - IBindable DistanceSpacingMultiplier { get; } + IBindable DistanceSpacingMultiplier { get; } /// /// Retrieves the distance between two points within a timing point that are one beat length apart. diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index 4f348567b1..cd56beda47 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Edit.Compose.Components [Resolved] private BindableBeatDivisor beatDivisor { get; set; } - private IBindable distanceSpacingMultiplier; + private IBindable distanceSpacingMultiplier; private readonly LayoutValue gridCache = new LayoutValue(Invalidation.RequiredParentSizeToFit); private readonly double? endTime; From abb88b090702a9330401ab4c348b725b379a2d25 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 10:54:38 +0300 Subject: [PATCH 0531/2328] Move distance spacing application to `DistanceSnapGrid` --- .../Editor/TestSceneObjectObjectSnap.cs | 5 +---- .../Editor/TestSceneSliderSnapping.cs | 3 +-- .../TestSceneHitObjectComposerDistanceSnapping.cs | 10 ---------- osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs | 2 +- .../Edit/Compose/Components/DistanceSnapGrid.cs | 2 +- 5 files changed, 4 insertions(+), 18 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs index 21ba1e647d..7bdf131e0d 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs @@ -19,10 +19,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor { private OsuPlayfield playfield; - protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(Ruleset.Value, false) - { - BeatmapInfo = { DistanceSpacing = 1 } - }; + protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(Ruleset.Value, false); public override void SetUpSteps() { diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs index 6b9a0ff531..b43b2b1461 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs @@ -35,8 +35,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor controlPointInfo.Add(0, new TimingControlPoint { BeatLength = beat_length }); return new TestBeatmap(ruleset, false) { - ControlPointInfo = controlPointInfo, - BeatmapInfo = { DistanceSpacing = 1 }, + ControlPointInfo = controlPointInfo }; } diff --git a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs index ffaf3ec41d..2c2c06ae0c 100644 --- a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs +++ b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs @@ -62,7 +62,6 @@ namespace osu.Game.Tests.Editing BeatDivisor.Value = 1; composer.EditorBeatmap.Difficulty.SliderMultiplier = 1; - composer.EditorBeatmap.BeatmapInfo.DistanceSpacing = 1; composer.EditorBeatmap.ControlPointInfo.Clear(); composer.EditorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 1000 }); }); @@ -89,15 +88,6 @@ namespace osu.Game.Tests.Editing }); } - [TestCase(1)] - [TestCase(2)] - public void TestDistanceSpacingMultiplier(float multiplier) - { - AddStep($"set distance spacing = {multiplier}", () => composer.DistanceSpacingMultiplier.Value = multiplier); - - assertSnapDistance(100 * multiplier); - } - [TestCase(1)] [TestCase(2)] public void TestBeatDivisor(int divisor) diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index ce31318fb8..1e1fbb4edf 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -109,7 +109,7 @@ namespace osu.Game.Rulesets.Edit public virtual float GetBeatSnapDistanceAt(HitObject referenceObject) { - return (float)(100 * EditorBeatmap.Difficulty.SliderMultiplier * referenceObject.DifficultyControlPoint.SliderVelocity * DistanceSpacingMultiplier.Value / BeatSnapProvider.BeatDivisor); + return (float)(100 * EditorBeatmap.Difficulty.SliderMultiplier * referenceObject.DifficultyControlPoint.SliderVelocity / BeatSnapProvider.BeatDivisor); } public virtual float DurationToDistance(HitObject referenceObject, double duration) diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index cd56beda47..13c3b713b1 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -92,7 +92,7 @@ namespace osu.Game.Screens.Edit.Compose.Components private void updateSpacing() { - DistanceSpacing = SnapProvider.GetBeatSnapDistanceAt(ReferenceObject); + DistanceSpacing = SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * distanceSpacingMultiplier.Value; if (endTime == null) MaxIntervals = int.MaxValue; From b6d2ca7709b0b8a32f179c0c258852217372b520 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 10:57:14 +0300 Subject: [PATCH 0532/2328] Clarify TODO comment --- osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs index a90b0d3e89..9ff6d10a49 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Catch.Edit [BackgroundDependencyLoader] private void load() { - // todo: enable distance spacing once catch supports it. + // todo: enable distance spacing once catch supports applying it to its existing distance snap grid implementation. RightSideToolboxContainer.Alpha = 0; DistanceSpacingMultiplier.Disabled = true; From edeefc28501a12c7719025a63925975b39e4bd3c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 11:10:14 +0300 Subject: [PATCH 0533/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 82dec74855..ff6499631d 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 325e834fa5..26891ad978 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 8775442be2..d261e13ade 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From c8665dc93b40835dd08687c51ec4384354e83584 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 11:12:50 +0300 Subject: [PATCH 0534/2328] Update `TimeSpan` localisation to use `ToLocalisableString` --- osu.Game/Extensions/TimeDisplayExtensions.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Extensions/TimeDisplayExtensions.cs b/osu.Game/Extensions/TimeDisplayExtensions.cs index 54af6a5942..98633958ee 100644 --- a/osu.Game/Extensions/TimeDisplayExtensions.cs +++ b/osu.Game/Extensions/TimeDisplayExtensions.cs @@ -3,6 +3,7 @@ using System; using Humanizer; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; @@ -42,12 +43,12 @@ namespace osu.Game.Extensions public static LocalisableString ToFormattedDuration(this TimeSpan timeSpan) { if (timeSpan.TotalDays >= 1) - return new LocalisableFormattableString(timeSpan, @"dd\:hh\:mm\:ss"); + return timeSpan.ToLocalisableString(@"dd\:hh\:mm\:ss"); if (timeSpan.TotalHours >= 1) - return new LocalisableFormattableString(timeSpan, @"hh\:mm\:ss"); + return timeSpan.ToLocalisableString(@"hh\:mm\:ss"); - return new LocalisableFormattableString(timeSpan, @"mm\:ss"); + return timeSpan.ToLocalisableString(@"mm\:ss"); } /// From be2d616e345e7e37ff5698b1b57c435209874d83 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 11:19:30 +0300 Subject: [PATCH 0535/2328] Fix localisation use cases not falling back to `default(LocalisableString)` Previously such use cases have been returning `null` values just fine since `GetLocalisableString` was returning `LocalisableFormattableString`, and these null values were wrapped in `LocalisableString`s implicitly, therefore not requiring an explicit fallback string and `null` doesn't break anything. --- .../Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs | 2 +- .../Overlays/Profile/Header/Components/LevelProgressBar.cs | 2 +- osu.Game/Overlays/Rankings/SpotlightSelector.cs | 2 +- osu.Game/Overlays/Rankings/Tables/PerformanceTable.cs | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs index ec795cf6b2..9ee002fd9d 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs @@ -119,7 +119,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores maxComboColumn.Text = value.MaxCombo.ToLocalisableString(@"0\x"); ppColumn.Alpha = value.BeatmapInfo.Status.GrantsPerformancePoints() ? 1 : 0; - ppColumn.Text = value.PP?.ToLocalisableString(@"N0"); + ppColumn.Text = value.PP?.ToLocalisableString(@"N0") ?? default(LocalisableString); statisticsColumns.ChildrenEnumerable = value.GetStatisticsForDisplay().Select(createStatisticsColumn); modsColumn.Mods = value.Mods; diff --git a/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs b/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs index 8f6b935128..ec9cb55042 100644 --- a/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs +++ b/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs @@ -62,7 +62,7 @@ namespace osu.Game.Overlays.Profile.Header.Components private void updateProgress(APIUser user) { levelProgressBar.Length = user?.Statistics?.Level.Progress / 100f ?? 0; - levelProgressText.Text = user?.Statistics?.Level.Progress.ToLocalisableString("0'%'"); + levelProgressText.Text = user?.Statistics?.Level.Progress.ToLocalisableString("0'%'") ?? default(LocalisableString); } } } diff --git a/osu.Game/Overlays/Rankings/SpotlightSelector.cs b/osu.Game/Overlays/Rankings/SpotlightSelector.cs index dfa45cc543..48a4c31f30 100644 --- a/osu.Game/Overlays/Rankings/SpotlightSelector.cs +++ b/osu.Game/Overlays/Rankings/SpotlightSelector.cs @@ -126,7 +126,7 @@ namespace osu.Game.Overlays.Rankings startDateColumn.Value = dateToString(response.Spotlight.StartDate); endDateColumn.Value = dateToString(response.Spotlight.EndDate); mapCountColumn.Value = response.BeatmapSets.Count.ToLocalisableString(@"N0"); - participantsColumn.Value = response.Spotlight.Participants?.ToLocalisableString(@"N0"); + participantsColumn.Value = response.Spotlight.Participants?.ToLocalisableString(@"N0") ?? default(LocalisableString); } private LocalisableString dateToString(DateTimeOffset date) => date.ToLocalisableString(@"yyyy-MM-dd"); diff --git a/osu.Game/Overlays/Rankings/Tables/PerformanceTable.cs b/osu.Game/Overlays/Rankings/Tables/PerformanceTable.cs index 17c17b1f1a..bdbd2942d1 100644 --- a/osu.Game/Overlays/Rankings/Tables/PerformanceTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/PerformanceTable.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; using osu.Game.Users; @@ -24,7 +25,7 @@ namespace osu.Game.Overlays.Rankings.Tables protected override Drawable[] CreateUniqueContent(UserStatistics item) => new Drawable[] { - new RowText { Text = item.PP?.ToLocalisableString(@"N0"), } + new RowText { Text = item.PP?.ToLocalisableString(@"N0") ?? default(LocalisableString), } }; } } From 92cac0b74e67616aec5845d11c9adb7deb3d6b2a Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 28 Apr 2022 17:30:24 +0900 Subject: [PATCH 0536/2328] Fix TabControls using the wrong sample --- .../BeatmapListing/BeatmapListingCardSizeTabControl.cs | 3 ++- osu.Game/Overlays/OverlaySortTabControl.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapListingCardSizeTabControl.cs b/osu.Game/Overlays/BeatmapListing/BeatmapListingCardSizeTabControl.cs index e4fda9d9c3..1f9a63e3b9 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapListingCardSizeTabControl.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapListingCardSizeTabControl.cs @@ -72,7 +72,8 @@ namespace osu.Game.Overlays.BeatmapListing Size = new Vector2(12), Icon = getIconForCardSize(Value) } - } + }, + new HoverClickSounds(HoverSampleSet.TabSelect) }; } diff --git a/osu.Game/Overlays/OverlaySortTabControl.cs b/osu.Game/Overlays/OverlaySortTabControl.cs index d4dde0db3f..5f5cfce344 100644 --- a/osu.Game/Overlays/OverlaySortTabControl.cs +++ b/osu.Game/Overlays/OverlaySortTabControl.cs @@ -149,7 +149,7 @@ namespace osu.Game.Overlays } }); - AddInternal(new HoverClickSounds()); + AddInternal(new HoverClickSounds(HoverSampleSet.TabSelect)); } protected override void LoadComplete() From 37816ebc41abc2679c667a848865382872aa01b2 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 28 Apr 2022 17:33:51 +0900 Subject: [PATCH 0537/2328] Add audio feedback to `SwitchButton` checkbox --- .../Graphics/UserInterfaceV2/SwitchButton.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterfaceV2/SwitchButton.cs b/osu.Game/Graphics/UserInterfaceV2/SwitchButton.cs index c6477d1781..f483e67b27 100644 --- a/osu.Game/Graphics/UserInterfaceV2/SwitchButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/SwitchButton.cs @@ -4,6 +4,8 @@ #nullable enable using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -31,6 +33,9 @@ namespace osu.Game.Graphics.UserInterfaceV2 private Color4 enabledColour; private Color4 disabledColour; + private Sample? sampleChecked; + private Sample? sampleUnchecked; + public SwitchButton() { Size = new Vector2(45, 20); @@ -70,13 +75,16 @@ namespace osu.Game.Graphics.UserInterfaceV2 } [BackgroundDependencyLoader(true)] - private void load(OverlayColourProvider? colourProvider, OsuColour colours) + private void load(OverlayColourProvider? colourProvider, OsuColour colours, AudioManager audio) { enabledColour = colourProvider?.Highlight1 ?? colours.BlueDark; disabledColour = colourProvider?.Background3 ?? colours.Gray3; switchContainer.Colour = enabledColour; fill.Colour = disabledColour; + + sampleChecked = audio.Samples.Get(@"UI/check-on"); + sampleUnchecked = audio.Samples.Get(@"UI/check-off"); } protected override void LoadComplete() @@ -107,6 +115,16 @@ namespace osu.Game.Graphics.UserInterfaceV2 base.OnHoverLost(e); } + protected override void OnUserChange(bool value) + { + base.OnUserChange(value); + + if (value) + sampleChecked?.Play(); + else + sampleUnchecked?.Play(); + } + private void updateBorder() { circularContainer.TransformBorderTo((Current.Value ? enabledColour : disabledColour).Lighten(IsHovered ? 0.3f : 0)); From 691bec6f16845c94fa79ba26ff87372e988c43d3 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 11:38:40 +0300 Subject: [PATCH 0538/2328] Use `LocalisableString.Interpolate` instead of invalid `TranslatableString`s --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 4 ++-- osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 27a057bf09..735de670e3 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -317,11 +317,11 @@ namespace osu.Game.Overlays } else { - BackButton.Text = new TranslatableString(@"_", @"{0} ({1})", CommonStrings.Back, steps[currentStepIndex.Value - 1].Description); + BackButton.Text = LocalisableString.Interpolate($@"{CommonStrings.Back} ({steps[currentStepIndex.Value - 1].Description})"); NextButton.Text = isLastStep ? CommonStrings.Finish - : new TranslatableString(@"_", @"{0} ({1})", CommonStrings.Next, steps[currentStepIndex.Value + 1].Description); + : LocalisableString.Interpolate($@"{CommonStrings.Next} ({steps[currentStepIndex.Value + 1].Description})"); } } diff --git a/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs b/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs index 42091c521f..1662ca399f 100644 --- a/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs +++ b/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs @@ -99,8 +99,8 @@ namespace osu.Game.Screens.Play.PlayerSettings { public override LocalisableString TooltipText => Current.Value == 0 - ? new TranslatableString("_", @"{0} ms", base.TooltipText) - : new TranslatableString("_", @"{0} ms {1}", base.TooltipText, getEarlyLateText(Current.Value)); + ? LocalisableString.Interpolate($@"{base.TooltipText} ms") + : LocalisableString.Interpolate($@"{base.TooltipText} ms {getEarlyLateText(Current.Value)}"); private LocalisableString getEarlyLateText(double value) { From 93db6c6bb0a82b85cf1a4429bcf8e7ff165bc75f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 17:46:00 +0900 Subject: [PATCH 0539/2328] Move `FastRandom` to `LegacyRandom` in `osu.Game` project --- .../Beatmaps/CatchBeatmapProcessor.cs | 8 +- .../Beatmaps/ManiaBeatmapConverter.cs | 8 +- .../Legacy/DistanceObjectPatternGenerator.cs | 4 +- .../Legacy/EndTimeObjectPatternGenerator.cs | 4 +- .../Legacy/HitObjectPatternGenerator.cs | 4 +- .../Patterns/Legacy/PatternGenerator.cs | 6 +- .../MathUtils/FastRandom.cs | 95 ------------------- .../Utils/LegacyRandom.cs | 37 +++++--- 8 files changed, 40 insertions(+), 126 deletions(-) delete mode 100644 osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs rename osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs => osu.Game/Utils/LegacyRandom.cs (79%) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs index 346a09cac8..ab61b14ac4 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs @@ -5,10 +5,10 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; -using osu.Game.Rulesets.Catch.MathUtils; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Objects.Types; +using osu.Game.Utils; namespace osu.Game.Rulesets.Catch.Beatmaps { @@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps public void ApplyPositionOffsets(IBeatmap beatmap) { - var rng = new FastRandom(RNG_SEED); + var rng = new LegacyRandom(RNG_SEED); float? lastPosition = null; double lastStartTime = 0; @@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps initialiseHyperDash(beatmap); } - private static void applyHardRockOffset(CatchHitObject hitObject, ref float? lastPosition, ref double lastStartTime, FastRandom rng) + private static void applyHardRockOffset(CatchHitObject hitObject, ref float? lastPosition, ref double lastStartTime, LegacyRandom rng) { float offsetPosition = hitObject.OriginalX; double startTime = hitObject.StartTime; @@ -146,7 +146,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps /// The position which the offset should be applied to. /// The maximum offset, cannot exceed 20px. /// The random number generator. - private static void applyRandomOffset(ref float position, double maxOffset, FastRandom rng) + private static void applyRandomOffset(ref float position, double maxOffset, LegacyRandom rng) { bool right = rng.NextBool(); float rand = Math.Min(20, (float)rng.Next(0, Math.Max(0, maxOffset))); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 47e0e6d7b1..207c6907c8 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -11,8 +11,8 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Mania.Beatmaps.Patterns; -using osu.Game.Rulesets.Mania.MathUtils; using osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy; +using osu.Game.Utils; using osuTK; namespace osu.Game.Rulesets.Mania.Beatmaps @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps private readonly int originalTargetColumns; // Internal for testing purposes - internal FastRandom Random { get; private set; } + internal LegacyRandom Random { get; private set; } private Pattern lastPattern = new Pattern(); @@ -84,7 +84,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps IBeatmapDifficultyInfo difficulty = original.Difficulty; int seed = (int)MathF.Round(difficulty.DrainRate + difficulty.CircleSize) * 20 + (int)(difficulty.OverallDifficulty * 41.2) + (int)MathF.Round(difficulty.ApproachRate); - Random = new FastRandom(seed); + Random = new LegacyRandom(seed); return base.ConvertBeatmap(original, cancellationToken); } @@ -227,7 +227,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps /// private class SpecificBeatmapPatternGenerator : Patterns.Legacy.PatternGenerator { - public SpecificBeatmapPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) + public SpecificBeatmapPatternGenerator(LegacyRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) : base(random, hitObject, beatmap, previousPattern, originalBeatmap) { } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 5f8b58d94d..dafe65f415 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -8,12 +8,12 @@ using System.Linq; using osu.Framework.Extensions.EnumExtensions; using osu.Game.Audio; using osu.Game.Beatmaps; -using osu.Game.Rulesets.Mania.MathUtils; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.Formats; +using osu.Game.Utils; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy private PatternType convertType; - public DistanceObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) + public DistanceObjectPatternGenerator(LegacyRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) : base(random, hitObject, beatmap, previousPattern, originalBeatmap) { convertType = PatternType.None; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index f816a70ab3..2265d3d347 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -2,13 +2,13 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using osu.Game.Rulesets.Mania.MathUtils; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using System.Linq; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Utils; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy private readonly int endTime; private readonly PatternType convertType; - public EndTimeObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) + public EndTimeObjectPatternGenerator(LegacyRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) : base(random, hitObject, beatmap, previousPattern, originalBeatmap) { endTime = (int)((HitObject as IHasDuration)?.EndTime ?? 0); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index 53b059b4e2..41d4c9322b 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -9,11 +9,11 @@ using osuTK; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Rulesets.Mania.MathUtils; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Game.Utils; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy private readonly PatternType convertType; - public HitObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, double previousTime, Vector2 previousPosition, double density, + public HitObjectPatternGenerator(LegacyRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, double previousTime, Vector2 previousPosition, double density, PatternType lastStair, IBeatmap originalBeatmap) : base(random, hitObject, beatmap, previousPattern, originalBeatmap) { diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs index eaf0ea0f2b..d5689c047a 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs @@ -5,8 +5,8 @@ using System; using System.Linq; using JetBrains.Annotations; using osu.Game.Beatmaps; -using osu.Game.Rulesets.Mania.MathUtils; using osu.Game.Rulesets.Objects; +using osu.Game.Utils; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { @@ -23,14 +23,14 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// /// The random number generator to use. /// - protected readonly FastRandom Random; + protected readonly LegacyRandom Random; /// /// The beatmap which is being converted from. /// protected readonly IBeatmap OriginalBeatmap; - protected PatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) + protected PatternGenerator(LegacyRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) : base(hitObject, beatmap, previousPattern) { if (random == null) throw new ArgumentNullException(nameof(random)); diff --git a/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs b/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs deleted file mode 100644 index a9cd7f2476..0000000000 --- a/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs +++ /dev/null @@ -1,95 +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 System; - -namespace osu.Game.Rulesets.Mania.MathUtils -{ - /// - /// A PRNG specified in http://heliosphan.org/fastrandom.html. - /// - internal class FastRandom - { - private const double int_to_real = 1.0 / (int.MaxValue + 1.0); - private const uint int_mask = 0x7FFFFFFF; - private const uint y = 842502087; - private const uint z = 3579807591; - private const uint w = 273326509; - - internal uint X { get; private set; } - internal uint Y { get; private set; } = y; - internal uint Z { get; private set; } = z; - internal uint W { get; private set; } = w; - - public FastRandom(int seed) - { - X = (uint)seed; - } - - public FastRandom() - : this(Environment.TickCount) - { - } - - /// - /// Generates a random unsigned integer within the range [, ). - /// - /// The random value. - public uint NextUInt() - { - uint t = X ^ (X << 11); - X = Y; - Y = Z; - Z = W; - return W = W ^ (W >> 19) ^ t ^ (t >> 8); - } - - /// - /// Generates a random integer value within the range [0, ). - /// - /// The random value. - public int Next() => (int)(int_mask & NextUInt()); - - /// - /// Generates a random integer value within the range [0, ). - /// - /// The upper bound. - /// The random value. - public int Next(int upperBound) => (int)(NextDouble() * upperBound); - - /// - /// Generates a random integer value within the range [, ). - /// - /// The lower bound of the range. - /// The upper bound of the range. - /// The random value. - public int Next(int lowerBound, int upperBound) => (int)(lowerBound + NextDouble() * (upperBound - lowerBound)); - - /// - /// Generates a random double value within the range [0, 1). - /// - /// The random value. - public double NextDouble() => int_to_real * Next(); - - private uint bitBuffer; - private int bitIndex = 32; - - /// - /// Generates a reandom boolean value. Cached such that a random value is only generated once in every 32 calls. - /// - /// The random value. - public bool NextBool() - { - if (bitIndex == 32) - { - bitBuffer = NextUInt(); - bitIndex = 1; - - return (bitBuffer & 1) == 1; - } - - bitIndex++; - return ((bitBuffer >>= 1) & 1) == 1; - } - } -} diff --git a/osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs b/osu.Game/Utils/LegacyRandom.cs similarity index 79% rename from osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs rename to osu.Game/Utils/LegacyRandom.cs index 46e427e1b7..cf731aa91f 100644 --- a/osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs +++ b/osu.Game/Utils/LegacyRandom.cs @@ -2,27 +2,36 @@ // See the LICENCE file in the repository root for full licence text. using System; +using osu.Framework.Utils; -namespace osu.Game.Rulesets.Catch.MathUtils +namespace osu.Game.Utils { /// /// A PRNG specified in http://heliosphan.org/fastrandom.html. + /// Should only be used to match legacy behaviour. See for a newer alternative. /// - public class FastRandom + /// + /// Known in osu-stable code as `FastRandom`. + /// + public class LegacyRandom { private const double int_to_real = 1.0 / (int.MaxValue + 1.0); private const uint int_mask = 0x7FFFFFFF; - private const uint y_initial = 842502087; - private const uint z_initial = 3579807591; - private const uint w_initial = 273326509; - private uint x, y = y_initial, z = z_initial, w = w_initial; + private const uint y = 842502087; + private const uint z = 3579807591; + private const uint w = 273326509; - public FastRandom(int seed) + public uint X { get; private set; } + public uint Y { get; private set; } = y; + public uint Z { get; private set; } = z; + public uint W { get; private set; } = w; + + public LegacyRandom(int seed) { - x = (uint)seed; + X = (uint)seed; } - public FastRandom() + public LegacyRandom() : this(Environment.TickCount) { } @@ -33,11 +42,11 @@ namespace osu.Game.Rulesets.Catch.MathUtils /// The random value. public uint NextUInt() { - uint t = x ^ (x << 11); - x = y; - y = z; - z = w; - return w = w ^ (w >> 19) ^ t ^ (t >> 8); + uint t = X ^ (X << 11); + X = Y; + Y = Z; + Z = W; + return W = W ^ (W >> 19) ^ t ^ (t >> 8); } /// From d052321eee722155c2635560819b60a3a8a41089 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 12:11:06 +0300 Subject: [PATCH 0540/2328] Revert "Fix context menus not working" This reverts commit 51aa17eb524e70899f09c1058842e0d55f58109b. --- osu.Game/Graphics/UserInterface/OsuDropdown.cs | 18 +----------------- osu.Game/Graphics/UserInterface/OsuMenu.cs | 18 +----------------- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 20fa7d5148..b1d4691938 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -131,22 +130,7 @@ namespace osu.Game.Graphics.UserInterface BackgroundColourSelected = SelectionColour }; - protected override ScrollContainer CreateScrollContainer(Direction direction) => new DropdownScrollContainer(direction); - - // Hotfix for https://github.com/ppy/osu/issues/17961 - public class DropdownScrollContainer : OsuScrollContainer - { - public DropdownScrollContainer(Direction direction) - : base(direction) - { - } - - protected override bool OnMouseDown(MouseDownEvent e) - { - base.OnMouseDown(e); - return true; - } - } + protected override ScrollContainer CreateScrollContainer(Direction direction) => new OsuScrollContainer(direction); #region DrawableOsuDropdownMenuItem diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index bfdfd32fb3..a16adcbd57 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -9,7 +9,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osuTK; @@ -82,22 +81,7 @@ namespace osu.Game.Graphics.UserInterface return new DrawableOsuMenuItem(item); } - protected override ScrollContainer CreateScrollContainer(Direction direction) => new OsuMenuScrollContainer(direction); - - // Hotfix for https://github.com/ppy/osu/issues/17961 - public class OsuMenuScrollContainer : OsuScrollContainer - { - public OsuMenuScrollContainer(Direction direction) - : base(direction) - { - } - - protected override bool OnMouseDown(MouseDownEvent e) - { - base.OnMouseDown(e); - return true; - } - } + protected override ScrollContainer CreateScrollContainer(Direction direction) => new OsuScrollContainer(direction); protected override Menu CreateSubMenu() => new OsuMenu(Direction.Vertical) { From 99d2d7b80592777fbde57bca6aab8f8d2b49fdcb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Apr 2022 18:57:10 +0900 Subject: [PATCH 0541/2328] Add very basic implementation of bundled beatmap downloader --- .../TestSceneBundledBeatmapDownloader.cs | 24 ++ .../Drawables/BundledBeatmapDownloader.cs | 227 ++++++++++++++++++ 2 files changed, 251 insertions(+) create mode 100644 osu.Game.Tests/Visual/Online/TestSceneBundledBeatmapDownloader.cs create mode 100644 osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneBundledBeatmapDownloader.cs b/osu.Game.Tests/Visual/Online/TestSceneBundledBeatmapDownloader.cs new file mode 100644 index 0000000000..895524e79a --- /dev/null +++ b/osu.Game.Tests/Visual/Online/TestSceneBundledBeatmapDownloader.cs @@ -0,0 +1,24 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Game.Beatmaps.Drawables; + +namespace osu.Game.Tests.Visual.Online +{ + [Ignore("Only for visual testing")] + public class TestSceneBundledBeatmapDownloader : OsuTestScene + { + private BundledBeatmapDownloader downloader; + + [Test] + public void TestDownloader() + { + AddStep("Create downloader", () => + { + downloader?.Expire(); + Add(downloader = new BundledBeatmapDownloader()); + }); + } + } +} diff --git a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs new file mode 100644 index 0000000000..6b14ed760d --- /dev/null +++ b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs @@ -0,0 +1,227 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using System.Text.RegularExpressions; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Containers; +using osu.Framework.Utils; +using osu.Game.Online.API.Requests.Responses; + +namespace osu.Game.Beatmaps.Drawables +{ + public class BundledBeatmapDownloader : CompositeDrawable + { + [Resolved] + private BeatmapModelDownloader beatmapDownloader { get; set; } + + [BackgroundDependencyLoader] + private void load() + { + foreach (string filename in bundled_beatmap_filenames.OrderBy(_ => RNG.NextSingle()).Take(10)) + { + var match = Regex.Match(filename, @"([0-9]*) (.*) - (.*)\.osz"); + + beatmapDownloader.Download(new APIBeatmapSet + { + OnlineID = int.Parse(match.Groups[1].Value), + Artist = match.Groups[2].Value, + Title = match.Groups[3].Value, + }); + } + } + + private static readonly string[] bundled_beatmap_filenames = new[] + { + "682286 Yuyoyuppe - Emerald Galaxy.osz", + "682287 baker - For a Dead Girl+.osz", + "682289 Hige Driver - I Wanna Feel Your Love (feat. shully).osz", + "682290 Hige Driver - Miracle Sugite Yabai (feat. shully).osz", + "682416 Hige Driver - Palette.osz", + "682595 baker - Kimi ga Kimi ga -vocanico remix-.osz", + "716211 yuki. - Spring Signal.osz", + "716213 dark cat - BUBBLE TEA (feat. juu & cinders).osz", + "716215 LukHash - CLONED.osz", + "716219 IAHN - Snowdrop.osz", + "716249 *namirin - Senaka Awase no Kuukyo (with Kakichoco).osz", + "716390 sakuraburst - SHA.osz", + "716441 Fractal Dreamers - Paradigm Shift.osz", + "729808 Thaehan - Leprechaun.osz", + "751771 Cranky - Hanaarashi.osz", + "751772 Cranky - Ran.osz", + "751773 Cranky - Feline, the White....osz", + "751774 Function Phantom - Variable.osz", + "751779 Rin - Daishibyo set 14 ~ Sado no Futatsuiwa.osz", + "751782 Fractal Dreamers - Fata Morgana.osz", + "751785 Cranky - Chandelier - King.osz", + "751846 Fractal Dreamers - Celestial Horizon.osz", + "751866 Rin - Moriya set 08 ReEdit ~ Youkai no Yama.osz", + "751894 Fractal Dreamers - Blue Haven.osz", + "751896 Cranky - Rave 2 Rave.osz", + "751932 Cranky - La fuite des jours.osz", + "751972 Cranky - CHASER.osz", + "779173 Thaehan - Superpower.osz", + "780932 VINXIS - A Centralized View.osz", + "785572 S3RL - I'll See You Again (feat. Chi Chi).osz", + "785650 yuki. feat. setsunan - Hello! World.osz", + "785677 Dictate - Militant.osz", + "785731 S3RL - Catchit (Radio Edit).osz", + "785774 LukHash - GLITCH.osz", + "786498 Trial & Error - Tokoyami no keiyaku KEGARETA-SHOUJO feat. GUMI.osz", + "789374 Pulse - LP.osz", + "789528 James Portland - Sky.osz", + "789529 Lexurus - Gravity.osz", + "789544 Andromedik - Invasion.osz", + "789905 Gourski x Himmes - Silence.osz", + "791667 cYsmix - Babaroque (Short Ver.).osz", + "791798 cYsmix - Behind the Walls.osz", + "791845 cYsmix - Little Knight.osz", + "792241 cYsmix - Eden.osz", + "792396 cYsmix - The Ballad of a Mindless Girl.osz", + "795432 Phonetic - Journey.osz", + "831322 DJ'TEKINA//SOMETHING - Hidamari no Uta.osz", + "847764 Cranky - Crocus.osz", + "847776 Culprate & Joe Ford - Gaucho.osz", + "847812 J. Pachelbel - Canon (Cranky Remix).osz", + "847900 Cranky - Time Alter.osz", + "847930 LukHash - 8BIT FAIRY TALE.osz", + "848003 Culprate - Aurora.osz", + "848068 nanobii - popsicle beach.osz", + "848090 Trial & Error - DAI*TAN SENSATION feat. Nanahira, Mii, Aitsuki Nakuru (Short Ver.).osz", + "848259 Culprate & Skorpion - Jester.osz", + "848976 Dictate - Treason.osz", + "851543 Culprate - Florn.osz", + "864748 Thaehan - Angry Birds Epic (Remix).osz", + "873667 OISHII - ONIGIRI FREEWAY.osz", + "876227 Culprate, Keota & Sophie Meiers - Mechanic Heartbeat.osz", + "880487 cYsmix - Peer Gynt.osz", + "883088 Wisp X - Somewhere I'd Rather Be.osz", + "891333 HyuN - White Aura.osz", + "891334 HyuN - Wild Card.osz", + "891337 HyuN feat. LyuU - Cross Over.osz", + "891338 HyuN & Ritoru - Apocalypse in Love.osz", + "891339 HyuN feat. Ato - Asu wa Ame ga Yamukara.osz", + "891345 HyuN - Infinity Heaven.osz", + "891348 HyuN - Guitian.osz", + "891356 HyuN - Legend of Genesis.osz", + "891366 HyuN - Illusion of Inflict.osz", + "891417 HyuN feat. Yu-A - My life is for you.osz", + "891441 HyuN - You'Re aRleAdY dEAd.osz", + "891632 HyuN feat. YURI - Disorder.osz", + "891712 HyuN - Tokyo's Starlight.osz", + "901091 *namirin - Ciel etoile.osz", + "916990 *namirin - Koishiteiku Planet.osz", + "929284 tieff - Sense of Nostalgia.osz", + "933940 Ben Briggs - Yes (Maybe).osz", + "934415 Ben Briggs - Fearless Living.osz", + "934627 Ben Briggs - New Game Plus.osz", + "934666 Ben Briggs - Wave Island.osz", + "936126 siromaru + cranky - conflict.osz", + "940377 onumi - ARROGANCE.osz", + "940597 tieff - Take Your Swimsuit.osz", + "941085 tieff - Our Story.osz", + "949297 tieff - Sunflower.osz", + "952380 Ben Briggs - Why Are We Yelling.osz", + "954272 *namirin - Kanzen Shouri*Esper Girl.osz", + "955866 KIRA & Heartbreaker - B.B.F (feat. Hatsune Miku & Kagamine Rin).osz", + "961320 Kuba Oms - All In All.osz", + "964553 The Flashbulb - You Take the World's Weight Away.osz", + "965651 Fractal Dreamers - Ad Astra.osz", + "966225 The Flashbulb - Passage D.osz", + "966324 DJ'TEKINA//SOMETHING - Hidamari no Uta.osz", + "972810 James Landino & Kabuki - Birdsong.osz", + "972932 James Landino - Hide And Seek.osz", + "977276 The Flashbulb - Mellann.osz", + "981616 *namirin - Mizutamari Tobikoete (with Nanahira).osz", + "985788 Loki - Wizard's Tower.osz", + "996628 OISHII - ONIGIRI FREEWAY.osz", + "996898 HyuN - White Aura.osz", + "1003554 yuki. - Nadeshiko Sensation.osz", + "1014936 Thaehan - Bwa !.osz", + "1019827 UNDEAD CORPORATION - Sad Dream.osz", + "1020213 Creo - Idolize.osz", + "1021450 Thaehan - Chiptune & Baroque.osz", + "707824 Fractal Dreamers - Fortuna Redux.osz", + "789553 Cranky - Ran.osz", + "827822 Function Phantom - Neuronecia.osz", + "847323 Nakanojojo - Bittersweet (feat. Kuishinboakachan a.k.a Kiato).osz", + "847433 Trial & Error - Tokoyami no keiyaku KEGARETA-SHOUJO feat. GUMI.osz", + "847576 dark cat - hot chocolate.osz", + "847957 Wisp X - Final Moments.osz", + "876282 VINXIS - Greetings.osz", + "876648 Thaehan - Angry Birds Epic (Remix).osz", + "877069 IAHN - Transform (Original Mix).osz", + "877496 Thaehan - Leprechaun.osz", + "877935 Thaehan - Overpowered.osz", + "878344 yuki. - Be Your Light.osz", + "918446 VINXIS - Facade.osz", + "918903 LukHash - Ghosts.osz", + "919251 *namirin - Hitokoto no Kyori.osz", + "919704 S3RL - I Will Pick You Up (feat. Tamika).osz", + "921535 SOOOO - Raven Haven.osz", + "927206 *namirin - Kanzen Shouri*Esper Girl.osz", + "927544 Camellia feat. Nanahira - Kansoku Eisei.osz", + "930806 Nakanojojo - Pararara (feat. Amekoya).osz", + "931741 Camellia - Quaoar.osz", + "935699 Rin - Mythic set ~ Heart-Stirring Urban Legends.osz", + "935732 Thaehan - Yuujou.osz", + "941145 Function Phantom - Euclid.osz", + "942334 Dictate - Cauldron.osz", + "946540 nanobii - astral blast.osz", + "948844 Rin - Kishinjou set 01 ~ Mist Lake.osz", + "949122 Wisp X - Petal.osz", + "951618 Rin - Kishinjou set 02 ~ Mermaid from the Uncharted Land.osz", + "957412 Rin - Lunatic set 16 ~ The Space Shrine Maiden Returns Home.osz", + "961335 Thaehan - Insert Coin.osz", + "965178 The Flashbulb - DIDJ PVC.osz", + "966087 The Flashbulb - Creep.osz", + "966277 The Flashbulb - Amen Iraq.osz", + "966407 LukHash - ROOM 12.osz", + "966451 The Flashbulb - Six Acid Strings.osz", + "972301 BilliumMoto - four veiled stars.osz", + "973173 nanobii - popsicle beach.osz", + "973954 BilliumMoto - Rocky Buinne (Short Ver.).osz", + "975435 BilliumMoto - life flashes before weeb eyes.osz", + "978759 L. V. Beethoven - Moonlight Sonata (Cranky Remix).osz", + "982559 BilliumMoto - HDHR.osz", + "984361 The Flashbulb - Ninedump.osz", + "1023681 Inferi - The Ruin of Mankind.osz", + "1034358 ALEPH - The Evil Spirit.osz", + "1037567 ALEPH - Scintillations.osz", + "554256 Helblinde - When Time Sleeps.osz", + "693123 yuki. - Nadeshiko Sensation.osz", + "767009 OISHII - PIZZA PLAZA.osz", + "767346 Thaehan - Bwa !.osz", + "815162 VINXIS - Greetings.osz", + "840964 cYsmix - Breeze.osz", + "932657 Wisp X - Eventide.osz", + "933700 onumi - CONFUSION PART ONE.osz", + "933984 onumi - PERSONALITY.osz", + "934785 onumi - FAKE.osz", + "936545 onumi - REGRET PART ONE.osz", + "943803 Fractal Dreamers - Everything for a Dream.osz", + "943876 S3RL - I Will Pick You Up (feat. Tamika).osz", + "946773 Trial & Error - DREAMING COLOR (Short Ver.).osz", + "955808 Trial & Error - Tokoyami no keiyaku KEGARETA-SHOUJO feat. GUMI (Short Ver.).osz", + "957808 Fractal Dreamers - Module_410.osz", + "957842 antiPLUR - One Life Left to Live.osz", + "965730 The Flashbulb - Lawn Wake IV (Black).osz", + "966240 Creo - Challenger.osz", + "968232 Rin - Lunatic set 15 ~ The Moon as Seen from the Shrine.osz", + "972302 VINXIS - A Centralized View.osz", + "972887 HyuN - Illusion of Inflict.osz", + "1008600 LukHash - WHEN AN ANGEL DIES.osz", + "1032103 LukHash - H8 U.osz", + "943516 antiPLUR - Clockwork Spooks.osz", + "946394 VINXIS - Three Times The Original Charm.osz", + "966408 antiPLUR - One Life Left to Live.osz", + "971561 antiPLUR - Runengon.osz", + "983864 James Landino - Shiba Island.osz", + "989512 BilliumMoto - 1xMISS.osz", + "994104 James Landino - Reaction feat. Slyleaf.osz", + "1003217 nekodex - circles!.osz", + "1009907 James Landino & Kabuki - Birdsong.osz", + "1015169 Thaehan - Insert Coin.osz", + }; + } +} From b042f1cad55680e61d4656522b4b4cb500a9e05a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Apr 2022 18:57:20 +0900 Subject: [PATCH 0542/2328] Add screen to perform bundled beatmap downloads --- .../FirstRunSetup/ScreenBundledBeatmaps.cs | 47 +++++++++++++++++++ osu.Game/Overlays/FirstRunSetupOverlay.cs | 1 + 2 files changed, 48 insertions(+) create mode 100644 osu.Game/Overlays/FirstRunSetup/ScreenBundledBeatmaps.cs diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBundledBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBundledBeatmaps.cs new file mode 100644 index 0000000000..fae852860b --- /dev/null +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBundledBeatmaps.cs @@ -0,0 +1,47 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.ComponentModel; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Beatmaps.Drawables; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Overlays.FirstRunSetup +{ + [Description("Bundled Beatmaps")] + public class ScreenBundledBeatmaps : FirstRunSetupScreen + { + private TriangleButton downloadButton; + + [BackgroundDependencyLoader] + private void load() + { + Content.Children = new Drawable[] + { + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + { + Text = "osu! doesn't come with any beatmaps pre-loaded. To get started, we have some recommended beatmaps.", + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + }, + downloadButton = new TriangleButton + { + Width = 300, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = "Download beatmap selection", + Action = download + } + }; + } + + private void download() + { + AddInternal(new BundledBeatmapDownloader()); + downloadButton.Enabled.Value = false; + } + } +} diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 82158793a2..b43f14522e 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -60,6 +60,7 @@ namespace osu.Game.Overlays private readonly Type[] steps = { typeof(ScreenWelcome), + typeof(ScreenBundledBeatmaps), typeof(ScreenUIScale) }; From 973dd4bfa9eab3d7d7ee934ed4b02df0a6c940ff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Apr 2022 19:41:13 +0900 Subject: [PATCH 0543/2328] Add initial flow for download button / progress display --- .../Drawables/BundledBeatmapDownloader.cs | 51 ++++++++++++++++--- .../FirstRunSetup/ScreenBundledBeatmaps.cs | 29 ++++++++++- 2 files changed, 72 insertions(+), 8 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs index 6b14ed760d..5937186705 100644 --- a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs +++ b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs @@ -1,37 +1,55 @@ // 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.Linq; using System.Text.RegularExpressions; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Utils; +using osu.Game.Database; +using osu.Game.Online; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Overlays; namespace osu.Game.Beatmaps.Drawables { public class BundledBeatmapDownloader : CompositeDrawable { - [Resolved] - private BeatmapModelDownloader beatmapDownloader { get; set; } + public IEnumerable DownloadTrackers => downloadTrackers; + + private readonly List downloadTrackers = new List(); [BackgroundDependencyLoader] - private void load() + private void load(BeatmapManager beatmapManager, IAPIProvider api, INotificationOverlay notifications) { + var beatmapDownloader = new BundledBeatmapModelDownloader(beatmapManager, api) + { + PostNotification = notifications.Post + }; + foreach (string filename in bundled_beatmap_filenames.OrderBy(_ => RNG.NextSingle()).Take(10)) { var match = Regex.Match(filename, @"([0-9]*) (.*) - (.*)\.osz"); - beatmapDownloader.Download(new APIBeatmapSet + var beatmapSet = new APIBeatmapSet { OnlineID = int.Parse(match.Groups[1].Value), Artist = match.Groups[2].Value, Title = match.Groups[3].Value, - }); + }; + + var beatmapDownloadTracker = new BeatmapDownloadTracker(beatmapSet); + downloadTrackers.Add(beatmapDownloadTracker); + AddInternal(beatmapDownloadTracker); + + beatmapDownloader.Download(beatmapSet); } } - private static readonly string[] bundled_beatmap_filenames = new[] + private static readonly string[] bundled_beatmap_filenames = { "682286 Yuyoyuppe - Emerald Galaxy.osz", "682287 baker - For a Dead Girl+.osz", @@ -223,5 +241,26 @@ namespace osu.Game.Beatmaps.Drawables "1009907 James Landino & Kabuki - Birdsong.osz", "1015169 Thaehan - Insert Coin.osz", }; + + private class BundledBeatmapModelDownloader : BeatmapModelDownloader + { + public BundledBeatmapModelDownloader(IModelImporter beatmapImporter, IAPIProvider api) + : base(beatmapImporter, api) + { + } + + protected override ArchiveDownloadRequest CreateDownloadRequest(IBeatmapSetInfo set, bool minimiseDownloadSize) + => new BundledBeatmapDownloadRequest(set, minimiseDownloadSize); + + public class BundledBeatmapDownloadRequest : DownloadBeatmapSetRequest + { + protected override string Uri => $"https://assets.ppy.sh/client-resources/bundled/{Model.OnlineID}.osz"; + + public BundledBeatmapDownloadRequest(IBeatmapSetInfo beatmapSetInfo, bool minimiseDownloadSize) + : base(beatmapSetInfo, minimiseDownloadSize) + { + } + } + } } } diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBundledBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBundledBeatmaps.cs index fae852860b..97f429bcf2 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBundledBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBundledBeatmaps.cs @@ -2,12 +2,15 @@ // See the LICENCE file in the repository root for full licence text. using System.ComponentModel; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; +using osu.Game.Online; +using osuTK.Graphics; namespace osu.Game.Overlays.FirstRunSetup { @@ -16,6 +19,9 @@ namespace osu.Game.Overlays.FirstRunSetup { private TriangleButton downloadButton; + private ProgressBar progressBar; + private BundledBeatmapDownloader downloader; + [BackgroundDependencyLoader] private void load() { @@ -34,14 +40,33 @@ namespace osu.Game.Overlays.FirstRunSetup Origin = Anchor.TopCentre, Text = "Download beatmap selection", Action = download - } + }, }; + + downloadButton.Add(progressBar = new ProgressBar(false) + { + RelativeSizeAxes = Axes.Both, + Blending = BlendingParameters.Additive, + FillColour = Color4.Aqua, + Alpha = 0.5f, + Depth = float.MinValue + }); } private void download() { - AddInternal(new BundledBeatmapDownloader()); + AddInternal(downloader = new BundledBeatmapDownloader()); downloadButton.Enabled.Value = false; + + foreach (var tracker in downloader.DownloadTrackers) + tracker.State.BindValueChanged(_ => updateProgress()); + } + + private void updateProgress() + { + double progress = (double)downloader.DownloadTrackers.Count(t => t.State.Value == DownloadState.LocallyAvailable) / downloader.DownloadTrackers.Count(); + + this.TransformBindableTo(progressBar.Current, progress, 1000, Easing.OutQuint); } } } From b424d20f267b26104eca245cf1f3de926f29849b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Apr 2022 20:18:46 +0900 Subject: [PATCH 0544/2328] Fix rounded buttons not allowing custom colour specifications --- osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs index 23ebc6e98d..f535a32b39 100644 --- a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; +using osuTK.Graphics; namespace osu.Game.Graphics.UserInterfaceV2 { @@ -28,7 +29,8 @@ namespace osu.Game.Graphics.UserInterfaceV2 [BackgroundDependencyLoader(true)] private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours) { - BackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3; + if (BackgroundColour == Color4.White) + BackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3; } protected override void LoadComplete() From 58399a5113e9bc5906e529672fc917b19a33a187 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Apr 2022 20:19:11 +0900 Subject: [PATCH 0545/2328] Add tutorial download support and improve the visuals "slightly" --- .../TestSceneBundledBeatmapDownloader.cs | 2 +- .../Drawables/BundledBeatmapDownloader.cs | 37 +++++-- .../FirstRunSetup/ScreenBundledBeatmaps.cs | 98 +++++++++++++++---- 3 files changed, 108 insertions(+), 29 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBundledBeatmapDownloader.cs b/osu.Game.Tests/Visual/Online/TestSceneBundledBeatmapDownloader.cs index 895524e79a..2af1c9a0f0 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBundledBeatmapDownloader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBundledBeatmapDownloader.cs @@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.Online AddStep("Create downloader", () => { downloader?.Expire(); - Add(downloader = new BundledBeatmapDownloader()); + Add(downloader = new BundledBeatmapDownloader(false)); }); } } diff --git a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs index 5937186705..0bdaaaca22 100644 --- a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs +++ b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs @@ -22,15 +22,34 @@ namespace osu.Game.Beatmaps.Drawables private readonly List downloadTrackers = new List(); - [BackgroundDependencyLoader] - private void load(BeatmapManager beatmapManager, IAPIProvider api, INotificationOverlay notifications) - { - var beatmapDownloader = new BundledBeatmapModelDownloader(beatmapManager, api) - { - PostNotification = notifications.Post - }; + private readonly List downloadableFilenames = new List(); - foreach (string filename in bundled_beatmap_filenames.OrderBy(_ => RNG.NextSingle()).Take(10)) + private BundledBeatmapModelDownloader beatmapDownloader; + + public BundledBeatmapDownloader(bool onlyTutorial) + { + if (onlyTutorial) + downloadableFilenames.Add(tutorial_filename); + else + downloadableFilenames.AddRange(bundled_beatmap_filenames); + } + + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + { + var localDependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + + localDependencies.CacheAs(beatmapDownloader = new BundledBeatmapModelDownloader(parent.Get(), parent.Get()) + { + PostNotification = parent.Get().Post + }); + + return localDependencies; + } + + [BackgroundDependencyLoader] + private void load() + { + foreach (string filename in downloadableFilenames.OrderBy(_ => RNG.NextSingle()).Take(10)) { var match = Regex.Match(filename, @"([0-9]*) (.*) - (.*)\.osz"); @@ -49,6 +68,8 @@ namespace osu.Game.Beatmaps.Drawables } } + private const string tutorial_filename = "1011011 nekodex - new beginnings.osz"; + private static readonly string[] bundled_beatmap_filenames = { "682286 Yuyoyuppe - Emerald Galaxy.osz", diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBundledBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBundledBeatmaps.cs index 97f429bcf2..518903e74b 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBundledBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBundledBeatmaps.cs @@ -9,64 +9,122 @@ using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Online; -using osuTK.Graphics; +using osuTK; namespace osu.Game.Overlays.FirstRunSetup { [Description("Bundled Beatmaps")] public class ScreenBundledBeatmaps : FirstRunSetupScreen { - private TriangleButton downloadButton; + private RoundedButton downloadBundledButton; - private ProgressBar progressBar; - private BundledBeatmapDownloader downloader; + private ProgressBar progressBarBundled; + + private RoundedButton downloadTutorialButton; + private ProgressBar progressBarTutorial; + + private BundledBeatmapDownloader tutorialDownloader; + private BundledBeatmapDownloader bundledDownloader; [BackgroundDependencyLoader] - private void load() + private void load(OsuColour colours) { + Vector2 buttonSize = new Vector2(500, 80); + Content.Children = new Drawable[] { new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { - Text = "osu! doesn't come with any beatmaps pre-loaded. To get started, we have some recommended beatmaps.", + Text = + "osu! doesn't come with any beatmaps pre-loaded. To get started, we have some recommended beatmaps. You can obtain more beatmaps from the main menu \"browse\" button at any time.", RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, - downloadButton = new TriangleButton + downloadTutorialButton = new RoundedButton { - Width = 300, + Size = buttonSize, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "Download beatmap selection", - Action = download + BackgroundColour = colours.Pink3, + Text = "Download tutorial", + Action = downloadTutorial }, + downloadBundledButton = new RoundedButton + { + Size = buttonSize, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + BackgroundColour = colours.Blue3, + Text = "Download beatmap selection", + Action = downloadBundled + }, + // TODO: add stable import button if a stable install is detected. }; - downloadButton.Add(progressBar = new ProgressBar(false) + downloadTutorialButton.Add(progressBarTutorial = new ProgressBar(false) { RelativeSizeAxes = Axes.Both, Blending = BlendingParameters.Additive, - FillColour = Color4.Aqua, + FillColour = downloadTutorialButton.BackgroundColour, + Alpha = 0.5f, + Depth = float.MinValue + }); + + downloadBundledButton.Add(progressBarBundled = new ProgressBar(false) + { + RelativeSizeAxes = Axes.Both, + Blending = BlendingParameters.Additive, + FillColour = downloadBundledButton.BackgroundColour, Alpha = 0.5f, Depth = float.MinValue }); } - private void download() + private void downloadTutorial() { - AddInternal(downloader = new BundledBeatmapDownloader()); - downloadButton.Enabled.Value = false; + if (tutorialDownloader != null) + return; - foreach (var tracker in downloader.DownloadTrackers) - tracker.State.BindValueChanged(_ => updateProgress()); + tutorialDownloader = new BundledBeatmapDownloader(true); + + AddInternal(tutorialDownloader); + + var downloadTracker = tutorialDownloader.DownloadTrackers.First(); + + downloadTracker.Progress.BindValueChanged(progress => + { + progressBarTutorial.Current.Value = progress.NewValue; + + if (progress.NewValue == 1) + downloadTutorialButton.Enabled.Value = false; + }, true); } - private void updateProgress() + private void downloadBundled() { - double progress = (double)downloader.DownloadTrackers.Count(t => t.State.Value == DownloadState.LocallyAvailable) / downloader.DownloadTrackers.Count(); + if (bundledDownloader != null) + return; - this.TransformBindableTo(progressBar.Current, progress, 1000, Easing.OutQuint); + // downloadBundledButton.Enabled.Value = false; + + bundledDownloader = new BundledBeatmapDownloader(false); + + AddInternal(bundledDownloader); + + foreach (var tracker in bundledDownloader.DownloadTrackers) + tracker.State.BindValueChanged(_ => updateProgress(), true); + + void updateProgress() + { + double progress = (double)bundledDownloader.DownloadTrackers.Count(t => t.State.Value == DownloadState.LocallyAvailable) / bundledDownloader.DownloadTrackers.Count(); + + this.TransformBindableTo(progressBarBundled.Current, progress, 1000, Easing.OutQuint); + + if (progress == 1) + downloadBundledButton.Enabled.Value = false; + } } } } From d0564657423632e9ae41978b085f85682054ba6b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 16:08:32 +0900 Subject: [PATCH 0546/2328] Remove explicit dependency on `INotificationOverlay` --- osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs index 0bdaaaca22..029bb37c18 100644 --- a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs +++ b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs @@ -38,10 +38,10 @@ namespace osu.Game.Beatmaps.Drawables { var localDependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - localDependencies.CacheAs(beatmapDownloader = new BundledBeatmapModelDownloader(parent.Get(), parent.Get()) - { - PostNotification = parent.Get().Post - }); + localDependencies.CacheAs(beatmapDownloader = new BundledBeatmapModelDownloader(parent.Get(), parent.Get())); + + if (parent.Get() is INotificationOverlay notifications) + beatmapDownloader.PostNotification = notifications.Post; return localDependencies; } From 3c0bdcaf3804717eb827bdbbcf579c6e8345143a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 16:09:00 +0900 Subject: [PATCH 0547/2328] Rename screen, add tests and add stable import step --- .../TestSceneFirstRunScreenBundledBeatmaps.cs | 24 ++++++ ...enBundledBeatmaps.cs => ScreenBeatmaps.cs} | 81 ++++++++++++++----- osu.Game/Overlays/FirstRunSetupOverlay.cs | 2 +- 3 files changed, 84 insertions(+), 23 deletions(-) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBundledBeatmaps.cs rename osu.Game/Overlays/FirstRunSetup/{ScreenBundledBeatmaps.cs => ScreenBeatmaps.cs} (52%) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBundledBeatmaps.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBundledBeatmaps.cs new file mode 100644 index 0000000000..51065939f0 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBundledBeatmaps.cs @@ -0,0 +1,24 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Screens; +using osu.Game.Overlays; +using osu.Game.Overlays.FirstRunSetup; + +namespace osu.Game.Tests.Visual.UserInterface +{ + public class TestSceneFirstRunScreenBundledBeatmaps : OsuManualInputManagerTestScene + { + [Cached] + private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); + + public TestSceneFirstRunScreenBundledBeatmaps() + { + AddStep("load screen", () => + { + Child = new ScreenStack(new ScreenBeatmaps()); + }); + } + } +} diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBundledBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs similarity index 52% rename from osu.Game/Overlays/FirstRunSetup/ScreenBundledBeatmaps.cs rename to osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs index 518903e74b..aff084be73 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBundledBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs @@ -1,3 +1,4 @@ +#nullable enable // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. @@ -6,39 +7,51 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps.Drawables; +using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Localisation; using osu.Game.Online; using osuTK; namespace osu.Game.Overlays.FirstRunSetup { - [Description("Bundled Beatmaps")] - public class ScreenBundledBeatmaps : FirstRunSetupScreen + [Description("Obtaining Beatmaps")] + public class ScreenBeatmaps : FirstRunSetupScreen { - private RoundedButton downloadBundledButton; + private RoundedButton downloadBundledButton = null!; + private RoundedButton importBeatmapsButton = null!; - private ProgressBar progressBarBundled; + private ProgressBar progressBarBundled = null!; - private RoundedButton downloadTutorialButton; - private ProgressBar progressBarTutorial; + private RoundedButton downloadTutorialButton = null!; + private ProgressBar progressBarTutorial = null!; - private BundledBeatmapDownloader tutorialDownloader; - private BundledBeatmapDownloader bundledDownloader; + private BundledBeatmapDownloader tutorialDownloader = null!; + private BundledBeatmapDownloader bundledDownloader = null!; - [BackgroundDependencyLoader] - private void load(OsuColour colours) + [BackgroundDependencyLoader(permitNulls: true)] + private void load(OsuColour colours, OverlayColourProvider overlayColourProvider, LegacyImportManager? legacyImportManager) { - Vector2 buttonSize = new Vector2(500, 80); + Vector2 buttonSize = new Vector2(500, 60); Content.Children = new Drawable[] { new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { + Colour = overlayColourProvider.Content1, Text = - "osu! doesn't come with any beatmaps pre-loaded. To get started, we have some recommended beatmaps. You can obtain more beatmaps from the main menu \"browse\" button at any time.", + "\"Beatmaps\" are what we call playable levels in osu!.\n\nosu! doesn't come with any beatmaps pre-loaded. This step will help you get started on your beatmap collection.", + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + }, + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + { + Colour = overlayColourProvider.Content1, + Text = + "If you are a new player, we recommend playing through the tutorial to get accustomed to the gameplay.", RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, @@ -51,6 +64,13 @@ namespace osu.Game.Overlays.FirstRunSetup Text = "Download tutorial", Action = downloadTutorial }, + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + { + Colour = overlayColourProvider.Content1, + Text = "To get you started, we have some recommended beatmaps.", + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + }, downloadBundledButton = new RoundedButton { Size = buttonSize, @@ -60,9 +80,34 @@ namespace osu.Game.Overlays.FirstRunSetup Text = "Download beatmap selection", Action = downloadBundled }, - // TODO: add stable import button if a stable install is detected. + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + { + Colour = overlayColourProvider.Content1, + Text = "If you have an existing osu! install, you can also choose to import your existing beatmap collection.", + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + }, + importBeatmapsButton = new RoundedButton + { + Size = buttonSize, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + BackgroundColour = colours.Blue3, + Text = MaintenanceSettingsStrings.ImportBeatmapsFromStable, + Action = () => + { + importBeatmapsButton.Enabled.Value = false; + legacyImportManager?.ImportFromStableAsync(StableContent.Beatmaps).ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true)); + } + }, + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + { + Colour = overlayColourProvider.Content1, + Text = "You can also obtain more beatmaps from the main menu \"browse\" button at any time.", + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + }, }; - downloadTutorialButton.Add(progressBarTutorial = new ProgressBar(false) { RelativeSizeAxes = Axes.Both, @@ -84,9 +129,6 @@ namespace osu.Game.Overlays.FirstRunSetup private void downloadTutorial() { - if (tutorialDownloader != null) - return; - tutorialDownloader = new BundledBeatmapDownloader(true); AddInternal(tutorialDownloader); @@ -104,11 +146,6 @@ namespace osu.Game.Overlays.FirstRunSetup private void downloadBundled() { - if (bundledDownloader != null) - return; - - // downloadBundledButton.Enabled.Value = false; - bundledDownloader = new BundledBeatmapDownloader(false); AddInternal(bundledDownloader); diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index b43f14522e..c151554081 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -60,7 +60,7 @@ namespace osu.Game.Overlays private readonly Type[] steps = { typeof(ScreenWelcome), - typeof(ScreenBundledBeatmaps), + typeof(ScreenBeatmaps), typeof(ScreenUIScale) }; From 081275e0b996b5198c116ebb2903d0ef9898e0e3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 16:36:25 +0900 Subject: [PATCH 0548/2328] Adjust text and layout --- osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs | 6 +++--- osu.Game/Overlays/FirstRunSetupOverlay.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs index aff084be73..b1e2394f89 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.FirstRunSetup { Colour = overlayColourProvider.Content1, Text = - "\"Beatmaps\" are what we call playable levels in osu!.\n\nosu! doesn't come with any beatmaps pre-loaded. This step will help you get started on your beatmap collection.", + "\"Beatmaps\" are what we call playable levels. osu! doesn't come with any beatmaps pre-loaded. This step will help you get started on your beatmap collection.", RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, @@ -61,7 +61,7 @@ namespace osu.Game.Overlays.FirstRunSetup Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, BackgroundColour = colours.Pink3, - Text = "Download tutorial", + Text = "Get the osu! tutorial", Action = downloadTutorial }, new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) @@ -77,7 +77,7 @@ namespace osu.Game.Overlays.FirstRunSetup Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, BackgroundColour = colours.Blue3, - Text = "Download beatmap selection", + Text = "Get recommended beatmaps", Action = downloadBundled }, new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index c151554081..13fb73bd27 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -83,7 +83,7 @@ namespace osu.Game.Overlays Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Horizontal = 50 }, + Padding = new MarginPadding { Horizontal = 70 * 2 }, Child = new InputBlockingContainer { Masking = true, @@ -104,7 +104,7 @@ namespace osu.Game.Overlays Padding = new MarginPadding { Vertical = 20, - Horizontal = 20, + Horizontal = 70, }, } }, From c860eb46b0274e28a32aff95c3935c37290fec8f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 17:11:29 +0900 Subject: [PATCH 0549/2328] Split out button implementation into its own class --- .../Overlays/FirstRunSetup/ScreenBeatmaps.cs | 97 ++++++++++++------- 1 file changed, 63 insertions(+), 34 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs index b1e2394f89..893c940a1d 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs @@ -5,6 +5,7 @@ using System.ComponentModel; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps.Drawables; using osu.Game.Database; @@ -21,19 +22,18 @@ namespace osu.Game.Overlays.FirstRunSetup [Description("Obtaining Beatmaps")] public class ScreenBeatmaps : FirstRunSetupScreen { - private RoundedButton downloadBundledButton = null!; - private RoundedButton importBeatmapsButton = null!; + private ProgressRoundedButton downloadBundledButton = null!; + private ProgressRoundedButton importBeatmapsButton = null!; + private ProgressRoundedButton downloadTutorialButton = null!; - private ProgressBar progressBarBundled = null!; + private BundledBeatmapDownloader? tutorialDownloader; + private BundledBeatmapDownloader? bundledDownloader; - private RoundedButton downloadTutorialButton = null!; - private ProgressBar progressBarTutorial = null!; - - private BundledBeatmapDownloader tutorialDownloader = null!; - private BundledBeatmapDownloader bundledDownloader = null!; + [Resolved] + private OsuColour colours { get; set; } = null!; [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuColour colours, OverlayColourProvider overlayColourProvider, LegacyImportManager? legacyImportManager) + private void load(OverlayColourProvider overlayColourProvider, LegacyImportManager? legacyImportManager) { Vector2 buttonSize = new Vector2(500, 60); @@ -55,7 +55,7 @@ namespace osu.Game.Overlays.FirstRunSetup RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, - downloadTutorialButton = new RoundedButton + downloadTutorialButton = new ProgressRoundedButton { Size = buttonSize, Anchor = Anchor.TopCentre, @@ -71,7 +71,7 @@ namespace osu.Game.Overlays.FirstRunSetup RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, - downloadBundledButton = new RoundedButton + downloadBundledButton = new ProgressRoundedButton { Size = buttonSize, Anchor = Anchor.TopCentre, @@ -87,7 +87,7 @@ namespace osu.Game.Overlays.FirstRunSetup RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, - importBeatmapsButton = new RoundedButton + importBeatmapsButton = new ProgressRoundedButton { Size = buttonSize, Anchor = Anchor.TopCentre, @@ -97,7 +97,13 @@ namespace osu.Game.Overlays.FirstRunSetup Action = () => { importBeatmapsButton.Enabled.Value = false; - legacyImportManager?.ImportFromStableAsync(StableContent.Beatmaps).ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true)); + legacyImportManager?.ImportFromStableAsync(StableContent.Beatmaps).ContinueWith(t => Schedule(() => + { + // TODO: can we know if the import was successful? + // if so we should turn the button green and disable it in that case alone. + // importBeatmapsButton.Enabled.Value = true; + importBeatmapsButton.Complete(); + })); } }, new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) @@ -108,27 +114,13 @@ namespace osu.Game.Overlays.FirstRunSetup AutoSizeAxes = Axes.Y }, }; - downloadTutorialButton.Add(progressBarTutorial = new ProgressBar(false) - { - RelativeSizeAxes = Axes.Both, - Blending = BlendingParameters.Additive, - FillColour = downloadTutorialButton.BackgroundColour, - Alpha = 0.5f, - Depth = float.MinValue - }); - - downloadBundledButton.Add(progressBarBundled = new ProgressBar(false) - { - RelativeSizeAxes = Axes.Both, - Blending = BlendingParameters.Additive, - FillColour = downloadBundledButton.BackgroundColour, - Alpha = 0.5f, - Depth = float.MinValue - }); } private void downloadTutorial() { + if (tutorialDownloader != null) + return; + tutorialDownloader = new BundledBeatmapDownloader(true); AddInternal(tutorialDownloader); @@ -137,15 +129,18 @@ namespace osu.Game.Overlays.FirstRunSetup downloadTracker.Progress.BindValueChanged(progress => { - progressBarTutorial.Current.Value = progress.NewValue; + downloadTutorialButton.Current.Value = progress.NewValue; if (progress.NewValue == 1) - downloadTutorialButton.Enabled.Value = false; + downloadTutorialButton.Complete(); }, true); } private void downloadBundled() { + if (bundledDownloader != null) + return; + bundledDownloader = new BundledBeatmapDownloader(false); AddInternal(bundledDownloader); @@ -157,10 +152,44 @@ namespace osu.Game.Overlays.FirstRunSetup { double progress = (double)bundledDownloader.DownloadTrackers.Count(t => t.State.Value == DownloadState.LocallyAvailable) / bundledDownloader.DownloadTrackers.Count(); - this.TransformBindableTo(progressBarBundled.Current, progress, 1000, Easing.OutQuint); + this.TransformBindableTo(downloadBundledButton.Current, progress, 2000, Easing.OutQuint); if (progress == 1) - downloadBundledButton.Enabled.Value = false; + downloadBundledButton.Complete(); + } + } + + private class ProgressRoundedButton : RoundedButton + { + [Resolved] + private OsuColour colours { get; set; } = null!; + + private ProgressBar progressBar = null!; + + public Bindable Current => progressBar.Current; + + protected override void LoadComplete() + { + base.LoadComplete(); + + Add(progressBar = new ProgressBar(false) + { + RelativeSizeAxes = Axes.Both, + Blending = BlendingParameters.Additive, + FillColour = BackgroundColour, + Alpha = 0.5f, + Depth = float.MinValue + }); + } + + public void Complete() + { + Enabled.Value = false; + + Background.FadeColour(colours.Green, 500, Easing.OutQuint); + progressBar.FillColour = colours.Green; + + this.TransformBindableTo(Current, 1, 500, Easing.OutQuint); } } } From 18a38f7e23786e2e83de7a9c6478e440b64fe8aa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 17:46:00 +0900 Subject: [PATCH 0550/2328] Move `FastRandom` to `LegacyRandom` in `osu.Game` project --- .../Beatmaps/CatchBeatmapProcessor.cs | 8 +- .../Beatmaps/ManiaBeatmapConverter.cs | 8 +- .../Legacy/DistanceObjectPatternGenerator.cs | 4 +- .../Legacy/EndTimeObjectPatternGenerator.cs | 4 +- .../Legacy/HitObjectPatternGenerator.cs | 4 +- .../Patterns/Legacy/PatternGenerator.cs | 6 +- .../MathUtils/FastRandom.cs | 95 ------------------- .../Utils/LegacyRandom.cs | 37 +++++--- 8 files changed, 40 insertions(+), 126 deletions(-) delete mode 100644 osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs rename osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs => osu.Game/Utils/LegacyRandom.cs (79%) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs index 346a09cac8..ab61b14ac4 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs @@ -5,10 +5,10 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; -using osu.Game.Rulesets.Catch.MathUtils; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Objects.Types; +using osu.Game.Utils; namespace osu.Game.Rulesets.Catch.Beatmaps { @@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps public void ApplyPositionOffsets(IBeatmap beatmap) { - var rng = new FastRandom(RNG_SEED); + var rng = new LegacyRandom(RNG_SEED); float? lastPosition = null; double lastStartTime = 0; @@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps initialiseHyperDash(beatmap); } - private static void applyHardRockOffset(CatchHitObject hitObject, ref float? lastPosition, ref double lastStartTime, FastRandom rng) + private static void applyHardRockOffset(CatchHitObject hitObject, ref float? lastPosition, ref double lastStartTime, LegacyRandom rng) { float offsetPosition = hitObject.OriginalX; double startTime = hitObject.StartTime; @@ -146,7 +146,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps /// The position which the offset should be applied to. /// The maximum offset, cannot exceed 20px. /// The random number generator. - private static void applyRandomOffset(ref float position, double maxOffset, FastRandom rng) + private static void applyRandomOffset(ref float position, double maxOffset, LegacyRandom rng) { bool right = rng.NextBool(); float rand = Math.Min(20, (float)rng.Next(0, Math.Max(0, maxOffset))); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 47e0e6d7b1..207c6907c8 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -11,8 +11,8 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Mania.Beatmaps.Patterns; -using osu.Game.Rulesets.Mania.MathUtils; using osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy; +using osu.Game.Utils; using osuTK; namespace osu.Game.Rulesets.Mania.Beatmaps @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps private readonly int originalTargetColumns; // Internal for testing purposes - internal FastRandom Random { get; private set; } + internal LegacyRandom Random { get; private set; } private Pattern lastPattern = new Pattern(); @@ -84,7 +84,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps IBeatmapDifficultyInfo difficulty = original.Difficulty; int seed = (int)MathF.Round(difficulty.DrainRate + difficulty.CircleSize) * 20 + (int)(difficulty.OverallDifficulty * 41.2) + (int)MathF.Round(difficulty.ApproachRate); - Random = new FastRandom(seed); + Random = new LegacyRandom(seed); return base.ConvertBeatmap(original, cancellationToken); } @@ -227,7 +227,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps /// private class SpecificBeatmapPatternGenerator : Patterns.Legacy.PatternGenerator { - public SpecificBeatmapPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) + public SpecificBeatmapPatternGenerator(LegacyRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) : base(random, hitObject, beatmap, previousPattern, originalBeatmap) { } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 5f8b58d94d..dafe65f415 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -8,12 +8,12 @@ using System.Linq; using osu.Framework.Extensions.EnumExtensions; using osu.Game.Audio; using osu.Game.Beatmaps; -using osu.Game.Rulesets.Mania.MathUtils; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.Formats; +using osu.Game.Utils; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy private PatternType convertType; - public DistanceObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) + public DistanceObjectPatternGenerator(LegacyRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) : base(random, hitObject, beatmap, previousPattern, originalBeatmap) { convertType = PatternType.None; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index f816a70ab3..2265d3d347 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -2,13 +2,13 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using osu.Game.Rulesets.Mania.MathUtils; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using System.Linq; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Utils; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy private readonly int endTime; private readonly PatternType convertType; - public EndTimeObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) + public EndTimeObjectPatternGenerator(LegacyRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) : base(random, hitObject, beatmap, previousPattern, originalBeatmap) { endTime = (int)((HitObject as IHasDuration)?.EndTime ?? 0); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index 53b059b4e2..41d4c9322b 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -9,11 +9,11 @@ using osuTK; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Rulesets.Mania.MathUtils; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Game.Utils; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy private readonly PatternType convertType; - public HitObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, double previousTime, Vector2 previousPosition, double density, + public HitObjectPatternGenerator(LegacyRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, double previousTime, Vector2 previousPosition, double density, PatternType lastStair, IBeatmap originalBeatmap) : base(random, hitObject, beatmap, previousPattern, originalBeatmap) { diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs index eaf0ea0f2b..d5689c047a 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs @@ -5,8 +5,8 @@ using System; using System.Linq; using JetBrains.Annotations; using osu.Game.Beatmaps; -using osu.Game.Rulesets.Mania.MathUtils; using osu.Game.Rulesets.Objects; +using osu.Game.Utils; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { @@ -23,14 +23,14 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// /// The random number generator to use. /// - protected readonly FastRandom Random; + protected readonly LegacyRandom Random; /// /// The beatmap which is being converted from. /// protected readonly IBeatmap OriginalBeatmap; - protected PatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) + protected PatternGenerator(LegacyRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) : base(hitObject, beatmap, previousPattern) { if (random == null) throw new ArgumentNullException(nameof(random)); diff --git a/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs b/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs deleted file mode 100644 index a9cd7f2476..0000000000 --- a/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs +++ /dev/null @@ -1,95 +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 System; - -namespace osu.Game.Rulesets.Mania.MathUtils -{ - /// - /// A PRNG specified in http://heliosphan.org/fastrandom.html. - /// - internal class FastRandom - { - private const double int_to_real = 1.0 / (int.MaxValue + 1.0); - private const uint int_mask = 0x7FFFFFFF; - private const uint y = 842502087; - private const uint z = 3579807591; - private const uint w = 273326509; - - internal uint X { get; private set; } - internal uint Y { get; private set; } = y; - internal uint Z { get; private set; } = z; - internal uint W { get; private set; } = w; - - public FastRandom(int seed) - { - X = (uint)seed; - } - - public FastRandom() - : this(Environment.TickCount) - { - } - - /// - /// Generates a random unsigned integer within the range [, ). - /// - /// The random value. - public uint NextUInt() - { - uint t = X ^ (X << 11); - X = Y; - Y = Z; - Z = W; - return W = W ^ (W >> 19) ^ t ^ (t >> 8); - } - - /// - /// Generates a random integer value within the range [0, ). - /// - /// The random value. - public int Next() => (int)(int_mask & NextUInt()); - - /// - /// Generates a random integer value within the range [0, ). - /// - /// The upper bound. - /// The random value. - public int Next(int upperBound) => (int)(NextDouble() * upperBound); - - /// - /// Generates a random integer value within the range [, ). - /// - /// The lower bound of the range. - /// The upper bound of the range. - /// The random value. - public int Next(int lowerBound, int upperBound) => (int)(lowerBound + NextDouble() * (upperBound - lowerBound)); - - /// - /// Generates a random double value within the range [0, 1). - /// - /// The random value. - public double NextDouble() => int_to_real * Next(); - - private uint bitBuffer; - private int bitIndex = 32; - - /// - /// Generates a reandom boolean value. Cached such that a random value is only generated once in every 32 calls. - /// - /// The random value. - public bool NextBool() - { - if (bitIndex == 32) - { - bitBuffer = NextUInt(); - bitIndex = 1; - - return (bitBuffer & 1) == 1; - } - - bitIndex++; - return ((bitBuffer >>= 1) & 1) == 1; - } - } -} diff --git a/osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs b/osu.Game/Utils/LegacyRandom.cs similarity index 79% rename from osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs rename to osu.Game/Utils/LegacyRandom.cs index 46e427e1b7..cf731aa91f 100644 --- a/osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs +++ b/osu.Game/Utils/LegacyRandom.cs @@ -2,27 +2,36 @@ // See the LICENCE file in the repository root for full licence text. using System; +using osu.Framework.Utils; -namespace osu.Game.Rulesets.Catch.MathUtils +namespace osu.Game.Utils { /// /// A PRNG specified in http://heliosphan.org/fastrandom.html. + /// Should only be used to match legacy behaviour. See for a newer alternative. /// - public class FastRandom + /// + /// Known in osu-stable code as `FastRandom`. + /// + public class LegacyRandom { private const double int_to_real = 1.0 / (int.MaxValue + 1.0); private const uint int_mask = 0x7FFFFFFF; - private const uint y_initial = 842502087; - private const uint z_initial = 3579807591; - private const uint w_initial = 273326509; - private uint x, y = y_initial, z = z_initial, w = w_initial; + private const uint y = 842502087; + private const uint z = 3579807591; + private const uint w = 273326509; - public FastRandom(int seed) + public uint X { get; private set; } + public uint Y { get; private set; } = y; + public uint Z { get; private set; } = z; + public uint W { get; private set; } = w; + + public LegacyRandom(int seed) { - x = (uint)seed; + X = (uint)seed; } - public FastRandom() + public LegacyRandom() : this(Environment.TickCount) { } @@ -33,11 +42,11 @@ namespace osu.Game.Rulesets.Catch.MathUtils /// The random value. public uint NextUInt() { - uint t = x ^ (x << 11); - x = y; - y = z; - z = w; - return w = w ^ (w >> 19) ^ t ^ (t >> 8); + uint t = X ^ (X << 11); + X = Y; + Y = Z; + Z = W; + return W = W ^ (W >> 19) ^ t ^ (t >> 8); } /// From 3c9e52018834ab2409758e57fae5d0fa3a71f548 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 17:24:47 +0900 Subject: [PATCH 0551/2328] Update bundle logic to match stable --- .../Drawables/BundledBeatmapDownloader.cs | 84 +++++++++++++------ 1 file changed, 58 insertions(+), 26 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs index 029bb37c18..5b81022cbf 100644 --- a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs +++ b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs @@ -1,18 +1,19 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; -using osu.Framework.Utils; using osu.Game.Database; using osu.Game.Online; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; +using osu.Game.Utils; namespace osu.Game.Beatmaps.Drawables { @@ -29,9 +30,16 @@ namespace osu.Game.Beatmaps.Drawables public BundledBeatmapDownloader(bool onlyTutorial) { if (onlyTutorial) - downloadableFilenames.Add(tutorial_filename); + { + queueDownloads(new[] { tutorial_filename }); + } else - downloadableFilenames.AddRange(bundled_beatmap_filenames); + { + queueDownloads(bundled_osu, 8); + queueDownloads(bundled_taiko, 3); + queueDownloads(bundled_catch, 3); + queueDownloads(bundled_mania, 3); + } } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) @@ -49,7 +57,7 @@ namespace osu.Game.Beatmaps.Drawables [BackgroundDependencyLoader] private void load() { - foreach (string filename in downloadableFilenames.OrderBy(_ => RNG.NextSingle()).Take(10)) + foreach (string filename in downloadableFilenames) { var match = Regex.Match(filename, @"([0-9]*) (.*) - (.*)\.osz"); @@ -68,9 +76,42 @@ namespace osu.Game.Beatmaps.Drawables } } + private void queueDownloads(string[] sourceFilenames, int? limit = null) + { + try + { + // Matches osu-stable, in order to provide new users with roughly the same randomised selection of bundled beatmaps. + var random = new LegacyRandom(DateTime.UtcNow.Year * 1000 + (DateTime.UtcNow.DayOfYear / 7)); + + downloadableFilenames.AddRange(sourceFilenames.OrderBy(x => random.NextDouble()).Take(limit ?? int.MaxValue)); + } + catch { } + } + + private class BundledBeatmapModelDownloader : BeatmapModelDownloader + { + public BundledBeatmapModelDownloader(IModelImporter beatmapImporter, IAPIProvider api) + : base(beatmapImporter, api) + { + } + + protected override ArchiveDownloadRequest CreateDownloadRequest(IBeatmapSetInfo set, bool minimiseDownloadSize) + => new BundledBeatmapDownloadRequest(set, minimiseDownloadSize); + + public class BundledBeatmapDownloadRequest : DownloadBeatmapSetRequest + { + protected override string Uri => $"https://assets.ppy.sh/client-resources/bundled/{Model.OnlineID}.osz"; + + public BundledBeatmapDownloadRequest(IBeatmapSetInfo beatmapSetInfo, bool minimiseDownloadSize) + : base(beatmapSetInfo, minimiseDownloadSize) + { + } + } + } + private const string tutorial_filename = "1011011 nekodex - new beginnings.osz"; - private static readonly string[] bundled_beatmap_filenames = + private static readonly string[] bundled_osu = { "682286 Yuyoyuppe - Emerald Galaxy.osz", "682287 baker - For a Dead Girl+.osz", @@ -180,6 +221,10 @@ namespace osu.Game.Beatmaps.Drawables "1019827 UNDEAD CORPORATION - Sad Dream.osz", "1020213 Creo - Idolize.osz", "1021450 Thaehan - Chiptune & Baroque.osz", + }; + + private static readonly string[] bundled_taiko = + { "707824 Fractal Dreamers - Fortuna Redux.osz", "789553 Cranky - Ran.osz", "827822 Function Phantom - Neuronecia.osz", @@ -227,6 +272,10 @@ namespace osu.Game.Beatmaps.Drawables "1023681 Inferi - The Ruin of Mankind.osz", "1034358 ALEPH - The Evil Spirit.osz", "1037567 ALEPH - Scintillations.osz", + }; + + private static readonly string[] bundled_catch = + { "554256 Helblinde - When Time Sleeps.osz", "693123 yuki. - Nadeshiko Sensation.osz", "767009 OISHII - PIZZA PLAZA.osz", @@ -251,6 +300,10 @@ namespace osu.Game.Beatmaps.Drawables "972887 HyuN - Illusion of Inflict.osz", "1008600 LukHash - WHEN AN ANGEL DIES.osz", "1032103 LukHash - H8 U.osz", + }; + + private static readonly string[] bundled_mania = + { "943516 antiPLUR - Clockwork Spooks.osz", "946394 VINXIS - Three Times The Original Charm.osz", "966408 antiPLUR - One Life Left to Live.osz", @@ -262,26 +315,5 @@ namespace osu.Game.Beatmaps.Drawables "1009907 James Landino & Kabuki - Birdsong.osz", "1015169 Thaehan - Insert Coin.osz", }; - - private class BundledBeatmapModelDownloader : BeatmapModelDownloader - { - public BundledBeatmapModelDownloader(IModelImporter beatmapImporter, IAPIProvider api) - : base(beatmapImporter, api) - { - } - - protected override ArchiveDownloadRequest CreateDownloadRequest(IBeatmapSetInfo set, bool minimiseDownloadSize) - => new BundledBeatmapDownloadRequest(set, minimiseDownloadSize); - - public class BundledBeatmapDownloadRequest : DownloadBeatmapSetRequest - { - protected override string Uri => $"https://assets.ppy.sh/client-resources/bundled/{Model.OnlineID}.osz"; - - public BundledBeatmapDownloadRequest(IBeatmapSetInfo beatmapSetInfo, bool minimiseDownloadSize) - : base(beatmapSetInfo, minimiseDownloadSize) - { - } - } - } } } From 9f6597695ce4555cbaa12df3d4705534d05f928e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 18:17:29 +0900 Subject: [PATCH 0552/2328] Only mark stable import complete if it actually completes --- osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs index 893c940a1d..abbef52f8f 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs @@ -99,10 +99,10 @@ namespace osu.Game.Overlays.FirstRunSetup importBeatmapsButton.Enabled.Value = false; legacyImportManager?.ImportFromStableAsync(StableContent.Beatmaps).ContinueWith(t => Schedule(() => { - // TODO: can we know if the import was successful? - // if so we should turn the button green and disable it in that case alone. - // importBeatmapsButton.Enabled.Value = true; - importBeatmapsButton.Complete(); + if (t.IsCompletedSuccessfully) + importBeatmapsButton.Complete(); + else + importBeatmapsButton.Enabled.Value = true; })); } }, From 4e0d70cbf49322e74362c88bba9f4bd5a0eb6e06 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 18:26:29 +0900 Subject: [PATCH 0553/2328] Internalise bindable and progress handling to ensure transforms don't go backwards --- .../Overlays/FirstRunSetup/ScreenBeatmaps.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs index abbef52f8f..e02ba4d3ed 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs @@ -5,7 +5,6 @@ using System.ComponentModel; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps.Drawables; using osu.Game.Database; @@ -129,7 +128,7 @@ namespace osu.Game.Overlays.FirstRunSetup downloadTracker.Progress.BindValueChanged(progress => { - downloadTutorialButton.Current.Value = progress.NewValue; + downloadTutorialButton.SetProgress(progress.NewValue, false); if (progress.NewValue == 1) downloadTutorialButton.Complete(); @@ -152,10 +151,10 @@ namespace osu.Game.Overlays.FirstRunSetup { double progress = (double)bundledDownloader.DownloadTrackers.Count(t => t.State.Value == DownloadState.LocallyAvailable) / bundledDownloader.DownloadTrackers.Count(); - this.TransformBindableTo(downloadBundledButton.Current, progress, 2000, Easing.OutQuint); - if (progress == 1) downloadBundledButton.Complete(); + else + downloadBundledButton.SetProgress(progress, true); } } @@ -166,8 +165,6 @@ namespace osu.Game.Overlays.FirstRunSetup private ProgressBar progressBar = null!; - public Bindable Current => progressBar.Current; - protected override void LoadComplete() { base.LoadComplete(); @@ -189,7 +186,15 @@ namespace osu.Game.Overlays.FirstRunSetup Background.FadeColour(colours.Green, 500, Easing.OutQuint); progressBar.FillColour = colours.Green; - this.TransformBindableTo(Current, 1, 500, Easing.OutQuint); + this.TransformBindableTo(progressBar.Current, 1, 500, Easing.OutQuint); + } + + public void SetProgress(double progress, bool animated) + { + if (!Enabled.Value) + return; + + this.TransformBindableTo(progressBar.Current, progress, animated ? 500 : 0, Easing.OutQuint); } } } From 88bfd5dece938e0e886dce8f433191cd7fe4b9ca Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 18:57:32 +0900 Subject: [PATCH 0554/2328] Show current beatmap count on beatmap screen --- .../FirstRunSetup/FirstRunSetupScreen.cs | 7 ++- .../Overlays/FirstRunSetup/ScreenBeatmaps.cs | 63 +++++++++++++++++-- 2 files changed, 62 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs index 282ba52ddc..d4032306ad 100644 --- a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs +++ b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs @@ -19,8 +19,11 @@ namespace osu.Game.Overlays.FirstRunSetup protected FillFlowContainer Content { get; private set; } + [Resolved] + protected OverlayColourProvider OverlayColourProvider { get; private set; } + [BackgroundDependencyLoader] - private void load(OverlayColourProvider overlayColourProvider) + private void load() { const float header_size = 40; const float spacing = 20; @@ -36,7 +39,7 @@ namespace osu.Game.Overlays.FirstRunSetup { Text = this.GetLocalisableDescription(), Font = OsuFont.Default.With(size: header_size), - Colour = overlayColourProvider.Light1, + Colour = OverlayColourProvider.Light1, }, Content = new FillFlowContainer { diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs index e02ba4d3ed..fda9fde8b7 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs @@ -2,10 +2,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.ComponentModel; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Database; using osu.Game.Graphics; @@ -15,6 +17,8 @@ using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; using osu.Game.Online; using osuTK; +using Realms; +using Container = osu.Framework.Graphics.Containers.Container; namespace osu.Game.Overlays.FirstRunSetup { @@ -25,14 +29,21 @@ namespace osu.Game.Overlays.FirstRunSetup private ProgressRoundedButton importBeatmapsButton = null!; private ProgressRoundedButton downloadTutorialButton = null!; + private OsuTextFlowContainer currentlyLoadedBeatmaps = null!; + private BundledBeatmapDownloader? tutorialDownloader; private BundledBeatmapDownloader? bundledDownloader; [Resolved] private OsuColour colours { get; set; } = null!; + [Resolved] + private RealmAccess realmAccess { get; set; } = null!; + + private IDisposable? beatmapSubscription; + [BackgroundDependencyLoader(permitNulls: true)] - private void load(OverlayColourProvider overlayColourProvider, LegacyImportManager? legacyImportManager) + private void load(LegacyImportManager? legacyImportManager) { Vector2 buttonSize = new Vector2(500, 60); @@ -40,15 +51,31 @@ namespace osu.Game.Overlays.FirstRunSetup { new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { - Colour = overlayColourProvider.Content1, + Colour = OverlayColourProvider.Content1, Text = "\"Beatmaps\" are what we call playable levels. osu! doesn't come with any beatmaps pre-loaded. This step will help you get started on your beatmap collection.", RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, + new Container + { + RelativeSizeAxes = Axes.X, + Height = 30, + Children = new Drawable[] + { + currentlyLoadedBeatmaps = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 24, weight: FontWeight.SemiBold)) + { + Colour = OverlayColourProvider.Content2, + TextAnchor = Anchor.Centre, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + }, + } + }, new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { - Colour = overlayColourProvider.Content1, + Colour = OverlayColourProvider.Content1, Text = "If you are a new player, we recommend playing through the tutorial to get accustomed to the gameplay.", RelativeSizeAxes = Axes.X, @@ -65,7 +92,7 @@ namespace osu.Game.Overlays.FirstRunSetup }, new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { - Colour = overlayColourProvider.Content1, + Colour = OverlayColourProvider.Content1, Text = "To get you started, we have some recommended beatmaps.", RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y @@ -81,7 +108,7 @@ namespace osu.Game.Overlays.FirstRunSetup }, new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { - Colour = overlayColourProvider.Content1, + Colour = OverlayColourProvider.Content1, Text = "If you have an existing osu! install, you can also choose to import your existing beatmap collection.", RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y @@ -107,7 +134,7 @@ namespace osu.Game.Overlays.FirstRunSetup }, new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { - Colour = overlayColourProvider.Content1, + Colour = OverlayColourProvider.Content1, Text = "You can also obtain more beatmaps from the main menu \"browse\" button at any time.", RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y @@ -115,6 +142,30 @@ namespace osu.Game.Overlays.FirstRunSetup }; } + protected override void LoadComplete() + { + base.LoadComplete(); + + beatmapSubscription = realmAccess.RegisterForNotifications(r => r.All().Where(s => !s.DeletePending && !s.Protected), beatmapsChanged); + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + beatmapSubscription?.Dispose(); + } + + private void beatmapsChanged(IRealmCollection sender, ChangeSet? changes, Exception error) + { + currentlyLoadedBeatmaps.Text = $"You currently have {sender.Count} beatmap(s) loaded!"; + + if (changes != null && (changes.DeletedIndices.Any() || changes.InsertedIndices.Any())) + { + currentlyLoadedBeatmaps.FadeColour(colours.YellowLight).FadeColour(OverlayColourProvider.Content2); + currentlyLoadedBeatmaps.ScaleTo(1.1f).ScaleTo(1, 1000, Easing.OutQuint); + } + } + private void downloadTutorial() { if (tutorialDownloader != null) From 804848c9fb546aea2634da3e9b45c9eee2d6ad10 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 18:57:41 +0900 Subject: [PATCH 0555/2328] Allow bundled downloader to not post notifications --- .../Beatmaps/Drawables/BundledBeatmapDownloader.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs index 5b81022cbf..bc99aa4a5a 100644 --- a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs +++ b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs @@ -19,6 +19,8 @@ namespace osu.Game.Beatmaps.Drawables { public class BundledBeatmapDownloader : CompositeDrawable { + private readonly bool shouldPostNotifications; + public IEnumerable DownloadTrackers => downloadTrackers; private readonly List downloadTrackers = new List(); @@ -27,8 +29,15 @@ namespace osu.Game.Beatmaps.Drawables private BundledBeatmapModelDownloader beatmapDownloader; - public BundledBeatmapDownloader(bool onlyTutorial) + /// + /// Construct a new beatmap downloader. + /// + /// Whether only the tutorial should be downloaded, instead of bundled beatmaps. + /// Whether downloads should create tracking notifications. + public BundledBeatmapDownloader(bool onlyTutorial, bool shouldPostNotifications = false) { + this.shouldPostNotifications = shouldPostNotifications; + if (onlyTutorial) { queueDownloads(new[] { tutorial_filename }); @@ -48,7 +57,7 @@ namespace osu.Game.Beatmaps.Drawables localDependencies.CacheAs(beatmapDownloader = new BundledBeatmapModelDownloader(parent.Get(), parent.Get())); - if (parent.Get() is INotificationOverlay notifications) + if (shouldPostNotifications && parent.Get() is INotificationOverlay notifications) beatmapDownloader.PostNotification = notifications.Post; return localDependencies; From b6896376e7db72813bbd8c42a6d9ce9bd26c3a45 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 19:08:16 +0900 Subject: [PATCH 0556/2328] Better signal when no beatmaps are loaded --- osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs index fda9fde8b7..645713c52a 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs @@ -159,10 +159,17 @@ namespace osu.Game.Overlays.FirstRunSetup { currentlyLoadedBeatmaps.Text = $"You currently have {sender.Count} beatmap(s) loaded!"; - if (changes != null && (changes.DeletedIndices.Any() || changes.InsertedIndices.Any())) + if (sender.Count == 0) { - currentlyLoadedBeatmaps.FadeColour(colours.YellowLight).FadeColour(OverlayColourProvider.Content2); - currentlyLoadedBeatmaps.ScaleTo(1.1f).ScaleTo(1, 1000, Easing.OutQuint); + currentlyLoadedBeatmaps.FadeColour(colours.Red1, 500, Easing.OutQuint); + } + else if (changes != null && (changes.DeletedIndices.Any() || changes.InsertedIndices.Any())) + { + currentlyLoadedBeatmaps.FadeColour(colours.Yellow) + .FadeColour(OverlayColourProvider.Content2, 1500, Easing.OutQuint); + + currentlyLoadedBeatmaps.ScaleTo(1.1f) + .ScaleTo(1, 1500, Easing.OutQuint); } } From 14316855f9a478734cc4627463e70332c3b8fdbc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 19:26:28 +0900 Subject: [PATCH 0557/2328] Add localisation length hinting --- .editorconfig | 2 ++ osu.Game/.editorconfig | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index be5652954b..49e83c9103 100644 --- a/.editorconfig +++ b/.editorconfig @@ -175,6 +175,8 @@ csharp_style_prefer_switch_expression = false:none #Supressing roslyn built-in analyzers # Suppress: EC112 +dotnet_diagnostic.OLOC001.words_in_name = 5 + #Private method is unused dotnet_diagnostic.IDE0051.severity = silent #Private member is unused diff --git a/osu.Game/.editorconfig b/osu.Game/.editorconfig index 4107d1bb35..539cd56dab 100644 --- a/osu.Game/.editorconfig +++ b/osu.Game/.editorconfig @@ -1,3 +1,4 @@ [*.cs] +dotnet_diagnostic.OLOC001.words_in_name = 5 dotnet_diagnostic.OLOC001.prefix_namespace = osu.Game.Resources.Localisation -dotnet_diagnostic.OLOC001.license_header = // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.\n// See the LICENCE file in the repository root for full licence text. \ No newline at end of file +dotnet_diagnostic.OLOC001.license_header = // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.\n// See the LICENCE file in the repository root for full licence text. From 694f33b827d327b2b8fb8afd7e39761c8a12a25b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 19:33:16 +0900 Subject: [PATCH 0558/2328] Add localisation of beatmaps screen --- .../FirstRunSetupBeatmapScreenStrings.cs | 54 +++++++++++++++++++ .../Overlays/FirstRunSetup/ScreenBeatmaps.cs | 22 ++++---- 2 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 osu.Game/Localisation/FirstRunSetupBeatmapScreenStrings.cs diff --git a/osu.Game/Localisation/FirstRunSetupBeatmapScreenStrings.cs b/osu.Game/Localisation/FirstRunSetupBeatmapScreenStrings.cs new file mode 100644 index 0000000000..3a7fe4bb12 --- /dev/null +++ b/osu.Game/Localisation/FirstRunSetupBeatmapScreenStrings.cs @@ -0,0 +1,54 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Localisation; + +namespace osu.Game.Localisation +{ + public static class FirstRunSetupBeatmapScreenStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.FirstRunSetupBeatmapScreen"; + + /// + /// "Obtaining Beatmaps" + /// + public static LocalisableString Header => new TranslatableString(getKey(@"header"), @"Obtaining Beatmaps"); + + /// + /// ""Beatmaps" are what we call playable levels. osu! doesn't come with any beatmaps pre-loaded. This step will help you get started on your beatmap collection." + /// + public static LocalisableString Description => new TranslatableString(getKey(@"description"), @"""Beatmaps"" are what we call playable levels. osu! doesn't come with any beatmaps pre-loaded. This step will help you get started on your beatmap collection."); + + /// + /// "If you are a new player, we recommend playing through the tutorial to get accustomed to the gameplay." + /// + public static LocalisableString TutorialDescription => new TranslatableString(getKey(@"tutorial_description"), @"If you are a new player, we recommend playing through the tutorial to get accustomed to the gameplay."); + + /// + /// "Get the osu! tutorial" + /// + public static LocalisableString TutorialButton => new TranslatableString(getKey(@"tutorial_button"), @"Get the osu! tutorial"); + + /// + /// "To get you started, we have some recommended beatmaps." + /// + public static LocalisableString BundledDescription => new TranslatableString(getKey(@"bundled_description"), @"To get you started, we have some recommended beatmaps."); + + /// + /// "Get recommended beatmaps" + /// + public static LocalisableString BundledButton => new TranslatableString(getKey(@"bundled_button"), @"Get recommended beatmaps"); + + /// + /// "You can also obtain more beatmaps from the main menu "browse" button at any time." + /// + public static LocalisableString ObtainMoreBeatmaps => new TranslatableString(getKey(@"obtain_more_beatmaps"), @"You can also obtain more beatmaps from the main menu ""browse"" button at any time."); + + /// + /// "You currently have {0} beatmap(s) loaded!" + /// + public static LocalisableString CurrentlyLoadedBeatmaps(int beatmaps) => new TranslatableString(getKey(@"currently_loaded_beatmaps"), @"You currently have {0} beatmap(s) loaded!", beatmaps); + + private static string getKey(string key) => $@"{prefix}:{key}"; + } +} diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs index 645713c52a..892856d280 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs @@ -3,10 +3,11 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.ComponentModel; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Database; @@ -18,11 +19,10 @@ using osu.Game.Localisation; using osu.Game.Online; using osuTK; using Realms; -using Container = osu.Framework.Graphics.Containers.Container; namespace osu.Game.Overlays.FirstRunSetup { - [Description("Obtaining Beatmaps")] + [LocalisableDescription(typeof(FirstRunSetupBeatmapScreenStrings), nameof(FirstRunSetupBeatmapScreenStrings.Header))] public class ScreenBeatmaps : FirstRunSetupScreen { private ProgressRoundedButton downloadBundledButton = null!; @@ -52,8 +52,7 @@ namespace osu.Game.Overlays.FirstRunSetup new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { Colour = OverlayColourProvider.Content1, - Text = - "\"Beatmaps\" are what we call playable levels. osu! doesn't come with any beatmaps pre-loaded. This step will help you get started on your beatmap collection.", + Text = FirstRunSetupBeatmapScreenStrings.Description, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, @@ -76,8 +75,7 @@ namespace osu.Game.Overlays.FirstRunSetup new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { Colour = OverlayColourProvider.Content1, - Text = - "If you are a new player, we recommend playing through the tutorial to get accustomed to the gameplay.", + Text = FirstRunSetupBeatmapScreenStrings.TutorialDescription, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, @@ -87,13 +85,13 @@ namespace osu.Game.Overlays.FirstRunSetup Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, BackgroundColour = colours.Pink3, - Text = "Get the osu! tutorial", + Text = FirstRunSetupBeatmapScreenStrings.TutorialButton, Action = downloadTutorial }, new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { Colour = OverlayColourProvider.Content1, - Text = "To get you started, we have some recommended beatmaps.", + Text = FirstRunSetupBeatmapScreenStrings.BundledDescription, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, @@ -103,7 +101,7 @@ namespace osu.Game.Overlays.FirstRunSetup Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, BackgroundColour = colours.Blue3, - Text = "Get recommended beatmaps", + Text = FirstRunSetupBeatmapScreenStrings.BundledButton, Action = downloadBundled }, new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) @@ -135,7 +133,7 @@ namespace osu.Game.Overlays.FirstRunSetup new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { Colour = OverlayColourProvider.Content1, - Text = "You can also obtain more beatmaps from the main menu \"browse\" button at any time.", + Text = FirstRunSetupBeatmapScreenStrings.ObtainMoreBeatmaps, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, @@ -157,7 +155,7 @@ namespace osu.Game.Overlays.FirstRunSetup private void beatmapsChanged(IRealmCollection sender, ChangeSet? changes, Exception error) { - currentlyLoadedBeatmaps.Text = $"You currently have {sender.Count} beatmap(s) loaded!"; + currentlyLoadedBeatmaps.Text = FirstRunSetupBeatmapScreenStrings.CurrentlyLoadedBeatmaps(sender.Count); if (sender.Count == 0) { From fe0fcc7e9ea522ebfa9bca7a71603de316a80371 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 28 Apr 2022 20:00:38 +0900 Subject: [PATCH 0559/2328] Rename countdown object --- .../Multiplayer/ForceGameplayStartCountdown.cs | 17 +++++++++++++++++ .../Multiplayer/GameplayStartCountdown.cs | 15 --------------- .../Online/Multiplayer/MultiplayerCountdown.cs | 2 +- osu.Game/Online/SignalRWorkaroundTypes.cs | 2 +- 4 files changed, 19 insertions(+), 17 deletions(-) create mode 100644 osu.Game/Online/Multiplayer/ForceGameplayStartCountdown.cs delete mode 100644 osu.Game/Online/Multiplayer/GameplayStartCountdown.cs diff --git a/osu.Game/Online/Multiplayer/ForceGameplayStartCountdown.cs b/osu.Game/Online/Multiplayer/ForceGameplayStartCountdown.cs new file mode 100644 index 0000000000..4ec5019a07 --- /dev/null +++ b/osu.Game/Online/Multiplayer/ForceGameplayStartCountdown.cs @@ -0,0 +1,17 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using MessagePack; + +namespace osu.Game.Online.Multiplayer +{ + /// + /// A started by the server when clients being to load. + /// Indicates how long until gameplay will forcefully start, excluding any users which have not completed loading, + /// and forcing progression of any clients that are blocking load due to user interaction. + /// + [MessagePackObject] + public class ForceGameplayStartCountdown : MultiplayerCountdown + { + } +} diff --git a/osu.Game/Online/Multiplayer/GameplayStartCountdown.cs b/osu.Game/Online/Multiplayer/GameplayStartCountdown.cs deleted file mode 100644 index d3d7f78507..0000000000 --- a/osu.Game/Online/Multiplayer/GameplayStartCountdown.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 MessagePack; - -namespace osu.Game.Online.Multiplayer -{ - /// - /// A indicating that gameplay will start after a given period of time. - /// - [MessagePackObject] - public class GameplayStartCountdown : MultiplayerCountdown - { - } -} diff --git a/osu.Game/Online/Multiplayer/MultiplayerCountdown.cs b/osu.Game/Online/Multiplayer/MultiplayerCountdown.cs index 308eea3aef..dbf2ab667b 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerCountdown.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerCountdown.cs @@ -14,7 +14,7 @@ namespace osu.Game.Online.Multiplayer /// [MessagePackObject] [Union(0, typeof(MatchStartCountdown))] // IMPORTANT: Add rules to SignalRUnionWorkaroundResolver for new derived types. - [Union(1, typeof(GameplayStartCountdown))] + [Union(1, typeof(ForceGameplayStartCountdown))] public abstract class MultiplayerCountdown { /// diff --git a/osu.Game/Online/SignalRWorkaroundTypes.cs b/osu.Game/Online/SignalRWorkaroundTypes.cs index 00fdadb87e..d1f0ba725f 100644 --- a/osu.Game/Online/SignalRWorkaroundTypes.cs +++ b/osu.Game/Online/SignalRWorkaroundTypes.cs @@ -25,7 +25,7 @@ namespace osu.Game.Online (typeof(TeamVersusRoomState), typeof(MatchRoomState)), (typeof(TeamVersusUserState), typeof(MatchUserState)), (typeof(MatchStartCountdown), typeof(MultiplayerCountdown)), - (typeof(GameplayStartCountdown), typeof(MultiplayerCountdown)) + (typeof(ForceGameplayStartCountdown), typeof(MultiplayerCountdown)) }; } } From f300b62877cad3c2c25b52fae29c7a446a887dda Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 20:03:54 +0900 Subject: [PATCH 0560/2328] Add `ScrollIntoView` method which accepts an offset to allow usage in mod select --- .../Graphics/Containers/OsuScrollContainer.cs | 21 +++++++++++++++++++ osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs index 017ea6ec32..817b8409e6 100644 --- a/osu.Game/Graphics/Containers/OsuScrollContainer.cs +++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs @@ -3,6 +3,7 @@ #nullable enable +using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -57,6 +58,26 @@ namespace osu.Game.Graphics.Containers { } + /// + /// Scrolls a into view. + /// + /// The to scroll into view. + /// Whether to animate the movement. + /// An added amount to scroll beyond the requirement to bring the target into view. + public void ScrollIntoView(Drawable d, bool animated = true, float extraScroll = 0) + { + float childPos0 = GetChildPosInContent(d); + float childPos1 = GetChildPosInContent(d, d.DrawSize); + + float minPos = Math.Min(childPos0, childPos1); + float maxPos = Math.Max(childPos0, childPos1); + + if (minPos < Current || (minPos > Current && d.DrawSize[ScrollDim] > DisplayableContent)) + ScrollTo(minPos - extraScroll, animated); + else if (maxPos > Current + DisplayableContent) + ScrollTo(maxPos - DisplayableContent + extraScroll, animated); + } + protected override bool OnMouseDown(MouseDownEvent e) { if (shouldPerformRightMouseScroll(e)) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 03a66575c4..ffd6e9a52c 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -161,7 +161,7 @@ namespace osu.Game.Overlays.Mods { AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, - RequestScroll = column => columnScroll.ScrollTo(Math.Clamp(column.DrawPosition.X - 70, 0, columnScroll.ScrollableExtent)) + RequestScroll = column => columnScroll.ScrollIntoView(column, extraScroll: 140) }; protected override void LoadComplete() From 1d8ac6917dc4a3fe58f67b254a32143b2c9bd632 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 28 Apr 2022 20:10:47 +0900 Subject: [PATCH 0561/2328] Send Loaded state from PlayerLoader on update thread --- .../Multiplayer/MultiplayerPlayer.cs | 3 --- .../Multiplayer/MultiplayerPlayerLoader.cs | 22 +++++++++++++++++++ osu.Game/Screens/Play/PlayerLoader.cs | 10 ++++++++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs index 7dd57ee50f..02ff040a94 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs @@ -133,9 +133,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer failAndBail(); } }), true); - - client.ChangeState(MultiplayerUserState.Loaded) - .ContinueWith(task => failAndBail(task.Exception?.Message ?? "Server error"), TaskContinuationOptions.NotOnRanToCompletion); } protected override void LoadComplete() diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs index 236df7917c..7f01bd64ab 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs @@ -2,7 +2,9 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Threading.Tasks; using osu.Framework.Allocation; +using osu.Framework.Logging; using osu.Framework.Screens; using osu.Game.Online.Multiplayer; using osu.Game.Screens.Play; @@ -28,6 +30,26 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer // The server is forcefully starting gameplay. || multiplayerClient.LocalUser?.State == MultiplayerUserState.Playing; + protected override void OnPlayerLoaded() + { + base.OnPlayerLoaded(); + + multiplayerClient.ChangeState(MultiplayerUserState.Loaded) + .ContinueWith(task => failAndBail(task.Exception?.Message ?? "Server error"), TaskContinuationOptions.NotOnRanToCompletion); + } + + private void failAndBail(string message = null) + { + if (!string.IsNullOrEmpty(message)) + Logger.Log(message, LoggingTarget.Runtime, LogLevel.Important); + + Schedule(() => + { + if (this.IsCurrentScreen()) + this.Exit(); + }); + } + public override void OnSuspending(ScreenTransitionEvent e) { base.OnSuspending(e); diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index bdfa822cb0..d75466764d 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -368,7 +368,15 @@ namespace osu.Game.Screens.Play CurrentPlayer.RestartCount = restartCount++; CurrentPlayer.RestartRequested = restartRequested; - LoadTask = LoadComponentAsync(CurrentPlayer, _ => MetadataInfo.Loading = false); + LoadTask = LoadComponentAsync(CurrentPlayer, _ => + { + MetadataInfo.Loading = false; + OnPlayerLoaded(); + }); + } + + protected virtual void OnPlayerLoaded() + { } private void restartRequested() From a50dd2ae93becc4c980c88e8b881a1a914e8b914 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 20:15:40 +0900 Subject: [PATCH 0562/2328] Fix rider failures in nullable --- osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs index 892856d280..190a0badab 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs @@ -1,7 +1,8 @@ -#nullable enable // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Linq; using osu.Framework.Allocation; From b902e69634ea7f56e4af3ceb29037186695b39b1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 20:16:32 +0900 Subject: [PATCH 0563/2328] Update test expectations based on new screen order --- .../Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index 31c4d66784..836cf6caad 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -178,7 +178,7 @@ namespace osu.Game.Tests.Visual.UserInterface { AddStep("step to next", () => overlay.NextButton.TriggerClick()); - AddAssert("is at known screen", () => overlay.CurrentScreen is ScreenUIScale); + AddAssert("is at known screen", () => overlay.CurrentScreen is ScreenBeatmaps); AddStep("hide", () => overlay.Hide()); AddAssert("overlay hidden", () => overlay.State.Value == Visibility.Hidden); @@ -188,7 +188,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("run notification action", () => lastNotification.Activated()); AddAssert("overlay shown", () => overlay.State.Value == Visibility.Visible); - AddAssert("is resumed", () => overlay.CurrentScreen is ScreenUIScale); + AddAssert("is resumed", () => overlay.CurrentScreen is ScreenBeatmaps); } } } From 32ad2166698528574947aca2c17fe28eb35d2757 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Apr 2022 22:58:32 +0900 Subject: [PATCH 0564/2328] Allow dragging the osu! logo Logic borrowed from `NowPlayingOverlay`. --- osu.Game/Screens/Menu/OsuLogo.cs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 1d3aef0653..1217a28fe7 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -109,7 +109,7 @@ namespace osu.Game.Screens.Menu AutoSizeAxes = Axes.Both, Children = new Drawable[] { - logoBounceContainer = new Container + logoBounceContainer = new DragContainer { AutoSizeAxes = Axes.Both, Children = new Drawable[] @@ -402,5 +402,26 @@ namespace osu.Game.Screens.Menu impactContainer.ScaleTo(0.96f); impactContainer.ScaleTo(1.12f, 250); } + + private class DragContainer : Container + { + protected override bool OnDragStart(DragStartEvent e) => true; + + protected override void OnDrag(DragEvent e) + { + Vector2 change = e.MousePosition - e.MouseDownPosition; + + // Diminish the drag distance as we go further to simulate "rubber band" feeling. + change *= change.Length <= 0 ? 0 : MathF.Pow(change.Length, 0.6f) / change.Length; + + this.MoveTo(change); + } + + protected override void OnDragEnd(DragEndEvent e) + { + this.MoveTo(Vector2.Zero, 800, Easing.OutElastic); + base.OnDragEnd(e); + } + } } } From d5702e29558f7845e27e4a60bbf2c88231535d3f Mon Sep 17 00:00:00 2001 From: Pasi4K5 Date: Thu, 28 Apr 2022 18:29:37 +0200 Subject: [PATCH 0565/2328] Append incompatible mods to `base.IncompatibleMods` --- osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs b/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs index 5d262cd95e..b27b1a7267 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public class OsuModClassic : ModClassic, IApplicableToHitObject, IApplicableToDrawableHitObject, IApplicableToDrawableRuleset { - public override Type[] IncompatibleMods => new[] { typeof(OsuModStrictTracking), typeof(OsuModTarget) }; + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModStrictTracking), typeof(OsuModTarget) }).ToArray(); [SettingSource("No slider head accuracy requirement", "Scores sliders proportionally to the number of ticks hit.")] public Bindable NoSliderHeadAccuracy { get; } = new BindableBool(true); diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs index 7a7e189c29..23500f5da6 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public override string Description => "It never gets boring!"; - public override Type[] IncompatibleMods => new[] { typeof(OsuModTarget) }; + public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModTarget)).ToArray(); private static readonly float playfield_diagonal = OsuPlayfield.BASE_SIZE.LengthFast; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs index 4d6c09f919..bb21550c56 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => @"Practice keeping up with the beat of the song."; public override double ScoreMultiplier => 1; - public override Type[] IncompatibleMods => new[] + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(IRequiresApproachCircles), typeof(OsuModClassic), @@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.Mods typeof(OsuModSpunOut), typeof(OsuModStrictTracking), typeof(OsuModSuddenDeath) - }; + }).ToArray(); [SettingSource("Seed", "Use a custom seed instead of a random one", SettingControlType = typeof(SettingsNumberBox))] public Bindable Seed { get; } = new Bindable From fa5c05120c913dd9c5931d7e92a84d8ba5b4b4c0 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 20:04:52 +0300 Subject: [PATCH 0566/2328] Allow rewinding random in song select with Shift + Left Click --- osu.Game/Screens/Select/FooterButtonRandom.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osu.Game/Screens/Select/FooterButtonRandom.cs b/osu.Game/Screens/Select/FooterButtonRandom.cs index 1d4722cf5d..5cdf381879 100644 --- a/osu.Game/Screens/Select/FooterButtonRandom.cs +++ b/osu.Game/Screens/Select/FooterButtonRandom.cs @@ -59,6 +59,18 @@ namespace osu.Game.Screens.Select }; } + protected override bool OnClick(ClickEvent e) + { + rewindSearch = e.ShiftPressed; + return base.OnClick(e); + } + + protected override void OnMouseUp(MouseUpEvent e) + { + rewindSearch = false; + base.OnMouseUp(e); + } + public override bool OnPressed(KeyBindingPressEvent e) { rewindSearch = e.Action == GlobalAction.SelectPreviousRandom; From e31fdc28ddbadae1e8bd2150d6ea695bd4b133e6 Mon Sep 17 00:00:00 2001 From: Pasi4K5 Date: Thu, 28 Apr 2022 22:31:48 +0200 Subject: [PATCH 0567/2328] Make Classic and Target compatible again --- osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs b/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs index b27b1a7267..76ff361ce3 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public class OsuModClassic : ModClassic, IApplicableToHitObject, IApplicableToDrawableHitObject, IApplicableToDrawableRuleset { - public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModStrictTracking), typeof(OsuModTarget) }).ToArray(); + public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModStrictTracking)).ToArray(); [SettingSource("No slider head accuracy requirement", "Scores sliders proportionally to the number of ticks hit.")] public Bindable NoSliderHeadAccuracy { get; } = new BindableBool(true); diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs index bb21550c56..5b121f4673 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs @@ -45,7 +45,6 @@ namespace osu.Game.Rulesets.Osu.Mods public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(IRequiresApproachCircles), - typeof(OsuModClassic), typeof(OsuModRandom), typeof(OsuModSpunOut), typeof(OsuModStrictTracking), From 294340279eb5614a8a6d1c23d305b6ba9aa5a174 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 04:14:09 +0300 Subject: [PATCH 0568/2328] Add inputting test coverage --- .../SongSelect/TestSceneSongSelectFooter.cs | 90 ++++++++++++++----- 1 file changed, 70 insertions(+), 20 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectFooter.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectFooter.cs index 0ac65b357c..6485123b29 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectFooter.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectFooter.cs @@ -1,35 +1,85 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Screens.Select; +using osuTK.Input; namespace osu.Game.Tests.Visual.SongSelect { public class TestSceneSongSelectFooter : OsuManualInputManagerTestScene { - public TestSceneSongSelectFooter() - { - AddStep("Create footer", () => - { - Footer footer; - AddRange(new Drawable[] - { - footer = new Footer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - } - }); + private FooterButtonRandom randomButton; - footer.AddButton(new FooterButtonMods(), null); - footer.AddButton(new FooterButtonRandom - { - NextRandom = () => { }, - PreviousRandom = () => { }, - }, null); - footer.AddButton(new FooterButtonOptions(), null); + private bool nextRandomCalled; + private bool previousRandomCalled; + + [SetUp] + public void SetUp() => Schedule(() => + { + nextRandomCalled = false; + previousRandomCalled = false; + + Footer footer; + + Child = footer = new Footer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }; + + footer.AddButton(new FooterButtonMods(), null); + footer.AddButton(randomButton = new FooterButtonRandom + { + NextRandom = () => nextRandomCalled = true, + PreviousRandom = () => previousRandomCalled = true, + }, null); + footer.AddButton(new FooterButtonOptions(), null); + }); + + [Test] + public void TestFooterRandom() + { + AddStep("press F2", () => InputManager.Key(Key.F2)); + AddAssert("next random invoked", () => nextRandomCalled && !previousRandomCalled); + } + + [Test] + public void TestFooterRandomViaMouse() + { + AddStep("click button", () => + { + InputManager.MoveMouseTo(randomButton); + InputManager.Click(MouseButton.Left); }); + AddAssert("next random invoked", () => nextRandomCalled && !previousRandomCalled); + } + + [Test] + public void TestFooterRewind() + { + AddStep("press Shift+F2", () => + { + InputManager.PressKey(Key.LShift); + InputManager.PressKey(Key.F2); + InputManager.ReleaseKey(Key.F2); + InputManager.ReleaseKey(Key.LShift); + }); + AddAssert("previous random invoked", () => previousRandomCalled && !nextRandomCalled); + } + + [Test] + public void TestFooterRewindViaMouse() + { + AddStep("shift + click button", () => + { + InputManager.PressKey(Key.LShift); + InputManager.MoveMouseTo(randomButton); + InputManager.Click(MouseButton.Left); + InputManager.ReleaseKey(Key.LShift); + }); + AddAssert("previous random invoked", () => previousRandomCalled && !nextRandomCalled); } } } From 7442ae283cee27f591c76c80de62c915d190829d Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 05:24:00 +0300 Subject: [PATCH 0569/2328] Tidy up test cases a touch --- .../Mods/TestSceneOsuModAlternate.cs | 60 +++++++++++-------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAlternate.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAlternate.cs index de1f61a0bd..67654c11f2 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAlternate.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAlternate.cs @@ -16,31 +16,6 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods { public class TestSceneOsuModAlternate : OsuModTestScene { - [Test] - public void TestInputAtIntro() => CreateModTest(new ModTestData - { - Mod = new OsuModAlternate(), - PassCondition = () => Player.ScoreProcessor.Combo.Value == 1, - Autoplay = false, - Beatmap = new Beatmap - { - HitObjects = new List - { - new HitCircle - { - StartTime = 1000, - Position = new Vector2(100), - }, - }, - }, - ReplayFrames = new List - { - new OsuReplayFrame(500, new Vector2(200), OsuAction.LeftButton), - new OsuReplayFrame(501, new Vector2(200)), - new OsuReplayFrame(1000, new Vector2(100), OsuAction.LeftButton), - } - }); - [Test] public void TestInputAlternating() => CreateModTest(new ModTestData { @@ -116,6 +91,39 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods } }); + /// + /// Ensures alternation is reset before the first hitobject after intro. + /// + [Test] + public void TestInputSingularAtIntro() => CreateModTest(new ModTestData + { + Mod = new OsuModAlternate(), + PassCondition = () => Player.ScoreProcessor.Combo.Value == 1, + Autoplay = false, + Beatmap = new Beatmap + { + HitObjects = new List + { + new HitCircle + { + StartTime = 1000, + Position = new Vector2(100), + }, + }, + }, + ReplayFrames = new List + { + // first press during intro. + new OsuReplayFrame(500, new Vector2(200), OsuAction.LeftButton), + new OsuReplayFrame(501, new Vector2(200)), + // press same key at hitobject and ensure it has been hit. + new OsuReplayFrame(1000, new Vector2(100), OsuAction.LeftButton), + } + }); + + /// + /// Ensures alternation is reset after a break. + /// [Test] public void TestInputSingularWithBreak() => CreateModTest(new ModTestData { @@ -144,8 +152,10 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods }, ReplayFrames = new List { + // first press to start alternate lock. new OsuReplayFrame(500, new Vector2(100), OsuAction.LeftButton), new OsuReplayFrame(501, new Vector2(100)), + // press same key at second hitobject and ensure it has been hit. new OsuReplayFrame(2500, new Vector2(100), OsuAction.LeftButton), new OsuReplayFrame(2501, new Vector2(100)), } From 845e7dba95d28d2d37bf8502db04ee7910cb0e63 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Apr 2022 11:27:14 +0900 Subject: [PATCH 0570/2328] Reduce padding slightly to restore usability of UI scale screen --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index c3dcdef318..4277f0f2ba 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -84,7 +84,7 @@ namespace osu.Game.Overlays Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Horizontal = 70 * 2 }, + Padding = new MarginPadding { Horizontal = 70 * 1.2f }, Child = new InputBlockingContainer { Masking = true, From 723d70be7096b300e86568b937b2f2998f4ded56 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 05:26:19 +0300 Subject: [PATCH 0571/2328] Change `TestInputSingularWithBreak` to reproduce case of pressing before second object --- .../Mods/TestSceneOsuModAlternate.cs | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAlternate.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAlternate.cs index 67654c11f2..5e46498aca 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAlternate.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAlternate.cs @@ -122,19 +122,19 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods }); /// - /// Ensures alternation is reset after a break. + /// Ensures alternation is reset before the first hitobject after a break. /// [Test] public void TestInputSingularWithBreak() => CreateModTest(new ModTestData { Mod = new OsuModAlternate(), - PassCondition = () => Player.ScoreProcessor.Combo.Value == 2, + PassCondition = () => Player.ScoreProcessor.Combo.Value == 0 && Player.ScoreProcessor.HighestCombo.Value == 2, Autoplay = false, Beatmap = new Beatmap { Breaks = new List { - new BreakPeriod(500, 2250), + new BreakPeriod(500, 2000), }, HitObjects = new List { @@ -146,8 +146,13 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods new HitCircle { StartTime = 2500, - Position = new Vector2(100), - } + Position = new Vector2(500, 100), + }, + new HitCircle + { + StartTime = 3000, + Position = new Vector2(500, 100), + }, } }, ReplayFrames = new List @@ -155,9 +160,15 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods // first press to start alternate lock. new OsuReplayFrame(500, new Vector2(100), OsuAction.LeftButton), new OsuReplayFrame(501, new Vector2(100)), + // press same key after break but before hit object. + new OsuReplayFrame(2250, new Vector2(300, 100), OsuAction.LeftButton), + new OsuReplayFrame(2251, new Vector2(300, 100)), // press same key at second hitobject and ensure it has been hit. - new OsuReplayFrame(2500, new Vector2(100), OsuAction.LeftButton), - new OsuReplayFrame(2501, new Vector2(100)), + new OsuReplayFrame(2500, new Vector2(500, 100), OsuAction.LeftButton), + new OsuReplayFrame(2501, new Vector2(500, 100)), + // press same key at third hitobject and ensure it has been missed. + new OsuReplayFrame(3000, new Vector2(500, 100), OsuAction.LeftButton), + new OsuReplayFrame(3001, new Vector2(500, 100)), } }); } From 92d4463e55acf51e8707d3eddbba642ec6a22541 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Apr 2022 11:45:18 +0900 Subject: [PATCH 0572/2328] Add "always bundled" beatmaps --- .../Beatmaps/Drawables/BundledBeatmapDownloader.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs index bc99aa4a5a..df0a69cb25 100644 --- a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs +++ b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs @@ -44,6 +44,8 @@ namespace osu.Game.Beatmaps.Drawables } else { + queueDownloads(always_bundled_beatmaps); + queueDownloads(bundled_osu, 8); queueDownloads(bundled_taiko, 3); queueDownloads(bundled_catch, 3); @@ -120,6 +122,15 @@ namespace osu.Game.Beatmaps.Drawables private const string tutorial_filename = "1011011 nekodex - new beginnings.osz"; + /// + /// Contest winners or other special cases. + /// + private static readonly string[] always_bundled_beatmaps = + { + // This thing is 40mb, I'm not sure we want it here... + @"1388906 Raphlesia & BilliumMoto - My Love.osz" + }; + private static readonly string[] bundled_osu = { "682286 Yuyoyuppe - Emerald Galaxy.osz", From 6ccbdc85a37fc172159f591762efe4110875e3fe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Apr 2022 11:56:46 +0900 Subject: [PATCH 0573/2328] Improve setting description text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- osu.Game/Screens/Play/SongProgress.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index a21a08e558..b38dcb937d 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -42,7 +42,7 @@ namespace osu.Game.Screens.Play /// public readonly Bindable AllowSeeking = new Bindable(); - [SettingSource("Show difficulty graph", "Whether a graph should show difficulty throughout the beatmap")] + [SettingSource("Show difficulty graph", "Whether a graph displaying difficulty throughout the beatmap should be shown")] public Bindable ShowGraph { get; } = new BindableBool(true); public override bool HandleNonPositionalInput => AllowSeeking.Value; From 22e9620211fd32352494ef48ba336dad178471b3 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 29 Apr 2022 12:09:11 +0900 Subject: [PATCH 0574/2328] Don't block clicks when dragging osu! logo --- osu.Game/Screens/Menu/OsuLogo.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 1217a28fe7..f5743c7d5a 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -405,6 +405,8 @@ namespace osu.Game.Screens.Menu private class DragContainer : Container { + public override bool DragBlocksClick => false; + protected override bool OnDragStart(DragStartEvent e) => true; protected override void OnDrag(DragEvent e) From d7441fbcd443464ca8e2e108ac677e68b42f1f51 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 29 Apr 2022 12:16:37 +0900 Subject: [PATCH 0575/2328] Move diagnostic down --- .editorconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index 49e83c9103..840fa98334 100644 --- a/.editorconfig +++ b/.editorconfig @@ -175,8 +175,6 @@ csharp_style_prefer_switch_expression = false:none #Supressing roslyn built-in analyzers # Suppress: EC112 -dotnet_diagnostic.OLOC001.words_in_name = 5 - #Private method is unused dotnet_diagnostic.IDE0051.severity = silent #Private member is unused @@ -193,4 +191,5 @@ dotnet_diagnostic.CA2225.severity = none # Banned APIs dotnet_diagnostic.RS0030.severity = error +dotnet_diagnostic.OLOC001.words_in_name = 5 dotnet_diagnostic.OLOC001.license_header = // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.\n// See the LICENCE file in the repository root for full licence text. From a4ca8bfe75ab0aa19c3aa20275492cdfe4a182fa Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 05:26:56 +0300 Subject: [PATCH 0576/2328] Improve "Alternate" to reset before first hitobject after break --- osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs | 51 +++++++++++-------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs index 46b97dd23b..dfa28a537a 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs @@ -2,21 +2,24 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using System.Linq; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; +using osu.Game.Beatmaps.Timing; using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Screens.Play; +using osu.Game.Utils; namespace osu.Game.Rulesets.Osu.Mods { - public class OsuModAlternate : Mod, IApplicableToDrawableRuleset, IApplicableToPlayer + public class OsuModAlternate : Mod, IApplicableToDrawableRuleset { public override string Name => @"Alternate"; public override string Acronym => @"AL"; @@ -26,9 +29,16 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Conversion; public override IconUsage? Icon => FontAwesome.Solid.Keyboard; - private double firstObjectValidJudgementTime; - private IBindable isBreakTime; private const double flash_duration = 1000; + + /// + /// A tracker for periods where alternate should not be forced (i.e. non-gameplay periods). + /// + /// + /// This is different from in that the periods here end strictly at the first object after the break, rather than the break's end time. + /// + private PeriodTracker nonGameplayPeriods; + private OsuAction? lastActionPressed; private DrawableRuleset ruleset; @@ -39,29 +49,30 @@ namespace osu.Game.Rulesets.Osu.Mods ruleset = drawableRuleset; drawableRuleset.KeyBindingInputManager.Add(new InputInterceptor(this)); - var firstHitObject = ruleset.Objects.FirstOrDefault(); - firstObjectValidJudgementTime = (firstHitObject?.StartTime ?? 0) - (firstHitObject?.HitWindows.WindowFor(HitResult.Meh) ?? 0); + var periods = new List(); + + if (drawableRuleset.Objects.Any()) + { + periods.Add(new Period(int.MinValue, getValidJudgementTime(ruleset.Objects.First()) - 1)); + + foreach (BreakPeriod b in drawableRuleset.Beatmap.Breaks) + periods.Add(new Period(b.StartTime, getValidJudgementTime(ruleset.Objects.First(h => h.StartTime >= b.EndTime)) - 1)); + + static double getValidJudgementTime(HitObject hitObject) => hitObject.StartTime - hitObject.HitWindows.WindowFor(HitResult.Meh); + } + + nonGameplayPeriods = new PeriodTracker(periods); gameplayClock = drawableRuleset.FrameStableClock; } - public void ApplyToPlayer(Player player) - { - isBreakTime = player.IsBreakTime.GetBoundCopy(); - isBreakTime.ValueChanged += e => - { - if (e.NewValue) - lastActionPressed = null; - }; - } - private bool checkCorrectAction(OsuAction action) { - if (isBreakTime.Value) - return true; - - if (gameplayClock.CurrentTime < firstObjectValidJudgementTime) + if (nonGameplayPeriods.IsInAny(gameplayClock.CurrentTime)) + { + lastActionPressed = null; return true; + } switch (action) { From ee99b949402e7917dc579a84dd9a2fbfae9a5708 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Apr 2022 13:46:18 +0900 Subject: [PATCH 0577/2328] Fix return condition from `EnsureMutableSkin` not accounting for "failed" imports --- osu.Game/Skinning/SkinManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index 77e60d179c..5e1902f520 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -174,9 +174,10 @@ namespace osu.Game.Skinning // currently this only happens on save. result.PerformRead(skin => Save(skin.CreateInstance(this))); CurrentSkinInfo.Value = result; + return true; } - return true; + return false; }); } From 7e3d1511c67d620ba2dc63059c6cec86ed25d244 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 06:55:44 +0300 Subject: [PATCH 0578/2328] Hide "Rank Achieved" sorting mode until it's supported --- osu.Game/Screens/Select/Filter/SortMode.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/Filter/SortMode.cs b/osu.Game/Screens/Select/Filter/SortMode.cs index 1ab54fa069..5dfa2a2664 100644 --- a/osu.Game/Screens/Select/Filter/SortMode.cs +++ b/osu.Game/Screens/Select/Filter/SortMode.cs @@ -27,8 +27,9 @@ namespace osu.Game.Screens.Select.Filter [LocalisableDescription(typeof(SortStrings), nameof(SortStrings.ArtistTracksLength))] Length, - [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchFiltersRank))] - RankAchieved, + // todo: pending support (https://github.com/ppy/osu/issues/4917) + // [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchFiltersRank))] + // RankAchieved, [LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowInfoSource))] Source, From ef56dc07b5eea8392407aec09de8f3adbd1e8681 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 06:55:58 +0300 Subject: [PATCH 0579/2328] Hide "modding" tab in user profile until it's implemented --- osu.Game/Overlays/Profile/ProfileHeader.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index fab2487c0d..44e0d9c37f 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -31,7 +31,9 @@ namespace osu.Game.Overlays.Profile User.ValueChanged += e => updateDisplay(e.NewValue); TabControl.AddItem(LayoutStrings.HeaderUsersShow); - TabControl.AddItem(LayoutStrings.HeaderUsersModding); + + // todo: pending implementation. + // TabControl.AddItem(LayoutStrings.HeaderUsersModding); centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true); } From fef94d49f4a57b1a1ac7bfd4fa5ef87278e2f049 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 08:02:07 +0300 Subject: [PATCH 0580/2328] Revert "Convert data type of `DistanceSpacing` to float" This reverts commit 7aaa88cac2be239dcc778a1082585f8e8d5a7e55. --- .../Editor/TestSceneOsuDistanceSnapGrid.cs | 2 +- .../TestSceneHitObjectComposerDistanceSnapping.cs | 2 +- .../Visual/Editing/TestSceneDistanceSnapGrid.cs | 2 +- .../UserInterface/TestSceneExpandingContainer.cs | 4 ++-- osu.Game/Beatmaps/BeatmapInfo.cs | 2 +- osu.Game/Beatmaps/EFBeatmapInfo.cs | 2 +- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 2 +- .../Settings/Sections/Gameplay/InputSettings.cs | 2 +- osu.Game/Overlays/Settings/Sections/SizeSlider.cs | 7 +++++-- .../Sections/UserInterface/GeneralSettings.cs | 2 +- .../Rulesets/Edit/DistancedHitObjectComposer.cs | 14 +++++++------- osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs | 2 +- .../Edit/Compose/Components/DistanceSnapGrid.cs | 2 +- 13 files changed, 24 insertions(+), 21 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs index 4cccddddf3..2ba30c5f74 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs @@ -187,7 +187,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); - public IBindable DistanceSpacingMultiplier { get; } = new BindableFloat(1); + public IBindable DistanceSpacingMultiplier { get; } = new BindableDouble(1); public float GetBeatSnapDistanceAt(HitObject referenceObject) => (float)beat_length; diff --git a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs index 2c2c06ae0c..a2ee97210a 100644 --- a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs +++ b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs @@ -222,7 +222,7 @@ namespace osu.Game.Tests.Editing { public new EditorBeatmap EditorBeatmap => base.EditorBeatmap; - public new Bindable DistanceSpacingMultiplier => base.DistanceSpacingMultiplier; + public new Bindable DistanceSpacingMultiplier => base.DistanceSpacingMultiplier; public TestHitObjectComposer() : base(new OsuRuleset()) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs index 20bf9b3fa0..b9cfa84a5d 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs @@ -167,7 +167,7 @@ namespace osu.Game.Tests.Visual.Editing public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); - public IBindable DistanceSpacingMultiplier { get; } = new BindableFloat(1); + public IBindable DistanceSpacingMultiplier { get; } = new BindableDouble(1); public float GetBeatSnapDistanceAt(HitObject referenceObject) => 10; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs index f4920b4412..288c0cb140 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs @@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.UserInterface private TestExpandingContainer container; private SettingsToolboxGroup toolboxGroup; - private ExpandableSlider slider1; + private ExpandableSlider> slider1; private ExpandableSlider slider2; [SetUp] @@ -34,7 +34,7 @@ namespace osu.Game.Tests.Visual.UserInterface Width = 1, Children = new Drawable[] { - slider1 = new ExpandableSlider + slider1 = new ExpandableSlider> { Current = new BindableFloat { diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 1b364247a8..1a9703f478 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -109,7 +109,7 @@ namespace osu.Game.Beatmaps public bool SamplesMatchPlaybackRate { get; set; } = true; - public float DistanceSpacing { get; set; } = 1.0f; + public double DistanceSpacing { get; set; } = 1.0; public int BeatDivisor { get; set; } diff --git a/osu.Game/Beatmaps/EFBeatmapInfo.cs b/osu.Game/Beatmaps/EFBeatmapInfo.cs index 67c4dbe788..740adfd1c7 100644 --- a/osu.Game/Beatmaps/EFBeatmapInfo.cs +++ b/osu.Game/Beatmaps/EFBeatmapInfo.cs @@ -107,7 +107,7 @@ namespace osu.Game.Beatmaps [NotMapped] public int[] Bookmarks { get; set; } = Array.Empty(); - public float DistanceSpacing { get; set; } + public double DistanceSpacing { get; set; } public int BeatDivisor { get; set; } public int GridSize { get; set; } public double TimelineZoom { get; set; } diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 0ba7a07010..79d8bd3bb3 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -240,7 +240,7 @@ namespace osu.Game.Beatmaps.Formats break; case @"DistanceSpacing": - beatmap.BeatmapInfo.DistanceSpacing = Math.Max(0, Parsing.ParseFloat(pair.Value)); + beatmap.BeatmapInfo.DistanceSpacing = Math.Max(0, Parsing.ParseDouble(pair.Value)); break; case @"BeatDivisor": diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs index 962572ca6e..83ea655601 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { Children = new Drawable[] { - new SettingsSlider + new SettingsSlider> { LabelText = SkinSettingsStrings.GameplayCursorSize, Current = config.GetBindable(OsuSetting.GameplayCursorSize), diff --git a/osu.Game/Overlays/Settings/Sections/SizeSlider.cs b/osu.Game/Overlays/Settings/Sections/SizeSlider.cs index 8aeb440be1..c8a46162af 100644 --- a/osu.Game/Overlays/Settings/Sections/SizeSlider.cs +++ b/osu.Game/Overlays/Settings/Sections/SizeSlider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Globalization; using osu.Framework.Localisation; using osu.Game.Graphics.UserInterface; @@ -9,8 +11,9 @@ namespace osu.Game.Overlays.Settings.Sections /// /// A slider intended to show a "size" multiplier number, where 1x is 1.0. /// - internal class SizeSlider : OsuSliderBar + public class SizeSlider : OsuSliderBar + where T : struct, IEquatable, IComparable, IConvertible, IFormattable { - public override LocalisableString TooltipText => Current.Value.ToString(@"0.##x"); + public override LocalisableString TooltipText => Current.Value.ToString(@"0.##x", NumberFormatInfo.CurrentInfo); } } diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs index 6e1558f7d7..0e3b822c82 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface LabelText = UserInterfaceStrings.CursorRotation, Current = config.GetBindable(OsuSetting.CursorRotation) }, - new SettingsSlider + new SettingsSlider> { LabelText = UserInterfaceStrings.MenuCursorSize, Current = config.GetBindable(OsuSetting.MenuCursorSize), diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index 1e1fbb4edf..0505f9ab0e 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -21,18 +21,18 @@ namespace osu.Game.Rulesets.Edit public abstract class DistancedHitObjectComposer : HitObjectComposer, IDistanceSnapProvider where TObject : HitObject { - protected Bindable DistanceSpacingMultiplier { get; } = new BindableFloat(1.0f) + protected Bindable DistanceSpacingMultiplier { get; } = new BindableDouble(1.0) { - MinValue = 0.1f, - MaxValue = 6.0f, - Precision = 0.01f, + MinValue = 0.1, + MaxValue = 6.0, + Precision = 0.01, }; - IBindable IDistanceSnapProvider.DistanceSpacingMultiplier => DistanceSpacingMultiplier; + IBindable IDistanceSnapProvider.DistanceSpacingMultiplier => DistanceSpacingMultiplier; protected ExpandingToolboxContainer RightSideToolboxContainer { get; private set; } - private ExpandableSlider distanceSpacingSlider; + private ExpandableSlider> distanceSpacingSlider; private bool distanceSpacingScrollActive; protected DistancedHitObjectComposer(Ruleset ruleset) @@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Edit Origin = Anchor.TopRight, Child = new EditorToolboxGroup("snapping") { - Child = distanceSpacingSlider = new ExpandableSlider + Child = distanceSpacingSlider = new ExpandableSlider> { Current = { BindTarget = DistanceSpacingMultiplier }, KeyboardStep = 0.1f, diff --git a/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs index 0eb572d22a..c6e866561e 100644 --- a/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Edit /// The spacing multiplier applied to beat snap distances. /// /// - IBindable DistanceSpacingMultiplier { get; } + IBindable DistanceSpacingMultiplier { get; } /// /// Retrieves the distance between two points within a timing point that are one beat length apart. diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index 13c3b713b1..2500bb1f60 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Edit.Compose.Components [Resolved] private BindableBeatDivisor beatDivisor { get; set; } - private IBindable distanceSpacingMultiplier; + private IBindable distanceSpacingMultiplier; private readonly LayoutValue gridCache = new LayoutValue(Invalidation.RequiredParentSizeToFit); private readonly double? endTime; From 173a6188eb0d46db4a762e81213f1d377127140e Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 08:41:37 +0300 Subject: [PATCH 0581/2328] Add back `float` cast to distance spacing computation --- osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index 2500bb1f60..5568c15514 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -92,7 +92,7 @@ namespace osu.Game.Screens.Edit.Compose.Components private void updateSpacing() { - DistanceSpacing = SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * distanceSpacingMultiplier.Value; + DistanceSpacing = (float)(SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * distanceSpacingMultiplier.Value); if (endTime == null) MaxIntervals = int.MaxValue; From a9d67d3e92dd9f892d0843ac5961172294346373 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 10:10:19 +0300 Subject: [PATCH 0582/2328] Change random button text when holding shift key --- osu.Game/Screens/Select/FooterButtonRandom.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/FooterButtonRandom.cs b/osu.Game/Screens/Select/FooterButtonRandom.cs index 5cdf381879..5f8fdce054 100644 --- a/osu.Game/Screens/Select/FooterButtonRandom.cs +++ b/osu.Game/Screens/Select/FooterButtonRandom.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.Select { SelectedColour = colours.Green; DeselectedColour = SelectedColour.Opacity(0.5f); - Text = @"random"; + updateText(); Action = () => { @@ -59,6 +59,18 @@ namespace osu.Game.Screens.Select }; } + protected override bool OnKeyDown(KeyDownEvent e) + { + updateText(e.ShiftPressed); + return base.OnKeyDown(e); + } + + protected override void OnKeyUp(KeyUpEvent e) + { + updateText(e.ShiftPressed); + base.OnKeyUp(e); + } + protected override bool OnClick(ClickEvent e) { rewindSearch = e.ShiftPressed; @@ -91,5 +103,7 @@ namespace osu.Game.Screens.Select rewindSearch = false; } } + + private void updateText(bool rewind = false) => Text = rewind ? "rewind" : "random"; } } From 856ca96b66ec0073f42b290cbde260e04267c8eb Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 10:12:20 +0300 Subject: [PATCH 0583/2328] Allow right-clicking to rewind on random button --- .../SongSelect/TestSceneSongSelectFooter.cs | 16 +++++++++++++- osu.Game/Screens/Select/FooterButtonRandom.cs | 21 ++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectFooter.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectFooter.cs index 6485123b29..f27615eea5 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectFooter.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectFooter.cs @@ -4,6 +4,7 @@ using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Screens.Select; +using osuTK; using osuTK.Input; namespace osu.Game.Tests.Visual.SongSelect @@ -36,6 +37,8 @@ namespace osu.Game.Tests.Visual.SongSelect PreviousRandom = () => previousRandomCalled = true, }, null); footer.AddButton(new FooterButtonOptions(), null); + + InputManager.MoveMouseTo(Vector2.Zero); }); [Test] @@ -70,7 +73,7 @@ namespace osu.Game.Tests.Visual.SongSelect } [Test] - public void TestFooterRewindViaMouse() + public void TestFooterRewindViaShiftMouseLeft() { AddStep("shift + click button", () => { @@ -81,5 +84,16 @@ namespace osu.Game.Tests.Visual.SongSelect }); AddAssert("previous random invoked", () => previousRandomCalled && !nextRandomCalled); } + + [Test] + public void TestFooterRewindViaMouseRight() + { + AddStep("right click button", () => + { + InputManager.MoveMouseTo(randomButton); + InputManager.Click(MouseButton.Right); + }); + AddAssert("previous random invoked", () => previousRandomCalled && !nextRandomCalled); + } } } diff --git a/osu.Game/Screens/Select/FooterButtonRandom.cs b/osu.Game/Screens/Select/FooterButtonRandom.cs index 5f8fdce054..48d5836826 100644 --- a/osu.Game/Screens/Select/FooterButtonRandom.cs +++ b/osu.Game/Screens/Select/FooterButtonRandom.cs @@ -10,6 +10,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Input.Bindings; using osuTK; +using osuTK.Input; namespace osu.Game.Screens.Select { @@ -73,13 +74,27 @@ namespace osu.Game.Screens.Select protected override bool OnClick(ClickEvent e) { - rewindSearch = e.ShiftPressed; - return base.OnClick(e); + try + { + // this uses OR to handle rewinding when clicks are triggered by other sources (i.e. right button in OnMouseUp). + rewindSearch |= e.ShiftPressed; + return base.OnClick(e); + } + finally + { + rewindSearch = false; + } } protected override void OnMouseUp(MouseUpEvent e) { - rewindSearch = false; + if (e.Button == MouseButton.Right) + { + rewindSearch = true; + TriggerClick(); + return; + } + base.OnMouseUp(e); } From 3829d278451c71aa4223c70520331f970ad79cb7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 12:19:22 +0300 Subject: [PATCH 0584/2328] Update overlay ruleset selector design --- osu.Game/Overlays/OverlayRulesetTabItem.cs | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/OverlayRulesetTabItem.cs b/osu.Game/Overlays/OverlayRulesetTabItem.cs index 9d4afc94d1..4f58d4c189 100644 --- a/osu.Game/Overlays/OverlayRulesetTabItem.cs +++ b/osu.Game/Overlays/OverlayRulesetTabItem.cs @@ -5,14 +5,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets; using osuTK.Graphics; using osuTK; using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays { @@ -26,7 +24,7 @@ namespace osu.Game.Overlays set { accentColour = value; - text.FadeColour(value, 120, Easing.OutQuint); + icon.FadeColour(value, 120, Easing.OutQuint); } } @@ -35,7 +33,7 @@ namespace osu.Game.Overlays [Resolved] private OverlayColourProvider colourProvider { get; set; } - private readonly OsuSpriteText text; + private readonly Drawable icon; public OverlayRulesetTabItem(RulesetInfo value) : base(value) @@ -48,15 +46,14 @@ namespace osu.Game.Overlays { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, - Spacing = new Vector2(3, 0), - Child = text = new OsuSpriteText + Spacing = new Vector2(5f, 0), + Child = icon = new ConstrainedIconContainer { - Origin = Anchor.Centre, Anchor = Anchor.Centre, - Text = value.Name, - Font = OsuFont.GetFont(size: 14), - ShadowColour = Color4.Black.Opacity(0.75f) - } + Origin = Anchor.Centre, + Size = new Vector2(20f), + Icon = value.CreateInstance().CreateIcon(), + }, }, new HoverClickSounds() }); @@ -91,7 +88,6 @@ namespace osu.Game.Overlays private void updateState() { - text.Font = text.Font.With(weight: Active.Value ? FontWeight.Bold : FontWeight.Medium); AccentColour = Enabled.Value ? getActiveColour() : colourProvider.Foreground1; } From 4016fe1e19695637ea0a954b63ec633fcff2d5b4 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 12:19:47 +0300 Subject: [PATCH 0585/2328] Adjust profile ruleset selector to new design Looks weird with `AlwaysPresent`. --- .../Profile/Header/Components/ProfileRulesetTabItem.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs index 3d20fba542..15640ddc5e 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs @@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Profile.Header.Components isDefault = value; - icon.FadeTo(isDefault ? 1 : 0, 200, Easing.OutQuint); + icon.Alpha = isDefault ? 1 : 0; } } @@ -47,7 +47,6 @@ namespace osu.Game.Overlays.Profile.Header.Components Origin = Anchor.Centre, Anchor = Anchor.Centre, Alpha = 0, - AlwaysPresent = true, Icon = FontAwesome.Solid.Star, Size = new Vector2(12), }); From fae8d86e154df9e31674a2b94f66a79c259ba709 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 12:20:33 +0300 Subject: [PATCH 0586/2328] Fix regressed profile ruleset selector test scene Due to the changes in `APIUser`, which change equality to be based on ID. --- .../Visual/Online/TestSceneProfileRulesetSelector.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs index cbbe8b8eac..4e572b665b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs @@ -32,14 +32,14 @@ namespace osu.Game.Tests.Visual.Online }; AddStep("set osu! as default", () => selector.SetDefaultRuleset(new OsuRuleset().RulesetInfo)); - AddStep("set mania as default", () => selector.SetDefaultRuleset(new ManiaRuleset().RulesetInfo)); AddStep("set taiko as default", () => selector.SetDefaultRuleset(new TaikoRuleset().RulesetInfo)); AddStep("set catch as default", () => selector.SetDefaultRuleset(new CatchRuleset().RulesetInfo)); + AddStep("set mania as default", () => selector.SetDefaultRuleset(new ManiaRuleset().RulesetInfo)); - AddStep("User with osu as default", () => user.Value = new APIUser { PlayMode = "osu" }); - AddStep("User with mania as default", () => user.Value = new APIUser { PlayMode = "mania" }); - AddStep("User with taiko as default", () => user.Value = new APIUser { PlayMode = "taiko" }); - AddStep("User with catch as default", () => user.Value = new APIUser { PlayMode = "fruits" }); + AddStep("User with osu as default", () => user.Value = new APIUser { Id = 0, PlayMode = "osu" }); + AddStep("User with taiko as default", () => user.Value = new APIUser { Id = 2, PlayMode = "taiko" }); + AddStep("User with catch as default", () => user.Value = new APIUser { Id = 3, PlayMode = "fruits" }); + AddStep("User with mania as default", () => user.Value = new APIUser { Id = 1, PlayMode = "mania" }); AddStep("null user", () => user.Value = null); } } From 5e19bdbf430b76c8124f81afd4e6d04a69978950 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 12:21:12 +0300 Subject: [PATCH 0587/2328] Refactor beatmap ruleset selector test scene --- .../Online/TestSceneBeatmapRulesetSelector.cs | 99 ++++++++++--------- 1 file changed, 53 insertions(+), 46 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs index 63741451f3..c550c9afda 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs @@ -4,11 +4,11 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; -using osu.Framework.Graphics.UserInterface; +using osu.Framework.Graphics; +using osu.Framework.Testing; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.BeatmapSet; -using osu.Game.Rulesets; namespace osu.Game.Tests.Visual.Online { @@ -17,79 +17,86 @@ namespace osu.Game.Tests.Visual.Online [Cached] private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue); - private readonly TestRulesetSelector selector; + private BeatmapRulesetSelector selector; - public TestSceneBeatmapRulesetSelector() + [SetUp] + public void SetUp() => Schedule(() => Child = selector = new BeatmapRulesetSelector { - Add(selector = new TestRulesetSelector()); - } + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + BeatmapSet = new APIBeatmapSet(), + }); - [Resolved] - private IRulesetStore rulesets { get; set; } + [Test] + public void TestDisplay() + { + AddSliderStep("osu", 0, 100, 0, v => updateBeatmaps(0, v)); + AddSliderStep("taiko", 0, 100, 0, v => updateBeatmaps(1, v)); + AddSliderStep("fruits", 0, 100, 0, v => updateBeatmaps(2, v)); + AddSliderStep("mania", 0, 100, 0, v => updateBeatmaps(3, v)); + + void updateBeatmaps(int ruleset, int count) + { + if (selector == null) + return; + + selector.BeatmapSet = new APIBeatmapSet + { + Beatmaps = selector.BeatmapSet.Beatmaps + .Where(b => b.Ruleset.OnlineID != ruleset) + .Concat(Enumerable.Range(0, count).Select(_ => new APIBeatmap { RulesetID = ruleset })) + .ToArray(), + }; + } + } [Test] public void TestMultipleRulesetsBeatmapSet() { - var enabledRulesets = rulesets.AvailableRulesets.Skip(1).Take(2); - AddStep("load multiple rulesets beatmapset", () => - { - selector.BeatmapSet = new APIBeatmapSet - { - Beatmaps = enabledRulesets.Select(r => new APIBeatmap { RulesetID = r.OnlineID }).ToArray() - }; - }); - - var tabItems = selector.TabContainer.TabItems; - AddAssert("other rulesets disabled", () => tabItems.Except(tabItems.Where(t => enabledRulesets.Any(r => r.Equals(t.Value)))).All(t => !t.Enabled.Value)); - AddAssert("left-most ruleset selected", () => tabItems.First(t => t.Enabled.Value).Active.Value); - } - - [Test] - public void TestSingleRulesetBeatmapSet() - { - var enabledRuleset = rulesets.AvailableRulesets.Last(); - - AddStep("load single ruleset beatmapset", () => { selector.BeatmapSet = new APIBeatmapSet { Beatmaps = new[] { - new APIBeatmap - { - RulesetID = enabledRuleset.OnlineID - } + new APIBeatmap { RulesetID = 1 }, + new APIBeatmap { RulesetID = 2 }, } }; }); - AddAssert("single ruleset selected", () => selector.SelectedTab.Value.Equals(enabledRuleset)); + AddAssert("osu disabled", () => !selector.ChildrenOfType().Single(t => t.Value.OnlineID == 0).Enabled.Value); + AddAssert("mania disabled", () => !selector.ChildrenOfType().Single(t => t.Value.OnlineID == 3).Enabled.Value); + + AddAssert("taiko selected", () => selector.ChildrenOfType().Single(t => t.Active.Value).Value.OnlineID == 1); + } + + [Test] + public void TestSingleRulesetBeatmapSet() + { + AddStep("load single ruleset beatmapset", () => + { + selector.BeatmapSet = new APIBeatmapSet + { + Beatmaps = new[] { new APIBeatmap { RulesetID = 3 } } + }; + }); + + AddAssert("single ruleset selected", () => selector.ChildrenOfType().Single(t => t.Active.Value).Value.OnlineID == 3); } [Test] public void TestEmptyBeatmapSet() { AddStep("load empty beatmapset", () => selector.BeatmapSet = new APIBeatmapSet()); - - AddAssert("no ruleset selected", () => selector.SelectedTab == null); - AddAssert("all rulesets disabled", () => selector.TabContainer.TabItems.All(t => !t.Enabled.Value)); + AddAssert("all rulesets disabled", () => selector.ChildrenOfType().All(t => !t.Active.Value && !t.Enabled.Value)); } [Test] public void TestNullBeatmapSet() { AddStep("load null beatmapset", () => selector.BeatmapSet = null); - - AddAssert("no ruleset selected", () => selector.SelectedTab == null); - AddAssert("all rulesets disabled", () => selector.TabContainer.TabItems.All(t => !t.Enabled.Value)); - } - - private class TestRulesetSelector : BeatmapRulesetSelector - { - public new TabItem SelectedTab => base.SelectedTab; - - public new TabFillFlowContainer TabContainer => base.TabContainer; + AddAssert("all rulesets disabled", () => selector.ChildrenOfType().All(t => !t.Active.Value && !t.Enabled.Value)); } } } From 55c03dc04d0505f462c41876a50797acc3698f0b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 12:40:40 +0300 Subject: [PATCH 0588/2328] Fix silly mistake in ordering and update test colour scheme --- .../Visual/Online/TestSceneProfileRulesetSelector.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs index 4e572b665b..ae90872439 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs @@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.Online public class TestSceneProfileRulesetSelector : OsuTestScene { [Cached] - private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); + private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Pink); public TestSceneProfileRulesetSelector() { @@ -37,9 +37,9 @@ namespace osu.Game.Tests.Visual.Online AddStep("set mania as default", () => selector.SetDefaultRuleset(new ManiaRuleset().RulesetInfo)); AddStep("User with osu as default", () => user.Value = new APIUser { Id = 0, PlayMode = "osu" }); - AddStep("User with taiko as default", () => user.Value = new APIUser { Id = 2, PlayMode = "taiko" }); - AddStep("User with catch as default", () => user.Value = new APIUser { Id = 3, PlayMode = "fruits" }); - AddStep("User with mania as default", () => user.Value = new APIUser { Id = 1, PlayMode = "mania" }); + AddStep("User with taiko as default", () => user.Value = new APIUser { Id = 1, PlayMode = "taiko" }); + AddStep("User with catch as default", () => user.Value = new APIUser { Id = 2, PlayMode = "fruits" }); + AddStep("User with mania as default", () => user.Value = new APIUser { Id = 3, PlayMode = "mania" }); AddStep("null user", () => user.Value = null); } } From 9ea3e244e7d141b1a0d56862a03a2f15aa56a372 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 29 Apr 2022 12:48:05 +0300 Subject: [PATCH 0589/2328] Adjust ruleset tab item content spacing to match web Not too noticeable, but better match web in any case. --- osu.Game/Overlays/OverlayRulesetTabItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/OverlayRulesetTabItem.cs b/osu.Game/Overlays/OverlayRulesetTabItem.cs index 4f58d4c189..32177b2b96 100644 --- a/osu.Game/Overlays/OverlayRulesetTabItem.cs +++ b/osu.Game/Overlays/OverlayRulesetTabItem.cs @@ -46,7 +46,7 @@ namespace osu.Game.Overlays { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, - Spacing = new Vector2(5f, 0), + Spacing = new Vector2(4f, 0), Child = icon = new ConstrainedIconContainer { Anchor = Anchor.Centre, From 670b51324ea0d6e52c036391039329ca27f3e1b2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Apr 2022 23:45:02 +0900 Subject: [PATCH 0590/2328] Add basic test at top of first run scene to make adjusting UI easier --- .../Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index 836cf6caad..39298f56ba 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -65,6 +65,12 @@ namespace osu.Game.Tests.Visual.UserInterface }); } + [Test] + public void TestBasic() + { + AddAssert("overlay visible", () => overlay.State.Value == Visibility.Visible); + } + [Test] [Ignore("Enable when first run setup is being displayed on first run.")] public void TestDoesntOpenOnSecondRun() From 27ee990359ab4f412e589b53ae70f740c9de7e1c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Apr 2022 23:45:17 +0900 Subject: [PATCH 0591/2328] Update first-run overlay footer buttons to use new sheared design --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 36 ++++++++++++++--------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 4277f0f2ba..75778e6c4d 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -25,7 +25,6 @@ using osu.Game.Overlays.Mods; using osu.Game.Overlays.Notifications; using osu.Game.Screens; using osu.Game.Screens.Menu; -using osu.Game.Screens.OnlinePlay.Match.Components; namespace osu.Game.Overlays { @@ -45,8 +44,8 @@ namespace osu.Game.Overlays private ScreenStack? stack; - public PurpleTriangleButton NextButton = null!; - public DangerousTriangleButton BackButton = null!; + public ShearedButton NextButton = null!; + public ShearedButton BackButton = null!; private readonly Bindable showFirstRunSetup = new Bindable(); @@ -72,7 +71,7 @@ namespace osu.Game.Overlays private Container content = null!; [BackgroundDependencyLoader] - private void load() + private void load(OsuColour colours) { Header.Title = FirstRunSetupOverlayStrings.FirstRunSetupTitle; Header.Description = FirstRunSetupOverlayStrings.FirstRunSetupDescription; @@ -84,7 +83,11 @@ namespace osu.Game.Overlays Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Horizontal = 70 * 1.2f }, + Padding = new MarginPadding + { + Horizontal = 70 * 1.2f, + Bottom = 20, + }, Child = new InputBlockingContainer { Masking = true, @@ -117,14 +120,15 @@ namespace osu.Game.Overlays { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Width = 0.98f, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, + Margin = new MarginPadding { Vertical = PADDING }, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, ColumnDimensions = new[] { - new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.Absolute, 10), + new Dimension(GridSizeMode.AutoSize), new Dimension(), + new Dimension(GridSizeMode.Absolute, 10), }, RowDimensions = new[] { @@ -134,21 +138,25 @@ namespace osu.Game.Overlays { new[] { - BackButton = new DangerousTriangleButton + Empty(), + BackButton = new ShearedButton(300) { - Width = 300, Text = CommonStrings.Back, Action = showPreviousStep, Enabled = { Value = false }, + DarkerColour = colours.Pink2, + LighterColour = colours.Pink1, }, - Empty(), - NextButton = new PurpleTriangleButton + NextButton = new ShearedButton(0) { RelativeSizeAxes = Axes.X, Width = 1, Text = FirstRunSetupOverlayStrings.GetStarted, + DarkerColour = ColourProvider.Colour2, + LighterColour = ColourProvider.Colour1, Action = showNextStep - } + }, + Empty(), }, } }); From 3996972867507a1b46c551d7c921a5a973dad3c1 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 30 Apr 2022 12:23:08 +0300 Subject: [PATCH 0592/2328] Remove unnecessary `f` suffix --- osu.Game/Overlays/OverlayRulesetTabItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/OverlayRulesetTabItem.cs b/osu.Game/Overlays/OverlayRulesetTabItem.cs index 32177b2b96..84815b0cc1 100644 --- a/osu.Game/Overlays/OverlayRulesetTabItem.cs +++ b/osu.Game/Overlays/OverlayRulesetTabItem.cs @@ -46,7 +46,7 @@ namespace osu.Game.Overlays { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, - Spacing = new Vector2(4f, 0), + Spacing = new Vector2(4, 0), Child = icon = new ConstrainedIconContainer { Anchor = Anchor.Centre, From c7ab9a89285f457737a6e5b1f2261da4a46c4e0c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 30 Apr 2022 15:35:04 +0300 Subject: [PATCH 0593/2328] Add ruleset tab item tooltips --- osu.Game/Overlays/OverlayRulesetTabItem.cs | 6 ++++- .../Components/ProfileRulesetTabItem.cs | 23 +++++++++++++------ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/OverlayRulesetTabItem.cs b/osu.Game/Overlays/OverlayRulesetTabItem.cs index 84815b0cc1..8ed75a528b 100644 --- a/osu.Game/Overlays/OverlayRulesetTabItem.cs +++ b/osu.Game/Overlays/OverlayRulesetTabItem.cs @@ -10,11 +10,13 @@ using osu.Game.Rulesets; using osuTK.Graphics; using osuTK; using osu.Framework.Allocation; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Localisation; using osu.Game.Graphics.Containers; namespace osu.Game.Overlays { - public class OverlayRulesetTabItem : TabItem + public class OverlayRulesetTabItem : TabItem, IHasTooltip { private Color4 accentColour; @@ -35,6 +37,8 @@ namespace osu.Game.Overlays private readonly Drawable icon; + public LocalisableString TooltipText => Value.Name; + public OverlayRulesetTabItem(RulesetInfo value) : base(value) { diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs index 15640ddc5e..4a44e285bf 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs @@ -2,7 +2,10 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; +using osu.Framework.Localisation; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets; using osuTK; using osuTK.Graphics; @@ -42,14 +45,20 @@ namespace osu.Game.Overlays.Profile.Header.Components public ProfileRulesetTabItem(RulesetInfo value) : base(value) { - Add(icon = new SpriteIcon + Add(icon = new DefaultRulesetIcon { Alpha = 0 }); + } + + public class DefaultRulesetIcon : SpriteIcon, IHasTooltip + { + public LocalisableString TooltipText => UsersStrings.ShowEditDefaultPlaymodeIsDefaultTooltip; + + public DefaultRulesetIcon() { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Alpha = 0, - Icon = FontAwesome.Solid.Star, - Size = new Vector2(12), - }); + Origin = Anchor.Centre; + Anchor = Anchor.Centre; + Icon = FontAwesome.Solid.Star; + Size = new Vector2(12); + } } } } From ba5da8a52aa40cc4c1092854f33b9054b4fbe5e1 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 30 Apr 2022 15:36:15 +0300 Subject: [PATCH 0594/2328] Fix tooltips not shown on selected tab --- osu.Game/Overlays/OverlayRulesetTabItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/OverlayRulesetTabItem.cs b/osu.Game/Overlays/OverlayRulesetTabItem.cs index 8ed75a528b..1f11b98881 100644 --- a/osu.Game/Overlays/OverlayRulesetTabItem.cs +++ b/osu.Game/Overlays/OverlayRulesetTabItem.cs @@ -71,7 +71,7 @@ namespace osu.Game.Overlays Enabled.BindValueChanged(_ => updateState(), true); } - public override bool PropagatePositionalInputSubTree => Enabled.Value && !Active.Value && base.PropagatePositionalInputSubTree; + public override bool PropagatePositionalInputSubTree => Enabled.Value && base.PropagatePositionalInputSubTree; protected override bool OnHover(HoverEvent e) { From b6fb0197ab1ef3f03a9270af7e035d0f97839c86 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 30 Apr 2022 23:52:36 +0900 Subject: [PATCH 0595/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index ff6499631d..b6260fd1d4 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 26891ad978..fa7563da55 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index d261e13ade..e472b5f1a8 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From de393f735fdb3d2f4b93939af1a47f8a17217a17 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Fri, 29 Apr 2022 21:33:32 +0100 Subject: [PATCH 0596/2328] Implement basic layout and behaviour of new chat overlay Provides initial implementation of new chat overlay in component `ChatOverlayV2`. Contains only the basic functionality required for a functioning chat overlay according to the new design with the intent of added the rest of the functionality in subsequent PRs. Backports existing tests for the current chat overlay except for ones testing keyboard shortcuts (since they haven't been added) and tab closing behaviour (since no tabs). --- .../Visual/Online/TestSceneChatOverlayV2.cs | 365 ++++++++++++++++++ .../Chat/ChannelList/ChannelListItem.cs | 18 +- osu.Game/Overlays/Chat/ChatOverlayTopBar.cs | 67 ++++ .../Chat/Listing/ChannelListingItem.cs | 18 +- osu.Game/Overlays/ChatOverlayV2.cs | 293 ++++++++++++++ 5 files changed, 743 insertions(+), 18 deletions(-) create mode 100644 osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs create mode 100644 osu.Game/Overlays/Chat/ChatOverlayTopBar.cs create mode 100644 osu.Game/Overlays/ChatOverlayV2.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs new file mode 100644 index 0000000000..312bda6460 --- /dev/null +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -0,0 +1,365 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Net; +using NUnit.Framework; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Logging; +using osu.Framework.Testing; +using osu.Framework.Utils; +using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; +using osu.Game.Online.Chat; +using osu.Game.Overlays; +using osu.Game.Overlays.Chat; +using osu.Game.Overlays.Chat.Listing; +using osu.Game.Overlays.Chat.ChannelList; +using osuTK.Input; + +namespace osu.Game.Tests.Visual.Online +{ + [TestFixture] + public class TestSceneChatOverlayV2 : OsuManualInputManagerTestScene + { + private ChatOverlayV2 chatOverlay; + private ChannelManager channelManager; + + private readonly APIUser testUser; + private readonly Channel testPMChannel; + private readonly Channel[] testChannels; + private Channel testChannel1 => testChannels[0]; + private Channel testChannel2 => testChannels[1]; + + public TestSceneChatOverlayV2() + { + testUser = new APIUser { Username = "test user", Id = 5071479 }; + testPMChannel = new Channel(testUser); + testChannels = Enumerable.Range(1, 10).Select(createPublicChannel).ToArray(); + } + + [SetUp] + public void SetUp() => Schedule(() => + { + Child = new DependencyProvidingContainer + { + RelativeSizeAxes = Axes.Both, + CachedDependencies = new (Type, object)[] + { + (typeof(ChannelManager), channelManager = new ChannelManager()), + }, + Children = new Drawable[] + { + channelManager, + chatOverlay = new ChatOverlayV2 { RelativeSizeAxes = Axes.Both }, + }, + }; + }); + + [SetUpSteps] + public void SetUpSteps() + { + AddStep("Setup request handler", () => + { + ((DummyAPIAccess)API).HandleRequest = req => + { + switch (req) + { + case GetUpdatesRequest getUpdates: + getUpdates.TriggerFailure(new WebException()); + return true; + + case JoinChannelRequest joinChannel: + joinChannel.TriggerSuccess(); + return true; + + case LeaveChannelRequest leaveChannel: + leaveChannel.TriggerSuccess(); + return true; + + case GetMessagesRequest getMessages: + getMessages.TriggerSuccess(createChannelMessages(getMessages.Channel)); + return true; + + case GetUserRequest getUser: + if (getUser.Lookup == testUser.Username) + getUser.TriggerSuccess(testUser); + else + getUser.TriggerFailure(new WebException()); + return true; + + case PostMessageRequest postMessage: + postMessage.TriggerSuccess(new Message(RNG.Next(0, 10000000)) + { + Content = postMessage.Message.Content, + ChannelId = postMessage.Message.ChannelId, + Sender = postMessage.Message.Sender, + Timestamp = new DateTimeOffset(DateTime.Now), + }); + return true; + + default: + Logger.Log($"Unhandled Request Type: {req.GetType()}"); + return false; + } + }; + }); + + AddStep("Add test channels", () => + { + (channelManager.AvailableChannels as BindableList)?.AddRange(testChannels); + }); + } + + [Test] + public void TestShowHide() + { + AddStep("Show overlay", () => chatOverlay.Show()); + AddAssert("Overlay is visible", () => chatOverlay.State.Value == Visibility.Visible); + AddStep("Hide overlay", () => chatOverlay.Hide()); + AddAssert("Overlay is hidden", () => chatOverlay.State.Value == Visibility.Hidden); + } + + [Test] + public void TestChannelSelection() + { + AddStep("Show overlay", () => chatOverlay.Show()); + AddAssert("Listing is visible", () => listingVisibility == Visibility.Visible); + AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); + AddAssert("Listing is hidden", () => listingVisibility == Visibility.Hidden); + AddAssert("Loading is hidden", () => loadingVisibility == Visibility.Hidden); + AddAssert("Current channel is correct", () => channelManager.CurrentChannel.Value == testChannel1); + AddAssert("DrawableChannel is correct", () => currentDrawableChannel.Channel == testChannel1); + } + + [Test] + public void TestSearchInListing() + { + AddStep("Show overlay", () => chatOverlay.Show()); + AddAssert("Listing is visible", () => listingVisibility == Visibility.Visible); + AddStep("Search for 'number 2'", () => chatOverlay.ChildrenOfType().Single().Text = "number 2"); + AddUntilStep("Only channel 2 visibile", () => + { + IEnumerable listingItems = chatOverlay.ChildrenOfType() + .Where(item => item.IsPresent); + return listingItems.Count() == 1 && listingItems.Single().Channel == testChannel2; + }); + } + + [Test] + public void TestChannelCloseButton() + { + AddStep("Show overlay", () => chatOverlay.Show()); + AddStep("Join PM and public channels", () => + { + channelManager.JoinChannel(testChannel1); + channelManager.JoinChannel(testPMChannel); + }); + AddStep("Select PM channel", () => clickDrawable(getChannelListItem(testPMChannel))); + AddStep("Click close button", () => + { + ChannelListItemCloseButton closeButton = getChannelListItem(testPMChannel).ChildrenOfType().Single(); + clickDrawable(closeButton); + }); + AddAssert("PM channel closed", () => !channelManager.JoinedChannels.Contains(testPMChannel)); + AddStep("Select normal channel", () => clickDrawable(getChannelListItem(testChannel1))); + AddStep("Click close button", () => + { + ChannelListItemCloseButton closeButton = getChannelListItem(testChannel1).ChildrenOfType().Single(); + clickDrawable(closeButton); + }); + AddAssert("Normal channel closed", () => !channelManager.JoinedChannels.Contains(testChannel1)); + } + + [Test] + public void TestChatCommand() + { + AddStep("Show overlay", () => chatOverlay.Show()); + AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); + AddStep("Open chat with user", () => channelManager.PostCommand($"chat {testUser.Username}")); + AddAssert("PM channel is selected", () => channelManager.CurrentChannel.Value == testPMChannel); + AddAssert("PM channel is visibile", () => currentDrawableChannel.Channel == testPMChannel); + AddStep("Open chat with non-existent user", () => channelManager.PostCommand("chat user_doesnt_exist")); + AddAssert("Last message is error", () => channelManager.CurrentChannel.Value.Messages.Last() is ErrorMessage); + // Make sure no unnecessary requests are made when the PM channel is already open. + AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); + AddStep("Unregister request handling", () => ((DummyAPIAccess)API).HandleRequest = null); + AddStep("Open chat with user", () => channelManager.PostCommand($"chat {testUser.Username}")); + AddAssert("PM channel is selected", () => channelManager.CurrentChannel.Value == testPMChannel); + AddAssert("PM channel is visibile", () => currentDrawableChannel.Channel == testPMChannel); + } + + [Test] + public void TestMultiplayerChannelIsNotShown() + { + Channel multiplayerChannel = null; + + AddStep("Show overlay", () => chatOverlay.Show()); + AddStep("Join multiplayer channel", () => channelManager.JoinChannel(multiplayerChannel = new Channel(new APIUser()) + { + Name = "#mp_1", + Type = ChannelType.Multiplayer, + })); + AddAssert("Channel is joined", () => channelManager.JoinedChannels.Contains(multiplayerChannel)); + AddUntilStep("Channel not present in listing", () => !chatOverlay.ChildrenOfType() + .Where(item => item.IsPresent) + .Select(item => item.Channel) + .Contains(multiplayerChannel)); + } + + [Test] + public void TestHighlightOnCurrentChannel() + { + Message message = null; + + AddStep("Show overlay", () => chatOverlay.Show()); + AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); + AddStep("Send message in channel 1", () => + { + testChannel1.AddNewMessages(message = new Message + { + ChannelId = testChannel1.Id, + Content = "Message to highlight!", + Timestamp = DateTimeOffset.Now, + Sender = testUser, + }); + }); + AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel1)); + } + + [Test] + public void TestHighlightOnAnotherChannel() + { + Message message = null; + + AddStep("Show overlay", () => chatOverlay.Show()); + AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + AddStep("Join channel 2", () => channelManager.JoinChannel(testChannel2)); + AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); + AddStep("Send message in channel 2", () => + { + testChannel2.AddNewMessages(message = new Message + { + ChannelId = testChannel2.Id, + Content = "Message to highlight!", + Timestamp = DateTimeOffset.Now, + Sender = testUser, + }); + }); + AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel2)); + AddAssert("Channel 2 is selected", () => channelManager.CurrentChannel.Value == testChannel2); + AddAssert("Channel 2 is visible", () => currentDrawableChannel.Channel == testChannel2); + } + + [Test] + public void TestHighlightOnLeftChannel() + { + Message message = null; + + AddStep("Show overlay", () => chatOverlay.Show()); + AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + AddStep("Join channel 2", () => channelManager.JoinChannel(testChannel2)); + AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); + AddStep("Send message in channel 2", () => + { + testChannel2.AddNewMessages(message = new Message + { + ChannelId = testChannel2.Id, + Content = "Message to highlight!", + Timestamp = DateTimeOffset.Now, + Sender = testUser, + }); + }); + AddStep("Leave channel 2", () => channelManager.LeaveChannel(testChannel2)); + AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel2)); + AddAssert("Channel 2 is selected", () => channelManager.CurrentChannel.Value == testChannel2); + AddAssert("Channel 2 is visible", () => currentDrawableChannel.Channel == testChannel2); + } + + [Test] + public void TestHighlightWhileChatNeverOpen() + { + Message message = null; + + AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + AddStep("Send message in channel 1", () => + { + testChannel1.AddNewMessages(message = new Message + { + ChannelId = testChannel1.Id, + Content = "Message to highlight!", + Timestamp = DateTimeOffset.Now, + Sender = testUser, + }); + }); + AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel1)); + } + + [Test] + public void TestHighlightWithNullChannel() + { + Message message = null; + + AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + AddStep("Send message in channel 1", () => + { + testChannel1.AddNewMessages(message = new Message + { + ChannelId = testChannel1.Id, + Content = "Message to highlight!", + Timestamp = DateTimeOffset.Now, + Sender = testUser, + }); + }); + AddStep("Set null channel", () => channelManager.CurrentChannel.Value = null); + AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel1)); + } + + private Visibility listingVisibility => + chatOverlay.ChildrenOfType().Single().State.Value; + + private Visibility loadingVisibility => + chatOverlay.ChildrenOfType().Single().State.Value; + + private DrawableChannel currentDrawableChannel => + chatOverlay.ChildrenOfType>().Single().Child; + + private ChannelListItem getChannelListItem(Channel channel) => + chatOverlay.ChildrenOfType().Single(item => item.Channel == channel); + + private void clickDrawable(Drawable d) + { + InputManager.MoveMouseTo(d); + InputManager.Click(MouseButton.Left); + } + + private List createChannelMessages(Channel channel) + { + var message = new Message + { + ChannelId = channel.Id, + Content = $"Hello, this is a message in {channel.Name}", + Sender = testUser, + Timestamp = new DateTimeOffset(DateTime.Now), + }; + return new List { message }; + } + + private Channel createPublicChannel(int id) => new Channel + { + Id = id, + Name = $"#channel-{id}", + Topic = $"We talk about the number {id} here", + Type = ChannelType.Public, + }; + } +} diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs index 7c4a72559b..fa8fae29e5 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs @@ -25,14 +25,14 @@ namespace osu.Game.Overlays.Chat.ChannelList public event Action? OnRequestSelect; public event Action? OnRequestLeave; + public readonly Channel Channel; + public readonly BindableInt Mentions = new BindableInt(); public readonly BindableBool Unread = new BindableBool(); public readonly BindableBool SelectorActive = new BindableBool(); - private readonly Channel channel; - private Box hoverBox = null!; private Box selectBox = null!; private OsuSpriteText text = null!; @@ -46,7 +46,7 @@ namespace osu.Game.Overlays.Chat.ChannelList public ChannelListItem(Channel channel) { - this.channel = channel; + Channel = channel; } [BackgroundDependencyLoader] @@ -92,7 +92,7 @@ namespace osu.Game.Overlays.Chat.ChannelList { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Text = channel.Name, + Text = Channel.Name, Font = OsuFont.Torus.With(size: 17, weight: FontWeight.SemiBold), Colour = colourProvider.Light3, Margin = new MarginPadding { Bottom = 2 }, @@ -111,7 +111,7 @@ namespace osu.Game.Overlays.Chat.ChannelList Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Margin = new MarginPadding { Right = 3 }, - Action = () => OnRequestLeave?.Invoke(channel), + Action = () => OnRequestLeave?.Invoke(Channel), } } }, @@ -119,7 +119,7 @@ namespace osu.Game.Overlays.Chat.ChannelList }, }; - Action = () => OnRequestSelect?.Invoke(channel); + Action = () => OnRequestSelect?.Invoke(Channel); } protected override void LoadComplete() @@ -151,10 +151,10 @@ namespace osu.Game.Overlays.Chat.ChannelList private Drawable createIcon() { - if (channel.Type != ChannelType.PM) + if (Channel.Type != ChannelType.PM) return Drawable.Empty(); - return new UpdateableAvatar(channel.Users.First(), isInteractive: false) + return new UpdateableAvatar(Channel.Users.First(), isInteractive: false) { Size = new Vector2(20), Margin = new MarginPadding { Right = 5 }, @@ -167,7 +167,7 @@ namespace osu.Game.Overlays.Chat.ChannelList private void updateSelectState() { - if (selectedChannel.Value == channel && !SelectorActive.Value) + if (selectedChannel.Value == Channel && !SelectorActive.Value) selectBox.FadeIn(300, Easing.OutQuint); else selectBox.FadeOut(200, Easing.OutQuint); diff --git a/osu.Game/Overlays/Chat/ChatOverlayTopBar.cs b/osu.Game/Overlays/Chat/ChatOverlayTopBar.cs new file mode 100644 index 0000000000..9ba7608d89 --- /dev/null +++ b/osu.Game/Overlays/Chat/ChatOverlayTopBar.cs @@ -0,0 +1,67 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osuTK; + +namespace osu.Game.Overlays.Chat +{ + public class ChatOverlayTopBar : Container + { + // IsHovered is used by overlay + public override bool HandlePositionalInput => true; + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider, TextureStore textures) + { + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Background3, + }, + new GridContainer + { + RelativeSizeAxes = Axes.Both, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, 50), + new Dimension(), + }, + Content = new[] + { + new Drawable[] + { + new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Texture = textures.Get("Icons/Hexacons/messaging"), + Size = new Vector2(18), + }, + // Placeholder text + new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = "osu!chat", + Font = OsuFont.Torus.With(size: 16, weight: FontWeight.SemiBold), + Margin = new MarginPadding { Bottom = 2f }, + }, + }, + }, + }, + }; + } + } +} diff --git a/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs b/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs index 526cbcda87..1f0cbae7e2 100644 --- a/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs +++ b/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs @@ -25,11 +25,11 @@ namespace osu.Game.Overlays.Chat.Listing public event Action? OnRequestJoin; public event Action? OnRequestLeave; - public bool FilteringActive { get; set; } - public IEnumerable FilterTerms => new[] { channel.Name, channel.Topic ?? string.Empty }; - public bool MatchingFilter { set => this.FadeTo(value ? 1f : 0f, 100); } + public readonly Channel Channel; - private readonly Channel channel; + public bool FilteringActive { get; set; } + public IEnumerable FilterTerms => new[] { Channel.Name, Channel.Topic ?? string.Empty }; + public bool MatchingFilter { set => this.FadeTo(value ? 1f : 0f, 100); } private Box hoverBox = null!; private SpriteIcon checkbox = null!; @@ -47,7 +47,7 @@ namespace osu.Game.Overlays.Chat.Listing public ChannelListingItem(Channel channel) { - this.channel = channel; + Channel = channel; } [BackgroundDependencyLoader] @@ -94,7 +94,7 @@ namespace osu.Game.Overlays.Chat.Listing { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Text = channel.Name, + Text = Channel.Name, Font = OsuFont.Torus.With(size: text_size, weight: FontWeight.SemiBold), Margin = new MarginPadding { Bottom = 2 }, }, @@ -102,7 +102,7 @@ namespace osu.Game.Overlays.Chat.Listing { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Text = channel.Topic, + Text = Channel.Topic, Font = OsuFont.Torus.With(size: text_size), Margin = new MarginPadding { Bottom = 2 }, }, @@ -134,7 +134,7 @@ namespace osu.Game.Overlays.Chat.Listing { base.LoadComplete(); - channelJoined = channel.Joined.GetBoundCopy(); + channelJoined = Channel.Joined.GetBoundCopy(); channelJoined.BindValueChanged(change => { const double duration = 500; @@ -155,7 +155,7 @@ namespace osu.Game.Overlays.Chat.Listing } }, true); - Action = () => (channelJoined.Value ? OnRequestLeave : OnRequestJoin)?.Invoke(channel); + Action = () => (channelJoined.Value ? OnRequestLeave : OnRequestJoin)?.Invoke(Channel); } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs new file mode 100644 index 0000000000..01b8ed2a45 --- /dev/null +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -0,0 +1,293 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Diagnostics; +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; +using osu.Framework.Localisation; +using osu.Game.Configuration; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; +using osu.Game.Localisation; +using osu.Game.Online.Chat; +using osu.Game.Overlays.Chat; +using osu.Game.Overlays.Chat.ChannelList; +using osu.Game.Overlays.Chat.Listing; + +namespace osu.Game.Overlays +{ + public class ChatOverlayV2 : OsuFocusedOverlayContainer, INamedOverlayComponent + { + public string IconTexture => "Icons/Hexacons/messaging"; + public LocalisableString Title => ChatStrings.HeaderTitle; + public LocalisableString Description => ChatStrings.HeaderDescription; + + private ChatOverlayTopBar topBar = null!; + private ChannelList channelList = null!; + private LoadingLayer loading = null!; + private ChannelListing channelListing = null!; + private ChatTextBar textBar = null!; + private Container currentChannelContainer = null!; + + private Bindable? chatHeight; + private bool isDraggingTopBar; + private float dragStartChatHeight; + + private const int transition_length = 500; + private const float default_chat_height = 0.4f; + private const float top_bar_height = 40; + private const float side_bar_width = 190; + private const float chat_bar_height = 60; + + private readonly BindableBool selectorActive = new BindableBool(); + + [Resolved] + private OsuConfigManager config { get; set; } = null!; + + [Resolved] + private ChannelManager channelManager { get; set; } = null!; + + [Cached] + private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Pink); + + [Cached] + private readonly Bindable currentChannel = new Bindable(); + + [BackgroundDependencyLoader] + private void load() + { + // Width = 0.85f; // Matches OnlineOverlay + Height = default_chat_height; + RelativeSizeAxes = Axes.Both; + RelativePositionAxes = Axes.Both; + Anchor = Anchor.BottomCentre; + Origin = Anchor.BottomCentre; + Masking = true; + CornerRadius = 7f; + Margin = new MarginPadding { Bottom = -10 }; + Padding = new MarginPadding { Bottom = 10 }; + + Children = new Drawable[] + { + topBar = new ChatOverlayTopBar + { + RelativeSizeAxes = Axes.X, + Height = top_bar_height, + }, + channelList = new ChannelList + { + RelativeSizeAxes = Axes.Y, + Width = side_bar_width, + Padding = new MarginPadding { Top = top_bar_height }, + SelectorActive = { BindTarget = selectorActive }, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Padding = new MarginPadding + { + Top = top_bar_height, + Left = side_bar_width, + Bottom = chat_bar_height, + }, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Background4, + }, + currentChannelContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, + loading = new LoadingLayer(true), + channelListing = new ChannelListing + { + RelativeSizeAxes = Axes.Both, + }, + }, + }, + textBar = new ChatTextBar + { + RelativeSizeAxes = Axes.X, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Padding = new MarginPadding { Left = side_bar_width }, + ShowSearch = { BindTarget = selectorActive }, + }, + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + loading.Show(); + + chatHeight = config.GetBindable(OsuSetting.ChatDisplayHeight).GetBoundCopy(); + chatHeight.BindValueChanged(height => { Height = height.NewValue; }, true); + + currentChannel.BindTo(channelManager.CurrentChannel); + channelManager.CurrentChannel.BindValueChanged(currentChannelChanged, true); + channelManager.JoinedChannels.BindCollectionChanged(joinedChannelsChanged, true); + channelManager.AvailableChannels.BindCollectionChanged(availableChannelsChanged, true); + + channelList.OnRequestSelect += channel => + { + // Manually selecting a channel should dismiss the selector + selectorActive.Value = false; + channelManager.CurrentChannel.Value = channel; + }; + channelList.OnRequestLeave += channel => channelManager.LeaveChannel(channel); + + channelListing.OnRequestJoin += channel => channelManager.JoinChannel(channel); + channelListing.OnRequestLeave += channel => channelManager.LeaveChannel(channel); + + textBar.OnSearchTermsChanged += searchTerms => channelListing.SearchTerm = searchTerms; + textBar.OnChatMessageCommitted += handleChatMessage; + + selectorActive.BindValueChanged(v => channelListing.State.Value = v.NewValue ? Visibility.Visible : Visibility.Hidden, true); + } + + /// + /// Highlights a certain message in the specified channel. + /// + /// The message to highlight. + /// The channel containing the message. + public void HighlightMessage(Message message, Channel channel) + { + Debug.Assert(channel.Id == message.ChannelId); + + if (currentChannel.Value?.Id != channel.Id) + { + if (!channel.Joined.Value) + channel = channelManager.JoinChannel(channel); + + channelManager.CurrentChannel.Value = channel; + } + + selectorActive.Value = false; + + channel.HighlightedMessage.Value = message; + + Show(); + } + + protected override bool OnDragStart(DragStartEvent e) + { + isDraggingTopBar = topBar.IsHovered; + + if (!isDraggingTopBar) + return base.OnDragStart(e); + + dragStartChatHeight = chatHeight!.Value; + return true; + } + + protected override void OnDrag(DragEvent e) + { + if (!isDraggingTopBar) + return; + + float targetChatHeight = dragStartChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y; + chatHeight!.Value = targetChatHeight; + } + + protected override void OnDragEnd(DragEndEvent e) + { + isDraggingTopBar = false; + base.OnDragEnd(e); + } + + protected override void PopIn() + { + this.MoveToY(0, transition_length, Easing.OutQuint); + this.FadeIn(transition_length, Easing.OutQuint); + base.PopIn(); + } + + protected override void PopOut() + { + this.MoveToY(Height, transition_length, Easing.InSine); + this.FadeOut(transition_length, Easing.InSine); + base.PopOut(); + } + + private void currentChannelChanged(ValueChangedEvent e) + { + Channel? newChannel = e.NewValue; + + loading.Show(); + + // Channel is null when leaving the currently selected channel + if (newChannel == null) + { + // Find another channel to switch to + newChannel = channelManager.JoinedChannels.FirstOrDefault(chan => chan != e.OldValue); + + if (newChannel == null) + selectorActive.Value = true; + else + currentChannel.Value = newChannel; + + return; + } + + LoadComponentAsync(new DrawableChannel(newChannel), loaded => + { + currentChannelContainer.Clear(); + currentChannelContainer.Add(loaded); + loading.Hide(); + }); + } + + private void joinedChannelsChanged(object sender, NotifyCollectionChangedEventArgs args) + { + switch (args.Action) + { + case NotifyCollectionChangedAction.Add: + IEnumerable joinedChannels = filterChannels(args.NewItems); + foreach (var channel in joinedChannels) + channelList.AddChannel(channel); + break; + + case NotifyCollectionChangedAction.Remove: + IEnumerable leftChannels = filterChannels(args.OldItems); + foreach (var channel in leftChannels) + channelList.RemoveChannel(channel); + break; + } + } + + private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs args) + => channelListing.UpdateAvailableChannels(channelManager.AvailableChannels); + + private IEnumerable filterChannels(IList channels) + => channels.Cast().Where(c => c.Type == ChannelType.Public || c.Type == ChannelType.PM); + + private void handleChatMessage(string message) + { + if (string.IsNullOrWhiteSpace(message)) + return; + + if (message[0] == '/') + channelManager.PostCommand(message.Substring(1)); + else + channelManager.PostMessage(message); + } + } +} + From 5c13200c75d581b796306b04e5d21ad3082beb3b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 1 May 2022 13:01:38 +0900 Subject: [PATCH 0597/2328] Update production endpoint to new version --- osu.Game/Online/ProductionEndpointConfiguration.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/ProductionEndpointConfiguration.cs b/osu.Game/Online/ProductionEndpointConfiguration.cs index c6ddc03564..e44dad1db5 100644 --- a/osu.Game/Online/ProductionEndpointConfiguration.cs +++ b/osu.Game/Online/ProductionEndpointConfiguration.cs @@ -10,8 +10,8 @@ namespace osu.Game.Online WebsiteRootUrl = APIEndpointUrl = @"https://osu.ppy.sh"; APIClientSecret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk"; APIClientID = "5"; - SpectatorEndpointUrl = "https://spectator.ppy.sh/spectator"; - MultiplayerEndpointUrl = "https://spectator.ppy.sh/multiplayer"; + SpectatorEndpointUrl = "https://spectator2.ppy.sh/spectator"; + MultiplayerEndpointUrl = "https://spectator2.ppy.sh/multiplayer"; } } } From 4bd1d091486feba7933432359758c531c40ec29b Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sun, 1 May 2022 12:20:11 +0100 Subject: [PATCH 0598/2328] Remove blank line --- osu.Game/Overlays/ChatOverlayV2.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 01b8ed2a45..d0b49d9ef3 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -290,4 +290,3 @@ namespace osu.Game.Overlays } } } - From bcce807311ae0a455ebf0771322c63ba9ed8c6d7 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sun, 1 May 2022 12:20:54 +0100 Subject: [PATCH 0599/2328] Fix chat command test as reference equality checks on PM channels doesn't seem to to work --- osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 312bda6460..c7bb6760c7 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -185,16 +185,17 @@ namespace osu.Game.Tests.Visual.Online AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); AddStep("Open chat with user", () => channelManager.PostCommand($"chat {testUser.Username}")); - AddAssert("PM channel is selected", () => channelManager.CurrentChannel.Value == testPMChannel); - AddAssert("PM channel is visibile", () => currentDrawableChannel.Channel == testPMChannel); + AddAssert("PM channel is selected", () => + channelManager.CurrentChannel.Value.Type == ChannelType.PM && channelManager.CurrentChannel.Value.Users.Single() == testUser); AddStep("Open chat with non-existent user", () => channelManager.PostCommand("chat user_doesnt_exist")); AddAssert("Last message is error", () => channelManager.CurrentChannel.Value.Messages.Last() is ErrorMessage); + // Make sure no unnecessary requests are made when the PM channel is already open. AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); AddStep("Unregister request handling", () => ((DummyAPIAccess)API).HandleRequest = null); AddStep("Open chat with user", () => channelManager.PostCommand($"chat {testUser.Username}")); - AddAssert("PM channel is selected", () => channelManager.CurrentChannel.Value == testPMChannel); - AddAssert("PM channel is visibile", () => currentDrawableChannel.Channel == testPMChannel); + AddAssert("PM channel is selected", () => + channelManager.CurrentChannel.Value.Type == ChannelType.PM && channelManager.CurrentChannel.Value.Users.Single() == testUser); } [Test] From 4b30d0e59b84cc4a8a496cd5d2ab8fcf16f125f8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 2 May 2022 17:42:56 +0900 Subject: [PATCH 0600/2328] Fix first-run overlay's song select applying track adjustments Closes https://github.com/ppy/osu/issues/18041. --- osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs index 1bd82f6d99..862506add2 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs @@ -99,6 +99,8 @@ namespace osu.Game.Overlays.FirstRunSetup private class NestedSongSelect : PlaySongSelect { protected override bool ControlGlobalMusic => false; + + public override bool? AllowTrackAdjustments => false; } private class PinnedMainMenu : MainMenu From c3e0ba5c8db4bd3d2042445ad1d8db136e5b93e6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 2 May 2022 20:27:00 +0900 Subject: [PATCH 0601/2328] Fix clicking anywhere in the beatmap overlay dismissing it --- osu.Game/Overlays/BeatmapSetOverlay.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index b9d3854066..bd63c997df 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -5,7 +5,6 @@ using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.Events; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.BeatmapSet; @@ -24,9 +23,6 @@ namespace osu.Game.Overlays private readonly Bindable beatmapSet = new Bindable(); - // receive input outside our bounds so we can trigger a close event on ourselves. - public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; - public BeatmapSetOverlay() : base(OverlayColourScheme.Blue) { @@ -71,12 +67,6 @@ namespace osu.Game.Overlays beatmapSet.Value = null; } - protected override bool OnClick(ClickEvent e) - { - Hide(); - return true; - } - public void FetchAndShowBeatmap(int beatmapId) { beatmapSet.Value = null; From 55949e8407bd91ad1bc32e09084d3db27cb986e3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 2 May 2022 20:30:03 +0900 Subject: [PATCH 0602/2328] Make disabled sheared buttons darker --- osu.Game/Graphics/UserInterface/ShearedButton.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedButton.cs b/osu.Game/Graphics/UserInterface/ShearedButton.cs index c3c566782f..d46fa24409 100644 --- a/osu.Game/Graphics/UserInterface/ShearedButton.cs +++ b/osu.Game/Graphics/UserInterface/ShearedButton.cs @@ -176,8 +176,8 @@ namespace osu.Game.Graphics.UserInterface if (!Enabled.Value) { - colourDark = colourDark.Darken(0.3f); - colourLight = colourLight.Darken(0.3f); + colourDark = colourDark.Darken(1f); + colourLight = colourLight.Darken(1f); } else if (IsHovered) { From f9a1d9df56968b8ebe8ff094ae990c4615214690 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 2 May 2022 20:30:36 +0900 Subject: [PATCH 0603/2328] Reduce scale effect slightly (was feeling too bouncy) --- osu.Game/Graphics/UserInterface/ShearedButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedButton.cs b/osu.Game/Graphics/UserInterface/ShearedButton.cs index d46fa24409..dea44e6d99 100644 --- a/osu.Game/Graphics/UserInterface/ShearedButton.cs +++ b/osu.Game/Graphics/UserInterface/ShearedButton.cs @@ -158,7 +158,7 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnMouseDown(MouseDownEvent e) { - Content.ScaleTo(0.8f, 2000, Easing.OutQuint); + Content.ScaleTo(0.9f, 2000, Easing.OutQuint); return base.OnMouseDown(e); } From 18852b250965df3f8c51be41682c2fca9719f298 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 2 May 2022 15:31:47 +0300 Subject: [PATCH 0604/2328] Fix footer random button autosizing to text length --- osu.Game/Screens/Select/FooterButtonRandom.cs | 51 +++++++++++++++---- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Select/FooterButtonRandom.cs b/osu.Game/Screens/Select/FooterButtonRandom.cs index 48d5836826..f855b80f75 100644 --- a/osu.Game/Screens/Select/FooterButtonRandom.cs +++ b/osu.Game/Screens/Select/FooterButtonRandom.cs @@ -5,6 +5,7 @@ using System; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -19,6 +20,9 @@ namespace osu.Game.Screens.Select public Action NextRandom { get; set; } public Action PreviousRandom { get; set; } + private Container persistentText; + private OsuSpriteText randomSpriteText; + private OsuSpriteText rewindSpriteText; private bool rewindSearch; [BackgroundDependencyLoader] @@ -26,7 +30,32 @@ namespace osu.Game.Screens.Select { SelectedColour = colours.Green; DeselectedColour = SelectedColour.Opacity(0.5f); - updateText(); + + TextContainer.Add(persistentText = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AlwaysPresent = true, + AutoSizeAxes = Axes.Both, + Children = new[] + { + randomSpriteText = new OsuSpriteText + { + AlwaysPresent = true, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "random", + }, + rewindSpriteText = new OsuSpriteText + { + AlwaysPresent = true, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "rewind", + Alpha = 0f, + } + } + }); Action = () => { @@ -34,22 +63,22 @@ namespace osu.Game.Screens.Select { const double fade_time = 500; - OsuSpriteText rewindSpriteText; + OsuSpriteText fallingRewind; - TextContainer.Add(rewindSpriteText = new OsuSpriteText + TextContainer.Add(fallingRewind = new OsuSpriteText { Alpha = 0, - Text = @"rewind", + Text = rewindSpriteText.Text, AlwaysPresent = true, // make sure the button is sized large enough to always show this Anchor = Anchor.Centre, Origin = Anchor.Centre, }); - rewindSpriteText.FadeOutFromOne(fade_time, Easing.In); - rewindSpriteText.MoveTo(Vector2.Zero).MoveTo(new Vector2(0, 10), fade_time, Easing.In); - rewindSpriteText.Expire(); + fallingRewind.FadeOutFromOne(fade_time, Easing.In); + fallingRewind.MoveTo(Vector2.Zero).MoveTo(new Vector2(0, 10), fade_time, Easing.In); + fallingRewind.Expire(); - SpriteText.FadeInFromZero(fade_time, Easing.In); + persistentText.FadeInFromZero(fade_time, Easing.In); PreviousRandom.Invoke(); } @@ -119,6 +148,10 @@ namespace osu.Game.Screens.Select } } - private void updateText(bool rewind = false) => Text = rewind ? "rewind" : "random"; + private void updateText(bool rewind = false) + { + randomSpriteText.Alpha = rewind ? 0 : 1; + rewindSpriteText.Alpha = rewind ? 1 : 0; + } } } From c4c62ff4e7c478dcafdcc21b166cd34ecc64a11d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 2 May 2022 22:46:14 +0900 Subject: [PATCH 0605/2328] Fix countdown sounds playing every minute, rather than only on the last minute --- .../OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs index a7e18622dc..62310bcaac 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs @@ -106,7 +106,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match { updateButtonText(); - int secondsRemaining = countdownTimeRemaining.Seconds; + int secondsRemaining = (int)countdownTimeRemaining.TotalSeconds; playTickSound(secondsRemaining); From e6f1ac6bec24e483f42e985a4ca43cf0454d99f5 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 2 May 2022 20:08:33 +0100 Subject: [PATCH 0606/2328] Ensure "chatting in..." text is aligned with chat message --- osu.Game/Overlays/Chat/ChatTextBar.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChatTextBar.cs b/osu.Game/Overlays/Chat/ChatTextBar.cs index ef20149dac..15fa2d87db 100644 --- a/osu.Game/Overlays/Chat/ChatTextBar.cs +++ b/osu.Game/Overlays/Chat/ChatTextBar.cs @@ -32,7 +32,7 @@ namespace osu.Game.Overlays.Chat private Container searchIconContainer = null!; private ChatTextBox chatTextBox = null!; - private const float chatting_text_width = 180; + private const float chatting_text_width = 240; private const float search_icon_width = 40; [BackgroundDependencyLoader] From 1473762e2567884d8e238e1ce3c713e76c0be42b Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 2 May 2022 20:57:39 +0100 Subject: [PATCH 0607/2328] Don't wrap "chatting in.." text in `ChatTextBar` --- osu.Game/Overlays/Chat/ChatTextBar.cs | 31 ++++++++++++++++----------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTextBar.cs b/osu.Game/Overlays/Chat/ChatTextBar.cs index 15fa2d87db..316511d9a6 100644 --- a/osu.Game/Overlays/Chat/ChatTextBar.cs +++ b/osu.Game/Overlays/Chat/ChatTextBar.cs @@ -11,7 +11,8 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Game.Graphics.Containers; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; using osuTK; @@ -28,7 +29,8 @@ namespace osu.Game.Overlays.Chat [Resolved] private Bindable currentChannel { get; set; } = null!; - private OsuTextFlowContainer chattingTextContainer = null!; + private Container chattingTextContainer = null!; + private OsuSpriteText chattingText = null!; private Container searchIconContainer = null!; private ChatTextBox chatTextBox = null!; @@ -61,16 +63,19 @@ namespace osu.Game.Overlays.Chat { new Drawable[] { - chattingTextContainer = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 20)) + chattingTextContainer = new Container { - Masking = true, - Width = chatting_text_width, - Padding = new MarginPadding { Left = 10 }, RelativeSizeAxes = Axes.Y, - TextAnchor = Anchor.CentreRight, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Colour = colourProvider.Background1, + Width = chatting_text_width, + Masking = true, + Child = chattingText = new OsuSpriteText + { + Font = OsuFont.Torus.With(size: 20), + Colour = colourProvider.Background1, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Truncate = true, + }, }, searchIconContainer = new Container { @@ -131,15 +136,15 @@ namespace osu.Game.Overlays.Chat switch (newChannel?.Type) { case ChannelType.Public: - chattingTextContainer.Text = $"chatting in {newChannel.Name}"; + chattingText.Text = $"chatting in {newChannel.Name}"; break; case ChannelType.PM: - chattingTextContainer.Text = $"chatting with {newChannel.Name}"; + chattingText.Text = $"chatting with {newChannel.Name}"; break; default: - chattingTextContainer.Text = string.Empty; + chattingText.Text = string.Empty; break; } }, true); From 7f8e00c1e3e8e6d66d4f9de132c0ffdddf9b37bf Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 2 May 2022 21:22:47 +0100 Subject: [PATCH 0608/2328] Change "Add more channels" to sentence case in "ChannelList" --- osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs index 57ab7584b5..f9dab74eb1 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs @@ -50,7 +50,7 @@ namespace osu.Game.Overlays.Chat.ChannelList { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Text = "Add More Channels", + Text = "Add more channels", Font = OsuFont.Torus.With(size: 17, weight: FontWeight.SemiBold), Colour = colourProvider.Light3, Margin = new MarginPadding { Bottom = 2 }, From a931b1ecc37a089edc4fcf55f93c94543cf26d08 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 2 May 2022 22:32:25 +0100 Subject: [PATCH 0609/2328] Show selected channel text as white in `ChannelListItem` --- .../Chat/ChannelList/ChannelListItem.cs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs index fa8fae29e5..e6a126f4d8 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs @@ -126,13 +126,9 @@ namespace osu.Game.Overlays.Chat.ChannelList { base.LoadComplete(); - selectedChannel.BindValueChanged(_ => updateSelectState(), true); - SelectorActive.BindValueChanged(_ => updateSelectState(), true); - - Unread.BindValueChanged(change => - { - text.FadeColour(change.NewValue ? colourProvider.Content1 : colourProvider.Light3, 300, Easing.OutQuint); - }, true); + selectedChannel.BindValueChanged(_ => updateState(), true); + SelectorActive.BindValueChanged(_ => updateState(), true); + Unread.BindValueChanged(_ => updateState(), true); } protected override bool OnHover(HoverEvent e) @@ -165,12 +161,21 @@ namespace osu.Game.Overlays.Chat.ChannelList }; } - private void updateSelectState() + private void updateState() { - if (selectedChannel.Value == Channel && !SelectorActive.Value) + if (showSelected) selectBox.FadeIn(300, Easing.OutQuint); else selectBox.FadeOut(200, Easing.OutQuint); + + if (showUnread || showSelected) + text.FadeColour(colourProvider.Content1, 300, Easing.OutQuint); + else + text.FadeColour(colourProvider.Light3, 200, Easing.OutQuint); } + + private bool showUnread => Unread.Value; + + private bool showSelected => selectedChannel.Value == Channel && !SelectorActive.Value; } } From d7919f462c32def081a8424c09731088495146d7 Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Tue, 3 May 2022 05:36:12 +0700 Subject: [PATCH 0610/2328] Split `SearchTextBox` into `SearchTextBox` and `BasicSearchTextBox` --- .../UserInterface/BasicSearchTextBox.cs | 26 +++++++++++++++++++ .../Graphics/UserInterface/SearchTextBox.cs | 13 ---------- 2 files changed, 26 insertions(+), 13 deletions(-) create mode 100644 osu.Game/Graphics/UserInterface/BasicSearchTextBox.cs diff --git a/osu.Game/Graphics/UserInterface/BasicSearchTextBox.cs b/osu.Game/Graphics/UserInterface/BasicSearchTextBox.cs new file mode 100644 index 0000000000..aa101d7e08 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/BasicSearchTextBox.cs @@ -0,0 +1,26 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osuTK; + +namespace osu.Game.Graphics.UserInterface +{ + public class BasicSearchTextBox : SearchTextBox + { + public BasicSearchTextBox() + { + Add(new SpriteIcon + { + Icon = FontAwesome.Solid.Search, + Origin = Anchor.CentreRight, + Anchor = Anchor.CentreRight, + Margin = new MarginPadding { Right = 10 }, + Size = new Vector2(20), + }); + + TextFlow.Padding = new MarginPadding { Right = 35 }; + } + } +} \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index dd9ed7c9e9..cc0bc2dc46 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -1,12 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Framework.Input.Events; using osu.Game.Resources.Localisation.Web; -using osuTK; using osuTK.Input; namespace osu.Game.Graphics.UserInterface @@ -18,16 +15,6 @@ namespace osu.Game.Graphics.UserInterface public SearchTextBox() { Height = 35; - Add(new SpriteIcon - { - Icon = FontAwesome.Solid.Search, - Origin = Anchor.CentreRight, - Anchor = Anchor.CentreRight, - Margin = new MarginPadding { Right = 10 }, - Size = new Vector2(20), - }); - - TextFlow.Padding = new MarginPadding { Right = 35 }; PlaceholderText = HomeStrings.SearchPlaceholder; } From 81be69e72ec3884fcc1347235036b735162efa1f Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Tue, 3 May 2022 06:18:42 +0700 Subject: [PATCH 0611/2328] Update search textbox implementation to use `BasicSearchTextBox` instead --- osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs | 2 +- osu.Game/Overlays/BeatmapListing/BeatmapListingSearchControl.cs | 2 +- osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs | 2 +- osu.Game/Overlays/Music/FilterControl.cs | 2 +- osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs b/osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs index 6a9e8a5b8c..0b76ff658f 100644 --- a/osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs @@ -6,7 +6,7 @@ namespace osu.Game.Graphics.UserInterface /// /// A which does not handle left/right arrow keys for seeking. /// - public class SeekLimitedSearchTextBox : SearchTextBox + public class SeekLimitedSearchTextBox : BasicSearchTextBox { public override bool HandleLeftRightArrows => false; } diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapListingSearchControl.cs b/osu.Game/Overlays/BeatmapListing/BeatmapListingSearchControl.cs index 2474515802..eeaa31a013 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapListingSearchControl.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapListingSearchControl.cs @@ -163,7 +163,7 @@ namespace osu.Game.Overlays.BeatmapListing public void TakeFocus() => textBox.TakeFocus(); - private class BeatmapSearchTextBox : SearchTextBox + private class BeatmapSearchTextBox : BasicSearchTextBox { /// /// Any time the text box receives key events (even while masked). diff --git a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs index 231d7ca63c..9b0354e264 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs @@ -181,7 +181,7 @@ namespace osu.Game.Overlays.Chat.Selection base.PopOut(); } - private class HeaderSearchTextBox : SearchTextBox + private class HeaderSearchTextBox : BasicSearchTextBox { [BackgroundDependencyLoader] private void load() diff --git a/osu.Game/Overlays/Music/FilterControl.cs b/osu.Game/Overlays/Music/FilterControl.cs index 66adbeebe8..46c66b4bae 100644 --- a/osu.Game/Overlays/Music/FilterControl.cs +++ b/osu.Game/Overlays/Music/FilterControl.cs @@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Music Collection = collectionDropdown.Current.Value?.Collection }; - public class FilterTextBox : SearchTextBox + public class FilterTextBox : BasicSearchTextBox { protected override bool AllowCommit => true; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs index ec55ae79ce..f2429c1944 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs @@ -129,7 +129,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge { RelativeSizeAxes = Axes.X, Height = Header.HEIGHT, - Child = searchTextBox = new SearchTextBox + Child = searchTextBox = new BasicSearchTextBox { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, From e6fbb199518c3c07a2f8a11f7d9a7f0fe2ccae8f Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Thu, 21 Apr 2022 03:59:36 +0700 Subject: [PATCH 0612/2328] Implement new search textbox design --- .../TestSceneShearedSearchTextBox.cs | 46 +++++ .../UserInterface/ShearedSearchTextBox.cs | 192 ++++++++++++++++++ 2 files changed, 238 insertions(+) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneShearedSearchTextBox.cs create mode 100644 osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedSearchTextBox.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedSearchTextBox.cs new file mode 100644 index 0000000000..e1dbf04133 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedSearchTextBox.cs @@ -0,0 +1,46 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Linq; +using NUnit.Framework; +using osu.Framework.Graphics; +using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; + +namespace osu.Game.Tests.Visual.UserInterface +{ + public class TestSceneShearedSearchTextBox : OsuTestScene + { + [Test] + public void TestAllColourSchemes() + { + foreach (var scheme in Enum.GetValues(typeof(OverlayColourScheme)).Cast()) + AddStep($"set {scheme} scheme", () => Child = createContent(scheme)); + } + + private Drawable createContent(OverlayColourScheme colourScheme) + { + var colourProvider = new OverlayColourProvider(colourScheme); + + return new DependencyProvidingContainer + { + RelativeSizeAxes = Axes.Both, + CachedDependencies = new (Type, object)[] + { + (typeof(OverlayColourProvider), colourProvider) + }, + Children = new Drawable[] + { + new ShearedSearchTextBox + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Width = 0.5f + } + } + }; + } + } +} diff --git a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs new file mode 100644 index 0000000000..e3dc118faa --- /dev/null +++ b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs @@ -0,0 +1,192 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input; +using osu.Framework.Input.Events; +using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; +using osuTK; +using osuTK.Graphics; +using osuTK.Input; + +namespace osu.Game.Graphics.UserInterface +{ + public class ShearedSearchTextBox : CompositeDrawable, IHasCurrentValue + { + private const float icon_container_width = 50; + private const float corner_radius = 10; + private const float height = 42; + private readonly Vector2 shear = new Vector2(0.2f, 0); + + public FocusedTextBox TextBox; + + public Bindable Current + { + get => TextBox.Current; + set => TextBox.Current = value; + } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + Height = height; + Shear = shear; + Masking = true; + CornerRadius = corner_radius; + InternalChild = new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new Box + { + Colour = colourProvider.Background3, + RelativeSizeAxes = Axes.Both + }, + new GridContainer + { + RelativeSizeAxes = Axes.Both, + Content = new[] + { + new Drawable[] + { + new Container + { + Name = @"Search box container", + RelativeSizeAxes = Axes.Both, + CornerRadius = corner_radius, + Masking = true, + Children = new Drawable[] + { + new Box + { + Colour = colourProvider.Background4, + RelativeSizeAxes = Axes.Both + }, + TextBox = new SearchTextBox + { + Shear = -shear, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + RelativeSizeAxes = Axes.X, + Padding = new MarginPadding + { + Horizontal = corner_radius + } + } + } + }, + new Container + { + Name = @"Icon container", + RelativeSizeAxes = Axes.Y, + Width = icon_container_width, + Origin = Anchor.CentreRight, + Anchor = Anchor.CentreRight, + Children = new Drawable[] + { + new SpriteIcon + { + Icon = FontAwesome.Solid.Search, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Size = new Vector2(16), + Shear = -shear + } + } + } + } + }, + ColumnDimensions = new[] { new Dimension(), new Dimension(GridSizeMode.AutoSize) } + } + } + }; + } + + public override bool HandleNonPositionalInput => TextBox.HandleNonPositionalInput; + + private class SearchTextBox : FocusedTextBox + { + protected virtual bool AllowCommit => false; + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + BackgroundFocused = colourProvider.Background4; + BackgroundUnfocused = colourProvider.Background4; + Placeholder.Colour = Color4.White; + PlaceholderText = @"Search"; + } + + protected override SpriteText CreatePlaceholder() => new OsuSpriteText + { + Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold) + }; + + protected override Drawable GetDrawableCharacter(char c) => new FallingDownContainer + { + AutoSizeAxes = Axes.Both, + Child = new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold) }, + }; + + public override bool OnPressed(KeyBindingPressEvent e) + { + switch (e.Action) + { + case PlatformAction.MoveBackwardLine: + case PlatformAction.MoveForwardLine: + // Shift+delete is handled via PlatformAction on macOS. this is not so useful in the context of a SearchTextBox + // as we do not allow arrow key navigation in the first place (ie. the caret should always be at the end of text) + // Avoid handling it here to allow other components to potentially consume the shortcut. + case PlatformAction.DeleteForwardChar: + return false; + } + + return base.OnPressed(e); + } + + protected override bool OnKeyDown(KeyDownEvent e) + { + if (!e.ControlPressed && !e.ShiftPressed) + { + switch (e.Key) + { + case Key.Left: + case Key.Right: + case Key.Up: + case Key.Down: + return false; + } + } + + if (!AllowCommit) + { + switch (e.Key) + { + case Key.KeypadEnter: + case Key.Enter: + return false; + } + } + + if (e.ShiftPressed) + { + switch (e.Key) + { + case Key.Delete: + return false; + } + } + + return base.OnKeyDown(e); + } + } + } +} From a436ff877f19d509ee0eb0a81a76659997aa99b1 Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Fri, 22 Apr 2022 22:01:56 +0700 Subject: [PATCH 0613/2328] Apply review --- osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs index e3dc118faa..89373ec8db 100644 --- a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs @@ -12,6 +12,7 @@ using osu.Framework.Input; using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; using osu.Game.Overlays; +using osu.Game.Overlays.Mods; using osuTK; using osuTK.Graphics; using osuTK.Input; @@ -21,9 +22,9 @@ namespace osu.Game.Graphics.UserInterface public class ShearedSearchTextBox : CompositeDrawable, IHasCurrentValue { private const float icon_container_width = 50; - private const float corner_radius = 10; + private const float corner_radius = 7; private const float height = 42; - private readonly Vector2 shear = new Vector2(0.2f, 0); + private readonly Vector2 shear = new Vector2(ShearedOverlayContainer.SHEAR, 0); public FocusedTextBox TextBox; @@ -78,7 +79,7 @@ namespace osu.Game.Graphics.UserInterface RelativeSizeAxes = Axes.X, Padding = new MarginPadding { - Horizontal = corner_radius + Horizontal = corner_radius + shear.X } } } From e03d086305626e3fe30e69787911f6c6b636a7a3 Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Tue, 3 May 2022 11:24:48 +0700 Subject: [PATCH 0614/2328] Inherit `SearchTextBox` instead --- .../UserInterface/ShearedSearchTextBox.cs | 58 +------------------ 1 file changed, 1 insertion(+), 57 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs index 89373ec8db..04c060a5bc 100644 --- a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs @@ -8,14 +8,11 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; -using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; using osu.Game.Overlays; using osu.Game.Overlays.Mods; using osuTK; using osuTK.Graphics; -using osuTK.Input; namespace osu.Game.Graphics.UserInterface { @@ -113,9 +110,8 @@ namespace osu.Game.Graphics.UserInterface public override bool HandleNonPositionalInput => TextBox.HandleNonPositionalInput; - private class SearchTextBox : FocusedTextBox + private class InnerSearchTextBox : SearchTextBox { - protected virtual bool AllowCommit => false; [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) @@ -136,58 +132,6 @@ namespace osu.Game.Graphics.UserInterface AutoSizeAxes = Axes.Both, Child = new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold) }, }; - - public override bool OnPressed(KeyBindingPressEvent e) - { - switch (e.Action) - { - case PlatformAction.MoveBackwardLine: - case PlatformAction.MoveForwardLine: - // Shift+delete is handled via PlatformAction on macOS. this is not so useful in the context of a SearchTextBox - // as we do not allow arrow key navigation in the first place (ie. the caret should always be at the end of text) - // Avoid handling it here to allow other components to potentially consume the shortcut. - case PlatformAction.DeleteForwardChar: - return false; - } - - return base.OnPressed(e); - } - - protected override bool OnKeyDown(KeyDownEvent e) - { - if (!e.ControlPressed && !e.ShiftPressed) - { - switch (e.Key) - { - case Key.Left: - case Key.Right: - case Key.Up: - case Key.Down: - return false; - } - } - - if (!AllowCommit) - { - switch (e.Key) - { - case Key.KeypadEnter: - case Key.Enter: - return false; - } - } - - if (e.ShiftPressed) - { - switch (e.Key) - { - case Key.Delete: - return false; - } - } - - return base.OnKeyDown(e); - } } } } From a35502a834189826e4435ec7faf1cc3654d12481 Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Tue, 3 May 2022 11:25:14 +0700 Subject: [PATCH 0615/2328] Move implementation to ctor instead of bdl method --- .../UserInterface/ShearedSearchTextBox.cs | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs index 04c060a5bc..4076c4f76b 100644 --- a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs @@ -22,17 +22,27 @@ namespace osu.Game.Graphics.UserInterface private const float corner_radius = 7; private const float height = 42; private readonly Vector2 shear = new Vector2(ShearedOverlayContainer.SHEAR, 0); - - public FocusedTextBox TextBox; + private readonly Box background; + private readonly Box searchBoxBackground; + private readonly SearchTextBox textBox; public Bindable Current { - get => TextBox.Current; - set => TextBox.Current = value; + get => textBox.Current; + set => textBox.Current = value; } - [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) + public bool HoldFocus + { + get => textBox.HoldFocus; + set => textBox.HoldFocus = value; + } + + public void TakeFocus() => textBox.TakeFocus(); + + public void KillFocus() => textBox.KillFocus(); + + public ShearedSearchTextBox() { Height = height; Shear = shear; @@ -43,9 +53,8 @@ namespace osu.Game.Graphics.UserInterface RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new Box + background = new Box { - Colour = colourProvider.Background3, RelativeSizeAxes = Axes.Both }, new GridContainer @@ -63,12 +72,11 @@ namespace osu.Game.Graphics.UserInterface Masking = true, Children = new Drawable[] { - new Box + searchBoxBackground = new Box { - Colour = colourProvider.Background4, RelativeSizeAxes = Axes.Both }, - TextBox = new SearchTextBox + textBox = new InnerSearchTextBox { Shear = -shear, Anchor = Anchor.CentreLeft, @@ -108,11 +116,17 @@ namespace osu.Game.Graphics.UserInterface }; } - public override bool HandleNonPositionalInput => TextBox.HandleNonPositionalInput; + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + background.Colour = colourProvider.Background3; + searchBoxBackground.Colour = colourProvider.Background4; + } + + public override bool HandleNonPositionalInput => textBox.HandleNonPositionalInput; private class InnerSearchTextBox : SearchTextBox { - [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) { From 4f16da893286b09da833f3b3aa24037019fdb266 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 2 May 2022 20:04:34 +0800 Subject: [PATCH 0616/2328] Set EnforceCodeStyleInBuild --- .globalconfig | 55 +++++++++++++++++++++++++++++++++++++++++++ Directory.Build.props | 1 + osu.sln | 1 + 3 files changed, 57 insertions(+) create mode 100644 .globalconfig diff --git a/.globalconfig b/.globalconfig new file mode 100644 index 0000000000..607798492c --- /dev/null +++ b/.globalconfig @@ -0,0 +1,55 @@ +is_global = true + +# .NET Code Style +# IDE styles reference: https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ + +# IDE0001: Simplify names +dotnet_diagnostic.IDE0001.severity = warning + +# IDE0002: Simplify member access +dotnet_diagnostic.IDE0002.severity = warning + +# IDE0003: Remove qualification +dotnet_diagnostic.IDE0003.severity = warning + +# IDE0004: Remove unnecessary cast +dotnet_diagnostic.IDE0004.severity = warning + +# IDE0005: Remove unnecessary imports +dotnet_diagnostic.IDE0005.severity = warning + +# IDE0034: Simplify default literal +dotnet_diagnostic.IDE0034.severity = warning + +# IDE0036: Sort modifiers +dotnet_diagnostic.IDE0036.severity = warning + +# IDE0040: Add accessibility modifier +dotnet_diagnostic.IDE0040.severity = warning + +# IDE0049: Use keyword for type name +dotnet_diagnostic.IDE0040.severity = warning + +# IDE0055: Fix formatting +dotnet_diagnostic.IDE0055.severity = warning + +# IDE0051: Private method is unused +dotnet_diagnostic.IDE0051.severity = silent + +# IDE0052: Private member is unused +dotnet_diagnostic.IDE0052.severity = warning + +# IDE0073: File header +dotnet_diagnostic.IDE0073.severity = warning + +# IDE0130: Namespace mismatch with folder +dotnet_diagnostic.IDE0130.severity = warning + +# IDE1006: Naming style +dotnet_diagnostic.IDE1006.severity = warning + +#Disable operator overloads requiring alternate named methods +dotnet_diagnostic.CA2225.severity = none + +# Banned APIs +dotnet_diagnostic.RS0030.severity = error diff --git a/Directory.Build.props b/Directory.Build.props index 709545bf1d..f3ddc68838 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -20,6 +20,7 @@ + true $(MSBuildThisFileDirectory)CodeAnalysis\osu.ruleset diff --git a/osu.sln b/osu.sln index b5018db362..aeec0843be 100644 --- a/osu.sln +++ b/osu.sln @@ -56,6 +56,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{10DF8F12-50FD-45D8-8A38-17BA764BF54D}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig + .globalconfig = .globalconfig Directory.Build.props = Directory.Build.props osu.Android.props = osu.Android.props osu.iOS.props = osu.iOS.props From 7cf4dabe29961c7f9d74f88e5827269598ed45ce Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 2 May 2022 20:07:53 +0800 Subject: [PATCH 0617/2328] Fix IDE0005 and IDE0034 --- osu.Game/Migrations/20181007180454_StandardizePaths.cs | 4 +--- .../Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs | 2 +- .../Overlays/Profile/Header/Components/LevelProgressBar.cs | 2 +- osu.Game/Overlays/Rankings/SpotlightSelector.cs | 2 +- osu.Game/Overlays/Rankings/Tables/PerformanceTable.cs | 3 +-- .../Edit/Compose/Components/SelectionBoxRotationHandle.cs | 2 +- 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/osu.Game/Migrations/20181007180454_StandardizePaths.cs b/osu.Game/Migrations/20181007180454_StandardizePaths.cs index 274b8030a9..11a020eb9c 100644 --- a/osu.Game/Migrations/20181007180454_StandardizePaths.cs +++ b/osu.Game/Migrations/20181007180454_StandardizePaths.cs @@ -1,6 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using System.IO; +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs index 9ee002fd9d..f528f54cdf 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs @@ -119,7 +119,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores maxComboColumn.Text = value.MaxCombo.ToLocalisableString(@"0\x"); ppColumn.Alpha = value.BeatmapInfo.Status.GrantsPerformancePoints() ? 1 : 0; - ppColumn.Text = value.PP?.ToLocalisableString(@"N0") ?? default(LocalisableString); + ppColumn.Text = value.PP?.ToLocalisableString(@"N0") ?? default; statisticsColumns.ChildrenEnumerable = value.GetStatisticsForDisplay().Select(createStatisticsColumn); modsColumn.Mods = value.Mods; diff --git a/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs b/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs index ec9cb55042..d8eb5b65ac 100644 --- a/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs +++ b/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs @@ -62,7 +62,7 @@ namespace osu.Game.Overlays.Profile.Header.Components private void updateProgress(APIUser user) { levelProgressBar.Length = user?.Statistics?.Level.Progress / 100f ?? 0; - levelProgressText.Text = user?.Statistics?.Level.Progress.ToLocalisableString("0'%'") ?? default(LocalisableString); + levelProgressText.Text = user?.Statistics?.Level.Progress.ToLocalisableString("0'%'") ?? default; } } } diff --git a/osu.Game/Overlays/Rankings/SpotlightSelector.cs b/osu.Game/Overlays/Rankings/SpotlightSelector.cs index 48a4c31f30..c05c160463 100644 --- a/osu.Game/Overlays/Rankings/SpotlightSelector.cs +++ b/osu.Game/Overlays/Rankings/SpotlightSelector.cs @@ -126,7 +126,7 @@ namespace osu.Game.Overlays.Rankings startDateColumn.Value = dateToString(response.Spotlight.StartDate); endDateColumn.Value = dateToString(response.Spotlight.EndDate); mapCountColumn.Value = response.BeatmapSets.Count.ToLocalisableString(@"N0"); - participantsColumn.Value = response.Spotlight.Participants?.ToLocalisableString(@"N0") ?? default(LocalisableString); + participantsColumn.Value = response.Spotlight.Participants?.ToLocalisableString(@"N0") ?? default; } private LocalisableString dateToString(DateTimeOffset date) => date.ToLocalisableString(@"yyyy-MM-dd"); diff --git a/osu.Game/Overlays/Rankings/Tables/PerformanceTable.cs b/osu.Game/Overlays/Rankings/Tables/PerformanceTable.cs index bdbd2942d1..6c85ec2753 100644 --- a/osu.Game/Overlays/Rankings/Tables/PerformanceTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/PerformanceTable.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; using osu.Game.Users; @@ -25,7 +24,7 @@ namespace osu.Game.Overlays.Rankings.Tables protected override Drawable[] CreateUniqueContent(UserStatistics item) => new Drawable[] { - new RowText { Text = item.PP?.ToLocalisableString(@"N0") ?? default(LocalisableString), } + new RowText { Text = item.PP?.ToLocalisableString(@"N0") ?? default, } }; } } diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxRotationHandle.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxRotationHandle.cs index 22479bd9b3..f13ed0456a 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxRotationHandle.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxRotationHandle.cs @@ -100,7 +100,7 @@ namespace osu.Game.Screens.Edit.Compose.Components private void updateTooltipText() { - TooltipText = cumulativeRotation.Value?.ToLocalisableString("0.0°") ?? default(LocalisableString); + TooltipText = cumulativeRotation.Value?.ToLocalisableString("0.0°") ?? default; } } } From 5513710b2efbe9684cbf850ea7ef8c8ce04dcb38 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 2 May 2022 21:51:28 +0800 Subject: [PATCH 0618/2328] Fix IDE0055 --- .../CatchSelectionBlueprintTestScene.cs | 5 +- .../TestSceneManageCollectionsDialog.cs | 3 +- .../OnlinePlay/Components/DrawableGameType.cs | 76 ++++++++++--------- 3 files changed, 44 insertions(+), 40 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/CatchSelectionBlueprintTestScene.cs b/osu.Game.Rulesets.Catch.Tests/Editor/CatchSelectionBlueprintTestScene.cs index e345e03c96..88fd3b36ba 100644 --- a/osu.Game.Rulesets.Catch.Tests/Editor/CatchSelectionBlueprintTestScene.cs +++ b/osu.Game.Rulesets.Catch.Tests/Editor/CatchSelectionBlueprintTestScene.cs @@ -29,13 +29,14 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor protected CatchSelectionBlueprintTestScene() { - EditorBeatmap = new EditorBeatmap(new CatchBeatmap + var catchBeatmap = new CatchBeatmap { BeatmapInfo = { Ruleset = new CatchRuleset().RulesetInfo, } - }) { Difficulty = { CircleSize = 0 } }; + }; + EditorBeatmap = new EditorBeatmap(catchBeatmap) { Difficulty = { CircleSize = 0 } }; EditorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 100 diff --git a/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs b/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs index 51ca55f37f..d5983ac827 100644 --- a/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs +++ b/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs @@ -141,7 +141,8 @@ namespace osu.Game.Tests.Visual.Collections { AddStep("add dropdown", () => { - Add(new CollectionFilterDropdown + Add( + new CollectionFilterDropdown { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, diff --git a/osu.Game/Screens/OnlinePlay/Components/DrawableGameType.cs b/osu.Game/Screens/OnlinePlay/Components/DrawableGameType.cs index 613f16563c..f360a80599 100644 --- a/osu.Game/Screens/OnlinePlay/Components/DrawableGameType.cs +++ b/osu.Game/Screens/OnlinePlay/Components/DrawableGameType.cs @@ -87,44 +87,46 @@ namespace osu.Game.Screens.OnlinePlay.Components }, }; - // case MatchType.TagCoop: - // return new SpriteIcon - // { - // Anchor = Anchor.Centre, - // Origin = Anchor.Centre, - // Size = new Vector2(size), - // Icon = FontAwesome.Solid.Sync, - // Colour = colours.Blue, - // - // Shadow = false - // }; +#pragma warning disable IDE0055 // Indentation of commented code + // case MatchType.TagCoop: + // return new SpriteIcon + // { + // Anchor = Anchor.Centre, + // Origin = Anchor.Centre, + // Size = new Vector2(size), + // Icon = FontAwesome.Solid.Sync, + // Colour = colours.Blue, + // + // Shadow = false + // }; - // case MatchType.TagTeamCoop: - // return new FillFlowContainer - // { - // Anchor = Anchor.Centre, - // Origin = Anchor.Centre, - // AutoSizeAxes = Axes.Both, - // Direction = FillDirection.Horizontal, - // Spacing = new Vector2(2f), - // Children = new[] - // { - // new SpriteIcon - // { - // Icon = FontAwesome.Solid.Sync, - // Size = new Vector2(size * 0.75f), - // Colour = colours.Blue, - // Shadow = false, - // }, - // new SpriteIcon - // { - // Icon = FontAwesome.Solid.Sync, - // Size = new Vector2(size * 0.75f), - // Colour = colours.Pink, - // Shadow = false, - // }, - // }, - // }; + // case MatchType.TagTeamCoop: + // return new FillFlowContainer + // { + // Anchor = Anchor.Centre, + // Origin = Anchor.Centre, + // AutoSizeAxes = Axes.Both, + // Direction = FillDirection.Horizontal, + // Spacing = new Vector2(2f), + // Children = new[] + // { + // new SpriteIcon + // { + // Icon = FontAwesome.Solid.Sync, + // Size = new Vector2(size * 0.75f), + // Colour = colours.Blue, + // Shadow = false, + // }, + // new SpriteIcon + // { + // Icon = FontAwesome.Solid.Sync, + // Size = new Vector2(size * 0.75f), + // Colour = colours.Pink, + // Shadow = false, + // }, + // }, + // }; +#pragma warning restore IDE0055 } } From 4a56297c1c187083878aa7c9e8b83c9fedf33cee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 3 May 2022 14:28:58 +0900 Subject: [PATCH 0619/2328] Add localisation and improve visuals of placeholder text --- .../UserInterface/ShearedSearchTextBox.cs | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs index 4076c4f76b..5dda8598bc 100644 --- a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs @@ -11,8 +11,8 @@ using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Overlays; using osu.Game.Overlays.Mods; +using osu.Game.Resources.Localisation.Web; using osuTK; -using osuTK.Graphics; namespace osu.Game.Graphics.UserInterface { @@ -132,14 +132,29 @@ namespace osu.Game.Graphics.UserInterface { BackgroundFocused = colourProvider.Background4; BackgroundUnfocused = colourProvider.Background4; - Placeholder.Colour = Color4.White; - PlaceholderText = @"Search"; + + Placeholder.Font = OsuFont.GetFont(size: CalculatedTextSize, weight: FontWeight.SemiBold); + PlaceholderText = CommonStrings.InputSearch; } - protected override SpriteText CreatePlaceholder() => new OsuSpriteText + protected override SpriteText CreatePlaceholder() => new SearchPlaceholder(); + + internal class SearchPlaceholder : SpriteText { - Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold) - }; + public override void Show() + { + this + .MoveToY(0, 250, Easing.OutQuint) + .FadeIn(250, Easing.OutQuint); + } + + public override void Hide() + { + this + .MoveToY(3, 250, Easing.OutQuint) + .FadeOut(250, Easing.OutQuint); + } + } protected override Drawable GetDrawableCharacter(char c) => new FallingDownContainer { From 8e0235392f9df3fed2007cbb69f94fad0990be17 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 3 May 2022 14:30:38 +0900 Subject: [PATCH 0620/2328] Inline single-use constants --- .../UserInterface/ShearedSearchTextBox.cs | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs index 5dda8598bc..639331196d 100644 --- a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs @@ -18,10 +18,8 @@ namespace osu.Game.Graphics.UserInterface { public class ShearedSearchTextBox : CompositeDrawable, IHasCurrentValue { - private const float icon_container_width = 50; private const float corner_radius = 7; - private const float height = 42; - private readonly Vector2 shear = new Vector2(ShearedOverlayContainer.SHEAR, 0); + private readonly Box background; private readonly Box searchBoxBackground; private readonly SearchTextBox textBox; @@ -44,8 +42,8 @@ namespace osu.Game.Graphics.UserInterface public ShearedSearchTextBox() { - Height = height; - Shear = shear; + Height = 42; + Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0); Masking = true; CornerRadius = corner_radius; InternalChild = new Container @@ -78,13 +76,13 @@ namespace osu.Game.Graphics.UserInterface }, textBox = new InnerSearchTextBox { - Shear = -shear, + Shear = -new Vector2(ShearedOverlayContainer.SHEAR, 0), Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, RelativeSizeAxes = Axes.X, Padding = new MarginPadding { - Horizontal = corner_radius + shear.X + Horizontal = corner_radius + new Vector2(ShearedOverlayContainer.SHEAR, 0).X } } } @@ -93,7 +91,7 @@ namespace osu.Game.Graphics.UserInterface { Name = @"Icon container", RelativeSizeAxes = Axes.Y, - Width = icon_container_width, + Width = 50, Origin = Anchor.CentreRight, Anchor = Anchor.CentreRight, Children = new Drawable[] @@ -104,13 +102,17 @@ namespace osu.Game.Graphics.UserInterface Origin = Anchor.Centre, Anchor = Anchor.Centre, Size = new Vector2(16), - Shear = -shear + Shear = -new Vector2(ShearedOverlayContainer.SHEAR, 0) } } } } }, - ColumnDimensions = new[] { new Dimension(), new Dimension(GridSizeMode.AutoSize) } + ColumnDimensions = new[] + { + new Dimension(), + new Dimension(GridSizeMode.AutoSize) + } } } }; From bc88c4ee8e201f3734d9b60a725e77978e002cd7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 3 May 2022 14:34:18 +0900 Subject: [PATCH 0621/2328] Reduce container nesting by one level --- .../UserInterface/ShearedSearchTextBox.cs | 103 +++++++++--------- 1 file changed, 50 insertions(+), 53 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs index 639331196d..8b49f1d90e 100644 --- a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs @@ -46,73 +46,70 @@ namespace osu.Game.Graphics.UserInterface Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0); Masking = true; CornerRadius = corner_radius; - InternalChild = new Container + + InternalChildren = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] + background = new Box { - background = new Box + RelativeSizeAxes = Axes.Both + }, + new GridContainer + { + RelativeSizeAxes = Axes.Both, + Content = new[] { - RelativeSizeAxes = Axes.Both - }, - new GridContainer - { - RelativeSizeAxes = Axes.Both, - Content = new[] + new Drawable[] { - new Drawable[] + new Container { - new Container + Name = @"Search box container", + RelativeSizeAxes = Axes.Both, + CornerRadius = corner_radius, + Masking = true, + Children = new Drawable[] { - Name = @"Search box container", - RelativeSizeAxes = Axes.Both, - CornerRadius = corner_radius, - Masking = true, - Children = new Drawable[] + searchBoxBackground = new Box { - searchBoxBackground = new Box - { - RelativeSizeAxes = Axes.Both - }, - textBox = new InnerSearchTextBox - { - Shear = -new Vector2(ShearedOverlayContainer.SHEAR, 0), - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - RelativeSizeAxes = Axes.X, - Padding = new MarginPadding - { - Horizontal = corner_radius + new Vector2(ShearedOverlayContainer.SHEAR, 0).X - } - } - } - }, - new Container - { - Name = @"Icon container", - RelativeSizeAxes = Axes.Y, - Width = 50, - Origin = Anchor.CentreRight, - Anchor = Anchor.CentreRight, - Children = new Drawable[] + RelativeSizeAxes = Axes.Both + }, + textBox = new InnerSearchTextBox { - new SpriteIcon + Shear = -Shear, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + RelativeSizeAxes = Axes.X, + Padding = new MarginPadding { - Icon = FontAwesome.Solid.Search, - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Size = new Vector2(16), - Shear = -new Vector2(ShearedOverlayContainer.SHEAR, 0) + Horizontal = corner_radius + Shear.X } } } + }, + new Container + { + Name = @"Icon container", + RelativeSizeAxes = Axes.Y, + Width = 50, + Origin = Anchor.CentreRight, + Anchor = Anchor.CentreRight, + Children = new Drawable[] + { + new SpriteIcon + { + Icon = FontAwesome.Solid.Search, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Size = new Vector2(16), + Shear = -Shear + } + } } - }, - ColumnDimensions = new[] - { - new Dimension(), - new Dimension(GridSizeMode.AutoSize) } + }, + ColumnDimensions = new[] + { + new Dimension(), + new Dimension(GridSizeMode.AutoSize) } } }; From b5ea26f2fa7b4f2c99c733f49111c16b8704a2be Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 3 May 2022 14:45:17 +0900 Subject: [PATCH 0622/2328] Fix incorrect shear masking on nested textbox --- .../UserInterface/ShearedSearchTextBox.cs | 31 +++++-------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs index 8b49f1d90e..d16ae2498a 100644 --- a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs @@ -21,7 +21,6 @@ namespace osu.Game.Graphics.UserInterface private const float corner_radius = 7; private readonly Box background; - private readonly Box searchBoxBackground; private readonly SearchTextBox textBox; public Bindable Current @@ -60,30 +59,12 @@ namespace osu.Game.Graphics.UserInterface { new Drawable[] { - new Container + textBox = new InnerSearchTextBox { - Name = @"Search box container", + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, RelativeSizeAxes = Axes.Both, - CornerRadius = corner_radius, - Masking = true, - Children = new Drawable[] - { - searchBoxBackground = new Box - { - RelativeSizeAxes = Axes.Both - }, - textBox = new InnerSearchTextBox - { - Shear = -Shear, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - RelativeSizeAxes = Axes.X, - Padding = new MarginPadding - { - Horizontal = corner_radius + Shear.X - } - } - } + Size = Vector2.One }, new Container { @@ -119,7 +100,6 @@ namespace osu.Game.Graphics.UserInterface private void load(OverlayColourProvider colourProvider) { background.Colour = colourProvider.Background3; - searchBoxBackground.Colour = colourProvider.Background4; } public override bool HandleNonPositionalInput => textBox.HandleNonPositionalInput; @@ -134,6 +114,9 @@ namespace osu.Game.Graphics.UserInterface Placeholder.Font = OsuFont.GetFont(size: CalculatedTextSize, weight: FontWeight.SemiBold); PlaceholderText = CommonStrings.InputSearch; + + CornerRadius = corner_radius; + TextContainer.Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0); } protected override SpriteText CreatePlaceholder() => new SearchPlaceholder(); From 983eed32fc8f328837cb50428b621a0ac1b93385 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 3 May 2022 14:48:00 +0900 Subject: [PATCH 0623/2328] Reduce complexity of icon container nesting --- .../UserInterface/ShearedSearchTextBox.cs | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs index d16ae2498a..0c34a04a65 100644 --- a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs @@ -66,31 +66,20 @@ namespace osu.Game.Graphics.UserInterface RelativeSizeAxes = Axes.Both, Size = Vector2.One }, - new Container + new SpriteIcon { - Name = @"Icon container", - RelativeSizeAxes = Axes.Y, - Width = 50, - Origin = Anchor.CentreRight, - Anchor = Anchor.CentreRight, - Children = new Drawable[] - { - new SpriteIcon - { - Icon = FontAwesome.Solid.Search, - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Size = new Vector2(16), - Shear = -Shear - } - } + Icon = FontAwesome.Solid.Search, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Size = new Vector2(16), + Shear = -Shear } } }, ColumnDimensions = new[] { new Dimension(), - new Dimension(GridSizeMode.AutoSize) + new Dimension(GridSizeMode.Absolute, 50), } } }; From a555c472127a9d900ac239b91ae82f1802c8f8d7 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 3 May 2022 15:02:57 +0900 Subject: [PATCH 0624/2328] Reduce sorting complexity in worst-case of diffcalc --- osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs b/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs index bbd2f079aa..d13d4ebf2e 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs @@ -65,6 +65,10 @@ namespace osu.Game.Rulesets.Difficulty.Skills /// private void saveCurrentPeak() { + // Ignore sections with 0 strain to avoid edge cases of long maps with a lot of spacing between objects (e.g. /b/2351871). + if (currentSectionPeak == 0) + return; + strainPeaks.Add(currentSectionPeak); } From 547038f13b9840e263ce1bc6c0d57841acf8aeb6 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 3 May 2022 14:28:53 +0800 Subject: [PATCH 0625/2328] Align editorconfig with framework --- .editorconfig | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/.editorconfig b/.editorconfig index 840fa98334..35ac84fca0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,14 @@ # EditorConfig is awesome: http://editorconfig.org root = true +[*.{csproj,props,targets}] +charset = utf-8-bom +end_of_line = crlf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + [*.cs] end_of_line = crlf insert_final_newline = true @@ -8,8 +16,19 @@ indent_style = space indent_size = 4 trim_trailing_whitespace = true +#license header +file_header_template = Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.\nSee the LICENCE file in the repository root for full licence text. + #Roslyn naming styles +#PascalCase for public and protected members +dotnet_naming_style.pascalcase.capitalization = pascal_case +dotnet_naming_symbols.public_members.applicable_accessibilities = public,internal,protected,protected_internal,private_protected +dotnet_naming_symbols.public_members.applicable_kinds = property,method,field,event +dotnet_naming_rule.public_members_pascalcase.severity = error +dotnet_naming_rule.public_members_pascalcase.symbols = public_members +dotnet_naming_rule.public_members_pascalcase.style = pascalcase + #camelCase for private members dotnet_naming_style.camelcase.capitalization = camel_case @@ -157,7 +176,7 @@ csharp_style_unused_value_assignment_preference = discard_variable:warning #Style - variable declaration csharp_style_inlined_variable_declaration = true:warning -csharp_style_deconstructed_variable_declaration = false:silent +csharp_style_deconstructed_variable_declaration = true:warning #Style - other C# 7.x features dotnet_style_prefer_inferred_tuple_names = true:warning @@ -168,28 +187,15 @@ dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent #Style - C# 8 features csharp_prefer_static_local_function = true:warning csharp_prefer_simple_using_statement = true:silent -csharp_style_prefer_index_operator = false:silent -csharp_style_prefer_range_operator = false:silent +csharp_style_prefer_index_operator = true:warning +csharp_style_prefer_range_operator = true:warning csharp_style_prefer_switch_expression = false:none -#Supressing roslyn built-in analyzers -# Suppress: EC112 - -#Private method is unused -dotnet_diagnostic.IDE0051.severity = silent -#Private member is unused -dotnet_diagnostic.IDE0052.severity = silent - -#Rules for disposable -dotnet_diagnostic.IDE0067.severity = none -dotnet_diagnostic.IDE0068.severity = none -dotnet_diagnostic.IDE0069.severity = none - -#Disable operator overloads requiring alternate named methods -dotnet_diagnostic.CA2225.severity = none - -# Banned APIs -dotnet_diagnostic.RS0030.severity = error +[*.{yaml,yml}] +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true dotnet_diagnostic.OLOC001.words_in_name = 5 dotnet_diagnostic.OLOC001.license_header = // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.\n// See the LICENCE file in the repository root for full licence text. From 1202c29ea1aa4318a111e196f583c430700ff951 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 3 May 2022 14:33:14 +0800 Subject: [PATCH 0626/2328] Add license headers to EF migration files --- osu.Game/Migrations/20171019041408_InitialCreate.cs | 5 ++++- osu.Game/Migrations/20171025071459_AddMissingIndexRules.cs | 5 ++++- .../20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs | 5 ++++- .../Migrations/20171209034410_AddRulesetInfoShortName.cs | 5 ++++- osu.Game/Migrations/20180125143340_Settings.cs | 5 ++++- osu.Game/Migrations/20180131154205_AddMuteBinding.cs | 5 ++++- osu.Game/Migrations/20180219060912_AddSkins.cs | 5 ++++- .../Migrations/20180529055154_RemoveUniqueHashConstraints.cs | 5 ++++- .../Migrations/20180621044111_UpdateTaikoDefaultBindings.cs | 5 ++++- osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs | 5 ++++- osu.Game/Migrations/20180913080842_AddRankStatus.cs | 5 ++++- osu.Game/Migrations/20181007180454_StandardizePaths.cs | 5 ++++- osu.Game/Migrations/20181128100659_AddSkinInfoHash.cs | 5 ++++- osu.Game/Migrations/20181130113755_AddScoreInfoTables.cs | 5 ++++- osu.Game/Migrations/20190225062029_AddUserIDColumn.cs | 5 ++++- osu.Game/Migrations/20190525060824_SkinSettings.cs | 5 ++++- .../20190605091246_AddDateAddedColumnToBeatmapSet.cs | 5 ++++- osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs | 5 ++++- osu.Game/Migrations/20190913104727_AddBeatmapVideo.cs | 5 ++++- osu.Game/Migrations/20200302094919_RefreshVolumeBindings.cs | 5 ++++- osu.Game/Migrations/20201019224408_AddEpilepsyWarning.cs | 5 ++++- .../Migrations/20210412045700_RefreshVolumeBindingsAgain.cs | 5 ++++- .../Migrations/20210511060743_AddSkinInstantiationInfo.cs | 5 ++++- .../20210514062639_AddAuthorIdToBeatmapMetadata.cs | 5 ++++- osu.Game/Migrations/20210824185035_AddCountdownSettings.cs | 5 ++++- .../Migrations/20210912144011_AddSamplesMatchPlaybackRate.cs | 5 ++++- 26 files changed, 104 insertions(+), 26 deletions(-) diff --git a/osu.Game/Migrations/20171019041408_InitialCreate.cs b/osu.Game/Migrations/20171019041408_InitialCreate.cs index 9b6881f98c..08ab64fd08 100644 --- a/osu.Game/Migrations/20171019041408_InitialCreate.cs +++ b/osu.Game/Migrations/20171019041408_InitialCreate.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20171025071459_AddMissingIndexRules.cs b/osu.Game/Migrations/20171025071459_AddMissingIndexRules.cs index c9fc59c5a2..4ec3952941 100644 --- a/osu.Game/Migrations/20171025071459_AddMissingIndexRules.cs +++ b/osu.Game/Migrations/20171025071459_AddMissingIndexRules.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs b/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs index 084ae67940..6aba12f86f 100644 --- a/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs +++ b/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs b/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs index 09cf0af89c..5688455f79 100644 --- a/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs +++ b/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20180125143340_Settings.cs b/osu.Game/Migrations/20180125143340_Settings.cs index 166d3c086d..1feb37531f 100644 --- a/osu.Game/Migrations/20180125143340_Settings.cs +++ b/osu.Game/Migrations/20180125143340_Settings.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20180131154205_AddMuteBinding.cs b/osu.Game/Migrations/20180131154205_AddMuteBinding.cs index 5564a30bbf..8646d1d76b 100644 --- a/osu.Game/Migrations/20180131154205_AddMuteBinding.cs +++ b/osu.Game/Migrations/20180131154205_AddMuteBinding.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Infrastructure; using osu.Game.Database; using osu.Game.Input.Bindings; diff --git a/osu.Game/Migrations/20180219060912_AddSkins.cs b/osu.Game/Migrations/20180219060912_AddSkins.cs index a0270ab0fd..319748bed6 100644 --- a/osu.Game/Migrations/20180219060912_AddSkins.cs +++ b/osu.Game/Migrations/20180219060912_AddSkins.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs b/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs index 27269cc5fc..91eabe8868 100644 --- a/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs +++ b/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs index 71304ea979..d888ccd5a2 100644 --- a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs +++ b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs index 506d65f761..fdea636ac6 100644 --- a/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs +++ b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20180913080842_AddRankStatus.cs b/osu.Game/Migrations/20180913080842_AddRankStatus.cs index bba4944bb7..bb147dff84 100644 --- a/osu.Game/Migrations/20180913080842_AddRankStatus.cs +++ b/osu.Game/Migrations/20180913080842_AddRankStatus.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20181007180454_StandardizePaths.cs b/osu.Game/Migrations/20181007180454_StandardizePaths.cs index 11a020eb9c..30f27043a0 100644 --- a/osu.Game/Migrations/20181007180454_StandardizePaths.cs +++ b/osu.Game/Migrations/20181007180454_StandardizePaths.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20181128100659_AddSkinInfoHash.cs b/osu.Game/Migrations/20181128100659_AddSkinInfoHash.cs index 860264a7dd..ee825a1e9c 100644 --- a/osu.Game/Migrations/20181128100659_AddSkinInfoHash.cs +++ b/osu.Game/Migrations/20181128100659_AddSkinInfoHash.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20181130113755_AddScoreInfoTables.cs b/osu.Game/Migrations/20181130113755_AddScoreInfoTables.cs index 2b6f94c5a4..58980132f3 100644 --- a/osu.Game/Migrations/20181130113755_AddScoreInfoTables.cs +++ b/osu.Game/Migrations/20181130113755_AddScoreInfoTables.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20190225062029_AddUserIDColumn.cs b/osu.Game/Migrations/20190225062029_AddUserIDColumn.cs index 0720e0eac7..f2eef600dc 100644 --- a/osu.Game/Migrations/20190225062029_AddUserIDColumn.cs +++ b/osu.Game/Migrations/20190225062029_AddUserIDColumn.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20190525060824_SkinSettings.cs b/osu.Game/Migrations/20190525060824_SkinSettings.cs index 99237419b7..7779b55bb7 100644 --- a/osu.Game/Migrations/20190525060824_SkinSettings.cs +++ b/osu.Game/Migrations/20190525060824_SkinSettings.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs b/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs index 55dc18b6a3..0620a0624f 100644 --- a/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs +++ b/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs b/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs index f5963ebf5e..f8ce354aa1 100644 --- a/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs +++ b/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20190913104727_AddBeatmapVideo.cs b/osu.Game/Migrations/20190913104727_AddBeatmapVideo.cs index 9ed0943acd..af82b4db20 100644 --- a/osu.Game/Migrations/20190913104727_AddBeatmapVideo.cs +++ b/osu.Game/Migrations/20190913104727_AddBeatmapVideo.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.cs b/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.cs index ec4475971c..3d2ddbf6fc 100644 --- a/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.cs +++ b/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.cs b/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.cs index be6968aa5d..58a35a7bf3 100644 --- a/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.cs +++ b/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.cs b/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.cs index 155d6670a8..4d3941dd20 100644 --- a/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.cs +++ b/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.cs b/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.cs index 1d5b0769a4..887635fa85 100644 --- a/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.cs +++ b/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.cs b/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.cs index 98fe9b5e13..7b579e27b9 100644 --- a/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.cs +++ b/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20210824185035_AddCountdownSettings.cs b/osu.Game/Migrations/20210824185035_AddCountdownSettings.cs index 564f5f4520..d1b09e2c1d 100644 --- a/osu.Game/Migrations/20210824185035_AddCountdownSettings.cs +++ b/osu.Game/Migrations/20210824185035_AddCountdownSettings.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.cs b/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.cs index bf3f855d5f..f6fc1f4420 100644 --- a/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.cs +++ b/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations { From 2a388ba3eaba2df84a1f5b5a6c7e3d22149f1a7e Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 3 May 2022 14:34:54 +0800 Subject: [PATCH 0627/2328] Turn IDE0052 to silent according to the occurrences --- .globalconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.globalconfig b/.globalconfig index 607798492c..462dbc74ed 100644 --- a/.globalconfig +++ b/.globalconfig @@ -37,7 +37,7 @@ dotnet_diagnostic.IDE0055.severity = warning dotnet_diagnostic.IDE0051.severity = silent # IDE0052: Private member is unused -dotnet_diagnostic.IDE0052.severity = warning +dotnet_diagnostic.IDE0052.severity = silent # IDE0073: File header dotnet_diagnostic.IDE0073.severity = warning From 2896612c5cd09cc4c6436f2f307d60218b13b8f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 3 May 2022 16:06:04 +0900 Subject: [PATCH 0628/2328] Make exiting multiplayer a dangerous operation, requiring hold --- .../Containers/HoldToConfirmContainer.cs | 8 ++++-- .../Dialog/PopupDialogDangerousButton.cs | 4 ++- .../Screens/Play/HUD/HoldForMenuButton.cs | 27 ++++++++++++++----- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs index 1b802a0a14..c74245461d 100644 --- a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs +++ b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs @@ -40,9 +40,13 @@ namespace osu.Game.Graphics.Containers private Bindable holdActivationDelay; - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + [Resolved] + private OsuConfigManager config { get; set; } + + protected override void LoadComplete() { + base.LoadComplete(); + holdActivationDelay = HoldActivationDelay != null ? new Bindable(HoldActivationDelay.Value) : config.GetBindable(OsuSetting.UIHoldActivationDelay); diff --git a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs index adc627e15b..6c775f44f8 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs @@ -12,6 +12,8 @@ namespace osu.Game.Overlays.Dialog { public class PopupDialogDangerousButton : PopupDialogButton { + public const double DANGEROUS_HOLD_ACTIVATION_DELAY = 500; + private Box progressBox; private DangerousConfirmContainer confirmContainer; @@ -42,7 +44,7 @@ namespace osu.Game.Overlays.Dialog private class DangerousConfirmContainer : HoldToConfirmContainer { - protected override double? HoldActivationDelay => 500; + protected override double? HoldActivationDelay => DANGEROUS_HOLD_ACTIVATION_DELAY; protected override bool OnMouseDown(MouseDownEvent e) { diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index 3da63ec2cc..c6aa3fbe08 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -18,6 +18,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Input.Bindings; +using osu.Game.Overlays.Dialog; using osuTK; namespace osu.Game.Screens.Play.HUD @@ -37,6 +38,14 @@ namespace osu.Game.Screens.Play.HUD private readonly OsuSpriteText text; + [Resolved] + private OsuConfigManager config { get; set; } + + [Resolved(canBeNull: true)] + private Player player { get; set; } + + private readonly Bindable activationDelay = new Bindable(); + public HoldForMenuButton() { Direction = FillDirection.Horizontal; @@ -60,14 +69,15 @@ namespace osu.Game.Screens.Play.HUD AutoSizeAxes = Axes.Both; } - [Resolved] - private OsuConfigManager config { get; set; } - - private Bindable activationDelay; - protected override void LoadComplete() { - activationDelay = config.GetBindable(OsuSetting.UIHoldActivationDelay); + if (player?.Configuration.AllowRestart == false) + { + activationDelay.Value = PopupDialogDangerousButton.DANGEROUS_HOLD_ACTIVATION_DELAY; + } + else + config.BindWith(OsuSetting.UIHoldActivationDelay, activationDelay); + activationDelay.BindValueChanged(v => { text.Text = v.NewValue > 0 @@ -115,6 +125,11 @@ namespace osu.Game.Screens.Play.HUD public Action HoverGained; public Action HoverLost; + [Resolved(canBeNull: true)] + private Player player { get; set; } + + protected override double? HoldActivationDelay => player?.Configuration.AllowRestart == false ? PopupDialogDangerousButton.DANGEROUS_HOLD_ACTIVATION_DELAY : (double?)null; + [BackgroundDependencyLoader] private void load(OsuColour colours) { From 637f81769609d8d56223d2d70263b57d6617444a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 3 May 2022 16:06:20 +0900 Subject: [PATCH 0629/2328] Ignore zero-sections on a per-case basis --- .../Difficulty/Skills/OsuStrainSkill.cs | 6 +++++- .../Difficulty/TaikoDifficultyCalculator.cs | 8 +++++++- osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs | 10 +++++----- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/OsuStrainSkill.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/OsuStrainSkill.cs index e47edc37cc..dcd2c7d321 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/OsuStrainSkill.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/OsuStrainSkill.cs @@ -38,7 +38,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills double difficulty = 0; double weight = 1; - List strains = GetCurrentStrainPeaks().OrderByDescending(d => d).ToList(); + // Sections with 0 strain are excluded to avoid worst-case time complexity of the following sort (e.g. /b/2351871). + // These sections will not contribute to the difficulty. + var peaks = GetCurrentStrainPeaks().Where(p => p > 0); + + List strains = peaks.OrderByDescending(d => d).ToList(); // We are reducing the highest strains first to account for extreme difficulty spikes for (int i = 0; i < Math.Min(strains.Count, ReducedSectionCount); i++) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index 6afdef3f3c..a9d512f076 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -141,7 +141,13 @@ namespace osu.Game.Rulesets.Taiko.Difficulty double colourPeak = colourPeaks[i] * colour_skill_multiplier; double rhythmPeak = rhythmPeaks[i] * rhythm_skill_multiplier; double staminaPeak = (staminaRightPeaks[i] + staminaLeftPeaks[i]) * stamina_skill_multiplier * staminaPenalty; - peaks.Add(norm(2, colourPeak, rhythmPeak, staminaPeak)); + + double peak = norm(2, colourPeak, rhythmPeak, staminaPeak); + + // Sections with 0 strain are excluded to avoid worst-case time complexity of the following sort (e.g. /b/2351871). + // These sections will not contribute to the difficulty. + if (peak > 0) + peaks.Add(peak); } double difficulty = 0; diff --git a/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs b/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs index d13d4ebf2e..97266562e4 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs @@ -65,10 +65,6 @@ namespace osu.Game.Rulesets.Difficulty.Skills /// private void saveCurrentPeak() { - // Ignore sections with 0 strain to avoid edge cases of long maps with a lot of spacing between objects (e.g. /b/2351871). - if (currentSectionPeak == 0) - return; - strainPeaks.Add(currentSectionPeak); } @@ -104,9 +100,13 @@ namespace osu.Game.Rulesets.Difficulty.Skills double difficulty = 0; double weight = 1; + // Sections with 0 strain are excluded to avoid worst-case time complexity of the following sort (e.g. /b/2351871). + // These sections will not contribute to the difficulty. + var peaks = GetCurrentStrainPeaks().Where(p => p > 0); + // Difficulty is the weighted sum of the highest strains from every section. // We're sorting from highest to lowest strain. - foreach (double strain in GetCurrentStrainPeaks().OrderByDescending(d => d)) + foreach (double strain in peaks.OrderByDescending(d => d)) { difficulty += strain * weight; weight *= DecayWeight; From 521ec1a225f72931941c1ab23714954aa646ec93 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 3 May 2022 04:44:55 +0300 Subject: [PATCH 0630/2328] Add keybind for distance grid spacing activation --- osu.Game/Input/Bindings/GlobalActionContainer.cs | 4 ++++ .../Localisation/GlobalActionKeyBindingStrings.cs | 5 +++++ .../Rulesets/Edit/DistancedHitObjectComposer.cs | 14 ++++++++------ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index 47cb7be2cf..5656c79975 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -79,6 +79,7 @@ namespace osu.Game.Input.Bindings new KeyBinding(new[] { InputKey.F5 }, GlobalAction.EditorTestGameplay), new KeyBinding(new[] { InputKey.Control, InputKey.H }, GlobalAction.EditorFlipHorizontally), new KeyBinding(new[] { InputKey.Control, InputKey.J }, GlobalAction.EditorFlipVertically), + new KeyBinding(new[] { InputKey.Control, InputKey.Alt }, GlobalAction.EditorDistanceSpacing), }; public IEnumerable InGameKeyBindings => new[] @@ -301,5 +302,8 @@ namespace osu.Game.Input.Bindings [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorFlipVertically))] EditorFlipVertically, + + [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorDistanceSpacing))] + EditorDistanceSpacing, } } diff --git a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs index 777e97d1e3..73cc7546ab 100644 --- a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs +++ b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs @@ -239,6 +239,11 @@ namespace osu.Game.Localisation /// public static LocalisableString EditorFlipVertically => new TranslatableString(getKey(@"editor_flip_vertically"), @"Flip selection vertically"); + /// + /// "Distance grid spacing (hold)" + /// + public static LocalisableString EditorDistanceSpacing => new TranslatableString(getKey(@"editor_distance_spacing"), @"Distance grid spacing (hold)"); + /// /// "Toggle skin editor" /// diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index 0505f9ab0e..1a4ea845d0 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -4,9 +4,11 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; +using osu.Game.Input.Bindings; using osu.Game.Overlays.Settings.Sections; using osu.Game.Rulesets.Objects; using osuTK; @@ -18,7 +20,7 @@ namespace osu.Game.Rulesets.Edit /// /// The base type of supported objects. [Cached(typeof(IDistanceSnapProvider))] - public abstract class DistancedHitObjectComposer : HitObjectComposer, IDistanceSnapProvider + public abstract class DistancedHitObjectComposer : HitObjectComposer, IDistanceSnapProvider, IKeyBindingHandler where TObject : HitObject { protected Bindable DistanceSpacingMultiplier { get; } = new BindableDouble(1.0) @@ -75,21 +77,21 @@ namespace osu.Game.Rulesets.Edit } } - protected override bool OnKeyDown(KeyDownEvent e) + public bool OnPressed(KeyBindingPressEvent e) { - if (!DistanceSpacingMultiplier.Disabled && e.ControlPressed && e.AltPressed && !e.Repeat) + if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing) { RightSideToolboxContainer.Expanded.Value = true; distanceSpacingScrollActive = true; return true; } - return base.OnKeyDown(e); + return false; } - protected override void OnKeyUp(KeyUpEvent e) + public void OnReleased(KeyBindingReleaseEvent e) { - if (!DistanceSpacingMultiplier.Disabled && distanceSpacingScrollActive && (!e.AltPressed || !e.ControlPressed)) + if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing) { RightSideToolboxContainer.Expanded.Value = false; distanceSpacingScrollActive = false; From b8287f3687e06c88b6a565994cf23233f285d2e2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 3 May 2022 10:30:32 +0300 Subject: [PATCH 0631/2328] Display toast notification on editor distance spacing change --- .../Edit/DistancedHitObjectComposer.cs | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index 1a4ea845d0..a19944712e 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -3,12 +3,16 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; +using osu.Framework.Localisation; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; +using osu.Game.Overlays; +using osu.Game.Overlays.OSD; using osu.Game.Overlays.Settings.Sections; using osu.Game.Rulesets.Objects; using osuTK; @@ -37,6 +41,9 @@ namespace osu.Game.Rulesets.Edit private ExpandableSlider> distanceSpacingSlider; private bool distanceSpacingScrollActive; + [Resolved] + private OnScreenDisplay onScreenDisplay { get; set; } + protected DistancedHitObjectComposer(Ruleset ruleset) : base(ruleset) { @@ -72,6 +79,10 @@ namespace osu.Game.Rulesets.Edit { distanceSpacingSlider.ContractedLabelText = $"D. S. ({v.NewValue:0.##x})"; distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({v.NewValue:0.##x})"; + + if (v.NewValue != v.OldValue) + onScreenDisplay.Display(new DistanceSpacingToast(v.NewValue.ToLocalisableString(@"0.##x"))); + EditorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue; }, true); } @@ -81,7 +92,6 @@ namespace osu.Game.Rulesets.Edit { if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing) { - RightSideToolboxContainer.Expanded.Value = true; distanceSpacingScrollActive = true; return true; } @@ -92,10 +102,7 @@ namespace osu.Game.Rulesets.Edit public void OnReleased(KeyBindingReleaseEvent e) { if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing) - { - RightSideToolboxContainer.Expanded.Value = false; distanceSpacingScrollActive = false; - } } protected override bool OnScroll(ScrollEvent e) @@ -160,5 +167,13 @@ namespace osu.Game.Rulesets.Edit FillFlow.Spacing = new Vector2(10); } } + + private class DistanceSpacingToast : Toast + { + public DistanceSpacingToast(LocalisableString value) + : base("Distance Spacing", value, string.Empty) + { + } + } } } From 0dd2e1652c2a040e6bd831c2cbdab12d22f33210 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 3 May 2022 11:15:28 +0300 Subject: [PATCH 0632/2328] Mark `OnScreenDisplay` dependency as nullable --- osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index a19944712e..75b87fb6e8 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Edit private ExpandableSlider> distanceSpacingSlider; private bool distanceSpacingScrollActive; - [Resolved] + [Resolved(canBeNull: true)] private OnScreenDisplay onScreenDisplay { get; set; } protected DistancedHitObjectComposer(Ruleset ruleset) @@ -81,7 +81,7 @@ namespace osu.Game.Rulesets.Edit distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({v.NewValue:0.##x})"; if (v.NewValue != v.OldValue) - onScreenDisplay.Display(new DistanceSpacingToast(v.NewValue.ToLocalisableString(@"0.##x"))); + onScreenDisplay?.Display(new DistanceSpacingToast(v.NewValue.ToLocalisableString(@"0.##x"))); EditorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue; }, true); From 89d8ed8e20b2850cb96af75fd0d5b69adf575c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 17 Apr 2022 20:26:16 +0200 Subject: [PATCH 0633/2328] Port existing test coverage --- .../UserInterface/TestSceneModSelectScreen.cs | 225 ++++++++++++++++++ 1 file changed, 225 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index ec6e962c6a..bd63023efb 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -2,17 +2,21 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; +using osu.Game.Overlays.Settings; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; using osuTK.Input; @@ -169,6 +173,206 @@ namespace osu.Game.Tests.Visual.UserInterface assertCustomisationToggleState(disabled: true, active: false); // config was dismissed without explicit user action. } + /// + /// Ensure that two mod overlays are not cross polluting via central settings instances. + /// + [Test] + public void TestSettingsNotCrossPolluting() + { + Bindable> selectedMods2 = null; + ModSelectScreen modSelectScreen2 = null; + + createScreen(); + AddStep("select diff adjust", () => SelectedMods.Value = new Mod[] { new OsuModDifficultyAdjust() }); + + AddStep("set setting", () => modSelectScreen.ChildrenOfType>().First().Current.Value = 8); + + AddAssert("ensure setting is propagated", () => SelectedMods.Value.OfType().Single().CircleSize.Value == 8); + + AddStep("create second bindable", () => selectedMods2 = new Bindable>(new Mod[] { new OsuModDifficultyAdjust() })); + + AddStep("create second overlay", () => + { + Add(modSelectScreen2 = new UserModSelectScreen().With(d => + { + d.Origin = Anchor.TopCentre; + d.Anchor = Anchor.TopCentre; + d.SelectedMods.BindTarget = selectedMods2; + })); + }); + + AddStep("show", () => modSelectScreen2.Show()); + + AddAssert("ensure first is unchanged", () => SelectedMods.Value.OfType().Single().CircleSize.Value == 8); + AddAssert("ensure second is default", () => selectedMods2.Value.OfType().Single().CircleSize.Value == null); + } + + [Test] + public void TestSettingsResetOnDeselection() + { + var osuModDoubleTime = new OsuModDoubleTime { SpeedChange = { Value = 1.2 } }; + + createScreen(); + changeRuleset(0); + + AddStep("set dt mod with custom rate", () => { SelectedMods.Value = new[] { osuModDoubleTime }; }); + + AddAssert("selected mod matches", () => (SelectedMods.Value.Single() as OsuModDoubleTime)?.SpeedChange.Value == 1.2); + + AddStep("deselect", () => getPanelForMod(typeof(OsuModDoubleTime)).TriggerClick()); + AddAssert("selected mods empty", () => SelectedMods.Value.Count == 0); + + AddStep("reselect", () => getPanelForMod(typeof(OsuModDoubleTime)).TriggerClick()); + AddAssert("selected mod has default value", () => (SelectedMods.Value.Single() as OsuModDoubleTime)?.SpeedChange.IsDefault == true); + } + + [Test] + public void TestAnimationFlushOnClose() + { + createScreen(); + changeRuleset(0); + + AddStep("Select all fun mods", () => + { + modSelectScreen.ChildrenOfType() + .Single(c => c.ModType == ModType.DifficultyIncrease) + .SelectAll(); + }); + + AddUntilStep("many mods selected", () => SelectedMods.Value.Count >= 5); + + AddStep("trigger deselect and close overlay", () => + { + modSelectScreen.ChildrenOfType() + .Single(c => c.ModType == ModType.DifficultyIncrease) + .DeselectAll(); + + modSelectScreen.Hide(); + }); + + AddAssert("all mods deselected", () => SelectedMods.Value.Count == 0); + } + + [Test] + public void TestRulesetChanges() + { + createScreen(); + changeRuleset(0); + + var noFailMod = new OsuRuleset().GetModsFor(ModType.DifficultyReduction).FirstOrDefault(m => m is OsuModNoFail); + + AddStep("set mods externally", () => { SelectedMods.Value = new[] { noFailMod }; }); + + changeRuleset(0); + + AddAssert("ensure mods still selected", () => SelectedMods.Value.SingleOrDefault(m => m is OsuModNoFail) != null); + + changeRuleset(3); + + AddAssert("ensure mods not selected", () => SelectedMods.Value.Count == 0); + + changeRuleset(0); + + AddAssert("ensure mods not selected", () => SelectedMods.Value.Count == 0); + } + + [Test] + public void TestExternallySetCustomizedMod() + { + createScreen(); + changeRuleset(0); + + AddStep("set customized mod externally", () => SelectedMods.Value = new[] { new OsuModDoubleTime { SpeedChange = { Value = 1.01 } } }); + + AddAssert("ensure button is selected and customized accordingly", () => + { + var button = getPanelForMod(SelectedMods.Value.Single().GetType()); + return ((OsuModDoubleTime)button.Mod).SpeedChange.Value == 1.01; + }); + } + + [Test] + public void TestSettingsAreRetainedOnReload() + { + createScreen(); + changeRuleset(0); + + AddStep("set customized mod externally", () => SelectedMods.Value = new[] { new OsuModDoubleTime { SpeedChange = { Value = 1.01 } } }); + AddAssert("setting remains", () => (SelectedMods.Value.SingleOrDefault() as OsuModDoubleTime)?.SpeedChange.Value == 1.01); + + createScreen(); + AddAssert("setting remains", () => (SelectedMods.Value.SingleOrDefault() as OsuModDoubleTime)?.SpeedChange.Value == 1.01); + } + + [Test] + public void TestExternallySetModIsReplacedByOverlayInstance() + { + Mod external = new OsuModDoubleTime(); + Mod overlayButtonMod = null; + + createScreen(); + changeRuleset(0); + + AddStep("set mod externally", () => { SelectedMods.Value = new[] { external }; }); + + AddAssert("ensure button is selected", () => + { + var button = getPanelForMod(SelectedMods.Value.Single().GetType()); + overlayButtonMod = button.Mod; + return button.Active.Value; + }); + + // Right now, when an external change occurs, the ModSelectOverlay will replace the global instance with its own + AddAssert("mod instance doesn't match", () => external != overlayButtonMod); + + AddAssert("one mod present in global selected", () => SelectedMods.Value.Count == 1); + AddAssert("globally selected matches button's mod instance", () => SelectedMods.Value.Contains(overlayButtonMod)); + AddAssert("globally selected doesn't contain original external change", () => !SelectedMods.Value.Contains(external)); + } + + [Test] + public void TestChangeIsValidChangesButtonVisibility() + { + createScreen(); + changeRuleset(0); + + AddAssert("double time visible", () => modSelectScreen.ChildrenOfType().Where(panel => panel.Mod is OsuModDoubleTime).Any(panel => !panel.Filtered.Value)); + + AddStep("make double time invalid", () => modSelectScreen.IsValidMod = m => !(m is OsuModDoubleTime)); + AddUntilStep("double time not visible", () => modSelectScreen.ChildrenOfType().Where(panel => panel.Mod is OsuModDoubleTime).All(panel => panel.Filtered.Value)); + AddAssert("nightcore still visible", () => modSelectScreen.ChildrenOfType().Where(panel => panel.Mod is OsuModNightcore).Any(panel => !panel.Filtered.Value)); + + AddStep("make double time valid again", () => modSelectScreen.IsValidMod = m => true); + AddUntilStep("double time visible", () => modSelectScreen.ChildrenOfType().Where(panel => panel.Mod is OsuModDoubleTime).Any(panel => !panel.Filtered.Value)); + AddAssert("nightcore still visible", () => modSelectScreen.ChildrenOfType().Where(b => b.Mod is OsuModNightcore).Any(panel => !panel.Filtered.Value)); + } + + [Test] + public void TestChangeIsValidPreservesSelection() + { + createScreen(); + changeRuleset(0); + + AddStep("select DT + HD", () => SelectedMods.Value = new Mod[] { new OsuModDoubleTime(), new OsuModHidden() }); + AddAssert("DT + HD selected", () => modSelectScreen.ChildrenOfType().Count(panel => panel.Active.Value) == 2); + + AddStep("make NF invalid", () => modSelectScreen.IsValidMod = m => !(m is ModNoFail)); + AddAssert("DT + HD still selected", () => modSelectScreen.ChildrenOfType().Count(panel => panel.Active.Value) == 2); + } + + [Test] + public void TestUnimplementedModIsUnselectable() + { + var testRuleset = new TestUnimplementedModOsuRuleset(); + + createScreen(); + + AddStep("set ruleset", () => Ruleset.Value = testRuleset.RulesetInfo); + waitForColumnLoad(); + + AddAssert("unimplemented mod panel is filtered", () => getPanelForMod(typeof(TestUnimplementedMod)).Filtered.Value); + } + private void waitForColumnLoad() => AddUntilStep("all column content loaded", () => modSelectScreen.ChildrenOfType().Any() && modSelectScreen.ChildrenOfType().All(column => column.IsLoaded && column.ItemsLoaded)); @@ -188,5 +392,26 @@ namespace osu.Game.Tests.Visual.UserInterface private ModPanel getPanelForMod(Type modType) => modSelectScreen.ChildrenOfType().Single(panel => panel.Mod.GetType() == modType); + + private class TestUnimplementedMod : Mod + { + public override string Name => "Unimplemented mod"; + public override string Acronym => "UM"; + public override string Description => "A mod that is not implemented."; + public override double ScoreMultiplier => 1; + public override ModType Type => ModType.Conversion; + } + + private class TestUnimplementedModOsuRuleset : OsuRuleset + { + public override string ShortName => "unimplemented"; + + public override IEnumerable GetModsFor(ModType type) + { + if (type == ModType.Conversion) return base.GetModsFor(type).Concat(new[] { new TestUnimplementedMod() }); + + return base.GetModsFor(type); + } + } } } From 746a4a740316f6bd1fbdd17f8bcc1d63c3474e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 17 Apr 2022 21:23:54 +0200 Subject: [PATCH 0634/2328] Fix mod column using wrong equality type --- osu.Game/Overlays/Mods/ModColumn.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 018922c074..9e32602a85 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -296,7 +296,7 @@ namespace osu.Game.Overlays.Mods private void updateActiveState() { foreach (var panel in panelFlow) - panel.Active.Value = SelectedMods.Value.Contains(panel.Mod, EqualityComparer.Default); + panel.Active.Value = SelectedMods.Value.Any(selected => selected.GetType() == panel.Mod.GetType()); } #region Bulk select / deselect From fe59f4ae58ae848af1f6992d9c4b63f9f3d3a0e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 17 Apr 2022 20:32:45 +0200 Subject: [PATCH 0635/2328] Fix multiselection operation not flushing on close --- osu.Game/Overlays/Mods/ModColumn.cs | 9 +++++++++ osu.Game/Overlays/Mods/ModSelectScreen.cs | 10 ++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 9e32602a85..c839305746 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -364,6 +364,15 @@ namespace osu.Game.Overlays.Mods pendingSelectionOperations.Enqueue(() => button.Active.Value = false); } + /// + /// Play out all remaining animations immediately to leave mods in a good (final) state. + /// + public void FlushAnimation() + { + while (pendingSelectionOperations.TryDequeue(out var dequeuedAction)) + dequeuedAction(); + } + private class ToggleAllCheckbox : OsuCheckbox { private Color4 accentColour; diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index ffd6e9a52c..20c5b5a321 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -313,10 +313,12 @@ namespace osu.Game.Overlays.Mods { const float distance = 700; - columnFlow[i].Column - .TopLevelContent - .MoveToY(i % 2 == 0 ? -distance : distance, fade_out_duration, Easing.OutQuint) - .FadeOut(fade_out_duration, Easing.OutQuint); + var column = columnFlow[i].Column; + + column.FlushAnimation(); + column.TopLevelContent + .MoveToY(i % 2 == 0 ? -distance : distance, fade_out_duration, Easing.OutQuint) + .FadeOut(fade_out_duration, Easing.OutQuint); } } From 7c04bf5c53442b3fe2d0adf05928c674a378923c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 17 Apr 2022 22:12:06 +0200 Subject: [PATCH 0636/2328] Refactor mod reference management to meet test expectations --- osu.Game/Overlays/Mods/ModColumn.cs | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index c839305746..c2273abf53 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Collections.Generic; using System.Linq; @@ -10,6 +12,7 @@ using Humanizer; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; @@ -25,8 +28,6 @@ using osuTK; using osuTK.Graphics; using osuTK.Input; -#nullable enable - namespace osu.Game.Overlays.Mods { public class ModColumn : CompositeDrawable @@ -256,7 +257,9 @@ namespace osu.Game.Overlays.Mods private void updateMods() { - var newMods = ModUtils.FlattenMods(availableMods.Value.GetValueOrDefault(ModType) ?? Array.Empty()).ToList(); + var newMods = ModUtils.FlattenMods(availableMods.Value.GetValueOrDefault(ModType) ?? Array.Empty()) + .Select(m => m.DeepClone()) + .ToList(); if (newMods.SequenceEqual(panelFlow.Children.Select(p => p.Mod))) return; @@ -280,9 +283,16 @@ namespace osu.Game.Overlays.Mods panel.Active.BindValueChanged(_ => { updateToggleAllState(); - SelectedMods.Value = panel.Active.Value - ? SelectedMods.Value.Append(panel.Mod).ToArray() - : SelectedMods.Value.Except(new[] { panel.Mod }).ToArray(); + + var newSelectedMods = SelectedMods.Value; + + var matchingModInstance = SelectedMods.Value.SingleOrDefault(selected => selected.GetType() == panel.Mod.GetType()); + if (matchingModInstance != null && (matchingModInstance != panel.Mod || !panel.Active.Value)) + newSelectedMods = newSelectedMods.Except(matchingModInstance.Yield()).ToArray(); + if (panel.Active.Value) + newSelectedMods = newSelectedMods.Append(panel.Mod).ToArray(); + + SelectedMods.Value = newSelectedMods.ToArray(); }); } }, (cancellationTokenSource = new CancellationTokenSource()).Token); @@ -296,7 +306,12 @@ namespace osu.Game.Overlays.Mods private void updateActiveState() { foreach (var panel in panelFlow) - panel.Active.Value = SelectedMods.Value.Any(selected => selected.GetType() == panel.Mod.GetType()); + { + var matchingSelectedMod = SelectedMods.Value.SingleOrDefault(selected => selected.GetType() == panel.Mod.GetType()); + panel.Active.Value = matchingSelectedMod != null; + if (matchingSelectedMod != null) + panel.Mod.CopyFrom(matchingSelectedMod); + } } #region Bulk select / deselect From f91ee4b0422bd8b91585b4f0f9a689719a8b0f06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 17 Apr 2022 22:14:28 +0200 Subject: [PATCH 0637/2328] Reset panel mod instance settings to defaults on deselect --- osu.Game/Overlays/Mods/ModColumn.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index c2273abf53..d480382fcb 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -309,8 +309,10 @@ namespace osu.Game.Overlays.Mods { var matchingSelectedMod = SelectedMods.Value.SingleOrDefault(selected => selected.GetType() == panel.Mod.GetType()); panel.Active.Value = matchingSelectedMod != null; - if (matchingSelectedMod != null) + if (panel.Active.Value) panel.Mod.CopyFrom(matchingSelectedMod); + else + panel.Mod.ResetSettingsToDefaults(); } } From e3641213e1832c627def0b48aae6213f455e4b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 17 Apr 2022 22:16:59 +0200 Subject: [PATCH 0638/2328] Always hide unimplemented mods on mod select screen --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 +- osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 20c5b5a321..2f6eae0afb 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -203,7 +203,7 @@ namespace osu.Game.Overlays.Mods private void updateAvailableMods() { foreach (var column in columnFlow.Columns) - column.Filter = isValidMod; + column.Filter = m => m.HasImplementation && isValidMod.Invoke(m); } private void updateCustomisation(ValueChangedEvent> valueChangedEvent) diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs index c85a4fc38b..5a7a60b479 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.OnlinePlay public new Func IsValidMod { get => base.IsValidMod; - set => base.IsValidMod = m => m.HasImplementation && m.UserPlayable && value.Invoke(m); + set => base.IsValidMod = m => m.UserPlayable && value.Invoke(m); } public FreeModSelectScreen() From 970361676b374995f5c768805e9d9097e23ec855 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 2 May 2022 23:05:35 +0200 Subject: [PATCH 0639/2328] Fix setting items not creating if mods initially not empty --- .../Visual/UserInterface/TestSceneModSelectScreen.cs | 2 ++ osu.Game/Overlays/Mods/ModSettingsArea.cs | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index bd63023efb..7690029ba2 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -68,6 +68,7 @@ namespace osu.Game.Tests.Visual.UserInterface return Precision.AlmostEquals(multiplier, modSelectScreen.ChildrenOfType().Single().Current.Value); }); assertCustomisationToggleState(disabled: false, active: false); + AddAssert("setting items created", () => modSelectScreen.ChildrenOfType().Any()); } [Test] @@ -82,6 +83,7 @@ namespace osu.Game.Tests.Visual.UserInterface return Precision.AlmostEquals(multiplier, modSelectScreen.ChildrenOfType().Single().Current.Value); }); assertCustomisationToggleState(disabled: false, active: false); + AddAssert("setting items created", () => modSelectScreen.ChildrenOfType().Any()); } [Test] diff --git a/osu.Game/Overlays/Mods/ModSettingsArea.cs b/osu.Game/Overlays/Mods/ModSettingsArea.cs index be72c1e3e3..9c5f3b7f11 100644 --- a/osu.Game/Overlays/Mods/ModSettingsArea.cs +++ b/osu.Game/Overlays/Mods/ModSettingsArea.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; @@ -21,7 +22,7 @@ namespace osu.Game.Overlays.Mods { public class ModSettingsArea : CompositeDrawable { - public Bindable> SelectedMods { get; } = new Bindable>(); + public Bindable> SelectedMods { get; } = new Bindable>(Array.Empty()); public const float HEIGHT = 250; @@ -77,7 +78,7 @@ namespace osu.Game.Overlays.Mods protected override void LoadComplete() { base.LoadComplete(); - SelectedMods.BindValueChanged(_ => updateMods()); + SelectedMods.BindValueChanged(_ => updateMods(), true); } private void updateMods() From 216dfb7e9121b5e0f8b662d3f9039aeb7860fbcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 2 May 2022 23:29:30 +0200 Subject: [PATCH 0640/2328] Expand incompatibility test to cover logic more thoroughly --- .../Visual/UserInterface/TestSceneModSelectScreen.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index 7690029ba2..0bd138275b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -104,17 +104,25 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("activate DT", () => getPanelForMod(typeof(OsuModDoubleTime)).TriggerClick()); AddAssert("DT active", () => SelectedMods.Value.Single().GetType() == typeof(OsuModDoubleTime)); + AddAssert("DT panel active", () => getPanelForMod(typeof(OsuModDoubleTime)).Active.Value); AddStep("activate NC", () => getPanelForMod(typeof(OsuModNightcore)).TriggerClick()); AddAssert("only NC active", () => SelectedMods.Value.Single().GetType() == typeof(OsuModNightcore)); + AddAssert("DT panel not active", () => !getPanelForMod(typeof(OsuModDoubleTime)).Active.Value); + AddAssert("NC panel active", () => getPanelForMod(typeof(OsuModNightcore)).Active.Value); AddStep("activate HR", () => getPanelForMod(typeof(OsuModHardRock)).TriggerClick()); AddAssert("NC+HR active", () => SelectedMods.Value.Any(mod => mod.GetType() == typeof(OsuModNightcore)) && SelectedMods.Value.Any(mod => mod.GetType() == typeof(OsuModHardRock))); + AddAssert("NC panel active", () => getPanelForMod(typeof(OsuModNightcore)).Active.Value); + AddAssert("HR panel active", () => getPanelForMod(typeof(OsuModHardRock)).Active.Value); AddStep("activate MR", () => getPanelForMod(typeof(OsuModMirror)).TriggerClick()); AddAssert("NC+MR active", () => SelectedMods.Value.Any(mod => mod.GetType() == typeof(OsuModNightcore)) && SelectedMods.Value.Any(mod => mod.GetType() == typeof(OsuModMirror))); + AddAssert("NC panel active", () => getPanelForMod(typeof(OsuModNightcore)).Active.Value); + AddAssert("HR panel not active", () => !getPanelForMod(typeof(OsuModHardRock)).Active.Value); + AddAssert("MR panel active", () => getPanelForMod(typeof(OsuModMirror)).Active.Value); } [Test] From f5fa41356e33a528039742f9909d45dff71e451e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 3 May 2022 21:44:44 +0200 Subject: [PATCH 0641/2328] Rewrite mod instance management again to pass tests --- .../UserInterface/TestSceneModSelectScreen.cs | 4 +- osu.Game/Overlays/Mods/ModColumn.cs | 129 ++++++++++++------ osu.Game/Overlays/Mods/ModSelectScreen.cs | 33 ++--- osu.Game/Overlays/Mods/UserModSelectScreen.cs | 7 +- 4 files changed, 111 insertions(+), 62 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index 0bd138275b..bdb423a43c 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -336,8 +336,8 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("mod instance doesn't match", () => external != overlayButtonMod); AddAssert("one mod present in global selected", () => SelectedMods.Value.Count == 1); - AddAssert("globally selected matches button's mod instance", () => SelectedMods.Value.Contains(overlayButtonMod)); - AddAssert("globally selected doesn't contain original external change", () => !SelectedMods.Value.Contains(external)); + AddAssert("globally selected matches button's mod instance", () => SelectedMods.Value.Any(mod => ReferenceEquals(mod, overlayButtonMod))); + AddAssert("globally selected doesn't contain original external change", () => !SelectedMods.Value.Any(mod => ReferenceEquals(mod, external))); } [Test] diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index d480382fcb..f9332dd28b 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -53,9 +53,22 @@ namespace osu.Game.Overlays.Mods } } - public Bindable> SelectedMods = new Bindable>(Array.Empty()); public Bindable Active = new BindableBool(true); + /// + /// List of mods marked as selected in this column. + /// + /// + /// Note that the mod instances returned by this property are owned solely by this column + /// (as in, they are locally-managed clones, to ensure proper isolation from any other external instances). + /// + public IReadOnlyList SelectedMods { get; private set; } = Array.Empty(); + + /// + /// Invoked when a mod panel has been selected interactively by the user. + /// + public event Action? SelectionChangedByUser; + protected override bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) => base.ReceivePositionalInputAtSubTree(screenSpacePos) && Active.Value; protected virtual ModPanel CreateModPanel(Mod mod) => new ModPanel(mod); @@ -64,6 +77,15 @@ namespace osu.Game.Overlays.Mods private readonly Bindable>> availableMods = new Bindable>>(); + /// + /// All mods that are available for the current ruleset in this particular column. + /// + /// + /// Note that the mod instances in this list are owned solely by this column + /// (as in, they are locally-managed clones, to ensure proper isolation from any other external instances). + /// + private IReadOnlyList localAvailableMods = Array.Empty(); + private readonly TextFlowContainer headerText; private readonly Box headerBackground; private readonly Container contentContainer; @@ -227,6 +249,9 @@ namespace osu.Game.Overlays.Mods private void load(OsuGameBase game, OverlayColourProvider colourProvider, OsuColour colours) { availableMods.BindTo(game.AvailableMods); + // this `BindValueChanged` callback is intentionally here, to ensure that local available mods are constructed as early as possible. + // this is needed to make sure no external changes to mods are dropped while mod panels are asynchronously loading. + availableMods.BindValueChanged(_ => updateLocalAvailableMods(), true); headerBackground.Colour = accentColour = colours.ForModType(ModType); @@ -240,33 +265,26 @@ namespace osu.Game.Overlays.Mods contentBackground.Colour = colourProvider.Background4; } - protected override void LoadComplete() - { - base.LoadComplete(); - availableMods.BindValueChanged(_ => Scheduler.AddOnce(updateMods)); - SelectedMods.BindValueChanged(_ => - { - // if a load is in progress, don't try to update the selection - the load flow will do so. - if (latestLoadTask == null) - updateActiveState(); - }); - updateMods(); - } - - private CancellationTokenSource? cancellationTokenSource; - - private void updateMods() + private void updateLocalAvailableMods() { var newMods = ModUtils.FlattenMods(availableMods.Value.GetValueOrDefault(ModType) ?? Array.Empty()) .Select(m => m.DeepClone()) .ToList(); - if (newMods.SequenceEqual(panelFlow.Children.Select(p => p.Mod))) + if (newMods.SequenceEqual(localAvailableMods)) return; + localAvailableMods = newMods; + Scheduler.AddOnce(loadPanels); + } + + private CancellationTokenSource? cancellationTokenSource; + + private void loadPanels() + { cancellationTokenSource?.Cancel(); - var panels = newMods.Select(mod => CreateModPanel(mod).With(panel => panel.Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0))); + var panels = localAvailableMods.Select(mod => CreateModPanel(mod).With(panel => panel.Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0))); Task? loadTask; @@ -280,20 +298,7 @@ namespace osu.Game.Overlays.Mods foreach (var panel in panelFlow) { - panel.Active.BindValueChanged(_ => - { - updateToggleAllState(); - - var newSelectedMods = SelectedMods.Value; - - var matchingModInstance = SelectedMods.Value.SingleOrDefault(selected => selected.GetType() == panel.Mod.GetType()); - if (matchingModInstance != null && (matchingModInstance != panel.Mod || !panel.Active.Value)) - newSelectedMods = newSelectedMods.Except(matchingModInstance.Yield()).ToArray(); - if (panel.Active.Value) - newSelectedMods = newSelectedMods.Append(panel.Mod).ToArray(); - - SelectedMods.Value = newSelectedMods.ToArray(); - }); + panel.Active.BindValueChanged(_ => panelStateChanged(panel)); } }, (cancellationTokenSource = new CancellationTokenSource()).Token); loadTask.ContinueWith(_ => @@ -306,14 +311,62 @@ namespace osu.Game.Overlays.Mods private void updateActiveState() { foreach (var panel in panelFlow) + panel.Active.Value = SelectedMods.Contains(panel.Mod); + } + + /// + /// This flag helps to determine the source of changes to . + /// If the value is false, then are changing due to a user selection on the UI. + /// If the value is true, then are changing due to an external call. + /// + private bool externalSelectionUpdateInProgress; + + private void panelStateChanged(ModPanel panel) + { + updateToggleAllState(); + + var newSelectedMods = panel.Active.Value + ? SelectedMods.Append(panel.Mod) + : SelectedMods.Except(panel.Mod.Yield()); + + SelectedMods = newSelectedMods.ToArray(); + if (!externalSelectionUpdateInProgress) + SelectionChangedByUser?.Invoke(); + } + + /// + /// Adjusts the set of selected mods in this column to match the passed in . + /// + /// + /// This method exists to be able to receive mod instances that come from potentially-external sources and to copy the changes across to this column's state. + /// uses this to substitute any external mod references in + /// to references that are owned by this column. + /// + internal void SetSelection(IReadOnlyList mods) + { + externalSelectionUpdateInProgress = true; + + var newSelection = new List(); + + foreach (var mod in localAvailableMods) { - var matchingSelectedMod = SelectedMods.Value.SingleOrDefault(selected => selected.GetType() == panel.Mod.GetType()); - panel.Active.Value = matchingSelectedMod != null; - if (panel.Active.Value) - panel.Mod.CopyFrom(matchingSelectedMod); + var matchingSelectedMod = mods.SingleOrDefault(selected => selected.GetType() == mod.GetType()); + + if (matchingSelectedMod != null) + { + mod.CopyFrom(matchingSelectedMod); + newSelection.Add(mod); + } else - panel.Mod.ResetSettingsToDefaults(); + { + mod.ResetSettingsToDefaults(); + } } + + SelectedMods = newSelection; + updateActiveState(); + + externalSelectionUpdateInProgress = false; } #region Bulk select / deselect diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 2f6eae0afb..bb12143d7c 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -179,7 +179,7 @@ namespace osu.Game.Overlays.Mods foreach (var column in columnFlow.Columns) { - column.SelectedMods.BindValueChanged(updateBindableFromSelection); + column.SelectionChangedByUser += updateBindableFromSelection; } customisationVisible.BindValueChanged(_ => updateCustomisationVisualState(), true); @@ -250,33 +250,26 @@ namespace osu.Game.Overlays.Mods private void updateSelectionFromBindable() { - // note that selectionBindableSyncInProgress is purposefully not checked here. - // this is because in the case of mod selection in solo gameplay, a user selection of a mod can actually lead to deselection of other incompatible mods. - // to synchronise state correctly, updateBindableFromSelection() computes the final mods (including incompatibility rules) and updates SelectedMods, - // and this method then runs unconditionally again to make sure the new visual selection accurately reflects the final set of selected mods. - // selectionBindableSyncInProgress ensures that mutual infinite recursion does not happen after that unconditional call. + // `SelectedMods` may contain mod references that come from external sources. + // to ensure isolation, first pull in the potentially-external change into the mod columns... foreach (var column in columnFlow.Columns) - column.SelectedMods.Value = SelectedMods.Value.Where(mod => mod.Type == column.ModType).ToArray(); + column.SetSelection(SelectedMods.Value); + + // and then, when done, replace the potentially-external mod references in `SelectedMods` with ones we own. + updateBindableFromSelection(); } - private bool selectionBindableSyncInProgress; - - private void updateBindableFromSelection(ValueChangedEvent> modSelectionChange) + private void updateBindableFromSelection() { - if (selectionBindableSyncInProgress) + var candidateSelection = columnFlow.Columns.SelectMany(column => column.SelectedMods).ToArray(); + + if (candidateSelection.SequenceEqual(SelectedMods.Value)) return; - selectionBindableSyncInProgress = true; - - SelectedMods.Value = ComputeNewModsFromSelection( - modSelectionChange.NewValue.Except(modSelectionChange.OldValue), - modSelectionChange.OldValue.Except(modSelectionChange.NewValue)); - - selectionBindableSyncInProgress = false; + SelectedMods.Value = ComputeNewModsFromSelection(SelectedMods.Value, candidateSelection); } - protected virtual IReadOnlyList ComputeNewModsFromSelection(IEnumerable addedMods, IEnumerable removedMods) - => columnFlow.Columns.SelectMany(column => column.SelectedMods.Value).ToArray(); + protected virtual IReadOnlyList ComputeNewModsFromSelection(IReadOnlyList oldSelection, IReadOnlyList newSelection) => newSelection; protected override void PopIn() { diff --git a/osu.Game/Overlays/Mods/UserModSelectScreen.cs b/osu.Game/Overlays/Mods/UserModSelectScreen.cs index ed0a07521b..ca33d35605 100644 --- a/osu.Game/Overlays/Mods/UserModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/UserModSelectScreen.cs @@ -14,9 +14,12 @@ namespace osu.Game.Overlays.Mods { protected override ModColumn CreateModColumn(ModType modType, Key[] toggleKeys = null) => new UserModColumn(modType, false, toggleKeys); - protected override IReadOnlyList ComputeNewModsFromSelection(IEnumerable addedMods, IEnumerable removedMods) + protected override IReadOnlyList ComputeNewModsFromSelection(IReadOnlyList oldSelection, IReadOnlyList newSelection) { - IEnumerable modsAfterRemoval = SelectedMods.Value.Except(removedMods).ToList(); + var addedMods = newSelection.Except(oldSelection); + var removedMods = oldSelection.Except(newSelection); + + IEnumerable modsAfterRemoval = newSelection.Except(removedMods).ToList(); // the preference is that all new mods should override potential incompatible old mods. // in general that's a bit difficult to compute if more than one mod is added at a time, From 50aee8b665bcb9285fd6c8b099135f9aa56b32f4 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Tue, 3 May 2022 22:32:01 +0100 Subject: [PATCH 0642/2328] Ensure `ChannelListSelector` text also turns white when selected --- .../Overlays/Chat/ChannelList/ChannelListSelector.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs index f9dab74eb1..9cba93ffa5 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs @@ -21,6 +21,10 @@ namespace osu.Game.Overlays.Chat.ChannelList private Box hoverBox = null!; private Box selectBox = null!; + private OsuSpriteText text = null!; + + [Resolved] + private OverlayColourProvider colourProvider { get; set; } = null!; [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) @@ -46,7 +50,7 @@ namespace osu.Game.Overlays.Chat.ChannelList { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = 18, Right = 10 }, - Child = new OsuSpriteText + Child = text = new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, @@ -68,9 +72,15 @@ namespace osu.Game.Overlays.Chat.ChannelList SelectorActive.BindValueChanged(selector => { if (selector.NewValue) + { + text.FadeColour(colourProvider.Content1, 300, Easing.OutQuint); selectBox.FadeIn(300, Easing.OutQuint); + } else + { + text.FadeColour(colourProvider.Light3, 200, Easing.OutQuint); selectBox.FadeOut(200, Easing.OutQuint); + } }, true); Action = () => SelectorActive.Value = true; From c17edb2848e32dd803e88b6b95efe4c46d74ab2a Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Tue, 3 May 2022 22:32:51 +0100 Subject: [PATCH 0643/2328] Add padding to text in `ChatTextBar` to separate it from the textbox --- osu.Game/Overlays/Chat/ChatTextBar.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Chat/ChatTextBar.cs b/osu.Game/Overlays/Chat/ChatTextBar.cs index 316511d9a6..3de7b67b0f 100644 --- a/osu.Game/Overlays/Chat/ChatTextBar.cs +++ b/osu.Game/Overlays/Chat/ChatTextBar.cs @@ -68,6 +68,7 @@ namespace osu.Game.Overlays.Chat RelativeSizeAxes = Axes.Y, Width = chatting_text_width, Masking = true, + Padding = new MarginPadding { Right = 5 }, Child = chattingText = new OsuSpriteText { Font = OsuFont.Torus.With(size: 20), From 60999e83e03647f71460c65ba57aa3d038d994ae Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Tue, 3 May 2022 22:33:36 +0100 Subject: [PATCH 0644/2328] Ensure `ChatTextBox` takes/leaves focus on chat overlay pop in/out --- osu.Game/Overlays/Chat/ChatTextBar.cs | 4 ++++ osu.Game/Overlays/ChatOverlayV2.cs | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTextBar.cs b/osu.Game/Overlays/Chat/ChatTextBar.cs index 3de7b67b0f..0fa3613d38 100644 --- a/osu.Game/Overlays/Chat/ChatTextBar.cs +++ b/osu.Game/Overlays/Chat/ChatTextBar.cs @@ -26,6 +26,10 @@ namespace osu.Game.Overlays.Chat public event Action? OnSearchTermsChanged; + public void TextBoxTakeFocus() => chatTextBox.TakeFocus(); + + public void TextBoxKillFocus() => chatTextBox.KillFocus(); + [Resolved] private Bindable currentChannel { get; set; } = null!; diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index d0b49d9ef3..f6190bbe20 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -214,16 +214,22 @@ namespace osu.Game.Overlays protected override void PopIn() { + base.PopIn(); + this.MoveToY(0, transition_length, Easing.OutQuint); this.FadeIn(transition_length, Easing.OutQuint); - base.PopIn(); + + textBar.TextBoxTakeFocus(); } protected override void PopOut() { + base.PopOut(); + this.MoveToY(Height, transition_length, Easing.InSine); this.FadeOut(transition_length, Easing.InSine); - base.PopOut(); + + textBar.TextBoxKillFocus(); } private void currentChannelChanged(ValueChangedEvent e) From d52a1a5d2324a5d0041fe7d7e6e548e56f907aa2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 4 May 2022 03:52:10 +0300 Subject: [PATCH 0645/2328] Add key binding for beatmap selection in song select --- .../Input/Bindings/GlobalActionContainer.cs | 10 +++++++- .../GlobalActionKeyBindingStrings.cs | 10 ++++++++ osu.Game/Screens/Select/BeatmapCarousel.cs | 24 ++++--------------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index 47cb7be2cf..ec368a6fda 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -100,10 +100,12 @@ namespace osu.Game.Input.Bindings public IEnumerable SongSelectKeyBindings => new[] { + new KeyBinding(InputKey.Left, GlobalAction.SelectPreviousBeatmap), + new KeyBinding(InputKey.Right, GlobalAction.SelectNextBeatmap), new KeyBinding(InputKey.F1, GlobalAction.ToggleModSelection), new KeyBinding(InputKey.F2, GlobalAction.SelectNextRandom), new KeyBinding(new[] { InputKey.Shift, InputKey.F2 }, GlobalAction.SelectPreviousRandom), - new KeyBinding(InputKey.F3, GlobalAction.ToggleBeatmapOptions) + new KeyBinding(InputKey.F3, GlobalAction.ToggleBeatmapOptions), }; public IEnumerable AudioControlKeyBindings => new[] @@ -301,5 +303,11 @@ namespace osu.Game.Input.Bindings [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorFlipVertically))] EditorFlipVertically, + + [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.SelectPreviousBeatmap))] + SelectPreviousBeatmap, + + [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.SelectNextBeatmap))] + SelectNextBeatmap, } } diff --git a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs index 777e97d1e3..08e13e24ae 100644 --- a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs +++ b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs @@ -194,6 +194,16 @@ namespace osu.Game.Localisation /// public static LocalisableString ToggleInGameInterface => new TranslatableString(getKey(@"toggle_in_game_interface"), @"Toggle in-game interface"); + /// + /// "Previous beatmap selection" + /// + public static LocalisableString SelectPreviousBeatmap => new TranslatableString(getKey(@"select_previous_beatmap"), @"Previous beatmap selection"); + + /// + /// "Next beatmap selection" + /// + public static LocalisableString SelectNextBeatmap => new TranslatableString(getKey(@"select_next_beatmap"), @"Next beatmap selection"); + /// /// "Toggle Mod Select" /// diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index c3d340ac61..85b5af049e 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -604,34 +604,20 @@ namespace osu.Game.Screens.Select public void ScrollToSelected(bool immediate = false) => pendingScrollOperation = immediate ? PendingScrollOperation.Immediate : PendingScrollOperation.Standard; - #region Key / button selection logic - - protected override bool OnKeyDown(KeyDownEvent e) - { - switch (e.Key) - { - case Key.Left: - SelectNext(-1); - return true; - - case Key.Right: - SelectNext(); - return true; - } - - return false; - } + #region Button selection logic public bool OnPressed(KeyBindingPressEvent e) { switch (e.Action) { case GlobalAction.SelectNext: - SelectNext(1, false); + case GlobalAction.SelectNextBeatmap: + SelectNext(1, e.Action == GlobalAction.SelectNextBeatmap); return true; case GlobalAction.SelectPrevious: - SelectNext(-1, false); + case GlobalAction.SelectPreviousBeatmap: + SelectNext(-1, e.Action == GlobalAction.SelectPreviousBeatmap); return true; } From bb086800b1e528205cfcd635c093798bc87e2a0c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 May 2022 13:41:30 +0900 Subject: [PATCH 0646/2328] Remove ugly playfield border --- osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index bd26a99e51..ba7c6e9d33 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -59,11 +59,6 @@ namespace osu.Game.Rulesets.Osu.Edit { LayerBelowRuleset.AddRange(new Drawable[] { - new PlayfieldBorder - { - RelativeSizeAxes = Axes.Both, - PlayfieldBorderStyle = { Value = PlayfieldBorderStyle.Corners } - }, distanceSnapGridContainer = new Container { RelativeSizeAxes = Axes.Both From 0bb90c7b07169096984972b9741b6f9a9dbebb2d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 May 2022 13:41:55 +0900 Subject: [PATCH 0647/2328] Fix gridline centering and ensure lines are always rendered using a fixed screen-space width --- .../Components/RectangularPositionSnapGrid.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/RectangularPositionSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/RectangularPositionSnapGrid.cs index 95b4b2fe53..4c0b4f8beb 100644 --- a/osu.Game/Screens/Edit/Compose/Components/RectangularPositionSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/RectangularPositionSnapGrid.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Layout; +using osu.Framework.Utils; using osuTK; namespace osu.Game.Screens.Edit.Compose.Components @@ -72,25 +73,29 @@ namespace osu.Game.Screens.Edit.Compose.Components int index = 0; float currentPosition = startPosition; - while ((endPosition - currentPosition) * Math.Sign(step) > 0) + // Make lines the same width independent of display resolution. + float lineWidth = DrawWidth / ScreenSpaceDrawQuad.Width; + + while (Precision.AlmostBigger((endPosition - currentPosition) * Math.Sign(step), 0)) { var gridLine = new Box { Colour = Colour4.White, Alpha = index == 0 ? 0.3f : 0.1f, - EdgeSmoothness = new Vector2(0.2f) }; if (direction == Direction.Horizontal) { + gridLine.Origin = Anchor.CentreLeft; gridLine.RelativeSizeAxes = Axes.X; - gridLine.Height = 1; + gridLine.Height = lineWidth; gridLine.Y = currentPosition; } else { + gridLine.Origin = Anchor.TopCentre; gridLine.RelativeSizeAxes = Axes.Y; - gridLine.Width = 1; + gridLine.Width = lineWidth; gridLine.X = currentPosition; } From df530cb5ab2d2c598fcf8f02d20475d20abde36a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 May 2022 13:49:02 +0900 Subject: [PATCH 0648/2328] Add highlighting to the position snap grid edges in addition to centre lines --- .../Components/RectangularPositionSnapGrid.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/RectangularPositionSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/RectangularPositionSnapGrid.cs index 4c0b4f8beb..f0d26c7b6a 100644 --- a/osu.Game/Screens/Edit/Compose/Components/RectangularPositionSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/RectangularPositionSnapGrid.cs @@ -2,6 +2,8 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; +using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -76,12 +78,14 @@ namespace osu.Game.Screens.Edit.Compose.Components // Make lines the same width independent of display resolution. float lineWidth = DrawWidth / ScreenSpaceDrawQuad.Width; + List generatedLines = new List(); + while (Precision.AlmostBigger((endPosition - currentPosition) * Math.Sign(step), 0)) { var gridLine = new Box { Colour = Colour4.White, - Alpha = index == 0 ? 0.3f : 0.1f, + Alpha = 0.1f, }; if (direction == Direction.Horizontal) @@ -99,11 +103,19 @@ namespace osu.Game.Screens.Edit.Compose.Components gridLine.X = currentPosition; } - AddInternal(gridLine); + generatedLines.Add(gridLine); index += 1; currentPosition = startPosition + index * step; } + + if (generatedLines.Count == 0) + return; + + generatedLines.First().Alpha = 0.3f; + generatedLines.Last().Alpha = 0.3f; + + AddRangeInternal(generatedLines); } public Vector2 GetSnappedPosition(Vector2 original) From 8e96af8ff0b7caaaf7e2542856daa6a7ecd001af Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 4 May 2022 13:43:59 +0800 Subject: [PATCH 0649/2328] Update indentation to be clearer --- .../TestSceneManageCollectionsDialog.cs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs b/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs index d5983ac827..888002eb36 100644 --- a/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs +++ b/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs @@ -141,15 +141,13 @@ namespace osu.Game.Tests.Visual.Collections { AddStep("add dropdown", () => { - Add( - new CollectionFilterDropdown - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - RelativeSizeAxes = Axes.X, - Width = 0.4f, - } - ); + Add(new CollectionFilterDropdown + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + RelativeSizeAxes = Axes.X, + Width = 0.4f, + }); }); AddStep("add two collections with same name", () => manager.Collections.AddRange(new[] { From 35eeeba4c60b9240296e077ae5968d40100877ee Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 4 May 2022 13:57:53 +0800 Subject: [PATCH 0650/2328] Disable code style analysis on Xamarin projects --- osu.Android.props | 3 ++- osu.iOS.props | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index b6260fd1d4..299f236220 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -1,4 +1,4 @@ - + 8.0 bin\$(Configuration) @@ -19,6 +19,7 @@ cjk,mideast,other,rare,west SdkOnly prompt + false True diff --git a/osu.iOS.props b/osu.iOS.props index e472b5f1a8..d16c6803f4 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -1,4 +1,4 @@ - + 8.0 {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} @@ -11,6 +11,7 @@ iPhone Developer true + false From 813d6fed487d06959f18f19e982639e08a95d9dc Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 4 May 2022 09:00:54 +0300 Subject: [PATCH 0651/2328] Split activation keybind to separate increase/decrease keybinds --- .../Input/Bindings/GlobalActionContainer.cs | 10 +++-- .../GlobalActionKeyBindingStrings.cs | 9 ++++- .../Edit/DistancedHitObjectComposer.cs | 40 +++++++++++-------- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index 5656c79975..3e7051cbf5 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -79,7 +79,8 @@ namespace osu.Game.Input.Bindings new KeyBinding(new[] { InputKey.F5 }, GlobalAction.EditorTestGameplay), new KeyBinding(new[] { InputKey.Control, InputKey.H }, GlobalAction.EditorFlipHorizontally), new KeyBinding(new[] { InputKey.Control, InputKey.J }, GlobalAction.EditorFlipVertically), - new KeyBinding(new[] { InputKey.Control, InputKey.Alt }, GlobalAction.EditorDistanceSpacing), + new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.MouseWheelDown }, GlobalAction.EditorDecreaseDistanceSpacing), + new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.MouseWheelUp }, GlobalAction.EditorIncreaseDistanceSpacing), }; public IEnumerable InGameKeyBindings => new[] @@ -303,7 +304,10 @@ namespace osu.Game.Input.Bindings [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorFlipVertically))] EditorFlipVertically, - [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorDistanceSpacing))] - EditorDistanceSpacing, + [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorIncreaseDistanceSpacing))] + EditorIncreaseDistanceSpacing, + + [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorDecreaseDistanceSpacing))] + EditorDecreaseDistanceSpacing, } } diff --git a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs index 73cc7546ab..5086e7f4c7 100644 --- a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs +++ b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs @@ -240,9 +240,14 @@ namespace osu.Game.Localisation public static LocalisableString EditorFlipVertically => new TranslatableString(getKey(@"editor_flip_vertically"), @"Flip selection vertically"); /// - /// "Distance grid spacing (hold)" + /// "Increase distance grid spacing" /// - public static LocalisableString EditorDistanceSpacing => new TranslatableString(getKey(@"editor_distance_spacing"), @"Distance grid spacing (hold)"); + public static LocalisableString EditorIncreaseDistanceSpacing => new TranslatableString(getKey(@"editor_increase_distance_spacing"), @"Increase distance grid spacing"); + + /// + /// "Decrease distance grid spacing" + /// + public static LocalisableString EditorDecreaseDistanceSpacing => new TranslatableString(getKey(@"editor_decrease_distance_spacing"), @"Decrease distance grid spacing"); /// /// "Toggle skin editor" diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index 1a4ea845d0..e6bc36622f 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Edit /// /// The base type of supported objects. [Cached(typeof(IDistanceSnapProvider))] - public abstract class DistancedHitObjectComposer : HitObjectComposer, IDistanceSnapProvider, IKeyBindingHandler + public abstract class DistancedHitObjectComposer : HitObjectComposer, IDistanceSnapProvider, IScrollBindingHandler where TObject : HitObject { protected Bindable DistanceSpacingMultiplier { get; } = new BindableDouble(1.0) @@ -35,7 +35,6 @@ namespace osu.Game.Rulesets.Edit protected ExpandingToolboxContainer RightSideToolboxContainer { get; private set; } private ExpandableSlider> distanceSpacingSlider; - private bool distanceSpacingScrollActive; protected DistancedHitObjectComposer(Ruleset ruleset) : base(ruleset) @@ -79,11 +78,11 @@ namespace osu.Game.Rulesets.Edit public bool OnPressed(KeyBindingPressEvent e) { - if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing) + switch (e.Action) { - RightSideToolboxContainer.Expanded.Value = true; - distanceSpacingScrollActive = true; - return true; + case GlobalAction.EditorIncreaseDistanceSpacing: + case GlobalAction.EditorDecreaseDistanceSpacing: + return adjustDistanceSpacing(e.Action, 0.1f); } return false; @@ -91,22 +90,31 @@ namespace osu.Game.Rulesets.Edit public void OnReleased(KeyBindingReleaseEvent e) { - if (!DistanceSpacingMultiplier.Disabled && e.Action == GlobalAction.EditorDistanceSpacing) - { - RightSideToolboxContainer.Expanded.Value = false; - distanceSpacingScrollActive = false; - } } - protected override bool OnScroll(ScrollEvent e) + public bool OnScroll(KeyBindingScrollEvent e) { - if (distanceSpacingScrollActive) + switch (e.Action) { - DistanceSpacingMultiplier.Value += e.ScrollDelta.Y * (e.IsPrecise ? 0.01f : 0.1f); - return true; + case GlobalAction.EditorIncreaseDistanceSpacing: + case GlobalAction.EditorDecreaseDistanceSpacing: + return adjustDistanceSpacing(e.Action, e.IsPrecise ? 0.01f : 0.1f); } - return base.OnScroll(e); + return false; + } + + private bool adjustDistanceSpacing(GlobalAction action, float amount) + { + if (DistanceSpacingMultiplier.Disabled) + return false; + + if (action == GlobalAction.EditorIncreaseDistanceSpacing) + DistanceSpacingMultiplier.Value += amount; + else if (action == GlobalAction.EditorDecreaseDistanceSpacing) + DistanceSpacingMultiplier.Value -= amount; + + return true; } public virtual float GetBeatSnapDistanceAt(HitObject referenceObject) From a17bbd62b7d05491a1ed2d5575819feb0c7fcdc5 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 4 May 2022 14:06:01 +0800 Subject: [PATCH 0652/2328] Disable EnforceCodeStyleInBuild in Xamarin CI run --- .github/workflows/ci.yml | 4 ++-- Directory.Build.props | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2066f27de..b4d7f894d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,7 +128,7 @@ jobs: # cannot accept .sln(f) files as arguments. # Build just the main game for now. - name: Build - run: msbuild osu.Android/osu.Android.csproj /restore /p:Configuration=Debug + run: msbuild osu.Android/osu.Android.csproj /restore /p:Configuration=Debug /p:EnforceCodeStyleInBuild=false build-only-ios: name: Build only (iOS) @@ -147,4 +147,4 @@ jobs: # cannot accept .sln(f) files as arguments. # Build just the main game for now. - name: Build - run: msbuild osu.iOS/osu.iOS.csproj /restore /p:Configuration=Debug \ No newline at end of file + run: msbuild osu.iOS/osu.iOS.csproj /restore /p:Configuration=Debug /p:EnforceCodeStyleInBuild=false diff --git a/Directory.Build.props b/Directory.Build.props index f3ddc68838..65ffe02584 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,4 +1,4 @@ - + 8.0 @@ -20,7 +20,7 @@ - true + true $(MSBuildThisFileDirectory)CodeAnalysis\osu.ruleset From 504ca5be31d011b8909ea05518265529758a63fb Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 4 May 2022 09:51:53 +0300 Subject: [PATCH 0653/2328] Fix scrolling no longer adjusting distance spacing by amount --- osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index e6bc36622f..66a78640c6 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Edit { case GlobalAction.EditorIncreaseDistanceSpacing: case GlobalAction.EditorDecreaseDistanceSpacing: - return adjustDistanceSpacing(e.Action, e.IsPrecise ? 0.01f : 0.1f); + return adjustDistanceSpacing(e.Action, e.ScrollAmount * (e.IsPrecise ? 0.01f : 0.1f)); } return false; From 732739715aee8149791a0f2bc35fa4b5d14ba3c7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 May 2022 16:31:20 +0900 Subject: [PATCH 0654/2328] Remove "grid" from strings --- osu.Game/Localisation/GlobalActionKeyBindingStrings.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs index 5086e7f4c7..58afb284b5 100644 --- a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs +++ b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs @@ -240,14 +240,14 @@ namespace osu.Game.Localisation public static LocalisableString EditorFlipVertically => new TranslatableString(getKey(@"editor_flip_vertically"), @"Flip selection vertically"); /// - /// "Increase distance grid spacing" + /// "Increase distance spacing" /// - public static LocalisableString EditorIncreaseDistanceSpacing => new TranslatableString(getKey(@"editor_increase_distance_spacing"), @"Increase distance grid spacing"); + public static LocalisableString EditorIncreaseDistanceSpacing => new TranslatableString(getKey(@"editor_increase_distance_spacing"), @"Increase distance spacing"); /// - /// "Decrease distance grid spacing" + /// "Decrease distance spacing" /// - public static LocalisableString EditorDecreaseDistanceSpacing => new TranslatableString(getKey(@"editor_decrease_distance_spacing"), @"Decrease distance grid spacing"); + public static LocalisableString EditorDecreaseDistanceSpacing => new TranslatableString(getKey(@"editor_decrease_distance_spacing"), @"Decrease distance spacing"); /// /// "Toggle skin editor" From a66743266f6460dc7c50ad873e2b231a813a8d0b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 May 2022 17:20:58 +0900 Subject: [PATCH 0655/2328] Remove unused `ScrollingToolboxGroup` class --- .../Rulesets/Edit/ScrollingToolboxGroup.cs | 34 ------------------- 1 file changed, 34 deletions(-) delete mode 100644 osu.Game/Rulesets/Edit/ScrollingToolboxGroup.cs diff --git a/osu.Game/Rulesets/Edit/ScrollingToolboxGroup.cs b/osu.Game/Rulesets/Edit/ScrollingToolboxGroup.cs deleted file mode 100644 index 98e026c49a..0000000000 --- a/osu.Game/Rulesets/Edit/ScrollingToolboxGroup.cs +++ /dev/null @@ -1,34 +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.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Graphics.Containers; - -namespace osu.Game.Rulesets.Edit -{ - public class ScrollingToolboxGroup : EditorToolboxGroup - { - protected readonly OsuScrollContainer Scroll; - - protected readonly FillFlowContainer FillFlow; - - protected override Container Content { get; } - - public ScrollingToolboxGroup(string title, float scrollAreaHeight) - : base(title) - { - base.Content.Add(Scroll = new OsuScrollContainer - { - RelativeSizeAxes = Axes.X, - Height = scrollAreaHeight, - Child = Content = FillFlow = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - }, - }); - } - } -} From b325f0ee0b3ebc286f13ba82d95e590707ece455 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 May 2022 17:41:29 +0900 Subject: [PATCH 0656/2328] Combine editor toolbox container implementation and fix input blocking Until now, toolbox scroll areas would block input from arriving behind them, even when no visible element was clicked. In addition, clicking on a button inside a toolbox would still send a `MouseDown` event to things behind it. Specifically, the editor's `HitObjectComposer` would receive these events and also place objects when the user does not expect them to be placed. This fixes another regression that occurred due to `ScrollContainer`s no longer blocking input theirselves. --- .../Edit/DistancedHitObjectComposer.cs | 19 ++--------- .../Edit/ExpandingToolboxContainer.cs | 34 +++++++++++++++++++ osu.Game/Rulesets/Edit/HitObjectComposer.cs | 16 ++------- 3 files changed, 38 insertions(+), 31 deletions(-) create mode 100644 osu.Game/Rulesets/Edit/ExpandingToolboxContainer.cs diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index 66a78640c6..370e8ccbda 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -6,12 +6,10 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; -using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; using osu.Game.Overlays.Settings.Sections; using osu.Game.Rulesets.Objects; -using osuTK; namespace osu.Game.Rulesets.Edit { @@ -44,8 +42,9 @@ namespace osu.Game.Rulesets.Edit [BackgroundDependencyLoader] private void load() { - AddInternal(RightSideToolboxContainer = new ExpandingToolboxContainer + AddInternal(RightSideToolboxContainer = new ExpandingToolboxContainer(130, 250) { + Padding = new MarginPadding { Right = 10 }, Alpha = DistanceSpacingMultiplier.Disabled ? 0 : 1, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, @@ -154,19 +153,5 @@ namespace osu.Game.Rulesets.Edit return DurationToDistance(referenceObject, snappedEndTime - startTime); } - - protected class ExpandingToolboxContainer : ExpandingContainer - { - protected override double HoverExpansionDelay => 250; - - public ExpandingToolboxContainer() - : base(130, 250) - { - RelativeSizeAxes = Axes.Y; - Padding = new MarginPadding { Left = 10 }; - - FillFlow.Spacing = new Vector2(10); - } - } } } diff --git a/osu.Game/Rulesets/Edit/ExpandingToolboxContainer.cs b/osu.Game/Rulesets/Edit/ExpandingToolboxContainer.cs new file mode 100644 index 0000000000..e807dbd482 --- /dev/null +++ b/osu.Game/Rulesets/Edit/ExpandingToolboxContainer.cs @@ -0,0 +1,34 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using osu.Framework.Graphics; +using osu.Framework.Input.Events; +using osu.Game.Graphics.Containers; +using osuTK; + +namespace osu.Game.Rulesets.Edit +{ + public class ExpandingToolboxContainer : ExpandingContainer + { + protected override double HoverExpansionDelay => 250; + + public ExpandingToolboxContainer(float contractedWidth, float expandedWidth) + : base(contractedWidth, expandedWidth) + { + RelativeSizeAxes = Axes.Y; + + FillFlow.Spacing = new Vector2(10); + } + + protected override bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) => base.ReceivePositionalInputAtSubTree(screenSpacePos) && anyToolboxHovered(screenSpacePos); + + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) && anyToolboxHovered(screenSpacePos); + + private bool anyToolboxHovered(Vector2 screenSpacePos) => FillFlow.Children.Any(d => d.ScreenSpaceDrawQuad.Contains(screenSpacePos)); + + protected override bool OnMouseDown(MouseDownEvent e) => true; + + protected override bool OnClick(ClickEvent e) => true; + } +} diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index a235a5bc60..1c388fe68f 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -13,7 +13,6 @@ using osu.Framework.Input; using osu.Framework.Input.Events; using osu.Framework.Logging; using osu.Game.Beatmaps; -using osu.Game.Graphics.Containers; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Mods; @@ -115,8 +114,9 @@ namespace osu.Game.Rulesets.Edit .WithChild(BlueprintContainer = CreateBlueprintContainer()) } }, - new LeftToolboxFlow + new ExpandingToolboxContainer(80, 200) { + Padding = new MarginPadding { Left = 10 }, Children = new Drawable[] { new EditorToolboxGroup("toolbox (1-9)") @@ -382,18 +382,6 @@ namespace osu.Game.Rulesets.Edit } #endregion - - private class LeftToolboxFlow : ExpandingButtonContainer - { - public LeftToolboxFlow() - : base(80, 200) - { - RelativeSizeAxes = Axes.Y; - Padding = new MarginPadding { Right = 10 }; - - FillFlow.Spacing = new Vector2(10); - } - } } /// From 0b8fd2e39f9c4e93d91c43f93da1c08e27244f33 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 4 May 2022 11:41:33 +0300 Subject: [PATCH 0657/2328] Improve distance spacing toast inline with key binding changes --- .../Edit/DistancedHitObjectComposer.cs | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index afd6909874..466b6cba4b 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -3,11 +3,13 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Framework.Localisation; +using osu.Game.Configuration; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; @@ -80,7 +82,7 @@ namespace osu.Game.Rulesets.Edit distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({v.NewValue:0.##x})"; if (v.NewValue != v.OldValue) - onScreenDisplay?.Display(new DistanceSpacingToast(v.NewValue.ToLocalisableString(@"0.##x"))); + onScreenDisplay?.Display(new DistanceSpacingToast(v.NewValue.ToLocalisableString(@"0.##x"), v)); EditorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue; }, true); @@ -182,10 +184,23 @@ namespace osu.Game.Rulesets.Edit private class DistanceSpacingToast : Toast { - public DistanceSpacingToast(LocalisableString value) - : base("Distance Spacing", value, string.Empty) + private readonly ValueChangedEvent change; + + public DistanceSpacingToast(LocalisableString value, ValueChangedEvent change) + : base(getAction(change).GetLocalisableDescription(), value, string.Empty) { + this.change = change; } + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + ShortcutText.Text = config.LookupKeyBindings(getAction(change)); + } + + private static GlobalAction getAction(ValueChangedEvent change) => change.NewValue - change.OldValue > 0 + ? GlobalAction.EditorIncreaseDistanceSpacing + : GlobalAction.EditorDecreaseDistanceSpacing; } } } From f899c3e68fa5ad4eb53196de2dd509fd3d9d46b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 May 2022 17:56:38 +0900 Subject: [PATCH 0658/2328] Add test coverage of circle placement around editor toolboxes --- .../Editing/TestSceneHitObjectComposer.cs | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs index ae1b691767..231a1f408f 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs @@ -19,6 +19,7 @@ using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Components.RadioButtons; +using osu.Game.Screens.Edit.Components.TernaryButtons; using osu.Game.Screens.Edit.Compose.Components; using osuTK; using osuTK.Input; @@ -87,6 +88,65 @@ namespace osu.Game.Tests.Visual.Editing AddAssert("Tool changed", () => hitObjectComposer.ChildrenOfType().First().CurrentTool is HitCircleCompositionTool); } + [Test] + public void TestPlacementFailsWhenClickingButton() + { + AddStep("clear all control points and hitobjects", () => + { + editorBeatmap.ControlPointInfo.Clear(); + editorBeatmap.Clear(); + }); + + AddStep("Add timing point", () => editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint())); + + AddStep("Change to hitcircle", () => hitObjectComposer.ChildrenOfType().First(d => d.Button.Label == "HitCircle").TriggerClick()); + + AddStep("move mouse to overlapping toggle button", () => + { + var playfield = hitObjectComposer.Playfield.ScreenSpaceDrawQuad; + var button = hitObjectComposer + .ChildrenOfType().First() + .ChildrenOfType().First(b => playfield.Contains(b.ScreenSpaceDrawQuad.Centre)); + + InputManager.MoveMouseTo(button); + }); + + AddAssert("no circles placed", () => editorBeatmap.HitObjects.Count == 0); + + AddStep("attempt place circle", () => InputManager.Click(MouseButton.Left)); + + AddAssert("no circles placed", () => editorBeatmap.HitObjects.Count == 0); + } + + [Test] + public void TestPlacementWithinToolboxScrollArea() + { + AddStep("clear all control points and hitobjects", () => + { + editorBeatmap.ControlPointInfo.Clear(); + editorBeatmap.Clear(); + }); + + AddStep("Add timing point", () => editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint())); + + AddStep("Change to hitcircle", () => hitObjectComposer.ChildrenOfType().First(d => d.Button.Label == "HitCircle").TriggerClick()); + + AddStep("move mouse to scroll area", () => + { + // Specifically wanting to test the area of overlap between the left expanding toolbox container + // and the playfield/composer. + var scrollArea = hitObjectComposer.ChildrenOfType().First().ScreenSpaceDrawQuad; + var playfield = hitObjectComposer.Playfield.ScreenSpaceDrawQuad; + InputManager.MoveMouseTo(new Vector2(scrollArea.TopLeft.X, playfield.Centre.Y)); + }); + + AddAssert("no circles placed", () => editorBeatmap.HitObjects.Count == 0); + + AddStep("place circle", () => InputManager.Click(MouseButton.Left)); + + AddAssert("circle placed", () => editorBeatmap.HitObjects.Count == 1); + } + [Test] public void TestDistanceSpacingHotkeys() { From f5d4f02200aa1118485de0eddfa977aa4ec09325 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 4 May 2022 11:59:29 +0300 Subject: [PATCH 0659/2328] Use `ToUpper` for key binding text --- osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index 466b6cba4b..3ca443cc85 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -195,7 +195,7 @@ namespace osu.Game.Rulesets.Edit [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - ShortcutText.Text = config.LookupKeyBindings(getAction(change)); + ShortcutText.Text = config.LookupKeyBindings(getAction(change)).ToUpper(); } private static GlobalAction getAction(ValueChangedEvent change) => change.NewValue - change.OldValue > 0 From 4e0f899159aebc9b5de32b04faefc7f98f8cc654 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 May 2022 18:13:30 +0900 Subject: [PATCH 0660/2328] Rename value changed variable --- osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index 3ca443cc85..081610a62b 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -76,15 +76,15 @@ namespace osu.Game.Rulesets.Edit if (!DistanceSpacingMultiplier.Disabled) { DistanceSpacingMultiplier.Value = EditorBeatmap.BeatmapInfo.DistanceSpacing; - DistanceSpacingMultiplier.BindValueChanged(v => + DistanceSpacingMultiplier.BindValueChanged(multiplier => { - distanceSpacingSlider.ContractedLabelText = $"D. S. ({v.NewValue:0.##x})"; - distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({v.NewValue:0.##x})"; + distanceSpacingSlider.ContractedLabelText = $"D. S. ({multiplier.NewValue:0.##x})"; + distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({multiplier.NewValue:0.##x})"; - if (v.NewValue != v.OldValue) - onScreenDisplay?.Display(new DistanceSpacingToast(v.NewValue.ToLocalisableString(@"0.##x"), v)); + if (multiplier.NewValue != multiplier.OldValue) + onScreenDisplay?.Display(new DistanceSpacingToast(multiplier.NewValue.ToLocalisableString(@"0.##x"), multiplier)); - EditorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue; + EditorBeatmap.BeatmapInfo.DistanceSpacing = multiplier.NewValue; }, true); } } From a759e641ebf17f71cbd825491fb34fc95045f382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 4 May 2022 11:56:29 +0200 Subject: [PATCH 0661/2328] Enforce composer aspect ratio to avoid depending on ambient window size --- osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs index 231a1f408f..fb179a448c 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs @@ -71,6 +71,11 @@ namespace osu.Game.Tests.Visual.Editing Child = editorBeatmapContainer = new EditorBeatmapContainer(Beatmap.Value) { Child = hitObjectComposer = new OsuHitObjectComposer(new OsuRuleset()) + { + // force the composer to fully overlap the playfield area by setting a 4:3 aspect ratio. + FillMode = FillMode.Fit, + FillAspectRatio = 4 / 3f + } }; }); } From 6380216263c0cff2c46417322362da11631aa63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 4 May 2022 11:56:44 +0200 Subject: [PATCH 0662/2328] Nudge click location to avoid placement failures --- osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs index fb179a448c..c9d44fdab7 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs @@ -142,7 +142,7 @@ namespace osu.Game.Tests.Visual.Editing // and the playfield/composer. var scrollArea = hitObjectComposer.ChildrenOfType().First().ScreenSpaceDrawQuad; var playfield = hitObjectComposer.Playfield.ScreenSpaceDrawQuad; - InputManager.MoveMouseTo(new Vector2(scrollArea.TopLeft.X, playfield.Centre.Y)); + InputManager.MoveMouseTo(new Vector2(scrollArea.TopLeft.X + 1, playfield.Centre.Y)); }); AddAssert("no circles placed", () => editorBeatmap.HitObjects.Count == 0); From 2f12c7d9e1e9c1231c82c2bd4766f198dfa709a8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 May 2022 19:09:22 +0900 Subject: [PATCH 0663/2328] Change `ChatTextBox` to not handle up/down arrows --- osu.Game/Online/Chat/StandAloneChatDisplay.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/osu.Game/Online/Chat/StandAloneChatDisplay.cs b/osu.Game/Online/Chat/StandAloneChatDisplay.cs index 6a7da52416..df210fcaf8 100644 --- a/osu.Game/Online/Chat/StandAloneChatDisplay.cs +++ b/osu.Game/Online/Chat/StandAloneChatDisplay.cs @@ -14,6 +14,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Chat; using osu.Game.Resources.Localisation.Web; using osuTK.Graphics; +using osuTK.Input; namespace osu.Game.Online.Chat { @@ -119,6 +120,20 @@ namespace osu.Game.Online.Chat public class ChatTextBox : FocusedTextBox { + protected override bool OnKeyDown(KeyDownEvent e) + { + // Chat text boxes are generally used in places where they retain focus, but shouldn't block interaction with other + // elements on the same screen. + switch (e.Key) + { + case Key.Up: + case Key.Down: + return false; + } + + return base.OnKeyDown(e); + } + protected override void LoadComplete() { base.LoadComplete(); From df1f4aecdceee273e3fbafbe7e7fa2c208e50419 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 May 2022 19:09:40 +0900 Subject: [PATCH 0664/2328] Add support for traversing playlist items using next/previous bindings Addresses https://github.com/ppy/osu/discussions/18061. --- .../OnlinePlay/DrawableRoomPlaylist.cs | 53 ++++++++++++++++++- .../Lounge/Components/RoomsContainer.cs | 2 +- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs index 57bb4253cb..d1b21ca1b0 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs @@ -6,7 +6,10 @@ using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Input.Bindings; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; +using osu.Game.Input.Bindings; using osu.Game.Online.Rooms; using osuTK; @@ -15,7 +18,7 @@ namespace osu.Game.Screens.OnlinePlay /// /// A scrollable list which displays the s in a . /// - public class DrawableRoomPlaylist : OsuRearrangeableListContainer + public class DrawableRoomPlaylist : OsuRearrangeableListContainer, IKeyBindingHandler { /// /// The currently-selected item. Selection is visually represented with a border. @@ -169,5 +172,53 @@ namespace osu.Game.Screens.OnlinePlay }); protected virtual DrawableRoomPlaylistItem CreateDrawablePlaylistItem(PlaylistItem item) => new DrawableRoomPlaylistItem(item); + + #region Key selection logic (shared with BeatmapCarousel and RoomsContainer) + + public bool OnPressed(KeyBindingPressEvent e) + { + switch (e.Action) + { + case GlobalAction.SelectNext: + selectNext(1); + return true; + + case GlobalAction.SelectPrevious: + selectNext(-1); + return true; + } + + return false; + } + + public void OnReleased(KeyBindingReleaseEvent e) + { + } + + private void selectNext(int direction) + { + if (SelectedItem.Disabled) + return; + + var visibleRooms = ListContainer.AsEnumerable().Where(r => r.IsPresent); + + PlaylistItem item; + + if (SelectedItem.Value == null) + item = visibleRooms.FirstOrDefault()?.Model; + else + { + if (direction < 0) + visibleRooms = visibleRooms.Reverse(); + + item = visibleRooms.SkipWhile(r => r.Model != SelectedItem.Value).Skip(1).FirstOrDefault()?.Model; + } + + // we already have a valid selection only change selection if we still have a room to switch to. + if (item != null) + SelectedItem.Value = item; + } + + #endregion } } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs index 175cd2c44e..9bcda90e6d 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs @@ -139,7 +139,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components return base.OnClick(e); } - #region Key selection logic (shared with BeatmapCarousel) + #region Key selection logic (shared with BeatmapCarousel and RoomsContainer) public bool OnPressed(KeyBindingPressEvent e) { From 3b04daddaa9ec3de743eb590003df4f4cc17592d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 4 May 2022 12:36:43 +0200 Subject: [PATCH 0665/2328] Fix self-reference in region name --- osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs index 9bcda90e6d..74e4225f11 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs @@ -139,7 +139,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components return base.OnClick(e); } - #region Key selection logic (shared with BeatmapCarousel and RoomsContainer) + #region Key selection logic (shared with BeatmapCarousel and DrawableRoomPlaylist) public bool OnPressed(KeyBindingPressEvent e) { From 3eead5a6a39c3add1966990f280d655c2d71f3c2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 May 2022 19:40:08 +0900 Subject: [PATCH 0666/2328] Rename `FlushAnimation` to `FlushPendingSelections` to better match purpose --- osu.Game/Overlays/Mods/ModColumn.cs | 4 ++-- osu.Game/Overlays/Mods/ModSection.cs | 4 ++-- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 +- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index f9332dd28b..a792c0a81e 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -435,9 +435,9 @@ namespace osu.Game.Overlays.Mods } /// - /// Play out all remaining animations immediately to leave mods in a good (final) state. + /// Run any delayed selections (due to animation) immediately to leave mods in a good (final) state. /// - public void FlushAnimation() + public void FlushPendingSelections() { while (pendingSelectionOperations.TryDequeue(out var dequeuedAction)) dequeuedAction(); diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 5bf8cddd0c..a70191a864 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -250,9 +250,9 @@ namespace osu.Game.Overlays.Mods protected virtual ModButton CreateModButton(Mod mod) => new ModButton(mod); /// - /// Play out all remaining animations immediately to leave mods in a good (final) state. + /// Run any delayed selections (due to animation) immediately to leave mods in a good (final) state. /// - public void FlushAnimation() + public void FlushPendingSelections() { while (pendingSelectionOperations.TryDequeue(out var dequeuedAction)) dequeuedAction(); diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 9ce79c25f7..cf57322594 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -369,7 +369,7 @@ namespace osu.Game.Overlays.Mods foreach (var section in ModSectionsContainer) { - section.FlushAnimation(); + section.FlushPendingSelections(); } FooterContainer.MoveToX(content_width, WaveContainer.DISAPPEAR_DURATION, Easing.InSine); diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index bb12143d7c..8060bca65f 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -308,7 +308,7 @@ namespace osu.Game.Overlays.Mods var column = columnFlow[i].Column; - column.FlushAnimation(); + column.FlushPendingSelections(); column.TopLevelContent .MoveToY(i % 2 == 0 ? -distance : distance, fade_out_duration, Easing.OutQuint) .FadeOut(fade_out_duration, Easing.OutQuint); From ec27fa8e857a357e7e07f205dcdc6c3891666416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 4 May 2022 13:12:21 +0200 Subject: [PATCH 0667/2328] Add test coverage for keyboard selection --- .../TestSceneDrawableRoomPlaylist.cs | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs index 76353323d6..566a8db608 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs @@ -147,6 +147,40 @@ namespace osu.Game.Tests.Visual.Multiplayer AddAssert("item 1 is selected", () => playlist.SelectedItem.Value == playlist.Items[1]); } + [Test] + public void KeyboardSelection() + { + createPlaylist(p => p.AllowSelection = true); + + AddStep("press down", () => InputManager.Key(Key.Down)); + AddAssert("item 0 is selected", () => playlist.SelectedItem.Value == playlist.Items[0]); + + AddStep("press down", () => InputManager.Key(Key.Down)); + AddAssert("item 1 is selected", () => playlist.SelectedItem.Value == playlist.Items[1]); + + AddStep("press up", () => InputManager.Key(Key.Up)); + AddAssert("item 0 is selected", () => playlist.SelectedItem.Value == playlist.Items[0]); + + AddUntilStep("navigate to last item via keyboard", () => + { + InputManager.Key(Key.Down); + return playlist.SelectedItem.Value == playlist.Items.Last(); + }); + AddAssert("last item is selected", () => playlist.SelectedItem.Value == playlist.Items.Last()); + AddUntilStep("last item is scrolled into view", () => + { + var drawableItem = playlist.ItemMap[playlist.Items.Last()]; + return playlist.ScreenSpaceDrawQuad.Contains(drawableItem.ScreenSpaceDrawQuad.TopLeft) + && playlist.ScreenSpaceDrawQuad.Contains(drawableItem.ScreenSpaceDrawQuad.BottomRight); + }); + + AddStep("press down", () => InputManager.Key(Key.Down)); + AddAssert("last item is selected", () => playlist.SelectedItem.Value == playlist.Items.Last()); + + AddStep("press up", () => InputManager.Key(Key.Up)); + AddAssert("second last item is selected", () => playlist.SelectedItem.Value == playlist.Items.Reverse().ElementAt(1)); + } + [Test] public void TestDownloadButtonHiddenWhenBeatmapExists() { From 0405c1c34a18ca1c06be95fa5426f7deeeaf0daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 4 May 2022 13:15:26 +0200 Subject: [PATCH 0668/2328] Ensure selected playlist item is always scrolled into view --- .../Screens/OnlinePlay/DrawableRoomPlaylist.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs index d1b21ca1b0..fe654c4ab8 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Diagnostics; using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -173,6 +174,21 @@ namespace osu.Game.Screens.OnlinePlay protected virtual DrawableRoomPlaylistItem CreateDrawablePlaylistItem(PlaylistItem item) => new DrawableRoomPlaylistItem(item); + protected override void LoadComplete() + { + base.LoadComplete(); + + SelectedItem.BindValueChanged(_ => scrollToSelection(), true); + } + + private void scrollToSelection() + { + if (SelectedItem.Value == null) return; + + Debug.Assert(ItemMap.TryGetValue(SelectedItem.Value, out var drawableItem)); + ScrollContainer.ScrollIntoView(drawableItem); + } + #region Key selection logic (shared with BeatmapCarousel and RoomsContainer) public bool OnPressed(KeyBindingPressEvent e) From cf220f171b22ac1a65e65c91daa9b35499f5bea3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 May 2022 20:14:30 +0900 Subject: [PATCH 0669/2328] Add test coverage of cross-thread transforms if a dialog is pushed too early --- .../UserInterface/TestSceneDialogOverlay.cs | 60 ++++++++++++++++--- 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs index 405461eec8..aecb3f6c71 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs @@ -1,10 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Threading; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Testing; using osu.Game.Overlays; using osu.Game.Overlays.Dialog; @@ -15,15 +17,11 @@ namespace osu.Game.Tests.Visual.UserInterface { private DialogOverlay overlay; - [SetUpSteps] - public void SetUpSteps() - { - AddStep("create dialog overlay", () => Child = overlay = new DialogOverlay()); - } - [Test] public void TestBasic() { + AddStep("create dialog overlay", () => Child = overlay = new DialogOverlay()); + TestPopupDialog firstDialog = null; TestPopupDialog secondDialog = null; @@ -37,12 +35,12 @@ namespace osu.Game.Tests.Visual.UserInterface new PopupDialogOkButton { Text = @"I never want to see this again.", - Action = () => System.Console.WriteLine(@"OK"), + Action = () => Console.WriteLine(@"OK"), }, new PopupDialogCancelButton { Text = @"Firetruck, I still want quick ranks!", - Action = () => System.Console.WriteLine(@"Cancel"), + Action = () => Console.WriteLine(@"Cancel"), }, }, })); @@ -87,9 +85,51 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("first dialog is not part of hierarchy", () => firstDialog.Parent == null); } + [Test] + public void TestPushBeforeLoad() + { + PopupDialog dialog = null; + + AddStep("create dialog overlay", () => overlay = new SlowLoadingDialogOverlay()); + + AddStep("start loading overlay", () => LoadComponentAsync(overlay, Add)); + + AddStep("push dialog before loaded", () => + { + overlay.Push(dialog = new TestPopupDialog + { + Buttons = new PopupDialogButton[] + { + new PopupDialogOkButton { Text = @"OK" }, + }, + }); + }); + + AddAssert("dialog not displayed", () => overlay.CurrentDialog != dialog); + + AddStep("complete load", () => ((SlowLoadingDialogOverlay)overlay).LoadEvent.Set()); + + AddUntilStep("wait for load", () => overlay.IsLoaded); + + AddAssert("dialog displayed", () => overlay.CurrentDialog == dialog); + } + + public class SlowLoadingDialogOverlay : DialogOverlay + { + public ManualResetEventSlim LoadEvent = new ManualResetEventSlim(); + + [BackgroundDependencyLoader] + private void load() + { + LoadEvent.Wait(10000); + } + } + [Test] public void TestDismissBeforePush() { + AddStep("create dialog overlay", () => Child = overlay = new DialogOverlay()); + TestPopupDialog testDialog = null; AddStep("dismissed dialog push", () => { @@ -106,6 +146,8 @@ namespace osu.Game.Tests.Visual.UserInterface [Test] public void TestDismissBeforePushViaButtonPress() { + AddStep("create dialog overlay", () => Child = overlay = new DialogOverlay()); + TestPopupDialog testDialog = null; AddStep("dismissed dialog push", () => { From 383245f43afec71c7e5d44102c04395032a582e0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 May 2022 20:22:52 +0900 Subject: [PATCH 0670/2328] Fix dialoged pushed to `DialogOverlay` too early potentially doing cross-thread transforms As seen at https://github.com/ppy/osu/runs/6287700705?check_suite_focus=true. --- osu.Game/Overlays/DialogOverlay.cs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 15d89a561a..0699c69691 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -47,6 +47,12 @@ namespace osu.Game.Overlays public void Push(PopupDialog dialog) { + if (!IsLoaded) + { + Schedule(() => Push(dialog)); + return; + } + if (dialog == CurrentDialog || dialog.State.Value != Visibility.Visible) return; // if any existing dialog is being displayed, dismiss it before showing a new one. @@ -60,7 +66,7 @@ namespace osu.Game.Overlays Show(); } - public override bool IsPresent => dialogContainer.Children.Count > 0; + public override bool IsPresent => Scheduler.HasPendingTasks || dialogContainer.Children.Count > 0; protected override bool BlockNonPositionalInput => true; @@ -88,16 +94,14 @@ namespace osu.Game.Overlays protected override void PopOut() { base.PopOut(); + this.FadeOut(PopupDialog.EXIT_DURATION, Easing.InSine); + + // PopOut is called as part of VisibilityContainer's initialisation logic, but we don't want it to interact with a potentially waiting dialog. + if (!IsLoaded) return; lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF, 100, Easing.InCubic); - if (CurrentDialog?.State.Value == Visibility.Visible) - { - CurrentDialog.Hide(); - return; - } - - this.FadeOut(PopupDialog.EXIT_DURATION, Easing.InSine); + if (CurrentDialog?.State.Value == Visibility.Visible) CurrentDialog.Hide(); } public override bool OnPressed(KeyBindingPressEvent e) From e6fdef2d7afbb769583bc5a4cab62eba438e5773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 4 May 2022 13:51:47 +0200 Subject: [PATCH 0671/2328] Fix test failures due to selection/item collection desyncs --- osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs index fe654c4ab8..18cf454be3 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Diagnostics; using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -178,14 +177,19 @@ namespace osu.Game.Screens.OnlinePlay { base.LoadComplete(); - SelectedItem.BindValueChanged(_ => scrollToSelection(), true); + // schedules added as the properties may change value while the drawable items haven't been created yet. + SelectedItem.BindValueChanged(_ => Scheduler.AddOnce(scrollToSelection)); + Items.BindCollectionChanged((_, __) => Scheduler.AddOnce(scrollToSelection), true); } private void scrollToSelection() { - if (SelectedItem.Value == null) return; + // SelectedItem and ItemMap/drawable items are managed separately, + // so if the item can't be unmapped to a drawable, don't try to scroll to it. + // best effort is made to not drop any updates, by subscribing to both sources. + if (SelectedItem.Value == null || !ItemMap.TryGetValue(SelectedItem.Value, out var drawableItem)) + return; - Debug.Assert(ItemMap.TryGetValue(SelectedItem.Value, out var drawableItem)); ScrollContainer.ScrollIntoView(drawableItem); } From 81ce0e6565f244f6d1c59f00653ca972ab49a63d Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Wed, 4 May 2022 12:55:22 +0100 Subject: [PATCH 0672/2328] Reimplement sliderticks --- .../Mods/OsuModStrictTracking.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs b/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs index ab45e5192d..a1e6946157 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs @@ -70,6 +70,11 @@ namespace osu.Game.Rulesets.Osu.Mods drawableRuleset.Playfield.RegisterPool(10, 100); } + private class StrictTrackingSliderTick : SliderTick + { + public override Judgement CreateJudgement() => new OsuIgnoreJudgement(); + } + private class StrictTrackingSliderTailCircle : SliderTailCircle { public StrictTrackingSliderTailCircle(Slider slider) @@ -109,6 +114,18 @@ namespace osu.Game.Rulesets.Osu.Mods { switch (e.Type) { + case SliderEventType.Tick: + AddNested(new StrictTrackingSliderTick + { + SpanIndex = e.SpanIndex, + SpanStartTime = e.SpanStartTime, + StartTime = e.Time, + Position = Position + Path.PositionAt(e.PathProgress), + StackHeight = StackHeight, + Scale = Scale, + }); + break; + case SliderEventType.Head: AddNested(HeadCircle = new SliderHeadCircle { From ddab3c6d8084a0c19289c56f53bdb779481ec4b6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 May 2022 21:00:11 +0900 Subject: [PATCH 0673/2328] Tidy up state variables --- osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs index e6a126f4d8..c5ac87f527 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs @@ -163,19 +163,17 @@ namespace osu.Game.Overlays.Chat.ChannelList private void updateState() { - if (showSelected) + bool selected = selectedChannel.Value == Channel && !SelectorActive.Value; + + if (selected) selectBox.FadeIn(300, Easing.OutQuint); else selectBox.FadeOut(200, Easing.OutQuint); - if (showUnread || showSelected) + if (Unread.Value || selected) text.FadeColour(colourProvider.Content1, 300, Easing.OutQuint); else text.FadeColour(colourProvider.Light3, 200, Easing.OutQuint); } - - private bool showUnread => Unread.Value; - - private bool showSelected => selectedChannel.Value == Channel && !SelectorActive.Value; } } From 1a85e1267bc0ccf3700360f831b69f5e5cc26312 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 4 May 2022 14:43:40 +0100 Subject: [PATCH 0674/2328] Ensure focus is directed to `ChatTextBox` from `ChatOverlay` and add tests --- .../Visual/Online/TestSceneChatOverlayV2.cs | 27 ++++++++++++++++++- osu.Game/Overlays/ChatOverlayV2.cs | 8 ++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index c7bb6760c7..9d4de11c5a 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -144,7 +144,7 @@ namespace osu.Game.Tests.Visual.Online { AddStep("Show overlay", () => chatOverlay.Show()); AddAssert("Listing is visible", () => listingVisibility == Visibility.Visible); - AddStep("Search for 'number 2'", () => chatOverlay.ChildrenOfType().Single().Text = "number 2"); + AddStep("Search for 'number 2'", () => chatOverlayTextBox.Text = "number 2"); AddUntilStep("Only channel 2 visibile", () => { IEnumerable listingItems = chatOverlay.ChildrenOfType() @@ -325,6 +325,28 @@ namespace osu.Game.Tests.Visual.Online AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel1)); } + [Test] + public void TextBoxRetainsFocus() + { + AddStep("Show overlay", () => chatOverlay.Show()); + AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); + AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); + AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); + AddStep("Click selector", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); + AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); + AddStep("Click listing", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); + AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); + AddStep("Click drawable channel", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); + AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); + AddStep("Click channel list", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); + AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); + AddStep("Click top bar", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); + AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); + AddStep("Hide overlay", () => chatOverlay.Hide()); + AddAssert("TextBox is not focused", () => InputManager.FocusedDrawable == null); + } + private Visibility listingVisibility => chatOverlay.ChildrenOfType().Single().State.Value; @@ -337,6 +359,9 @@ namespace osu.Game.Tests.Visual.Online private ChannelListItem getChannelListItem(Channel channel) => chatOverlay.ChildrenOfType().Single(item => item.Channel == channel); + private ChatTextBox chatOverlayTextBox => + chatOverlay.ChildrenOfType().Single(); + private void clickDrawable(Drawable d) { InputManager.MoveMouseTo(d); diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index f6190bbe20..658a28bfdb 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -218,8 +218,6 @@ namespace osu.Game.Overlays this.MoveToY(0, transition_length, Easing.OutQuint); this.FadeIn(transition_length, Easing.OutQuint); - - textBar.TextBoxTakeFocus(); } protected override void PopOut() @@ -232,6 +230,12 @@ namespace osu.Game.Overlays textBar.TextBoxKillFocus(); } + protected override void OnFocus(FocusEvent e) + { + textBar.TextBoxTakeFocus(); + base.OnFocus(e); + } + private void currentChannelChanged(ValueChangedEvent e) { Channel? newChannel = e.NewValue; From 9416346c942ad20baa7b8000ebcb0a028a8c796e Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 4 May 2022 16:46:23 +0300 Subject: [PATCH 0675/2328] Globalise beatmap selection key bindings as "group" selection --- .../Input/Bindings/GlobalActionContainer.cs | 13 ++++++------ .../GlobalActionKeyBindingStrings.cs | 20 +++++++++---------- osu.Game/Overlays/Volume/VolumeMeter.cs | 4 ++-- osu.Game/Screens/Select/BeatmapCarousel.cs | 8 ++++---- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index ec368a6fda..9cb8f2dfcc 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -59,6 +59,9 @@ namespace osu.Game.Input.Bindings new KeyBinding(InputKey.Up, GlobalAction.SelectPrevious), new KeyBinding(InputKey.Down, GlobalAction.SelectNext), + new KeyBinding(InputKey.Left, GlobalAction.SelectPreviousGroup), + new KeyBinding(InputKey.Right, GlobalAction.SelectNextGroup), + new KeyBinding(InputKey.Space, GlobalAction.Select), new KeyBinding(InputKey.Enter, GlobalAction.Select), new KeyBinding(InputKey.KeypadEnter, GlobalAction.Select), @@ -100,8 +103,6 @@ namespace osu.Game.Input.Bindings public IEnumerable SongSelectKeyBindings => new[] { - new KeyBinding(InputKey.Left, GlobalAction.SelectPreviousBeatmap), - new KeyBinding(InputKey.Right, GlobalAction.SelectNextBeatmap), new KeyBinding(InputKey.F1, GlobalAction.ToggleModSelection), new KeyBinding(InputKey.F2, GlobalAction.SelectNextRandom), new KeyBinding(new[] { InputKey.Shift, InputKey.F2 }, GlobalAction.SelectPreviousRandom), @@ -304,10 +305,10 @@ namespace osu.Game.Input.Bindings [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorFlipVertically))] EditorFlipVertically, - [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.SelectPreviousBeatmap))] - SelectPreviousBeatmap, + [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.SelectPreviousGroup))] + SelectPreviousGroup, - [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.SelectNextBeatmap))] - SelectNextBeatmap, + [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.SelectNextGroup))] + SelectNextGroup, } } diff --git a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs index 08e13e24ae..129706261b 100644 --- a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs +++ b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs @@ -129,6 +129,16 @@ namespace osu.Game.Localisation /// public static LocalisableString SelectNext => new TranslatableString(getKey(@"select_next"), @"Next selection"); + /// + /// "Previous group selection" + /// + public static LocalisableString SelectPreviousGroup => new TranslatableString(getKey(@"select_previous_group"), @"Previous group selection"); + + /// + /// "Next group selection" + /// + public static LocalisableString SelectNextGroup => new TranslatableString(getKey(@"select_next_group"), @"Next group selection"); + /// /// "Home" /// @@ -194,16 +204,6 @@ namespace osu.Game.Localisation /// public static LocalisableString ToggleInGameInterface => new TranslatableString(getKey(@"toggle_in_game_interface"), @"Toggle in-game interface"); - /// - /// "Previous beatmap selection" - /// - public static LocalisableString SelectPreviousBeatmap => new TranslatableString(getKey(@"select_previous_beatmap"), @"Previous beatmap selection"); - - /// - /// "Next beatmap selection" - /// - public static LocalisableString SelectNextBeatmap => new TranslatableString(getKey(@"select_next_beatmap"), @"Next beatmap selection"); - /// /// "Toggle Mod Select" /// diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index e2afd46c18..46b8b35da2 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -372,12 +372,12 @@ namespace osu.Game.Overlays.Volume switch (e.Action) { - case GlobalAction.SelectPrevious: + case GlobalAction.SelectPreviousGroup: State = SelectionState.Selected; adjust(1, false); return true; - case GlobalAction.SelectNext: + case GlobalAction.SelectNextGroup: State = SelectionState.Selected; adjust(-1, false); return true; diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 85b5af049e..a59f14647d 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -611,13 +611,13 @@ namespace osu.Game.Screens.Select switch (e.Action) { case GlobalAction.SelectNext: - case GlobalAction.SelectNextBeatmap: - SelectNext(1, e.Action == GlobalAction.SelectNextBeatmap); + case GlobalAction.SelectNextGroup: + SelectNext(1, e.Action == GlobalAction.SelectNextGroup); return true; case GlobalAction.SelectPrevious: - case GlobalAction.SelectPreviousBeatmap: - SelectNext(-1, e.Action == GlobalAction.SelectPreviousBeatmap); + case GlobalAction.SelectPreviousGroup: + SelectNext(-1, e.Action == GlobalAction.SelectPreviousGroup); return true; } From 20e277d2e587069d0534bf457efa8999d0ac9629 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 4 May 2022 17:08:41 +0300 Subject: [PATCH 0676/2328] Apply proposed naming changes --- osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs | 2 +- osu.Game/Rulesets/Mods/IMod.cs | 4 ++-- osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs | 2 +- osu.Game/Rulesets/Mods/ModRateAdjust.cs | 2 +- osu.Game/Rulesets/Mods/ModTimeRamp.cs | 2 +- osu.Game/Rulesets/Mods/ModUsage.cs | 6 +++--- osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs | 2 +- .../OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs | 4 ++-- osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs | 2 +- .../Screens/Play/PlayerSettings/BeatmapOffsetControl.cs | 2 +- osu.Game/Screens/Play/SubmittingPlayer.cs | 2 +- osu.Game/Screens/Ranking/ResultsScreen.cs | 2 +- osu.Game/Utils/ModUtils.cs | 4 ++-- 13 files changed, 18 insertions(+), 18 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs b/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs index caeb757d7a..17ea117018 100644 --- a/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs +++ b/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs @@ -63,7 +63,7 @@ namespace osu.Game.Overlays.BeatmapSet return; modsContainer.Add(new ModButton(new ModNoMod())); - modsContainer.AddRange(rulesetInstance.AllMods.Where(m => m.IsPlayable(ModUsage.User)).Select(m => new ModButton(m))); + modsContainer.AddRange(rulesetInstance.AllMods.Where(m => m.IsPlayable(ModUsage.SoloLocal)).Select(m => new ModButton(m))); modsContainer.ForEach(button => { diff --git a/osu.Game/Rulesets/Mods/IMod.cs b/osu.Game/Rulesets/Mods/IMod.cs index 325b75b76e..d37ef53a66 100644 --- a/osu.Game/Rulesets/Mods/IMod.cs +++ b/osu.Game/Rulesets/Mods/IMod.cs @@ -39,8 +39,8 @@ namespace osu.Game.Rulesets.Mods /// /// /// Should be always false for cases where the user is not interacting with the game. - /// Should be false in for mods that make gameplay duration dependent on user input (e.g. ). - /// Should be false in for mods that affect the gameplay duration (e.g. and ). + /// Should be false in for mods that make gameplay duration dependent on user input (e.g. ). + /// Should be false in for mods that affect the gameplay duration (e.g. and ). /// /// /// The mod usage. diff --git a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs index 801cd3cba7..700ad30c08 100644 --- a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs +++ b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mods public override double ScoreMultiplier => 1; - public override bool IsPlayable(ModUsage usage) => usage == ModUsage.User; + public override bool IsPlayable(ModUsage usage) => usage == ModUsage.SoloLocal; public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModTimeRamp) }; diff --git a/osu.Game/Rulesets/Mods/ModRateAdjust.cs b/osu.Game/Rulesets/Mods/ModRateAdjust.cs index 59d9026f3b..acb39bfbe6 100644 --- a/osu.Game/Rulesets/Mods/ModRateAdjust.cs +++ b/osu.Game/Rulesets/Mods/ModRateAdjust.cs @@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Mods { public abstract class ModRateAdjust : Mod, IApplicableToRate { - public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerPerPlayer; + public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerLocal; public abstract BindableNumber SpeedChange { get; } diff --git a/osu.Game/Rulesets/Mods/ModTimeRamp.cs b/osu.Game/Rulesets/Mods/ModTimeRamp.cs index 96b38301b5..c554c39010 100644 --- a/osu.Game/Rulesets/Mods/ModTimeRamp.cs +++ b/osu.Game/Rulesets/Mods/ModTimeRamp.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mods [SettingSource("Adjust pitch", "Should pitch be adjusted with speed")] public abstract BindableBool AdjustPitch { get; } - public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerPerPlayer; + public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerLocal; public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModAdaptiveSpeed) }; diff --git a/osu.Game/Rulesets/Mods/ModUsage.cs b/osu.Game/Rulesets/Mods/ModUsage.cs index 04d99149dd..3f25154d73 100644 --- a/osu.Game/Rulesets/Mods/ModUsage.cs +++ b/osu.Game/Rulesets/Mods/ModUsage.cs @@ -11,17 +11,17 @@ namespace osu.Game.Rulesets.Mods /// /// This mod can be used for a per-user gameplay session. /// - User, + SoloLocal, /// /// This mod can be used in multiplayer but must be applied to all users. /// This is generally the case for mods which affect the length of gameplay. /// - MultiplayerRoomWide, + MultiplayerGlobal, /// /// This mod can be used in multiplayer either at a room or per-player level (i.e. "free mod"). /// - MultiplayerPerPlayer, + MultiplayerLocal, } } diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs index 37cffd8343..13d5dd8927 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.OnlinePlay public new Func IsValidMod { get => base.IsValidMod; - set => base.IsValidMod = m => m.HasImplementation && m.IsPlayable(ModUsage.User) && value(m); + set => base.IsValidMod = m => m.HasImplementation && m.IsPlayable(ModUsage.SoloLocal) && value(m); } public FreeModSelectOverlay() diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs index 5bf217031a..d7e752623d 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs @@ -95,8 +95,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea(); - protected override bool IsValidMod(Mod mod) => base.IsValidMod(mod) && mod.IsPlayable(ModUsage.MultiplayerRoomWide); + protected override bool IsValidMod(Mod mod) => base.IsValidMod(mod) && mod.IsPlayable(ModUsage.MultiplayerGlobal); - protected override bool IsValidFreeMod(Mod mod) => base.IsValidFreeMod(mod) && mod.IsPlayable(ModUsage.MultiplayerPerPlayer); + protected override bool IsValidFreeMod(Mod mod) => base.IsValidFreeMod(mod) && mod.IsPlayable(ModUsage.MultiplayerLocal); } } diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs index d9da230f58..b8b0604c79 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs @@ -170,7 +170,7 @@ namespace osu.Game.Screens.OnlinePlay /// /// The to check. /// Whether is a valid mod for online play. - protected virtual bool IsValidMod(Mod mod) => mod.HasImplementation && ModUtils.FlattenMod(mod).All(m => m.IsPlayable(ModUsage.User)); + protected virtual bool IsValidMod(Mod mod) => mod.HasImplementation && ModUtils.FlattenMod(mod).All(m => m.IsPlayable(ModUsage.SoloLocal)); /// /// Checks whether a given is valid for per-player free-mod selection. diff --git a/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs b/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs index 554b58f481..af2cecfba5 100644 --- a/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs +++ b/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs @@ -188,7 +188,7 @@ namespace osu.Game.Screens.Play.PlayerSettings if (score.NewValue == null) return; - if (score.NewValue.Mods.Any(m => !m.IsPlayable(ModUsage.User))) + if (score.NewValue.Mods.Any(m => !m.IsPlayable(ModUsage.SoloLocal))) return; var hitEvents = score.NewValue.HitEvents; diff --git a/osu.Game/Screens/Play/SubmittingPlayer.cs b/osu.Game/Screens/Play/SubmittingPlayer.cs index 6846992b13..b33ff87d55 100644 --- a/osu.Game/Screens/Play/SubmittingPlayer.cs +++ b/osu.Game/Screens/Play/SubmittingPlayer.cs @@ -48,7 +48,7 @@ namespace osu.Game.Screens.Play // Token request construction should happen post-load to allow derived classes to potentially prepare DI backings that are used to create the request. var tcs = new TaskCompletionSource(); - if (Mods.Value.Any(m => !m.IsPlayable(ModUsage.User))) + if (Mods.Value.Any(m => !m.IsPlayable(ModUsage.SoloLocal))) { handleTokenFailure(new InvalidOperationException("Non-user playable mod selected.")); return false; diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index ee2c00a135..e0ae0309ce 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -146,7 +146,7 @@ namespace osu.Game.Screens.Ranking if (Score != null) { // only show flair / animation when arriving after watching a play that isn't autoplay. - bool shouldFlair = player != null && Score.Mods.All(m => m.IsPlayable(ModUsage.User)); + bool shouldFlair = player != null && Score.Mods.All(m => m.IsPlayable(ModUsage.SoloLocal)); ScorePanelList.AddScore(Score, shouldFlair); } diff --git a/osu.Game/Utils/ModUtils.cs b/osu.Game/Utils/ModUtils.cs index c5cf469f7c..e19020a959 100644 --- a/osu.Game/Utils/ModUtils.cs +++ b/osu.Game/Utils/ModUtils.cs @@ -121,7 +121,7 @@ namespace osu.Game.Utils /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidRequiredModsForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) - => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerRoomWide), out invalidMods); + => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerGlobal), out invalidMods); /// /// Checks that all s in a combination are valid as "free mods" in a multiplayer match session. @@ -130,7 +130,7 @@ namespace osu.Game.Utils /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidFreeModsForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) - => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerPerPlayer), out invalidMods); + => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerLocal), out invalidMods); private static bool checkValid(IEnumerable mods, Predicate valid, [NotNullWhen(false)] out List? invalidMods) { From 8f04db5df5136f9431e62a6fffce273f2ba8d6bc Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 4 May 2022 17:21:19 +0300 Subject: [PATCH 0677/2328] Bring back behaviour of checking incompatibility on gameplay validity --- osu.Game.Tests/Mods/ModUtilsTest.cs | 12 ++++++++++++ osu.Game/OsuGame.cs | 15 +++++---------- osu.Game/Utils/ModUtils.cs | 15 +++++++++++---- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tests/Mods/ModUtilsTest.cs b/osu.Game.Tests/Mods/ModUtilsTest.cs index e858abfe44..4c126f0a3b 100644 --- a/osu.Game.Tests/Mods/ModUtilsTest.cs +++ b/osu.Game.Tests/Mods/ModUtilsTest.cs @@ -134,6 +134,18 @@ namespace osu.Game.Tests.Mods private static readonly object[] invalid_mod_test_scenarios = { + // incompatible pair. + new object[] + { + new Mod[] { new OsuModDoubleTime(), new OsuModHalfTime() }, + new[] { typeof(OsuModDoubleTime), typeof(OsuModHalfTime) } + }, + // incompatible pair with derived class. + new object[] + { + new Mod[] { new OsuModNightcore(), new OsuModHalfTime() }, + new[] { typeof(OsuModNightcore), typeof(OsuModHalfTime) } + }, // system mod. new object[] { diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 29985b0893..e9fe8c43de 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -577,16 +577,11 @@ namespace osu.Game if (SelectedMods.Disabled) return; - var validMods = mods.NewValue; - - if (!ModUtils.CheckCompatibleSet(validMods, out var incompatible)) - validMods = validMods.Except(incompatible).ToArray(); - - if (!ModUtils.CheckValidForGameplay(validMods, out var invalid)) - validMods = validMods.Except(invalid).ToArray(); - - // ensure we always have a valid set of mods. - SelectedMods.Value = validMods; + if (!ModUtils.CheckValidForGameplay(mods.NewValue, out var invalid)) + { + // ensure we always have a valid set of mods. + SelectedMods.Value = mods.NewValue.Except(invalid).ToArray(); + } } #endregion diff --git a/osu.Game/Utils/ModUtils.cs b/osu.Game/Utils/ModUtils.cs index e19020a959..c18125054a 100644 --- a/osu.Game/Utils/ModUtils.cs +++ b/osu.Game/Utils/ModUtils.cs @@ -112,7 +112,7 @@ namespace osu.Game.Utils /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidForGameplay(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) - => checkValid(mods, m => m.Type != ModType.System && m.HasImplementation && !(m is MultiMod), out invalidMods); + => checkValid(mods, m => m.Type != ModType.System && m.HasImplementation && !(m is MultiMod), out invalidMods, true); /// /// Checks that all s in a combination are valid as "required mods" in a multiplayer match session. @@ -121,7 +121,7 @@ namespace osu.Game.Utils /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidRequiredModsForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) - => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerGlobal), out invalidMods); + => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerGlobal), out invalidMods, true); /// /// Checks that all s in a combination are valid as "free mods" in a multiplayer match session. @@ -130,13 +130,20 @@ namespace osu.Game.Utils /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidFreeModsForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) - => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerLocal), out invalidMods); + => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerLocal), out invalidMods, false); - private static bool checkValid(IEnumerable mods, Predicate valid, [NotNullWhen(false)] out List? invalidMods) + private static bool checkValid(IEnumerable mods, Predicate valid, [NotNullWhen(false)] out List? invalidMods, bool checkCompatibility) { mods = mods.ToArray(); invalidMods = null; + if (checkCompatibility) + { + // exclude multi mods from compatibility checks. + // the loop below automatically marks all multi mods as not valid for gameplay anyway. + CheckCompatibleSet(mods.Where(m => !(m is MultiMod)), out invalidMods); + } + foreach (var mod in mods) { if (!valid(mod)) From 8488a29e9e4db0dd26ab6ec2ecacd24681b764b2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 4 May 2022 17:22:11 +0300 Subject: [PATCH 0678/2328] Renew obsoletion date --- osu.Game/Rulesets/Mods/IMod.cs | 2 +- osu.Game/Rulesets/Mods/Mod.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Mods/IMod.cs b/osu.Game/Rulesets/Mods/IMod.cs index d37ef53a66..c0d4aa5c9f 100644 --- a/osu.Game/Rulesets/Mods/IMod.cs +++ b/osu.Game/Rulesets/Mods/IMod.cs @@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Mods /// Whether this mod is playable by an end user. /// Should be false for cases where the user is not interacting with the game (so it can be excluded from multiplayer selection, for example). /// - [Obsolete("Override IsPlayable instead.")] // Can be removed 20220918 + [Obsolete("Override IsPlayable instead.")] // Can be removed 20221104 bool UserPlayable { get; } /// diff --git a/osu.Game/Rulesets/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs index debb1a1e48..b2f1b7e24f 100644 --- a/osu.Game/Rulesets/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -96,7 +96,7 @@ namespace osu.Game.Rulesets.Mods #pragma warning restore 618 [JsonIgnore] - [Obsolete("Override IsPlayable instead.")] // Can be removed 20220918 + [Obsolete("Override IsPlayable instead.")] // Can be removed 20221104 public virtual bool UserPlayable => true; [Obsolete("Going forward, the concept of \"ranked\" doesn't exist. The only exceptions are automation mods, which should now override IsPlayable to false.")] // Can be removed 20211009 From d0df9e8051f7580b94e888079557d6cf62018b40 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 4 May 2022 18:56:27 +0300 Subject: [PATCH 0679/2328] Inline `CheckCompatibleSet` method to avoid ugly boolean flag --- osu.Game/Utils/ModUtils.cs | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/osu.Game/Utils/ModUtils.cs b/osu.Game/Utils/ModUtils.cs index c18125054a..40db981ef0 100644 --- a/osu.Game/Utils/ModUtils.cs +++ b/osu.Game/Utils/ModUtils.cs @@ -112,7 +112,16 @@ namespace osu.Game.Utils /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidForGameplay(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) - => checkValid(mods, m => m.Type != ModType.System && m.HasImplementation && !(m is MultiMod), out invalidMods, true); + { + mods = mods.ToArray(); + + // exclude multi mods from compatibility checks. + // the loop below automatically marks all multi mods as not valid for gameplay anyway. + if (!CheckCompatibleSet(mods.Where(m => !(m is MultiMod)), out invalidMods)) + return false; + + return checkValid(mods, m => m.Type != ModType.System && m.HasImplementation && !(m is MultiMod), out invalidMods); + } /// /// Checks that all s in a combination are valid as "required mods" in a multiplayer match session. @@ -121,7 +130,14 @@ namespace osu.Game.Utils /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidRequiredModsForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) - => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerGlobal), out invalidMods, true); + { + mods = mods.ToArray(); + + if (!CheckCompatibleSet(mods, out invalidMods)) + return false; + + return checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerGlobal), out invalidMods); + } /// /// Checks that all s in a combination are valid as "free mods" in a multiplayer match session. @@ -130,20 +146,13 @@ namespace osu.Game.Utils /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidFreeModsForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) - => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerLocal), out invalidMods, false); + => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerLocal), out invalidMods); - private static bool checkValid(IEnumerable mods, Predicate valid, [NotNullWhen(false)] out List? invalidMods, bool checkCompatibility) + private static bool checkValid(IEnumerable mods, Predicate valid, [NotNullWhen(false)] out List? invalidMods) { mods = mods.ToArray(); invalidMods = null; - if (checkCompatibility) - { - // exclude multi mods from compatibility checks. - // the loop below automatically marks all multi mods as not valid for gameplay anyway. - CheckCompatibleSet(mods.Where(m => !(m is MultiMod)), out invalidMods); - } - foreach (var mod in mods) { if (!valid(mod)) From a27fcda9f1cee33104a9e6bb1aee1e5ac2bca1ac Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 01:52:39 +0900 Subject: [PATCH 0680/2328] Fix failing tests due to `CurrentDialog` being unexpectedly not set after `Push` --- .../UserInterface/TestSceneDialogOverlay.cs | 2 -- osu.Game/Overlays/DialogOverlay.cs | 27 +++++++++---------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs index aecb3f6c71..54cdeaf956 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs @@ -105,8 +105,6 @@ namespace osu.Game.Tests.Visual.UserInterface }); }); - AddAssert("dialog not displayed", () => overlay.CurrentDialog != dialog); - AddStep("complete load", () => ((SlowLoadingDialogOverlay)overlay).LoadEvent.Set()); AddUntilStep("wait for load", () => overlay.IsLoaded); diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 0699c69691..a8c3c392e0 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -47,23 +47,23 @@ namespace osu.Game.Overlays public void Push(PopupDialog dialog) { - if (!IsLoaded) - { - Schedule(() => Push(dialog)); - return; - } - if (dialog == CurrentDialog || dialog.State.Value != Visibility.Visible) return; - // if any existing dialog is being displayed, dismiss it before showing a new one. - CurrentDialog?.Hide(); - + var lastDialog = CurrentDialog; CurrentDialog = dialog; - CurrentDialog.State.ValueChanged += state => onDialogOnStateChanged(dialog, state.NewValue); - dialogContainer.Add(CurrentDialog); + Scheduler.Add(() => + { + // if any existing dialog is being displayed, dismiss it before showing a new one. + lastDialog?.Hide(); - Show(); + CurrentDialog = dialog; + CurrentDialog.State.ValueChanged += state => onDialogOnStateChanged(dialog, state.NewValue); + + dialogContainer.Add(CurrentDialog); + + Show(); + }, false); } public override bool IsPresent => Scheduler.HasPendingTasks || dialogContainer.Children.Count > 0; @@ -96,9 +96,6 @@ namespace osu.Game.Overlays base.PopOut(); this.FadeOut(PopupDialog.EXIT_DURATION, Easing.InSine); - // PopOut is called as part of VisibilityContainer's initialisation logic, but we don't want it to interact with a potentially waiting dialog. - if (!IsLoaded) return; - lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF, 100, Easing.InCubic); if (CurrentDialog?.State.Value == Visibility.Visible) CurrentDialog.Hide(); From 81b462262096d38d864be7e1b1bf22cc13e75eb7 Mon Sep 17 00:00:00 2001 From: Supersonicboss1 Date: Wed, 4 May 2022 22:25:34 +0100 Subject: [PATCH 0681/2328] fixed autoplay not showing compat, + relax compat --- osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs index dfa28a537a..0832cfb545 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Acronym => @"AL"; public override string Description => @"Don't use the same key twice in a row!"; public override double ScoreMultiplier => 1.0; - public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay) }; + public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModRelax) }; public override ModType Type => ModType.Conversion; public override IconUsage? Icon => FontAwesome.Solid.Keyboard; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs index b31ef5d2fd..507b3588bd 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs @@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public class OsuModAutoplay : ModAutoplay { - public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModMagnetised), typeof(OsuModAutopilot), typeof(OsuModSpunOut) }).ToArray(); + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModMagnetised), typeof(OsuModAutopilot), typeof(OsuModSpunOut), typeof(OsuModAlternate) }).ToArray(); public override ModReplayData CreateReplayData(IBeatmap beatmap, IReadOnlyList mods) => new ModReplayData(new OsuAutoGenerator(beatmap, mods).Generate(), new ModCreatedUser { Username = "Autoplay" }); diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs b/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs index 5b42772358..99d7535957 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public class OsuModCinema : ModCinema { - public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModMagnetised), typeof(OsuModAutopilot), typeof(OsuModSpunOut) }).ToArray(); + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModMagnetised), typeof(OsuModAutopilot), typeof(OsuModSpunOut), typeof(OsuModAlternate) }).ToArray(); public override ModReplayData CreateReplayData(IBeatmap beatmap, IReadOnlyList mods) => new ModReplayData(new OsuAutoGenerator(beatmap, mods).Generate(), new ModCreatedUser { Username = "Autoplay" }); diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index 6b81efdca6..5f37c6a0ae 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Mods public class OsuModRelax : ModRelax, IUpdatableByPlayfield, IApplicableToDrawableRuleset, IApplicableToPlayer { public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things."; - public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot), typeof(OsuModMagnetised) }).ToArray(); + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot), typeof(OsuModMagnetised), typeof(OsuModAlternate) }).ToArray(); /// /// How early before a hitobject's start time to trigger a hit. From 464b3af5f37b23204c3c440d4d0359b670527384 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 5 May 2022 05:42:20 +0300 Subject: [PATCH 0682/2328] Rename local correctly --- osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs index 18cf454be3..d1b83c3749 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs @@ -220,18 +220,18 @@ namespace osu.Game.Screens.OnlinePlay if (SelectedItem.Disabled) return; - var visibleRooms = ListContainer.AsEnumerable().Where(r => r.IsPresent); + var visibleItems = ListContainer.AsEnumerable().Where(r => r.IsPresent); PlaylistItem item; if (SelectedItem.Value == null) - item = visibleRooms.FirstOrDefault()?.Model; + item = visibleItems.FirstOrDefault()?.Model; else { if (direction < 0) - visibleRooms = visibleRooms.Reverse(); + visibleItems = visibleItems.Reverse(); - item = visibleRooms.SkipWhile(r => r.Model != SelectedItem.Value).Skip(1).FirstOrDefault()?.Model; + item = visibleItems.SkipWhile(r => r.Model != SelectedItem.Value).Skip(1).FirstOrDefault()?.Model; } // we already have a valid selection only change selection if we still have a room to switch to. From f28978b85661ea1c878c27864788e0d65e68de57 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 5 May 2022 05:42:49 +0300 Subject: [PATCH 0683/2328] Handle against playlists which disallow selection `SelectedItem.Disabled` is also not checked against in the select-via-click flow inside `DrawableRoomPlaylistItem` (only `AllowSelection` is checked). --- .../Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs | 9 +++++++++ osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs index 566a8db608..d520384218 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs @@ -56,6 +56,9 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("click", () => InputManager.Click(MouseButton.Left)); AddAssert("no item selected", () => playlist.SelectedItem.Value == null); + + AddStep("press down", () => InputManager.Key(Key.Down)); + AddAssert("no item selected", () => playlist.SelectedItem.Value == null); } [Test] @@ -73,6 +76,9 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("click", () => InputManager.Click(MouseButton.Left)); AddAssert("no item selected", () => playlist.SelectedItem.Value == null); + + AddStep("press down", () => InputManager.Key(Key.Down)); + AddAssert("no item selected", () => playlist.SelectedItem.Value == null); } [Test] @@ -91,6 +97,9 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("click", () => InputManager.Click(MouseButton.Left)); AddAssert("no item selected", () => playlist.SelectedItem.Value == null); + + AddStep("press down", () => InputManager.Key(Key.Down)); + AddAssert("no item selected", () => playlist.SelectedItem.Value == null); } [Test] diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs index d1b83c3749..840fc48613 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs @@ -217,7 +217,7 @@ namespace osu.Game.Screens.OnlinePlay private void selectNext(int direction) { - if (SelectedItem.Disabled) + if (!AllowSelection) return; var visibleItems = ListContainer.AsEnumerable().Where(r => r.IsPresent); From a26793cd654a29ada9d9d0234e796f531cd404c8 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 5 May 2022 06:12:24 +0300 Subject: [PATCH 0684/2328] Add missing `Test` prefix --- .../Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs index d520384218..e2b4b2870f 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs @@ -157,7 +157,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] - public void KeyboardSelection() + public void TestKeyboardSelection() { createPlaylist(p => p.AllowSelection = true); From e3c7c5d0b9ceca3ea19683280321c66e08155c42 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 5 May 2022 08:12:54 +0300 Subject: [PATCH 0685/2328] Improve validity methods to include system, non-implemented, and multi mods --- osu.Game/Utils/ModUtils.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/osu.Game/Utils/ModUtils.cs b/osu.Game/Utils/ModUtils.cs index 40db981ef0..f11a06e3be 100644 --- a/osu.Game/Utils/ModUtils.cs +++ b/osu.Game/Utils/ModUtils.cs @@ -115,12 +115,15 @@ namespace osu.Game.Utils { mods = mods.ToArray(); - // exclude multi mods from compatibility checks. - // the loop below automatically marks all multi mods as not valid for gameplay anyway. - if (!CheckCompatibleSet(mods.Where(m => !(m is MultiMod)), out invalidMods)) + // checking compatibility of multi mods would try to flatten them and return incompatible mods. + // in gameplay context, we never want MultiMod selected in the first place, therefore check against it first. + if (!checkValid(mods, m => !(m is MultiMod), out invalidMods)) return false; - return checkValid(mods, m => m.Type != ModType.System && m.HasImplementation && !(m is MultiMod), out invalidMods); + if (!CheckCompatibleSet(mods, out invalidMods)) + return false; + + return checkValid(mods, m => m.Type != ModType.System && m.HasImplementation, out invalidMods); } /// @@ -133,10 +136,15 @@ namespace osu.Game.Utils { mods = mods.ToArray(); + // checking compatibility of multi mods would try to flatten them and return incompatible mods. + // in gameplay context, we never want MultiMod selected in the first place, therefore check against it first. + if (!checkValid(mods, m => !(m is MultiMod), out invalidMods)) + return false; + if (!CheckCompatibleSet(mods, out invalidMods)) return false; - return checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerGlobal), out invalidMods); + return checkValid(mods, m => m.Type != ModType.System && m.HasImplementation && m.IsPlayable(ModUsage.MultiplayerGlobal), out invalidMods); } /// @@ -146,7 +154,7 @@ namespace osu.Game.Utils /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidFreeModsForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) - => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerLocal), out invalidMods); + => checkValid(mods, m => m.Type != ModType.System && m.HasImplementation && m.IsPlayable(ModUsage.MultiplayerLocal) && !(m is MultiMod), out invalidMods); private static bool checkValid(IEnumerable mods, Predicate valid, [NotNullWhen(false)] out List? invalidMods) { From 86aa2125fe9878eda71857a0e1d0ca0823ab2899 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 5 May 2022 08:13:29 +0300 Subject: [PATCH 0686/2328] Add test coverage for multiplayer mod validity methods --- osu.Game.Tests/Mods/ModUtilsTest.cs | 161 ++++++++++++++++++++++++++-- 1 file changed, 153 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Mods/ModUtilsTest.cs b/osu.Game.Tests/Mods/ModUtilsTest.cs index 4c126f0a3b..2447233d3c 100644 --- a/osu.Game.Tests/Mods/ModUtilsTest.cs +++ b/osu.Game.Tests/Mods/ModUtilsTest.cs @@ -137,33 +137,137 @@ namespace osu.Game.Tests.Mods // incompatible pair. new object[] { - new Mod[] { new OsuModDoubleTime(), new OsuModHalfTime() }, - new[] { typeof(OsuModDoubleTime), typeof(OsuModHalfTime) } + new Mod[] { new OsuModHidden(), new OsuModApproachDifferent() }, + new[] { typeof(OsuModHidden), typeof(OsuModApproachDifferent) } }, // incompatible pair with derived class. new object[] { - new Mod[] { new OsuModNightcore(), new OsuModHalfTime() }, - new[] { typeof(OsuModNightcore), typeof(OsuModHalfTime) } + new Mod[] { new OsuModDeflate(), new OsuModApproachDifferent() }, + new[] { typeof(OsuModDeflate), typeof(OsuModApproachDifferent) } }, // system mod. new object[] { - new Mod[] { new OsuModDoubleTime(), new OsuModTouchDevice() }, + new Mod[] { new OsuModHidden(), new OsuModTouchDevice() }, new[] { typeof(OsuModTouchDevice) } }, // multi mod. new object[] { - new Mod[] { new MultiMod(new OsuModHalfTime()), new OsuModDaycore() }, + new Mod[] { new MultiMod(new OsuModSuddenDeath(), new OsuModPerfect()) }, new[] { typeof(MultiMod) } }, + // invalid multiplayer mod is valid for local. + new object[] + { + new Mod[] { new OsuModHidden(), new InvalidMultiplayerMod() }, + null + }, + // invalid free mod is valid for local. + new object[] + { + new Mod[] { new OsuModHidden(), new InvalidMultiplayerFreeMod() }, + null + }, // valid pair. new object[] { - new Mod[] { new OsuModDoubleTime(), new OsuModHardRock() }, + new Mod[] { new OsuModHidden(), new OsuModHardRock() }, null - } + }, + }; + + private static readonly object[] invalid_multiplayer_mod_test_scenarios = + { + // incompatible pair. + new object[] + { + new Mod[] { new OsuModHidden(), new OsuModApproachDifferent() }, + new[] { typeof(OsuModHidden), typeof(OsuModApproachDifferent) } + }, + // incompatible pair with derived class. + new object[] + { + new Mod[] { new OsuModDeflate(), new OsuModApproachDifferent() }, + new[] { typeof(OsuModDeflate), typeof(OsuModApproachDifferent) } + }, + // system mod. + new object[] + { + new Mod[] { new OsuModHidden(), new OsuModTouchDevice() }, + new[] { typeof(OsuModTouchDevice) } + }, + // multi mod. + new object[] + { + new Mod[] { new MultiMod(new OsuModSuddenDeath(), new OsuModPerfect()) }, + new[] { typeof(MultiMod) } + }, + // invalid multiplayer mod. + new object[] + { + new Mod[] { new OsuModHidden(), new InvalidMultiplayerMod() }, + new[] { typeof(InvalidMultiplayerMod) } + }, + // invalid free mod is valid for multiplayer global. + new object[] + { + new Mod[] { new OsuModHidden(), new InvalidMultiplayerFreeMod() }, + null + }, + // valid pair. + new object[] + { + new Mod[] { new OsuModHidden(), new OsuModHardRock() }, + null + }, + }; + + private static readonly object[] invalid_free_mod_test_scenarios = + { + // system mod. + new object[] + { + new Mod[] { new OsuModHidden(), new OsuModTouchDevice() }, + new[] { typeof(OsuModTouchDevice) } + }, + // multi mod. + new object[] + { + new Mod[] { new MultiMod(new OsuModSuddenDeath(), new OsuModPerfect()) }, + new[] { typeof(MultiMod) } + }, + // invalid multiplayer mod. + new object[] + { + new Mod[] { new OsuModHidden(), new InvalidMultiplayerMod() }, + new[] { typeof(InvalidMultiplayerMod) } + }, + // invalid free mod. + new object[] + { + new Mod[] { new OsuModHidden(), new InvalidMultiplayerFreeMod() }, + new[] { typeof(InvalidMultiplayerFreeMod) } + }, + // incompatible pair is valid for free mods. + new object[] + { + new Mod[] { new OsuModHidden(), new OsuModApproachDifferent() }, + null, + }, + // incompatible pair with derived class is valid for free mods. + new object[] + { + new Mod[] { new OsuModDeflate(), new OsuModSpinIn() }, + null, + }, + // valid pair. + new object[] + { + new Mod[] { new OsuModHidden(), new OsuModHardRock() }, + null + }, }; [TestCaseSource(nameof(invalid_mod_test_scenarios))] @@ -179,6 +283,32 @@ namespace osu.Game.Tests.Mods Assert.That(invalid.Select(t => t.GetType()), Is.EquivalentTo(expectedInvalid)); } + [TestCaseSource(nameof(invalid_multiplayer_mod_test_scenarios))] + public void TestInvalidMultiplayerModScenarios(Mod[] inputMods, Type[] expectedInvalid) + { + bool isValid = ModUtils.CheckValidRequiredModsForMultiplayer(inputMods, out var invalid); + + Assert.That(isValid, Is.EqualTo(expectedInvalid == null)); + + if (isValid) + Assert.IsNull(invalid); + else + Assert.That(invalid.Select(t => t.GetType()), Is.EquivalentTo(expectedInvalid)); + } + + [TestCaseSource(nameof(invalid_free_mod_test_scenarios))] + public void TestInvalidFreeModScenarios(Mod[] inputMods, Type[] expectedInvalid) + { + bool isValid = ModUtils.CheckValidFreeModsForMultiplayer(inputMods, out var invalid); + + Assert.That(isValid, Is.EqualTo(expectedInvalid == null)); + + if (isValid) + Assert.IsNull(invalid); + else + Assert.That(invalid.Select(t => t.GetType()), Is.EquivalentTo(expectedInvalid)); + } + public abstract class CustomMod1 : Mod, IModCompatibilitySpecification { } @@ -187,6 +317,21 @@ namespace osu.Game.Tests.Mods { } + public class InvalidMultiplayerMod : Mod + { + public override string Name => string.Empty; + public override string Description => string.Empty; + public override string Acronym => string.Empty; + public override double ScoreMultiplier => 1; + public override bool HasImplementation => true; + public override bool IsPlayable(ModUsage usage) => usage == ModUsage.SoloLocal; + } + + private class InvalidMultiplayerFreeMod : InvalidMultiplayerMod + { + public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerLocal; + } + public interface IModCompatibilitySpecification { } From 326ff3b6e9998d1e67cc41f2fa26c70eca456e4a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 14:55:05 +0900 Subject: [PATCH 0687/2328] Fix `CurrentDialog` being updated twice, unsafe variable access --- osu.Game/Overlays/DialogOverlay.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index a8c3c392e0..c46f36b4df 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -50,17 +50,17 @@ namespace osu.Game.Overlays if (dialog == CurrentDialog || dialog.State.Value != Visibility.Visible) return; var lastDialog = CurrentDialog; + + // Immediately update the externally accessible property as this may be used for checks even before + // a DialogOverlay instance has finished loading. CurrentDialog = dialog; Scheduler.Add(() => { // if any existing dialog is being displayed, dismiss it before showing a new one. lastDialog?.Hide(); - - CurrentDialog = dialog; - CurrentDialog.State.ValueChanged += state => onDialogOnStateChanged(dialog, state.NewValue); - - dialogContainer.Add(CurrentDialog); + dialog.State.ValueChanged += state => onDialogOnStateChanged(dialog, state.NewValue); + dialogContainer.Add(dialog); Show(); }, false); From f6a6a11391e934973b3449cec07700c5421d11b5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 15:02:23 +0900 Subject: [PATCH 0688/2328] Remove `DialogOverlay` local fades (is already managed by `PopupDialog`s themselves) --- osu.Game/Overlays/DialogOverlay.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index c46f36b4df..5a69562e82 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -87,18 +87,16 @@ namespace osu.Game.Overlays protected override void PopIn() { base.PopIn(); - this.FadeIn(PopupDialog.ENTER_DURATION, Easing.OutQuint); lowPassFilter.CutoffTo(300, 100, Easing.OutCubic); } protected override void PopOut() { base.PopOut(); - this.FadeOut(PopupDialog.EXIT_DURATION, Easing.InSine); - lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF, 100, Easing.InCubic); - if (CurrentDialog?.State.Value == Visibility.Visible) CurrentDialog.Hide(); + if (CurrentDialog?.State.Value == Visibility.Visible) + CurrentDialog.Hide(); } public override bool OnPressed(KeyBindingPressEvent e) From cbc58c67bfd32b0631089afd0b7ee89c0ca01ea3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 15:16:01 +0900 Subject: [PATCH 0689/2328] Remove weird strict tracking icon and reword description to explain what the mod does --- osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs b/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs index ab45e5192d..22ace52c2a 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs @@ -4,7 +4,6 @@ using System; using System.Linq; using System.Threading; -using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mods; @@ -23,9 +22,8 @@ namespace osu.Game.Rulesets.Osu.Mods { public override string Name => @"Strict Tracking"; public override string Acronym => @"ST"; - public override IconUsage? Icon => FontAwesome.Solid.PenFancy; public override ModType Type => ModType.DifficultyIncrease; - public override string Description => @"Follow circles just got serious..."; + public override string Description => @"Once you start a slider, follow precisely or get a miss."; public override double ScoreMultiplier => 1.0; public override Type[] IncompatibleMods => new[] { typeof(ModClassic), typeof(OsuModTarget) }; From f6fc926f1ade6fb5d1366edd4dd2f6632ec83913 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 15:58:21 +0900 Subject: [PATCH 0690/2328] Add xmldoc and rename methods in `IPositionSnapProvider` for legibility --- osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs | 4 ++-- .../Editor/TestSceneManiaBeatSnapGrid.cs | 4 ++-- osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs | 6 +++--- .../Editor/TestSceneOsuDistanceSnapGrid.cs | 4 ++-- .../Sliders/Components/PathControlPointVisualiser.cs | 2 +- osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 8 ++++---- .../Visual/Editing/TestSceneDistanceSnapGrid.cs | 4 ++-- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 6 +++--- osu.Game/Rulesets/Edit/IPositionSnapProvider.cs | 10 +++++++--- .../Edit/Compose/Components/BlueprintContainer.cs | 4 ++-- .../Compose/Components/ComposeBlueprintContainer.cs | 2 +- .../Edit/Compose/Components/Timeline/Timeline.cs | 4 ++-- .../Components/Timeline/TimelineHitObjectBlueprint.cs | 2 +- 13 files changed, 32 insertions(+), 28 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs index 9ff6d10a49..630a2cf645 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs @@ -89,9 +89,9 @@ namespace osu.Game.Rulesets.Catch.Edit new TernaryButton(distanceSnapToggle, "Distance Snap", () => new SpriteIcon { Icon = FontAwesome.Solid.Ruler }) }); - public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) + public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) { - var result = base.SnapScreenSpacePositionToValidTime(screenSpacePosition); + var result = base.FindSnappedPositionAndTime(screenSpacePosition); result.ScreenSpacePosition.X = screenSpacePosition.X; if (distanceSnapGrid.IsPresent && distanceSnapGrid.GetSnappedPosition(result.ScreenSpacePosition) is SnapResult snapResult && diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs index 2e55f86bb6..4bb049b1a4 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs @@ -97,12 +97,12 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor set => InternalChild = value; } - public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) + public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) { throw new System.NotImplementedException(); } - public override SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) + public override SnapResult FindSnappedPosition(Vector2 screenSpacePosition) { throw new System.NotImplementedException(); } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 2baec95c94..fef315e2ef 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -56,9 +56,9 @@ namespace osu.Game.Rulesets.Mania.Edit protected override Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpacePosition) => Playfield.GetColumnByPosition(screenSpacePosition); - public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) + public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) { - var result = base.SnapScreenSpacePositionToValidTime(screenSpacePosition); + var result = base.FindSnappedPositionAndTime(screenSpacePosition); switch (ScrollingInfo.Direction.Value) { @@ -112,7 +112,7 @@ namespace osu.Game.Rulesets.Mania.Edit } else { - var result = SnapScreenSpacePositionToValidTime(inputManager.CurrentState.Mouse.Position); + var result = FindSnappedPositionAndTime(inputManager.CurrentState.Mouse.Position); if (result.Time is double time) beatSnapGrid.SelectionTimeRange = (time, time); else diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs index 2ba30c5f74..27381d9d55 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs @@ -182,10 +182,10 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor private class SnapProvider : IDistanceSnapProvider { - public SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) => + public SnapResult FindSnappedPosition(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, null); - public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); + public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); public IBindable DistanceSpacingMultiplier { get; } = new BindableDouble(1); diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs index 5de614722f..e71bde7357 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs @@ -255,7 +255,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components { // Special handling for selections containing head control point - the position of the slider changes which means the snapped position and time have to be taken into account Vector2 newHeadPosition = Parent.ToScreenSpace(e.MousePosition + (dragStartPositions[0] - dragStartPositions[draggedControlPointIndex])); - var result = snapProvider?.SnapScreenSpacePositionToValidTime(newHeadPosition); + var result = snapProvider?.FindSnappedPositionAndTime(newHeadPosition); Vector2 movementDelta = Parent.ToLocalSpace(result?.ScreenSpacePosition ?? newHeadPosition) - slider.Position; diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index ba7c6e9d33..02beb0f2a4 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -123,7 +123,7 @@ namespace osu.Game.Rulesets.Osu.Edit } } - public override SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) + public override SnapResult FindSnappedPosition(Vector2 screenSpacePosition) { if (snapToVisibleBlueprints(screenSpacePosition, out var snapResult)) return snapResult; @@ -131,9 +131,9 @@ namespace osu.Game.Rulesets.Osu.Edit return new SnapResult(screenSpacePosition, null); } - public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) + public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) { - var positionSnap = SnapScreenSpacePositionToValidPosition(screenSpacePosition); + var positionSnap = FindSnappedPosition(screenSpacePosition); if (positionSnap.ScreenSpacePosition != screenSpacePosition) return positionSnap; @@ -149,7 +149,7 @@ namespace osu.Game.Rulesets.Osu.Edit return new SnapResult(rectangularPositionSnapGrid.ToScreenSpace(pos), null, PlayfieldAtScreenSpacePosition(screenSpacePosition)); } - return base.SnapScreenSpacePositionToValidTime(screenSpacePosition); + return base.FindSnappedPositionAndTime(screenSpacePosition); } private bool snapToVisibleBlueprints(Vector2 screenSpacePosition, out SnapResult snapResult) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs index b9cfa84a5d..1be4ac2eab 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs @@ -162,10 +162,10 @@ namespace osu.Game.Tests.Visual.Editing private class SnapProvider : IDistanceSnapProvider { - public SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) => + public SnapResult FindSnappedPosition(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, null); - public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); + public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); public IBindable DistanceSpacingMultiplier { get; } = new BindableDouble(1); diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 1c388fe68f..e0cfd5c74a 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -362,7 +362,7 @@ namespace osu.Game.Rulesets.Edit /// The most relevant . protected virtual Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpacePosition) => drawableRulesetWrapper.Playfield; - public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) + public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) { var playfield = PlayfieldAtScreenSpacePosition(screenSpacePosition); double? targetTime = null; @@ -416,9 +416,9 @@ namespace osu.Game.Rulesets.Edit #region IPositionSnapProvider - public abstract SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition); + public abstract SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition); - public virtual SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) => + public virtual SnapResult FindSnappedPosition(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, null); #endregion diff --git a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs index 8a179ed424..8b6dbb6af3 100644 --- a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs @@ -5,23 +5,27 @@ using osuTK; namespace osu.Game.Rulesets.Edit { + /// + /// A snap provider which given the position of a hit object, offers a more correct position and time value inferred from the context of the beatmap. + /// Provided values are done so in an isolated context, without consideration of other nearby hit objects. + /// public interface IPositionSnapProvider { /// /// Given a position, find a valid time and position snap. /// /// - /// This call should be equivalent to running with any additional logic that can be performed without the time immutability restriction. + /// This call should be equivalent to running with any additional logic that can be performed without the time immutability restriction. /// /// The screen-space position to be snapped. /// The time and position post-snapping. - SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition); + SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition); /// /// Given a position, find a value position snap, restricting time to its input value. /// /// The screen-space position to be snapped. /// The position post-snapping. Time will always be null. - SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition); + SnapResult FindSnappedPosition(Vector2 screenSpacePosition); } } diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index 6dc6f20cfe..186c66e0af 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -486,7 +486,7 @@ namespace osu.Game.Screens.Edit.Compose.Components Vector2 originalPosition = movementBlueprintOriginalPositions[i]; var testPosition = originalPosition + distanceTravelled; - var positionalResult = snapProvider.SnapScreenSpacePositionToValidPosition(testPosition); + var positionalResult = snapProvider.FindSnappedPosition(testPosition); if (positionalResult.ScreenSpacePosition == testPosition) continue; @@ -505,7 +505,7 @@ namespace osu.Game.Screens.Edit.Compose.Components Vector2 movePosition = movementBlueprintOriginalPositions.First() + distanceTravelled; // Retrieve a snapped position. - var result = snapProvider?.SnapScreenSpacePositionToValidTime(movePosition); + var result = snapProvider?.FindSnappedPositionAndTime(movePosition); if (result == null) { diff --git a/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs index 79b38861ee..68be20720d 100644 --- a/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs @@ -214,7 +214,7 @@ namespace osu.Game.Screens.Edit.Compose.Components private void updatePlacementPosition() { - var snapResult = Composer.SnapScreenSpacePositionToValidTime(inputManager.CurrentState.Mouse.Position); + var snapResult = Composer.FindSnappedPositionAndTime(inputManager.CurrentState.Mouse.Position); // if no time was found from positional snapping, we should still quantize to the beat. snapResult.Time ??= Beatmap.SnapTime(EditorClock.CurrentTime, null); diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index c2b2bdb861..56ff972801 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -307,10 +307,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline /// public double VisibleRange => track.Length / Zoom; - public SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) => + public SnapResult FindSnappedPosition(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, null); - public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) => + public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, beatSnapProvider.SnapTime(getTimeFromPosition(Content.ToLocalSpace(screenSpacePosition)))); private double getTimeFromPosition(Vector2 localPosition) => diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs index 6426d33e99..33ea137d51 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs @@ -382,7 +382,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline { OnDragHandled?.Invoke(e); - if (timeline.SnapScreenSpacePositionToValidTime(e.ScreenSpaceMousePosition).Time is double time) + if (timeline.FindSnappedPositionAndTime(e.ScreenSpaceMousePosition).Time is double time) { switch (hitObject) { From 1fce0da33189907d8c14588af5b35dd8b5efb13a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 16:04:34 +0900 Subject: [PATCH 0691/2328] Reword slightly, to allow better conformity with `IDistanceSnapProvider` --- osu.Game/Rulesets/Edit/IPositionSnapProvider.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs index 8b6dbb6af3..c6a365938c 100644 --- a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs @@ -6,8 +6,8 @@ using osuTK; namespace osu.Game.Rulesets.Edit { /// - /// A snap provider which given the position of a hit object, offers a more correct position and time value inferred from the context of the beatmap. - /// Provided values are done so in an isolated context, without consideration of other nearby hit objects. + /// A snap provider which given a proposed position for a hit object, potentially offers a more correct position and time value inferred from the context of the beatmap. + /// Provided values are inferred in an isolated context, without consideration of other nearby hit objects. /// public interface IPositionSnapProvider { From ac6342ff8d22213ac41a2df547ab69c816641a21 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 5 May 2022 10:16:16 +0300 Subject: [PATCH 0692/2328] Add workaround for item scrolling issue --- osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs index 840fc48613..2a72fc6eb1 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs @@ -190,7 +190,12 @@ namespace osu.Game.Screens.OnlinePlay if (SelectedItem.Value == null || !ItemMap.TryGetValue(SelectedItem.Value, out var drawableItem)) return; - ScrollContainer.ScrollIntoView(drawableItem); + // ScrollIntoView does not handle non-loaded items appropriately, delay scroll until the item finishes loading. + // see: https://github.com/ppy/osu-framework/issues/5158 + if (!drawableItem.IsLoaded) + drawableItem.OnLoadComplete += _ => ScrollContainer.ScrollIntoView(drawableItem); + else + ScrollContainer.ScrollIntoView(drawableItem); } #region Key selection logic (shared with BeatmapCarousel and RoomsContainer) From 6227e3f876bfd9d6fceebb5e2f7a8a276fdcccf6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 16:17:37 +0900 Subject: [PATCH 0693/2328] Add comprehensive documentation of `BeatmapInfo.DistanceSpacing` --- osu.Game/Beatmaps/BeatmapInfo.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 1a9703f478..abc9020dc6 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -1,21 +1,23 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Linq; using JetBrains.Annotations; using Newtonsoft.Json; using osu.Framework.Testing; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Database; using osu.Game.Models; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.BeatmapSet.Scores; using osu.Game.Rulesets; +using osu.Game.Rulesets.Edit; using osu.Game.Scoring; using Realms; -#nullable enable - namespace osu.Game.Beatmaps { /// @@ -109,6 +111,16 @@ namespace osu.Game.Beatmaps public bool SamplesMatchPlaybackRate { get; set; } = true; + /// + /// The ratio of distance travelled per time unit. + /// Generally used to decouple the spacing between hit objects from the enforced "velocity" of the beatmap (see ). + /// + /// + /// The most common method of understanding is that at a default value of 1.0, the time-to-distance ratio will match the slider velocity of the beatmap + /// at the current point in time. Increasing this value will make hit objects more spaced apart when compared to the cursor movement required to track a slider. + /// + /// This is only a hint property, used by the editor in implementations. It does not directly affect the beatmap or gameplay. + /// public double DistanceSpacing { get; set; } = 1.0; public int BeatDivisor { get; set; } From 977e6d8a8081fff93503156670ce034ec54387f7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 16:25:05 +0900 Subject: [PATCH 0694/2328] Add xmldoc for `IDistanceSnapProvider` and related properties --- .../Editor/TestSceneOsuDistanceSnapGrid.cs | 4 ++-- .../Sliders/SliderPlacementBlueprint.cs | 2 +- ...tSceneHitObjectComposerDistanceSnapping.cs | 4 ++-- .../Editing/TestSceneDistanceSnapGrid.cs | 4 ++-- .../Edit/DistancedHitObjectComposer.cs | 4 ++-- .../Rulesets/Edit/IDistanceSnapProvider.cs | 23 +++++++++++-------- .../Rulesets/Objects/SliderPathExtensions.cs | 2 +- .../Components/CircularDistanceSnapGrid.cs | 2 +- 8 files changed, 25 insertions(+), 20 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs index 2ba30c5f74..2ea39e47f4 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs @@ -195,9 +195,9 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor public double DistanceToDuration(HitObject referenceObject, float distance) => distance; - public double GetSnappedDurationFromDistance(HitObject referenceObject, float distance) => 0; + public double FindSnappedDuration(HitObject referenceObject, float distance) => 0; - public float GetSnappedDistanceFromDistance(HitObject referenceObject, float distance) => 0; + public float FindSnappedDistance(HitObject referenceObject, float distance) => 0; } } } diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs index 73a4ea5434..501589987d 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs @@ -220,7 +220,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders private void updateSlider() { - HitObject.Path.ExpectedDistance.Value = snapProvider?.GetSnappedDistanceFromDistance(HitObject, (float)HitObject.Path.CalculatedDistance) ?? (float)HitObject.Path.CalculatedDistance; + HitObject.Path.ExpectedDistance.Value = snapProvider?.FindSnappedDistance(HitObject, (float)HitObject.Path.CalculatedDistance) ?? (float)HitObject.Path.CalculatedDistance; bodyPiece.UpdateFrom(HitObject); headCirclePiece.UpdateFrom(HitObject.HeadCircle); diff --git a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs index a2ee97210a..82fc7a208b 100644 --- a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs +++ b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs @@ -213,10 +213,10 @@ namespace osu.Game.Tests.Editing => AddAssert($"distance = {distance} -> duration = {expectedDuration}", () => composer.DistanceToDuration(new HitObject(), distance) == expectedDuration); private void assertSnappedDuration(float distance, double expectedDuration) - => AddAssert($"distance = {distance} -> duration = {expectedDuration} (snapped)", () => composer.GetSnappedDurationFromDistance(new HitObject(), distance) == expectedDuration); + => AddAssert($"distance = {distance} -> duration = {expectedDuration} (snapped)", () => composer.FindSnappedDuration(new HitObject(), distance) == expectedDuration); private void assertSnappedDistance(float distance, float expectedDistance) - => AddAssert($"distance = {distance} -> distance = {expectedDistance} (snapped)", () => composer.GetSnappedDistanceFromDistance(new HitObject(), distance) == expectedDistance); + => AddAssert($"distance = {distance} -> distance = {expectedDistance} (snapped)", () => composer.FindSnappedDistance(new HitObject(), distance) == expectedDistance); private class TestHitObjectComposer : OsuHitObjectComposer { diff --git a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs index b9cfa84a5d..7cb1e8f36a 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs @@ -175,9 +175,9 @@ namespace osu.Game.Tests.Visual.Editing public double DistanceToDuration(HitObject referenceObject, float distance) => distance; - public double GetSnappedDurationFromDistance(HitObject referenceObject, float distance) => 0; + public double FindSnappedDuration(HitObject referenceObject, float distance) => 0; - public float GetSnappedDistanceFromDistance(HitObject referenceObject, float distance) => 0; + public float FindSnappedDistance(HitObject referenceObject, float distance) => 0; } } } diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index 680fc9aaa8..2280211421 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -146,10 +146,10 @@ namespace osu.Game.Rulesets.Edit return distance / GetBeatSnapDistanceAt(referenceObject) * beatLength; } - public virtual double GetSnappedDurationFromDistance(HitObject referenceObject, float distance) + public virtual double FindSnappedDuration(HitObject referenceObject, float distance) => BeatSnapProvider.SnapTime(referenceObject.StartTime + DistanceToDuration(referenceObject, distance), referenceObject.StartTime) - referenceObject.StartTime; - public virtual float GetSnappedDistanceFromDistance(HitObject referenceObject, float distance) + public virtual float FindSnappedDistance(HitObject referenceObject, float distance) { double startTime = referenceObject.StartTime; diff --git a/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs index c6e866561e..8e4e9afb1c 100644 --- a/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs @@ -7,10 +7,13 @@ using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Edit { + /// + /// A snap provider which given a reference hit object and proposed distance from it, offers a more correct duration or distance value. + /// public interface IDistanceSnapProvider : IPositionSnapProvider { /// - /// The spacing multiplier applied to beat snap distances. + /// A multiplier which changes the ratio of distance travelled per time unit. /// /// IBindable DistanceSpacingMultiplier { get; } @@ -23,7 +26,7 @@ namespace osu.Game.Rulesets.Edit float GetBeatSnapDistanceAt(HitObject referenceObject); /// - /// Converts a duration to a distance. + /// Converts a duration to a distance without applying any snapping. /// /// An object to be used as a reference point for this operation. /// The duration to convert. @@ -31,7 +34,7 @@ namespace osu.Game.Rulesets.Edit float DurationToDistance(HitObject referenceObject, double duration); /// - /// Converts a distance to a duration. + /// Converts a distance to a duration without applying any snapping. /// /// An object to be used as a reference point for this operation. /// The distance to convert. @@ -39,20 +42,22 @@ namespace osu.Game.Rulesets.Edit double DistanceToDuration(HitObject referenceObject, float distance); /// - /// Converts a distance to a snapped duration. + /// Given a distance from the provided hit object, find the valid snapped duration. /// /// An object to be used as a reference point for this operation. /// The distance to convert. /// A value that represents as a duration snapped to the closest beat of the timing point. - double GetSnappedDurationFromDistance(HitObject referenceObject, float distance); + double FindSnappedDuration(HitObject referenceObject, float distance); /// - /// Converts an unsnapped distance to a snapped distance. - /// The returned distance will always be floored (as to never exceed the provided . + /// Given a distance from the provided hit object, find the valid snapped distance. /// /// An object to be used as a reference point for this operation. /// The distance to convert. - /// A value that represents snapped to the closest beat of the timing point. - float GetSnappedDistanceFromDistance(HitObject referenceObject, float distance); + /// + /// A value that represents snapped to the closest beat of the timing point. + /// The distance will always be less than or equal to the provided . + /// + float FindSnappedDistance(HitObject referenceObject, float distance); } } diff --git a/osu.Game/Rulesets/Objects/SliderPathExtensions.cs b/osu.Game/Rulesets/Objects/SliderPathExtensions.cs index 3100d26a55..dd418a1b7b 100644 --- a/osu.Game/Rulesets/Objects/SliderPathExtensions.cs +++ b/osu.Game/Rulesets/Objects/SliderPathExtensions.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Objects public static void SnapTo(this THitObject hitObject, IDistanceSnapProvider? snapProvider) where THitObject : HitObject, IHasPath { - hitObject.Path.ExpectedDistance.Value = snapProvider?.GetSnappedDistanceFromDistance(hitObject, (float)hitObject.Path.CalculatedDistance) ?? hitObject.Path.CalculatedDistance; + hitObject.Path.ExpectedDistance.Value = snapProvider?.FindSnappedDistance(hitObject, (float)hitObject.Path.CalculatedDistance) ?? hitObject.Path.CalculatedDistance; } /// diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index 6b32ff96c4..50d5f0389a 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -80,7 +80,7 @@ namespace osu.Game.Screens.Edit.Compose.Components Vector2 normalisedDirection = direction * new Vector2(1f / distance); Vector2 snappedPosition = StartPosition + normalisedDirection * radialCount * radius; - return (snappedPosition, StartTime + SnapProvider.GetSnappedDurationFromDistance(ReferenceObject, (snappedPosition - StartPosition).Length)); + return (snappedPosition, StartTime + SnapProvider.FindSnappedDuration(ReferenceObject, (snappedPosition - StartPosition).Length)); } } } From b411b59006da5cfbb5d39cd0e0754db943b3f298 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 16:32:14 +0900 Subject: [PATCH 0695/2328] Move `IPlacementHandler` caching to interface --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 1 - osu.Game/Screens/Edit/Compose/IPlacementHandler.cs | 2 ++ osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 1c388fe68f..fdc12bf549 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -35,7 +35,6 @@ namespace osu.Game.Rulesets.Edit /// Responsible for providing snapping and generally gluing components together. /// /// The base type of supported objects. - [Cached(Type = typeof(IPlacementHandler))] public abstract class HitObjectComposer : HitObjectComposer, IPlacementHandler where TObject : HitObject { diff --git a/osu.Game/Screens/Edit/Compose/IPlacementHandler.cs b/osu.Game/Screens/Edit/Compose/IPlacementHandler.cs index aefcbc6542..59eb13cae5 100644 --- a/osu.Game/Screens/Edit/Compose/IPlacementHandler.cs +++ b/osu.Game/Screens/Edit/Compose/IPlacementHandler.cs @@ -1,10 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; using osu.Game.Rulesets.Objects; namespace osu.Game.Screens.Edit.Compose { + [Cached] public interface IPlacementHandler { /// diff --git a/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs b/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs index b2f5b1754f..b981a31bd1 100644 --- a/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs +++ b/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs @@ -14,7 +14,6 @@ using osu.Game.Screens.Edit.Compose; namespace osu.Game.Tests.Visual { - [Cached(Type = typeof(IPlacementHandler))] public abstract class PlacementBlueprintTestScene : OsuManualInputManagerTestScene, IPlacementHandler { protected readonly Container HitObjectContainer; From 1c6a233cc0daba2519a3ba54609ebabea6c7c637 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 16:35:52 +0900 Subject: [PATCH 0696/2328] Move snap provider caching to interfaces --- osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs | 1 - osu.Game/Rulesets/Edit/HitObjectComposer.cs | 1 - osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs | 2 ++ osu.Game/Rulesets/Edit/IPositionSnapProvider.cs | 2 ++ osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs | 1 - 5 files changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index 680fc9aaa8..7a997bb423 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -23,7 +23,6 @@ namespace osu.Game.Rulesets.Edit /// Represents a for rulesets with the concept of distances between objects. /// /// The base type of supported objects. - [Cached(typeof(IDistanceSnapProvider))] public abstract class DistancedHitObjectComposer : HitObjectComposer, IDistanceSnapProvider, IScrollBindingHandler where TObject : HitObject { diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index fdc12bf549..c384eb4ea9 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -388,7 +388,6 @@ namespace osu.Game.Rulesets.Edit /// Generally used to access certain methods without requiring a generic type for . /// [Cached(typeof(HitObjectComposer))] - [Cached(typeof(IPositionSnapProvider))] public abstract class HitObjectComposer : CompositeDrawable, IPositionSnapProvider { protected HitObjectComposer() diff --git a/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs index c6e866561e..7850edf3f1 100644 --- a/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs @@ -1,12 +1,14 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Edit { + [Cached] public interface IDistanceSnapProvider : IPositionSnapProvider { /// diff --git a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs index 8a179ed424..d7379b26ce 100644 --- a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs @@ -1,10 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; using osuTK; namespace osu.Game.Rulesets.Edit { + [Cached] public interface IPositionSnapProvider { /// diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index c2b2bdb861..f91b321835 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -19,7 +19,6 @@ using osuTK; namespace osu.Game.Screens.Edit.Compose.Components.Timeline { - [Cached(typeof(IPositionSnapProvider))] [Cached] public class Timeline : ZoomableScrollContainer, IPositionSnapProvider { From 5a1ac71d90fdb698d6e8e2a68ef7779faf651acd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 16:42:57 +0900 Subject: [PATCH 0697/2328] Remove unnecessary type specification in `HitObjectComposer`'s caching --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index c384eb4ea9..b97690c9e0 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -387,7 +387,7 @@ namespace osu.Game.Rulesets.Edit /// A non-generic definition of a HitObject composer class. /// Generally used to access certain methods without requiring a generic type for . /// - [Cached(typeof(HitObjectComposer))] + [Cached] public abstract class HitObjectComposer : CompositeDrawable, IPositionSnapProvider { protected HitObjectComposer() From c3d2648f85bd87289cb58a5622038e2f4d44e7f4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 17:07:05 +0900 Subject: [PATCH 0698/2328] Reword weird xmldoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- osu.Game/Rulesets/Edit/IPositionSnapProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs index c6a365938c..200005cb11 100644 --- a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Edit SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition); /// - /// Given a position, find a value position snap, restricting time to its input value. + /// Given a position, find a valid position snap, without changing the time value. /// /// The screen-space position to be snapped. /// The position post-snapping. Time will always be null. From de9b3d33ebfba7beefe36f659e3a8aa77ab6a7eb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 17:00:36 +0900 Subject: [PATCH 0699/2328] Rename misleading `DistanceSpacing` variable --- .../Editor/TestSceneOsuDistanceSnapGrid.cs | 16 +++------------- .../Visual/Editing/TestSceneDistanceSnapGrid.cs | 10 +++++----- .../Components/CircularDistanceSnapGrid.cs | 10 +++++----- .../Edit/Compose/Components/DistanceSnapGrid.cs | 8 ++++---- 4 files changed, 17 insertions(+), 27 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs index 368166157d..015a922719 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor [Cached(typeof(IDistanceSnapProvider))] private readonly SnapProvider snapProvider = new SnapProvider(); - private TestOsuDistanceSnapGrid grid; + private OsuDistanceSnapGrid grid; public TestSceneOsuDistanceSnapGrid() { @@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor RelativeSizeAxes = Axes.Both, Colour = Color4.SlateGray }, - grid = new TestOsuDistanceSnapGrid(new HitCircle { Position = grid_position }), + grid = new OsuDistanceSnapGrid(new HitCircle { Position = grid_position }), new SnappingCursorContainer { GetSnapPosition = v => grid.GetSnappedPosition(grid.ToLocalSpace(v)).position } }; }); @@ -115,7 +115,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor RelativeSizeAxes = Axes.Both, Colour = Color4.SlateGray }, - grid = new TestOsuDistanceSnapGrid(new HitCircle { Position = grid_position }, new HitCircle { StartTime = 200 }), + grid = new OsuDistanceSnapGrid(new HitCircle { Position = grid_position }, new HitCircle { StartTime = 200 }), new SnappingCursorContainer { GetSnapPosition = v => grid.GetSnappedPosition(grid.ToLocalSpace(v)).position } }; }); @@ -170,16 +170,6 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor } } - private class TestOsuDistanceSnapGrid : OsuDistanceSnapGrid - { - public new float DistanceSpacing => base.DistanceSpacing; - - public TestOsuDistanceSnapGrid(OsuHitObject hitObject, OsuHitObject nextHitObject = null) - : base(hitObject, nextHitObject) - { - } - } - private class SnapProvider : IDistanceSnapProvider { public SnapResult FindSnappedPosition(Vector2 screenSpacePosition) => diff --git a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs index 38c0808a71..cdaa3739b7 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs @@ -87,7 +87,7 @@ namespace osu.Game.Tests.Visual.Editing private class TestDistanceSnapGrid : DistanceSnapGrid { - public new float DistanceSpacing => base.DistanceSpacing; + public new float DistanceBetweenTick => base.DistanceBetweenTick; public TestDistanceSnapGrid(double? endTime = null) : base(new HitObject(), grid_position, 0, endTime) @@ -105,7 +105,7 @@ namespace osu.Game.Tests.Visual.Editing int indexFromPlacement = 0; - for (float s = StartPosition.X + DistanceSpacing; s <= DrawWidth && indexFromPlacement < MaxIntervals; s += DistanceSpacing, indexFromPlacement++) + for (float s = StartPosition.X + DistanceBetweenTick; s <= DrawWidth && indexFromPlacement < MaxIntervals; s += DistanceBetweenTick, indexFromPlacement++) { AddInternal(new Circle { @@ -118,7 +118,7 @@ namespace osu.Game.Tests.Visual.Editing indexFromPlacement = 0; - for (float s = StartPosition.X - DistanceSpacing; s >= 0 && indexFromPlacement < MaxIntervals; s -= DistanceSpacing, indexFromPlacement++) + for (float s = StartPosition.X - DistanceBetweenTick; s >= 0 && indexFromPlacement < MaxIntervals; s -= DistanceBetweenTick, indexFromPlacement++) { AddInternal(new Circle { @@ -131,7 +131,7 @@ namespace osu.Game.Tests.Visual.Editing indexFromPlacement = 0; - for (float s = StartPosition.Y + DistanceSpacing; s <= DrawHeight && indexFromPlacement < MaxIntervals; s += DistanceSpacing, indexFromPlacement++) + for (float s = StartPosition.Y + DistanceBetweenTick; s <= DrawHeight && indexFromPlacement < MaxIntervals; s += DistanceBetweenTick, indexFromPlacement++) { AddInternal(new Circle { @@ -144,7 +144,7 @@ namespace osu.Game.Tests.Visual.Editing indexFromPlacement = 0; - for (float s = StartPosition.Y - DistanceSpacing; s >= 0 && indexFromPlacement < MaxIntervals; s -= DistanceSpacing, indexFromPlacement++) + for (float s = StartPosition.Y - DistanceBetweenTick; s >= 0 && indexFromPlacement < MaxIntervals; s -= DistanceBetweenTick, indexFromPlacement++) { AddInternal(new Circle { diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index 50d5f0389a..76e429dbeb 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -30,14 +30,14 @@ namespace osu.Game.Screens.Edit.Compose.Components Position = StartPosition, Width = crosshair_thickness, EdgeSmoothness = new Vector2(1), - Height = Math.Min(crosshair_max_size, DistanceSpacing * 2), + Height = Math.Min(crosshair_max_size, DistanceBetweenTick * 2), }, new Box { Origin = Anchor.Centre, Position = StartPosition, EdgeSmoothness = new Vector2(1), - Width = Math.Min(crosshair_max_size, DistanceSpacing * 2), + Width = Math.Min(crosshair_max_size, DistanceBetweenTick * 2), Height = crosshair_thickness, } }); @@ -45,11 +45,11 @@ namespace osu.Game.Screens.Edit.Compose.Components float dx = Math.Max(StartPosition.X, DrawWidth - StartPosition.X); float dy = Math.Max(StartPosition.Y, DrawHeight - StartPosition.Y); float maxDistance = new Vector2(dx, dy).Length; - int requiredCircles = Math.Min(MaxIntervals, (int)(maxDistance / DistanceSpacing)); + int requiredCircles = Math.Min(MaxIntervals, (int)(maxDistance / DistanceBetweenTick)); for (int i = 0; i < requiredCircles; i++) { - float radius = (i + 1) * DistanceSpacing * 2; + float radius = (i + 1) * DistanceBetweenTick * 2; AddInternal(new CircularProgress { @@ -74,7 +74,7 @@ namespace osu.Game.Screens.Edit.Compose.Components float distance = direction.Length; - float radius = DistanceSpacing; + float radius = DistanceBetweenTick; int radialCount = Math.Clamp((int)MathF.Round(distance / radius), 1, MaxIntervals); Vector2 normalisedDirection = direction * new Vector2(1f / distance); diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index 5568c15514..42bb8a813d 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Edit.Compose.Components /// /// The spacing between each tick of the beat snapping grid. /// - protected float DistanceSpacing { get; private set; } + protected float DistanceBetweenTick { get; private set; } /// /// The maximum number of distance snapping intervals allowed. @@ -32,7 +32,7 @@ namespace osu.Game.Screens.Edit.Compose.Components /// /// The position which the grid should start. - /// The first beat snapping tick is located at + away from this point. + /// The first beat snapping tick is located at + away from this point. /// protected readonly Vector2 StartPosition; @@ -92,7 +92,7 @@ namespace osu.Game.Screens.Edit.Compose.Components private void updateSpacing() { - DistanceSpacing = (float)(SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * distanceSpacingMultiplier.Value); + DistanceBetweenTick = (float)(SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * distanceSpacingMultiplier.Value); if (endTime == null) MaxIntervals = int.MaxValue; @@ -100,7 +100,7 @@ namespace osu.Game.Screens.Edit.Compose.Components { // +1 is added since a snapped hitobject may have its start time slightly less than the snapped time due to floating point errors double maxDuration = endTime.Value - StartTime + 1; - MaxIntervals = (int)(maxDuration / SnapProvider.DistanceToDuration(ReferenceObject, DistanceSpacing)); + MaxIntervals = (int)(maxDuration / SnapProvider.DistanceToDuration(ReferenceObject, DistanceBetweenTick)); } gridCache.Invalidate(); From 786c7f14d3d0a2ea1db09dea4528e04a4b53e217 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 17:08:53 +0900 Subject: [PATCH 0700/2328] Expose `DistanceSpacingMultiplier` to distance --- .../Edit/Compose/Components/DistanceSnapGrid.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index 42bb8a813d..a907608cbc 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -25,6 +25,8 @@ namespace osu.Game.Screens.Edit.Compose.Components /// protected float DistanceBetweenTick { get; private set; } + protected IBindable DistanceSpacingMultiplier { get; private set; } + /// /// The maximum number of distance snapping intervals allowed. /// @@ -53,8 +55,6 @@ namespace osu.Game.Screens.Edit.Compose.Components [Resolved] private BindableBeatDivisor beatDivisor { get; set; } - private IBindable distanceSpacingMultiplier; - private readonly LayoutValue gridCache = new LayoutValue(Invalidation.RequiredParentSizeToFit); private readonly double? endTime; @@ -86,13 +86,13 @@ namespace osu.Game.Screens.Edit.Compose.Components beatDivisor.BindValueChanged(_ => updateSpacing()); - distanceSpacingMultiplier = SnapProvider.DistanceSpacingMultiplier.GetBoundCopy(); - distanceSpacingMultiplier.BindValueChanged(_ => updateSpacing(), true); + DistanceSpacingMultiplier = SnapProvider.DistanceSpacingMultiplier.GetBoundCopy(); + DistanceSpacingMultiplier.BindValueChanged(_ => updateSpacing(), true); } private void updateSpacing() { - DistanceBetweenTick = (float)(SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * distanceSpacingMultiplier.Value); + DistanceBetweenTick = (float)(SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * DistanceSpacingMultiplier.Value); if (endTime == null) MaxIntervals = int.MaxValue; From 4c884aea5d8592b810b7549ab8d6966759edf60c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 17:09:14 +0900 Subject: [PATCH 0701/2328] Fix `CircularDistanceSnapGrid` returning an incorrect time value when distance spacing is not 1.0 --- .../Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index 76e429dbeb..1c6eb98521 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -80,7 +80,7 @@ namespace osu.Game.Screens.Edit.Compose.Components Vector2 normalisedDirection = direction * new Vector2(1f / distance); Vector2 snappedPosition = StartPosition + normalisedDirection * radialCount * radius; - return (snappedPosition, StartTime + SnapProvider.FindSnappedDuration(ReferenceObject, (snappedPosition - StartPosition).Length)); + return (snappedPosition, StartTime + SnapProvider.FindSnappedDuration(ReferenceObject, (float)((snappedPosition - StartPosition).Length / DistanceSpacingMultiplier.Value))); } } } From 947a68006a6afb4f166053401bc6b01f21e78f14 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 17:50:17 +0900 Subject: [PATCH 0702/2328] Add note about `IDistanceSnapProvider` not multiplying `DistanceSpacing` itself --- osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs index 8c599f8596..b12e1437dc 100644 --- a/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs @@ -16,6 +16,7 @@ namespace osu.Game.Rulesets.Edit { /// /// A multiplier which changes the ratio of distance travelled per time unit. + /// Importantly, this is provided for manual usage, and not multiplied into any of the methods exposed by this interface. /// /// IBindable DistanceSpacingMultiplier { get; } From b2e9be70a5e3ae76a315fa346356a9348f0a590e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 17:50:33 +0900 Subject: [PATCH 0703/2328] Rewrite `CircularDistanceSnapGrid` snapping implementation to use snap provider --- .../Components/CircularDistanceSnapGrid.cs | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index 1c6eb98521..f34fa7328a 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -68,19 +68,29 @@ namespace osu.Game.Screens.Edit.Compose.Components if (MaxIntervals == 0) return (StartPosition, StartTime); - Vector2 direction = position - StartPosition; - if (direction == Vector2.Zero) - direction = new Vector2(0.001f, 0.001f); + // This grid implementation factors in the user's distance spacing specification, + // which is usually not considered by an `IDistanceSnapProvider`. + float distanceSpacing = (float)DistanceSpacingMultiplier.Value; - float distance = direction.Length; + Vector2 travelVector = (position - StartPosition); - float radius = DistanceBetweenTick; - int radialCount = Math.Clamp((int)MathF.Round(distance / radius), 1, MaxIntervals); + if (travelVector == Vector2.Zero) + return (StartPosition, StartTime); - Vector2 normalisedDirection = direction * new Vector2(1f / distance); - Vector2 snappedPosition = StartPosition + normalisedDirection * radialCount * radius; + float travelLength = travelVector.Length; - return (snappedPosition, StartTime + SnapProvider.FindSnappedDuration(ReferenceObject, (float)((snappedPosition - StartPosition).Length / DistanceSpacingMultiplier.Value))); + // FindSnappedDistance will always round down, but we want to potentially round upwards. + travelLength += DistanceBetweenTick / 2; + + // When interacting with the resolved snap provider, the distance spacing multiplier should first be removed + // to allow for snapping at a non-multiplied ratio. + float snappedDistance = SnapProvider.FindSnappedDistance(ReferenceObject, travelLength / distanceSpacing); + double snappedTime = StartTime + SnapProvider.DistanceToDuration(ReferenceObject, snappedDistance); + + // The multiplier can then be reapplied to the final position. + Vector2 snappedPosition = StartPosition + travelVector.Normalized() * snappedDistance * distanceSpacing; + + return (snappedPosition, snappedTime); } } } From 67341db0e742e302802a006d21e9c8baa2bba68a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 5 May 2022 12:40:02 +0300 Subject: [PATCH 0704/2328] Wrap `BeatmapOnlineLookupQueue` cache request in a task --- osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs b/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs index a24b6b315a..46f5b418bd 100644 --- a/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs +++ b/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs @@ -153,7 +153,7 @@ namespace osu.Game.Beatmaps } }; - cacheDownloadRequest.PerformAsync(); + Task.Run(() => cacheDownloadRequest.PerformAsync()); } private bool checkLocalCache(BeatmapSetInfo set, BeatmapInfo beatmapInfo) From 269e15c167dc53a20afd3162e936b578d8fbae4a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 5 May 2022 11:42:50 +0300 Subject: [PATCH 0705/2328] Add test coverage of distance spacing multiplier working with distance snap grid --- .../Editor/TestSceneOsuDistanceSnapGrid.cs | 12 +++++- .../Editing/TestSceneDistanceSnapGrid.cs | 37 ++++++++++++++++--- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs index 015a922719..1feb80414a 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs @@ -82,6 +82,14 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor AddStep($"set beat divisor = {divisor}", () => beatDivisor.Value = divisor); } + [TestCase(1.0f)] + [TestCase(2.0f)] + [TestCase(0.5f)] + public void TestDistanceSpacing(float multiplier) + { + AddStep($"set beat divisor = {multiplier}", () => snapProvider.DistanceSpacingMultiplier.Value = multiplier); + } + [Test] public void TestCursorInCentre() { @@ -177,7 +185,9 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); - public IBindable DistanceSpacingMultiplier { get; } = new BindableDouble(1); + public Bindable DistanceSpacingMultiplier { get; } = new BindableDouble(1); + + IBindable IDistanceSnapProvider.DistanceSpacingMultiplier => DistanceSpacingMultiplier; public float GetBeatSnapDistanceAt(HitObject referenceObject) => (float)beat_length; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs index cdaa3739b7..7d8089b435 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs @@ -21,8 +21,12 @@ namespace osu.Game.Tests.Visual.Editing public class TestSceneDistanceSnapGrid : EditorClockTestScene { private const double beat_length = 100; + private const int beat_snap_distance = 10; + private static readonly Vector2 grid_position = new Vector2(512, 384); + private TestDistanceSnapGrid grid; + [Cached(typeof(EditorBeatmap))] private readonly EditorBeatmap editorBeatmap; @@ -39,6 +43,7 @@ namespace osu.Game.Tests.Visual.Editing } }); editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = beat_length }); + editorBeatmap.Difficulty.SliderMultiplier = 1; } [SetUp] @@ -51,7 +56,7 @@ namespace osu.Game.Tests.Visual.Editing RelativeSizeAxes = Axes.Both, Colour = Color4.SlateGray }, - new TestDistanceSnapGrid() + grid = new TestDistanceSnapGrid() }; }); @@ -68,9 +73,22 @@ namespace osu.Game.Tests.Visual.Editing AddStep($"set beat divisor = {divisor}", () => BeatDivisor.Value = divisor); } - [Test] - public void TestLimitedDistance() + [TestCase(1.0)] + [TestCase(2.0)] + [TestCase(0.5)] + public void TestDistanceSpacing(double multiplier) { + AddStep($"set distance spacing = {multiplier}", () => snapProvider.DistanceSpacingMultiplier.Value = multiplier); + AddAssert("distance spacing matches multiplier", () => grid.DistanceBetweenTick == beat_snap_distance * multiplier); + } + + [TestCase(1.0)] + [TestCase(2.0)] + [TestCase(0.5)] + public void TestLimitedDistance(double multiplier) + { + const int end_time = 100; + AddStep("create limited grid", () => { Children = new Drawable[] @@ -80,15 +98,20 @@ namespace osu.Game.Tests.Visual.Editing RelativeSizeAxes = Axes.Both, Colour = Color4.SlateGray }, - new TestDistanceSnapGrid(100) + grid = new TestDistanceSnapGrid(end_time) }; }); + + AddStep($"set distance spacing = {multiplier}", () => snapProvider.DistanceSpacingMultiplier.Value = multiplier); + AddAssert("check correct interval count", () => grid.MaxIntervals == (end_time / grid.DistanceBetweenTick)); } private class TestDistanceSnapGrid : DistanceSnapGrid { public new float DistanceBetweenTick => base.DistanceBetweenTick; + public new int MaxIntervals => base.MaxIntervals; + public TestDistanceSnapGrid(double? endTime = null) : base(new HitObject(), grid_position, 0, endTime) { @@ -167,9 +190,11 @@ namespace osu.Game.Tests.Visual.Editing public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); - public IBindable DistanceSpacingMultiplier { get; } = new BindableDouble(1); + public Bindable DistanceSpacingMultiplier { get; } = new BindableDouble(1); - public float GetBeatSnapDistanceAt(HitObject referenceObject) => 10; + IBindable IDistanceSnapProvider.DistanceSpacingMultiplier => DistanceSpacingMultiplier; + + public float GetBeatSnapDistanceAt(HitObject referenceObject) => beat_snap_distance; public float DurationToDistance(HitObject referenceObject, double duration) => (float)duration; From 7b71fb860b39574c71cad2def3055750cec4bdad Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 18:25:32 +0900 Subject: [PATCH 0706/2328] Expose `DistanceSpacingMultiplier` for test usage --- osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index bbcb702bd8..5e6d9dbe34 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Edit public abstract class DistancedHitObjectComposer : HitObjectComposer, IDistanceSnapProvider, IScrollBindingHandler where TObject : HitObject { - protected Bindable DistanceSpacingMultiplier { get; } = new BindableDouble(1.0) + public Bindable DistanceSpacingMultiplier { get; } = new BindableDouble(1.0) { MinValue = 0.1, MaxValue = 6.0, From b9d8b7e413462c45871419977b67a927ace19c41 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 18:25:46 +0900 Subject: [PATCH 0707/2328] Fix end time extent not being accounted for in new snap implementation --- .../Edit/Compose/Components/CircularDistanceSnapGrid.cs | 5 +++++ .../Screens/Edit/Compose/Components/DistanceSnapGrid.cs | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index f34fa7328a..2873d74f75 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -87,6 +87,11 @@ namespace osu.Game.Screens.Edit.Compose.Components float snappedDistance = SnapProvider.FindSnappedDistance(ReferenceObject, travelLength / distanceSpacing); double snappedTime = StartTime + SnapProvider.DistanceToDuration(ReferenceObject, snappedDistance); + if (snappedTime > LatestEndTime) + { + snappedDistance = SnapProvider.DurationToDistance(ReferenceObject, LatestEndTime.Value - ReferenceObject.StartTime); + } + // The multiplier can then be reapplied to the final position. Vector2 snappedPosition = StartPosition + travelVector.Normalized() * snappedDistance * distanceSpacing; diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index a907608cbc..b9e0cfef19 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -43,6 +43,8 @@ namespace osu.Game.Screens.Edit.Compose.Components /// protected readonly double StartTime; + protected readonly double? LatestEndTime; + [Resolved] protected OsuColour Colours { get; private set; } @@ -56,7 +58,6 @@ namespace osu.Game.Screens.Edit.Compose.Components private BindableBeatDivisor beatDivisor { get; set; } private readonly LayoutValue gridCache = new LayoutValue(Invalidation.RequiredParentSizeToFit); - private readonly double? endTime; protected readonly HitObject ReferenceObject; @@ -70,7 +71,7 @@ namespace osu.Game.Screens.Edit.Compose.Components protected DistanceSnapGrid(HitObject referenceObject, Vector2 startPosition, double startTime, double? endTime = null) { ReferenceObject = referenceObject; - this.endTime = endTime; + LatestEndTime = endTime; StartPosition = startPosition; StartTime = startTime; @@ -94,12 +95,12 @@ namespace osu.Game.Screens.Edit.Compose.Components { DistanceBetweenTick = (float)(SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * DistanceSpacingMultiplier.Value); - if (endTime == null) + if (LatestEndTime == null) MaxIntervals = int.MaxValue; else { // +1 is added since a snapped hitobject may have its start time slightly less than the snapped time due to floating point errors - double maxDuration = endTime.Value - StartTime + 1; + double maxDuration = LatestEndTime.Value - StartTime + 1; MaxIntervals = (int)(maxDuration / SnapProvider.DistanceToDuration(ReferenceObject, DistanceBetweenTick)); } From 4fe23bced2da57d8931991b3df12aab667c7c6d0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 18:32:37 +0900 Subject: [PATCH 0708/2328] Update tests with new assumptions and a better snap implementation --- .../Editor/TestSceneOsuDistanceSnapGrid.cs | 53 +++++++++---------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs index 1feb80414a..201d6b5d8f 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs @@ -4,7 +4,6 @@ using System; using NUnit.Framework; using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -12,7 +11,6 @@ using osu.Framework.Input.Events; using osu.Framework.Utils; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Osu.Objects; @@ -26,16 +24,26 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor public class TestSceneOsuDistanceSnapGrid : OsuManualInputManagerTestScene { private const double beat_length = 100; + private static readonly Vector2 grid_position = new Vector2(512, 384); [Cached(typeof(EditorBeatmap))] + [Cached(typeof(IBeatSnapProvider))] private readonly EditorBeatmap editorBeatmap; + [Cached] + private readonly EditorClock editorClock; + [Cached] private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor(); [Cached(typeof(IDistanceSnapProvider))] - private readonly SnapProvider snapProvider = new SnapProvider(); + private readonly OsuHitObjectComposer snapProvider = new OsuHitObjectComposer(new OsuRuleset()) + { + // Just used for the snap implementation, so let's hide from vision. + AlwaysPresent = true, + Alpha = 0, + }; private OsuDistanceSnapGrid grid; @@ -48,14 +56,25 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor Ruleset = new OsuRuleset().RulesetInfo } }); + + editorClock = new EditorClock(editorBeatmap); + + base.Content.Children = new Drawable[] + { + snapProvider, + Content + }; } + protected override Container Content { get; } = new Container { RelativeSizeAxes = Axes.Both }; + [SetUp] public void Setup() => Schedule(() => { editorBeatmap.Difficulty.SliderMultiplier = 1; editorBeatmap.ControlPointInfo.Clear(); editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = beat_length }); + snapProvider.DistanceSpacingMultiplier.Value = 1; Children = new Drawable[] { @@ -94,20 +113,20 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor public void TestCursorInCentre() { AddStep("move mouse to centre", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position))); - assertSnappedDistance((float)beat_length); + assertSnappedDistance(0); } [Test] public void TestCursorBeforeMovementPoint() { - AddStep("move mouse to just before movement point", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position + new Vector2((float)beat_length, 0) * 1.49f))); + AddStep("move mouse to just before movement point", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position + new Vector2((float)beat_length, 0) * 1.45f))); assertSnappedDistance((float)beat_length); } [Test] public void TestCursorAfterMovementPoint() { - AddStep("move mouse to just after movement point", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position + new Vector2((float)beat_length, 0) * 1.51f))); + AddStep("move mouse to just after movement point", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position + new Vector2((float)beat_length, 0) * 1.55f))); assertSnappedDistance((float)beat_length * 2); } @@ -177,27 +196,5 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor cursor.Position = GetSnapPosition.Invoke(screenSpacePosition); } } - - private class SnapProvider : IDistanceSnapProvider - { - public SnapResult FindSnappedPosition(Vector2 screenSpacePosition) => - new SnapResult(screenSpacePosition, null); - - public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); - - public Bindable DistanceSpacingMultiplier { get; } = new BindableDouble(1); - - IBindable IDistanceSnapProvider.DistanceSpacingMultiplier => DistanceSpacingMultiplier; - - public float GetBeatSnapDistanceAt(HitObject referenceObject) => (float)beat_length; - - public float DurationToDistance(HitObject referenceObject, double duration) => (float)duration; - - public double DistanceToDuration(HitObject referenceObject, float distance) => distance; - - public double FindSnappedDuration(HitObject referenceObject, float distance) => 0; - - public float FindSnappedDistance(HitObject referenceObject, float distance) => 0; - } } } From 9fd98b80608e42182df12ced2ebec96b19d2e3db Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 18:41:25 +0900 Subject: [PATCH 0709/2328] Also add test coverage of adjsuting the distance spacing multiplier --- .../Editor/TestSceneOsuDistanceSnapGrid.cs | 47 +++++++++++-------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs index 201d6b5d8f..6d0ed15e45 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs @@ -7,7 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.Events; +using osu.Framework.Input; using osu.Framework.Utils; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Edit; @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor { public class TestSceneOsuDistanceSnapGrid : OsuManualInputManagerTestScene { - private const double beat_length = 100; + private const float beat_length = 100; private static readonly Vector2 grid_position = new Vector2(512, 384); @@ -119,15 +119,27 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor [Test] public void TestCursorBeforeMovementPoint() { - AddStep("move mouse to just before movement point", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position + new Vector2((float)beat_length, 0) * 1.45f))); - assertSnappedDistance((float)beat_length); + AddStep("move mouse to just before movement point", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position + new Vector2(beat_length, 0) * 1.45f))); + assertSnappedDistance(beat_length); } [Test] public void TestCursorAfterMovementPoint() { - AddStep("move mouse to just after movement point", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position + new Vector2((float)beat_length, 0) * 1.55f))); - assertSnappedDistance((float)beat_length * 2); + AddStep("move mouse to just after movement point", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position + new Vector2(beat_length, 0) * 1.55f))); + assertSnappedDistance(beat_length * 2); + } + + [TestCase(0.5f, beat_length * 2)] + [TestCase(1, beat_length * 2)] + [TestCase(1.5f, beat_length * 1.5f)] + [TestCase(2f, beat_length * 2)] + public void TestDistanceSpacingAdjust(float multiplier, float expectedDistance) + { + AddStep($"Set distance spacing to {multiplier}", () => snapProvider.DistanceSpacingMultiplier.Value = multiplier); + AddStep("move mouse to point", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position + new Vector2(beat_length, 0) * 2))); + + assertSnappedDistance(expectedDistance); } [Test] @@ -147,8 +159,8 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor }; }); - AddStep("move mouse outside grid", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position + new Vector2((float)beat_length, 0) * 3f))); - assertSnappedDistance((float)beat_length * 2); + AddStep("move mouse outside grid", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position + new Vector2(beat_length, 0) * 3f))); + assertSnappedDistance(beat_length * 2); } private void assertSnappedDistance(float expectedDistance) => AddAssert($"snap distance = {expectedDistance}", () => @@ -164,6 +176,10 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor private readonly Drawable cursor; + private InputManager inputManager; + + public override bool HandlePositionalInput => true; + public SnappingCursorContainer() { RelativeSizeAxes = Axes.Both; @@ -180,20 +196,13 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor { base.LoadComplete(); - updatePosition(GetContainingInputManager().CurrentState.Mouse.Position); + inputManager = GetContainingInputManager(); } - protected override bool OnMouseMove(MouseMoveEvent e) + protected override void Update() { - base.OnMouseMove(e); - - updatePosition(e.ScreenSpaceMousePosition); - return true; - } - - private void updatePosition(Vector2 screenSpacePosition) - { - cursor.Position = GetSnapPosition.Invoke(screenSpacePosition); + base.Update(); + cursor.Position = GetSnapPosition.Invoke(inputManager.CurrentState.Mouse.Position); } } } From e7205d8593ec1ab27528137eed48b2002d61cd85 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 19:09:56 +0900 Subject: [PATCH 0710/2328] Reset all test data before each test method to avoid channels stuck in joined state --- .../Visual/Online/TestSceneChatOverlayV2.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 9d4de11c5a..b15a7afbf9 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -31,22 +31,20 @@ namespace osu.Game.Tests.Visual.Online private ChatOverlayV2 chatOverlay; private ChannelManager channelManager; - private readonly APIUser testUser; - private readonly Channel testPMChannel; - private readonly Channel[] testChannels; + private APIUser testUser; + private Channel testPMChannel; + private Channel[] testChannels; + private Channel testChannel1 => testChannels[0]; private Channel testChannel2 => testChannels[1]; - public TestSceneChatOverlayV2() - { - testUser = new APIUser { Username = "test user", Id = 5071479 }; - testPMChannel = new Channel(testUser); - testChannels = Enumerable.Range(1, 10).Select(createPublicChannel).ToArray(); - } - [SetUp] public void SetUp() => Schedule(() => { + testUser = new APIUser { Username = "test user", Id = 5071479 }; + testPMChannel = new Channel(testUser); + testChannels = Enumerable.Range(1, 10).Select(createPublicChannel).ToArray(); + Child = new DependencyProvidingContainer { RelativeSizeAxes = Axes.Both, From 25ea660b0b7f449bb74280a09b3f31db5b471d67 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 19:13:48 +0900 Subject: [PATCH 0711/2328] Replace `HandlePositionalInput` override with simple hover effect --- osu.Game/Overlays/Chat/ChatOverlayTopBar.cs | 24 +++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatOverlayTopBar.cs b/osu.Game/Overlays/Chat/ChatOverlayTopBar.cs index 9ba7608d89..3a8cd1fb91 100644 --- a/osu.Game/Overlays/Chat/ChatOverlayTopBar.cs +++ b/osu.Game/Overlays/Chat/ChatOverlayTopBar.cs @@ -4,31 +4,35 @@ #nullable enable using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osuTK; +using osuTK.Graphics; namespace osu.Game.Overlays.Chat { public class ChatOverlayTopBar : Container { - // IsHovered is used by overlay - public override bool HandlePositionalInput => true; + private Box background = null!; + + private Color4 backgroundColour; [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider, TextureStore textures) { Children = new Drawable[] { - new Box + background = new Box { RelativeSizeAxes = Axes.Both, - Colour = colourProvider.Background3, + Colour = backgroundColour = colourProvider.Background3, }, new GridContainer { @@ -63,5 +67,17 @@ namespace osu.Game.Overlays.Chat }, }; } + + protected override bool OnHover(HoverEvent e) + { + background.FadeColour(backgroundColour.Lighten(0.1f), 300, Easing.OutQuint); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + background.FadeColour(backgroundColour, 300, Easing.OutQuint); + base.OnHoverLost(e); + } } } From 74505ba1666e821c905d27325bb86f7e0236aa2a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 19:16:19 +0900 Subject: [PATCH 0712/2328] Remove `!` usage (also seems to fix height saving/loading) --- osu.Game/Overlays/ChatOverlayV2.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 658a28bfdb..ae4e160de5 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -39,7 +39,8 @@ namespace osu.Game.Overlays private ChatTextBar textBar = null!; private Container currentChannelContainer = null!; - private Bindable? chatHeight; + private readonly Bindable chatHeight = new Bindable(); + private bool isDraggingTopBar; private float dragStartChatHeight; @@ -137,7 +138,8 @@ namespace osu.Game.Overlays loading.Show(); - chatHeight = config.GetBindable(OsuSetting.ChatDisplayHeight).GetBoundCopy(); + config.BindWith(OsuSetting.ChatDisplayHeight, chatHeight); + chatHeight.BindValueChanged(height => { Height = height.NewValue; }, true); currentChannel.BindTo(channelManager.CurrentChannel); @@ -193,7 +195,7 @@ namespace osu.Game.Overlays if (!isDraggingTopBar) return base.OnDragStart(e); - dragStartChatHeight = chatHeight!.Value; + dragStartChatHeight = chatHeight.Value; return true; } @@ -203,7 +205,7 @@ namespace osu.Game.Overlays return; float targetChatHeight = dragStartChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y; - chatHeight!.Value = targetChatHeight; + chatHeight.Value = targetChatHeight; } protected override void OnDragEnd(DragEndEvent e) From e54f5e2d9206f49b387beda75f70e9fcfddc5a4e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 19:17:32 +0900 Subject: [PATCH 0713/2328] Adjust value change variables to avoid `e` usage --- osu.Game/Overlays/ChatOverlayV2.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index ae4e160de5..8a73eabed2 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -238,9 +238,9 @@ namespace osu.Game.Overlays base.OnFocus(e); } - private void currentChannelChanged(ValueChangedEvent e) + private void currentChannelChanged(ValueChangedEvent channel) { - Channel? newChannel = e.NewValue; + Channel? newChannel = channel.NewValue; loading.Show(); @@ -248,7 +248,7 @@ namespace osu.Game.Overlays if (newChannel == null) { // Find another channel to switch to - newChannel = channelManager.JoinedChannels.FirstOrDefault(chan => chan != e.OldValue); + newChannel = channelManager.JoinedChannels.FirstOrDefault(c => c != channel.OldValue); if (newChannel == null) selectorActive.Value = true; From 97221d2ef1ee5b88464fc2bdbbe7dc372d05c882 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 19:22:30 +0900 Subject: [PATCH 0714/2328] Tidy up initialisation --- osu.Game/Overlays/ChatOverlayV2.cs | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 8a73eabed2..16da1f7c10 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -64,20 +64,27 @@ namespace osu.Game.Overlays [Cached] private readonly Bindable currentChannel = new Bindable(); + public ChatOverlayV2() + { + Height = default_chat_height; + + Masking = true; + + const float corner_radius = 7f; + + CornerRadius = corner_radius; + + // Hack to hide the bottom edge corner radius off-screen. + Margin = new MarginPadding { Bottom = -corner_radius }; + Padding = new MarginPadding { Bottom = corner_radius }; + + Anchor = Anchor.BottomCentre; + Origin = Anchor.BottomCentre; + } + [BackgroundDependencyLoader] private void load() { - // Width = 0.85f; // Matches OnlineOverlay - Height = default_chat_height; - RelativeSizeAxes = Axes.Both; - RelativePositionAxes = Axes.Both; - Anchor = Anchor.BottomCentre; - Origin = Anchor.BottomCentre; - Masking = true; - CornerRadius = 7f; - Margin = new MarginPadding { Bottom = -10 }; - Padding = new MarginPadding { Bottom = 10 }; - Children = new Drawable[] { topBar = new ChatOverlayTopBar From 684db27bb8d962c6ada325dcb903b71c95106dbb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 May 2022 19:40:44 +0900 Subject: [PATCH 0715/2328] Reword binding text to read better --- osu.Game/Localisation/GlobalActionKeyBindingStrings.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs index cfe0fd55ce..b2f25de7f2 100644 --- a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs +++ b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs @@ -130,14 +130,14 @@ namespace osu.Game.Localisation public static LocalisableString SelectNext => new TranslatableString(getKey(@"select_next"), @"Next selection"); /// - /// "Previous group selection" + /// "Select previous group" /// - public static LocalisableString SelectPreviousGroup => new TranslatableString(getKey(@"select_previous_group"), @"Previous group selection"); + public static LocalisableString SelectPreviousGroup => new TranslatableString(getKey(@"select_previous_group"), @"Select previous group"); /// - /// "Next group selection" + /// "Select next group" /// - public static LocalisableString SelectNextGroup => new TranslatableString(getKey(@"select_next_group"), @"Next group selection"); + public static LocalisableString SelectNextGroup => new TranslatableString(getKey(@"select_next_group"), @"Select next group"); /// /// "Home" From 8501a4161958514bfae52c5e78aee2ee26a870e0 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 5 May 2022 14:37:38 +0300 Subject: [PATCH 0716/2328] Bring back separate bool properties as non-cascading --- osu.Game.Tests/Mods/ModUtilsTest.cs | 12 ++++++--- .../TestSceneFreeModSelectScreen.cs | 3 +-- .../BeatmapSet/LeaderboardModSelector.cs | 2 +- osu.Game/Rulesets/Mods/IMod.cs | 26 +++++++++--------- osu.Game/Rulesets/Mods/Mod.cs | 11 ++++---- osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs | 3 ++- osu.Game/Rulesets/Mods/ModAutoplay.cs | 4 ++- osu.Game/Rulesets/Mods/ModRateAdjust.cs | 2 +- osu.Game/Rulesets/Mods/ModTimeRamp.cs | 2 +- osu.Game/Rulesets/Mods/ModUsage.cs | 27 ------------------- osu.Game/Rulesets/Mods/UnknownMod.cs | 4 ++- .../OnlinePlay/FreeModSelectOverlay.cs | 2 +- .../Screens/OnlinePlay/FreeModSelectScreen.cs | 2 +- .../Multiplayer/MultiplayerMatchSongSelect.cs | 4 +-- .../OnlinePlay/OnlinePlaySongSelect.cs | 2 +- .../PlayerSettings/BeatmapOffsetControl.cs | 3 +-- osu.Game/Screens/Play/SubmittingPlayer.cs | 3 +-- osu.Game/Screens/Ranking/ResultsScreen.cs | 3 +-- osu.Game/Utils/ModUtils.cs | 4 +-- 19 files changed, 49 insertions(+), 70 deletions(-) delete mode 100644 osu.Game/Rulesets/Mods/ModUsage.cs diff --git a/osu.Game.Tests/Mods/ModUtilsTest.cs b/osu.Game.Tests/Mods/ModUtilsTest.cs index 2447233d3c..6c9dddf51f 100644 --- a/osu.Game.Tests/Mods/ModUtilsTest.cs +++ b/osu.Game.Tests/Mods/ModUtilsTest.cs @@ -324,12 +324,18 @@ namespace osu.Game.Tests.Mods public override string Acronym => string.Empty; public override double ScoreMultiplier => 1; public override bool HasImplementation => true; - public override bool IsPlayable(ModUsage usage) => usage == ModUsage.SoloLocal; + public override bool ValidForMultiplayer => false; + public override bool ValidForMultiplayerAsFreeMod => false; } - private class InvalidMultiplayerFreeMod : InvalidMultiplayerMod + private class InvalidMultiplayerFreeMod : Mod { - public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerLocal; + public override string Name => string.Empty; + public override string Description => string.Empty; + public override string Acronym => string.Empty; + public override double ScoreMultiplier => 1; + public override bool HasImplementation => true; + public override bool ValidForMultiplayerAsFreeMod => false; } public interface IModCompatibilitySpecification diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs index fad784a09e..b5f901e51d 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs @@ -6,7 +6,6 @@ using NUnit.Framework; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Overlays.Mods; -using osu.Game.Rulesets.Mods; using osu.Game.Screens.OnlinePlay; namespace osu.Game.Tests.Visual.Multiplayer @@ -29,7 +28,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("all visible mods are playable", () => this.ChildrenOfType() .Where(panel => panel.IsPresent) - .All(panel => panel.Mod.HasImplementation && panel.Mod.IsPlayable(ModUsage.SoloLocal))); + .All(panel => panel.Mod.HasImplementation && panel.Mod.UserPlayable)); AddToggleStep("toggle visibility", visible => { diff --git a/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs b/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs index 17ea117018..25aed4c980 100644 --- a/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs +++ b/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs @@ -63,7 +63,7 @@ namespace osu.Game.Overlays.BeatmapSet return; modsContainer.Add(new ModButton(new ModNoMod())); - modsContainer.AddRange(rulesetInstance.AllMods.Where(m => m.IsPlayable(ModUsage.SoloLocal)).Select(m => new ModButton(m))); + modsContainer.AddRange(rulesetInstance.AllMods.Where(m => m.UserPlayable).Select(m => new ModButton(m))); modsContainer.ForEach(button => { diff --git a/osu.Game/Rulesets/Mods/IMod.cs b/osu.Game/Rulesets/Mods/IMod.cs index c0d4aa5c9f..30fa1ea8cb 100644 --- a/osu.Game/Rulesets/Mods/IMod.cs +++ b/osu.Game/Rulesets/Mods/IMod.cs @@ -33,26 +33,24 @@ namespace osu.Game.Rulesets.Mods /// IconUsage? Icon { get; } - /// - /// Whether this mod is playable for the given usage. - /// - /// - /// - /// Should be always false for cases where the user is not interacting with the game. - /// Should be false in for mods that make gameplay duration dependent on user input (e.g. ). - /// Should be false in for mods that affect the gameplay duration (e.g. and ). - /// - /// - /// The mod usage. - bool IsPlayable(ModUsage usage); - /// /// Whether this mod is playable by an end user. /// Should be false for cases where the user is not interacting with the game (so it can be excluded from multiplayer selection, for example). /// - [Obsolete("Override IsPlayable instead.")] // Can be removed 20221104 bool UserPlayable { get; } + /// + /// Whether this mod is valid for multiplayer matches. + /// Should be false for mods that make gameplay duration dependent on user input (e.g. ). + /// + bool ValidForMultiplayer { get; } + + /// + /// Whether this mod is valid as a free mod in multiplayer matches. + /// Should be false for mods that affect the gameplay duration (e.g. and ). + /// + bool ValidForMultiplayerAsFreeMod { get; } + /// /// Create a fresh instance based on this mod. /// diff --git a/osu.Game/Rulesets/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs index b2f1b7e24f..93990d36e1 100644 --- a/osu.Game/Rulesets/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -91,13 +91,14 @@ namespace osu.Game.Rulesets.Mods [JsonIgnore] public virtual bool HasImplementation => this is IApplicableMod; -#pragma warning disable 618 - public virtual bool IsPlayable(ModUsage usage) => UserPlayable; -#pragma warning restore 618 + [JsonIgnore] + public virtual bool UserPlayable => true; [JsonIgnore] - [Obsolete("Override IsPlayable instead.")] // Can be removed 20221104 - public virtual bool UserPlayable => true; + public virtual bool ValidForMultiplayer => true; + + [JsonIgnore] + public virtual bool ValidForMultiplayerAsFreeMod => true; [Obsolete("Going forward, the concept of \"ranked\" doesn't exist. The only exceptions are automation mods, which should now override IsPlayable to false.")] // Can be removed 20211009 public virtual bool Ranked => false; diff --git a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs index 700ad30c08..93251f7b2d 100644 --- a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs +++ b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs @@ -31,7 +31,8 @@ namespace osu.Game.Rulesets.Mods public override double ScoreMultiplier => 1; - public override bool IsPlayable(ModUsage usage) => usage == ModUsage.SoloLocal; + public override bool ValidForMultiplayer => false; + public override bool ValidForMultiplayerAsFreeMod => false; public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModTimeRamp) }; diff --git a/osu.Game/Rulesets/Mods/ModAutoplay.cs b/osu.Game/Rulesets/Mods/ModAutoplay.cs index 9df25b006d..0ebe11b393 100644 --- a/osu.Game/Rulesets/Mods/ModAutoplay.cs +++ b/osu.Game/Rulesets/Mods/ModAutoplay.cs @@ -24,7 +24,9 @@ namespace osu.Game.Rulesets.Mods public bool RestartOnFail => false; - public override bool IsPlayable(ModUsage usage) => false; + public override bool UserPlayable => false; + public override bool ValidForMultiplayer => false; + public override bool ValidForMultiplayerAsFreeMod => false; public override Type[] IncompatibleMods => new[] { typeof(ModCinema), typeof(ModRelax), typeof(ModFailCondition), typeof(ModNoFail) }; diff --git a/osu.Game/Rulesets/Mods/ModRateAdjust.cs b/osu.Game/Rulesets/Mods/ModRateAdjust.cs index acb39bfbe6..05953f903f 100644 --- a/osu.Game/Rulesets/Mods/ModRateAdjust.cs +++ b/osu.Game/Rulesets/Mods/ModRateAdjust.cs @@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Mods { public abstract class ModRateAdjust : Mod, IApplicableToRate { - public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerLocal; + public override bool ValidForMultiplayerAsFreeMod => false; public abstract BindableNumber SpeedChange { get; } diff --git a/osu.Game/Rulesets/Mods/ModTimeRamp.cs b/osu.Game/Rulesets/Mods/ModTimeRamp.cs index c554c39010..fe6d54332c 100644 --- a/osu.Game/Rulesets/Mods/ModTimeRamp.cs +++ b/osu.Game/Rulesets/Mods/ModTimeRamp.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mods [SettingSource("Adjust pitch", "Should pitch be adjusted with speed")] public abstract BindableBool AdjustPitch { get; } - public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerLocal; + public override bool ValidForMultiplayerAsFreeMod => false; public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModAdaptiveSpeed) }; diff --git a/osu.Game/Rulesets/Mods/ModUsage.cs b/osu.Game/Rulesets/Mods/ModUsage.cs deleted file mode 100644 index 3f25154d73..0000000000 --- a/osu.Game/Rulesets/Mods/ModUsage.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -namespace osu.Game.Rulesets.Mods -{ - /// - /// The context in which a is playable. - /// - public enum ModUsage - { - /// - /// This mod can be used for a per-user gameplay session. - /// - SoloLocal, - - /// - /// This mod can be used in multiplayer but must be applied to all users. - /// This is generally the case for mods which affect the length of gameplay. - /// - MultiplayerGlobal, - - /// - /// This mod can be used in multiplayer either at a room or per-player level (i.e. "free mod"). - /// - MultiplayerLocal, - } -} diff --git a/osu.Game/Rulesets/Mods/UnknownMod.cs b/osu.Game/Rulesets/Mods/UnknownMod.cs index 75d86e67bc..72de0ad653 100644 --- a/osu.Game/Rulesets/Mods/UnknownMod.cs +++ b/osu.Game/Rulesets/Mods/UnknownMod.cs @@ -15,7 +15,9 @@ namespace osu.Game.Rulesets.Mods public override string Description => "This mod could not be resolved by the game."; public override double ScoreMultiplier => 0; - public override bool IsPlayable(ModUsage usage) => false; + public override bool UserPlayable => false; + public override bool ValidForMultiplayer => false; + public override bool ValidForMultiplayerAsFreeMod => false; public override ModType Type => ModType.System; diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs index 13d5dd8927..d5abaaab4e 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.OnlinePlay public new Func IsValidMod { get => base.IsValidMod; - set => base.IsValidMod = m => m.HasImplementation && m.IsPlayable(ModUsage.SoloLocal) && value(m); + set => base.IsValidMod = m => m.HasImplementation && m.UserPlayable && value(m); } public FreeModSelectOverlay() diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs index 415ae60706..5a7a60b479 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.OnlinePlay public new Func IsValidMod { get => base.IsValidMod; - set => base.IsValidMod = m => m.IsPlayable(ModUsage.SoloLocal) && value.Invoke(m); + set => base.IsValidMod = m => m.UserPlayable && value.Invoke(m); } public FreeModSelectScreen() diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs index d7e752623d..929c3ee321 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs @@ -95,8 +95,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea(); - protected override bool IsValidMod(Mod mod) => base.IsValidMod(mod) && mod.IsPlayable(ModUsage.MultiplayerGlobal); + protected override bool IsValidMod(Mod mod) => base.IsValidMod(mod) && mod.ValidForMultiplayer; - protected override bool IsValidFreeMod(Mod mod) => base.IsValidFreeMod(mod) && mod.IsPlayable(ModUsage.MultiplayerLocal); + protected override bool IsValidFreeMod(Mod mod) => base.IsValidFreeMod(mod) && mod.ValidForMultiplayerAsFreeMod; } } diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs index b8b0604c79..6a559dbb2c 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs @@ -170,7 +170,7 @@ namespace osu.Game.Screens.OnlinePlay /// /// The to check. /// Whether is a valid mod for online play. - protected virtual bool IsValidMod(Mod mod) => mod.HasImplementation && ModUtils.FlattenMod(mod).All(m => m.IsPlayable(ModUsage.SoloLocal)); + protected virtual bool IsValidMod(Mod mod) => mod.HasImplementation && ModUtils.FlattenMod(mod).All(m => m.UserPlayable); /// /// Checks whether a given is valid for per-player free-mod selection. diff --git a/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs b/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs index af2cecfba5..1662ca399f 100644 --- a/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs +++ b/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs @@ -20,7 +20,6 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Localisation; using osu.Game.Overlays.Settings; -using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; using osu.Game.Screens.Ranking.Statistics; @@ -188,7 +187,7 @@ namespace osu.Game.Screens.Play.PlayerSettings if (score.NewValue == null) return; - if (score.NewValue.Mods.Any(m => !m.IsPlayable(ModUsage.SoloLocal))) + if (score.NewValue.Mods.Any(m => !m.UserPlayable)) return; var hitEvents = score.NewValue.HitEvents; diff --git a/osu.Game/Screens/Play/SubmittingPlayer.cs b/osu.Game/Screens/Play/SubmittingPlayer.cs index b33ff87d55..b62dc1e5a6 100644 --- a/osu.Game/Screens/Play/SubmittingPlayer.cs +++ b/osu.Game/Screens/Play/SubmittingPlayer.cs @@ -11,7 +11,6 @@ using osu.Framework.Logging; using osu.Framework.Screens; using osu.Game.Online.API; using osu.Game.Online.Rooms; -using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; @@ -48,7 +47,7 @@ namespace osu.Game.Screens.Play // Token request construction should happen post-load to allow derived classes to potentially prepare DI backings that are used to create the request. var tcs = new TaskCompletionSource(); - if (Mods.Value.Any(m => !m.IsPlayable(ModUsage.SoloLocal))) + if (Mods.Value.Any(m => !m.UserPlayable)) { handleTokenFailure(new InvalidOperationException("Non-user playable mod selected.")); return false; diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index e0ae0309ce..98514cd846 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -18,7 +18,6 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; using osu.Game.Online.API; -using osu.Game.Rulesets.Mods; using osu.Game.Scoring; using osu.Game.Screens.Play; using osu.Game.Screens.Ranking.Statistics; @@ -146,7 +145,7 @@ namespace osu.Game.Screens.Ranking if (Score != null) { // only show flair / animation when arriving after watching a play that isn't autoplay. - bool shouldFlair = player != null && Score.Mods.All(m => m.IsPlayable(ModUsage.SoloLocal)); + bool shouldFlair = player != null && Score.Mods.All(m => m.UserPlayable); ScorePanelList.AddScore(Score, shouldFlair); } diff --git a/osu.Game/Utils/ModUtils.cs b/osu.Game/Utils/ModUtils.cs index f11a06e3be..a252a9b416 100644 --- a/osu.Game/Utils/ModUtils.cs +++ b/osu.Game/Utils/ModUtils.cs @@ -144,7 +144,7 @@ namespace osu.Game.Utils if (!CheckCompatibleSet(mods, out invalidMods)) return false; - return checkValid(mods, m => m.Type != ModType.System && m.HasImplementation && m.IsPlayable(ModUsage.MultiplayerGlobal), out invalidMods); + return checkValid(mods, m => m.Type != ModType.System && m.HasImplementation && m.ValidForMultiplayer, out invalidMods); } /// @@ -154,7 +154,7 @@ namespace osu.Game.Utils /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. public static bool CheckValidFreeModsForMultiplayer(IEnumerable mods, [NotNullWhen(false)] out List? invalidMods) - => checkValid(mods, m => m.Type != ModType.System && m.HasImplementation && m.IsPlayable(ModUsage.MultiplayerLocal) && !(m is MultiMod), out invalidMods); + => checkValid(mods, m => m.Type != ModType.System && m.HasImplementation && m.ValidForMultiplayerAsFreeMod && !(m is MultiMod), out invalidMods); private static bool checkValid(IEnumerable mods, Predicate valid, [NotNullWhen(false)] out List? invalidMods) { From 43c9058d09dbff83898f8b7f841c524d8a72d454 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 5 May 2022 14:39:05 +0300 Subject: [PATCH 0717/2328] Fix wrong obsolete message --- osu.Game/Rulesets/Mods/Mod.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs index 93990d36e1..af1550f8a9 100644 --- a/osu.Game/Rulesets/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Mods [JsonIgnore] public virtual bool ValidForMultiplayerAsFreeMod => true; - [Obsolete("Going forward, the concept of \"ranked\" doesn't exist. The only exceptions are automation mods, which should now override IsPlayable to false.")] // Can be removed 20211009 + [Obsolete("Going forward, the concept of \"ranked\" doesn't exist. The only exceptions are automation mods, which should now override and set UserPlayable to false.")] // Can be removed 20211009 public virtual bool Ranked => false; /// From 2039d3db6a76031a7f23d9c84140f0f1f8f94d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 May 2022 14:37:57 +0200 Subject: [PATCH 0718/2328] Use standard slider ticks in strict tracking mod --- osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs b/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs index a1e6946157..8bbfa68fdf 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs @@ -70,11 +70,6 @@ namespace osu.Game.Rulesets.Osu.Mods drawableRuleset.Playfield.RegisterPool(10, 100); } - private class StrictTrackingSliderTick : SliderTick - { - public override Judgement CreateJudgement() => new OsuIgnoreJudgement(); - } - private class StrictTrackingSliderTailCircle : SliderTailCircle { public StrictTrackingSliderTailCircle(Slider slider) @@ -115,7 +110,7 @@ namespace osu.Game.Rulesets.Osu.Mods switch (e.Type) { case SliderEventType.Tick: - AddNested(new StrictTrackingSliderTick + AddNested(new SliderTick { SpanIndex = e.SpanIndex, SpanStartTime = e.SpanStartTime, From 74c0cb2f6eb9ddf40563e70da00f9454e29b22ca Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 5 May 2022 16:16:55 +0300 Subject: [PATCH 0719/2328] Add note about not checking compatibility in free mods validity method --- osu.Game/Utils/ModUtils.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Utils/ModUtils.cs b/osu.Game/Utils/ModUtils.cs index a252a9b416..ea092a8ca3 100644 --- a/osu.Game/Utils/ModUtils.cs +++ b/osu.Game/Utils/ModUtils.cs @@ -150,6 +150,11 @@ namespace osu.Game.Utils /// /// Checks that all s in a combination are valid as "free mods" in a multiplayer match session. /// + /// + /// Note that this does not check compatibility between mods, + /// given that the passed mods are expected to be the ones to be allowed for the multiplayer match, + /// not to be confused with the list of mods the user currently has selected for the multiplayer match. + /// /// The mods to check. /// Invalid mods, if any were found. Will be null if all mods were valid. /// Whether the input mods were all valid. If false, will contain all invalid entries. From 5ea6f62951b93a9e558c59142e0275ce886d2459 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Thu, 5 May 2022 14:20:33 +0100 Subject: [PATCH 0720/2328] Ensure `RelativePositionAxes` is set in BDL for animations to work --- osu.Game/Overlays/ChatOverlayV2.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 16da1f7c10..cab88136fc 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -85,6 +85,9 @@ namespace osu.Game.Overlays [BackgroundDependencyLoader] private void load() { + // Required for the pop in/out animation + RelativePositionAxes = Axes.Both; + Children = new Drawable[] { topBar = new ChatOverlayTopBar From 9cb52f8879f839eb7ba64cd1b38a35d4bc0c69cb Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Thu, 5 May 2022 14:21:26 +0100 Subject: [PATCH 0721/2328] Add tests for chat height saving/loading --- .../Visual/Online/TestSceneChatOverlayV2.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index b15a7afbf9..31ced4e8f7 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -6,12 +6,14 @@ using System.Linq; using System.Collections.Generic; using System.Net; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Logging; using osu.Framework.Testing; using osu.Framework.Utils; +using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.API.Requests; @@ -21,6 +23,7 @@ using osu.Game.Overlays; using osu.Game.Overlays.Chat; using osu.Game.Overlays.Chat.Listing; using osu.Game.Overlays.Chat.ChannelList; +using osuTK; using osuTK.Input; namespace osu.Game.Tests.Visual.Online @@ -38,6 +41,9 @@ namespace osu.Game.Tests.Visual.Online private Channel testChannel1 => testChannels[0]; private Channel testChannel2 => testChannels[1]; + [Resolved] + private OsuConfigManager config { get; set; } = null!; + [SetUp] public void SetUp() => Schedule(() => { @@ -124,6 +130,28 @@ namespace osu.Game.Tests.Visual.Online AddAssert("Overlay is hidden", () => chatOverlay.State.Value == Visibility.Hidden); } + [Test] + public void TestChatHeight() + { + Bindable configChatHeight = config.GetBindable(OsuSetting.ChatDisplayHeight); + float newHeight = 0; + + AddStep("Set config chat height", () => configChatHeight.Value = 0.4f); + AddStep("Show overlay", () => chatOverlay.Show()); + AddAssert("Overlay uses config height", () => chatOverlay.Height == 0.4f); + AddStep("Drag overlay to new height", () => { + InputManager.MoveMouseTo(chatOverlayTopBar); + InputManager.PressButton(MouseButton.Left); + InputManager.MoveMouseTo(chatOverlayTopBar, new Vector2(0, -300)); + InputManager.ReleaseButton(MouseButton.Left); + }); + AddStep("Store new height", () => newHeight = chatOverlay.Height); + AddAssert("Config height changed", () => configChatHeight.Value != 0.4f && configChatHeight.Value == newHeight); + AddStep("Hide overlay", () => chatOverlay.Hide()); + AddStep("Show overlay", () => chatOverlay.Show()); + AddAssert("Overlay uses new height", () => chatOverlay.Height == newHeight); + } + [Test] public void TestChannelSelection() { @@ -360,6 +388,9 @@ namespace osu.Game.Tests.Visual.Online private ChatTextBox chatOverlayTextBox => chatOverlay.ChildrenOfType().Single(); + private ChatOverlayTopBar chatOverlayTopBar => + chatOverlay.ChildrenOfType().Single(); + private void clickDrawable(Drawable d) { InputManager.MoveMouseTo(d); From 5657e7f11ec5d0e8551380efeb3e4998e6e55f3c Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Thu, 5 May 2022 14:52:03 +0100 Subject: [PATCH 0722/2328] Fix chat height saving/loading test --- osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 31ced4e8f7..98574e5d53 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -133,13 +133,15 @@ namespace osu.Game.Tests.Visual.Online [Test] public void TestChatHeight() { - Bindable configChatHeight = config.GetBindable(OsuSetting.ChatDisplayHeight); + Bindable configChatHeight = null; float newHeight = 0; + AddStep("Bind config chat height", () => configChatHeight = config.GetBindable(OsuSetting.ChatDisplayHeight).GetBoundCopy()); AddStep("Set config chat height", () => configChatHeight.Value = 0.4f); AddStep("Show overlay", () => chatOverlay.Show()); AddAssert("Overlay uses config height", () => chatOverlay.Height == 0.4f); - AddStep("Drag overlay to new height", () => { + AddStep("Drag overlay to new height", () => + { InputManager.MoveMouseTo(chatOverlayTopBar); InputManager.PressButton(MouseButton.Left); InputManager.MoveMouseTo(chatOverlayTopBar, new Vector2(0, -300)); From 2cc56a4b19348b2b80ca4e4521a37e56a4bc0011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 May 2022 19:07:44 +0200 Subject: [PATCH 0723/2328] Fix hidden issue with automatic customisation panel show logic Doesn't cause tests to fail headless, but they do fail in the test browser. --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 8060bca65f..1779d59e33 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -217,7 +217,7 @@ namespace osu.Game.Overlays.Mods foreach (var mod in SelectedMods.Value) { anyCustomisableMod |= mod.GetSettingsSourceProperties().Any(); - anyModWithRequiredCustomisationAdded |= !valueChangedEvent.OldValue.Contains(mod) && mod.RequiresConfiguration; + anyModWithRequiredCustomisationAdded |= valueChangedEvent.OldValue.All(m => m.GetType() != mod.GetType()) && mod.RequiresConfiguration; } if (anyCustomisableMod) From 8002726c9c1a1e1bf23befa68bb45eaec1cb57fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 May 2022 19:08:38 +0200 Subject: [PATCH 0724/2328] Add test coverage for dismissing customisation area with Escape --- .../Visual/UserInterface/TestSceneModSelectScreen.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index bdb423a43c..a3ce4b734b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -164,11 +164,19 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("select mod requiring configuration", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() }); assertCustomisationToggleState(disabled: false, active: true); - AddStep("dismiss mod customisation", () => + AddStep("dismiss mod customisation via mouse", () => { InputManager.MoveMouseTo(modSelectScreen.ChildrenOfType().Single()); InputManager.Click(MouseButton.Left); }); + assertCustomisationToggleState(disabled: false, active: false); + + AddStep("reset mods", () => SelectedMods.SetDefault()); + AddStep("select mod requiring configuration", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() }); + assertCustomisationToggleState(disabled: false, active: true); + + AddStep("dismiss mod customisation via keyboard", () => InputManager.Key(Key.Escape)); + assertCustomisationToggleState(disabled: false, active: false); AddStep("append another mod not requiring config", () => SelectedMods.Value = SelectedMods.Value.Append(new OsuModFlashlight()).ToArray()); assertCustomisationToggleState(disabled: false, active: false); From 79e1b93b303195ef57cb9d2fc839aca0670fefd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 May 2022 17:08:02 +0200 Subject: [PATCH 0725/2328] Close customisation area on escape press before exiting --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 1779d59e33..a7f8a167f9 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -18,6 +18,7 @@ using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; +using osu.Game.Input.Bindings; using osu.Game.Rulesets.Mods; using osuTK; using osuTK.Input; @@ -315,6 +316,17 @@ namespace osu.Game.Overlays.Mods } } + public override bool OnPressed(KeyBindingPressEvent e) + { + if (e.Action == GlobalAction.Back && customisationVisible.Value) + { + customisationVisible.Value = false; + return true; + } + + return base.OnPressed(e); + } + internal class ColumnScrollContainer : OsuScrollContainer { public ColumnScrollContainer() From aafb363a3487e547ea349d0717f489557eb82252 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 6 May 2022 01:24:19 +0800 Subject: [PATCH 0726/2328] Only enable EnforceCodeStyleInBuild in CI --- .github/workflows/ci.yml | 7 +++++-- Directory.Build.props | 1 - osu.Android.props | 1 - osu.iOS.props | 1 - 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4d7f894d4..57069a0ae2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,9 @@ jobs: path: ${{ github.workspace }}/inspectcode key: inspectcode-${{ hashFiles('.config/dotnet-tools.json') }}-${{ hashFiles('.github/workflows/ci.yml' ) }} + - name: Dotnet code style + run: dotnet build -c Debug -warnaserror osu.Desktop.slnf -p:EnforceCodeStyleInBuild=true + - name: CodeFileSanity run: | # TODO: Add ignore filters and GitHub Workflow Command Reporting in CFS. That way we don't have to do this workaround. @@ -128,7 +131,7 @@ jobs: # cannot accept .sln(f) files as arguments. # Build just the main game for now. - name: Build - run: msbuild osu.Android/osu.Android.csproj /restore /p:Configuration=Debug /p:EnforceCodeStyleInBuild=false + run: msbuild osu.Android/osu.Android.csproj /restore /p:Configuration=Debug build-only-ios: name: Build only (iOS) @@ -147,4 +150,4 @@ jobs: # cannot accept .sln(f) files as arguments. # Build just the main game for now. - name: Build - run: msbuild osu.iOS/osu.iOS.csproj /restore /p:Configuration=Debug /p:EnforceCodeStyleInBuild=false + run: msbuild osu.iOS/osu.iOS.csproj /restore /p:Configuration=Debug diff --git a/Directory.Build.props b/Directory.Build.props index 65ffe02584..73a150d3e3 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -20,7 +20,6 @@ - true $(MSBuildThisFileDirectory)CodeAnalysis\osu.ruleset diff --git a/osu.Android.props b/osu.Android.props index 299f236220..2866ec24a6 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -19,7 +19,6 @@ cjk,mideast,other,rare,west SdkOnly prompt - false True diff --git a/osu.iOS.props b/osu.iOS.props index d16c6803f4..f987ae9bf8 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -11,7 +11,6 @@ iPhone Developer true - false From 30ffc7b23f0d354cad739df4ca2e4c62ba42a294 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 6 May 2022 01:28:30 +0800 Subject: [PATCH 0727/2328] Remove dotnet-format --- .config/dotnet-tools.json | 6 ------ .github/workflows/ci.yml | 4 ---- 2 files changed, 10 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 5a3eadf607..1132396608 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -2,12 +2,6 @@ "version": 1, "isRoot": true, "tools": { - "dotnet-format": { - "version": "3.1.37601", - "commands": [ - "dotnet-format" - ] - }, "jetbrains.resharper.globaltools": { "version": "2022.1.0-eap10", "commands": [ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57069a0ae2..514acef525 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,10 +49,6 @@ jobs: done <<< $(dotnet codefilesanity) exit $exit_code - # Temporarily disabled due to test failures, but it won't work anyway until the tool is upgraded. - # - name: .NET Format (Dry Run) - # run: dotnet format --dry-run --check - - name: InspectCode run: dotnet jb inspectcode $(pwd)/osu.Desktop.slnf --no-build --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN From 701ddade47739c20143e56e4da271663b24bce7d Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 6 May 2022 01:32:37 +0800 Subject: [PATCH 0728/2328] Revert editorconfig changes from framework --- .editorconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index 35ac84fca0..c0ea55f4c8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -176,7 +176,7 @@ csharp_style_unused_value_assignment_preference = discard_variable:warning #Style - variable declaration csharp_style_inlined_variable_declaration = true:warning -csharp_style_deconstructed_variable_declaration = true:warning +csharp_style_deconstructed_variable_declaration = false:silent #Style - other C# 7.x features dotnet_style_prefer_inferred_tuple_names = true:warning @@ -187,8 +187,8 @@ dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent #Style - C# 8 features csharp_prefer_static_local_function = true:warning csharp_prefer_simple_using_statement = true:silent -csharp_style_prefer_index_operator = true:warning -csharp_style_prefer_range_operator = true:warning +csharp_style_prefer_index_operator = false:silent +csharp_style_prefer_range_operator = false:silent csharp_style_prefer_switch_expression = false:none [*.{yaml,yml}] From 407db7ff9d288d9f1a81d05027f732eb33019c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 4 May 2022 21:49:02 +0200 Subject: [PATCH 0729/2328] Replace old mod select overlay with new design --- .../Navigation/TestSceneScreenNavigation.cs | 2 +- .../OnlinePlay/OnlinePlaySongSelect.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 36 ++++++------------- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs index a1f41d4caf..8ba074a7d1 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs @@ -551,7 +551,7 @@ namespace osu.Game.Tests.Visual.Navigation public class TestPlaySongSelect : PlaySongSelect { - public ModSelectOverlay ModSelectOverlay => ModSelect; + public ModSelectScreen ModSelectOverlay => ModSelect; public BeatmapOptionsOverlay BeatmapOptionsOverlay => BeatmapOptions; diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs index 6a559dbb2c..0eeb32230d 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs @@ -153,7 +153,7 @@ namespace osu.Game.Screens.OnlinePlay return base.OnExiting(e); } - protected override ModSelectOverlay CreateModSelectOverlay() => new UserModSelectOverlay + protected override ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen { IsValidMod = IsValidMod }; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 2a1ed2a7a8..3c46433b45 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -101,7 +101,7 @@ namespace osu.Game.Screens.Select [Resolved(CanBeNull = true)] private LegacyImportManager legacyImportManager { get; set; } - protected ModSelectOverlay ModSelect { get; private set; } + protected ModSelectScreen ModSelect { get; private set; } protected Sample SampleConfirm { get; private set; } @@ -252,35 +252,19 @@ namespace osu.Game.Screens.Select { AddRangeInternal(new Drawable[] { - new GridContainer // used for max height implementation + FooterPanels = new Container { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.Both, - RowDimensions = new[] + Padding = new MarginPadding { Bottom = Footer.HEIGHT }, + Children = new Drawable[] { - new Dimension(), - new Dimension(GridSizeMode.Relative, 1f, maxSize: ModSelectOverlay.HEIGHT + Footer.HEIGHT), - }, - Content = new[] - { - null, - new Drawable[] - { - FooterPanels = new Container - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Bottom = Footer.HEIGHT }, - Children = new Drawable[] - { - BeatmapOptions = new BeatmapOptionsOverlay(), - ModSelect = CreateModSelectOverlay() - } - } - } + BeatmapOptions = new BeatmapOptionsOverlay(), } }, - Footer = new Footer() + Footer = new Footer(), + ModSelect = CreateModSelectOverlay() }); } @@ -332,7 +316,7 @@ namespace osu.Game.Screens.Select (new FooterButtonOptions(), BeatmapOptions) }; - protected virtual ModSelectOverlay CreateModSelectOverlay() => new UserModSelectOverlay(); + protected virtual ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen(); protected virtual void ApplyFilterToCarousel(FilterCriteria criteria) { From 1744d7e4f0cd7130b0dad22da73bb708d9295c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 4 May 2022 21:53:04 +0200 Subject: [PATCH 0730/2328] Fix new mod select overlay dimming itself --- .../Containers/OsuFocusedOverlayContainer.cs | 6 +-- osu.Game/OsuGame.cs | 45 ++++++++++++++++++- osu.Game/Screens/Select/SongSelect.cs | 21 ++++++++- 3 files changed, 66 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 68351acd7e..0e8e481e9d 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -127,14 +127,14 @@ namespace osu.Game.Graphics.Containers if (didChange) samplePopIn?.Play(); - if (BlockScreenWideMouse && DimMainContent) game?.AddBlockingOverlay(this); + if (BlockScreenWideMouse && DimMainContent) game?.ShowBlockingOverlay(this); break; case Visibility.Hidden: if (didChange) samplePopOut?.Play(); - if (BlockScreenWideMouse) game?.RemoveBlockingOverlay(this); + if (BlockScreenWideMouse) game?.HideBlockingOverlay(this); break; } @@ -150,7 +150,7 @@ namespace osu.Game.Graphics.Containers protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - game?.RemoveBlockingOverlay(this); + game?.HideBlockingOverlay(this); } } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index e9fe8c43de..da8cdde944 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -171,6 +171,7 @@ namespace osu.Game private readonly string[] args; private readonly List focusedOverlays = new List(); + private readonly List externalOverlays = new List(); private readonly List visibleBlockingOverlays = new List(); @@ -186,19 +187,59 @@ namespace osu.Game private void updateBlockingOverlayFade() => ScreenContainer.FadeColour(visibleBlockingOverlays.Any() ? OsuColour.Gray(0.5f) : Color4.White, 500, Easing.OutQuint); - public void AddBlockingOverlay(OverlayContainer overlay) + /// + /// Registers a blocking that was not created by itself for later use. + /// + /// + /// The goal of this method is to allow child screens, like to register their own full-screen blocking overlays + /// with background dim. + /// In those cases, for the dim to work correctly, the overlays need to be added at the `OsuGame` level directly, rather as children of the screens. + /// + /// + /// An that should be disposed of when the should be unregistered. + /// Disposing of this will automatically expire the . + /// + internal IDisposable RegisterBlockingOverlay(OverlayContainer overlayContainer) + { + if (overlayContainer.Parent != null) + throw new ArgumentException($@"Overlays registered via {nameof(RegisterBlockingOverlay)} should not be added to the scene graph."); + + if (externalOverlays.Contains(overlayContainer)) + throw new ArgumentException($@"{overlayContainer} has already been registered via {nameof(RegisterBlockingOverlay)} once."); + + externalOverlays.Add(overlayContainer); + overlayContent.Add(overlayContainer); + return new InvokeOnDisposal(() => unregisterBlockingOverlay(overlayContainer)); + } + + /// + /// Should be called when has been shown and should begin blocking background input. + /// + internal void ShowBlockingOverlay(OverlayContainer overlay) { if (!visibleBlockingOverlays.Contains(overlay)) visibleBlockingOverlays.Add(overlay); updateBlockingOverlayFade(); } - public void RemoveBlockingOverlay(OverlayContainer overlay) => Schedule(() => + /// + /// Should be called when a blocking has been hidden and should stop blocking background input. + /// + internal void HideBlockingOverlay(OverlayContainer overlay) => Schedule(() => { visibleBlockingOverlays.Remove(overlay); updateBlockingOverlayFade(); }); + /// + /// Unregisters a blocking that was not created by itself. + /// + private void unregisterBlockingOverlay(OverlayContainer overlayContainer) + { + externalOverlays.Remove(overlayContainer); + overlayContainer.Expire(); + } + /// /// Close all game-wide overlays. /// diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 3c46433b45..448e702b96 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -35,6 +35,7 @@ using osu.Framework.Input.Bindings; using osu.Game.Collections; using osu.Game.Graphics.UserInterface; using System.Diagnostics; +using JetBrains.Annotations; using osu.Game.Screens.Play; using osu.Game.Database; using osu.Game.Skinning; @@ -116,9 +117,15 @@ namespace osu.Game.Screens.Select private double audioFeedbackLastPlaybackTime; + [CanBeNull] + private IDisposable modSelectOverlayRegistration; + [Resolved] private MusicController music { get; set; } + [Resolved(CanBeNull = true)] + private OsuGame game { get; set; } + [BackgroundDependencyLoader(true)] private void load(AudioManager audio, IDialogOverlay dialog, OsuColour colours, ManageCollectionsDialog manageCollectionsDialog, DifficultyRecommender recommender) { @@ -264,10 +271,13 @@ namespace osu.Game.Screens.Select } }, Footer = new Footer(), - ModSelect = CreateModSelectOverlay() }); } + // preload the mod select overlay for later use in `LoadComplete()`. + // therein it will be registered at the `OsuGame` level to properly function as a blocking overlay. + LoadComponent(ModSelect = CreateModSelectOverlay()); + if (Footer != null) { foreach (var (button, overlay) in CreateFooterButtons()) @@ -301,6 +311,13 @@ namespace osu.Game.Screens.Select } } + protected override void LoadComplete() + { + base.LoadComplete(); + + modSelectOverlayRegistration = game?.RegisterBlockingOverlay(ModSelect); + } + /// /// Creates the buttons to be displayed in the footer. /// @@ -700,6 +717,8 @@ namespace osu.Game.Screens.Select if (music != null) music.TrackChanged -= ensureTrackLooping; + + modSelectOverlayRegistration?.Dispose(); } /// From ac08498f35f8db294d26dfd0dba91df914cf492d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 4 May 2022 22:17:40 +0200 Subject: [PATCH 0731/2328] Use plum colour scheme in multiplayer to match rest of multiplayer screens --- .../UserInterface/TestSceneShearedOverlayContainer.cs | 5 ++++- osu.Game/Overlays/FirstRunSetupOverlay.cs | 7 +++++-- osu.Game/Overlays/Mods/ModSelectScreen.cs | 7 +++++-- osu.Game/Overlays/Mods/ShearedOverlayContainer.cs | 6 ++---- osu.Game/Overlays/Mods/UserModSelectScreen.cs | 5 +++++ osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs | 2 ++ osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs | 3 ++- 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayContainer.cs index 5a9cafde27..4dd64c6536 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayContainer.cs @@ -66,7 +66,10 @@ namespace osu.Game.Tests.Visual.UserInterface public class TestShearedOverlayContainer : ShearedOverlayContainer { - protected override OverlayColourScheme ColourScheme => OverlayColourScheme.Green; + public TestShearedOverlayContainer() + : base(OverlayColourScheme.Green) + { + } [BackgroundDependencyLoader] private void load() diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 75778e6c4d..607bef76dd 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -31,8 +31,6 @@ namespace osu.Game.Overlays [Cached] public class FirstRunSetupOverlay : ShearedOverlayContainer { - protected override OverlayColourScheme ColourScheme => OverlayColourScheme.Purple; - [Resolved] private IPerformFromScreenRunner performer { get; set; } = null!; @@ -70,6 +68,11 @@ namespace osu.Game.Overlays private Container content = null!; + public FirstRunSetupOverlay() + : base(OverlayColourScheme.Purple) + { + } + [BackgroundDependencyLoader] private void load(OsuColour colours) { diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index a7f8a167f9..bf47e4351a 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -27,8 +27,6 @@ namespace osu.Game.Overlays.Mods { public abstract class ModSelectScreen : ShearedOverlayContainer { - protected override OverlayColourScheme ColourScheme => OverlayColourScheme.Green; - [Cached] public Bindable> SelectedMods { get; private set; } = new Bindable>(Array.Empty()); @@ -65,6 +63,11 @@ namespace osu.Game.Overlays.Mods private ColumnScrollContainer columnScroll = null!; private ColumnFlowContainer columnFlow = null!; + protected ModSelectScreen(OverlayColourScheme colourScheme = OverlayColourScheme.Green) + : base(colourScheme) + { + } + [BackgroundDependencyLoader] private void load() { diff --git a/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs index eca192c8e5..92e88bfaaf 100644 --- a/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs +++ b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs @@ -51,17 +51,15 @@ namespace osu.Game.Overlays.Mods /// protected Container FooterContent { get; private set; } - protected abstract OverlayColourScheme ColourScheme { get; } - protected override bool StartHidden => true; protected override bool BlockNonPositionalInput => true; - protected ShearedOverlayContainer() + protected ShearedOverlayContainer(OverlayColourScheme colourScheme) { RelativeSizeAxes = Axes.Both; - ColourProvider = new OverlayColourProvider(ColourScheme); + ColourProvider = new OverlayColourProvider(colourScheme); } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Mods/UserModSelectScreen.cs b/osu.Game/Overlays/Mods/UserModSelectScreen.cs index ca33d35605..a018797cba 100644 --- a/osu.Game/Overlays/Mods/UserModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/UserModSelectScreen.cs @@ -12,6 +12,11 @@ namespace osu.Game.Overlays.Mods { public class UserModSelectScreen : ModSelectScreen { + public UserModSelectScreen(OverlayColourScheme colourScheme = OverlayColourScheme.Green) + : base(colourScheme) + { + } + protected override ModColumn CreateModColumn(ModType modType, Key[] toggleKeys = null) => new UserModColumn(modType, false, toggleKeys); protected override IReadOnlyList ComputeNewModsFromSelection(IReadOnlyList oldSelection, IReadOnlyList newSelection) diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs index 5a7a60b479..63b7d1dbb5 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using osu.Game.Overlays; using osu.Game.Overlays.Mods; using osu.Game.Rulesets.Mods; using osuTK.Input; @@ -20,6 +21,7 @@ namespace osu.Game.Screens.OnlinePlay } public FreeModSelectScreen() + : base(OverlayColourScheme.Plum) { IsValidMod = _ => true; } diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs index 0eeb32230d..d8474ef86a 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs @@ -14,6 +14,7 @@ using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Online.API; using osu.Game.Online.Rooms; +using osu.Game.Overlays; using osu.Game.Overlays.Mods; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; @@ -153,7 +154,7 @@ namespace osu.Game.Screens.OnlinePlay return base.OnExiting(e); } - protected override ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen + protected override ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen(OverlayColourScheme.Plum) { IsValidMod = IsValidMod }; From 4eefbd5bc21af4b34fd374fd255b29dacca3d195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 4 May 2022 22:25:13 +0200 Subject: [PATCH 0732/2328] Use new free mod select design in room creation flow --- .../Screens/OnlinePlay/OnlinePlaySongSelect.cs | 17 ++++++++++++++--- osu.Game/Screens/Select/SongSelect.cs | 4 ++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs index d8474ef86a..659084addf 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs @@ -46,7 +46,6 @@ namespace osu.Game.Screens.OnlinePlay protected readonly Bindable> FreeMods = new Bindable>(Array.Empty()); - private readonly FreeModSelectOverlay freeModSelectOverlay; private readonly Room room; private WorkingBeatmap initialBeatmap; @@ -54,13 +53,16 @@ namespace osu.Game.Screens.OnlinePlay private IReadOnlyList initialMods; private bool itemSelected; + private FreeModSelectScreen freeModSelectOverlay; + private IDisposable freeModSelectOverlayRegistration; + protected OnlinePlaySongSelect(Room room) { this.room = room; Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING }; - freeModSelectOverlay = new FreeModSelectOverlay + freeModSelectOverlay = new FreeModSelectScreen { SelectedMods = { BindTarget = FreeMods }, IsValidMod = IsValidFreeMod, @@ -76,7 +78,7 @@ namespace osu.Game.Screens.OnlinePlay initialRuleset = Ruleset.Value; initialMods = Mods.Value.ToList(); - FooterPanels.Add(freeModSelectOverlay); + LoadComponent(freeModSelectOverlay); } protected override void LoadComplete() @@ -95,6 +97,8 @@ namespace osu.Game.Screens.OnlinePlay Mods.BindValueChanged(onModsChanged); Ruleset.BindValueChanged(onRulesetChanged); + + freeModSelectOverlayRegistration = Game?.RegisterBlockingOverlay(freeModSelectOverlay); } private void onModsChanged(ValueChangedEvent> mods) @@ -183,5 +187,12 @@ namespace osu.Game.Screens.OnlinePlay private bool checkCompatibleFreeMod(Mod mod) => Mods.Value.All(m => m.Acronym != mod.Acronym) // Mod must not be contained in the required mods. && ModUtils.CheckCompatibleSet(Mods.Value.Append(mod).ToArray()); // Mod must be compatible with all the required mods. + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + freeModSelectOverlayRegistration?.Dispose(); + } } } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 448e702b96..55d28ec8a4 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -124,7 +124,7 @@ namespace osu.Game.Screens.Select private MusicController music { get; set; } [Resolved(CanBeNull = true)] - private OsuGame game { get; set; } + protected new OsuGame Game { get; private set; } [BackgroundDependencyLoader(true)] private void load(AudioManager audio, IDialogOverlay dialog, OsuColour colours, ManageCollectionsDialog manageCollectionsDialog, DifficultyRecommender recommender) @@ -315,7 +315,7 @@ namespace osu.Game.Screens.Select { base.LoadComplete(); - modSelectOverlayRegistration = game?.RegisterBlockingOverlay(ModSelect); + modSelectOverlayRegistration = Game?.RegisterBlockingOverlay(ModSelect); } /// From 66473972daafbcf0b1ec7358a21dbae001ec149f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 4 May 2022 22:30:20 +0200 Subject: [PATCH 0733/2328] Use new user mod select design in multiplayer lobby --- .../Screens/OnlinePlay/Match/RoomSubScreen.cs | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs index cc1f842f8c..5b892e1925 100644 --- a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -57,6 +58,9 @@ namespace osu.Game.Screens.OnlinePlay.Match protected readonly IBindable RoomId = new Bindable(); + [Resolved] + private OsuGame game { get; set; } + [Resolved] private MusicController music { get; set; } @@ -77,7 +81,11 @@ namespace osu.Game.Screens.OnlinePlay.Match public readonly Room Room; private readonly bool allowEdit; - private ModSelectOverlay userModsSelectOverlay; + private ModSelectScreen userModsSelectOverlay; + + [CanBeNull] + private IDisposable userModsSelectOverlayRegistration; + private RoomSettingsOverlay settingsOverlay; private Drawable mainContent; @@ -180,11 +188,6 @@ namespace osu.Game.Screens.OnlinePlay.Match Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Child = userModsSelectOverlay = new UserModSelectOverlay - { - SelectedMods = { BindTarget = UserMods }, - IsValidMod = _ => false - } }, } } @@ -227,6 +230,12 @@ namespace osu.Game.Screens.OnlinePlay.Match } } }; + + LoadComponent(userModsSelectOverlay = new UserModSelectScreen(OverlayColourScheme.Plum) + { + SelectedMods = { BindTarget = UserMods }, + IsValidMod = _ => false + }); } protected override void LoadComplete() @@ -254,6 +263,8 @@ namespace osu.Game.Screens.OnlinePlay.Match beatmapAvailabilityTracker.SelectedItem.BindTo(SelectedItem); beatmapAvailabilityTracker.Availability.BindValueChanged(_ => updateWorkingBeatmap()); + + userModsSelectOverlayRegistration = game?.RegisterBlockingOverlay(userModsSelectOverlay); } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) @@ -459,5 +470,12 @@ namespace osu.Game.Screens.OnlinePlay.Match public class UserModSelectButton : PurpleTriangleButton { } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + userModsSelectOverlayRegistration?.Dispose(); + } } } From a56eab2c4757dfb3955e3eefb507c051c723f5b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 May 2022 15:47:10 +0200 Subject: [PATCH 0734/2328] Extract interface for overlay management --- .../Containers/OsuFocusedOverlayContainer.cs | 12 ++--- osu.Game/OsuGame.cs | 36 +++++---------- osu.Game/Overlays/IOverlayManager.cs | 44 +++++++++++++++++++ .../Screens/OnlinePlay/Match/RoomSubScreen.cs | 6 +-- .../OnlinePlay/OnlinePlaySongSelect.cs | 4 +- osu.Game/Screens/Select/SongSelect.cs | 4 +- 6 files changed, 69 insertions(+), 37 deletions(-) create mode 100644 osu.Game/Overlays/IOverlayManager.cs diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 0e8e481e9d..512602d120 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -34,7 +34,7 @@ namespace osu.Game.Graphics.Containers protected virtual bool DimMainContent => true; [Resolved(CanBeNull = true)] - private OsuGame game { get; set; } + private IOverlayManager overlayManager { get; set; } [Resolved] private PreviewTrackManager previewTrackManager { get; set; } @@ -50,8 +50,8 @@ namespace osu.Game.Graphics.Containers protected override void LoadComplete() { - if (game != null) - OverlayActivationMode.BindTo(game.OverlayActivationMode); + if (overlayManager != null) + OverlayActivationMode.BindTo(overlayManager.OverlayActivationMode); OverlayActivationMode.BindValueChanged(mode => { @@ -127,14 +127,14 @@ namespace osu.Game.Graphics.Containers if (didChange) samplePopIn?.Play(); - if (BlockScreenWideMouse && DimMainContent) game?.ShowBlockingOverlay(this); + if (BlockScreenWideMouse && DimMainContent) overlayManager?.ShowBlockingOverlay(this); break; case Visibility.Hidden: if (didChange) samplePopOut?.Play(); - if (BlockScreenWideMouse) game?.HideBlockingOverlay(this); + if (BlockScreenWideMouse) overlayManager?.HideBlockingOverlay(this); break; } @@ -150,7 +150,7 @@ namespace osu.Game.Graphics.Containers protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - game?.HideBlockingOverlay(this); + overlayManager?.HideBlockingOverlay(this); } } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index da8cdde944..fcf5889a7e 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -63,7 +63,7 @@ namespace osu.Game /// The full osu! experience. Builds on top of to add menus and binding logic /// for initial components that are generally retrieved via DI. /// - public class OsuGame : OsuGameBase, IKeyBindingHandler, ILocalUserPlayInfo, IPerformFromScreenRunner + public class OsuGame : OsuGameBase, IKeyBindingHandler, ILocalUserPlayInfo, IPerformFromScreenRunner, IOverlayManager { /// /// The amount of global offset to apply when a left/right anchored overlay is displayed (ie. settings or notifications). @@ -184,48 +184,34 @@ namespace osu.Game SentryLogger = new SentryLogger(this); } + #region IOverlayManager + + IBindable IOverlayManager.OverlayActivationMode => OverlayActivationMode; + private void updateBlockingOverlayFade() => ScreenContainer.FadeColour(visibleBlockingOverlays.Any() ? OsuColour.Gray(0.5f) : Color4.White, 500, Easing.OutQuint); - /// - /// Registers a blocking that was not created by itself for later use. - /// - /// - /// The goal of this method is to allow child screens, like to register their own full-screen blocking overlays - /// with background dim. - /// In those cases, for the dim to work correctly, the overlays need to be added at the `OsuGame` level directly, rather as children of the screens. - /// - /// - /// An that should be disposed of when the should be unregistered. - /// Disposing of this will automatically expire the . - /// - internal IDisposable RegisterBlockingOverlay(OverlayContainer overlayContainer) + IDisposable IOverlayManager.RegisterBlockingOverlay(OverlayContainer overlayContainer) { if (overlayContainer.Parent != null) - throw new ArgumentException($@"Overlays registered via {nameof(RegisterBlockingOverlay)} should not be added to the scene graph."); + throw new ArgumentException($@"Overlays registered via {nameof(IOverlayManager.RegisterBlockingOverlay)} should not be added to the scene graph."); if (externalOverlays.Contains(overlayContainer)) - throw new ArgumentException($@"{overlayContainer} has already been registered via {nameof(RegisterBlockingOverlay)} once."); + throw new ArgumentException($@"{overlayContainer} has already been registered via {nameof(IOverlayManager.RegisterBlockingOverlay)} once."); externalOverlays.Add(overlayContainer); overlayContent.Add(overlayContainer); return new InvokeOnDisposal(() => unregisterBlockingOverlay(overlayContainer)); } - /// - /// Should be called when has been shown and should begin blocking background input. - /// - internal void ShowBlockingOverlay(OverlayContainer overlay) + void IOverlayManager.ShowBlockingOverlay(OverlayContainer overlay) { if (!visibleBlockingOverlays.Contains(overlay)) visibleBlockingOverlays.Add(overlay); updateBlockingOverlayFade(); } - /// - /// Should be called when a blocking has been hidden and should stop blocking background input. - /// - internal void HideBlockingOverlay(OverlayContainer overlay) => Schedule(() => + void IOverlayManager.HideBlockingOverlay(OverlayContainer overlay) => Schedule(() => { visibleBlockingOverlays.Remove(overlay); updateBlockingOverlayFade(); @@ -240,6 +226,8 @@ namespace osu.Game overlayContainer.Expire(); } + #endregion + /// /// Close all game-wide overlays. /// diff --git a/osu.Game/Overlays/IOverlayManager.cs b/osu.Game/Overlays/IOverlayManager.cs new file mode 100644 index 0000000000..940ee2d8db --- /dev/null +++ b/osu.Game/Overlays/IOverlayManager.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; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics.Containers; +using osu.Game.Screens.Select; + +namespace osu.Game.Overlays +{ + [Cached] + internal interface IOverlayManager + { + /// + /// Whether overlays should be able to be opened game-wide. Value is sourced from the current active screen. + /// + IBindable OverlayActivationMode { get; } + + /// + /// Registers a blocking that was not created by itself for later use. + /// + /// + /// The goal of this method is to allow child screens, like to register their own full-screen blocking overlays + /// with background dim. + /// In those cases, for the dim to work correctly, the overlays need to be added at a game level directly, rather as children of the screens. + /// + /// + /// An that should be disposed of when the should be unregistered. + /// Disposing of this will automatically expire the . + /// + IDisposable RegisterBlockingOverlay(OverlayContainer overlayContainer); + + /// + /// Should be called when has been shown and should begin blocking background input. + /// + void ShowBlockingOverlay(OverlayContainer overlay); + + /// + /// Should be called when a blocking has been hidden and should stop blocking background input. + /// + void HideBlockingOverlay(OverlayContainer overlay); + } +} diff --git a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs index 5b892e1925..b7a9b45bb8 100644 --- a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs @@ -58,8 +58,8 @@ namespace osu.Game.Screens.OnlinePlay.Match protected readonly IBindable RoomId = new Bindable(); - [Resolved] - private OsuGame game { get; set; } + [Resolved(CanBeNull = true)] + private IOverlayManager overlayManager { get; set; } [Resolved] private MusicController music { get; set; } @@ -264,7 +264,7 @@ namespace osu.Game.Screens.OnlinePlay.Match beatmapAvailabilityTracker.SelectedItem.BindTo(SelectedItem); beatmapAvailabilityTracker.Availability.BindValueChanged(_ => updateWorkingBeatmap()); - userModsSelectOverlayRegistration = game?.RegisterBlockingOverlay(userModsSelectOverlay); + userModsSelectOverlayRegistration = overlayManager?.RegisterBlockingOverlay(userModsSelectOverlay); } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs index 659084addf..c262544d6c 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs @@ -53,7 +53,7 @@ namespace osu.Game.Screens.OnlinePlay private IReadOnlyList initialMods; private bool itemSelected; - private FreeModSelectScreen freeModSelectOverlay; + private readonly FreeModSelectScreen freeModSelectOverlay; private IDisposable freeModSelectOverlayRegistration; protected OnlinePlaySongSelect(Room room) @@ -98,7 +98,7 @@ namespace osu.Game.Screens.OnlinePlay Mods.BindValueChanged(onModsChanged); Ruleset.BindValueChanged(onRulesetChanged); - freeModSelectOverlayRegistration = Game?.RegisterBlockingOverlay(freeModSelectOverlay); + freeModSelectOverlayRegistration = OverlayManager?.RegisterBlockingOverlay(freeModSelectOverlay); } private void onModsChanged(ValueChangedEvent> mods) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 55d28ec8a4..bb2746ee95 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -124,7 +124,7 @@ namespace osu.Game.Screens.Select private MusicController music { get; set; } [Resolved(CanBeNull = true)] - protected new OsuGame Game { get; private set; } + internal IOverlayManager OverlayManager { get; private set; } [BackgroundDependencyLoader(true)] private void load(AudioManager audio, IDialogOverlay dialog, OsuColour colours, ManageCollectionsDialog manageCollectionsDialog, DifficultyRecommender recommender) @@ -315,7 +315,7 @@ namespace osu.Game.Screens.Select { base.LoadComplete(); - modSelectOverlayRegistration = Game?.RegisterBlockingOverlay(ModSelect); + modSelectOverlayRegistration = OverlayManager?.RegisterBlockingOverlay(ModSelect); } /// From fdb21fedaba887647523f0c25fdad6c3bc0775d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 May 2022 16:31:02 +0200 Subject: [PATCH 0735/2328] Implement `IOverlayManager` in `ScreenTestScene` --- osu.Game/Tests/Visual/ScreenTestScene.cs | 33 ++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/osu.Game/Tests/Visual/ScreenTestScene.cs b/osu.Game/Tests/Visual/ScreenTestScene.cs index e9069d8c9c..0fa2f3e786 100644 --- a/osu.Game/Tests/Visual/ScreenTestScene.cs +++ b/osu.Game/Tests/Visual/ScreenTestScene.cs @@ -1,12 +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 System; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Development; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Logging; using osu.Framework.Testing; +using osu.Game.Graphics; using osu.Game.Overlays; using osu.Game.Screens; @@ -15,11 +18,12 @@ namespace osu.Game.Tests.Visual /// /// A test case which can be used to test a screen (that relies on OnEntering being called to execute startup instructions). /// - public abstract class ScreenTestScene : OsuManualInputManagerTestScene + public abstract class ScreenTestScene : OsuManualInputManagerTestScene, IOverlayManager { protected readonly OsuScreenStack Stack; private readonly Container content; + private readonly Container overlayContent; protected override Container Content => content; @@ -36,7 +40,11 @@ namespace osu.Game.Tests.Visual RelativeSizeAxes = Axes.Both }, content = new Container { RelativeSizeAxes = Axes.Both }, - DialogOverlay = new DialogOverlay() + overlayContent = new Container + { + RelativeSizeAxes = Axes.Both, + Child = DialogOverlay = new DialogOverlay() + } }); Stack.ScreenPushed += (lastScreen, newScreen) => Logger.Log($"{nameof(ScreenTestScene)} screen changed → {newScreen}"); @@ -65,5 +73,26 @@ namespace osu.Game.Tests.Visual return false; }); } + + #region IOverlayManager + + IBindable IOverlayManager.OverlayActivationMode { get; } = new Bindable(OverlayActivation.All); + + // in the blocking methods below it is important to be careful about threading (e.g. use `Expire()` rather than `Remove()`, and schedule transforms), + // because in the worst case the clean-up methods could be called from async disposal. + + IDisposable IOverlayManager.RegisterBlockingOverlay(OverlayContainer overlayContainer) + { + overlayContent.Add(overlayContainer); + return new InvokeOnDisposal(() => overlayContainer.Expire()); + } + + void IOverlayManager.ShowBlockingOverlay(OverlayContainer overlay) + => Schedule(() => Stack.FadeColour(OsuColour.Gray(0.5f), 500, Easing.OutQuint)); + + void IOverlayManager.HideBlockingOverlay(OverlayContainer overlay) + => Schedule(() => Stack.FadeColour(Colour4.White, 500, Easing.OutQuint)); + + #endregion } } From 0caea7717641ad85849219257ea563e2ad8e53f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 May 2022 17:27:21 +0200 Subject: [PATCH 0736/2328] Fix mod selects not hiding when their owner screens exit --- osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs | 10 ++++++++-- osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs | 2 ++ osu.Game/Screens/Select/SongSelect.cs | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs index b7a9b45bb8..ec4e329f7a 100644 --- a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs @@ -309,7 +309,7 @@ namespace osu.Game.Screens.OnlinePlay.Match public override void OnSuspending(ScreenTransitionEvent e) { - endHandlingTrack(); + onLeaving(); base.OnSuspending(e); } @@ -327,7 +327,7 @@ namespace osu.Game.Screens.OnlinePlay.Match RoomManager?.PartRoom(); Mods.Value = Array.Empty(); - endHandlingTrack(); + onLeaving(); return base.OnExiting(e); } @@ -423,6 +423,12 @@ namespace osu.Game.Screens.OnlinePlay.Match Beatmap.BindValueChanged(applyLoopingToTrack, true); } + private void onLeaving() + { + userModsSelectOverlay.Hide(); + endHandlingTrack(); + } + private void endHandlingTrack() { Beatmap.ValueChanged -= applyLoopingToTrack; diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs index c262544d6c..c4503773ad 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs @@ -155,6 +155,8 @@ namespace osu.Game.Screens.OnlinePlay Mods.Value = initialMods; } + freeModSelectOverlay.Hide(); + return base.OnExiting(e); } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index bb2746ee95..eb5e996972 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -659,6 +659,7 @@ namespace osu.Game.Screens.Select return true; beatmapInfoWedge.Hide(); + ModSelect.Hide(); this.FadeOut(100); From 8f65e0e60f4931f736e6b342e18b6a67e1ecbb4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 May 2022 21:08:19 +0200 Subject: [PATCH 0737/2328] Add failing test coverage for toggling mod overlay with hotkey --- .../Visual/SongSelect/TestScenePlaySongSelect.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index d27f16a624..083e24be7b 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -8,6 +8,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; +using osu.Framework.Graphics.Containers; using osu.Framework.Platform; using osu.Framework.Screens; using osu.Framework.Testing; @@ -18,6 +19,7 @@ using osu.Game.Extensions; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; +using osu.Game.Overlays.Mods; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; @@ -918,6 +920,19 @@ namespace osu.Game.Tests.Visual.SongSelect AddAssert("check ruleset is correct for score", () => Ruleset.Value.OnlineID == 0); } + [Test] + public void TestModOverlayToggling() + { + changeRuleset(0); + createSongSelect(); + + AddStep("toggle mod overlay on", () => InputManager.Key(Key.F1)); + AddUntilStep("mod overlay shown", () => songSelect.ModSelect.State.Value == Visibility.Visible); + + AddStep("toggle mod overlay off", () => InputManager.Key(Key.F1)); + AddUntilStep("mod overlay hidden", () => songSelect.ModSelect.State.Value == Visibility.Hidden); + } + private void waitForInitialSelection() { AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault); @@ -993,6 +1008,7 @@ namespace osu.Game.Tests.Visual.SongSelect public WorkingBeatmap CurrentBeatmap => Beatmap.Value; public IWorkingBeatmap CurrentBeatmapDetailsBeatmap => BeatmapDetails.Beatmap; public new BeatmapCarousel Carousel => base.Carousel; + public new ModSelectScreen ModSelect => base.ModSelect; public new void PresentScore(ScoreInfo score) => base.PresentScore(score); From 34cf4c6a3895557d6dc5f1d07b702857b512ccca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 May 2022 21:22:07 +0200 Subject: [PATCH 0738/2328] Fix mod overlay not closing on toggle hotkey --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 21 +++++++++++++++++++ .../OnlinePlay/OnlinePlaySongSelect.cs | 2 ++ osu.Game/Screens/Select/SongSelect.cs | 5 ++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index bf47e4351a..7c0ed941c6 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -20,6 +20,7 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; using osu.Game.Rulesets.Mods; +using osu.Game.Screens.Select; using osuTK; using osuTK.Input; @@ -44,6 +45,15 @@ namespace osu.Game.Overlays.Mods } } + /// + /// Hotkey that should be used to hide the mod select screen. + /// + /// + /// This is handled locally here rather than via , because this overlay is being registered at the game level + /// and therefore takes away keyboard focus from the screen stack. + /// + internal GlobalAction? Hotkey { get; set; } + /// /// Whether configurable s can be configured by the local user. /// @@ -321,12 +331,23 @@ namespace osu.Game.Overlays.Mods public override bool OnPressed(KeyBindingPressEvent e) { + if (e.Repeat) + return false; + if (e.Action == GlobalAction.Back && customisationVisible.Value) { customisationVisible.Value = false; return true; } + if (e.Action == Hotkey) + { + if (customisationVisible.Value) + customisationVisible.Value = false; + Hide(); + return true; + } + return base.OnPressed(e); } diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs index c4503773ad..4b6c06481b 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Screens; using osu.Game.Beatmaps; +using osu.Game.Input.Bindings; using osu.Game.Online.API; using osu.Game.Online.Rooms; using osu.Game.Overlays; @@ -162,6 +163,7 @@ namespace osu.Game.Screens.OnlinePlay protected override ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen(OverlayColourScheme.Plum) { + Hotkey = GlobalAction.ToggleModSelection, IsValidMod = IsValidMod }; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index eb5e996972..7317b20f88 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -333,7 +333,10 @@ namespace osu.Game.Screens.Select (new FooterButtonOptions(), BeatmapOptions) }; - protected virtual ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen(); + protected virtual ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen + { + Hotkey = GlobalAction.ToggleModSelection + }; protected virtual void ApplyFilterToCarousel(FilterCriteria criteria) { From 17c19063f7945ad3d40287f471875c0a109835f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 May 2022 21:24:11 +0200 Subject: [PATCH 0739/2328] Fix user dim test scene accumulating no fail instances in `SelectedMods` The old design was apparently somehow tolerant of multiple instances of the same mod in `SelectedMods`, but the new one is not. Fix the test, because appending to a list of mods that was getting modified by previous tests is generally not how tests should be written. --- .../Visual/Background/TestSceneUserDimBackgrounds.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs b/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs index f7140537ee..ef115ab66b 100644 --- a/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs +++ b/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Linq; using System.Threading; using NUnit.Framework; using osu.Framework.Allocation; @@ -283,7 +282,7 @@ namespace osu.Game.Tests.Visual.Background AddUntilStep("Song select has selection", () => songSelect.Carousel?.SelectedBeatmapInfo != null); AddStep("Set default user settings", () => { - SelectedMods.Value = SelectedMods.Value.Concat(new[] { new OsuModNoFail() }).ToArray(); + SelectedMods.Value = new[] { new OsuModNoFail() }; songSelect.DimLevel.Value = 0.7f; songSelect.BlurLevel.Value = 0.4f; }); From 199bdb8e7ded820c6a0b1663ef307d8564f9a831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 May 2022 21:43:39 +0200 Subject: [PATCH 0740/2328] Replace reference to old mod select in multiplayer test --- osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs index 6a69917fb4..8e26d1c562 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs @@ -622,7 +622,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("invoke on back button", () => multiplayerComponents.OnBackButton()); - AddAssert("mod overlay is hidden", () => this.ChildrenOfType().Single().State.Value == Visibility.Hidden); + AddAssert("mod overlay is hidden", () => this.ChildrenOfType().Single().State.Value == Visibility.Hidden); AddAssert("dialog overlay is hidden", () => DialogOverlay.State.Value == Visibility.Hidden); From ecc28050992e69ec8a1068ede63d8cd313623680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 May 2022 21:47:03 +0200 Subject: [PATCH 0741/2328] Replace references to old mod select classes in match song select test Also note the change from `songSelect.ChildrenOfType<>()...` to `this.ChildrenOfType<>()...` - because the new design is registered at game-level, the mod select is not a child of the song select screen anymore. --- .../Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs index 714951cc42..d170b12dc3 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs @@ -132,7 +132,7 @@ namespace osu.Game.Tests.Visual.Multiplayer private void assertHasFreeModButton(Type type, bool hasButton = true) { AddAssert($"{type.ReadableName()} {(hasButton ? "displayed" : "not displayed")} in freemod overlay", - () => songSelect.ChildrenOfType().Single().ChildrenOfType().All(b => b.Mod.GetType() != type)); + () => this.ChildrenOfType().Single().ChildrenOfType().All(b => b.Mod.GetType() != type)); } private class TestMultiplayerMatchSongSelect : MultiplayerMatchSongSelect From d296f78dfe097fdf70c759a416538ef7a1fa3fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 May 2022 21:59:44 +0200 Subject: [PATCH 0742/2328] Replace references to old mod select classes in multiplayer match screen test --- .../Multiplayer/TestSceneMultiplayerMatchSubScreen.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs index 057032c413..2abde82e92 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs @@ -168,8 +168,13 @@ namespace osu.Game.Tests.Visual.Multiplayer ClickButtonWhenEnabled(); + AddUntilStep("mod select contents loaded", + () => this.ChildrenOfType().Any() && this.ChildrenOfType().All(col => col.IsLoaded && col.ItemsLoaded)); AddUntilStep("mod select contains only double time mod", - () => this.ChildrenOfType().SingleOrDefault()?.ChildrenOfType().SingleOrDefault()?.Mod is OsuModDoubleTime); + () => this.ChildrenOfType() + .SingleOrDefault()? + .ChildrenOfType() + .SingleOrDefault(panel => !panel.Filtered.Value)?.Mod is OsuModDoubleTime); } } } From a2ab79620a2a7dd63260a23951b9b2d572046d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 May 2022 22:15:49 +0200 Subject: [PATCH 0743/2328] Update song select exit via click test to match new expectations --- .../Visual/Navigation/TestSceneScreenNavigation.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs index 8ba074a7d1..f8eee7be56 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs @@ -253,12 +253,12 @@ namespace osu.Game.Tests.Visual.Navigation PushAndConfirm(() => songSelect = new TestPlaySongSelect()); AddStep("Show mods overlay", () => songSelect.ModSelectOverlay.Show()); AddAssert("Overlay was shown", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible); - AddStep("Move mouse to backButton", () => InputManager.MoveMouseTo(backButtonPosition)); - // BackButton handles hover using its child button, so this checks whether or not any of BackButton's children are hovered. - AddUntilStep("Back button is hovered", () => Game.ChildrenOfType().First().Children.Any(c => c.IsHovered)); + AddStep("Move mouse to dimmed area", () => InputManager.MoveMouseTo(new Vector2( + songSelect.ScreenSpaceDrawQuad.TopLeft.X + 1, + songSelect.ScreenSpaceDrawQuad.TopLeft.Y + songSelect.ScreenSpaceDrawQuad.Height / 2))); + AddStep("Click left mouse button", () => InputManager.Click(MouseButton.Left)); - AddStep("Click back button", () => InputManager.Click(MouseButton.Left)); AddUntilStep("Overlay was hidden", () => songSelect.ModSelectOverlay.State.Value == Visibility.Hidden); exitViaBackButtonAndConfirm(); } From 16a6c11bc87a906b36e699fcd2101eac371dcb25 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Thu, 5 May 2022 21:39:31 +0100 Subject: [PATCH 0744/2328] Clamp maximum and minimum height the chat overlay can be resized to --- osu.Game/Overlays/ChatOverlayV2.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index cab88136fc..8b6fe70f3c 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -3,6 +3,7 @@ #nullable enable +using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; @@ -44,8 +45,11 @@ namespace osu.Game.Overlays private bool isDraggingTopBar; private float dragStartChatHeight; - private const int transition_length = 500; + private const float min_chat_height = 0.2f; + private const float max_chat_height = 1f; private const float default_chat_height = 0.4f; + + private const int transition_length = 500; private const float top_bar_height = 40; private const float side_bar_width = 190; private const float chat_bar_height = 60; @@ -215,7 +219,7 @@ namespace osu.Game.Overlays return; float targetChatHeight = dragStartChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y; - chatHeight.Value = targetChatHeight; + chatHeight.Value = Math.Clamp(targetChatHeight, min_chat_height, max_chat_height); } protected override void OnDragEnd(DragEndEvent e) From 0974de8fb007afdca51520ac44204c408a6d3523 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Thu, 5 May 2022 23:13:32 +0100 Subject: [PATCH 0745/2328] Use `BindableFloat` for chat height --- osu.Game/Overlays/ChatOverlayV2.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 8b6fe70f3c..4c7fa0f802 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -3,7 +3,6 @@ #nullable enable -using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; @@ -40,16 +39,13 @@ namespace osu.Game.Overlays private ChatTextBar textBar = null!; private Container currentChannelContainer = null!; - private readonly Bindable chatHeight = new Bindable(); + private readonly BindableFloat chatHeight = new BindableFloat(); private bool isDraggingTopBar; private float dragStartChatHeight; - private const float min_chat_height = 0.2f; - private const float max_chat_height = 1f; - private const float default_chat_height = 0.4f; - private const int transition_length = 500; + private const float default_chat_height = 0.4f; private const float top_bar_height = 40; private const float side_bar_width = 190; private const float chat_bar_height = 60; @@ -219,7 +215,7 @@ namespace osu.Game.Overlays return; float targetChatHeight = dragStartChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y; - chatHeight.Value = Math.Clamp(targetChatHeight, min_chat_height, max_chat_height); + chatHeight.Value = targetChatHeight; } protected override void OnDragEnd(DragEndEvent e) From 7ffe3b132fbe12ff2f8689fbc330aecf90bd1249 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Thu, 5 May 2022 23:13:43 +0100 Subject: [PATCH 0746/2328] Use `BindableFloat` in chat height tests --- .../Visual/Online/TestSceneChatOverlayV2.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 98574e5d53..7c77ac925e 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -133,22 +133,22 @@ namespace osu.Game.Tests.Visual.Online [Test] public void TestChatHeight() { - Bindable configChatHeight = null; + BindableFloat configChatHeight = new BindableFloat(); + config.BindWith(OsuSetting.ChatDisplayHeight, configChatHeight); float newHeight = 0; - AddStep("Bind config chat height", () => configChatHeight = config.GetBindable(OsuSetting.ChatDisplayHeight).GetBoundCopy()); - AddStep("Set config chat height", () => configChatHeight.Value = 0.4f); + AddStep("Reset config chat height", () => configChatHeight.SetDefault()); AddStep("Show overlay", () => chatOverlay.Show()); - AddAssert("Overlay uses config height", () => chatOverlay.Height == 0.4f); - AddStep("Drag overlay to new height", () => + AddAssert("Overlay uses config height", () => chatOverlay.Height == configChatHeight.Default); + AddStep("Click top bar", () => { InputManager.MoveMouseTo(chatOverlayTopBar); InputManager.PressButton(MouseButton.Left); - InputManager.MoveMouseTo(chatOverlayTopBar, new Vector2(0, -300)); - InputManager.ReleaseButton(MouseButton.Left); }); + AddStep("Drag overlay to new height", () => InputManager.MoveMouseTo(chatOverlayTopBar, new Vector2(0, -300))); + AddStep("Stop dragging", () => InputManager.ReleaseButton(MouseButton.Left)); AddStep("Store new height", () => newHeight = chatOverlay.Height); - AddAssert("Config height changed", () => configChatHeight.Value != 0.4f && configChatHeight.Value == newHeight); + AddAssert("Config height changed", () => !configChatHeight.IsDefault && configChatHeight.Value == newHeight); AddStep("Hide overlay", () => chatOverlay.Hide()); AddStep("Show overlay", () => chatOverlay.Show()); AddAssert("Overlay uses new height", () => chatOverlay.Height == newHeight); From be960eb092aacf2f8651d5099b1eb2d1eb09a8a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 14:34:31 +0900 Subject: [PATCH 0747/2328] Move dangerous hold specification to base class --- .../Containers/HoldToConfirmContainer.cs | 32 ++++++++++---- .../Dialog/PopupDialogDangerousButton.cs | 7 ++-- .../Screens/Play/HUD/HoldForMenuButton.cs | 42 +++++++------------ 3 files changed, 43 insertions(+), 38 deletions(-) diff --git a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs index c74245461d..078721ec77 100644 --- a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs +++ b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs @@ -12,6 +12,13 @@ namespace osu.Game.Graphics.Containers { public abstract class HoldToConfirmContainer : Container { + public const double DANGEROUS_HOLD_ACTIVATION_DELAY = 500; + + /// + /// Whether the associated action is considered dangerous, warranting a longer hold. + /// + public bool IsDangerousAction { get; } + public Action Action; private const int fadeout_delay = 200; @@ -29,12 +36,9 @@ namespace osu.Game.Graphics.Containers protected virtual bool AllowMultipleFires => false; /// - /// Specify a custom activation delay, overriding the game-wide user setting. + /// The current activation delay for this control. /// - /// - /// This should be used in special cases where we want to be extra sure the user knows what they are doing. An example is when changes would be lost. - /// - protected virtual double? HoldActivationDelay => null; + protected IBindable HoldActivationDelay => holdActivationDelay; public Bindable Progress = new BindableDouble(); @@ -43,13 +47,25 @@ namespace osu.Game.Graphics.Containers [Resolved] private OsuConfigManager config { get; set; } + protected HoldToConfirmContainer(bool isDangerousAction = false) + { + IsDangerousAction = isDangerousAction; + } + protected override void LoadComplete() { base.LoadComplete(); - holdActivationDelay = HoldActivationDelay != null - ? new Bindable(HoldActivationDelay.Value) - : config.GetBindable(OsuSetting.UIHoldActivationDelay); + if (IsDangerousAction) + { + holdActivationDelay.Value = DANGEROUS_HOLD_ACTIVATION_DELAY; + } + else + { + holdActivationDelay = HoldActivationDelay != null + ? new Bindable(HoldActivationDelay.Value) + : config.GetBindable(OsuSetting.UIHoldActivationDelay); + } } protected void BeginConfirm() diff --git a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs index 6c775f44f8..6239c5e409 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs @@ -12,8 +12,6 @@ namespace osu.Game.Overlays.Dialog { public class PopupDialogDangerousButton : PopupDialogButton { - public const double DANGEROUS_HOLD_ACTIVATION_DELAY = 500; - private Box progressBox; private DangerousConfirmContainer confirmContainer; @@ -44,7 +42,10 @@ namespace osu.Game.Overlays.Dialog private class DangerousConfirmContainer : HoldToConfirmContainer { - protected override double? HoldActivationDelay => DANGEROUS_HOLD_ACTIVATION_DELAY; + public DangerousConfirmContainer() + : base(isDangerousAction: true) + { + } protected override bool OnMouseDown(MouseDownEvent e) { diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index c6aa3fbe08..9d280a1737 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -13,12 +13,10 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Framework.Utils; -using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Input.Bindings; -using osu.Game.Overlays.Dialog; using osuTK; namespace osu.Game.Screens.Play.HUD @@ -29,20 +27,11 @@ namespace osu.Game.Screens.Play.HUD public readonly Bindable IsPaused = new Bindable(); - private readonly Button button; + private Button button; - public Action Action - { - set => button.Action = value; - } + public Action Action { get; set; } - private readonly OsuSpriteText text; - - [Resolved] - private OsuConfigManager config { get; set; } - - [Resolved(canBeNull: true)] - private Player player { get; set; } + private OsuSpriteText text; private readonly Bindable activationDelay = new Bindable(); @@ -51,6 +40,11 @@ namespace osu.Game.Screens.Play.HUD Direction = FillDirection.Horizontal; Spacing = new Vector2(20, 0); Margin = new MarginPadding(10); + } + + [BackgroundDependencyLoader(true)] + private void load(Player player) + { Children = new Drawable[] { text = new OsuSpriteText @@ -59,11 +53,12 @@ namespace osu.Game.Screens.Play.HUD Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft }, - button = new Button + button = new Button(player?.Configuration.AllowRestart == false) { HoverGained = () => text.FadeIn(500, Easing.OutQuint), HoverLost = () => text.FadeOut(500, Easing.OutQuint), - IsPaused = { BindTarget = IsPaused } + IsPaused = { BindTarget = IsPaused }, + Action = () => Action(), } }; AutoSizeAxes = Axes.Both; @@ -71,13 +66,6 @@ namespace osu.Game.Screens.Play.HUD protected override void LoadComplete() { - if (player?.Configuration.AllowRestart == false) - { - activationDelay.Value = PopupDialogDangerousButton.DANGEROUS_HOLD_ACTIVATION_DELAY; - } - else - config.BindWith(OsuSetting.UIHoldActivationDelay, activationDelay); - activationDelay.BindValueChanged(v => { text.Text = v.NewValue > 0 @@ -125,10 +113,10 @@ namespace osu.Game.Screens.Play.HUD public Action HoverGained; public Action HoverLost; - [Resolved(canBeNull: true)] - private Player player { get; set; } - - protected override double? HoldActivationDelay => player?.Configuration.AllowRestart == false ? PopupDialogDangerousButton.DANGEROUS_HOLD_ACTIVATION_DELAY : (double?)null; + public Button(bool isDangerousAction) + : base(isDangerousAction) + { + } [BackgroundDependencyLoader] private void load(OsuColour colours) From a11771c11b82992c2b5dfdda3acfcc09c59121e1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 14:37:50 +0900 Subject: [PATCH 0748/2328] Better encapsulate exposed bindables of `HoldToConfirmContainer` --- .../Containers/HoldToConfirmContainer.cs | 40 ++++++++++--------- .../Screens/Play/HUD/HoldForMenuButton.cs | 2 +- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs index 078721ec77..540f9b97a7 100644 --- a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs +++ b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs @@ -14,15 +14,18 @@ namespace osu.Game.Graphics.Containers { public const double DANGEROUS_HOLD_ACTIVATION_DELAY = 500; + private const int fadeout_delay = 200; + /// /// Whether the associated action is considered dangerous, warranting a longer hold. /// public bool IsDangerousAction { get; } + /// + /// The action to perform when a hold successfully completes. + /// public Action Action; - private const int fadeout_delay = 200; - /// /// Whether currently in a fired state (and the confirm has been sent). /// @@ -30,19 +33,24 @@ namespace osu.Game.Graphics.Containers private bool confirming; + /// + /// The current activation delay for this control. + /// + public IBindable HoldActivationDelay => holdActivationDelay; + + /// + /// The progress of any ongoing hold operation. 0 means no hold has started; 1 means a hold has been completed. + /// + public IBindable Progress => progress; + /// /// Whether the overlay should be allowed to return from a fired state. /// protected virtual bool AllowMultipleFires => false; - /// - /// The current activation delay for this control. - /// - protected IBindable HoldActivationDelay => holdActivationDelay; + private readonly Bindable progress = new BindableDouble(); - public Bindable Progress = new BindableDouble(); - - private Bindable holdActivationDelay; + private readonly Bindable holdActivationDelay = new Bindable(); [Resolved] private OsuConfigManager config { get; set; } @@ -57,15 +65,9 @@ namespace osu.Game.Graphics.Containers base.LoadComplete(); if (IsDangerousAction) - { holdActivationDelay.Value = DANGEROUS_HOLD_ACTIVATION_DELAY; - } else - { - holdActivationDelay = HoldActivationDelay != null - ? new Bindable(HoldActivationDelay.Value) - : config.GetBindable(OsuSetting.UIHoldActivationDelay); - } + config.BindWith(OsuSetting.UIHoldActivationDelay, holdActivationDelay); } protected void BeginConfirm() @@ -74,7 +76,7 @@ namespace osu.Game.Graphics.Containers confirming = true; - this.TransformBindableTo(Progress, 1, holdActivationDelay.Value * (1 - Progress.Value), Easing.Out).OnComplete(_ => Confirm()); + this.TransformBindableTo(progress, 1, holdActivationDelay.Value * (1 - progress.Value), Easing.Out).OnComplete(_ => Confirm()); } protected virtual void Confirm() @@ -91,9 +93,9 @@ namespace osu.Game.Graphics.Containers Fired = false; this - .TransformBindableTo(Progress, Progress.Value) + .TransformBindableTo(progress, progress.Value) .Delay(200) - .TransformBindableTo(Progress, 0, fadeout_delay, Easing.InSine); + .TransformBindableTo(progress, 0, fadeout_delay, Easing.InSine); } } } diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index 9d280a1737..678c4256b4 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -164,7 +164,7 @@ namespace osu.Game.Screens.Play.HUD private void bind() { - circularProgress.Current.BindTo(Progress); + ((IBindable)circularProgress.Current).BindTo(Progress); Progress.ValueChanged += progress => icon.Scale = new Vector2(1 + (float)progress.NewValue * 0.2f); } From c38e97c9ecb390496c576ab815911a87d17c1a04 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 14:43:24 +0900 Subject: [PATCH 0749/2328] Add full xmldoc to `HoldToConfirmContainer` --- .../Containers/HoldToConfirmContainer.cs | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs index 540f9b97a7..28afd082c3 100644 --- a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs +++ b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs @@ -10,6 +10,16 @@ using osu.Game.Configuration; namespace osu.Game.Graphics.Containers { + /// + /// A container which adds a common "hold-to-perform" pattern to a container. + /// + /// + /// This container does not handle triggering the hold/abort operations. + /// To use this class, please call and when necessary. + /// + /// The is exposed as a transforming bindable which smoothly tracks the progress of a hold operation. + /// It can be used for animating and displaying progress directly. + /// public abstract class HoldToConfirmContainer : Container { public const double DANGEROUS_HOLD_ACTIVATION_DELAY = 500; @@ -70,6 +80,12 @@ namespace osu.Game.Graphics.Containers config.BindWith(OsuSetting.UIHoldActivationDelay, holdActivationDelay); } + /// + /// Begin a new confirmation. Should be called when the container is interacted with (ie. the user presses a key). + /// + /// + /// Calling this method when already in the process of confirming has no effect. + /// protected void BeginConfirm() { if (confirming || (!AllowMultipleFires && Fired)) return; @@ -79,12 +95,9 @@ namespace osu.Game.Graphics.Containers this.TransformBindableTo(progress, 1, holdActivationDelay.Value * (1 - progress.Value), Easing.Out).OnComplete(_ => Confirm()); } - protected virtual void Confirm() - { - Action?.Invoke(); - Fired = true; - } - + /// + /// Abort any ongoing confirmation. Should be called when the container's interaction is no longer valid (ie. the user releases a key). + /// protected void AbortConfirm() { if (!AllowMultipleFires && Fired) return; @@ -97,5 +110,15 @@ namespace osu.Game.Graphics.Containers .Delay(200) .TransformBindableTo(progress, 0, fadeout_delay, Easing.InSine); } + + /// + /// A method which is invoked when the confirmation sequence completes successfully. + /// By default, will fire the associated . + /// + protected virtual void Confirm() + { + Action?.Invoke(); + Fired = true; + } } } From 1c4aa125859d2de65858661b38bc207706a65625 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 14:44:10 +0900 Subject: [PATCH 0750/2328] Rename non-descript `Button` nested class --- osu.Game/Screens/Play/HUD/HoldForMenuButton.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index 678c4256b4..e3283062ef 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -27,7 +27,7 @@ namespace osu.Game.Screens.Play.HUD public readonly Bindable IsPaused = new Bindable(); - private Button button; + private HoldButton button; public Action Action { get; set; } @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Play.HUD Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft }, - button = new Button(player?.Configuration.AllowRestart == false) + button = new HoldButton(player?.Configuration.AllowRestart == false) { HoverGained = () => text.FadeIn(500, Easing.OutQuint), HoverLost = () => text.FadeOut(500, Easing.OutQuint), @@ -100,7 +100,7 @@ namespace osu.Game.Screens.Play.HUD } } - private class Button : HoldToConfirmContainer, IKeyBindingHandler + private class HoldButton : HoldToConfirmContainer, IKeyBindingHandler { private SpriteIcon icon; private CircularProgress circularProgress; @@ -113,7 +113,7 @@ namespace osu.Game.Screens.Play.HUD public Action HoverGained; public Action HoverLost; - public Button(bool isDangerousAction) + public HoldButton(bool isDangerousAction) : base(isDangerousAction) { } From 78959a6e05a4cf753dfc59d480b2fdf041296c33 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 15:01:24 +0900 Subject: [PATCH 0751/2328] Add animation to denote a dangerous player exit --- .../Screens/Play/HUD/HoldForMenuButton.cs | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index e3283062ef..f892ea1049 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -12,12 +12,14 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; +using osu.Framework.Threading; using osu.Framework.Utils; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Input.Bindings; using osuTK; +using osuTK.Graphics; namespace osu.Game.Screens.Play.HUD { @@ -113,6 +115,11 @@ namespace osu.Game.Screens.Play.HUD public Action HoverGained; public Action HoverLost; + private const double shake_duration = 20; + + private bool pendingAnimation; + private ScheduledDelegate shakeOperation; + public HoldButton(bool isDangerousAction) : base(isDangerousAction) { @@ -165,10 +172,38 @@ namespace osu.Game.Screens.Play.HUD private void bind() { ((IBindable)circularProgress.Current).BindTo(Progress); - Progress.ValueChanged += progress => icon.Scale = new Vector2(1 + (float)progress.NewValue * 0.2f); + Progress.ValueChanged += progress => + { + icon.Scale = new Vector2(1 + (float)progress.NewValue * 0.2f); + + if (IsDangerousAction) + { + //Child.Scale = new Vector2(1 + (float)progress.NewValue); + Colour = Interpolation.ValueAt(progress.NewValue, Color4.White, Color4.Red, 0, 1, Easing.OutQuint); + + if (progress.NewValue > 0 && progress.NewValue < 1) + { + shakeOperation ??= Scheduler.AddDelayed(shake, shake_duration, true); + } + else + { + Child.MoveTo(Vector2.Zero, shake_duration * 2, Easing.OutQuint); + shakeOperation?.Cancel(); + shakeOperation = null; + } + } + }; } - private bool pendingAnimation; + private void shake() + { + const float shake_magnitude = 8; + + Child.MoveTo(new Vector2( + RNG.NextSingle(-1, 1) * (float)Progress.Value * shake_magnitude, + RNG.NextSingle(-1, 1) * (float)Progress.Value * shake_magnitude + ), shake_duration); + } protected override void Confirm() { From 060461a431a3fe99a46786b652cba234933fbc85 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 15:22:22 +0900 Subject: [PATCH 0752/2328] Add test coverage of multiplayer gameplay exit flow --- .../Multiplayer/TestSceneMultiplayer.cs | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs index 6a69917fb4..8e45d99eae 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs @@ -7,6 +7,7 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; +using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics.Containers; @@ -17,6 +18,7 @@ using osu.Framework.Screens; using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Beatmaps; +using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; @@ -56,6 +58,9 @@ namespace osu.Game.Tests.Visual.Multiplayer private TestMultiplayerClient multiplayerClient => multiplayerComponents.MultiplayerClient; private TestMultiplayerRoomManager roomManager => multiplayerComponents.RoomManager; + [Resolved] + private OsuConfigManager config { get; set; } + [BackgroundDependencyLoader] private void load(GameHost host, AudioManager audio) { @@ -668,6 +673,43 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("wait for results", () => multiplayerComponents.CurrentScreen is ResultsScreen); } + [Test] + public void TestGameplayExitFlow() + { + Bindable holdDelay = null; + + AddStep("Set hold delay to zero", () => + { + holdDelay = config.GetBindable(OsuSetting.UIHoldActivationDelay); + holdDelay.Value = 0; + }); + + createRoom(() => new Room + { + Name = { Value = "Test Room" }, + Playlist = + { + new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo) + { + RulesetID = new OsuRuleset().RulesetInfo.OnlineID, + } + } + }); + + enterGameplay(); + + AddUntilStep("wait for playing", () => this.ChildrenOfType().FirstOrDefault()?.LocalUserPlaying.Value == true); + + AddStep("attempt exit without hold", () => InputManager.Key(Key.Escape)); + AddAssert("still in gameplay", () => multiplayerComponents.CurrentScreen is Player); + + AddStep("attempt exit with hold", () => InputManager.PressKey(Key.Escape)); + AddUntilStep("wait for lounge", () => multiplayerComponents.CurrentScreen is Screens.OnlinePlay.Multiplayer.Multiplayer); + + AddStep("stop holding", () => InputManager.ReleaseKey(Key.Escape)); + AddStep("set hold delay to default", () => holdDelay.SetDefault()); + } + [Test] public void TestGameplayDoesntStartWithNonLoadedUser() { From 32b40bdabfaa99f6c01ecf22a07c222b064103cd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 15:45:36 +0900 Subject: [PATCH 0753/2328] Rename `DistanceBetweenTick` to be plural --- .../Visual/Editing/TestSceneDistanceSnapGrid.cs | 14 +++++++------- .../Compose/Components/CircularDistanceSnapGrid.cs | 10 +++++----- .../Edit/Compose/Components/DistanceSnapGrid.cs | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs index 7d8089b435..9148965987 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs @@ -79,7 +79,7 @@ namespace osu.Game.Tests.Visual.Editing public void TestDistanceSpacing(double multiplier) { AddStep($"set distance spacing = {multiplier}", () => snapProvider.DistanceSpacingMultiplier.Value = multiplier); - AddAssert("distance spacing matches multiplier", () => grid.DistanceBetweenTick == beat_snap_distance * multiplier); + AddAssert("distance spacing matches multiplier", () => grid.DistanceBetweenTicks == beat_snap_distance * multiplier); } [TestCase(1.0)] @@ -103,12 +103,12 @@ namespace osu.Game.Tests.Visual.Editing }); AddStep($"set distance spacing = {multiplier}", () => snapProvider.DistanceSpacingMultiplier.Value = multiplier); - AddAssert("check correct interval count", () => grid.MaxIntervals == (end_time / grid.DistanceBetweenTick)); + AddAssert("check correct interval count", () => grid.MaxIntervals == (end_time / grid.DistanceBetweenTicks)); } private class TestDistanceSnapGrid : DistanceSnapGrid { - public new float DistanceBetweenTick => base.DistanceBetweenTick; + public new float DistanceBetweenTicks => base.DistanceBetweenTicks; public new int MaxIntervals => base.MaxIntervals; @@ -128,7 +128,7 @@ namespace osu.Game.Tests.Visual.Editing int indexFromPlacement = 0; - for (float s = StartPosition.X + DistanceBetweenTick; s <= DrawWidth && indexFromPlacement < MaxIntervals; s += DistanceBetweenTick, indexFromPlacement++) + for (float s = StartPosition.X + DistanceBetweenTicks; s <= DrawWidth && indexFromPlacement < MaxIntervals; s += DistanceBetweenTicks, indexFromPlacement++) { AddInternal(new Circle { @@ -141,7 +141,7 @@ namespace osu.Game.Tests.Visual.Editing indexFromPlacement = 0; - for (float s = StartPosition.X - DistanceBetweenTick; s >= 0 && indexFromPlacement < MaxIntervals; s -= DistanceBetweenTick, indexFromPlacement++) + for (float s = StartPosition.X - DistanceBetweenTicks; s >= 0 && indexFromPlacement < MaxIntervals; s -= DistanceBetweenTicks, indexFromPlacement++) { AddInternal(new Circle { @@ -154,7 +154,7 @@ namespace osu.Game.Tests.Visual.Editing indexFromPlacement = 0; - for (float s = StartPosition.Y + DistanceBetweenTick; s <= DrawHeight && indexFromPlacement < MaxIntervals; s += DistanceBetweenTick, indexFromPlacement++) + for (float s = StartPosition.Y + DistanceBetweenTicks; s <= DrawHeight && indexFromPlacement < MaxIntervals; s += DistanceBetweenTicks, indexFromPlacement++) { AddInternal(new Circle { @@ -167,7 +167,7 @@ namespace osu.Game.Tests.Visual.Editing indexFromPlacement = 0; - for (float s = StartPosition.Y - DistanceBetweenTick; s >= 0 && indexFromPlacement < MaxIntervals; s -= DistanceBetweenTick, indexFromPlacement++) + for (float s = StartPosition.Y - DistanceBetweenTicks; s >= 0 && indexFromPlacement < MaxIntervals; s -= DistanceBetweenTicks, indexFromPlacement++) { AddInternal(new Circle { diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index 2873d74f75..ee8ca80c01 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -30,14 +30,14 @@ namespace osu.Game.Screens.Edit.Compose.Components Position = StartPosition, Width = crosshair_thickness, EdgeSmoothness = new Vector2(1), - Height = Math.Min(crosshair_max_size, DistanceBetweenTick * 2), + Height = Math.Min(crosshair_max_size, DistanceBetweenTicks * 2), }, new Box { Origin = Anchor.Centre, Position = StartPosition, EdgeSmoothness = new Vector2(1), - Width = Math.Min(crosshair_max_size, DistanceBetweenTick * 2), + Width = Math.Min(crosshair_max_size, DistanceBetweenTicks * 2), Height = crosshair_thickness, } }); @@ -45,11 +45,11 @@ namespace osu.Game.Screens.Edit.Compose.Components float dx = Math.Max(StartPosition.X, DrawWidth - StartPosition.X); float dy = Math.Max(StartPosition.Y, DrawHeight - StartPosition.Y); float maxDistance = new Vector2(dx, dy).Length; - int requiredCircles = Math.Min(MaxIntervals, (int)(maxDistance / DistanceBetweenTick)); + int requiredCircles = Math.Min(MaxIntervals, (int)(maxDistance / DistanceBetweenTicks)); for (int i = 0; i < requiredCircles; i++) { - float radius = (i + 1) * DistanceBetweenTick * 2; + float radius = (i + 1) * DistanceBetweenTicks * 2; AddInternal(new CircularProgress { @@ -80,7 +80,7 @@ namespace osu.Game.Screens.Edit.Compose.Components float travelLength = travelVector.Length; // FindSnappedDistance will always round down, but we want to potentially round upwards. - travelLength += DistanceBetweenTick / 2; + travelLength += DistanceBetweenTicks / 2; // When interacting with the resolved snap provider, the distance spacing multiplier should first be removed // to allow for snapping at a non-multiplied ratio. diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index b9e0cfef19..742fbc99ca 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Edit.Compose.Components /// /// The spacing between each tick of the beat snapping grid. /// - protected float DistanceBetweenTick { get; private set; } + protected float DistanceBetweenTicks { get; private set; } protected IBindable DistanceSpacingMultiplier { get; private set; } @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Edit.Compose.Components /// /// The position which the grid should start. - /// The first beat snapping tick is located at + away from this point. + /// The first beat snapping tick is located at + away from this point. /// protected readonly Vector2 StartPosition; @@ -93,7 +93,7 @@ namespace osu.Game.Screens.Edit.Compose.Components private void updateSpacing() { - DistanceBetweenTick = (float)(SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * DistanceSpacingMultiplier.Value); + DistanceBetweenTicks = (float)(SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * DistanceSpacingMultiplier.Value); if (LatestEndTime == null) MaxIntervals = int.MaxValue; @@ -101,7 +101,7 @@ namespace osu.Game.Screens.Edit.Compose.Components { // +1 is added since a snapped hitobject may have its start time slightly less than the snapped time due to floating point errors double maxDuration = LatestEndTime.Value - StartTime + 1; - MaxIntervals = (int)(maxDuration / SnapProvider.DistanceToDuration(ReferenceObject, DistanceBetweenTick)); + MaxIntervals = (int)(maxDuration / SnapProvider.DistanceToDuration(ReferenceObject, DistanceBetweenTicks)); } gridCache.Invalidate(); From 246479bf34c725d886742017099f9d509e58b2f7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 15:54:37 +0900 Subject: [PATCH 0754/2328] Fix snap extent not working correctly on sliders (and providing incorrect time values) --- .../Edit/Compose/Components/CircularDistanceSnapGrid.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index ee8ca80c01..ffa4176a48 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -89,7 +89,8 @@ namespace osu.Game.Screens.Edit.Compose.Components if (snappedTime > LatestEndTime) { - snappedDistance = SnapProvider.DurationToDistance(ReferenceObject, LatestEndTime.Value - ReferenceObject.StartTime); + snappedDistance = SnapProvider.DurationToDistance(ReferenceObject, LatestEndTime.Value - ReferenceObject.GetEndTime()); + snappedTime = StartTime + SnapProvider.DistanceToDuration(ReferenceObject, snappedDistance); } // The multiplier can then be reapplied to the final position. From f39fcee41bae044337bca75e5619f88772b50a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 10:04:00 +0200 Subject: [PATCH 0755/2328] Remove commented-out code --- osu.Game/Screens/Play/HUD/HoldForMenuButton.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index f892ea1049..8ed7260aac 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -178,7 +178,6 @@ namespace osu.Game.Screens.Play.HUD if (IsDangerousAction) { - //Child.Scale = new Vector2(1 + (float)progress.NewValue); Colour = Interpolation.ValueAt(progress.NewValue, Color4.White, Color4.Red, 0, 1, Easing.OutQuint); if (progress.NewValue > 0 && progress.NewValue < 1) From f5026bbbeb579dfe72325fbbab92647ceafcafd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 10:04:36 +0200 Subject: [PATCH 0756/2328] Bind to button's activation delay directly --- osu.Game/Screens/Play/HUD/HoldForMenuButton.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index 8ed7260aac..2ba76d0896 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -35,8 +35,6 @@ namespace osu.Game.Screens.Play.HUD private OsuSpriteText text; - private readonly Bindable activationDelay = new Bindable(); - public HoldForMenuButton() { Direction = FillDirection.Horizontal; @@ -68,7 +66,7 @@ namespace osu.Game.Screens.Play.HUD protected override void LoadComplete() { - activationDelay.BindValueChanged(v => + button.HoldActivationDelay.BindValueChanged(v => { text.Text = v.NewValue > 0 ? "hold for menu" From c7e7aa5962c12cda3e74b161e0f4b30130b5a026 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 17:05:52 +0900 Subject: [PATCH 0757/2328] Don't draw distance snap grid on the start time of the next object --- osu.Game.Rulesets.Osu/Edit/OsuDistanceSnapGrid.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu/Edit/OsuDistanceSnapGrid.cs index 8a561f962a..b11929c1e8 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuDistanceSnapGrid.cs @@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Osu.Edit public class OsuDistanceSnapGrid : CircularDistanceSnapGrid { public OsuDistanceSnapGrid(OsuHitObject hitObject, [CanBeNull] OsuHitObject nextHitObject = null) - : base(hitObject, hitObject.StackedEndPosition, hitObject.GetEndTime(), nextHitObject?.StartTime) + : base(hitObject, hitObject.StackedEndPosition, hitObject.GetEndTime(), nextHitObject?.StartTime - 1) { Masking = true; } From 684fef7f8cf813f616b96cb0c3abfe009ccf40d5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 17:09:02 +0900 Subject: [PATCH 0758/2328] Fix `MaxIntervals` incorrectly factoring distance spacing multipiler into snap calculation --- .../Edit/Compose/Components/DistanceSnapGrid.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index 742fbc99ca..2f39db06d4 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -52,7 +52,7 @@ namespace osu.Game.Screens.Edit.Compose.Components protected IDistanceSnapProvider SnapProvider { get; private set; } [Resolved] - private EditorBeatmap beatmap { get; set; } + protected EditorBeatmap Beatmap { get; private set; } [Resolved] private BindableBeatDivisor beatDivisor { get; set; } @@ -93,16 +93,15 @@ namespace osu.Game.Screens.Edit.Compose.Components private void updateSpacing() { - DistanceBetweenTicks = (float)(SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * DistanceSpacingMultiplier.Value); + float distanceSpacingMultiplier = (float)DistanceSpacingMultiplier.Value; + float beatSnapDistance = SnapProvider.GetBeatSnapDistanceAt(ReferenceObject); + + DistanceBetweenTicks = beatSnapDistance * distanceSpacingMultiplier; if (LatestEndTime == null) MaxIntervals = int.MaxValue; else - { - // +1 is added since a snapped hitobject may have its start time slightly less than the snapped time due to floating point errors - double maxDuration = LatestEndTime.Value - StartTime + 1; - MaxIntervals = (int)(maxDuration / SnapProvider.DistanceToDuration(ReferenceObject, DistanceBetweenTicks)); - } + MaxIntervals = (int)((LatestEndTime.Value - StartTime) / SnapProvider.DistanceToDuration(ReferenceObject, beatSnapDistance)); gridCache.Invalidate(); } @@ -138,7 +137,7 @@ namespace osu.Game.Screens.Edit.Compose.Components /// The applicable colour. protected ColourInfo GetColourForIndexFromPlacement(int placementIndex) { - var timingPoint = beatmap.ControlPointInfo.TimingPointAt(StartTime); + var timingPoint = Beatmap.ControlPointInfo.TimingPointAt(StartTime); double beatLength = timingPoint.BeatLength / beatDivisor.Value; int beatIndex = (int)Math.Round((StartTime - timingPoint.Time) / beatLength); From 37cbc792834b9128ae2dfdcb8deba7abe6129766 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 17:09:38 +0900 Subject: [PATCH 0759/2328] Fix clamping logic to always clamp to the last displayed tick --- .../Compose/Components/CircularDistanceSnapGrid.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index ffa4176a48..13d838234e 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -70,7 +70,7 @@ namespace osu.Game.Screens.Edit.Compose.Components // This grid implementation factors in the user's distance spacing specification, // which is usually not considered by an `IDistanceSnapProvider`. - float distanceSpacing = (float)DistanceSpacingMultiplier.Value; + float distanceSpacingMultiplier = (float)DistanceSpacingMultiplier.Value; Vector2 travelVector = (position - StartPosition); @@ -84,17 +84,19 @@ namespace osu.Game.Screens.Edit.Compose.Components // When interacting with the resolved snap provider, the distance spacing multiplier should first be removed // to allow for snapping at a non-multiplied ratio. - float snappedDistance = SnapProvider.FindSnappedDistance(ReferenceObject, travelLength / distanceSpacing); + float snappedDistance = SnapProvider.FindSnappedDistance(ReferenceObject, travelLength / distanceSpacingMultiplier); double snappedTime = StartTime + SnapProvider.DistanceToDuration(ReferenceObject, snappedDistance); if (snappedTime > LatestEndTime) { - snappedDistance = SnapProvider.DurationToDistance(ReferenceObject, LatestEndTime.Value - ReferenceObject.GetEndTime()); + double tickLength = Beatmap.GetBeatLengthAtTime(StartTime); + + snappedDistance = SnapProvider.DurationToDistance(ReferenceObject, MaxIntervals * tickLength); snappedTime = StartTime + SnapProvider.DistanceToDuration(ReferenceObject, snappedDistance); } // The multiplier can then be reapplied to the final position. - Vector2 snappedPosition = StartPosition + travelVector.Normalized() * snappedDistance * distanceSpacing; + Vector2 snappedPosition = StartPosition + travelVector.Normalized() * snappedDistance * distanceSpacingMultiplier; return (snappedPosition, snappedTime); } From 319867f73c968d9238ac319c05ed03fe38fa3076 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 17:32:55 +0900 Subject: [PATCH 0760/2328] Mark `GuestUser` as system user via `Id` for now Should resolve https://github.com/ppy/osu/issues/18105. Checking through usages, it doesn't immediately look like this will regress any other scenarios. --- osu.Game/Online/API/APIAccess.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 8c9741b98b..62ddd49881 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -458,7 +458,7 @@ namespace osu.Game.Online.API public GuestUser() { Username = @"Guest"; - Id = 1; + Id = SYSTEM_USER_ID; } } From 118e58888b77d38a2b202c97ad7fe5ed11ff3ab9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 17:51:51 +0900 Subject: [PATCH 0761/2328] Rename incorrectly named variable (radius is not diameter) --- .../Edit/Compose/Components/CircularDistanceSnapGrid.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index 13d838234e..91fad08aff 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -49,15 +49,15 @@ namespace osu.Game.Screens.Edit.Compose.Components for (int i = 0; i < requiredCircles; i++) { - float radius = (i + 1) * DistanceBetweenTicks * 2; + float diameter = (i + 1) * DistanceBetweenTicks * 2; AddInternal(new CircularProgress { Origin = Anchor.Centre, Position = StartPosition, Current = { Value = 1 }, - Size = new Vector2(radius), - InnerRadius = 4 * 1f / radius, + Size = new Vector2(diameter), + InnerRadius = 4 * 1f / diameter, Colour = GetColourForIndexFromPlacement(i) }); } From 69592722f80f0869a1ddbe42fbe76564c6252c5e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 18:25:02 +0900 Subject: [PATCH 0762/2328] Highlight distance snap grid rings that are close to the current time value --- .../Components/CircularDistanceSnapGrid.cs | 45 +++++++++++++++++-- .../Compose/Components/DistanceSnapGrid.cs | 7 +-- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index 91fad08aff..5682b5563e 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -2,11 +2,15 @@ // See the LICENCE file in the repository root for full licence text. using System; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; +using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osuTK; +using osuTK.Graphics; namespace osu.Game.Screens.Edit.Compose.Components { @@ -51,14 +55,12 @@ namespace osu.Game.Screens.Edit.Compose.Components { float diameter = (i + 1) * DistanceBetweenTicks * 2; - AddInternal(new CircularProgress + AddInternal(new Ring(ReferenceObject, GetColourForIndexFromPlacement(i)) { - Origin = Anchor.Centre, Position = StartPosition, - Current = { Value = 1 }, + Origin = Anchor.Centre, Size = new Vector2(diameter), InnerRadius = 4 * 1f / diameter, - Colour = GetColourForIndexFromPlacement(i) }); } } @@ -100,5 +102,40 @@ namespace osu.Game.Screens.Edit.Compose.Components return (snappedPosition, snappedTime); } + + public class Ring : CircularProgress + { + [Resolved] + private IDistanceSnapProvider snapProvider { get; set; } + + [Resolved(canBeNull: true)] + private EditorClock editorClock { get; set; } + + private readonly HitObject referenceObject; + + private readonly Color4 baseColour; + + public Ring(HitObject referenceObject, Color4 baseColour) + { + this.referenceObject = referenceObject; + + Colour = this.baseColour = baseColour; + + Current.Value = 1; + } + + protected override void Update() + { + base.Update(); + + if (editorClock == null) + return; + + float distanceForCurrentTime = snapProvider.DurationToDistance(referenceObject, editorClock.CurrentTime - referenceObject.StartTime); + float timeBasedAlpha = Math.Clamp(1 - Math.Abs(distanceForCurrentTime - Size.X / 2) / 30, 0, 1); + + Colour = baseColour.Opacity(Math.Max(baseColour.A, timeBasedAlpha)); + } + } } } diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index 2f39db06d4..1f64a50c02 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -4,14 +4,15 @@ using System; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Layout; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osuTK; +using osuTK.Graphics; namespace osu.Game.Screens.Edit.Compose.Components { @@ -135,7 +136,7 @@ namespace osu.Game.Screens.Edit.Compose.Components /// /// The 0-based beat index from the point of placement. /// The applicable colour. - protected ColourInfo GetColourForIndexFromPlacement(int placementIndex) + protected Color4 GetColourForIndexFromPlacement(int placementIndex) { var timingPoint = Beatmap.ControlPointInfo.TimingPointAt(StartTime); double beatLength = timingPoint.BeatLength / beatDivisor.Value; @@ -144,7 +145,7 @@ namespace osu.Game.Screens.Edit.Compose.Components var colour = BindableBeatDivisor.GetColourFor(BindableBeatDivisor.GetDivisorForBeatIndex(beatIndex + placementIndex + 1, beatDivisor.Value), Colours); int repeatIndex = placementIndex / beatDivisor.Value; - return ColourInfo.SingleColour(colour).MultiplyAlpha(0.5f / (repeatIndex + 1)); + return colour.Opacity(0.5f / (repeatIndex + 1)); } } } From 8f217d1e975db8ffdf3099e982e9edabb6bc8fe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 11:37:50 +0200 Subject: [PATCH 0763/2328] Add failing test case for broken hover behaviour --- .../UserInterface/TestSceneModSelectScreen.cs | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index a3ce4b734b..c92a738b56 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -18,6 +18,7 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; +using osuTK; using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface @@ -164,7 +165,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("select mod requiring configuration", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() }); assertCustomisationToggleState(disabled: false, active: true); - AddStep("dismiss mod customisation via mouse", () => + AddStep("dismiss mod customisation via toggle", () => { InputManager.MoveMouseTo(modSelectScreen.ChildrenOfType().Single()); InputManager.Click(MouseButton.Left); @@ -191,6 +192,29 @@ namespace osu.Game.Tests.Visual.UserInterface assertCustomisationToggleState(disabled: true, active: false); // config was dismissed without explicit user action. } + [Test] + public void TestDismissCustomisationViaDimmedArea() + { + createScreen(); + assertCustomisationToggleState(disabled: true, active: false); + + AddStep("select mod requiring configuration", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() }); + assertCustomisationToggleState(disabled: false, active: true); + + AddStep("move mouse to settings area", () => InputManager.MoveMouseTo(this.ChildrenOfType().Single())); + AddStep("move mouse to dimmed area", () => + { + InputManager.MoveMouseTo(new Vector2( + modSelectScreen.ScreenSpaceDrawQuad.TopLeft.X, + (modSelectScreen.ScreenSpaceDrawQuad.TopLeft.Y + modSelectScreen.ScreenSpaceDrawQuad.BottomLeft.Y) / 2)); + }); + AddStep("click", () => InputManager.Click(MouseButton.Left)); + assertCustomisationToggleState(disabled: false, active: false); + + AddStep("move mouse to first mod panel", () => InputManager.MoveMouseTo(modSelectScreen.ChildrenOfType().First())); + AddAssert("first mod panel is hovered", () => modSelectScreen.ChildrenOfType().First().IsHovered); + } + /// /// Ensure that two mod overlays are not cross polluting via central settings instances. /// From daed42513e6476abe183fd6173ce328765970903 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 18:44:25 +0900 Subject: [PATCH 0764/2328] Fix outdated test asserts --- .../Editor/TestSceneOsuDistanceSnapGrid.cs | 2 +- osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs index 6d0ed15e45..f6b8f4edc3 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs @@ -160,7 +160,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor }); AddStep("move mouse outside grid", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position + new Vector2(beat_length, 0) * 3f))); - assertSnappedDistance(beat_length * 2); + assertSnappedDistance(beat_length); } private void assertSnappedDistance(float expectedDistance) => AddAssert($"snap distance = {expectedDistance}", () => diff --git a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs index 9148965987..3aa3481cbf 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs @@ -103,7 +103,7 @@ namespace osu.Game.Tests.Visual.Editing }); AddStep($"set distance spacing = {multiplier}", () => snapProvider.DistanceSpacingMultiplier.Value = multiplier); - AddAssert("check correct interval count", () => grid.MaxIntervals == (end_time / grid.DistanceBetweenTicks)); + AddStep("check correct interval count", () => Assert.That((end_time / grid.DistanceBetweenTicks) * multiplier, Is.EqualTo(grid.MaxIntervals))); } private class TestDistanceSnapGrid : DistanceSnapGrid From c6bc6be1280dfff8db52757ab51ab8aa9111b28b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 19:06:40 +0900 Subject: [PATCH 0765/2328] Fix toolbox expand being interrupted by gaps between groups --- osu.Game/Rulesets/Edit/ExpandingToolboxContainer.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Edit/ExpandingToolboxContainer.cs b/osu.Game/Rulesets/Edit/ExpandingToolboxContainer.cs index e807dbd482..c6cc09a16c 100644 --- a/osu.Game/Rulesets/Edit/ExpandingToolboxContainer.cs +++ b/osu.Game/Rulesets/Edit/ExpandingToolboxContainer.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Linq; using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; @@ -25,7 +24,7 @@ namespace osu.Game.Rulesets.Edit public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) && anyToolboxHovered(screenSpacePos); - private bool anyToolboxHovered(Vector2 screenSpacePos) => FillFlow.Children.Any(d => d.ScreenSpaceDrawQuad.Contains(screenSpacePos)); + private bool anyToolboxHovered(Vector2 screenSpacePos) => FillFlow.ScreenSpaceDrawQuad.Contains(screenSpacePos); protected override bool OnMouseDown(MouseDownEvent e) => true; From 08fd0ea086d4e6b7ca0d9d07179493120ecdc47e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 12:26:09 +0200 Subject: [PATCH 0766/2328] Fix click-to-return container still handling hover when inactive --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index a7f8a167f9..a1b4d7d8a0 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -464,6 +464,8 @@ namespace osu.Game.Overlays.Mods public Action? OnClicked { get; set; } + public override bool HandlePositionalInput => base.HandlePositionalInput && HandleMouse.Value; + protected override bool Handle(UIEvent e) { if (!HandleMouse.Value) From 949e30c4b4d85ed4b50e04494fe20fd3f6143ab7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 19:36:41 +0900 Subject: [PATCH 0767/2328] Remove auto-expansion of individual toolbox groups when parent expanding container expands --- osu.Game/Overlays/SettingsToolboxGroup.cs | 54 ++++++++--------------- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/osu.Game/Overlays/SettingsToolboxGroup.cs b/osu.Game/Overlays/SettingsToolboxGroup.cs index b9e5283a44..ca4864293c 100644 --- a/osu.Game/Overlays/SettingsToolboxGroup.cs +++ b/osu.Game/Overlays/SettingsToolboxGroup.cs @@ -135,60 +135,31 @@ namespace osu.Game.Overlays headerText.FadeTo(headerText.DrawWidth < DrawWidth ? 1 : 0, 150, Easing.OutQuint); } - [Resolved(canBeNull: true)] - private IExpandingContainer expandingContainer { get; set; } - - private bool expandedByContainer; - protected override void LoadComplete() { base.LoadComplete(); - expandingContainer?.Expanded.BindValueChanged(containerExpanded => - { - if (containerExpanded.NewValue && !Expanded.Value) - { - Expanded.Value = true; - expandedByContainer = true; - } - else if (!containerExpanded.NewValue && expandedByContainer) - { - Expanded.Value = false; - expandedByContainer = false; - } - - updateActiveState(); - }, true); - Expanded.BindValueChanged(v => { // clearing transforms can break autosizing, see: https://github.com/ppy/osu-framework/issues/5064 if (v.NewValue != v.OldValue) content.ClearTransforms(); - if (v.NewValue) - content.AutoSizeAxes = Axes.Y; - else - { - content.AutoSizeAxes = Axes.None; - content.ResizeHeightTo(0, transition_duration, Easing.OutQuint); - } - - button.FadeColour(Expanded.Value ? expandedColour : Color4.White, 200, Easing.InOutQuint); + Scheduler.AddOnce(updateExpandedState); }, true); - this.Delay(600).Schedule(updateActiveState); + this.Delay(600).Schedule(updateFadeState); } protected override bool OnHover(HoverEvent e) { - updateActiveState(); + updateFadeState(); return false; } protected override void OnHoverLost(HoverLostEvent e) { - updateActiveState(); + updateFadeState(); base.OnHoverLost(e); } @@ -198,9 +169,22 @@ namespace osu.Game.Overlays expandedColour = colours.Yellow; } - private void updateActiveState() + private void updateExpandedState() { - this.FadeTo(IsHovered || expandingContainer?.Expanded.Value == true ? 1 : inactive_alpha, fade_duration, Easing.OutQuint); + if (Expanded.Value) + content.AutoSizeAxes = Axes.Y; + else + { + content.AutoSizeAxes = Axes.None; + content.ResizeHeightTo(0, transition_duration, Easing.OutQuint); + } + + button.FadeColour(Expanded.Value ? expandedColour : Color4.White, 200, Easing.InOutQuint); + } + + private void updateFadeState() + { + this.FadeTo(IsHovered ? 1 : inactive_alpha, fade_duration, Easing.OutQuint); } protected override Container Content => content; From 59add66632fcd15cad5b81f0baf99653bdabb483 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 19:39:00 +0900 Subject: [PATCH 0768/2328] Remove unnecessary autosize workaround (was fixed long ago) --- osu.Game/Overlays/SettingsToolboxGroup.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Overlays/SettingsToolboxGroup.cs b/osu.Game/Overlays/SettingsToolboxGroup.cs index ca4864293c..10a09f3965 100644 --- a/osu.Game/Overlays/SettingsToolboxGroup.cs +++ b/osu.Game/Overlays/SettingsToolboxGroup.cs @@ -141,10 +141,6 @@ namespace osu.Game.Overlays Expanded.BindValueChanged(v => { - // clearing transforms can break autosizing, see: https://github.com/ppy/osu-framework/issues/5064 - if (v.NewValue != v.OldValue) - content.ClearTransforms(); - Scheduler.AddOnce(updateExpandedState); }, true); From b432885e5f4b20cee67ab44b3321df1ea954ecca Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 19:39:09 +0900 Subject: [PATCH 0769/2328] Tidy up ordering of `SettingsToolboxGroup` --- osu.Game/Overlays/SettingsToolboxGroup.cs | 47 +++++++++++------------ 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/osu.Game/Overlays/SettingsToolboxGroup.cs b/osu.Game/Overlays/SettingsToolboxGroup.cs index 10a09f3965..eb8c0248e7 100644 --- a/osu.Game/Overlays/SettingsToolboxGroup.cs +++ b/osu.Game/Overlays/SettingsToolboxGroup.cs @@ -117,32 +117,17 @@ namespace osu.Game.Overlays }; } - protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source) + [BackgroundDependencyLoader] + private void load(OsuColour colours) { - if (invalidation.HasFlagFast(Invalidation.DrawSize)) - headerTextVisibilityCache.Invalidate(); - - return base.OnInvalidate(invalidation, source); - } - - protected override void Update() - { - base.Update(); - - if (!headerTextVisibilityCache.IsValid) - // These toolbox grouped may be contracted to only show icons. - // For now, let's hide the header to avoid text truncation weirdness in such cases. - headerText.FadeTo(headerText.DrawWidth < DrawWidth ? 1 : 0, 150, Easing.OutQuint); + expandedColour = colours.Yellow; } protected override void LoadComplete() { base.LoadComplete(); - Expanded.BindValueChanged(v => - { - Scheduler.AddOnce(updateExpandedState); - }, true); + Expanded.BindValueChanged(updateExpandedState, true); this.Delay(600).Schedule(updateFadeState); } @@ -159,15 +144,27 @@ namespace osu.Game.Overlays base.OnHoverLost(e); } - [BackgroundDependencyLoader] - private void load(OsuColour colours) + protected override void Update() { - expandedColour = colours.Yellow; + base.Update(); + + if (!headerTextVisibilityCache.IsValid) + // These toolbox grouped may be contracted to only show icons. + // For now, let's hide the header to avoid text truncation weirdness in such cases. + headerText.FadeTo(headerText.DrawWidth < DrawWidth ? 1 : 0, 150, Easing.OutQuint); } - private void updateExpandedState() + protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source) { - if (Expanded.Value) + if (invalidation.HasFlagFast(Invalidation.DrawSize)) + headerTextVisibilityCache.Invalidate(); + + return base.OnInvalidate(invalidation, source); + } + + private void updateExpandedState(ValueChangedEvent expanded) + { + if (expanded.NewValue) content.AutoSizeAxes = Axes.Y; else { @@ -175,7 +172,7 @@ namespace osu.Game.Overlays content.ResizeHeightTo(0, transition_duration, Easing.OutQuint); } - button.FadeColour(Expanded.Value ? expandedColour : Color4.White, 200, Easing.InOutQuint); + button.FadeColour(expanded.NewValue ? expandedColour : Color4.White, 200, Easing.InOutQuint); } private void updateFadeState() From 88c190f3e359f9cb3bf9449dba97d19af0de7329 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 19:45:14 +0900 Subject: [PATCH 0770/2328] Change colour denoting expanded state to be gray rather than yellow I always found the yellow colour very non-descript in this case. Gray seems to work better? --- osu.Game/Overlays/SettingsToolboxGroup.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/SettingsToolboxGroup.cs b/osu.Game/Overlays/SettingsToolboxGroup.cs index eb8c0248e7..fd81d092c9 100644 --- a/osu.Game/Overlays/SettingsToolboxGroup.cs +++ b/osu.Game/Overlays/SettingsToolboxGroup.cs @@ -39,10 +39,10 @@ namespace osu.Game.Overlays public BindableBool Expanded { get; } = new BindableBool(true); - private Color4 expandedColour; - private readonly OsuSpriteText headerText; + private readonly Container headerContent; + /// /// Create a new instance. /// @@ -71,7 +71,7 @@ namespace osu.Game.Overlays AutoSizeAxes = Axes.Y, Children = new Drawable[] { - new Container + headerContent = new Container { Name = @"Header", Origin = Anchor.TopCentre, @@ -117,12 +117,6 @@ namespace osu.Game.Overlays }; } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - expandedColour = colours.Yellow; - } - protected override void LoadComplete() { base.LoadComplete(); @@ -172,7 +166,7 @@ namespace osu.Game.Overlays content.ResizeHeightTo(0, transition_duration, Easing.OutQuint); } - button.FadeColour(expanded.NewValue ? expandedColour : Color4.White, 200, Easing.InOutQuint); + headerContent.FadeColour(expanded.NewValue ? Color4.White : OsuColour.Gray(0.5f), 200, Easing.OutQuint); } private void updateFadeState() From a915b7333c8935ce0c643431824806059d494cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 13:08:54 +0200 Subject: [PATCH 0771/2328] Remove unused using directive --- osu.Game/Overlays/SettingsToolboxGroup.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/SettingsToolboxGroup.cs b/osu.Game/Overlays/SettingsToolboxGroup.cs index fd81d092c9..f9cfd8ff2a 100644 --- a/osu.Game/Overlays/SettingsToolboxGroup.cs +++ b/osu.Game/Overlays/SettingsToolboxGroup.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Caching; using osu.Framework.Extensions.EnumExtensions; From e9d52aa9547f0df158310fac9bf7a632232d34fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 13:09:37 +0200 Subject: [PATCH 0772/2328] Remove not-accessed field --- osu.Game/Overlays/SettingsToolboxGroup.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/SettingsToolboxGroup.cs b/osu.Game/Overlays/SettingsToolboxGroup.cs index f9cfd8ff2a..808d4fc422 100644 --- a/osu.Game/Overlays/SettingsToolboxGroup.cs +++ b/osu.Game/Overlays/SettingsToolboxGroup.cs @@ -34,7 +34,6 @@ namespace osu.Game.Overlays private readonly Cached headerTextVisibilityCache = new Cached(); private readonly FillFlowContainer content; - private readonly IconButton button; public BindableBool Expanded { get; } = new BindableBool(true); @@ -87,7 +86,7 @@ namespace osu.Game.Overlays Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17), Padding = new MarginPadding { Left = 10, Right = 30 }, }, - button = new IconButton + new IconButton { Origin = Anchor.Centre, Anchor = Anchor.CentreRight, From fad1f727bb26954f75a8eeea25ff333107f3325a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 May 2022 20:34:44 +0900 Subject: [PATCH 0773/2328] Fix editor drag box visuals --- .../Edit/Compose/Components/DragBox.cs | 85 ++++++++++++++++--- 1 file changed, 73 insertions(+), 12 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/DragBox.cs b/osu.Game/Screens/Edit/Compose/Components/DragBox.cs index eaee2cd1e2..a256adbe4a 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DragBox.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DragBox.cs @@ -9,7 +9,8 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; -using osuTK.Graphics; +using osu.Framework.Layout; +using osuTK; namespace osu.Game.Screens.Edit.Compose.Components { @@ -41,17 +42,7 @@ namespace osu.Game.Screens.Edit.Compose.Components InternalChild = Box = CreateBox(); } - protected virtual Drawable CreateBox() => new Container - { - Masking = true, - BorderColour = Color4.White, - BorderThickness = SelectionBox.BORDER_RADIUS, - Child = new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0.1f - } - }; + protected virtual Drawable CreateBox() => new BoxWithBorders(); private RectangleF? dragRectangle; @@ -111,5 +102,75 @@ namespace osu.Game.Screens.Edit.Compose.Components public override void Show() => State = Visibility.Visible; public event Action StateChanged; + + public class BoxWithBorders : CompositeDrawable + { + private readonly LayoutValue cache = new LayoutValue(Invalidation.RequiredParentSizeToFit); + + public BoxWithBorders() + { + AddLayout(cache); + } + + protected override void Update() + { + base.Update(); + + if (!cache.IsValid) + { + createContent(); + cache.Validate(); + } + } + + private void createContent() + { + if (DrawSize == Vector2.Zero) + { + ClearInternal(); + return; + } + + // Make lines the same width independent of display resolution. + float lineThickness = DrawWidth > 0 + ? DrawWidth / ScreenSpaceDrawQuad.Width * 2 + : DrawHeight / ScreenSpaceDrawQuad.Height * 2; + + Padding = new MarginPadding(-lineThickness); + + InternalChildren = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.X, + Height = lineThickness, + }, + new Box + { + RelativeSizeAxes = Axes.X, + Height = lineThickness, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + }, + new Box + { + RelativeSizeAxes = Axes.Y, + Width = lineThickness, + }, + new Box + { + RelativeSizeAxes = Axes.Y, + Width = lineThickness, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + }, + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0.1f + } + }; + } + } } } From 19297375e270839c443bfd3165b79c641f692de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 13:44:04 +0200 Subject: [PATCH 0774/2328] Update tests to reflect new expected behaviour --- .../Visual/UserInterface/TestSceneExpandingContainer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs index 288c0cb140..2bb6e58448 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs @@ -99,15 +99,15 @@ namespace osu.Game.Tests.Visual.UserInterface } /// - /// Tests expanding a container will expand underlying groups if contracted. + /// Tests expanding a container will not expand underlying groups if they were manually contracted by the user. /// [Test] - public void TestExpandingContainerExpandsContractedGroup() + public void TestExpandingContainerDoesNotExpandContractedGroup() { AddStep("contract group", () => toolboxGroup.Expanded.Value = false); AddStep("expand container", () => container.Expanded.Value = true); - AddAssert("group expanded", () => toolboxGroup.Expanded.Value); + AddAssert("group not expanded", () => !toolboxGroup.Expanded.Value); AddAssert("controls expanded", () => slider1.Expanded.Value && slider2.Expanded.Value); AddStep("contract container", () => container.Expanded.Value = false); From b119726b289334df0666c15709a99245b2c0a28d Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 6 May 2022 15:36:52 +0300 Subject: [PATCH 0775/2328] Reword test step --- .../Editor/TestSceneOsuDistanceSnapGrid.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs index f6b8f4edc3..3c3c5cb939 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs @@ -106,7 +106,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor [TestCase(0.5f)] public void TestDistanceSpacing(float multiplier) { - AddStep($"set beat divisor = {multiplier}", () => snapProvider.DistanceSpacingMultiplier.Value = multiplier); + AddStep($"set distance spacing = {multiplier}", () => snapProvider.DistanceSpacingMultiplier.Value = multiplier); } [Test] From 29a3ab7e7a018d895ddcc5f14d65d0f864812855 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 15:21:25 +0200 Subject: [PATCH 0776/2328] Halve drag box padding Allows the drag box borders to collapse in on themselves to a single line if the drag selection has zero width or height. --- osu.Game/Screens/Edit/Compose/Components/DragBox.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/DragBox.cs b/osu.Game/Screens/Edit/Compose/Components/DragBox.cs index a256adbe4a..ecbac82db0 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DragBox.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DragBox.cs @@ -136,7 +136,7 @@ namespace osu.Game.Screens.Edit.Compose.Components ? DrawWidth / ScreenSpaceDrawQuad.Width * 2 : DrawHeight / ScreenSpaceDrawQuad.Height * 2; - Padding = new MarginPadding(-lineThickness); + Padding = new MarginPadding(-lineThickness / 2); InternalChildren = new Drawable[] { From c533c93ffd088e2a2240fdccc822608fd1460317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 15:29:54 +0200 Subject: [PATCH 0777/2328] Remove leftover border thickness spec in mod settings area Was never supposed to be there, it was a vestige of a previous design iteration that went by unnoticed. --- osu.Game/Overlays/Mods/ModSettingsArea.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSettingsArea.cs b/osu.Game/Overlays/Mods/ModSettingsArea.cs index 9c5f3b7f11..08f563f93e 100644 --- a/osu.Game/Overlays/Mods/ModSettingsArea.cs +++ b/osu.Game/Overlays/Mods/ModSettingsArea.cs @@ -44,7 +44,6 @@ namespace osu.Game.Overlays.Mods { RelativeSizeAxes = Axes.Both, Masking = true, - BorderThickness = 2, Children = new Drawable[] { background = new Box From 112496204d26f8709428b9eab026969953330910 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 6 May 2022 18:50:28 +0300 Subject: [PATCH 0778/2328] Make nested class private --- .../Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index 5682b5563e..b3df72f827 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -103,7 +103,7 @@ namespace osu.Game.Screens.Edit.Compose.Components return (snappedPosition, snappedTime); } - public class Ring : CircularProgress + private class Ring : CircularProgress { [Resolved] private IDistanceSnapProvider snapProvider { get; set; } From d78f1d158d3f5582fc99efd20a92c48e5e73331d Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 6 May 2022 18:51:34 +0300 Subject: [PATCH 0779/2328] Use `GetEndTime()` instead of `StartTime` Companion to https://github.com/ppy/osu/pull/18103/commits/246479bf34c725d886742017099f9d509e58b2f7 --- .../Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index b3df72f827..6cb05f0596 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -131,7 +131,7 @@ namespace osu.Game.Screens.Edit.Compose.Components if (editorClock == null) return; - float distanceForCurrentTime = snapProvider.DurationToDistance(referenceObject, editorClock.CurrentTime - referenceObject.StartTime); + float distanceForCurrentTime = snapProvider.DurationToDistance(referenceObject, editorClock.CurrentTime - referenceObject.GetEndTime()); float timeBasedAlpha = Math.Clamp(1 - Math.Abs(distanceForCurrentTime - Size.X / 2) / 30, 0, 1); Colour = baseColour.Opacity(Math.Max(baseColour.A, timeBasedAlpha)); From 723fce81741de8b858edb0a60090b850fc18f67a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 6 May 2022 18:54:08 +0300 Subject: [PATCH 0780/2328] Move inverting value to happen outside clamp Looks to have no effect, but makes sense to happen outside instead. --- .../Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index 6cb05f0596..c0a3f7d97f 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -132,7 +132,7 @@ namespace osu.Game.Screens.Edit.Compose.Components return; float distanceForCurrentTime = snapProvider.DurationToDistance(referenceObject, editorClock.CurrentTime - referenceObject.GetEndTime()); - float timeBasedAlpha = Math.Clamp(1 - Math.Abs(distanceForCurrentTime - Size.X / 2) / 30, 0, 1); + float timeBasedAlpha = 1 - Math.Clamp(Math.Abs(distanceForCurrentTime - Size.X / 2) / 30, 0, 1); Colour = baseColour.Opacity(Math.Max(baseColour.A, timeBasedAlpha)); } From cc251ed5c3fe4a50126817d8893fba4a4a591536 Mon Sep 17 00:00:00 2001 From: Hugo Denizart Date: Fri, 6 May 2022 19:52:25 +0200 Subject: [PATCH 0781/2328] =?UTF-8?q?=F0=9F=94=A7=20Update=20Sentry=20DSN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- osu.Game/Utils/SentryLogger.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index dbf04283b6..d9c8199f75 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -24,7 +24,7 @@ namespace osu.Game.Utils var options = new SentryOptions { - Dsn = "https://5e342cd55f294edebdc9ad604d28bbd3@sentry.io/1255255", + Dsn = "https://ad9f78529cef40ac874afb95a9aca04e@sentry.ppy.sh/2", Release = game.Version }; From 049fed42e2084497b6766d7af736026fe77b96b4 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 6 May 2022 21:42:20 +0300 Subject: [PATCH 0782/2328] Fix side overlay offsetting not affecting fullscreen overlays --- osu.Game/OsuGame.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index e9fe8c43de..7f47c15f68 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -1153,6 +1153,7 @@ namespace osu.Game horizontalOffset += (Content.ToLocalSpace(Notifications.ScreenSpaceDrawQuad.TopLeft).X - Content.DrawWidth) * SIDE_OVERLAY_OFFSET_RATIO; ScreenOffsetContainer.X = horizontalOffset; + overlayContent.X = horizontalOffset; MenuCursorContainer.CanShowCursor = (ScreenStack.CurrentScreen as IOsuScreen)?.CursorVisible ?? false; } From 8080f784fd5f9a3e202d7f27808b8a08ac67835b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 6 May 2022 22:20:04 +0300 Subject: [PATCH 0783/2328] Apply offset by a factor of 0.8x from screen offset --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 7f47c15f68..b3de23ee08 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -1153,7 +1153,7 @@ namespace osu.Game horizontalOffset += (Content.ToLocalSpace(Notifications.ScreenSpaceDrawQuad.TopLeft).X - Content.DrawWidth) * SIDE_OVERLAY_OFFSET_RATIO; ScreenOffsetContainer.X = horizontalOffset; - overlayContent.X = horizontalOffset; + overlayContent.X = horizontalOffset * 0.8f; MenuCursorContainer.CanShowCursor = (ScreenStack.CurrentScreen as IOsuScreen)?.CursorVisible ?? false; } From 380cd1e03619e45ad580356342f99498c0f59592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 21:35:22 +0200 Subject: [PATCH 0784/2328] Add test coverage for lack of customisation on free mod select --- .../TestSceneFreeModSelectScreen.cs | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs index b5f901e51d..8eaa45696f 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs @@ -6,24 +6,19 @@ using NUnit.Framework; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Overlays.Mods; +using osu.Game.Rulesets.Osu.Mods; using osu.Game.Screens.OnlinePlay; namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneFreeModSelectScreen : MultiplayerTestScene { + private FreeModSelectScreen freeModSelectScreen; + [Test] public void TestFreeModSelect() { - FreeModSelectScreen freeModSelectScreen = null; - - AddStep("create free mod select screen", () => Child = freeModSelectScreen = new FreeModSelectScreen - { - State = { Value = Visibility.Visible } - }); - AddUntilStep("all column content loaded", - () => freeModSelectScreen.ChildrenOfType().Any() - && freeModSelectScreen.ChildrenOfType().All(column => column.IsLoaded && column.ItemsLoaded)); + createFreeModSelect(); AddUntilStep("all visible mods are playable", () => this.ChildrenOfType() @@ -36,5 +31,26 @@ namespace osu.Game.Tests.Visual.Multiplayer freeModSelectScreen.State.Value = visible ? Visibility.Visible : Visibility.Hidden; }); } + + [Test] + public void TestCustomisationNotAvailable() + { + createFreeModSelect(); + + AddStep("select difficulty adjust", () => freeModSelectScreen.SelectedMods.Value = new[] { new OsuModDifficultyAdjust() }); + AddWaitStep("wait some", 3); + AddAssert("customisation area not expanded", () => this.ChildrenOfType().Single().Height == 0); + } + + private void createFreeModSelect() + { + AddStep("create free mod select screen", () => Child = freeModSelectScreen = new FreeModSelectScreen + { + State = { Value = Visibility.Visible } + }); + AddUntilStep("all column content loaded", + () => freeModSelectScreen.ChildrenOfType().Any() + && freeModSelectScreen.ChildrenOfType().All(column => column.IsLoaded && column.ItemsLoaded)); + } } } From c199b8fcb66fade4234b6e24597d42f4afccc442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 21:35:36 +0200 Subject: [PATCH 0785/2328] Simplify state management in `ModColumn` Bad sign when you can't follow your own code. All of the various state changing methods were flattened into one because it was too hard to follow what was calling what and why. --- osu.Game/Overlays/Mods/ModColumn.cs | 43 ++++++++++------------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index a792c0a81e..270839112a 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -49,7 +49,7 @@ namespace osu.Game.Overlays.Mods set { filter = value; - updateFilter(); + updateState(); } } @@ -292,9 +292,7 @@ namespace osu.Game.Overlays.Mods { panelFlow.ChildrenEnumerable = loaded; - updateActiveState(); - updateToggleAllState(); - updateFilter(); + updateState(); foreach (var panel in panelFlow) { @@ -308,10 +306,19 @@ namespace osu.Game.Overlays.Mods }); } - private void updateActiveState() + private void updateState() { foreach (var panel in panelFlow) + { panel.Active.Value = SelectedMods.Contains(panel.Mod); + panel.ApplyFilter(Filter); + } + + if (toggleAllCheckbox != null && !SelectionAnimationRunning) + { + toggleAllCheckbox.Alpha = panelFlow.Any(panel => !panel.Filtered.Value) ? 1 : 0; + toggleAllCheckbox.Current.Value = panelFlow.Where(panel => !panel.Filtered.Value).All(panel => panel.Active.Value); + } } /// @@ -323,13 +330,12 @@ namespace osu.Game.Overlays.Mods private void panelStateChanged(ModPanel panel) { - updateToggleAllState(); - var newSelectedMods = panel.Active.Value ? SelectedMods.Append(panel.Mod) : SelectedMods.Except(panel.Mod.Yield()); SelectedMods = newSelectedMods.ToArray(); + updateState(); if (!externalSelectionUpdateInProgress) SelectionChangedByUser?.Invoke(); } @@ -364,7 +370,7 @@ namespace osu.Game.Overlays.Mods } SelectedMods = newSelection; - updateActiveState(); + updateState(); externalSelectionUpdateInProgress = false; } @@ -403,15 +409,6 @@ namespace osu.Game.Overlays.Mods } } - private void updateToggleAllState() - { - if (toggleAllCheckbox != null && !SelectionAnimationRunning) - { - toggleAllCheckbox.Alpha = panelFlow.Any(panel => !panel.Filtered.Value) ? 1 : 0; - toggleAllCheckbox.Current.Value = panelFlow.Where(panel => !panel.Filtered.Value).All(panel => panel.Active.Value); - } - } - /// /// Selects all mods. /// @@ -507,18 +504,6 @@ namespace osu.Game.Overlays.Mods #endregion - #region Filtering support - - private void updateFilter() - { - foreach (var modPanel in panelFlow) - modPanel.ApplyFilter(Filter); - - updateToggleAllState(); - } - - #endregion - #region Keyboard selection support protected override bool OnKeyDown(KeyDownEvent e) From 621f7467898e290bdd2d9d9fe3cc4daadd209366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 21:46:56 +0200 Subject: [PATCH 0786/2328] Do not modify selected mods through panel state change during external update --- osu.Game/Overlays/Mods/ModColumn.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 270839112a..f6fa591666 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -330,14 +330,16 @@ namespace osu.Game.Overlays.Mods private void panelStateChanged(ModPanel panel) { + if (externalSelectionUpdateInProgress) + return; + var newSelectedMods = panel.Active.Value ? SelectedMods.Append(panel.Mod) : SelectedMods.Except(panel.Mod.Yield()); SelectedMods = newSelectedMods.ToArray(); updateState(); - if (!externalSelectionUpdateInProgress) - SelectionChangedByUser?.Invoke(); + SelectionChangedByUser?.Invoke(); } /// From 8c73ed72078a47eb7f166164cb80e642b5486218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 21:38:29 +0200 Subject: [PATCH 0787/2328] Fix sequence equality check not using reference comparison --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index a1b4d7d8a0..838c3597ae 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; using osu.Framework.Layout; +using osu.Framework.Lists; using osu.Framework.Utils; using osu.Game.Configuration; using osu.Game.Graphics; @@ -264,7 +265,9 @@ namespace osu.Game.Overlays.Mods { var candidateSelection = columnFlow.Columns.SelectMany(column => column.SelectedMods).ToArray(); - if (candidateSelection.SequenceEqual(SelectedMods.Value)) + // the following guard intends to check cases where we've already replaced potentially-external mod references with our own and avoid endless recursion. + // TODO: replace custom comparer with System.Collections.Generic.ReferenceEqualityComparer when fully on .NET 6 + if (candidateSelection.SequenceEqual(SelectedMods.Value, new FuncEqualityComparer(ReferenceEquals))) return; SelectedMods.Value = ComputeNewModsFromSelection(SelectedMods.Value, candidateSelection); From 9d62206176732dbc9b6e96b1f0258ee87dffe489 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Fri, 6 May 2022 22:56:35 +0100 Subject: [PATCH 0788/2328] Update new chat overlay day separator colours and spacing Updates the `DaySeparator` component to have separately settable colours for the text and the lines. Updates existing overrides of the `DaySeparator` to use the new colour setter. Create new `ChatOverlayDrawableChannel` with adjusted spacing and new `DaySeparator` colours. --- .../Visual/Online/TestSceneChatOverlayV2.cs | 6 ++-- osu.Game/Online/Chat/StandAloneChatDisplay.cs | 33 ++++++++----------- osu.Game/Overlays/Chat/ChatTextBar.cs | 2 +- osu.Game/Overlays/Chat/DrawableChannel.cs | 18 +++++++++- osu.Game/Overlays/ChatOverlayV2.cs | 33 +++++++++++++++++-- 5 files changed, 64 insertions(+), 28 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 7c77ac925e..9d894314f8 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -365,7 +365,7 @@ namespace osu.Game.Tests.Visual.Online AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); AddStep("Click listing", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); - AddStep("Click drawable channel", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); + AddStep("Click drawable channel", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); AddStep("Click channel list", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); @@ -381,8 +381,8 @@ namespace osu.Game.Tests.Visual.Online private Visibility loadingVisibility => chatOverlay.ChildrenOfType().Single().State.Value; - private DrawableChannel currentDrawableChannel => - chatOverlay.ChildrenOfType>().Single().Child; + private ChatOverlayDrawableChannel currentDrawableChannel => + chatOverlay.ChildrenOfType>().Single().Child; private ChannelListItem getChannelListItem(Channel channel) => chatOverlay.ChildrenOfType().Single(item => item.Channel == channel); diff --git a/osu.Game/Online/Chat/StandAloneChatDisplay.cs b/osu.Game/Online/Chat/StandAloneChatDisplay.cs index df210fcaf8..c03cd938a5 100644 --- a/osu.Game/Online/Chat/StandAloneChatDisplay.cs +++ b/osu.Game/Online/Chat/StandAloneChatDisplay.cs @@ -155,9 +155,7 @@ namespace osu.Game.Online.Chat { public Func CreateChatLineAction; - protected override ChatLine CreateChatLine(Message m) => CreateChatLineAction(m); - - protected override DaySeparator CreateDaySeparator(DateTimeOffset time) => new CustomDaySeparator(time); + private Colour4 daySepColour; public StandAloneDrawableChannel(Channel channel) : base(channel) @@ -165,28 +163,23 @@ namespace osu.Game.Online.Chat } [BackgroundDependencyLoader] - private void load() + private void load(OsuColour colours) { ChatLineFlow.Padding = new MarginPadding { Horizontal = 0 }; + daySepColour = colours.Yellow; } - private class CustomDaySeparator : DaySeparator + protected override ChatLine CreateChatLine(Message m) => CreateChatLineAction(m); + + protected override DaySeparator CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) { - public CustomDaySeparator(DateTimeOffset time) - : base(time) - { - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Colour = colours.Yellow; - TextSize = 14; - LineHeight = 1; - Padding = new MarginPadding { Horizontal = 10 }; - Margin = new MarginPadding { Vertical = 5 }; - } - } + TextSize = 14, + TextColour = daySepColour, + LineHeight = 1, + LineColour = daySepColour, + Padding = new MarginPadding { Horizontal = 10 }, + Margin = new MarginPadding { Vertical = 5 }, + }; } protected class StandAloneMessage : ChatLine diff --git a/osu.Game/Overlays/Chat/ChatTextBar.cs b/osu.Game/Overlays/Chat/ChatTextBar.cs index 0fa3613d38..404d686d91 100644 --- a/osu.Game/Overlays/Chat/ChatTextBar.cs +++ b/osu.Game/Overlays/Chat/ChatTextBar.cs @@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Chat private Container searchIconContainer = null!; private ChatTextBox chatTextBox = null!; - private const float chatting_text_width = 240; + private const float chatting_text_width = 220; private const float search_icon_width = 40; [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index 161fe1d5be..7e4e936bee 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -9,6 +9,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; @@ -123,8 +124,9 @@ namespace osu.Game.Overlays.Chat protected virtual DaySeparator CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) { + TextColour = colours.ChatBlue.Lighten(0.7f), + LineColour = colours.ChatBlue.Lighten(0.7f), Margin = new MarginPadding { Vertical = 10 }, - Colour = colours.ChatBlue.Lighten(0.7f), }; private void newMessagesArrived(IEnumerable newMessages) => Schedule(() => @@ -212,6 +214,12 @@ namespace osu.Game.Overlays.Chat set => text.Font = text.Font.With(size: value); } + public ColourInfo TextColour + { + get => text.Colour; + set => text.Colour = value; + } + private float lineHeight = 2; public float LineHeight @@ -220,6 +228,14 @@ namespace osu.Game.Overlays.Chat set => lineHeight = leftBox.Height = rightBox.Height = value; } + private ColourInfo lineColour; + + public ColourInfo LineColour + { + get => lineColour; + set => lineColour = leftBox.Colour = rightBox.Colour = value; + } + private readonly SpriteText text; private readonly Box leftBox; private readonly Box rightBox; diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 4c7fa0f802..cc050a0760 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -3,6 +3,7 @@ #nullable enable +using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; @@ -37,7 +38,7 @@ namespace osu.Game.Overlays private LoadingLayer loading = null!; private ChannelListing channelListing = null!; private ChatTextBar textBar = null!; - private Container currentChannelContainer = null!; + private Container currentChannelContainer = null!; private readonly BindableFloat chatHeight = new BindableFloat(); @@ -120,7 +121,7 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both, Colour = colourProvider.Background4, }, - currentChannelContainer = new Container + currentChannelContainer = new Container { RelativeSizeAxes = Axes.Both, }, @@ -268,7 +269,7 @@ namespace osu.Game.Overlays return; } - LoadComponentAsync(new DrawableChannel(newChannel), loaded => + LoadComponentAsync(new ChatOverlayDrawableChannel(newChannel), loaded => { currentChannelContainer.Clear(); currentChannelContainer.Add(loaded); @@ -311,4 +312,30 @@ namespace osu.Game.Overlays channelManager.PostMessage(message); } } + + public class ChatOverlayDrawableChannel : DrawableChannel + { + private Colour4 daySepTextColour; + private Colour4 daySepLineColour; + + public ChatOverlayDrawableChannel(Channel channel) + : base(channel) + { } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + ChatLineFlow.Padding = new MarginPadding(0); + daySepTextColour = colourProvider.Content1; + daySepLineColour = colourProvider.Background5; + } + + protected override DaySeparator CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) + { + TextColour = daySepTextColour, + LineColour = daySepLineColour, + Margin = new MarginPadding { Vertical = 10 }, + Padding = new MarginPadding { Horizontal = 15 }, + }; + } } From 6fc808be22cb8bf32e8f1bd497f88efa7f89340c Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Fri, 6 May 2022 23:17:59 +0100 Subject: [PATCH 0789/2328] Code quality --- osu.Game/Overlays/ChatOverlayV2.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index cc050a0760..e1ac71a125 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -320,7 +320,8 @@ namespace osu.Game.Overlays public ChatOverlayDrawableChannel(Channel channel) : base(channel) - { } + { + } [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) From 71758390b5db8186bd149647d162417e5607e730 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 7 May 2022 13:37:36 +0900 Subject: [PATCH 0790/2328] Fix time based distance grid alpha not correctly accounting for distance spacing multiplier --- .../Edit/Compose/Components/CircularDistanceSnapGrid.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index c0a3f7d97f..2c6bb766ad 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -131,7 +131,12 @@ namespace osu.Game.Screens.Edit.Compose.Components if (editorClock == null) return; - float distanceForCurrentTime = snapProvider.DurationToDistance(referenceObject, editorClock.CurrentTime - referenceObject.GetEndTime()); + float distanceSpacingMultiplier = (float)snapProvider.DistanceSpacingMultiplier.Value; + double timeFromReferencePoint = editorClock.CurrentTime - referenceObject.GetEndTime(); + + float distanceForCurrentTime = snapProvider.DurationToDistance(referenceObject, timeFromReferencePoint) + * distanceSpacingMultiplier; + float timeBasedAlpha = 1 - Math.Clamp(Math.Abs(distanceForCurrentTime - Size.X / 2) / 30, 0, 1); Colour = baseColour.Opacity(Math.Max(baseColour.A, timeBasedAlpha)); From ce14fddcb2c2950285dd89d96b8587cd9c3fbf6f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 7 May 2022 14:02:07 +0900 Subject: [PATCH 0791/2328] Use above-1 offset instead for more correct feeling parallax --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index b3de23ee08..69adca4190 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -1153,7 +1153,7 @@ namespace osu.Game horizontalOffset += (Content.ToLocalSpace(Notifications.ScreenSpaceDrawQuad.TopLeft).X - Content.DrawWidth) * SIDE_OVERLAY_OFFSET_RATIO; ScreenOffsetContainer.X = horizontalOffset; - overlayContent.X = horizontalOffset * 0.8f; + overlayContent.X = horizontalOffset * 1.2f; MenuCursorContainer.CanShowCursor = (ScreenStack.CurrentScreen as IOsuScreen)?.CursorVisible ?? false; } From 0c6de331f3075fe701210031271d79bd4cdeef8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 15:59:19 +0200 Subject: [PATCH 0792/2328] Move footer button padding to a higher level --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 838c3597ae..06baea8364 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -145,13 +145,18 @@ namespace osu.Game.Overlays.Mods }); } + FooterContent.Padding = new MarginPadding + { + Vertical = PADDING, + Horizontal = 70 + }; + if (AllowCustomisation) { - Footer.Add(new ShearedToggleButton(200) + FooterContent.Add(new ShearedToggleButton(200) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - Margin = new MarginPadding { Vertical = PADDING, Left = 70 }, Text = "Mod Customisation", Active = { BindTarget = customisationVisible } }); From 0b95594f60f8afeab0b3927944e4f28e66b8eb28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 16:02:32 +0200 Subject: [PATCH 0793/2328] Add some more padding between footer and column scroll --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 06baea8364..75f9f4e72e 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -95,6 +95,7 @@ namespace osu.Game.Overlays.Mods Padding = new MarginPadding { Top = (ShowTotalMultiplier ? DifficultyMultiplierDisplay.HEIGHT : 0) + PADDING, + Bottom = PADDING }, RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, From 852e4a97668421ad78b258d6366204ebb8cdd858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 16:31:59 +0200 Subject: [PATCH 0794/2328] Add select/deselect all buttons to free mod select screen --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 61 +++++++++++++------ .../Screens/OnlinePlay/FreeModSelectScreen.cs | 21 ++++++- 2 files changed, 61 insertions(+), 21 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 75f9f4e72e..419a6ee7f7 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -47,11 +47,6 @@ namespace osu.Game.Overlays.Mods } } - /// - /// Whether configurable s can be configured by the local user. - /// - protected virtual bool AllowCustomisation => true; - /// /// Whether the total score multiplier calculated from the current selected set of mods should be shown. /// @@ -59,12 +54,27 @@ namespace osu.Game.Overlays.Mods protected virtual ModColumn CreateModColumn(ModType modType, Key[]? toggleKeys = null) => new ModColumn(modType, false, toggleKeys); + protected virtual Drawable[] CreateFooterButtons() => new Drawable[] + { + customisationButton = new ShearedToggleButton(200) + { + Text = "Mod Customisation", + Active = { BindTarget = customisationVisible } + }, + new ShearedButton(200) + { + Text = "Deselect All", + Action = DeselectAll + } + }; + private readonly BindableBool customisationVisible = new BindableBool(); private DifficultyMultiplierDisplay? multiplierDisplay; private ModSettingsArea modSettingsArea = null!; private ColumnScrollContainer columnScroll = null!; private ColumnFlowContainer columnFlow = null!; + private ShearedToggleButton? customisationButton; [BackgroundDependencyLoader] private void load() @@ -146,22 +156,21 @@ namespace osu.Game.Overlays.Mods }); } - FooterContent.Padding = new MarginPadding + FooterContent.Child = new FillFlowContainer { - Vertical = PADDING, - Horizontal = 70 - }; - - if (AllowCustomisation) - { - FooterContent.Add(new ShearedToggleButton(200) + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Horizontal, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Padding = new MarginPadding { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Text = "Mod Customisation", - Active = { BindTarget = customisationVisible } - }); - } + Vertical = PADDING, + Horizontal = 70 + }, + Spacing = new Vector2(10), + Children = CreateFooterButtons() + }; } private ColumnDimContainer createModColumnContent(ModType modType, Key[]? toggleKeys = null) @@ -216,7 +225,7 @@ namespace osu.Game.Overlays.Mods private void updateCustomisation(ValueChangedEvent> valueChangedEvent) { - if (!AllowCustomisation) + if (customisationButton == null) return; bool anyCustomisableMod = false; @@ -325,6 +334,18 @@ namespace osu.Game.Overlays.Mods } } + protected void SelectAll() + { + foreach (var column in columnFlow.Columns) + column.SelectAll(); + } + + protected void DeselectAll() + { + foreach (var column in columnFlow.Columns) + column.DeselectAll(); + } + public override bool OnPressed(KeyBindingPressEvent e) { if (e.Action == GlobalAction.Back && customisationVisible.Value) diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs index 5a7a60b479..52ca28ce5d 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs @@ -2,6 +2,8 @@ // See the LICENCE file in the repository root for full licence text. using System; +using osu.Framework.Graphics; +using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; using osu.Game.Rulesets.Mods; using osuTK.Input; @@ -10,7 +12,6 @@ namespace osu.Game.Screens.OnlinePlay { public class FreeModSelectScreen : ModSelectScreen { - protected override bool AllowCustomisation => false; protected override bool ShowTotalMultiplier => false; public new Func IsValidMod @@ -25,5 +26,23 @@ namespace osu.Game.Screens.OnlinePlay } protected override ModColumn CreateModColumn(ModType modType, Key[] toggleKeys = null) => new ModColumn(modType, true, toggleKeys); + + protected override Drawable[] CreateFooterButtons() => new Drawable[] + { + new ShearedButton(200) + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Text = "Select All", + Action = SelectAll + }, + new ShearedButton(200) + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Text = "Deselect All", + Action = DeselectAll + } + }; } } From 35c106efaab09a067c7b456aabfda8ec7e24fdb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 20:54:36 +0200 Subject: [PATCH 0795/2328] Add test coverage for deselecting all mods on user mod select --- .../UserInterface/TestSceneModSelectScreen.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index c92a738b56..9e0c8206b7 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -415,6 +415,23 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("unimplemented mod panel is filtered", () => getPanelForMod(typeof(TestUnimplementedMod)).Filtered.Value); } + [Test] + public void TestDeselectAllViaButton() + { + createScreen(); + changeRuleset(0); + + AddStep("select DT + HD", () => SelectedMods.Value = new Mod[] { new OsuModDoubleTime(), new OsuModHidden() }); + AddAssert("DT + HD selected", () => modSelectScreen.ChildrenOfType().Count(panel => panel.Active.Value) == 2); + + AddStep("click deselect all button", () => + { + InputManager.MoveMouseTo(this.ChildrenOfType().Last()); + InputManager.Click(MouseButton.Left); + }); + AddUntilStep("all mods deselected", () => !SelectedMods.Value.Any()); + } + private void waitForColumnLoad() => AddUntilStep("all column content loaded", () => modSelectScreen.ChildrenOfType().Any() && modSelectScreen.ChildrenOfType().All(column => column.IsLoaded && column.ItemsLoaded)); From e1953c484c0ae08bb4846a1243bf4c3283640ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 16:43:24 +0200 Subject: [PATCH 0796/2328] Add test coverage for selecting/deselecting all mods on free mod select --- .../TestSceneFreeModSelectScreen.cs | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs index 8eaa45696f..a02055d960 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs @@ -1,19 +1,32 @@ // 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.Linq; using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; +using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; using osu.Game.Rulesets.Osu.Mods; +using osu.Game.Rulesets.Mods; using osu.Game.Screens.OnlinePlay; +using osuTK.Input; namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneFreeModSelectScreen : MultiplayerTestScene { private FreeModSelectScreen freeModSelectScreen; + private readonly Bindable>> availableMods = new Bindable>>(); + + [BackgroundDependencyLoader] + private void load(OsuGameBase osuGameBase) + { + availableMods.BindTo(osuGameBase.AvailableMods); + } [Test] public void TestFreeModSelect() @@ -42,6 +55,26 @@ namespace osu.Game.Tests.Visual.Multiplayer AddAssert("customisation area not expanded", () => this.ChildrenOfType().Single().Height == 0); } + [Test] + public void TestSelectDeselectAll() + { + createFreeModSelect(); + + AddStep("click select all button", () => + { + InputManager.MoveMouseTo(this.ChildrenOfType().First()); + InputManager.Click(MouseButton.Left); + }); + AddUntilStep("all mods selected", assertAllAvailableModsSelected); + + AddStep("click deselect all button", () => + { + InputManager.MoveMouseTo(this.ChildrenOfType().Last()); + InputManager.Click(MouseButton.Left); + }); + AddUntilStep("all mods deselected", () => !freeModSelectScreen.SelectedMods.Value.Any()); + } + private void createFreeModSelect() { AddStep("create free mod select screen", () => Child = freeModSelectScreen = new FreeModSelectScreen @@ -52,5 +85,21 @@ namespace osu.Game.Tests.Visual.Multiplayer () => freeModSelectScreen.ChildrenOfType().Any() && freeModSelectScreen.ChildrenOfType().All(column => column.IsLoaded && column.ItemsLoaded)); } + + private bool assertAllAvailableModsSelected() + { + var allAvailableMods = availableMods.Value + .SelectMany(pair => pair.Value) + .Where(mod => mod.UserPlayable && mod.HasImplementation) + .ToList(); + + foreach (var availableMod in allAvailableMods) + { + if (freeModSelectScreen.SelectedMods.Value.All(selectedMod => selectedMod.GetType() != availableMod.GetType())) + return false; + } + + return true; + } } } From 9f96dd47d12db4a4df8ebfa9268eec86907fb886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 16:48:01 +0200 Subject: [PATCH 0797/2328] Remove schedule in panel load It was causing selection/deselection of all mods to work improperly if a select/deselect all operation was requested before the panel was scrolled into view. In general the schedule was an over-optimisation - the game-global set of available mods shouldn't be changing so often as to warrant such an aggressive debounce. --- osu.Game/Overlays/Mods/ModColumn.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index f6fa591666..7f1d7e0541 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -275,7 +275,7 @@ namespace osu.Game.Overlays.Mods return; localAvailableMods = newMods; - Scheduler.AddOnce(loadPanels); + loadPanels(); } private CancellationTokenSource? cancellationTokenSource; From 9514a5cef7a6b291056697f1305fa159903103a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 17:33:32 +0200 Subject: [PATCH 0798/2328] Only load panels asynchronously outside of BDL --- osu.Game/Overlays/Mods/ModColumn.cs | 41 +++++++++++++++++++---------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 7f1d7e0541..6297b2d92e 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -275,30 +275,25 @@ namespace osu.Game.Overlays.Mods return; localAvailableMods = newMods; - loadPanels(); + + if (!IsLoaded) + // if we're coming from BDL, perform the first load synchronously to make sure everything is in place as early as possible. + onPanelsLoaded(createPanels()); + else + asyncLoadPanels(); } private CancellationTokenSource? cancellationTokenSource; - private void loadPanels() + private void asyncLoadPanels() { cancellationTokenSource?.Cancel(); - var panels = localAvailableMods.Select(mod => CreateModPanel(mod).With(panel => panel.Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0))); + var panels = createPanels(); Task? loadTask; - latestLoadTask = loadTask = LoadComponentsAsync(panels, loaded => - { - panelFlow.ChildrenEnumerable = loaded; - - updateState(); - - foreach (var panel in panelFlow) - { - panel.Active.BindValueChanged(_ => panelStateChanged(panel)); - } - }, (cancellationTokenSource = new CancellationTokenSource()).Token); + latestLoadTask = loadTask = LoadComponentsAsync(panels, onPanelsLoaded, (cancellationTokenSource = new CancellationTokenSource()).Token); loadTask.ContinueWith(_ => { if (loadTask == latestLoadTask) @@ -306,6 +301,24 @@ namespace osu.Game.Overlays.Mods }); } + private IEnumerable createPanels() + { + var panels = localAvailableMods.Select(mod => CreateModPanel(mod).With(panel => panel.Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0))); + return panels; + } + + private void onPanelsLoaded(IEnumerable loaded) + { + panelFlow.ChildrenEnumerable = loaded; + + updateState(); + + foreach (var panel in panelFlow) + { + panel.Active.BindValueChanged(_ => panelStateChanged(panel)); + } + } + private void updateState() { foreach (var panel in panelFlow) From 18e4c3ed0f6659ff7c3dc3b5bb089a7c09c04b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 18:08:11 +0200 Subject: [PATCH 0799/2328] Update mod columns even if they're not present/offscreen Important to make "select/deselect all" operations work on all columns simultaneously, even if they're offscreen. Unfortunately by the nature of how the existing selection animation works, it is hard-tied to the update loop, so we need to compensate. --- osu.Game/Overlays/Mods/ModColumn.cs | 2 +- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 6297b2d92e..07871663a6 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -399,7 +399,7 @@ namespace osu.Game.Overlays.Mods private readonly Queue pendingSelectionOperations = new Queue(); - protected bool SelectionAnimationRunning => pendingSelectionOperations.Count > 0; + internal bool SelectionAnimationRunning => pendingSelectionOperations.Count > 0; protected override void Update() { diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 419a6ee7f7..5ffe07f34a 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -454,6 +454,8 @@ namespace osu.Game.Overlays.Mods FinishTransforms(); } + protected override bool RequiresChildrenUpdate => base.RequiresChildrenUpdate || Column.SelectionAnimationRunning; + private void updateDim() { Colour4 targetColour; From 4ff96f82be57186874089d942beb35ee4766a015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 22:36:08 +0200 Subject: [PATCH 0800/2328] Dim other buttons if customisation panel is open --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 13 ++++++++++--- osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 5ffe07f34a..e5b4927a6a 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -54,7 +54,7 @@ namespace osu.Game.Overlays.Mods protected virtual ModColumn CreateModColumn(ModType modType, Key[]? toggleKeys = null) => new ModColumn(modType, false, toggleKeys); - protected virtual Drawable[] CreateFooterButtons() => new Drawable[] + protected virtual IEnumerable CreateFooterButtons() => new[] { customisationButton = new ShearedToggleButton(200) { @@ -75,6 +75,7 @@ namespace osu.Game.Overlays.Mods private ColumnScrollContainer columnScroll = null!; private ColumnFlowContainer columnFlow = null!; private ShearedToggleButton? customisationButton; + private FillFlowContainer footerButtonFlow = null!; [BackgroundDependencyLoader] private void load() @@ -156,7 +157,7 @@ namespace osu.Game.Overlays.Mods }); } - FooterContent.Child = new FillFlowContainer + FooterContent.Child = footerButtonFlow = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -169,7 +170,7 @@ namespace osu.Game.Overlays.Mods Horizontal = 70 }, Spacing = new Vector2(10), - Children = CreateFooterButtons() + ChildrenEnumerable = CreateFooterButtons() }; } @@ -259,6 +260,12 @@ namespace osu.Game.Overlays.Mods MainAreaContent.FadeColour(customisationVisible.Value ? Colour4.Gray : Colour4.White, transition_duration, Easing.InOutCubic); + foreach (var button in footerButtonFlow) + { + if (button != customisationButton) + button.Enabled.Value = !customisationVisible.Value; + } + float modAreaHeight = customisationVisible.Value ? ModSettingsArea.HEIGHT : 0; modSettingsArea.ResizeHeightTo(modAreaHeight, transition_duration, Easing.InOutCubic); diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs index 52ca28ce5d..6298e1f8c0 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; @@ -27,7 +28,7 @@ namespace osu.Game.Screens.OnlinePlay protected override ModColumn CreateModColumn(ModType modType, Key[] toggleKeys = null) => new ModColumn(modType, true, toggleKeys); - protected override Drawable[] CreateFooterButtons() => new Drawable[] + protected override IEnumerable CreateFooterButtons() => new[] { new ShearedButton(200) { From 6ad990dfc3a32d824c08e29ad5dc7d20410b14e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 10:17:24 +0200 Subject: [PATCH 0801/2328] Add basic localisation strings for new mod select --- osu.Game/Localisation/CommonStrings.cs | 10 +++++++ .../Localisation/ModSelectScreenStrings.cs | 29 +++++++++++++++++++ osu.Game/Overlays/Mods/ModSelectScreen.cs | 9 +++--- .../Screens/OnlinePlay/FreeModSelectScreen.cs | 5 ++-- 4 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 osu.Game/Localisation/ModSelectScreenStrings.cs diff --git a/osu.Game/Localisation/CommonStrings.cs b/osu.Game/Localisation/CommonStrings.cs index 52e9811cf7..9cd626af0f 100644 --- a/osu.Game/Localisation/CommonStrings.cs +++ b/osu.Game/Localisation/CommonStrings.cs @@ -59,6 +59,16 @@ namespace osu.Game.Localisation /// public static LocalisableString Importing => new TranslatableString(getKey(@"importing"), @"Importing..."); + /// + /// "Deselect All" + /// + public static LocalisableString DeselectAll => new TranslatableString(getKey(@"deselect_all"), @"Deselect All"); + + /// + /// "Select All" + /// + public static LocalisableString SelectAll => new TranslatableString(getKey(@"select_all"), @"Select All"); + private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game/Localisation/ModSelectScreenStrings.cs b/osu.Game/Localisation/ModSelectScreenStrings.cs new file mode 100644 index 0000000000..0c113fd381 --- /dev/null +++ b/osu.Game/Localisation/ModSelectScreenStrings.cs @@ -0,0 +1,29 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Localisation; + +namespace osu.Game.Localisation +{ + public static class ModSelectScreenStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.ModSelectScreen"; + + /// + /// "Mod Select" + /// + public static LocalisableString ModSelectTitle => new TranslatableString(getKey(@"mod_select_title"), @"Mod Select"); + + /// + /// "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play. Others are just for fun." + /// + public static LocalisableString ModSelectDescription => new TranslatableString(getKey(@"mod_select_description"), @"Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play. Others are just for fun."); + + /// + /// "Mod Customisation" + /// + public static LocalisableString ModCustomisation => new TranslatableString(getKey(@"mod_customisation"), @"Mod Customisation"); + + private static string getKey(string key) => $@"{prefix}:{key}"; + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index e5b4927a6a..4a80a0637e 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -23,6 +23,7 @@ using osu.Game.Input.Bindings; using osu.Game.Rulesets.Mods; using osuTK; using osuTK.Input; +using osu.Game.Localisation; namespace osu.Game.Overlays.Mods { @@ -58,12 +59,12 @@ namespace osu.Game.Overlays.Mods { customisationButton = new ShearedToggleButton(200) { - Text = "Mod Customisation", + Text = ModSelectScreenStrings.ModCustomisation, Active = { BindTarget = customisationVisible } }, new ShearedButton(200) { - Text = "Deselect All", + Text = CommonStrings.DeselectAll, Action = DeselectAll } }; @@ -80,8 +81,8 @@ namespace osu.Game.Overlays.Mods [BackgroundDependencyLoader] private void load() { - Header.Title = "Mod Select"; - Header.Description = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play. Others are just for fun."; + Header.Title = ModSelectScreenStrings.ModSelectTitle; + Header.Description = ModSelectScreenStrings.ModSelectDescription; AddRange(new Drawable[] { diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs index 6298e1f8c0..5a7fe8a778 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs @@ -8,6 +8,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; using osu.Game.Rulesets.Mods; using osuTK.Input; +using osu.Game.Localisation; namespace osu.Game.Screens.OnlinePlay { @@ -34,14 +35,14 @@ namespace osu.Game.Screens.OnlinePlay { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - Text = "Select All", + Text = CommonStrings.SelectAll, Action = SelectAll }, new ShearedButton(200) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - Text = "Deselect All", + Text = CommonStrings.DeselectAll, Action = DeselectAll } }; From 271d64fd545deaa4fb42eb6d6464b7283d55f871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 May 2022 22:30:07 +0200 Subject: [PATCH 0802/2328] Add back button to mod select overlays --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 4a80a0637e..2af65d89b5 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -79,7 +79,7 @@ namespace osu.Game.Overlays.Mods private FillFlowContainer footerButtonFlow = null!; [BackgroundDependencyLoader] - private void load() + private void load(OsuColour colours) { Header.Title = ModSelectScreenStrings.ModSelectTitle; Header.Description = ModSelectScreenStrings.ModSelectDescription; @@ -171,7 +171,13 @@ namespace osu.Game.Overlays.Mods Horizontal = 70 }, Spacing = new Vector2(10), - ChildrenEnumerable = CreateFooterButtons() + ChildrenEnumerable = CreateFooterButtons().Prepend(new ShearedButton(200) + { + Text = CommonStrings.Back, + Action = Hide, + DarkerColour = colours.Pink2, + LighterColour = colours.Pink1 + }) }; } From 1c029552d7c9308f05969bb640c7adec2f51a889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 10:23:49 +0200 Subject: [PATCH 0803/2328] Add test coverage for mod select back button --- .../UserInterface/TestSceneModSelectScreen.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index 9e0c8206b7..42ffeba444 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -432,6 +432,25 @@ namespace osu.Game.Tests.Visual.UserInterface AddUntilStep("all mods deselected", () => !SelectedMods.Value.Any()); } + [Test] + public void TestCloseViaBackButton() + { + createScreen(); + changeRuleset(0); + + AddStep("select difficulty adjust", () => SelectedMods.Value = new Mod[] { new OsuModDifficultyAdjust() }); + assertCustomisationToggleState(disabled: false, active: true); + AddAssert("back button disabled", () => !this.ChildrenOfType().First().Enabled.Value); + + AddStep("dismiss customisation area", () => InputManager.Key(Key.Escape)); + AddStep("click back button", () => + { + InputManager.MoveMouseTo(this.ChildrenOfType().First()); + InputManager.Click(MouseButton.Left); + }); + AddAssert("mod select hidden", () => modSelectScreen.State.Value == Visibility.Hidden); + } + private void waitForColumnLoad() => AddUntilStep("all column content loaded", () => modSelectScreen.ChildrenOfType().Any() && modSelectScreen.ChildrenOfType().All(column => column.IsLoaded && column.ItemsLoaded)); From 9d3e67b10dbf9b6fc27405a50023f735a95d16fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 10:25:23 +0200 Subject: [PATCH 0804/2328] Update free mod select/deselect all test after back button addition --- .../Visual/Multiplayer/TestSceneFreeModSelectScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs index a02055d960..4eb14542ba 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs @@ -62,7 +62,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("click select all button", () => { - InputManager.MoveMouseTo(this.ChildrenOfType().First()); + InputManager.MoveMouseTo(this.ChildrenOfType().ElementAt(1)); InputManager.Click(MouseButton.Left); }); AddUntilStep("all mods selected", assertAllAvailableModsSelected); From fa0a256f4843f4cd5c3cbfcf1737e613f2ff856a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 10:48:15 +0200 Subject: [PATCH 0805/2328] Add localisable string for difficulty multiplier display --- .../DifficultyMultiplierDisplayStrings.cs | 19 +++++++++++++++++++ .../Mods/DifficultyMultiplierDisplay.cs | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs diff --git a/osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs b/osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs new file mode 100644 index 0000000000..c281d90190 --- /dev/null +++ b/osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs @@ -0,0 +1,19 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Localisation; + +namespace osu.Game.Localisation +{ + public static class DifficultyMultiplierDisplayStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.DifficultyMultiplierDisplay"; + + /// + /// "Difficulty Multiplier" + /// + public static LocalisableString DifficultyMultiplier => new TranslatableString(getKey(@"difficulty_multiplier"), @"Difficulty Multiplier"); + + private static string getKey(string key) => $@"{prefix}:{key}"; + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs b/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs index 1d848fe456..4ccec0dd87 100644 --- a/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs +++ b/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs @@ -15,6 +15,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Mods; using osuTK; +using osu.Game.Localisation; namespace osu.Game.Overlays.Mods { @@ -99,7 +100,7 @@ namespace osu.Game.Overlays.Mods Origin = Anchor.Centre, Margin = new MarginPadding { Horizontal = 18 }, Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0), - Text = "Difficulty Multiplier", + Text = DifficultyMultiplierDisplayStrings.DifficultyMultiplier, Font = OsuFont.Default.With(size: 17, weight: FontWeight.SemiBold) } } From f761d4d4d4060597ff01624f513c849090b9160b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 10:56:03 +0200 Subject: [PATCH 0806/2328] Reuse "select/deselect all" localisable string on column toggle --- osu.Game/Overlays/Mods/ModColumn.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 07871663a6..cbd036c71f 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -22,6 +23,7 @@ using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; +using osu.Game.Localisation; using osu.Game.Rulesets.Mods; using osu.Game.Utils; using osuTK; @@ -220,7 +222,6 @@ namespace osu.Game.Overlays.Mods Origin = Anchor.CentreLeft, Scale = new Vector2(0.8f), RelativeSizeAxes = Axes.X, - LabelText = "Enable All", Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0) }); panelFlow.Padding = new MarginPadding @@ -265,6 +266,19 @@ namespace osu.Game.Overlays.Mods contentBackground.Colour = colourProvider.Background4; } + protected override void LoadComplete() + { + base.LoadComplete(); + + toggleAllCheckbox?.Current.BindValueChanged(_ => updateToggleAllText(), true); + } + + private void updateToggleAllText() + { + Debug.Assert(toggleAllCheckbox != null); + toggleAllCheckbox.LabelText = toggleAllCheckbox.Current.Value ? CommonStrings.DeselectAll : CommonStrings.SelectAll; + } + private void updateLocalAvailableMods() { var newMods = ModUtils.FlattenMods(availableMods.Value.GetValueOrDefault(ModType) ?? Array.Empty()) From fd75963ca2d4ce479ce1965ae81390b45cf68da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 11:01:05 +0200 Subject: [PATCH 0807/2328] Dismiss mod select if select binding is pressed --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 7d0400aace..706222761d 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -384,7 +384,7 @@ namespace osu.Game.Overlays.Mods return true; } - if (e.Action == Hotkey) + if (e.Action == Hotkey || e.Action == GlobalAction.Select) { if (customisationVisible.Value) customisationVisible.Value = false; From 8ee3fdd0aaa9cd03339ed21576a2aaa080bc4ff3 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 7 May 2022 12:15:11 +0300 Subject: [PATCH 0808/2328] Change mod scrolling behaviour to not scroll horizontally on columns/settings --- osu.Game/Overlays/Mods/ModColumn.cs | 2 +- osu.Game/Overlays/Mods/ModSettingsArea.cs | 2 +- .../Mods/NestedVerticalScrollContainer.cs | 48 ------------------- 3 files changed, 2 insertions(+), 50 deletions(-) delete mode 100644 osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 07871663a6..1bc139a181 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -186,7 +186,7 @@ namespace osu.Game.Overlays.Mods }, new Drawable[] { - new NestedVerticalScrollContainer + new OsuScrollContainer(Direction.Vertical) { RelativeSizeAxes = Axes.Both, ClampExtension = 100, diff --git a/osu.Game/Overlays/Mods/ModSettingsArea.cs b/osu.Game/Overlays/Mods/ModSettingsArea.cs index 08f563f93e..f44e4bf07f 100644 --- a/osu.Game/Overlays/Mods/ModSettingsArea.cs +++ b/osu.Game/Overlays/Mods/ModSettingsArea.cs @@ -158,7 +158,7 @@ namespace osu.Game.Overlays.Mods new[] { Empty() }, new Drawable[] { - new NestedVerticalScrollContainer + new OsuScrollContainer(Direction.Vertical) { RelativeSizeAxes = Axes.Both, ClampExtension = 100, diff --git a/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs b/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs deleted file mode 100644 index d27f97f3d2..0000000000 --- a/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -#nullable enable - -using osu.Framework.Graphics; -using osu.Framework.Input.Events; -using osu.Game.Graphics.Containers; - -namespace osu.Game.Overlays.Mods -{ - /// - /// A scroll container that handles the case of vertically scrolling content inside a larger horizontally scrolling parent container. - /// - public class NestedVerticalScrollContainer : OsuScrollContainer - { - private ModSelectScreen.ColumnScrollContainer? parentScrollContainer; - - protected override void LoadComplete() - { - base.LoadComplete(); - - parentScrollContainer = this.FindClosestParent(); - } - - protected override bool OnScroll(ScrollEvent e) - { - if (parentScrollContainer == null) - return base.OnScroll(e); - - bool topRightInView = parentScrollContainer.ScreenSpaceDrawQuad.Contains(ScreenSpaceDrawQuad.TopRight); - bool bottomLeftInView = parentScrollContainer.ScreenSpaceDrawQuad.Contains(ScreenSpaceDrawQuad.BottomLeft); - - // If not completely on-screen, handle scroll but also allow parent to scroll at the same time (to hopefully bring our content into full view). - if (!topRightInView || !bottomLeftInView) - return false; - - bool scrollingPastEnd = e.ScrollDelta.Y < 0 && IsScrolledToEnd(); - bool scrollingPastStart = e.ScrollDelta.Y > 0 && Target <= 0; - - // If at either of our extents, delegate scroll to the horizontal parent container. - if (scrollingPastStart || scrollingPastEnd) - return false; - - return base.OnScroll(e); - } - } -} From d4c9de8596b88e268893892b36305048d1faa5ba Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 7 May 2022 13:23:48 +0300 Subject: [PATCH 0809/2328] Move button width in mod select to constant --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 8 +++++--- osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 2af65d89b5..a9af48fc06 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -29,6 +29,8 @@ namespace osu.Game.Overlays.Mods { public abstract class ModSelectScreen : ShearedOverlayContainer { + protected const int BUTTON_WIDTH = 200; + protected override OverlayColourScheme ColourScheme => OverlayColourScheme.Green; [Cached] @@ -57,12 +59,12 @@ namespace osu.Game.Overlays.Mods protected virtual IEnumerable CreateFooterButtons() => new[] { - customisationButton = new ShearedToggleButton(200) + customisationButton = new ShearedToggleButton(BUTTON_WIDTH) { Text = ModSelectScreenStrings.ModCustomisation, Active = { BindTarget = customisationVisible } }, - new ShearedButton(200) + new ShearedButton(BUTTON_WIDTH) { Text = CommonStrings.DeselectAll, Action = DeselectAll @@ -171,7 +173,7 @@ namespace osu.Game.Overlays.Mods Horizontal = 70 }, Spacing = new Vector2(10), - ChildrenEnumerable = CreateFooterButtons().Prepend(new ShearedButton(200) + ChildrenEnumerable = CreateFooterButtons().Prepend(new ShearedButton(BUTTON_WIDTH) { Text = CommonStrings.Back, Action = Hide, diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs index 5a7fe8a778..6d241af043 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs @@ -31,14 +31,14 @@ namespace osu.Game.Screens.OnlinePlay protected override IEnumerable CreateFooterButtons() => new[] { - new ShearedButton(200) + new ShearedButton(BUTTON_WIDTH) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Text = CommonStrings.SelectAll, Action = SelectAll }, - new ShearedButton(200) + new ShearedButton(BUTTON_WIDTH) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, From a716f62a6a373ed4e37827c7790f2927e5b402c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 12:59:15 +0200 Subject: [PATCH 0810/2328] Flash back button when keyboard back binding is pressed --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index a9af48fc06..8ec2260370 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -77,8 +77,10 @@ namespace osu.Game.Overlays.Mods private ModSettingsArea modSettingsArea = null!; private ColumnScrollContainer columnScroll = null!; private ColumnFlowContainer columnFlow = null!; - private ShearedToggleButton? customisationButton; + private FillFlowContainer footerButtonFlow = null!; + private ShearedButton backButton = null!; + private ShearedToggleButton? customisationButton; [BackgroundDependencyLoader] private void load(OsuColour colours) @@ -173,7 +175,7 @@ namespace osu.Game.Overlays.Mods Horizontal = 70 }, Spacing = new Vector2(10), - ChildrenEnumerable = CreateFooterButtons().Prepend(new ShearedButton(BUTTON_WIDTH) + ChildrenEnumerable = CreateFooterButtons().Prepend(backButton = new ShearedButton(BUTTON_WIDTH) { Text = CommonStrings.Back, Action = Hide, @@ -364,9 +366,12 @@ namespace osu.Game.Overlays.Mods public override bool OnPressed(KeyBindingPressEvent e) { - if (e.Action == GlobalAction.Back && customisationVisible.Value) + if (e.Action == GlobalAction.Back) { - customisationVisible.Value = false; + if (customisationVisible.Value) + customisationVisible.Value = false; + else + backButton.TriggerClick(); return true; } From 5d6d7bb324bab493478d8a843278362bfbdcc330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 13:10:03 +0200 Subject: [PATCH 0811/2328] Fix incorrect assert in multiplayer song select test scene --- .../Multiplayer/TestSceneMultiplayerMatchSongSelect.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs index d170b12dc3..061fe5715b 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs @@ -132,7 +132,11 @@ namespace osu.Game.Tests.Visual.Multiplayer private void assertHasFreeModButton(Type type, bool hasButton = true) { AddAssert($"{type.ReadableName()} {(hasButton ? "displayed" : "not displayed")} in freemod overlay", - () => this.ChildrenOfType().Single().ChildrenOfType().All(b => b.Mod.GetType() != type)); + () => this.ChildrenOfType() + .Single() + .ChildrenOfType() + .Where(panel => !panel.Filtered.Value) + .All(b => b.Mod.GetType() != type)); } private class TestMultiplayerMatchSongSelect : MultiplayerMatchSongSelect From 0c2b4a6c0b189571cd175c21e195c9193b8d0f7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 15:44:22 +0200 Subject: [PATCH 0812/2328] Fix invalid `IsLoaded` check Would fail when `availableMods` would be changed from a different thread while the columns aren't loaded. --- osu.Game/Overlays/Mods/ModColumn.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index a1ad435733..346e62e5fa 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -250,9 +250,8 @@ namespace osu.Game.Overlays.Mods private void load(OsuGameBase game, OverlayColourProvider colourProvider, OsuColour colours) { availableMods.BindTo(game.AvailableMods); - // this `BindValueChanged` callback is intentionally here, to ensure that local available mods are constructed as early as possible. - // this is needed to make sure no external changes to mods are dropped while mod panels are asynchronously loading. - availableMods.BindValueChanged(_ => updateLocalAvailableMods(), true); + updateLocalAvailableMods(asyncLoadContent: false); + availableMods.BindValueChanged(_ => updateLocalAvailableMods(asyncLoadContent: true)); headerBackground.Colour = accentColour = colours.ForModType(ModType); @@ -279,7 +278,7 @@ namespace osu.Game.Overlays.Mods toggleAllCheckbox.LabelText = toggleAllCheckbox.Current.Value ? CommonStrings.DeselectAll : CommonStrings.SelectAll; } - private void updateLocalAvailableMods() + private void updateLocalAvailableMods(bool asyncLoadContent) { var newMods = ModUtils.FlattenMods(availableMods.Value.GetValueOrDefault(ModType) ?? Array.Empty()) .Select(m => m.DeepClone()) @@ -290,11 +289,10 @@ namespace osu.Game.Overlays.Mods localAvailableMods = newMods; - if (!IsLoaded) - // if we're coming from BDL, perform the first load synchronously to make sure everything is in place as early as possible. - onPanelsLoaded(createPanels()); - else + if (asyncLoadContent) asyncLoadPanels(); + else + onPanelsLoaded(createPanels()); } private CancellationTokenSource? cancellationTokenSource; From 0d32bf91eb19af79e5d61bab685fced1f3d26d2e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 8 May 2022 01:30:21 +0900 Subject: [PATCH 0813/2328] Hardcode hide key handling in `ModSelectScreen` --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 33 +++++++++---------- .../OnlinePlay/OnlinePlaySongSelect.cs | 2 -- osu.Game/Screens/Select/SongSelect.cs | 5 +-- 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 3980f6f4b9..2a9e235364 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -20,11 +20,10 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; +using osu.Game.Localisation; using osu.Game.Rulesets.Mods; -using osu.Game.Screens.Select; using osuTK; using osuTK.Input; -using osu.Game.Localisation; namespace osu.Game.Overlays.Mods { @@ -49,15 +48,6 @@ namespace osu.Game.Overlays.Mods } } - /// - /// Hotkey that should be used to hide the mod select screen. - /// - /// - /// This is handled locally here rather than via , because this overlay is being registered at the game level - /// and therefore takes away keyboard focus from the screen stack. - /// - internal GlobalAction? Hotkey { get; set; } - /// /// Whether the total score multiplier calculated from the current selected set of mods should be shown. /// @@ -382,6 +372,8 @@ namespace osu.Game.Overlays.Mods if (e.Repeat) return false; + // This is handled locally here because this overlay is being registered at the game level + // and therefore takes away keyboard focus from the screen stack. if (e.Action == GlobalAction.Back) { if (customisationVisible.Value) @@ -391,15 +383,20 @@ namespace osu.Game.Overlays.Mods return true; } - if (e.Action == Hotkey || e.Action == GlobalAction.Select) + switch (e.Action) { - if (customisationVisible.Value) - customisationVisible.Value = false; - Hide(); - return true; - } + case GlobalAction.ToggleModSelection: + case GlobalAction.Select: + { + if (customisationVisible.Value) + customisationVisible.Value = false; + Hide(); + return true; + } - return base.OnPressed(e); + default: + return base.OnPressed(e); + } } internal class ColumnScrollContainer : OsuScrollContainer diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs index 4b6c06481b..c4503773ad 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Screens; using osu.Game.Beatmaps; -using osu.Game.Input.Bindings; using osu.Game.Online.API; using osu.Game.Online.Rooms; using osu.Game.Overlays; @@ -163,7 +162,6 @@ namespace osu.Game.Screens.OnlinePlay protected override ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen(OverlayColourScheme.Plum) { - Hotkey = GlobalAction.ToggleModSelection, IsValidMod = IsValidMod }; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 7317b20f88..eb5e996972 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -333,10 +333,7 @@ namespace osu.Game.Screens.Select (new FooterButtonOptions(), BeatmapOptions) }; - protected virtual ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen - { - Hotkey = GlobalAction.ToggleModSelection - }; + protected virtual ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen(); protected virtual void ApplyFilterToCarousel(FilterCriteria criteria) { From 1d27ef18dc7d4a02aea655aa357ed8f62ec8a6ea Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 8 May 2022 01:49:29 +0900 Subject: [PATCH 0814/2328] Add xmldoc for `IsValidMod` --- osu.Game/Overlays/Mods/ModColumn.cs | 2 +- osu.Game/Overlays/Mods/ModSelectScreen.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 346e62e5fa..f0741cdc40 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Mods private Func? filter; /// - /// Function determining whether each mod in the column should be displayed. + /// A function determining whether each mod in the column should be displayed. /// A return value of means that the mod is not filtered and therefore its corresponding panel should be displayed. /// A return value of means that the mod is filtered out and therefore its corresponding panel should be hidden. /// diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 2a9e235364..8098e8b0f6 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -36,6 +36,11 @@ namespace osu.Game.Overlays.Mods private Func isValidMod = m => true; + /// + /// A function determining whether each mod in the column should be displayed. + /// A return value of means that the mod is not filtered and therefore its corresponding panel should be displayed. + /// A return value of means that the mod is filtered out and therefore its corresponding panel should be hidden. + /// public Func IsValidMod { get => isValidMod; From 03c80d91978988229b338c4056ef3a7f6d282702 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 8 May 2022 01:58:37 +0900 Subject: [PATCH 0815/2328] Reorder methods / properties in `ModSelectScreen` for legibility --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 86 ++++++++++++++--------- 1 file changed, 52 insertions(+), 34 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 8098e8b0f6..ef96811144 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -60,29 +60,20 @@ namespace osu.Game.Overlays.Mods protected virtual ModColumn CreateModColumn(ModType modType, Key[]? toggleKeys = null) => new ModColumn(modType, false, toggleKeys); - protected virtual IEnumerable CreateFooterButtons() => new[] - { - customisationButton = new ShearedToggleButton(BUTTON_WIDTH) - { - Text = ModSelectScreenStrings.ModCustomisation, - Active = { BindTarget = customisationVisible } - }, - new ShearedButton(BUTTON_WIDTH) - { - Text = CommonStrings.DeselectAll, - Action = DeselectAll - } - }; + protected virtual IReadOnlyList ComputeNewModsFromSelection(IReadOnlyList oldSelection, IReadOnlyList newSelection) => newSelection; + + protected virtual IEnumerable CreateFooterButtons() => createDefaultFooterButtons(); private readonly BindableBool customisationVisible = new BindableBool(); - private DifficultyMultiplierDisplay? multiplierDisplay; private ModSettingsArea modSettingsArea = null!; private ColumnScrollContainer columnScroll = null!; private ColumnFlowContainer columnFlow = null!; - private FillFlowContainer footerButtonFlow = null!; private ShearedButton backButton = null!; + + private DifficultyMultiplierDisplay? multiplierDisplay; + private ShearedToggleButton? customisationButton; protected ModSelectScreen(OverlayColourScheme colourScheme = OverlayColourScheme.Green) @@ -193,14 +184,6 @@ namespace osu.Game.Overlays.Mods }; } - private ColumnDimContainer createModColumnContent(ModType modType, Key[]? toggleKeys = null) - => new ColumnDimContainer(CreateModColumn(modType, toggleKeys)) - { - AutoSizeAxes = Axes.X, - RelativeSizeAxes = Axes.Y, - RequestScroll = column => columnScroll.ScrollIntoView(column, extraScroll: 140) - }; - protected override void LoadComplete() { base.LoadComplete(); @@ -224,6 +207,47 @@ namespace osu.Game.Overlays.Mods updateAvailableMods(); } + /// + /// Select all visible mods in all columns. + /// + protected void SelectAll() + { + foreach (var column in columnFlow.Columns) + column.SelectAll(); + } + + /// + /// Deselect all visible mods in all columns. + /// + protected void DeselectAll() + { + foreach (var column in columnFlow.Columns) + column.DeselectAll(); + } + + private ColumnDimContainer createModColumnContent(ModType modType, Key[]? toggleKeys = null) + => new ColumnDimContainer(CreateModColumn(modType, toggleKeys)) + { + AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Y, + RequestScroll = column => columnScroll.ScrollIntoView(column, extraScroll: 140) + }; + + private ShearedButton[] createDefaultFooterButtons() + => new[] + { + customisationButton = new ShearedToggleButton(BUTTON_WIDTH) + { + Text = ModSelectScreenStrings.ModCustomisation, + Active = { BindTarget = customisationVisible } + }, + new ShearedButton(BUTTON_WIDTH) + { + Text = CommonStrings.DeselectAll, + Action = DeselectAll + } + }; + private void updateMultiplier() { if (multiplierDisplay == null) @@ -314,7 +338,7 @@ namespace osu.Game.Overlays.Mods SelectedMods.Value = ComputeNewModsFromSelection(SelectedMods.Value, candidateSelection); } - protected virtual IReadOnlyList ComputeNewModsFromSelection(IReadOnlyList oldSelection, IReadOnlyList newSelection) => newSelection; + #region Transition handling protected override void PopIn() { @@ -360,17 +384,9 @@ namespace osu.Game.Overlays.Mods } } - protected void SelectAll() - { - foreach (var column in columnFlow.Columns) - column.SelectAll(); - } + #endregion - protected void DeselectAll() - { - foreach (var column in columnFlow.Columns) - column.DeselectAll(); - } + #region Input handling public override bool OnPressed(KeyBindingPressEvent e) { @@ -404,6 +420,8 @@ namespace osu.Game.Overlays.Mods } } + #endregion + internal class ColumnScrollContainer : OsuScrollContainer { public ColumnScrollContainer() From 2278da563e95e26f4ed6718b6441067df7f67463 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 8 May 2022 02:03:28 +0900 Subject: [PATCH 0816/2328] Add various xmldoc for nested classes --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index ef96811144..0a1b4e857e 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -422,6 +422,9 @@ namespace osu.Game.Overlays.Mods #endregion + /// + /// Manages horizontal scrolling of mod columns, along with the "active" states of each column based on visibility. + /// internal class ColumnScrollContainer : OsuScrollContainer { public ColumnScrollContainer() @@ -460,6 +463,9 @@ namespace osu.Game.Overlays.Mods } } + /// + /// Manages padding and layout of mod columns. + /// internal class ColumnFlowContainer : FillFlowContainer { public IEnumerable Columns => Children.Select(dimWrapper => dimWrapper.Column); @@ -496,11 +502,21 @@ namespace osu.Game.Overlays.Mods } } + /// + /// Encapsulates a column and provides dim and input blocking based on an externally managed "active" state. + /// internal class ColumnDimContainer : Container { public ModColumn Column { get; } + /// + /// Tracks whether this column is in an interactive state. Generally only the case when the column is on-screen. + /// public readonly Bindable Active = new BindableBool(); + + /// + /// Invoked when the column is clicked while not active, requesting a scroll to be performed to bring it on-screen. + /// public Action? RequestScroll { get; set; } [Resolved] @@ -555,6 +571,9 @@ namespace osu.Game.Overlays.Mods } } + /// + /// A container which blocks and handles input, managing the "return from customisation" state change. + /// private class ClickToReturnContainer : Container { public BindableBool HandleMouse { get; } = new BindableBool(); From 46d3220c07ea99d4ef4dc67756ddee5d781f06a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 21:20:00 +0200 Subject: [PATCH 0817/2328] Isolate sample screens from global mods bindable Fixes scenario wherein entering the first run setup overlay, exiting at the "UI scale" step (which shows a song select), then moving to actua song select and trying to select a mod would lead to a crash. The crash was caused by two active mod screen instances attempting to swap the global mod bindable's mod instances for ones they owned. This logic - while generally problematic and hard to maintain - was fixing several issues with mod reference management and setting copying, so I'm letting it live another day. This change will mean that the song select preview on the "UI scale" step will not receive the same mods that the actual game has enabled. That said, it already doesn't use the same beatmap or ruleset, so this looks fine to break. --- osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs index 862506add2..152d67ab27 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -19,6 +20,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; using osu.Game.Overlays.Settings; using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; using osu.Game.Screens; using osu.Game.Screens.Menu; using osu.Game.Screens.Select; @@ -131,6 +133,10 @@ namespace osu.Game.Overlays.FirstRunSetup [Cached(typeof(IBindable))] protected Bindable Beatmap { get; private set; } = new Bindable(); + [Cached] + [Cached(typeof(IBindable>))] + protected Bindable> SelectedMods { get; private set; } = new Bindable>(Array.Empty()); + public override bool HandlePositionalInput => false; public override bool HandleNonPositionalInput => false; public override bool PropagatePositionalInputSubTree => false; From 836de491353212ed8acc533437ac72b1c349af38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 22:41:48 +0200 Subject: [PATCH 0818/2328] Adjust skin editor scene library test for extensibility --- .../TestSceneSkinEditorSceneLibrary.cs | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs index d3aeba2c0f..3e6cf325df 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs @@ -20,20 +20,21 @@ namespace osu.Game.Tests.Visual.Navigation { public class TestSceneSkinEditorSceneLibrary : OsuGameTestScene { - private SkinEditor skinEditor; + private TestPlaySongSelect songSelect; + private SkinEditor skinEditor => Game.ChildrenOfType().FirstOrDefault(); - public override void SetUpSteps() + private void advanceToSongSelect() { - base.SetUpSteps(); - - Screens.Select.SongSelect songSelect = null; PushAndConfirm(() => songSelect = new TestPlaySongSelect()); AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded); AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely()); AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault); + } + private void openSkinEditor() + { AddStep("open skin editor", () => { InputManager.PressKey(Key.ControlLeft); @@ -42,13 +43,15 @@ namespace osu.Game.Tests.Visual.Navigation InputManager.ReleaseKey(Key.ControlLeft); InputManager.ReleaseKey(Key.ShiftLeft); }); - - AddUntilStep("get skin editor", () => (skinEditor = Game.ChildrenOfType().FirstOrDefault()) != null); + AddUntilStep("skin editor loaded", () => skinEditor != null); } [Test] public void TestEditComponentDuringGameplay() { + advanceToSongSelect(); + openSkinEditor(); + switchToGameplayScene(); BarHitErrorMeter hitErrorMeter = null; @@ -85,6 +88,8 @@ namespace osu.Game.Tests.Visual.Navigation [Test] public void TestAutoplayCompatibleModsRetainedOnEnteringGameplay() { + advanceToSongSelect(); + openSkinEditor(); AddStep("select DT", () => Game.SelectedMods.Value = new Mod[] { new OsuModDoubleTime() }); switchToGameplayScene(); @@ -95,6 +100,8 @@ namespace osu.Game.Tests.Visual.Navigation [Test] public void TestAutoplayIncompatibleModsRemovedOnEnteringGameplay() { + advanceToSongSelect(); + openSkinEditor(); AddStep("select no fail and spun out", () => Game.SelectedMods.Value = new Mod[] { new OsuModNoFail(), new OsuModSpunOut() }); switchToGameplayScene(); @@ -105,6 +112,8 @@ namespace osu.Game.Tests.Visual.Navigation [Test] public void TestDuplicateAutoplayModRemovedOnEnteringGameplay() { + advanceToSongSelect(); + openSkinEditor(); AddStep("select autoplay", () => Game.SelectedMods.Value = new Mod[] { new OsuModAutoplay() }); switchToGameplayScene(); @@ -115,6 +124,8 @@ namespace osu.Game.Tests.Visual.Navigation [Test] public void TestCinemaModRemovedOnEnteringGameplay() { + advanceToSongSelect(); + openSkinEditor(); AddStep("select cinema", () => Game.SelectedMods.Value = new Mod[] { new OsuModCinema() }); switchToGameplayScene(); From a3e61fddcb06c21ed7e12d7af61bd9a7d03a260c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 22:43:45 +0200 Subject: [PATCH 0819/2328] Rename skin editor scene library test scene to be more general --- ...inEditorSceneLibrary.cs => TestSceneSkinEditorNavigation.cs} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename osu.Game.Tests/Visual/Navigation/{TestSceneSkinEditorSceneLibrary.cs => TestSceneSkinEditorNavigation.cs} (98%) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs similarity index 98% rename from osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs rename to osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs index 3e6cf325df..5359d992a1 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorSceneLibrary.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs @@ -18,7 +18,7 @@ using static osu.Game.Tests.Visual.Navigation.TestSceneScreenNavigation; namespace osu.Game.Tests.Visual.Navigation { - public class TestSceneSkinEditorSceneLibrary : OsuGameTestScene + public class TestSceneSkinEditorNavigation : OsuGameTestScene { private TestPlaySongSelect songSelect; private SkinEditor skinEditor => Game.ChildrenOfType().FirstOrDefault(); From bdea6d865443e51e2ae927b01d3f347473364907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 22:47:19 +0200 Subject: [PATCH 0820/2328] Add failing test for mod overlay not closing on entering skin editor --- .../Navigation/TestSceneSkinEditorNavigation.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs index 5359d992a1..68c44f49cc 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs @@ -4,6 +4,7 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Extensions; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; using osu.Game.Overlays.Settings; @@ -133,6 +134,16 @@ namespace osu.Game.Tests.Visual.Navigation AddAssert("no mod selected", () => !((Player)Game.ScreenStack.CurrentScreen).Mods.Value.Any()); } + [Test] + public void TestModOverlayClosesOnOpeningSkinEditor() + { + advanceToSongSelect(); + AddStep("open mod overlay", () => songSelect.ModSelectOverlay.Show()); + + openSkinEditor(); + AddUntilStep("mod overlay closed", () => songSelect.ModSelectOverlay.State.Value == Visibility.Hidden); + } + private void switchToGameplayScene() { AddStep("Click gameplay scene button", () => skinEditor.ChildrenOfType().First(b => b.Text == "Gameplay").TriggerClick()); From a45ca2ad101957b9e00560a0b66a01508e724168 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 22:50:10 +0200 Subject: [PATCH 0821/2328] Fix focused overlays not registering as such Also fixes bug wherein opening skin editor at song select with mod select open would show mod select on top of the skin editor. --- osu.Game/OsuGame.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index c2a96a9082..54c4231b06 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -201,6 +201,10 @@ namespace osu.Game externalOverlays.Add(overlayContainer); overlayContent.Add(overlayContainer); + + if (overlayContainer is OsuFocusedOverlayContainer focusedOverlayContainer) + focusedOverlays.Add(focusedOverlayContainer); + return new InvokeOnDisposal(() => unregisterBlockingOverlay(overlayContainer)); } @@ -223,6 +227,10 @@ namespace osu.Game private void unregisterBlockingOverlay(OverlayContainer overlayContainer) { externalOverlays.Remove(overlayContainer); + + if (overlayContainer is OsuFocusedOverlayContainer focusedOverlayContainer) + focusedOverlays.Remove(focusedOverlayContainer); + overlayContainer.Expire(); } From bec28c5b28219a9eccfedeed3818e97d41c291ea Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sat, 7 May 2022 22:16:11 +0100 Subject: [PATCH 0822/2328] Remove virtual `ColourInfo` properties from `DaySeparator` --- osu.Game/Online/Chat/StandAloneChatDisplay.cs | 3 +-- osu.Game/Overlays/Chat/DrawableChannel.cs | 18 +----------------- osu.Game/Overlays/ChatOverlayV2.cs | 10 ++-------- 3 files changed, 4 insertions(+), 27 deletions(-) diff --git a/osu.Game/Online/Chat/StandAloneChatDisplay.cs b/osu.Game/Online/Chat/StandAloneChatDisplay.cs index c03cd938a5..ac6bc190ca 100644 --- a/osu.Game/Online/Chat/StandAloneChatDisplay.cs +++ b/osu.Game/Online/Chat/StandAloneChatDisplay.cs @@ -174,9 +174,8 @@ namespace osu.Game.Online.Chat protected override DaySeparator CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) { TextSize = 14, - TextColour = daySepColour, + Colour = daySepColour, LineHeight = 1, - LineColour = daySepColour, Padding = new MarginPadding { Horizontal = 10 }, Margin = new MarginPadding { Vertical = 5 }, }; diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index 7e4e936bee..0dcb52c60a 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -9,7 +9,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; @@ -124,8 +123,7 @@ namespace osu.Game.Overlays.Chat protected virtual DaySeparator CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) { - TextColour = colours.ChatBlue.Lighten(0.7f), - LineColour = colours.ChatBlue.Lighten(0.7f), + Colour = colours.ChatBlue.Lighten(0.7f), Margin = new MarginPadding { Vertical = 10 }, }; @@ -214,12 +212,6 @@ namespace osu.Game.Overlays.Chat set => text.Font = text.Font.With(size: value); } - public ColourInfo TextColour - { - get => text.Colour; - set => text.Colour = value; - } - private float lineHeight = 2; public float LineHeight @@ -228,14 +220,6 @@ namespace osu.Game.Overlays.Chat set => lineHeight = leftBox.Height = rightBox.Height = value; } - private ColourInfo lineColour; - - public ColourInfo LineColour - { - get => lineColour; - set => lineColour = leftBox.Colour = rightBox.Colour = value; - } - private readonly SpriteText text; private readonly Box leftBox; private readonly Box rightBox; diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index e1ac71a125..18a2f593dd 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -315,26 +315,20 @@ namespace osu.Game.Overlays public class ChatOverlayDrawableChannel : DrawableChannel { - private Colour4 daySepTextColour; - private Colour4 daySepLineColour; - public ChatOverlayDrawableChannel(Channel channel) : base(channel) { } [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) + private void load() { ChatLineFlow.Padding = new MarginPadding(0); - daySepTextColour = colourProvider.Content1; - daySepLineColour = colourProvider.Background5; } protected override DaySeparator CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) { - TextColour = daySepTextColour, - LineColour = daySepLineColour, + Colour = Colour4.White, Margin = new MarginPadding { Vertical = 10 }, Padding = new MarginPadding { Horizontal = 15 }, }; From f4acfbd0df4380f1ddf9800abae74135027119cf Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sat, 7 May 2022 22:23:46 +0100 Subject: [PATCH 0823/2328] Change return type of `CreateDaySeparator` to `Drawable` --- osu.Game/Online/Chat/StandAloneChatDisplay.cs | 2 +- osu.Game/Overlays/Chat/DrawableChannel.cs | 2 +- osu.Game/Overlays/ChatOverlayV2.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/Chat/StandAloneChatDisplay.cs b/osu.Game/Online/Chat/StandAloneChatDisplay.cs index ac6bc190ca..79c4ed6068 100644 --- a/osu.Game/Online/Chat/StandAloneChatDisplay.cs +++ b/osu.Game/Online/Chat/StandAloneChatDisplay.cs @@ -171,7 +171,7 @@ namespace osu.Game.Online.Chat protected override ChatLine CreateChatLine(Message m) => CreateChatLineAction(m); - protected override DaySeparator CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) + protected override Drawable CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) { TextSize = 14, Colour = daySepColour, diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index 0dcb52c60a..f2d4a3e301 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -121,7 +121,7 @@ namespace osu.Game.Overlays.Chat protected virtual ChatLine CreateChatLine(Message m) => new ChatLine(m); - protected virtual DaySeparator CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) + protected virtual Drawable CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) { Colour = colours.ChatBlue.Lighten(0.7f), Margin = new MarginPadding { Vertical = 10 }, diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 18a2f593dd..1f2fb9724b 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -326,7 +326,7 @@ namespace osu.Game.Overlays ChatLineFlow.Padding = new MarginPadding(0); } - protected override DaySeparator CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) + protected override Drawable CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) { Colour = Colour4.White, Margin = new MarginPadding { Vertical = 10 }, From c0643cae751fa27e49b5929b2e3ffba0737604b9 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sat, 7 May 2022 23:24:34 +0100 Subject: [PATCH 0824/2328] Create `ChatOverlayDaySeparator` and use in `ChatOverlayDrawableChannel` --- osu.Game/Overlays/ChatOverlayV2.cs | 59 +++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 1f2fb9724b..b0f81c217a 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -17,7 +17,9 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Configuration; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; using osu.Game.Online.Chat; @@ -326,11 +328,58 @@ namespace osu.Game.Overlays ChatLineFlow.Padding = new MarginPadding(0); } - protected override Drawable CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) + protected override Drawable CreateDaySeparator(DateTimeOffset time) => new ChatOverlayDaySeparator(time); + + private class ChatOverlayDaySeparator : Container { - Colour = Colour4.White, - Margin = new MarginPadding { Vertical = 10 }, - Padding = new MarginPadding { Horizontal = 15 }, - }; + private readonly DateTimeOffset time; + + public ChatOverlayDaySeparator(DateTimeOffset time) + { + this.time = time; + } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Padding = new MarginPadding(15); + Child = new GridContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, 215), + new Dimension(GridSizeMode.AutoSize), + new Dimension(), + }, + Content = new[] + { + new Drawable[] + { + Drawable.Empty(), + new OsuSpriteText + { + Text = time.ToLocalTime().ToString("dd MMMM yyyy").ToUpper(), + Font = OsuFont.Torus.With(size: 15, weight: FontWeight.SemiBold), + Colour = colourProvider.Content1, + Margin = new MarginPadding { Right = 10 }, + }, + new Box + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Colour = colourProvider.Background5, + RelativeSizeAxes = Axes.X, + Height = 2, + }, + }, + }, + }; + } + } } } From 8da7bbd32271d782d2b65d7f84878a2b46c9552a Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sat, 7 May 2022 23:30:46 +0100 Subject: [PATCH 0825/2328] Code quality --- osu.Game/Overlays/ChatOverlayV2.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index b0f81c217a..0702b3ad97 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -358,7 +358,7 @@ namespace osu.Game.Overlays }, Content = new[] { - new Drawable[] + new[] { Drawable.Empty(), new OsuSpriteText From 230c4e27b8baee58b553d651d289a5f199f3c962 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 8 May 2022 12:56:07 +0900 Subject: [PATCH 0826/2328] Simplify and centralise hiding logic for mod overlay Behaviourally, this also always toggles via button triggering to add the button flash animation. --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 40 ++++++++++++++--------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 0a1b4e857e..5ec667bd90 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -393,30 +393,38 @@ namespace osu.Game.Overlays.Mods if (e.Repeat) return false; - // This is handled locally here because this overlay is being registered at the game level - // and therefore takes away keyboard focus from the screen stack. - if (e.Action == GlobalAction.Back) - { - if (customisationVisible.Value) - customisationVisible.Value = false; - else - backButton.TriggerClick(); - return true; - } - switch (e.Action) { + case GlobalAction.Back: + // Pressing the back binding should only go back one step at a time. + hideOverlay(false); + return true; + + // This is handled locally here because this overlay is being registered at the game level + // and therefore takes away keyboard focus from the screen stack. case GlobalAction.ToggleModSelection: case GlobalAction.Select: { - if (customisationVisible.Value) - customisationVisible.Value = false; - Hide(); + // Pressing toggle or select should completely hide the overlay in one shot. + hideOverlay(true); return true; } + } - default: - return base.OnPressed(e); + return base.OnPressed(e); + + void hideOverlay(bool immediate) + { + if (customisationVisible.Value) + { + Debug.Assert(customisationButton != null); + customisationButton.TriggerClick(); + + if (!immediate) + return; + } + + backButton.TriggerClick(); } } From 3eeedd802478279e91d72caf4971a027427cd4b9 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Sun, 8 May 2022 13:45:21 +0900 Subject: [PATCH 0827/2328] Fix per-hit object slider velocity ignored in osu!catch --- osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs index 7ddbc2f768..b91a74c4a1 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs @@ -183,15 +183,15 @@ namespace osu.Game.Beatmaps.Formats SampleControlPoint lastRelevantSamplePoint = null; DifficultyControlPoint lastRelevantDifficultyPoint = null; - bool isOsuRuleset = onlineRulesetID == 0; + // In osu!taiko and osu!mania, a scroll speed is stored as "slider velocity" in legacy formats. + // In that case, a scrolling speed change is a global effect and per-hit object difficulty control points are ignored. + bool scrollSpeedEncodedAsSliderVelocity = onlineRulesetID == 1 || onlineRulesetID == 3; // iterate over hitobjects and pull out all required sample and difficulty changes extractDifficultyControlPoints(beatmap.HitObjects); extractSampleControlPoints(beatmap.HitObjects); - // handle scroll speed, which is stored as "slider velocity" in legacy formats. - // this is relevant for scrolling ruleset beatmaps. - if (!isOsuRuleset) + if (scrollSpeedEncodedAsSliderVelocity) { foreach (var point in legacyControlPoints.EffectPoints) legacyControlPoints.Add(point.Time, new DifficultyControlPoint { SliderVelocity = point.ScrollSpeed }); @@ -242,7 +242,7 @@ namespace osu.Game.Beatmaps.Formats IEnumerable collectDifficultyControlPoints(IEnumerable hitObjects) { - if (!isOsuRuleset) + if (scrollSpeedEncodedAsSliderVelocity) yield break; foreach (var hitObject in hitObjects) From 125628dd20076054c6e5a8ab040d08b729558d6c Mon Sep 17 00:00:00 2001 From: ekrctb Date: Sun, 8 May 2022 15:52:14 +0900 Subject: [PATCH 0828/2328] Fix hit object not shown in timline while placement is waiting --- .../Edit/Blueprints/BananaShowerPlacementBlueprint.cs | 2 ++ .../Edit/Blueprints/JuiceStreamPlacementBlueprint.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs index 6dea8b0712..4613bfd36e 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs @@ -23,6 +23,8 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints base.Update(); outline.UpdateFrom(HitObjectContainer, HitObject); + + BeginPlacement(); } protected override bool OnMouseDown(MouseDownEvent e) diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamPlacementBlueprint.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamPlacementBlueprint.cs index cff5bc2417..e9c8e2bb2c 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamPlacementBlueprint.cs @@ -47,6 +47,8 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints base.LoadComplete(); inputManager = GetContainingInputManager(); + + BeginPlacement(); } protected override bool OnMouseDown(MouseDownEvent e) From 9ae019eb3945acb74eecebf58aa7baeeaa2a3e00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 16:17:23 +0200 Subject: [PATCH 0829/2328] Move `ISamplePlaybackDisabler` to more general namespace --- .../Visual/Gameplay/TestSceneGameplaySamplePlayback.cs | 1 + osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs | 1 - osu.Game/{Screens/Play => Audio}/ISamplePlaybackDisabler.cs | 4 ++-- osu.Game/Screens/Edit/Editor.cs | 1 + osu.Game/Screens/Play/Player.cs | 1 + osu.Game/Skinning/PausableSkinnableSound.cs | 1 - 6 files changed, 5 insertions(+), 4 deletions(-) rename osu.Game/{Screens/Play => Audio}/ISamplePlaybackDisabler.cs (85%) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs index ae2bc60fc6..815cc09448 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Testing; +using osu.Game.Audio; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Objects.Drawables; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs index 64afe1235b..3953ef8b33 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs @@ -15,7 +15,6 @@ using osu.Framework.Graphics.OpenGL.Textures; using osu.Framework.Graphics.Textures; using osu.Framework.Testing; using osu.Game.Audio; -using osu.Game.Screens.Play; using osu.Game.Skinning; namespace osu.Game.Tests.Visual.Gameplay diff --git a/osu.Game/Screens/Play/ISamplePlaybackDisabler.cs b/osu.Game/Audio/ISamplePlaybackDisabler.cs similarity index 85% rename from osu.Game/Screens/Play/ISamplePlaybackDisabler.cs rename to osu.Game/Audio/ISamplePlaybackDisabler.cs index 6b37021fe6..65d36e9171 100644 --- a/osu.Game/Screens/Play/ISamplePlaybackDisabler.cs +++ b/osu.Game/Audio/ISamplePlaybackDisabler.cs @@ -4,11 +4,11 @@ using osu.Framework.Bindables; using osu.Game.Skinning; -namespace osu.Game.Screens.Play +namespace osu.Game.Audio { /// /// Allows a component to disable sample playback dynamically as required. - /// Handled by . + /// Automatically handled by . /// public interface ISamplePlaybackDisabler { diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 3fde033587..143d975104 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -19,6 +19,7 @@ using osu.Framework.Input.Events; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Framework.Screens; +using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Database; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index ae3eb1ed8b..2f37b578f2 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -16,6 +16,7 @@ using osu.Framework.Input.Events; using osu.Framework.Logging; using osu.Framework.Screens; using osu.Framework.Threading; +using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Skinning/PausableSkinnableSound.cs b/osu.Game/Skinning/PausableSkinnableSound.cs index 10b8c47028..b34351d4e7 100644 --- a/osu.Game/Skinning/PausableSkinnableSound.cs +++ b/osu.Game/Skinning/PausableSkinnableSound.cs @@ -8,7 +8,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Threading; using osu.Game.Audio; -using osu.Game.Screens.Play; namespace osu.Game.Skinning { From cbd1169495a283d4d439cfc16edd856b23304f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 16:23:30 +0200 Subject: [PATCH 0830/2328] Move cache declarations of `ISamplePlaybackDisabler` to interface --- osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs | 1 - osu.Game/Audio/ISamplePlaybackDisabler.cs | 2 ++ osu.Game/Screens/Edit/Editor.cs | 1 - osu.Game/Screens/Play/Player.cs | 1 - 4 files changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs index 3953ef8b33..31abcb6748 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs @@ -130,7 +130,6 @@ namespace osu.Game.Tests.Visual.Gameplay } [Cached(typeof(ISkinSource))] - [Cached(typeof(ISamplePlaybackDisabler))] private class TestSkinSourceContainer : Container, ISkinSource, ISamplePlaybackDisabler { [Resolved] diff --git a/osu.Game/Audio/ISamplePlaybackDisabler.cs b/osu.Game/Audio/ISamplePlaybackDisabler.cs index 65d36e9171..2f49e94f34 100644 --- a/osu.Game/Audio/ISamplePlaybackDisabler.cs +++ b/osu.Game/Audio/ISamplePlaybackDisabler.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Skinning; @@ -10,6 +11,7 @@ namespace osu.Game.Audio /// Allows a component to disable sample playback dynamically as required. /// Automatically handled by . /// + [Cached] public interface ISamplePlaybackDisabler { /// diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 143d975104..947c184009 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -51,7 +51,6 @@ using osuTK.Input; namespace osu.Game.Screens.Edit { [Cached(typeof(IBeatSnapProvider))] - [Cached(typeof(ISamplePlaybackDisabler))] [Cached] public class Editor : ScreenWithBeatmapBackground, IKeyBindingHandler, IKeyBindingHandler, IBeatSnapProvider, ISamplePlaybackDisabler { diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2f37b578f2..51c1e6b43b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -38,7 +38,6 @@ using osuTK.Graphics; namespace osu.Game.Screens.Play { [Cached] - [Cached(typeof(ISamplePlaybackDisabler))] public abstract class Player : ScreenWithBeatmapBackground, ISamplePlaybackDisabler, ILocalUserPlayInfo { /// From 81ca534f878879af0cbb3384fb26fb8084aaeae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 16:28:28 +0200 Subject: [PATCH 0831/2328] Implement `ISamplePlaybackDisabler` in mod select --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 5ec667bd90..4e87b5955a 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -15,6 +15,7 @@ using osu.Framework.Input.Events; using osu.Framework.Layout; using osu.Framework.Lists; using osu.Framework.Utils; +using osu.Game.Audio; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -27,7 +28,7 @@ using osuTK.Input; namespace osu.Game.Overlays.Mods { - public abstract class ModSelectScreen : ShearedOverlayContainer + public abstract class ModSelectScreen : ShearedOverlayContainer, ISamplePlaybackDisabler { protected const int BUTTON_WIDTH = 200; @@ -188,6 +189,8 @@ namespace osu.Game.Overlays.Mods { base.LoadComplete(); + State.BindValueChanged(_ => samplePlaybackDisabled.Value = State.Value == Visibility.Hidden, true); + ((IBindable>)modSettingsArea.SelectedMods).BindTo(SelectedMods); SelectedMods.BindValueChanged(val => @@ -430,6 +433,13 @@ namespace osu.Game.Overlays.Mods #endregion + #region Sample playback control + + private readonly Bindable samplePlaybackDisabled = new BindableBool(true); + IBindable ISamplePlaybackDisabler.SamplePlaybackDisabled => samplePlaybackDisabled; + + #endregion + /// /// Manages horizontal scrolling of mod columns, along with the "active" states of each column based on visibility. /// From b92d95a17acb60a0ba671add4a80fc74eda4957f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 7 May 2022 16:35:34 +0200 Subject: [PATCH 0832/2328] Fix mod panels playing samples when hidden at a higher level --- osu.Game/Audio/ISamplePlaybackDisabler.cs | 1 + osu.Game/Overlays/Mods/ModPanel.cs | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/osu.Game/Audio/ISamplePlaybackDisabler.cs b/osu.Game/Audio/ISamplePlaybackDisabler.cs index 2f49e94f34..4167316780 100644 --- a/osu.Game/Audio/ISamplePlaybackDisabler.cs +++ b/osu.Game/Audio/ISamplePlaybackDisabler.cs @@ -10,6 +10,7 @@ namespace osu.Game.Audio /// /// Allows a component to disable sample playback dynamically as required. /// Automatically handled by . + /// May also be manually handled locally to particular components. /// [Cached] public interface ISamplePlaybackDisabler diff --git a/osu.Game/Overlays/Mods/ModPanel.cs b/osu.Game/Overlays/Mods/ModPanel.cs index f2a97da3b2..4c4951307d 100644 --- a/osu.Game/Overlays/Mods/ModPanel.cs +++ b/osu.Game/Overlays/Mods/ModPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -12,6 +14,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Framework.Utils; +using osu.Game.Audio; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -21,8 +24,6 @@ using osu.Game.Rulesets.UI; using osuTK; using osuTK.Input; -#nullable enable - namespace osu.Game.Overlays.Mods { public class ModPanel : OsuClickableContainer @@ -50,6 +51,7 @@ namespace osu.Game.Overlays.Mods private Colour4 activeColour; + private readonly Bindable samplePlaybackDisabled = new BindableBool(); private Sample? sampleOff; private Sample? sampleOn; @@ -139,13 +141,16 @@ namespace osu.Game.Overlays.Mods Action = Active.Toggle; } - [BackgroundDependencyLoader] - private void load(AudioManager audio, OsuColour colours) + [BackgroundDependencyLoader(true)] + private void load(AudioManager audio, OsuColour colours, ISamplePlaybackDisabler? samplePlaybackDisabler) { sampleOn = audio.Samples.Get(@"UI/check-on"); sampleOff = audio.Samples.Get(@"UI/check-off"); activeColour = colours.ForModType(Mod.Type); + + if (samplePlaybackDisabler != null) + ((IBindable)samplePlaybackDisabled).BindTo(samplePlaybackDisabler.SamplePlaybackDisabled); } protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds(sampleSet); @@ -166,6 +171,9 @@ namespace osu.Game.Overlays.Mods private void playStateChangeSamples() { + if (samplePlaybackDisabled.Value) + return; + if (Active.Value) sampleOn?.Play(); else From 778497b9e27c0bce96d5580d71d9bb915c997b00 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 8 May 2022 17:00:20 +0900 Subject: [PATCH 0833/2328] Scroll mod select slightly into view on first display --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 4e87b5955a..959d9ad2fc 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -208,6 +208,14 @@ namespace osu.Game.Overlays.Mods customisationVisible.BindValueChanged(_ => updateCustomisationVisualState(), true); updateAvailableMods(); + + // Start scrolled slightly to the right to give the user a sense that + // there is more horizontal content available. + ScheduleAfterChildren(() => + { + columnScroll.ScrollTo(100, false); + columnScroll.ScrollToStart(); + }); } /// From b8cb2c1b82570100a6c60388f65d7fa2e240c7fe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 8 May 2022 19:57:03 +0900 Subject: [PATCH 0834/2328] Increase scroll amount slightly --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 959d9ad2fc..fc06af3f9d 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -213,7 +213,7 @@ namespace osu.Game.Overlays.Mods // there is more horizontal content available. ScheduleAfterChildren(() => { - columnScroll.ScrollTo(100, false); + columnScroll.ScrollTo(200, false); columnScroll.ScrollToStart(); }); } From dcf0d5a9d5b93045385c8f4b9f5fe16844294bb3 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Sun, 8 May 2022 21:49:42 +0900 Subject: [PATCH 0835/2328] Fix slider velocity wrongly decoded as scrolling speed in osu!catch --- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 79d8bd3bb3..3a893a1238 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -431,9 +431,10 @@ namespace osu.Game.Beatmaps.Formats OmitFirstBarLine = omitFirstBarSignature, }; - bool isOsuRuleset = beatmap.BeatmapInfo.Ruleset.OnlineID == 0; - // scrolling rulesets use effect points rather than difficulty points for scroll speed adjustments. - if (!isOsuRuleset) + int onlineRulesetID = beatmap.BeatmapInfo.Ruleset.OnlineID; + + // osu!taiko and osu!mania use effect points rather than difficulty points for scroll speed adjustments. + if (onlineRulesetID == 1 || onlineRulesetID == 3) effectPoint.ScrollSpeed = speedMultiplier; addControlPoint(time, effectPoint, timingChange); From 92ccec20d787d08e19d81437ab7c89e148175abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 8 May 2022 14:44:54 +0200 Subject: [PATCH 0836/2328] Hide mod columns if all mods within are filtered out --- osu.Game/Overlays/Mods/ModColumn.cs | 13 +++++++ osu.Game/Overlays/Mods/ModSelectScreen.cs | 45 +++++++++++++++++------ 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index f0741cdc40..89f472a290 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -55,8 +55,18 @@ namespace osu.Game.Overlays.Mods } } + /// + /// Determines whether this column should accept user input. + /// public Bindable Active = new BindableBool(true); + private readonly Bindable allFiltered = new BindableBool(); + + /// + /// True if all of the panels in this column have been filtered out by the current . + /// + public IBindable AllFiltered => allFiltered; + /// /// List of mods marked as selected in this column. /// @@ -339,6 +349,9 @@ namespace osu.Game.Overlays.Mods panel.ApplyFilter(Filter); } + allFiltered.Value = panelFlow.All(panel => panel.Filtered.Value); + Alpha = allFiltered.Value ? 0 : 1; + if (toggleAllCheckbox != null && !SelectionAnimationRunning) { toggleAllCheckbox.Alpha = panelFlow.Any(panel => !panel.Filtered.Value) ? 1 : 0; diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index fc06af3f9d..6a3df3fb05 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -237,11 +237,11 @@ namespace osu.Game.Overlays.Mods } private ColumnDimContainer createModColumnContent(ModType modType, Key[]? toggleKeys = null) - => new ColumnDimContainer(CreateModColumn(modType, toggleKeys)) + => new ColumnDimContainer(CreateModColumn(modType, toggleKeys).With(column => column.Filter = IsValidMod)) { AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, - RequestScroll = column => columnScroll.ScrollIntoView(column, extraScroll: 140) + RequestScroll = column => columnScroll.ScrollIntoView(column, extraScroll: 140), }; private ShearedButton[] createDefaultFooterButtons() @@ -351,6 +351,8 @@ namespace osu.Game.Overlays.Mods #region Transition handling + private const float distance = 700; + protected override void PopIn() { const double fade_in_duration = 400; @@ -362,13 +364,26 @@ namespace osu.Game.Overlays.Mods .FadeIn(fade_in_duration / 2, Easing.OutQuint) .ScaleTo(1, fade_in_duration, Easing.OutElastic); + int nonFilteredColumnCount = 0; + for (int i = 0; i < columnFlow.Count; i++) { - columnFlow[i].Column - .TopLevelContent - .Delay(i * 30) - .MoveToY(0, fade_in_duration, Easing.OutQuint) - .FadeIn(fade_in_duration, Easing.OutQuint); + var column = columnFlow[i].Column; + + double delay = column.AllFiltered.Value ? 0 : nonFilteredColumnCount * 30; + double duration = column.AllFiltered.Value ? 0 : fade_in_duration; + float startingYPosition = 0; + if (!column.AllFiltered.Value) + startingYPosition = nonFilteredColumnCount % 2 == 0 ? -distance : distance; + + column.TopLevelContent + .MoveToY(startingYPosition) + .Delay(delay) + .MoveToY(0, duration, Easing.OutQuint) + .FadeIn(duration, Easing.OutQuint); + + if (!column.AllFiltered.Value) + nonFilteredColumnCount += 1; } } @@ -382,16 +397,24 @@ namespace osu.Game.Overlays.Mods .FadeOut(fade_out_duration / 2, Easing.OutQuint) .ScaleTo(0.75f, fade_out_duration, Easing.OutQuint); + int nonFilteredColumnCount = 0; + for (int i = 0; i < columnFlow.Count; i++) { - const float distance = 700; - var column = columnFlow[i].Column; + double duration = column.AllFiltered.Value ? 0 : fade_out_duration; + float newYPosition = 0; + if (!column.AllFiltered.Value) + newYPosition = nonFilteredColumnCount % 2 == 0 ? -distance : distance; + column.FlushPendingSelections(); column.TopLevelContent - .MoveToY(i % 2 == 0 ? -distance : distance, fade_out_duration, Easing.OutQuint) - .FadeOut(fade_out_duration, Easing.OutQuint); + .MoveToY(newYPosition, duration, Easing.OutQuint) + .FadeOut(duration, Easing.OutQuint); + + if (!column.AllFiltered.Value) + nonFilteredColumnCount += 1; } } From 38c004d734be28cdc973bbd8eb9f4ca19e5b55db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 8 May 2022 14:45:01 +0200 Subject: [PATCH 0837/2328] Add test coverage for hiding mod columns --- .../UserInterface/TestSceneModSelectScreen.cs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index 42ffeba444..fa7758df59 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -451,6 +451,36 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("mod select hidden", () => modSelectScreen.State.Value == Visibility.Hidden); } + [Test] + public void TestColumnHiding() + { + AddStep("create screen", () => Child = modSelectScreen = new UserModSelectScreen + { + RelativeSizeAxes = Axes.Both, + State = { Value = Visibility.Visible }, + SelectedMods = { BindTarget = SelectedMods }, + IsValidMod = mod => mod.Type == ModType.DifficultyIncrease || mod.Type == ModType.Conversion + }); + waitForColumnLoad(); + changeRuleset(0); + + AddAssert("two columns visible", () => this.ChildrenOfType().Count(col => col.IsPresent) == 2); + + AddStep("unset filter", () => modSelectScreen.IsValidMod = _ => true); + AddAssert("all columns visible", () => this.ChildrenOfType().All(col => col.IsPresent)); + + AddStep("filter out everything", () => modSelectScreen.IsValidMod = _ => false); + AddAssert("no columns visible", () => this.ChildrenOfType().All(col => !col.IsPresent)); + + AddStep("hide", () => modSelectScreen.Hide()); + AddStep("set filter for 3 columns", () => modSelectScreen.IsValidMod = mod => mod.Type == ModType.DifficultyReduction + || mod.Type == ModType.Automation + || mod.Type == ModType.Conversion); + + AddStep("show", () => modSelectScreen.Show()); + AddUntilStep("3 columns visible", () => this.ChildrenOfType().Count(col => col.IsPresent) == 3); + } + private void waitForColumnLoad() => AddUntilStep("all column content loaded", () => modSelectScreen.ChildrenOfType().Any() && modSelectScreen.ChildrenOfType().All(column => column.IsLoaded && column.ItemsLoaded)); From 077c77d52459c92b3b4e4f1beb9f634a0585eada Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 8 May 2022 16:00:07 +0300 Subject: [PATCH 0838/2328] Add method for scaling results screen in tests --- .../Multiplayer/TestSceneMultiplayerTeamResults.cs | 12 ++++++++++++ .../Visual/Ranking/TestSceneResultsScreen.cs | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs index bcb36a585f..0237298fa1 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs @@ -8,11 +8,23 @@ using osu.Game.Online.Rooms; using osu.Game.Rulesets.Osu; using osu.Game.Screens.OnlinePlay.Multiplayer; using osu.Game.Tests.Resources; +using osuTK; namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneMultiplayerTeamResults : ScreenTestScene { + [Test] + public void TestScaling() + { + // scheduling is needed as scaling the content immediately causes the entire scene to shake badly, for some odd reason. + AddSliderStep("scale", 0.5f, 1.6f, 1f, v => Schedule(() => + { + Stack.Scale = new Vector2(v); + Stack.Size = new Vector2(1f / v); + })); + } + [TestCase(7483253, 1048576)] [TestCase(1048576, 7483253)] [TestCase(1048576, 1048576)] diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs b/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs index 4eed2a25f5..a1d51683e4 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs @@ -56,6 +56,17 @@ namespace osu.Game.Tests.Visual.Ranking }); } + [Test] + public void TestScaling() + { + // scheduling is needed as scaling the content immediately causes the entire scene to shake badly, for some odd reason. + AddSliderStep("scale", 0.5f, 1.6f, 1f, v => Schedule(() => + { + Content.Scale = new Vector2(v); + Content.Size = new Vector2(1f / v); + })); + } + [Test] public void TestResultsWithoutPlayer() { From 298c2a1828bf628d59a5bd7ec1b671e925732ec9 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 8 May 2022 16:03:57 +0300 Subject: [PATCH 0839/2328] Replace vertical scrolling in results screen with size-preserving container --- .../MultiplayerTeamResultsScreen.cs | 6 ++--- osu.Game/Screens/Ranking/ResultsScreen.cs | 26 ++----------------- 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs index 3f0f3e043c..117415ac8f 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs @@ -46,9 +46,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer { const float winner_background_half_height = 250; - VerticalScrollContent.Anchor = VerticalScrollContent.Origin = Anchor.TopCentre; - VerticalScrollContent.Scale = new Vector2(0.9f); - VerticalScrollContent.Y = 75; + Content.Anchor = Content.Origin = Anchor.TopCentre; + Content.Scale = new Vector2(0.9f); + Content.Y = 75; var redScore = teamScores.First().Value; var blueScore = teamScores.Last().Value; diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index 98514cd846..2c91b17917 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -14,7 +14,6 @@ using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Framework.Screens; using osu.Game.Graphics; -using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; using osu.Game.Online.API; @@ -41,7 +40,7 @@ namespace osu.Game.Screens.Ranking protected ScorePanelList ScorePanelList { get; private set; } - protected VerticalScrollContainer VerticalScrollContent { get; private set; } + protected Container Content { get; private set; } [Resolved(CanBeNull = true)] private Player player { get; set; } @@ -79,10 +78,9 @@ namespace osu.Game.Screens.Ranking { new Drawable[] { - VerticalScrollContent = new VerticalScrollContainer + Content = new DrawSizePreservingFillContainer { RelativeSizeAxes = Axes.Both, - ScrollbarVisible = false, Child = new Container { RelativeSizeAxes = Axes.Both, @@ -346,25 +344,5 @@ namespace osu.Game.Screens.Ranking public void OnReleased(KeyBindingReleaseEvent e) { } - - protected class VerticalScrollContainer : OsuScrollContainer - { - protected override Container Content => content; - - private readonly Container content; - - public VerticalScrollContainer() - { - Masking = false; - - base.Content.Add(content = new Container { RelativeSizeAxes = Axes.X }); - } - - protected override void Update() - { - base.Update(); - content.Height = Math.Max(screen_height, DrawHeight); - } - } } } From 7f1ad149d5775606497144af30d94e801222e8a7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 8 May 2022 16:04:24 +0300 Subject: [PATCH 0840/2328] Remove no longer necessary horizontal scroll blocker --- osu.Game/Screens/Ranking/ScorePanelList.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/osu.Game/Screens/Ranking/ScorePanelList.cs b/osu.Game/Screens/Ranking/ScorePanelList.cs index c2ef5529e8..a5341242e2 100644 --- a/osu.Game/Screens/Ranking/ScorePanelList.cs +++ b/osu.Game/Screens/Ranking/ScorePanelList.cs @@ -85,7 +85,6 @@ namespace osu.Game.Screens.Ranking InternalChild = scroll = new Scroll { RelativeSizeAxes = Axes.Both, - HandleScroll = () => expandedPanel?.IsHovered != true, // handle horizontal scroll only when not hovering the expanded panel. Child = flow = new Flow { Anchor = Anchor.Centre, @@ -359,11 +358,6 @@ namespace osu.Game.Screens.Ranking /// public float? InstantScrollTarget; - /// - /// Whether this container should handle scroll trigger events. - /// - public Func HandleScroll; - protected override void UpdateAfterChildren() { if (InstantScrollTarget != null) @@ -374,10 +368,6 @@ namespace osu.Game.Screens.Ranking base.UpdateAfterChildren(); } - - public override bool HandlePositionalInput => HandleScroll(); - - public override bool HandleNonPositionalInput => HandleScroll(); } } } From 6f4cdccf6c5430991c8e4c87a6ad60698faff4ce Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 8 May 2022 16:20:26 +0300 Subject: [PATCH 0841/2328] Remove no longer required constant --- osu.Game/Screens/Ranking/ResultsScreen.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index 2c91b17917..87e49fcc5e 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -27,7 +27,6 @@ namespace osu.Game.Screens.Ranking public abstract class ResultsScreen : ScreenWithBeatmapBackground, IKeyBindingHandler { protected const float BACKGROUND_BLUR = 20; - private static readonly float screen_height = 768 - TwoLayerButton.SIZE_EXTENDED.Y; public override bool DisallowExternalBeatmapRulesetChanges => true; From 4e0155fa4bac0dd8a8316f4cf1e80b610a465e17 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Sun, 8 May 2022 18:32:01 +0900 Subject: [PATCH 0842/2328] Make `JuiceStreamPath` time based instead of distance based. And remove the "slope limit" feature. TODO: for a juice stream with a large slope, the slider velocity of the hit object should be changed. --- .../TestSceneJuiceStreamSelectionBlueprint.cs | 8 +- .../JuiceStreamPathTest.cs | 95 +++++------ .../Blueprints/Components/EditablePath.cs | 30 ++-- .../Components/PlacementEditablePath.cs | 10 +- .../Components/SelectionEditablePath.cs | 12 +- .../JuiceStreamPlacementBlueprint.cs | 6 +- .../JuiceStreamSelectionBlueprint.cs | 6 +- .../Objects/JuiceStreamPath.cs | 158 ++++++++---------- .../Objects/JuiceStreamPathVertex.cs | 10 +- 9 files changed, 157 insertions(+), 178 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamSelectionBlueprint.cs b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamSelectionBlueprint.cs index fb77fb1efd..123316f461 100644 --- a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamSelectionBlueprint.cs @@ -234,10 +234,10 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor { var path = new JuiceStreamPath(); for (int i = 1; i < times.Length; i++) - path.Add((times[i] - times[0]) * velocity, positions[i] - positions[0]); + path.Add(times[i] - times[0], positions[i] - positions[0]); var sliderPath = new SliderPath(); - path.ConvertToSliderPath(sliderPath, 0); + path.ConvertToSliderPath(sliderPath, 0, velocity); addBlueprintStep(times[0], positions[0], sliderPath, velocity); } @@ -245,11 +245,11 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor private void addVertexCheckStep(int count, int index, double time, float x) => AddAssert($"vertex {index} of {count} at {time}, {x}", () => { - double expectedDistance = (time - hitObject.StartTime) * hitObject.Velocity; + double expectedTime = time - hitObject.StartTime; float expectedX = x - hitObject.OriginalX; var vertices = getVertices(); return vertices.Count == count && - Precision.AlmostEquals(vertices[index].Distance, expectedDistance, 1e-3) && + Precision.AlmostEquals(vertices[index].Time, expectedTime, 1e-3) && Precision.AlmostEquals(vertices[index].X, expectedX); }); diff --git a/osu.Game.Rulesets.Catch.Tests/JuiceStreamPathTest.cs b/osu.Game.Rulesets.Catch.Tests/JuiceStreamPathTest.cs index 8fa96fb8c9..5248d5a96a 100644 --- a/osu.Game.Rulesets.Catch.Tests/JuiceStreamPathTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/JuiceStreamPathTest.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; -using osu.Framework.Utils; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; @@ -37,14 +36,14 @@ namespace osu.Game.Rulesets.Catch.Tests { case 0: { - double distance = rng.NextDouble() * scale * 2 - scale; + double time = rng.NextDouble() * scale * 2 - scale; if (integralValues) - distance = Math.Round(distance); + time = Math.Round(time); - float oldX = path.PositionAtDistance(distance); - int index = path.InsertVertex(distance); + float oldX = path.PositionAtTime(time); + int index = path.InsertVertex(time); Assert.That(path.Vertices.Count, Is.EqualTo(vertexCount + 1)); - Assert.That(path.Vertices[index].Distance, Is.EqualTo(distance)); + Assert.That(path.Vertices[index].Time, Is.EqualTo(time)); Assert.That(path.Vertices[index].X, Is.EqualTo(oldX)); break; } @@ -52,20 +51,20 @@ namespace osu.Game.Rulesets.Catch.Tests case 1: { int index = rng.Next(path.Vertices.Count); - double distance = path.Vertices[index].Distance; + double time = path.Vertices[index].Time; float newX = (float)(rng.NextDouble() * scale * 2 - scale); if (integralValues) newX = MathF.Round(newX); path.SetVertexPosition(index, newX); Assert.That(path.Vertices.Count, Is.EqualTo(vertexCount)); - Assert.That(path.Vertices[index].Distance, Is.EqualTo(distance)); + Assert.That(path.Vertices[index].Time, Is.EqualTo(time)); Assert.That(path.Vertices[index].X, Is.EqualTo(newX)); break; } } - assertInvariants(path.Vertices, checkSlope); + assertInvariants(path.Vertices); } } @@ -76,7 +75,7 @@ namespace osu.Game.Rulesets.Catch.Tests path.Add(10, 5); path.Add(20, -5); - int removeCount = path.RemoveVertices((v, i) => v.Distance == 10 && i == 1); + int removeCount = path.RemoveVertices((v, i) => v.Time == 10 && i == 1); Assert.That(removeCount, Is.EqualTo(1)); Assert.That(path.Vertices, Is.EqualTo(new[] { @@ -131,8 +130,9 @@ namespace osu.Game.Rulesets.Catch.Tests })); } - [Test] - public void TestRandomConvertFromSliderPath() + [TestCase(10)] + [TestCase(0.1)] + public void TestRandomConvertFromSliderPath(double velocity) { var rng = new Random(1); var path = new JuiceStreamPath(); @@ -162,28 +162,28 @@ namespace osu.Game.Rulesets.Catch.Tests else sliderPath.ExpectedDistance.Value = null; - path.ConvertFromSliderPath(sliderPath); - Assert.That(path.Vertices[0].Distance, Is.EqualTo(0)); - Assert.That(path.Distance, Is.EqualTo(sliderPath.Distance).Within(1e-3)); - assertInvariants(path.Vertices, true); + path.ConvertFromSliderPath(sliderPath, velocity); + Assert.That(path.Vertices[0].Time, Is.EqualTo(0)); + Assert.That(path.Duration * velocity, Is.EqualTo(sliderPath.Distance).Within(1e-3)); + assertInvariants(path.Vertices); - double[] sampleDistances = Enumerable.Range(0, 10) - .Select(_ => rng.NextDouble() * sliderPath.Distance) - .ToArray(); + double[] sampleTimes = Enumerable.Range(0, 10) + .Select(_ => rng.NextDouble() * sliderPath.Distance / velocity) + .ToArray(); - foreach (double distance in sampleDistances) + foreach (double time in sampleTimes) { - float expected = sliderPath.PositionAt(distance / sliderPath.Distance).X; - Assert.That(path.PositionAtDistance(distance), Is.EqualTo(expected).Within(1e-3)); + float expected = sliderPath.PositionAt(time * velocity / sliderPath.Distance).X; + Assert.That(path.PositionAtTime(time), Is.EqualTo(expected).Within(1e-3)); } - path.ResampleVertices(sampleDistances); - assertInvariants(path.Vertices, true); + path.ResampleVertices(sampleTimes); + assertInvariants(path.Vertices); - foreach (double distance in sampleDistances) + foreach (double time in sampleTimes) { - float expected = sliderPath.PositionAt(distance / sliderPath.Distance).X; - Assert.That(path.PositionAtDistance(distance), Is.EqualTo(expected).Within(1e-3)); + float expected = sliderPath.PositionAt(time * velocity / sliderPath.Distance).X; + Assert.That(path.PositionAtTime(time), Is.EqualTo(expected).Within(1e-3)); } } } @@ -201,17 +201,17 @@ namespace osu.Game.Rulesets.Catch.Tests do { - double distance = rng.NextDouble() * 1e3; + double time = rng.NextDouble() * 1e3; float x = (float)(rng.NextDouble() * 1e3); - path.Add(distance, x); + path.Add(time, x); } while (rng.Next(5) != 0); float sliderStartY = (float)(rng.NextDouble() * JuiceStreamPath.OSU_PLAYFIELD_HEIGHT); - path.ConvertToSliderPath(sliderPath, sliderStartY); - Assert.That(sliderPath.Distance, Is.EqualTo(path.Distance).Within(1e-3)); - Assert.That(sliderPath.ControlPoints[0].Position.X, Is.EqualTo(path.Vertices[0].X)); - assertInvariants(path.Vertices, true); + double requiredVelocity = path.ComputeRequiredVelocity(); + double velocity = Math.Clamp(requiredVelocity, 1, 100); + + path.ConvertToSliderPath(sliderPath, sliderStartY, velocity); foreach (var point in sliderPath.ControlPoints) { @@ -219,11 +219,18 @@ namespace osu.Game.Rulesets.Catch.Tests Assert.That(sliderStartY + point.Position.Y, Is.InRange(0, JuiceStreamPath.OSU_PLAYFIELD_HEIGHT)); } + Assert.That(sliderPath.ControlPoints[0].Position.X, Is.EqualTo(path.Vertices[0].X)); + + // The path is preserved only if required velocity is used. + if (velocity < requiredVelocity) continue; + + Assert.That(sliderPath.Distance / velocity, Is.EqualTo(path.Duration).Within(1e-3)); + for (int i = 0; i < 10; i++) { - double distance = rng.NextDouble() * path.Distance; - float expected = path.PositionAtDistance(distance); - Assert.That(sliderPath.PositionAt(distance / sliderPath.Distance).X, Is.EqualTo(expected).Within(1e-3)); + double time = rng.NextDouble() * path.Duration; + float expected = path.PositionAtTime(time); + Assert.That(sliderPath.PositionAt(time * velocity / sliderPath.Distance).X, Is.EqualTo(expected).Within(3e-3)); } } } @@ -244,7 +251,7 @@ namespace osu.Game.Rulesets.Catch.Tests path.Add(20, 0); checkNewId(); - path.RemoveVertices((v, _) => v.Distance == 20); + path.RemoveVertices((v, _) => v.Time == 20); checkNewId(); path.ResampleVertices(new double[] { 5, 10, 15 }); @@ -253,7 +260,7 @@ namespace osu.Game.Rulesets.Catch.Tests path.Clear(); checkNewId(); - path.ConvertFromSliderPath(new SliderPath()); + path.ConvertFromSliderPath(new SliderPath(), 1); checkNewId(); void checkNewId() @@ -263,25 +270,19 @@ namespace osu.Game.Rulesets.Catch.Tests } } - private void assertInvariants(IReadOnlyList vertices, bool checkSlope) + private void assertInvariants(IReadOnlyList vertices) { Assert.That(vertices, Is.Not.Empty); for (int i = 0; i < vertices.Count; i++) { - Assert.That(double.IsFinite(vertices[i].Distance)); + Assert.That(double.IsFinite(vertices[i].Time)); Assert.That(float.IsFinite(vertices[i].X)); } for (int i = 1; i < vertices.Count; i++) { - Assert.That(vertices[i].Distance, Is.GreaterThanOrEqualTo(vertices[i - 1].Distance)); - - if (!checkSlope) continue; - - float xDiff = Math.Abs(vertices[i].X - vertices[i - 1].X); - double distanceDiff = vertices[i].Distance - vertices[i - 1].Distance; - Assert.That(xDiff, Is.LessThanOrEqualTo(distanceDiff).Within(Precision.FLOAT_EPSILON)); + Assert.That(vertices[i].Time, Is.GreaterThanOrEqualTo(vertices[i - 1].Time)); } } } diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs index 1a43a10c81..3004d3644c 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components public int VertexCount => path.Vertices.Count; - protected readonly Func PositionToDistance; + protected readonly Func PositionToTime; protected IReadOnlyList VertexStates => vertexStates; @@ -44,9 +44,9 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components [CanBeNull] private IBeatSnapProvider beatSnapProvider { get; set; } - protected EditablePath(Func positionToDistance) + protected EditablePath(Func positionToTime) { - PositionToDistance = positionToDistance; + PositionToTime = positionToTime; Anchor = Anchor.BottomLeft; } @@ -59,13 +59,13 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components while (InternalChildren.Count < path.Vertices.Count) AddInternal(new VertexPiece()); - double distanceToYFactor = -hitObjectContainer.LengthAtTime(hitObject.StartTime, hitObject.StartTime + 1 / hitObject.Velocity); + double timeToYFactor = -hitObjectContainer.LengthAtTime(hitObject.StartTime, hitObject.StartTime + 1); for (int i = 0; i < VertexCount; i++) { var piece = (VertexPiece)InternalChildren[i]; var vertex = path.Vertices[i]; - piece.Position = new Vector2(vertex.X, (float)(vertex.Distance * distanceToYFactor)); + piece.Position = new Vector2(vertex.X, (float)(vertex.Time * timeToYFactor)); piece.UpdateFrom(vertexStates[i]); } } @@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components public void InitializeFromHitObject(JuiceStream hitObject) { var sliderPath = hitObject.Path; - path.ConvertFromSliderPath(sliderPath); + path.ConvertFromSliderPath(sliderPath, hitObject.Velocity); // If the original slider path has non-linear type segments, resample the vertices at nested hit object times to reduce the number of vertices. if (sliderPath.ControlPoints.Any(p => p.Type != null && p.Type != PathType.Linear)) @@ -92,11 +92,11 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components public void UpdateHitObjectFromPath(JuiceStream hitObject) { - path.ConvertToSliderPath(hitObject.Path, hitObject.LegacyConvertedY); + path.ConvertToSliderPath(hitObject.Path, hitObject.LegacyConvertedY, hitObject.Velocity); if (beatSnapProvider == null) return; - double endTime = hitObject.StartTime + path.Distance / hitObject.Velocity; + double endTime = hitObject.StartTime + path.Duration; double snappedEndTime = beatSnapProvider.SnapTime(endTime, hitObject.StartTime); hitObject.Path.ExpectedDistance.Value = (snappedEndTime - hitObject.StartTime) * hitObject.Velocity; } @@ -108,9 +108,9 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => false; - protected int AddVertex(double distance, float x) + protected int AddVertex(double time, float x) { - int index = path.InsertVertex(distance); + int index = path.InsertVertex(time); path.SetVertexPosition(index, x); vertexStates.Insert(index, new VertexState()); @@ -138,9 +138,9 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components return true; } - protected void MoveSelectedVertices(double distanceDelta, float xDelta) + protected void MoveSelectedVertices(double timeDelta, float xDelta) { - // Because the vertex list may be reordered due to distance change, the state list must be reordered as well. + // Because the vertex list may be reordered due to time change, the state list must be reordered as well. previousVertexStates.Clear(); previousVertexStates.AddRange(vertexStates); @@ -152,11 +152,11 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components for (int i = 1; i < vertexCount; i++) { var state = previousVertexStates[i]; - double distance = state.VertexBeforeChange.Distance; + double time = state.VertexBeforeChange.Time; if (state.IsSelected) - distance += distanceDelta; + time += timeDelta; - int newIndex = path.InsertVertex(Math.Max(0, distance)); + int newIndex = path.InsertVertex(Math.Max(0, time)); vertexStates.Insert(newIndex, state); } diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/PlacementEditablePath.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/PlacementEditablePath.cs index 158872fbab..511aec5e5d 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/PlacementEditablePath.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/PlacementEditablePath.cs @@ -15,15 +15,15 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components /// private JuiceStreamPathVertex lastVertex; - public PlacementEditablePath(Func positionToDistance) - : base(positionToDistance) + public PlacementEditablePath(Func positionToTime) + : base(positionToTime) { } public void AddNewVertex() { var endVertex = Vertices[^1]; - int index = AddVertex(endVertex.Distance, endVertex.X); + int index = AddVertex(endVertex.Time, endVertex.X); for (int i = 0; i < VertexCount; i++) { @@ -41,9 +41,9 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components public void MoveLastVertex(Vector2 screenSpacePosition) { Vector2 position = ToRelativePosition(screenSpacePosition); - double distanceDelta = PositionToDistance(position.Y) - lastVertex.Distance; + double timeDelta = PositionToTime(position.Y) - lastVertex.Time; float xDelta = position.X - lastVertex.X; - MoveSelectedVertices(distanceDelta, xDelta); + MoveSelectedVertices(timeDelta, xDelta); } } } diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/SelectionEditablePath.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/SelectionEditablePath.cs index 8c7314d0b6..b4c353313c 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/SelectionEditablePath.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/SelectionEditablePath.cs @@ -27,15 +27,15 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components [CanBeNull] private IEditorChangeHandler changeHandler { get; set; } - public SelectionEditablePath(Func positionToDistance) - : base(positionToDistance) + public SelectionEditablePath(Func positionToTime) + : base(positionToTime) { } public void AddVertex(Vector2 relativePosition) { - double distance = Math.Max(0, PositionToDistance(relativePosition.Y)); - int index = AddVertex(distance, relativePosition.X); + double time = Math.Max(0, PositionToTime(relativePosition.Y)); + int index = AddVertex(time, relativePosition.X); selectOnly(index); } @@ -83,9 +83,9 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components protected override void OnDrag(DragEvent e) { Vector2 mousePosition = ToRelativePosition(e.ScreenSpaceMousePosition); - double distanceDelta = PositionToDistance(mousePosition.Y) - PositionToDistance(dragStartPosition.Y); + double timeDelta = PositionToTime(mousePosition.Y) - PositionToTime(dragStartPosition.Y); float xDelta = mousePosition.X - dragStartPosition.X; - MoveSelectedVertices(distanceDelta, xDelta); + MoveSelectedVertices(timeDelta, xDelta); } protected override void OnDragEnd(DragEndEvent e) diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamPlacementBlueprint.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamPlacementBlueprint.cs index cff5bc2417..4a5a1d8160 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamPlacementBlueprint.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints { scrollingPath = new ScrollingPath(), nestedOutlineContainer = new NestedOutlineContainer(), - editablePath = new PlacementEditablePath(positionToDistance) + editablePath = new PlacementEditablePath(positionToTime) }; } @@ -119,10 +119,10 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints lastEditablePathId = editablePath.PathId; } - private double positionToDistance(float relativeYPosition) + private double positionToTime(float relativeYPosition) { double time = HitObjectContainer.TimeAtPosition(relativeYPosition, HitObject.StartTime); - return (time - HitObject.StartTime) * HitObject.Velocity; + return time - HitObject.StartTime; } } } diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamSelectionBlueprint.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamSelectionBlueprint.cs index 890d059d19..12054a1d16 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamSelectionBlueprint.cs @@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints { scrollingPath = new ScrollingPath(), nestedOutlineContainer = new NestedOutlineContainer(), - editablePath = new SelectionEditablePath(positionToDistance) + editablePath = new SelectionEditablePath(positionToTime) }; } @@ -145,10 +145,10 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints return new RectangleF(left, top, right - left, bottom - top).Inflate(objectRadius); } - private double positionToDistance(float relativeYPosition) + private double positionToTime(float relativeYPosition) { double time = HitObjectContainer.TimeAtPosition(relativeYPosition, HitObject.StartTime); - return (time - HitObject.StartTime) * HitObject.Velocity; + return time - HitObject.StartTime; } private void initializeJuiceStreamPath() diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStreamPath.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStreamPath.cs index 7207833fe6..d8cea3945c 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStreamPath.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStreamPath.cs @@ -20,11 +20,6 @@ namespace osu.Game.Rulesets.Catch.Objects /// However, the representation is difficult to work with. /// This represents the path in a more convenient way, a polyline connecting list of s. /// - /// - /// The path can be regarded as a function from the closed interval [Vertices[0].Distance, Vertices[^1].Distance] to the x position, given by . - /// To ensure the path is convertible to a , the slope of the function must not be more than 1 everywhere, - /// and this slope condition is always maintained as an invariant. - /// /// public class JuiceStreamPath { @@ -46,9 +41,9 @@ namespace osu.Game.Rulesets.Catch.Objects public int InvalidationID { get; private set; } = 1; /// - /// The difference between first vertex's and last vertex's . + /// The difference between first vertex's and last vertex's . /// - public double Distance => vertices[^1].Distance - vertices[0].Distance; + public double Duration => vertices[^1].Time - vertices[0].Time; /// /// This list should always be non-empty. @@ -59,15 +54,15 @@ namespace osu.Game.Rulesets.Catch.Objects }; /// - /// Compute the x-position of the path at the given . + /// Compute the x-position of the path at the given . /// /// - /// When the given distance is outside of the path, the x position at the corresponding endpoint is returned, + /// When the given time is outside of the path, the x position at the corresponding endpoint is returned, /// - public float PositionAtDistance(double distance) + public float PositionAtTime(double time) { - int index = vertexIndexAtDistance(distance); - return positionAtDistance(distance, index); + int index = vertexIndexAtTime(time); + return positionAtTime(time, index); } /// @@ -81,19 +76,19 @@ namespace osu.Game.Rulesets.Catch.Objects } /// - /// Insert a vertex at given . - /// The is used as the position of the new vertex. + /// Insert a vertex at given . + /// The is used as the position of the new vertex. /// Thus, the set of points of the path is not changed (up to floating-point precision). /// /// The index of the new vertex. - public int InsertVertex(double distance) + public int InsertVertex(double time) { - if (!double.IsFinite(distance)) - throw new ArgumentOutOfRangeException(nameof(distance)); + if (!double.IsFinite(time)) + throw new ArgumentOutOfRangeException(nameof(time)); - int index = vertexIndexAtDistance(distance); - float x = positionAtDistance(distance, index); - vertices.Insert(index, new JuiceStreamPathVertex(distance, x)); + int index = vertexIndexAtTime(time); + float x = positionAtTime(time, index); + vertices.Insert(index, new JuiceStreamPathVertex(time, x)); invalidate(); return index; @@ -101,7 +96,6 @@ namespace osu.Game.Rulesets.Catch.Objects /// /// Move the vertex of given to the given position . - /// When the distances between vertices are too small for the new vertex positions, the adjacent vertices are moved towards . /// public void SetVertexPosition(int index, float newX) { @@ -111,32 +105,17 @@ namespace osu.Game.Rulesets.Catch.Objects if (!float.IsFinite(newX)) throw new ArgumentOutOfRangeException(nameof(newX)); - var newVertex = new JuiceStreamPathVertex(vertices[index].Distance, newX); - - for (int i = index - 1; i >= 0 && !canConnect(vertices[i], newVertex); i--) - { - float clampedX = clampToConnectablePosition(newVertex, vertices[i]); - vertices[i] = new JuiceStreamPathVertex(vertices[i].Distance, clampedX); - } - - for (int i = index + 1; i < vertices.Count; i++) - { - float clampedX = clampToConnectablePosition(newVertex, vertices[i]); - vertices[i] = new JuiceStreamPathVertex(vertices[i].Distance, clampedX); - } - - vertices[index] = newVertex; + vertices[index] = new JuiceStreamPathVertex(vertices[index].Time, newX); invalidate(); } /// - /// Add a new vertex at given and position. - /// Adjacent vertices are moved when necessary in the same way as . + /// Add a new vertex at given and position. /// - public void Add(double distance, float x) + public void Add(double time, float x) { - int index = InsertVertex(distance); + int index = InsertVertex(time); SetVertexPosition(index, x); } @@ -163,22 +142,22 @@ namespace osu.Game.Rulesets.Catch.Objects } /// - /// Recreate this path by using difference set of vertices at given distances. - /// In addition to the given , the first vertex and the last vertex are always added to the new path. - /// New vertices use the positions on the original path. Thus, s at are preserved. + /// Recreate this path by using difference set of vertices at given time points. + /// In addition to the given , the first vertex and the last vertex are always added to the new path. + /// New vertices use the positions on the original path. Thus, s at are preserved. /// - public void ResampleVertices(IEnumerable sampleDistances) + public void ResampleVertices(IEnumerable sampleTimes) { var sampledVertices = new List(); - foreach (double distance in sampleDistances) + foreach (double time in sampleTimes) { - if (!double.IsFinite(distance)) - throw new ArgumentOutOfRangeException(nameof(sampleDistances)); + if (!double.IsFinite(time)) + throw new ArgumentOutOfRangeException(nameof(sampleTimes)); - double clampedDistance = Math.Clamp(distance, vertices[0].Distance, vertices[^1].Distance); - float x = PositionAtDistance(clampedDistance); - sampledVertices.Add(new JuiceStreamPathVertex(clampedDistance, x)); + double clampedTime = Math.Clamp(time, vertices[0].Time, vertices[^1].Time); + float x = PositionAtTime(clampedTime); + sampledVertices.Add(new JuiceStreamPathVertex(clampedTime, x)); } sampledVertices.Sort(); @@ -196,37 +175,57 @@ namespace osu.Game.Rulesets.Catch.Objects /// /// Duplicated vertices are automatically removed. /// - public void ConvertFromSliderPath(SliderPath sliderPath) + public void ConvertFromSliderPath(SliderPath sliderPath, double velocity) { var sliderPathVertices = new List(); sliderPath.GetPathToProgress(sliderPathVertices, 0, 1); - double distance = 0; + double time = 0; vertices.Clear(); vertices.Add(new JuiceStreamPathVertex(0, sliderPathVertices.FirstOrDefault().X)); for (int i = 1; i < sliderPathVertices.Count; i++) { - distance += Vector2.Distance(sliderPathVertices[i - 1], sliderPathVertices[i]); + time += Vector2.Distance(sliderPathVertices[i - 1], sliderPathVertices[i]) / velocity; - if (!Precision.AlmostEquals(vertices[^1].Distance, distance)) - vertices.Add(new JuiceStreamPathVertex(distance, sliderPathVertices[i].X)); + if (!Precision.AlmostEquals(vertices[^1].Time, time)) + Add(time, sliderPathVertices[i].X); } invalidate(); } + /// + /// Computes the minimum slider velocity required to convert this path to a . + /// + public double ComputeRequiredVelocity() + { + double maximumSlope = 0; + + for (int i = 1; i < vertices.Count; i++) + { + double xDifference = Math.Abs((double)vertices[i].X - vertices[i - 1].X); + double timeDifference = vertices[i].Time - vertices[i - 1].Time; + maximumSlope = Math.Max(maximumSlope, xDifference / timeDifference); + } + + return maximumSlope; + } + /// /// Convert the path of this to a and write the result to . /// The resulting slider is "folded" to make it vertically contained in the playfield `(0..)` assuming the slider start position is . + /// + /// The velocity of the converted slider is assumed to be . + /// To preserve the path, should be at least the value returned by . /// - public void ConvertToSliderPath(SliderPath sliderPath, float sliderStartY) + public void ConvertToSliderPath(SliderPath sliderPath, float sliderStartY, double velocity) { const float margin = 1; // Note: these two variables and `sliderPath` are modified by the local functions. - double currentDistance = 0; + double currentTime = 0; Vector2 lastPosition = new Vector2(vertices[0].X, 0); sliderPath.ControlPoints.Clear(); @@ -237,10 +236,10 @@ namespace osu.Game.Rulesets.Catch.Objects sliderPath.ControlPoints[^1].Type = PathType.Linear; float deltaX = vertices[i].X - lastPosition.X; - double length = vertices[i].Distance - currentDistance; + double length = (vertices[i].Time - currentTime) * velocity; // Should satisfy `deltaX^2 + deltaY^2 = length^2`. - // By invariants, the expression inside the `sqrt` is (almost) non-negative. + // The expression inside the `sqrt` is (almost) non-negative if the slider velocity is large enough. double deltaY = Math.Sqrt(Math.Max(0, length * length - (double)deltaX * deltaX)); // When `deltaY` is small, one segment is always enough. @@ -280,59 +279,38 @@ namespace osu.Game.Rulesets.Catch.Objects { Vector2 nextPosition = new Vector2(nextX, nextY); sliderPath.ControlPoints.Add(new PathControlPoint(nextPosition)); - currentDistance += Vector2.Distance(lastPosition, nextPosition); + currentTime += Vector2.Distance(lastPosition, nextPosition) / velocity; lastPosition = nextPosition; } } /// - /// Find the index at which a new vertex with can be inserted. + /// Find the index at which a new vertex with can be inserted. /// - private int vertexIndexAtDistance(double distance) + private int vertexIndexAtTime(double time) { - // The position of `(distance, Infinity)` is uniquely determined because infinite positions are not allowed. - int i = vertices.BinarySearch(new JuiceStreamPathVertex(distance, float.PositiveInfinity)); + // The position of `(time, Infinity)` is uniquely determined because infinite positions are not allowed. + int i = vertices.BinarySearch(new JuiceStreamPathVertex(time, float.PositiveInfinity)); return i < 0 ? ~i : i; } /// - /// Compute the position at the given , assuming is the vertex index returned by . + /// Compute the position at the given , assuming is the vertex index returned by . /// - private float positionAtDistance(double distance, int index) + private float positionAtTime(double time, int index) { if (index <= 0) return vertices[0].X; if (index >= vertices.Count) return vertices[^1].X; - double length = vertices[index].Distance - vertices[index - 1].Distance; - if (Precision.AlmostEquals(length, 0)) + double duration = vertices[index].Time - vertices[index - 1].Time; + if (Precision.AlmostEquals(duration, 0)) return vertices[index].X; float deltaX = vertices[index].X - vertices[index - 1].X; - return (float)(vertices[index - 1].X + deltaX * ((distance - vertices[index - 1].Distance) / length)); - } - - /// - /// Check the two vertices can connected directly while satisfying the slope condition. - /// - private bool canConnect(JuiceStreamPathVertex vertex1, JuiceStreamPathVertex vertex2, float allowance = 0) - { - double xDistance = Math.Abs((double)vertex2.X - vertex1.X); - float length = (float)Math.Abs(vertex2.Distance - vertex1.Distance); - return xDistance <= length + allowance; - } - - /// - /// Move the position of towards the position of - /// until the vertex pair satisfies the condition . - /// - /// The resulting position of . - private float clampToConnectablePosition(JuiceStreamPathVertex fixedVertex, JuiceStreamPathVertex movableVertex) - { - float length = (float)Math.Abs(movableVertex.Distance - fixedVertex.Distance); - return Math.Clamp(movableVertex.X, fixedVertex.X - length, fixedVertex.X + length); + return (float)(vertices[index - 1].X + deltaX * ((time - vertices[index - 1].Time) / duration)); } private void invalidate() => InvalidationID++; diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStreamPathVertex.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStreamPathVertex.cs index 58c50603c4..afef2e637f 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStreamPathVertex.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStreamPathVertex.cs @@ -12,22 +12,22 @@ namespace osu.Game.Rulesets.Catch.Objects /// public readonly struct JuiceStreamPathVertex : IComparable { - public readonly double Distance; + public readonly double Time; public readonly float X; - public JuiceStreamPathVertex(double distance, float x) + public JuiceStreamPathVertex(double time, float x) { - Distance = distance; + Time = time; X = x; } public int CompareTo(JuiceStreamPathVertex other) { - int c = Distance.CompareTo(other.Distance); + int c = Time.CompareTo(other.Time); return c != 0 ? c : X.CompareTo(other.X); } - public override string ToString() => $"({Distance}, {X})"; + public override string ToString() => $"({Time}, {X})"; } } From 9ffa90602bc675ed0a37eac66845b34f36948f8f Mon Sep 17 00:00:00 2001 From: ekrctb Date: Sun, 8 May 2022 21:17:57 +0900 Subject: [PATCH 0843/2328] Automatically set slider velocity from juice stream path --- .../Blueprints/Components/EditablePath.cs | 22 +++++++++++++++++-- .../Objects/JuiceStreamPath.cs | 5 +++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs index 3004d3644c..20e303dad1 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs @@ -92,13 +92,31 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components public void UpdateHitObjectFromPath(JuiceStream hitObject) { - path.ConvertToSliderPath(hitObject.Path, hitObject.LegacyConvertedY, hitObject.Velocity); + // The SV setting may need to be changed for the current path. + var svBindable = hitObject.DifficultyControlPoint.SliderVelocityBindable; + double svToVelocityFactor = hitObject.Velocity / svBindable.Value; + double requiredVelocity = path.ComputeRequiredVelocity(); + + // The value is pre-rounded here because setting it to the bindable will rounded to the nearest value + // but it should be always rounded up to satisfy the required minimum velocity condition. + // + // This is rounded to integers instead of using the precision of the bindable + // because it results in a smaller number of non-redundant control points. + // + // The value is clamped here by the bindable min and max values. + // In case the required velocity is too large, the path is not preserved. + svBindable.Value = Math.Ceiling(requiredVelocity / svToVelocityFactor); + + // Calculate the velocity using the resulting SV because `hitObject.Velocity` is not recomputed yet. + double velocity = svBindable.Value * svToVelocityFactor; + + path.ConvertToSliderPath(hitObject.Path, hitObject.LegacyConvertedY, velocity); if (beatSnapProvider == null) return; double endTime = hitObject.StartTime + path.Duration; double snappedEndTime = beatSnapProvider.SnapTime(endTime, hitObject.StartTime); - hitObject.Path.ExpectedDistance.Value = (snappedEndTime - hitObject.StartTime) * hitObject.Velocity; + hitObject.Path.ExpectedDistance.Value = (snappedEndTime - hitObject.StartTime) * velocity; } public Vector2 ToRelativePosition(Vector2 screenSpacePosition) diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStreamPath.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStreamPath.cs index d8cea3945c..61f4c580ae 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStreamPath.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStreamPath.cs @@ -207,6 +207,11 @@ namespace osu.Game.Rulesets.Catch.Objects { double xDifference = Math.Abs((double)vertices[i].X - vertices[i - 1].X); double timeDifference = vertices[i].Time - vertices[i - 1].Time; + + // A short segment won't affect the resulting path much anyways so ignore it to avoid divide-by-zero. + if (Precision.AlmostEquals(timeDifference, 0)) + continue; + maximumSlope = Math.Max(maximumSlope, xDifference / timeDifference); } From 0e98bb28bda2c7dcedba4d4637493e61c3c28d8e Mon Sep 17 00:00:00 2001 From: ekrctb Date: Sun, 8 May 2022 21:21:51 +0900 Subject: [PATCH 0844/2328] Fix wrong resampling times are used for juice stream path --- .../Edit/Blueprints/Components/EditablePath.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs index 20e303dad1..652d083c4e 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs @@ -80,7 +80,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components { path.ResampleVertices(hitObject.NestedHitObjects .Skip(1).TakeWhile(h => !(h is Fruit)) // Only droplets in the first span are used. - .Select(h => (h.StartTime - hitObject.StartTime) * hitObject.Velocity)); + .Select(h => h.StartTime - hitObject.StartTime)); } vertexStates.Clear(); From 670922c8e563c202b6d7e396450f64ce77ecb78d Mon Sep 17 00:00:00 2001 From: ekrctb Date: Sun, 8 May 2022 21:32:05 +0900 Subject: [PATCH 0845/2328] Use latest slider velocity for juice stream velocity computation. This fixes one-frame glitch in editor when slider velocity is changed. --- osu.Game.Rulesets.Catch/Objects/JuiceStream.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs index 282afb6343..d34452cdbb 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs @@ -27,10 +27,16 @@ namespace osu.Game.Rulesets.Catch.Objects public int RepeatCount { get; set; } [JsonIgnore] - public double Velocity { get; private set; } + private double velocityFactor; [JsonIgnore] - public double TickDistance { get; private set; } + private double tickDistanceFactor; + + [JsonIgnore] + public double Velocity => velocityFactor * DifficultyControlPoint.SliderVelocity; + + [JsonIgnore] + public double TickDistance => tickDistanceFactor * DifficultyControlPoint.SliderVelocity; /// /// The length of one span of this . @@ -43,10 +49,8 @@ namespace osu.Game.Rulesets.Catch.Objects TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime); - double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * DifficultyControlPoint.SliderVelocity; - - Velocity = scoringDistance / timingPoint.BeatLength; - TickDistance = scoringDistance / difficulty.SliderTickRate; + velocityFactor = base_scoring_distance * difficulty.SliderMultiplier / timingPoint.BeatLength; + tickDistanceFactor = base_scoring_distance * difficulty.SliderMultiplier / difficulty.SliderTickRate; } protected override void CreateNestedHitObjects(CancellationToken cancellationToken) From 37c9aac49f836bb49f57c0ea246998dcf6815144 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Sun, 8 May 2022 21:35:06 +0900 Subject: [PATCH 0846/2328] Make `ScrollingPath` use time instead of distance. This is consistent as other components now use time instead of distance. --- .../Edit/Blueprints/Components/ScrollingPath.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/ScrollingPath.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/ScrollingPath.cs index 109bf61ea5..cfaca2f9a4 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/ScrollingPath.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/ScrollingPath.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components { private readonly Path drawablePath; - private readonly List<(double Distance, float X)> vertices = new List<(double, float)>(); + private readonly List<(double Time, float X)> vertices = new List<(double, float)>(); public ScrollingPath() { @@ -35,16 +35,16 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components public void UpdatePathFrom(ScrollingHitObjectContainer hitObjectContainer, JuiceStream hitObject) { - double distanceToYFactor = -hitObjectContainer.LengthAtTime(hitObject.StartTime, hitObject.StartTime + 1 / hitObject.Velocity); + double timeToYFactor = -hitObjectContainer.LengthAtTime(hitObject.StartTime, hitObject.StartTime + 1); - computeDistanceXs(hitObject); + computeTimeXs(hitObject); drawablePath.Vertices = vertices - .Select(v => new Vector2(v.X, (float)(v.Distance * distanceToYFactor))) + .Select(v => new Vector2(v.X, (float)(v.Time * timeToYFactor))) .ToArray(); drawablePath.OriginPosition = drawablePath.PositionInBoundingBox(Vector2.Zero); } - private void computeDistanceXs(JuiceStream hitObject) + private void computeTimeXs(JuiceStream hitObject) { vertices.Clear(); @@ -54,17 +54,17 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components if (sliderVertices.Count == 0) return; - double distance = 0; + double time = 0; Vector2 lastPosition = Vector2.Zero; for (int repeat = 0; repeat < hitObject.RepeatCount + 1; repeat++) { foreach (var position in sliderVertices) { - distance += Vector2.Distance(lastPosition, position); + time += Vector2.Distance(lastPosition, position) / hitObject.Velocity; lastPosition = position; - vertices.Add((distance, position.X)); + vertices.Add((time, position.X)); } sliderVertices.Reverse(); From 7daa3d8eb79b59756fad96810012c01e3a167dfe Mon Sep 17 00:00:00 2001 From: ekrctb Date: Sun, 8 May 2022 21:54:14 +0900 Subject: [PATCH 0847/2328] Remove now-redundant velocity calculation Velocity is computed from the up-to-date SV now. --- .../Edit/Blueprints/Components/EditablePath.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs index 652d083c4e..e038562b4b 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs @@ -107,16 +107,13 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components // In case the required velocity is too large, the path is not preserved. svBindable.Value = Math.Ceiling(requiredVelocity / svToVelocityFactor); - // Calculate the velocity using the resulting SV because `hitObject.Velocity` is not recomputed yet. - double velocity = svBindable.Value * svToVelocityFactor; - - path.ConvertToSliderPath(hitObject.Path, hitObject.LegacyConvertedY, velocity); + path.ConvertToSliderPath(hitObject.Path, hitObject.LegacyConvertedY, hitObject.Velocity); if (beatSnapProvider == null) return; double endTime = hitObject.StartTime + path.Duration; double snappedEndTime = beatSnapProvider.SnapTime(endTime, hitObject.StartTime); - hitObject.Path.ExpectedDistance.Value = (snappedEndTime - hitObject.StartTime) * velocity; + hitObject.Path.ExpectedDistance.Value = (snappedEndTime - hitObject.StartTime) * hitObject.Velocity; } public Vector2 ToRelativePosition(Vector2 screenSpacePosition) From d8a4f9d37ddb42a2e0a73f51e5112edab432964a Mon Sep 17 00:00:00 2001 From: ekrctb Date: Sun, 8 May 2022 22:33:16 +0900 Subject: [PATCH 0848/2328] Update juice stream blueprint tests No "clipping" occur anymore for vertex positions. Instead, clipping may occur when the path is converted to a slider. Add tests for automatic slider velocity change. --- .../TestSceneJuiceStreamPlacementBlueprint.cs | 29 +++++------------ .../TestSceneJuiceStreamSelectionBlueprint.cs | 31 +++++-------------- 2 files changed, 15 insertions(+), 45 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamPlacementBlueprint.cs b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamPlacementBlueprint.cs index 981efc9a13..b1adc4901c 100644 --- a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamPlacementBlueprint.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor { public class TestSceneJuiceStreamPlacementBlueprint : CatchPlacementBlueprintTestScene { - private const double velocity = 0.5; + private const double velocity_factor = 0.5; private JuiceStream lastObject => LastObject?.HitObject as JuiceStream; @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor { var playable = base.GetPlayableBeatmap(); playable.Difficulty.SliderTickRate = 5; - playable.Difficulty.SliderMultiplier = velocity * 10; + playable.Difficulty.SliderMultiplier = velocity_factor * 10; return playable; } @@ -43,6 +43,7 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor AddAssert("end time is correct", () => Precision.AlmostEquals(lastObject.EndTime, times[1])); AddAssert("start position is correct", () => Precision.AlmostEquals(lastObject.OriginalX, positions[0])); AddAssert("end position is correct", () => Precision.AlmostEquals(lastObject.EndX, positions[1])); + AddAssert("default slider velocity", () => lastObject.DifficultyControlPoint.SliderVelocityBindable.IsDefault); } [Test] @@ -66,28 +67,21 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor } [Test] - public void TestVelocityLimit() + public void TestSliderVelocityChange() { double[] times = { 100, 300 }; float[] positions = { 200, 500 }; addPlacementSteps(times, positions); - addPathCheckStep(times, new float[] { 200, 300 }); - } + addPathCheckStep(times, positions); - [Test] - public void TestPreviousVerticesAreFixed() - { - double[] times = { 100, 300, 500, 700 }; - float[] positions = { 200, 400, 100, 500 }; - addPlacementSteps(times, positions); - addPathCheckStep(times, new float[] { 200, 300, 200, 300 }); + AddAssert("slider velocity changed", () => !lastObject.DifficultyControlPoint.SliderVelocityBindable.IsDefault); } [Test] public void TestClampedPositionIsRestored() { double[] times = { 100, 300, 500 }; - float[] positions = { 200, 200, 0, 250 }; + float[] positions = { 200, 200, -3000, 250 }; addMoveAndClickSteps(times[0], positions[0]); addMoveAndClickSteps(times[1], positions[1]); @@ -97,15 +91,6 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor addPathCheckStep(times, new float[] { 200, 200, 250 }); } - [Test] - public void TestFirstVertexIsFixed() - { - double[] times = { 100, 200 }; - float[] positions = { 100, 300 }; - addPlacementSteps(times, positions); - addPathCheckStep(times, new float[] { 100, 150 }); - } - [Test] public void TestOutOfOrder() { diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamSelectionBlueprint.cs b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamSelectionBlueprint.cs index 123316f461..22a839d847 100644 --- a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamSelectionBlueprint.cs @@ -101,31 +101,16 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor } [Test] - public void TestClampedPositionIsRestored() + public void TestSliderVelocityChange() { - const double velocity = 0.25; - double[] times = { 100, 500, 700 }; - float[] positions = { 100, 100, 100 }; - addBlueprintStep(times, positions, velocity); + double[] times = { 100, 300 }; + float[] positions = { 200, 300 }; + addBlueprintStep(times, positions); + AddAssert("default slider velocity", () => hitObject.DifficultyControlPoint.SliderVelocityBindable.IsDefault); addDragStartStep(times[1], positions[1]); - - AddMouseMoveStep(times[1], 200); - addVertexCheckStep(3, 1, times[1], 200); - addVertexCheckStep(3, 2, times[2], 150); - - AddMouseMoveStep(times[1], 100); - addVertexCheckStep(3, 1, times[1], 100); - // Stored position is restored. - addVertexCheckStep(3, 2, times[2], positions[2]); - - AddMouseMoveStep(times[1], 300); - addDragEndStep(); - addDragStartStep(times[1], 300); - - AddMouseMoveStep(times[1], 100); - // Position is different because a changed position is committed when the previous drag is ended. - addVertexCheckStep(3, 2, times[2], 250); + AddMouseMoveStep(times[1], 400); + AddAssert("slider velocity changed", () => !hitObject.DifficultyControlPoint.SliderVelocityBindable.IsDefault); } [Test] @@ -174,7 +159,7 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor addAddVertexSteps(500, 150); addVertexCheckStep(3, 1, 500, 150); - addAddVertexSteps(90, 220); + addAddVertexSteps(90, 200); addVertexCheckStep(4, 1, times[0], positions[0]); addAddVertexSteps(750, 180); From 6bdcf893b7d6c960d8154c9908b78f8c92a6c273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 8 May 2022 15:13:29 +0200 Subject: [PATCH 0849/2328] Move alpha management closer to screen level Felt bad messing with alpha at the column level. --- osu.Game/Overlays/Mods/ModColumn.cs | 1 - osu.Game/Overlays/Mods/ModSelectScreen.cs | 13 ++++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 89f472a290..3a2fda0bb0 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -350,7 +350,6 @@ namespace osu.Game.Overlays.Mods } allFiltered.Value = panelFlow.All(panel => panel.Filtered.Value); - Alpha = allFiltered.Value ? 0 : 1; if (toggleAllCheckbox != null && !SelectionAnimationRunning) { diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 6a3df3fb05..a2e73b9575 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -580,17 +580,20 @@ namespace osu.Game.Overlays.Mods protected override void LoadComplete() { base.LoadComplete(); - Active.BindValueChanged(_ => updateDim(), true); + Active.BindValueChanged(_ => updateState()); + Column.AllFiltered.BindValueChanged(_ => updateState(), true); FinishTransforms(); } protected override bool RequiresChildrenUpdate => base.RequiresChildrenUpdate || Column.SelectionAnimationRunning; - private void updateDim() + private void updateState() { Colour4 targetColour; - if (Active.Value) + Column.Alpha = Column.AllFiltered.Value ? 0 : 1; + + if (Column.Active.Value) targetColour = Colour4.White; else targetColour = IsHovered ? colours.GrayC : colours.Gray8; @@ -609,14 +612,14 @@ namespace osu.Game.Overlays.Mods protected override bool OnHover(HoverEvent e) { base.OnHover(e); - updateDim(); + updateState(); return Active.Value; } protected override void OnHoverLost(HoverLostEvent e) { base.OnHoverLost(e); - updateDim(); + updateState(); } } From d964b4f23c47df79e7c27acdcb7056b7b8774210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 8 May 2022 15:22:32 +0200 Subject: [PATCH 0850/2328] Fix uneven spacing when some mod columns are hidden --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index a2e73b9575..8b19e38954 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -129,7 +129,6 @@ namespace osu.Game.Overlays.Mods Shear = new Vector2(SHEAR, 0), RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, - Spacing = new Vector2(10, 0), Margin = new MarginPadding { Horizontal = 70 }, Children = new[] { @@ -237,12 +236,21 @@ namespace osu.Game.Overlays.Mods } private ColumnDimContainer createModColumnContent(ModType modType, Key[]? toggleKeys = null) - => new ColumnDimContainer(CreateModColumn(modType, toggleKeys).With(column => column.Filter = IsValidMod)) + { + var column = CreateModColumn(modType, toggleKeys).With(column => + { + column.Filter = IsValidMod; + // spacing applied here rather than via `columnFlow.Spacing` to avoid uneven gaps when some of the columns are hidden. + column.Margin = new MarginPadding { Right = 10 }; + }); + + return new ColumnDimContainer(column) { AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, - RequestScroll = column => columnScroll.ScrollIntoView(column, extraScroll: 140), + RequestScroll = col => columnScroll.ScrollIntoView(col, extraScroll: 140), }; + } private ShearedButton[] createDefaultFooterButtons() => new[] From 483a611c411ea64e24ca8e3a63fe58cb53cc99d3 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Sun, 8 May 2022 23:10:51 +0900 Subject: [PATCH 0851/2328] Fix `BeginPlacement` location. --- .../Edit/Blueprints/BananaShowerPlacementBlueprint.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs index 4613bfd36e..44cfea7779 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs @@ -18,13 +18,18 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints InternalChild = outline = new TimeSpanOutline(); } + protected override void LoadComplete() + { + base.LoadComplete(); + + BeginPlacement(); + } + protected override void Update() { base.Update(); outline.UpdateFrom(HitObjectContainer, HitObject); - - BeginPlacement(); } protected override bool OnMouseDown(MouseDownEvent e) From 158f1342608ff147b27ee48ef52652bded7632d2 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 9 May 2022 00:01:05 +0900 Subject: [PATCH 0852/2328] Fix duration is negative while placing banana shower in catch editor. Timeline blueprint is glitched when the hit object has negative duration. Negative duration is unwanted anyways so placement implementation is fixed instead of supporting it in timline blueprint. --- .../TestSceneBananaShowerPlacementBlueprint.cs | 3 +++ .../BananaShowerPlacementBlueprint.cs | 18 +++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneBananaShowerPlacementBlueprint.cs b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneBananaShowerPlacementBlueprint.cs index cca3701a60..fec253924f 100644 --- a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneBananaShowerPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneBananaShowerPlacementBlueprint.cs @@ -55,7 +55,10 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor AddMoveStep(end_time, 0); AddClickStep(MouseButton.Left); + AddMoveStep(start_time, 0); + AddAssert("duration is positive", () => ((BananaShower)CurrentBlueprint.HitObject).Duration > 0); + AddClickStep(MouseButton.Right); AddAssert("start time is correct", () => Precision.AlmostEquals(LastObject.HitObject.StartTime, start_time)); AddAssert("end time is correct", () => Precision.AlmostEquals(LastObject.HitObject.GetEndTime(), end_time)); diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs index 6dea8b0712..c3a5306b3f 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Input.Events; using osu.Game.Rulesets.Catch.Edit.Blueprints.Components; using osu.Game.Rulesets.Catch.Objects; @@ -13,6 +14,9 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints { private readonly TimeSpanOutline outline; + private double placementStartTime; + private double placementEndTime; + public BananaShowerPlacementBlueprint() { InternalChild = outline = new TimeSpanOutline(); @@ -38,13 +42,6 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints case PlacementState.Active: if (e.Button != MouseButton.Right) break; - // If the duration is negative, swap the start and the end time to make the duration positive. - if (HitObject.Duration < 0) - { - HitObject.StartTime = HitObject.EndTime; - HitObject.Duration = -HitObject.Duration; - } - EndPlacement(HitObject.Duration > 0); return true; } @@ -61,13 +58,16 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints switch (PlacementActive) { case PlacementState.Waiting: - HitObject.StartTime = time; + placementStartTime = placementEndTime = time; break; case PlacementState.Active: - HitObject.EndTime = time; + placementEndTime = time; break; } + + HitObject.StartTime = Math.Min(placementStartTime, placementEndTime); + HitObject.EndTime = Math.Max(placementStartTime, placementEndTime); } } } From 172d14bcc6675e042b7852845c6122222530c4c5 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Sun, 8 May 2022 11:40:14 -0700 Subject: [PATCH 0853/2328] Improve code quality of mod column flow container --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 29 ++++------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index fc06af3f9d..b232acf11b 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -12,7 +12,6 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; -using osu.Framework.Layout; using osu.Framework.Lists; using osu.Framework.Utils; using osu.Game.Audio; @@ -125,12 +124,15 @@ namespace osu.Game.Overlays.Mods ScrollbarOverlapsContent = false, Child = columnFlow = new ColumnFlowContainer { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, Direction = FillDirection.Horizontal, Shear = new Vector2(SHEAR, 0), RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Spacing = new Vector2(10, 0), Margin = new MarginPadding { Horizontal = 70 }, + Padding = new MarginPadding { Bottom = 10 }, Children = new[] { createModColumnContent(ModType.DifficultyReduction, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }), @@ -490,19 +492,12 @@ namespace osu.Game.Overlays.Mods } /// - /// Manages padding and layout of mod columns. + /// Manages layout of mod columns. /// internal class ColumnFlowContainer : FillFlowContainer { public IEnumerable Columns => Children.Select(dimWrapper => dimWrapper.Column); - private readonly LayoutValue drawSizeLayout = new LayoutValue(Invalidation.DrawSize); - - public ColumnFlowContainer() - { - AddLayout(drawSizeLayout); - } - public override void Add(ColumnDimContainer dimContainer) { base.Add(dimContainer); @@ -510,22 +505,6 @@ namespace osu.Game.Overlays.Mods Debug.Assert(dimContainer != null); dimContainer.Column.Shear = Vector2.Zero; } - - protected override void Update() - { - base.Update(); - - if (!drawSizeLayout.IsValid) - { - Padding = new MarginPadding - { - Left = DrawHeight * SHEAR, - Bottom = 10 - }; - - drawSizeLayout.Validate(); - } - } } /// From bc839be4d85653fc0872c7e9d923129072eeedff Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Wed, 4 May 2022 09:26:58 -0700 Subject: [PATCH 0854/2328] Add failing rapid back button exit test --- .../Navigation/TestSceneScreenNavigation.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs index f8eee7be56..9674ef7ae1 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Beatmaps; +using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Leaderboards; using osu.Game.Overlays; @@ -503,6 +504,22 @@ namespace osu.Game.Tests.Visual.Navigation AddStep("test dispose doesn't crash", () => Game.Dispose()); } + [Test] + public void TestRapidBackButtonExit() + { + AddStep("set hold delay to 0", () => Game.LocalConfig.SetValue(OsuSetting.UIHoldActivationDelay, 0.0)); + + AddStep("press escape twice rapidly", () => + { + InputManager.Key(Key.Escape); + InputManager.Key(Key.Escape); + }); + + pushEscape(); + + AddAssert("exit dialog is shown", () => Game.Dependencies.Get().CurrentDialog != null); + } + private Func playToResults() { Player player = null; From 21e1f4546a7dc35eb056748899dd423c6273cf0e Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Wed, 4 May 2022 09:27:53 -0700 Subject: [PATCH 0855/2328] Fix popup dialog potentially not clicking last button when dismissed --- osu.Game/Overlays/Dialog/PopupDialog.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index d08b6b7beb..5959fe656c 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -100,10 +100,6 @@ namespace osu.Game.Overlays.Dialog } } - // We always want dialogs to show their appear animation, so we request they start hidden. - // Normally this would not be required, but is here due to the manual Show() call that occurs before LoadComplete(). - protected override bool StartHidden => true; - protected PopupDialog() { RelativeSizeAxes = Axes.Both; @@ -272,7 +268,7 @@ namespace osu.Game.Overlays.Dialog protected override void PopOut() { - if (!actionInvoked && content.IsPresent) + if (!actionInvoked) // In the case a user did not choose an action before a hide was triggered, press the last button. // This is presumed to always be a sane default "cancel" action. buttonsContainer.Last().TriggerClick(); From 5f80e344c3f1bcf4953dedd6092d18c1d7d366eb Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 9 May 2022 00:15:08 +0100 Subject: [PATCH 0856/2328] Update day separator date text to right align against username --- osu.Game/Overlays/ChatOverlayV2.cs | 45 +++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 0702b3ad97..8c832baa38 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -349,26 +349,51 @@ namespace osu.Game.Overlays { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, ColumnDimensions = new[] { - new Dimension(GridSizeMode.Absolute, 215), - new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.Absolute, 200), + new Dimension(GridSizeMode.Absolute, 15), new Dimension(), }, Content = new[] { new[] { - Drawable.Empty(), - new OsuSpriteText + new GridContainer { - Text = time.ToLocalTime().ToString("dd MMMM yyyy").ToUpper(), - Font = OsuFont.Torus.With(size: 15, weight: FontWeight.SemiBold), - Colour = colourProvider.Content1, - Margin = new MarginPadding { Right = 10 }, + RelativeSizeAxes = Axes.Both, + ColumnDimensions = new[] + { + new Dimension(), + new Dimension(GridSizeMode.Absolute, 15), + new Dimension(GridSizeMode.AutoSize), + }, + Content = new[] + { + new[] + { + new Circle + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Colour = colourProvider.Background5, + RelativeSizeAxes = Axes.X, + Height = 2, + }, + Drawable.Empty(), + new OsuSpriteText + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Text = time.ToLocalTime().ToString("dd MMMM yyyy").ToUpper(), + Font = OsuFont.Torus.With(size: 15, weight: FontWeight.SemiBold), + Colour = colourProvider.Content1, + }, + }, + }, }, - new Box + Drawable.Empty(), + new Circle { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, From c221058f0f6cb269ed1a9746a6f999a1027c6740 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 9 May 2022 00:26:00 +0100 Subject: [PATCH 0857/2328] Simplify fetching `DrawableChannel` in `ChatOverlayV2` test --- osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 9d894314f8..259f5540b7 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -365,7 +365,7 @@ namespace osu.Game.Tests.Visual.Online AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); AddStep("Click listing", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); - AddStep("Click drawable channel", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); + AddStep("Click drawable channel", () => clickDrawable(currentDrawableChannel)); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); AddStep("Click channel list", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); @@ -381,8 +381,8 @@ namespace osu.Game.Tests.Visual.Online private Visibility loadingVisibility => chatOverlay.ChildrenOfType().Single().State.Value; - private ChatOverlayDrawableChannel currentDrawableChannel => - chatOverlay.ChildrenOfType>().Single().Child; + private DrawableChannel currentDrawableChannel => + chatOverlay.ChildrenOfType().Single(); private ChannelListItem getChannelListItem(Channel channel) => chatOverlay.ChildrenOfType().Single(item => item.Channel == channel); From aeb29849897521108bfc8d94a416272ec2bd69fa Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 9 May 2022 00:29:40 +0100 Subject: [PATCH 0858/2328] Move `ChatOverlayDrawableChannel` to it's own file --- .../Chat/ChatOverlayDrawableChannel.cs | 109 ++++++++++++++++++ osu.Game/Overlays/ChatOverlayV2.cs | 96 --------------- 2 files changed, 109 insertions(+), 96 deletions(-) create mode 100644 osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs diff --git a/osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs b/osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs new file mode 100644 index 0000000000..793d81fe26 --- /dev/null +++ b/osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs @@ -0,0 +1,109 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using System; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Online.Chat; + +namespace osu.Game.Overlays.Chat +{ + public class ChatOverlayDrawableChannel : DrawableChannel + { + public ChatOverlayDrawableChannel(Channel channel) + : base(channel) + { + } + + [BackgroundDependencyLoader] + private void load() + { + ChatLineFlow.Padding = new MarginPadding(0); + } + + protected override Drawable CreateDaySeparator(DateTimeOffset time) => new ChatOverlayDaySeparator(time); + + private class ChatOverlayDaySeparator : Container + { + private readonly DateTimeOffset time; + + public ChatOverlayDaySeparator(DateTimeOffset time) + { + this.time = time; + } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Padding = new MarginPadding(15); + Child = new GridContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, 200), + new Dimension(GridSizeMode.Absolute, 15), + new Dimension(), + }, + Content = new[] + { + new[] + { + new GridContainer + { + RelativeSizeAxes = Axes.Both, + ColumnDimensions = new[] + { + new Dimension(), + new Dimension(GridSizeMode.Absolute, 15), + new Dimension(GridSizeMode.AutoSize), + }, + Content = new[] + { + new[] + { + new Circle + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Colour = colourProvider.Background5, + RelativeSizeAxes = Axes.X, + Height = 2, + }, + Drawable.Empty(), + new OsuSpriteText + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Text = time.ToLocalTime().ToString("dd MMMM yyyy").ToUpper(), + Font = OsuFont.Torus.With(size: 15, weight: FontWeight.SemiBold), + Colour = colourProvider.Content1, + }, + }, + }, + }, + Drawable.Empty(), + new Circle + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Colour = colourProvider.Background5, + RelativeSizeAxes = Axes.X, + Height = 2, + }, + }, + }, + }; + } + } + } +} diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 8c832baa38..071f64ce29 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -3,7 +3,6 @@ #nullable enable -using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; @@ -17,9 +16,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Configuration; -using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; using osu.Game.Online.Chat; @@ -314,97 +311,4 @@ namespace osu.Game.Overlays channelManager.PostMessage(message); } } - - public class ChatOverlayDrawableChannel : DrawableChannel - { - public ChatOverlayDrawableChannel(Channel channel) - : base(channel) - { - } - - [BackgroundDependencyLoader] - private void load() - { - ChatLineFlow.Padding = new MarginPadding(0); - } - - protected override Drawable CreateDaySeparator(DateTimeOffset time) => new ChatOverlayDaySeparator(time); - - private class ChatOverlayDaySeparator : Container - { - private readonly DateTimeOffset time; - - public ChatOverlayDaySeparator(DateTimeOffset time) - { - this.time = time; - } - - [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - Padding = new MarginPadding(15); - Child = new GridContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - ColumnDimensions = new[] - { - new Dimension(GridSizeMode.Absolute, 200), - new Dimension(GridSizeMode.Absolute, 15), - new Dimension(), - }, - Content = new[] - { - new[] - { - new GridContainer - { - RelativeSizeAxes = Axes.Both, - ColumnDimensions = new[] - { - new Dimension(), - new Dimension(GridSizeMode.Absolute, 15), - new Dimension(GridSizeMode.AutoSize), - }, - Content = new[] - { - new[] - { - new Circle - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Colour = colourProvider.Background5, - RelativeSizeAxes = Axes.X, - Height = 2, - }, - Drawable.Empty(), - new OsuSpriteText - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Text = time.ToLocalTime().ToString("dd MMMM yyyy").ToUpper(), - Font = OsuFont.Torus.With(size: 15, weight: FontWeight.SemiBold), - Colour = colourProvider.Content1, - }, - }, - }, - }, - Drawable.Empty(), - new Circle - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Colour = colourProvider.Background5, - RelativeSizeAxes = Axes.X, - Height = 2, - }, - }, - }, - }; - } - } - } } From 623e2c94ae69cf5049c1c6001863319ca6029ef2 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 9 May 2022 00:32:22 +0100 Subject: [PATCH 0859/2328] Adjust padding --- osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs b/osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs index 793d81fe26..3b47adc4b7 100644 --- a/osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs +++ b/osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Chat { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - Padding = new MarginPadding(15); + Padding = new MarginPadding { Horizontal = 15, Vertical = 20 }; Child = new GridContainer { RelativeSizeAxes = Axes.X, From 3b4fdf20f9c5bb510ab660373c2a8ec498e18321 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 9 May 2022 12:15:54 +0900 Subject: [PATCH 0860/2328] Prevent throwing exceptions on first run without internet --- osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs b/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs index 46f5b418bd..fc39887e79 100644 --- a/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs +++ b/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs @@ -153,7 +153,17 @@ namespace osu.Game.Beatmaps } }; - Task.Run(() => cacheDownloadRequest.PerformAsync()); + Task.Run(async () => + { + try + { + await cacheDownloadRequest.PerformAsync(); + } + catch + { + // Prevent throwing unobserved exceptions, as they will be logged from the network request to the log file anyway. + } + }); } private bool checkLocalCache(BeatmapSetInfo set, BeatmapInfo beatmapInfo) From e4521b1fff489cc92164d8d5de8c16cb628bd675 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 9 May 2022 10:16:57 +0300 Subject: [PATCH 0861/2328] Revert scale locking changes for now --- osu.Game/Screens/Ranking/ResultsScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index 87e49fcc5e..70a1b69bcf 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Ranking { new Drawable[] { - Content = new DrawSizePreservingFillContainer + Content = new Container { RelativeSizeAxes = Axes.Both, Child = new Container From 3407a299ef30657d040736d71c7e84687adf927f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 9 May 2022 10:35:12 +0300 Subject: [PATCH 0862/2328] Revert "Revert scale locking changes for now" This reverts commit e4521b1fff489cc92164d8d5de8c16cb628bd675. --- osu.Game/Screens/Ranking/ResultsScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index 70a1b69bcf..87e49fcc5e 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Ranking { new Drawable[] { - Content = new Container + Content = new DrawSizePreservingFillContainer { RelativeSizeAxes = Axes.Both, Child = new Container From 422531d8ec5cb7240b4948c9e426663982e2a973 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 9 May 2022 10:35:13 +0300 Subject: [PATCH 0863/2328] Revert "Remove no longer required constant" This reverts commit 6f4cdccf6c5430991c8e4c87a6ad60698faff4ce. --- osu.Game/Screens/Ranking/ResultsScreen.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index 87e49fcc5e..2c91b17917 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -27,6 +27,7 @@ namespace osu.Game.Screens.Ranking public abstract class ResultsScreen : ScreenWithBeatmapBackground, IKeyBindingHandler { protected const float BACKGROUND_BLUR = 20; + private static readonly float screen_height = 768 - TwoLayerButton.SIZE_EXTENDED.Y; public override bool DisallowExternalBeatmapRulesetChanges => true; From 2f3ac61b479bae1e4ecef58ffef024809ac1f5b4 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 9 May 2022 10:35:14 +0300 Subject: [PATCH 0864/2328] Revert "Replace vertical scrolling in results screen with size-preserving container" This reverts commit 298c2a1828bf628d59a5bd7ec1b671e925732ec9. --- .../MultiplayerTeamResultsScreen.cs | 6 ++--- osu.Game/Screens/Ranking/ResultsScreen.cs | 26 +++++++++++++++++-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs index 117415ac8f..3f0f3e043c 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs @@ -46,9 +46,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer { const float winner_background_half_height = 250; - Content.Anchor = Content.Origin = Anchor.TopCentre; - Content.Scale = new Vector2(0.9f); - Content.Y = 75; + VerticalScrollContent.Anchor = VerticalScrollContent.Origin = Anchor.TopCentre; + VerticalScrollContent.Scale = new Vector2(0.9f); + VerticalScrollContent.Y = 75; var redScore = teamScores.First().Value; var blueScore = teamScores.Last().Value; diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index 2c91b17917..98514cd846 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -14,6 +14,7 @@ using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Framework.Screens; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; using osu.Game.Online.API; @@ -40,7 +41,7 @@ namespace osu.Game.Screens.Ranking protected ScorePanelList ScorePanelList { get; private set; } - protected Container Content { get; private set; } + protected VerticalScrollContainer VerticalScrollContent { get; private set; } [Resolved(CanBeNull = true)] private Player player { get; set; } @@ -78,9 +79,10 @@ namespace osu.Game.Screens.Ranking { new Drawable[] { - Content = new DrawSizePreservingFillContainer + VerticalScrollContent = new VerticalScrollContainer { RelativeSizeAxes = Axes.Both, + ScrollbarVisible = false, Child = new Container { RelativeSizeAxes = Axes.Both, @@ -344,5 +346,25 @@ namespace osu.Game.Screens.Ranking public void OnReleased(KeyBindingReleaseEvent e) { } + + protected class VerticalScrollContainer : OsuScrollContainer + { + protected override Container Content => content; + + private readonly Container content; + + public VerticalScrollContainer() + { + Masking = false; + + base.Content.Add(content = new Container { RelativeSizeAxes = Axes.X }); + } + + protected override void Update() + { + base.Update(); + content.Height = Math.Max(screen_height, DrawHeight); + } + } } } From 72552ecc855a1a30483dd80d4b9c9c41726ac7c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 9 May 2022 16:49:20 +0900 Subject: [PATCH 0865/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 2866ec24a6..97d9dbc380 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index fa7563da55..2f32c843c0 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index f987ae9bf8..b483267696 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From a16f2349aa6c9b2bf4246e1fc970dcebf5ada2e4 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 9 May 2022 17:55:40 +0900 Subject: [PATCH 0866/2328] Fix next queued item not selecting after gameplay --- .../TestSceneMultiplayerMatchSubScreen.cs | 37 +++++++++++++++++++ .../OnlinePlay/DrawableRoomPlaylistItem.cs | 8 ++-- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs index 2abde82e92..6173580f0b 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs @@ -21,6 +21,7 @@ using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Taiko; using osu.Game.Rulesets.Taiko.Mods; using osu.Game.Rulesets.UI; +using osu.Game.Screens.OnlinePlay; using osu.Game.Screens.OnlinePlay.Match; using osu.Game.Screens.OnlinePlay.Multiplayer; using osu.Game.Screens.OnlinePlay.Multiplayer.Match; @@ -176,5 +177,41 @@ namespace osu.Game.Tests.Visual.Multiplayer .ChildrenOfType() .SingleOrDefault(panel => !panel.Filtered.Value)?.Mod is OsuModDoubleTime); } + + [Test] + public void TestNextPlaylistItemSelectedAfterCompletion() + { + AddStep("add two playlist items", () => + { + SelectedRoom.Value.Playlist.AddRange(new[] + { + new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First()).BeatmapInfo) + { + RulesetID = new OsuRuleset().RulesetInfo.OnlineID + }, + new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First()).BeatmapInfo) + { + RulesetID = new OsuRuleset().RulesetInfo.OnlineID + } + }); + }); + + ClickButtonWhenEnabled(); + + AddUntilStep("wait for join", () => RoomJoined); + + ClickButtonWhenEnabled(); + ClickButtonWhenEnabled(); + + AddStep("change user to loaded", () => MultiplayerClient.ChangeState(MultiplayerUserState.Loaded)); + AddUntilStep("user playing", () => MultiplayerClient.LocalUser?.State == MultiplayerUserState.Playing); + AddStep("abort gameplay", () => MultiplayerClient.AbortGameplay()); + + AddUntilStep("last playlist item selected", () => + { + var lastItem = this.ChildrenOfType().Single(p => p.Item.ID == MultiplayerClient.APIRoom?.Playlist.Last().ID); + return lastItem.IsSelectedItem; + }); + } } } diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs index 459b861d96..2618e15d31 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs @@ -65,6 +65,8 @@ namespace osu.Game.Screens.OnlinePlay public readonly PlaylistItem Item; + public bool IsSelectedItem => SelectedItem.Value?.ID == Item.ID; + private readonly DelayedLoadWrapper onScreenLoader = new DelayedLoadWrapper(Empty) { RelativeSizeAxes = Axes.Both }; private readonly IBindable valid = new Bindable(); @@ -128,12 +130,10 @@ namespace osu.Game.Screens.OnlinePlay SelectedItem.BindValueChanged(selected => { - bool isCurrent = selected.NewValue == Model; - if (!valid.Value) { // Don't allow selection when not valid. - if (isCurrent) + if (IsSelectedItem) { SelectedItem.Value = selected.OldValue; } @@ -142,7 +142,7 @@ namespace osu.Game.Screens.OnlinePlay return; } - maskingContainer.BorderThickness = isCurrent ? 5 : 0; + maskingContainer.BorderThickness = IsSelectedItem ? 5 : 0; }, true); valid.BindValueChanged(_ => Scheduler.AddOnce(refresh)); From 0fe121f48a8954d25fef2b8059fea1f60d967549 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 9 May 2022 13:25:22 +0300 Subject: [PATCH 0867/2328] Move and rename settings toolbox group test scene --- .../TestSceneSettingsToolboxGroup.cs} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename osu.Game.Tests/Visual/{Gameplay/TestSceneReplaySettingsOverlay.cs => UserInterface/TestSceneSettingsToolboxGroup.cs} (85%) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplaySettingsOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.cs similarity index 85% rename from osu.Game.Tests/Visual/Gameplay/TestSceneReplaySettingsOverlay.cs rename to osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.cs index f8fab784cc..5ca30d07b0 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplaySettingsOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.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 NUnit.Framework; @@ -8,12 +8,12 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.PlayerSettings; -namespace osu.Game.Tests.Visual.Gameplay +namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] - public class TestSceneReplaySettingsOverlay : OsuTestScene + public class TestSceneSettingsToolboxGroup : OsuTestScene { - public TestSceneReplaySettingsOverlay() + public TestSceneSettingsToolboxGroup() { ExampleContainer container; From deda1c83e67779a748d82138215846519dbcfea7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 9 May 2022 13:44:18 +0300 Subject: [PATCH 0868/2328] Add failing test case --- .../TestSceneSettingsToolboxGroup.cs | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.cs index 5ca30d07b0..76657afbcd 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.cs @@ -1,17 +1,21 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.PlayerSettings; +using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] - public class TestSceneSettingsToolboxGroup : OsuTestScene + public class TestSceneSettingsToolboxGroup : OsuManualInputManagerTestScene { public TestSceneSettingsToolboxGroup() { @@ -46,6 +50,22 @@ namespace osu.Game.Tests.Visual.UserInterface })); } + [Test] + public void TestClickExpandButtonMultipleTimes() + { + SettingsToolboxGroup group = null; + + AddAssert("group expanded by default", () => (group = this.ChildrenOfType().First()).Expanded.Value); + AddStep("click expand button multiple times", () => + { + InputManager.MoveMouseTo(group.ChildrenOfType().Single()); + Scheduler.AddDelayed(() => InputManager.Click(MouseButton.Left), 100); + Scheduler.AddDelayed(() => InputManager.Click(MouseButton.Left), 200); + Scheduler.AddDelayed(() => InputManager.Click(MouseButton.Left), 300); + }); + AddAssert("group contracted", () => !group.Expanded.Value); + } + private class ExampleContainer : PlayerSettingsGroup { public ExampleContainer() From 702c6ae658d671a21985f28ec199b3bc18d7f5bd Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 9 May 2022 13:49:31 +0300 Subject: [PATCH 0869/2328] Fix `SettingsToolboxGroup` not clearing transforms before updating autosize --- osu.Game/Overlays/SettingsToolboxGroup.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/SettingsToolboxGroup.cs b/osu.Game/Overlays/SettingsToolboxGroup.cs index 808d4fc422..36d4f03e02 100644 --- a/osu.Game/Overlays/SettingsToolboxGroup.cs +++ b/osu.Game/Overlays/SettingsToolboxGroup.cs @@ -156,6 +156,8 @@ namespace osu.Game.Overlays private void updateExpandedState(ValueChangedEvent expanded) { + content.ClearTransforms(); + if (expanded.NewValue) content.AutoSizeAxes = Axes.Y; else From 70a90722e8dac2147feaffb764064a65ae5d031c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 9 May 2022 19:48:53 +0900 Subject: [PATCH 0870/2328] Fix dropdown item hover colour not being set in time Turns out to be an osu!-side issue. The colour transform was being shortcutted for the non-displayed case, which meant it was not in a good state in time for the first hover. Closes https://github.com/ppy/osu/issues/18163#issuecomment-1120747301 --- osu.Game/Graphics/UserInterface/OsuDropdown.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index b1d4691938..4e391c8221 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -184,14 +184,12 @@ namespace osu.Game.Graphics.UserInterface protected override void UpdateBackgroundColour() { - if (!IsPreSelected && !IsSelected) - { - Background.FadeOut(600, Easing.OutQuint); - return; - } - - Background.FadeIn(100, Easing.OutQuint); Background.FadeColour(IsPreSelected ? BackgroundColourHover : BackgroundColourSelected, 100, Easing.OutQuint); + + if (IsPreSelected || IsSelected) + Background.FadeIn(100, Easing.OutQuint); + else + Background.FadeOut(600, Easing.OutQuint); } protected override void UpdateForegroundColour() From 5f3bea846b0e2fe0c435629c9ee056e6b86d3742 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 9 May 2022 11:15:12 +0100 Subject: [PATCH 0871/2328] Simplify fetching of `DrawableChannel` --- osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 7c77ac925e..259f5540b7 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -365,7 +365,7 @@ namespace osu.Game.Tests.Visual.Online AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); AddStep("Click listing", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); - AddStep("Click drawable channel", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); + AddStep("Click drawable channel", () => clickDrawable(currentDrawableChannel)); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); AddStep("Click channel list", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); @@ -382,7 +382,7 @@ namespace osu.Game.Tests.Visual.Online chatOverlay.ChildrenOfType().Single().State.Value; private DrawableChannel currentDrawableChannel => - chatOverlay.ChildrenOfType>().Single().Child; + chatOverlay.ChildrenOfType().Single(); private ChannelListItem getChannelListItem(Channel channel) => chatOverlay.ChildrenOfType().Single(item => item.Channel == channel); From 9ec8b609a8395e1f814604b2c1f1c097f7a90d5b Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 9 May 2022 12:00:49 +0100 Subject: [PATCH 0872/2328] Update channel visibility tests to be more correct --- .../Visual/Online/TestSceneChatOverlayV2.cs | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 259f5540b7..9956b8977f 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -121,6 +121,19 @@ namespace osu.Game.Tests.Visual.Online }); } + [Test] + public void TestBasic() + { + AddStep("Show overlay with channel", () => + { + chatOverlay.Show(); + Channel joinedChannel = channelManager.JoinChannel(testChannel1); + channelManager.CurrentChannel.Value = joinedChannel; + }); + AddAssert("Overlay is visible", () => chatOverlay.State.Value == Visibility.Visible); + AddAssert("Channel is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + } + [Test] public void TestShowHide() { @@ -158,20 +171,17 @@ namespace osu.Game.Tests.Visual.Online public void TestChannelSelection() { AddStep("Show overlay", () => chatOverlay.Show()); - AddAssert("Listing is visible", () => listingVisibility == Visibility.Visible); + AddAssert("Listing is visible", () => listingIsVisible); AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); - AddAssert("Listing is hidden", () => listingVisibility == Visibility.Hidden); - AddAssert("Loading is hidden", () => loadingVisibility == Visibility.Hidden); - AddAssert("Current channel is correct", () => channelManager.CurrentChannel.Value == testChannel1); - AddAssert("DrawableChannel is correct", () => currentDrawableChannel.Channel == testChannel1); + AddAssert("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); } [Test] public void TestSearchInListing() { AddStep("Show overlay", () => chatOverlay.Show()); - AddAssert("Listing is visible", () => listingVisibility == Visibility.Visible); + AddAssert("Listing is visible", () => listingIsVisible); AddStep("Search for 'number 2'", () => chatOverlayTextBox.Text = "number 2"); AddUntilStep("Only channel 2 visibile", () => { @@ -263,6 +273,7 @@ namespace osu.Game.Tests.Visual.Online }); }); AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel1)); + AddAssert("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); } [Test] @@ -285,8 +296,7 @@ namespace osu.Game.Tests.Visual.Online }); }); AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel2)); - AddAssert("Channel 2 is selected", () => channelManager.CurrentChannel.Value == testChannel2); - AddAssert("Channel 2 is visible", () => currentDrawableChannel.Channel == testChannel2); + AddAssert("Channel 2 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel2); } [Test] @@ -310,8 +320,7 @@ namespace osu.Game.Tests.Visual.Online }); AddStep("Leave channel 2", () => channelManager.LeaveChannel(testChannel2)); AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel2)); - AddAssert("Channel 2 is selected", () => channelManager.CurrentChannel.Value == testChannel2); - AddAssert("Channel 2 is visible", () => currentDrawableChannel.Channel == testChannel2); + AddAssert("Channel 2 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel2); } [Test] @@ -331,6 +340,7 @@ namespace osu.Game.Tests.Visual.Online }); }); AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel1)); + AddAssert("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); } [Test] @@ -351,6 +361,7 @@ namespace osu.Game.Tests.Visual.Online }); AddStep("Set null channel", () => channelManager.CurrentChannel.Value = null); AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel1)); + AddAssert("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); } [Test] @@ -375,11 +386,14 @@ namespace osu.Game.Tests.Visual.Online AddAssert("TextBox is not focused", () => InputManager.FocusedDrawable == null); } - private Visibility listingVisibility => - chatOverlay.ChildrenOfType().Single().State.Value; + private bool listingIsVisible => + chatOverlay.ChildrenOfType().Single().State.Value == Visibility.Visible; - private Visibility loadingVisibility => - chatOverlay.ChildrenOfType().Single().State.Value; + private bool loadingIsVisible => + chatOverlay.ChildrenOfType().Single().State.Value == Visibility.Visible; + + private bool channelIsVisible => + !listingIsVisible && !loadingIsVisible; private DrawableChannel currentDrawableChannel => chatOverlay.ChildrenOfType().Single(); From d4cc2bd7dd813733c927b69999ef8bcb801450cc Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 9 May 2022 12:01:30 +0100 Subject: [PATCH 0873/2328] Ensure channel selector is dismissed when the current channel is changed --- osu.Game/Overlays/ChatOverlayV2.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 4c7fa0f802..48b34726f8 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -191,8 +191,6 @@ namespace osu.Game.Overlays channelManager.CurrentChannel.Value = channel; } - selectorActive.Value = false; - channel.HighlightedMessage.Value = message; Show(); @@ -268,6 +266,8 @@ namespace osu.Game.Overlays return; } + selectorActive.Value = false; + LoadComponentAsync(new DrawableChannel(newChannel), loaded => { currentChannelContainer.Clear(); From ceb6276d2ffd3e0e9b900225ea28bd12efdca146 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 9 May 2022 18:19:29 +0300 Subject: [PATCH 0874/2328] Add failing test case --- .../UserInterface/TestSceneRoundedButton.cs | 48 ++++++++++++++++--- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs index 9ccfba7c74..ef3c0c7fa4 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs @@ -2,11 +2,16 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; +using System.Linq; using NUnit.Framework; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; +using osu.Framework.Testing; using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Overlays; +using osuTK; namespace osu.Game.Tests.Visual.UserInterface { @@ -22,15 +27,10 @@ namespace osu.Game.Tests.Visual.UserInterface RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Colour4.DarkGray - }, button = new RoundedButton { Width = 400, - Text = "Test button", + Text = "Test Button", Anchor = Anchor.Centre, Origin = Anchor.Centre, Action = () => { } @@ -40,5 +40,39 @@ namespace osu.Game.Tests.Visual.UserInterface AddToggleStep("toggle disabled", disabled => button.Action = disabled ? (Action)null : () => { }); } + + [Test] + public void TestOverlay() + { + IEnumerable schemes = Enum.GetValues(typeof(OverlayColourScheme)).Cast(); + + AddStep("create buttons", () => + { + Child = new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(5f), + ChildrenEnumerable = schemes.Select(c => new DependencyProvidingContainer + { + AutoSizeAxes = Axes.Both, + CachedDependencies = new (Type, object)[] { (typeof(OverlayColourProvider), new OverlayColourProvider(c)) }, + Child = new RoundedButton + { + Width = 400, + Text = $"Test {c}", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Action = () => { }, + } + }), + }; + }); + + AddAssert("first button has correct colour", () => this.ChildrenOfType().First().BackgroundColour == new OverlayColourProvider(schemes.First()).Highlight1); + AddToggleStep("toggle disabled", disabled => this.ChildrenOfType().ForEach(b => b.Action = disabled ? (Action)null : () => { })); + } } } From 172524ff8a3812ffce89361c5552a6426529df33 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 9 May 2022 18:21:00 +0300 Subject: [PATCH 0875/2328] Move default background colour specification to `OsuButton` --- osu.Game/Graphics/UserInterface/OsuButton.cs | 8 +++++--- osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs | 11 ----------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 29a797bd78..6fa63e5874 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Diagnostics; +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -12,6 +13,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; using osuTK.Graphics; namespace osu.Game.Graphics.UserInterface @@ -86,11 +88,11 @@ namespace osu.Game.Graphics.UserInterface AddInternal(new HoverClickSounds(hoverSounds.Value)); } - [BackgroundDependencyLoader] - private void load(OsuColour colours) + [BackgroundDependencyLoader(permitNulls: true)] + private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours) { if (backgroundColour == null) - BackgroundColour = colours.BlueDark; + BackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3; } protected override void LoadComplete() diff --git a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs index f535a32b39..b1529774d9 100644 --- a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs @@ -2,13 +2,9 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using JetBrains.Annotations; -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.UserInterface; -using osu.Game.Overlays; -using osuTK.Graphics; namespace osu.Game.Graphics.UserInterfaceV2 { @@ -26,13 +22,6 @@ namespace osu.Game.Graphics.UserInterfaceV2 } } - [BackgroundDependencyLoader(true)] - private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours) - { - if (BackgroundColour == Color4.White) - BackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3; - } - protected override void LoadComplete() { base.LoadComplete(); From ace25af949ab39946e4a8b57103b40247c96dbfa Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 9 May 2022 20:55:26 +0300 Subject: [PATCH 0876/2328] Revert "Move default background colour specification to `OsuButton`" This reverts commit 172524ff8a3812ffce89361c5552a6426529df33. --- osu.Game/Graphics/UserInterface/OsuButton.cs | 8 +++----- osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs | 11 +++++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 6fa63e5874..29a797bd78 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System.Diagnostics; -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -13,7 +12,6 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Graphics.Sprites; -using osu.Game.Overlays; using osuTK.Graphics; namespace osu.Game.Graphics.UserInterface @@ -88,11 +86,11 @@ namespace osu.Game.Graphics.UserInterface AddInternal(new HoverClickSounds(hoverSounds.Value)); } - [BackgroundDependencyLoader(permitNulls: true)] - private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours) + [BackgroundDependencyLoader] + private void load(OsuColour colours) { if (backgroundColour == null) - BackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3; + BackgroundColour = colours.BlueDark; } protected override void LoadComplete() diff --git a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs index b1529774d9..f535a32b39 100644 --- a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs @@ -2,9 +2,13 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using JetBrains.Annotations; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; +using osuTK.Graphics; namespace osu.Game.Graphics.UserInterfaceV2 { @@ -22,6 +26,13 @@ namespace osu.Game.Graphics.UserInterfaceV2 } } + [BackgroundDependencyLoader(true)] + private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours) + { + if (BackgroundColour == Color4.White) + BackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3; + } + protected override void LoadComplete() { base.LoadComplete(); From 1fcfeac05f8c499ae86c36d32bcfdaf0bfc736f4 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 9 May 2022 18:52:09 +0300 Subject: [PATCH 0877/2328] Fix `RoundedButton` not using its default background colour --- osu.Game/Graphics/UserInterface/OsuButton.cs | 31 ++++++++++++++----- .../Graphics/UserInterfaceV2/RoundedButton.cs | 4 +-- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 29a797bd78..08514d94c3 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -33,9 +32,12 @@ namespace osu.Game.Graphics.UserInterface private Color4? backgroundColour; + /// + /// Sets a custom background colour to this button, replacing the provided default. + /// public Color4 BackgroundColour { - get => backgroundColour ?? Color4.White; + get => backgroundColour ?? defaultBackgroundColour; set { backgroundColour = value; @@ -43,6 +45,23 @@ namespace osu.Game.Graphics.UserInterface } } + private Color4 defaultBackgroundColour; + + /// + /// Sets a default background colour to this button. + /// + protected Color4 DefaultBackgroundColour + { + get => defaultBackgroundColour; + set + { + defaultBackgroundColour = value; + + if (backgroundColour == null) + Background.FadeColour(value); + } + } + protected override Container Content { get; } protected Box Hover; @@ -89,8 +108,7 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(OsuColour colours) { - if (backgroundColour == null) - BackgroundColour = colours.BlueDark; + DefaultBackgroundColour = colours.BlueDark; } protected override void LoadComplete() @@ -106,10 +124,7 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnClick(ClickEvent e) { if (Enabled.Value) - { - Debug.Assert(backgroundColour != null); - Background.FlashColour(backgroundColour.Value.Lighten(0.4f), 200); - } + Background.FlashColour(BackgroundColour.Lighten(0.4f), 200); return base.OnClick(e); } diff --git a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs index f535a32b39..ec56b6d784 100644 --- a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; -using osuTK.Graphics; namespace osu.Game.Graphics.UserInterfaceV2 { @@ -29,8 +28,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 [BackgroundDependencyLoader(true)] private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours) { - if (BackgroundColour == Color4.White) - BackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3; + DefaultBackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3; } protected override void LoadComplete() From 5726cf660f7ec219804fb0ebb6315ab5af5017ed Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 9 May 2022 21:19:34 +0300 Subject: [PATCH 0878/2328] Improve test coverage to use existing `ThemeComparisonTestScene` --- .../UserInterface/TestSceneRoundedButton.cs | 74 +++++-------------- 1 file changed, 18 insertions(+), 56 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs index ef3c0c7fa4..f45c55d912 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs @@ -1,78 +1,40 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using System.Collections.Generic; using System.Linq; using NUnit.Framework; -using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays; -using osuTK; namespace osu.Game.Tests.Visual.UserInterface { - public class TestSceneRoundedButton : OsuTestScene + public class TestSceneRoundedButton : ThemeComparisonTestScene { - [Test] - public void TestBasic() + private readonly BindableBool enabled = new BindableBool(true); + + protected override Drawable CreateContent() => new RoundedButton { - RoundedButton button = null; + Width = 400, + Text = "Test button", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Enabled = { BindTarget = enabled }, + }; - AddStep("create button", () => Child = new Container - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - button = new RoundedButton - { - Width = 400, - Text = "Test Button", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Action = () => { } - } - } - }); - - AddToggleStep("toggle disabled", disabled => button.Action = disabled ? (Action)null : () => { }); + [Test] + public void TestDisabled() + { + AddToggleStep("toggle disabled", disabled => enabled.Value = !disabled); } [Test] - public void TestOverlay() + public void TestBackgroundColour() { - IEnumerable schemes = Enum.GetValues(typeof(OverlayColourScheme)).Cast(); - - AddStep("create buttons", () => - { - Child = new FillFlowContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Spacing = new Vector2(5f), - ChildrenEnumerable = schemes.Select(c => new DependencyProvidingContainer - { - AutoSizeAxes = Axes.Both, - CachedDependencies = new (Type, object)[] { (typeof(OverlayColourProvider), new OverlayColourProvider(c)) }, - Child = new RoundedButton - { - Width = 400, - Text = $"Test {c}", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Action = () => { }, - } - }), - }; - }); - - AddAssert("first button has correct colour", () => this.ChildrenOfType().First().BackgroundColour == new OverlayColourProvider(schemes.First()).Highlight1); - AddToggleStep("toggle disabled", disabled => this.ChildrenOfType().ForEach(b => b.Action = disabled ? (Action)null : () => { })); + AddStep("set red scheme", () => CreateThemedContent(OverlayColourScheme.Red)); + AddAssert("first button has correct colour", () => Cell(0, 1).ChildrenOfType().First().BackgroundColour == new OverlayColourProvider(OverlayColourScheme.Red).Highlight1); } } } From ebb64d1f1ab7fb2b398ba11803690f0e83d56651 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 9 May 2022 20:15:43 +0100 Subject: [PATCH 0879/2328] Use `AddUntilStep` to wait for channel to load and become visible --- .../Visual/Online/TestSceneChatOverlayV2.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 9956b8977f..bf1767cc96 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -131,7 +131,7 @@ namespace osu.Game.Tests.Visual.Online channelManager.CurrentChannel.Value = joinedChannel; }); AddAssert("Overlay is visible", () => chatOverlay.State.Value == Visibility.Visible); - AddAssert("Channel is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + AddUntilStep("Channel is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); } [Test] @@ -174,7 +174,7 @@ namespace osu.Game.Tests.Visual.Online AddAssert("Listing is visible", () => listingIsVisible); AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); - AddAssert("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + AddUntilStep("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); } [Test] @@ -273,7 +273,7 @@ namespace osu.Game.Tests.Visual.Online }); }); AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel1)); - AddAssert("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + AddUntilStep("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); } [Test] @@ -296,7 +296,7 @@ namespace osu.Game.Tests.Visual.Online }); }); AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel2)); - AddAssert("Channel 2 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel2); + AddUntilStep("Channel 2 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel2); } [Test] @@ -320,7 +320,7 @@ namespace osu.Game.Tests.Visual.Online }); AddStep("Leave channel 2", () => channelManager.LeaveChannel(testChannel2)); AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel2)); - AddAssert("Channel 2 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel2); + AddUntilStep("Channel 2 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel2); } [Test] @@ -340,7 +340,7 @@ namespace osu.Game.Tests.Visual.Online }); }); AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel1)); - AddAssert("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + AddUntilStep("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); } [Test] @@ -361,7 +361,7 @@ namespace osu.Game.Tests.Visual.Online }); AddStep("Set null channel", () => channelManager.CurrentChannel.Value = null); AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel1)); - AddAssert("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + AddUntilStep("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); } [Test] From 38e463d31da24d4721efc22e0541505831268c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 9 May 2022 22:16:04 +0200 Subject: [PATCH 0880/2328] Add failing test case for invalid mod adjustment management --- .../UserInterface/TestSceneModSelectScreen.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index fa7758df59..661465b484 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -481,6 +481,38 @@ namespace osu.Game.Tests.Visual.UserInterface AddUntilStep("3 columns visible", () => this.ChildrenOfType().Count(col => col.IsPresent) == 3); } + [Test] + public void TestCorrectAudioAdjustmentDeapplication() + { + createScreen(); + changeRuleset(0); + + AddStep("allow track adjustments", () => MusicController.AllowTrackAdjustments = true); + + AddStep("set wind up", () => modSelectScreen.SelectedMods.Value = new[] { new ModWindUp() }); + AddStep("open customisation menu", () => + { + InputManager.MoveMouseTo(this.ChildrenOfType().Single()); + InputManager.Click(MouseButton.Left); + }); + AddAssert("frequency above 1", () => MusicController.CurrentTrack.AggregateFrequency.Value > 1); + AddAssert("tempo is 1", () => MusicController.CurrentTrack.AggregateTempo.Value == 1); + + AddStep("turn off pitch adjustment", () => + { + InputManager.MoveMouseTo(this.ChildrenOfType().Single()); + InputManager.Click(MouseButton.Left); + }); + AddAssert("frequency is 1", () => MusicController.CurrentTrack.AggregateFrequency.Value == 1); + AddAssert("tempo above 1", () => MusicController.CurrentTrack.AggregateTempo.Value > 1); + + AddStep("reset mods", () => modSelectScreen.SelectedMods.SetDefault()); + AddAssert("frequency is 1", () => MusicController.CurrentTrack.AggregateFrequency.Value == 1); + AddAssert("tempo is 1", () => MusicController.CurrentTrack.AggregateTempo.Value == 1); + + AddStep("disallow track adjustments", () => MusicController.AllowTrackAdjustments = false); + } + private void waitForColumnLoad() => AddUntilStep("all column content loaded", () => modSelectScreen.ChildrenOfType().Any() && modSelectScreen.ChildrenOfType().All(column => column.IsLoaded && column.ItemsLoaded)); From 96ea4ee7b33136a4fb563520c730c971eaf63026 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 9 May 2022 23:49:05 +0300 Subject: [PATCH 0881/2328] Add explanatory comment --- osu.Game/Overlays/SettingsToolboxGroup.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/SettingsToolboxGroup.cs b/osu.Game/Overlays/SettingsToolboxGroup.cs index 36d4f03e02..077762c0d0 100644 --- a/osu.Game/Overlays/SettingsToolboxGroup.cs +++ b/osu.Game/Overlays/SettingsToolboxGroup.cs @@ -156,6 +156,8 @@ namespace osu.Game.Overlays private void updateExpandedState(ValueChangedEvent expanded) { + // clearing transforms is necessary to avoid a previous height transform + // potentially continuing to get processed while content has changed to autosize. content.ClearTransforms(); if (expanded.NewValue) From beb86a7f7c909f27ba0f8fa217338e32a067bac4 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 9 May 2022 23:57:08 +0300 Subject: [PATCH 0882/2328] Remove usage of player settings in `TestSceneSettingsToolboxGroup` --- .../TestSceneSettingsToolboxGroup.cs | 73 ++++++++----------- 1 file changed, 29 insertions(+), 44 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.cs index 76657afbcd..8ef24e58a0 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.cs @@ -4,12 +4,11 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays; -using osu.Game.Screens.Play.HUD; -using osu.Game.Screens.Play.PlayerSettings; +using osu.Game.Overlays.Settings; using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface @@ -17,45 +16,39 @@ namespace osu.Game.Tests.Visual.UserInterface [TestFixture] public class TestSceneSettingsToolboxGroup : OsuManualInputManagerTestScene { - public TestSceneSettingsToolboxGroup() + private SettingsToolboxGroup group; + + [SetUp] + public void SetUp() => Schedule(() => { - ExampleContainer container; - - Add(new PlayerSettingsOverlay + Child = group = new SettingsToolboxGroup("example") { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - State = { Value = Visibility.Visible } - }); - - Add(container = new ExampleContainer()); - - AddStep(@"Add button", () => container.Add(new TriangleButton - { - RelativeSizeAxes = Axes.X, - Text = @"Button", - })); - - AddStep(@"Add checkbox", () => container.Add(new PlayerCheckbox - { - LabelText = "Checkbox", - })); - - AddStep(@"Add textbox", () => container.Add(new FocusedTextBox - { - RelativeSizeAxes = Axes.X, - Height = 30, - PlaceholderText = "Textbox", - HoldFocus = false, - })); - } + Children = new Drawable[] + { + new RoundedButton + { + RelativeSizeAxes = Axes.X, + Text = @"Button", + Enabled = { Value = true }, + }, + new OsuCheckbox + { + LabelText = @"Checkbox", + }, + new OutlinedTextBox + { + RelativeSizeAxes = Axes.X, + Height = 30, + PlaceholderText = @"Textbox", + } + }, + }; + }); [Test] public void TestClickExpandButtonMultipleTimes() { - SettingsToolboxGroup group = null; - - AddAssert("group expanded by default", () => (group = this.ChildrenOfType().First()).Expanded.Value); + AddAssert("group expanded by default", () => group.Expanded.Value); AddStep("click expand button multiple times", () => { InputManager.MoveMouseTo(group.ChildrenOfType().Single()); @@ -65,13 +58,5 @@ namespace osu.Game.Tests.Visual.UserInterface }); AddAssert("group contracted", () => !group.Expanded.Value); } - - private class ExampleContainer : PlayerSettingsGroup - { - public ExampleContainer() - : base("example") - { - } - } } } From 2481201a734ef248e2f99f58734f136389b93393 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 9 May 2022 22:58:46 +0100 Subject: [PATCH 0883/2328] Fix selector dismissal behaviour during user actions --- osu.Game/Overlays/ChatOverlayV2.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 48b34726f8..e59bee7977 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -165,7 +165,12 @@ namespace osu.Game.Overlays }; channelList.OnRequestLeave += channel => channelManager.LeaveChannel(channel); - channelListing.OnRequestJoin += channel => channelManager.JoinChannel(channel); + channelListing.OnRequestJoin += channel => + { + channelManager.JoinChannel(channel); + // Manually joining a channel should keep the selector open + selectorActive.Value = true; + }; channelListing.OnRequestLeave += channel => channelManager.LeaveChannel(channel); textBar.OnSearchTermsChanged += searchTerms => channelListing.SearchTerm = searchTerms; @@ -255,6 +260,10 @@ namespace osu.Game.Overlays // Channel is null when leaving the currently selected channel if (newChannel == null) { + // Don't need to autoswitch if the selector is visible + if (selectorActive.Value) + return; + // Find another channel to switch to newChannel = channelManager.JoinedChannels.FirstOrDefault(c => c != channel.OldValue); From 2b7eeadac0fbf52419050fbd8e4fe69ff93de893 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 10 May 2022 14:48:41 +0900 Subject: [PATCH 0884/2328] Workaround bad performance when selecting all freemods --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 16975cfd1d..1c629b7a4f 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -192,7 +192,8 @@ namespace osu.Game.Overlays.Mods State.BindValueChanged(_ => samplePlaybackDisabled.Value = State.Value == Visibility.Hidden, true); - ((IBindable>)modSettingsArea.SelectedMods).BindTo(SelectedMods); + if (customisationButton != null) + ((IBindable>)modSettingsArea.SelectedMods).BindTo(SelectedMods); SelectedMods.BindValueChanged(val => { From 8ccf2ee0759e58e14d8544c32297e410a8c5fb5e Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 10 May 2022 15:07:08 +0900 Subject: [PATCH 0885/2328] Add inline comment --- osu.Game/Overlays/Mods/ModSelectScreen.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 1c629b7a4f..912c09f05c 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -192,6 +192,8 @@ namespace osu.Game.Overlays.Mods State.BindValueChanged(_ => samplePlaybackDisabled.Value = State.Value == Visibility.Hidden, true); + // This is an optimisation to prevent refreshing the available settings controls when it can be + // reasonably assumed that the settings panel is never to be displayed (e.g. FreeModSelectScreen). if (customisationButton != null) ((IBindable>)modSettingsArea.SelectedMods).BindTo(SelectedMods); From bcd91ac743885c1bce1df4bf6a84de925004b73d Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 10 May 2022 10:02:32 +0300 Subject: [PATCH 0886/2328] Move exception soft-handling logic to `OsuGameBase` --- osu.Desktop/Program.cs | 22 ---------------------- osu.Game/OsuGameBase.cs | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index eb9045d9ce..405f0a8006 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -4,8 +4,6 @@ using System; using System.IO; using System.Runtime.Versioning; -using System.Threading; -using System.Threading.Tasks; using osu.Desktop.LegacyIpc; using osu.Framework; using osu.Framework.Development; @@ -63,8 +61,6 @@ namespace osu.Desktop using (DesktopGameHost host = Host.GetSuitableDesktopHost(gameName, new HostOptions { BindIPC = true })) { - host.ExceptionThrown += handleException; - if (!host.IsPrimaryInstance) { if (args.Length > 0 && args[0].Contains('.')) // easy way to check for a file import in args @@ -131,23 +127,5 @@ namespace osu.Desktop // tools.SetProcessAppUserModelId(); }); } - - private static int allowableExceptions = DebugUtils.IsDebugBuild ? 0 : 1; - - /// - /// Allow a maximum of one unhandled exception, per second of execution. - /// - /// - private static bool handleException(Exception arg) - { - bool continueExecution = Interlocked.Decrement(ref allowableExceptions) >= 0; - - Logger.Log($"Unhandled exception has been {(continueExecution ? $"allowed with {allowableExceptions} more allowable exceptions" : "denied")} ."); - - // restore the stock of allowable exceptions after a short delay. - Task.Delay(1000).ContinueWith(_ => Interlocked.Increment(ref allowableExceptions)); - - return continueExecution; - } } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 324fcada89..c5b69a3637 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -7,6 +7,7 @@ using System.IO; using System.Linq; using System.Reflection; using System.Threading; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; @@ -180,9 +181,16 @@ namespace osu.Game /// protected DatabaseContextFactory EFContextFactory { get; private set; } + /// + /// Number of exceptions to allow before aborting execution. + /// + protected virtual int SoftHandledExceptions => 0; + public OsuGameBase() { Name = @"osu!"; + + allowableExceptions = SoftHandledExceptions; } [BackgroundDependencyLoader] @@ -408,6 +416,8 @@ namespace osu.Game LocalConfig ??= UseDevelopmentServer ? new DevelopmentOsuConfigManager(Storage) : new OsuConfigManager(Storage); + + host.ExceptionThrown += onExceptionThrown; } /// @@ -505,6 +515,23 @@ namespace osu.Game AvailableMods.Value = dict; } + private int allowableExceptions; + + /// + /// Allows a maximum of one unhandled exception, per second of execution. + /// + private bool onExceptionThrown(Exception _) + { + bool continueExecution = Interlocked.Decrement(ref allowableExceptions) >= 0; + + Logger.Log($"Unhandled exception has been {(continueExecution ? $"allowed with {SoftHandledExceptions} more allowable exceptions" : "denied")} ."); + + // restore the stock of allowable exceptions after a short delay. + Task.Delay(1000).ContinueWith(_ => Interlocked.Increment(ref allowableExceptions)); + + return continueExecution; + } + protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); @@ -514,6 +541,9 @@ namespace osu.Game LocalConfig?.Dispose(); realm?.Dispose(); + + if (Host != null) + Host.ExceptionThrown -= onExceptionThrown; } } } From 725f5f4dcb00616e5f7f65ab6595918ad2812a8a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 10 May 2022 10:02:41 +0300 Subject: [PATCH 0887/2328] Allow one more exception per second in `OsuGame` and `TournamentGame` --- osu.Game.Tournament/TournamentGame.cs | 3 +++ osu.Game/OsuGame.cs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index 7967f54b49..d9db0e6d20 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -6,6 +6,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Configuration; +using osu.Framework.Development; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -39,6 +40,8 @@ namespace osu.Game.Tournament private Bindable windowMode; private LoadingSpinner loadingSpinner; + protected override int SoftHandledExceptions => DebugUtils.IsDebugBuild ? 0 : 1; + [BackgroundDependencyLoader] private void load(FrameworkConfigManager frameworkConfig, GameHost host) { diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 54c4231b06..6961dce910 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -13,6 +13,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Configuration; +using osu.Framework.Development; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -175,6 +176,8 @@ namespace osu.Game private readonly List visibleBlockingOverlays = new List(); + protected override int SoftHandledExceptions => DebugUtils.IsDebugBuild ? 0 : 1; + public OsuGame(string[] args = null) { this.args = args; From dc3c73f72300af57ad18b9671178c0bed2e1206d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 14:03:03 +0900 Subject: [PATCH 0888/2328] Enable sentry session tracking --- osu.Game/Utils/SentryLogger.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index d9c8199f75..7e0449cec8 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -25,6 +25,8 @@ namespace osu.Game.Utils var options = new SentryOptions { Dsn = "https://ad9f78529cef40ac874afb95a9aca04e@sentry.ppy.sh/2", + AutoSessionTracking = true, + IsEnvironmentUser = false, Release = game.Version }; From 09c21cde8ca15a02ddd29dba669cb200fa9919fb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 14:08:42 +0900 Subject: [PATCH 0889/2328] Add log level translation --- osu.Game/Utils/SentryLogger.cs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index 7e0449cec8..c39d718d62 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -50,12 +50,37 @@ namespace osu.Game.Utils if (lastException != null && lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace, StringComparison.Ordinal)) return; lastException = exception; - sentry.CaptureEvent(new SentryEvent(exception) { Message = entry.Message }, sentryScope); + sentry.CaptureEvent(new SentryEvent(exception) + { + Message = entry.Message, + Level = getSentryLevel(entry.Level), + }, sentryScope); } else sentryScope.AddBreadcrumb(DateTimeOffset.Now, entry.Message, entry.Target.ToString(), "navigation"); } + private SentryLevel? getSentryLevel(LogLevel entryLevel) + { + switch (entryLevel) + { + case LogLevel.Debug: + return SentryLevel.Debug; + + case LogLevel.Verbose: + return SentryLevel.Info; + + case LogLevel.Important: + return SentryLevel.Warning; + + case LogLevel.Error: + return SentryLevel.Error; + + default: + throw new ArgumentOutOfRangeException(nameof(entryLevel), entryLevel, null); + } + } + private bool shouldSubmitException(Exception exception) { switch (exception) From 64cc6ebddbb090edc7a39bb83415b68dc7f25ece Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 14:12:31 +0900 Subject: [PATCH 0890/2328] Add local user tracking to sentry reporting --- osu.Game/OsuGameBase.cs | 2 +- osu.Game/Utils/SentryLogger.cs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 324fcada89..3f0610e9aa 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -125,7 +125,7 @@ namespace osu.Game protected MusicController MusicController { get; private set; } - protected IAPIProvider API { get; set; } + protected internal IAPIProvider API { get; protected set; } protected Storage Storage { get; set; } diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index c39d718d62..5cecc4d776 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -4,7 +4,10 @@ using System; using System.IO; using System.Net; +using JetBrains.Annotations; +using osu.Framework.Bindables; using osu.Framework.Logging; +using osu.Game.Online.API.Requests.Responses; using Sentry; namespace osu.Game.Utils @@ -18,6 +21,9 @@ namespace osu.Game.Utils private Scope sentryScope; private Exception lastException; + [UsedImplicitly] + private readonly IBindable localUser; + public SentryLogger(OsuGame game) { if (!game.IsDeployedBuild) return; @@ -34,6 +40,16 @@ namespace osu.Game.Utils sentryScope = new Scope(options); Logger.NewEntry += processLogEntry; + + localUser = game.API.LocalUser.GetBoundCopy(); + localUser.BindValueChanged(user => + { + sentryScope.User = new User + { + Username = user.NewValue.Username, + Id = user.NewValue.Id.ToString(), + }; + }); } private void processLogEntry(LogEntry entry) @@ -50,6 +66,7 @@ namespace osu.Game.Utils if (lastException != null && lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace, StringComparison.Ordinal)) return; lastException = exception; + sentry.CaptureEvent(new SentryEvent(exception) { Message = entry.Message, From a5b454edc72537daaaf428bca8b34bf8a9c926b7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 14:21:49 +0900 Subject: [PATCH 0891/2328] Remove unnecessary DI caching of `SentryLogger` --- osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs | 2 -- osu.Game/OsuGame.cs | 2 -- 2 files changed, 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs b/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs index 0f8337deb6..e4871f611e 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs @@ -23,7 +23,6 @@ using osu.Game.Rulesets.Mods; using osu.Game.Scoring; using osu.Game.Screens.Menu; using osu.Game.Skinning; -using osu.Game.Utils; namespace osu.Game.Tests.Visual.Navigation { @@ -33,7 +32,6 @@ namespace osu.Game.Tests.Visual.Navigation private IReadOnlyList requiredGameDependencies => new[] { typeof(OsuGame), - typeof(SentryLogger), typeof(OsuLogo), typeof(IdleTracker), typeof(OnScreenDisplay), diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 54c4231b06..a6c57998b0 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -258,8 +258,6 @@ namespace osu.Game { dependencies.CacheAs(this); - dependencies.Cache(SentryLogger); - dependencies.Cache(osuLogo = new OsuLogo { Alpha = 0 }); // bind config int to database RulesetInfo From 3338bffce3809d78d0f00e6b0b2bf332e62c8af7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 14:25:10 +0900 Subject: [PATCH 0892/2328] Attach user to sentry later in startup flow --- osu.Game/OsuGame.cs | 2 ++ osu.Game/OsuGameBase.cs | 2 +- osu.Game/Utils/SentryLogger.cs | 26 +++++++++++++++----------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index a6c57998b0..b8abef38a8 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -258,6 +258,8 @@ namespace osu.Game { dependencies.CacheAs(this); + SentryLogger.AttachUser(API.LocalUser); + dependencies.Cache(osuLogo = new OsuLogo { Alpha = 0 }); // bind config int to database RulesetInfo diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 3f0610e9aa..324fcada89 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -125,7 +125,7 @@ namespace osu.Game protected MusicController MusicController { get; private set; } - protected internal IAPIProvider API { get; protected set; } + protected IAPIProvider API { get; set; } protected Storage Storage { get; set; } diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index 5cecc4d776..92f2902c0e 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -1,10 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; +using System.Diagnostics; using System.IO; using System.Net; -using JetBrains.Annotations; using osu.Framework.Bindables; using osu.Framework.Logging; using osu.Game.Online.API.Requests.Responses; @@ -19,10 +21,9 @@ namespace osu.Game.Utils { private SentryClient sentry; private Scope sentryScope; - private Exception lastException; + private Exception? lastException; - [UsedImplicitly] - private readonly IBindable localUser; + private IBindable? localUser; public SentryLogger(OsuGame game) { @@ -40,16 +41,21 @@ namespace osu.Game.Utils sentryScope = new Scope(options); Logger.NewEntry += processLogEntry; + } - localUser = game.API.LocalUser.GetBoundCopy(); - localUser.BindValueChanged(user => + public void AttachUser(IBindable user) + { + Debug.Assert(localUser == null); + + localUser = user.GetBoundCopy(); + localUser.BindValueChanged(u => { sentryScope.User = new User { - Username = user.NewValue.Username, - Id = user.NewValue.Id.ToString(), + Username = u.NewValue.Username, + Id = u.NewValue.Id.ToString(), }; - }); + }, true); } private void processLogEntry(LogEntry entry) @@ -137,8 +143,6 @@ namespace osu.Game.Utils protected virtual void Dispose(bool isDisposing) { Logger.NewEntry -= processLogEntry; - sentry = null; - sentryScope = null; } #endregion From 9734d778f4bda85e2f38cd03e326c09cb3c40ac7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 14:44:54 +0900 Subject: [PATCH 0893/2328] Update sentry SDK usage in line with more recent specifications --- osu.Game/Utils/SentryLogger.cs | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index 92f2902c0e..02bcdd281a 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -19,26 +19,24 @@ namespace osu.Game.Utils /// public class SentryLogger : IDisposable { - private SentryClient sentry; - private Scope sentryScope; private Exception? lastException; private IBindable? localUser; + private readonly IDisposable? sentrySession; + public SentryLogger(OsuGame game) { - if (!game.IsDeployedBuild) return; - - var options = new SentryOptions + sentrySession = SentrySdk.Init(options => { - Dsn = "https://ad9f78529cef40ac874afb95a9aca04e@sentry.ppy.sh/2", - AutoSessionTracking = true, - IsEnvironmentUser = false, - Release = game.Version - }; + // Not setting the dsn will completely disable sentry. + if (game.IsDeployedBuild) + options.Dsn = "https://ad9f78529cef40ac874afb95a9aca04e@sentry.ppy.sh/2"; - sentry = new SentryClient(options); - sentryScope = new Scope(options); + options.AutoSessionTracking = true; + options.IsEnvironmentUser = false; + options.Release = game.Version; + }); Logger.NewEntry += processLogEntry; } @@ -50,11 +48,11 @@ namespace osu.Game.Utils localUser = user.GetBoundCopy(); localUser.BindValueChanged(u => { - sentryScope.User = new User + SentrySdk.ConfigureScope(scope => scope.User = new User { Username = u.NewValue.Username, Id = u.NewValue.Id.ToString(), - }; + }); }, true); } @@ -73,14 +71,14 @@ namespace osu.Game.Utils lastException = exception; - sentry.CaptureEvent(new SentryEvent(exception) + SentrySdk.CaptureEvent(new SentryEvent(exception) { Message = entry.Message, Level = getSentryLevel(entry.Level), - }, sentryScope); + }); } else - sentryScope.AddBreadcrumb(DateTimeOffset.Now, entry.Message, entry.Target.ToString(), "navigation"); + SentrySdk.AddBreadcrumb(entry.Message, entry.Target.ToString(), "navigation"); } private SentryLevel? getSentryLevel(LogLevel entryLevel) @@ -143,6 +141,7 @@ namespace osu.Game.Utils protected virtual void Dispose(bool isDisposing) { Logger.NewEntry -= processLogEntry; + sentrySession?.Dispose(); } #endregion From 99e6d56508799132912238edf898df000f33033a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 14:45:55 +0900 Subject: [PATCH 0894/2328] Add finalizer to sentry logger for safety --- osu.Game/Utils/SentryLogger.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index 02bcdd281a..c6429b6b2c 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -41,6 +41,8 @@ namespace osu.Game.Utils Logger.NewEntry += processLogEntry; } + ~SentryLogger() => Dispose(false); + public void AttachUser(IBindable user) { Debug.Assert(localUser == null); From c6112b3ae78becb6980053ae047258c103a4db8e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 15:07:02 +0900 Subject: [PATCH 0895/2328] Add unhandled exception marking --- osu.Game/Utils/SentryLogger.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index c6429b6b2c..728d6ab9be 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -11,6 +11,7 @@ using osu.Framework.Bindables; using osu.Framework.Logging; using osu.Game.Online.API.Requests.Responses; using Sentry; +using Sentry.Protocol; namespace osu.Game.Utils { @@ -73,6 +74,13 @@ namespace osu.Game.Utils lastException = exception; + // framework does some weird exception redirection which means sentry does not see unhandled exceptions using its automatic methods. + // but all unhandled exceptions still arrive via this pathway. we just need to mark them as unhandled for tagging purposes. + // easiest solution is to check the message matches what the framework logs this as. + // see https://github.com/ppy/osu-framework/blob/f932f8df053f0011d755c95ad9a2ed61b94d136b/osu.Framework/Platform/GameHost.cs#L336 + bool wasHandled = entry.Message != @"An unhandled exception has occurred."; + exception.Data[Mechanism.HandledKey] = wasHandled; + SentrySdk.CaptureEvent(new SentryEvent(exception) { Message = entry.Message, From 363643a16d64777ffd0daf681507ec0e53d003c3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 15:08:49 +0900 Subject: [PATCH 0896/2328] Remove sentry logger debounce This is probably going to result in a high quantity of exceptions, but I think this is fine. We can add rules as we go to not log certain exception types. --- osu.Game/Utils/SentryLogger.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index 728d6ab9be..170d8e7cb0 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -20,8 +20,6 @@ namespace osu.Game.Utils /// public class SentryLogger : IDisposable { - private Exception? lastException; - private IBindable? localUser; private readonly IDisposable? sentrySession; @@ -69,11 +67,6 @@ namespace osu.Game.Utils { if (!shouldSubmitException(exception)) return; - // since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports. - if (lastException != null && lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace, StringComparison.Ordinal)) return; - - lastException = exception; - // framework does some weird exception redirection which means sentry does not see unhandled exceptions using its automatic methods. // but all unhandled exceptions still arrive via this pathway. we just need to mark them as unhandled for tagging purposes. // easiest solution is to check the message matches what the framework logs this as. From 216c68e6d018246a37870fa2ada898f7def2a080 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 15:19:43 +0900 Subject: [PATCH 0897/2328] Add unobserved exception hinting --- osu.Game/Utils/SentryLogger.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index 170d8e7cb0..96affd85a7 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -71,8 +71,22 @@ namespace osu.Game.Utils // but all unhandled exceptions still arrive via this pathway. we just need to mark them as unhandled for tagging purposes. // easiest solution is to check the message matches what the framework logs this as. // see https://github.com/ppy/osu-framework/blob/f932f8df053f0011d755c95ad9a2ed61b94d136b/osu.Framework/Platform/GameHost.cs#L336 - bool wasHandled = entry.Message != @"An unhandled exception has occurred."; - exception.Data[Mechanism.HandledKey] = wasHandled; + bool wasUnhandled = entry.Message == @"An unhandled error has occurred."; + bool wasUnobserved = entry.Message == @"An unobserved error has occurred."; + + if (wasUnobserved) + { + // see https://github.com/getsentry/sentry-dotnet/blob/c6a660b1affc894441c63df2695a995701671744/src/Sentry/Integrations/TaskUnobservedTaskExceptionIntegration.cs#L39 + exception.Data[Mechanism.MechanismKey] = @"UnobservedTaskException"; + } + + if (wasUnhandled) + { + // see https://github.com/getsentry/sentry-dotnet/blob/main/src/Sentry/Integrations/AppDomainUnhandledExceptionIntegration.cs#L38-L39 + exception.Data[Mechanism.MechanismKey] = @"AppDomain.UnhandledException"; + } + + exception.Data[Mechanism.HandledKey] = !wasUnhandled; SentrySdk.CaptureEvent(new SentryEvent(exception) { From 6a49eb68759d89e4d001866a7ae4fcbb7addc8d5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 16:14:04 +0900 Subject: [PATCH 0898/2328] Add breadcrumb level mappings --- osu.Game/Utils/SentryLogger.cs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index 96affd85a7..ad4bcf6274 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -95,10 +95,31 @@ namespace osu.Game.Utils }); } else - SentrySdk.AddBreadcrumb(entry.Message, entry.Target.ToString(), "navigation"); + SentrySdk.AddBreadcrumb(entry.Message, entry.Target.ToString(), "navigation", level: getBreadcrumbLevel(entry.Level)); } - private SentryLevel? getSentryLevel(LogLevel entryLevel) + private BreadcrumbLevel getBreadcrumbLevel(LogLevel entryLevel) + { + switch (entryLevel) + { + case LogLevel.Debug: + return BreadcrumbLevel.Debug; + + case LogLevel.Verbose: + return BreadcrumbLevel.Info; + + case LogLevel.Important: + return BreadcrumbLevel.Warning; + + case LogLevel.Error: + return BreadcrumbLevel.Error; + + default: + throw new ArgumentOutOfRangeException(nameof(entryLevel), entryLevel, null); + } + } + + private SentryLevel getSentryLevel(LogLevel entryLevel) { switch (entryLevel) { From 14a21e92244030a6f1fa758237f9733776b0c6b7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 10 May 2022 11:41:41 +0300 Subject: [PATCH 0899/2328] Workaround interface mocks in `TestSceneFirstRunSetupOverlay` breaking with hot reload --- .../TestSceneFirstRunSetupOverlay.cs | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index 39298f56ba..905f53c165 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -4,9 +4,11 @@ using System; using System.Collections.Generic; using System.Linq; +using JetBrains.Annotations; using Moq; using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Framework.Screens; using osu.Framework.Testing; @@ -25,9 +27,9 @@ namespace osu.Game.Tests.Visual.UserInterface { private FirstRunSetupOverlay overlay; - private readonly Mock performer = new Mock(); + private readonly Mock performer = new Mock(); - private readonly Mock notificationOverlay = new Mock(); + private readonly Mock notificationOverlay = new Mock(); private Notification lastNotification; @@ -37,8 +39,8 @@ namespace osu.Game.Tests.Visual.UserInterface private void load() { Dependencies.Cache(LocalConfig = new OsuConfigManager(LocalStorage)); - Dependencies.CacheAs(performer.Object); - Dependencies.CacheAs(notificationOverlay.Object); + Dependencies.CacheAs(performer.Object); + Dependencies.CacheAs(notificationOverlay.Object); } [SetUpSteps] @@ -196,5 +198,31 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("overlay shown", () => overlay.State.Value == Visibility.Visible); AddAssert("is resumed", () => overlay.CurrentScreen is ScreenBeatmaps); } + + // interface mocks break hot reload, mocking this stub implementation instead works around it. + // see: https://github.com/moq/moq4/issues/1252 + [UsedImplicitly] + public class TestNotificationOverlay : INotificationOverlay + { + public virtual void Post(Notification notification) + { + } + + public virtual void Hide() + { + } + + public virtual IBindable UnreadCount => null; + } + + // interface mocks break hot reload, mocking this stub implementation instead works around it. + // see: https://github.com/moq/moq4/issues/1252 + [UsedImplicitly] + public class TestPerformerFromScreenRunner : IPerformFromScreenRunner + { + public virtual void PerformFromScreen(Action action, IEnumerable validScreens = null) + { + } + } } } From 9aadc274bfe5578d2dabe2388ee9f3af4928addd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 16:43:38 +0900 Subject: [PATCH 0900/2328] Show first run dialog on first run of the game --- .../Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs | 1 - osu.Game/Overlays/FirstRunSetupOverlay.cs | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index 905f53c165..48b5690243 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -74,7 +74,6 @@ namespace osu.Game.Tests.Visual.UserInterface } [Test] - [Ignore("Enable when first run setup is being displayed on first run.")] public void TestDoesntOpenOnSecondRun() { AddStep("set first run", () => LocalConfig.SetValue(OsuSetting.ShowFirstRunSetup, true)); diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 607bef76dd..df1e094114 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -171,8 +171,7 @@ namespace osu.Game.Overlays config.BindWith(OsuSetting.ShowFirstRunSetup, showFirstRunSetup); - // TODO: uncomment when happy with the whole flow. - // if (showFirstRunSetup.Value) Show(); + if (showFirstRunSetup.Value) Show(); } public override bool OnPressed(KeyBindingPressEvent e) @@ -304,8 +303,7 @@ namespace osu.Game.Overlays } else { - // TODO: uncomment when happy with the whole flow. - // showFirstRunSetup.Value = false; + showFirstRunSetup.Value = false; currentStepIndex = null; Hide(); } From bcce9c5e6772911ff817216c4424ad0ff596e7a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 17:01:36 +0900 Subject: [PATCH 0901/2328] Limit the width of first run overlay content --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 71 ++++++++++++++--------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index df1e094114..befa80e839 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -62,7 +62,7 @@ namespace osu.Game.Overlays typeof(ScreenBehaviour), }; - private Container stackContainer = null!; + private Container screenContent = null!; private Bindable? overlayActivationMode; @@ -86,36 +86,51 @@ namespace osu.Game.Overlays Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding + Padding = new MarginPadding { Bottom = 20, }, + Child = new GridContainer() { - Horizontal = 70 * 1.2f, - Bottom = 20, - }, - Child = new InputBlockingContainer - { - Masking = true, - CornerRadius = 14, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, - Children = new Drawable[] + ColumnDimensions = new[] { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = ColourProvider.Background6, - }, - stackContainer = new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding - { - Vertical = 20, - Horizontal = 70, - }, - } + new Dimension(), + new Dimension(minSize: 640, maxSize: 800), + new Dimension(), }, - }, + Content = new[] + { + new[] + { + Empty(), + new InputBlockingContainer + { + Masking = true, + CornerRadius = 14, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = ColourProvider.Background6, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding + { + Vertical = 20, + Horizontal = 20, + }, + Child = screenContent = new Container { RelativeSizeAxes = Axes.Both, }, + }, + }, + }, + Empty(), + }, + } + } }, }); @@ -268,7 +283,7 @@ namespace osu.Game.Overlays { Debug.Assert(currentStepIndex == null); - stackContainer.Child = stack = new ScreenStack + screenContent.Child = stack = new ScreenStack { RelativeSizeAxes = Axes.Both, }; From e5204e565dae9946543ca23c72119be7f26e0540 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 17:23:12 +0900 Subject: [PATCH 0902/2328] Move horizontal padding to content level to better align scrollbar --- .../FirstRunSetup/FirstRunSetupScreen.cs | 34 +++++++++++-------- osu.Game/Overlays/FirstRunSetupOverlay.cs | 6 +--- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs index 1f18d181cb..2990948199 100644 --- a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs +++ b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs @@ -33,23 +33,29 @@ namespace osu.Game.Overlays.FirstRunSetup new OsuScrollContainer(Direction.Vertical) { RelativeSizeAxes = Axes.Both, - ScrollbarOverlapsContent = false, - Children = new Drawable[] + Masking = false, + Child = new Container { - new OsuSpriteText + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Horizontal = 30 }, + Children = new Drawable[] { - Text = this.GetLocalisableDescription(), - Font = OsuFont.Default.With(size: header_size), - Colour = OverlayColourProvider.Light1, + new OsuSpriteText + { + Text = this.GetLocalisableDescription(), + Font = OsuFont.Default.With(size: header_size), + Colour = OverlayColourProvider.Light1, + }, + Content = new FillFlowContainer + { + Y = header_size + spacing, + Spacing = new Vector2(spacing), + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + } }, - Content = new FillFlowContainer - { - Y = header_size + spacing, - Spacing = new Vector2(spacing), - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - } }, } }; diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index befa80e839..19a4c09473 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -118,11 +118,7 @@ namespace osu.Game.Overlays new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding - { - Vertical = 20, - Horizontal = 20, - }, + Padding = new MarginPadding { Vertical = 20 }, Child = screenContent = new Container { RelativeSizeAxes = Axes.Both, }, }, }, From 61313b69ecd40049dbc13b502e21a0e4cbeb312d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 17:33:37 +0900 Subject: [PATCH 0903/2328] Standardise font sizes in first run overlay screens --- .../Overlays/FirstRunSetup/FirstRunSetupScreen.cs | 9 ++++++--- osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs | 14 +++++++------- osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs | 2 +- osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs | 2 +- osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs | 2 +- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs index 2990948199..2cfa7cd164 100644 --- a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs +++ b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs @@ -19,13 +19,16 @@ namespace osu.Game.Overlays.FirstRunSetup protected FillFlowContainer Content { get; private set; } + protected const float CONTENT_FONT_SIZE = 16; + + protected const float HEADER_FONT_SIZE = 24; + [Resolved] protected OverlayColourProvider OverlayColourProvider { get; private set; } [BackgroundDependencyLoader] private void load() { - const float header_size = 40; const float spacing = 20; InternalChildren = new Drawable[] @@ -44,12 +47,12 @@ namespace osu.Game.Overlays.FirstRunSetup new OsuSpriteText { Text = this.GetLocalisableDescription(), - Font = OsuFont.Default.With(size: header_size), + Font = OsuFont.TorusAlternate.With(size: HEADER_FONT_SIZE), Colour = OverlayColourProvider.Light1, }, Content = new FillFlowContainer { - Y = header_size + spacing, + Y = HEADER_FONT_SIZE + spacing, Spacing = new Vector2(spacing), RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs index 190a0badab..66acdca8c7 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs @@ -46,11 +46,11 @@ namespace osu.Game.Overlays.FirstRunSetup [BackgroundDependencyLoader(permitNulls: true)] private void load(LegacyImportManager? legacyImportManager) { - Vector2 buttonSize = new Vector2(500, 60); + Vector2 buttonSize = new Vector2(400, 50); Content.Children = new Drawable[] { - new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) { Colour = OverlayColourProvider.Content1, Text = FirstRunSetupBeatmapScreenStrings.Description, @@ -63,7 +63,7 @@ namespace osu.Game.Overlays.FirstRunSetup Height = 30, Children = new Drawable[] { - currentlyLoadedBeatmaps = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 24, weight: FontWeight.SemiBold)) + currentlyLoadedBeatmaps = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: HEADER_FONT_SIZE, weight: FontWeight.SemiBold)) { Colour = OverlayColourProvider.Content2, TextAnchor = Anchor.Centre, @@ -73,7 +73,7 @@ namespace osu.Game.Overlays.FirstRunSetup }, } }, - new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) { Colour = OverlayColourProvider.Content1, Text = FirstRunSetupBeatmapScreenStrings.TutorialDescription, @@ -89,7 +89,7 @@ namespace osu.Game.Overlays.FirstRunSetup Text = FirstRunSetupBeatmapScreenStrings.TutorialButton, Action = downloadTutorial }, - new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) { Colour = OverlayColourProvider.Content1, Text = FirstRunSetupBeatmapScreenStrings.BundledDescription, @@ -105,7 +105,7 @@ namespace osu.Game.Overlays.FirstRunSetup Text = FirstRunSetupBeatmapScreenStrings.BundledButton, Action = downloadBundled }, - new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) { Colour = OverlayColourProvider.Content1, Text = "If you have an existing osu! install, you can also choose to import your existing beatmap collection.", @@ -131,7 +131,7 @@ namespace osu.Game.Overlays.FirstRunSetup })); } }, - new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) { Colour = OverlayColourProvider.Content1, Text = FirstRunSetupBeatmapScreenStrings.ObtainMoreBeatmaps, diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs index dc3d40ad95..9d426bd3fa 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays.FirstRunSetup { Content.Children = new Drawable[] { - new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 24)) + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) { Text = FirstRunSetupOverlayStrings.BehaviourDescription, RelativeSizeAxes = Axes.X, diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs index 152d67ab27..24e113e6a9 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs @@ -37,7 +37,7 @@ namespace osu.Game.Overlays.FirstRunSetup { Content.Children = new Drawable[] { - new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 24)) + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) { Text = FirstRunSetupOverlayStrings.UIScaleDescription, RelativeSizeAxes = Axes.X, diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs index 10e15a7555..420d630857 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs @@ -18,7 +18,7 @@ namespace osu.Game.Overlays.FirstRunSetup { Content.Children = new Drawable[] { - new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) { Text = FirstRunSetupOverlayStrings.WelcomeDescription, RelativeSizeAxes = Axes.X, From 63b9e01d384eb8fda2c5439ab98807b1be7244e5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 17:35:43 +0900 Subject: [PATCH 0904/2328] Fix behaviour screen using old style buttons --- osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs index 9d426bd3fa..1a88e6a842 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs @@ -9,7 +9,7 @@ using osu.Framework.Localisation; using osu.Framework.Testing; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings.Sections; @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.FirstRunSetup private SearchContainer searchContainer; [BackgroundDependencyLoader] - private void load() + private void load(OsuColour colours) { Content.Children = new Drawable[] { @@ -50,7 +50,7 @@ namespace osu.Game.Overlays.FirstRunSetup { new[] { - new TriangleButton + new RoundedButton { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, @@ -59,10 +59,11 @@ namespace osu.Game.Overlays.FirstRunSetup Action = applyStandard, }, Empty(), - new DangerousTriangleButton + new RoundedButton { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, + BackgroundColour = colours.Pink3, Text = FirstRunSetupOverlayStrings.ClassicDefaults, RelativeSizeAxes = Axes.X, Action = applyClassic From 493798ae5e5e4ba61e5654b2623eab4a249af750 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 17:44:23 +0900 Subject: [PATCH 0905/2328] Fix nested ui scale example screens no longer fitting --- osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs index 24e113e6a9..4a44a6d391 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs @@ -35,6 +35,8 @@ namespace osu.Game.Overlays.FirstRunSetup [BackgroundDependencyLoader] private void load(OsuConfigManager config) { + const float screen_width = 640; + Content.Children = new Drawable[] { new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) @@ -54,7 +56,7 @@ namespace osu.Game.Overlays.FirstRunSetup Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.None, - Size = new Vector2(960, 960 / 16f * 9 / 2), + Size = new Vector2(screen_width, screen_width / 16f * 9 / 2), Children = new Drawable[] { new GridContainer From 25c6226ca9cb7c82ef9a66e4c12f45f13ec7e732 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 17:47:04 +0900 Subject: [PATCH 0906/2328] Adjust transition length for a more seamless screen change --- osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs index 2cfa7cd164..d1ea91e51a 100644 --- a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs +++ b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs @@ -68,7 +68,7 @@ namespace osu.Game.Overlays.FirstRunSetup { base.OnEntering(e); this - .FadeInFromZero(500) + .FadeInFromZero(100) .MoveToX(offset) .MoveToX(0, 500, Easing.OutQuint); } @@ -77,7 +77,7 @@ namespace osu.Game.Overlays.FirstRunSetup { base.OnResuming(e); this - .FadeInFromZero(500) + .FadeInFromZero(100) .MoveToX(0, 500, Easing.OutQuint); } From a93c63b2b5b7d0119b3fb5ee97bee8232d593854 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 18:04:10 +0900 Subject: [PATCH 0907/2328] Add loading spinner when loading first run screens --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 19a4c09473..c0eed14c99 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -15,6 +15,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Framework.Screens; +using osu.Framework.Threading; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; @@ -68,6 +69,9 @@ namespace osu.Game.Overlays private Container content = null!; + private LoadingSpinner loading = null!; + private ScheduledDelegate? loadingShowDelegate; + public FirstRunSetupOverlay() : base(OverlayColourScheme.Purple) { @@ -115,6 +119,7 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both, Colour = ColourProvider.Background6, }, + loading = new LoadingSpinner(), new Container { RelativeSizeAxes = Axes.Both, @@ -310,7 +315,16 @@ namespace osu.Game.Overlays if (currentStepIndex < steps.Length) { - stack.Push((Screen)Activator.CreateInstance(steps[currentStepIndex.Value])); + var nextScreen = (Screen)Activator.CreateInstance(steps[currentStepIndex.Value]); + + loadingShowDelegate = Scheduler.AddDelayed(() => loading.Show(), 200); + nextScreen.OnLoadComplete += _ => + { + loadingShowDelegate?.Cancel(); + loading.Hide(); + }; + + stack.Push(nextScreen); } else { From a578f7a406a049f8548af177b630c89a6ba32c8a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 18:08:17 +0900 Subject: [PATCH 0908/2328] Force nested screens to load synchronously --- osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs | 15 +++++++++------ osu.Game/Screens/OsuScreenStack.cs | 7 +++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs index 4a44a6d391..8452691bb5 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs @@ -125,6 +125,7 @@ namespace osu.Game.Overlays.FirstRunSetup private class SampleScreenContainer : CompositeDrawable { + private readonly OsuScreen screen; // Minimal isolation from main game. [Cached] @@ -144,6 +145,12 @@ namespace osu.Game.Overlays.FirstRunSetup public override bool PropagatePositionalInputSubTree => false; public override bool PropagateNonPositionalInputSubTree => false; + public SampleScreenContainer(OsuScreen screen) + { + this.screen = screen; + RelativeSizeAxes = Axes.Both; + } + [BackgroundDependencyLoader] private void load(AudioManager audio, TextureStore textures, RulesetStore rulesets) { @@ -151,13 +158,8 @@ namespace osu.Game.Overlays.FirstRunSetup Beatmap.Value.LoadTrack(); Ruleset.Value = rulesets.AvailableRulesets.First(); - } - public SampleScreenContainer(Screen screen) - { OsuScreenStack stack; - RelativeSizeAxes = Axes.Both; - OsuLogo logo; Padding = new MarginPadding(5); @@ -191,7 +193,8 @@ namespace osu.Game.Overlays.FirstRunSetup }, }; - stack.Push(screen); + // intentionally load synchronously so it is included in the initial load of the first run screen. + stack.PushSynchronously(screen); } } } diff --git a/osu.Game/Screens/OsuScreenStack.cs b/osu.Game/Screens/OsuScreenStack.cs index ebbcbd7650..18b16ba865 100644 --- a/osu.Game/Screens/OsuScreenStack.cs +++ b/osu.Game/Screens/OsuScreenStack.cs @@ -29,6 +29,13 @@ namespace osu.Game.Screens ScreenExited += ScreenChanged; } + public void PushSynchronously(OsuScreen screen) + { + LoadComponent(screen); + + Push(screen); + } + private void screenPushed(IScreen prev, IScreen next) { if (LoadState < LoadState.Ready) From cac6d5569c8dbd1282330ffadf5a2d20bb0d0cb5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 19:07:00 +0900 Subject: [PATCH 0909/2328] Fix incorrect variable reference in log output --- osu.Game/OsuGameBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index c5b69a3637..3a35bce05c 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -524,7 +524,7 @@ namespace osu.Game { bool continueExecution = Interlocked.Decrement(ref allowableExceptions) >= 0; - Logger.Log($"Unhandled exception has been {(continueExecution ? $"allowed with {SoftHandledExceptions} more allowable exceptions" : "denied")} ."); + Logger.Log($"Unhandled exception has been {(continueExecution ? $"allowed with {allowableExceptions} more allowable exceptions" : "denied")} ."); // restore the stock of allowable exceptions after a short delay. Task.Delay(1000).ContinueWith(_ => Interlocked.Increment(ref allowableExceptions)); From 4d22f262667972c4bf20cf1c117d8a7e1e5f2f45 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 19:07:07 +0900 Subject: [PATCH 0910/2328] Rename property and improve xmldoc --- osu.Game.Tournament/TournamentGame.cs | 2 +- osu.Game/OsuGame.cs | 2 +- osu.Game/OsuGameBase.cs | 11 ++++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index d9db0e6d20..042e660122 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -40,7 +40,7 @@ namespace osu.Game.Tournament private Bindable windowMode; private LoadingSpinner loadingSpinner; - protected override int SoftHandledExceptions => DebugUtils.IsDebugBuild ? 0 : 1; + protected override int ExceptionsBeforeCrash => DebugUtils.IsDebugBuild ? 0 : 1; [BackgroundDependencyLoader] private void load(FrameworkConfigManager frameworkConfig, GameHost host) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 6961dce910..0cfb3c2de8 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -176,7 +176,7 @@ namespace osu.Game private readonly List visibleBlockingOverlays = new List(); - protected override int SoftHandledExceptions => DebugUtils.IsDebugBuild ? 0 : 1; + protected override int ExceptionsBeforeCrash => DebugUtils.IsDebugBuild ? 0 : 1; public OsuGame(string[] args = null) { diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 3a35bce05c..b17526114a 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -182,15 +182,20 @@ namespace osu.Game protected DatabaseContextFactory EFContextFactory { get; private set; } /// - /// Number of exceptions to allow before aborting execution. + /// Number of unhandled exceptions to allow before aborting execution. /// - protected virtual int SoftHandledExceptions => 0; + /// + /// When an unhandled exception is encountered, an internal count will be decremented. + /// If the count hits zero, the game will crash. + /// Each second, the count is incremented until reaching the value specified. + /// + protected virtual int ExceptionsBeforeCrash => 0; public OsuGameBase() { Name = @"osu!"; - allowableExceptions = SoftHandledExceptions; + allowableExceptions = ExceptionsBeforeCrash; } [BackgroundDependencyLoader] From b2a57c34bbea091d2e172c03a05c9481e9312bc7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 19:10:34 +0900 Subject: [PATCH 0911/2328] Move implementation to base --- osu.Game.Tournament/TournamentGame.cs | 3 --- osu.Game/OsuGame.cs | 3 --- osu.Game/OsuGameBase.cs | 4 ++-- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index 042e660122..7967f54b49 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -6,7 +6,6 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Configuration; -using osu.Framework.Development; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -40,8 +39,6 @@ namespace osu.Game.Tournament private Bindable windowMode; private LoadingSpinner loadingSpinner; - protected override int ExceptionsBeforeCrash => DebugUtils.IsDebugBuild ? 0 : 1; - [BackgroundDependencyLoader] private void load(FrameworkConfigManager frameworkConfig, GameHost host) { diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 0cfb3c2de8..54c4231b06 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -13,7 +13,6 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Configuration; -using osu.Framework.Development; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -176,8 +175,6 @@ namespace osu.Game private readonly List visibleBlockingOverlays = new List(); - protected override int ExceptionsBeforeCrash => DebugUtils.IsDebugBuild ? 0 : 1; - public OsuGame(string[] args = null) { this.args = args; diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index b17526114a..ce798d4027 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -189,13 +189,13 @@ namespace osu.Game /// If the count hits zero, the game will crash. /// Each second, the count is incremented until reaching the value specified. /// - protected virtual int ExceptionsBeforeCrash => 0; + protected virtual int UnhandledExceptionsBeforeCrash => DebugUtils.IsDebugBuild ? 0 : 1; public OsuGameBase() { Name = @"osu!"; - allowableExceptions = ExceptionsBeforeCrash; + allowableExceptions = UnhandledExceptionsBeforeCrash; } [BackgroundDependencyLoader] From 42fe7082250654233c6c78074a61cfbfec0866fb Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 10 May 2022 19:56:21 +0900 Subject: [PATCH 0912/2328] Fix inspection --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index c0eed14c99..cebb2f5e3b 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -91,7 +91,7 @@ namespace osu.Game.Overlays Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Bottom = 20, }, - Child = new GridContainer() + Child = new GridContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, From 87f6f74795beb592dd50e5994f2f48bca590eac6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 21:03:55 +0900 Subject: [PATCH 0913/2328] Add failing test coverage of adding a file to a detached beatmap across threads --- .../Database/BeatmapImporterTests.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index f9c13a8169..b7bfe14402 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -136,6 +136,37 @@ namespace osu.Game.Tests.Database }); } + [Test] + public void TestAddFileToAsyncImportedBeatmap() + { + RunTestWithRealm((realm, storage) => + { + BeatmapSetInfo? detachedSet = null; + + using (var importer = new BeatmapModelManager(realm, storage)) + using (new RealmRulesetStore(realm, storage)) + { + Task.Run(async () => + { + Live? beatmapSet; + + using (var reader = new ZipArchiveReader(TestResources.GetTestBeatmapStream())) + // ReSharper disable once AccessToDisposedClosure + beatmapSet = await importer.Import(reader); + + Assert.NotNull(beatmapSet); + Debug.Assert(beatmapSet != null); + + // Intentionally detach on async thread as to not trigger a refresh on the main thread. + beatmapSet.PerformRead(s => detachedSet = s.Detach()); + }).WaitSafely(); + + Debug.Assert(detachedSet != null); + importer.AddFile(detachedSet, new MemoryStream(), "test"); + } + }); + } + [Test] public void TestImportBeatmapThenCleanup() { From 33f024212ffaaa1d70c38b20ff46e42b77fd8654 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 20:47:26 +0900 Subject: [PATCH 0914/2328] Fix realm refetch operations potentially being unsafe As seen in test failure https://github.com/ppy/osu/runs/6357384721?check_suite_focus=true. --- osu.Game/Database/RealmAccess.cs | 20 +++++++++++++++++ osu.Game/Stores/RealmArchiveModelManager.cs | 25 ++++++++++++++------- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index b0a70b51d0..937876a70e 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -344,6 +344,26 @@ namespace osu.Game.Database } } + /// + /// Write changes to realm. + /// + /// The work to run. + public T Write(Func action) + { + if (ThreadSafety.IsUpdateThread) + { + total_writes_update.Value++; + return Realm.Write(action); + } + else + { + total_writes_async.Value++; + + using (var realm = getRealmInstance()) + return realm.Write(action); + } + } + /// /// Write changes to realm. /// diff --git a/osu.Game/Stores/RealmArchiveModelManager.cs b/osu.Game/Stores/RealmArchiveModelManager.cs index 57e51b79aa..e349efe5ad 100644 --- a/osu.Game/Stores/RealmArchiveModelManager.cs +++ b/osu.Game/Stores/RealmArchiveModelManager.cs @@ -45,11 +45,16 @@ namespace osu.Game.Stores // This method should be removed as soon as all the surrounding pieces support non-detached operations. if (!item.IsManaged) { - var managed = Realm.Realm.Find(item.ID); - managed.Realm.Write(() => operation(managed)); + // Importantly, begin the realm write *before* re-fetching, else the update realm may not be in a consistent state + // (ie. if an async import finished very recently). + Realm.Realm.Write(realm => + { + var managed = Realm.Realm.Find(item.ID); + operation(managed); - item.Files.Clear(); - item.Files.AddRange(managed.Files.Detach()); + item.Files.Clear(); + item.Files.AddRange(managed.Files.Detach()); + }); } else operation(item); @@ -165,7 +170,9 @@ namespace osu.Game.Stores public bool Delete(TModel item) { - return Realm.Run(realm => + // Importantly, begin the realm write *before* re-fetching, else the update realm may not be in a consistent state + // (ie. if an async import finished very recently). + return Realm.Write(realm => { if (!item.IsManaged) item = realm.Find(item.ID); @@ -173,14 +180,16 @@ namespace osu.Game.Stores if (item?.DeletePending != false) return false; - realm.Write(r => item.DeletePending = true); + item.DeletePending = true; return true; }); } public void Undelete(TModel item) { - Realm.Run(realm => + // Importantly, begin the realm write *before* re-fetching, else the update realm may not be in a consistent state + // (ie. if an async import finished very recently). + Realm.Write(realm => { if (!item.IsManaged) item = realm.Find(item.ID); @@ -188,7 +197,7 @@ namespace osu.Game.Stores if (item?.DeletePending != true) return; - realm.Write(r => item.DeletePending = false); + item.DeletePending = false; }); } From 0eb29d56f258a2febc465de501bc22ef219bbecf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 May 2022 19:46:55 +0900 Subject: [PATCH 0915/2328] Rename new test method to be english --- osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index 661465b484..6e8ed5ebb4 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -482,7 +482,7 @@ namespace osu.Game.Tests.Visual.UserInterface } [Test] - public void TestCorrectAudioAdjustmentDeapplication() + public void TestCorrectAudioAdjustmentAfterPitchAdjustChange() { createScreen(); changeRuleset(0); From bbbecbb6b7bcf080033b3236dc09918957ef5fb8 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 10 May 2022 17:54:34 +0300 Subject: [PATCH 0916/2328] Apply time-ramping adjustment using clock instead of track --- osu.Game/Rulesets/Mods/ModTimeRamp.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Mods/ModTimeRamp.cs b/osu.Game/Rulesets/Mods/ModTimeRamp.cs index fe6d54332c..12046d1577 100644 --- a/osu.Game/Rulesets/Mods/ModTimeRamp.cs +++ b/osu.Game/Rulesets/Mods/ModTimeRamp.cs @@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Mods public virtual void Update(Playfield playfield) { - applyRateAdjustment(track.CurrentTime); + applyRateAdjustment(playfield.Clock.CurrentTime); } /// From 4f5001704e6b45a4b9e4a4a47f1cde91eb92c8be Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 10 May 2022 18:01:15 +0300 Subject: [PATCH 0917/2328] Change `IApplicableToTrack` to receive adjustable component instead --- osu.Game/Rulesets/Mods/IApplicableToTrack.cs | 4 ++-- osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs | 6 ++---- osu.Game/Rulesets/Mods/ModDaycore.cs | 3 +-- osu.Game/Rulesets/Mods/ModMuted.cs | 3 +-- osu.Game/Rulesets/Mods/ModNightcore.cs | 2 +- osu.Game/Rulesets/Mods/ModRateAdjust.cs | 3 +-- osu.Game/Rulesets/Mods/ModTimeRamp.cs | 5 ++--- 7 files changed, 10 insertions(+), 16 deletions(-) diff --git a/osu.Game/Rulesets/Mods/IApplicableToTrack.cs b/osu.Game/Rulesets/Mods/IApplicableToTrack.cs index 9b840cea08..deecd4bf1f 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToTrack.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToTrack.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Audio.Track; +using osu.Framework.Audio; namespace osu.Game.Rulesets.Mods { @@ -10,6 +10,6 @@ namespace osu.Game.Rulesets.Mods /// public interface IApplicableToTrack : IApplicableMod { - void ApplyToTrack(ITrack track); + void ApplyToTrack(IAdjustableAudioComponent track); } } diff --git a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs index 93251f7b2d..c9661662bf 100644 --- a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs +++ b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Audio; -using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Graphics.Audio; using osu.Framework.Utils; @@ -79,7 +78,7 @@ namespace osu.Game.Rulesets.Mods // Apply a fixed rate change when missing, allowing the player to catch up when the rate is too fast. private const double rate_change_on_miss = 0.95d; - private ITrack track; + private IAdjustableAudioComponent track; private double targetRate = 1d; /// @@ -141,7 +140,7 @@ namespace osu.Game.Rulesets.Mods AdjustPitch.BindValueChanged(adjustPitchChanged); } - public void ApplyToTrack(ITrack track) + public void ApplyToTrack(IAdjustableAudioComponent track) { this.track = track; @@ -210,7 +209,6 @@ namespace osu.Game.Rulesets.Mods private void adjustPitchChanged(ValueChangedEvent adjustPitchSetting) { track?.RemoveAdjustment(adjustmentForPitchSetting(adjustPitchSetting.OldValue), SpeedChange); - track?.AddAdjustment(adjustmentForPitchSetting(adjustPitchSetting.NewValue), SpeedChange); } diff --git a/osu.Game/Rulesets/Mods/ModDaycore.cs b/osu.Game/Rulesets/Mods/ModDaycore.cs index 61ad7db706..9e8e44229e 100644 --- a/osu.Game/Rulesets/Mods/ModDaycore.cs +++ b/osu.Game/Rulesets/Mods/ModDaycore.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Audio; -using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; @@ -27,7 +26,7 @@ namespace osu.Game.Rulesets.Mods }, true); } - public override void ApplyToTrack(ITrack track) + public override void ApplyToTrack(IAdjustableAudioComponent track) { // base.ApplyToTrack() intentionally not called (different tempo adjustment is applied) track.AddAdjustment(AdjustableProperty.Frequency, freqAdjust); diff --git a/osu.Game/Rulesets/Mods/ModMuted.cs b/osu.Game/Rulesets/Mods/ModMuted.cs index 1d33b44812..a7d3114f2b 100644 --- a/osu.Game/Rulesets/Mods/ModMuted.cs +++ b/osu.Game/Rulesets/Mods/ModMuted.cs @@ -3,7 +3,6 @@ using System.Linq; using osu.Framework.Audio; -using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; @@ -71,7 +70,7 @@ namespace osu.Game.Rulesets.Mods InverseMuting.BindValueChanged(i => MuteComboCount.MinValue = i.NewValue ? 1 : 0, true); } - public void ApplyToTrack(ITrack track) + public void ApplyToTrack(IAdjustableAudioComponent track) { track.AddAdjustment(AdjustableProperty.Volume, mainVolumeAdjust); } diff --git a/osu.Game/Rulesets/Mods/ModNightcore.cs b/osu.Game/Rulesets/Mods/ModNightcore.cs index 993efead33..7997204450 100644 --- a/osu.Game/Rulesets/Mods/ModNightcore.cs +++ b/osu.Game/Rulesets/Mods/ModNightcore.cs @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Mods }, true); } - public override void ApplyToTrack(ITrack track) + public override void ApplyToTrack(IAdjustableAudioComponent track) { // base.ApplyToTrack() intentionally not called (different tempo adjustment is applied) track.AddAdjustment(AdjustableProperty.Frequency, freqAdjust); diff --git a/osu.Game/Rulesets/Mods/ModRateAdjust.cs b/osu.Game/Rulesets/Mods/ModRateAdjust.cs index 05953f903f..49590c30ca 100644 --- a/osu.Game/Rulesets/Mods/ModRateAdjust.cs +++ b/osu.Game/Rulesets/Mods/ModRateAdjust.cs @@ -3,7 +3,6 @@ using System; using osu.Framework.Audio; -using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Graphics.Audio; @@ -15,7 +14,7 @@ namespace osu.Game.Rulesets.Mods public abstract BindableNumber SpeedChange { get; } - public virtual void ApplyToTrack(ITrack track) + public virtual void ApplyToTrack(IAdjustableAudioComponent track) { track.AddAdjustment(AdjustableProperty.Tempo, SpeedChange); } diff --git a/osu.Game/Rulesets/Mods/ModTimeRamp.cs b/osu.Game/Rulesets/Mods/ModTimeRamp.cs index 12046d1577..22d6d4ca29 100644 --- a/osu.Game/Rulesets/Mods/ModTimeRamp.cs +++ b/osu.Game/Rulesets/Mods/ModTimeRamp.cs @@ -4,7 +4,6 @@ using System; using System.Linq; using osu.Framework.Audio; -using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Graphics.Audio; using osu.Game.Beatmaps; @@ -46,7 +45,7 @@ namespace osu.Game.Rulesets.Mods Precision = 0.01, }; - private ITrack track; + private IAdjustableAudioComponent track; protected ModTimeRamp() { @@ -55,7 +54,7 @@ namespace osu.Game.Rulesets.Mods AdjustPitch.BindValueChanged(applyPitchAdjustment); } - public void ApplyToTrack(ITrack track) + public void ApplyToTrack(IAdjustableAudioComponent track) { this.track = track; From 82b784ce5a2b29839ea3b4177c1274bd31eec2d4 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 10 May 2022 18:01:36 +0300 Subject: [PATCH 0918/2328] Change `IApplicableToSample` to receive adjustable component instead Done for consistency with `IApplicableToTrack`. --- osu.Game/Rulesets/Mods/IApplicableToSample.cs | 4 ++-- osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs | 3 +-- osu.Game/Rulesets/Mods/ModRateAdjust.cs | 3 +-- osu.Game/Rulesets/Mods/ModTimeRamp.cs | 3 +-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/osu.Game/Rulesets/Mods/IApplicableToSample.cs b/osu.Game/Rulesets/Mods/IApplicableToSample.cs index 50a6d501b6..efd88f2399 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToSample.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToSample.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Graphics.Audio; +using osu.Framework.Audio; namespace osu.Game.Rulesets.Mods { @@ -10,6 +10,6 @@ namespace osu.Game.Rulesets.Mods /// public interface IApplicableToSample : IApplicableMod { - void ApplyToSample(DrawableSample sample); + void ApplyToSample(IAdjustableAudioComponent sample); } } diff --git a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs index c9661662bf..fb291fe10f 100644 --- a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs +++ b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Audio; using osu.Framework.Bindables; -using osu.Framework.Graphics.Audio; using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Configuration; @@ -150,7 +149,7 @@ namespace osu.Game.Rulesets.Mods recentRates.AddRange(Enumerable.Repeat(InitialRate.Value, recent_rate_count)); } - public void ApplyToSample(DrawableSample sample) + public void ApplyToSample(IAdjustableAudioComponent sample) { sample.AddAdjustment(AdjustableProperty.Frequency, SpeedChange); } diff --git a/osu.Game/Rulesets/Mods/ModRateAdjust.cs b/osu.Game/Rulesets/Mods/ModRateAdjust.cs index 49590c30ca..7b55ba4ad0 100644 --- a/osu.Game/Rulesets/Mods/ModRateAdjust.cs +++ b/osu.Game/Rulesets/Mods/ModRateAdjust.cs @@ -4,7 +4,6 @@ using System; using osu.Framework.Audio; using osu.Framework.Bindables; -using osu.Framework.Graphics.Audio; namespace osu.Game.Rulesets.Mods { @@ -19,7 +18,7 @@ namespace osu.Game.Rulesets.Mods track.AddAdjustment(AdjustableProperty.Tempo, SpeedChange); } - public virtual void ApplyToSample(DrawableSample sample) + public virtual void ApplyToSample(IAdjustableAudioComponent sample) { sample.AddAdjustment(AdjustableProperty.Frequency, SpeedChange); } diff --git a/osu.Game/Rulesets/Mods/ModTimeRamp.cs b/osu.Game/Rulesets/Mods/ModTimeRamp.cs index 22d6d4ca29..98abda872b 100644 --- a/osu.Game/Rulesets/Mods/ModTimeRamp.cs +++ b/osu.Game/Rulesets/Mods/ModTimeRamp.cs @@ -5,7 +5,6 @@ using System; using System.Linq; using osu.Framework.Audio; using osu.Framework.Bindables; -using osu.Framework.Graphics.Audio; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Rulesets.Objects; @@ -62,7 +61,7 @@ namespace osu.Game.Rulesets.Mods AdjustPitch.TriggerChange(); } - public void ApplyToSample(DrawableSample sample) + public void ApplyToSample(IAdjustableAudioComponent sample) { sample.AddAdjustment(AdjustableProperty.Frequency, SpeedChange); } From 725ff93f34e9b49cca90e1006089d512e9891f06 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 10 May 2022 18:02:32 +0300 Subject: [PATCH 0919/2328] Define local adjustments component for mods in `MusicController` Isolates `CurrentTrack` from being directly adjusted by the mod, which could lead to issues depending on how the mod adds adjustments (i.e. `ModTimeRamp`, which adds adjustments based on changes to a setting bindable). --- osu.Game/Overlays/MusicController.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 5fc0da8891..0373856ace 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -377,6 +377,8 @@ namespace osu.Game.Overlays } } + private readonly AudioAdjustments modTrackAdjustments = new AudioAdjustments(); + /// /// Resets the adjustments currently applied on and applies the mod adjustments if is true. /// @@ -385,15 +387,27 @@ namespace osu.Game.Overlays /// public void ResetTrackAdjustments() { + // todo: we probably want a helper method rather than this. CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Balance); CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Frequency); CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Tempo); CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Volume); - if (allowTrackAdjustments) + modTrackAdjustments.RemoveAllAdjustments(AdjustableProperty.Balance); + modTrackAdjustments.RemoveAllAdjustments(AdjustableProperty.Frequency); + modTrackAdjustments.RemoveAllAdjustments(AdjustableProperty.Tempo); + modTrackAdjustments.RemoveAllAdjustments(AdjustableProperty.Volume); + + var applicableToTrack = mods.Value.OfType(); + + if (!allowTrackAdjustments || !applicableToTrack.Any()) + CurrentTrack.UnbindAdjustments(modTrackAdjustments); + else { - foreach (var mod in mods.Value.OfType()) - mod.ApplyToTrack(CurrentTrack); + CurrentTrack.BindAdjustments(modTrackAdjustments); + + foreach (var mod in applicableToTrack) + mod.ApplyToTrack(modTrackAdjustments); } } } From ec231e0f312eeeecb8229a0fe1ee0660935b455f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 May 2022 00:45:17 +0900 Subject: [PATCH 0920/2328] Use more local realm reference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- osu.Game/Stores/RealmArchiveModelManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Stores/RealmArchiveModelManager.cs b/osu.Game/Stores/RealmArchiveModelManager.cs index e349efe5ad..cc8229b436 100644 --- a/osu.Game/Stores/RealmArchiveModelManager.cs +++ b/osu.Game/Stores/RealmArchiveModelManager.cs @@ -49,7 +49,7 @@ namespace osu.Game.Stores // (ie. if an async import finished very recently). Realm.Realm.Write(realm => { - var managed = Realm.Realm.Find(item.ID); + var managed = realm.Find(item.ID); operation(managed); item.Files.Clear(); From a0f1c48e806ff64f6c58b521b43c1d87f3d83e0b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 10 May 2022 19:24:36 +0300 Subject: [PATCH 0921/2328] Fix `ModTimeRampTest` failing due to changes in `Update` method --- osu.Game.Tests/Rulesets/Mods/ModTimeRampTest.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Rulesets/Mods/ModTimeRampTest.cs b/osu.Game.Tests/Rulesets/Mods/ModTimeRampTest.cs index 4b9f2181dc..51163efd6a 100644 --- a/osu.Game.Tests/Rulesets/Mods/ModTimeRampTest.cs +++ b/osu.Game.Tests/Rulesets/Mods/ModTimeRampTest.cs @@ -3,9 +3,11 @@ using NUnit.Framework; using osu.Framework.Audio.Track; +using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.UI; namespace osu.Game.Tests.Rulesets.Mods { @@ -16,11 +18,14 @@ namespace osu.Game.Tests.Rulesets.Mods private const double duration = 9000; private TrackVirtual track; + private OsuPlayfield playfield; [SetUp] public void SetUp() { track = new TrackVirtual(20_000); + // define a fake playfield to re-calculate the current rate by ModTimeRamp.Update(Playfield). + playfield = new OsuPlayfield { Clock = new FramedClock(track) }; } [TestCase(0, 1)] @@ -80,8 +85,8 @@ namespace osu.Game.Tests.Rulesets.Mods private void seekTrackAndUpdateMod(ModTimeRamp mod, double time) { track.Seek(time); - // update the mod via a fake playfield to re-calculate the current rate. - mod.Update(null); + playfield.Clock.ProcessFrame(); + mod.Update(playfield); } private static Beatmap createSingleSpinnerBeatmap() From 36a764416400d2d8f77793a1e258f5f7d092742a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 10 May 2022 20:46:31 +0300 Subject: [PATCH 0922/2328] Reinstantiate mod adjustments layer for safety against previous mods --- osu.Game/Overlays/MusicController.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 0373856ace..50495d0a2c 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -377,7 +377,7 @@ namespace osu.Game.Overlays } } - private readonly AudioAdjustments modTrackAdjustments = new AudioAdjustments(); + private AudioAdjustments modTrackAdjustments; /// /// Resets the adjustments currently applied on and applies the mod adjustments if is true. @@ -393,18 +393,19 @@ namespace osu.Game.Overlays CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Tempo); CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Volume); - modTrackAdjustments.RemoveAllAdjustments(AdjustableProperty.Balance); - modTrackAdjustments.RemoveAllAdjustments(AdjustableProperty.Frequency); - modTrackAdjustments.RemoveAllAdjustments(AdjustableProperty.Tempo); - modTrackAdjustments.RemoveAllAdjustments(AdjustableProperty.Volume); - var applicableToTrack = mods.Value.OfType(); if (!allowTrackAdjustments || !applicableToTrack.Any()) - CurrentTrack.UnbindAdjustments(modTrackAdjustments); + { + if (modTrackAdjustments != null) + { + CurrentTrack.UnbindAdjustments(modTrackAdjustments); + modTrackAdjustments = null; + } + } else { - CurrentTrack.BindAdjustments(modTrackAdjustments); + CurrentTrack.BindAdjustments(modTrackAdjustments = new AudioAdjustments()); foreach (var mod in applicableToTrack) mod.ApplyToTrack(modTrackAdjustments); From 9446be251117f6b904c67b09aea0155b535738a6 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 10 May 2022 20:49:15 +0300 Subject: [PATCH 0923/2328] Remove unnecessary `UnbindAdjustments` call It is not necessary given that `CurrentTrack` already removes all adjustments first. --- osu.Game/Overlays/MusicController.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 50495d0a2c..65b06eb864 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -393,21 +393,11 @@ namespace osu.Game.Overlays CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Tempo); CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Volume); - var applicableToTrack = mods.Value.OfType(); - - if (!allowTrackAdjustments || !applicableToTrack.Any()) - { - if (modTrackAdjustments != null) - { - CurrentTrack.UnbindAdjustments(modTrackAdjustments); - modTrackAdjustments = null; - } - } - else + if (allowTrackAdjustments) { CurrentTrack.BindAdjustments(modTrackAdjustments = new AudioAdjustments()); - foreach (var mod in applicableToTrack) + foreach (var mod in mods.Value.OfType()) mod.ApplyToTrack(modTrackAdjustments); } } From 9cfe2cc310b916f2ca78ca1daefd256a777f2dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 10 May 2022 21:43:57 +0200 Subject: [PATCH 0924/2328] Move `TestCustomisableModRuleset` out of `TestSceneModSettings` --- .../Mods/TestCustomisableModRuleset.cs | 80 +++++++++++++++++++ .../Gameplay/TestSceneReplayRecorder.cs | 6 +- .../Gameplay/TestSceneSpectatorPlayback.cs | 6 +- .../UserInterface/TestSceneModSettings.cs | 78 +----------------- 4 files changed, 90 insertions(+), 80 deletions(-) create mode 100644 osu.Game.Tests/Mods/TestCustomisableModRuleset.cs diff --git a/osu.Game.Tests/Mods/TestCustomisableModRuleset.cs b/osu.Game.Tests/Mods/TestCustomisableModRuleset.cs new file mode 100644 index 0000000000..3992d9abe6 --- /dev/null +++ b/osu.Game.Tests/Mods/TestCustomisableModRuleset.cs @@ -0,0 +1,80 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using osu.Framework.Bindables; +using osu.Game.Beatmaps; +using osu.Game.Configuration; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.UI; + +namespace osu.Game.Tests.Mods +{ + public class TestCustomisableModRuleset : Ruleset + { + public static RulesetInfo CreateTestRulesetInfo() => new TestCustomisableModRuleset().RulesetInfo; + + public override IEnumerable GetModsFor(ModType type) + { + if (type == ModType.Conversion) + { + return new Mod[] + { + new TestModCustomisable1(), + new TestModCustomisable2() + }; + } + + return Array.Empty(); + } + + public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList mods = null) => throw new NotImplementedException(); + + public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => throw new NotImplementedException(); + + public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => throw new NotImplementedException(); + + public override string Description { get; } = "test"; + public override string ShortName { get; } = "tst"; + + public class TestModCustomisable1 : TestModCustomisable + { + public override string Name => "Customisable Mod 1"; + + public override string Acronym => "CM1"; + } + + public class TestModCustomisable2 : TestModCustomisable + { + public override string Name => "Customisable Mod 2"; + + public override string Acronym => "CM2"; + + public override bool RequiresConfiguration => true; + } + + public abstract class TestModCustomisable : Mod, IApplicableMod + { + public override double ScoreMultiplier => 1.0; + + public override string Description => "This is a customisable test mod."; + + public override ModType Type => ModType.Conversion; + + [SettingSource("Sample float", "Change something for a mod")] + public BindableFloat SliderBindable { get; } = new BindableFloat + { + MinValue = 0, + MaxValue = 10, + Default = 5, + Value = 7 + }; + + [SettingSource("Sample bool", "Clicking this changes a setting")] + public BindableBool TickBindable { get; } = new BindableBool(); + } + } +} diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs index 8df32c500e..81763564fa 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs @@ -24,7 +24,7 @@ using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.UI; using osu.Game.Scoring; using osu.Game.Screens.Play; -using osu.Game.Tests.Visual.UserInterface; +using osu.Game.Tests.Mods; using osuTK; using osuTK.Graphics; using osuTK.Input; @@ -59,7 +59,7 @@ namespace osu.Game.Tests.Visual.Gameplay { new Drawable[] { - recordingManager = new TestRulesetInputManager(TestSceneModSettings.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique) + recordingManager = new TestRulesetInputManager(TestCustomisableModRuleset.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique) { Recorder = recorder = new TestReplayRecorder(new Score { @@ -97,7 +97,7 @@ namespace osu.Game.Tests.Visual.Gameplay }, new Drawable[] { - playbackManager = new TestRulesetInputManager(TestSceneModSettings.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique) + playbackManager = new TestRulesetInputManager(TestCustomisableModRuleset.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique) { ReplayInputHandler = new TestFramedReplayInputHandler(replay) { diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs index 4ec46036f6..f8748922cf 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs @@ -27,8 +27,8 @@ using osu.Game.Rulesets.Replays.Types; using osu.Game.Rulesets.UI; using osu.Game.Scoring; using osu.Game.Screens.Play; +using osu.Game.Tests.Mods; using osu.Game.Tests.Visual.Spectator; -using osu.Game.Tests.Visual.UserInterface; using osuTK; using osuTK.Graphics; @@ -77,7 +77,7 @@ namespace osu.Game.Tests.Visual.Gameplay { new Drawable[] { - recordingManager = new TestRulesetInputManager(TestSceneModSettings.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique) + recordingManager = new TestRulesetInputManager(TestCustomisableModRuleset.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique) { Recorder = recorder = new TestReplayRecorder { @@ -107,7 +107,7 @@ namespace osu.Game.Tests.Visual.Gameplay }, new Drawable[] { - playbackManager = new TestRulesetInputManager(TestSceneModSettings.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique) + playbackManager = new TestRulesetInputManager(TestCustomisableModRuleset.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique) { Clock = new FramedClock(manualClock), ReplayInputHandler = replayHandler = new TestFramedReplayInputHandler(replay) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSettings.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSettings.cs index 9a3083e8db..379735a7f5 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSettings.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSettings.cs @@ -5,20 +5,15 @@ using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Utils; using osu.Framework.Testing; -using osu.Game.Beatmaps; -using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; -using osu.Game.Rulesets; -using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Mods; -using osu.Game.Rulesets.UI; +using osu.Game.Tests.Mods; using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface @@ -27,15 +22,15 @@ namespace osu.Game.Tests.Visual.UserInterface { private TestModSelectOverlay modSelect; - private readonly Mod testCustomisableMod = new TestModCustomisable1(); + private readonly Mod testCustomisableMod = new TestCustomisableModRuleset.TestModCustomisable1(); - private readonly Mod testCustomisableAutoOpenMod = new TestModCustomisable2(); + private readonly Mod testCustomisableAutoOpenMod = new TestCustomisableModRuleset.TestModCustomisable2(); [SetUp] public void SetUp() => Schedule(() => { SelectedMods.Value = Array.Empty(); - Ruleset.Value = CreateTestRulesetInfo(); + Ruleset.Value = TestCustomisableModRuleset.CreateTestRulesetInfo(); }); [Test] @@ -169,70 +164,5 @@ namespace osu.Game.Tests.Visual.UserInterface public void SetModSettingsWidth(float newWidth) => ModSettingsContainer.Parent.Width = newWidth; } - - public static RulesetInfo CreateTestRulesetInfo() => new TestCustomisableModRuleset().RulesetInfo; - - public class TestCustomisableModRuleset : Ruleset - { - public override IEnumerable GetModsFor(ModType type) - { - if (type == ModType.Conversion) - { - return new Mod[] - { - new TestModCustomisable1(), - new TestModCustomisable2() - }; - } - - return Array.Empty(); - } - - public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList mods = null) => throw new NotImplementedException(); - - public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => throw new NotImplementedException(); - - public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => throw new NotImplementedException(); - - public override string Description { get; } = "test"; - public override string ShortName { get; } = "tst"; - } - - private class TestModCustomisable1 : TestModCustomisable - { - public override string Name => "Customisable Mod 1"; - - public override string Acronym => "CM1"; - } - - private class TestModCustomisable2 : TestModCustomisable - { - public override string Name => "Customisable Mod 2"; - - public override string Acronym => "CM2"; - - public override bool RequiresConfiguration => true; - } - - private abstract class TestModCustomisable : Mod, IApplicableMod - { - public override double ScoreMultiplier => 1.0; - - public override string Description => "This is a customisable test mod."; - - public override ModType Type => ModType.Conversion; - - [SettingSource("Sample float", "Change something for a mod")] - public BindableFloat SliderBindable { get; } = new BindableFloat - { - MinValue = 0, - MaxValue = 10, - Default = 5, - Value = 7 - }; - - [SettingSource("Sample bool", "Clicking this changes a setting")] - public BindableBool TickBindable { get; } = new BindableBool(); - } } } From 4a3447f59f69af6b591f4c6c44f5b3422b229b58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 10 May 2022 21:45:57 +0200 Subject: [PATCH 0925/2328] Remove old free mod select overlay --- .../TestSceneFreeModSelectOverlay.cs | 21 --- .../OnlinePlay/FreeModSelectOverlay.cs | 157 ------------------ 2 files changed, 178 deletions(-) delete mode 100644 osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs delete mode 100644 osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs deleted file mode 100644 index 26a0301d8a..0000000000 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs +++ /dev/null @@ -1,21 +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 NUnit.Framework; -using osu.Framework.Graphics.Containers; -using osu.Game.Screens.OnlinePlay; - -namespace osu.Game.Tests.Visual.Multiplayer -{ - public class TestSceneFreeModSelectOverlay : MultiplayerTestScene - { - [SetUp] - public new void Setup() => Schedule(() => - { - Child = new FreeModSelectOverlay - { - State = { Value = Visibility.Visible } - }; - }); - } -} diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs deleted file mode 100644 index d5abaaab4e..0000000000 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs +++ /dev/null @@ -1,157 +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 System; -using System.Linq; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; -using osu.Game.Overlays.Mods; -using osu.Game.Rulesets.Mods; - -namespace osu.Game.Screens.OnlinePlay -{ - /// - /// A used for free-mod selection in online play. - /// - public class FreeModSelectOverlay : ModSelectOverlay - { - protected override bool Stacked => false; - - protected override bool AllowConfiguration => false; - - public new Func IsValidMod - { - get => base.IsValidMod; - set => base.IsValidMod = m => m.HasImplementation && m.UserPlayable && value(m); - } - - public FreeModSelectOverlay() - { - IsValidMod = m => true; - - DeselectAllButton.Alpha = 0; - - Drawable selectAllButton; - Drawable deselectAllButton; - - FooterContainer.AddRange(new[] - { - selectAllButton = new TriangleButton - { - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - Width = 180, - Text = "Select All", - Action = selectAll, - }, - // Unlike the base mod select overlay, this button deselects mods instantaneously. - deselectAllButton = new TriangleButton - { - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - Width = 180, - Text = "Deselect All", - Action = deselectAll, - }, - }); - - FooterContainer.SetLayoutPosition(selectAllButton, -2); - FooterContainer.SetLayoutPosition(deselectAllButton, -1); - } - - private void selectAll() - { - foreach (var section in ModSectionsContainer.Children) - section.SelectAll(); - } - - private void deselectAll() - { - foreach (var section in ModSectionsContainer.Children) - section.DeselectAll(); - } - - protected override void OnAvailableModsChanged() - { - base.OnAvailableModsChanged(); - - foreach (var section in ModSectionsContainer.Children) - ((FreeModSection)section).UpdateCheckboxState(); - } - - protected override ModSection CreateModSection(ModType type) => new FreeModSection(type); - - private class FreeModSection : ModSection - { - private HeaderCheckbox checkbox; - - public FreeModSection(ModType type) - : base(type) - { - } - - protected override Drawable CreateHeader(string text) => new Container - { - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Child = checkbox = new HeaderCheckbox - { - LabelText = text, - Changed = onCheckboxChanged - } - }; - - private void onCheckboxChanged(bool value) - { - if (value) - SelectAll(); - else - DeselectAll(); - } - - protected override void ModButtonStateChanged(Mod mod) - { - base.ModButtonStateChanged(mod); - UpdateCheckboxState(); - } - - public void UpdateCheckboxState() - { - if (!SelectionAnimationRunning) - { - var validButtons = Buttons.Where(b => b.Mod.HasImplementation); - checkbox.Current.Value = validButtons.All(b => b.Selected); - } - } - } - - private class HeaderCheckbox : OsuCheckbox - { - public Action Changed; - - protected override bool PlaySoundsOnUserChange => false; - - public HeaderCheckbox() - : base(false) - - { - } - - protected override void ApplyLabelParameters(SpriteText text) - { - base.ApplyLabelParameters(text); - - text.Font = OsuFont.GetFont(weight: FontWeight.Bold); - } - - protected override void OnUserChange(bool value) - { - base.OnUserChange(value); - Changed?.Invoke(value); - } - } - } -} From 24c59e2f2fa942769843ebd8afd299c4008c3c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 10 May 2022 21:48:21 +0200 Subject: [PATCH 0926/2328] Remove old user mod select overlay --- .../TestSceneModSelectOverlay.cs | 472 ------------------ .../UserInterface/TestSceneModSettings.cs | 119 ----- .../IncompatibilityDisplayingModButton.cs | 66 --- .../Overlays/Mods/UserModSelectOverlay.cs | 30 -- 4 files changed, 687 deletions(-) delete mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs delete mode 100644 osu.Game/Overlays/Mods/IncompatibilityDisplayingModButton.cs delete mode 100644 osu.Game/Overlays/Mods/UserModSelectOverlay.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs deleted file mode 100644 index b429619044..0000000000 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs +++ /dev/null @@ -1,472 +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 System; -using System.Collections.Generic; -using System.Linq; -using NUnit.Framework; -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Testing; -using osu.Game.Graphics.UserInterface; -using osu.Game.Overlays.Mods; -using osu.Game.Overlays.Settings; -using osu.Game.Rulesets; -using osu.Game.Rulesets.Mania; -using osu.Game.Rulesets.Mania.Mods; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Osu; -using osu.Game.Rulesets.Osu.Mods; -using osu.Game.Screens.Play.HUD; -using osuTK; -using osuTK.Graphics; - -namespace osu.Game.Tests.Visual.UserInterface -{ - [Description("mod select and icon display")] - public class TestSceneModSelectOverlay : OsuTestScene - { - private RulesetStore rulesets; - private ModDisplay modDisplay; - private TestModSelectOverlay modSelect; - - [BackgroundDependencyLoader] - private void load(RulesetStore rulesets) - { - this.rulesets = rulesets; - } - - [SetUp] - public void SetUp() => Schedule(() => - { - SelectedMods.Value = Array.Empty(); - createDisplay(() => new TestModSelectOverlay()); - }); - - [SetUpSteps] - public void SetUpSteps() - { - AddStep("show", () => modSelect.Show()); - } - - /// - /// Ensure that two mod overlays are not cross polluting via central settings instances. - /// - [Test] - public void TestSettingsNotCrossPolluting() - { - Bindable> selectedMods2 = null; - - AddStep("select diff adjust", () => SelectedMods.Value = new Mod[] { new OsuModDifficultyAdjust() }); - - AddStep("set setting", () => modSelect.ChildrenOfType>().First().Current.Value = 8); - - AddAssert("ensure setting is propagated", () => SelectedMods.Value.OfType().Single().CircleSize.Value == 8); - - AddStep("create second bindable", () => selectedMods2 = new Bindable>(new Mod[] { new OsuModDifficultyAdjust() })); - - AddStep("create second overlay", () => - { - Add(modSelect = new TestModSelectOverlay().With(d => - { - d.Origin = Anchor.TopCentre; - d.Anchor = Anchor.TopCentre; - d.SelectedMods.BindTarget = selectedMods2; - })); - }); - - AddStep("show", () => modSelect.Show()); - - AddAssert("ensure first is unchanged", () => SelectedMods.Value.OfType().Single().CircleSize.Value == 8); - AddAssert("ensure second is default", () => selectedMods2.Value.OfType().Single().CircleSize.Value == null); - } - - [Test] - public void TestSettingsResetOnDeselection() - { - var osuModDoubleTime = new OsuModDoubleTime { SpeedChange = { Value = 1.2 } }; - - changeRuleset(0); - - AddStep("set dt mod with custom rate", () => { SelectedMods.Value = new[] { osuModDoubleTime }; }); - - AddAssert("selected mod matches", () => (SelectedMods.Value.Single() as OsuModDoubleTime)?.SpeedChange.Value == 1.2); - - AddStep("deselect", () => modSelect.DeselectAllButton.TriggerClick()); - AddAssert("selected mods empty", () => SelectedMods.Value.Count == 0); - - AddStep("reselect", () => modSelect.GetModButton(osuModDoubleTime).TriggerClick()); - AddAssert("selected mod has default value", () => (SelectedMods.Value.Single() as OsuModDoubleTime)?.SpeedChange.IsDefault == true); - } - - [Test] - public void TestAnimationFlushOnClose() - { - changeRuleset(0); - - AddStep("Select all fun mods", () => - { - modSelect.ModSectionsContainer - .Single(c => c.ModType == ModType.DifficultyIncrease) - .SelectAll(); - }); - - AddUntilStep("many mods selected", () => modDisplay.Current.Value.Count >= 5); - - AddStep("trigger deselect and close overlay", () => - { - modSelect.ModSectionsContainer - .Single(c => c.ModType == ModType.DifficultyIncrease) - .DeselectAll(); - - modSelect.Hide(); - }); - - AddAssert("all mods deselected", () => modDisplay.Current.Value.Count == 0); - } - - [Test] - public void TestOsuMods() - { - changeRuleset(0); - - var osu = new OsuRuleset(); - - var easierMods = osu.GetModsFor(ModType.DifficultyReduction); - var harderMods = osu.GetModsFor(ModType.DifficultyIncrease); - - var noFailMod = osu.GetModsFor(ModType.DifficultyReduction).FirstOrDefault(m => m is OsuModNoFail); - - var doubleTimeMod = harderMods.OfType().FirstOrDefault(m => m.Mods.Any(a => a is OsuModDoubleTime)); - - var easy = easierMods.FirstOrDefault(m => m is OsuModEasy); - var hardRock = harderMods.FirstOrDefault(m => m is OsuModHardRock); - - testSingleMod(noFailMod); - testMultiMod(doubleTimeMod); - testIncompatibleMods(easy, hardRock); - testDeselectAll(easierMods.Where(m => !(m is MultiMod))); - } - - [Test] - public void TestManiaMods() - { - changeRuleset(3); - - var mania = new ManiaRuleset(); - - testModsWithSameBaseType( - mania.CreateMod(), - mania.CreateMod()); - } - - [Test] - public void TestRulesetChanges() - { - changeRuleset(0); - - var noFailMod = new OsuRuleset().GetModsFor(ModType.DifficultyReduction).FirstOrDefault(m => m is OsuModNoFail); - - AddStep("set mods externally", () => { SelectedMods.Value = new[] { noFailMod }; }); - - changeRuleset(0); - - AddAssert("ensure mods still selected", () => modDisplay.Current.Value.SingleOrDefault(m => m is OsuModNoFail) != null); - - changeRuleset(3); - - AddAssert("ensure mods not selected", () => modDisplay.Current.Value.Count == 0); - - changeRuleset(0); - - AddAssert("ensure mods not selected", () => modDisplay.Current.Value.Count == 0); - } - - [Test] - public void TestExternallySetCustomizedMod() - { - changeRuleset(0); - - AddStep("set customized mod externally", () => SelectedMods.Value = new[] { new OsuModDoubleTime { SpeedChange = { Value = 1.01 } } }); - - AddAssert("ensure button is selected and customized accordingly", () => - { - var button = modSelect.GetModButton(SelectedMods.Value.Single()); - return ((OsuModDoubleTime)button.SelectedMod).SpeedChange.Value == 1.01; - }); - } - - [Test] - public void TestSettingsAreRetainedOnReload() - { - changeRuleset(0); - - AddStep("set customized mod externally", () => SelectedMods.Value = new[] { new OsuModDoubleTime { SpeedChange = { Value = 1.01 } } }); - - AddAssert("setting remains", () => (SelectedMods.Value.SingleOrDefault() as OsuModDoubleTime)?.SpeedChange.Value == 1.01); - - AddStep("create overlay", () => createDisplay(() => new TestNonStackedModSelectOverlay())); - - AddAssert("setting remains", () => (SelectedMods.Value.SingleOrDefault() as OsuModDoubleTime)?.SpeedChange.Value == 1.01); - } - - [Test] - public void TestExternallySetModIsReplacedByOverlayInstance() - { - Mod external = new OsuModDoubleTime(); - Mod overlayButtonMod = null; - - changeRuleset(0); - - AddStep("set mod externally", () => { SelectedMods.Value = new[] { external }; }); - - AddAssert("ensure button is selected", () => - { - var button = modSelect.GetModButton(SelectedMods.Value.Single()); - overlayButtonMod = button.SelectedMod; - return overlayButtonMod.GetType() == external.GetType(); - }); - - // Right now, when an external change occurs, the ModSelectOverlay will replace the global instance with its own - AddAssert("mod instance doesn't match", () => external != overlayButtonMod); - - AddAssert("one mod present in global selected", () => SelectedMods.Value.Count == 1); - AddAssert("globally selected matches button's mod instance", () => SelectedMods.Value.Contains(overlayButtonMod)); - AddAssert("globally selected doesn't contain original external change", () => !SelectedMods.Value.Contains(external)); - } - - [Test] - public void TestNonStacked() - { - changeRuleset(0); - - AddStep("create overlay", () => createDisplay(() => new TestNonStackedModSelectOverlay())); - - AddStep("show", () => modSelect.Show()); - - AddAssert("ensure all buttons are spread out", () => modSelect.ChildrenOfType().All(m => m.Mods.Length <= 1)); - } - - [Test] - public void TestChangeIsValidChangesButtonVisibility() - { - changeRuleset(0); - - AddAssert("double time visible", () => modSelect.ChildrenOfType().Any(b => b.Mods.Any(m => m is OsuModDoubleTime))); - - AddStep("make double time invalid", () => modSelect.IsValidMod = m => !(m is OsuModDoubleTime)); - AddUntilStep("double time not visible", () => modSelect.ChildrenOfType().All(b => !b.Mods.Any(m => m is OsuModDoubleTime))); - AddAssert("nightcore still visible", () => modSelect.ChildrenOfType().Any(b => b.Mods.Any(m => m is OsuModNightcore))); - - AddStep("make double time valid again", () => modSelect.IsValidMod = m => true); - AddUntilStep("double time visible", () => modSelect.ChildrenOfType().Any(b => b.Mods.Any(m => m is OsuModDoubleTime))); - AddAssert("nightcore still visible", () => modSelect.ChildrenOfType().Any(b => b.Mods.Any(m => m is OsuModNightcore))); - } - - [Test] - public void TestChangeIsValidPreservesSelection() - { - changeRuleset(0); - - AddStep("select DT + HD", () => SelectedMods.Value = new Mod[] { new OsuModDoubleTime(), new OsuModHidden() }); - AddAssert("DT + HD selected", () => modSelect.ChildrenOfType().Count(b => b.Selected) == 2); - - AddStep("make NF invalid", () => modSelect.IsValidMod = m => !(m is ModNoFail)); - AddAssert("DT + HD still selected", () => modSelect.ChildrenOfType().Count(b => b.Selected) == 2); - } - - [Test] - public void TestUnimplementedModIsUnselectable() - { - var testRuleset = new TestUnimplementedModOsuRuleset(); - changeTestRuleset(testRuleset.RulesetInfo); - - var conversionMods = testRuleset.GetModsFor(ModType.Conversion); - - var unimplementedMod = conversionMods.FirstOrDefault(m => m is TestUnimplementedMod); - - testUnimplementedMod(unimplementedMod); - } - - private void testSingleMod(Mod mod) - { - selectNext(mod); - checkSelected(mod); - - selectPrevious(mod); - checkNotSelected(mod); - - selectNext(mod); - selectNext(mod); - checkNotSelected(mod); - - selectPrevious(mod); - selectPrevious(mod); - checkNotSelected(mod); - } - - private void testMultiMod(MultiMod multiMod) - { - foreach (var mod in multiMod.Mods) - { - selectNext(mod); - checkSelected(mod); - } - - for (int index = multiMod.Mods.Length - 1; index >= 0; index--) - selectPrevious(multiMod.Mods[index]); - - foreach (var mod in multiMod.Mods) - checkNotSelected(mod); - } - - private void testUnimplementedMod(Mod mod) - { - selectNext(mod); - checkNotSelected(mod); - } - - private void testIncompatibleMods(Mod modA, Mod modB) - { - selectNext(modA); - checkSelected(modA); - checkNotSelected(modB); - - selectNext(modB); - checkSelected(modB); - checkNotSelected(modA); - - selectPrevious(modB); - checkNotSelected(modA); - checkNotSelected(modB); - } - - private void testDeselectAll(IEnumerable mods) - { - foreach (var mod in mods) - selectNext(mod); - - AddAssert("check for any selection", () => modSelect.SelectedMods.Value.Any()); - AddStep("deselect all", () => modSelect.DeselectAllButton.Action.Invoke()); - AddAssert("check for no selection", () => !modSelect.SelectedMods.Value.Any()); - } - - private void testModsWithSameBaseType(Mod modA, Mod modB) - { - selectNext(modA); - checkSelected(modA); - selectNext(modB); - checkSelected(modB); - - // Backwards - selectPrevious(modA); - checkSelected(modA); - } - - private void selectNext(Mod mod) => AddStep($"left click {mod.Name}", () => modSelect.GetModButton(mod)?.SelectNext(1)); - - private void selectPrevious(Mod mod) => AddStep($"right click {mod.Name}", () => modSelect.GetModButton(mod)?.SelectNext(-1)); - - private void checkSelected(Mod mod) - { - AddAssert($"check {mod.Name} is selected", () => - { - var button = modSelect.GetModButton(mod); - return modSelect.SelectedMods.Value.SingleOrDefault(m => m.Name == mod.Name) != null && button.SelectedMod.GetType() == mod.GetType() && button.Selected; - }); - } - - private void changeRuleset(int? onlineId) - { - AddStep($"change ruleset to {(onlineId?.ToString() ?? "none")}", () => { Ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault(r => r.OnlineID == onlineId); }); - waitForLoad(); - } - - private void changeTestRuleset(RulesetInfo rulesetInfo) - { - AddStep($"change ruleset to {rulesetInfo.Name}", () => { Ruleset.Value = rulesetInfo; }); - waitForLoad(); - } - - private void waitForLoad() => - AddUntilStep("wait for icons to load", () => modSelect.AllLoaded); - - private void checkNotSelected(Mod mod) - { - AddAssert($"check {mod.Name} is not selected", () => - { - var button = modSelect.GetModButton(mod); - return modSelect.SelectedMods.Value.All(m => m.GetType() != mod.GetType()) && button.SelectedMod?.GetType() != mod.GetType(); - }); - } - - private void createDisplay(Func createOverlayFunc) - { - Children = new Drawable[] - { - modSelect = createOverlayFunc().With(d => - { - d.Origin = Anchor.BottomCentre; - d.Anchor = Anchor.BottomCentre; - d.SelectedMods.BindTarget = SelectedMods; - }), - modDisplay = new ModDisplay - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Position = new Vector2(-5, 25), - Current = { BindTarget = modSelect.SelectedMods } - } - }; - } - - private class TestModSelectOverlay : UserModSelectOverlay - { - public new Bindable> SelectedMods => base.SelectedMods; - - public bool AllLoaded => ModSectionsContainer.Children.All(c => c.ModIconsLoaded); - - public new FillFlowContainer ModSectionsContainer => - base.ModSectionsContainer; - - public ModButton GetModButton(Mod mod) - { - var section = ModSectionsContainer.Children.Single(s => s.ModType == mod.Type); - return section.ButtonsContainer.OfType().Single(b => b.Mods.Any(m => m.GetType() == mod.GetType())); - } - - public new TriangleButton DeselectAllButton => base.DeselectAllButton; - - public new Color4 LowMultiplierColour => base.LowMultiplierColour; - public new Color4 HighMultiplierColour => base.HighMultiplierColour; - } - - private class TestNonStackedModSelectOverlay : TestModSelectOverlay - { - protected override bool Stacked => false; - } - - private class TestUnimplementedMod : Mod - { - public override string Name => "Unimplemented mod"; - public override string Acronym => "UM"; - public override string Description => "A mod that is not implemented."; - public override double ScoreMultiplier => 1; - public override ModType Type => ModType.Conversion; - } - - private class TestUnimplementedModOsuRuleset : OsuRuleset - { - public override string ShortName => "unimplemented"; - - public override IEnumerable GetModsFor(ModType type) - { - if (type == ModType.Conversion) return base.GetModsFor(type).Concat(new[] { new TestUnimplementedMod() }); - - return base.GetModsFor(type); - } - } - } -} diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSettings.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSettings.cs index 379735a7f5..1cf3b2651c 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSettings.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSettings.cs @@ -1,79 +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 System; -using System.Collections.Generic; -using System.Linq; using NUnit.Framework; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Utils; -using osu.Framework.Testing; -using osu.Game.Graphics.UserInterface; -using osu.Game.Overlays.Mods; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Mods; -using osu.Game.Tests.Mods; -using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface { public class TestSceneModSettings : OsuManualInputManagerTestScene { - private TestModSelectOverlay modSelect; - - private readonly Mod testCustomisableMod = new TestCustomisableModRuleset.TestModCustomisable1(); - - private readonly Mod testCustomisableAutoOpenMod = new TestCustomisableModRuleset.TestModCustomisable2(); - - [SetUp] - public void SetUp() => Schedule(() => - { - SelectedMods.Value = Array.Empty(); - Ruleset.Value = TestCustomisableModRuleset.CreateTestRulesetInfo(); - }); - - [Test] - public void TestButtonShowsOnCustomisableMod() - { - createModSelect(); - openModSelect(); - - AddAssert("button disabled", () => !modSelect.CustomiseButton.Enabled.Value); - AddUntilStep("wait for button load", () => modSelect.ButtonsLoaded); - AddStep("select mod", () => modSelect.SelectMod(testCustomisableMod)); - AddAssert("button enabled", () => modSelect.CustomiseButton.Enabled.Value); - AddStep("open Customisation", () => modSelect.CustomiseButton.TriggerClick()); - AddStep("deselect mod", () => modSelect.SelectMod(testCustomisableMod)); - AddAssert("controls hidden", () => modSelect.ModSettingsContainer.State.Value == Visibility.Hidden); - } - - [Test] - public void TestButtonShowsOnModAlreadyAdded() - { - AddStep("set active mods", () => SelectedMods.Value = new List { testCustomisableMod }); - - createModSelect(); - - AddAssert("mods still active", () => SelectedMods.Value.Count == 1); - - openModSelect(); - AddAssert("button enabled", () => modSelect.CustomiseButton.Enabled.Value); - } - - [Test] - public void TestCustomisationMenuVisibility() - { - createModSelect(); - openModSelect(); - - AddAssert("Customisation closed", () => modSelect.ModSettingsContainer.State.Value == Visibility.Hidden); - AddStep("select mod", () => modSelect.SelectMod(testCustomisableAutoOpenMod)); - AddAssert("Customisation opened", () => modSelect.ModSettingsContainer.State.Value == Visibility.Visible); - AddStep("deselect mod", () => modSelect.SelectMod(testCustomisableAutoOpenMod)); - AddAssert("Customisation closed", () => modSelect.ModSettingsContainer.State.Value == Visibility.Hidden); - } - [Test] public void TestModSettingsUnboundWhenCopied() { @@ -109,60 +45,5 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("original has new value", () => Precision.AlmostEquals(2.0, ((OsuModDoubleTime)original.Mods[0]).SpeedChange.Value)); AddAssert("copy has original value", () => Precision.AlmostEquals(1.5, ((OsuModDoubleTime)copy.Mods[0]).SpeedChange.Value)); } - - [Test] - public void TestCustomisationMenuNoClickthrough() - { - createModSelect(); - openModSelect(); - - AddStep("change mod settings menu width to full screen", () => modSelect.SetModSettingsWidth(1.0f)); - AddStep("select cm2", () => modSelect.SelectMod(testCustomisableAutoOpenMod)); - AddAssert("Customisation opened", () => modSelect.ModSettingsContainer.State.Value == Visibility.Visible); - AddStep("hover over mod behind settings menu", () => InputManager.MoveMouseTo(modSelect.GetModButton(testCustomisableMod))); - AddAssert("Mod is not considered hovered over", () => !modSelect.GetModButton(testCustomisableMod).IsHovered); - AddStep("left click mod", () => InputManager.Click(MouseButton.Left)); - AddAssert("only cm2 is active", () => SelectedMods.Value.Count == 1); - AddStep("right click mod", () => InputManager.Click(MouseButton.Right)); - AddAssert("only cm2 is active", () => SelectedMods.Value.Count == 1); - } - - private void createModSelect() - { - AddStep("create mod select", () => - { - Child = modSelect = new TestModSelectOverlay - { - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, - SelectedMods = { BindTarget = SelectedMods } - }; - }); - } - - private void openModSelect() - { - AddStep("open", () => modSelect.Show()); - AddUntilStep("wait for ready", () => modSelect.State.Value == Visibility.Visible && modSelect.ButtonsLoaded); - } - - private class TestModSelectOverlay : UserModSelectOverlay - { - public new VisibilityContainer ModSettingsContainer => base.ModSettingsContainer; - public new TriangleButton CustomiseButton => base.CustomiseButton; - - public bool ButtonsLoaded => ModSectionsContainer.Children.All(c => c.ModIconsLoaded); - - public ModButton GetModButton(Mod mod) - { - return ModSectionsContainer.ChildrenOfType().Single(b => b.Mods.Any(m => m.GetType() == mod.GetType())); - } - - public void SelectMod(Mod mod) => - GetModButton(mod).SelectNext(1); - - public void SetModSettingsWidth(float newWidth) => - ModSettingsContainer.Parent.Width = newWidth; - } } } diff --git a/osu.Game/Overlays/Mods/IncompatibilityDisplayingModButton.cs b/osu.Game/Overlays/Mods/IncompatibilityDisplayingModButton.cs deleted file mode 100644 index 6e2cb40596..0000000000 --- a/osu.Game/Overlays/Mods/IncompatibilityDisplayingModButton.cs +++ /dev/null @@ -1,66 +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 System.Collections.Generic; -using System.Linq; -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; -using osu.Game.Rulesets.Mods; -using osu.Game.Utils; -using osuTK; - -namespace osu.Game.Overlays.Mods -{ - public class IncompatibilityDisplayingModButton : ModButton - { - private readonly CompositeDrawable incompatibleIcon; - - [Resolved] - private Bindable> selectedMods { get; set; } - - public IncompatibilityDisplayingModButton(Mod mod) - : base(mod) - { - ButtonContent.Add(incompatibleIcon = new IncompatibleIcon - { - Anchor = Anchor.BottomRight, - Origin = Anchor.Centre, - Position = new Vector2(-13), - }); - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - selectedMods.BindValueChanged(_ => Scheduler.AddOnce(updateCompatibility), true); - } - - protected override void DisplayMod(Mod mod) - { - base.DisplayMod(mod); - - Scheduler.AddOnce(updateCompatibility); - } - - private void updateCompatibility() - { - var m = SelectedMod ?? Mods.First(); - - bool isIncompatible = false; - - if (selectedMods.Value.Count > 0 && !selectedMods.Value.Contains(m)) - isIncompatible = !ModUtils.CheckCompatibleSet(selectedMods.Value.Append(m)); - - if (isIncompatible) - incompatibleIcon.Show(); - else - incompatibleIcon.Hide(); - } - - public override ITooltip GetCustomTooltip() => new IncompatibilityDisplayingTooltip(); - } -} diff --git a/osu.Game/Overlays/Mods/UserModSelectOverlay.cs b/osu.Game/Overlays/Mods/UserModSelectOverlay.cs deleted file mode 100644 index 161f89c2eb..0000000000 --- a/osu.Game/Overlays/Mods/UserModSelectOverlay.cs +++ /dev/null @@ -1,30 +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.Rulesets.Mods; - -namespace osu.Game.Overlays.Mods -{ - public class UserModSelectOverlay : ModSelectOverlay - { - protected override void OnModSelected(Mod mod) - { - base.OnModSelected(mod); - - foreach (var section in ModSectionsContainer.Children) - section.DeselectTypes(mod.IncompatibleMods, true, mod); - } - - protected override ModSection CreateModSection(ModType type) => new UserModSection(type); - - private class UserModSection : ModSection - { - public UserModSection(ModType type) - : base(type) - { - } - - protected override ModButton CreateModButton(Mod mod) => new IncompatibilityDisplayingModButton(mod); - } - } -} From 128468e13d87aa8f2ed54ddb4264732b96c2b1ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 10 May 2022 21:52:30 +0200 Subject: [PATCH 0927/2328] Remove old base mod select overlay --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 532 --------------------- 1 file changed, 532 deletions(-) delete mode 100644 osu.Game/Overlays/Mods/ModSelectOverlay.cs diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs deleted file mode 100644 index cf57322594..0000000000 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ /dev/null @@ -1,532 +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 System; -using System.Collections.Generic; -using System.Linq; -using JetBrains.Annotations; -using osu.Framework.Allocation; -using osu.Framework.Audio; -using osu.Framework.Audio.Sample; -using osu.Framework.Bindables; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.Events; -using osu.Game.Graphics; -using osu.Game.Graphics.Backgrounds; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; -using osu.Game.Input.Bindings; -using osu.Game.Resources.Localisation.Web; -using osu.Game.Rulesets.Mods; -using osu.Game.Screens; -using osu.Game.Utils; -using osuTK; -using osuTK.Graphics; -using osuTK.Input; - -namespace osu.Game.Overlays.Mods -{ - public abstract class ModSelectOverlay : WaveOverlayContainer - { - public const float HEIGHT = 510; - - protected readonly TriangleButton DeselectAllButton; - protected readonly TriangleButton CustomiseButton; - protected readonly TriangleButton CloseButton; - - protected readonly FillFlowContainer FooterContainer; - - protected override bool BlockNonPositionalInput => false; - - protected override bool DimMainContent => false; - - /// - /// Whether s underneath the same instance should appear as stacked buttons. - /// - protected virtual bool Stacked => true; - - /// - /// Whether configurable s can be configured by the local user. - /// - protected virtual bool AllowConfiguration => true; - - [NotNull] - private Func isValidMod = m => true; - - /// - /// A function that checks whether a given mod is selectable. - /// - [NotNull] - public Func IsValidMod - { - get => isValidMod; - set - { - isValidMod = value ?? throw new ArgumentNullException(nameof(value)); - updateAvailableMods(); - } - } - - protected readonly FillFlowContainer ModSectionsContainer; - - protected readonly ModSettingsContainer ModSettingsContainer; - - [Cached] - public readonly Bindable> SelectedMods = new Bindable>(Array.Empty()); - - private Bindable>> availableMods; - - protected Color4 LowMultiplierColour; - protected Color4 HighMultiplierColour; - - private const float content_width = 0.8f; - private const float footer_button_spacing = 20; - - private Sample sampleOn, sampleOff; - - protected ModSelectOverlay() - { - Waves.FirstWaveColour = Color4Extensions.FromHex(@"19b0e2"); - Waves.SecondWaveColour = Color4Extensions.FromHex(@"2280a2"); - Waves.ThirdWaveColour = Color4Extensions.FromHex(@"005774"); - Waves.FourthWaveColour = Color4Extensions.FromHex(@"003a4e"); - - RelativeSizeAxes = Axes.X; - Height = HEIGHT; - - Padding = new MarginPadding { Horizontal = -OsuScreen.HORIZONTAL_OVERFLOW_PADDING }; - - Children = new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Both, - Masking = true, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = new Color4(36, 50, 68, 255) - }, - new Triangles - { - TriangleScale = 5, - RelativeSizeAxes = Axes.Both, - ColourLight = new Color4(53, 66, 82, 255), - ColourDark = new Color4(41, 54, 70, 255), - }, - }, - }, - new GridContainer - { - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - RowDimensions = new[] - { - new Dimension(GridSizeMode.Absolute, 90), - new Dimension(), - new Dimension(GridSizeMode.AutoSize), - }, - Content = new[] - { - new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Both, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(10).Opacity(100), - }, - new FillFlowContainer - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Width = content_width, - Padding = new MarginPadding { Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING }, - Children = new Drawable[] - { - new OsuSpriteText - { - Text = @"Gameplay Mods", - Font = OsuFont.GetFont(size: 22, weight: FontWeight.Bold), - Shadow = true, - Margin = new MarginPadding - { - Bottom = 4, - }, - }, - new OsuTextFlowContainer(text => - { - text.Font = text.Font.With(size: 18); - text.Shadow = true; - }) - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Text = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.\nOthers are just for fun.", - }, - }, - }, - }, - }, - }, - new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - // Body - new OsuScrollContainer - { - ScrollbarVisible = false, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding - { - Vertical = 10, - Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING - }, - Children = new Drawable[] - { - ModSectionsContainer = new FillFlowContainer - { - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Spacing = new Vector2(0f, 10f), - Width = content_width, - LayoutDuration = 200, - LayoutEasing = Easing.OutQuint, - Children = new[] - { - CreateModSection(ModType.DifficultyReduction).With(s => - { - s.ToggleKeys = new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }; - s.Action = modButtonPressed; - }), - CreateModSection(ModType.DifficultyIncrease).With(s => - { - s.ToggleKeys = new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }; - s.Action = modButtonPressed; - }), - CreateModSection(ModType.Automation).With(s => - { - s.ToggleKeys = new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }; - s.Action = modButtonPressed; - }), - CreateModSection(ModType.Conversion).With(s => - { - s.Action = modButtonPressed; - }), - CreateModSection(ModType.Fun).With(s => - { - s.Action = modButtonPressed; - }), - } - }, - } - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Padding = new MarginPadding(30), - Width = 0.3f, - Children = new Drawable[] - { - ModSettingsContainer = new ModSettingsContainer - { - Alpha = 0, - SelectedMods = { BindTarget = SelectedMods }, - }, - } - }, - } - }, - }, - new Drawable[] - { - new Container - { - Name = "Footer content", - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = new Color4(172, 20, 116, 255), - Alpha = 0.5f, - }, - FooterContainer = new FillFlowContainer - { - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - RelativePositionAxes = Axes.X, - Width = content_width, - Spacing = new Vector2(footer_button_spacing, footer_button_spacing / 2), - Padding = new MarginPadding - { - Vertical = 15, - Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING - }, - Children = new[] - { - DeselectAllButton = new TriangleButton - { - Width = 180, - Text = "Deselect All", - Action = deselectAll, - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - }, - CustomiseButton = new TriangleButton - { - Width = 180, - Text = "Customisation", - Action = () => ModSettingsContainer.ToggleVisibility(), - Enabled = { Value = false }, - Alpha = AllowConfiguration ? 1 : 0, - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - }, - CloseButton = new TriangleButton - { - Width = 180, - Text = CommonStrings.ButtonsClose, - Action = Hide, - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - }, - } - } - }, - } - }, - }, - }, - }; - - ((IBindable)CustomiseButton.Enabled).BindTo(ModSettingsContainer.HasSettingsForSelection); - } - - [BackgroundDependencyLoader(true)] - private void load(AudioManager audio, OsuGameBase osu) - { - availableMods = osu.AvailableMods.GetBoundCopy(); - - sampleOn = audio.Samples.Get(@"UI/check-on"); - sampleOff = audio.Samples.Get(@"UI/check-off"); - } - - private void deselectAll() - { - foreach (var section in ModSectionsContainer.Children) - section.DeselectAll(); - - refreshSelectedMods(); - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - availableMods.BindValueChanged(_ => updateAvailableMods(), true); - - // intentionally bound after the above line to avoid a potential update feedback cycle. - // i haven't actually observed this happening but as updateAvailableMods() changes the selection it is plausible. - SelectedMods.BindValueChanged(_ => updateSelectedButtons()); - } - - protected override void PopOut() - { - base.PopOut(); - - foreach (var section in ModSectionsContainer) - { - section.FlushPendingSelections(); - } - - FooterContainer.MoveToX(content_width, WaveContainer.DISAPPEAR_DURATION, Easing.InSine); - FooterContainer.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.InSine); - - foreach (var section in ModSectionsContainer.Children) - { - section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), WaveContainer.DISAPPEAR_DURATION, Easing.InSine); - section.ButtonsContainer.MoveToX(100f, WaveContainer.DISAPPEAR_DURATION, Easing.InSine); - section.ButtonsContainer.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.InSine); - } - } - - protected override void PopIn() - { - base.PopIn(); - - FooterContainer.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint); - FooterContainer.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint); - - foreach (var section in ModSectionsContainer.Children) - { - section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), WaveContainer.APPEAR_DURATION, Easing.OutQuint); - section.ButtonsContainer.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint); - section.ButtonsContainer.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint); - } - } - - protected override bool OnKeyDown(KeyDownEvent e) - { - // don't absorb control as ToolbarRulesetSelector uses control + number to navigate - if (e.ControlPressed) return false; - - switch (e.Key) - { - case Key.Number1: - DeselectAllButton.TriggerClick(); - return true; - - case Key.Number2: - CloseButton.TriggerClick(); - return true; - } - - return base.OnKeyDown(e); - } - - public override bool OnPressed(KeyBindingPressEvent e) => false; // handled by back button - - private void updateAvailableMods() - { - if (availableMods?.Value == null) - return; - - foreach (var section in ModSectionsContainer.Children) - { - IEnumerable modEnumeration = availableMods.Value[section.ModType]; - - if (!Stacked) - modEnumeration = ModUtils.FlattenMods(modEnumeration); - - section.Mods = modEnumeration.Select(getValidModOrNull).Where(m => m != null).Select(m => m.DeepClone()); - } - - updateSelectedButtons(); - OnAvailableModsChanged(); - } - - /// - /// Returns a valid form of a given if possible, or null otherwise. - /// - /// - /// This is a recursive process during which any invalid mods are culled while preserving structures where possible. - /// - /// The to check. - /// A valid form of if exists, or null otherwise. - [CanBeNull] - private Mod getValidModOrNull([NotNull] Mod mod) - { - if (!(mod is MultiMod multi)) - return IsValidMod(mod) ? mod : null; - - var validSubset = multi.Mods.Select(getValidModOrNull).Where(m => m != null).ToArray(); - - if (validSubset.Length == 0) - return null; - - return validSubset.Length == 1 ? validSubset[0] : new MultiMod(validSubset); - } - - private void updateSelectedButtons() - { - // Enumeration below may update the bindable list. - var selectedMods = SelectedMods.Value.ToList(); - - foreach (var section in ModSectionsContainer.Children) - section.UpdateSelectedButtons(selectedMods); - } - - private void modButtonPressed(Mod selectedMod) - { - if (selectedMod != null) - { - if (State.Value == Visibility.Visible) - Scheduler.AddOnce(playSelectedSound); - - OnModSelected(selectedMod); - - if (selectedMod.RequiresConfiguration && AllowConfiguration) - ModSettingsContainer.Show(); - } - else - { - if (State.Value == Visibility.Visible) - Scheduler.AddOnce(playDeselectedSound); - } - - refreshSelectedMods(); - } - - private void playSelectedSound() => sampleOn?.Play(); - private void playDeselectedSound() => sampleOff?.Play(); - - /// - /// Invoked after has changed. - /// - protected virtual void OnAvailableModsChanged() - { - } - - /// - /// Invoked when a new has been selected. - /// - /// The that has been selected. - protected virtual void OnModSelected(Mod mod) - { - } - - private void refreshSelectedMods() => SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray(); - - /// - /// Creates a that groups s with the same . - /// - /// The of s in the section. - /// The . - protected virtual ModSection CreateModSection(ModType type) => new ModSection(type); - - #region Disposal - - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - - availableMods?.UnbindAll(); - SelectedMods?.UnbindAll(); - } - - #endregion - } -} From dfd97701d7d17ca559f0d681d8a669cbe2cafb19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 10 May 2022 21:53:42 +0200 Subject: [PATCH 0928/2328] Remove old mod settings container & related controls --- osu.Game/Overlays/Mods/ModControlSection.cs | 54 --------- .../Overlays/Mods/ModSettingsContainer.cs | 111 ------------------ 2 files changed, 165 deletions(-) delete mode 100644 osu.Game/Overlays/Mods/ModControlSection.cs delete mode 100644 osu.Game/Overlays/Mods/ModSettingsContainer.cs diff --git a/osu.Game/Overlays/Mods/ModControlSection.cs b/osu.Game/Overlays/Mods/ModControlSection.cs deleted file mode 100644 index 10b3bc7c2b..0000000000 --- a/osu.Game/Overlays/Mods/ModControlSection.cs +++ /dev/null @@ -1,54 +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 System.Collections.Generic; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Rulesets.Mods; -using osuTK; - -namespace osu.Game.Overlays.Mods -{ - public class ModControlSection : CompositeDrawable - { - protected FillFlowContainer FlowContent; - - public readonly Mod Mod; - - public ModControlSection(Mod mod, IEnumerable modControls) - { - Mod = mod; - - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - - FlowContent = new FillFlowContainer - { - Margin = new MarginPadding { Top = 30 }, - Spacing = new Vector2(0, 5), - Direction = FillDirection.Vertical, - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - ChildrenEnumerable = modControls - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - AddRangeInternal(new Drawable[] - { - new OsuSpriteText - { - Text = Mod.Name, - Font = OsuFont.GetFont(weight: FontWeight.Bold), - Colour = colours.Yellow, - }, - FlowContent - }); - } - } -} diff --git a/osu.Game/Overlays/Mods/ModSettingsContainer.cs b/osu.Game/Overlays/Mods/ModSettingsContainer.cs deleted file mode 100644 index 64d65cab3b..0000000000 --- a/osu.Game/Overlays/Mods/ModSettingsContainer.cs +++ /dev/null @@ -1,111 +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 System; -using System.Collections.Generic; -using System.Linq; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.Events; -using osu.Game.Configuration; -using osu.Game.Graphics.Containers; -using osu.Game.Rulesets.Mods; -using osuTK; -using osuTK.Graphics; - -namespace osu.Game.Overlays.Mods -{ - public class ModSettingsContainer : VisibilityContainer - { - public readonly IBindable> SelectedMods = new Bindable>(Array.Empty()); - - public IBindable HasSettingsForSelection => hasSettingsForSelection; - - private readonly Bindable hasSettingsForSelection = new Bindable(); - - private readonly FillFlowContainer modSettingsContent; - - private readonly Container content; - - private const double transition_duration = 400; - - public ModSettingsContainer() - { - RelativeSizeAxes = Axes.Both; - - Child = content = new Container - { - Masking = true, - CornerRadius = 10, - RelativeSizeAxes = Axes.Both, - RelativePositionAxes = Axes.Both, - X = 1, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = new Color4(0, 0, 0, 192) - }, - new OsuScrollContainer - { - RelativeSizeAxes = Axes.Both, - ScrollbarVisible = false, - Child = modSettingsContent = new FillFlowContainer - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Spacing = new Vector2(0f, 10f), - Padding = new MarginPadding(20), - } - } - } - }; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - SelectedMods.BindValueChanged(modsChanged, true); - } - - private void modsChanged(ValueChangedEvent> mods) - { - modSettingsContent.Clear(); - - foreach (var mod in mods.NewValue) - { - var settings = mod.CreateSettingsControls().ToList(); - if (settings.Count > 0) - modSettingsContent.Add(new ModControlSection(mod, settings)); - } - - bool hasSettings = modSettingsContent.Count > 0; - - if (!hasSettings) - Hide(); - - hasSettingsForSelection.Value = hasSettings; - } - - protected override bool OnMouseDown(MouseDownEvent e) => true; - protected override bool OnHover(HoverEvent e) => true; - - protected override void PopIn() - { - this.FadeIn(transition_duration, Easing.OutQuint); - content.MoveToX(0, transition_duration, Easing.OutQuint); - } - - protected override void PopOut() - { - this.FadeOut(transition_duration, Easing.OutQuint); - content.MoveToX(1, transition_duration, Easing.OutQuint); - } - } -} From 8b0ece1c09df40506f813a125bbd9c2f78546eb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 10 May 2022 21:55:54 +0200 Subject: [PATCH 0929/2328] Remove old mod section --- osu.Game/Overlays/Mods/ModSection.cs | 261 --------------------------- 1 file changed, 261 deletions(-) delete mode 100644 osu.Game/Overlays/Mods/ModSection.cs diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs deleted file mode 100644 index a70191a864..0000000000 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ /dev/null @@ -1,261 +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 osuTK; -using osuTK.Input; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Graphics.Sprites; -using osu.Game.Rulesets.Mods; -using System; -using System.Linq; -using System.Collections.Generic; -using System.Threading; -using Humanizer; -using osu.Framework.Input.Events; -using osu.Game.Graphics; - -namespace osu.Game.Overlays.Mods -{ - public class ModSection : CompositeDrawable - { - private readonly Drawable header; - - public FillFlowContainer ButtonsContainer { get; } - - protected IReadOnlyList Buttons { get; private set; } = Array.Empty(); - - public Action Action; - - public Key[] ToggleKeys; - - public readonly ModType ModType; - - public IEnumerable SelectedMods => Buttons.Select(b => b.SelectedMod).Where(m => m != null); - - private CancellationTokenSource modsLoadCts; - - protected bool SelectionAnimationRunning => pendingSelectionOperations.Count > 0; - - /// - /// True when all mod icons have completed loading. - /// - public bool ModIconsLoaded { get; private set; } = true; - - public IEnumerable Mods - { - set - { - var modContainers = value.Select(m => - { - if (m == null) - return new ModButtonEmpty(); - - return CreateModButton(m).With(b => - { - b.SelectionChanged = mod => - { - ModButtonStateChanged(mod); - Action?.Invoke(mod); - }; - }); - }).ToArray(); - - modsLoadCts?.Cancel(); - - if (modContainers.Length == 0) - { - ModIconsLoaded = true; - header.Hide(); - Hide(); - return; - } - - ModIconsLoaded = false; - - LoadComponentsAsync(modContainers, c => - { - ModIconsLoaded = true; - ButtonsContainer.ChildrenEnumerable = c; - }, (modsLoadCts = new CancellationTokenSource()).Token); - - Buttons = modContainers.OfType().ToArray(); - - header.FadeIn(200); - this.FadeIn(200); - } - } - - protected virtual void ModButtonStateChanged(Mod mod) - { - } - - protected override bool OnKeyDown(KeyDownEvent e) - { - if (e.ControlPressed) return false; - - if (ToggleKeys != null) - { - int index = Array.IndexOf(ToggleKeys, e.Key); - if (index > -1 && index < Buttons.Count) - Buttons[index].SelectNext(e.ShiftPressed ? -1 : 1); - } - - return base.OnKeyDown(e); - } - - private const double initial_multiple_selection_delay = 120; - - private double selectionDelay = initial_multiple_selection_delay; - private double lastSelection; - - private readonly Queue pendingSelectionOperations = new Queue(); - - protected override void Update() - { - base.Update(); - - if (selectionDelay == initial_multiple_selection_delay || Time.Current - lastSelection >= selectionDelay) - { - if (pendingSelectionOperations.TryDequeue(out var dequeuedAction)) - { - dequeuedAction(); - - // each time we play an animation, we decrease the time until the next animation (to ramp the visual and audible elements). - selectionDelay = Math.Max(30, selectionDelay * 0.8f); - lastSelection = Time.Current; - } - else - { - // reset the selection delay after all animations have been completed. - // this will cause the next action to be immediately performed. - selectionDelay = initial_multiple_selection_delay; - } - } - } - - /// - /// Selects all mods. - /// - public void SelectAll() - { - pendingSelectionOperations.Clear(); - - foreach (var button in Buttons.Where(b => !b.Selected)) - pendingSelectionOperations.Enqueue(() => button.SelectAt(0)); - } - - /// - /// Deselects all mods. - /// - public void DeselectAll() - { - pendingSelectionOperations.Clear(); - DeselectTypes(Buttons.Select(b => b.SelectedMod?.GetType()).Where(t => t != null)); - } - - /// - /// Deselect one or more mods in this section. - /// - /// The types of s which should be deselected. - /// Whether the deselection should happen immediately. Should only be used when required to ensure correct selection flow. - /// If this deselection is triggered by a user selection, this should contain the newly selected type. This type will never be deselected, even if it matches one provided in . - public void DeselectTypes(IEnumerable modTypes, bool immediate = false, Mod newSelection = null) - { - foreach (var button in Buttons) - { - if (button.SelectedMod == null) continue; - - if (button.SelectedMod == newSelection) - continue; - - foreach (var type in modTypes) - { - if (type.IsInstanceOfType(button.SelectedMod)) - { - if (immediate) - button.Deselect(); - else - pendingSelectionOperations.Enqueue(button.Deselect); - } - } - } - } - - /// - /// Updates all buttons with the given list of selected mods. - /// - /// The new list of selected mods to select. - public void UpdateSelectedButtons(IReadOnlyList newSelectedMods) - { - foreach (var button in Buttons) - updateButtonSelection(button, newSelectedMods); - } - - private void updateButtonSelection(ModButton button, IReadOnlyList newSelectedMods) - { - foreach (var mod in newSelectedMods) - { - int index = Array.FindIndex(button.Mods, m1 => mod.GetType() == m1.GetType()); - if (index < 0) - continue; - - var buttonMod = button.Mods[index]; - - // as this is likely coming from an external change, ensure the settings of the mod are in sync. - buttonMod.CopyFrom(mod); - - button.SelectAt(index, false); - return; - } - - button.Deselect(); - } - - public ModSection(ModType type) - { - ModType = type; - - AutoSizeAxes = Axes.Y; - RelativeSizeAxes = Axes.X; - - Origin = Anchor.TopCentre; - Anchor = Anchor.TopCentre; - - InternalChildren = new[] - { - header = CreateHeader(type.Humanize(LetterCasing.Title)), - ButtonsContainer = new FillFlowContainer - { - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - Spacing = new Vector2(50f, 0f), - Margin = new MarginPadding - { - Top = 20, - }, - AlwaysPresent = true - }, - }; - } - - protected virtual Drawable CreateHeader(string text) => new OsuSpriteText - { - Font = OsuFont.GetFont(weight: FontWeight.Bold), - Text = text - }; - - protected virtual ModButton CreateModButton(Mod mod) => new ModButton(mod); - - /// - /// Run any delayed selections (due to animation) immediately to leave mods in a good (final) state. - /// - public void FlushPendingSelections() - { - while (pendingSelectionOperations.TryDequeue(out var dequeuedAction)) - dequeuedAction(); - } - } -} From 33634cba1eb7badf4821c04a7a21954b55d7f11d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 10 May 2022 21:58:22 +0200 Subject: [PATCH 0930/2328] Remove old mod buttons --- .../UserInterface/TestSceneModButton.cs | 64 ---- osu.Game/Overlays/Mods/IncompatibleIcon.cs | 64 ---- osu.Game/Overlays/Mods/ModButton.cs | 319 ------------------ osu.Game/Overlays/Mods/ModButtonEmpty.cs | 20 -- 4 files changed, 467 deletions(-) delete mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneModButton.cs delete mode 100644 osu.Game/Overlays/Mods/IncompatibleIcon.cs delete mode 100644 osu.Game/Overlays/Mods/ModButton.cs delete mode 100644 osu.Game/Overlays/Mods/ModButtonEmpty.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModButton.cs deleted file mode 100644 index fdc21d80ff..0000000000 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModButton.cs +++ /dev/null @@ -1,64 +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.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Game.Overlays.Mods; -using osu.Game.Rulesets.Mods; - -namespace osu.Game.Tests.Visual.UserInterface -{ - public class TestSceneModButton : OsuTestScene - { - public TestSceneModButton() - { - Children = new Drawable[] - { - new ModButton(new MultiMod(new TestMod1(), new TestMod2(), new TestMod3(), new TestMod4())) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre - } - }; - } - - private class TestMod1 : TestMod - { - public override string Name => "Test mod 1"; - - public override string Acronym => "M1"; - } - - private class TestMod2 : TestMod - { - public override string Name => "Test mod 2"; - - public override string Acronym => "M2"; - - public override IconUsage? Icon => FontAwesome.Solid.Exclamation; - } - - private class TestMod3 : TestMod - { - public override string Name => "Test mod 3"; - - public override string Acronym => "M3"; - - public override IconUsage? Icon => FontAwesome.Solid.ArrowRight; - } - - private class TestMod4 : TestMod - { - public override string Name => "Test mod 4"; - - public override string Acronym => "M4"; - } - - private abstract class TestMod : Mod, IApplicableMod - { - public override double ScoreMultiplier => 1.0; - - public override string Description => "This is a test mod."; - } - } -} diff --git a/osu.Game/Overlays/Mods/IncompatibleIcon.cs b/osu.Game/Overlays/Mods/IncompatibleIcon.cs deleted file mode 100644 index df134fe4a4..0000000000 --- a/osu.Game/Overlays/Mods/IncompatibleIcon.cs +++ /dev/null @@ -1,64 +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.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Localisation; -using osu.Game.Graphics; -using osuTK; -using osuTK.Graphics; - -namespace osu.Game.Overlays.Mods -{ - public class IncompatibleIcon : VisibilityContainer, IHasTooltip - { - private Circle circle; - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Size = new Vector2(20); - - State.Value = Visibility.Hidden; - Alpha = 0; - - InternalChildren = new Drawable[] - { - circle = new Circle - { - RelativeSizeAxes = Axes.Both, - Colour = colours.Gray4, - }, - new SpriteIcon - { - RelativeSizeAxes = Axes.Both, - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Size = new Vector2(0.6f), - Icon = FontAwesome.Solid.Slash, - Colour = Color4.White, - Shadow = true, - } - }; - } - - protected override void PopIn() - { - this.FadeIn(200, Easing.OutQuint); - circle.FlashColour(Color4.Red, 500, Easing.OutQuint); - this.ScaleTo(1.8f).Then().ScaleTo(1, 500, Easing.OutQuint); - } - - protected override void PopOut() - { - this.FadeOut(200, Easing.OutQuint); - this.ScaleTo(0.8f, 200, Easing.In); - } - - public LocalisableString TooltipText => "Incompatible with current selected mods"; - } -} diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs deleted file mode 100644 index 979e2c8da3..0000000000 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ /dev/null @@ -1,319 +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 osuTK; -using osuTK.Graphics; -using osuTK.Input; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics.Sprites; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.UI; -using System; -using System.Linq; -using osu.Framework.Graphics.Cursor; -using osu.Framework.Input.Events; -using osu.Framework.Localisation; -using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; - -namespace osu.Game.Overlays.Mods -{ - /// - /// Represents a clickable button which can cycle through one of more mods. - /// - public class ModButton : ModButtonEmpty, IHasCustomTooltip - { - private ModIcon foregroundIcon; - private ModIcon backgroundIcon; - private readonly SpriteText text; - private readonly Container iconsContainer; - - /// - /// Fired when the selection changes. - /// - public Action SelectionChanged; - - public LocalisableString TooltipText => (SelectedMod?.Description ?? Mods.FirstOrDefault()?.Description) ?? string.Empty; - - private const Easing mod_switch_easing = Easing.InOutSine; - private const double mod_switch_duration = 120; - - // A selected index of -1 means not selected. - private int selectedIndex = -1; - - /// - /// Change the selected mod index of this button. - /// - /// The new index. - /// Whether any settings applied to the mod should be reset on selection. - /// Whether the selection changed. - private bool changeSelectedIndex(int newIndex, bool resetSettings = true) - { - if (newIndex == selectedIndex) return false; - - int direction = newIndex < selectedIndex ? -1 : 1; - - bool beforeSelected = Selected; - - Mod previousSelection = SelectedMod ?? Mods[0]; - - if (newIndex >= Mods.Length) - newIndex = -1; - else if (newIndex < -1) - newIndex = Mods.Length - 1; - - if (newIndex >= 0 && !Mods[newIndex].HasImplementation) - return false; - - selectedIndex = newIndex; - - Mod newSelection = SelectedMod ?? Mods[0]; - - if (resetSettings) - newSelection.ResetSettingsToDefaults(); - - Schedule(() => - { - if (beforeSelected != Selected) - { - iconsContainer.RotateTo(Selected ? 5f : 0f, 300, Easing.OutElastic); - iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, Easing.OutElastic); - } - - if (previousSelection != newSelection) - { - const float rotate_angle = 16; - - foregroundIcon.RotateTo(rotate_angle * direction, mod_switch_duration, mod_switch_easing); - backgroundIcon.RotateTo(-rotate_angle * direction, mod_switch_duration, mod_switch_easing); - - backgroundIcon.Mod = newSelection; - - using (BeginDelayedSequence(mod_switch_duration)) - { - foregroundIcon - .RotateTo(-rotate_angle * direction) - .RotateTo(0f, mod_switch_duration, mod_switch_easing); - - backgroundIcon - .RotateTo(rotate_angle * direction) - .RotateTo(0f, mod_switch_duration, mod_switch_easing); - - Schedule(() => DisplayMod(newSelection)); - } - } - - foregroundIcon.Selected.Value = Selected; - }); - - SelectionChanged?.Invoke(SelectedMod); - - return true; - } - - public bool Selected => selectedIndex != -1; - - private Color4 selectedColour; - - public Color4 SelectedColour - { - get => selectedColour; - set - { - if (value == selectedColour) return; - - selectedColour = value; - if (Selected) foregroundIcon.Colour = value; - } - } - - private Mod mod; - - protected readonly Container ButtonContent; - - public Mod Mod - { - get => mod; - set - { - mod = value; - - if (mod == null) - { - Mods = Array.Empty(); - Alpha = 0; - } - else - { - Mods = (mod as MultiMod)?.Mods ?? new[] { mod }; - Alpha = 1; - } - - createIcons(); - - if (Mods.Length > 0) - { - DisplayMod(Mods[0]); - } - } - } - - public Mod[] Mods { get; private set; } - - public virtual Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex); - - protected override bool OnMouseDown(MouseDownEvent e) - { - ButtonContent.ScaleTo(0.9f, 800, Easing.Out); - return base.OnMouseDown(e); - } - - protected override void OnMouseUp(MouseUpEvent e) - { - ButtonContent.ScaleTo(1, 500, Easing.OutElastic); - - // only trigger the event if we are inside the area of the button - if (Contains(e.ScreenSpaceMousePosition)) - { - switch (e.Button) - { - case MouseButton.Right: - SelectNext(-1); - break; - } - } - } - - protected override bool OnClick(ClickEvent e) - { - SelectNext(1); - - return true; - } - - /// - /// Select the next available mod in a specified direction. - /// - /// 1 for forwards, -1 for backwards. - public void SelectNext(int direction) - { - int start = selectedIndex + direction; - // wrap around if we are at an extremity. - if (start >= Mods.Length) - start = -1; - else if (start < -1) - start = Mods.Length - 1; - - for (int i = start; i < Mods.Length && i >= 0; i += direction) - { - if (SelectAt(i)) - return; - } - - Deselect(); - } - - /// - /// Select the mod at the provided index. - /// - /// The index to select. - /// Whether any settings applied to the mod should be reset on selection. - /// Whether the selection changed. - public bool SelectAt(int index, bool resetSettings = true) - { - if (!Mods[index].HasImplementation) return false; - - changeSelectedIndex(index, resetSettings); - return true; - } - - public void Deselect() => changeSelectedIndex(-1); - - protected virtual void DisplayMod(Mod mod) - { - if (backgroundIcon != null) - backgroundIcon.Mod = foregroundIcon.Mod; - foregroundIcon.Mod = mod; - text.Text = mod.Name; - Colour = mod.HasImplementation ? Color4.White : Color4.Gray; - } - - private void createIcons() - { - iconsContainer.Clear(); - - if (Mods.Length > 1) - { - iconsContainer.AddRange(new[] - { - backgroundIcon = new ModIcon(Mods[1], false) - { - Origin = Anchor.BottomRight, - Anchor = Anchor.BottomRight, - Position = new Vector2(1.5f), - }, - foregroundIcon = new ModIcon(Mods[0], false) - { - Origin = Anchor.BottomRight, - Anchor = Anchor.BottomRight, - Position = new Vector2(-1.5f), - }, - }); - } - else - { - iconsContainer.Add(foregroundIcon = new ModIcon(Mod, false) - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - }); - } - } - - public ModButton(Mod mod) - { - Children = new Drawable[] - { - new Container - { - Size = new Vector2(77f, 80f), - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Children = new Drawable[] - { - ButtonContent = new Container - { - Children = new Drawable[] - { - iconsContainer = new Container - { - RelativeSizeAxes = Axes.Both, - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - }, - }, - RelativeSizeAxes = Axes.Both, - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - } - } - }, - text = new OsuSpriteText - { - Y = 75, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Font = OsuFont.GetFont(size: 18) - }, - new HoverSounds() - }; - Mod = mod; - } - - public virtual ITooltip GetCustomTooltip() => new ModButtonTooltip(); - - public Mod TooltipContent => SelectedMod ?? Mods.FirstOrDefault(); - } -} diff --git a/osu.Game/Overlays/Mods/ModButtonEmpty.cs b/osu.Game/Overlays/Mods/ModButtonEmpty.cs deleted file mode 100644 index 03afe5adba..0000000000 --- a/osu.Game/Overlays/Mods/ModButtonEmpty.cs +++ /dev/null @@ -1,20 +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 osuTK; -using osu.Framework.Graphics.Containers; - -namespace osu.Game.Overlays.Mods -{ - /// - /// A mod button used exclusively for providing an empty space the size of a mod button. - /// - public class ModButtonEmpty : Container - { - public ModButtonEmpty() - { - Size = new Vector2(100f); - AlwaysPresent = true; - } - } -} From c4c7556fb24407b7c97067729a6bd6c894a71eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 10 May 2022 22:07:24 +0200 Subject: [PATCH 0931/2328] Make remains of `TestSceneModSettings` non-visual As they're not really testing anything visual. --- osu.Game.Tests/Mods/ModSettingsTest.cs | 36 ++++++++++++++ .../UserInterface/TestSceneModSettings.cs | 49 ------------------- 2 files changed, 36 insertions(+), 49 deletions(-) create mode 100644 osu.Game.Tests/Mods/ModSettingsTest.cs delete mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneModSettings.cs diff --git a/osu.Game.Tests/Mods/ModSettingsTest.cs b/osu.Game.Tests/Mods/ModSettingsTest.cs new file mode 100644 index 0000000000..b9ea1f2567 --- /dev/null +++ b/osu.Game.Tests/Mods/ModSettingsTest.cs @@ -0,0 +1,36 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu.Mods; + +namespace osu.Game.Tests.Mods +{ + public class ModSettingsTest + { + [Test] + public void TestModSettingsUnboundWhenCopied() + { + var original = new OsuModDoubleTime(); + var copy = (OsuModDoubleTime)original.DeepClone(); + + original.SpeedChange.Value = 2; + + Assert.That(original.SpeedChange.Value, Is.EqualTo(2.0)); + Assert.That(copy.SpeedChange.Value, Is.EqualTo(1.5)); + } + + [Test] + public void TestMultiModSettingsUnboundWhenCopied() + { + var original = new MultiMod(new OsuModDoubleTime()); + var copy = (MultiMod)original.DeepClone(); + + ((OsuModDoubleTime)original.Mods[0]).SpeedChange.Value = 2; + + Assert.That(((OsuModDoubleTime)original.Mods[0]).SpeedChange.Value, Is.EqualTo(2.0)); + Assert.That(((OsuModDoubleTime)copy.Mods[0]).SpeedChange.Value, Is.EqualTo(1.5)); + } + } +} diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSettings.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSettings.cs deleted file mode 100644 index 1cf3b2651c..0000000000 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSettings.cs +++ /dev/null @@ -1,49 +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 NUnit.Framework; -using osu.Framework.Utils; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Osu.Mods; - -namespace osu.Game.Tests.Visual.UserInterface -{ - public class TestSceneModSettings : OsuManualInputManagerTestScene - { - [Test] - public void TestModSettingsUnboundWhenCopied() - { - OsuModDoubleTime original = null; - OsuModDoubleTime copy = null; - - AddStep("create mods", () => - { - original = new OsuModDoubleTime(); - copy = (OsuModDoubleTime)original.DeepClone(); - }); - - AddStep("change property", () => original.SpeedChange.Value = 2); - - AddAssert("original has new value", () => Precision.AlmostEquals(2.0, original.SpeedChange.Value)); - AddAssert("copy has original value", () => Precision.AlmostEquals(1.5, copy.SpeedChange.Value)); - } - - [Test] - public void TestMultiModSettingsUnboundWhenCopied() - { - MultiMod original = null; - MultiMod copy = null; - - AddStep("create mods", () => - { - original = new MultiMod(new OsuModDoubleTime()); - copy = (MultiMod)original.DeepClone(); - }); - - AddStep("change property", () => ((OsuModDoubleTime)original.Mods[0]).SpeedChange.Value = 2); - - AddAssert("original has new value", () => Precision.AlmostEquals(2.0, ((OsuModDoubleTime)original.Mods[0]).SpeedChange.Value)); - AddAssert("copy has original value", () => Precision.AlmostEquals(1.5, ((OsuModDoubleTime)copy.Mods[0]).SpeedChange.Value)); - } - } -} From 76c63f1d0a0a2bda6eb56642c0f417ba8656297c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 10 May 2022 22:29:57 +0200 Subject: [PATCH 0932/2328] Rename `ModSelect{Screen -> Overlay}` in place of removed old design --- .../TestSceneFreeModSelectScreen.cs | 18 ++-- .../Multiplayer/TestSceneMultiplayer.cs | 2 +- .../TestSceneMultiplayerMatchSongSelect.cs | 2 +- .../TestSceneMultiplayerMatchSubScreen.cs | 2 +- .../Navigation/TestSceneScreenNavigation.cs | 2 +- .../SongSelect/TestScenePlaySongSelect.cs | 2 +- .../UserInterface/TestSceneModSelectScreen.cs | 96 +++++++++---------- osu.Game/Overlays/Mods/ModColumn.cs | 2 +- ...ModSelectScreen.cs => ModSelectOverlay.cs} | 4 +- ...electScreen.cs => UserModSelectOverlay.cs} | 4 +- ...electScreen.cs => FreeModSelectOverlay.cs} | 4 +- .../Screens/OnlinePlay/Match/RoomSubScreen.cs | 4 +- .../OnlinePlay/OnlinePlaySongSelect.cs | 6 +- osu.Game/Screens/Select/SongSelect.cs | 4 +- 14 files changed, 76 insertions(+), 76 deletions(-) rename osu.Game/Overlays/Mods/{ModSelectScreen.cs => ModSelectOverlay.cs} (99%) rename osu.Game/Overlays/Mods/{UserModSelectScreen.cs => UserModSelectOverlay.cs} (92%) rename osu.Game/Screens/OnlinePlay/{FreeModSelectScreen.cs => FreeModSelectOverlay.cs} (94%) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs index 4eb14542ba..9a24a1c646 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs @@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneFreeModSelectScreen : MultiplayerTestScene { - private FreeModSelectScreen freeModSelectScreen; + private FreeModSelectOverlay freeModSelectOverlay; private readonly Bindable>> availableMods = new Bindable>>(); [BackgroundDependencyLoader] @@ -40,8 +40,8 @@ namespace osu.Game.Tests.Visual.Multiplayer AddToggleStep("toggle visibility", visible => { - if (freeModSelectScreen != null) - freeModSelectScreen.State.Value = visible ? Visibility.Visible : Visibility.Hidden; + if (freeModSelectOverlay != null) + freeModSelectOverlay.State.Value = visible ? Visibility.Visible : Visibility.Hidden; }); } @@ -50,7 +50,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { createFreeModSelect(); - AddStep("select difficulty adjust", () => freeModSelectScreen.SelectedMods.Value = new[] { new OsuModDifficultyAdjust() }); + AddStep("select difficulty adjust", () => freeModSelectOverlay.SelectedMods.Value = new[] { new OsuModDifficultyAdjust() }); AddWaitStep("wait some", 3); AddAssert("customisation area not expanded", () => this.ChildrenOfType().Single().Height == 0); } @@ -72,18 +72,18 @@ namespace osu.Game.Tests.Visual.Multiplayer InputManager.MoveMouseTo(this.ChildrenOfType().Last()); InputManager.Click(MouseButton.Left); }); - AddUntilStep("all mods deselected", () => !freeModSelectScreen.SelectedMods.Value.Any()); + AddUntilStep("all mods deselected", () => !freeModSelectOverlay.SelectedMods.Value.Any()); } private void createFreeModSelect() { - AddStep("create free mod select screen", () => Child = freeModSelectScreen = new FreeModSelectScreen + AddStep("create free mod select screen", () => Child = freeModSelectOverlay = new FreeModSelectOverlay { State = { Value = Visibility.Visible } }); AddUntilStep("all column content loaded", - () => freeModSelectScreen.ChildrenOfType().Any() - && freeModSelectScreen.ChildrenOfType().All(column => column.IsLoaded && column.ItemsLoaded)); + () => freeModSelectOverlay.ChildrenOfType().Any() + && freeModSelectOverlay.ChildrenOfType().All(column => column.IsLoaded && column.ItemsLoaded)); } private bool assertAllAvailableModsSelected() @@ -95,7 +95,7 @@ namespace osu.Game.Tests.Visual.Multiplayer foreach (var availableMod in allAvailableMods) { - if (freeModSelectScreen.SelectedMods.Value.All(selectedMod => selectedMod.GetType() != availableMod.GetType())) + if (freeModSelectOverlay.SelectedMods.Value.All(selectedMod => selectedMod.GetType() != availableMod.GetType())) return false; } diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs index 97cb08e3c1..8e45d99eae 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs @@ -627,7 +627,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("invoke on back button", () => multiplayerComponents.OnBackButton()); - AddAssert("mod overlay is hidden", () => this.ChildrenOfType().Single().State.Value == Visibility.Hidden); + AddAssert("mod overlay is hidden", () => this.ChildrenOfType().Single().State.Value == Visibility.Hidden); AddAssert("dialog overlay is hidden", () => DialogOverlay.State.Value == Visibility.Hidden); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs index 061fe5715b..eacd80925d 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs @@ -132,7 +132,7 @@ namespace osu.Game.Tests.Visual.Multiplayer private void assertHasFreeModButton(Type type, bool hasButton = true) { AddAssert($"{type.ReadableName()} {(hasButton ? "displayed" : "not displayed")} in freemod overlay", - () => this.ChildrenOfType() + () => this.ChildrenOfType() .Single() .ChildrenOfType() .Where(panel => !panel.Filtered.Value) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs index 6173580f0b..ca79fa9cb8 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs @@ -172,7 +172,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("mod select contents loaded", () => this.ChildrenOfType().Any() && this.ChildrenOfType().All(col => col.IsLoaded && col.ItemsLoaded)); AddUntilStep("mod select contains only double time mod", - () => this.ChildrenOfType() + () => this.ChildrenOfType() .SingleOrDefault()? .ChildrenOfType() .SingleOrDefault(panel => !panel.Filtered.Value)?.Mod is OsuModDoubleTime); diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs index 9674ef7ae1..a3e0caedb9 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs @@ -568,7 +568,7 @@ namespace osu.Game.Tests.Visual.Navigation public class TestPlaySongSelect : PlaySongSelect { - public ModSelectScreen ModSelectOverlay => ModSelect; + public ModSelectOverlay ModSelectOverlay => ModSelect; public BeatmapOptionsOverlay BeatmapOptionsOverlay => BeatmapOptions; diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 083e24be7b..aad7f6b301 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -1008,7 +1008,7 @@ namespace osu.Game.Tests.Visual.SongSelect public WorkingBeatmap CurrentBeatmap => Beatmap.Value; public IWorkingBeatmap CurrentBeatmapDetailsBeatmap => BeatmapDetails.Beatmap; public new BeatmapCarousel Carousel => base.Carousel; - public new ModSelectScreen ModSelect => base.ModSelect; + public new ModSelectOverlay ModSelect => base.ModSelect; public new void PresentScore(ScoreInfo score) => base.PresentScore(score); diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs index fa7758df59..2e2ce6edd7 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs @@ -29,7 +29,7 @@ namespace osu.Game.Tests.Visual.UserInterface [Resolved] private RulesetStore rulesetStore { get; set; } - private UserModSelectScreen modSelectScreen; + private UserModSelectOverlay modSelectOverlay; [SetUpSteps] public void SetUpSteps() @@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual.UserInterface private void createScreen() { - AddStep("create screen", () => Child = modSelectScreen = new UserModSelectScreen + AddStep("create screen", () => Child = modSelectOverlay = new UserModSelectOverlay { RelativeSizeAxes = Axes.Both, State = { Value = Visibility.Visible }, @@ -54,7 +54,7 @@ namespace osu.Game.Tests.Visual.UserInterface public void TestStateChange() { createScreen(); - AddStep("toggle state", () => modSelectScreen.ToggleVisibility()); + AddStep("toggle state", () => modSelectOverlay.ToggleVisibility()); } [Test] @@ -62,14 +62,14 @@ namespace osu.Game.Tests.Visual.UserInterface { AddStep("set mods", () => SelectedMods.Value = new Mod[] { new OsuModAlternate(), new OsuModDaycore() }); createScreen(); - AddUntilStep("two panels active", () => modSelectScreen.ChildrenOfType().Count(panel => panel.Active.Value) == 2); + AddUntilStep("two panels active", () => modSelectOverlay.ChildrenOfType().Count(panel => panel.Active.Value) == 2); AddAssert("mod multiplier correct", () => { double multiplier = SelectedMods.Value.Aggregate(1d, (m, mod) => m * mod.ScoreMultiplier); - return Precision.AlmostEquals(multiplier, modSelectScreen.ChildrenOfType().Single().Current.Value); + return Precision.AlmostEquals(multiplier, modSelectOverlay.ChildrenOfType().Single().Current.Value); }); assertCustomisationToggleState(disabled: false, active: false); - AddAssert("setting items created", () => modSelectScreen.ChildrenOfType().Any()); + AddAssert("setting items created", () => modSelectOverlay.ChildrenOfType().Any()); } [Test] @@ -77,14 +77,14 @@ namespace osu.Game.Tests.Visual.UserInterface { createScreen(); AddStep("set mods", () => SelectedMods.Value = new Mod[] { new OsuModAlternate(), new OsuModDaycore() }); - AddUntilStep("two panels active", () => modSelectScreen.ChildrenOfType().Count(panel => panel.Active.Value) == 2); + AddUntilStep("two panels active", () => modSelectOverlay.ChildrenOfType().Count(panel => panel.Active.Value) == 2); AddAssert("mod multiplier correct", () => { double multiplier = SelectedMods.Value.Aggregate(1d, (m, mod) => m * mod.ScoreMultiplier); - return Precision.AlmostEquals(multiplier, modSelectScreen.ChildrenOfType().Single().Current.Value); + return Precision.AlmostEquals(multiplier, modSelectOverlay.ChildrenOfType().Single().Current.Value); }); assertCustomisationToggleState(disabled: false, active: false); - AddAssert("setting items created", () => modSelectScreen.ChildrenOfType().Any()); + AddAssert("setting items created", () => modSelectOverlay.ChildrenOfType().Any()); } [Test] @@ -139,7 +139,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("last column dimmed", () => !this.ChildrenOfType().Last().Active.Value); AddStep("request scroll to last column", () => { - var lastDimContainer = this.ChildrenOfType().Last(); + var lastDimContainer = this.ChildrenOfType().Last(); lastColumn = lastDimContainer.Column; lastDimContainer.RequestScroll?.Invoke(lastDimContainer); }); @@ -167,7 +167,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("dismiss mod customisation via toggle", () => { - InputManager.MoveMouseTo(modSelectScreen.ChildrenOfType().Single()); + InputManager.MoveMouseTo(modSelectOverlay.ChildrenOfType().Single()); InputManager.Click(MouseButton.Left); }); assertCustomisationToggleState(disabled: false, active: false); @@ -205,14 +205,14 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("move mouse to dimmed area", () => { InputManager.MoveMouseTo(new Vector2( - modSelectScreen.ScreenSpaceDrawQuad.TopLeft.X, - (modSelectScreen.ScreenSpaceDrawQuad.TopLeft.Y + modSelectScreen.ScreenSpaceDrawQuad.BottomLeft.Y) / 2)); + modSelectOverlay.ScreenSpaceDrawQuad.TopLeft.X, + (modSelectOverlay.ScreenSpaceDrawQuad.TopLeft.Y + modSelectOverlay.ScreenSpaceDrawQuad.BottomLeft.Y) / 2)); }); AddStep("click", () => InputManager.Click(MouseButton.Left)); assertCustomisationToggleState(disabled: false, active: false); - AddStep("move mouse to first mod panel", () => InputManager.MoveMouseTo(modSelectScreen.ChildrenOfType().First())); - AddAssert("first mod panel is hovered", () => modSelectScreen.ChildrenOfType().First().IsHovered); + AddStep("move mouse to first mod panel", () => InputManager.MoveMouseTo(modSelectOverlay.ChildrenOfType().First())); + AddAssert("first mod panel is hovered", () => modSelectOverlay.ChildrenOfType().First().IsHovered); } /// @@ -222,12 +222,12 @@ namespace osu.Game.Tests.Visual.UserInterface public void TestSettingsNotCrossPolluting() { Bindable> selectedMods2 = null; - ModSelectScreen modSelectScreen2 = null; + ModSelectOverlay modSelectScreen2 = null; createScreen(); AddStep("select diff adjust", () => SelectedMods.Value = new Mod[] { new OsuModDifficultyAdjust() }); - AddStep("set setting", () => modSelectScreen.ChildrenOfType>().First().Current.Value = 8); + AddStep("set setting", () => modSelectOverlay.ChildrenOfType>().First().Current.Value = 8); AddAssert("ensure setting is propagated", () => SelectedMods.Value.OfType().Single().CircleSize.Value == 8); @@ -235,7 +235,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("create second overlay", () => { - Add(modSelectScreen2 = new UserModSelectScreen().With(d => + Add(modSelectScreen2 = new UserModSelectOverlay().With(d => { d.Origin = Anchor.TopCentre; d.Anchor = Anchor.TopCentre; @@ -276,20 +276,20 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("Select all fun mods", () => { - modSelectScreen.ChildrenOfType() - .Single(c => c.ModType == ModType.DifficultyIncrease) - .SelectAll(); + modSelectOverlay.ChildrenOfType() + .Single(c => c.ModType == ModType.DifficultyIncrease) + .SelectAll(); }); AddUntilStep("many mods selected", () => SelectedMods.Value.Count >= 5); AddStep("trigger deselect and close overlay", () => { - modSelectScreen.ChildrenOfType() - .Single(c => c.ModType == ModType.DifficultyIncrease) - .DeselectAll(); + modSelectOverlay.ChildrenOfType() + .Single(c => c.ModType == ModType.DifficultyIncrease) + .DeselectAll(); - modSelectScreen.Hide(); + modSelectOverlay.Hide(); }); AddAssert("all mods deselected", () => SelectedMods.Value.Count == 0); @@ -378,15 +378,15 @@ namespace osu.Game.Tests.Visual.UserInterface createScreen(); changeRuleset(0); - AddAssert("double time visible", () => modSelectScreen.ChildrenOfType().Where(panel => panel.Mod is OsuModDoubleTime).Any(panel => !panel.Filtered.Value)); + AddAssert("double time visible", () => modSelectOverlay.ChildrenOfType().Where(panel => panel.Mod is OsuModDoubleTime).Any(panel => !panel.Filtered.Value)); - AddStep("make double time invalid", () => modSelectScreen.IsValidMod = m => !(m is OsuModDoubleTime)); - AddUntilStep("double time not visible", () => modSelectScreen.ChildrenOfType().Where(panel => panel.Mod is OsuModDoubleTime).All(panel => panel.Filtered.Value)); - AddAssert("nightcore still visible", () => modSelectScreen.ChildrenOfType().Where(panel => panel.Mod is OsuModNightcore).Any(panel => !panel.Filtered.Value)); + AddStep("make double time invalid", () => modSelectOverlay.IsValidMod = m => !(m is OsuModDoubleTime)); + AddUntilStep("double time not visible", () => modSelectOverlay.ChildrenOfType().Where(panel => panel.Mod is OsuModDoubleTime).All(panel => panel.Filtered.Value)); + AddAssert("nightcore still visible", () => modSelectOverlay.ChildrenOfType().Where(panel => panel.Mod is OsuModNightcore).Any(panel => !panel.Filtered.Value)); - AddStep("make double time valid again", () => modSelectScreen.IsValidMod = m => true); - AddUntilStep("double time visible", () => modSelectScreen.ChildrenOfType().Where(panel => panel.Mod is OsuModDoubleTime).Any(panel => !panel.Filtered.Value)); - AddAssert("nightcore still visible", () => modSelectScreen.ChildrenOfType().Where(b => b.Mod is OsuModNightcore).Any(panel => !panel.Filtered.Value)); + AddStep("make double time valid again", () => modSelectOverlay.IsValidMod = m => true); + AddUntilStep("double time visible", () => modSelectOverlay.ChildrenOfType().Where(panel => panel.Mod is OsuModDoubleTime).Any(panel => !panel.Filtered.Value)); + AddAssert("nightcore still visible", () => modSelectOverlay.ChildrenOfType().Where(b => b.Mod is OsuModNightcore).Any(panel => !panel.Filtered.Value)); } [Test] @@ -396,10 +396,10 @@ namespace osu.Game.Tests.Visual.UserInterface changeRuleset(0); AddStep("select DT + HD", () => SelectedMods.Value = new Mod[] { new OsuModDoubleTime(), new OsuModHidden() }); - AddAssert("DT + HD selected", () => modSelectScreen.ChildrenOfType().Count(panel => panel.Active.Value) == 2); + AddAssert("DT + HD selected", () => modSelectOverlay.ChildrenOfType().Count(panel => panel.Active.Value) == 2); - AddStep("make NF invalid", () => modSelectScreen.IsValidMod = m => !(m is ModNoFail)); - AddAssert("DT + HD still selected", () => modSelectScreen.ChildrenOfType().Count(panel => panel.Active.Value) == 2); + AddStep("make NF invalid", () => modSelectOverlay.IsValidMod = m => !(m is ModNoFail)); + AddAssert("DT + HD still selected", () => modSelectOverlay.ChildrenOfType().Count(panel => panel.Active.Value) == 2); } [Test] @@ -422,7 +422,7 @@ namespace osu.Game.Tests.Visual.UserInterface changeRuleset(0); AddStep("select DT + HD", () => SelectedMods.Value = new Mod[] { new OsuModDoubleTime(), new OsuModHidden() }); - AddAssert("DT + HD selected", () => modSelectScreen.ChildrenOfType().Count(panel => panel.Active.Value) == 2); + AddAssert("DT + HD selected", () => modSelectOverlay.ChildrenOfType().Count(panel => panel.Active.Value) == 2); AddStep("click deselect all button", () => { @@ -448,13 +448,13 @@ namespace osu.Game.Tests.Visual.UserInterface InputManager.MoveMouseTo(this.ChildrenOfType().First()); InputManager.Click(MouseButton.Left); }); - AddAssert("mod select hidden", () => modSelectScreen.State.Value == Visibility.Hidden); + AddAssert("mod select hidden", () => modSelectOverlay.State.Value == Visibility.Hidden); } [Test] public void TestColumnHiding() { - AddStep("create screen", () => Child = modSelectScreen = new UserModSelectScreen + AddStep("create screen", () => Child = modSelectOverlay = new UserModSelectOverlay { RelativeSizeAxes = Axes.Both, State = { Value = Visibility.Visible }, @@ -466,23 +466,23 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("two columns visible", () => this.ChildrenOfType().Count(col => col.IsPresent) == 2); - AddStep("unset filter", () => modSelectScreen.IsValidMod = _ => true); + AddStep("unset filter", () => modSelectOverlay.IsValidMod = _ => true); AddAssert("all columns visible", () => this.ChildrenOfType().All(col => col.IsPresent)); - AddStep("filter out everything", () => modSelectScreen.IsValidMod = _ => false); + AddStep("filter out everything", () => modSelectOverlay.IsValidMod = _ => false); AddAssert("no columns visible", () => this.ChildrenOfType().All(col => !col.IsPresent)); - AddStep("hide", () => modSelectScreen.Hide()); - AddStep("set filter for 3 columns", () => modSelectScreen.IsValidMod = mod => mod.Type == ModType.DifficultyReduction - || mod.Type == ModType.Automation - || mod.Type == ModType.Conversion); + AddStep("hide", () => modSelectOverlay.Hide()); + AddStep("set filter for 3 columns", () => modSelectOverlay.IsValidMod = mod => mod.Type == ModType.DifficultyReduction + || mod.Type == ModType.Automation + || mod.Type == ModType.Conversion); - AddStep("show", () => modSelectScreen.Show()); + AddStep("show", () => modSelectOverlay.Show()); AddUntilStep("3 columns visible", () => this.ChildrenOfType().Count(col => col.IsPresent) == 3); } private void waitForColumnLoad() => AddUntilStep("all column content loaded", - () => modSelectScreen.ChildrenOfType().Any() && modSelectScreen.ChildrenOfType().All(column => column.IsLoaded && column.ItemsLoaded)); + () => modSelectOverlay.ChildrenOfType().Any() && modSelectOverlay.ChildrenOfType().All(column => column.IsLoaded && column.ItemsLoaded)); private void changeRuleset(int id) { @@ -492,14 +492,14 @@ namespace osu.Game.Tests.Visual.UserInterface private void assertCustomisationToggleState(bool disabled, bool active) { - ShearedToggleButton getToggle() => modSelectScreen.ChildrenOfType().Single(); + ShearedToggleButton getToggle() => modSelectOverlay.ChildrenOfType().Single(); AddAssert($"customisation toggle is {(disabled ? "" : "not ")}disabled", () => getToggle().Active.Disabled == disabled); AddAssert($"customisation toggle is {(active ? "" : "not ")}active", () => getToggle().Active.Value == active); } private ModPanel getPanelForMod(Type modType) - => modSelectScreen.ChildrenOfType().Single(panel => panel.Mod.GetType() == modType); + => modSelectOverlay.ChildrenOfType().Single(panel => panel.Mod.GetType() == modType); private class TestUnimplementedMod : Mod { diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 3a2fda0bb0..b32ebb4a5c 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -384,7 +384,7 @@ namespace osu.Game.Overlays.Mods /// /// /// This method exists to be able to receive mod instances that come from potentially-external sources and to copy the changes across to this column's state. - /// uses this to substitute any external mod references in + /// uses this to substitute any external mod references in /// to references that are owned by this column. /// internal void SetSelection(IReadOnlyList mods) diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs similarity index 99% rename from osu.Game/Overlays/Mods/ModSelectScreen.cs rename to osu.Game/Overlays/Mods/ModSelectOverlay.cs index 912c09f05c..b589b2e7e1 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -27,7 +27,7 @@ using osuTK.Input; namespace osu.Game.Overlays.Mods { - public abstract class ModSelectScreen : ShearedOverlayContainer, ISamplePlaybackDisabler + public abstract class ModSelectOverlay : ShearedOverlayContainer, ISamplePlaybackDisabler { protected const int BUTTON_WIDTH = 200; @@ -76,7 +76,7 @@ namespace osu.Game.Overlays.Mods private ShearedToggleButton? customisationButton; - protected ModSelectScreen(OverlayColourScheme colourScheme = OverlayColourScheme.Green) + protected ModSelectOverlay(OverlayColourScheme colourScheme = OverlayColourScheme.Green) : base(colourScheme) { } diff --git a/osu.Game/Overlays/Mods/UserModSelectScreen.cs b/osu.Game/Overlays/Mods/UserModSelectOverlay.cs similarity index 92% rename from osu.Game/Overlays/Mods/UserModSelectScreen.cs rename to osu.Game/Overlays/Mods/UserModSelectOverlay.cs index a018797cba..8ff5e28c8f 100644 --- a/osu.Game/Overlays/Mods/UserModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/UserModSelectOverlay.cs @@ -10,9 +10,9 @@ using osuTK.Input; namespace osu.Game.Overlays.Mods { - public class UserModSelectScreen : ModSelectScreen + public class UserModSelectOverlay : ModSelectOverlay { - public UserModSelectScreen(OverlayColourScheme colourScheme = OverlayColourScheme.Green) + public UserModSelectOverlay(OverlayColourScheme colourScheme = OverlayColourScheme.Green) : base(colourScheme) { } diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs similarity index 94% rename from osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs rename to osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs index e92de5e083..6e1c9b7a59 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectScreen.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs @@ -13,7 +13,7 @@ using osu.Game.Localisation; namespace osu.Game.Screens.OnlinePlay { - public class FreeModSelectScreen : ModSelectScreen + public class FreeModSelectOverlay : ModSelectOverlay { protected override bool ShowTotalMultiplier => false; @@ -23,7 +23,7 @@ namespace osu.Game.Screens.OnlinePlay set => base.IsValidMod = m => m.UserPlayable && value.Invoke(m); } - public FreeModSelectScreen() + public FreeModSelectOverlay() : base(OverlayColourScheme.Plum) { IsValidMod = _ => true; diff --git a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs index ec4e329f7a..13b2c37ded 100644 --- a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs @@ -81,7 +81,7 @@ namespace osu.Game.Screens.OnlinePlay.Match public readonly Room Room; private readonly bool allowEdit; - private ModSelectScreen userModsSelectOverlay; + private ModSelectOverlay userModsSelectOverlay; [CanBeNull] private IDisposable userModsSelectOverlayRegistration; @@ -231,7 +231,7 @@ namespace osu.Game.Screens.OnlinePlay.Match } }; - LoadComponent(userModsSelectOverlay = new UserModSelectScreen(OverlayColourScheme.Plum) + LoadComponent(userModsSelectOverlay = new UserModSelectOverlay(OverlayColourScheme.Plum) { SelectedMods = { BindTarget = UserMods }, IsValidMod = _ => false diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs index c4503773ad..fb18a33d66 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs @@ -53,7 +53,7 @@ namespace osu.Game.Screens.OnlinePlay private IReadOnlyList initialMods; private bool itemSelected; - private readonly FreeModSelectScreen freeModSelectOverlay; + private readonly FreeModSelectOverlay freeModSelectOverlay; private IDisposable freeModSelectOverlayRegistration; protected OnlinePlaySongSelect(Room room) @@ -62,7 +62,7 @@ namespace osu.Game.Screens.OnlinePlay Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING }; - freeModSelectOverlay = new FreeModSelectScreen + freeModSelectOverlay = new FreeModSelectOverlay { SelectedMods = { BindTarget = FreeMods }, IsValidMod = IsValidFreeMod, @@ -160,7 +160,7 @@ namespace osu.Game.Screens.OnlinePlay return base.OnExiting(e); } - protected override ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen(OverlayColourScheme.Plum) + protected override ModSelectOverlay CreateModSelectOverlay() => new UserModSelectOverlay(OverlayColourScheme.Plum) { IsValidMod = IsValidMod }; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index eb5e996972..8870239485 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -102,7 +102,7 @@ namespace osu.Game.Screens.Select [Resolved(CanBeNull = true)] private LegacyImportManager legacyImportManager { get; set; } - protected ModSelectScreen ModSelect { get; private set; } + protected ModSelectOverlay ModSelect { get; private set; } protected Sample SampleConfirm { get; private set; } @@ -333,7 +333,7 @@ namespace osu.Game.Screens.Select (new FooterButtonOptions(), BeatmapOptions) }; - protected virtual ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen(); + protected virtual ModSelectOverlay CreateModSelectOverlay() => new UserModSelectOverlay(); protected virtual void ApplyFilterToCarousel(FilterCriteria criteria) { From 9dce329e998e88c415c7d23576d75a29be3ca47f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 May 2022 10:38:35 +0900 Subject: [PATCH 0933/2328] Remove build suffix from version when reporting to sentry --- osu.Game/OsuGameBase.cs | 4 +++- osu.Game/Utils/SentryLogger.cs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index ce798d4027..2e4758a134 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -86,6 +86,8 @@ namespace osu.Game public bool IsDeployedBuild => AssemblyVersion.Major > 0; + internal const string BUILD_SUFFIX = "lazer"; + public virtual string Version { get @@ -94,7 +96,7 @@ namespace osu.Game return @"local " + (DebugUtils.IsDebugBuild ? @"debug" : @"release"); var version = AssemblyVersion; - return $@"{version.Major}.{version.Minor}.{version.Build}-lazer"; + return $@"{version.Major}.{version.Minor}.{version.Build}-{BUILD_SUFFIX}"; } } diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index ad4bcf6274..218d10345f 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -34,7 +34,7 @@ namespace osu.Game.Utils options.AutoSessionTracking = true; options.IsEnvironmentUser = false; - options.Release = game.Version; + options.Release = game.Version.Replace($@"-{OsuGameBase.BUILD_SUFFIX}", string.Empty); }); Logger.NewEntry += processLogEntry; From 533f4b298f5f0a34fa690e33c11ac858cae783ee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 May 2022 10:40:40 +0900 Subject: [PATCH 0934/2328] Add explanation inline for future visitors --- osu.Game/Utils/SentryLogger.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index 218d10345f..16f1a8b039 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -34,6 +34,8 @@ namespace osu.Game.Utils options.AutoSessionTracking = true; options.IsEnvironmentUser = false; + // The reported release needs to match release tags on github in order for sentry + // to automatically associate and track against releases. options.Release = game.Version.Replace($@"-{OsuGameBase.BUILD_SUFFIX}", string.Empty); }); From 843e13a471a0b763ca5cd2f6047478c1fb0241de Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 May 2022 12:55:15 +0900 Subject: [PATCH 0935/2328] Add screen stack context to sentry --- osu.Game/OsuGame.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index b8abef38a8..9edcf90132 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -56,6 +56,8 @@ using osu.Game.Updater; using osu.Game.Users; using osu.Game.Utils; using osuTK.Graphics; +using Sentry; +using Logger = osu.Framework.Logging.Logger; namespace osu.Game { @@ -1197,6 +1199,15 @@ namespace osu.Game private void screenChanged(IScreen current, IScreen newScreen) { + SentrySdk.ConfigureScope(scope => + { + scope.Contexts[@"screen stack"] = new + { + Current = newScreen.GetType().Name, + Previous = current.GetType().Name, + }; + }); + switch (newScreen) { case IntroScreen intro: From b136677bb002565e7736f7947a44fd456685d5df Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 May 2022 14:03:16 +0900 Subject: [PATCH 0936/2328] Add config and clock time contexts to sentry --- osu.Game/Configuration/OsuConfigManager.cs | 16 ++++++++++++++++ osu.Game/Utils/SentryLogger.cs | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 64e77384a2..026a83cceb 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -2,8 +2,10 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using System.Diagnostics; using System.Globalization; +using System.Linq; using osu.Framework.Configuration; using osu.Framework.Configuration.Tracking; using osu.Framework.Extensions; @@ -164,6 +166,20 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.EditorHitAnimations, false); } + public IDictionary GetLoggableState() => + new Dictionary(ConfigStore.Where(kvp => !keyContainsPrivateInformation(kvp.Key)).ToDictionary(kvp => kvp.Key, kvp => kvp.Value.ToString())); + + private static bool keyContainsPrivateInformation(OsuSetting argKey) + { + switch (argKey) + { + case OsuSetting.Token: + return true; + } + + return false; + } + public OsuConfigManager(Storage storage) : base(storage) { diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index ad4bcf6274..e019e4bb12 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -7,9 +7,12 @@ using System; using System.Diagnostics; using System.IO; using System.Net; +using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Logging; +using osu.Game.Configuration; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Overlays; using Sentry; using Sentry.Protocol; @@ -24,8 +27,11 @@ namespace osu.Game.Utils private readonly IDisposable? sentrySession; + private readonly OsuGame game; + public SentryLogger(OsuGame game) { + this.game = game; sentrySession = SentrySdk.Init(options => { // Not setting the dsn will completely disable sentry. @@ -92,6 +98,18 @@ namespace osu.Game.Utils { Message = entry.Message, Level = getSentryLevel(entry.Level), + }, scope => + { + scope.Contexts[@"config"] = new + { + Game = game.Dependencies.Get().GetLoggableState() + // TODO: add framework config here. needs some consideration on how to expose. + }; + scope.Contexts[@"clocks"] = new + { + Audio = game.Dependencies.Get().CurrentTrack.CurrentTime, + Game = game.Clock.CurrentTime, + }; }); } else From 977a0453cc3e18bbc38ba75d77288b0af72834c3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 May 2022 14:11:20 +0900 Subject: [PATCH 0937/2328] Add beatmap context to sentry --- osu.Game/Utils/SentryLogger.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index e019e4bb12..d02ffcb013 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -10,6 +10,7 @@ using System.Net; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Logging; +using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; @@ -105,6 +106,15 @@ namespace osu.Game.Utils Game = game.Dependencies.Get().GetLoggableState() // TODO: add framework config here. needs some consideration on how to expose. }; + + var beatmap = game.Dependencies.Get>().Value.BeatmapInfo; + + scope.Contexts[@"beatmap"] = new + { + Name = beatmap.ToString(), + beatmap.OnlineID, + }; + scope.Contexts[@"clocks"] = new { Audio = game.Dependencies.Get().CurrentTrack.CurrentTime, From f53d42d31ff51e6c43878e49f2db6b3da73a5841 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 May 2022 14:51:56 +0900 Subject: [PATCH 0938/2328] Add realm context to sentry --- osu.Game/Utils/SentryLogger.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index d02ffcb013..a291cee9ae 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -6,14 +6,18 @@ using System; using System.Diagnostics; using System.IO; +using System.Linq; using System.Net; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Logging; using osu.Game.Beatmaps; using osu.Game.Configuration; +using osu.Game.Database; +using osu.Game.Models; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; +using osu.Game.Skinning; using Sentry; using Sentry.Protocol; @@ -101,13 +105,27 @@ namespace osu.Game.Utils Level = getSentryLevel(entry.Level), }, scope => { + var beatmap = game.Dependencies.Get>().Value.BeatmapInfo; + scope.Contexts[@"config"] = new { Game = game.Dependencies.Get().GetLoggableState() // TODO: add framework config here. needs some consideration on how to expose. }; - var beatmap = game.Dependencies.Get>().Value.BeatmapInfo; + game.Dependencies.Get().Run(realm => + { + scope.Contexts[@"realm"] = new + { + Counts = new + { + BeatmapSets = realm.All().Count(), + Beatmaps = realm.All().Count(), + Files = realm.All().Count(), + Skins = realm.All().Count(), + } + }; + }); scope.Contexts[@"beatmap"] = new { From be09ec833e0b5e271f6fe8d50dd3d0e4d965de30 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 May 2022 14:52:08 +0900 Subject: [PATCH 0939/2328] Add global statistics context to sentry --- osu.Game/Utils/SentryLogger.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index a291cee9ae..d68f43e88a 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -11,6 +11,7 @@ using System.Net; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Logging; +using osu.Framework.Statistics; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Database; @@ -127,6 +128,10 @@ namespace osu.Game.Utils }; }); + scope.Contexts[@"global statistics"] = GlobalStatistics.GetStatistics() + .GroupBy(s => s.Group) + .ToDictionary(g => g.Key, items => items.ToDictionary(i => i.Name, g => g.DisplayValue)); + scope.Contexts[@"beatmap"] = new { Name = beatmap.ToString(), From 0b597e712ed72de537fc9e8e413bc06a7c477111 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 11 May 2022 09:39:27 +0300 Subject: [PATCH 0940/2328] Fix timeline not handling mouse down events --- .../Screens/Edit/Compose/Components/Timeline/Timeline.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index 51b8792d87..7e66c57917 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -270,12 +270,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline protected override bool OnMouseDown(MouseDownEvent e) { if (base.OnMouseDown(e)) - { beginUserDrag(); - return true; - } - return false; + return true; } protected override void OnMouseUp(MouseUpEvent e) From e43ce28ada3a21a1b7c978da2db16ea9fee0f994 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 11 May 2022 09:51:00 +0300 Subject: [PATCH 0941/2328] Remove references of "difficulty point" in sample point test scene Fat-fingered. --- .../Editing/TestSceneHitObjectSamplePointAdjustments.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs index dca30a6fc0..f0a2347c31 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs @@ -173,11 +173,11 @@ namespace osu.Game.Tests.Visual.Editing samplePopoverHasSingleBank("normal"); } - private void clickSamplePiece(int objectIndex) => AddStep($"click {objectIndex.ToOrdinalWords()} difficulty piece", () => + private void clickSamplePiece(int objectIndex) => AddStep($"click {objectIndex.ToOrdinalWords()} sample piece", () => { - var difficultyPiece = this.ChildrenOfType().Single(piece => piece.HitObject == EditorBeatmap.HitObjects.ElementAt(objectIndex)); + var samplePiece = this.ChildrenOfType().Single(piece => piece.HitObject == EditorBeatmap.HitObjects.ElementAt(objectIndex)); - InputManager.MoveMouseTo(difficultyPiece); + InputManager.MoveMouseTo(samplePiece); InputManager.Click(MouseButton.Left); }); @@ -216,7 +216,7 @@ namespace osu.Game.Tests.Visual.Editing private void dismissPopover() { AddStep("dismiss popover", () => InputManager.Key(Key.Escape)); - AddUntilStep("wait for dismiss", () => !this.ChildrenOfType().Any(popover => popover.IsPresent)); + AddUntilStep("wait for dismiss", () => !this.ChildrenOfType().Any(popover => popover.IsPresent)); } private void setVolumeViaPopover(int volume) => AddStep($"set volume {volume} via popover", () => From f797514bce5aafb5df020e7fa62c2dd24b0e3139 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 11 May 2022 09:51:59 +0300 Subject: [PATCH 0942/2328] Add failing test cases --- ...tSceneHitObjectDifficultyPointAdjustments.cs | 17 +++++++++++++++++ .../TestSceneHitObjectSamplePointAdjustments.cs | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs index 4012a672ed..7f82d5966e 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs @@ -7,6 +7,7 @@ using NUnit.Framework; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu; @@ -66,6 +67,13 @@ namespace osu.Game.Tests.Visual.Editing }); } + [Test] + public void TestPopoverHasFocus() + { + clickDifficultyPiece(0); + velocityPopoverHasFocus(); + } + [Test] public void TestSingleSelection() { @@ -133,6 +141,15 @@ namespace osu.Game.Tests.Visual.Editing InputManager.Click(MouseButton.Left); }); + private void velocityPopoverHasFocus() => AddUntilStep("velocity popover textbox focused", () => + { + var popover = this.ChildrenOfType().SingleOrDefault(); + var slider = popover?.ChildrenOfType>().Single(); + var textbox = slider?.ChildrenOfType().Single(); + + return textbox?.HasFocus == true; + }); + private void velocityPopoverHasSingleValue(double velocity) => AddUntilStep($"velocity popover has {velocity}", () => { var popover = this.ChildrenOfType().SingleOrDefault(); diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs index f0a2347c31..fcdf4a6e33 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs @@ -57,6 +57,13 @@ namespace osu.Game.Tests.Visual.Editing }); } + [Test] + public void TestPopoverHasFocus() + { + clickSamplePiece(0); + samplePopoverHasFocus(); + } + [Test] public void TestSingleSelection() { @@ -181,6 +188,15 @@ namespace osu.Game.Tests.Visual.Editing InputManager.Click(MouseButton.Left); }); + private void samplePopoverHasFocus() => AddUntilStep("sample popover textbox focused", () => + { + var popover = this.ChildrenOfType().SingleOrDefault(); + var slider = popover?.ChildrenOfType>().Single(); + var textbox = slider?.ChildrenOfType().Single(); + + return textbox?.HasFocus == true; + }); + private void samplePopoverHasSingleVolume(int volume) => AddUntilStep($"sample popover has volume {volume}", () => { var popover = this.ChildrenOfType().SingleOrDefault(); From 24432dffc4622135e1a296638d1e765ca9801477 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 11 May 2022 09:53:04 +0300 Subject: [PATCH 0943/2328] Add support for focusing intermediate slider-textbox component --- .../Edit/Timing/IndeterminateSliderWithTextBoxInput.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game/Screens/Edit/Timing/IndeterminateSliderWithTextBoxInput.cs b/osu.Game/Screens/Edit/Timing/IndeterminateSliderWithTextBoxInput.cs index 0cf2cf6c54..16a04982f5 100644 --- a/osu.Game/Screens/Edit/Timing/IndeterminateSliderWithTextBoxInput.cs +++ b/osu.Game/Screens/Edit/Timing/IndeterminateSliderWithTextBoxInput.cs @@ -7,6 +7,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays.Settings; @@ -107,6 +108,14 @@ namespace osu.Game.Screens.Edit.Timing Current.BindValueChanged(_ => updateState(), true); } + public override bool AcceptsFocus => true; + + protected override void OnFocus(FocusEvent e) + { + base.OnFocus(e); + GetContainingInputManager().ChangeFocus(textBox); + } + private void updateState() { if (Current.Value is T nonNullValue) From 96db530de63626afa8ed51f3f8f24de669a7faa2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 11 May 2022 09:55:34 +0300 Subject: [PATCH 0944/2328] Focus textbox on control point popovers --- .../Compose/Components/Timeline/DifficultyPointPiece.cs | 6 ++++++ .../Edit/Compose/Components/Timeline/SamplePointPiece.cs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/DifficultyPointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/DifficultyPointPiece.cs index b230bab0c2..eaaa663fe7 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/DifficultyPointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/DifficultyPointPiece.cs @@ -122,6 +122,12 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline beatmap.EndChange(); }); } + + protected override void LoadComplete() + { + base.LoadComplete(); + ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(sliderVelocitySlider)); + } } } } diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index fc0952d4f0..ab21a83c43 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -126,6 +126,12 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline volume.Current.BindValueChanged(val => updateVolumeFor(relevantObjects, val.NewValue)); } + protected override void LoadComplete() + { + base.LoadComplete(); + ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(volume)); + } + private static string? getCommonBank(SampleControlPoint[] relevantControlPoints) => relevantControlPoints.Select(point => point.SampleBank).Distinct().Count() == 1 ? relevantControlPoints.First().SampleBank : null; private static int? getCommonVolume(SampleControlPoint[] relevantControlPoints) => relevantControlPoints.Select(point => point.SampleVolume).Distinct().Count() == 1 ? (int?)relevantControlPoints.First().SampleVolume : null; From 1c369956066c28ffe2333d03ae9353e1cf9a09f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 May 2022 16:09:16 +0900 Subject: [PATCH 0945/2328] Expose `HoldingForHUD` state from `HUDOverlay` as bindable --- osu.Game/Screens/Play/HUDOverlay.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index abfed1acd0..f6087e0958 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -68,7 +68,9 @@ namespace osu.Game.Screens.Play internal readonly IBindable IsPlaying = new Bindable(); - private bool holdingForHUD; + public IBindable HoldingForHUD => holdingForHUD; + + private readonly BindableBool holdingForHUD = new BindableBool(); private readonly SkinnableTargetContainer mainComponents; @@ -144,7 +146,8 @@ namespace osu.Game.Screens.Play hideTargets.ForEach(d => d.Hide()); } - public override void Hide() => throw new InvalidOperationException($"{nameof(HUDOverlay)} should not be hidden as it will remove the ability of a user to quit. Use {nameof(ShowHud)} instead."); + public override void Hide() => + throw new InvalidOperationException($"{nameof(HUDOverlay)} should not be hidden as it will remove the ability of a user to quit. Use {nameof(ShowHud)} instead."); protected override void LoadComplete() { @@ -152,6 +155,7 @@ namespace osu.Game.Screens.Play ShowHud.BindValueChanged(visible => hideTargets.ForEach(d => d.FadeTo(visible.NewValue ? 1 : 0, FADE_DURATION, FADE_EASING))); + holdingForHUD.BindValueChanged(_ => updateVisibility()); IsPlaying.BindValueChanged(_ => updateVisibility()); configVisibilityMode.BindValueChanged(_ => updateVisibility(), true); @@ -204,7 +208,7 @@ namespace osu.Game.Screens.Play if (ShowHud.Disabled) return; - if (holdingForHUD) + if (holdingForHUD.Value) { ShowHud.Value = true; return; @@ -287,8 +291,7 @@ namespace osu.Game.Screens.Play switch (e.Action) { case GlobalAction.HoldForHUD: - holdingForHUD = true; - updateVisibility(); + holdingForHUD.Value = true; return true; case GlobalAction.ToggleInGameInterface: @@ -318,8 +321,7 @@ namespace osu.Game.Screens.Play switch (e.Action) { case GlobalAction.HoldForHUD: - holdingForHUD = false; - updateVisibility(); + holdingForHUD.Value = false; break; } } From d05cd6908763cd47ca66281f70d6540b2080ea39 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 May 2022 16:12:54 +0900 Subject: [PATCH 0946/2328] Change multiplayer leaderboard to always hide during gameplay unless holding-for-HUD --- .../OnlinePlay/Multiplayer/MultiplayerPlayer.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs index 02ff040a94..5dab845999 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs @@ -43,6 +43,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer private readonly MultiplayerRoomUser[] users; + private readonly Bindable leaderboardExpanded = new BindableBool(); + private LoadingLayer loadingDisplay; private FillFlowContainer leaderboardFlow; @@ -76,13 +78,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer Spacing = new Vector2(5) }); + HUDOverlay.HoldingForHUD.BindValueChanged(_ => updateLeaderboardExpandedState()); + LocalUserPlaying.BindValueChanged(_ => updateLeaderboardExpandedState(), true); + // todo: this should be implemented via a custom HUD implementation, and correctly masked to the main content area. LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(GameplayState.Ruleset.RulesetInfo, ScoreProcessor, users), l => { if (!LoadedBeatmapSuccessfully) return; - ((IBindable)leaderboard.Expanded).BindTo(HUDOverlay.ShowHud); + leaderboard.Expanded.BindTo(leaderboardExpanded); leaderboardFlow.Insert(0, l); @@ -99,7 +104,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer LoadComponentAsync(new GameplayChatDisplay(Room) { - Expanded = { BindTarget = HUDOverlay.ShowHud }, + Expanded = { BindTarget = leaderboardExpanded }, }, chat => leaderboardFlow.Insert(2, chat)); HUDOverlay.Add(loadingDisplay = new LoadingLayer(true) { Depth = float.MaxValue }); @@ -152,6 +157,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer } } + private void updateLeaderboardExpandedState() => + leaderboardExpanded.Value = !LocalUserPlaying.Value || HUDOverlay.HoldingForHUD.Value; + private void failAndBail(string message = null) { if (!string.IsNullOrEmpty(message)) From d51689e9ae38a0f0030ac436701d22d57465b51d Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 11 May 2022 11:25:41 +0300 Subject: [PATCH 0947/2328] Unfocus textbox when dismissing popover in test scene --- .../Editing/TestSceneHitObjectDifficultyPointAdjustments.cs | 1 + .../Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs index 7f82d5966e..7c05abc2cd 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs @@ -168,6 +168,7 @@ namespace osu.Game.Tests.Visual.Editing private void dismissPopover() { + AddStep("unfocus textbox", () => InputManager.Key(Key.Escape)); AddStep("dismiss popover", () => InputManager.Key(Key.Escape)); AddUntilStep("wait for dismiss", () => !this.ChildrenOfType().Any(popover => popover.IsPresent)); } diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs index fcdf4a6e33..4501eea88e 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs @@ -231,6 +231,7 @@ namespace osu.Game.Tests.Visual.Editing private void dismissPopover() { + AddStep("unfocus textbox", () => InputManager.Key(Key.Escape)); AddStep("dismiss popover", () => InputManager.Key(Key.Escape)); AddUntilStep("wait for dismiss", () => !this.ChildrenOfType().Any(popover => popover.IsPresent)); } From 551370d27b1a9c4e941335e706efc9bc19896cfe Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 11 May 2022 18:26:08 +0900 Subject: [PATCH 0948/2328] Update ReSharper package --- .config/dotnet-tools.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 1132396608..65ac05261a 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "jetbrains.resharper.globaltools": { - "version": "2022.1.0-eap10", + "version": "2022.1.1", "commands": [ "jb" ] @@ -27,4 +27,4 @@ ] } } -} +} \ No newline at end of file From a46894b613df38cb0d4d159f6e86a87dd2a0e8fb Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 11 May 2022 18:27:57 +0900 Subject: [PATCH 0949/2328] Bust CI cache on more files --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 514acef525..729f2f266d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: uses: actions/cache@v3 with: path: ${{ github.workspace }}/inspectcode - key: inspectcode-${{ hashFiles('.config/dotnet-tools.json') }}-${{ hashFiles('.github/workflows/ci.yml' ) }} + key: inspectcode-${{ hashFiles('.config/dotnet-tools.json', '.github/workflows/ci.yml', 'osu.sln*', '.editorconfig', '.globalconfig') }} - name: Dotnet code style run: dotnet build -c Debug -warnaserror osu.Desktop.slnf -p:EnforceCodeStyleInBuild=true From fecf92e16f926b2d5e2a8f51b2e3c03bf8736d0d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 May 2022 19:51:22 +0900 Subject: [PATCH 0950/2328] Update libraries to latest versions --- .../osu.Game.Rulesets.EmptyFreeform.Tests.csproj | 2 +- .../osu.Game.Rulesets.Pippidon.Tests.csproj | 2 +- .../osu.Game.Rulesets.EmptyScrolling.Tests.csproj | 2 +- .../osu.Game.Rulesets.Pippidon.Tests.csproj | 2 +- osu.Android.props | 2 +- osu.Desktop/osu.Desktop.csproj | 2 +- osu.Game.Benchmarks/osu.Game.Benchmarks.csproj | 2 +- .../osu.Game.Rulesets.Catch.Tests.csproj | 2 +- .../osu.Game.Rulesets.Mania.Tests.csproj | 2 +- .../osu.Game.Rulesets.Osu.Tests.csproj | 2 +- .../osu.Game.Rulesets.Taiko.Tests.csproj | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 2 +- .../osu.Game.Tournament.Tests.csproj | 2 +- osu.Game/osu.Game.csproj | 14 +++++++------- osu.iOS.props | 8 ++++---- 15 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform.Tests/osu.Game.Rulesets.EmptyFreeform.Tests.csproj b/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform.Tests/osu.Game.Rulesets.EmptyFreeform.Tests.csproj index cb922c5a58..bc285dbe11 100644 --- a/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform.Tests/osu.Game.Rulesets.EmptyFreeform.Tests.csproj +++ b/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform.Tests/osu.Game.Rulesets.EmptyFreeform.Tests.csproj @@ -11,7 +11,7 @@ - + diff --git a/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj b/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj index 5ecd9cc675..718ada1905 100644 --- a/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj +++ b/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj @@ -11,7 +11,7 @@ - + diff --git a/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling.Tests/osu.Game.Rulesets.EmptyScrolling.Tests.csproj b/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling.Tests/osu.Game.Rulesets.EmptyScrolling.Tests.csproj index 33ad0ac4f7..6b9c3f4d63 100644 --- a/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling.Tests/osu.Game.Rulesets.EmptyScrolling.Tests.csproj +++ b/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling.Tests/osu.Game.Rulesets.EmptyScrolling.Tests.csproj @@ -11,7 +11,7 @@ - + diff --git a/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj b/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj index 5ecd9cc675..718ada1905 100644 --- a/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj +++ b/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj @@ -11,7 +11,7 @@ - + diff --git a/osu.Android.props b/osu.Android.props index 97d9dbc380..af4a93d191 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -56,6 +56,6 @@ - + diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index a4f309c6ac..a4f9e2671b 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -24,7 +24,7 @@ - + diff --git a/osu.Game.Benchmarks/osu.Game.Benchmarks.csproj b/osu.Game.Benchmarks/osu.Game.Benchmarks.csproj index 434c0e0367..36ffd3b5b6 100644 --- a/osu.Game.Benchmarks/osu.Game.Benchmarks.csproj +++ b/osu.Game.Benchmarks/osu.Game.Benchmarks.csproj @@ -8,7 +8,7 @@ - + diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj index fc6d900567..b957ade952 100644 --- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj +++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj @@ -3,7 +3,7 @@ - + diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index ddad2adfea..d3b4b378c0 100644 --- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj +++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj @@ -3,7 +3,7 @@ - + diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj index 4ce29ab5c7..2c0d3fd937 100644 --- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj +++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj @@ -4,7 +4,7 @@ - + diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj index a6b8eb8651..ce468d399b 100644 --- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj +++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj @@ -3,7 +3,7 @@ - + diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 0bcf533653..a1eef4ce47 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -5,7 +5,7 @@ - + diff --git a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj index c7314a4969..6fd53d923b 100644 --- a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj +++ b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj @@ -6,7 +6,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2f32c843c0..89cb882981 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -23,9 +23,9 @@ - - - + + + @@ -34,12 +34,12 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - - + + + diff --git a/osu.iOS.props b/osu.iOS.props index b483267696..46580705f7 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -85,10 +85,10 @@ - - + + - - + + From 3cbd19a9ce09c800005e6b51d263e4d4593362d5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 May 2022 21:17:16 +0900 Subject: [PATCH 0951/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index af4a93d191..98dc28d915 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 89cb882981..772a78c8fe 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 46580705f7..af8f9b617c 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 9d30b490ade53ada8771a704a03163c04f15028f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 11 May 2022 18:26:04 +0300 Subject: [PATCH 0952/2328] Fix intermittent test failures in results screen --- .../Visual/Ranking/TestSceneResultsScreen.cs | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs b/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs index a1d51683e4..2a5fc050d3 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs @@ -103,7 +103,7 @@ namespace osu.Game.Tests.Visual.Ranking score.Accuracy = accuracy; score.Rank = rank; - AddStep("load results", () => Child = new TestResultsContainer(screen = createResultsScreen(score))); + loadResultsScreen(() => screen = createResultsScreen(score)); AddUntilStep("wait for loaded", () => screen.IsLoaded); AddAssert("retry overlay present", () => screen.RetryOverlay != null); } @@ -113,7 +113,7 @@ namespace osu.Game.Tests.Visual.Ranking { UnrankedSoloResultsScreen screen = null; - AddStep("load results", () => Child = new TestResultsContainer(screen = createUnrankedSoloResultsScreen())); + loadResultsScreen(() => screen = createUnrankedSoloResultsScreen()); AddUntilStep("wait for loaded", () => screen.IsLoaded); AddAssert("retry overlay present", () => screen.RetryOverlay != null); } @@ -123,7 +123,7 @@ namespace osu.Game.Tests.Visual.Ranking { TestResultsScreen screen = null; - AddStep("load results", () => Child = new TestResultsContainer(screen = createResultsScreen())); + loadResultsScreen(() => screen = createResultsScreen()); AddUntilStep("wait for load", () => this.ChildrenOfType().Single().AllPanelsVisible); AddStep("click expanded panel", () => @@ -162,7 +162,7 @@ namespace osu.Game.Tests.Visual.Ranking { TestResultsScreen screen = null; - AddStep("load results", () => Child = new TestResultsContainer(screen = createResultsScreen())); + loadResultsScreen(() => screen = createResultsScreen()); AddUntilStep("wait for load", () => this.ChildrenOfType().Single().AllPanelsVisible); AddStep("click expanded panel", () => @@ -201,7 +201,7 @@ namespace osu.Game.Tests.Visual.Ranking { TestResultsScreen screen = null; - AddStep("load results", () => Child = new TestResultsContainer(screen = createResultsScreen())); + loadResultsScreen(() => screen = createResultsScreen()); AddUntilStep("wait for load", () => this.ChildrenOfType().Single().AllPanelsVisible); ScorePanel expandedPanel = null; @@ -231,7 +231,7 @@ namespace osu.Game.Tests.Visual.Ranking var tcs = new TaskCompletionSource(); - AddStep("load results", () => Child = new TestResultsContainer(screen = new DelayedFetchResultsScreen(TestResources.CreateTestScoreInfo(), tcs.Task))); + loadResultsScreen(() => screen = new DelayedFetchResultsScreen(TestResources.CreateTestScoreInfo(), tcs.Task)); AddUntilStep("wait for loaded", () => screen.IsLoaded); @@ -255,7 +255,7 @@ namespace osu.Game.Tests.Visual.Ranking { TestResultsScreen screen = null; - AddStep("load results", () => Child = new TestResultsContainer(screen = createResultsScreen())); + loadResultsScreen(() => screen = createResultsScreen()); AddUntilStep("wait for load", () => this.ChildrenOfType().Single().AllPanelsVisible); AddAssert("download button is disabled", () => !screen.ChildrenOfType().Last().Enabled.Value); @@ -276,7 +276,7 @@ namespace osu.Game.Tests.Visual.Ranking var ruleset = new RulesetWithNoPerformanceCalculator(); var score = TestResources.CreateTestScoreInfo(ruleset.RulesetInfo); - AddStep("load results", () => Child = new TestResultsContainer(createResultsScreen(score))); + loadResultsScreen(() => createResultsScreen(score)); AddUntilStep("wait for load", () => this.ChildrenOfType().Single().AllPanelsVisible); AddAssert("PP displayed as 0", () => @@ -287,6 +287,22 @@ namespace osu.Game.Tests.Visual.Ranking }); } + private void loadResultsScreen(Func createResults) + { + ResultsScreen results = null; + + AddStep("load results", () => Child = new TestResultsContainer(results = createResults())); + + // expanded panel should be centered the moment results screen is loaded + // but can potentially be scrolled away on certain specific load scenarios. + // see: https://github.com/ppy/osu/issues/18226 + AddUntilStep("expanded panel in centre of screen", () => + { + var expandedPanel = this.ChildrenOfType().Single(p => p.State == PanelState.Expanded); + return Precision.AlmostEquals(expandedPanel.ScreenSpaceDrawQuad.Centre.X, results.ScreenSpaceDrawQuad.Centre.X, 1); + }); + } + private TestResultsScreen createResultsScreen(ScoreInfo score = null) => new TestResultsScreen(score ?? TestResources.CreateTestScoreInfo()); private UnrankedSoloResultsScreen createUnrankedSoloResultsScreen() => new UnrankedSoloResultsScreen(TestResources.CreateTestScoreInfo()); From a104277e7fbd1315fa230fa67d6be9ea317f92e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 18:01:33 +0200 Subject: [PATCH 0953/2328] Rename `ModSelect{Screen -> Overlay}Strings` --- ...ModSelectScreenStrings.cs => ModSelectOverlayStrings.cs} | 6 +++--- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) rename osu.Game/Localisation/{ModSelectScreenStrings.cs => ModSelectOverlayStrings.cs} (94%) diff --git a/osu.Game/Localisation/ModSelectScreenStrings.cs b/osu.Game/Localisation/ModSelectOverlayStrings.cs similarity index 94% rename from osu.Game/Localisation/ModSelectScreenStrings.cs rename to osu.Game/Localisation/ModSelectOverlayStrings.cs index 0c113fd381..e9af7147e3 100644 --- a/osu.Game/Localisation/ModSelectScreenStrings.cs +++ b/osu.Game/Localisation/ModSelectOverlayStrings.cs @@ -5,9 +5,9 @@ using osu.Framework.Localisation; namespace osu.Game.Localisation { - public static class ModSelectScreenStrings + public static class ModSelectOverlayStrings { - private const string prefix = @"osu.Game.Resources.Localisation.ModSelectScreen"; + private const string prefix = @"osu.Game.Resources.Localisation.ModSelectOverlay"; /// /// "Mod Select" @@ -26,4 +26,4 @@ namespace osu.Game.Localisation private static string getKey(string key) => $@"{prefix}:{key}"; } -} \ No newline at end of file +} diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index b589b2e7e1..7a8e89584a 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -84,8 +84,8 @@ namespace osu.Game.Overlays.Mods [BackgroundDependencyLoader] private void load(OsuColour colours) { - Header.Title = ModSelectScreenStrings.ModSelectTitle; - Header.Description = ModSelectScreenStrings.ModSelectDescription; + Header.Title = ModSelectOverlayStrings.ModSelectTitle; + Header.Description = ModSelectOverlayStrings.ModSelectDescription; AddRange(new Drawable[] { @@ -262,7 +262,7 @@ namespace osu.Game.Overlays.Mods { customisationButton = new ShearedToggleButton(BUTTON_WIDTH) { - Text = ModSelectScreenStrings.ModCustomisation, + Text = ModSelectOverlayStrings.ModCustomisation, Active = { BindTarget = customisationVisible } }, new ShearedButton(BUTTON_WIDTH) From 62f6caf76dcc836b08a7db054d7f77d149c551c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 18:04:39 +0200 Subject: [PATCH 0954/2328] Rename `ModSelect{Screen -> Overlay}` test scenes --- ...eFreeModSelectScreen.cs => TestSceneFreeModSelectOverlay.cs} | 2 +- ...TestSceneModSelectScreen.cs => TestSceneModSelectOverlay.cs} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename osu.Game.Tests/Visual/Multiplayer/{TestSceneFreeModSelectScreen.cs => TestSceneFreeModSelectOverlay.cs} (98%) rename osu.Game.Tests/Visual/UserInterface/{TestSceneModSelectScreen.cs => TestSceneModSelectOverlay.cs} (99%) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs similarity index 98% rename from osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs rename to osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs index 9a24a1c646..f40c31b07f 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs @@ -17,7 +17,7 @@ using osuTK.Input; namespace osu.Game.Tests.Visual.Multiplayer { - public class TestSceneFreeModSelectScreen : MultiplayerTestScene + public class TestSceneFreeModSelectOverlay : MultiplayerTestScene { private FreeModSelectOverlay freeModSelectOverlay; private readonly Bindable>> availableMods = new Bindable>>(); diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs similarity index 99% rename from osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs rename to osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs index 2e2ce6edd7..08ad030b39 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs @@ -24,7 +24,7 @@ using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] - public class TestSceneModSelectScreen : OsuManualInputManagerTestScene + public class TestSceneModSelectOverlay : OsuManualInputManagerTestScene { [Resolved] private RulesetStore rulesetStore { get; set; } From 9b7ff9f2ee3d9aee2eb443c1e354024e8eae07ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 18:05:09 +0200 Subject: [PATCH 0955/2328] Rename `modSelect{Screen -> Overlay}2` variable --- .../Visual/UserInterface/TestSceneModSelectOverlay.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs index 08ad030b39..fc543d9db7 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs @@ -222,7 +222,7 @@ namespace osu.Game.Tests.Visual.UserInterface public void TestSettingsNotCrossPolluting() { Bindable> selectedMods2 = null; - ModSelectOverlay modSelectScreen2 = null; + ModSelectOverlay modSelectOverlay2 = null; createScreen(); AddStep("select diff adjust", () => SelectedMods.Value = new Mod[] { new OsuModDifficultyAdjust() }); @@ -235,7 +235,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("create second overlay", () => { - Add(modSelectScreen2 = new UserModSelectOverlay().With(d => + Add(modSelectOverlay2 = new UserModSelectOverlay().With(d => { d.Origin = Anchor.TopCentre; d.Anchor = Anchor.TopCentre; @@ -243,7 +243,7 @@ namespace osu.Game.Tests.Visual.UserInterface })); }); - AddStep("show", () => modSelectScreen2.Show()); + AddStep("show", () => modSelectOverlay2.Show()); AddAssert("ensure first is unchanged", () => SelectedMods.Value.OfType().Single().CircleSize.Value == 8); AddAssert("ensure second is default", () => selectedMods2.Value.OfType().Single().CircleSize.Value == null); From ddb2d4eef51220e0f41835ddfe4ec593482279fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 18:06:09 +0200 Subject: [PATCH 0956/2328] Rename `FreeModSelect{Screen -> Overlay}` reference in inline comment --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 7a8e89584a..b3c3eee15a 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -193,7 +193,7 @@ namespace osu.Game.Overlays.Mods State.BindValueChanged(_ => samplePlaybackDisabled.Value = State.Value == Visibility.Hidden, true); // This is an optimisation to prevent refreshing the available settings controls when it can be - // reasonably assumed that the settings panel is never to be displayed (e.g. FreeModSelectScreen). + // reasonably assumed that the settings panel is never to be displayed (e.g. FreeModSelectOverlay). if (customisationButton != null) ((IBindable>)modSettingsArea.SelectedMods).BindTo(SelectedMods); From 315c67a316343e8935c61e640aa502c418e887cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 19:59:30 +0200 Subject: [PATCH 0957/2328] Add failing test case for ruleset without all mod types --- .../UserInterface/TestSceneModSelectOverlay.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs index fc543d9db7..0b037a10cd 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs @@ -18,6 +18,7 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; +using osu.Game.Tests.Mods; using osuTK; using osuTK.Input; @@ -481,6 +482,21 @@ namespace osu.Game.Tests.Visual.UserInterface AddUntilStep("3 columns visible", () => this.ChildrenOfType().Count(col => col.IsPresent) == 3); } + [Test] + public void TestColumnHidingOnRulesetChange() + { + createScreen(); + + changeRuleset(0); + AddAssert("5 columns visible", () => this.ChildrenOfType().Count(col => col.IsPresent) == 5); + + AddStep("change to ruleset without all mod types", () => Ruleset.Value = TestCustomisableModRuleset.CreateTestRulesetInfo()); + AddUntilStep("1 column visible", () => this.ChildrenOfType().Count(col => col.IsPresent) == 1); + + changeRuleset(0); + AddAssert("5 columns visible", () => this.ChildrenOfType().Count(col => col.IsPresent) == 5); + } + private void waitForColumnLoad() => AddUntilStep("all column content loaded", () => modSelectOverlay.ChildrenOfType().Any() && modSelectOverlay.ChildrenOfType().All(column => column.IsLoaded && column.ItemsLoaded)); From 478cfc0b87ac3a6062e5948fe8df496df0fac991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 18:26:52 +0200 Subject: [PATCH 0958/2328] Split model class for mod state --- osu.Game/Overlays/Mods/ModState.cs | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 osu.Game/Overlays/Mods/ModState.cs diff --git a/osu.Game/Overlays/Mods/ModState.cs b/osu.Game/Overlays/Mods/ModState.cs new file mode 100644 index 0000000000..8fdd5db00b --- /dev/null +++ b/osu.Game/Overlays/Mods/ModState.cs @@ -0,0 +1,35 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Bindables; +using osu.Game.Rulesets.Mods; + +namespace osu.Game.Overlays.Mods +{ + /// + /// Wrapper class used to store the current state of a mod shown on the . + /// Used primarily to decouple data from drawable logic. + /// + public class ModState + { + /// + /// The mod that whose state this instance describes. + /// + public Mod Mod { get; } + + /// + /// Whether the mod is currently selected. + /// + public BindableBool Active { get; } = new BindableBool(); + + /// + /// Whether the mod is currently filtered out due to not matching imposed criteria. + /// + public BindableBool Filtered { get; } = new BindableBool(); + + public ModState(Mod mod) + { + Mod = mod; + } + } +} From 74599c9c625ae9902e16dfd80d2132d0fc0051e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 18:29:14 +0200 Subject: [PATCH 0959/2328] Use `ModState` in mod panels --- osu.Game/Overlays/Mods/ModPanel.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModPanel.cs b/osu.Game/Overlays/Mods/ModPanel.cs index 4c4951307d..02b8c195ec 100644 --- a/osu.Game/Overlays/Mods/ModPanel.cs +++ b/osu.Game/Overlays/Mods/ModPanel.cs @@ -28,9 +28,11 @@ namespace osu.Game.Overlays.Mods { public class ModPanel : OsuClickableContainer { - public Mod Mod { get; } - public BindableBool Active { get; } = new BindableBool(); - public BindableBool Filtered { get; } = new BindableBool(); + public Mod Mod => modState.Mod; + public BindableBool Active => modState.Active; + public BindableBool Filtered => modState.Filtered; + + private readonly ModState modState; protected readonly Box Background; protected readonly Container SwitchContainer; @@ -57,7 +59,7 @@ namespace osu.Game.Overlays.Mods public ModPanel(Mod mod) { - Mod = mod; + modState = new ModState(mod); RelativeSizeAxes = Axes.X; Height = 42; From e86444c4bf433a34adce2a62f3f0eae9fc9a12ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 18:37:31 +0200 Subject: [PATCH 0960/2328] Hoist `ModState` to column level --- .../Mods/IncompatibilityDisplayingModPanel.cs | 5 +++++ osu.Game/Overlays/Mods/ModColumn.cs | 21 ++++++++++--------- osu.Game/Overlays/Mods/ModPanel.cs | 15 ++++++++----- .../Overlays/Mods/UserModSelectOverlay.cs | 2 +- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs b/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs index aeb983d352..34c4458a21 100644 --- a/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs +++ b/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs @@ -19,6 +19,11 @@ namespace osu.Game.Overlays.Mods [Resolved] private Bindable> selectedMods { get; set; } + public IncompatibilityDisplayingModPanel(ModState modState) + : base(modState) + { + } + public IncompatibilityDisplayingModPanel(Mod mod) : base(mod) { diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index b32ebb4a5c..c5364fb403 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -20,6 +20,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; +using osu.Framework.Lists; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -83,20 +84,20 @@ namespace osu.Game.Overlays.Mods protected override bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) => base.ReceivePositionalInputAtSubTree(screenSpacePos) && Active.Value; - protected virtual ModPanel CreateModPanel(Mod mod) => new ModPanel(mod); + protected virtual ModPanel CreateModPanel(ModState mod) => new ModPanel(mod); private readonly Key[]? toggleKeys; private readonly Bindable>> availableMods = new Bindable>>(); /// - /// All mods that are available for the current ruleset in this particular column. + /// Contains information about state of all mods that are available for the current ruleset in this particular column. /// /// /// Note that the mod instances in this list are owned solely by this column /// (as in, they are locally-managed clones, to ensure proper isolation from any other external instances). /// - private IReadOnlyList localAvailableMods = Array.Empty(); + private IReadOnlyList localAvailableMods = Array.Empty(); private readonly TextFlowContainer headerText; private readonly Box headerBackground; @@ -291,10 +292,10 @@ namespace osu.Game.Overlays.Mods private void updateLocalAvailableMods(bool asyncLoadContent) { var newMods = ModUtils.FlattenMods(availableMods.Value.GetValueOrDefault(ModType) ?? Array.Empty()) - .Select(m => m.DeepClone()) + .Select(m => new ModState(m.DeepClone())) .ToList(); - if (newMods.SequenceEqual(localAvailableMods)) + if (newMods.SequenceEqual(localAvailableMods, new FuncEqualityComparer((x, y) => ReferenceEquals(x.Mod, y.Mod)))) return; localAvailableMods = newMods; @@ -393,18 +394,18 @@ namespace osu.Game.Overlays.Mods var newSelection = new List(); - foreach (var mod in localAvailableMods) + foreach (var modState in localAvailableMods) { - var matchingSelectedMod = mods.SingleOrDefault(selected => selected.GetType() == mod.GetType()); + var matchingSelectedMod = mods.SingleOrDefault(selected => selected.GetType() == modState.GetType()); if (matchingSelectedMod != null) { - mod.CopyFrom(matchingSelectedMod); - newSelection.Add(mod); + modState.Mod.CopyFrom(matchingSelectedMod); + newSelection.Add(modState.Mod); } else { - mod.ResetSettingsToDefaults(); + modState.Mod.ResetSettingsToDefaults(); } } diff --git a/osu.Game/Overlays/Mods/ModPanel.cs b/osu.Game/Overlays/Mods/ModPanel.cs index 02b8c195ec..7010342bd8 100644 --- a/osu.Game/Overlays/Mods/ModPanel.cs +++ b/osu.Game/Overlays/Mods/ModPanel.cs @@ -57,9 +57,9 @@ namespace osu.Game.Overlays.Mods private Sample? sampleOff; private Sample? sampleOn; - public ModPanel(Mod mod) + public ModPanel(ModState modState) { - modState = new ModState(mod); + this.modState = modState; RelativeSizeAxes = Axes.X; Height = 42; @@ -81,7 +81,7 @@ namespace osu.Game.Overlays.Mods SwitchContainer = new Container { RelativeSizeAxes = Axes.Y, - Child = new ModSwitchSmall(mod) + Child = new ModSwitchSmall(Mod) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -117,7 +117,7 @@ namespace osu.Game.Overlays.Mods { new OsuSpriteText { - Text = mod.Name, + Text = Mod.Name, Font = OsuFont.TorusAlternate.With(size: 18, weight: FontWeight.SemiBold), Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0), Margin = new MarginPadding @@ -127,7 +127,7 @@ namespace osu.Game.Overlays.Mods }, new OsuSpriteText { - Text = mod.Description, + Text = Mod.Description, Font = OsuFont.Default.With(size: 12), RelativeSizeAxes = Axes.X, Truncate = true, @@ -143,6 +143,11 @@ namespace osu.Game.Overlays.Mods Action = Active.Toggle; } + public ModPanel(Mod mod) + : this(new ModState(mod)) + { + } + [BackgroundDependencyLoader(true)] private void load(AudioManager audio, OsuColour colours, ISamplePlaybackDisabler? samplePlaybackDisabler) { diff --git a/osu.Game/Overlays/Mods/UserModSelectOverlay.cs b/osu.Game/Overlays/Mods/UserModSelectOverlay.cs index 8ff5e28c8f..7100446730 100644 --- a/osu.Game/Overlays/Mods/UserModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/UserModSelectOverlay.cs @@ -47,7 +47,7 @@ namespace osu.Game.Overlays.Mods { } - protected override ModPanel CreateModPanel(Mod mod) => new IncompatibilityDisplayingModPanel(mod); + protected override ModPanel CreateModPanel(ModState modState) => new IncompatibilityDisplayingModPanel(modState); } } } From 05a21fbbe0563605fe002dfe49ff1bb7a87632da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 19:02:45 +0200 Subject: [PATCH 0961/2328] Hoist `ModState` to overlay level --- osu.Game/Overlays/Mods/ModColumn.cs | 69 ++++++++-------------- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 47 +++++++++++---- 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index c5364fb403..8b3896a88c 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -20,13 +20,11 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; -using osu.Framework.Lists; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; using osu.Game.Rulesets.Mods; -using osu.Game.Utils; using osuTK; using osuTK.Graphics; using osuTK.Input; @@ -39,6 +37,23 @@ namespace osu.Game.Overlays.Mods public readonly ModType ModType; + private IReadOnlyList availableMods = Array.Empty(); + + /// + /// Sets the list of mods to show in this column. + /// + public IReadOnlyList AvailableMods + { + get => availableMods; + set + { + Debug.Assert(value.All(mod => mod.Mod.Type == ModType)); + + availableMods = value; + asyncLoadPanels(); + } + } + private Func? filter; /// @@ -88,17 +103,6 @@ namespace osu.Game.Overlays.Mods private readonly Key[]? toggleKeys; - private readonly Bindable>> availableMods = new Bindable>>(); - - /// - /// Contains information about state of all mods that are available for the current ruleset in this particular column. - /// - /// - /// Note that the mod instances in this list are owned solely by this column - /// (as in, they are locally-managed clones, to ensure proper isolation from any other external instances). - /// - private IReadOnlyList localAvailableMods = Array.Empty(); - private readonly TextFlowContainer headerText; private readonly Box headerBackground; private readonly Container contentContainer; @@ -258,12 +262,8 @@ namespace osu.Game.Overlays.Mods } [BackgroundDependencyLoader] - private void load(OsuGameBase game, OverlayColourProvider colourProvider, OsuColour colours) + private void load(OverlayColourProvider colourProvider, OsuColour colours) { - availableMods.BindTo(game.AvailableMods); - updateLocalAvailableMods(asyncLoadContent: false); - availableMods.BindValueChanged(_ => updateLocalAvailableMods(asyncLoadContent: true)); - headerBackground.Colour = accentColour = colours.ForModType(ModType); if (toggleAllCheckbox != null) @@ -289,30 +289,13 @@ namespace osu.Game.Overlays.Mods toggleAllCheckbox.LabelText = toggleAllCheckbox.Current.Value ? CommonStrings.DeselectAll : CommonStrings.SelectAll; } - private void updateLocalAvailableMods(bool asyncLoadContent) - { - var newMods = ModUtils.FlattenMods(availableMods.Value.GetValueOrDefault(ModType) ?? Array.Empty()) - .Select(m => new ModState(m.DeepClone())) - .ToList(); - - if (newMods.SequenceEqual(localAvailableMods, new FuncEqualityComparer((x, y) => ReferenceEquals(x.Mod, y.Mod)))) - return; - - localAvailableMods = newMods; - - if (asyncLoadContent) - asyncLoadPanels(); - else - onPanelsLoaded(createPanels()); - } - private CancellationTokenSource? cancellationTokenSource; private void asyncLoadPanels() { cancellationTokenSource?.Cancel(); - var panels = createPanels(); + var panels = availableMods.Select(mod => CreateModPanel(mod).With(panel => panel.Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0))); Task? loadTask; @@ -324,12 +307,6 @@ namespace osu.Game.Overlays.Mods }); } - private IEnumerable createPanels() - { - var panels = localAvailableMods.Select(mod => CreateModPanel(mod).With(panel => panel.Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0))); - return panels; - } - private void onPanelsLoaded(IEnumerable loaded) { panelFlow.ChildrenEnumerable = loaded; @@ -394,7 +371,7 @@ namespace osu.Game.Overlays.Mods var newSelection = new List(); - foreach (var modState in localAvailableMods) + foreach (var modState in this.availableMods) { var matchingSelectedMod = mods.SingleOrDefault(selected => selected.GetType() == modState.GetType()); @@ -554,10 +531,10 @@ namespace osu.Game.Overlays.Mods int index = Array.IndexOf(toggleKeys, e.Key); if (index < 0) return false; - var panel = panelFlow.ElementAtOrDefault(index); - if (panel == null || panel.Filtered.Value) return false; + var modState = availableMods.ElementAtOrDefault(index); + if (modState == null || modState.Filtered.Value) return false; - panel.Active.Toggle(); + modState.Active.Toggle(); return true; } diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index b3c3eee15a..ace0576b96 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -22,6 +22,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; using osu.Game.Localisation; using osu.Game.Rulesets.Mods; +using osu.Game.Utils; using osuTK; using osuTK.Input; @@ -47,9 +48,7 @@ namespace osu.Game.Overlays.Mods set { isValidMod = value ?? throw new ArgumentNullException(nameof(value)); - - if (IsLoaded) - updateAvailableMods(); + filterMods(); } } @@ -64,6 +63,9 @@ namespace osu.Game.Overlays.Mods protected virtual IEnumerable CreateFooterButtons() => createDefaultFooterButtons(); + private readonly Bindable>> availableMods = new Bindable>>(); + private readonly Dictionary> localAvailableMods = new Dictionary>(); + private readonly BindableBool customisationVisible = new BindableBool(); private ModSettingsArea modSettingsArea = null!; @@ -82,7 +84,7 @@ namespace osu.Game.Overlays.Mods } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuGameBase game, OsuColour colours) { Header.Title = ModSelectOverlayStrings.ModSelectTitle; Header.Description = ModSelectOverlayStrings.ModSelectDescription; @@ -184,12 +186,16 @@ namespace osu.Game.Overlays.Mods LighterColour = colours.Pink1 }) }; + + availableMods.BindTo(game.AvailableMods); } protected override void LoadComplete() { base.LoadComplete(); + availableMods.BindValueChanged(_ => createLocalMods(), true); + State.BindValueChanged(_ => samplePlaybackDisabled.Value = State.Value == Visibility.Hidden, true); // This is an optimisation to prevent refreshing the available settings controls when it can be @@ -211,8 +217,6 @@ namespace osu.Game.Overlays.Mods customisationVisible.BindValueChanged(_ => updateCustomisationVisualState(), true); - updateAvailableMods(); - // Start scrolled slightly to the right to give the user a sense that // there is more horizontal content available. ScheduleAfterChildren(() => @@ -272,6 +276,31 @@ namespace osu.Game.Overlays.Mods } }; + private void createLocalMods() + { + localAvailableMods.Clear(); + + foreach (var (modType, mods) in availableMods.Value) + { + var modStates = mods.SelectMany(ModUtils.FlattenMod) + .Select(mod => new ModState(mod.DeepClone())) + .ToArray(); + + localAvailableMods[modType] = modStates; + } + + filterMods(); + + foreach (var column in columnFlow.Columns) + column.AvailableMods = localAvailableMods.GetValueOrDefault(column.ModType, Array.Empty()); + } + + private void filterMods() + { + foreach (var modState in localAvailableMods.Values.SelectMany(m => m)) + modState.Filtered.Value = !modState.Mod.HasImplementation || !IsValidMod.Invoke(modState.Mod); + } + private void updateMultiplier() { if (multiplierDisplay == null) @@ -285,12 +314,6 @@ namespace osu.Game.Overlays.Mods multiplierDisplay.Current.Value = multiplier; } - private void updateAvailableMods() - { - foreach (var column in columnFlow.Columns) - column.Filter = m => m.HasImplementation && isValidMod.Invoke(m); - } - private void updateCustomisation(ValueChangedEvent> valueChangedEvent) { if (customisationButton == null) From 11ae1da65a092266786f4eae988bd0713584dbc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 19:30:06 +0200 Subject: [PATCH 0962/2328] Hoist reference replacement logic to overlay level --- osu.Game/Overlays/Mods/ModColumn.cs | 116 ++------------------- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 85 ++++++++++----- 2 files changed, 64 insertions(+), 137 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 8b3896a88c..deaaacd775 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -13,7 +13,6 @@ using Humanizer; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; @@ -54,49 +53,18 @@ namespace osu.Game.Overlays.Mods } } - private Func? filter; - /// /// A function determining whether each mod in the column should be displayed. /// A return value of means that the mod is not filtered and therefore its corresponding panel should be displayed. /// A return value of means that the mod is filtered out and therefore its corresponding panel should be hidden. /// - public Func? Filter - { - get => filter; - set - { - filter = value; - updateState(); - } - } + public Func? Filter { get; set; } // TODO: remove later /// /// Determines whether this column should accept user input. /// public Bindable Active = new BindableBool(true); - private readonly Bindable allFiltered = new BindableBool(); - - /// - /// True if all of the panels in this column have been filtered out by the current . - /// - public IBindable AllFiltered => allFiltered; - - /// - /// List of mods marked as selected in this column. - /// - /// - /// Note that the mod instances returned by this property are owned solely by this column - /// (as in, they are locally-managed clones, to ensure proper isolation from any other external instances). - /// - public IReadOnlyList SelectedMods { get; private set; } = Array.Empty(); - - /// - /// Invoked when a mod panel has been selected interactively by the user. - /// - public event Action? SelectionChangedByUser; - protected override bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) => base.ReceivePositionalInputAtSubTree(screenSpacePos) && Active.Value; protected virtual ModPanel CreateModPanel(ModState mod) => new ModPanel(mod); @@ -299,7 +267,11 @@ namespace osu.Game.Overlays.Mods Task? loadTask; - latestLoadTask = loadTask = LoadComponentsAsync(panels, onPanelsLoaded, (cancellationTokenSource = new CancellationTokenSource()).Token); + latestLoadTask = loadTask = LoadComponentsAsync(panels, loaded => + { + panelFlow.ChildrenEnumerable = loaded; + updateState(); + }, (cancellationTokenSource = new CancellationTokenSource()).Token); loadTask.ContinueWith(_ => { if (loadTask == latestLoadTask) @@ -307,27 +279,9 @@ namespace osu.Game.Overlays.Mods }); } - private void onPanelsLoaded(IEnumerable loaded) - { - panelFlow.ChildrenEnumerable = loaded; - - updateState(); - - foreach (var panel in panelFlow) - { - panel.Active.BindValueChanged(_ => panelStateChanged(panel)); - } - } - private void updateState() { - foreach (var panel in panelFlow) - { - panel.Active.Value = SelectedMods.Contains(panel.Mod); - panel.ApplyFilter(Filter); - } - - allFiltered.Value = panelFlow.All(panel => panel.Filtered.Value); + Alpha = availableMods.All(mod => mod.Filtered.Value) ? 0 : 1; if (toggleAllCheckbox != null && !SelectionAnimationRunning) { @@ -336,62 +290,6 @@ namespace osu.Game.Overlays.Mods } } - /// - /// This flag helps to determine the source of changes to . - /// If the value is false, then are changing due to a user selection on the UI. - /// If the value is true, then are changing due to an external call. - /// - private bool externalSelectionUpdateInProgress; - - private void panelStateChanged(ModPanel panel) - { - if (externalSelectionUpdateInProgress) - return; - - var newSelectedMods = panel.Active.Value - ? SelectedMods.Append(panel.Mod) - : SelectedMods.Except(panel.Mod.Yield()); - - SelectedMods = newSelectedMods.ToArray(); - updateState(); - SelectionChangedByUser?.Invoke(); - } - - /// - /// Adjusts the set of selected mods in this column to match the passed in . - /// - /// - /// This method exists to be able to receive mod instances that come from potentially-external sources and to copy the changes across to this column's state. - /// uses this to substitute any external mod references in - /// to references that are owned by this column. - /// - internal void SetSelection(IReadOnlyList mods) - { - externalSelectionUpdateInProgress = true; - - var newSelection = new List(); - - foreach (var modState in this.availableMods) - { - var matchingSelectedMod = mods.SingleOrDefault(selected => selected.GetType() == modState.GetType()); - - if (matchingSelectedMod != null) - { - modState.Mod.CopyFrom(matchingSelectedMod); - newSelection.Add(modState.Mod); - } - else - { - modState.Mod.ResetSettingsToDefaults(); - } - } - - SelectedMods = newSelection; - updateState(); - - externalSelectionUpdateInProgress = false; - } - #region Bulk select / deselect private const double initial_multiple_selection_delay = 120; diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index ace0576b96..567e91e3fa 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -207,14 +207,9 @@ namespace osu.Game.Overlays.Mods { updateMultiplier(); updateCustomisation(val); - updateSelectionFromBindable(); + updateFromExternalSelection(); }, true); - foreach (var column in columnFlow.Columns) - { - column.SelectionChangedByUser += updateBindableFromSelection; - } - customisationVisible.BindValueChanged(_ => updateCustomisationVisualState(), true); // Start scrolled slightly to the right to give the user a sense that @@ -248,7 +243,6 @@ namespace osu.Game.Overlays.Mods { var column = CreateModColumn(modType, toggleKeys).With(column => { - column.Filter = IsValidMod; // spacing applied here rather than via `columnFlow.Spacing` to avoid uneven gaps when some of the columns are hidden. column.Margin = new MarginPadding { Right = 10 }; }); @@ -286,6 +280,9 @@ namespace osu.Game.Overlays.Mods .Select(mod => new ModState(mod.DeepClone())) .ToArray(); + foreach (var modState in modStates) + modState.Active.BindValueChanged(_ => updateFromInternalSelection()); + localAvailableMods[modType] = modStates; } @@ -362,20 +359,50 @@ namespace osu.Game.Overlays.Mods TopLevelContent.MoveToY(-modAreaHeight, transition_duration, Easing.InOutCubic); } - private void updateSelectionFromBindable() - { - // `SelectedMods` may contain mod references that come from external sources. - // to ensure isolation, first pull in the potentially-external change into the mod columns... - foreach (var column in columnFlow.Columns) - column.SetSelection(SelectedMods.Value); + /// + /// This flag helps to determine the source of changes to . + /// If the value is false, then are changing due to a user selection on the UI. + /// If the value is true, then are changing due to an external change. + /// + private bool externalSelectionUpdateInProgress; - // and then, when done, replace the potentially-external mod references in `SelectedMods` with ones we own. - updateBindableFromSelection(); + private void updateFromExternalSelection() + { + externalSelectionUpdateInProgress = true; + + var newSelection = new List(); + + foreach (var modState in localAvailableMods.SelectMany(pair => pair.Value)) + { + var matchingSelectedMod = SelectedMods.Value.SingleOrDefault(selected => selected.GetType() == modState.Mod.GetType()); + + if (matchingSelectedMod != null) + { + modState.Mod.CopyFrom(matchingSelectedMod); + modState.Active.Value = true; + newSelection.Add(modState.Mod); + } + else + { + modState.Mod.ResetSettingsToDefaults(); + modState.Active.Value = false; + } + } + + SelectedMods.Value = newSelection; + + externalSelectionUpdateInProgress = false; } - private void updateBindableFromSelection() + private void updateFromInternalSelection() { - var candidateSelection = columnFlow.Columns.SelectMany(column => column.SelectedMods).ToArray(); + if (externalSelectionUpdateInProgress) + return; + + var candidateSelection = localAvailableMods.SelectMany(pair => pair.Value) + .Where(modState => modState.Active.Value) + .Select(modState => modState.Mod) + .ToArray(); // the following guard intends to check cases where we've already replaced potentially-external mod references with our own and avoid endless recursion. // TODO: replace custom comparer with System.Collections.Generic.ReferenceEqualityComparer when fully on .NET 6 @@ -406,10 +433,12 @@ namespace osu.Game.Overlays.Mods { var column = columnFlow[i].Column; - double delay = column.AllFiltered.Value ? 0 : nonFilteredColumnCount * 30; - double duration = column.AllFiltered.Value ? 0 : fade_in_duration; + bool allFiltered = column.AvailableMods.All(modState => modState.Filtered.Value); + + double delay = allFiltered ? 0 : nonFilteredColumnCount * 30; + double duration = allFiltered ? 0 : fade_in_duration; float startingYPosition = 0; - if (!column.AllFiltered.Value) + if (!allFiltered) startingYPosition = nonFilteredColumnCount % 2 == 0 ? -distance : distance; column.TopLevelContent @@ -418,7 +447,7 @@ namespace osu.Game.Overlays.Mods .MoveToY(0, duration, Easing.OutQuint) .FadeIn(duration, Easing.OutQuint); - if (!column.AllFiltered.Value) + if (!allFiltered) nonFilteredColumnCount += 1; } } @@ -439,9 +468,11 @@ namespace osu.Game.Overlays.Mods { var column = columnFlow[i].Column; - double duration = column.AllFiltered.Value ? 0 : fade_out_duration; + bool allFiltered = column.AvailableMods.All(modState => modState.Filtered.Value); + + double duration = allFiltered ? 0 : fade_out_duration; float newYPosition = 0; - if (!column.AllFiltered.Value) + if (!allFiltered) newYPosition = nonFilteredColumnCount % 2 == 0 ? -distance : distance; column.FlushPendingSelections(); @@ -449,7 +480,7 @@ namespace osu.Game.Overlays.Mods .MoveToY(newYPosition, duration, Easing.OutQuint) .FadeOut(duration, Easing.OutQuint); - if (!column.AllFiltered.Value) + if (!allFiltered) nonFilteredColumnCount += 1; } } @@ -593,8 +624,8 @@ namespace osu.Game.Overlays.Mods protected override void LoadComplete() { base.LoadComplete(); - Active.BindValueChanged(_ => updateState()); - Column.AllFiltered.BindValueChanged(_ => updateState(), true); + + Active.BindValueChanged(_ => updateState(), true); FinishTransforms(); } @@ -604,8 +635,6 @@ namespace osu.Game.Overlays.Mods { Colour4 targetColour; - Column.Alpha = Column.AllFiltered.Value ? 0 : 1; - if (Column.Active.Value) targetColour = Colour4.White; else From 83ba06e7afc42d59273515a1a8b277daeca64af6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 19:33:52 +0200 Subject: [PATCH 0963/2328] Extract helper property for accessing all mods --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 567e91e3fa..7e28ab4b1f 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -65,6 +65,7 @@ namespace osu.Game.Overlays.Mods private readonly Bindable>> availableMods = new Bindable>>(); private readonly Dictionary> localAvailableMods = new Dictionary>(); + private IEnumerable allLocalAvailableMods => localAvailableMods.SelectMany(pair => pair.Value); private readonly BindableBool customisationVisible = new BindableBool(); @@ -294,7 +295,7 @@ namespace osu.Game.Overlays.Mods private void filterMods() { - foreach (var modState in localAvailableMods.Values.SelectMany(m => m)) + foreach (var modState in allLocalAvailableMods) modState.Filtered.Value = !modState.Mod.HasImplementation || !IsValidMod.Invoke(modState.Mod); } @@ -372,7 +373,7 @@ namespace osu.Game.Overlays.Mods var newSelection = new List(); - foreach (var modState in localAvailableMods.SelectMany(pair => pair.Value)) + foreach (var modState in allLocalAvailableMods) { var matchingSelectedMod = SelectedMods.Value.SingleOrDefault(selected => selected.GetType() == modState.Mod.GetType()); @@ -399,10 +400,9 @@ namespace osu.Game.Overlays.Mods if (externalSelectionUpdateInProgress) return; - var candidateSelection = localAvailableMods.SelectMany(pair => pair.Value) - .Where(modState => modState.Active.Value) - .Select(modState => modState.Mod) - .ToArray(); + var candidateSelection = allLocalAvailableMods.Where(modState => modState.Active.Value) + .Select(modState => modState.Mod) + .ToArray(); // the following guard intends to check cases where we've already replaced potentially-external mod references with our own and avoid endless recursion. // TODO: replace custom comparer with System.Collections.Generic.ReferenceEqualityComparer when fully on .NET 6 From fc24a564782aa31381b8eada9e547f871f5c0978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 19:40:56 +0200 Subject: [PATCH 0964/2328] Add protection from recursive updates from external selection --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 7e28ab4b1f..e478b2afcd 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -369,6 +369,9 @@ namespace osu.Game.Overlays.Mods private void updateFromExternalSelection() { + if (externalSelectionUpdateInProgress) + return; + externalSelectionUpdateInProgress = true; var newSelection = new List(); From 7ac6073f13cf31bf6e15489c9f54f31ed87503c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 20:23:24 +0200 Subject: [PATCH 0965/2328] Fix column test scene to work --- .../UserInterface/TestSceneModColumn.cs | 59 +++++++++++-------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs index e47ae860c6..331509e10f 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Linq; using NUnit.Framework; @@ -12,11 +14,9 @@ using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; using osu.Game.Overlays.Mods; -using osu.Game.Rulesets.Catch; -using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; -using osu.Game.Rulesets.Taiko; +using osu.Game.Utils; using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface @@ -41,20 +41,16 @@ namespace osu.Game.Tests.Visual.UserInterface Child = new ModColumn(modType, false) { Anchor = Anchor.Centre, - Origin = Anchor.Centre + Origin = Anchor.Centre, + AvailableMods = getExampleModsFor(modType) } }); - - AddStep("change ruleset to osu!", () => Ruleset.Value = new OsuRuleset().RulesetInfo); - AddStep("change ruleset to taiko", () => Ruleset.Value = new TaikoRuleset().RulesetInfo); - AddStep("change ruleset to catch", () => Ruleset.Value = new CatchRuleset().RulesetInfo); - AddStep("change ruleset to mania", () => Ruleset.Value = new ManiaRuleset().RulesetInfo); } [Test] public void TestMultiSelection() { - ModColumn column = null; + ModColumn column = null!; AddStep("create content", () => Child = new Container { RelativeSizeAxes = Axes.Both, @@ -62,7 +58,8 @@ namespace osu.Game.Tests.Visual.UserInterface Child = column = new ModColumn(ModType.DifficultyIncrease, true) { Anchor = Anchor.Centre, - Origin = Anchor.Centre + Origin = Anchor.Centre, + AvailableMods = getExampleModsFor(ModType.DifficultyIncrease) } }); @@ -91,7 +88,7 @@ namespace osu.Game.Tests.Visual.UserInterface [Test] public void TestFiltering() { - TestModColumn column = null; + TestModColumn column = null!; AddStep("create content", () => Child = new Container { @@ -100,30 +97,31 @@ namespace osu.Game.Tests.Visual.UserInterface Child = column = new TestModColumn(ModType.Fun, true) { Anchor = Anchor.Centre, - Origin = Anchor.Centre + Origin = Anchor.Centre, + AvailableMods = getExampleModsFor(ModType.Fun) } }); - AddStep("set filter", () => column.Filter = mod => mod.Name.Contains("Wind", StringComparison.CurrentCultureIgnoreCase)); + AddStep("set filter", () => setFilter(mod => mod.Name.Contains("Wind", StringComparison.CurrentCultureIgnoreCase))); AddUntilStep("two panels visible", () => column.ChildrenOfType().Count(panel => !panel.Filtered.Value) == 2); clickToggle(); AddUntilStep("wait for animation", () => !column.SelectionAnimationRunning); AddAssert("only visible items selected", () => column.ChildrenOfType().Where(panel => panel.Active.Value).All(panel => !panel.Filtered.Value)); - AddStep("unset filter", () => column.Filter = null); + AddStep("unset filter", () => setFilter(null)); AddUntilStep("all panels visible", () => column.ChildrenOfType().All(panel => !panel.Filtered.Value)); AddAssert("checkbox not selected", () => !column.ChildrenOfType().Single().Current.Value); - AddStep("set filter", () => column.Filter = mod => mod.Name.Contains("Wind", StringComparison.CurrentCultureIgnoreCase)); + AddStep("set filter", () => setFilter(mod => mod.Name.Contains("Wind", StringComparison.CurrentCultureIgnoreCase))); AddUntilStep("two panels visible", () => column.ChildrenOfType().Count(panel => !panel.Filtered.Value) == 2); AddAssert("checkbox selected", () => column.ChildrenOfType().Single().Current.Value); - AddStep("filter out everything", () => column.Filter = _ => false); + AddStep("filter out everything", () => setFilter(_ => false)); AddUntilStep("no panels visible", () => column.ChildrenOfType().All(panel => panel.Filtered.Value)); AddUntilStep("checkbox hidden", () => !column.ChildrenOfType().Single().IsPresent); - AddStep("inset filter", () => column.Filter = null); + AddStep("inset filter", () => setFilter(null)); AddUntilStep("all panels visible", () => column.ChildrenOfType().All(panel => !panel.Filtered.Value)); AddUntilStep("checkbox visible", () => column.ChildrenOfType().Single().IsPresent); @@ -138,7 +136,7 @@ namespace osu.Game.Tests.Visual.UserInterface [Test] public void TestKeyboardSelection() { - ModColumn column = null; + ModColumn column = null!; AddStep("create content", () => Child = new Container { RelativeSizeAxes = Axes.Both, @@ -146,7 +144,8 @@ namespace osu.Game.Tests.Visual.UserInterface Child = column = new ModColumn(ModType.DifficultyReduction, true, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }) { Anchor = Anchor.Centre, - Origin = Anchor.Centre + Origin = Anchor.Centre, + AvailableMods = getExampleModsFor(ModType.DifficultyReduction) } }); @@ -158,7 +157,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("press W again", () => InputManager.Key(Key.W)); AddAssert("NF panel deselected", () => !this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "NF").Active.Value); - AddStep("set filter to NF", () => column.Filter = mod => mod.Acronym == "NF"); + AddStep("set filter to NF", () => setFilter(mod => mod.Acronym == "NF")); AddStep("press W", () => InputManager.Key(Key.W)); AddAssert("NF panel selected", () => this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "NF").Active.Value); @@ -166,12 +165,18 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("press W again", () => InputManager.Key(Key.W)); AddAssert("NF panel deselected", () => !this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "NF").Active.Value); - AddStep("filter out everything", () => column.Filter = _ => false); + AddStep("filter out everything", () => setFilter(_ => false)); AddStep("press W", () => InputManager.Key(Key.W)); AddAssert("NF panel not selected", () => !this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "NF").Active.Value); - AddStep("clear filter", () => column.Filter = null); + AddStep("clear filter", () => setFilter(null)); + } + + private void setFilter(Func? filter) + { + foreach (var modState in this.ChildrenOfType().Single().AvailableMods) + modState.Filtered.Value = filter?.Invoke(modState.Mod) == false; } private class TestModColumn : ModColumn @@ -183,5 +188,13 @@ namespace osu.Game.Tests.Visual.UserInterface { } } + + private static ModState[] getExampleModsFor(ModType modType) + { + return new OsuRuleset().GetModsFor(modType) + .SelectMany(ModUtils.FlattenMod) + .Select(mod => new ModState(mod)) + .ToArray(); + } } } From 52bbce12f16d3ba769c8da6fa6ee6a51a8a65d07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 20:23:56 +0200 Subject: [PATCH 0966/2328] Fix not being able to set `AvailableMods` before loaded --- osu.Game/Overlays/Mods/ModColumn.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index deaaacd775..06e96afdca 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -49,7 +49,9 @@ namespace osu.Game.Overlays.Mods Debug.Assert(value.All(mod => mod.Mod.Type == ModType)); availableMods = value; - asyncLoadPanels(); + + if (IsLoaded) + asyncLoadPanels(); } } @@ -249,6 +251,7 @@ namespace osu.Game.Overlays.Mods base.LoadComplete(); toggleAllCheckbox?.Current.BindValueChanged(_ => updateToggleAllText(), true); + asyncLoadPanels(); } private void updateToggleAllText() From b5a9f1310a706491c6019b2a2d159583620f4972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 20:28:11 +0200 Subject: [PATCH 0967/2328] Fix select/deselect all toggle not working correctly after changes --- osu.Game/Overlays/Mods/ModColumn.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 06e96afdca..c1904a0bc0 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -50,6 +50,14 @@ namespace osu.Game.Overlays.Mods availableMods = value; + foreach (var mod in availableMods) + { + mod.Active.BindValueChanged(_ => updateState()); + mod.Filtered.BindValueChanged(_ => updateState()); + } + + updateState(); + if (IsLoaded) asyncLoadPanels(); } From 1c0166367d1f12cfaf5194f467d7c64220e1409b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 20:29:28 +0200 Subject: [PATCH 0968/2328] Fix remaining column operations being coupled to drawables --- osu.Game/Overlays/Mods/ModColumn.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index c1904a0bc0..d7ce08e124 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -296,8 +296,8 @@ namespace osu.Game.Overlays.Mods if (toggleAllCheckbox != null && !SelectionAnimationRunning) { - toggleAllCheckbox.Alpha = panelFlow.Any(panel => !panel.Filtered.Value) ? 1 : 0; - toggleAllCheckbox.Current.Value = panelFlow.Where(panel => !panel.Filtered.Value).All(panel => panel.Active.Value); + toggleAllCheckbox.Alpha = availableMods.Any(panel => !panel.Filtered.Value) ? 1 : 0; + toggleAllCheckbox.Current.Value = availableMods.Where(panel => !panel.Filtered.Value).All(panel => panel.Active.Value); } } @@ -342,7 +342,7 @@ namespace osu.Game.Overlays.Mods { pendingSelectionOperations.Clear(); - foreach (var button in panelFlow.Where(b => !b.Active.Value && !b.Filtered.Value)) + foreach (var button in availableMods.Where(b => !b.Active.Value && !b.Filtered.Value)) pendingSelectionOperations.Enqueue(() => button.Active.Value = true); } @@ -353,7 +353,7 @@ namespace osu.Game.Overlays.Mods { pendingSelectionOperations.Clear(); - foreach (var button in panelFlow.Where(b => b.Active.Value && !b.Filtered.Value)) + foreach (var button in availableMods.Where(b => b.Active.Value && !b.Filtered.Value)) pendingSelectionOperations.Enqueue(() => button.Active.Value = false); } From 2266a5c9a0588beb5e188197a0dd03c67457dd46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 20:38:53 +0200 Subject: [PATCH 0969/2328] Remove no-longer-necessary `ModColumn.Filter` --- osu.Game/Overlays/Mods/ModColumn.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index d7ce08e124..9bb3f8bd9e 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -63,13 +63,6 @@ namespace osu.Game.Overlays.Mods } } - /// - /// A function determining whether each mod in the column should be displayed. - /// A return value of means that the mod is not filtered and therefore its corresponding panel should be displayed. - /// A return value of means that the mod is filtered out and therefore its corresponding panel should be hidden. - /// - public Func? Filter { get; set; } // TODO: remove later - /// /// Determines whether this column should accept user input. /// From 93539160adb48a6be40d69ed33c216d46f52327e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 21:57:57 +0200 Subject: [PATCH 0970/2328] Remove no-longer-necessary guard --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index e478b2afcd..d94f663962 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -12,7 +12,6 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; -using osu.Framework.Lists; using osu.Framework.Utils; using osu.Game.Audio; using osu.Game.Configuration; @@ -407,11 +406,6 @@ namespace osu.Game.Overlays.Mods .Select(modState => modState.Mod) .ToArray(); - // the following guard intends to check cases where we've already replaced potentially-external mod references with our own and avoid endless recursion. - // TODO: replace custom comparer with System.Collections.Generic.ReferenceEqualityComparer when fully on .NET 6 - if (candidateSelection.SequenceEqual(SelectedMods.Value, new FuncEqualityComparer(ReferenceEquals))) - return; - SelectedMods.Value = ComputeNewModsFromSelection(SelectedMods.Value, candidateSelection); } From 981ead68bf8a54ece314e00bf0d68a16aa331622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 11 May 2022 22:20:00 +0200 Subject: [PATCH 0971/2328] Ensure local mods are constructed in time for `Pop{In,Out}()` --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index d94f663962..d068839ab0 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -192,10 +192,11 @@ namespace osu.Game.Overlays.Mods protected override void LoadComplete() { - base.LoadComplete(); - + // this is called before base call so that the mod state is populated early, and the transition in `PopIn()` can play out properly. availableMods.BindValueChanged(_ => createLocalMods(), true); + base.LoadComplete(); + State.BindValueChanged(_ => samplePlaybackDisabled.Value = State.Value == Visibility.Hidden, true); // This is an optimisation to prevent refreshing the available settings controls when it can be From cced8609f6d2190156d24c75d5a048166761eb74 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 11 May 2022 22:51:15 +0100 Subject: [PATCH 0972/2328] Add `setCurrent` param to `ChannelManager.JoinChannel` --- osu.Game/Online/Chat/ChannelManager.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 47e45e67d1..1fe784f68b 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -420,10 +420,11 @@ namespace osu.Game.Online.Chat /// Joins a channel if it has not already been joined. Must be called from the update thread. /// /// The channel to join. + /// Set the channel to join as the current channel if the current channel is null. /// The joined channel. Note that this may not match the parameter channel as it is a backed object. - public Channel JoinChannel(Channel channel) => joinChannel(channel, true); + public Channel JoinChannel(Channel channel, bool setCurrent = true) => joinChannel(channel, true, setCurrent); - private Channel joinChannel(Channel channel, bool fetchInitialMessages = false) + private Channel joinChannel(Channel channel, bool fetchInitialMessages = false, bool setCurrent = true) { if (channel == null) return null; @@ -439,7 +440,7 @@ namespace osu.Game.Online.Chat case ChannelType.Multiplayer: // join is implicit. happens when you join a multiplayer game. // this will probably change in the future. - joinChannel(channel, fetchInitialMessages); + joinChannel(channel, fetchInitialMessages, setCurrent); return channel; case ChannelType.PM: @@ -460,7 +461,7 @@ namespace osu.Game.Online.Chat default: var req = new JoinChannelRequest(channel); - req.Success += () => joinChannel(channel, fetchInitialMessages); + req.Success += () => joinChannel(channel, fetchInitialMessages, setCurrent); req.Failure += ex => LeaveChannel(channel); api.Queue(req); return channel; @@ -472,7 +473,8 @@ namespace osu.Game.Online.Chat this.fetchInitialMessages(channel); } - CurrentChannel.Value ??= channel; + if (setCurrent) + CurrentChannel.Value ??= channel; return channel; } From db371ab0685621d868aa9bb036e963f487ee1a6a Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 11 May 2022 22:52:15 +0100 Subject: [PATCH 0973/2328] Use `CurrentChannel == null` to show the channel selector --- .../Overlays/Chat/ChannelList/ChannelList.cs | 8 ++--- .../Chat/ChannelList/ChannelListItem.cs | 5 +--- .../Chat/ChannelList/ChannelListSelector.cs | 12 ++++---- osu.Game/Overlays/ChatOverlayV2.cs | 29 ++----------------- 4 files changed, 12 insertions(+), 42 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 076dc5719e..6bdf5ee084 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Generic; using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -19,11 +18,9 @@ namespace osu.Game.Overlays.Chat.ChannelList { public class ChannelList : Container { - public Action? OnRequestSelect; + public Action? OnRequestSelect; public Action? OnRequestLeave; - public readonly BindableBool SelectorActive = new BindableBool(); - private readonly Dictionary channelMap = new Dictionary(); private ChannelListItemFlow publicChannelFlow = null!; @@ -56,7 +53,7 @@ namespace osu.Game.Overlays.Chat.ChannelList new ChannelListSelector { Margin = new MarginPadding { Bottom = 10 }, - SelectorActive = { BindTarget = SelectorActive }, + Action = () => OnRequestSelect?.Invoke(null), }, privateChannelFlow = new ChannelListItemFlow("DIRECT MESSAGES"), }, @@ -73,7 +70,6 @@ namespace osu.Game.Overlays.Chat.ChannelList ChannelListItem item = new ChannelListItem(channel); item.OnRequestSelect += chan => OnRequestSelect?.Invoke(chan); item.OnRequestLeave += chan => OnRequestLeave?.Invoke(chan); - item.SelectorActive.BindTarget = SelectorActive; ChannelListItemFlow flow = getFlowForChannel(channel); channelMap.Add(channel, item); diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs index c5ac87f527..dd571c9ad9 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs @@ -31,8 +31,6 @@ namespace osu.Game.Overlays.Chat.ChannelList public readonly BindableBool Unread = new BindableBool(); - public readonly BindableBool SelectorActive = new BindableBool(); - private Box hoverBox = null!; private Box selectBox = null!; private OsuSpriteText text = null!; @@ -127,7 +125,6 @@ namespace osu.Game.Overlays.Chat.ChannelList base.LoadComplete(); selectedChannel.BindValueChanged(_ => updateState(), true); - SelectorActive.BindValueChanged(_ => updateState(), true); Unread.BindValueChanged(_ => updateState(), true); } @@ -163,7 +160,7 @@ namespace osu.Game.Overlays.Chat.ChannelList private void updateState() { - bool selected = selectedChannel.Value == Channel && !SelectorActive.Value; + bool selected = selectedChannel.Value == Channel; if (selected) selectBox.FadeIn(300, Easing.OutQuint); diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs index 9cba93ffa5..7beef7b16c 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs @@ -12,17 +12,19 @@ using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Online.Chat; namespace osu.Game.Overlays.Chat.ChannelList { public class ChannelListSelector : OsuClickableContainer { - public readonly BindableBool SelectorActive = new BindableBool(); - private Box hoverBox = null!; private Box selectBox = null!; private OsuSpriteText text = null!; + [Resolved] + private Bindable currentChannel { get; set; } = null!; + [Resolved] private OverlayColourProvider colourProvider { get; set; } = null!; @@ -69,9 +71,9 @@ namespace osu.Game.Overlays.Chat.ChannelList { base.LoadComplete(); - SelectorActive.BindValueChanged(selector => + currentChannel.BindValueChanged(channel => { - if (selector.NewValue) + if (channel.NewValue == null) { text.FadeColour(colourProvider.Content1, 300, Easing.OutQuint); selectBox.FadeIn(300, Easing.OutQuint); @@ -82,8 +84,6 @@ namespace osu.Game.Overlays.Chat.ChannelList selectBox.FadeOut(200, Easing.OutQuint); } }, true); - - Action = () => SelectorActive.Value = true; } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index e59bee7977..19609f0702 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -100,7 +100,6 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Y, Width = side_bar_width, Padding = new MarginPadding { Top = top_bar_height }, - SelectorActive = { BindTarget = selectorActive }, }, new Container { @@ -157,20 +156,10 @@ namespace osu.Game.Overlays channelManager.JoinedChannels.BindCollectionChanged(joinedChannelsChanged, true); channelManager.AvailableChannels.BindCollectionChanged(availableChannelsChanged, true); - channelList.OnRequestSelect += channel => - { - // Manually selecting a channel should dismiss the selector - selectorActive.Value = false; - channelManager.CurrentChannel.Value = channel; - }; + channelList.OnRequestSelect += channel => channelManager.CurrentChannel.Value = channel; channelList.OnRequestLeave += channel => channelManager.LeaveChannel(channel); - channelListing.OnRequestJoin += channel => - { - channelManager.JoinChannel(channel); - // Manually joining a channel should keep the selector open - selectorActive.Value = true; - }; + channelListing.OnRequestJoin += channel => channelManager.JoinChannel(channel, false); channelListing.OnRequestLeave += channel => channelManager.LeaveChannel(channel); textBar.OnSearchTermsChanged += searchTerms => channelListing.SearchTerm = searchTerms; @@ -257,21 +246,9 @@ namespace osu.Game.Overlays loading.Show(); - // Channel is null when leaving the currently selected channel if (newChannel == null) { - // Don't need to autoswitch if the selector is visible - if (selectorActive.Value) - return; - - // Find another channel to switch to - newChannel = channelManager.JoinedChannels.FirstOrDefault(c => c != channel.OldValue); - - if (newChannel == null) - selectorActive.Value = true; - else - currentChannel.Value = newChannel; - + selectorActive.Value = true; return; } From c45e8f619b286b2af42a421f9d0337073b7bf5d4 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 11 May 2022 22:52:25 +0100 Subject: [PATCH 0974/2328] Update `ChannelList` test scene --- .../Visual/Online/TestSceneChannelList.cs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs index a3bfbd47a3..9929642539 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs @@ -25,7 +25,6 @@ namespace osu.Game.Tests.Visual.Online [Cached] private readonly Bindable selected = new Bindable(); - private OsuSpriteText selectorText; private OsuSpriteText selectedText; private OsuSpriteText leaveText; private ChannelList channelList; @@ -43,21 +42,12 @@ namespace osu.Game.Tests.Visual.Online Height = 0.7f, RowDimensions = new[] { - new Dimension(GridSizeMode.Absolute, 20), new Dimension(GridSizeMode.Absolute, 20), new Dimension(GridSizeMode.Absolute, 20), new Dimension(), }, Content = new[] { - new Drawable[] - { - selectorText = new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - }, - }, new Drawable[] { selectedText = new OsuSpriteText @@ -89,7 +79,6 @@ namespace osu.Game.Tests.Visual.Online channelList.OnRequestSelect += channel => { - channelList.SelectorActive.Value = false; selected.Value = channel; }; @@ -101,12 +90,6 @@ namespace osu.Game.Tests.Visual.Online channelList.RemoveChannel(channel); }; - channelList.SelectorActive.BindValueChanged(change => - { - selectorText.Text = $"Channel Selector Active: {change.NewValue}"; - selected.Value = null; - }, true); - selected.BindValueChanged(change => { selectedText.Text = $"Selected Channel: {change.NewValue?.Name ?? "[null]"}"; From b794deb5c544e5612745e1d33c32fa3122edd7e1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 12:06:51 +0900 Subject: [PATCH 0975/2328] Add null checks to screen context insertion --- osu.Game/OsuGame.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 9edcf90132..3d56d33689 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -14,6 +14,7 @@ using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Extensions.TypeExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -1203,8 +1204,8 @@ namespace osu.Game { scope.Contexts[@"screen stack"] = new { - Current = newScreen.GetType().Name, - Previous = current.GetType().Name, + Current = newScreen?.GetType().ReadableName(), + Previous = current?.GetType().ReadableName(), }; }); From fda61943b074eea3500b32422b032aacf5cac8a0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 13:04:17 +0900 Subject: [PATCH 0976/2328] Update distance snap test when cursor at centre of grid to be in line with expectations --- .../Editor/TestSceneOsuDistanceSnapGrid.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs index 3c3c5cb939..c50aec40a5 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs @@ -113,7 +113,14 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor public void TestCursorInCentre() { AddStep("move mouse to centre", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position))); - assertSnappedDistance(0); + assertSnappedDistance(beat_length); + } + + [Test] + public void TestCursorAlmostInCentre() + { + AddStep("move mouse to almost centre", () => InputManager.MoveMouseTo(grid.ToScreenSpace(grid_position) + new Vector2(1))); + assertSnappedDistance(beat_length); } [Test] From f51607521cef17d7ff4ef62082febe76e7252204 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 13:11:51 +0900 Subject: [PATCH 0977/2328] Fix distance snap providing zero-distance snaps incorrectly --- .../Edit/Compose/Components/CircularDistanceSnapGrid.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index 2c6bb766ad..cb50ea0d4b 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -7,6 +7,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Utils; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osuTK; @@ -76,14 +77,19 @@ namespace osu.Game.Screens.Edit.Compose.Components Vector2 travelVector = (position - StartPosition); + // We need a non-zero travel vector in order to find a valid direction. if (travelVector == Vector2.Zero) - return (StartPosition, StartTime); + travelVector = new Vector2(0, -1); float travelLength = travelVector.Length; // FindSnappedDistance will always round down, but we want to potentially round upwards. travelLength += DistanceBetweenTicks / 2; + // We never want to snap towards zero. + if (travelLength < DistanceBetweenTicks) + travelLength = DistanceBetweenTicks; + // When interacting with the resolved snap provider, the distance spacing multiplier should first be removed // to allow for snapping at a non-multiplied ratio. float snappedDistance = SnapProvider.FindSnappedDistance(ReferenceObject, travelLength / distanceSpacingMultiplier); From 2dfed6eda17ac3747fe6f3ac6d1406e25ef0a54e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 13:53:57 +0900 Subject: [PATCH 0978/2328] Remove `selectorActive` bindable completely --- osu.Game/Overlays/ChatOverlayV2.cs | 34 +++++++++++++----------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 19609f0702..60b25ef52d 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -50,8 +50,6 @@ namespace osu.Game.Overlays private const float side_bar_width = 190; private const float chat_bar_height = 60; - private readonly BindableBool selectorActive = new BindableBool(); - [Resolved] private OsuConfigManager config { get; set; } = null!; @@ -136,7 +134,6 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Padding = new MarginPadding { Left = side_bar_width }, - ShowSearch = { BindTarget = selectorActive }, }, }; } @@ -145,8 +142,6 @@ namespace osu.Game.Overlays { base.LoadComplete(); - loading.Show(); - config.BindWith(OsuSetting.ChatDisplayHeight, chatHeight); chatHeight.BindValueChanged(height => { Height = height.NewValue; }, true); @@ -164,8 +159,6 @@ namespace osu.Game.Overlays textBar.OnSearchTermsChanged += searchTerms => channelListing.SearchTerm = searchTerms; textBar.OnChatMessageCommitted += handleChatMessage; - - selectorActive.BindValueChanged(v => channelListing.State.Value = v.NewValue ? Visibility.Visible : Visibility.Hidden, true); } /// @@ -244,22 +237,25 @@ namespace osu.Game.Overlays { Channel? newChannel = channel.NewValue; - loading.Show(); - if (newChannel == null) { - selectorActive.Value = true; - return; + // null channel denotes that we should be showing the listing. + channelListing.State.Value = Visibility.Visible; + textBar.ShowSearch.Value = true; } - - selectorActive.Value = false; - - LoadComponentAsync(new DrawableChannel(newChannel), loaded => + else { - currentChannelContainer.Clear(); - currentChannelContainer.Add(loaded); - loading.Hide(); - }); + channelListing.State.Value = Visibility.Hidden; + textBar.ShowSearch.Value = false; + + loading.Show(); + LoadComponentAsync(new DrawableChannel(newChannel), loaded => + { + currentChannelContainer.Clear(); + currentChannelContainer.Add(loaded); + loading.Hide(); + }); + } } private void joinedChannelsChanged(object sender, NotifyCollectionChangedEventArgs args) From 1d38e5bd33ad8764ae3b16b468a967430174f3e3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 13:58:10 +0900 Subject: [PATCH 0979/2328] Add notes about weird local handling in `ChannelListSelector` --- osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs index 7beef7b16c..a07aad2041 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs @@ -73,6 +73,8 @@ namespace osu.Game.Overlays.Chat.ChannelList currentChannel.BindValueChanged(channel => { + // This logic should be handled by the chat overlay rather than this component. + // Selected state should be moved to an abstract class and shared with ChannelListItem. if (channel.NewValue == null) { text.FadeColour(colourProvider.Content1, 300, Easing.OutQuint); From c54ca937c505c7056daca10b1fd2f65a938c7d69 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 12 May 2022 14:55:20 +0900 Subject: [PATCH 0980/2328] Fix CI inspections --- .../Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index cb50ea0d4b..771612fcf1 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -7,7 +7,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Utils; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osuTK; From c0abce918fbacbd57f10a100d04cc1649d8bfb73 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 15:23:41 +0900 Subject: [PATCH 0981/2328] Add `enum` to snap method as alternative to mutliple nested invocations --- .../Edit/CatchHitObjectComposer.cs | 15 +++++--- .../Editor/TestSceneManiaBeatSnapGrid.cs | 7 +--- .../Edit/ManiaHitObjectComposer.cs | 4 +- .../Edit/OsuHitObjectComposer.cs | 37 ++++++++----------- .../Editing/TestSceneDistanceSnapGrid.cs | 5 +-- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 23 ++++++------ .../Rulesets/Edit/IPositionSnapProvider.cs | 14 +------ osu.Game/Rulesets/Edit/SnapType.cs | 15 ++++++++ .../Compose/Components/BlueprintContainer.cs | 4 +- .../Compose/Components/Timeline/Timeline.cs | 5 +-- 10 files changed, 62 insertions(+), 67 deletions(-) create mode 100644 osu.Game/Rulesets/Edit/SnapType.cs diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs index 630a2cf645..6f59b3e543 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs @@ -6,6 +6,7 @@ using System.Linq; using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; @@ -89,15 +90,19 @@ namespace osu.Game.Rulesets.Catch.Edit new TernaryButton(distanceSnapToggle, "Distance Snap", () => new SpriteIcon { Icon = FontAwesome.Solid.Ruler }) }); - public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) + public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All) { - var result = base.FindSnappedPositionAndTime(screenSpacePosition); + var result = base.FindSnappedPositionAndTime(screenSpacePosition, snapType); + result.ScreenSpacePosition.X = screenSpacePosition.X; - if (distanceSnapGrid.IsPresent && distanceSnapGrid.GetSnappedPosition(result.ScreenSpacePosition) is SnapResult snapResult && - Vector2.Distance(snapResult.ScreenSpacePosition, result.ScreenSpacePosition) < distance_snap_radius) + if (snapType.HasFlagFast(SnapType.Grids)) { - result = snapResult; + if (distanceSnapGrid.IsPresent && distanceSnapGrid.GetSnappedPosition(result.ScreenSpacePosition) is SnapResult snapResult && + Vector2.Distance(snapResult.ScreenSpacePosition, result.ScreenSpacePosition) < distance_snap_radius) + { + result = snapResult; + } } return result; diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs index 4bb049b1a4..6130a80bb4 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs @@ -97,12 +97,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor set => InternalChild = value; } - public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) - { - throw new System.NotImplementedException(); - } - - public override SnapResult FindSnappedPosition(Vector2 screenSpacePosition) + public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All) { throw new System.NotImplementedException(); } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index fef315e2ef..3c022dafc0 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -56,9 +56,9 @@ namespace osu.Game.Rulesets.Mania.Edit protected override Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpacePosition) => Playfield.GetColumnByPosition(screenSpacePosition); - public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) + public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All) { - var result = base.FindSnappedPositionAndTime(screenSpacePosition); + var result = base.FindSnappedPositionAndTime(screenSpacePosition, snapType); switch (ScrollingInfo.Direction.Value) { diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 02beb0f2a4..b0d6170190 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -7,6 +7,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Caching; +using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -123,33 +124,27 @@ namespace osu.Game.Rulesets.Osu.Edit } } - public override SnapResult FindSnappedPosition(Vector2 screenSpacePosition) + public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All) { - if (snapToVisibleBlueprints(screenSpacePosition, out var snapResult)) + if (snapType.HasFlagFast(SnapType.NearbyObjects) && snapToVisibleBlueprints(screenSpacePosition, out var snapResult)) return snapResult; - return new SnapResult(screenSpacePosition, null); - } - - public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) - { - var positionSnap = FindSnappedPosition(screenSpacePosition); - if (positionSnap.ScreenSpacePosition != screenSpacePosition) - return positionSnap; - - if (distanceSnapToggle.Value == TernaryState.True && distanceSnapGrid != null) + if (snapType.HasFlagFast(SnapType.Grids)) { - (Vector2 pos, double time) = distanceSnapGrid.GetSnappedPosition(distanceSnapGrid.ToLocalSpace(screenSpacePosition)); - return new SnapResult(distanceSnapGrid.ToScreenSpace(pos), time, PlayfieldAtScreenSpacePosition(screenSpacePosition)); + if (distanceSnapToggle.Value == TernaryState.True && distanceSnapGrid != null) + { + (Vector2 pos, double time) = distanceSnapGrid.GetSnappedPosition(distanceSnapGrid.ToLocalSpace(screenSpacePosition)); + return new SnapResult(distanceSnapGrid.ToScreenSpace(pos), time, PlayfieldAtScreenSpacePosition(screenSpacePosition)); + } + + if (rectangularGridSnapToggle.Value == TernaryState.True) + { + Vector2 pos = rectangularPositionSnapGrid.GetSnappedPosition(rectangularPositionSnapGrid.ToLocalSpace(screenSpacePosition)); + return new SnapResult(rectangularPositionSnapGrid.ToScreenSpace(pos), null, PlayfieldAtScreenSpacePosition(screenSpacePosition)); + } } - if (rectangularGridSnapToggle.Value == TernaryState.True) - { - Vector2 pos = rectangularPositionSnapGrid.GetSnappedPosition(rectangularPositionSnapGrid.ToLocalSpace(screenSpacePosition)); - return new SnapResult(rectangularPositionSnapGrid.ToScreenSpace(pos), null, PlayfieldAtScreenSpacePosition(screenSpacePosition)); - } - - return base.FindSnappedPositionAndTime(screenSpacePosition); + return base.FindSnappedPositionAndTime(screenSpacePosition, snapType); } private bool snapToVisibleBlueprints(Vector2 screenSpacePosition, out SnapResult snapResult) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs index 3aa3481cbf..ef07c3e411 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs @@ -185,10 +185,7 @@ namespace osu.Game.Tests.Visual.Editing private class SnapProvider : IDistanceSnapProvider { - public SnapResult FindSnappedPosition(Vector2 screenSpacePosition) => - new SnapResult(screenSpacePosition, null); - - public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0); + public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.Grids) => new SnapResult(screenSpacePosition, 0); public Bindable DistanceSpacingMultiplier { get; } = new BindableDouble(1); diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 216510fcf3..f8d796a778 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -7,6 +7,7 @@ using System.Collections.Specialized; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; @@ -361,20 +362,23 @@ namespace osu.Game.Rulesets.Edit /// The most relevant . protected virtual Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpacePosition) => drawableRulesetWrapper.Playfield; - public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) + public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All) { var playfield = PlayfieldAtScreenSpacePosition(screenSpacePosition); double? targetTime = null; - if (playfield is ScrollingPlayfield scrollingPlayfield) + if (snapType.HasFlagFast(SnapType.Grids)) { - targetTime = scrollingPlayfield.TimeAtScreenSpacePosition(screenSpacePosition); + if (playfield is ScrollingPlayfield scrollingPlayfield) + { + targetTime = scrollingPlayfield.TimeAtScreenSpacePosition(screenSpacePosition); - // apply beat snapping - targetTime = BeatSnapProvider.SnapTime(targetTime.Value); + // apply beat snapping + targetTime = BeatSnapProvider.SnapTime(targetTime.Value); - // convert back to screen space - screenSpacePosition = scrollingPlayfield.ScreenSpacePositionAtTime(targetTime.Value); + // convert back to screen space + screenSpacePosition = scrollingPlayfield.ScreenSpacePositionAtTime(targetTime.Value); + } } return new SnapResult(screenSpacePosition, targetTime, playfield); @@ -414,10 +418,7 @@ namespace osu.Game.Rulesets.Edit #region IPositionSnapProvider - public abstract SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition); - - public virtual SnapResult FindSnappedPosition(Vector2 screenSpacePosition) => - new SnapResult(screenSpacePosition, null); + public abstract SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All); #endregion } diff --git a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs index 837b04424a..a6a6e39e23 100644 --- a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs @@ -8,7 +8,6 @@ namespace osu.Game.Rulesets.Edit { /// /// A snap provider which given a proposed position for a hit object, potentially offers a more correct position and time value inferred from the context of the beatmap. - /// Provided values are inferred in an isolated context, without consideration of other nearby hit objects. /// [Cached] public interface IPositionSnapProvider @@ -16,18 +15,9 @@ namespace osu.Game.Rulesets.Edit /// /// Given a position, find a valid time and position snap. /// - /// - /// This call should be equivalent to running with any additional logic that can be performed without the time immutability restriction. - /// /// The screen-space position to be snapped. + /// The type of snapping to apply. /// The time and position post-snapping. - SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition); - - /// - /// Given a position, find a valid position snap, without changing the time value. - /// - /// The screen-space position to be snapped. - /// The position post-snapping. Time will always be null. - SnapResult FindSnappedPosition(Vector2 screenSpacePosition); + SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All); } } diff --git a/osu.Game/Rulesets/Edit/SnapType.cs b/osu.Game/Rulesets/Edit/SnapType.cs new file mode 100644 index 0000000000..4ab67fee63 --- /dev/null +++ b/osu.Game/Rulesets/Edit/SnapType.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 System; + +namespace osu.Game.Rulesets.Edit +{ + [Flags] + public enum SnapType + { + NearbyObjects = 0, + Grids = 1, + All = NearbyObjects | Grids, + } +} diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index 186c66e0af..d56dc176f6 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -486,7 +486,7 @@ namespace osu.Game.Screens.Edit.Compose.Components Vector2 originalPosition = movementBlueprintOriginalPositions[i]; var testPosition = originalPosition + distanceTravelled; - var positionalResult = snapProvider.FindSnappedPosition(testPosition); + var positionalResult = snapProvider.FindSnappedPositionAndTime(testPosition, SnapType.NearbyObjects); if (positionalResult.ScreenSpacePosition == testPosition) continue; @@ -505,7 +505,7 @@ namespace osu.Game.Screens.Edit.Compose.Components Vector2 movePosition = movementBlueprintOriginalPositions.First() + distanceTravelled; // Retrieve a snapped position. - var result = snapProvider?.FindSnappedPositionAndTime(movePosition); + var result = snapProvider?.FindSnappedPositionAndTime(movePosition, ~SnapType.NearbyObjects); if (result == null) { diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index 7e66c57917..992ab7947e 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -303,10 +303,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline /// public double VisibleRange => track.Length / Zoom; - public SnapResult FindSnappedPosition(Vector2 screenSpacePosition) => - new SnapResult(screenSpacePosition, null); - - public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) => + public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All) => new SnapResult(screenSpacePosition, beatSnapProvider.SnapTime(getTimeFromPosition(Content.ToLocalSpace(screenSpacePosition)))); private double getTimeFromPosition(Vector2 localPosition) => From f7e055dbfee9b68b6f93b69262e04c281a836245 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 16:13:31 +0900 Subject: [PATCH 0982/2328] Move mania note height offset application to a much more suitable location --- .../Blueprints/ManiaPlacementBlueprint.cs | 25 ++++++++++++++- .../Edit/ManiaHitObjectComposer.cs | 31 +++---------------- .../UI/Scrolling/ScrollingPlayfield.cs | 2 +- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs index 8f25668dd0..ad95fd5e87 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs @@ -5,7 +5,10 @@ using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Rulesets.Mania.Skinning.Default; using osu.Game.Rulesets.Mania.UI; +using osu.Game.Rulesets.UI.Scrolling; +using osuTK; using osuTK.Input; namespace osu.Game.Rulesets.Mania.Edit.Blueprints @@ -52,8 +55,28 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints { base.UpdateTimeAndPosition(result); + var playfield = (Column)result.Playfield; + + // Apply an offset to better align with the visual grid. + // This should only be applied during placement, as during selection / drag operations the movement is relative + // to the initial point of interaction rather than the grid. + switch (playfield.ScrollingInfo.Direction.Value) + { + case ScrollingDirection.Down: + result.ScreenSpacePosition -= new Vector2(0, getNoteHeight(playfield) / 2); + break; + + case ScrollingDirection.Up: + result.ScreenSpacePosition += new Vector2(0, getNoteHeight(playfield) / 2); + break; + } + if (PlacementActive == PlacementState.Waiting) - Column = result.Playfield as Column; + Column = playfield; } + + private float getNoteHeight(Column resultPlayfield) => + resultPlayfield.ToScreenSpace(new Vector2(DefaultNotePiece.NOTE_HEIGHT)).Y - + resultPlayfield.ToScreenSpace(Vector2.Zero).Y; } } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 3c022dafc0..c389e1bced 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -1,15 +1,14 @@ // 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; -using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Edit.Tools; -using osu.Game.Rulesets.Mania.Objects; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Input; -using osu.Game.Rulesets.Mania.Skinning.Default; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Edit.Tools; +using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects; @@ -56,28 +55,6 @@ namespace osu.Game.Rulesets.Mania.Edit protected override Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpacePosition) => Playfield.GetColumnByPosition(screenSpacePosition); - public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All) - { - var result = base.FindSnappedPositionAndTime(screenSpacePosition, snapType); - - switch (ScrollingInfo.Direction.Value) - { - case ScrollingDirection.Down: - result.ScreenSpacePosition -= new Vector2(0, getNoteHeight() / 2); - break; - - case ScrollingDirection.Up: - result.ScreenSpacePosition += new Vector2(0, getNoteHeight() / 2); - break; - } - - return result; - } - - private float getNoteHeight() => - Playfield.GetColumn(0).ToScreenSpace(new Vector2(DefaultNotePiece.NOTE_HEIGHT)).Y - - Playfield.GetColumn(0).ToScreenSpace(Vector2.Zero).Y; - protected override DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods = null) { drawableRuleset = new DrawableManiaEditorRuleset(ruleset, beatmap, mods); diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index 2b75f93f9e..782255733f 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.UI.Scrolling public new ScrollingHitObjectContainer HitObjectContainer => (ScrollingHitObjectContainer)base.HitObjectContainer; [Resolved] - protected IScrollingInfo ScrollingInfo { get; private set; } + public IScrollingInfo ScrollingInfo { get; private set; } [BackgroundDependencyLoader] private void load() From 10e41d018af6768090cdcebd41ebdc4a4e6c14c4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 17:36:35 +0900 Subject: [PATCH 0983/2328] Fix toggling hit animations on the editor not applying immediately --- osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs | 9 +++++++++ osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs index c89527d8bd..866e41d644 100644 --- a/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs +++ b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs @@ -6,6 +6,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Lists; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Rulesets.Mods; @@ -46,15 +47,23 @@ namespace osu.Game.Rulesets.Osu.Edit HitPolicy = new AnyOrderHitPolicy(); } + private readonly WeakList drawableHitObjects = new WeakList(); + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { hitAnimations = config.GetBindable(OsuSetting.EditorHitAnimations); + hitAnimations.BindValueChanged(_ => + { + foreach (var d in drawableHitObjects) d.RefreshStateTransforms(); + }); } protected override void OnNewDrawableHitObject(DrawableHitObject d) { d.ApplyCustomUpdateState += updateState; + + drawableHitObjects.Add(d); } private void updateState(DrawableHitObject hitObject, ArmedState state) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 5531bf8b5a..2e573a7f85 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -448,7 +448,7 @@ namespace osu.Game.Rulesets.Objects.Drawables /// /// Reapplies the current . /// - protected void RefreshStateTransforms() => updateState(State.Value, true); + public void RefreshStateTransforms() => updateState(State.Value, true); /// /// Apply (generally fade-in) transforms leading into the start time. From c4854d40048fde964eff9f54e01e60458c052555 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 17:55:12 +0900 Subject: [PATCH 0984/2328] Fix slider ball rotation becoming undefined when time is not flowing smoothly --- osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs index 8943a91076..710967b741 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs @@ -195,16 +195,16 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default public void UpdateProgress(double completionProgress) { - var newPos = drawableSlider.HitObject.CurvePositionAt(completionProgress); + Position = drawableSlider.HitObject.CurvePositionAt(completionProgress); - var diff = lastPosition.HasValue ? lastPosition.Value - newPos : newPos - drawableSlider.HitObject.CurvePositionAt(completionProgress + 0.01f); - if (diff == Vector2.Zero) + var diff = lastPosition.HasValue ? lastPosition.Value - Position : Position - drawableSlider.HitObject.CurvePositionAt(completionProgress + 0.01f); + + // Ensure the value is substantially high enough to allow for Atan2 to get a valid angle. + if (diff.LengthFast < 0.01f) return; - Position = newPos; ball.Rotation = -90 + (float)(-Math.Atan2(diff.X, diff.Y) * 180 / Math.PI); - - lastPosition = newPos; + lastPosition = Position; } private class FollowCircleContainer : CircularContainer From f5649b926a09976f05050534e074f7131c8b46c4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 18:04:20 +0900 Subject: [PATCH 0985/2328] Use `AliveObjects` rather than tracking all hitobjects manually --- osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs index 866e41d644..72d04d4211 100644 --- a/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs +++ b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs @@ -6,7 +6,6 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Lists; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Rulesets.Mods; @@ -47,23 +46,20 @@ namespace osu.Game.Rulesets.Osu.Edit HitPolicy = new AnyOrderHitPolicy(); } - private readonly WeakList drawableHitObjects = new WeakList(); - [BackgroundDependencyLoader] private void load(OsuConfigManager config) { hitAnimations = config.GetBindable(OsuSetting.EditorHitAnimations); hitAnimations.BindValueChanged(_ => { - foreach (var d in drawableHitObjects) d.RefreshStateTransforms(); + foreach (var d in HitObjectContainer.AliveObjects) + d.RefreshStateTransforms(); }); } protected override void OnNewDrawableHitObject(DrawableHitObject d) { d.ApplyCustomUpdateState += updateState; - - drawableHitObjects.Add(d); } private void updateState(DrawableHitObject hitObject, ArmedState state) From 4463a26f4e3c00287de0532fc14b02fdb3b96724 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 12 May 2022 17:19:07 +0900 Subject: [PATCH 0986/2328] Refactor opacity computation algorithm --- .../Preprocessing/OsuDifficultyHitObject.cs | 31 ++++++++++++++----- .../Difficulty/Skills/Flashlight.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs | 8 ++--- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 5cbddb5772..cf4802d282 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -4,6 +4,7 @@ using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Objects; using osuTK; @@ -85,19 +86,33 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing setDistances(clockRate); } - public double Opacity(double mapTime, bool hidden) + public double OpacityAt(double time, bool hidden) { - double ms = BaseObject.StartTime - mapTime; - if (ms < 0) + if (time > BaseObject.StartTime) + { + // Consider a hitobject as being invisible when its start time is passed. + // In reality the hitobject will be visible beyond its start time up until its hittable window has passed, + // but this is an approximation and such a case is unlikely to be hit where this function is used. return 0.0; + } - double preemptTime = BaseObject.TimePreempt; - double fadeInTime = BaseObject.TimeFadeIn; + double fadeInStartTime = BaseObject.StartTime - BaseObject.TimePreempt; + double fadeInDuration = BaseObject.TimeFadeIn; if (hidden) - return Math.Clamp(Math.Min((1.0 - ms / preemptTime) * 2.5, (ms / preemptTime - 0.3) * (1.0 / 0.3)), 0.0, 1.0); - else - return Math.Clamp((preemptTime - ms) / fadeInTime, 0.0, 1.0); + { + // Taken from OsuModHidden. + double fadeOutStartTime = BaseObject.StartTime - BaseObject.TimePreempt + BaseObject.TimeFadeIn; + double fadeOutDuration = BaseObject.TimePreempt * OsuModHidden.FADE_OUT_DURATION_MULTIPLIER; + + return Math.Min + ( + Math.Clamp((time - fadeInStartTime) / fadeInDuration, 0.0, 1.0), + 1.0 - Math.Clamp((time - fadeOutStartTime) / fadeOutDuration, 0.0, 1.0) + ); + } + + return Math.Clamp((time - fadeInStartTime) / fadeInDuration, 0.0, 1.0); } private void setDistances(double clockRate) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 5d2052046b..d93007fae5 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills double stackNerf = Math.Min(1.0, (currentObj.LazyJumpDistance / scalingFactor) / 25.0); // Bonus based on how visible the object is. - double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.Opacity(currentHitObject.StartTime, hidden)); + double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.OpacityAt(currentHitObject.StartTime, hidden)); result += stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime; } diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs index d602fe67ee..fc04e4d091 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs @@ -27,8 +27,8 @@ namespace osu.Game.Rulesets.Osu.Mods public override Type[] IncompatibleMods => new[] { typeof(IRequiresApproachCircles), typeof(OsuModSpinIn) }; - private const double fade_in_duration_multiplier = 0.4; - private const double fade_out_duration_multiplier = 0.3; + public const double FADE_IN_DURATION_MULTIPLIER = 0.4; + public const double FADE_OUT_DURATION_MULTIPLIER = 0.3; protected override bool IsFirstAdjustableObject(HitObject hitObject) => !(hitObject is Spinner || hitObject is SpinnerTick); @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Mods static void applyFadeInAdjustment(OsuHitObject osuObject) { - osuObject.TimeFadeIn = osuObject.TimePreempt * fade_in_duration_multiplier; + osuObject.TimeFadeIn = osuObject.TimePreempt * FADE_IN_DURATION_MULTIPLIER; foreach (var nested in osuObject.NestedHitObjects.OfType()) applyFadeInAdjustment(nested); } @@ -156,7 +156,7 @@ namespace osu.Game.Rulesets.Osu.Mods static (double fadeStartTime, double fadeDuration) getParameters(OsuHitObject hitObject) { double fadeOutStartTime = hitObject.StartTime - hitObject.TimePreempt + hitObject.TimeFadeIn; - double fadeOutDuration = hitObject.TimePreempt * fade_out_duration_multiplier; + double fadeOutDuration = hitObject.TimePreempt * FADE_OUT_DURATION_MULTIPLIER; // new duration from completed fade in to end (before fading out) double longFadeDuration = hitObject.GetEndTime() - fadeOutStartTime; From 1b2c07e1423ef313b6e5228f347641176255f74e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 19:25:51 +0900 Subject: [PATCH 0987/2328] Extend lifetime of `OsuSelectionBlueprint` to allow for lingering display --- .../Edit/Blueprints/OsuSelectionBlueprint.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs index 994c5cebeb..dbf53ac9a6 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs @@ -1,19 +1,27 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Screens.Edit; namespace osu.Game.Rulesets.Osu.Edit.Blueprints { public abstract class OsuSelectionBlueprint : HitObjectSelectionBlueprint where T : OsuHitObject { + [Resolved] + private EditorClock editorClock { get; set; } + protected new DrawableOsuHitObject DrawableObject => (DrawableOsuHitObject)base.DrawableObject; protected override bool AlwaysShowWhenSelected => true; + protected override bool ShouldBeAlive => base.ShouldBeAlive || editorClock.CurrentTime - Item.GetEndTime() < DrawableOsuEditorRuleset.EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION; + protected OsuSelectionBlueprint(T hitObject) : base(hitObject) { From c63e65c677b5103e4fc18e11cef67bb32ad497a9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 19:26:13 +0900 Subject: [PATCH 0988/2328] Don't hide `SelectionBlueprint`s themselves, only their children --- osu.Game/Rulesets/Edit/SelectionBlueprint.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Rulesets/Edit/SelectionBlueprint.cs b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs index 12ab89f79e..5e5bc9036d 100644 --- a/osu.Game/Rulesets/Edit/SelectionBlueprint.cs +++ b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs @@ -89,16 +89,12 @@ namespace osu.Game.Rulesets.Edit // set the body piece's alpha directly to avoid arbitrarily rendering frame buffers etc. of children. foreach (var d in InternalChildren) d.Hide(); - - Hide(); } protected virtual void OnSelected() { foreach (var d in InternalChildren) d.Show(); - - Show(); } // When not selected, input is only required for the blueprint itself to receive IsHovering From be3d4c9bf5a52e5dfcdb78d834f068389db47035 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 19:26:34 +0900 Subject: [PATCH 0989/2328] Add circle overlap marker, bringing back stable-like visibility of circles in the past --- .../Components/HitCircleOverlapMarker.cs | 87 +++++++++++++++++++ .../HitCircles/HitCircleSelectionBlueprint.cs | 9 +- .../Blueprints/Sliders/SliderCircleOverlay.cs | 23 ++++- 3 files changed, 116 insertions(+), 3 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs new file mode 100644 index 0000000000..34e5e120f1 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs @@ -0,0 +1,87 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Utils; +using osu.Game.Graphics; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Skinning.Default; +using osu.Game.Screens.Edit; +using osu.Game.Skinning; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components +{ + public class HitCircleOverlapMarker : BlueprintPiece + { + private readonly Circle circle; + private readonly RingPiece ring; + + [Resolved] + private EditorClock editorClock { get; set; } + + public HitCircleOverlapMarker() + { + Origin = Anchor.Centre; + + Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2); + + InternalChildren = new Drawable[] + { + circle = new Circle + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + }, + ring = new RingPiece + { + BorderThickness = 4, + } + }; + } + + [Resolved] + private ISkinSource skin { get; set; } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + circle.BorderColour = colours.Yellow; + } + + public override void UpdateFrom(HitCircle hitObject) + { + base.UpdateFrom(hitObject); + + Scale = new Vector2(hitObject.Scale); + + if ((hitObject is IHasComboInformation combo)) + ring.BorderColour = combo.GetComboColour(skin); + + bool hasReachedObject = editorClock.CurrentTime >= hitObject.StartTime; + float interpolation = Interpolation.ValueAt(editorClock.CurrentTime, 0, 1f, hitObject.StartTime, hitObject.StartTime + DrawableOsuEditorRuleset.EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION, Easing.In); + float interpolation2 = MathHelper.Clamp(Interpolation.ValueAt(editorClock.CurrentTime, 0, 1f, hitObject.StartTime, hitObject.StartTime + DrawableOsuEditorRuleset.EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION / 2, Easing.OutQuint), 0, 1); + float interpolation3 = Interpolation.ValueAt(editorClock.CurrentTime, 0, 1f, hitObject.StartTime, hitObject.StartTime + DrawableOsuEditorRuleset.EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION); + + if (hasReachedObject) + { + circle.Scale = new Vector2(1 - 0.05f * interpolation3); + ring.Scale = new Vector2(1 + 0.1f * interpolation2); + Alpha = 0.9f * (1 - (interpolation)); + } + else + Alpha = 0; + } + + public override void Hide() + { + // intentional no op so we are not hidden when not selected. + } + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs index b21a3e038e..3f9cfe21d4 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; @@ -14,11 +15,16 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles protected new DrawableHitCircle DrawableObject => (DrawableHitCircle)base.DrawableObject; protected readonly HitCirclePiece CirclePiece; + private readonly HitCircleOverlapMarker marker; public HitCircleSelectionBlueprint(HitCircle circle) : base(circle) { - InternalChild = CirclePiece = new HitCirclePiece(); + InternalChildren = new Drawable[] + { + marker = new HitCircleOverlapMarker(), + CirclePiece = new HitCirclePiece(), + }; } protected override void Update() @@ -26,6 +32,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles base.Update(); CirclePiece.UpdateFrom(HitObject); + marker.UpdateFrom(HitObject); } public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => DrawableObject.HitArea.ReceivePositionalInputAt(screenSpacePos); diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs index 241ff70a18..d31d2aed97 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; @@ -13,20 +14,38 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders private readonly Slider slider; private readonly SliderPosition position; + private readonly HitCircleOverlapMarker marker; public SliderCircleOverlay(Slider slider, SliderPosition position) { this.slider = slider; this.position = position; - InternalChild = CirclePiece = new HitCirclePiece(); + InternalChildren = new Drawable[] + { + marker = new HitCircleOverlapMarker(), + CirclePiece = new HitCirclePiece(), + }; } protected override void Update() { base.Update(); - CirclePiece.UpdateFrom(position == SliderPosition.Start ? (HitCircle)slider.HeadCircle : slider.TailCircle); + var circle = position == SliderPosition.Start ? (HitCircle)slider.HeadCircle : slider.TailCircle; + + CirclePiece.UpdateFrom(circle); + marker.UpdateFrom(circle); + } + + public override void Hide() + { + CirclePiece.Hide(); + } + + public override void Show() + { + CirclePiece.Show(); } } } From f22ff4e087d5567831e6c2388bb0b031080728d6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 19:28:56 +0900 Subject: [PATCH 0990/2328] Remove editor animation toggling (replaced by overlap markers) --- .../Editor/TestSceneOsuEditorHitAnimations.cs | 114 ------------------ .../Edit/DrawableOsuEditorRuleset.cs | 76 ------------ osu.Game/Configuration/OsuConfigManager.cs | 2 - osu.Game/Screens/Edit/Editor.cs | 1 - 4 files changed, 193 deletions(-) delete mode 100644 osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditorHitAnimations.cs diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditorHitAnimations.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditorHitAnimations.cs deleted file mode 100644 index 7ffa2c1f94..0000000000 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditorHitAnimations.cs +++ /dev/null @@ -1,114 +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 System; -using System.Collections.Generic; -using System.Linq; -using NUnit.Framework; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Transforms; -using osu.Framework.Testing; -using osu.Framework.Utils; -using osu.Game.Configuration; -using osu.Game.Rulesets.Objects; -using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Edit; -using osu.Game.Rulesets.Osu.Objects; -using osu.Game.Rulesets.Osu.Objects.Drawables; - -namespace osu.Game.Rulesets.Osu.Tests.Editor -{ - [TestFixture] - public class TestSceneOsuEditorHitAnimations : TestSceneOsuEditor - { - [Resolved] - private OsuConfigManager config { get; set; } - - [Test] - public void TestHitCircleAnimationDisable() - { - HitCircle hitCircle = null; - DrawableHitCircle drawableHitCircle = null; - - AddStep("retrieve first hit circle", () => hitCircle = getHitCircle(0)); - toggleAnimations(true); - seekSmoothlyTo(() => hitCircle.StartTime + 10); - - AddStep("retrieve drawable", () => drawableHitCircle = (DrawableHitCircle)getDrawableObjectFor(hitCircle)); - assertFutureTransforms(() => drawableHitCircle.CirclePiece, true); - - AddStep("retrieve second hit circle", () => hitCircle = getHitCircle(1)); - toggleAnimations(false); - seekSmoothlyTo(() => hitCircle.StartTime + 10); - - AddStep("retrieve drawable", () => drawableHitCircle = (DrawableHitCircle)getDrawableObjectFor(hitCircle)); - assertFutureTransforms(() => drawableHitCircle.CirclePiece, false); - AddAssert("hit circle has longer fade-out applied", () => - { - var alphaTransform = drawableHitCircle.Transforms.Last(t => t.TargetMember == nameof(Alpha)); - return alphaTransform.EndTime - alphaTransform.StartTime == DrawableOsuEditorRuleset.EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION; - }); - } - - [Test] - public void TestSliderAnimationDisable() - { - Slider slider = null; - DrawableSlider drawableSlider = null; - DrawableSliderRepeat sliderRepeat = null; - - AddStep("retrieve first slider with repeats", () => slider = getSliderWithRepeats(0)); - toggleAnimations(true); - seekSmoothlyTo(() => slider.StartTime + slider.SpanDuration + 10); - - retrieveDrawables(); - assertFutureTransforms(() => sliderRepeat, true); - - AddStep("retrieve second slider with repeats", () => slider = getSliderWithRepeats(1)); - toggleAnimations(false); - seekSmoothlyTo(() => slider.StartTime + slider.SpanDuration + 10); - - retrieveDrawables(); - assertFutureTransforms(() => sliderRepeat.Arrow, false); - seekSmoothlyTo(() => slider.GetEndTime()); - AddAssert("slider has longer fade-out applied", () => - { - var alphaTransform = drawableSlider.Transforms.Last(t => t.TargetMember == nameof(Alpha)); - return alphaTransform.EndTime - alphaTransform.StartTime == DrawableOsuEditorRuleset.EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION; - }); - - void retrieveDrawables() => - AddStep("retrieve drawables", () => - { - drawableSlider = (DrawableSlider)getDrawableObjectFor(slider); - sliderRepeat = (DrawableSliderRepeat)getDrawableObjectFor(slider.NestedHitObjects.OfType().First()); - }); - } - - private HitCircle getHitCircle(int index) - => EditorBeatmap.HitObjects.OfType().ElementAt(index); - - private Slider getSliderWithRepeats(int index) - => EditorBeatmap.HitObjects.OfType().Where(s => s.RepeatCount >= 1).ElementAt(index); - - private DrawableHitObject getDrawableObjectFor(HitObject hitObject) - => this.ChildrenOfType().Single(ho => ho.HitObject == hitObject); - - private IEnumerable getTransformsRecursively(Drawable drawable) - => drawable.ChildrenOfType().SelectMany(d => d.Transforms); - - private void toggleAnimations(bool enabled) - => AddStep($"toggle animations {(enabled ? "on" : "off")}", () => config.SetValue(OsuSetting.EditorHitAnimations, enabled)); - - private void seekSmoothlyTo(Func targetTime) - { - AddStep("seek smoothly", () => EditorClock.SeekSmoothlyTo(targetTime.Invoke())); - AddUntilStep("wait for seek", () => Precision.AlmostEquals(targetTime.Invoke(), EditorClock.CurrentTime)); - } - - private void assertFutureTransforms(Func getDrawable, bool hasFutureTransforms) - => AddAssert($"object {(hasFutureTransforms ? "has" : "has no")} future transforms", - () => getTransformsRecursively(getDrawable()).Any(t => t.EndTime >= EditorClock.CurrentTime) == hasFutureTransforms); - } -} diff --git a/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs index c89527d8bd..f542c88d89 100644 --- a/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs +++ b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs @@ -2,16 +2,8 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using System.Linq; -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Graphics; using osu.Game.Beatmaps; -using osu.Game.Configuration; using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.Osu.Skinning.Default; using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.UI; using osuTK; @@ -37,80 +29,12 @@ namespace osu.Game.Rulesets.Osu.Edit private class OsuEditorPlayfield : OsuPlayfield { - private Bindable hitAnimations; - protected override GameplayCursorContainer CreateCursor() => null; public OsuEditorPlayfield() { HitPolicy = new AnyOrderHitPolicy(); } - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - hitAnimations = config.GetBindable(OsuSetting.EditorHitAnimations); - } - - protected override void OnNewDrawableHitObject(DrawableHitObject d) - { - d.ApplyCustomUpdateState += updateState; - } - - private void updateState(DrawableHitObject hitObject, ArmedState state) - { - if (state == ArmedState.Idle || hitAnimations.Value) - return; - - if (hitObject is DrawableHitCircle circle) - { - using (circle.BeginAbsoluteSequence(circle.HitStateUpdateTime)) - { - circle.ApproachCircle - .FadeOutFromOne(EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION * 4) - .Expire(); - - circle.ApproachCircle.ScaleTo(1.1f, 300, Easing.OutQuint); - } - } - - if (hitObject is IHasMainCirclePiece mainPieceContainer) - { - // clear any explode animation logic. - // this is scheduled after children to ensure that the clear happens after invocations of ApplyCustomUpdateState on the circle piece's nested skinnables. - ScheduleAfterChildren(() => - { - if (hitObject.HitObject == null) return; - - mainPieceContainer.CirclePiece.ApplyTransformsAt(hitObject.StateUpdateTime, true); - mainPieceContainer.CirclePiece.ClearTransformsAfter(hitObject.StateUpdateTime, true); - }); - } - - if (hitObject is DrawableSliderRepeat repeat) - { - repeat.Arrow.ApplyTransformsAt(hitObject.StateUpdateTime, true); - repeat.Arrow.ClearTransformsAfter(hitObject.StateUpdateTime, true); - } - - // adjust the visuals of top-level object types to make them stay on screen for longer than usual. - switch (hitObject) - { - case DrawableSlider _: - case DrawableHitCircle _: - // Get the existing fade out transform - var existing = hitObject.Transforms.LastOrDefault(t => t.TargetMember == nameof(Alpha)); - - if (existing == null) - return; - - hitObject.RemoveTransform(existing); - - using (hitObject.BeginAbsoluteSequence(hitObject.HitStateUpdateTime)) - hitObject.FadeOut(EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION).Expire(); - break; - } - } } } } diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 026a83cceb..20d555c16c 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -163,7 +163,6 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.DiscordRichPresence, DiscordRichPresenceMode.Full); SetDefault(OsuSetting.EditorWaveformOpacity, 0.25f); - SetDefault(OsuSetting.EditorHitAnimations, false); } public IDictionary GetLoggableState() => @@ -356,7 +355,6 @@ namespace osu.Game.Configuration GameplayDisableWinKey, SeasonalBackgroundMode, EditorWaveformOpacity, - EditorHitAnimations, DiscordRichPresence, AutomaticallyDownloadWhenSpectating, ShowOnlineExplicitContent, diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 947c184009..75d2480a97 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -270,7 +270,6 @@ namespace osu.Game.Screens.Edit Items = new MenuItem[] { new WaveformOpacityMenuItem(config.GetBindable(OsuSetting.EditorWaveformOpacity)), - new HitAnimationsMenuItem(config.GetBindable(OsuSetting.EditorHitAnimations)) } } } From 0c335592b3ed4eebd8428fa91dd4c90abb98010c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 19:42:35 +0900 Subject: [PATCH 0991/2328] Tidy up interpolation and move `const` to new home --- .../Components/HitCircleOverlapMarker.cs | 23 +++++++++++++------ .../Edit/Blueprints/OsuSelectionBlueprint.cs | 3 ++- .../Edit/DrawableOsuEditorRuleset.cs | 6 ----- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs index 34e5e120f1..579c9ef356 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs @@ -18,6 +18,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components { public class HitCircleOverlapMarker : BlueprintPiece { + /// + /// Hit objects are intentionally made to fade out at a constant slower rate than in gameplay. + /// This allows a mapper to gain better historical context and use recent hitobjects as reference / snap points. + /// + public const double FADE_OUT_EXTENSION = 700; + private readonly Circle circle; private readonly RingPiece ring; @@ -64,16 +70,19 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components if ((hitObject is IHasComboInformation combo)) ring.BorderColour = combo.GetComboColour(skin); - bool hasReachedObject = editorClock.CurrentTime >= hitObject.StartTime; - float interpolation = Interpolation.ValueAt(editorClock.CurrentTime, 0, 1f, hitObject.StartTime, hitObject.StartTime + DrawableOsuEditorRuleset.EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION, Easing.In); - float interpolation2 = MathHelper.Clamp(Interpolation.ValueAt(editorClock.CurrentTime, 0, 1f, hitObject.StartTime, hitObject.StartTime + DrawableOsuEditorRuleset.EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION / 2, Easing.OutQuint), 0, 1); - float interpolation3 = Interpolation.ValueAt(editorClock.CurrentTime, 0, 1f, hitObject.StartTime, hitObject.StartTime + DrawableOsuEditorRuleset.EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION); + double editorTime = editorClock.CurrentTime; + double hitObjectTime = hitObject.StartTime; + bool hasReachedObject = editorTime >= hitObjectTime; if (hasReachedObject) { - circle.Scale = new Vector2(1 - 0.05f * interpolation3); - ring.Scale = new Vector2(1 + 0.1f * interpolation2); - Alpha = 0.9f * (1 - (interpolation)); + float alpha = Interpolation.ValueAt(editorTime, 0, 1f, hitObjectTime, hitObjectTime + FADE_OUT_EXTENSION, Easing.In); + float circleScale = Interpolation.ValueAt(editorTime, 0, 1f, hitObjectTime, hitObjectTime + FADE_OUT_EXTENSION); + float ringScale = MathHelper.Clamp(Interpolation.ValueAt(editorTime, 0, 1f, hitObjectTime, hitObjectTime + FADE_OUT_EXTENSION / 2, Easing.OutQuint), 0, 1); + + circle.Scale = new Vector2(1 - 0.05f * circleScale); + ring.Scale = new Vector2(1 + 0.1f * ringScale); + Alpha = 0.9f * (1 - alpha); } else Alpha = 0; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs index dbf53ac9a6..1d32e922ac 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Screens.Edit; @@ -20,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints protected override bool AlwaysShowWhenSelected => true; - protected override bool ShouldBeAlive => base.ShouldBeAlive || editorClock.CurrentTime - Item.GetEndTime() < DrawableOsuEditorRuleset.EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION; + protected override bool ShouldBeAlive => base.ShouldBeAlive || editorClock.CurrentTime - Item.GetEndTime() < HitCircleOverlapMarker.FADE_OUT_EXTENSION; protected OsuSelectionBlueprint(T hitObject) : base(hitObject) diff --git a/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs index f542c88d89..516b34d807 100644 --- a/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs +++ b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs @@ -12,12 +12,6 @@ namespace osu.Game.Rulesets.Osu.Edit { public class DrawableOsuEditorRuleset : DrawableOsuRuleset { - /// - /// Hit objects are intentionally made to fade out at a constant slower rate than in gameplay. - /// This allows a mapper to gain better historical context and use recent hitobjects as reference / snap points. - /// - public const double EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION = 700; - public DrawableOsuEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods) : base(ruleset, beatmap, mods) { From 0318944b807d8c3a2aa75735f78f955ec3dab837 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 23:37:29 +0900 Subject: [PATCH 0992/2328] Fix incorrect alive criteria causing clicking future objects to be too greedy --- osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs index 1d32e922ac..2d0c6fe81d 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs @@ -21,7 +21,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints protected override bool AlwaysShowWhenSelected => true; - protected override bool ShouldBeAlive => base.ShouldBeAlive || editorClock.CurrentTime - Item.GetEndTime() < HitCircleOverlapMarker.FADE_OUT_EXTENSION; + protected override bool ShouldBeAlive => base.ShouldBeAlive + || (editorClock.CurrentTime >= Item.StartTime && editorClock.CurrentTime - Item.GetEndTime() < HitCircleOverlapMarker.FADE_OUT_EXTENSION); protected OsuSelectionBlueprint(T hitObject) : base(hitObject) From a35c57860cb309ff73ac62d41be0b39b5257c3b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 May 2022 23:54:43 +0900 Subject: [PATCH 0993/2328] Resolve colour inline --- osu.Game/Online/Chat/StandAloneChatDisplay.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Online/Chat/StandAloneChatDisplay.cs b/osu.Game/Online/Chat/StandAloneChatDisplay.cs index 79c4ed6068..b7e1bc999b 100644 --- a/osu.Game/Online/Chat/StandAloneChatDisplay.cs +++ b/osu.Game/Online/Chat/StandAloneChatDisplay.cs @@ -155,7 +155,8 @@ namespace osu.Game.Online.Chat { public Func CreateChatLineAction; - private Colour4 daySepColour; + [Resolved] + private OsuColour colours { get; set; } public StandAloneDrawableChannel(Channel channel) : base(channel) @@ -163,10 +164,9 @@ namespace osu.Game.Online.Chat } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load() { ChatLineFlow.Padding = new MarginPadding { Horizontal = 0 }; - daySepColour = colours.Yellow; } protected override ChatLine CreateChatLine(Message m) => CreateChatLineAction(m); @@ -174,7 +174,7 @@ namespace osu.Game.Online.Chat protected override Drawable CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) { TextSize = 14, - Colour = daySepColour, + Colour = colours.Yellow, LineHeight = 1, Padding = new MarginPadding { Horizontal = 10 }, Margin = new MarginPadding { Vertical = 5 }, From 9f5351e5a195d490db4b19b808263aeeac725e85 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Thu, 12 May 2022 23:48:58 +0100 Subject: [PATCH 0994/2328] Add drawable channel caching to new chat overlay --- osu.Game/Overlays/ChatOverlayV2.cs | 37 +++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 6eec0bbbf4..bd3823f090 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -39,8 +39,9 @@ namespace osu.Game.Overlays private ChatTextBar textBar = null!; private Container currentChannelContainer = null!; - private readonly BindableFloat chatHeight = new BindableFloat(); + private readonly Dictionary loadedChannels = new Dictionary(); + private readonly BindableFloat chatHeight = new BindableFloat(); private bool isDraggingTopBar; private float dragStartChatHeight; @@ -173,7 +174,7 @@ namespace osu.Game.Overlays if (currentChannel.Value?.Id != channel.Id) { if (!channel.Joined.Value) - channel = channelManager.JoinChannel(channel); + channel = channelManager.JoinChannel(channel, false); channelManager.CurrentChannel.Value = channel; } @@ -248,13 +249,26 @@ namespace osu.Game.Overlays channelListing.State.Value = Visibility.Hidden; textBar.ShowSearch.Value = false; - loading.Show(); - LoadComponentAsync(new ChatOverlayDrawableChannel(newChannel), loaded => + if (loadedChannels.ContainsKey(newChannel)) { - currentChannelContainer.Clear(); - currentChannelContainer.Add(loaded); - loading.Hide(); - }); + currentChannelContainer.Clear(false); + currentChannelContainer.Add(loadedChannels[newChannel]); + } + else + { + loading.Show(); + + // Ensure the drawable channel is stored before async load to prevent double loading + ChatOverlayDrawableChannel drawableChannel = new ChatOverlayDrawableChannel(newChannel); + loadedChannels.Add(newChannel, drawableChannel); + + LoadComponentAsync(drawableChannel, loaded => + { + currentChannelContainer.Clear(false); + currentChannelContainer.Add(loaded); + loading.Hide(); + }); + } } } @@ -264,14 +278,21 @@ namespace osu.Game.Overlays { case NotifyCollectionChangedAction.Add: IEnumerable joinedChannels = filterChannels(args.NewItems); + foreach (var channel in joinedChannels) channelList.AddChannel(channel); + break; case NotifyCollectionChangedAction.Remove: IEnumerable leftChannels = filterChannels(args.OldItems); + foreach (var channel in leftChannels) + { channelList.RemoveChannel(channel); + loadedChannels.Remove(channel); + } + break; } } From ff13ef6bb05e0633d8c59e4a40273e084645336b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 May 2022 19:46:21 +0900 Subject: [PATCH 0995/2328] Fix a couple of markdown inspections --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dba0b2670d..9daa9635a9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- + osu! logo

# osu! @@ -31,7 +31,7 @@ If you are looking to install or test osu! without setting up a development envi **Latest build:** -| [Windows 8.1+ (x64)](https://github.com/ppy/osu/releases/latest/download/install.exe) | macOS 10.15+ ([Intel](https://github.com/ppy/osu/releases/latest/download/osu.app.Intel.zip), [Apple Silicon](https://github.com/ppy/osu/releases/latest/download/osu.app.Apple.Silicon.zip)) | [Linux (x64)](https://github.com/ppy/osu/releases/latest/download/osu.AppImage) | [iOS 10+](https://osu.ppy.sh/home/testflight) | [Android 5+](https://github.com/ppy/osu/releases/latest/download/sh.ppy.osulazer.apk) +| [Windows 8.1+ (x64)](https://github.com/ppy/osu/releases/latest/download/install.exe) | macOS 10.15+ ([Intel](https://github.com/ppy/osu/releases/latest/download/osu.app.Intel.zip), [Apple Silicon](https://github.com/ppy/osu/releases/latest/download/osu.app.Apple.Silicon.zip)) | [Linux (x64)](https://github.com/ppy/osu/releases/latest/download/osu.AppImage) | [iOS 10+](https://osu.ppy.sh/home/testflight) | [Android 5+](https://github.com/ppy/osu/releases/latest/download/sh.ppy.osulazer.apk) | | ------------- | ------------- | ------------- | ------------- | ------------- | - The iOS testflight link may fill up (Apple has a hard limit of 10,000 users). We reset it occasionally when this happens. Please do not ask about this. Check back regularly for link resets or follow [peppy](https://twitter.com/ppy) on twitter for announcements of link resets. From 4b4f3ec06432bebadf6f020653c938c8c5bb8d27 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 May 2022 19:46:28 +0900 Subject: [PATCH 0996/2328] Add crowdin information to README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 9daa9635a9..75d61dad4d 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ [![GitHub release](https://img.shields.io/github/release/ppy/osu.svg)](https://github.com/ppy/osu/releases/latest) [![CodeFactor](https://www.codefactor.io/repository/github/ppy/osu/badge)](https://www.codefactor.io/repository/github/ppy/osu) [![dev chat](https://discordapp.com/api/guilds/188630481301012481/widget.png?style=shield)](https://discord.gg/ppy) +[![Crowdin](https://d322cqt584bo4o.cloudfront.net/osu-web/localized.svg)](https://crowdin.com/project/osu-web) A free-to-win rhythm game. Rhythm is just a *click* away! @@ -104,6 +105,8 @@ When it comes to contributing to the project, the two main things you can do to Note that while we already have certain standards in place, nothing is set in stone. If you have an issue with the way code is structured, with any libraries we are using, or with any processes involved with contributing, *please* bring it up. We welcome all feedback so we can make contributing to this project as painless as possible. +If you wish to help with localisation efforts, head over to [crowdin](https://crowdin.com/project/osu-web). + For those interested, we love to reward quality contributions via [bounties](https://docs.google.com/spreadsheets/d/1jNXfj_S3Pb5PErA-czDdC9DUu4IgUbe1Lt8E7CYUJuE/view?&rm=minimal#gid=523803337), paid out via PayPal or osu!supporter tags. Don't hesitate to [request a bounty](https://docs.google.com/forms/d/e/1FAIpQLSet_8iFAgPMG526pBZ2Kic6HSh7XPM3fE8xPcnWNkMzINDdYg/viewform) for your work on this project. ## Licence From 15291623180b570b3687f1e4ae3b2eda1875ad0a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 May 2022 21:28:45 +0900 Subject: [PATCH 0997/2328] Remove circle scaling (apparently the fixed scale is required for spacing) --- .../Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs index 579c9ef356..e00abadb7e 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs @@ -77,10 +77,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components if (hasReachedObject) { float alpha = Interpolation.ValueAt(editorTime, 0, 1f, hitObjectTime, hitObjectTime + FADE_OUT_EXTENSION, Easing.In); - float circleScale = Interpolation.ValueAt(editorTime, 0, 1f, hitObjectTime, hitObjectTime + FADE_OUT_EXTENSION); float ringScale = MathHelper.Clamp(Interpolation.ValueAt(editorTime, 0, 1f, hitObjectTime, hitObjectTime + FADE_OUT_EXTENSION / 2, Easing.OutQuint), 0, 1); - circle.Scale = new Vector2(1 - 0.05f * circleScale); ring.Scale = new Vector2(1 + 0.1f * ringScale); Alpha = 0.9f * (1 - alpha); } From 38b8baf0954a95cbf993144a5533b1d582abda44 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 May 2022 21:28:50 +0900 Subject: [PATCH 0998/2328] Remove unused border colour --- .../HitCircles/Components/HitCircleOverlapMarker.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs index e00abadb7e..b2fc310dcb 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Utils; -using osu.Game.Graphics; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Skinning.Default; @@ -55,12 +54,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components [Resolved] private ISkinSource skin { get; set; } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - circle.BorderColour = colours.Yellow; - } - public override void UpdateFrom(HitCircle hitObject) { base.UpdateFrom(hitObject); From d9782b5ef67627ab3597176f2b38a6d0efd0a37e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 May 2022 21:31:49 +0900 Subject: [PATCH 0999/2328] Remove redundant parenthesis --- .../Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs index b2fc310dcb..b9d0d37d02 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs @@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components Scale = new Vector2(hitObject.Scale); - if ((hitObject is IHasComboInformation combo)) + if (hitObject is IHasComboInformation combo) ring.BorderColour = combo.GetComboColour(skin); double editorTime = editorClock.CurrentTime; From 35026ad6428f35b100575cdd0653d4694bdca3e5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 May 2022 21:39:54 +0900 Subject: [PATCH 1000/2328] Add missing `EditorClock` caching --- osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs b/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs index c3fb3bfc17..5448783f6d 100644 --- a/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs +++ b/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs @@ -2,16 +2,21 @@ // See the LICENCE file in the repository root for full licence text. using JetBrains.Annotations; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Timing; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Screens.Edit; namespace osu.Game.Tests.Visual { public abstract class SelectionBlueprintTestScene : OsuManualInputManagerTestScene { + [Cached] + private readonly EditorClock editorClock = new EditorClock(); + protected override Container Content => content ?? base.Content; private readonly Container content; From dec298cccbdfd34108c2c34f771ed82d81ce643c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 May 2022 21:47:22 +0900 Subject: [PATCH 1001/2328] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 98dc28d915..b984f528fe 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 772a78c8fe..7f149b4e35 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index af8f9b617c..932421a705 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -62,7 +62,7 @@ - + From cf3ead80477621b7b911010f5435269964127d38 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 May 2022 22:06:30 +0900 Subject: [PATCH 1002/2328] Remove unused local --- .../Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs index b9d0d37d02..ad4be2017e 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs @@ -23,7 +23,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components ///
public const double FADE_OUT_EXTENSION = 700; - private readonly Circle circle; private readonly RingPiece ring; [Resolved] @@ -37,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components InternalChildren = new Drawable[] { - circle = new Circle + new Circle { Anchor = Anchor.Centre, Origin = Anchor.Centre, From c4871ebcf4eaf35b3fe804d74a86b95474410e3a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 14 May 2022 02:50:51 +0900 Subject: [PATCH 1003/2328] Add editor track traversal keys (`Z`-`V`) --- osu.Game/Screens/Edit/Editor.cs | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 947c184009..0fa9d4ef01 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -33,6 +33,7 @@ using osu.Game.Overlays.Notifications; using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets; using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Objects; using osu.Game.Screens.Edit.Components; using osu.Game.Screens.Edit.Components.Menus; using osu.Game.Screens.Edit.Components.Timelines.Summary; @@ -475,6 +476,44 @@ namespace osu.Game.Screens.Edit case Key.Right: seek(e, 1); return true; + + // Track traversal keys. + // Matching osu-stable implementations. + case Key.Z: + // Seek to first object time, or track start if already there. + double? firstObjectTime = editorBeatmap.HitObjects.FirstOrDefault()?.StartTime; + + if (firstObjectTime == null || clock.CurrentTime == firstObjectTime) + clock.Seek(0); + else + clock.Seek(firstObjectTime.Value); + return true; + + case Key.X: + // Restart playback from beginning of track. + clock.Seek(0); + clock.Start(); + return true; + + case Key.C: + // Pause or resume. + if (clock.IsRunning) + clock.Stop(); + else + clock.Start(); + return true; + + case Key.V: + // Seek to last object time, or track end if already there. + // Note that in osu-stable subsequent presses when at track end won't return to last object. + // This has intentionally been changed to make it more useful. + double? lastObjectTime = editorBeatmap.HitObjects.LastOrDefault()?.GetEndTime(); + + if (lastObjectTime == null || clock.CurrentTime == lastObjectTime) + clock.Seek(clock.TrackLength); + else + clock.Seek(lastObjectTime.Value); + return true; } return base.OnKeyDown(e); From a346456daf26a32b528e7024cc302370c6944206 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 14 May 2022 03:01:42 +0900 Subject: [PATCH 1004/2328] Add test coverage of new traversal keys --- .../Visual/Editing/TestSceneEditorSeeking.cs | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs index ff741a8ed5..da28387c4d 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs @@ -28,6 +28,51 @@ namespace osu.Game.Tests.Visual.Editing return beatmap; } + [Test] + public void TestSeekToFirst() + { + pressAndCheckTime(Key.Z, 2170); + pressAndCheckTime(Key.Z, 0); + pressAndCheckTime(Key.Z, 2170); + + AddAssert("track not running", () => !EditorClock.IsRunning); + } + + [Test] + public void TestRestart() + { + pressAndCheckTime(Key.V, 227170); + + AddAssert("track not running", () => !EditorClock.IsRunning); + + AddStep("press X", () => InputManager.Key(Key.X)); + + AddAssert("track running", () => EditorClock.IsRunning); + AddAssert("time restarted", () => EditorClock.CurrentTime < 100000); + } + + [Test] + public void TestPauseResume() + { + AddAssert("track not running", () => !EditorClock.IsRunning); + + AddStep("press C", () => InputManager.Key(Key.C)); + AddAssert("track running", () => EditorClock.IsRunning); + + AddStep("press C", () => InputManager.Key(Key.C)); + AddAssert("track not running", () => !EditorClock.IsRunning); + } + + [Test] + public void TestSeekToLast() + { + pressAndCheckTime(Key.V, 227170); + pressAndCheckTime(Key.V, 229170); + pressAndCheckTime(Key.V, 227170); + + AddAssert("track not running", () => !EditorClock.IsRunning); + } + [Test] public void TestSnappedSeeking() { From f88e416d1a7b6f63b0177f8bc042ec7470912d5b Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Fri, 13 May 2022 23:39:09 +0100 Subject: [PATCH 1005/2328] Ensure the wrong drawable channel isn't shown after load --- osu.Game/Overlays/ChatOverlayV2.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index bd3823f090..361c06b04d 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -264,6 +264,14 @@ namespace osu.Game.Overlays LoadComponentAsync(drawableChannel, loaded => { + // Ensure the current channel hasn't changed by the time the load completes + if (currentChannel.Value != newChannel) + return; + + // Ensure the cached reference hasn't been removed from leaving the channel + if (!loadedChannels.ContainsKey(newChannel)) + return; + currentChannelContainer.Clear(false); currentChannelContainer.Add(loaded); loading.Hide(); From 2163a78b7f591518a3e532ed2a4be7835a2953ea Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sat, 14 May 2022 00:15:02 +0100 Subject: [PATCH 1006/2328] Ensure drawable channels removed from the cache are disposed --- osu.Game/Overlays/ChatOverlayV2.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 361c06b04d..e76d395204 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -241,6 +241,7 @@ namespace osu.Game.Overlays if (newChannel == null) { // null channel denotes that we should be showing the listing. + currentChannelContainer.Clear(false); channelListing.State.Value = Visibility.Visible; textBar.ShowSearch.Value = true; } @@ -298,7 +299,13 @@ namespace osu.Game.Overlays foreach (var channel in leftChannels) { channelList.RemoveChannel(channel); - loadedChannels.Remove(channel); + if (loadedChannels.ContainsKey(channel)) + { + ChatOverlayDrawableChannel loaded = loadedChannels[channel]; + loadedChannels.Remove(channel); + // DrawableChannel removed from cache must be manually disposed + loaded.Dispose(); + } } break; From bd68ffa805a6f3ae1d1a4a9853ebfa4f9aa1303d Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sat, 14 May 2022 12:16:00 +0100 Subject: [PATCH 1007/2328] Fix textbox focus test in `ChatOverlayV2` --- osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs | 6 +++--- osu.Game/Overlays/ChatOverlayV2.cs | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index bf1767cc96..82089ff3d1 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -365,19 +365,19 @@ namespace osu.Game.Tests.Visual.Online } [Test] - public void TextBoxRetainsFocus() + public void TestTextBoxRetainsFocus() { AddStep("Show overlay", () => chatOverlay.Show()); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); + AddStep("Click drawable channel", () => clickDrawable(currentDrawableChannel)); + AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); AddStep("Click selector", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); AddStep("Click listing", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); - AddStep("Click drawable channel", () => clickDrawable(currentDrawableChannel)); - AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); AddStep("Click channel list", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); AddStep("Click top bar", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index e76d395204..e91d57f18b 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -242,12 +242,12 @@ namespace osu.Game.Overlays { // null channel denotes that we should be showing the listing. currentChannelContainer.Clear(false); - channelListing.State.Value = Visibility.Visible; + channelListing.Show(); textBar.ShowSearch.Value = true; } else { - channelListing.State.Value = Visibility.Hidden; + channelListing.Hide(); textBar.ShowSearch.Value = false; if (loadedChannels.ContainsKey(newChannel)) @@ -299,6 +299,7 @@ namespace osu.Game.Overlays foreach (var channel in leftChannels) { channelList.RemoveChannel(channel); + if (loadedChannels.ContainsKey(channel)) { ChatOverlayDrawableChannel loaded = loadedChannels[channel]; From d5027cdfbd4418a129687aed5b881c41cc34a823 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 14 May 2022 19:46:13 +0300 Subject: [PATCH 1008/2328] Add `FeaturedInSpotlight` property to API beatmapsets --- .../Visual/Beatmaps/TestSceneBeatmapCard.cs | 17 +++++++++---- .../Online/TestSceneBeatmapSetOverlay.cs | 24 +++++++++++++++++++ .../API/Requests/Responses/APIBeatmapSet.cs | 3 +++ 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs index 94b693363a..6cb171974a 100644 --- a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs +++ b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs @@ -84,20 +84,26 @@ namespace osu.Game.Tests.Visual.Beatmaps explicitMap.Title = someDifficulties.TitleUnicode = "explicit beatmap"; explicitMap.HasExplicitContent = true; + var spotlightMap = CreateAPIBeatmapSet(Ruleset.Value); + spotlightMap.Title = someDifficulties.TitleUnicode = "spotlight beatmap"; + spotlightMap.FeaturedInSpotlight = true; + var featuredMap = CreateAPIBeatmapSet(Ruleset.Value); featuredMap.Title = someDifficulties.TitleUnicode = "featured artist beatmap"; featuredMap.TrackId = 1; - var explicitFeaturedMap = CreateAPIBeatmapSet(Ruleset.Value); - explicitFeaturedMap.Title = someDifficulties.TitleUnicode = "explicit featured artist"; - explicitFeaturedMap.HasExplicitContent = true; - explicitFeaturedMap.TrackId = 2; + var allBadgesMap = CreateAPIBeatmapSet(Ruleset.Value); + allBadgesMap.Title = someDifficulties.TitleUnicode = "all-badges beatmap"; + allBadgesMap.HasExplicitContent = true; + allBadgesMap.FeaturedInSpotlight = true; + allBadgesMap.TrackId = 2; var longName = CreateAPIBeatmapSet(Ruleset.Value); longName.Title = longName.TitleUnicode = "this track has an incredibly and implausibly long title"; longName.Artist = longName.ArtistUnicode = "and this artist! who would have thunk it. it's really such a long name."; longName.Source = "wow. even the source field has an impossibly long string in it. this really takes the cake, doesn't it?"; longName.HasExplicitContent = true; + longName.FeaturedInSpotlight = true; longName.TrackId = 444; testCases = new[] @@ -108,8 +114,9 @@ namespace osu.Game.Tests.Visual.Beatmaps someDifficulties, manyDifficulties, explicitMap, + spotlightMap, featuredMap, - explicitFeaturedMap, + allBadgesMap, longName }; diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index f87cca80b0..859727e632 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -165,6 +165,17 @@ namespace osu.Game.Tests.Visual.Online }); } + [Test] + public void TestSpotlightBeatmap() + { + AddStep("show spotlight map", () => + { + var beatmapSet = getBeatmapSet(); + beatmapSet.FeaturedInSpotlight = true; + overlay.ShowBeatmapSet(beatmapSet); + }); + } + [Test] public void TestFeaturedBeatmap() { @@ -176,6 +187,19 @@ namespace osu.Game.Tests.Visual.Online }); } + [Test] + public void TestAllBadgesBeatmap() + { + AddStep("show map with all badges", () => + { + var beatmapSet = getBeatmapSet(); + beatmapSet.HasExplicitContent = true; + beatmapSet.FeaturedInSpotlight = true; + beatmapSet.TrackId = 1; + overlay.ShowBeatmapSet(beatmapSet); + }); + } + [Test] public void TestHide() { diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs index d99c13b977..79c65fa79e 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs @@ -42,6 +42,9 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"nsfw")] public bool HasExplicitContent { get; set; } + [JsonProperty(@"spotlight")] + public bool FeaturedInSpotlight { get; set; } + [JsonProperty(@"video")] public bool HasVideo { get; set; } From c8bea6273b484018310d654fd80f3499ea531e91 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 14 May 2022 19:46:34 +0300 Subject: [PATCH 1009/2328] Abstractify beatmap badge logic to own class --- .../Overlays/BeatmapSet/BeatmapBadgePill.cs | 67 +++++++++++++++++++ .../BeatmapSet/ExplicitContentBeatmapPill.cs | 42 ++---------- .../BeatmapSet/FeaturedArtistBeatmapPill.cs | 42 ++---------- 3 files changed, 79 insertions(+), 72 deletions(-) create mode 100644 osu.Game/Overlays/BeatmapSet/BeatmapBadgePill.cs diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapBadgePill.cs b/osu.Game/Overlays/BeatmapSet/BeatmapBadgePill.cs new file mode 100644 index 0000000000..2c5042942c --- /dev/null +++ b/osu.Game/Overlays/BeatmapSet/BeatmapBadgePill.cs @@ -0,0 +1,67 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Extensions.LocalisationExtensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Localisation; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; + +#nullable enable + +namespace osu.Game.Overlays.BeatmapSet +{ + public abstract class BeatmapBadgePill : CompositeDrawable + { + [Resolved] + protected OsuColour Colours { get; private set; } = null!; + + [Resolved(canBeNull: true)] + protected OverlayColourProvider? ColourProvider { get; private set; } + + /// + /// The text displayed on the badge's label. + /// + public abstract LocalisableString BadgeText { get; } + + /// + /// The colour of the badge's label. + /// + public abstract Colour4 BadgeColour { get; } + + // todo: add linking support, to allow redirecting featured artist badge to corresponding track and spotlight badge to wiki page. + + protected BeatmapBadgePill() + { + AutoSizeAxes = Axes.Both; + } + + [BackgroundDependencyLoader(true)] + private void load() + { + InternalChild = new CircularContainer + { + Masking = true, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = ColourProvider?.Background5 ?? Colours.Gray2, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold), + Margin = new MarginPadding { Horizontal = 10, Vertical = 2 }, + Text = BadgeText.ToUpper(), + Colour = BadgeColour, + } + } + }; + } + } +} diff --git a/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapPill.cs b/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapPill.cs index 21d1d1172c..f8530f3a16 100644 --- a/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapPill.cs +++ b/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapPill.cs @@ -1,47 +1,17 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; -using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; +using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; +#nullable enable + namespace osu.Game.Overlays.BeatmapSet { - public class ExplicitContentBeatmapPill : CompositeDrawable + public class ExplicitContentBeatmapPill : BeatmapBadgePill { - public ExplicitContentBeatmapPill() - { - AutoSizeAxes = Axes.Both; - } - - [BackgroundDependencyLoader(true)] - private void load(OsuColour colours, OverlayColourProvider colourProvider) - { - InternalChild = new CircularContainer - { - Masking = true, - AutoSizeAxes = Axes.Both, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = colourProvider?.Background5 ?? colours.Gray2, - }, - new OsuSpriteText - { - Margin = new MarginPadding { Horizontal = 10f, Vertical = 2f }, - Text = BeatmapsetsStrings.NsfwBadgeLabel.ToUpper(), - Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold), - Colour = colours.Orange2 - } - } - }; - } + public override LocalisableString BadgeText => BeatmapsetsStrings.NsfwBadgeLabel; + public override Colour4 BadgeColour => Colours.Orange2; } } diff --git a/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapPill.cs b/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapPill.cs index 1be987cde2..4c29ede12e 100644 --- a/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapPill.cs +++ b/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapPill.cs @@ -1,47 +1,17 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; -using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; +using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; +#nullable enable + namespace osu.Game.Overlays.BeatmapSet { - public class FeaturedArtistBeatmapPill : CompositeDrawable + public class FeaturedArtistBeatmapPill : BeatmapBadgePill { - public FeaturedArtistBeatmapPill() - { - AutoSizeAxes = Axes.Both; - } - - [BackgroundDependencyLoader(true)] - private void load(OsuColour colours, OverlayColourProvider colourProvider) - { - InternalChild = new CircularContainer - { - Masking = true, - AutoSizeAxes = Axes.Both, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = colourProvider?.Background5 ?? colours.Gray2, - }, - new OsuSpriteText - { - Margin = new MarginPadding { Horizontal = 10f, Vertical = 2f }, - Text = BeatmapsetsStrings.FeaturedArtistBadgeLabel.ToUpper(), - Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold), - Colour = colours.Blue1 - } - } - }; - } + public override LocalisableString BadgeText => BeatmapsetsStrings.FeaturedArtistBadgeLabel; + public override Colour4 BadgeColour => Colours.Blue1; } } From 56d6cb5764f49eb2aaa98aef0b2ca97b3b88cbd6 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 14 May 2022 19:46:50 +0300 Subject: [PATCH 1010/2328] Add "spotlight" beatmap badge --- .../Overlays/BeatmapSet/SpotlightBeatmapPill.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 osu.Game/Overlays/BeatmapSet/SpotlightBeatmapPill.cs diff --git a/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapPill.cs b/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapPill.cs new file mode 100644 index 0000000000..7376889d7b --- /dev/null +++ b/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapPill.cs @@ -0,0 +1,17 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Localisation; +using osu.Game.Resources.Localisation.Web; + +#nullable enable + +namespace osu.Game.Overlays.BeatmapSet +{ + public class SpotlightBeatmapPill : BeatmapBadgePill + { + public override LocalisableString BadgeText => BeatmapsetsStrings.SpotlightBadgeLabel; + public override Colour4 BadgeColour => Colours.Pink1; + } +} From 2878a6dcbed331b7f73e5f8eb877fbc73745f7c2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 14 May 2022 19:47:10 +0300 Subject: [PATCH 1011/2328] Integrate spotlight beatmap badge in info overlay --- .../Overlays/BeatmapSet/BeatmapSetHeaderContent.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs index 8f4089c707..4233cfcb70 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs @@ -39,8 +39,11 @@ namespace osu.Game.Overlays.BeatmapSet private readonly Box coverGradient; private readonly OsuSpriteText title, artist; private readonly AuthorInfo author; + private readonly ExplicitContentBeatmapPill explicitContentPill; + private readonly SpotlightBeatmapPill spotlightPill; private readonly FeaturedArtistBeatmapPill featuredArtistPill; + private readonly FillFlowContainer downloadButtonsContainer; private readonly BeatmapAvailability beatmapAvailability; private readonly BeatmapSetOnlineStatusPill onlineStatusPill; @@ -127,6 +130,13 @@ namespace osu.Game.Overlays.BeatmapSet Margin = new MarginPadding { Left = 5, Bottom = 4 }, // To better lineup with the font }, explicitContentPill = new ExplicitContentBeatmapPill + { + Alpha = 0f, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Margin = new MarginPadding { Left = 10, Bottom = 4 }, + }, + spotlightPill = new SpotlightBeatmapPill { Alpha = 0f, Anchor = Anchor.BottomLeft, @@ -258,6 +268,7 @@ namespace osu.Game.Overlays.BeatmapSet artist.Text = new RomanisableString(setInfo.NewValue.ArtistUnicode, setInfo.NewValue.Artist); explicitContentPill.Alpha = setInfo.NewValue.HasExplicitContent ? 1 : 0; + spotlightPill.Alpha = setInfo.NewValue.FeaturedInSpotlight ? 1 : 0; featuredArtistPill.Alpha = setInfo.NewValue.TrackId != null ? 1 : 0; onlineStatusPill.FadeIn(500, Easing.OutQuint); From 9bac33ec9f6fb5a7c91f22356a803a50b3954f1e Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 14 May 2022 19:47:29 +0300 Subject: [PATCH 1012/2328] Integrate spotlight beatmap badge in listing cards --- .../Drawables/Cards/BeatmapCardExtra.cs | 30 +++++++++++++---- .../Drawables/Cards/BeatmapCardNormal.cs | 32 ++++++++++++++----- 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs index 535f222228..32da23b27d 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs @@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards Height = height; FillFlowContainer leftIconArea = null!; - GridContainer titleContainer = null!; + FillFlowContainer titleBadgeArea = null!; GridContainer artistContainer = null!; Child = content.With(c => @@ -93,7 +93,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards Direction = FillDirection.Vertical, Children = new Drawable[] { - titleContainer = new GridContainer + new GridContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -108,7 +108,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards }, Content = new[] { - new[] + new Drawable[] { new OsuSpriteText { @@ -117,7 +117,13 @@ namespace osu.Game.Beatmaps.Drawables.Cards RelativeSizeAxes = Axes.X, Truncate = true }, - Empty() + titleBadgeArea = new FillFlowContainer + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + } } } }, @@ -244,14 +250,24 @@ namespace osu.Game.Beatmaps.Drawables.Cards if (BeatmapSet.HasStoryboard) leftIconArea.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) }); - if (BeatmapSet.HasExplicitContent) + if (BeatmapSet.FeaturedInSpotlight) { - titleContainer.Content[0][1] = new ExplicitContentBeatmapPill + titleBadgeArea.Add(new SpotlightBeatmapPill { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Margin = new MarginPadding { Left = 5 } - }; + }); + } + + if (BeatmapSet.HasExplicitContent) + { + titleBadgeArea.Add(new ExplicitContentBeatmapPill + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Margin = new MarginPadding { Left = 5 } + }); } if (BeatmapSet.TrackId != null) diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs index 08befd5340..fc91c91e3c 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs @@ -55,7 +55,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards Height = height; FillFlowContainer leftIconArea = null!; - GridContainer titleContainer = null!; + FillFlowContainer titleBadgeArea = null!; GridContainer artistContainer = null!; Child = content.With(c => @@ -94,14 +94,14 @@ namespace osu.Game.Beatmaps.Drawables.Cards Direction = FillDirection.Vertical, Children = new Drawable[] { - titleContainer = new GridContainer + new GridContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, ColumnDimensions = new[] { new Dimension(), - new Dimension(GridSizeMode.AutoSize) + new Dimension(GridSizeMode.AutoSize), }, RowDimensions = new[] { @@ -109,7 +109,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards }, Content = new[] { - new[] + new Drawable[] { new OsuSpriteText { @@ -118,7 +118,13 @@ namespace osu.Game.Beatmaps.Drawables.Cards RelativeSizeAxes = Axes.X, Truncate = true }, - Empty() + titleBadgeArea = new FillFlowContainer + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + } } } }, @@ -225,14 +231,24 @@ namespace osu.Game.Beatmaps.Drawables.Cards if (BeatmapSet.HasStoryboard) leftIconArea.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) }); - if (BeatmapSet.HasExplicitContent) + if (BeatmapSet.FeaturedInSpotlight) { - titleContainer.Content[0][1] = new ExplicitContentBeatmapPill + titleBadgeArea.Add(new SpotlightBeatmapPill { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Margin = new MarginPadding { Left = 5 } - }; + }); + } + + if (BeatmapSet.HasExplicitContent) + { + titleBadgeArea.Add(new ExplicitContentBeatmapPill + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Margin = new MarginPadding { Left = 5 } + }); } if (BeatmapSet.TrackId != null) From a759cf2dabd9a5cc4fd4fad57789007845d3699c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 15 May 2022 02:39:54 +0900 Subject: [PATCH 1013/2328] Add key binding to deselect all mods Defaults to `Backspace`. --- .../UserInterface/TestSceneModSelectOverlay.cs | 18 +++++++++++++++++- .../Input/Bindings/GlobalActionContainer.cs | 4 ++++ .../GlobalActionKeyBindingStrings.cs | 5 +++++ osu.Game/Overlays/Mods/ModSelectOverlay.cs | 4 ++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs index 0b037a10cd..e946524a4b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.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 System; @@ -416,6 +416,22 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("unimplemented mod panel is filtered", () => getPanelForMod(typeof(TestUnimplementedMod)).Filtered.Value); } + [Test] + public void TestDeselectAllViaKey() + { + createScreen(); + changeRuleset(0); + + AddStep("select DT + HD", () => SelectedMods.Value = new Mod[] { new OsuModDoubleTime(), new OsuModHidden() }); + AddAssert("DT + HD selected", () => modSelectOverlay.ChildrenOfType().Count(panel => panel.Active.Value) == 2); + + AddStep("press bakcspace", () => + { + InputManager.Key(Key.BackSpace); + }); + AddUntilStep("all mods deselected", () => !SelectedMods.Value.Any()); + } + [Test] public void TestDeselectAllViaButton() { diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index 13a3f006fb..69ea6b00ca 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -109,6 +109,7 @@ namespace osu.Game.Input.Bindings new KeyBinding(InputKey.F2, GlobalAction.SelectNextRandom), new KeyBinding(new[] { InputKey.Shift, InputKey.F2 }, GlobalAction.SelectPreviousRandom), new KeyBinding(InputKey.F3, GlobalAction.ToggleBeatmapOptions), + new KeyBinding(InputKey.BackSpace, GlobalAction.DeselectAllMods), }; public IEnumerable AudioControlKeyBindings => new[] @@ -318,5 +319,8 @@ namespace osu.Game.Input.Bindings [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.SelectNextGroup))] SelectNextGroup, + + [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.DeselectAllMods))] + DeselectAllMods, } } diff --git a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs index b2f25de7f2..399e286478 100644 --- a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs +++ b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs @@ -209,6 +209,11 @@ namespace osu.Game.Localisation ///
public static LocalisableString ToggleModSelection => new TranslatableString(getKey(@"toggle_mod_selection"), @"Toggle Mod Select"); + /// + /// "Deselect all mods" + /// + public static LocalisableString DeselectAllMods => new TranslatableString(getKey(@"deselect_all_mods"), @"Deselect all mods"); + /// /// "Random" /// diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index d068839ab0..fb988b5bfe 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -508,6 +508,10 @@ namespace osu.Game.Overlays.Mods hideOverlay(true); return true; } + + case GlobalAction.DeselectAllMods: + DeselectAll(); + return true; } return base.OnPressed(e); From 6c3a4375c529ff4940c37fa376b17b1eff1a2a99 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 15 May 2022 02:40:35 +0900 Subject: [PATCH 1014/2328] Fix case of "toggle mod select" string --- osu.Game/Localisation/GlobalActionKeyBindingStrings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs index 399e286478..e392ae619f 100644 --- a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs +++ b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs @@ -207,7 +207,7 @@ namespace osu.Game.Localisation /// /// "Toggle Mod Select" /// - public static LocalisableString ToggleModSelection => new TranslatableString(getKey(@"toggle_mod_selection"), @"Toggle Mod Select"); + public static LocalisableString ToggleModSelection => new TranslatableString(getKey(@"toggle_mod_selection"), @"Toggle mod select"); /// /// "Deselect all mods" From 88ba84ac9cc99c3a60632ca31aed38083a48dc7a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 14 May 2022 20:52:38 +0300 Subject: [PATCH 1015/2328] Replace `Pill` with `Badge` everywhere --- .../Drawables/Cards/BeatmapCardExtra.cs | 6 +++--- .../Drawables/Cards/BeatmapCardNormal.cs | 6 +++--- .../{BeatmapBadgePill.cs => BeatmapBadge.cs} | 4 ++-- .../BeatmapSet/BeatmapSetHeaderContent.cs | 18 +++++++++--------- ...pPill.cs => ExplicitContentBeatmapBadge.cs} | 2 +- ...apPill.cs => FeaturedArtistBeatmapBadge.cs} | 2 +- ...BeatmapPill.cs => SpotlightBeatmapBadge.cs} | 2 +- .../OnlinePlay/DrawableRoomPlaylistItem.cs | 6 +++--- 8 files changed, 23 insertions(+), 23 deletions(-) rename osu.Game/Overlays/BeatmapSet/{BeatmapBadgePill.cs => BeatmapBadge.cs} (95%) rename osu.Game/Overlays/BeatmapSet/{ExplicitContentBeatmapPill.cs => ExplicitContentBeatmapBadge.cs} (88%) rename osu.Game/Overlays/BeatmapSet/{FeaturedArtistBeatmapPill.cs => FeaturedArtistBeatmapBadge.cs} (88%) rename osu.Game/Overlays/BeatmapSet/{SpotlightBeatmapPill.cs => SpotlightBeatmapBadge.cs} (89%) diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs index 32da23b27d..58c1ebee0f 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs @@ -252,7 +252,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards if (BeatmapSet.FeaturedInSpotlight) { - titleBadgeArea.Add(new SpotlightBeatmapPill + titleBadgeArea.Add(new SpotlightBeatmapBadge { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, @@ -262,7 +262,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards if (BeatmapSet.HasExplicitContent) { - titleBadgeArea.Add(new ExplicitContentBeatmapPill + titleBadgeArea.Add(new ExplicitContentBeatmapBadge { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, @@ -272,7 +272,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards if (BeatmapSet.TrackId != null) { - artistContainer.Content[0][1] = new FeaturedArtistBeatmapPill + artistContainer.Content[0][1] = new FeaturedArtistBeatmapBadge { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs index fc91c91e3c..3d7e81de21 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs @@ -233,7 +233,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards if (BeatmapSet.FeaturedInSpotlight) { - titleBadgeArea.Add(new SpotlightBeatmapPill + titleBadgeArea.Add(new SpotlightBeatmapBadge { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, @@ -243,7 +243,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards if (BeatmapSet.HasExplicitContent) { - titleBadgeArea.Add(new ExplicitContentBeatmapPill + titleBadgeArea.Add(new ExplicitContentBeatmapBadge { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, @@ -253,7 +253,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards if (BeatmapSet.TrackId != null) { - artistContainer.Content[0][1] = new FeaturedArtistBeatmapPill + artistContainer.Content[0][1] = new FeaturedArtistBeatmapBadge { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapBadgePill.cs b/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs similarity index 95% rename from osu.Game/Overlays/BeatmapSet/BeatmapBadgePill.cs rename to osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs index 2c5042942c..6a444cc85f 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapBadgePill.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs @@ -14,7 +14,7 @@ using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.BeatmapSet { - public abstract class BeatmapBadgePill : CompositeDrawable + public abstract class BeatmapBadge : CompositeDrawable { [Resolved] protected OsuColour Colours { get; private set; } = null!; @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.BeatmapSet // todo: add linking support, to allow redirecting featured artist badge to corresponding track and spotlight badge to wiki page. - protected BeatmapBadgePill() + protected BeatmapBadge() { AutoSizeAxes = Axes.Both; } diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs index 4233cfcb70..56efb725cd 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs @@ -40,9 +40,9 @@ namespace osu.Game.Overlays.BeatmapSet private readonly OsuSpriteText title, artist; private readonly AuthorInfo author; - private readonly ExplicitContentBeatmapPill explicitContentPill; - private readonly SpotlightBeatmapPill spotlightPill; - private readonly FeaturedArtistBeatmapPill featuredArtistPill; + private readonly ExplicitContentBeatmapBadge explicitContent; + private readonly SpotlightBeatmapBadge spotlight; + private readonly FeaturedArtistBeatmapBadge featuredArtist; private readonly FillFlowContainer downloadButtonsContainer; private readonly BeatmapAvailability beatmapAvailability; @@ -129,14 +129,14 @@ namespace osu.Game.Overlays.BeatmapSet Origin = Anchor.BottomLeft, Margin = new MarginPadding { Left = 5, Bottom = 4 }, // To better lineup with the font }, - explicitContentPill = new ExplicitContentBeatmapPill + explicitContent = new ExplicitContentBeatmapBadge { Alpha = 0f, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Margin = new MarginPadding { Left = 10, Bottom = 4 }, }, - spotlightPill = new SpotlightBeatmapPill + spotlight = new SpotlightBeatmapBadge { Alpha = 0f, Anchor = Anchor.BottomLeft, @@ -156,7 +156,7 @@ namespace osu.Game.Overlays.BeatmapSet { Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium, italics: true), }, - featuredArtistPill = new FeaturedArtistBeatmapPill + featuredArtist = new FeaturedArtistBeatmapBadge { Alpha = 0f, Anchor = Anchor.BottomLeft, @@ -267,9 +267,9 @@ namespace osu.Game.Overlays.BeatmapSet title.Text = new RomanisableString(setInfo.NewValue.TitleUnicode, setInfo.NewValue.Title); artist.Text = new RomanisableString(setInfo.NewValue.ArtistUnicode, setInfo.NewValue.Artist); - explicitContentPill.Alpha = setInfo.NewValue.HasExplicitContent ? 1 : 0; - spotlightPill.Alpha = setInfo.NewValue.FeaturedInSpotlight ? 1 : 0; - featuredArtistPill.Alpha = setInfo.NewValue.TrackId != null ? 1 : 0; + explicitContent.Alpha = setInfo.NewValue.HasExplicitContent ? 1 : 0; + spotlight.Alpha = setInfo.NewValue.FeaturedInSpotlight ? 1 : 0; + featuredArtist.Alpha = setInfo.NewValue.TrackId != null ? 1 : 0; onlineStatusPill.FadeIn(500, Easing.OutQuint); onlineStatusPill.Status = setInfo.NewValue.Status; diff --git a/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapPill.cs b/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapBadge.cs similarity index 88% rename from osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapPill.cs rename to osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapBadge.cs index f8530f3a16..b78b203a21 100644 --- a/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapPill.cs +++ b/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapBadge.cs @@ -9,7 +9,7 @@ using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.BeatmapSet { - public class ExplicitContentBeatmapPill : BeatmapBadgePill + public class ExplicitContentBeatmapBadge : BeatmapBadge { public override LocalisableString BadgeText => BeatmapsetsStrings.NsfwBadgeLabel; public override Colour4 BadgeColour => Colours.Orange2; diff --git a/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapPill.cs b/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs similarity index 88% rename from osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapPill.cs rename to osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs index 4c29ede12e..b471911217 100644 --- a/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapPill.cs +++ b/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs @@ -9,7 +9,7 @@ using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.BeatmapSet { - public class FeaturedArtistBeatmapPill : BeatmapBadgePill + public class FeaturedArtistBeatmapBadge : BeatmapBadge { public override LocalisableString BadgeText => BeatmapsetsStrings.FeaturedArtistBadgeLabel; public override Colour4 BadgeColour => Colours.Blue1; diff --git a/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapPill.cs b/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs similarity index 89% rename from osu.Game/Overlays/BeatmapSet/SpotlightBeatmapPill.cs rename to osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs index 7376889d7b..caa2043474 100644 --- a/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapPill.cs +++ b/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs @@ -9,7 +9,7 @@ using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.BeatmapSet { - public class SpotlightBeatmapPill : BeatmapBadgePill + public class SpotlightBeatmapBadge : BeatmapBadge { public override LocalisableString BadgeText => BeatmapsetsStrings.SpotlightBadgeLabel; public override Colour4 BadgeColour => Colours.Pink1; diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs index 2618e15d31..39853a5c45 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs @@ -78,7 +78,7 @@ namespace osu.Game.Screens.OnlinePlay private Container difficultyIconContainer; private LinkFlowContainer beatmapText; private LinkFlowContainer authorText; - private ExplicitContentBeatmapPill explicitContentPill; + private ExplicitContentBeatmapBadge explicitContent; private ModDisplay modDisplay; private FillFlowContainer buttonsFlow; private UpdateableAvatar ownerAvatar; @@ -293,7 +293,7 @@ namespace osu.Game.Screens.OnlinePlay } bool hasExplicitContent = (beatmap?.BeatmapSet as IBeatmapSetOnlineInfo)?.HasExplicitContent == true; - explicitContentPill.Alpha = hasExplicitContent ? 1 : 0; + explicitContent.Alpha = hasExplicitContent ? 1 : 0; modDisplay.Current.Value = requiredMods.ToArray(); @@ -380,7 +380,7 @@ namespace osu.Game.Screens.OnlinePlay Children = new Drawable[] { authorText = new LinkFlowContainer(fontParameters) { AutoSizeAxes = Axes.Both }, - explicitContentPill = new ExplicitContentBeatmapPill + explicitContent = new ExplicitContentBeatmapBadge { Alpha = 0f, Anchor = Anchor.CentreLeft, From 441957e18ee58e4c256002d593b583439921b6cc Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 14 May 2022 21:01:29 +0300 Subject: [PATCH 1016/2328] Convert get-only virtual properties to avoid DI order dependency --- osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs | 26 +++++++++---------- .../BeatmapSet/ExplicitContentBeatmapBadge.cs | 12 ++++++--- .../BeatmapSet/FeaturedArtistBeatmapBadge.cs | 12 ++++++--- .../BeatmapSet/SpotlightBeatmapBadge.cs | 12 ++++++--- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs b/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs index 6a444cc85f..2604a58a2b 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs @@ -16,21 +16,23 @@ namespace osu.Game.Overlays.BeatmapSet { public abstract class BeatmapBadge : CompositeDrawable { - [Resolved] - protected OsuColour Colours { get; private set; } = null!; - - [Resolved(canBeNull: true)] - protected OverlayColourProvider? ColourProvider { get; private set; } - /// /// The text displayed on the badge's label. /// - public abstract LocalisableString BadgeText { get; } + public LocalisableString BadgeText + { + set => badgeLabel.Text = value.ToUpper(); + } /// /// The colour of the badge's label. /// - public abstract Colour4 BadgeColour { get; } + public Colour4 BadgeColour + { + set => badgeLabel.Colour = value; + } + + private OsuSpriteText badgeLabel = null!; // todo: add linking support, to allow redirecting featured artist badge to corresponding track and spotlight badge to wiki page. @@ -40,7 +42,7 @@ namespace osu.Game.Overlays.BeatmapSet } [BackgroundDependencyLoader(true)] - private void load() + private void load(OsuColour colours, OverlayColourProvider? colourProvider) { InternalChild = new CircularContainer { @@ -51,14 +53,12 @@ namespace osu.Game.Overlays.BeatmapSet new Box { RelativeSizeAxes = Axes.Both, - Colour = ColourProvider?.Background5 ?? Colours.Gray2, + Colour = colourProvider?.Background5 ?? colours.Gray2, }, - new OsuSpriteText + badgeLabel = new OsuSpriteText { Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold), Margin = new MarginPadding { Horizontal = 10, Vertical = 2 }, - Text = BadgeText.ToUpper(), - Colour = BadgeColour, } } }; diff --git a/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapBadge.cs b/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapBadge.cs index b78b203a21..2a20d22b61 100644 --- a/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapBadge.cs +++ b/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapBadge.cs @@ -1,8 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Graphics; -using osu.Framework.Localisation; +using osu.Framework.Allocation; +using osu.Game.Graphics; using osu.Game.Resources.Localisation.Web; #nullable enable @@ -11,7 +11,11 @@ namespace osu.Game.Overlays.BeatmapSet { public class ExplicitContentBeatmapBadge : BeatmapBadge { - public override LocalisableString BadgeText => BeatmapsetsStrings.NsfwBadgeLabel; - public override Colour4 BadgeColour => Colours.Orange2; + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + BadgeText = BeatmapsetsStrings.NsfwBadgeLabel; + BadgeColour = colours.Orange2; + } } } diff --git a/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs b/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs index b471911217..230b8b5243 100644 --- a/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs +++ b/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs @@ -1,8 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Graphics; -using osu.Framework.Localisation; +using osu.Framework.Allocation; +using osu.Game.Graphics; using osu.Game.Resources.Localisation.Web; #nullable enable @@ -11,7 +11,11 @@ namespace osu.Game.Overlays.BeatmapSet { public class FeaturedArtistBeatmapBadge : BeatmapBadge { - public override LocalisableString BadgeText => BeatmapsetsStrings.FeaturedArtistBadgeLabel; - public override Colour4 BadgeColour => Colours.Blue1; + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + BadgeText = BeatmapsetsStrings.FeaturedArtistBadgeLabel; + BadgeColour = colours.Blue1; + } } } diff --git a/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs b/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs index caa2043474..8bfd623b2e 100644 --- a/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs +++ b/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs @@ -1,8 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Graphics; -using osu.Framework.Localisation; +using osu.Framework.Allocation; +using osu.Game.Graphics; using osu.Game.Resources.Localisation.Web; #nullable enable @@ -11,7 +11,11 @@ namespace osu.Game.Overlays.BeatmapSet { public class SpotlightBeatmapBadge : BeatmapBadge { - public override LocalisableString BadgeText => BeatmapsetsStrings.SpotlightBadgeLabel; - public override Colour4 BadgeColour => Colours.Pink1; + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + BadgeText = BeatmapsetsStrings.SpotlightBadgeLabel; + BadgeColour = colours.Pink1; + } } } From 1878578196e157bfb755318d39db742f5e5b74b0 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 14 May 2022 21:02:56 +0300 Subject: [PATCH 1017/2328] Move todo comment to subclasses --- osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs | 2 -- osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs | 1 + osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs b/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs index 2604a58a2b..d19aff3a69 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs @@ -34,8 +34,6 @@ namespace osu.Game.Overlays.BeatmapSet private OsuSpriteText badgeLabel = null!; - // todo: add linking support, to allow redirecting featured artist badge to corresponding track and spotlight badge to wiki page. - protected BeatmapBadge() { AutoSizeAxes = Axes.Both; diff --git a/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs b/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs index 230b8b5243..4f336d85fc 100644 --- a/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs +++ b/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs @@ -16,6 +16,7 @@ namespace osu.Game.Overlays.BeatmapSet { BadgeText = BeatmapsetsStrings.FeaturedArtistBadgeLabel; BadgeColour = colours.Blue1; + // todo: add linking support to allow redirecting featured artist badge to corresponding track. } } } diff --git a/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs b/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs index 8bfd623b2e..3204f79b21 100644 --- a/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs +++ b/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs @@ -16,6 +16,7 @@ namespace osu.Game.Overlays.BeatmapSet { BadgeText = BeatmapsetsStrings.SpotlightBadgeLabel; BadgeColour = colours.Pink1; + // todo: add linking support to allow redirecting spotlight badge to https://osu.ppy.sh/wiki/en/Beatmap_Spotlights. } } } From 282c8aec867ad5adb889bd4b7f7bb488051b8098 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 15 May 2022 03:09:15 +0900 Subject: [PATCH 1018/2328] Fix typo in test step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- .../Visual/UserInterface/TestSceneModSelectOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs index e946524a4b..2cc9a451a8 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs @@ -425,7 +425,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("select DT + HD", () => SelectedMods.Value = new Mod[] { new OsuModDoubleTime(), new OsuModHidden() }); AddAssert("DT + HD selected", () => modSelectOverlay.ChildrenOfType().Count(panel => panel.Active.Value) == 2); - AddStep("press bakcspace", () => + AddStep("press backspace", () => { InputManager.Key(Key.BackSpace); }); From 8a01050168038c41c6f8fc33d77848b91b85ccbb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 15 May 2022 03:16:33 +0900 Subject: [PATCH 1019/2328] Refactor mod select button initialisation to allow shared usage of deselect button --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 43 +++++++++++-------- .../OnlinePlay/FreeModSelectOverlay.cs | 16 +++---- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index fb988b5bfe..1dad185b78 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -56,11 +56,32 @@ namespace osu.Game.Overlays.Mods /// protected virtual bool ShowTotalMultiplier => true; + /// + /// Whether per-mod customisation controls are visible. + /// + protected virtual bool AllowCustomisation => true; + protected virtual ModColumn CreateModColumn(ModType modType, Key[]? toggleKeys = null) => new ModColumn(modType, false, toggleKeys); protected virtual IReadOnlyList ComputeNewModsFromSelection(IReadOnlyList oldSelection, IReadOnlyList newSelection) => newSelection; - protected virtual IEnumerable CreateFooterButtons() => createDefaultFooterButtons(); + protected virtual IEnumerable CreateFooterButtons() + { + if (AllowCustomisation) + { + yield return customisationButton = new ShearedToggleButton(BUTTON_WIDTH) + { + Text = ModSelectOverlayStrings.ModCustomisation, + Active = { BindTarget = customisationVisible } + }; + } + + yield return deselectAllButton = new ShearedButton(BUTTON_WIDTH) + { + Text = CommonStrings.DeselectAll, + Action = DeselectAll + }; + } private readonly Bindable>> availableMods = new Bindable>>(); private readonly Dictionary> localAvailableMods = new Dictionary>(); @@ -77,6 +98,7 @@ namespace osu.Game.Overlays.Mods private DifficultyMultiplierDisplay? multiplierDisplay; private ShearedToggleButton? customisationButton; + private ShearedButton? deselectAllButton; protected ModSelectOverlay(OverlayColourScheme colourScheme = OverlayColourScheme.Green) : base(colourScheme) @@ -201,7 +223,7 @@ namespace osu.Game.Overlays.Mods // This is an optimisation to prevent refreshing the available settings controls when it can be // reasonably assumed that the settings panel is never to be displayed (e.g. FreeModSelectOverlay). - if (customisationButton != null) + if (AllowCustomisation) ((IBindable>)modSettingsArea.SelectedMods).BindTo(SelectedMods); SelectedMods.BindValueChanged(val => @@ -256,21 +278,6 @@ namespace osu.Game.Overlays.Mods }; } - private ShearedButton[] createDefaultFooterButtons() - => new[] - { - customisationButton = new ShearedToggleButton(BUTTON_WIDTH) - { - Text = ModSelectOverlayStrings.ModCustomisation, - Active = { BindTarget = customisationVisible } - }, - new ShearedButton(BUTTON_WIDTH) - { - Text = CommonStrings.DeselectAll, - Action = DeselectAll - } - }; - private void createLocalMods() { localAvailableMods.Clear(); @@ -510,7 +517,7 @@ namespace osu.Game.Overlays.Mods } case GlobalAction.DeselectAllMods: - DeselectAll(); + deselectAllButton?.TriggerClick(); return true; } diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs index 6e1c9b7a59..790333ea5b 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs @@ -4,6 +4,7 @@ using System; using osu.Game.Overlays; using System.Collections.Generic; +using System.Linq; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; @@ -17,6 +18,8 @@ namespace osu.Game.Screens.OnlinePlay { protected override bool ShowTotalMultiplier => false; + protected override bool AllowCustomisation => false; + public new Func IsValidMod { get => base.IsValidMod; @@ -31,22 +34,13 @@ namespace osu.Game.Screens.OnlinePlay protected override ModColumn CreateModColumn(ModType modType, Key[] toggleKeys = null) => new ModColumn(modType, true, toggleKeys); - protected override IEnumerable CreateFooterButtons() => new[] - { + protected override IEnumerable CreateFooterButtons() => base.CreateFooterButtons().Prepend( new ShearedButton(BUTTON_WIDTH) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Text = CommonStrings.SelectAll, Action = SelectAll - }, - new ShearedButton(BUTTON_WIDTH) - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Text = CommonStrings.DeselectAll, - Action = DeselectAll - } - }; + }); } } From b6575c216b8945bceee462216d87b4ac79d7e0a4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 15 May 2022 03:18:44 +0900 Subject: [PATCH 1020/2328] Allow selecting all mods at free mod select using `ctrl`+`a` --- .../TestSceneFreeModSelectOverlay.cs | 13 +++++++++ .../TestSceneModSelectOverlay.cs | 5 +--- .../OnlinePlay/FreeModSelectOverlay.cs | 28 +++++++++++++++++-- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs index f40c31b07f..c37bff2066 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs @@ -7,6 +7,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; +using osu.Framework.Input; using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; @@ -55,6 +56,18 @@ namespace osu.Game.Tests.Visual.Multiplayer AddAssert("customisation area not expanded", () => this.ChildrenOfType().Single().Height == 0); } + [Test] + public void TestSelectDeselectAllViaKeyboard() + { + createFreeModSelect(); + + AddStep("press ctrl+a", () => InputManager.Keys(PlatformAction.SelectAll)); + AddUntilStep("all mods selected", assertAllAvailableModsSelected); + + AddStep("press backspace", () => InputManager.Key(Key.BackSpace)); + AddUntilStep("all mods deselected", () => !freeModSelectOverlay.SelectedMods.Value.Any()); + } + [Test] public void TestSelectDeselectAll() { diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs index 2cc9a451a8..75e30f76c3 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs @@ -425,10 +425,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("select DT + HD", () => SelectedMods.Value = new Mod[] { new OsuModDoubleTime(), new OsuModHidden() }); AddAssert("DT + HD selected", () => modSelectOverlay.ChildrenOfType().Count(panel => panel.Active.Value) == 2); - AddStep("press backspace", () => - { - InputManager.Key(Key.BackSpace); - }); + AddStep("press backspace", () => InputManager.Key(Key.BackSpace)); AddUntilStep("all mods deselected", () => !SelectedMods.Value.Any()); } diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs index 790333ea5b..f494f9799a 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs @@ -6,6 +6,9 @@ using osu.Game.Overlays; using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; +using osu.Framework.Input; +using osu.Framework.Input.Bindings; +using osu.Framework.Input.Events; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; using osu.Game.Rulesets.Mods; @@ -14,7 +17,7 @@ using osu.Game.Localisation; namespace osu.Game.Screens.OnlinePlay { - public class FreeModSelectOverlay : ModSelectOverlay + public class FreeModSelectOverlay : ModSelectOverlay, IKeyBindingHandler { protected override bool ShowTotalMultiplier => false; @@ -26,6 +29,8 @@ namespace osu.Game.Screens.OnlinePlay set => base.IsValidMod = m => m.UserPlayable && value.Invoke(m); } + private ShearedButton selectAllButton; + public FreeModSelectOverlay() : base(OverlayColourScheme.Plum) { @@ -35,12 +40,31 @@ namespace osu.Game.Screens.OnlinePlay protected override ModColumn CreateModColumn(ModType modType, Key[] toggleKeys = null) => new ModColumn(modType, true, toggleKeys); protected override IEnumerable CreateFooterButtons() => base.CreateFooterButtons().Prepend( - new ShearedButton(BUTTON_WIDTH) + selectAllButton = new ShearedButton(BUTTON_WIDTH) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Text = CommonStrings.SelectAll, Action = SelectAll }); + + public bool OnPressed(KeyBindingPressEvent e) + { + if (e.Repeat) + return false; + + switch (e.Action) + { + case PlatformAction.SelectAll: + selectAllButton.TriggerClick(); + return true; + } + + return false; + } + + public void OnReleased(KeyBindingReleaseEvent e) + { + } } } From 4bb06873d53d4459268e13305788cb9996d373ec Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 14 May 2022 21:54:52 +0300 Subject: [PATCH 1021/2328] Move badge hierarchy declaration to constructor for safer access --- osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs b/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs index d19aff3a69..a75fc8e888 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs @@ -32,26 +32,22 @@ namespace osu.Game.Overlays.BeatmapSet set => badgeLabel.Colour = value; } - private OsuSpriteText badgeLabel = null!; + private readonly Box background; + private readonly OsuSpriteText badgeLabel; protected BeatmapBadge() { AutoSizeAxes = Axes.Both; - } - [BackgroundDependencyLoader(true)] - private void load(OsuColour colours, OverlayColourProvider? colourProvider) - { InternalChild = new CircularContainer { Masking = true, AutoSizeAxes = Axes.Both, Children = new Drawable[] { - new Box + background = new Box { RelativeSizeAxes = Axes.Both, - Colour = colourProvider?.Background5 ?? colours.Gray2, }, badgeLabel = new OsuSpriteText { @@ -61,5 +57,11 @@ namespace osu.Game.Overlays.BeatmapSet } }; } + + [BackgroundDependencyLoader(true)] + private void load(OsuColour colours, OverlayColourProvider? colourProvider) + { + background.Colour = colourProvider?.Background5 ?? colours.Gray2; + } } } From 92ae652555a0ca85941d87d1de040d7427cedf5f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 14 May 2022 22:07:42 +0300 Subject: [PATCH 1022/2328] Enable indirect input events on iOS for proper mouse support --- osu.Game.Rulesets.Catch.Tests.iOS/Info.plist | 2 ++ osu.Game.Rulesets.Mania.Tests.iOS/Info.plist | 2 ++ osu.Game.Rulesets.Osu.Tests.iOS/Info.plist | 2 ++ osu.Game.Rulesets.Taiko.Tests.iOS/Info.plist | 2 ++ osu.Game.Tests.iOS/Info.plist | 2 ++ osu.iOS/Info.plist | 2 ++ 6 files changed, 12 insertions(+) diff --git a/osu.Game.Rulesets.Catch.Tests.iOS/Info.plist b/osu.Game.Rulesets.Catch.Tests.iOS/Info.plist index 33ddac6dfb..16a2b99997 100644 --- a/osu.Game.Rulesets.Catch.Tests.iOS/Info.plist +++ b/osu.Game.Rulesets.Catch.Tests.iOS/Info.plist @@ -37,6 +37,8 @@ XSAppIconAssets Assets.xcassets/AppIcon.appiconset + UIApplicationSupportsIndirectInputEvents + CADisableMinimumFrameDurationOnPhone diff --git a/osu.Game.Rulesets.Mania.Tests.iOS/Info.plist b/osu.Game.Rulesets.Mania.Tests.iOS/Info.plist index 78349334b4..82d1c8ea24 100644 --- a/osu.Game.Rulesets.Mania.Tests.iOS/Info.plist +++ b/osu.Game.Rulesets.Mania.Tests.iOS/Info.plist @@ -37,6 +37,8 @@ XSAppIconAssets Assets.xcassets/AppIcon.appiconset + UIApplicationSupportsIndirectInputEvents + CADisableMinimumFrameDurationOnPhone diff --git a/osu.Game.Rulesets.Osu.Tests.iOS/Info.plist b/osu.Game.Rulesets.Osu.Tests.iOS/Info.plist index b9f371c049..a88b74695c 100644 --- a/osu.Game.Rulesets.Osu.Tests.iOS/Info.plist +++ b/osu.Game.Rulesets.Osu.Tests.iOS/Info.plist @@ -37,6 +37,8 @@ XSAppIconAssets Assets.xcassets/AppIcon.appiconset + UIApplicationSupportsIndirectInputEvents + CADisableMinimumFrameDurationOnPhone diff --git a/osu.Game.Rulesets.Taiko.Tests.iOS/Info.plist b/osu.Game.Rulesets.Taiko.Tests.iOS/Info.plist index 65c47d2115..9628475b3e 100644 --- a/osu.Game.Rulesets.Taiko.Tests.iOS/Info.plist +++ b/osu.Game.Rulesets.Taiko.Tests.iOS/Info.plist @@ -37,6 +37,8 @@ XSAppIconAssets Assets.xcassets/AppIcon.appiconset + UIApplicationSupportsIndirectInputEvents + CADisableMinimumFrameDurationOnPhone diff --git a/osu.Game.Tests.iOS/Info.plist b/osu.Game.Tests.iOS/Info.plist index ed0c2e4dbf..31e2b3f257 100644 --- a/osu.Game.Tests.iOS/Info.plist +++ b/osu.Game.Tests.iOS/Info.plist @@ -37,6 +37,8 @@ XSAppIconAssets Assets.xcassets/AppIcon.appiconset + UIApplicationSupportsIndirectInputEvents + CADisableMinimumFrameDurationOnPhone diff --git a/osu.iOS/Info.plist b/osu.iOS/Info.plist index 02968b87a7..16cb68fa7d 100644 --- a/osu.iOS/Info.plist +++ b/osu.iOS/Info.plist @@ -33,6 +33,8 @@ UIStatusBarHidden + UIApplicationSupportsIndirectInputEvents + CADisableMinimumFrameDurationOnPhone NSCameraUsageDescription From 170df01b4615b2aa73d6ec67c61b4e7b1101654b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 15 May 2022 20:10:53 +0200 Subject: [PATCH 1023/2328] Adjust difficulty multiplier scale transition on mod overlay The previous transition was supposed to be a center-anchored elastic scale-in, but this didn't work as intended - because the multiplier ended up inside of an auto-sized right-aligned container, the animation itself would end up being anchored right. Attempts to remove the scale transition resulted in a rather jarring-looking result, so swap out the elastic scale-in for a sweep-in effect from the top, to match the header and avoid introducing too many directions of movement. Delay values tweaked "to taste" - can be adjusted further if there is an alternative set of values that feels better. --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 1dad185b78..8d72855217 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -428,9 +428,9 @@ namespace osu.Game.Overlays.Mods base.PopIn(); multiplierDisplay? - .Delay(fade_in_duration * 0.65f) - .FadeIn(fade_in_duration / 2, Easing.OutQuint) - .ScaleTo(1, fade_in_duration, Easing.OutElastic); + .Delay(fade_in_duration / 5) + .FadeIn(fade_in_duration, Easing.OutQuint) + .MoveToY(0, fade_in_duration, Easing.OutQuint); int nonFilteredColumnCount = 0; @@ -465,7 +465,7 @@ namespace osu.Game.Overlays.Mods multiplierDisplay? .FadeOut(fade_out_duration / 2, Easing.OutQuint) - .ScaleTo(0.75f, fade_out_duration, Easing.OutQuint); + .MoveToY(-distance, fade_out_duration / 2, Easing.OutQuint); int nonFilteredColumnCount = 0; From ae5b6c3e1068a130396c3a2f8fab554c362603c5 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sun, 15 May 2022 19:38:37 +0100 Subject: [PATCH 1024/2328] Use dummy channel to show selector and remove `ChannelListSelector` Add dummy channel `DummySelectorChannel` which should be set as the current channel in the channel manager when the selector in the chat overlay should be shown. Refactors the `ChannelListItem` to not show mention pill and close button when the channel is the dummy selector channel. Ensure that the `ChannelList` selects the dummy channel on clicking the selector item. Removes `ChannelListSelector` as it is no longer needed. Removes the `setCurrent` parameter from `ChannelManager.JoinChannel` method as it is no longer needed. --- .../Visual/Online/TestSceneChannelList.cs | 12 +- .../Visual/Online/TestSceneChatOverlayV2.cs | 5 +- osu.Game/Online/Chat/ChannelManager.cs | 18 +-- .../Overlays/Chat/ChannelList/ChannelList.cs | 10 +- .../Chat/ChannelList/ChannelListItem.cs | 60 +++++++--- .../Chat/ChannelList/ChannelListSelector.cs | 103 ------------------ osu.Game/Overlays/ChatOverlayV2.cs | 13 ++- 7 files changed, 80 insertions(+), 141 deletions(-) delete mode 100644 osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs index 9929642539..53a48fcc58 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs @@ -118,35 +118,37 @@ namespace osu.Game.Tests.Visual.Online { AddStep("Unread Selected", () => { - if (selected.Value != null) + if (validItem) channelList.GetItem(selected.Value).Unread.Value = true; }); AddStep("Read Selected", () => { - if (selected.Value != null) + if (validItem) channelList.GetItem(selected.Value).Unread.Value = false; }); AddStep("Add Mention Selected", () => { - if (selected.Value != null) + if (validItem) channelList.GetItem(selected.Value).Mentions.Value++; }); AddStep("Add 98 Mentions Selected", () => { - if (selected.Value != null) + if (validItem) channelList.GetItem(selected.Value).Mentions.Value += 98; }); AddStep("Clear Mentions Selected", () => { - if (selected.Value != null) + if (validItem) channelList.GetItem(selected.Value).Mentions.Value = 0; }); } + private bool validItem => selected.Value != null && !(selected.Value is DummySelectorChannel); + private Channel createRandomPublicChannel() { int id = RNG.Next(0, 10000); diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index bf1767cc96..48557a4ddb 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -372,7 +372,7 @@ namespace osu.Game.Tests.Visual.Online AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); - AddStep("Click selector", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); + AddStep("Click selector", () => clickDrawable(channelSelectorButton)); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); AddStep("Click listing", () => clickDrawable(chatOverlay.ChildrenOfType().Single())); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); @@ -407,6 +407,9 @@ namespace osu.Game.Tests.Visual.Online private ChatOverlayTopBar chatOverlayTopBar => chatOverlay.ChildrenOfType().Single(); + private ChannelListItem channelSelectorButton => + chatOverlay.ChildrenOfType().Single(item => item.Channel is DummySelectorChannel); + private void clickDrawable(Drawable d) { InputManager.MoveMouseTo(d); diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 1fe784f68b..9524e8c1a7 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -14,6 +14,7 @@ using osu.Game.Input; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Overlays; using osu.Game.Overlays.Chat.Tabs; namespace osu.Game.Online.Chat @@ -133,7 +134,9 @@ namespace osu.Game.Online.Chat private void currentChannelChanged(ValueChangedEvent e) { - if (!(e.NewValue is ChannelSelectorTabItem.ChannelSelectorTabChannel)) + bool isSelectorChannel = e.NewValue is ChannelSelectorTabItem.ChannelSelectorTabChannel || e.NewValue is DummySelectorChannel; + + if (!isSelectorChannel) JoinChannel(e.NewValue); } @@ -194,7 +197,6 @@ namespace osu.Game.Online.Chat createNewPrivateMessageRequest.Failure += exception => { - handlePostException(exception); target.ReplaceMessage(message, null); dequeueAndRun(); }; @@ -420,11 +422,10 @@ namespace osu.Game.Online.Chat /// Joins a channel if it has not already been joined. Must be called from the update thread. ///
/// The channel to join. - /// Set the channel to join as the current channel if the current channel is null. /// The joined channel. Note that this may not match the parameter channel as it is a backed object. - public Channel JoinChannel(Channel channel, bool setCurrent = true) => joinChannel(channel, true, setCurrent); + public Channel JoinChannel(Channel channel) => joinChannel(channel, true); - private Channel joinChannel(Channel channel, bool fetchInitialMessages = false, bool setCurrent = true) + private Channel joinChannel(Channel channel, bool fetchInitialMessages = false) { if (channel == null) return null; @@ -440,7 +441,7 @@ namespace osu.Game.Online.Chat case ChannelType.Multiplayer: // join is implicit. happens when you join a multiplayer game. // this will probably change in the future. - joinChannel(channel, fetchInitialMessages, setCurrent); + joinChannel(channel, fetchInitialMessages); return channel; case ChannelType.PM: @@ -461,7 +462,7 @@ namespace osu.Game.Online.Chat default: var req = new JoinChannelRequest(channel); - req.Success += () => joinChannel(channel, fetchInitialMessages, setCurrent); + req.Success += () => joinChannel(channel, fetchInitialMessages); req.Failure += ex => LeaveChannel(channel); api.Queue(req); return channel; @@ -473,8 +474,7 @@ namespace osu.Game.Online.Chat this.fetchInitialMessages(channel); } - if (setCurrent) - CurrentChannel.Value ??= channel; + CurrentChannel.Value ??= channel; return channel; } diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 6bdf5ee084..c9f3a4d380 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -18,13 +18,16 @@ namespace osu.Game.Overlays.Chat.ChannelList { public class ChannelList : Container { - public Action? OnRequestSelect; + public Action? OnRequestSelect; public Action? OnRequestLeave; private readonly Dictionary channelMap = new Dictionary(); + private readonly DummySelectorChannel dummySelectorChannel = new DummySelectorChannel(); + private ChannelListItemFlow publicChannelFlow = null!; private ChannelListItemFlow privateChannelFlow = null!; + private ChannelListItem selector = null!; [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) @@ -50,16 +53,17 @@ namespace osu.Game.Overlays.Chat.ChannelList Children = new Drawable[] { publicChannelFlow = new ChannelListItemFlow("CHANNELS"), - new ChannelListSelector + selector = new ChannelListItem(dummySelectorChannel) { Margin = new MarginPadding { Bottom = 10 }, - Action = () => OnRequestSelect?.Invoke(null), }, privateChannelFlow = new ChannelListItemFlow("DIRECT MESSAGES"), }, }, }, }; + + selector.OnRequestSelect += chan => OnRequestSelect?.Invoke(chan); } public void AddChannel(Channel channel) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs index dd571c9ad9..dfb0b6d781 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Chat.ChannelList private Box hoverBox = null!; private Box selectBox = null!; private OsuSpriteText text = null!; - private ChannelListItemCloseButton close = null!; + private Drawable close = null!; [Resolved] private Bindable selectedChannel { get; set; } = null!; @@ -97,20 +97,8 @@ namespace osu.Game.Overlays.Chat.ChannelList RelativeSizeAxes = Axes.X, Truncate = true, }, - new ChannelListItemMentionPill - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Margin = new MarginPadding { Right = 3 }, - Mentions = { BindTarget = Mentions }, - }, - close = new ChannelListItemCloseButton - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Margin = new MarginPadding { Right = 3 }, - Action = () => OnRequestLeave?.Invoke(Channel), - } + createMentionPill(), + close = createCloseButton(), } }, }, @@ -131,14 +119,20 @@ namespace osu.Game.Overlays.Chat.ChannelList protected override bool OnHover(HoverEvent e) { hoverBox.FadeIn(300, Easing.OutQuint); - close.FadeIn(300, Easing.OutQuint); + + if (!isSelector) + close.FadeIn(300, Easing.OutQuint); + return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { hoverBox.FadeOut(200, Easing.OutQuint); - close.FadeOut(200, Easing.OutQuint); + + if (!isSelector) + close.FadeOut(200, Easing.OutQuint); + base.OnHoverLost(e); } @@ -158,9 +152,37 @@ namespace osu.Game.Overlays.Chat.ChannelList }; } + private Drawable createMentionPill() + { + if (isSelector) + return Drawable.Empty(); + + return new ChannelListItemMentionPill + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Margin = new MarginPadding { Right = 3 }, + Mentions = { BindTarget = Mentions }, + }; + } + + private Drawable createCloseButton() + { + if (isSelector) + return Drawable.Empty(); + + return new ChannelListItemCloseButton + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Margin = new MarginPadding { Right = 3 }, + Action = () => OnRequestLeave?.Invoke(Channel), + }; + } + private void updateState() { - bool selected = selectedChannel.Value == Channel; + bool selected = selectedChannel.Value == Channel || (isSelector && selectedChannel.Value == null); if (selected) selectBox.FadeIn(300, Easing.OutQuint); @@ -172,5 +194,7 @@ namespace osu.Game.Overlays.Chat.ChannelList else text.FadeColour(colourProvider.Light3, 200, Easing.OutQuint); } + + private bool isSelector => Channel is DummySelectorChannel; } } diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs deleted file mode 100644 index a07aad2041..0000000000 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListSelector.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -#nullable enable - -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.Events; -using osu.Game.Graphics; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; -using osu.Game.Online.Chat; - -namespace osu.Game.Overlays.Chat.ChannelList -{ - public class ChannelListSelector : OsuClickableContainer - { - private Box hoverBox = null!; - private Box selectBox = null!; - private OsuSpriteText text = null!; - - [Resolved] - private Bindable currentChannel { get; set; } = null!; - - [Resolved] - private OverlayColourProvider colourProvider { get; set; } = null!; - - [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) - { - Height = 30; - RelativeSizeAxes = Axes.X; - - Children = new Drawable[] - { - hoverBox = new Box - { - RelativeSizeAxes = Axes.Both, - Colour = colourProvider.Background3, - Alpha = 0f, - }, - selectBox = new Box - { - RelativeSizeAxes = Axes.Both, - Colour = colourProvider.Background4, - Alpha = 0f, - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = 18, Right = 10 }, - Child = text = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Text = "Add more channels", - Font = OsuFont.Torus.With(size: 17, weight: FontWeight.SemiBold), - Colour = colourProvider.Light3, - Margin = new MarginPadding { Bottom = 2 }, - RelativeSizeAxes = Axes.X, - Truncate = true, - }, - }, - }; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - currentChannel.BindValueChanged(channel => - { - // This logic should be handled by the chat overlay rather than this component. - // Selected state should be moved to an abstract class and shared with ChannelListItem. - if (channel.NewValue == null) - { - text.FadeColour(colourProvider.Content1, 300, Easing.OutQuint); - selectBox.FadeIn(300, Easing.OutQuint); - } - else - { - text.FadeColour(colourProvider.Light3, 200, Easing.OutQuint); - selectBox.FadeOut(200, Easing.OutQuint); - } - }, true); - } - - protected override bool OnHover(HoverEvent e) - { - hoverBox.FadeIn(300, Easing.OutQuint); - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - hoverBox.FadeOut(200, Easing.OutQuint); - base.OnHoverLost(e); - } - } -} diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 6eec0bbbf4..0307dcfdf3 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -154,7 +154,7 @@ namespace osu.Game.Overlays channelList.OnRequestSelect += channel => channelManager.CurrentChannel.Value = channel; channelList.OnRequestLeave += channel => channelManager.LeaveChannel(channel); - channelListing.OnRequestJoin += channel => channelManager.JoinChannel(channel, false); + channelListing.OnRequestJoin += channel => channelManager.JoinChannel(channel); channelListing.OnRequestLeave += channel => channelManager.LeaveChannel(channel); textBar.OnSearchTermsChanged += searchTerms => channelListing.SearchTerm = searchTerms; @@ -237,7 +237,7 @@ namespace osu.Game.Overlays { Channel? newChannel = channel.NewValue; - if (newChannel == null) + if (newChannel == null || newChannel is DummySelectorChannel) { // null channel denotes that we should be showing the listing. channelListing.State.Value = Visibility.Visible; @@ -293,4 +293,13 @@ namespace osu.Game.Overlays channelManager.PostMessage(message); } } + + public class DummySelectorChannel : Channel + { + public DummySelectorChannel() + { + Name = "Add more channels"; + Type = ChannelType.System; + } + } } From a633501687c0535f76b2422cbb5f04f0935afccf Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 16 May 2022 14:09:37 +0900 Subject: [PATCH 1025/2328] Change FilterTerms to use LocalisableString --- osu.Game/Graphics/UserInterface/TriangleButton.cs | 3 ++- osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs | 3 ++- osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs | 3 ++- osu.Game/Overlays/Chat/Selection/ChannelListItem.cs | 3 ++- osu.Game/Overlays/Chat/Selection/ChannelSection.cs | 3 ++- osu.Game/Overlays/Music/PlaylistItem.cs | 3 ++- .../Overlays/Settings/Sections/Audio/OffsetSettings.cs | 2 +- osu.Game/Overlays/Settings/Sections/AudioSection.cs | 2 +- .../Overlays/Settings/Sections/Gameplay/ModsSettings.cs | 2 +- osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs | 3 ++- .../Settings/Sections/Input/KeyBindingsSubsection.cs | 3 ++- osu.Game/Overlays/Settings/SettingsButton.cs | 5 ++--- osu.Game/Overlays/Settings/SettingsDropdown.cs | 3 ++- osu.Game/Overlays/Settings/SettingsItem.cs | 7 ++++--- osu.Game/Overlays/Settings/SettingsSection.cs | 2 +- osu.Game/Overlays/Settings/SettingsSubsection.cs | 6 +----- .../Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs | 5 ++++- osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs | 3 ++- 18 files changed, 35 insertions(+), 26 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/TriangleButton.cs b/osu.Game/Graphics/UserInterface/TriangleButton.cs index 003a81f562..5ae6130039 100644 --- a/osu.Game/Graphics/UserInterface/TriangleButton.cs +++ b/osu.Game/Graphics/UserInterface/TriangleButton.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Localisation; using osu.Game.Graphics.Backgrounds; namespace osu.Game.Graphics.UserInterface @@ -27,7 +28,7 @@ namespace osu.Game.Graphics.UserInterface }); } - public virtual IEnumerable FilterTerms => new[] { Text.ToString() }; + public virtual IEnumerable FilterTerms => new[] { Text }; public bool MatchingFilter { diff --git a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs index ec56b6d784..3c0c3b69e8 100644 --- a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs @@ -6,6 +6,7 @@ using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Localisation; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; @@ -39,7 +40,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 private void updateCornerRadius() => Content.CornerRadius = DrawHeight / 2; - public virtual IEnumerable FilterTerms => new[] { Text.ToString() }; + public virtual IEnumerable FilterTerms => new[] { Text }; public bool MatchingFilter { diff --git a/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs b/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs index 1f0cbae7e2..86c81d5d79 100644 --- a/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs +++ b/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; +using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -28,7 +29,7 @@ namespace osu.Game.Overlays.Chat.Listing public readonly Channel Channel; public bool FilteringActive { get; set; } - public IEnumerable FilterTerms => new[] { Channel.Name, Channel.Topic ?? string.Empty }; + public IEnumerable FilterTerms => new LocalisableString[] { Channel.Name, Channel.Topic ?? string.Empty }; public bool MatchingFilter { set => this.FadeTo(value ? 1f : 0f, 100); } private Box hoverBox = null!; diff --git a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs index 1e58e8b640..59989ade7b 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; +using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; @@ -36,7 +37,7 @@ namespace osu.Game.Overlays.Chat.Selection private Color4 topicColour; private Color4 hoverColour; - public IEnumerable FilterTerms => new[] { Channel.Name, Channel.Topic ?? string.Empty }; + public IEnumerable FilterTerms => new LocalisableString[] { Channel.Name, Channel.Topic ?? string.Empty }; public bool MatchingFilter { diff --git a/osu.Game/Overlays/Chat/Selection/ChannelSection.cs b/osu.Game/Overlays/Chat/Selection/ChannelSection.cs index 537ac975ac..070332180c 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelSection.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; @@ -18,7 +19,7 @@ namespace osu.Game.Overlays.Chat.Selection public readonly FillFlowContainer ChannelFlow; public IEnumerable FilterableChildren => ChannelFlow.Children; - public IEnumerable FilterTerms => Array.Empty(); + public IEnumerable FilterTerms => Array.Empty(); public bool MatchingFilter { diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index f081cc0503..82599d3ec9 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -113,7 +114,7 @@ namespace osu.Game.Overlays.Music } } - public IEnumerable FilterTerms => Model.PerformRead(m => m.Metadata.GetSearchableTerms()); + public IEnumerable FilterTerms => Model.PerformRead(m => m.Metadata.GetSearchableTerms()).Select(s => (LocalisableString)s).ToArray(); private bool matchingFilter = true; diff --git a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs index 673252a99e..eaacb9293f 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio { protected override LocalisableString Header => AudioSettingsStrings.OffsetHeader; - public override IEnumerable FilterTerms => base.FilterTerms.Concat(new[] { "universal", "uo", "timing" }); + public override IEnumerable FilterTerms => base.FilterTerms.Concat(new LocalisableString[] { "universal", "uo", "timing" }); [BackgroundDependencyLoader] private void load(OsuConfigManager config) diff --git a/osu.Game/Overlays/Settings/Sections/AudioSection.cs b/osu.Game/Overlays/Settings/Sections/AudioSection.cs index 694da0529a..7ffa0bd415 100644 --- a/osu.Game/Overlays/Settings/Sections/AudioSection.cs +++ b/osu.Game/Overlays/Settings/Sections/AudioSection.cs @@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Settings.Sections Icon = FontAwesome.Solid.VolumeUp }; - public override IEnumerable FilterTerms => base.FilterTerms.Concat(new[] { "sound" }); + public override IEnumerable FilterTerms => base.FilterTerms.Concat(new LocalisableString[] { "sound" }); public AudioSection() { diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs index dfa060e8d5..ed88d80570 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs @@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { protected override LocalisableString Header => GameplaySettingsStrings.ModsHeader; - public override IEnumerable FilterTerms => base.FilterTerms.Concat(new[] { "mod" }); + public override IEnumerable FilterTerms => base.FilterTerms.Concat(new LocalisableString[] { "mod" }); [BackgroundDependencyLoader] private void load(OsuConfigManager config) diff --git a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs index 459405f57d..7312748435 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs @@ -15,6 +15,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; +using osu.Framework.Localisation; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -67,7 +68,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input private Bindable isDefault { get; } = new BindableBool(true); - public IEnumerable FilterTerms => bindings.Select(b => keyCombinationProvider.GetReadableString(b.KeyCombination)).Prepend(text.Text.ToString()); + public IEnumerable FilterTerms => bindings.Select(b => (LocalisableString)keyCombinationProvider.GetReadableString(b.KeyCombination)).Prepend(text.Text); public KeyBindingRow(object action, List bindings) { diff --git a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingsSubsection.cs b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingsSubsection.cs index 922d371261..297af35fb5 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingsSubsection.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingsSubsection.cs @@ -6,6 +6,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; +using osu.Framework.Localisation; using osu.Game.Database; using osu.Game.Input.Bindings; using osu.Game.Rulesets; @@ -74,6 +75,6 @@ namespace osu.Game.Overlays.Settings.Sections.Input } // Empty FilterTerms so that the ResetButton is visible only when the whole subsection is visible. - public override IEnumerable FilterTerms => Enumerable.Empty(); + public override IEnumerable FilterTerms => Enumerable.Empty(); } } diff --git a/osu.Game/Overlays/Settings/SettingsButton.cs b/osu.Game/Overlays/Settings/SettingsButton.cs index be7f2de480..10aea92b22 100644 --- a/osu.Game/Overlays/Settings/SettingsButton.cs +++ b/osu.Game/Overlays/Settings/SettingsButton.cs @@ -20,13 +20,12 @@ namespace osu.Game.Overlays.Settings public LocalisableString TooltipText { get; set; } - public override IEnumerable FilterTerms + public override IEnumerable FilterTerms { get { if (TooltipText != default) - // TODO: this won't work as intended once the tooltip text is translated. - return base.FilterTerms.Append(TooltipText.ToString()); + return base.FilterTerms.Append(TooltipText); return base.FilterTerms; } diff --git a/osu.Game/Overlays/Settings/SettingsDropdown.cs b/osu.Game/Overlays/Settings/SettingsDropdown.cs index 1e90222d28..3c10c084ab 100644 --- a/osu.Game/Overlays/Settings/SettingsDropdown.cs +++ b/osu.Game/Overlays/Settings/SettingsDropdown.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Localisation; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Settings @@ -25,7 +26,7 @@ namespace osu.Game.Overlays.Settings set => Control.ItemSource = value; } - public override IEnumerable FilterTerms => base.FilterTerms.Concat(Control.Items.Select(i => i.ToString())); + public override IEnumerable FilterTerms => base.FilterTerms.Concat(Control.Items.Select(i => (LocalisableString)i.ToString())); protected sealed override Drawable CreateControl() => CreateDropdown(); diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index afcd41af22..ee9daa1c0d 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -98,13 +99,13 @@ namespace osu.Game.Overlays.Settings set => controlWithCurrent.Current = value; } - public virtual IEnumerable FilterTerms + public virtual IEnumerable FilterTerms { get { - var keywords = new List(Keywords ?? Array.Empty()) + var keywords = new List(Keywords?.Select(k => (LocalisableString)k) ?? Array.Empty()) { - LabelText.ToString() + LabelText }; if (HasClassicDefault) diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index cfb0212b8c..da596e4d9d 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -32,7 +32,7 @@ namespace osu.Game.Overlays.Settings public abstract LocalisableString Header { get; } public IEnumerable FilterableChildren => Children.OfType(); - public virtual IEnumerable FilterTerms => new[] { Header.ToString() }; + public virtual IEnumerable FilterTerms => new[] { Header }; public const int ITEM_SPACING = 14; diff --git a/osu.Game/Overlays/Settings/SettingsSubsection.cs b/osu.Game/Overlays/Settings/SettingsSubsection.cs index c2cf08ac98..21391d5ccf 100644 --- a/osu.Game/Overlays/Settings/SettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/SettingsSubsection.cs @@ -25,11 +25,7 @@ namespace osu.Game.Overlays.Settings public IEnumerable FilterableChildren => Children.OfType(); - // FilterTerms should contains both original string and localised string for user to search. - // Since LocalisableString is unable to get original string at this time (2021-08-14), - // only call .ToString() to use localised one. - // TODO: Update here when FilterTerms accept LocalisableString. - public virtual IEnumerable FilterTerms => new[] { Header.ToString() }; + public virtual IEnumerable FilterTerms => new[] { Header }; public bool MatchingFilter { diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs index 74e4225f11..d61fbea387 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs @@ -80,7 +80,10 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components matchingFilter &= criteria.Ruleset == null || r.Room.PlaylistItemStats.Value?.RulesetIDs.Any(id => id == criteria.Ruleset.OnlineID) != false; if (!string.IsNullOrEmpty(criteria.SearchString)) - matchingFilter &= r.FilterTerms.Any(term => term.Contains(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase)); + { + // Room name isn't translatable, so ToString() is used here for simplicity. + matchingFilter &= r.FilterTerms.Any(term => term.ToString().Contains(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase)); + } r.MatchingFilter = matchingFilter; } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs index 7baa346c6f..35c903eb0c 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs @@ -14,6 +14,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; +using osu.Framework.Localisation; using osu.Game.Extensions; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -101,7 +102,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge public bool FilteringActive { get; set; } - public IEnumerable FilterTerms => new[] { Room.Name.Value }; + public IEnumerable FilterTerms => new LocalisableString[] { Room.Name.Value }; private bool matchingFilter = true; From 8c9edee360ba44364b5d3796f86e54db8bc04bf1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 May 2022 15:47:00 +0900 Subject: [PATCH 1026/2328] Add ruleset context to sentry error reports --- osu.Game/Utils/SentryLogger.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index 3edb27ca9b..ace397708e 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -18,6 +18,7 @@ using osu.Game.Database; using osu.Game.Models; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; +using osu.Game.Rulesets; using osu.Game.Skinning; using Sentry; using Sentry.Protocol; @@ -109,6 +110,7 @@ namespace osu.Game.Utils }, scope => { var beatmap = game.Dependencies.Get>().Value.BeatmapInfo; + var ruleset = game.Dependencies.Get>().Value; scope.Contexts[@"config"] = new { @@ -137,9 +139,17 @@ namespace osu.Game.Utils scope.Contexts[@"beatmap"] = new { Name = beatmap.ToString(), + Ruleset = beatmap.Ruleset.InstantiationInfo, beatmap.OnlineID, }; + scope.Contexts[@"ruleset"] = new + { + ruleset.Name, + ruleset.InstantiationInfo, + ruleset.OnlineID + }; + scope.Contexts[@"clocks"] = new { Audio = game.Dependencies.Get().CurrentTrack.CurrentTime, From 5ec05a86535038c8dd2a79d1f34c30d24360ba02 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 May 2022 15:50:15 +0900 Subject: [PATCH 1027/2328] Add tags for current screen and ruleset --- osu.Game/OsuGame.cs | 2 ++ osu.Game/Utils/SentryLogger.cs | 3 +++ 2 files changed, 5 insertions(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 3d56d33689..785881d97a 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -1207,6 +1207,8 @@ namespace osu.Game Current = newScreen?.GetType().ReadableName(), Previous = current?.GetType().ReadableName(), }; + + scope.SetTag(@"screen", newScreen?.GetType().ReadableName() ?? @"none"); }); switch (newScreen) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index ace397708e..b5d318bc64 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -145,6 +145,7 @@ namespace osu.Game.Utils scope.Contexts[@"ruleset"] = new { + ruleset.ShortName, ruleset.Name, ruleset.InstantiationInfo, ruleset.OnlineID @@ -155,6 +156,8 @@ namespace osu.Game.Utils Audio = game.Dependencies.Get().CurrentTrack.CurrentTime, Game = game.Clock.CurrentTime, }; + + scope.SetTag(@"ruleset", ruleset.ShortName); }); } else From 9331c6230669ebccdd2a244f317299a5a647a3d4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 May 2022 16:07:56 +0900 Subject: [PATCH 1028/2328] Also add realm ruleset count --- osu.Game/Utils/SentryLogger.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index b5d318bc64..5390c666ed 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -127,6 +127,8 @@ namespace osu.Game.Utils BeatmapSets = realm.All().Count(), Beatmaps = realm.All().Count(), Files = realm.All().Count(), + Rulesets = realm.All().Count(), + RulesetsAvailable = realm.All().Count(r => r.Available), Skins = realm.All().Count(), } }; From f78eb0066c7066f1f0ba4c71344a17487e8ef7a5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 May 2022 17:51:12 +0900 Subject: [PATCH 1029/2328] Update `Storage` in line with new methods --- osu.Game/IO/WrappedStorage.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/IO/WrappedStorage.cs b/osu.Game/IO/WrappedStorage.cs index a6605de1d2..d4d9d531fa 100644 --- a/osu.Game/IO/WrappedStorage.cs +++ b/osu.Game/IO/WrappedStorage.cs @@ -67,9 +67,13 @@ namespace osu.Game.IO public override IEnumerable GetFiles(string path, string pattern = "*") => ToLocalRelative(UnderlyingStorage.GetFiles(MutatePath(path), pattern)); + public override Stream CreateFileSafely(string path) => UnderlyingStorage.CreateFileSafely(path); + public override Stream GetStream(string path, FileAccess access = FileAccess.Read, FileMode mode = FileMode.OpenOrCreate) => UnderlyingStorage.GetStream(MutatePath(path), access, mode); + public override void Move(string from, string to) => UnderlyingStorage.Move(from, to); + public override bool OpenFileExternally(string filename) => UnderlyingStorage.OpenFileExternally(MutatePath(filename)); public override bool PresentFileExternally(string filename) => UnderlyingStorage.PresentFileExternally(MutatePath(filename)); From 218642c300417c38e0b20b7af19911e4a36f6364 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 May 2022 18:03:53 +0900 Subject: [PATCH 1030/2328] Update unsafe file write usages --- osu.Game.Tests/Database/BeatmapImporterTests.cs | 2 +- osu.Game.Tests/Visual/Navigation/TestEFToRealmMigration.cs | 3 +-- osu.Game.Tournament.Tests/NonVisual/DataLoadTest.cs | 2 +- osu.Game.Tournament.Tests/Screens/TestSceneDrawingsScreen.cs | 2 +- osu.Game.Tournament/Models/StableInfo.cs | 2 +- osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs | 2 +- osu.Game.Tournament/TournamentGameBase.cs | 2 +- osu.Game/Database/LegacyExporter.cs | 2 +- osu.Game/Database/RealmAccess.cs | 2 +- osu.Game/Graphics/ScreenshotManager.cs | 2 +- osu.Game/OsuGameBase.cs | 2 +- osu.Game/Stores/RealmFileStore.cs | 2 +- 12 files changed, 12 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index b7bfe14402..00276955aa 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -507,7 +507,7 @@ namespace osu.Game.Tests.Database using (var stream = storage.GetStream(firstFile.File.GetStoragePath())) originalLength = stream.Length; - using (var stream = storage.GetStream(firstFile.File.GetStoragePath(), FileAccess.Write, FileMode.Create)) + using (var stream = storage.CreateFileSafely(firstFile.File.GetStoragePath())) stream.WriteByte(0); var importedSecondTime = await LoadOszIntoStore(importer, realm.Realm); diff --git a/osu.Game.Tests/Visual/Navigation/TestEFToRealmMigration.cs b/osu.Game.Tests/Visual/Navigation/TestEFToRealmMigration.cs index 8498b9b28f..2ea768b878 100644 --- a/osu.Game.Tests/Visual/Navigation/TestEFToRealmMigration.cs +++ b/osu.Game.Tests/Visual/Navigation/TestEFToRealmMigration.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.IO; using System.Linq; using System.Runtime.InteropServices; using NUnit.Framework; @@ -25,7 +24,7 @@ namespace osu.Game.Tests.Visual.Navigation if (isDisposing) return; - using (var outStream = LocalStorage.GetStream(DatabaseContextFactory.DATABASE_NAME, FileAccess.Write, FileMode.Create)) + using (var outStream = LocalStorage.CreateFileSafely(DatabaseContextFactory.DATABASE_NAME)) using (var stream = TestResources.OpenResource(DatabaseContextFactory.DATABASE_NAME)) stream.CopyTo(outStream); } diff --git a/osu.Game.Tournament.Tests/NonVisual/DataLoadTest.cs b/osu.Game.Tournament.Tests/NonVisual/DataLoadTest.cs index 4c1256df2e..e5c539bbf1 100644 --- a/osu.Game.Tournament.Tests/NonVisual/DataLoadTest.cs +++ b/osu.Game.Tournament.Tests/NonVisual/DataLoadTest.cs @@ -28,7 +28,7 @@ namespace osu.Game.Tournament.Tests.NonVisual // ReSharper disable once AccessToDisposedClosure var storage = host.Storage.GetStorageForDirectory(Path.Combine("tournaments", "default")); - using (var stream = storage.GetStream("bracket.json", FileAccess.Write, FileMode.Create)) + using (var stream = storage.CreateFileSafely("bracket.json")) using (var writer = new StreamWriter(stream)) { writer.Write(@"{ diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneDrawingsScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneDrawingsScreen.cs index e2954c8f10..0e38c777ba 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneDrawingsScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneDrawingsScreen.cs @@ -15,7 +15,7 @@ namespace osu.Game.Tournament.Tests.Screens [BackgroundDependencyLoader] private void load(Storage storage) { - using (var stream = storage.GetStream("drawings.txt", FileAccess.Write)) + using (var stream = storage.CreateFileSafely("drawings.txt")) using (var writer = new StreamWriter(stream)) { writer.WriteLine("KR : South Korea : KOR"); diff --git a/osu.Game.Tournament/Models/StableInfo.cs b/osu.Game.Tournament/Models/StableInfo.cs index 1ebc81c773..c835b11a4d 100644 --- a/osu.Game.Tournament/Models/StableInfo.cs +++ b/osu.Game.Tournament/Models/StableInfo.cs @@ -45,7 +45,7 @@ namespace osu.Game.Tournament.Models public void SaveChanges() { - using (var stream = configStorage.GetStream(config_path, FileAccess.Write, FileMode.Create)) + using (var stream = configStorage.CreateFileSafely(config_path)) using (var sw = new StreamWriter(stream)) { sw.Write(JsonConvert.SerializeObject(this, diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index d02e0ebf86..53ac93afea 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -205,7 +205,7 @@ namespace osu.Game.Tournament.Screens.Drawings try { // Write to drawings_results - using (Stream stream = storage.GetStream(results_filename, FileAccess.Write, FileMode.Create)) + using (Stream stream = storage.CreateFileSafely(results_filename)) using (StreamWriter sw = new StreamWriter(stream)) { sw.Write(text); diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index a251a043f7..363baccb37 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -321,7 +321,7 @@ namespace osu.Game.Tournament Converters = new JsonConverter[] { new JsonPointConverter() } }); - using (var stream = storage.GetStream(BRACKET_FILENAME, FileAccess.Write, FileMode.Create)) + using (var stream = storage.CreateFileSafely(BRACKET_FILENAME)) using (var sw = new StreamWriter(stream)) sw.Write(serialisedLadder); } diff --git a/osu.Game/Database/LegacyExporter.cs b/osu.Game/Database/LegacyExporter.cs index ee960b6b30..992d1854e7 100644 --- a/osu.Game/Database/LegacyExporter.cs +++ b/osu.Game/Database/LegacyExporter.cs @@ -37,7 +37,7 @@ namespace osu.Game.Database { string filename = $"{item.GetDisplayString().GetValidArchiveContentFilename()}{FileExtension}"; - using (var stream = exportStorage.GetStream(filename, FileAccess.Write, FileMode.Create)) + using (var stream = exportStorage.CreateFileSafely(filename)) ExportModelTo(item, stream); exportStorage.PresentFileExternally(filename); diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 937876a70e..dbd3b96763 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -242,7 +242,7 @@ namespace osu.Game.Database storage.Delete(Filename); using (var inputStream = storage.GetStream(recoveryFilename)) - using (var outputStream = storage.GetStream(Filename, FileAccess.Write, FileMode.Create)) + using (var outputStream = storage.CreateFileSafely(Filename)) inputStream.CopyTo(outputStream); storage.Delete(recoveryFilename); diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index a2f1a3d7b9..1fc2633143 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -118,7 +118,7 @@ namespace osu.Game.Graphics if (filename == null) return; - using (var stream = storage.GetStream(filename, FileAccess.Write)) + using (var stream = storage.CreateFileSafely(filename)) { switch (screenshotFormat.Value) { diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 2e4758a134..564cb6c131 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -243,7 +243,7 @@ namespace osu.Game { if (source != null) { - using (var destination = Storage.GetStream(Path.Combine(backup_folder, $"collection.{migration}.db"), FileAccess.Write, FileMode.CreateNew)) + using (var destination = Storage.CreateFileSafely(Path.Combine(backup_folder, $"collection.{migration}.db"))) source.CopyTo(destination); } } diff --git a/osu.Game/Stores/RealmFileStore.cs b/osu.Game/Stores/RealmFileStore.cs index b5dd3d64e4..457d70f29a 100644 --- a/osu.Game/Stores/RealmFileStore.cs +++ b/osu.Game/Stores/RealmFileStore.cs @@ -65,7 +65,7 @@ namespace osu.Game.Stores { data.Seek(0, SeekOrigin.Begin); - using (var output = Storage.GetStream(file.GetStoragePath(), FileAccess.Write)) + using (var output = Storage.CreateFileSafely(file.GetStoragePath())) data.CopyTo(output); data.Seek(0, SeekOrigin.Begin); From d7aed77340b2d1b9a16f9de41081af910f304a31 Mon Sep 17 00:00:00 2001 From: "Hugo \"ThePooN\" Denizart" Date: Mon, 16 May 2022 16:01:42 +0200 Subject: [PATCH 1031/2328] =?UTF-8?q?=F0=9F=91=B7=20Push=20tagged=20releas?= =?UTF-8?q?es=20to=20Sentry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sentry-release.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/sentry-release.yml diff --git a/.github/workflows/sentry-release.yml b/.github/workflows/sentry-release.yml new file mode 100644 index 0000000000..8ca9f38234 --- /dev/null +++ b/.github/workflows/sentry-release.yml @@ -0,0 +1,26 @@ +name: Add Release to Sentry + +on: + push: + tags: + - '*' + +jobs: + sentry_release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Create Sentry release + uses: getsentry/action-release@v1 + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_ORG: ppy + SENTRY_PROJECT: osu + SENTRY_URL: https://sentry.ppy.sh/ + with: + environment: production + version: ${{ github.ref }} From 48b7e0f0900d52a23bb9fa1a753983c373ca6ec8 Mon Sep 17 00:00:00 2001 From: Jay L Date: Tue, 10 May 2022 18:17:40 +1000 Subject: [PATCH 1032/2328] Stamina Skill Rewrite and Refactor --- .../Difficulty/Skills/Stamina.cs | 139 +++++++++--------- .../Difficulty/TaikoDifficultyCalculator.cs | 20 +-- 2 files changed, 75 insertions(+), 84 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs index 54cf233d69..b10da95444 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs @@ -1,16 +1,50 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Linq; +using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Skills; -using osu.Game.Rulesets.Difficulty.Utils; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing; using osu.Game.Rulesets.Taiko.Objects; namespace osu.Game.Rulesets.Taiko.Difficulty.Skills { + class SingleKeyStamina + { + private double previousHitTime = -1; + + private double strainValueOf(DifficultyHitObject current) + { + if (previousHitTime == -1) + { + previousHitTime = current.StartTime; + return 0; + } + else + { + double objectStrain = 0.5; + objectStrain += speedBonus(current.StartTime - previousHitTime); + previousHitTime = current.StartTime; + return objectStrain; + } + } + + public double StrainValueAt(DifficultyHitObject current) + { + return strainValueOf(current); + } + + /// + /// Applies a speed bonus dependent on the time since the last hit performed using this key. + /// + /// The duration between the current and previous note hit using the same key. + private double speedBonus(double notePairDuration) + { + return 175 / Math.Pow(notePairDuration + 100, 1); + } + } + /// /// Calculates the stamina coefficient of taiko difficulty. /// @@ -22,39 +56,43 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills protected override double SkillMultiplier => 1; protected override double StrainDecayBase => 0.4; - /// - /// Maximum number of entries to keep in . - /// - private const int max_history_length = 2; + private SingleKeyStamina[] keyStamina = new SingleKeyStamina[4] + { + new SingleKeyStamina(), + new SingleKeyStamina(), + new SingleKeyStamina(), + new SingleKeyStamina() + }; - /// - /// The index of the hand this instance is associated with. - /// - /// - /// The value of 0 indicates the left hand (full alternating gameplay starting with left hand is assumed). - /// This naturally translates onto index offsets of the objects in the map. - /// - private readonly int hand; - - /// - /// Stores the last durations between notes hit with the hand indicated by . - /// - private readonly LimitedCapacityQueue notePairDurationHistory = new LimitedCapacityQueue(max_history_length); - - /// - /// Stores the of the last object that was hit by the other hand. - /// - private double offhandObjectDuration = double.MaxValue; + private int donIndex = 1; + private int katIndex = 3; /// /// Creates a skill. /// /// Mods for use in skill calculations. - /// Whether this instance is performing calculations for the right hand. - public Stamina(Mod[] mods, bool rightHand) + public Stamina(Mod[] mods) : base(mods) { - hand = rightHand ? 1 : 0; + } + + private SingleKeyStamina getNextSingleKeyStamina(TaikoDifficultyHitObject current) + { + if (current.HitType == HitType.Centre) + { + donIndex = donIndex == 0 ? 1 : 0; + return keyStamina[donIndex]; + } + else + { + katIndex = katIndex == 2 ? 3 : 2; + return keyStamina[katIndex]; + } + } + + private double sigmoid(double val, double center, double width) + { + return Math.Tanh(Math.E * -(val - center) / width); } protected override double StrainValueOf(DifficultyHitObject current) @@ -65,52 +103,9 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills } TaikoDifficultyHitObject hitObject = (TaikoDifficultyHitObject)current; + double objectStrain = getNextSingleKeyStamina(hitObject).StrainValueAt(hitObject); - if (hitObject.ObjectIndex % 2 == hand) - { - double objectStrain = 1; - - if (hitObject.ObjectIndex == 1) - return 1; - - notePairDurationHistory.Enqueue(hitObject.DeltaTime + offhandObjectDuration); - - double shortestRecentNote = notePairDurationHistory.Min(); - objectStrain += speedBonus(shortestRecentNote); - - if (hitObject.StaminaCheese) - objectStrain *= cheesePenalty(hitObject.DeltaTime + offhandObjectDuration); - - return objectStrain; - } - - offhandObjectDuration = hitObject.DeltaTime; - return 0; - } - - /// - /// Applies a penalty for hit objects marked with . - /// - /// The duration between the current and previous note hit using the hand indicated by . - private double cheesePenalty(double notePairDuration) - { - if (notePairDuration > 125) return 1; - if (notePairDuration < 100) return 0.6; - - return 0.6 + (notePairDuration - 100) * 0.016; - } - - /// - /// Applies a speed bonus dependent on the time since the last hit performed using this hand. - /// - /// The duration between the current and previous note hit using the hand indicated by . - private double speedBonus(double notePairDuration) - { - if (notePairDuration >= 200) return 0; - - double bonus = 200 - notePairDuration; - bonus *= bonus; - return bonus / 100000; + return objectStrain; } } } diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index a9d512f076..de69f63bf4 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty { private const double rhythm_skill_multiplier = 0.014; private const double colour_skill_multiplier = 0.01; - private const double stamina_skill_multiplier = 0.02; + private const double stamina_skill_multiplier = 0.021; public TaikoDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap) : base(ruleset, beatmap) @@ -33,8 +33,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty { new Colour(mods), new Rhythm(mods), - new Stamina(mods, true), - new Stamina(mods, false), + new Stamina(mods) }; protected override Mod[] DifficultyAdjustmentMods => new Mod[] @@ -58,7 +57,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty ); } - new StaminaCheeseDetector(taikoDifficultyHitObjects).FindCheese(); return taikoDifficultyHitObjects; } @@ -69,17 +67,16 @@ namespace osu.Game.Rulesets.Taiko.Difficulty var colour = (Colour)skills[0]; var rhythm = (Rhythm)skills[1]; - var staminaRight = (Stamina)skills[2]; - var staminaLeft = (Stamina)skills[3]; + var stamina = (Stamina)skills[2]; double colourRating = colour.DifficultyValue() * colour_skill_multiplier; double rhythmRating = rhythm.DifficultyValue() * rhythm_skill_multiplier; - double staminaRating = (staminaRight.DifficultyValue() + staminaLeft.DifficultyValue()) * stamina_skill_multiplier; + double staminaRating = stamina.DifficultyValue() * stamina_skill_multiplier; double staminaPenalty = simpleColourPenalty(staminaRating, colourRating); staminaRating *= staminaPenalty; - double combinedRating = locallyCombinedDifficulty(colour, rhythm, staminaRight, staminaLeft, staminaPenalty); + double combinedRating = locallyCombinedDifficulty(colour, rhythm, stamina, staminaPenalty); double separatedRating = norm(1.5, colourRating, rhythmRating, staminaRating); double starRating = 1.4 * separatedRating + 0.5 * combinedRating; starRating = rescale(starRating); @@ -127,20 +124,19 @@ namespace osu.Game.Rulesets.Taiko.Difficulty /// For each section, the peak strains of all separate skills are combined into a single peak strain for the section. /// The resulting partial rating of the beatmap is a weighted sum of the combined peaks (higher peaks are weighted more). /// - private double locallyCombinedDifficulty(Colour colour, Rhythm rhythm, Stamina staminaRight, Stamina staminaLeft, double staminaPenalty) + private double locallyCombinedDifficulty(Colour colour, Rhythm rhythm, Stamina stamina, double staminaPenalty) { List peaks = new List(); var colourPeaks = colour.GetCurrentStrainPeaks().ToList(); var rhythmPeaks = rhythm.GetCurrentStrainPeaks().ToList(); - var staminaRightPeaks = staminaRight.GetCurrentStrainPeaks().ToList(); - var staminaLeftPeaks = staminaLeft.GetCurrentStrainPeaks().ToList(); + var staminaPeaks = stamina.GetCurrentStrainPeaks().ToList(); for (int i = 0; i < colourPeaks.Count; i++) { double colourPeak = colourPeaks[i] * colour_skill_multiplier; double rhythmPeak = rhythmPeaks[i] * rhythm_skill_multiplier; - double staminaPeak = (staminaRightPeaks[i] + staminaLeftPeaks[i]) * stamina_skill_multiplier * staminaPenalty; + double staminaPeak = staminaPeaks[i] * stamina_skill_multiplier * staminaPenalty; double peak = norm(2, colourPeak, rhythmPeak, staminaPeak); From f15738fded36c06d022014871effae3c3c380709 Mon Sep 17 00:00:00 2001 From: Jay L Date: Sun, 15 May 2022 22:09:24 +1000 Subject: [PATCH 1033/2328] Remove Redundant Detection Not needed, as nerf is not required anymore and has negative effect. --- .../Preprocessing/StaminaCheeseDetector.cs | 145 ------------------ 1 file changed, 145 deletions(-) delete mode 100644 osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/StaminaCheeseDetector.cs diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/StaminaCheeseDetector.cs b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/StaminaCheeseDetector.cs deleted file mode 100644 index 3b1a9ad777..0000000000 --- a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/StaminaCheeseDetector.cs +++ /dev/null @@ -1,145 +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 System; -using System.Collections.Generic; -using osu.Game.Rulesets.Difficulty.Utils; -using osu.Game.Rulesets.Taiko.Objects; - -namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing -{ - /// - /// Detects special hit object patterns which are easier to hit using special techniques - /// than normally assumed in the fully-alternating play style. - /// - /// - /// This component detects two basic types of patterns, leveraged by the following techniques: - /// - /// Rolling allows hitting patterns with quickly and regularly alternating notes with a single hand. - /// TL tapping makes hitting longer sequences of consecutive same-colour notes with little to no colour changes in-between. - /// - /// - public class StaminaCheeseDetector - { - /// - /// The minimum number of consecutive objects with repeating patterns that can be classified as hittable using a roll. - /// - private const int roll_min_repetitions = 12; - - /// - /// The minimum number of consecutive objects with repeating patterns that can be classified as hittable using a TL tap. - /// - private const int tl_min_repetitions = 16; - - /// - /// The list of all s in the map. - /// - private readonly List hitObjects; - - public StaminaCheeseDetector(List hitObjects) - { - this.hitObjects = hitObjects; - } - - /// - /// Finds and marks all objects in that special difficulty-reducing techiques apply to - /// with the flag. - /// - public void FindCheese() - { - findRolls(3); - findRolls(4); - - findTlTap(0, HitType.Rim); - findTlTap(1, HitType.Rim); - findTlTap(0, HitType.Centre); - findTlTap(1, HitType.Centre); - } - - /// - /// Finds and marks all sequences hittable using a roll. - /// - /// The length of a single repeating pattern to consider (triplets/quadruplets). - private void findRolls(int patternLength) - { - var history = new LimitedCapacityQueue(2 * patternLength); - - // for convenience, we're tracking the index of the item *before* our suspected repeat's start, - // as that index can be simply subtracted from the current index to get the number of elements in between - // without off-by-one errors - int indexBeforeLastRepeat = -1; - int lastMarkEnd = 0; - - for (int i = 0; i < hitObjects.Count; i++) - { - history.Enqueue(hitObjects[i]); - if (!history.Full) - continue; - - if (!containsPatternRepeat(history, patternLength)) - { - // we're setting this up for the next iteration, hence the +1. - // right here this index will point at the queue's front (oldest item), - // but that item is about to be popped next loop with an enqueue. - indexBeforeLastRepeat = i - history.Count + 1; - continue; - } - - int repeatedLength = i - indexBeforeLastRepeat; - if (repeatedLength < roll_min_repetitions) - continue; - - markObjectsAsCheese(Math.Max(lastMarkEnd, i - repeatedLength + 1), i); - lastMarkEnd = i; - } - } - - /// - /// Determines whether the objects stored in contain a repetition of a pattern of length . - /// - private static bool containsPatternRepeat(LimitedCapacityQueue history, int patternLength) - { - for (int j = 0; j < patternLength; j++) - { - if (history[j].HitType != history[j + patternLength].HitType) - return false; - } - - return true; - } - - /// - /// Finds and marks all sequences hittable using a TL tap. - /// - /// Whether sequences starting with an odd- (1) or even-indexed (0) hit object should be checked. - /// The type of hit to check for TL taps. - private void findTlTap(int parity, HitType type) - { - int tlLength = -2; - int lastMarkEnd = 0; - - for (int i = parity; i < hitObjects.Count; i += 2) - { - if (hitObjects[i].HitType == type) - tlLength += 2; - else - tlLength = -2; - - if (tlLength < tl_min_repetitions) - continue; - - markObjectsAsCheese(Math.Max(lastMarkEnd, i - tlLength + 1), i); - lastMarkEnd = i; - } - } - - /// - /// Marks all objects from to (inclusive) as . - /// - private void markObjectsAsCheese(int start, int end) - { - for (int i = start; i <= end; i++) - hitObjects[i].StaminaCheese = true; - } - } -} From d174099016363de0cd77f62b5eb0c183d2df0b47 Mon Sep 17 00:00:00 2001 From: Jay L Date: Sun, 15 May 2022 22:09:54 +1000 Subject: [PATCH 1034/2328] Refactor and Cleanup of Stamina.cs --- .../Difficulty/Skills/Stamina.cs | 60 ++++++++++--------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs index b10da95444..6d4a1fd948 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Skills; using osu.Game.Rulesets.Mods; @@ -10,29 +9,28 @@ using osu.Game.Rulesets.Taiko.Objects; namespace osu.Game.Rulesets.Taiko.Difficulty.Skills { - class SingleKeyStamina + /// + /// Stamina of a single key, calculated based on repetition speed. + /// + public class SingleKeyStamina { private double previousHitTime = -1; - private double strainValueOf(DifficultyHitObject current) + /// + /// Similar to + /// + public double StrainValueOf(DifficultyHitObject current) { if (previousHitTime == -1) { previousHitTime = current.StartTime; return 0; } - else - { - double objectStrain = 0.5; - objectStrain += speedBonus(current.StartTime - previousHitTime); - previousHitTime = current.StartTime; - return objectStrain; - } - } - public double StrainValueAt(DifficultyHitObject current) - { - return strainValueOf(current); + double objectStrain = 0.5; + objectStrain += speedBonus(current.StartTime - previousHitTime); + previousHitTime = current.StartTime; + return objectStrain; } /// @@ -41,7 +39,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills /// The duration between the current and previous note hit using the same key. private double speedBonus(double notePairDuration) { - return 175 / Math.Pow(notePairDuration + 100, 1); + return 175 / (notePairDuration + 100); } } @@ -56,7 +54,10 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills protected override double SkillMultiplier => 1; protected override double StrainDecayBase => 0.4; - private SingleKeyStamina[] keyStamina = new SingleKeyStamina[4] + /// + /// Stamina of each individual keys, calculated based on repetition speed. + /// + private readonly SingleKeyStamina[] keyStamina = { new SingleKeyStamina(), new SingleKeyStamina(), @@ -64,7 +65,14 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills new SingleKeyStamina() }; + /// + /// Current index to for a don hit. + /// private int donIndex = 1; + + /// + /// Current index to for a kat hit. + /// private int katIndex = 3; /// @@ -76,23 +84,21 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills { } + /// + /// Get the next to use for the given . + /// + /// The current . private SingleKeyStamina getNextSingleKeyStamina(TaikoDifficultyHitObject current) { + // Alternate key for the same color. if (current.HitType == HitType.Centre) { donIndex = donIndex == 0 ? 1 : 0; return keyStamina[donIndex]; } - else - { - katIndex = katIndex == 2 ? 3 : 2; - return keyStamina[katIndex]; - } - } - private double sigmoid(double val, double center, double width) - { - return Math.Tanh(Math.E * -(val - center) / width); + katIndex = katIndex == 2 ? 3 : 2; + return keyStamina[katIndex]; } protected override double StrainValueOf(DifficultyHitObject current) @@ -103,9 +109,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills } TaikoDifficultyHitObject hitObject = (TaikoDifficultyHitObject)current; - double objectStrain = getNextSingleKeyStamina(hitObject).StrainValueAt(hitObject); - - return objectStrain; + return getNextSingleKeyStamina(hitObject).StrainValueOf(hitObject); } } } From b44afb19b16a19e7464c9f1281307f4c396e1fc7 Mon Sep 17 00:00:00 2001 From: Jay L Date: Sun, 15 May 2022 22:10:18 +1000 Subject: [PATCH 1035/2328] Include Convert Penalty For low colour variance --- .../Difficulty/TaikoDifficultyCalculator.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index de69f63bf4..5816b9957c 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -76,6 +76,11 @@ namespace osu.Game.Rulesets.Taiko.Difficulty double staminaPenalty = simpleColourPenalty(staminaRating, colourRating); staminaRating *= staminaPenalty; + if (beatmap.BeatmapInfo.Ruleset.OnlineID == 0 && colourRating < 0.05) + { + staminaPenalty *= 0.25; + } + double combinedRating = locallyCombinedDifficulty(colour, rhythm, stamina, staminaPenalty); double separatedRating = norm(1.5, colourRating, rhythmRating, staminaRating); double starRating = 1.4 * separatedRating + 0.5 * combinedRating; From d94e30bed3985f3301ea8d769ad5060affc94755 Mon Sep 17 00:00:00 2001 From: Jay L Date: Sun, 15 May 2022 22:11:01 +1000 Subject: [PATCH 1036/2328] Rewrite Performance difficultyValue Calculation To change values in line with the community survey, pp has been rescaled immensely, with changes on both the lower and upper end. --- .../Difficulty/TaikoPerformanceCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs index a8122551ff..8d99fd3b87 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs @@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty private double computeDifficultyValue(ScoreInfo score, TaikoDifficultyAttributes attributes) { - double difficultyValue = Math.Pow(5.0 * Math.Max(1.0, attributes.StarRating / 0.0075) - 4.0, 2.0) / 100000.0; + double difficultyValue = Math.Pow(5 * Math.Max(1.0, attributes.StarRating / 0.175) - 4.0, 2.25) / 450.0; double lengthBonus = 1 + 0.1 * Math.Min(1.0, totalHits / 1500.0); difficultyValue *= lengthBonus; From 94294ba351c2c4609328da2ada403a37b89c55b7 Mon Sep 17 00:00:00 2001 From: Jay L Date: Mon, 16 May 2022 10:26:47 +1000 Subject: [PATCH 1037/2328] Apply Review Changes --- osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs | 2 +- osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs index 6d4a1fd948..7846e97a65 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills /// public class SingleKeyStamina { - private double previousHitTime = -1; + private double previousHitTime; /// /// Similar to diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index 5816b9957c..1aa31c6fe4 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -76,6 +76,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty double staminaPenalty = simpleColourPenalty(staminaRating, colourRating); staminaRating *= staminaPenalty; + //TODO : This is a temporary fix for the stamina rating of converts, due to their low colour variance. if (beatmap.BeatmapInfo.Ruleset.OnlineID == 0 && colourRating < 0.05) { staminaPenalty *= 0.25; From c7ec95c0d0d4416561ef622e134b1aef81ea285e Mon Sep 17 00:00:00 2001 From: Jay L Date: Mon, 16 May 2022 14:25:07 +1000 Subject: [PATCH 1038/2328] Rectify Review Changes --- osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs index 7846e97a65..d54da8b869 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs @@ -14,14 +14,14 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills /// public class SingleKeyStamina { - private double previousHitTime; + private double? previousHitTime; /// /// Similar to /// public double StrainValueOf(DifficultyHitObject current) { - if (previousHitTime == -1) + if (previousHitTime == null) { previousHitTime = current.StartTime; return 0; From db6abd86f03bc538fa2c3ffda98120b883f37d5c Mon Sep 17 00:00:00 2001 From: Jay L Date: Mon, 16 May 2022 14:48:39 +1000 Subject: [PATCH 1039/2328] Rectify null value call tired programming is never a good idea --- osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs index d54da8b869..744dafd57e 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills } double objectStrain = 0.5; - objectStrain += speedBonus(current.StartTime - previousHitTime); + objectStrain += speedBonus(current.StartTime - previousHitTime.Value); previousHitTime = current.StartTime; return objectStrain; } From 934bcaf82e8851415a44656151f30a1c9eb5ed7f Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 16 May 2022 14:22:30 +0900 Subject: [PATCH 1040/2328] Adjust tests --- .../TaikoDifficultyCalculatorTest.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs index 226da7df09..51332a1ece 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs @@ -14,13 +14,13 @@ namespace osu.Game.Rulesets.Taiko.Tests { protected override string ResourceAssembly => "osu.Game.Rulesets.Taiko"; - [TestCase(2.2420075288523802d, 200, "diffcalc-test")] - [TestCase(2.2420075288523802d, 200, "diffcalc-test-strong")] + [TestCase(1.9971301024093662d, 200, "diffcalc-test")] + [TestCase(1.9971301024093662d, 200, "diffcalc-test-strong")] public void Test(double expectedStarRating, int expectedMaxCombo, string name) => base.Test(expectedStarRating, expectedMaxCombo, name); - [TestCase(3.134084469440479d, 200, "diffcalc-test")] - [TestCase(3.134084469440479d, 200, "diffcalc-test-strong")] + [TestCase(3.1645810961313674d, 200, "diffcalc-test")] + [TestCase(3.1645810961313674d, 200, "diffcalc-test-strong")] public void TestClockRateAdjusted(double expectedStarRating, int expectedMaxCombo, string name) => Test(expectedStarRating, expectedMaxCombo, name, new TaikoModDoubleTime()); From bc294b81575b92a878c733ec9fe121cd93675ae7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 May 2022 12:53:13 +0900 Subject: [PATCH 1041/2328] Add sentry tags for operating system and processor count These would usually be in the log header, but right now that's not conveyed. An example use case would be better understanding https://sentry.ppy.sh/organizations/ppy/issues/846/?project=2&query=is%3Aunresolved&sort=freq&statsPeriod=14d, where we currently don't know whether it is a desktop or mobile OS. --- osu.Game/Utils/SentryLogger.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index 5390c666ed..137bf7e0aa 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -8,6 +8,7 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Net; +using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Logging; @@ -160,6 +161,8 @@ namespace osu.Game.Utils }; scope.SetTag(@"ruleset", ruleset.ShortName); + scope.SetTag(@"os", $"{RuntimeInfo.OS} ({Environment.OSVersion})"); + scope.SetTag(@"processor count", Environment.ProcessorCount.ToString()); }); } else From 31137bebf8d414cdbcacce62e0365bc271999e6c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 May 2022 14:52:27 +0900 Subject: [PATCH 1042/2328] Revert realm to previous release to fix iOS crashes --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index b984f528fe..e867de73f3 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -56,6 +56,6 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 7f149b4e35..cd3a84a504 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -34,7 +34,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 932421a705..1f677e54fd 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -89,6 +89,6 @@ - + From ef5b2233d7403f671a9ac9e13c708e1d02aef52c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 May 2022 19:21:19 +0900 Subject: [PATCH 1043/2328] Improve the first run progress button to show loading and completion status --- .../FirstRunSetup/ProgressRoundedButton.cs | 103 ++++++++++++++++++ .../Overlays/FirstRunSetup/ScreenBeatmaps.cs | 45 +------- 2 files changed, 106 insertions(+), 42 deletions(-) create mode 100644 osu.Game/Overlays/FirstRunSetup/ProgressRoundedButton.cs diff --git a/osu.Game/Overlays/FirstRunSetup/ProgressRoundedButton.cs b/osu.Game/Overlays/FirstRunSetup/ProgressRoundedButton.cs new file mode 100644 index 0000000000..ee2db1f3d4 --- /dev/null +++ b/osu.Game/Overlays/FirstRunSetup/ProgressRoundedButton.cs @@ -0,0 +1,103 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable +using System; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; +using osuTK; + +namespace osu.Game.Overlays.FirstRunSetup +{ + public class ProgressRoundedButton : RoundedButton + { + public new Action? Action; + + [Resolved] + private OsuColour colours { get; set; } = null!; + + private ProgressBar progressBar = null!; + + private LoadingSpinner loading = null!; + + private SpriteIcon tick = null!; + + public ProgressRoundedButton() + { + base.Action = () => + { + loading.Show(); + Enabled.Value = false; + + Action?.Invoke(); + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + AddRange(new Drawable[] + { + progressBar = new ProgressBar(false) + { + RelativeSizeAxes = Axes.Both, + Blending = BlendingParameters.Additive, + FillColour = BackgroundColour, + Alpha = 0.5f, + Depth = float.MinValue + }, + new Container + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Margin = new MarginPadding(15), + Size = new Vector2(20), + Children = new Drawable[] + { + loading = new LoadingSpinner + { + RelativeSizeAxes = Axes.Both, + Size = Vector2.One, + }, + tick = new SpriteIcon + { + Icon = FontAwesome.Solid.Check, + RelativeSizeAxes = Axes.Both, + Size = Vector2.One, + Alpha = 0, + } + } + }, + }); + } + + public void Complete() + { + loading.Hide(); + tick.FadeIn(500, Easing.OutQuint); + + Background.FadeColour(colours.Green, 500, Easing.OutQuint); + progressBar.FillColour = colours.Green; + + this.TransformBindableTo(progressBar.Current, 1, 500, Easing.OutQuint); + } + + public void Abort() + { + loading.Hide(); + Enabled.Value = true; + this.TransformBindableTo(progressBar.Current, 0, 500, Easing.OutQuint); + } + + public void SetProgress(double progress, bool animated) + { + this.TransformBindableTo(progressBar.Current, progress, animated ? 500 : 0, Easing.OutQuint); + } + } +} diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs index 66acdca8c7..f7615d5ce9 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs @@ -14,8 +14,6 @@ using osu.Game.Beatmaps.Drawables; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.UserInterface; -using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; using osu.Game.Online; using osuTK; @@ -127,7 +125,10 @@ namespace osu.Game.Overlays.FirstRunSetup if (t.IsCompletedSuccessfully) importBeatmapsButton.Complete(); else + { importBeatmapsButton.Enabled.Value = true; + importBeatmapsButton.Abort(); + } })); } }, @@ -214,45 +215,5 @@ namespace osu.Game.Overlays.FirstRunSetup downloadBundledButton.SetProgress(progress, true); } } - - private class ProgressRoundedButton : RoundedButton - { - [Resolved] - private OsuColour colours { get; set; } = null!; - - private ProgressBar progressBar = null!; - - protected override void LoadComplete() - { - base.LoadComplete(); - - Add(progressBar = new ProgressBar(false) - { - RelativeSizeAxes = Axes.Both, - Blending = BlendingParameters.Additive, - FillColour = BackgroundColour, - Alpha = 0.5f, - Depth = float.MinValue - }); - } - - public void Complete() - { - Enabled.Value = false; - - Background.FadeColour(colours.Green, 500, Easing.OutQuint); - progressBar.FillColour = colours.Green; - - this.TransformBindableTo(progressBar.Current, 1, 500, Easing.OutQuint); - } - - public void SetProgress(double progress, bool animated) - { - if (!Enabled.Value) - return; - - this.TransformBindableTo(progressBar.Current, progress, animated ? 500 : 0, Easing.OutQuint); - } - } } } From 4412fec41a0fdc5ea7ff1c063dcbf0aff594210a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 May 2022 19:21:26 +0900 Subject: [PATCH 1044/2328] Add import from stable screen --- .../FirstRunSetupOverlayStrings.cs | 10 ++ .../Overlays/FirstRunSetup/ScreenBeatmaps.cs | 34 +----- .../FirstRunSetup/ScreenImportFromStable.cs | 105 ++++++++++++++++++ osu.Game/Overlays/FirstRunSetupOverlay.cs | 25 +++-- 4 files changed, 131 insertions(+), 43 deletions(-) create mode 100644 osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs diff --git a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs index 91b427e2ca..6b5ca7534d 100644 --- a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs +++ b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs @@ -74,6 +74,16 @@ We recommend you give the new defaults a try, but if you'd like to have things f /// public static LocalisableString ClassicDefaults => new TranslatableString(getKey(@"classic_defaults"), @"Classic defaults"); + /// + /// "Welcome" + /// + public static LocalisableString ImportTitle => new TranslatableString(getKey(@"import_title"), @"Import"); + + /// + /// "Import content from stable" + /// + public static LocalisableString ImportContentFromStable => new TranslatableString(getKey(@"import_content_from_stable"), @"Import content from osu!(stable)"); + private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs index f7615d5ce9..17e04c0c99 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs @@ -25,7 +25,6 @@ namespace osu.Game.Overlays.FirstRunSetup public class ScreenBeatmaps : FirstRunSetupScreen { private ProgressRoundedButton downloadBundledButton = null!; - private ProgressRoundedButton importBeatmapsButton = null!; private ProgressRoundedButton downloadTutorialButton = null!; private OsuTextFlowContainer currentlyLoadedBeatmaps = null!; @@ -41,8 +40,8 @@ namespace osu.Game.Overlays.FirstRunSetup private IDisposable? beatmapSubscription; - [BackgroundDependencyLoader(permitNulls: true)] - private void load(LegacyImportManager? legacyImportManager) + [BackgroundDependencyLoader] + private void load() { Vector2 buttonSize = new Vector2(400, 50); @@ -104,35 +103,6 @@ namespace osu.Game.Overlays.FirstRunSetup Action = downloadBundled }, new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) - { - Colour = OverlayColourProvider.Content1, - Text = "If you have an existing osu! install, you can also choose to import your existing beatmap collection.", - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y - }, - importBeatmapsButton = new ProgressRoundedButton - { - Size = buttonSize, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - BackgroundColour = colours.Blue3, - Text = MaintenanceSettingsStrings.ImportBeatmapsFromStable, - Action = () => - { - importBeatmapsButton.Enabled.Value = false; - legacyImportManager?.ImportFromStableAsync(StableContent.Beatmaps).ContinueWith(t => Schedule(() => - { - if (t.IsCompletedSuccessfully) - importBeatmapsButton.Complete(); - else - { - importBeatmapsButton.Enabled.Value = true; - importBeatmapsButton.Abort(); - } - })); - } - }, - new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) { Colour = OverlayColourProvider.Content1, Text = FirstRunSetupBeatmapScreenStrings.ObtainMoreBeatmaps, diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs new file mode 100644 index 0000000000..c55bb07295 --- /dev/null +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -0,0 +1,105 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Localisation; +using osu.Game.Database; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Localisation; +using osu.Game.Overlays.Settings; +using osuTK; + +namespace osu.Game.Overlays.FirstRunSetup +{ + [LocalisableDescription(typeof(FirstRunSetupOverlayStrings), nameof(FirstRunSetupOverlayStrings.ImportTitle))] + public class ScreenImportFromStable : FirstRunSetupScreen + { + private ProgressRoundedButton importButton = null!; + + private SettingsCheckbox checkboxSkins = null!; + private SettingsCheckbox checkboxBeatmaps = null!; + private SettingsCheckbox checkboxScores = null!; + private SettingsCheckbox checkboxCollections = null!; + + [Resolved] + private OsuColour colours { get; set; } = null!; + + [Resolved(canBeNull: true)] + private LegacyImportManager? legacyImportManager { get; set; } + + [BackgroundDependencyLoader(permitNulls: true)] + private void load() + { + Vector2 buttonSize = new Vector2(400, 50); + + Content.Children = new Drawable[] + { + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) + { + Colour = OverlayColourProvider.Content1, + Text = + "If you have an installation of a previous osu! version, you can choose to migrate your existing content. Note that this will create a copy, and not affect your existing installation.", + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + }, + checkboxBeatmaps = new SettingsCheckbox + { + LabelText = "Beatmaps", + Current = { Value = true } + }, + checkboxScores = new SettingsCheckbox + { + LabelText = "Scores", + Current = { Value = true } + }, + checkboxSkins = new SettingsCheckbox + { + LabelText = "Skins", + Current = { Value = true } + }, + checkboxCollections = new SettingsCheckbox + { + LabelText = "Collections", + Current = { Value = true } + }, + importButton = new ProgressRoundedButton + { + Size = buttonSize, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + BackgroundColour = colours.Blue3, + Text = FirstRunSetupOverlayStrings.ImportContentFromStable, + Action = runImport + }, + }; + } + + private void runImport() + { + importButton.Enabled.Value = false; + + StableContent importableContent = 0; + + if (checkboxBeatmaps.Current.Value) importableContent |= StableContent.Beatmaps; + if (checkboxScores.Current.Value) importableContent |= StableContent.Scores; + if (checkboxSkins.Current.Value) importableContent |= StableContent.Skins; + if (checkboxCollections.Current.Value) importableContent |= StableContent.Collections; + + legacyImportManager?.ImportFromStableAsync(importableContent) + .ContinueWith(t => Schedule(() => + { + if (t.IsCompletedSuccessfully) + importButton.Complete(); + else + { + importButton.Enabled.Value = true; + importButton.Abort(); + } + })); + } + } +} diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index cebb2f5e3b..dae2815e98 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -4,6 +4,7 @@ #nullable enable using System; +using System.Collections.Generic; using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -17,6 +18,7 @@ using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Framework.Threading; using osu.Game.Configuration; +using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; @@ -55,13 +57,7 @@ namespace osu.Game.Overlays ///
public FirstRunSetupScreen? CurrentScreen => (FirstRunSetupScreen?)stack?.CurrentScreen; - private readonly Type[] steps = - { - typeof(ScreenWelcome), - typeof(ScreenBeatmaps), - typeof(ScreenUIScale), - typeof(ScreenBehaviour), - }; + private readonly List steps = new List(); private Container screenContent = null!; @@ -77,9 +73,16 @@ namespace osu.Game.Overlays { } - [BackgroundDependencyLoader] - private void load(OsuColour colours) + [BackgroundDependencyLoader(permitNulls: true)] + private void load(OsuColour colours, LegacyImportManager? legacyImportManager) { + steps.Add(typeof(ScreenWelcome)); + steps.Add(typeof(ScreenBeatmaps)); + if (legacyImportManager?.SupportsImportFromStable == true) + steps.Add(typeof(ScreenImportFromStable)); + steps.Add(typeof(ScreenUIScale)); + steps.Add(typeof(ScreenBehaviour)); + Header.Title = FirstRunSetupOverlayStrings.FirstRunSetupTitle; Header.Description = FirstRunSetupOverlayStrings.FirstRunSetupDescription; @@ -313,7 +316,7 @@ namespace osu.Game.Overlays currentStepIndex++; - if (currentStepIndex < steps.Length) + if (currentStepIndex < steps.Count) { var nextScreen = (Screen)Activator.CreateInstance(steps[currentStepIndex.Value]); @@ -345,7 +348,7 @@ namespace osu.Game.Overlays return; bool isFirstStep = currentStepIndex == 0; - bool isLastStep = currentStepIndex == steps.Length - 1; + bool isLastStep = currentStepIndex == steps.Count - 1; if (isFirstStep) { From 6448c97929d56ef86edb13a0808c58026fdfcbf8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 May 2022 19:57:00 +0900 Subject: [PATCH 1045/2328] Allow retrieving count of available stable imports --- osu.Game/Collections/CollectionManager.cs | 12 ++++++++++++ osu.Game/Database/LegacyImportManager.cs | 23 +++++++++++++++++++++++ osu.Game/Database/LegacyModelImporter.cs | 2 ++ 3 files changed, 37 insertions(+) diff --git a/osu.Game/Collections/CollectionManager.cs b/osu.Game/Collections/CollectionManager.cs index 5845e0d4d1..700b0f5dcb 100644 --- a/osu.Game/Collections/CollectionManager.cs +++ b/osu.Game/Collections/CollectionManager.cs @@ -111,6 +111,18 @@ namespace osu.Game.Collections public Action PostNotification { protected get; set; } + public Task GetAvailableCount(StableStorage stableStorage) + { + if (!stableStorage.Exists(database_name)) + return Task.FromResult(0); + + return Task.Run(() => + { + using (var stream = stableStorage.GetStream(database_name)) + return readCollections(stream).Count; + }); + } + /// /// This is a temporary method and will likely be replaced by a full-fledged (and more correctly placed) migration process in the future. /// diff --git a/osu.Game/Database/LegacyImportManager.cs b/osu.Game/Database/LegacyImportManager.cs index 59394c2952..a9f37fe4a7 100644 --- a/osu.Game/Database/LegacyImportManager.cs +++ b/osu.Game/Database/LegacyImportManager.cs @@ -49,6 +49,29 @@ namespace osu.Game.Database public bool SupportsImportFromStable => RuntimeInfo.IsDesktop; + public async Task GetImportCount(StableContent content) + { + var stableStorage = await getStableStorage().ConfigureAwait(false); + + switch (content) + { + case StableContent.Beatmaps: + return await new LegacyBeatmapImporter(beatmaps).GetAvailableCount(stableStorage); + + case StableContent.Skins: + return await new LegacySkinImporter(skins).GetAvailableCount(stableStorage); + + case StableContent.Collections: + return await collections.GetAvailableCount(stableStorage); + + case StableContent.Scores: + return await new LegacyScoreImporter(scores).GetAvailableCount(stableStorage); + + default: + throw new ArgumentException($"Only one {nameof(StableContent)} flag should be specified."); + } + } + public async Task ImportFromStableAsync(StableContent content) { var stableStorage = await getStableStorage().ConfigureAwait(false); diff --git a/osu.Game/Database/LegacyModelImporter.cs b/osu.Game/Database/LegacyModelImporter.cs index d85fb5aab2..a6e0f5bf8b 100644 --- a/osu.Game/Database/LegacyModelImporter.cs +++ b/osu.Game/Database/LegacyModelImporter.cs @@ -34,6 +34,8 @@ namespace osu.Game.Database Importer = importer; } + public Task GetAvailableCount(StableStorage stableStorage) => Task.Run(() => GetStableImportPaths(stableStorage).Count()); + public Task ImportFromStableAsync(StableStorage stableStorage) { var storage = PrepareStableStorage(stableStorage); From 1666d13d262455c2323fe097f1d4bfbde0006675 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 May 2022 20:13:34 +0900 Subject: [PATCH 1046/2328] Add item counts to import screen --- .../Overlays/FirstRunSetup/ScreenImportFromStable.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs index c55bb07295..42a10854e8 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -4,6 +4,7 @@ #nullable enable using osu.Framework.Allocation; +using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Database; @@ -28,8 +29,8 @@ namespace osu.Game.Overlays.FirstRunSetup [Resolved] private OsuColour colours { get; set; } = null!; - [Resolved(canBeNull: true)] - private LegacyImportManager? legacyImportManager { get; set; } + [Resolved] + private LegacyImportManager legacyImportManager { get; set; } = null!; [BackgroundDependencyLoader(permitNulls: true)] private void load() @@ -76,6 +77,11 @@ namespace osu.Game.Overlays.FirstRunSetup Action = runImport }, }; + + legacyImportManager.GetImportCount(StableContent.Beatmaps).ContinueWith(task => Schedule(() => checkboxBeatmaps.LabelText += $" ({task.GetResultSafely()} items)")); + legacyImportManager.GetImportCount(StableContent.Scores).ContinueWith(task => Schedule(() => checkboxScores.LabelText += $" ({task.GetResultSafely()} items)")); + legacyImportManager.GetImportCount(StableContent.Skins).ContinueWith(task => Schedule(() => checkboxSkins.LabelText += $" ({task.GetResultSafely()} items)")); + legacyImportManager.GetImportCount(StableContent.Collections).ContinueWith(task => Schedule(() => checkboxCollections.LabelText += $" ({task.GetResultSafely()} items)")); } private void runImport() @@ -89,7 +95,7 @@ namespace osu.Game.Overlays.FirstRunSetup if (checkboxSkins.Current.Value) importableContent |= StableContent.Skins; if (checkboxCollections.Current.Value) importableContent |= StableContent.Collections; - legacyImportManager?.ImportFromStableAsync(importableContent) + legacyImportManager.ImportFromStableAsync(importableContent) .ContinueWith(t => Schedule(() => { if (t.IsCompletedSuccessfully) From 13e70eab515c2aeacec660fdf978908deb93e399 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 May 2022 20:37:38 +0900 Subject: [PATCH 1047/2328] Allow cancellation of count operations and bypassing interactive location logic --- osu.Game/Database/LegacyImportManager.cs | 35 +++++--- .../FirstRunSetup/ScreenImportFromStable.cs | 87 +++++++++++++++++-- 2 files changed, 107 insertions(+), 15 deletions(-) diff --git a/osu.Game/Database/LegacyImportManager.cs b/osu.Game/Database/LegacyImportManager.cs index a9f37fe4a7..9c436e8903 100644 --- a/osu.Game/Database/LegacyImportManager.cs +++ b/osu.Game/Database/LegacyImportManager.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using osu.Framework; using osu.Framework.Allocation; @@ -49,9 +50,14 @@ namespace osu.Game.Database public bool SupportsImportFromStable => RuntimeInfo.IsDesktop; - public async Task GetImportCount(StableContent content) + public async Task GetImportCount(StableContent content, CancellationToken cancellationToken) { - var stableStorage = await getStableStorage().ConfigureAwait(false); + var stableStorage = GetCurrentStableStorage(); + + if (stableStorage == null) + return 0; + + cancellationToken.ThrowIfCancellationRequested(); switch (content) { @@ -72,9 +78,22 @@ namespace osu.Game.Database } } - public async Task ImportFromStableAsync(StableContent content) + public async Task ImportFromStableAsync(StableContent content, bool interactiveLocateIfNotFound = true) { - var stableStorage = await getStableStorage().ConfigureAwait(false); + var stableStorage = GetCurrentStableStorage(); + + if (stableStorage == null) + { + if (!interactiveLocateIfNotFound) + return; + + var taskCompletionSource = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + Schedule(() => dialogOverlay.Push(new StableDirectoryLocationDialog(taskCompletionSource))); + string stablePath = await taskCompletionSource.Task.ConfigureAwait(false); + + stableStorage = cachedStorage = new StableStorage(stablePath, desktopGameHost); + } + var importTasks = new List(); Task beatmapImportTask = Task.CompletedTask; @@ -93,7 +112,7 @@ namespace osu.Game.Database await Task.WhenAll(importTasks.ToArray()).ConfigureAwait(false); } - private async Task getStableStorage() + public StableStorage GetCurrentStableStorage() { if (cachedStorage != null) return cachedStorage; @@ -102,11 +121,7 @@ namespace osu.Game.Database if (stableStorage != null) return cachedStorage = stableStorage; - var taskCompletionSource = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - Schedule(() => dialogOverlay.Push(new StableDirectoryLocationDialog(taskCompletionSource))); - string stablePath = await taskCompletionSource.Task.ConfigureAwait(false); - - return cachedStorage = new StableStorage(stablePath, desktopGameHost); + return null; } } diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs index 42a10854e8..e31f70b686 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -3,6 +3,8 @@ #nullable enable +using System.Linq; +using System.Threading; using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Graphics; @@ -10,6 +12,7 @@ using osu.Framework.Localisation; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Localisation; using osu.Game.Overlays.Settings; using osuTK; @@ -26,12 +29,16 @@ namespace osu.Game.Overlays.FirstRunSetup private SettingsCheckbox checkboxScores = null!; private SettingsCheckbox checkboxCollections = null!; + private OsuTextFlowContainer currentStablePath = null!; + [Resolved] private OsuColour colours { get; set; } = null!; [Resolved] private LegacyImportManager legacyImportManager { get; set; } = null!; + private CancellationTokenSource? stablePathUpdateCancellation; + [BackgroundDependencyLoader(permitNulls: true)] private void load() { @@ -47,6 +54,21 @@ namespace osu.Game.Overlays.FirstRunSetup RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, + currentStablePath = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: HEADER_FONT_SIZE, weight: FontWeight.SemiBold)) + { + Colour = OverlayColourProvider.Content2, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + }, + new RoundedButton + { + Size = buttonSize, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + BackgroundColour = colours.Blue3, + Text = "Locate osu!(stable) install", + Action = locateStable, + }, checkboxBeatmaps = new SettingsCheckbox { LabelText = "Beatmaps", @@ -78,10 +100,65 @@ namespace osu.Game.Overlays.FirstRunSetup }, }; - legacyImportManager.GetImportCount(StableContent.Beatmaps).ContinueWith(task => Schedule(() => checkboxBeatmaps.LabelText += $" ({task.GetResultSafely()} items)")); - legacyImportManager.GetImportCount(StableContent.Scores).ContinueWith(task => Schedule(() => checkboxScores.LabelText += $" ({task.GetResultSafely()} items)")); - legacyImportManager.GetImportCount(StableContent.Skins).ContinueWith(task => Schedule(() => checkboxSkins.LabelText += $" ({task.GetResultSafely()} items)")); - legacyImportManager.GetImportCount(StableContent.Collections).ContinueWith(task => Schedule(() => checkboxCollections.LabelText += $" ({task.GetResultSafely()} items)")); + updateStablePath(); + } + + private void locateStable() + { + legacyImportManager.ImportFromStableAsync(0).ContinueWith(task => + { + Schedule(updateStablePath); + }); + } + + private void updateStablePath() + { + stablePathUpdateCancellation?.Cancel(); + + var storage = legacyImportManager.GetCurrentStableStorage(); + + if (storage == null) + { + foreach (var c in Content.Children.OfType()) + c.Current.Disabled = true; + currentStablePath.Text = "No installation found"; + return; + } + + foreach (var c in Content.Children.OfType()) + c.Current.Disabled = false; + + currentStablePath.Text = storage.GetFullPath(string.Empty); + stablePathUpdateCancellation = new CancellationTokenSource(); + + legacyImportManager.GetImportCount(StableContent.Beatmaps, stablePathUpdateCancellation.Token).ContinueWith(task => Schedule(() => + { + if (task.IsCanceled) + return; + + checkboxBeatmaps.LabelText = $"Beatmaps ({task.GetResultSafely()} items)"; + })); + legacyImportManager.GetImportCount(StableContent.Scores, stablePathUpdateCancellation.Token).ContinueWith(task => Schedule(() => + { + if (task.IsCanceled) + return; + + checkboxScores.LabelText = $"Scores ({task.GetResultSafely()} items)"; + })); + legacyImportManager.GetImportCount(StableContent.Skins, stablePathUpdateCancellation.Token).ContinueWith(task => Schedule(() => + { + if (task.IsCanceled) + return; + + checkboxSkins.LabelText = $"Skins ({task.GetResultSafely()} items)"; + })); + legacyImportManager.GetImportCount(StableContent.Collections, stablePathUpdateCancellation.Token).ContinueWith(task => Schedule(() => + { + if (task.IsCanceled) + return; + + checkboxCollections.LabelText = $"Collections ({task.GetResultSafely()} items)"; + })); } private void runImport() @@ -95,7 +172,7 @@ namespace osu.Game.Overlays.FirstRunSetup if (checkboxSkins.Current.Value) importableContent |= StableContent.Skins; if (checkboxCollections.Current.Value) importableContent |= StableContent.Collections; - legacyImportManager.ImportFromStableAsync(importableContent) + legacyImportManager.ImportFromStableAsync(importableContent, false) .ContinueWith(t => Schedule(() => { if (t.IsCompletedSuccessfully) From 1593f05ff37c34bad7cc25b2f3d0d9ad9c84738d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 May 2022 20:53:04 +0900 Subject: [PATCH 1048/2328] Tidy up checkbox implementation --- .../FirstRunSetup/ScreenImportFromStable.cs | 134 ++++++++---------- 1 file changed, 63 insertions(+), 71 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs index e31f70b686..dd3580508a 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -3,6 +3,7 @@ #nullable enable +using System.Collections.Generic; using System.Linq; using System.Threading; using osu.Framework.Allocation; @@ -24,11 +25,6 @@ namespace osu.Game.Overlays.FirstRunSetup { private ProgressRoundedButton importButton = null!; - private SettingsCheckbox checkboxSkins = null!; - private SettingsCheckbox checkboxBeatmaps = null!; - private SettingsCheckbox checkboxScores = null!; - private SettingsCheckbox checkboxCollections = null!; - private OsuTextFlowContainer currentStablePath = null!; [Resolved] @@ -39,6 +35,8 @@ namespace osu.Game.Overlays.FirstRunSetup private CancellationTokenSource? stablePathUpdateCancellation; + private IEnumerable contentCheckboxes => Content.Children.OfType(); + [BackgroundDependencyLoader(permitNulls: true)] private void load() { @@ -69,26 +67,10 @@ namespace osu.Game.Overlays.FirstRunSetup Text = "Locate osu!(stable) install", Action = locateStable, }, - checkboxBeatmaps = new SettingsCheckbox - { - LabelText = "Beatmaps", - Current = { Value = true } - }, - checkboxScores = new SettingsCheckbox - { - LabelText = "Scores", - Current = { Value = true } - }, - checkboxSkins = new SettingsCheckbox - { - LabelText = "Skins", - Current = { Value = true } - }, - checkboxCollections = new SettingsCheckbox - { - LabelText = "Collections", - Current = { Value = true } - }, + new ImportCheckbox("Beatmaps", StableContent.Beatmaps), + new ImportCheckbox("Scores", StableContent.Scores), + new ImportCheckbox("Skins", StableContent.Skins), + new ImportCheckbox("Collections", StableContent.Collections), importButton = new ProgressRoundedButton { Size = buttonSize, @@ -119,46 +101,20 @@ namespace osu.Game.Overlays.FirstRunSetup if (storage == null) { - foreach (var c in Content.Children.OfType()) + foreach (var c in contentCheckboxes) c.Current.Disabled = true; currentStablePath.Text = "No installation found"; return; } - foreach (var c in Content.Children.OfType()) + foreach (var c in contentCheckboxes) + { c.Current.Disabled = false; + c.UpdateCount(); + } currentStablePath.Text = storage.GetFullPath(string.Empty); stablePathUpdateCancellation = new CancellationTokenSource(); - - legacyImportManager.GetImportCount(StableContent.Beatmaps, stablePathUpdateCancellation.Token).ContinueWith(task => Schedule(() => - { - if (task.IsCanceled) - return; - - checkboxBeatmaps.LabelText = $"Beatmaps ({task.GetResultSafely()} items)"; - })); - legacyImportManager.GetImportCount(StableContent.Scores, stablePathUpdateCancellation.Token).ContinueWith(task => Schedule(() => - { - if (task.IsCanceled) - return; - - checkboxScores.LabelText = $"Scores ({task.GetResultSafely()} items)"; - })); - legacyImportManager.GetImportCount(StableContent.Skins, stablePathUpdateCancellation.Token).ContinueWith(task => Schedule(() => - { - if (task.IsCanceled) - return; - - checkboxSkins.LabelText = $"Skins ({task.GetResultSafely()} items)"; - })); - legacyImportManager.GetImportCount(StableContent.Collections, stablePathUpdateCancellation.Token).ContinueWith(task => Schedule(() => - { - if (task.IsCanceled) - return; - - checkboxCollections.LabelText = $"Collections ({task.GetResultSafely()} items)"; - })); } private void runImport() @@ -167,22 +123,58 @@ namespace osu.Game.Overlays.FirstRunSetup StableContent importableContent = 0; - if (checkboxBeatmaps.Current.Value) importableContent |= StableContent.Beatmaps; - if (checkboxScores.Current.Value) importableContent |= StableContent.Scores; - if (checkboxSkins.Current.Value) importableContent |= StableContent.Skins; - if (checkboxCollections.Current.Value) importableContent |= StableContent.Collections; + foreach (var c in contentCheckboxes.Where(c => c.Current.Value)) + importableContent |= c.StableContent; - legacyImportManager.ImportFromStableAsync(importableContent, false) - .ContinueWith(t => Schedule(() => - { - if (t.IsCompletedSuccessfully) - importButton.Complete(); - else - { - importButton.Enabled.Value = true; - importButton.Abort(); - } - })); + legacyImportManager.ImportFromStableAsync(importableContent, false).ContinueWith(t => Schedule(() => + { + if (t.IsCompletedSuccessfully) + importButton.Complete(); + else + { + importButton.Enabled.Value = true; + importButton.Abort(); + } + })); + } + + private class ImportCheckbox : SettingsCheckbox + { + public readonly StableContent StableContent; + + private readonly LocalisableString title; + + [Resolved] + private LegacyImportManager legacyImportManager { get; set; } = null!; + + private CancellationTokenSource? countUpdateCancellation; + + public ImportCheckbox(LocalisableString title, StableContent stableContent) + { + this.title = title; + + StableContent = stableContent; + + Current.Value = true; + + LabelText = title; + } + + public void UpdateCount() + { + LabelText = LocalisableString.Interpolate($"{title} (calculating...)"); + + countUpdateCancellation?.Cancel(); + countUpdateCancellation = new CancellationTokenSource(); + + legacyImportManager.GetImportCount(StableContent, countUpdateCancellation.Token).ContinueWith(task => Schedule(() => + { + if (task.IsCanceled) + return; + + LabelText = LocalisableString.Interpolate($"{title} ({task.GetResultSafely()} items)"); + })); + } } } } From 4af1a788d14fadffcbd98953a769aacdd5b87d6a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 May 2022 21:07:42 +0900 Subject: [PATCH 1049/2328] Add locate stable button / screen --- osu.Game/Database/LegacyImportManager.cs | 5 +- .../FirstRunSetup/FirstRunSetupScreen.cs | 4 +- .../FirstRunSetup/ScreenImportFromStable.cs | 134 +++++++++++++++++- 3 files changed, 136 insertions(+), 7 deletions(-) diff --git a/osu.Game/Database/LegacyImportManager.cs b/osu.Game/Database/LegacyImportManager.cs index 9c436e8903..35b1d05fa1 100644 --- a/osu.Game/Database/LegacyImportManager.cs +++ b/osu.Game/Database/LegacyImportManager.cs @@ -50,6 +50,8 @@ namespace osu.Game.Database public bool SupportsImportFromStable => RuntimeInfo.IsDesktop; + public void UpdateStorage(string stablePath) => cachedStorage = new StableStorage(stablePath, desktopGameHost); + public async Task GetImportCount(StableContent content, CancellationToken cancellationToken) { var stableStorage = GetCurrentStableStorage(); @@ -91,7 +93,8 @@ namespace osu.Game.Database Schedule(() => dialogOverlay.Push(new StableDirectoryLocationDialog(taskCompletionSource))); string stablePath = await taskCompletionSource.Task.ConfigureAwait(false); - stableStorage = cachedStorage = new StableStorage(stablePath, desktopGameHost); + UpdateStorage(stablePath); + stableStorage = GetCurrentStableStorage(); } var importTasks = new List(); diff --git a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs index d1ea91e51a..b043f05bd8 100644 --- a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs +++ b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs @@ -21,6 +21,8 @@ namespace osu.Game.Overlays.FirstRunSetup protected const float CONTENT_FONT_SIZE = 16; + protected const float CONTENT_PADDING = 30; + protected const float HEADER_FONT_SIZE = 24; [Resolved] @@ -41,7 +43,7 @@ namespace osu.Game.Overlays.FirstRunSetup { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Horizontal = 30 }, + Padding = new MarginPadding { Horizontal = CONTENT_PADDING }, Children = new Drawable[] { new OsuSpriteText diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs index dd3580508a..acc0fdbb7c 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -4,19 +4,24 @@ #nullable enable using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading; using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Localisation; +using osu.Framework.Screens; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.IO; using osu.Game.Localisation; using osu.Game.Overlays.Settings; using osuTK; +using CommonStrings = osu.Game.Resources.Localisation.Web.CommonStrings; namespace osu.Game.Overlays.FirstRunSetup { @@ -24,6 +29,7 @@ namespace osu.Game.Overlays.FirstRunSetup public class ScreenImportFromStable : FirstRunSetupScreen { private ProgressRoundedButton importButton = null!; + private RoundedButton locateStableButton = null!; private OsuTextFlowContainer currentStablePath = null!; @@ -58,7 +64,7 @@ namespace osu.Game.Overlays.FirstRunSetup RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, }, - new RoundedButton + locateStableButton = new RoundedButton { Size = buttonSize, Anchor = Anchor.TopCentre, @@ -85,12 +91,15 @@ namespace osu.Game.Overlays.FirstRunSetup updateStablePath(); } - private void locateStable() + private void locateStable() => this.Push(new LocateStableScreen()); + + public override void OnResuming(ScreenTransitionEvent e) { - legacyImportManager.ImportFromStableAsync(0).ContinueWith(task => - { + base.OnResuming(e); + + if (e.Last is LocateStableScreen) + // stable storage may have changed. Schedule(updateStablePath); - }); } private void updateStablePath() @@ -120,6 +129,7 @@ namespace osu.Game.Overlays.FirstRunSetup private void runImport() { importButton.Enabled.Value = false; + locateStableButton.Enabled.Value = false; StableContent importableContent = 0; @@ -128,6 +138,8 @@ namespace osu.Game.Overlays.FirstRunSetup legacyImportManager.ImportFromStableAsync(importableContent, false).ContinueWith(t => Schedule(() => { + locateStableButton.Enabled.Value = true; + if (t.IsCompletedSuccessfully) importButton.Complete(); else @@ -176,5 +188,117 @@ namespace osu.Game.Overlays.FirstRunSetup })); } } + + private class LocateStableScreen : FirstRunSetupScreen + { + private RoundedButton selectionButton = null!; + + private OsuDirectorySelector directorySelector = null!; + + protected bool IsValidDirectory(DirectoryInfo? info) => info?.GetFiles("osu!.*.cfg").Any() ?? false; + + public LocalisableString HeaderText => "Please select your osu!stable install location"; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + // Don't want the scroll content provided by `FirstRunSetupScreen` so we don't use `Content`. + InternalChild = new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Horizontal = CONTENT_PADDING }, + Children = new Drawable[] + { + new GridContainer + { + RelativeSizeAxes = Axes.Both, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize), + new Dimension(), + new Dimension(GridSizeMode.AutoSize), + }, + Content = new[] + { + new Drawable[] + { + new OsuTextFlowContainer(cp => + { + cp.Font = OsuFont.Default.With(size: 24); + }) + { + Text = HeaderText, + TextAnchor = Anchor.TopCentre, + Margin = new MarginPadding(10), + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + } + }, + new Drawable[] + { + directorySelector = new OsuDirectorySelector + { + RelativeSizeAxes = Axes.Both, + } + }, + new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + new RoundedButton + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Width = 300, + Margin = new MarginPadding(10), + Colour = colours.Pink2, + Text = CommonStrings.ButtonsCancel, + Action = this.Exit + }, + selectionButton = new RoundedButton + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Width = 300, + Margin = new MarginPadding(10), + Text = MaintenanceSettingsStrings.SelectDirectory, + Action = () => + { + legacyImportManager.UpdateStorage(directorySelector.CurrentPath.Value.FullName); + this.Exit(); + } + }, + } + }, + } + } + } + } + }; + } + + [Resolved] + private LegacyImportManager legacyImportManager { get; set; } = null!; + + protected override void LoadComplete() + { + if (legacyImportManager.GetCurrentStableStorage() is StableStorage storage) + directorySelector.CurrentPath.Value = new DirectoryInfo(storage.GetFullPath(string.Empty)); + + directorySelector.CurrentPath.BindValueChanged(e => selectionButton.Enabled.Value = e.NewValue != null && IsValidDirectory(e.NewValue), true); + base.LoadComplete(); + } + + public override void OnSuspending(ScreenTransitionEvent e) + { + base.OnSuspending(e); + + this.FadeOut(250); + } + } } } From 98e5ad44a71a090476a55ba40d7a0dfbb67cc327 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 May 2022 21:24:36 +0900 Subject: [PATCH 1050/2328] Add `OverlayColourProvider` support to `OsuDirectorySelector` --- .../UserInterfaceV2/OsuDirectorySelectorDirectory.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorDirectory.cs b/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorDirectory.cs index ce2e7794a9..456bde6d1b 100644 --- a/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorDirectory.cs +++ b/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorDirectory.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; namespace osu.Game.Graphics.UserInterfaceV2 { @@ -44,8 +45,8 @@ namespace osu.Game.Graphics.UserInterfaceV2 internal class Background : CompositeDrawable { - [BackgroundDependencyLoader] - private void load(OsuColour colours) + [BackgroundDependencyLoader(true)] + private void load(OverlayColourProvider overlayColourProvider, OsuColour colours) { RelativeSizeAxes = Axes.Both; @@ -54,7 +55,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 InternalChild = new Box { - Colour = colours.GreySeaFoamDarker, + Colour = overlayColourProvider?.Background5 ?? colours.GreySeaFoamDarker, RelativeSizeAxes = Axes.Both, }; } From e2ea98693f8761ba0fc0fd76f786963d434eba5e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 May 2022 21:33:15 +0900 Subject: [PATCH 1051/2328] Tidy up buttons and text --- .../FirstRunSetup/ScreenImportFromStable.cs | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs index acc0fdbb7c..f867adff79 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -28,6 +28,8 @@ namespace osu.Game.Overlays.FirstRunSetup [LocalisableDescription(typeof(FirstRunSetupOverlayStrings), nameof(FirstRunSetupOverlayStrings.ImportTitle))] public class ScreenImportFromStable : FirstRunSetupScreen { + private static readonly Vector2 button_size = new Vector2(400, 50); + private ProgressRoundedButton importButton = null!; private RoundedButton locateStableButton = null!; @@ -46,8 +48,6 @@ namespace osu.Game.Overlays.FirstRunSetup [BackgroundDependencyLoader(permitNulls: true)] private void load() { - Vector2 buttonSize = new Vector2(400, 50); - Content.Children = new Drawable[] { new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) @@ -63,14 +63,14 @@ namespace osu.Game.Overlays.FirstRunSetup Colour = OverlayColourProvider.Content2, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + TextAnchor = Anchor.Centre, }, locateStableButton = new RoundedButton { - Size = buttonSize, + Size = button_size, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - BackgroundColour = colours.Blue3, - Text = "Locate osu!(stable) install", + Text = "Change location", Action = locateStable, }, new ImportCheckbox("Beatmaps", StableContent.Beatmaps), @@ -79,10 +79,9 @@ namespace osu.Game.Overlays.FirstRunSetup new ImportCheckbox("Collections", StableContent.Collections), importButton = new ProgressRoundedButton { - Size = buttonSize, + Size = button_size, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - BackgroundColour = colours.Blue3, Text = FirstRunSetupOverlayStrings.ImportContentFromStable, Action = runImport }, @@ -112,7 +111,10 @@ namespace osu.Game.Overlays.FirstRunSetup { foreach (var c in contentCheckboxes) c.Current.Disabled = true; + currentStablePath.FadeColour(colours.Red1, 500, Easing.OutQuint); currentStablePath.Text = "No installation found"; + + importButton.Enabled.Value = false; return; } @@ -122,8 +124,10 @@ namespace osu.Game.Overlays.FirstRunSetup c.UpdateCount(); } - currentStablePath.Text = storage.GetFullPath(string.Empty); + currentStablePath.FadeColour(OverlayColourProvider.Content2); + currentStablePath.Text = $"Found installation: {storage.GetFullPath(string.Empty)}"; stablePathUpdateCancellation = new CancellationTokenSource(); + importButton.Enabled.Value = true; } private void runImport() @@ -138,13 +142,12 @@ namespace osu.Game.Overlays.FirstRunSetup legacyImportManager.ImportFromStableAsync(importableContent, false).ContinueWith(t => Schedule(() => { - locateStableButton.Enabled.Value = true; - if (t.IsCompletedSuccessfully) importButton.Complete(); else { importButton.Enabled.Value = true; + locateStableButton.Enabled.Value = true; importButton.Abort(); } })); @@ -253,9 +256,11 @@ namespace osu.Game.Overlays.FirstRunSetup { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Width = 300, + RelativeSizeAxes = Axes.X, + Width = 0.45f, + Height = button_size.Y, Margin = new MarginPadding(10), - Colour = colours.Pink2, + BackgroundColour = colours.Pink2, Text = CommonStrings.ButtonsCancel, Action = this.Exit }, @@ -263,7 +268,9 @@ namespace osu.Game.Overlays.FirstRunSetup { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Width = 300, + RelativeSizeAxes = Axes.X, + Width = 0.45f, + Height = button_size.Y, Margin = new MarginPadding(10), Text = MaintenanceSettingsStrings.SelectDirectory, Action = () => From 8112416335429ee4d18475887d88c40558fd6c1c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 May 2022 15:25:45 +0900 Subject: [PATCH 1052/2328] Assert that downloads are queued early enough to work --- osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs index df0a69cb25..84903d381a 100644 --- a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs +++ b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs @@ -3,9 +3,11 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Text.RegularExpressions; using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Database; using osu.Game.Online; @@ -89,6 +91,8 @@ namespace osu.Game.Beatmaps.Drawables private void queueDownloads(string[] sourceFilenames, int? limit = null) { + Debug.Assert(LoadState == LoadState.NotLoaded); + try { // Matches osu-stable, in order to provide new users with roughly the same randomised selection of bundled beatmaps. From 3ff0399281f2f2ca0b5356aa08c48133623962db Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 May 2022 16:32:31 +0900 Subject: [PATCH 1053/2328] Split out `LabelledTextBoxWithPopover` for reuse --- .../Edit/Setup/FileChooserLabelledTextBox.cs | 37 +------------- .../Edit/Setup/LabelledTextBoxWithPopover.cs | 49 +++++++++++++++++++ 2 files changed, 51 insertions(+), 35 deletions(-) create mode 100644 osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs diff --git a/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs b/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs index d1e35ae20d..aae19396db 100644 --- a/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs @@ -11,11 +11,8 @@ using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.Events; using osu.Game.Database; -using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterfaceV2; using osuTK; @@ -24,7 +21,7 @@ namespace osu.Game.Screens.Edit.Setup /// /// A labelled textbox which reveals an inline file chooser when clicked. /// - internal class FileChooserLabelledTextBox : LabelledTextBox, ICanAcceptFiles, IHasPopover + internal class FileChooserLabelledTextBox : LabelledTextBoxWithPopover, ICanAcceptFiles { private readonly string[] handledExtensions; @@ -40,16 +37,6 @@ namespace osu.Game.Screens.Edit.Setup this.handledExtensions = handledExtensions; } - protected override OsuTextBox CreateTextBox() => - new FileChooserOsuTextBox - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.X, - CornerRadius = CORNER_RADIUS, - OnFocused = this.ShowPopover - }; - protected override void LoadComplete() { base.LoadComplete(); @@ -81,27 +68,7 @@ namespace osu.Game.Screens.Edit.Setup game.UnregisterImportHandler(this); } - internal class FileChooserOsuTextBox : OsuTextBox - { - public Action OnFocused; - - protected override bool OnDragStart(DragStartEvent e) - { - // This text box is intended to be "read only" without actually specifying that. - // As such we don't want to allow the user to select its content with a drag. - return false; - } - - protected override void OnFocus(FocusEvent e) - { - OnFocused?.Invoke(); - base.OnFocus(e); - - GetContainingInputManager().TriggerFocusContention(this); - } - } - - public Popover GetPopover() => new FileChooserPopover(handledExtensions, currentFile); + public override Popover GetPopover() => new FileChooserPopover(handledExtensions, currentFile); private class FileChooserPopover : OsuPopover { diff --git a/osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs b/osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs new file mode 100644 index 0000000000..1136675347 --- /dev/null +++ b/osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs @@ -0,0 +1,49 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input.Events; +using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; + +namespace osu.Game.Screens.Edit.Setup +{ + internal abstract class LabelledTextBoxWithPopover : LabelledTextBox, IHasPopover + { + public abstract Popover GetPopover(); + + protected override OsuTextBox CreateTextBox() => + new PopoverTextBox + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + CornerRadius = CORNER_RADIUS, + OnFocused = this.ShowPopover + }; + + internal class PopoverTextBox : OsuTextBox + { + public Action OnFocused; + + protected override bool OnDragStart(DragStartEvent e) + { + // This text box is intended to be "read only" without actually specifying that. + // As such we don't want to allow the user to select its content with a drag. + return false; + } + + protected override void OnFocus(FocusEvent e) + { + OnFocused?.Invoke(); + base.OnFocus(e); + + GetContainingInputManager().TriggerFocusContention(this); + } + } + } +} From adc7b61240c55d9b2bec397f1a05a1427cf56558 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 May 2022 16:33:02 +0900 Subject: [PATCH 1054/2328] Switch directory selector to use a semi-shared popover implementation --- .../FirstRunSetup/ScreenImportFromStable.cs | 226 +++++++----------- osu.Game/Overlays/FirstRunSetupOverlay.cs | 3 +- 2 files changed, 86 insertions(+), 143 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs index f867adff79..8b7550e301 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -3,25 +3,27 @@ #nullable enable +using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; +using System.Threading.Tasks; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Localisation; -using osu.Framework.Screens; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterfaceV2; -using osu.Game.IO; using osu.Game.Localisation; using osu.Game.Overlays.Settings; +using osu.Game.Screens.Edit.Setup; using osuTK; -using CommonStrings = osu.Game.Resources.Localisation.Web.CommonStrings; namespace osu.Game.Overlays.FirstRunSetup { @@ -31,18 +33,14 @@ namespace osu.Game.Overlays.FirstRunSetup private static readonly Vector2 button_size = new Vector2(400, 50); private ProgressRoundedButton importButton = null!; - private RoundedButton locateStableButton = null!; - - private OsuTextFlowContainer currentStablePath = null!; - - [Resolved] - private OsuColour colours { get; set; } = null!; [Resolved] private LegacyImportManager legacyImportManager { get; set; } = null!; private CancellationTokenSource? stablePathUpdateCancellation; + private StableLocatorLabelledTextBox stableLocatorTextBox = null!; + private IEnumerable contentCheckboxes => Content.Children.OfType(); [BackgroundDependencyLoader(permitNulls: true)] @@ -58,20 +56,10 @@ namespace osu.Game.Overlays.FirstRunSetup RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, - currentStablePath = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: HEADER_FONT_SIZE, weight: FontWeight.SemiBold)) + stableLocatorTextBox = new StableLocatorLabelledTextBox { - Colour = OverlayColourProvider.Content2, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - TextAnchor = Anchor.Centre, - }, - locateStableButton = new RoundedButton - { - Size = button_size, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Text = "Change location", - Action = locateStable, + Label = "previous osu! install", + PlaceholderText = "Click to locate a previous osu! install" }, new ImportCheckbox("Beatmaps", StableContent.Beatmaps), new ImportCheckbox("Scores", StableContent.Scores), @@ -87,18 +75,7 @@ namespace osu.Game.Overlays.FirstRunSetup }, }; - updateStablePath(); - } - - private void locateStable() => this.Push(new LocateStableScreen()); - - public override void OnResuming(ScreenTransitionEvent e) - { - base.OnResuming(e); - - if (e.Last is LocateStableScreen) - // stable storage may have changed. - Schedule(updateStablePath); + stableLocatorTextBox.Current.BindValueChanged(_ => updateStablePath(), true); } private void updateStablePath() @@ -111,9 +88,8 @@ namespace osu.Game.Overlays.FirstRunSetup { foreach (var c in contentCheckboxes) c.Current.Disabled = true; - currentStablePath.FadeColour(colours.Red1, 500, Easing.OutQuint); - currentStablePath.Text = "No installation found"; + stableLocatorTextBox.Current.Value = string.Empty; importButton.Enabled.Value = false; return; } @@ -124,8 +100,8 @@ namespace osu.Game.Overlays.FirstRunSetup c.UpdateCount(); } - currentStablePath.FadeColour(OverlayColourProvider.Content2); - currentStablePath.Text = $"Found installation: {storage.GetFullPath(string.Empty)}"; + stableLocatorTextBox.Current.Value = storage.GetFullPath(string.Empty); + stablePathUpdateCancellation = new CancellationTokenSource(); importButton.Enabled.Value = true; } @@ -133,7 +109,7 @@ namespace osu.Game.Overlays.FirstRunSetup private void runImport() { importButton.Enabled.Value = false; - locateStableButton.Enabled.Value = false; + stableLocatorTextBox.Current.Disabled = true; StableContent importableContent = 0; @@ -147,7 +123,7 @@ namespace osu.Game.Overlays.FirstRunSetup else { importButton.Enabled.Value = true; - locateStableButton.Enabled.Value = true; + stableLocatorTextBox.Current.Disabled = false; importButton.Abort(); } })); @@ -192,119 +168,85 @@ namespace osu.Game.Overlays.FirstRunSetup } } - private class LocateStableScreen : FirstRunSetupScreen + internal class StableLocatorLabelledTextBox : LabelledTextBoxWithPopover, ICanAcceptFiles { - private RoundedButton selectionButton = null!; - - private OsuDirectorySelector directorySelector = null!; - - protected bool IsValidDirectory(DirectoryInfo? info) => info?.GetFiles("osu!.*.cfg").Any() ?? false; - - public LocalisableString HeaderText => "Please select your osu!stable install location"; - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - // Don't want the scroll content provided by `FirstRunSetupScreen` so we don't use `Content`. - InternalChild = new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Horizontal = CONTENT_PADDING }, - Children = new Drawable[] - { - new GridContainer - { - RelativeSizeAxes = Axes.Both, - RowDimensions = new[] - { - new Dimension(GridSizeMode.AutoSize), - new Dimension(), - new Dimension(GridSizeMode.AutoSize), - }, - Content = new[] - { - new Drawable[] - { - new OsuTextFlowContainer(cp => - { - cp.Font = OsuFont.Default.With(size: 24); - }) - { - Text = HeaderText, - TextAnchor = Anchor.TopCentre, - Margin = new MarginPadding(10), - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - } - }, - new Drawable[] - { - directorySelector = new OsuDirectorySelector - { - RelativeSizeAxes = Axes.Both, - } - }, - new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Children = new Drawable[] - { - new RoundedButton - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - RelativeSizeAxes = Axes.X, - Width = 0.45f, - Height = button_size.Y, - Margin = new MarginPadding(10), - BackgroundColour = colours.Pink2, - Text = CommonStrings.ButtonsCancel, - Action = this.Exit - }, - selectionButton = new RoundedButton - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - RelativeSizeAxes = Axes.X, - Width = 0.45f, - Height = button_size.Y, - Margin = new MarginPadding(10), - Text = MaintenanceSettingsStrings.SelectDirectory, - Action = () => - { - legacyImportManager.UpdateStorage(directorySelector.CurrentPath.Value.FullName); - this.Exit(); - } - }, - } - }, - } - } - } - } - }; - } - [Resolved] private LegacyImportManager legacyImportManager { get; set; } = null!; + // TODO: test + public IEnumerable HandledExtensions { get; } = new[] { string.Empty }; + + private readonly Bindable currentDirectory = new Bindable(); + + [Resolved] + private OsuGameBase game { get; set; } = null!; + protected override void LoadComplete() { - if (legacyImportManager.GetCurrentStableStorage() is StableStorage storage) - directorySelector.CurrentPath.Value = new DirectoryInfo(storage.GetFullPath(string.Empty)); - - directorySelector.CurrentPath.BindValueChanged(e => selectionButton.Enabled.Value = e.NewValue != null && IsValidDirectory(e.NewValue), true); base.LoadComplete(); + + game.RegisterImportHandler(this); + + currentDirectory.BindValueChanged(onDirectorySelected); + + string? fullPath = legacyImportManager.GetCurrentStableStorage()?.GetFullPath(string.Empty); + if (fullPath != null) + currentDirectory.Value = new DirectoryInfo(fullPath); } - public override void OnSuspending(ScreenTransitionEvent e) + private void onDirectorySelected(ValueChangedEvent directory) { - base.OnSuspending(e); + if (directory.NewValue == null || directory.OldValue == null) + { + Current.Value = string.Empty; + return; + } - this.FadeOut(250); + // DirectorySelectors can trigger a noop value changed, but `DirectoryInfo` equality doesn't catch this. + if (directory.OldValue.FullName == directory.NewValue.FullName) + return; + + if (directory.NewValue?.GetFiles(@"osu!.*.cfg").Any() ?? false) + { + this.HidePopover(); + + string path = directory.NewValue.FullName; + + legacyImportManager.UpdateStorage(path); + Current.Value = path; + } + } + + Task ICanAcceptFiles.Import(params string[] paths) + { + Schedule(() => currentDirectory.Value = new DirectoryInfo(paths.First())); + return Task.CompletedTask; + } + + Task ICanAcceptFiles.Import(params ImportTask[] tasks) => throw new NotImplementedException(); + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + game.UnregisterImportHandler(this); + } + + public override Popover GetPopover() => new DirectoryChooserPopover(currentDirectory); + + private class DirectoryChooserPopover : OsuPopover + { + public DirectoryChooserPopover(Bindable currentDirectory) + { + Child = new Container + { + Size = new Vector2(600, 400), + Child = new OsuDirectorySelector(currentDirectory.Value?.FullName) + { + RelativeSizeAxes = Axes.Both, + CurrentPath = { BindTarget = currentDirectory } + }, + }; + } } } } diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index dae2815e98..890f17b013 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -11,6 +11,7 @@ using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; @@ -88,7 +89,7 @@ namespace osu.Game.Overlays MainAreaContent.AddRange(new Drawable[] { - content = new Container + content = new PopoverContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, From 30fdbc3de070fffecdf6e7666de15b4e6e264b42 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 May 2022 16:55:41 +0900 Subject: [PATCH 1055/2328] Add safety against calling `GetStableImportPaths` when path doesn't exist --- osu.Game/Database/LegacyModelImporter.cs | 10 ++++++++-- osu.Game/Database/LegacyScoreImporter.cs | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/osu.Game/Database/LegacyModelImporter.cs b/osu.Game/Database/LegacyModelImporter.cs index a6e0f5bf8b..13a9025ece 100644 --- a/osu.Game/Database/LegacyModelImporter.cs +++ b/osu.Game/Database/LegacyModelImporter.cs @@ -24,8 +24,14 @@ namespace osu.Game.Database /// /// Select paths to import from stable where all paths should be absolute. Default implementation iterates all directories in . /// - protected virtual IEnumerable GetStableImportPaths(Storage storage) => storage.GetDirectories(ImportFromStablePath) - .Select(path => storage.GetFullPath(path)); + protected virtual IEnumerable GetStableImportPaths(Storage storage) + { + if (!storage.ExistsDirectory(ImportFromStablePath)) + return Enumerable.Empty(); + + return storage.GetDirectories(ImportFromStablePath) + .Select(path => storage.GetFullPath(path)); + } protected readonly IModelImporter Importer; diff --git a/osu.Game/Database/LegacyScoreImporter.cs b/osu.Game/Database/LegacyScoreImporter.cs index 48445b7bdb..131b4ffb0e 100644 --- a/osu.Game/Database/LegacyScoreImporter.cs +++ b/osu.Game/Database/LegacyScoreImporter.cs @@ -15,8 +15,14 @@ namespace osu.Game.Database protected override string ImportFromStablePath => Path.Combine("Data", "r"); protected override IEnumerable GetStableImportPaths(Storage storage) - => storage.GetFiles(ImportFromStablePath).Where(p => Importer.HandledExtensions.Any(ext => Path.GetExtension(p)?.Equals(ext, StringComparison.OrdinalIgnoreCase) ?? false)) - .Select(path => storage.GetFullPath(path)); + { + if (!storage.ExistsDirectory(ImportFromStablePath)) + return Enumerable.Empty(); + + return storage.GetFiles(ImportFromStablePath) + .Where(p => Importer.HandledExtensions.Any(ext => Path.GetExtension(p)?.Equals(ext, StringComparison.OrdinalIgnoreCase) ?? false)) + .Select(path => storage.GetFullPath(path)); + } public LegacyScoreImporter(IModelImporter importer) : base(importer) From 03d3900a02ede396fe0fa0eb095b2579586fde66 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 May 2022 17:12:10 +0900 Subject: [PATCH 1056/2328] Fix incorrect default state of checkboxes --- osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs index 8b7550e301..7791c3614e 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -146,6 +146,7 @@ namespace osu.Game.Overlays.FirstRunSetup StableContent = stableContent; + Current.Default = true; Current.Value = true; LabelText = title; From 17e0105c2cff5b17aefd5f9b52c1dd29d6b9482c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 May 2022 17:26:26 +0900 Subject: [PATCH 1057/2328] Fix interaction with popover when textbox is disabled --- osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs b/osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs index 1136675347..799311dd2d 100644 --- a/osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs +++ b/osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs @@ -39,6 +39,9 @@ namespace osu.Game.Screens.Edit.Setup protected override void OnFocus(FocusEvent e) { + if (Current.Disabled) + return; + OnFocused?.Invoke(); base.OnFocus(e); From c0de1f96ff2158a293fc546a11b729d84ea4df77 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 May 2022 17:26:44 +0900 Subject: [PATCH 1058/2328] Tidy up interaction toggling and add progress message --- .../FirstRunSetupOverlayStrings.cs | 4 +- .../FirstRunSetup/ScreenImportFromStable.cs | 42 ++++++++++++------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs index 6b5ca7534d..181e35e4ce 100644 --- a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs +++ b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs @@ -80,9 +80,9 @@ We recommend you give the new defaults a try, but if you'd like to have things f public static LocalisableString ImportTitle => new TranslatableString(getKey(@"import_title"), @"Import"); /// - /// "Import content from stable" + /// "Import content from previous version" /// - public static LocalisableString ImportContentFromStable => new TranslatableString(getKey(@"import_content_from_stable"), @"Import content from osu!(stable)"); + public static LocalisableString ImportContentFromPreviousVersion => new TranslatableString(getKey(@"import_content_from_previous_version"), @"Import content from previous version"); private static string getKey(string key) => $@"{prefix}:{key}"; } diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs index 7791c3614e..3b3cf4caf7 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -34,11 +34,11 @@ namespace osu.Game.Overlays.FirstRunSetup private ProgressRoundedButton importButton = null!; + private OsuTextFlowContainer progressText = null!; + [Resolved] private LegacyImportManager legacyImportManager { get; set; } = null!; - private CancellationTokenSource? stablePathUpdateCancellation; - private StableLocatorLabelledTextBox stableLocatorTextBox = null!; private IEnumerable contentCheckboxes => Content.Children.OfType(); @@ -70,9 +70,18 @@ namespace osu.Game.Overlays.FirstRunSetup Size = button_size, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = FirstRunSetupOverlayStrings.ImportContentFromStable, + Text = FirstRunSetupOverlayStrings.ImportContentFromPreviousVersion, Action = runImport }, + progressText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) + { + Colour = OverlayColourProvider.Content1, + Text = + "Your import will continue in the background. Check on its progress in the notifications sidebar!", + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Alpha = 0, + }, }; stableLocatorTextBox.Current.BindValueChanged(_ => updateStablePath(), true); @@ -80,17 +89,14 @@ namespace osu.Game.Overlays.FirstRunSetup private void updateStablePath() { - stablePathUpdateCancellation?.Cancel(); - var storage = legacyImportManager.GetCurrentStableStorage(); if (storage == null) { - foreach (var c in contentCheckboxes) - c.Current.Disabled = true; + allowInteraction(false); + stableLocatorTextBox.Current.Disabled = false; stableLocatorTextBox.Current.Value = string.Empty; - importButton.Enabled.Value = false; return; } @@ -100,16 +106,15 @@ namespace osu.Game.Overlays.FirstRunSetup c.UpdateCount(); } + allowInteraction(true); stableLocatorTextBox.Current.Value = storage.GetFullPath(string.Empty); - - stablePathUpdateCancellation = new CancellationTokenSource(); importButton.Enabled.Value = true; } private void runImport() { - importButton.Enabled.Value = false; - stableLocatorTextBox.Current.Disabled = true; + allowInteraction(false); + progressText.FadeIn(1000, Easing.OutQuint); StableContent importableContent = 0; @@ -118,17 +123,26 @@ namespace osu.Game.Overlays.FirstRunSetup legacyImportManager.ImportFromStableAsync(importableContent, false).ContinueWith(t => Schedule(() => { + progressText.FadeOut(500, Easing.OutQuint); + if (t.IsCompletedSuccessfully) importButton.Complete(); else { - importButton.Enabled.Value = true; - stableLocatorTextBox.Current.Disabled = false; + allowInteraction(true); importButton.Abort(); } })); } + private void allowInteraction(bool allow) + { + importButton.Enabled.Value = allow; + stableLocatorTextBox.Current.Disabled = !allow; + foreach (var c in contentCheckboxes) + c.Current.Disabled = !allow; + } + private class ImportCheckbox : SettingsCheckbox { public readonly StableContent StableContent; From 83e781d5a1ef9da5e3c0d6f071ca33c44df20279 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 May 2022 17:42:46 +0900 Subject: [PATCH 1059/2328] Allow localisation of `PlaceholderText` --- osu.Game/Graphics/UserInterfaceV2/LabelledTextBox.cs | 3 ++- .../Edit/Compose/Components/Timeline/SamplePointPiece.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterfaceV2/LabelledTextBox.cs b/osu.Game/Graphics/UserInterfaceV2/LabelledTextBox.cs index fd64cc2056..82b9fe559f 100644 --- a/osu.Game/Graphics/UserInterfaceV2/LabelledTextBox.cs +++ b/osu.Game/Graphics/UserInterfaceV2/LabelledTextBox.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; +using osu.Framework.Localisation; using osu.Game.Graphics.UserInterface; namespace osu.Game.Graphics.UserInterfaceV2 @@ -25,7 +26,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 set => Component.ReadOnly = value; } - public string PlaceholderText + public LocalisableString PlaceholderText { set => Component.PlaceholderText = value; } diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index ab21a83c43..9abea73f6b 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -154,7 +154,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline private void updateBankPlaceholderText(IEnumerable objects) { string? commonBank = getCommonBank(objects.Select(h => h.SampleControlPoint).ToArray()); - bank.PlaceholderText = string.IsNullOrEmpty(commonBank) ? "(multiple)" : null; + bank.PlaceholderText = string.IsNullOrEmpty(commonBank) ? "(multiple)" : string.Empty; } private void updateVolumeFor(IEnumerable objects, int? newVolume) From f4e0ad8c4c87c41454ce28033f150569fa01174a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 May 2022 17:51:28 +0900 Subject: [PATCH 1060/2328] Fix drag drop of osu! folder not working as expected --- osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs index 3b3cf4caf7..b145dadd39 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -211,14 +211,14 @@ namespace osu.Game.Overlays.FirstRunSetup private void onDirectorySelected(ValueChangedEvent directory) { - if (directory.NewValue == null || directory.OldValue == null) + if (directory.NewValue == null) { Current.Value = string.Empty; return; } // DirectorySelectors can trigger a noop value changed, but `DirectoryInfo` equality doesn't catch this. - if (directory.OldValue.FullName == directory.NewValue.FullName) + if (directory.OldValue?.FullName == directory.NewValue.FullName) return; if (directory.NewValue?.GetFiles(@"osu!.*.cfg").Any() ?? false) From bf00b062ad05b000f5cb955881494c6da57ece9e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 May 2022 17:58:24 +0900 Subject: [PATCH 1061/2328] Add full localisation of import beatmaps screen --- ...RunOverlayImportFromStableScreenStrings.cs | 56 +++++++++++++++++++ .../FirstRunSetupOverlayStrings.cs | 10 ---- .../FirstRunSetup/ScreenImportFromStable.cs | 20 +++---- 3 files changed, 66 insertions(+), 20 deletions(-) create mode 100644 osu.Game/Localisation/FirstRunOverlayImportFromStableScreenStrings.cs diff --git a/osu.Game/Localisation/FirstRunOverlayImportFromStableScreenStrings.cs b/osu.Game/Localisation/FirstRunOverlayImportFromStableScreenStrings.cs new file mode 100644 index 0000000000..deac7d8628 --- /dev/null +++ b/osu.Game/Localisation/FirstRunOverlayImportFromStableScreenStrings.cs @@ -0,0 +1,56 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Localisation; + +namespace osu.Game.Localisation +{ + public static class FirstRunOverlayImportFromStableScreenStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.ScreenImportFromStable"; + + /// + /// "Import" + /// + public static LocalisableString Header => new TranslatableString(getKey(@"header"), @"Import"); + + /// + /// "If you have an installation of a previous osu! version, you can choose to migrate your existing content. Note that this will create a copy, and not affect your existing installation." + /// + public static LocalisableString Description => new TranslatableString(getKey(@"description"), + @"If you have an installation of a previous osu! version, you can choose to migrate your existing content. Note that this will create a copy, and not affect your existing installation."); + + /// + /// "previous osu! install" + /// + public static LocalisableString LocateDirectoryLabel => new TranslatableString(getKey(@"locate_directory_label"), @"previous osu! install"); + + /// + /// "Click to locate a previous osu! install" + /// + public static LocalisableString LocateDirectoryPlaceholder => new TranslatableString(getKey(@"locate_directory_placeholder"), @"Click to locate a previous osu! install"); + + /// + /// "Import content from previous version" + /// + public static LocalisableString ImportButton => new TranslatableString(getKey(@"import_button"), @"Import content from previous version"); + + /// + /// "Your import will continue in the background. Check on its progress in the notifications sidebar!" + /// + public static LocalisableString ImportInProgress => + new TranslatableString(getKey(@"import_in_progress"), @"Your import will continue in the background. Check on its progress in the notifications sidebar!"); + + /// + /// "calculating..." + /// + public static LocalisableString Calculating => new TranslatableString(getKey(@"calculating"), @"calculating..."); + + /// + /// "{0} items" + /// + public static LocalisableString Items(int arg0) => new TranslatableString(getKey(@"items"), @"{0} item(s)", arg0); + + private static string getKey(string key) => $@"{prefix}:{key}"; + } +} diff --git a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs index 181e35e4ce..91b427e2ca 100644 --- a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs +++ b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs @@ -74,16 +74,6 @@ We recommend you give the new defaults a try, but if you'd like to have things f ///
public static LocalisableString ClassicDefaults => new TranslatableString(getKey(@"classic_defaults"), @"Classic defaults"); - /// - /// "Welcome" - /// - public static LocalisableString ImportTitle => new TranslatableString(getKey(@"import_title"), @"Import"); - - /// - /// "Import content from previous version" - /// - public static LocalisableString ImportContentFromPreviousVersion => new TranslatableString(getKey(@"import_content_from_previous_version"), @"Import content from previous version"); - private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs index b145dadd39..d5ef879479 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -27,7 +27,7 @@ using osuTK; namespace osu.Game.Overlays.FirstRunSetup { - [LocalisableDescription(typeof(FirstRunSetupOverlayStrings), nameof(FirstRunSetupOverlayStrings.ImportTitle))] + [LocalisableDescription(typeof(FirstRunOverlayImportFromStableScreenStrings), nameof(FirstRunOverlayImportFromStableScreenStrings.Header))] public class ScreenImportFromStable : FirstRunSetupScreen { private static readonly Vector2 button_size = new Vector2(400, 50); @@ -51,15 +51,14 @@ namespace osu.Game.Overlays.FirstRunSetup new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) { Colour = OverlayColourProvider.Content1, - Text = - "If you have an installation of a previous osu! version, you can choose to migrate your existing content. Note that this will create a copy, and not affect your existing installation.", + Text = FirstRunOverlayImportFromStableScreenStrings.Description, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, stableLocatorTextBox = new StableLocatorLabelledTextBox { - Label = "previous osu! install", - PlaceholderText = "Click to locate a previous osu! install" + Label = FirstRunOverlayImportFromStableScreenStrings.LocateDirectoryLabel, + PlaceholderText = FirstRunOverlayImportFromStableScreenStrings.LocateDirectoryPlaceholder }, new ImportCheckbox("Beatmaps", StableContent.Beatmaps), new ImportCheckbox("Scores", StableContent.Scores), @@ -70,14 +69,13 @@ namespace osu.Game.Overlays.FirstRunSetup Size = button_size, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = FirstRunSetupOverlayStrings.ImportContentFromPreviousVersion, + Text = FirstRunOverlayImportFromStableScreenStrings.ImportButton, Action = runImport }, progressText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) { Colour = OverlayColourProvider.Content1, - Text = - "Your import will continue in the background. Check on its progress in the notifications sidebar!", + Text = FirstRunOverlayImportFromStableScreenStrings.ImportInProgress, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Alpha = 0, @@ -168,7 +166,7 @@ namespace osu.Game.Overlays.FirstRunSetup public void UpdateCount() { - LabelText = LocalisableString.Interpolate($"{title} (calculating...)"); + LabelText = LocalisableString.Interpolate($"{title} ({FirstRunOverlayImportFromStableScreenStrings.Calculating})"); countUpdateCancellation?.Cancel(); countUpdateCancellation = new CancellationTokenSource(); @@ -178,7 +176,9 @@ namespace osu.Game.Overlays.FirstRunSetup if (task.IsCanceled) return; - LabelText = LocalisableString.Interpolate($"{title} ({task.GetResultSafely()} items)"); + int count = task.GetResultSafely(); + + LabelText = LocalisableString.Interpolate($"{title} ({FirstRunOverlayImportFromStableScreenStrings.Items(count)})"); })); } } From 1b7ec1be26e806796258298641cba65a9d043370 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 May 2022 18:15:14 +0900 Subject: [PATCH 1062/2328] Add basic test coverage of new screen --- ...TestSceneFirstRunScreenImportFromStable.cs | 48 +++++++++++++++++++ osu.Game/Database/LegacyImportManager.cs | 8 ++-- 2 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenImportFromStable.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenImportFromStable.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenImportFromStable.cs new file mode 100644 index 0000000000..081b240795 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenImportFromStable.cs @@ -0,0 +1,48 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Threading; +using System.Threading.Tasks; +using Moq; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Screens; +using osu.Framework.Utils; +using osu.Game.Database; +using osu.Game.Overlays; +using osu.Game.Overlays.FirstRunSetup; + +namespace osu.Game.Tests.Visual.UserInterface +{ + public class TestSceneFirstRunScreenImportFromStable : OsuManualInputManagerTestScene + { + [Cached] + private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); + + private readonly Mock legacyImportManager = new Mock(); + + [BackgroundDependencyLoader] + private void load() + { + legacyImportManager.Setup(m => m.GetImportCount(It.IsAny(), It.IsAny())).Returns(() => Task.FromResult(RNG.Next(0, 256))); + + Dependencies.CacheAs(legacyImportManager.Object); + } + + public TestSceneFirstRunScreenImportFromStable() + { + AddStep("load screen", () => + { + Child = new PopoverContainer + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new ScreenStack(new ScreenImportFromStable()) + } + }; + }); + } + } +} diff --git a/osu.Game/Database/LegacyImportManager.cs b/osu.Game/Database/LegacyImportManager.cs index 35b1d05fa1..af9db1b6ec 100644 --- a/osu.Game/Database/LegacyImportManager.cs +++ b/osu.Game/Database/LegacyImportManager.cs @@ -37,13 +37,13 @@ namespace osu.Game.Database [Resolved] private CollectionManager collections { get; set; } - [Resolved] + [Resolved(canBeNull: true)] private OsuGame game { get; set; } [Resolved] private IDialogOverlay dialogOverlay { get; set; } - [Resolved(CanBeNull = true)] + [Resolved(canBeNull: true)] private DesktopGameHost desktopGameHost { get; set; } private StableStorage cachedStorage; @@ -52,7 +52,7 @@ namespace osu.Game.Database public void UpdateStorage(string stablePath) => cachedStorage = new StableStorage(stablePath, desktopGameHost); - public async Task GetImportCount(StableContent content, CancellationToken cancellationToken) + public virtual async Task GetImportCount(StableContent content, CancellationToken cancellationToken) { var stableStorage = GetCurrentStableStorage(); @@ -120,7 +120,7 @@ namespace osu.Game.Database if (cachedStorage != null) return cachedStorage; - var stableStorage = game.GetStorageForStableInstall(); + var stableStorage = game?.GetStorageForStableInstall(); if (stableStorage != null) return cachedStorage = stableStorage; From 062ffe64acf700d295d22585af9a8d1c95362684 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 May 2022 18:21:19 +0900 Subject: [PATCH 1063/2328] Remove delay on pop in --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 8d72855217..f1a998bd3c 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -428,7 +428,6 @@ namespace osu.Game.Overlays.Mods base.PopIn(); multiplierDisplay? - .Delay(fade_in_duration / 5) .FadeIn(fade_in_duration, Easing.OutQuint) .MoveToY(0, fade_in_duration, Easing.OutQuint); From 5ad969246702e79eef2b10f155891fa4b61ee3ce Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 17 May 2022 14:59:18 +0900 Subject: [PATCH 1064/2328] Adjust minimum health targets to match osu-stable --- osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs b/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs index dfeb6b4788..e7bb6d79f8 100644 --- a/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs +++ b/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs @@ -27,17 +27,17 @@ namespace osu.Game.Rulesets.Scoring /// /// The minimum health target at an HP drain rate of 0. /// - private const double min_health_target = 0.95; + private const double min_health_target = 0.99; /// /// The minimum health target at an HP drain rate of 5. /// - private const double mid_health_target = 0.70; + private const double mid_health_target = 0.9; /// /// The minimum health target at an HP drain rate of 10. /// - private const double max_health_target = 0.30; + private const double max_health_target = 0.4; private IBeatmap beatmap; From 932442e2422db30333071d6a441b993d4f50667b Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Tue, 17 May 2022 18:52:19 +0100 Subject: [PATCH 1065/2328] Use `null` for empty grid cells in `ChannelListItem` --- .../Chat/ChannelList/ChannelListItem.cs | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs index dfb0b6d781..da1cfaf617 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Chat.ChannelList private Box hoverBox = null!; private Box selectBox = null!; private OsuSpriteText text = null!; - private Drawable close = null!; + private Drawable? close; [Resolved] private Bindable selectedChannel { get; set; } = null!; @@ -119,9 +119,7 @@ namespace osu.Game.Overlays.Chat.ChannelList protected override bool OnHover(HoverEvent e) { hoverBox.FadeIn(300, Easing.OutQuint); - - if (!isSelector) - close.FadeIn(300, Easing.OutQuint); + close?.FadeIn(300, Easing.OutQuint); return base.OnHover(e); } @@ -129,17 +127,15 @@ namespace osu.Game.Overlays.Chat.ChannelList protected override void OnHoverLost(HoverLostEvent e) { hoverBox.FadeOut(200, Easing.OutQuint); - - if (!isSelector) - close.FadeOut(200, Easing.OutQuint); + close?.FadeOut(200, Easing.OutQuint); base.OnHoverLost(e); } - private Drawable createIcon() + private UpdateableAvatar? createIcon() { if (Channel.Type != ChannelType.PM) - return Drawable.Empty(); + return null; return new UpdateableAvatar(Channel.Users.First(), isInteractive: false) { @@ -152,10 +148,10 @@ namespace osu.Game.Overlays.Chat.ChannelList }; } - private Drawable createMentionPill() + private ChannelListItemMentionPill? createMentionPill() { if (isSelector) - return Drawable.Empty(); + return null; return new ChannelListItemMentionPill { @@ -166,10 +162,10 @@ namespace osu.Game.Overlays.Chat.ChannelList }; } - private Drawable createCloseButton() + private ChannelListItemCloseButton? createCloseButton() { if (isSelector) - return Drawable.Empty(); + return null; return new ChannelListItemCloseButton { From 4015042e369a6d0900cca61beb0a13ee795d1639 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 18 May 2022 01:35:39 +0100 Subject: [PATCH 1066/2328] Ensure close button component is not stored as a `Drawable` --- osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs index da1cfaf617..eb2bdfdf8a 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Chat.ChannelList private Box hoverBox = null!; private Box selectBox = null!; private OsuSpriteText text = null!; - private Drawable? close; + private ChannelListItemCloseButton? close; [Resolved] private Bindable selectedChannel { get; set; } = null!; @@ -83,7 +83,7 @@ namespace osu.Game.Overlays.Chat.ChannelList }, Content = new[] { - new[] + new Drawable?[] { createIcon(), text = new OsuSpriteText From dd4b11c593f7869295e246241e388c701e641f99 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 18 May 2022 01:47:23 +0100 Subject: [PATCH 1067/2328] Re-add exception handling on PM message request failure --- osu.Game/Online/Chat/ChannelManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 9524e8c1a7..9e85067f15 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -197,6 +197,7 @@ namespace osu.Game.Online.Chat createNewPrivateMessageRequest.Failure += exception => { + handlePostException(exception); target.ReplaceMessage(message, null); dequeueAndRun(); }; From 49340888c09cd27e9e030648404947474d07510f Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 18 May 2022 10:56:42 +0900 Subject: [PATCH 1068/2328] Fix compile errors --- osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs | 2 +- osu.Game.Tests/Visual/UserInterface/TestScenePlaylistOverlay.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs index 377873f64a..97463b7466 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs @@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual.Settings .OfType() .OfType() .Where(f => !(f is IHasFilterableChildren)) - .All(f => f.FilterTerms.Any(t => t.Contains("scaling"))) + .All(f => f.FilterTerms.Any(t => t.ToString().Contains("scaling"))) )); AddAssert("ensure section is current", () => settings.CurrentSection.Value is GraphicsSection); diff --git a/osu.Game.Tests/Visual/UserInterface/TestScenePlaylistOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestScenePlaylistOverlay.cs index 09e5bc849e..84a06d97df 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestScenePlaylistOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestScenePlaylistOverlay.cs @@ -89,7 +89,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("results filtered correctly", () => playlistOverlay.ChildrenOfType() .Where(item => item.MatchingFilter) - .All(item => item.FilterTerms.Any(term => term.Contains("10")))); + .All(item => item.FilterTerms.Any(term => term.ToString().Contains("10")))); } } } From 3f71224dfc26a7cd87c6737bac79f86af84de2b2 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 18 May 2022 14:05:21 +0900 Subject: [PATCH 1069/2328] Package .json files in nupkg output --- osu.Desktop/osu.nuspec | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Desktop/osu.nuspec b/osu.Desktop/osu.nuspec index dc1ec17e2c..db58c325bd 100644 --- a/osu.Desktop/osu.nuspec +++ b/osu.Desktop/osu.nuspec @@ -18,5 +18,6 @@ + From 69351d2cdf9de1b4c01ef5740c73983cb3a94fe2 Mon Sep 17 00:00:00 2001 From: Noah M Date: Wed, 18 May 2022 01:09:58 -0500 Subject: [PATCH 1070/2328] Implement button to delete all beatmap videos --- osu.Game/Beatmaps/BeatmapManager.cs | 12 ++++++ .../MaintenanceSettingsStrings.cs | 5 +++ .../Sections/Maintenance/GeneralSettings.cs | 14 +++++++ .../MassDeleteConfirmationDialog.cs | 7 ++++ osu.Game/Stores/RealmArchiveModelManager.cs | 38 +++++++++++++++++++ 5 files changed, 76 insertions(+) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 5f7de0d762..2a5df9e206 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -319,6 +319,18 @@ namespace osu.Game.Beatmaps }); } + public void DeleteVideos(Expression>? filter = null, bool silent = false) + { + realm.Write(r => + { + var items = r.All().Where(s => !s.DeletePending && !s.Protected); + + if (filter != null) + items = items.Where(filter); + beatmapModelManager.DeleteVideos(items.ToList(), silent); + }); + } + public void UndeleteAll() { realm.Run(r => beatmapModelManager.Undelete(r.All().Where(s => s.DeletePending).ToList())); diff --git a/osu.Game/Localisation/MaintenanceSettingsStrings.cs b/osu.Game/Localisation/MaintenanceSettingsStrings.cs index a0e1a9ddab..7a04bcd1ca 100644 --- a/osu.Game/Localisation/MaintenanceSettingsStrings.cs +++ b/osu.Game/Localisation/MaintenanceSettingsStrings.cs @@ -29,6 +29,11 @@ namespace osu.Game.Localisation ///
public static LocalisableString DeleteAllBeatmaps => new TranslatableString(getKey(@"delete_all_beatmaps"), @"Delete ALL beatmaps"); + /// + /// "Delete ALL beatmap videos" + /// + public static LocalisableString DeleteAllBeatmapVideos => new TranslatableString(getKey(@"delete_all_beatmap_videos"), @"Delete ALL beatmap videos"); + /// /// "Import scores from stable" /// diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs index be4b0decd9..c2ebb59ecc 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -28,6 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance private SettingsButton deleteSkinsButton; private SettingsButton restoreButton; private SettingsButton undeleteButton; + private SettingsButton deleteBeatmapVideosButton; [BackgroundDependencyLoader(permitNulls: true)] private void load(BeatmapManager beatmaps, ScoreManager scores, SkinManager skins, [CanBeNull] CollectionManager collectionManager, [CanBeNull] LegacyImportManager legacyImportManager, IDialogOverlay dialogOverlay) @@ -58,6 +59,19 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance } }); + Add(deleteBeatmapVideosButton = new DangerousSettingsButton + { + Text = MaintenanceSettingsStrings.DeleteAllBeatmapVideos, + Action = () => + { + dialogOverlay?.Push(new MassVideoDeleteConfirmationDialog(() => + { + deleteBeatmapVideosButton.Enabled.Value = false; + Task.Run(() => beatmaps.DeleteVideos()).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true)); + })); + } + }); + if (legacyImportManager?.SupportsImportFromStable == true) { Add(importScoresButton = new SettingsButton diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs index c481c80d82..274b1060ca 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs @@ -29,4 +29,11 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance }; } } + public class MassVideoDeleteConfirmationDialog : MassDeleteConfirmationDialog + { + public MassVideoDeleteConfirmationDialog(Action deleteAction) : base(deleteAction) + { + BodyText = "All beatmap videos? This cannot be undone!"; + } + } } diff --git a/osu.Game/Stores/RealmArchiveModelManager.cs b/osu.Game/Stores/RealmArchiveModelManager.cs index cc8229b436..f70aa41cfb 100644 --- a/osu.Game/Stores/RealmArchiveModelManager.cs +++ b/osu.Game/Stores/RealmArchiveModelManager.cs @@ -132,6 +132,44 @@ namespace osu.Game.Stores notification.State = ProgressNotificationState.Completed; } + /// + /// Delete videos from a list of items. + /// This will post notifications tracking progress. + /// + public void DeleteVideos(List items, bool silent = false) + { + if (items.Count == 0) return; + + var notification = new ProgressNotification + { + Progress = 0, + Text = $"Preparing to delete all {HumanisedModelName} videos...", + CompletionText = $"Deleted all {HumanisedModelName} videos!", + State = ProgressNotificationState.Active, + }; + if (!silent) + PostNotification?.Invoke(notification); + + int i = 0; + + foreach (var b in items) + { + if (notification.State == ProgressNotificationState.Cancelled) + // user requested abort + return; + + notification.Text = $"Deleting videos from {HumanisedModelName}s ({++i} of {items.Count})"; + + var video = b.Files.FirstOrDefault(f => f.Filename.EndsWith(".mp4") || f.Filename.EndsWith(".avi") || f.Filename.EndsWith(".mov") || f.Filename.EndsWith(".flv")); + if (video != null) + DeleteFile(b, video); + + notification.Progress = (float)i / items.Count; + } + + notification.State = ProgressNotificationState.Completed; + } + /// /// Restore multiple items that were previously deleted. /// This will post notifications tracking progress. From fe49a7e6782e66dedbe5805192c6930589aa6522 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 18 May 2022 17:10:19 +0900 Subject: [PATCH 1071/2328] Add failing tests --- .../Formats/LegacyBeatmapDecoderTest.cs | 35 +++++++++++++++++++ .../Resources/adjacent-catmull-segments.osu | 2 ++ 2 files changed, 37 insertions(+) create mode 100644 osu.Game.Tests/Resources/adjacent-catmull-segments.osu diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 468cb7683c..89baaf228d 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -863,5 +863,40 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.That(decoded.Difficulty.OverallDifficulty, Is.EqualTo(1)); } } + + [Test] + public void TestLegacyAdjacentImplicitCatmullSegmentsAreMerged() + { + var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; + + using (var resStream = TestResources.OpenResource("adjacent-catmull-segments.osu")) + using (var stream = new LineBufferedReader(resStream)) + { + var decoded = decoder.Decode(stream); + var controlPoints = ((IHasPath)decoded.HitObjects[0]).Path.ControlPoints; + + Assert.That(controlPoints.Count, Is.EqualTo(6)); + Assert.That(controlPoints.Single(c => c.Type != null).Type, Is.EqualTo(PathType.Catmull)); + } + } + + [Test] + public void TestNonLegacyAdjacentImplicitCatmullSegmentsAreNotMerged() + { + var decoder = new LegacyBeatmapDecoder(LegacyBeatmapEncoder.FIRST_LAZER_VERSION) { ApplyOffsets = false }; + + using (var resStream = TestResources.OpenResource("adjacent-catmull-segments.osu")) + using (var stream = new LineBufferedReader(resStream)) + { + var decoded = decoder.Decode(stream); + var controlPoints = ((IHasPath)decoded.HitObjects[0]).Path.ControlPoints; + + Assert.That(controlPoints.Count, Is.EqualTo(4)); + Assert.That(controlPoints[0].Type, Is.EqualTo(PathType.Catmull)); + Assert.That(controlPoints[1].Type, Is.EqualTo(PathType.Catmull)); + Assert.That(controlPoints[2].Type, Is.EqualTo(PathType.Catmull)); + Assert.That(controlPoints[3].Type, Is.Null); + } + } } } diff --git a/osu.Game.Tests/Resources/adjacent-catmull-segments.osu b/osu.Game.Tests/Resources/adjacent-catmull-segments.osu new file mode 100644 index 0000000000..a436fe5228 --- /dev/null +++ b/osu.Game.Tests/Resources/adjacent-catmull-segments.osu @@ -0,0 +1,2 @@ +[HitObjects] +200,304,23875,6,0,C|288:304|288:304|288:208|288:208|352:208,1,260,8|0 \ No newline at end of file From 731f0960ec53ed3a6059ae5a29cfd5a27f5c3d67 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 18 May 2022 17:11:08 +0900 Subject: [PATCH 1072/2328] Don't merge adjacent legacy Catmull segments --- osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs | 4 ++-- osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs index b91a74c4a1..3b4200e7a9 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs @@ -22,7 +22,7 @@ namespace osu.Game.Beatmaps.Formats { public class LegacyBeatmapEncoder { - public const int LATEST_VERSION = 128; + public const int FIRST_LAZER_VERSION = 128; /// /// osu! is generally slower than taiko, so a factor is added to increase @@ -55,7 +55,7 @@ namespace osu.Game.Beatmaps.Formats public void Encode(TextWriter writer) { - writer.WriteLine($"osu file format v{LATEST_VERSION}"); + writer.WriteLine($"osu file format v{FIRST_LAZER_VERSION}"); writer.WriteLine(); handleGeneral(writer); diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 2a7f2b037f..7cf68a2df7 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -336,10 +336,14 @@ namespace osu.Game.Rulesets.Objects.Legacy while (++endIndex < vertices.Length - endPointLength) { - // Keep incrementing while an implicit segment doesn't need to be started + // Keep incrementing while an implicit segment doesn't need to be started. if (vertices[endIndex].Position != vertices[endIndex - 1].Position) continue; + // Adjacent legacy Catmull segments should be treated as a single segment. + if (FormatVersion < LegacyBeatmapEncoder.FIRST_LAZER_VERSION && type == PathType.Catmull) + continue; + // The last control point of each segment is not allowed to start a new implicit segment. if (endIndex == vertices.Length - endPointLength - 1) continue; From df4968a55bda4c0d6dcc0cd9bb9d18ca94f511f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 May 2022 21:20:14 +0900 Subject: [PATCH 1073/2328] Add `new Guid` bannedsymbols rule --- CodeAnalysis/BannedSymbols.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CodeAnalysis/BannedSymbols.txt b/CodeAnalysis/BannedSymbols.txt index e96ad48325..b3cca21c98 100644 --- a/CodeAnalysis/BannedSymbols.txt +++ b/CodeAnalysis/BannedSymbols.txt @@ -11,6 +11,7 @@ T:Microsoft.EntityFrameworkCore.Internal.TypeExtensions;Don't use internal exten T:NuGet.Packaging.CollectionExtensions;Don't use internal extension methods. M:System.Enum.HasFlag(System.Enum);Use osu.Framework.Extensions.EnumExtensions.HasFlagFast() instead. M:Realms.IRealmCollection`1.SubscribeForNotifications`1(Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IRealmCollection,NotificationCallbackDelegate) instead. +M:System.Guid.#ctor;Probably meaning to use Guid.New() instead. If actually wanting empty, use Guid.Empty(). M:Realms.CollectionExtensions.SubscribeForNotifications`1(System.Linq.IQueryable{``0},Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IQueryable,NotificationCallbackDelegate) instead. M:Realms.CollectionExtensions.SubscribeForNotifications`1(System.Collections.Generic.IList{``0},Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IList,NotificationCallbackDelegate) instead. M:System.Threading.Tasks.Task.Wait();Don't use Task.Wait. Use Task.WaitSafely() to ensure we avoid deadlocks. From fa09270e6278ad808c82021938227b1fb3f46b36 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 May 2022 21:21:20 +0900 Subject: [PATCH 1074/2328] Remove left-over todo --- osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs index d5ef879479..ad6ff21353 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -188,7 +188,6 @@ namespace osu.Game.Overlays.FirstRunSetup [Resolved] private LegacyImportManager legacyImportManager { get; set; } = null!; - // TODO: test public IEnumerable HandledExtensions { get; } = new[] { string.Empty }; private readonly Bindable currentDirectory = new Bindable(); From d54e1503c763f735360bc8caac09019a4a5dbd60 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 May 2022 21:22:17 +0900 Subject: [PATCH 1075/2328] Rename interaction toggle method --- .../Overlays/FirstRunSetup/ScreenImportFromStable.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs index ad6ff21353..106e78dc18 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -91,7 +91,7 @@ namespace osu.Game.Overlays.FirstRunSetup if (storage == null) { - allowInteraction(false); + toggleInteraction(false); stableLocatorTextBox.Current.Disabled = false; stableLocatorTextBox.Current.Value = string.Empty; @@ -104,14 +104,14 @@ namespace osu.Game.Overlays.FirstRunSetup c.UpdateCount(); } - allowInteraction(true); + toggleInteraction(true); stableLocatorTextBox.Current.Value = storage.GetFullPath(string.Empty); importButton.Enabled.Value = true; } private void runImport() { - allowInteraction(false); + toggleInteraction(false); progressText.FadeIn(1000, Easing.OutQuint); StableContent importableContent = 0; @@ -127,13 +127,13 @@ namespace osu.Game.Overlays.FirstRunSetup importButton.Complete(); else { - allowInteraction(true); + toggleInteraction(true); importButton.Abort(); } })); } - private void allowInteraction(bool allow) + private void toggleInteraction(bool allow) { importButton.Enabled.Value = allow; stableLocatorTextBox.Current.Disabled = !allow; From 0cee90e156f31492bd81283c7e4b39238f10734d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 May 2022 21:32:32 +0900 Subject: [PATCH 1076/2328] Add common strings for missing localisable content --- osu.Game/Localisation/CommonStrings.cs | 22 ++++++++++++++++++- .../FirstRunSetup/ScreenImportFromStable.cs | 8 +++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/osu.Game/Localisation/CommonStrings.cs b/osu.Game/Localisation/CommonStrings.cs index 9cd626af0f..1fd677034d 100644 --- a/osu.Game/Localisation/CommonStrings.cs +++ b/osu.Game/Localisation/CommonStrings.cs @@ -69,6 +69,26 @@ namespace osu.Game.Localisation /// public static LocalisableString SelectAll => new TranslatableString(getKey(@"select_all"), @"Select All"); + /// + /// "Beatmaps" + /// + public static LocalisableString Beatmaps => new TranslatableString(getKey(@"beatmaps"), @"Beatmaps"); + + /// + /// "Scores" + /// + public static LocalisableString Scores => new TranslatableString(getKey(@"scores"), @"Scores"); + + /// + /// "Skins" + /// + public static LocalisableString Skins => new TranslatableString(getKey(@"skins"), @"Skins"); + + /// + /// "Collections" + /// + public static LocalisableString Collections => new TranslatableString(getKey(@"collections"), @"Collections"); + private static string getKey(string key) => $@"{prefix}:{key}"; } -} +} \ No newline at end of file diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs index 106e78dc18..cf8abf0a76 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -60,10 +60,10 @@ namespace osu.Game.Overlays.FirstRunSetup Label = FirstRunOverlayImportFromStableScreenStrings.LocateDirectoryLabel, PlaceholderText = FirstRunOverlayImportFromStableScreenStrings.LocateDirectoryPlaceholder }, - new ImportCheckbox("Beatmaps", StableContent.Beatmaps), - new ImportCheckbox("Scores", StableContent.Scores), - new ImportCheckbox("Skins", StableContent.Skins), - new ImportCheckbox("Collections", StableContent.Collections), + new ImportCheckbox(CommonStrings.Beatmaps, StableContent.Beatmaps), + new ImportCheckbox(CommonStrings.Scores, StableContent.Scores), + new ImportCheckbox(CommonStrings.Skins, StableContent.Skins), + new ImportCheckbox(CommonStrings.Collections, StableContent.Collections), importButton = new ProgressRoundedButton { Size = button_size, From f5235f6a563a013529387a73ea481ea3dc9fd5aa Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 18 May 2022 20:38:13 +0300 Subject: [PATCH 1077/2328] Correctify recommended method and property --- CodeAnalysis/BannedSymbols.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CodeAnalysis/BannedSymbols.txt b/CodeAnalysis/BannedSymbols.txt index b3cca21c98..b72df0a306 100644 --- a/CodeAnalysis/BannedSymbols.txt +++ b/CodeAnalysis/BannedSymbols.txt @@ -11,7 +11,7 @@ T:Microsoft.EntityFrameworkCore.Internal.TypeExtensions;Don't use internal exten T:NuGet.Packaging.CollectionExtensions;Don't use internal extension methods. M:System.Enum.HasFlag(System.Enum);Use osu.Framework.Extensions.EnumExtensions.HasFlagFast() instead. M:Realms.IRealmCollection`1.SubscribeForNotifications`1(Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IRealmCollection,NotificationCallbackDelegate) instead. -M:System.Guid.#ctor;Probably meaning to use Guid.New() instead. If actually wanting empty, use Guid.Empty(). +M:System.Guid.#ctor;Probably meaning to use Guid.NewGuid() instead. If actually wanting empty, use Guid.Empty. M:Realms.CollectionExtensions.SubscribeForNotifications`1(System.Linq.IQueryable{``0},Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IQueryable,NotificationCallbackDelegate) instead. M:Realms.CollectionExtensions.SubscribeForNotifications`1(System.Collections.Generic.IList{``0},Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IList,NotificationCallbackDelegate) instead. M:System.Threading.Tasks.Task.Wait();Don't use Task.Wait. Use Task.WaitSafely() to ensure we avoid deadlocks. From 371738b047105ec1f14b84baf992b1acc52b068d Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 18 May 2022 20:00:42 +0100 Subject: [PATCH 1078/2328] Check against the loaded drawable channel --- osu.Game/Overlays/ChatOverlayV2.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index e91d57f18b..611c539f8f 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -263,18 +263,18 @@ namespace osu.Game.Overlays ChatOverlayDrawableChannel drawableChannel = new ChatOverlayDrawableChannel(newChannel); loadedChannels.Add(newChannel, drawableChannel); - LoadComponentAsync(drawableChannel, loaded => + LoadComponentAsync(drawableChannel, loadedDrawable => { // Ensure the current channel hasn't changed by the time the load completes - if (currentChannel.Value != newChannel) + if (currentChannel.Value != loadedDrawable.Channel) return; // Ensure the cached reference hasn't been removed from leaving the channel - if (!loadedChannels.ContainsKey(newChannel)) + if (!loadedChannels.ContainsKey(loadedDrawable.Channel)) return; currentChannelContainer.Clear(false); - currentChannelContainer.Add(loaded); + currentChannelContainer.Add(loadedDrawable); loading.Hide(); }); } From 5d3878a737ae957c359aff643285954172731a52 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 18 May 2022 22:58:39 +0300 Subject: [PATCH 1079/2328] Add test coverage for slow-loading channels --- .../Visual/Online/TestSceneChatOverlayV2.cs | 64 ++++++++++++++++++- osu.Game/Overlays/ChatOverlayV2.cs | 6 +- 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 82089ff3d1..3e3c8122b3 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -5,6 +5,8 @@ using System; using System.Linq; using System.Collections.Generic; using System.Net; +using System.Threading; +using JetBrains.Annotations; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -31,7 +33,7 @@ namespace osu.Game.Tests.Visual.Online [TestFixture] public class TestSceneChatOverlayV2 : OsuManualInputManagerTestScene { - private ChatOverlayV2 chatOverlay; + private TestChatOverlayV2 chatOverlay; private ChannelManager channelManager; private APIUser testUser; @@ -61,7 +63,7 @@ namespace osu.Game.Tests.Visual.Online Children = new Drawable[] { channelManager, - chatOverlay = new ChatOverlayV2 { RelativeSizeAxes = Axes.Both }, + chatOverlay = new TestChatOverlayV2 { RelativeSizeAxes = Axes.Both }, }, }; }); @@ -386,6 +388,34 @@ namespace osu.Game.Tests.Visual.Online AddAssert("TextBox is not focused", () => InputManager.FocusedDrawable == null); } + [Test] + public void TestSlowLoadingChannel() + { + AddStep("Show overlay (slow-loading)", () => + { + chatOverlay.Show(); + chatOverlay.SlowLoading = true; + }); + AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + AddAssert("Channel 1 loading", () => !channelIsVisible && chatOverlay.GetSlowLoadingChannel(testChannel1).LoadState == LoadState.Loading); + + AddStep("Join channel 2", () => channelManager.JoinChannel(testChannel2)); + AddStep("Select channel 2", () => clickDrawable(getChannelListItem(testChannel2))); + AddAssert("Channel 2 loading", () => !channelIsVisible && chatOverlay.GetSlowLoadingChannel(testChannel2).LoadState == LoadState.Loading); + + AddStep("Finish channel 1 load", () => chatOverlay.GetSlowLoadingChannel(testChannel1).LoadEvent.Set()); + AddAssert("Channel 1 ready", () => chatOverlay.GetSlowLoadingChannel(testChannel1).LoadState == LoadState.Ready); + AddAssert("Channel 1 not displayed", () => !channelIsVisible); + + AddStep("Finish channel 2 load", () => chatOverlay.GetSlowLoadingChannel(testChannel2).LoadEvent.Set()); + AddAssert("Channel 2 loaded", () => chatOverlay.GetSlowLoadingChannel(testChannel2).IsLoaded); + AddAssert("Channel 2 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel2); + + AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); + AddAssert("Channel 1 loaded", () => chatOverlay.GetSlowLoadingChannel(testChannel1).IsLoaded); + AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + } + private bool listingIsVisible => chatOverlay.ChildrenOfType().Single().State.Value == Visibility.Visible; @@ -432,5 +462,35 @@ namespace osu.Game.Tests.Visual.Online Topic = $"We talk about the number {id} here", Type = ChannelType.Public, }; + + private class TestChatOverlayV2 : ChatOverlayV2 + { + public bool SlowLoading { get; set; } + + public SlowLoadingDrawableChannel GetSlowLoadingChannel(Channel channel) => DrawableChannels.OfType().Single(c => c.Channel == channel); + + protected override ChatOverlayDrawableChannel CreateDrawableChannel(Channel newChannel) + { + return SlowLoading + ? new SlowLoadingDrawableChannel(newChannel) + : new ChatOverlayDrawableChannel(newChannel); + } + } + + private class SlowLoadingDrawableChannel : ChatOverlayDrawableChannel + { + public readonly ManualResetEventSlim LoadEvent = new ManualResetEventSlim(); + + public SlowLoadingDrawableChannel([NotNull] Channel channel) + : base(channel) + { + } + + [BackgroundDependencyLoader] + private void load() + { + LoadEvent.Wait(10000); + } + } } } diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 611c539f8f..b2c1f6858c 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -41,6 +41,8 @@ namespace osu.Game.Overlays private readonly Dictionary loadedChannels = new Dictionary(); + protected IEnumerable DrawableChannels => loadedChannels.Values; + private readonly BindableFloat chatHeight = new BindableFloat(); private bool isDraggingTopBar; private float dragStartChatHeight; @@ -260,7 +262,7 @@ namespace osu.Game.Overlays loading.Show(); // Ensure the drawable channel is stored before async load to prevent double loading - ChatOverlayDrawableChannel drawableChannel = new ChatOverlayDrawableChannel(newChannel); + ChatOverlayDrawableChannel drawableChannel = CreateDrawableChannel(newChannel); loadedChannels.Add(newChannel, drawableChannel); LoadComponentAsync(drawableChannel, loadedDrawable => @@ -281,6 +283,8 @@ namespace osu.Game.Overlays } } + protected virtual ChatOverlayDrawableChannel CreateDrawableChannel(Channel newChannel) => new ChatOverlayDrawableChannel(newChannel); + private void joinedChannelsChanged(object sender, NotifyCollectionChangedEventArgs args) { switch (args.Action) From 617382a56f19d628122f5842d8e939efbf2ecbad Mon Sep 17 00:00:00 2001 From: Noah M Date: Wed, 18 May 2022 15:20:02 -0500 Subject: [PATCH 1080/2328] Split off MassVideoDeleteConfirmationDialog into its own file --- .../Maintenance/MassDeleteConfirmationDialog.cs | 7 ------- .../MassVideoDeleteConfirmationDialog.cs | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 osu.Game/Overlays/Settings/Sections/Maintenance/MassVideoDeleteConfirmationDialog.cs diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs index 274b1060ca..c481c80d82 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs @@ -29,11 +29,4 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance }; } } - public class MassVideoDeleteConfirmationDialog : MassDeleteConfirmationDialog - { - public MassVideoDeleteConfirmationDialog(Action deleteAction) : base(deleteAction) - { - BodyText = "All beatmap videos? This cannot be undone!"; - } - } } diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/MassVideoDeleteConfirmationDialog.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/MassVideoDeleteConfirmationDialog.cs new file mode 100644 index 0000000000..522177807c --- /dev/null +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/MassVideoDeleteConfirmationDialog.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 System; + +namespace osu.Game.Overlays.Settings.Sections.Maintenance +{ + public class MassVideoDeleteConfirmationDialog : MassDeleteConfirmationDialog + { + public MassVideoDeleteConfirmationDialog(Action deleteAction) : base(deleteAction) + { + BodyText = "All beatmap videos? This cannot be undone!"; + } + } +} From a93a2fcafba1b0f3af7e52ea6b36e72a592b9e51 Mon Sep 17 00:00:00 2001 From: Noah M Date: Wed, 18 May 2022 15:37:46 -0500 Subject: [PATCH 1081/2328] Move implementation of DeleteVideos to BeatmapModelManager --- osu.Game/Beatmaps/BeatmapModelManager.cs | 39 +++++++++++++++++++++ osu.Game/Stores/RealmArchiveModelManager.cs | 38 -------------------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapModelManager.cs b/osu.Game/Beatmaps/BeatmapModelManager.cs index 4c680bbcc9..3cd2e8c8bd 100644 --- a/osu.Game/Beatmaps/BeatmapModelManager.cs +++ b/osu.Game/Beatmaps/BeatmapModelManager.cs @@ -16,6 +16,7 @@ using osu.Game.Database; using osu.Game.Extensions; using osu.Game.Skinning; using osu.Game.Stores; +using osu.Game.Overlays.Notifications; #nullable enable @@ -114,5 +115,43 @@ namespace osu.Game.Beatmaps item.CopyChangesToRealm(existing); }); } + + /// + /// Delete videos from a list of beatmaps. + /// This will post notifications tracking progress. + /// + public void DeleteVideos(List items, bool silent = false) + { + if (items.Count == 0) return; + + var notification = new ProgressNotification + { + Progress = 0, + Text = $"Preparing to delete all {HumanisedModelName} videos...", + CompletionText = $"Deleted all {HumanisedModelName} videos!", + State = ProgressNotificationState.Active, + }; + if (!silent) + PostNotification?.Invoke(notification); + + int i = 0; + + foreach (var b in items) + { + if (notification.State == ProgressNotificationState.Cancelled) + // user requested abort + return; + + notification.Text = $"Deleting videos from {HumanisedModelName}s ({++i} of {items.Count})"; + + var video = b.Files.FirstOrDefault(f => f.Filename.EndsWith(".mp4") || f.Filename.EndsWith(".avi") || f.Filename.EndsWith(".mov") || f.Filename.EndsWith(".flv")); + if (video != null) + DeleteFile(b, video); + + notification.Progress = (float)i / items.Count; + } + + notification.State = ProgressNotificationState.Completed; + } } } diff --git a/osu.Game/Stores/RealmArchiveModelManager.cs b/osu.Game/Stores/RealmArchiveModelManager.cs index f70aa41cfb..cc8229b436 100644 --- a/osu.Game/Stores/RealmArchiveModelManager.cs +++ b/osu.Game/Stores/RealmArchiveModelManager.cs @@ -132,44 +132,6 @@ namespace osu.Game.Stores notification.State = ProgressNotificationState.Completed; } - /// - /// Delete videos from a list of items. - /// This will post notifications tracking progress. - /// - public void DeleteVideos(List items, bool silent = false) - { - if (items.Count == 0) return; - - var notification = new ProgressNotification - { - Progress = 0, - Text = $"Preparing to delete all {HumanisedModelName} videos...", - CompletionText = $"Deleted all {HumanisedModelName} videos!", - State = ProgressNotificationState.Active, - }; - if (!silent) - PostNotification?.Invoke(notification); - - int i = 0; - - foreach (var b in items) - { - if (notification.State == ProgressNotificationState.Cancelled) - // user requested abort - return; - - notification.Text = $"Deleting videos from {HumanisedModelName}s ({++i} of {items.Count})"; - - var video = b.Files.FirstOrDefault(f => f.Filename.EndsWith(".mp4") || f.Filename.EndsWith(".avi") || f.Filename.EndsWith(".mov") || f.Filename.EndsWith(".flv")); - if (video != null) - DeleteFile(b, video); - - notification.Progress = (float)i / items.Count; - } - - notification.State = ProgressNotificationState.Completed; - } - /// /// Restore multiple items that were previously deleted. /// This will post notifications tracking progress. From 60eb0ea69edd1c8e9a9b41c2db071d385536493e Mon Sep 17 00:00:00 2001 From: Noah M Date: Wed, 18 May 2022 15:40:46 -0500 Subject: [PATCH 1082/2328] Remove unnecessary parameters from DeleteVideos --- osu.Game/Beatmaps/BeatmapManager.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 2a5df9e206..92266924df 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -319,15 +319,12 @@ namespace osu.Game.Beatmaps }); } - public void DeleteVideos(Expression>? filter = null, bool silent = false) + public void DeleteVideos() { realm.Write(r => { var items = r.All().Where(s => !s.DeletePending && !s.Protected); - - if (filter != null) - items = items.Where(filter); - beatmapModelManager.DeleteVideos(items.ToList(), silent); + beatmapModelManager.DeleteVideos(items.ToList()); }); } From d1fcd73c87ca9fe93123ad66b0259521587d15a0 Mon Sep 17 00:00:00 2001 From: Noah M Date: Wed, 18 May 2022 16:25:10 -0500 Subject: [PATCH 1083/2328] Convert extension checking to checking against string array --- osu.Game/Beatmaps/BeatmapModelManager.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapModelManager.cs b/osu.Game/Beatmaps/BeatmapModelManager.cs index 3cd2e8c8bd..9d3ea7d192 100644 --- a/osu.Game/Beatmaps/BeatmapModelManager.cs +++ b/osu.Game/Beatmaps/BeatmapModelManager.cs @@ -34,6 +34,8 @@ namespace osu.Game.Beatmaps protected override string[] HashableFileTypes => new[] { ".osu" }; + private static readonly string[] video_extensions = { ".mp4", ".mov", ".avi", ".flv" }; + public BeatmapModelManager(RealmAccess realm, Storage storage, BeatmapOnlineLookupQueue? onlineLookupQueue = null) : base(realm, storage, onlineLookupQueue) { @@ -144,7 +146,7 @@ namespace osu.Game.Beatmaps notification.Text = $"Deleting videos from {HumanisedModelName}s ({++i} of {items.Count})"; - var video = b.Files.FirstOrDefault(f => f.Filename.EndsWith(".mp4") || f.Filename.EndsWith(".avi") || f.Filename.EndsWith(".mov") || f.Filename.EndsWith(".flv")); + var video = b.Files.FirstOrDefault(f => video_extensions.Any(ex => f.Filename.EndsWith(ex, StringComparison.Ordinal))); if (video != null) DeleteFile(b, video); From 0ef94067872805047679d948585ce6fb81d8a463 Mon Sep 17 00:00:00 2001 From: Noah M Date: Wed, 18 May 2022 16:35:14 -0500 Subject: [PATCH 1084/2328] Fix deleteBeatmapVideosButton not being reenabled My bad --- .../Overlays/Settings/Sections/Maintenance/GeneralSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs index c2ebb59ecc..afc5cad893 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -67,7 +67,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance dialogOverlay?.Push(new MassVideoDeleteConfirmationDialog(() => { deleteBeatmapVideosButton.Enabled.Value = false; - Task.Run(() => beatmaps.DeleteVideos()).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true)); + Task.Run(() => beatmaps.DeleteVideos()).ContinueWith(t => Schedule(() => deleteBeatmapVideosButton.Enabled.Value = true)); })); } }); From 3bca014b52b2b7ea11b3b0ce491d0f0456854311 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 19 May 2022 09:44:11 +0900 Subject: [PATCH 1085/2328] Bust CI cache on CodeAnalysis ruleset changes --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 729f2f266d..1d5c565d60 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: uses: actions/cache@v3 with: path: ${{ github.workspace }}/inspectcode - key: inspectcode-${{ hashFiles('.config/dotnet-tools.json', '.github/workflows/ci.yml', 'osu.sln*', '.editorconfig', '.globalconfig') }} + key: inspectcode-${{ hashFiles('.config/dotnet-tools.json', '.github/workflows/ci.yml', 'osu.sln*', '.editorconfig', '.globalconfig', 'CodeAnalysis/*') }} - name: Dotnet code style run: dotnet build -c Debug -warnaserror osu.Desktop.slnf -p:EnforceCodeStyleInBuild=true From a443200d0d25c54a0e28a0691b9ada5a9bd2bab1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 May 2022 13:49:52 +0900 Subject: [PATCH 1086/2328] Make dependency nullable to allow for safer disposal unbinding --- .../Skinning/Legacy/LegacyMainCirclePiece.cs | 2 +- osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs index 391147648f..dd6226e19b 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy private readonly Bindable accentColour = new Bindable(); private readonly IBindable indexInCurrentCombo = new Bindable(); - [Resolved(canBeNull: true)] + [Resolved(canBeNull: true)] // Can't really be null but required to handle potential of disposal before DI completes. private DrawableHitObject? drawableObject { get; set; } [Resolved] diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs index cf8abf0a76..62b517d982 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -192,14 +192,14 @@ namespace osu.Game.Overlays.FirstRunSetup private readonly Bindable currentDirectory = new Bindable(); - [Resolved] - private OsuGameBase game { get; set; } = null!; + [Resolved(canBeNull: true)] // Can't really be null but required to handle potential of disposal before DI completes. + private OsuGameBase? game { get; set; } protected override void LoadComplete() { base.LoadComplete(); - game.RegisterImportHandler(this); + game?.RegisterImportHandler(this); currentDirectory.BindValueChanged(onDirectorySelected); @@ -242,7 +242,7 @@ namespace osu.Game.Overlays.FirstRunSetup protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - game.UnregisterImportHandler(this); + game?.UnregisterImportHandler(this); } public override Popover GetPopover() => new DirectoryChooserPopover(currentDirectory); From f6fb8f3fb99be7352e40d4cd7b4df12e755349b7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 May 2022 13:54:44 +0900 Subject: [PATCH 1087/2328] Delete and ignore rider's `misc.xml` This file has changed on us too many times. Doesn't seem to contain anything of value. --- .gitignore | 2 ++ .idea/.idea.osu.Desktop/.idea/misc.xml | 11 ----------- 2 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 .idea/.idea.osu.Desktop/.idea/misc.xml diff --git a/.gitignore b/.gitignore index 5b19270ab9..0c7a18b437 100644 --- a/.gitignore +++ b/.gitignore @@ -340,3 +340,5 @@ inspectcode # Fody (pulled in by Realm) - schema file FodyWeavers.xsd **/FodyWeavers.xml + +.idea/.idea.osu.Desktop/.idea/misc.xml \ No newline at end of file diff --git a/.idea/.idea.osu.Desktop/.idea/misc.xml b/.idea/.idea.osu.Desktop/.idea/misc.xml deleted file mode 100644 index 4e1d56f4dd..0000000000 --- a/.idea/.idea.osu.Desktop/.idea/misc.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - \ No newline at end of file From 70bd40ce443cf7ece4df644dd013afe9f3842c89 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 May 2022 14:01:24 +0900 Subject: [PATCH 1088/2328] Fix incorrect count of beatmaps available to import --- osu.Game/Database/LegacyModelImporter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Database/LegacyModelImporter.cs b/osu.Game/Database/LegacyModelImporter.cs index 13a9025ece..9b2a54dada 100644 --- a/osu.Game/Database/LegacyModelImporter.cs +++ b/osu.Game/Database/LegacyModelImporter.cs @@ -40,7 +40,7 @@ namespace osu.Game.Database Importer = importer; } - public Task GetAvailableCount(StableStorage stableStorage) => Task.Run(() => GetStableImportPaths(stableStorage).Count()); + public Task GetAvailableCount(StableStorage stableStorage) => Task.Run(() => GetStableImportPaths(PrepareStableStorage(stableStorage)).Count()); public Task ImportFromStableAsync(StableStorage stableStorage) { From 5af7641e946939a15e7729f58ac76de4b6511269 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 May 2022 15:53:53 +0900 Subject: [PATCH 1089/2328] Add safety against playfield potentially not being available during mania note placement --- .../Blueprints/ManiaPlacementBlueprint.cs | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs index ad95fd5e87..7a99565e8a 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs @@ -55,24 +55,25 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints { base.UpdateTimeAndPosition(result); - var playfield = (Column)result.Playfield; - - // Apply an offset to better align with the visual grid. - // This should only be applied during placement, as during selection / drag operations the movement is relative - // to the initial point of interaction rather than the grid. - switch (playfield.ScrollingInfo.Direction.Value) + if (result.Playfield is Column col) { - case ScrollingDirection.Down: - result.ScreenSpacePosition -= new Vector2(0, getNoteHeight(playfield) / 2); - break; + // Apply an offset to better align with the visual grid. + // This should only be applied during placement, as during selection / drag operations the movement is relative + // to the initial point of interaction rather than the grid. + switch (col.ScrollingInfo.Direction.Value) + { + case ScrollingDirection.Down: + result.ScreenSpacePosition -= new Vector2(0, getNoteHeight(col) / 2); + break; - case ScrollingDirection.Up: - result.ScreenSpacePosition += new Vector2(0, getNoteHeight(playfield) / 2); - break; + case ScrollingDirection.Up: + result.ScreenSpacePosition += new Vector2(0, getNoteHeight(col) / 2); + break; + } + + if (PlacementActive == PlacementState.Waiting) + Column = col; } - - if (PlacementActive == PlacementState.Waiting) - Column = playfield; } private float getNoteHeight(Column resultPlayfield) => From b3d6f76cfacdca8ec3906c8f92d324b71f1e54fc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 May 2022 15:57:17 +0900 Subject: [PATCH 1090/2328] Add "None" snap type to fix flags not working correctly --- osu.Game/Rulesets/Edit/SnapType.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Edit/SnapType.cs b/osu.Game/Rulesets/Edit/SnapType.cs index 4ab67fee63..6761356331 100644 --- a/osu.Game/Rulesets/Edit/SnapType.cs +++ b/osu.Game/Rulesets/Edit/SnapType.cs @@ -8,8 +8,9 @@ namespace osu.Game.Rulesets.Edit [Flags] public enum SnapType { - NearbyObjects = 0, - Grids = 1, + None = 0, + NearbyObjects = 1 << 0, + Grids = 1 << 1, All = NearbyObjects | Grids, } } From 363e7a6f537b7feda0f8825192391d64e791a749 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 May 2022 16:42:43 +0900 Subject: [PATCH 1091/2328] Simplify toolbar hiding logic in `FirstRunSetupOverlay` Rather than fiddling around with the activation modes, this seems like a much cleaner way to make things work. Closes https://github.com/ppy/osu/issues/18277. --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 22 +++------------------- osu.Game/Screens/Menu/MainMenu.cs | 2 ++ 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 890f17b013..7b0de4affe 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -62,8 +62,6 @@ namespace osu.Game.Overlays private Container screenContent = null!; - private Bindable? overlayActivationMode; - private Container content = null!; private LoadingSpinner loading = null!; @@ -225,16 +223,9 @@ namespace osu.Game.Overlays // if we are valid for display, only do so after reaching the main menu. performer.PerformFromScreen(screen => { - MainMenu menu = (MainMenu)screen; - - // Eventually I'd like to replace this with a better method that doesn't access the screen. - // Either this dialog would be converted to its own screen, or at very least be "hosted" by a screen pushed to the main menu. - // Alternatively, another method of disabling notifications could be added to `INotificationOverlay`. - if (menu != null) - { - overlayActivationMode = menu.OverlayActivationMode.GetBoundCopy(); - overlayActivationMode.Value = OverlayActivation.UserTriggered; - } + // Hides the toolbar for us. + if (screen is MainMenu menu) + menu.ReturnToOsuLogo(); base.Show(); }, new[] { typeof(MainMenu) }); @@ -257,13 +248,6 @@ namespace osu.Game.Overlays content.ScaleTo(0.99f, 400, Easing.OutQuint); - if (overlayActivationMode != null) - { - // If this is non-null we are guaranteed to have come from the main menu. - overlayActivationMode.Value = OverlayActivation.All; - overlayActivationMode = null; - } - if (currentStepIndex != null) { notificationOverlay.Post(new SimpleNotification diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 4401ee93ec..6fc8039413 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -150,6 +150,8 @@ namespace osu.Game.Screens.Menu [Resolved(canBeNull: true)] private IPerformFromScreenRunner performer { get; set; } + public void ReturnToOsuLogo() => Buttons.State = ButtonSystemState.Initial; + private void confirmAndExit() { if (exitConfirmed) return; From 63c97763658c490de30239d0b1e41799dbed9d2e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 May 2022 19:24:18 +0900 Subject: [PATCH 1092/2328] Fix oversight in bindable logic in new overlay class --- osu.Game/Overlays/ChatOverlayV2.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 0307dcfdf3..42c928014a 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -62,6 +62,9 @@ namespace osu.Game.Overlays [Cached] private readonly Bindable currentChannel = new Bindable(); + private readonly IBindableList availableChannels = new BindableList(); + private readonly IBindableList joinedChannels = new BindableList(); + public ChatOverlayV2() { Height = default_chat_height; @@ -147,9 +150,13 @@ namespace osu.Game.Overlays chatHeight.BindValueChanged(height => { Height = height.NewValue; }, true); currentChannel.BindTo(channelManager.CurrentChannel); - channelManager.CurrentChannel.BindValueChanged(currentChannelChanged, true); - channelManager.JoinedChannels.BindCollectionChanged(joinedChannelsChanged, true); - channelManager.AvailableChannels.BindCollectionChanged(availableChannelsChanged, true); + currentChannel.BindValueChanged(currentChannelChanged, true); + + joinedChannels.BindTo(channelManager.JoinedChannels); + joinedChannels.BindCollectionChanged(joinedChannelsChanged, true); + + availableChannels.BindTo(channelManager.AvailableChannels); + availableChannels.BindCollectionChanged(availableChannelsChanged, true); channelList.OnRequestSelect += channel => channelManager.CurrentChannel.Value = channel; channelList.OnRequestLeave += channel => channelManager.LeaveChannel(channel); @@ -263,8 +270,8 @@ namespace osu.Game.Overlays switch (args.Action) { case NotifyCollectionChangedAction.Add: - IEnumerable joinedChannels = filterChannels(args.NewItems); - foreach (var channel in joinedChannels) + IEnumerable newChannels = filterChannels(args.NewItems); + foreach (var channel in newChannels) channelList.AddChannel(channel); break; From 136ecb45e241b6d0dd4358107ddb2d9b4299f3bf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 May 2022 19:26:14 +0900 Subject: [PATCH 1093/2328] Rename dummy channel and move to a nested class inside the `ChannelListing` itself --- osu.Game.Tests/Visual/Online/TestSceneChannelList.cs | 3 ++- .../Visual/Online/TestSceneChatOverlayV2.cs | 2 +- osu.Game/Online/Chat/ChannelManager.cs | 4 ++-- osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 5 +++-- osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs | 3 ++- osu.Game/Overlays/Chat/Listing/ChannelListing.cs | 9 +++++++++ osu.Game/Overlays/ChatOverlayV2.cs | 11 +---------- 7 files changed, 20 insertions(+), 17 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs index 53a48fcc58..e4bc5645b6 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs @@ -13,6 +13,7 @@ using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Chat; using osu.Game.Overlays; using osu.Game.Overlays.Chat.ChannelList; +using osu.Game.Overlays.Chat.Listing; namespace osu.Game.Tests.Visual.Online { @@ -147,7 +148,7 @@ namespace osu.Game.Tests.Visual.Online }); } - private bool validItem => selected.Value != null && !(selected.Value is DummySelectorChannel); + private bool validItem => selected.Value != null && !(selected.Value is ChannelListing.ChannelListingChannel); private Channel createRandomPublicChannel() { diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 48557a4ddb..3b8849f7c9 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -408,7 +408,7 @@ namespace osu.Game.Tests.Visual.Online chatOverlay.ChildrenOfType().Single(); private ChannelListItem channelSelectorButton => - chatOverlay.ChildrenOfType().Single(item => item.Channel is DummySelectorChannel); + chatOverlay.ChildrenOfType().Single(item => item.Channel is ChannelListing.ChannelListingChannel); private void clickDrawable(Drawable d) { diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 9e85067f15..b7d67de04d 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -14,7 +14,7 @@ using osu.Game.Input; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; -using osu.Game.Overlays; +using osu.Game.Overlays.Chat.Listing; using osu.Game.Overlays.Chat.Tabs; namespace osu.Game.Online.Chat @@ -134,7 +134,7 @@ namespace osu.Game.Online.Chat private void currentChannelChanged(ValueChangedEvent e) { - bool isSelectorChannel = e.NewValue is ChannelSelectorTabItem.ChannelSelectorTabChannel || e.NewValue is DummySelectorChannel; + bool isSelectorChannel = e.NewValue is ChannelSelectorTabItem.ChannelSelectorTabChannel || e.NewValue is ChannelListing.ChannelListingChannel; if (!isSelectorChannel) JoinChannel(e.NewValue); diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index c9f3a4d380..555b54155c 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -13,6 +13,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; +using osu.Game.Overlays.Chat.Listing; namespace osu.Game.Overlays.Chat.ChannelList { @@ -23,7 +24,7 @@ namespace osu.Game.Overlays.Chat.ChannelList private readonly Dictionary channelMap = new Dictionary(); - private readonly DummySelectorChannel dummySelectorChannel = new DummySelectorChannel(); + private readonly ChannelListing.ChannelListingChannel channelListingChannel = new ChannelListing.ChannelListingChannel(); private ChannelListItemFlow publicChannelFlow = null!; private ChannelListItemFlow privateChannelFlow = null!; @@ -53,7 +54,7 @@ namespace osu.Game.Overlays.Chat.ChannelList Children = new Drawable[] { publicChannelFlow = new ChannelListItemFlow("CHANNELS"), - selector = new ChannelListItem(dummySelectorChannel) + selector = new ChannelListItem(channelListingChannel) { Margin = new MarginPadding { Bottom = 10 }, }, diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs index eb2bdfdf8a..2967d9df11 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs @@ -15,6 +15,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; +using osu.Game.Overlays.Chat.Listing; using osu.Game.Users.Drawables; using osuTK; @@ -191,6 +192,6 @@ namespace osu.Game.Overlays.Chat.ChannelList text.FadeColour(colourProvider.Light3, 200, Easing.OutQuint); } - private bool isSelector => Channel is DummySelectorChannel; + private bool isSelector => Channel is ChannelListing.ChannelListingChannel; } } diff --git a/osu.Game/Overlays/Chat/Listing/ChannelListing.cs b/osu.Game/Overlays/Chat/Listing/ChannelListing.cs index 732c78de15..8a5bc18cbf 100644 --- a/osu.Game/Overlays/Chat/Listing/ChannelListing.cs +++ b/osu.Game/Overlays/Chat/Listing/ChannelListing.cs @@ -75,5 +75,14 @@ namespace osu.Game.Overlays.Chat.Listing protected override void PopIn() => this.FadeIn(); protected override void PopOut() => this.FadeOut(); + + public class ChannelListingChannel : Channel + { + public ChannelListingChannel() + { + Name = "Add more channels"; + Type = ChannelType.System; + } + } } } diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 42c928014a..202d70d99b 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -244,7 +244,7 @@ namespace osu.Game.Overlays { Channel? newChannel = channel.NewValue; - if (newChannel == null || newChannel is DummySelectorChannel) + if (newChannel == null || newChannel is ChannelListing.ChannelListingChannel) { // null channel denotes that we should be showing the listing. channelListing.State.Value = Visibility.Visible; @@ -300,13 +300,4 @@ namespace osu.Game.Overlays channelManager.PostMessage(message); } } - - public class DummySelectorChannel : Channel - { - public DummySelectorChannel() - { - Name = "Add more channels"; - Type = ChannelType.System; - } - } } From c37d1e4fae4fe827e7ae36b485407d280fd29ba5 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Thu, 19 May 2022 11:45:39 +0100 Subject: [PATCH 1094/2328] Ensure current channel is set to the `ChannelListingChannel` when it becomes `null` --- osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 6 +++--- osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs | 2 +- osu.Game/Overlays/ChatOverlayV2.cs | 10 ++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 555b54155c..d1ceae604c 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -22,9 +22,9 @@ namespace osu.Game.Overlays.Chat.ChannelList public Action? OnRequestSelect; public Action? OnRequestLeave; - private readonly Dictionary channelMap = new Dictionary(); + public readonly ChannelListing.ChannelListingChannel ChannelListingChannel = new ChannelListing.ChannelListingChannel(); - private readonly ChannelListing.ChannelListingChannel channelListingChannel = new ChannelListing.ChannelListingChannel(); + private readonly Dictionary channelMap = new Dictionary(); private ChannelListItemFlow publicChannelFlow = null!; private ChannelListItemFlow privateChannelFlow = null!; @@ -54,7 +54,7 @@ namespace osu.Game.Overlays.Chat.ChannelList Children = new Drawable[] { publicChannelFlow = new ChannelListItemFlow("CHANNELS"), - selector = new ChannelListItem(channelListingChannel) + selector = new ChannelListItem(ChannelListingChannel) { Margin = new MarginPadding { Bottom = 10 }, }, diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs index 2967d9df11..9ab0c2792a 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs @@ -179,7 +179,7 @@ namespace osu.Game.Overlays.Chat.ChannelList private void updateState() { - bool selected = selectedChannel.Value == Channel || (isSelector && selectedChannel.Value == null); + bool selected = selectedChannel.Value == Channel; if (selected) selectBox.FadeIn(300, Easing.OutQuint); diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 202d70d99b..fe3f8ba8cb 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -244,9 +244,15 @@ namespace osu.Game.Overlays { Channel? newChannel = channel.NewValue; - if (newChannel == null || newChannel is ChannelListing.ChannelListingChannel) + // null channel denotes that we should be showing the listing. + if (newChannel == null) + { + currentChannel.Value = channelList.ChannelListingChannel; + return; + } + + if (newChannel is ChannelListing.ChannelListingChannel) { - // null channel denotes that we should be showing the listing. channelListing.State.Value = Visibility.Visible; textBar.ShowSearch.Value = true; } From 3fdff7bbcb5a6f17a736f8e71e59a1fdacf8b3a7 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 17 May 2022 15:11:22 +0900 Subject: [PATCH 1095/2328] Make Meh judgements not drain HP --- osu.Game/Rulesets/Judgements/Judgement.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Judgements/Judgement.cs b/osu.Game/Rulesets/Judgements/Judgement.cs index fd576e9b9f..4fe34e15fd 100644 --- a/osu.Game/Rulesets/Judgements/Judgement.cs +++ b/osu.Game/Rulesets/Judgements/Judgement.cs @@ -103,7 +103,7 @@ namespace osu.Game.Rulesets.Judgements return -DEFAULT_MAX_HEALTH_INCREASE; case HitResult.Meh: - return -DEFAULT_MAX_HEALTH_INCREASE * 0.05; + return DEFAULT_MAX_HEALTH_INCREASE * 0.05; case HitResult.Ok: return DEFAULT_MAX_HEALTH_INCREASE * 0.5; From ce7be940e2dd4f220583318bdf623a63d0f6e4f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 May 2022 14:34:33 +0900 Subject: [PATCH 1096/2328] Setup basics for control and test --- .../Editing/TestSceneTapTimingControl.cs | 94 +++++++++ .../UserInterfaceV2/LabelledDrawable.cs | 3 +- .../Screens/Edit/Timing/TapTimingControl.cs | 189 ++++++++++++++++++ osu.Game/Screens/Edit/Timing/TimingSection.cs | 2 + 4 files changed, 287 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs create mode 100644 osu.Game/Screens/Edit/Timing/TapTimingControl.cs diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs b/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs new file mode 100644 index 0000000000..c2889b2549 --- /dev/null +++ b/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs @@ -0,0 +1,94 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Testing; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Overlays; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu; +using osu.Game.Screens.Edit; +using osu.Game.Screens.Edit.Timing; +using osuTK; + +namespace osu.Game.Tests.Visual.Editing +{ + [TestFixture] + public class TestSceneTapTimingControl : EditorClockTestScene + { + [Cached(typeof(EditorBeatmap))] + [Cached(typeof(IBeatSnapProvider))] + private readonly EditorBeatmap editorBeatmap; + + [Cached] + private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue); + + [Cached] + private Bindable selectedGroup = new Bindable(); + + private TapTimingControl control; + + public TestSceneTapTimingControl() + { + editorBeatmap = new EditorBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo)); + selectedGroup.Value = editorBeatmap.ControlPointInfo.Groups.First(); + } + + [Test] + public void TestTapThenReset() + { + AddStep("click tap button", () => + { + control.ChildrenOfType() + .First(b => b.Text == "Tap to beat") + .TriggerClick(); + }); + + AddUntilStep("wait for track playing", () => Clock.IsRunning); + + AddStep("click reset button", () => + { + control.ChildrenOfType() + .First(b => b.Text == "Reset") + .TriggerClick(); + }); + + AddUntilStep("wait for track stopped", () => !Clock.IsRunning); + } + + [Test] + public void TestBasic() + { + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap); + Beatmap.Disabled = true; + + Child = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Y, + Width = 400, + Scale = new Vector2(1.5f), + Child = control = new TapTimingControl(), + }; + } + + protected override void Dispose(bool isDisposing) + { + Beatmap.Disabled = false; + base.Dispose(isDisposing); + } + } +} diff --git a/osu.Game/Graphics/UserInterfaceV2/LabelledDrawable.cs b/osu.Game/Graphics/UserInterfaceV2/LabelledDrawable.cs index 1e6032c1d0..066e1a7978 100644 --- a/osu.Game/Graphics/UserInterfaceV2/LabelledDrawable.cs +++ b/osu.Game/Graphics/UserInterfaceV2/LabelledDrawable.cs @@ -41,7 +41,8 @@ namespace osu.Game.Graphics.UserInterfaceV2 protected const float CONTENT_PADDING_VERTICAL = 10; protected const float CONTENT_PADDING_HORIZONTAL = 15; - protected const float CORNER_RADIUS = 15; + + public const float CORNER_RADIUS = 15; /// /// The component that is being displayed. diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs new file mode 100644 index 0000000000..3867a4bcec --- /dev/null +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -0,0 +1,189 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Overlays; +using osuTK; + +namespace osu.Game.Screens.Edit.Timing +{ + public class TapTimingControl : CompositeDrawable + { + [Resolved] + private EditorClock editorClock { get; set; } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider, OsuColour colours) + { + Height = 200; + RelativeSizeAxes = Axes.X; + + CornerRadius = LabelledDrawable.CORNER_RADIUS; + Masking = true; + + InternalChildren = new Drawable[] + { + new Box + { + Colour = colourProvider.Background4, + RelativeSizeAxes = Axes.Both, + }, + new GridContainer + { + RelativeSizeAxes = Axes.Both, + RowDimensions = new[] + { + new Dimension(), + new Dimension(GridSizeMode.Absolute, 60), + }, + Content = new[] + { + new Drawable[] + { + new Metronome() + }, + new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(10), + Children = new Drawable[] + { + new RoundedButton + { + Text = "Reset", + BackgroundColour = colours.Pink, + RelativeSizeAxes = Axes.X, + Width = 0.3f, + Action = reset, + }, + new RoundedButton + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Text = "Tap to beat", + RelativeSizeAxes = Axes.X, + BackgroundColour = colourProvider.Background1, + Width = 0.68f, + Action = tap, + } + } + }, + } + } + }, + }; + } + + private void tap() + { + if (!editorClock.IsRunning) + { + editorClock.Seek(0); + editorClock.Start(); + } + } + + private void reset() + { + editorClock.Stop(); + } + + private class Metronome : BeatSyncedContainer + { + private Container swing; + private Box weight; + private OsuSpriteText bpm; + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider overlayColourProvider) + { + Margin = new MarginPadding(10); + AutoSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + new Triangle + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(80, 120), + Colour = overlayColourProvider.Background1, + }, + new Circle + { + Y = -25, + Anchor = Anchor.BottomCentre, + Origin = Anchor.Centre, + Colour = overlayColourProvider.Content2, + Size = new Vector2(10) + }, + bpm = new OsuSpriteText + { + Colour = overlayColourProvider.Content1, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + swing = new Container + { + RelativeSizeAxes = Axes.Both, + Y = -25, + Height = 0.8f, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Children = new Drawable[] + { + new Box + { + Colour = overlayColourProvider.Content2, + RelativeSizeAxes = Axes.Y, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Width = 4, + }, + weight = new Box + { + Anchor = Anchor.TopCentre, + Origin = Anchor.Centre, + Colour = overlayColourProvider.Content2, + Size = new Vector2(15), + RelativePositionAxes = Axes.Y, + Y = -0.4f, + }, + } + }, + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + swing + .RotateTo(20, 500, Easing.InOutQuad) + .Then() + .RotateTo(-20, 500, Easing.InOutQuad) + .Loop(); + } + + protected override void Update() + { + base.Update(); + + if (CurrentTimingPoint == null) + return; + + weight.Y = Math.Clamp((float)CurrentTimingPoint.BPM / 480, 0, 0.95f); + bpm.Text = $"{CurrentTimingPoint.BPM:F0}"; + } + } + } +} diff --git a/osu.Game/Screens/Edit/Timing/TimingSection.cs b/osu.Game/Screens/Edit/Timing/TimingSection.cs index 13af04cd4b..be719d0cb6 100644 --- a/osu.Game/Screens/Edit/Timing/TimingSection.cs +++ b/osu.Game/Screens/Edit/Timing/TimingSection.cs @@ -19,6 +19,7 @@ namespace osu.Game.Screens.Edit.Timing { Flow.AddRange(new Drawable[] { + new TapTimingControl(), bpmTextEntry = new BPMTextBox(), timeSignature = new LabelledTimeSignature { @@ -96,5 +97,6 @@ namespace osu.Game.Screens.Edit.Timing } private static double beatLengthToBpm(double beatLength) => 60000 / beatLength; + } } From 42179568f3aca7d67c574ae615dcf8c65920eae3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 May 2022 15:56:39 +0900 Subject: [PATCH 1097/2328] Initial animation pass on metronome --- .../Editing/TestSceneTapTimingControl.cs | 58 +++++++--- .../Screens/Edit/Timing/TapTimingControl.cs | 105 +++++++++++++----- osu.Game/Screens/Edit/Timing/TimingSection.cs | 1 - 3 files changed, 117 insertions(+), 47 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs b/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs index c2889b2549..9b2618df5b 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs @@ -36,10 +36,37 @@ namespace osu.Game.Tests.Visual.Editing public TestSceneTapTimingControl() { - editorBeatmap = new EditorBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo)); + var playableBeatmap = CreateBeatmap(new OsuRuleset().RulesetInfo); + + // Ensure time doesn't end while testing + playableBeatmap.BeatmapInfo.Length = 1200000; + + editorBeatmap = new EditorBeatmap(playableBeatmap); + selectedGroup.Value = editorBeatmap.ControlPointInfo.Groups.First(); } + protected override void LoadComplete() + { + base.LoadComplete(); + + Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap); + Beatmap.Disabled = true; + + Children = new Drawable[] + { + new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Y, + Width = 400, + Scale = new Vector2(1.5f), + Child = control = new TapTimingControl(), + } + }; + } + [Test] public void TestTapThenReset() { @@ -65,24 +92,19 @@ namespace osu.Game.Tests.Visual.Editing [Test] public void TestBasic() { - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap); - Beatmap.Disabled = true; - - Child = new Container + AddStep("set low bpm", () => { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.Y, - Width = 400, - Scale = new Vector2(1.5f), - Child = control = new TapTimingControl(), - }; + editorBeatmap.ControlPointInfo.TimingPoints.First().BeatLength = 1000; + }); + + AddStep("click tap button", () => + { + control.ChildrenOfType() + .First(b => b.Text == "Tap to beat") + .TriggerClick(); + }); + + AddSliderStep("BPM", 30, 400, 60, bpm => editorBeatmap.ControlPointInfo.TimingPoints.First().BeatLength = 60000f / bpm); } protected override void Dispose(bool isDisposing) diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index 3867a4bcec..e23982ddc7 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -3,15 +3,19 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Audio.Track; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Utils; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays; using osuTK; +using osuTK.Graphics; namespace osu.Game.Screens.Edit.Timing { @@ -103,9 +107,13 @@ namespace osu.Game.Screens.Edit.Timing private Container swing; private Box weight; private OsuSpriteText bpm; + private Box stick; + + [Resolved] + private OverlayColourProvider overlayColourProvider { get; set; } [BackgroundDependencyLoader] - private void load(OverlayColourProvider overlayColourProvider) + private void load() { Margin = new MarginPadding(10); AutoSizeAxes = Axes.Both; @@ -117,21 +125,13 @@ namespace osu.Game.Screens.Edit.Timing Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(80, 120), - Colour = overlayColourProvider.Background1, - }, - new Circle - { - Y = -25, - Anchor = Anchor.BottomCentre, - Origin = Anchor.Centre, - Colour = overlayColourProvider.Content2, - Size = new Vector2(10) + Colour = overlayColourProvider.Background2, }, bpm = new OsuSpriteText { Colour = overlayColourProvider.Content1, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, }, swing = new Container { @@ -142,10 +142,10 @@ namespace osu.Game.Screens.Edit.Timing Origin = Anchor.BottomCentre, Children = new Drawable[] { - new Box + stick = new Box { - Colour = overlayColourProvider.Content2, RelativeSizeAxes = Axes.Y, + Colour = overlayColourProvider.Colour2, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Width = 4, @@ -154,35 +154,84 @@ namespace osu.Game.Screens.Edit.Timing { Anchor = Anchor.TopCentre, Origin = Anchor.Centre, - Colour = overlayColourProvider.Content2, + Colour = overlayColourProvider.Colour1, Size = new Vector2(15), RelativePositionAxes = Axes.Y, - Y = -0.4f, + Y = 0.4f, }, } }, + new Circle + { + Y = -25, + Anchor = Anchor.BottomCentre, + Origin = Anchor.Centre, + Colour = overlayColourProvider.Colour0, + Size = new Vector2(10) + }, }; } - protected override void LoadComplete() - { - base.LoadComplete(); - swing - .RotateTo(20, 500, Easing.InOutQuad) - .Then() - .RotateTo(-20, 500, Easing.InOutQuad) - .Loop(); - } + private double beatLength; + + private TimingControlPoint timingPoint; + + private float bpmRatio; + private bool isSwinging; protected override void Update() { base.Update(); - if (CurrentTimingPoint == null) + timingPoint = Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(BeatSyncClock.CurrentTime); + + if (beatLength != timingPoint.BeatLength) + { + beatLength = timingPoint.BeatLength; + bpm.Text = $"{timingPoint.BPM:F0}"; + + EarlyActivationMilliseconds = timingPoint.BeatLength / 2; + + bpmRatio = (float)Interpolation.ApplyEasing(Easing.OutQuad, Math.Clamp((timingPoint.BPM - 30) / 480, 0, 1)); + + weight.MoveToY((float)Interpolation.Lerp(0, 0.9f, bpmRatio), 600, Easing.OutQuint); + } + + if (BeatSyncClock?.IsRunning != true && isSwinging) + { + swing.ClearTransforms(true); + + using (swing.BeginDelayedSequence(350)) + { + swing.RotateTo(0, 1000, Easing.OutQuint); + stick.FadeColour(overlayColourProvider.Colour2, 1000, Easing.OutQuint); + } + + isSwinging = false; + } + } + + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes) + { + base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + + float angle = (float)Interpolation.Lerp(25, 4, bpmRatio); + + if (!IsBeatSyncedWithTrack) return; - weight.Y = Math.Clamp((float)CurrentTimingPoint.BPM / 480, 0, 0.95f); - bpm.Text = $"{CurrentTimingPoint.BPM:F0}"; + isSwinging = true; + + float currentAngle = swing.Rotation; + float targetAngle = currentAngle > 0 ? -angle : angle; + + swing.RotateTo(targetAngle, beatLength, Easing.InOutQuad); + + if (currentAngle != 0 && Math.Abs(currentAngle - targetAngle) > angle * 1.8f && isSwinging) + { + using (stick.BeginDelayedSequence(beatLength / 2)) + stick.FlashColour(overlayColourProvider.Content1, beatLength, Easing.OutQuint); + } } } } diff --git a/osu.Game/Screens/Edit/Timing/TimingSection.cs b/osu.Game/Screens/Edit/Timing/TimingSection.cs index be719d0cb6..a5abd96d72 100644 --- a/osu.Game/Screens/Edit/Timing/TimingSection.cs +++ b/osu.Game/Screens/Edit/Timing/TimingSection.cs @@ -97,6 +97,5 @@ namespace osu.Game.Screens.Edit.Timing } private static double beatLengthToBpm(double beatLength) => 60000 / beatLength; - } } From cf1ef28f72235a4f5d742e3d404ccfd94d2dcab1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 May 2022 16:22:16 +0900 Subject: [PATCH 1098/2328] Add taper and more correctly shaped weight --- .../Screens/Edit/Timing/TapTimingControl.cs | 91 ++++++++++++++----- 1 file changed, 70 insertions(+), 21 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index e23982ddc7..7507a7dd35 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -15,7 +15,6 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays; using osuTK; -using osuTK.Graphics; namespace osu.Game.Screens.Edit.Timing { @@ -105,9 +104,11 @@ namespace osu.Game.Screens.Edit.Timing private class Metronome : BeatSyncedContainer { private Container swing; - private Box weight; + private OsuSpriteText bpm; - private Box stick; + + private Drawable weight; + private Drawable stick; [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } @@ -116,33 +117,41 @@ namespace osu.Game.Screens.Edit.Timing private void load() { Margin = new MarginPadding(10); + + const float taper = 10; + + var triangleSize = new Vector2(80, 120); + AutoSizeAxes = Axes.Both; + const float stick_vertical_offset = -23; + InternalChildren = new Drawable[] { - new Triangle + new Container { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(80, 120), - Colour = overlayColourProvider.Background2, - }, - bpm = new OsuSpriteText - { - Colour = overlayColourProvider.Content1, + Masking = true, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, + Size = new Vector2(triangleSize.X * 1.2f, triangleSize.Y - taper), + Child = new Triangle + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Size = triangleSize, + Colour = overlayColourProvider.Background3, + }, }, swing = new Container { RelativeSizeAxes = Axes.Both, - Y = -25, + Y = stick_vertical_offset, Height = 0.8f, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Children = new Drawable[] + Children = new[] { - stick = new Box + stick = new Circle { RelativeSizeAxes = Axes.Y, Colour = overlayColourProvider.Colour2, @@ -150,24 +159,64 @@ namespace osu.Game.Screens.Edit.Timing Origin = Anchor.BottomCentre, Width = 4, }, - weight = new Box + weight = new Container { Anchor = Anchor.TopCentre, Origin = Anchor.Centre, Colour = overlayColourProvider.Colour1, - Size = new Vector2(15), + Size = new Vector2(10), + Rotation = 180, RelativePositionAxes = Axes.Y, Y = 0.4f, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Shear = new Vector2(0.2f, 0), + }, + new Box + { + RelativeSizeAxes = Axes.Both, + Shear = new Vector2(-0.2f, 0), + }, + } }, } }, new Circle { - Y = -25, + Y = stick_vertical_offset, Anchor = Anchor.BottomCentre, Origin = Anchor.Centre, Colour = overlayColourProvider.Colour0, - Size = new Vector2(10) + Size = new Vector2(8) + }, + new Container + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.Both, + Masking = true, + Height = 0.3f, + Children = new Drawable[] + { + new Triangle + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Size = triangleSize, + Colour = overlayColourProvider.Background2, + Alpha = 0.8f + }, + } + }, + bpm = new OsuSpriteText + { + Colour = overlayColourProvider.Content1, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Y = -3, }, }; } @@ -194,7 +243,7 @@ namespace osu.Game.Screens.Edit.Timing bpmRatio = (float)Interpolation.ApplyEasing(Easing.OutQuad, Math.Clamp((timingPoint.BPM - 30) / 480, 0, 1)); - weight.MoveToY((float)Interpolation.Lerp(0, 0.9f, bpmRatio), 600, Easing.OutQuint); + weight.MoveToY((float)Interpolation.Lerp(0.07f, 0.9f, bpmRatio), 600, Easing.OutQuint); } if (BeatSyncClock?.IsRunning != true && isSwinging) @@ -215,7 +264,7 @@ namespace osu.Game.Screens.Edit.Timing { base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); - float angle = (float)Interpolation.Lerp(25, 4, bpmRatio); + float angle = (float)Interpolation.Lerp(30, 5, bpmRatio); if (!IsBeatSyncedWithTrack) return; From 79878a4ec21cab922d4ed10295fa0f9eac8ecda2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 May 2022 16:25:24 +0900 Subject: [PATCH 1099/2328] Metrics adjust and labelling --- .../Screens/Edit/Timing/TapTimingControl.cs | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index 7507a7dd35..3aff74d359 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -116,26 +116,27 @@ namespace osu.Game.Screens.Edit.Timing [BackgroundDependencyLoader] private void load() { + const float taper = 30; + const float swing_vertical_offset = -23; + + var triangleSize = new Vector2(90, 120 + taper); + Margin = new MarginPadding(10); - const float taper = 10; - - var triangleSize = new Vector2(80, 120); - AutoSizeAxes = Axes.Both; - const float stick_vertical_offset = -23; - InternalChildren = new Drawable[] { new Container { + Name = @"Taper adjust", Masking = true, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Size = new Vector2(triangleSize.X * 1.2f, triangleSize.Y - taper), Child = new Triangle { + Name = @"Main body", Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Size = triangleSize, @@ -144,15 +145,17 @@ namespace osu.Game.Screens.Edit.Timing }, swing = new Container { + Name = @"Swing", RelativeSizeAxes = Axes.Both, - Y = stick_vertical_offset, - Height = 0.8f, + Y = swing_vertical_offset, + Height = 0.80f, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Children = new[] { stick = new Circle { + Name = @"Stick", RelativeSizeAxes = Axes.Y, Colour = overlayColourProvider.Colour2, Anchor = Anchor.BottomCentre, @@ -161,6 +164,7 @@ namespace osu.Game.Screens.Edit.Timing }, weight = new Container { + Name = @"Weight", Anchor = Anchor.TopCentre, Origin = Anchor.Centre, Colour = overlayColourProvider.Colour1, @@ -186,7 +190,8 @@ namespace osu.Game.Screens.Edit.Timing }, new Circle { - Y = stick_vertical_offset, + Name = @"Swing connection point", + Y = swing_vertical_offset, Anchor = Anchor.BottomCentre, Origin = Anchor.Centre, Colour = overlayColourProvider.Colour0, @@ -194,6 +199,7 @@ namespace osu.Game.Screens.Edit.Timing }, new Container { + Name = @"Lower cover", Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.Both, @@ -213,6 +219,7 @@ namespace osu.Game.Screens.Edit.Timing }, bpm = new OsuSpriteText { + Name = @"BPM display", Colour = overlayColourProvider.Content1, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, From 21072a26ef30547bbbee7b802bcd918caac4296c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 May 2022 16:33:27 +0900 Subject: [PATCH 1100/2328] Add locking wedge --- .../Screens/Edit/Timing/TapTimingControl.cs | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index 3aff74d359..323561f0a8 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -133,14 +133,17 @@ namespace osu.Game.Screens.Edit.Timing Masking = true, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Size = new Vector2(triangleSize.X * 1.2f, triangleSize.Y - taper), - Child = new Triangle + Size = new Vector2(triangleSize.X, triangleSize.Y - taper), + Children = new Drawable[] { - Name = @"Main body", - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - Size = triangleSize, - Colour = overlayColourProvider.Background3, + new Triangle + { + Name = @"Main body", + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Size = triangleSize, + Colour = overlayColourProvider.Background3, + }, }, }, swing = new Container @@ -188,6 +191,25 @@ namespace osu.Game.Screens.Edit.Timing }, } }, + new Container + { + Name = @"Taper adjust", + Masking = true, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Size = new Vector2(triangleSize.X, triangleSize.Y - taper), + Children = new Drawable[] + { + new Circle + { + Name = @"Locking wedge", + Anchor = Anchor.TopCentre, + Origin = Anchor.Centre, + Colour = overlayColourProvider.Background1, + Size = new Vector2(8), + } + }, + }, new Circle { Name = @"Swing connection point", From 8487d2c48a41010245ba0b1a527ab821935520ac Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 May 2022 16:45:01 +0900 Subject: [PATCH 1101/2328] Interpolate bpm label and fix incorrect angle logic --- .../Screens/Edit/Timing/TapTimingControl.cs | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index 323561f0a8..4ab731c897 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -4,6 +4,7 @@ using System; using osu.Framework.Allocation; using osu.Framework.Audio.Track; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -105,7 +106,7 @@ namespace osu.Game.Screens.Edit.Timing { private Container swing; - private OsuSpriteText bpm; + private OsuSpriteText bpmText; private Drawable weight; private Drawable stick; @@ -116,7 +117,7 @@ namespace osu.Game.Screens.Edit.Timing [BackgroundDependencyLoader] private void load() { - const float taper = 30; + const float taper = 25; const float swing_vertical_offset = -23; var triangleSize = new Vector2(90, 120 + taper); @@ -226,7 +227,7 @@ namespace osu.Game.Screens.Edit.Timing Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.Both, Masking = true, - Height = 0.3f, + Height = 0.28f, Children = new Drawable[] { new Triangle @@ -239,7 +240,7 @@ namespace osu.Game.Screens.Edit.Timing }, } }, - bpm = new OsuSpriteText + bpmText = new OsuSpriteText { Name = @"BPM display", Colour = overlayColourProvider.Content1, @@ -254,9 +255,17 @@ namespace osu.Game.Screens.Edit.Timing private TimingControlPoint timingPoint; - private float bpmRatio; private bool isSwinging; + private readonly BindableInt interpolatedBpm = new BindableInt(); + + protected override void LoadComplete() + { + base.LoadComplete(); + + interpolatedBpm.BindValueChanged(bpm => bpmText.Text = bpm.NewValue.ToString()); + } + protected override void Update() { base.Update(); @@ -266,13 +275,13 @@ namespace osu.Game.Screens.Edit.Timing if (beatLength != timingPoint.BeatLength) { beatLength = timingPoint.BeatLength; - bpm.Text = $"{timingPoint.BPM:F0}"; EarlyActivationMilliseconds = timingPoint.BeatLength / 2; - bpmRatio = (float)Interpolation.ApplyEasing(Easing.OutQuad, Math.Clamp((timingPoint.BPM - 30) / 480, 0, 1)); + float bpmRatio = (float)Interpolation.ApplyEasing(Easing.OutQuad, Math.Clamp((timingPoint.BPM - 30) / 480, 0, 1)); - weight.MoveToY((float)Interpolation.Lerp(0.07f, 0.9f, bpmRatio), 600, Easing.OutQuint); + weight.MoveToY((float)Interpolation.Lerp(0.1f, 0.83f, bpmRatio), 600, Easing.OutQuint); + this.TransformBindableTo(interpolatedBpm, (int)timingPoint.BPM, 600, Easing.OutQuint); } if (BeatSyncClock?.IsRunning != true && isSwinging) @@ -293,7 +302,7 @@ namespace osu.Game.Screens.Edit.Timing { base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); - float angle = (float)Interpolation.Lerp(30, 5, bpmRatio); + const float angle = 27.5f; if (!IsBeatSyncedWithTrack) return; From 4712e512d71810e0be81428275382372eca91fac Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 May 2022 16:48:07 +0900 Subject: [PATCH 1102/2328] Apply edge smoothness and make weight more accented --- osu.Game/Screens/Edit/Timing/TapTimingControl.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index 4ab731c897..bdab427c58 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -140,6 +140,7 @@ namespace osu.Game.Screens.Edit.Timing new Triangle { Name = @"Main body", + EdgeSmoothness = new Vector2(1), Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Size = triangleSize, @@ -171,7 +172,7 @@ namespace osu.Game.Screens.Edit.Timing Name = @"Weight", Anchor = Anchor.TopCentre, Origin = Anchor.Centre, - Colour = overlayColourProvider.Colour1, + Colour = overlayColourProvider.Colour0, Size = new Vector2(10), Rotation = 180, RelativePositionAxes = Axes.Y, @@ -182,11 +183,13 @@ namespace osu.Game.Screens.Edit.Timing { RelativeSizeAxes = Axes.Both, Shear = new Vector2(0.2f, 0), + EdgeSmoothness = new Vector2(1), }, new Box { RelativeSizeAxes = Axes.Both, Shear = new Vector2(-0.2f, 0), + EdgeSmoothness = new Vector2(1), }, } }, @@ -236,6 +239,7 @@ namespace osu.Game.Screens.Edit.Timing Origin = Anchor.BottomCentre, Size = triangleSize, Colour = overlayColourProvider.Background2, + EdgeSmoothness = new Vector2(1), Alpha = 0.8f }, } From cf97f4e409aa57e7883b0a36d037ae588c4683b7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 May 2022 16:55:07 +0900 Subject: [PATCH 1103/2328] Add centre marker --- osu.Game/Screens/Edit/Timing/TapTimingControl.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index bdab427c58..a99468fbff 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -119,6 +119,7 @@ namespace osu.Game.Screens.Edit.Timing { const float taper = 25; const float swing_vertical_offset = -23; + const float lower_cover_height = 32; var triangleSize = new Vector2(90, 120 + taper); @@ -148,6 +149,17 @@ namespace osu.Game.Screens.Edit.Timing }, }, }, + new Circle + { + Name = "Centre marker", + Colour = overlayColourProvider.Background5, + RelativeSizeAxes = Axes.Y, + Width = 2, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Y = -(lower_cover_height + 3), + Height = 0.65f, + }, swing = new Container { Name = @"Swing", @@ -228,9 +240,9 @@ namespace osu.Game.Screens.Edit.Timing Name = @"Lower cover", Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - RelativeSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.X, Masking = true, - Height = 0.28f, + Height = lower_cover_height, Children = new Drawable[] { new Triangle From 2e21d75b101d4aabb3a2dba05ef2e7306c6976ce Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 May 2022 17:12:35 +0900 Subject: [PATCH 1104/2328] Move metronome into own class and rename to avoid conflict with mod sounds --- .../Mods/TestSceneOsuModMuted.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs | 2 +- .../Editing/TestSceneTapTimingControl.cs | 6 +- .../Mods/{Metronome.cs => MetronomeBeat.cs} | 4 +- osu.Game/Rulesets/Mods/ModMuted.cs | 6 +- .../Screens/Edit/Timing/MetronomeDisplay.cs | 255 +++++++++++++++++ .../Screens/Edit/Timing/TapTimingControl.cs | 261 +----------------- 7 files changed, 277 insertions(+), 259 deletions(-) rename osu.Game/Rulesets/Mods/{Metronome.cs => MetronomeBeat.cs} (95%) create mode 100644 osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMuted.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMuted.cs index c14dc78f38..e08d66fa31 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMuted.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMuted.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods MuteComboCount = { Value = 0 }, }, PassCondition = () => Beatmap.Value.Track.AggregateVolume.Value == 0.0 && - Player.ChildrenOfType().SingleOrDefault()?.AggregateVolume.Value == 1.0, + Player.ChildrenOfType().SingleOrDefault()?.AggregateVolume.Value == 1.0, }); /// diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs index 5b121f4673..c58c624f5c 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs @@ -339,7 +339,7 @@ namespace osu.Game.Rulesets.Osu.Mods public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) { - drawableRuleset.Overlays.Add(new Metronome(drawableRuleset.Beatmap.HitObjects.First().StartTime)); + drawableRuleset.Overlays.Add(new MetronomeBeat(drawableRuleset.Beatmap.HitObjects.First().StartTime)); } #endregion diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs b/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs index 9b2618df5b..de441995b5 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs @@ -73,7 +73,7 @@ namespace osu.Game.Tests.Visual.Editing AddStep("click tap button", () => { control.ChildrenOfType() - .First(b => b.Text == "Tap to beat") + .Last() .TriggerClick(); }); @@ -82,7 +82,7 @@ namespace osu.Game.Tests.Visual.Editing AddStep("click reset button", () => { control.ChildrenOfType() - .First(b => b.Text == "Reset") + .First() .TriggerClick(); }); @@ -100,7 +100,7 @@ namespace osu.Game.Tests.Visual.Editing AddStep("click tap button", () => { control.ChildrenOfType() - .First(b => b.Text == "Tap to beat") + .Last() .TriggerClick(); }); diff --git a/osu.Game/Rulesets/Mods/Metronome.cs b/osu.Game/Rulesets/Mods/MetronomeBeat.cs similarity index 95% rename from osu.Game/Rulesets/Mods/Metronome.cs rename to osu.Game/Rulesets/Mods/MetronomeBeat.cs index b85a341577..c7a8b02130 100644 --- a/osu.Game/Rulesets/Mods/Metronome.cs +++ b/osu.Game/Rulesets/Mods/MetronomeBeat.cs @@ -11,14 +11,14 @@ using osu.Game.Skinning; namespace osu.Game.Rulesets.Mods { - public class Metronome : BeatSyncedContainer, IAdjustableAudioComponent + public class MetronomeBeat : BeatSyncedContainer, IAdjustableAudioComponent { private readonly double firstHitTime; private readonly PausableSkinnableSound sample; /// Start time of the first hit object, used for providing a count down. - public Metronome(double firstHitTime) + public MetronomeBeat(double firstHitTime) { this.firstHitTime = firstHitTime; AllowMistimedEventFiring = false; diff --git a/osu.Game/Rulesets/Mods/ModMuted.cs b/osu.Game/Rulesets/Mods/ModMuted.cs index a7d3114f2b..84341faab7 100644 --- a/osu.Game/Rulesets/Mods/ModMuted.cs +++ b/osu.Game/Rulesets/Mods/ModMuted.cs @@ -79,11 +79,11 @@ namespace osu.Game.Rulesets.Mods { if (EnableMetronome.Value) { - Metronome metronome; + MetronomeBeat metronomeBeat; - drawableRuleset.Overlays.Add(metronome = new Metronome(drawableRuleset.Beatmap.HitObjects.First().StartTime)); + drawableRuleset.Overlays.Add(metronomeBeat = new MetronomeBeat(drawableRuleset.Beatmap.HitObjects.First().StartTime)); - metronome.AddAdjustment(AdjustableProperty.Volume, metronomeVolumeAdjust); + metronomeBeat.AddAdjustment(AdjustableProperty.Volume, metronomeVolumeAdjust); } if (AffectsHitSounds.Value) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs new file mode 100644 index 0000000000..fdd5bd1e4e --- /dev/null +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -0,0 +1,255 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Allocation; +using osu.Framework.Audio.Track; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Utils; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; +using osuTK; + +namespace osu.Game.Screens.Edit.Timing +{ + public class MetronomeDisplay : BeatSyncedContainer + { + private Container swing; + + private OsuSpriteText bpmText; + + private Drawable weight; + private Drawable stick; + + [Resolved] + private OverlayColourProvider overlayColourProvider { get; set; } + + [BackgroundDependencyLoader] + private void load() + { + const float taper = 25; + const float swing_vertical_offset = -23; + const float lower_cover_height = 32; + + var triangleSize = new Vector2(90, 120 + taper); + + Margin = new MarginPadding(10); + + AutoSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + new Container + { + Name = @"Taper adjust", + Masking = true, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Size = new Vector2(triangleSize.X, triangleSize.Y - taper), + Children = new Drawable[] + { + new Triangle + { + Name = @"Main body", + EdgeSmoothness = new Vector2(1), + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Size = triangleSize, + Colour = overlayColourProvider.Background3, + }, + }, + }, + new Circle + { + Name = "Centre marker", + Colour = overlayColourProvider.Background5, + RelativeSizeAxes = Axes.Y, + Width = 2, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Y = -(lower_cover_height + 3), + Height = 0.65f, + }, + swing = new Container + { + Name = @"Swing", + RelativeSizeAxes = Axes.Both, + Y = swing_vertical_offset, + Height = 0.80f, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Children = new[] + { + stick = new Circle + { + Name = @"Stick", + RelativeSizeAxes = Axes.Y, + Colour = overlayColourProvider.Colour2, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Width = 4, + }, + weight = new Container + { + Name = @"Weight", + Anchor = Anchor.TopCentre, + Origin = Anchor.Centre, + Colour = overlayColourProvider.Colour0, + Size = new Vector2(10), + Rotation = 180, + RelativePositionAxes = Axes.Y, + Y = 0.4f, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Shear = new Vector2(0.2f, 0), + EdgeSmoothness = new Vector2(1), + }, + new Box + { + RelativeSizeAxes = Axes.Both, + Shear = new Vector2(-0.2f, 0), + EdgeSmoothness = new Vector2(1), + }, + } + }, + } + }, + new Container + { + Name = @"Taper adjust", + Masking = true, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Size = new Vector2(triangleSize.X, triangleSize.Y - taper), + Children = new Drawable[] + { + new Circle + { + Name = @"Locking wedge", + Anchor = Anchor.TopCentre, + Origin = Anchor.Centre, + Colour = overlayColourProvider.Background1, + Size = new Vector2(8), + } + }, + }, + new Circle + { + Name = @"Swing connection point", + Y = swing_vertical_offset, + Anchor = Anchor.BottomCentre, + Origin = Anchor.Centre, + Colour = overlayColourProvider.Colour0, + Size = new Vector2(8) + }, + new Container + { + Name = @"Lower cover", + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Masking = true, + Height = lower_cover_height, + Children = new Drawable[] + { + new Triangle + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Size = triangleSize, + Colour = overlayColourProvider.Background2, + EdgeSmoothness = new Vector2(1), + Alpha = 0.8f + }, + } + }, + bpmText = new OsuSpriteText + { + Name = @"BPM display", + Colour = overlayColourProvider.Content1, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Y = -3, + }, + }; + } + + private double beatLength; + + private TimingControlPoint timingPoint; + + private bool isSwinging; + + private readonly BindableInt interpolatedBpm = new BindableInt(); + + protected override void LoadComplete() + { + base.LoadComplete(); + + interpolatedBpm.BindValueChanged(bpm => bpmText.Text = bpm.NewValue.ToString()); + } + + protected override void Update() + { + base.Update(); + + timingPoint = Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(BeatSyncClock.CurrentTime); + + if (beatLength != timingPoint.BeatLength) + { + beatLength = timingPoint.BeatLength; + + EarlyActivationMilliseconds = timingPoint.BeatLength / 2; + + float bpmRatio = (float)Interpolation.ApplyEasing(Easing.OutQuad, Math.Clamp((timingPoint.BPM - 30) / 480, 0, 1)); + + weight.MoveToY((float)Interpolation.Lerp(0.1f, 0.83f, bpmRatio), 600, Easing.OutQuint); + this.TransformBindableTo(interpolatedBpm, (int)timingPoint.BPM, 600, Easing.OutQuint); + } + + if (BeatSyncClock?.IsRunning != true && isSwinging) + { + swing.ClearTransforms(true); + + using (swing.BeginDelayedSequence(350)) + { + swing.RotateTo(0, 1000, Easing.OutQuint); + stick.FadeColour(overlayColourProvider.Colour2, 1000, Easing.OutQuint); + } + + isSwinging = false; + } + } + + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes) + { + base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + + const float angle = 27.5f; + + if (!IsBeatSyncedWithTrack) + return; + + isSwinging = true; + + float currentAngle = swing.Rotation; + float targetAngle = currentAngle > 0 ? -angle : angle; + + swing.RotateTo(targetAngle, beatLength, Easing.InOutQuad); + + if (currentAngle != 0 && Math.Abs(currentAngle - targetAngle) > angle * 1.8f && isSwinging) + { + using (stick.BeginDelayedSequence(beatLength / 2)) + stick.FlashColour(overlayColourProvider.Content1, beatLength, Easing.OutQuint); + } + } + } +} diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index a99468fbff..1b0f0a3f5e 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -1,21 +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 System; using osu.Framework.Allocation; -using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Utils; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays; -using osuTK; namespace osu.Game.Screens.Edit.Timing { @@ -24,6 +18,9 @@ namespace osu.Game.Screens.Edit.Timing [Resolved] private EditorClock editorClock { get; set; } + [Resolved] + private Bindable selectedGroup { get; set; } + [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider, OsuColour colours) { @@ -52,7 +49,11 @@ namespace osu.Game.Screens.Edit.Timing { new Drawable[] { - new Metronome() + new MetronomeDisplay + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + } }, new Drawable[] { @@ -74,7 +75,7 @@ namespace osu.Game.Screens.Edit.Timing { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - Text = "Tap to beat", + Text = "Play from start", RelativeSizeAxes = Axes.X, BackgroundColour = colourProvider.Background1, Width = 0.68f, @@ -90,252 +91,14 @@ namespace osu.Game.Screens.Edit.Timing private void tap() { - if (!editorClock.IsRunning) - { - editorClock.Seek(0); - editorClock.Start(); - } + editorClock.Seek(selectedGroup.Value.Time); + editorClock.Start(); } private void reset() { editorClock.Stop(); - } - - private class Metronome : BeatSyncedContainer - { - private Container swing; - - private OsuSpriteText bpmText; - - private Drawable weight; - private Drawable stick; - - [Resolved] - private OverlayColourProvider overlayColourProvider { get; set; } - - [BackgroundDependencyLoader] - private void load() - { - const float taper = 25; - const float swing_vertical_offset = -23; - const float lower_cover_height = 32; - - var triangleSize = new Vector2(90, 120 + taper); - - Margin = new MarginPadding(10); - - AutoSizeAxes = Axes.Both; - - InternalChildren = new Drawable[] - { - new Container - { - Name = @"Taper adjust", - Masking = true, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - Size = new Vector2(triangleSize.X, triangleSize.Y - taper), - Children = new Drawable[] - { - new Triangle - { - Name = @"Main body", - EdgeSmoothness = new Vector2(1), - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - Size = triangleSize, - Colour = overlayColourProvider.Background3, - }, - }, - }, - new Circle - { - Name = "Centre marker", - Colour = overlayColourProvider.Background5, - RelativeSizeAxes = Axes.Y, - Width = 2, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - Y = -(lower_cover_height + 3), - Height = 0.65f, - }, - swing = new Container - { - Name = @"Swing", - RelativeSizeAxes = Axes.Both, - Y = swing_vertical_offset, - Height = 0.80f, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - Children = new[] - { - stick = new Circle - { - Name = @"Stick", - RelativeSizeAxes = Axes.Y, - Colour = overlayColourProvider.Colour2, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - Width = 4, - }, - weight = new Container - { - Name = @"Weight", - Anchor = Anchor.TopCentre, - Origin = Anchor.Centre, - Colour = overlayColourProvider.Colour0, - Size = new Vector2(10), - Rotation = 180, - RelativePositionAxes = Axes.Y, - Y = 0.4f, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Shear = new Vector2(0.2f, 0), - EdgeSmoothness = new Vector2(1), - }, - new Box - { - RelativeSizeAxes = Axes.Both, - Shear = new Vector2(-0.2f, 0), - EdgeSmoothness = new Vector2(1), - }, - } - }, - } - }, - new Container - { - Name = @"Taper adjust", - Masking = true, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - Size = new Vector2(triangleSize.X, triangleSize.Y - taper), - Children = new Drawable[] - { - new Circle - { - Name = @"Locking wedge", - Anchor = Anchor.TopCentre, - Origin = Anchor.Centre, - Colour = overlayColourProvider.Background1, - Size = new Vector2(8), - } - }, - }, - new Circle - { - Name = @"Swing connection point", - Y = swing_vertical_offset, - Anchor = Anchor.BottomCentre, - Origin = Anchor.Centre, - Colour = overlayColourProvider.Colour0, - Size = new Vector2(8) - }, - new Container - { - Name = @"Lower cover", - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - RelativeSizeAxes = Axes.X, - Masking = true, - Height = lower_cover_height, - Children = new Drawable[] - { - new Triangle - { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - Size = triangleSize, - Colour = overlayColourProvider.Background2, - EdgeSmoothness = new Vector2(1), - Alpha = 0.8f - }, - } - }, - bpmText = new OsuSpriteText - { - Name = @"BPM display", - Colour = overlayColourProvider.Content1, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - Y = -3, - }, - }; - } - - private double beatLength; - - private TimingControlPoint timingPoint; - - private bool isSwinging; - - private readonly BindableInt interpolatedBpm = new BindableInt(); - - protected override void LoadComplete() - { - base.LoadComplete(); - - interpolatedBpm.BindValueChanged(bpm => bpmText.Text = bpm.NewValue.ToString()); - } - - protected override void Update() - { - base.Update(); - - timingPoint = Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(BeatSyncClock.CurrentTime); - - if (beatLength != timingPoint.BeatLength) - { - beatLength = timingPoint.BeatLength; - - EarlyActivationMilliseconds = timingPoint.BeatLength / 2; - - float bpmRatio = (float)Interpolation.ApplyEasing(Easing.OutQuad, Math.Clamp((timingPoint.BPM - 30) / 480, 0, 1)); - - weight.MoveToY((float)Interpolation.Lerp(0.1f, 0.83f, bpmRatio), 600, Easing.OutQuint); - this.TransformBindableTo(interpolatedBpm, (int)timingPoint.BPM, 600, Easing.OutQuint); - } - - if (BeatSyncClock?.IsRunning != true && isSwinging) - { - swing.ClearTransforms(true); - - using (swing.BeginDelayedSequence(350)) - { - swing.RotateTo(0, 1000, Easing.OutQuint); - stick.FadeColour(overlayColourProvider.Colour2, 1000, Easing.OutQuint); - } - - isSwinging = false; - } - } - - protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes) - { - base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); - - const float angle = 27.5f; - - if (!IsBeatSyncedWithTrack) - return; - - isSwinging = true; - - float currentAngle = swing.Rotation; - float targetAngle = currentAngle > 0 ? -angle : angle; - - swing.RotateTo(targetAngle, beatLength, Easing.InOutQuad); - - if (currentAngle != 0 && Math.Abs(currentAngle - targetAngle) > angle * 1.8f && isSwinging) - { - using (stick.BeginDelayedSequence(beatLength / 2)) - stick.FlashColour(overlayColourProvider.Content1, beatLength, Easing.OutQuint); - } - } + editorClock.Seek(selectedGroup.Value.Time); } } } From 82eb5fd2c9007945d7432e22433ebeded94b7066 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 May 2022 17:21:56 +0900 Subject: [PATCH 1105/2328] Add centre line on weight --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index fdd5bd1e4e..5429165fe0 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Utils; @@ -99,7 +100,6 @@ namespace osu.Game.Screens.Edit.Timing Name = @"Weight", Anchor = Anchor.TopCentre, Origin = Anchor.Centre, - Colour = overlayColourProvider.Colour0, Size = new Vector2(10), Rotation = 180, RelativePositionAxes = Axes.Y, @@ -110,14 +110,25 @@ namespace osu.Game.Screens.Edit.Timing { RelativeSizeAxes = Axes.Both, Shear = new Vector2(0.2f, 0), + Colour = overlayColourProvider.Colour1, EdgeSmoothness = new Vector2(1), }, new Box { RelativeSizeAxes = Axes.Both, Shear = new Vector2(-0.2f, 0), + Colour = overlayColourProvider.Colour1, EdgeSmoothness = new Vector2(1), }, + new Circle + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Colour = ColourInfo.GradientVertical(overlayColourProvider.Colour1, overlayColourProvider.Colour0), + RelativeSizeAxes = Axes.Y, + Width = 1, + Height = 0.9f + }, } }, } From b29172ea45fea63d8e48b85aee346d9d607f0dfa Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 19 May 2022 19:55:51 +0900 Subject: [PATCH 1106/2328] Increase HP lost for misses --- osu.Game/Rulesets/Judgements/Judgement.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Judgements/Judgement.cs b/osu.Game/Rulesets/Judgements/Judgement.cs index 4fe34e15fd..99dce82ec2 100644 --- a/osu.Game/Rulesets/Judgements/Judgement.cs +++ b/osu.Game/Rulesets/Judgements/Judgement.cs @@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Judgements return -DEFAULT_MAX_HEALTH_INCREASE; case HitResult.Miss: - return -DEFAULT_MAX_HEALTH_INCREASE; + return -DEFAULT_MAX_HEALTH_INCREASE * 2; case HitResult.Meh: return DEFAULT_MAX_HEALTH_INCREASE * 0.05; From c78d90ccbdc92bb090c9840934ce70986c409a08 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 20 May 2022 14:43:07 +0300 Subject: [PATCH 1107/2328] Refactor track transferring logic for ability to override and disallow --- osu.Game/Beatmaps/WorkingBeatmap.cs | 16 ++++++++++++---- osu.Game/Overlays/MusicController.cs | 9 +-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index bb64ec796c..a1a8306b76 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -126,11 +126,19 @@ namespace osu.Game.Beatmaps } /// - /// Transfer a valid audio track into this working beatmap. Used as an optimisation to avoid reload / track swap - /// across difficulties in the same beatmap set. + /// Attempts to transfer the audio track to a target working beatmap, if valid for transferring. + /// Used as an optimisation to avoid reload / track swap across difficulties in the same beatmap set. /// - /// The track to transfer. - public void TransferTrack([NotNull] Track track) => this.track = track ?? throw new ArgumentNullException(nameof(track)); + /// The target working beatmap to transfer this track to. + /// Whether the track is valid and has been transferred to this working beatmap. + public virtual bool TryTransferTrack([NotNull] WorkingBeatmap target) + { + if (BeatmapInfo?.AudioEquals(target.BeatmapInfo) != true) + return false; + + target.track = track; + return true; + } /// /// Get the loaded audio track instance. must have first been called. diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 65b06eb864..509da4302d 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -290,15 +290,8 @@ namespace osu.Game.Overlays current = newWorking; - if (!audioEquals || CurrentTrack.IsDummyDevice) - { + if (lastWorking == null || !lastWorking.TryTransferTrack(current)) changeTrack(); - } - else - { - // transfer still valid track to new working beatmap - current.TransferTrack(lastWorking.Track); - } TrackChanged?.Invoke(current, direction); From cef99fd0205ba17f515a95530adb2ad0a6296bed Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 20 May 2022 14:43:50 +0300 Subject: [PATCH 1108/2328] Disallow transferring track from test `WorkingBeatmap`s which have local stores --- osu.Game.Tests/WaveformTestBeatmap.cs | 7 +++++++ osu.Game/Tests/Visual/OsuTestScene.cs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/osu.Game.Tests/WaveformTestBeatmap.cs b/osu.Game.Tests/WaveformTestBeatmap.cs index 9c85fa0c9c..ab7bf7fb73 100644 --- a/osu.Game.Tests/WaveformTestBeatmap.cs +++ b/osu.Game.Tests/WaveformTestBeatmap.cs @@ -59,6 +59,13 @@ namespace osu.Game.Tests protected override Track GetBeatmapTrack() => trackStore.Get(firstAudioFile); + public override bool TryTransferTrack(WorkingBeatmap target) + { + // Our track comes from a local track store that's disposed on finalizer, + // therefore it's unsafe to transfer it to another working beatmap. + return false; + } + private string firstAudioFile { get diff --git a/osu.Game/Tests/Visual/OsuTestScene.cs b/osu.Game/Tests/Visual/OsuTestScene.cs index f2d280417e..1582bdfca4 100644 --- a/osu.Game/Tests/Visual/OsuTestScene.cs +++ b/osu.Game/Tests/Visual/OsuTestScene.cs @@ -373,6 +373,13 @@ namespace osu.Game.Tests.Visual protected override Track GetBeatmapTrack() => track; + public override bool TryTransferTrack(WorkingBeatmap target) + { + // Our track comes from a local track store that's disposed on finalizer, + // therefore it's unsafe to transfer it to another working beatmap. + return false; + } + public class TrackVirtualStore : AudioCollectionManager, ITrackStore { private readonly IFrameBasedClock referenceClock; From abf9039109389dd8b869fed1c2778dedd0c76b5c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 20 May 2022 14:44:07 +0300 Subject: [PATCH 1109/2328] Use `==` instead of `??` --- osu.Game/Overlays/MusicController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 509da4302d..aa09ff6b97 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -267,7 +267,7 @@ namespace osu.Game.Overlays TrackChangeDirection direction = TrackChangeDirection.None; - bool audioEquals = newWorking?.BeatmapInfo?.AudioEquals(current?.BeatmapInfo) ?? false; + bool audioEquals = newWorking?.BeatmapInfo?.AudioEquals(current?.BeatmapInfo) == true; if (current != null) { From c3bfbe888003f733137617e8629725bdadd1c506 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 May 2022 23:23:51 +0900 Subject: [PATCH 1110/2328] Allow `BeatSyncedContainer` to prefer `EditorBeatmap` when available --- .../TestSceneBeatSyncedContainer.cs | 19 +------------ .../Containers/BeatSyncedContainer.cs | 28 +++++++++++++------ 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs index ede89c6096..1881f6d718 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs @@ -258,24 +258,7 @@ namespace osu.Game.Tests.Visual.UserInterface }; } - protected override void LoadComplete() - { - base.LoadComplete(); - - Beatmap.BindValueChanged(_ => - { - timingPointCount.Value = 0; - currentTimingPoint.Value = 0; - beatCount.Value = 0; - currentBeat.Value = 0; - beatsPerMinute.Value = 0; - adjustedBeatLength.Value = 0; - timeUntilNextBeat.Value = 0; - timeSinceLastBeat.Value = 0; - }, true); - } - - private List timingPoints => Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints.ToList(); + private List timingPoints => Beatmap.ControlPointInfo.TimingPoints.ToList(); private TimingControlPoint getNextTimingPoint(TimingControlPoint current) { diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index 2024d18570..48936f7aa9 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Screens.Edit; using osu.Game.Screens.Play; namespace osu.Game.Graphics.Containers @@ -79,20 +80,31 @@ namespace osu.Game.Graphics.Containers } [Resolved] - protected IBindable Beatmap { get; private set; } + private IBindable beatmap { get; set; } [Resolved(canBeNull: true)] protected GameplayClock GameplayClock { get; private set; } + [Resolved(canBeNull: true)] + protected EditorBeatmap EditorBeatmap { get; private set; } + + [Resolved(canBeNull: true)] + protected EditorClock EditorClock { get; private set; } + + protected IBeatmap Beatmap => EditorBeatmap ?? beatmap?.Value.Beatmap; + protected IClock BeatSyncClock { get { + if (EditorClock != null) + return EditorClock; + if (GameplayClock != null) return GameplayClock; - if (Beatmap.Value.TrackLoaded) - return Beatmap.Value.Track; + if (beatmap.Value.TrackLoaded) + return beatmap.Value.Track; return null; } @@ -101,7 +113,6 @@ namespace osu.Game.Graphics.Containers protected override void Update() { ITrack track = null; - IBeatmap beatmap = null; TimingControlPoint timingPoint; EffectControlPoint effectPoint; @@ -113,10 +124,9 @@ namespace osu.Game.Graphics.Containers double currentTrackTime = clock.CurrentTime + EarlyActivationMilliseconds; - if (Beatmap.Value.TrackLoaded && Beatmap.Value.BeatmapLoaded) + if (this.beatmap.Value.TrackLoaded && this.beatmap.Value.BeatmapLoaded) { - track = Beatmap.Value.Track; - beatmap = Beatmap.Value.Beatmap; + track = this.beatmap.Value.Track; } IsBeatSyncedWithTrack = beatmap != null && clock.IsRunning && track?.Length > 0; @@ -125,8 +135,8 @@ namespace osu.Game.Graphics.Containers { Debug.Assert(beatmap != null); - timingPoint = beatmap.ControlPointInfo.TimingPointAt(currentTrackTime); - effectPoint = beatmap.ControlPointInfo.EffectPointAt(currentTrackTime); + timingPoint = Beatmap.ControlPointInfo.TimingPointAt(currentTrackTime); + effectPoint = Beatmap.ControlPointInfo.EffectPointAt(currentTrackTime); } else { From 8db80b92bb04f642e58e95de70c6309e2be44876 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 May 2022 23:24:21 +0900 Subject: [PATCH 1111/2328] Fix metronome not using `EditorBeatmap` causing editor updates to not propagate immediately --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 5429165fe0..d51d7b9c58 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Audio.Track; using osu.Framework.Bindables; @@ -30,6 +31,9 @@ namespace osu.Game.Screens.Edit.Timing [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } + [Resolved] + private EditorBeatmap editorBeatmap { get; set; } + [BackgroundDependencyLoader] private void load() { @@ -205,14 +209,14 @@ namespace osu.Game.Screens.Edit.Timing { base.LoadComplete(); - interpolatedBpm.BindValueChanged(bpm => bpmText.Text = bpm.NewValue.ToString()); + interpolatedBpm.BindValueChanged(bpm => bpmText.Text = bpm.NewValue.ToString(CultureInfo.CurrentCulture)); } protected override void Update() { base.Update(); - timingPoint = Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(BeatSyncClock.CurrentTime); + timingPoint = editorBeatmap.ControlPointInfo.TimingPointAt(BeatSyncClock.CurrentTime); if (beatLength != timingPoint.BeatLength) { @@ -223,7 +227,7 @@ namespace osu.Game.Screens.Edit.Timing float bpmRatio = (float)Interpolation.ApplyEasing(Easing.OutQuad, Math.Clamp((timingPoint.BPM - 30) / 480, 0, 1)); weight.MoveToY((float)Interpolation.Lerp(0.1f, 0.83f, bpmRatio), 600, Easing.OutQuint); - this.TransformBindableTo(interpolatedBpm, (int)timingPoint.BPM, 600, Easing.OutQuint); + this.TransformBindableTo(interpolatedBpm, (int)Math.Round(timingPoint.BPM), 600, Easing.OutQuint); } if (BeatSyncClock?.IsRunning != true && isSwinging) From a2950d9d4e096ca6d09506e0ab01736651e9100f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 May 2022 23:49:03 +0900 Subject: [PATCH 1112/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index b984f528fe..27fcdd4f6e 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 7f149b4e35..53a4753223 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 932421a705..2e861faa1f 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From de8aedf3484229b27920873abd4bc02a50bc81cd Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 20 May 2022 17:29:37 +0300 Subject: [PATCH 1113/2328] Add failing test case --- .../SongSelect/TestSceneBeatmapInfoWedge.cs | 40 +++++++++++++++---- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs index 644a333fcf..995274e722 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using System.Globalization; using System.Linq; using JetBrains.Annotations; using NUnit.Framework; @@ -127,6 +126,12 @@ namespace osu.Game.Tests.Visual.SongSelect AddAssert("check info labels count", () => infoWedge.Info.ChildrenOfType().Count() == expectedCount); } + [SetUpSteps] + public void SetUpSteps() + { + AddStep("reset mods", () => SelectedMods.SetDefault()); + } + [Test] public void TestNullBeatmap() { @@ -147,24 +152,43 @@ namespace osu.Game.Tests.Visual.SongSelect [Test] public void TestBPMUpdates() { - const float bpm = 120; + const double bpm = 120; IBeatmap beatmap = createTestBeatmap(new OsuRuleset().RulesetInfo); beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 60 * 1000 / bpm }); OsuModDoubleTime doubleTime = null; selectBeatmap(beatmap); - checkDisplayedBPM(bpm); + checkDisplayedBPM($"{bpm}"); AddStep("select DT", () => SelectedMods.Value = new[] { doubleTime = new OsuModDoubleTime() }); - checkDisplayedBPM(bpm * 1.5f); + checkDisplayedBPM($"{bpm * 1.5f}"); AddStep("change DT rate", () => doubleTime.SpeedChange.Value = 2); - checkDisplayedBPM(bpm * 2); + checkDisplayedBPM($"{bpm * 2}"); + } - void checkDisplayedBPM(float target) => - AddUntilStep($"displayed bpm is {target}", () => this.ChildrenOfType().Any( - label => label.Statistic.Name == "BPM" && label.Statistic.Content == target.ToString(CultureInfo.InvariantCulture))); + [TestCase(120, 125, "120-125 (mostly 120)")] + [TestCase(120, 120.6, "120-121 (mostly 120)")] + [TestCase(120, 120.4, "120")] + public void TestVaryingBPM(double commonBpm, double otherBpm, string expectedDisplay) + { + IBeatmap beatmap = createTestBeatmap(new OsuRuleset().RulesetInfo); + beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 60 * 1000 / commonBpm }); + beatmap.ControlPointInfo.Add(100, new TimingControlPoint { BeatLength = 60 * 1000 / otherBpm }); + beatmap.ControlPointInfo.Add(200, new TimingControlPoint { BeatLength = 60 * 1000 / commonBpm }); + + selectBeatmap(beatmap); + checkDisplayedBPM(expectedDisplay); + } + + private void checkDisplayedBPM(string target) + { + AddUntilStep($"displayed bpm is {target}", () => + { + var label = this.ChildrenOfType().Single(l => l.Statistic.Name == "BPM"); + return label.Statistic.Content == target; + }); } private void setRuleset(RulesetInfo rulesetInfo) From 596853da8feb59a5f2c7252e1f0de11763979ad0 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 20 May 2022 17:43:40 +0300 Subject: [PATCH 1114/2328] Fix song select potentially displaying BPM range with equal min/max values --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 7db1016f62..55ade6fa33 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -12,7 +12,6 @@ using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; @@ -416,13 +415,13 @@ namespace osu.Game.Screens.Select foreach (var mod in mods.Value.OfType()) rate = mod.ApplyToRate(0, rate); - double bpmMax = beatmap.ControlPointInfo.BPMMaximum * rate; - double bpmMin = beatmap.ControlPointInfo.BPMMinimum * rate; - double mostCommonBPM = 60000 / beatmap.GetMostCommonBeatLength() * rate; + int bpmMax = (int)Math.Round(beatmap.ControlPointInfo.BPMMaximum * rate); + int bpmMin = (int)Math.Round(beatmap.ControlPointInfo.BPMMinimum * rate); + int mostCommonBPM = (int)Math.Round(60000 / beatmap.GetMostCommonBeatLength() * rate); - string labelText = Precision.AlmostEquals(bpmMin, bpmMax) - ? $"{bpmMin:0}" - : $"{bpmMin:0}-{bpmMax:0} (mostly {mostCommonBPM:0})"; + string labelText = bpmMin == bpmMax + ? $"{bpmMin}" + : $"{bpmMin}-{bpmMax} (mostly {mostCommonBPM})"; bpmLabelContainer.Child = new InfoLabel(new BeatmapStatistic { From 84a3cee452364173ed73d405e3a6caade62263b7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 20 May 2022 17:47:45 +0300 Subject: [PATCH 1115/2328] Apply rate multiplier outside BPM rounding --- .../Visual/SongSelect/TestSceneBeatmapInfoWedge.cs | 13 +++++++++---- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 6 +++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs index 995274e722..030055903f 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs @@ -168,16 +168,21 @@ namespace osu.Game.Tests.Visual.SongSelect checkDisplayedBPM($"{bpm * 2}"); } - [TestCase(120, 125, "120-125 (mostly 120)")] - [TestCase(120, 120.6, "120-121 (mostly 120)")] - [TestCase(120, 120.4, "120")] - public void TestVaryingBPM(double commonBpm, double otherBpm, string expectedDisplay) + [TestCase(120, 125, null, "120-125 (mostly 120)")] + [TestCase(120, 120.6, null, "120-121 (mostly 120)")] + [TestCase(120, 120.4, null, "120")] + [TestCase(120, 120.6, "DT", "180-182 (mostly 180)")] + [TestCase(120, 120.4, "DT", "180")] + public void TestVaryingBPM(double commonBpm, double otherBpm, string mod, string expectedDisplay) { IBeatmap beatmap = createTestBeatmap(new OsuRuleset().RulesetInfo); beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 60 * 1000 / commonBpm }); beatmap.ControlPointInfo.Add(100, new TimingControlPoint { BeatLength = 60 * 1000 / otherBpm }); beatmap.ControlPointInfo.Add(200, new TimingControlPoint { BeatLength = 60 * 1000 / commonBpm }); + if (mod != null) + AddStep($"select {mod}", () => SelectedMods.Value = new[] { Ruleset.Value.CreateInstance().CreateModFromAcronym(mod) }); + selectBeatmap(beatmap); checkDisplayedBPM(expectedDisplay); } diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 55ade6fa33..d98238f518 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -415,9 +415,9 @@ namespace osu.Game.Screens.Select foreach (var mod in mods.Value.OfType()) rate = mod.ApplyToRate(0, rate); - int bpmMax = (int)Math.Round(beatmap.ControlPointInfo.BPMMaximum * rate); - int bpmMin = (int)Math.Round(beatmap.ControlPointInfo.BPMMinimum * rate); - int mostCommonBPM = (int)Math.Round(60000 / beatmap.GetMostCommonBeatLength() * rate); + int bpmMax = (int)Math.Round(Math.Round(beatmap.ControlPointInfo.BPMMaximum) * rate); + int bpmMin = (int)Math.Round(Math.Round(beatmap.ControlPointInfo.BPMMinimum) * rate); + int mostCommonBPM = (int)Math.Round(Math.Round(60000 / beatmap.GetMostCommonBeatLength()) * rate); string labelText = bpmMin == bpmMax ? $"{bpmMin}" From 7dcb88759afcf00ce46e930ce117729fe9d7416f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 21 May 2022 00:28:17 +0900 Subject: [PATCH 1116/2328] Remove unnecessary using statement --- osu.Game/Graphics/ScreenshotManager.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index 1fc2633143..53f7d5791b 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.IO; using System.Threading; using System.Threading.Tasks; using osu.Framework.Allocation; From 1f17652c1d55d0f42a9394af259f668961982077 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 20 May 2022 19:08:41 +0300 Subject: [PATCH 1117/2328] Fix test failure due to async-loading of content --- osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs index 030055903f..ef04baefa2 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs @@ -191,7 +191,7 @@ namespace osu.Game.Tests.Visual.SongSelect { AddUntilStep($"displayed bpm is {target}", () => { - var label = this.ChildrenOfType().Single(l => l.Statistic.Name == "BPM"); + var label = infoWedge.DisplayedContent.ChildrenOfType().Single(l => l.Statistic.Name == "BPM"); return label.Statistic.Content == target; }); } From d3f115bfe2b321a9309be155995d44e6fc0423a4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 21 May 2022 13:53:58 +0900 Subject: [PATCH 1118/2328] Remove redundant qualifiers --- osu.Game/Graphics/Containers/BeatSyncedContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index 48936f7aa9..bd46a20434 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -124,9 +124,9 @@ namespace osu.Game.Graphics.Containers double currentTrackTime = clock.CurrentTime + EarlyActivationMilliseconds; - if (this.beatmap.Value.TrackLoaded && this.beatmap.Value.BeatmapLoaded) + if (beatmap.Value.TrackLoaded && beatmap.Value.BeatmapLoaded) { - track = this.beatmap.Value.Track; + track = beatmap.Value.Track; } IsBeatSyncedWithTrack = beatmap != null && clock.IsRunning && track?.Length > 0; From 5bf17dde9fd244c76a61960f6689741128ed6a60 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 21 May 2022 14:35:07 +0900 Subject: [PATCH 1119/2328] Fix missing `MutatePath` calls --- osu.Game/IO/WrappedStorage.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/IO/WrappedStorage.cs b/osu.Game/IO/WrappedStorage.cs index d4d9d531fa..a465c215e2 100644 --- a/osu.Game/IO/WrappedStorage.cs +++ b/osu.Game/IO/WrappedStorage.cs @@ -67,12 +67,12 @@ namespace osu.Game.IO public override IEnumerable GetFiles(string path, string pattern = "*") => ToLocalRelative(UnderlyingStorage.GetFiles(MutatePath(path), pattern)); - public override Stream CreateFileSafely(string path) => UnderlyingStorage.CreateFileSafely(path); + public override Stream CreateFileSafely(string path) => UnderlyingStorage.CreateFileSafely(MutatePath(path)); public override Stream GetStream(string path, FileAccess access = FileAccess.Read, FileMode mode = FileMode.OpenOrCreate) => UnderlyingStorage.GetStream(MutatePath(path), access, mode); - public override void Move(string from, string to) => UnderlyingStorage.Move(from, to); + public override void Move(string from, string to) => UnderlyingStorage.Move(MutatePath(from), MutatePath(to)); public override bool OpenFileExternally(string filename) => UnderlyingStorage.OpenFileExternally(MutatePath(filename)); From 72386d9377412eb2ba5adef5e06ade4b389cb2ec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 21 May 2022 15:15:52 +0900 Subject: [PATCH 1120/2328] Fix incorrect storage being used in `CreateFileSafely` implementation --- osu.Game/IO/WrappedStorage.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/IO/WrappedStorage.cs b/osu.Game/IO/WrappedStorage.cs index a465c215e2..5887704768 100644 --- a/osu.Game/IO/WrappedStorage.cs +++ b/osu.Game/IO/WrappedStorage.cs @@ -11,7 +11,7 @@ namespace osu.Game.IO /// /// A storage which wraps another storage and delegates implementation, potentially mutating the lookup path. /// - public class WrappedStorage : Storage + public class WrappedStorage : NativeStorage // TODO: Revert to Storage inheritance after https://github.com/ppy/osu-framework/pull/5189 { protected Storage UnderlyingStorage { get; private set; } @@ -67,8 +67,6 @@ namespace osu.Game.IO public override IEnumerable GetFiles(string path, string pattern = "*") => ToLocalRelative(UnderlyingStorage.GetFiles(MutatePath(path), pattern)); - public override Stream CreateFileSafely(string path) => UnderlyingStorage.CreateFileSafely(MutatePath(path)); - public override Stream GetStream(string path, FileAccess access = FileAccess.Read, FileMode mode = FileMode.OpenOrCreate) => UnderlyingStorage.GetStream(MutatePath(path), access, mode); From ba21556d4e9271b7f7e9185eb19b5ccec2b2901c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 21 May 2022 15:54:43 +0900 Subject: [PATCH 1121/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 7910100b1f..aaea784852 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 17bc056b59..5bc65ca507 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 191d1bd5ca..3597e7e5c0 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From c587d10cc3dcef9be569b2b6d453bb2b1c79b1cd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 21 May 2022 15:55:07 +0900 Subject: [PATCH 1122/2328] Revert storage workaround --- osu.Game/IO/WrappedStorage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/IO/WrappedStorage.cs b/osu.Game/IO/WrappedStorage.cs index 5887704768..7205ea3adb 100644 --- a/osu.Game/IO/WrappedStorage.cs +++ b/osu.Game/IO/WrappedStorage.cs @@ -11,7 +11,7 @@ namespace osu.Game.IO /// /// A storage which wraps another storage and delegates implementation, potentially mutating the lookup path. /// - public class WrappedStorage : NativeStorage // TODO: Revert to Storage inheritance after https://github.com/ppy/osu-framework/pull/5189 + public class WrappedStorage : Storage { protected Storage UnderlyingStorage { get; private set; } From a7aa36a825cc9589ee6f3cf5bf2f5792d8df09cd Mon Sep 17 00:00:00 2001 From: maromalo <54760464+maromalo@users.noreply.github.com> Date: Sat, 21 May 2022 04:55:42 -0300 Subject: [PATCH 1123/2328] Add OnPressed to button --- .../Screens/OnlinePlay/Match/RoomSubScreen.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs index 13b2c37ded..61798b5413 100644 --- a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs @@ -15,9 +15,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Bindings; +using osu.Framework.Input.Events; using osu.Framework.Screens; using osu.Game.Audio; using osu.Game.Beatmaps; +using osu.Game.Input.Bindings; using osu.Game.Online.Rooms; using osu.Game.Overlays; using osu.Game.Overlays.Mods; @@ -473,8 +476,19 @@ namespace osu.Game.Screens.OnlinePlay.Match /// The room to change the settings of. protected abstract RoomSettingsOverlay CreateRoomSettingsOverlay(Room room); - public class UserModSelectButton : PurpleTriangleButton + public class UserModSelectButton : PurpleTriangleButton, IKeyBindingHandler { + public virtual bool OnPressed(KeyBindingPressEvent e) + { + if (e.Action == GlobalAction.ToggleModSelection && !e.Repeat) + { + TriggerClick(); + return true; + } + return false; + } + + public virtual void OnReleased(KeyBindingReleaseEvent e) { } } protected override void Dispose(bool isDisposing) From 2bd4c126d39223990260535b2f4874ef8229e0b8 Mon Sep 17 00:00:00 2001 From: maromalo <54760464+maromalo@users.noreply.github.com> Date: Sat, 21 May 2022 05:07:24 -0300 Subject: [PATCH 1124/2328] Blank line Forgot to save. --- osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs index 61798b5413..0dc6e52770 100644 --- a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs @@ -485,6 +485,7 @@ namespace osu.Game.Screens.OnlinePlay.Match TriggerClick(); return true; } + return false; } From 376549ce09a2570811ff8b7ea1e6ce3b1636b812 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 21 May 2022 21:48:51 +0900 Subject: [PATCH 1125/2328] Use `ToLocalisableString` instead of `CurrentCulture` --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index d51d7b9c58..98ce9f0f46 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -6,6 +6,7 @@ using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Audio.Track; using osu.Framework.Bindables; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; @@ -209,7 +210,7 @@ namespace osu.Game.Screens.Edit.Timing { base.LoadComplete(); - interpolatedBpm.BindValueChanged(bpm => bpmText.Text = bpm.NewValue.ToString(CultureInfo.CurrentCulture)); + interpolatedBpm.BindValueChanged(bpm => bpmText.Text = bpm.NewValue.ToLocalisableString()); } protected override void Update() From 9a780bcad3b6e7e4b14fe11f3bc1f2c23c13c6d0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 21 May 2022 21:56:05 +0900 Subject: [PATCH 1126/2328] Remove unused using --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 98ce9f0f46..b59865ac1a 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Audio.Track; using osu.Framework.Bindables; From 466ed3c791507796151fb504ad353902a71c1f32 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 21 May 2022 16:43:31 +0300 Subject: [PATCH 1127/2328] Fix wrong return xmldoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- osu.Game/Beatmaps/WorkingBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index a1a8306b76..5551e0b3e5 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -130,7 +130,7 @@ namespace osu.Game.Beatmaps /// Used as an optimisation to avoid reload / track swap across difficulties in the same beatmap set. /// /// The target working beatmap to transfer this track to. - /// Whether the track is valid and has been transferred to this working beatmap. + /// Whether the track has been transferred to the . public virtual bool TryTransferTrack([NotNull] WorkingBeatmap target) { if (BeatmapInfo?.AudioEquals(target.BeatmapInfo) != true) From a42f5ea34ec5c88b002037692029422931a4dcb8 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 21 May 2022 16:50:40 +0300 Subject: [PATCH 1128/2328] Bring back virtual track condition given its cheapness Will still keep the override in `ClockBackedTestWorkingBeatmap` because it still relies on a local track store and will fail the moment it uses a non-virtual track. --- osu.Game/Beatmaps/WorkingBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 5551e0b3e5..5fc579b47c 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -133,7 +133,7 @@ namespace osu.Game.Beatmaps /// Whether the track has been transferred to the . public virtual bool TryTransferTrack([NotNull] WorkingBeatmap target) { - if (BeatmapInfo?.AudioEquals(target.BeatmapInfo) != true) + if (BeatmapInfo?.AudioEquals(target.BeatmapInfo) != true || track.IsDummyDevice) return false; target.track = track; From a17eed64f96c2557bbf632d894694fd57bc1d00c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 21 May 2022 16:51:04 +0300 Subject: [PATCH 1129/2328] Use `Track` to ensure its loaded before transferring --- osu.Game/Beatmaps/WorkingBeatmap.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 5fc579b47c..09072ec897 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -133,10 +133,10 @@ namespace osu.Game.Beatmaps /// Whether the track has been transferred to the . public virtual bool TryTransferTrack([NotNull] WorkingBeatmap target) { - if (BeatmapInfo?.AudioEquals(target.BeatmapInfo) != true || track.IsDummyDevice) + if (BeatmapInfo?.AudioEquals(target.BeatmapInfo) != true || Track.IsDummyDevice) return false; - target.track = track; + target.track = Track; return true; } From d73afcaf484185ac1d1102b8b2c4df4a118c98b5 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 12 May 2022 17:29:28 +0300 Subject: [PATCH 1130/2328] Fix existing test coverage false-passing Also improves general test coverage to test more realisticly, in order to produce accurate results. --- .../TestSceneMultiSpectatorScreen.cs | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs index 703b526e8c..c048722804 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; @@ -15,13 +16,14 @@ using osu.Game.Configuration; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus; -using osu.Game.Online.Rooms; using osu.Game.Rulesets.UI; using osu.Game.Screens.OnlinePlay.Multiplayer.Spectate; using osu.Game.Screens.Play; using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.PlayerSettings; +using osu.Game.Storyboards; using osu.Game.Tests.Beatmaps.IO; +using osuTK; using osuTK.Graphics; namespace osu.Game.Tests.Visual.Multiplayer @@ -349,15 +351,27 @@ namespace osu.Game.Tests.Visual.Multiplayer } /// - /// Tests spectating with a gameplay start time set to a negative value. - /// Simulating beatmaps with high or negative time storyboard elements. + /// Tests spectating with a beatmap that has a high value. /// [Test] - public void TestNegativeGameplayStartTime() + public void TestAudioLeadIn() => testLeadIn(b => b.BeatmapInfo.AudioLeadIn = 2000); + + /// + /// Tests spectating with a beatmap that has a storyboard element with a negative start time (i.e. intro storyboard element). + /// + [Test] + public void TestIntroStoryboardElement() => testLeadIn(b => + { + var sprite = new StoryboardSprite("unknown", Anchor.TopLeft, Vector2.Zero); + sprite.TimelineGroup.Alpha.Add(Easing.None, -2000, 0, 0, 1); + b.Storyboard.GetLayer("Background").Add(sprite); + }); + + private void testLeadIn(Action applyToBeatmap = null) { start(PLAYER_1_ID); - loadSpectateScreen(false, -500); + loadSpectateScreen(false, applyToBeatmap); // to ensure negative gameplay start time does not affect spectator, send frames exactly after StartGameplay(). // (similar to real spectating sessions in which the first frames get sent between StartGameplay() and player load complete) @@ -371,14 +385,16 @@ namespace osu.Game.Tests.Visual.Multiplayer assertRunning(PLAYER_1_ID); } - private void loadSpectateScreen(bool waitForPlayerLoad = true, double? gameplayStartTime = null) + private void loadSpectateScreen(bool waitForPlayerLoad = true, Action applyToBeatmap = null) { - AddStep(!gameplayStartTime.HasValue ? "load screen" : $"load screen (start = {gameplayStartTime}ms)", () => + AddStep("load screen", () => { Beatmap.Value = beatmapManager.GetWorkingBeatmap(importedBeatmap); Ruleset.Value = importedBeatmap.Ruleset; - LoadScreen(spectatorScreen = new TestMultiSpectatorScreen(SelectedRoom.Value, playingUsers.ToArray(), gameplayStartTime)); + applyToBeatmap?.Invoke(Beatmap.Value); + + LoadScreen(spectatorScreen = new MultiSpectatorScreen(SelectedRoom.Value, playingUsers.ToArray())); }); AddUntilStep("wait for screen load", () => spectatorScreen.LoadState == LoadState.Loaded && (!waitForPlayerLoad || spectatorScreen.AllPlayersLoaded)); @@ -461,19 +477,5 @@ namespace osu.Game.Tests.Visual.Multiplayer private GameplayLeaderboardScore getLeaderboardScore(int userId) => spectatorScreen.ChildrenOfType().Single(s => s.User?.Id == userId); private int[] getPlayerIds(int count) => Enumerable.Range(PLAYER_1_ID, count).ToArray(); - - private class TestMultiSpectatorScreen : MultiSpectatorScreen - { - private readonly double? startTime; - - public TestMultiSpectatorScreen(Room room, MultiplayerRoomUser[] users, double? startTime = null) - : base(room, users) - { - this.startTime = startTime; - } - - protected override MasterGameplayClockContainer CreateMasterGameplayClockContainer(WorkingBeatmap beatmap) - => new MasterGameplayClockContainer(beatmap, 0) { StartTime = startTime ?? 0 }; - } } } From 27da293b4053d9fce0ca0cd161f32c1e7127d535 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 13 May 2022 00:07:11 +0300 Subject: [PATCH 1131/2328] Make catch-up spectator clocks running state immutable externally --- .../Spectate/CatchUpSpectatorPlayerClock.cs | 10 ++++++++++ .../Multiplayer/Spectate/CatchUpSyncManager.cs | 2 ++ .../Multiplayer/Spectate/ISpectatorPlayerClock.cs | 10 ++++++++++ 3 files changed, 22 insertions(+) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSpectatorPlayerClock.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSpectatorPlayerClock.cs index 20d12d62a3..48d0b063ff 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSpectatorPlayerClock.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSpectatorPlayerClock.cs @@ -34,6 +34,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate public void Stop() => IsRunning = false; + void IAdjustableClock.Start() + { + // Our running state should only be managed by an ISyncManager, ignore calls from external sources. + } + + void IAdjustableClock.Stop() + { + // Our running state should only be managed by an ISyncManager, ignore calls from external sources. + } + public bool Seek(double position) { CurrentTime = position; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSyncManager.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSyncManager.cs index b8f47c16ff..b0fdeddd56 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSyncManager.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSyncManager.cs @@ -144,6 +144,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate // Make sure the player clock is running if it can. if (!clock.WaitingOnFrames.Value) clock.Start(); + else + clock.Stop(); if (clock.IsCatchingUp) { diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISpectatorPlayerClock.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISpectatorPlayerClock.cs index de23b4fef7..b2ecb105c2 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISpectatorPlayerClock.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISpectatorPlayerClock.cs @@ -11,6 +11,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate /// public interface ISpectatorPlayerClock : IFrameBasedClock, IAdjustableClock { + /// + /// Starts this . + /// + new void Start(); + + /// + /// Stops this . + /// + new void Stop(); + /// /// Whether this clock is waiting on frames to continue playback. /// From efae934e0199713368a4e9cf563cb77a6202f6a6 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sat, 21 May 2022 17:35:31 +0100 Subject: [PATCH 1132/2328] Fix slow loading channel test --- osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 4f916eec18..e27db00003 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -397,6 +397,7 @@ namespace osu.Game.Tests.Visual.Online chatOverlay.SlowLoading = true; }); AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); AddAssert("Channel 1 loading", () => !channelIsVisible && chatOverlay.GetSlowLoadingChannel(testChannel1).LoadState == LoadState.Loading); AddStep("Join channel 2", () => channelManager.JoinChannel(testChannel2)); From 21e1576b2fccaf00eaf980265c8b6590103d4767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 21 May 2022 20:49:29 +0200 Subject: [PATCH 1133/2328] Fix appearance of sheared button borders after click The border would previously get brighter after click, but then dim instantly when the flash layer has fully faded out. The underlying issue there is https://github.com/ppy/osu-framework/issues/5191, but `ShearedButton` was placing the flashing layer incorrectly anyway, as the intent was that it should also apply to the border. --- .../Graphics/UserInterface/ShearedButton.cs | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedButton.cs b/osu.Game/Graphics/UserInterface/ShearedButton.cs index dea44e6d99..66c6eedd0c 100644 --- a/osu.Game/Graphics/UserInterface/ShearedButton.cs +++ b/osu.Game/Graphics/UserInterface/ShearedButton.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Framework.Localisation; @@ -68,6 +69,7 @@ namespace osu.Game.Graphics.UserInterface private Colour4? lighterColour; private Colour4? textColour; + private readonly Container backgroundLayer; private readonly Box flashLayer; /// @@ -85,24 +87,35 @@ namespace osu.Game.Graphics.UserInterface Height = 50; Padding = new MarginPadding { Horizontal = shear * 50 }; - Content.CornerRadius = 7; + const float corner_radius = 7; + + Content.CornerRadius = corner_radius; Content.Shear = new Vector2(shear, 0); Content.Masking = true; - Content.BorderThickness = 2; Content.Anchor = Content.Origin = Anchor.Centre; Children = new Drawable[] { - background = new Box + backgroundLayer = new Container { - RelativeSizeAxes = Axes.Both - }, - text = new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Font = OsuFont.TorusAlternate.With(size: 17), - Shear = new Vector2(-shear, 0) + RelativeSizeAxes = Axes.Both, + CornerRadius = corner_radius, + Masking = true, + BorderThickness = 2, + Children = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both + }, + text = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = OsuFont.TorusAlternate.With(size: 17), + Shear = new Vector2(-shear, 0) + }, + } }, flashLayer = new Box { @@ -186,7 +199,7 @@ namespace osu.Game.Graphics.UserInterface } background.FadeColour(colourDark, 150, Easing.OutQuint); - Content.TransformTo(nameof(BorderColour), ColourInfo.GradientVertical(colourDark, colourLight), 150, Easing.OutQuint); + backgroundLayer.TransformTo(nameof(BorderColour), ColourInfo.GradientVertical(colourDark, colourLight), 150, Easing.OutQuint); if (!Enabled.Value) colourText = colourText.Opacity(0.6f); From fc25d248ad18d4af683347fe0a3b444504e4161c Mon Sep 17 00:00:00 2001 From: maromalo <54760464+maromalo@users.noreply.github.com> Date: Sat, 21 May 2022 18:16:29 -0300 Subject: [PATCH 1134/2328] Test coverage + no virtual --- .../TestSceneMultiplayerMatchSubScreen.cs | 42 +++++++++++++++++++ .../Screens/OnlinePlay/Match/RoomSubScreen.cs | 4 +- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs index ca79fa9cb8..dd281e7738 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs @@ -178,6 +178,48 @@ namespace osu.Game.Tests.Visual.Multiplayer .SingleOrDefault(panel => !panel.Filtered.Value)?.Mod is OsuModDoubleTime); } + [Test] + public void TestModSelectKeyWithAllowedMods() + { + AddStep("add playlist item with allowed mod", () => + { + SelectedRoom.Value.Playlist.Add(new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo) + { + RulesetID = new OsuRuleset().RulesetInfo.OnlineID, + AllowedMods = new[] { new APIMod(new OsuModDoubleTime()) } + }); + }); + + ClickButtonWhenEnabled(); + + AddUntilStep("wait for join", () => RoomJoined); + + AddStep("press toggle mod select key", () => InputManager.Key(osuTK.Input.Key.F1)); + + AddUntilStep("mod select contents loaded", + () => this.ChildrenOfType().Any() && this.ChildrenOfType().All(col => col.IsLoaded && col.ItemsLoaded)); + } + + [Test] + public void TestModSelectKeyWithNoAllowedMods() + { + AddStep("add playlist item with no allowed mods", () => + { + SelectedRoom.Value.Playlist.Add(new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo) + { + RulesetID = new OsuRuleset().RulesetInfo.OnlineID, + }); + }); + ClickButtonWhenEnabled(); + + AddUntilStep("wait for join", () => RoomJoined); + + AddStep("press toggle mod select key", () => InputManager.Key(osuTK.Input.Key.F1)); + + AddAssert("mod select contents not loaded", + () => !(this.ChildrenOfType().Any() && this.ChildrenOfType().All(col => col.IsLoaded && col.ItemsLoaded))); + } + [Test] public void TestNextPlaylistItemSelectedAfterCompletion() { diff --git a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs index 0dc6e52770..a612b6a0e6 100644 --- a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs @@ -478,7 +478,7 @@ namespace osu.Game.Screens.OnlinePlay.Match public class UserModSelectButton : PurpleTriangleButton, IKeyBindingHandler { - public virtual bool OnPressed(KeyBindingPressEvent e) + public bool OnPressed(KeyBindingPressEvent e) { if (e.Action == GlobalAction.ToggleModSelection && !e.Repeat) { @@ -489,7 +489,7 @@ namespace osu.Game.Screens.OnlinePlay.Match return false; } - public virtual void OnReleased(KeyBindingReleaseEvent e) { } + public void OnReleased(KeyBindingReleaseEvent e) { } } protected override void Dispose(bool isDisposing) From eabf57828276ce8ce2b2ad16305e54df271b34ed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 May 2022 22:15:53 +0900 Subject: [PATCH 1135/2328] Use interface to convey beat sync information --- .../TestSceneBeatSyncedContainer.cs | 22 +++++-- .../Containers/BeatSyncedContainer.cs | 65 ++++--------------- .../Graphics/Containers/IBeatSyncProvider.cs | 26 ++++++++ osu.Game/OsuGameBase.cs | 10 ++- osu.Game/Rulesets/Mods/MetronomeBeat.cs | 2 +- osu.Game/Screens/Edit/Editor.cs | 10 ++- .../Screens/Edit/Timing/MetronomeDisplay.cs | 12 ++-- .../Play/MasterGameplayClockContainer.cs | 8 ++- osu.Game/Screens/Play/Player.cs | 9 ++- 9 files changed, 96 insertions(+), 68 deletions(-) create mode 100644 osu.Game/Graphics/Containers/IBeatSyncProvider.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs index 1881f6d718..3cbb7daf51 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using NUnit.Framework; using osu.Framework.Audio.Track; @@ -82,11 +83,15 @@ namespace osu.Game.Tests.Visual.UserInterface if (!allowMistimed) { - AddAssert("trigger is near beat length", () => lastActuationTime != null && lastBeatIndex != null && Precision.AlmostEquals(lastTimingPoint.Time + lastBeatIndex.Value * lastTimingPoint.BeatLength, lastActuationTime.Value, BeatSyncedContainer.MISTIMED_ALLOWANCE)); + AddAssert("trigger is near beat length", + () => lastActuationTime != null && lastBeatIndex != null && Precision.AlmostEquals(lastTimingPoint.Time + lastBeatIndex.Value * lastTimingPoint.BeatLength, lastActuationTime.Value, + BeatSyncedContainer.MISTIMED_ALLOWANCE)); } else { - AddAssert("trigger is not near beat length", () => lastActuationTime != null && lastBeatIndex != null && !Precision.AlmostEquals(lastTimingPoint.Time + lastBeatIndex.Value * lastTimingPoint.BeatLength, lastActuationTime.Value, BeatSyncedContainer.MISTIMED_ALLOWANCE)); + AddAssert("trigger is not near beat length", + () => lastActuationTime != null && lastBeatIndex != null && !Precision.AlmostEquals(lastTimingPoint.Time + lastBeatIndex.Value * lastTimingPoint.BeatLength, + lastActuationTime.Value, BeatSyncedContainer.MISTIMED_ALLOWANCE)); } } @@ -258,7 +263,7 @@ namespace osu.Game.Tests.Visual.UserInterface }; } - private List timingPoints => Beatmap.ControlPointInfo.TimingPoints.ToList(); + private List timingPoints => BeatSyncSource.ControlPoints?.TimingPoints.ToList(); private TimingControlPoint getNextTimingPoint(TimingControlPoint current) { @@ -275,7 +280,11 @@ namespace osu.Game.Tests.Visual.UserInterface if (timingPoints.Count == 0) return 0; if (timingPoints[^1] == current) - return (int)Math.Ceiling((BeatSyncClock.CurrentTime - current.Time) / current.BeatLength); + { + Debug.Assert(BeatSyncSource.Clock != null); + + return (int)Math.Ceiling((BeatSyncSource.Clock.CurrentTime - current.Time) / current.BeatLength); + } return (int)Math.Ceiling((getNextTimingPoint(current).Time - current.Time) / current.BeatLength); } @@ -283,9 +292,12 @@ namespace osu.Game.Tests.Visual.UserInterface protected override void Update() { base.Update(); + + Debug.Assert(BeatSyncSource.Clock != null); + timeUntilNextBeat.Value = TimeUntilNextBeat; timeSinceLastBeat.Value = TimeSinceLastBeat; - currentTime.Value = BeatSyncClock.CurrentTime; + currentTime.Value = BeatSyncSource.Clock.CurrentTime; } public Action NewBeat; diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index bd46a20434..953731244d 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -5,12 +5,9 @@ using System; using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Audio.Track; -using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; -using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Screens.Edit; using osu.Game.Screens.Play; namespace osu.Game.Graphics.Containers @@ -75,74 +72,38 @@ namespace osu.Game.Graphics.Containers /// protected bool IsBeatSyncedWithTrack { get; private set; } + [Resolved] + protected IBeatSyncProvider BeatSyncSource { get; private set; } + protected virtual void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes) { } - [Resolved] - private IBindable beatmap { get; set; } - - [Resolved(canBeNull: true)] - protected GameplayClock GameplayClock { get; private set; } - - [Resolved(canBeNull: true)] - protected EditorBeatmap EditorBeatmap { get; private set; } - - [Resolved(canBeNull: true)] - protected EditorClock EditorClock { get; private set; } - - protected IBeatmap Beatmap => EditorBeatmap ?? beatmap?.Value.Beatmap; - - protected IClock BeatSyncClock - { - get - { - if (EditorClock != null) - return EditorClock; - - if (GameplayClock != null) - return GameplayClock; - - if (beatmap.Value.TrackLoaded) - return beatmap.Value.Track; - - return null; - } - } - protected override void Update() { - ITrack track = null; - TimingControlPoint timingPoint; EffectControlPoint effectPoint; - IClock clock = BeatSyncClock; + IsBeatSyncedWithTrack = BeatSyncSource.Clock?.IsRunning == true; - if (clock == null) - return; - - double currentTrackTime = clock.CurrentTime + EarlyActivationMilliseconds; - - if (beatmap.Value.TrackLoaded && beatmap.Value.BeatmapLoaded) - { - track = beatmap.Value.Track; - } - - IsBeatSyncedWithTrack = beatmap != null && clock.IsRunning && track?.Length > 0; + double currentTrackTime; if (IsBeatSyncedWithTrack) { - Debug.Assert(beatmap != null); + Debug.Assert(BeatSyncSource.ControlPoints != null); + Debug.Assert(BeatSyncSource.Clock != null); - timingPoint = Beatmap.ControlPointInfo.TimingPointAt(currentTrackTime); - effectPoint = Beatmap.ControlPointInfo.EffectPointAt(currentTrackTime); + currentTrackTime = BeatSyncSource.Clock.CurrentTime + EarlyActivationMilliseconds; + + timingPoint = BeatSyncSource.ControlPoints.TimingPointAt(currentTrackTime); + effectPoint = BeatSyncSource.ControlPoints.EffectPointAt(currentTrackTime); } else { // this may be the case where the beat syncing clock has been paused. // we still want to show an idle animation, so use this container's time instead. currentTrackTime = Clock.CurrentTime + EarlyActivationMilliseconds; + timingPoint = TimingControlPoint.DEFAULT; effectPoint = EffectControlPoint.DEFAULT; } @@ -172,7 +133,7 @@ namespace osu.Game.Graphics.Containers if (AllowMistimedEventFiring || Math.Abs(TimeSinceLastBeat) < MISTIMED_ALLOWANCE) { using (BeginDelayedSequence(-TimeSinceLastBeat)) - OnNewBeat(beatIndex, timingPoint, effectPoint, track?.CurrentAmplitudes ?? ChannelAmplitudes.Empty); + OnNewBeat(beatIndex, timingPoint, effectPoint, BeatSyncSource.Amplitudes ?? ChannelAmplitudes.Empty); } lastBeat = beatIndex; diff --git a/osu.Game/Graphics/Containers/IBeatSyncProvider.cs b/osu.Game/Graphics/Containers/IBeatSyncProvider.cs new file mode 100644 index 0000000000..d5be50297c --- /dev/null +++ b/osu.Game/Graphics/Containers/IBeatSyncProvider.cs @@ -0,0 +1,26 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using osu.Framework.Allocation; +using osu.Framework.Audio.Track; +using osu.Framework.Timing; +using osu.Game.Beatmaps.ControlPoints; + +namespace osu.Game.Graphics.Containers +{ + /// + /// Provides various data sources which allow for synchronising visuals to a known beat. + /// Primarily intended for use with . + /// + [Cached(typeof(IBeatSyncProvider))] + public interface IBeatSyncProvider + { + ControlPointInfo? ControlPoints { get; } + + IClock? Clock { get; } + + ChannelAmplitudes? Amplitudes { get; } + } +} diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 2e4758a134..52052efd5d 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -10,6 +10,7 @@ using System.Threading; using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; +using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Development; using osu.Framework.Extensions; @@ -21,12 +22,15 @@ using osu.Framework.Input; using osu.Framework.IO.Stores; using osu.Framework.Logging; using osu.Framework.Platform; +using osu.Framework.Timing; using osu.Game.Audio; using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.Formats; using osu.Game.Configuration; using osu.Game.Database; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Cursor; using osu.Game.Input; using osu.Game.Input.Bindings; @@ -52,7 +56,7 @@ namespace osu.Game /// Unlike , this class will not load any kind of UI, allowing it to be used /// for provide dependencies to test cases without interfering with them. /// - public partial class OsuGameBase : Framework.Game, ICanAcceptFiles + public partial class OsuGameBase : Framework.Game, ICanAcceptFiles, IBeatSyncProvider { public const string OSU_PROTOCOL = "osu://"; @@ -552,5 +556,9 @@ namespace osu.Game if (Host != null) Host.ExceptionThrown -= onExceptionThrown; } + + ControlPointInfo IBeatSyncProvider.ControlPoints => Beatmap.Value.Beatmap.ControlPointInfo; + IClock IBeatSyncProvider.Clock => Beatmap.Value.TrackLoaded ? Beatmap.Value.Track : (IClock)null; + ChannelAmplitudes? IBeatSyncProvider.Amplitudes => Beatmap.Value.TrackLoaded ? Beatmap.Value.Track.CurrentAmplitudes : (ChannelAmplitudes?)null; } } diff --git a/osu.Game/Rulesets/Mods/MetronomeBeat.cs b/osu.Game/Rulesets/Mods/MetronomeBeat.cs index c7a8b02130..149af1e30a 100644 --- a/osu.Game/Rulesets/Mods/MetronomeBeat.cs +++ b/osu.Game/Rulesets/Mods/MetronomeBeat.cs @@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Mods int timeSignature = timingPoint.TimeSignature.Numerator; // play metronome from one measure before the first object. - if (BeatSyncClock.CurrentTime < firstHitTime - timingPoint.BeatLength * timeSignature) + if (BeatSyncSource.Clock?.CurrentTime < firstHitTime - timingPoint.BeatLength * timeSignature) return; sample.Frequency.Value = beatIndex % timeSignature == 0 ? 1 : 0.5f; diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 3a2b195eed..a50a70374b 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -8,6 +8,7 @@ using System.Linq; using JetBrains.Annotations; using osu.Framework; using osu.Framework.Allocation; +using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -19,11 +20,14 @@ using osu.Framework.Input.Events; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Framework.Screens; +using osu.Framework.Timing; using osu.Game.Audio; using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Configuration; using osu.Game.Database; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; @@ -53,7 +57,7 @@ namespace osu.Game.Screens.Edit { [Cached(typeof(IBeatSnapProvider))] [Cached] - public class Editor : ScreenWithBeatmapBackground, IKeyBindingHandler, IKeyBindingHandler, IBeatSnapProvider, ISamplePlaybackDisabler + public class Editor : ScreenWithBeatmapBackground, IKeyBindingHandler, IKeyBindingHandler, IBeatSnapProvider, ISamplePlaybackDisabler, IBeatSyncProvider { public override float BackgroundParallaxAmount => 0.1f; @@ -954,5 +958,9 @@ namespace osu.Game.Screens.Edit public double GetBeatLengthAtTime(double referenceTime) => editorBeatmap.GetBeatLengthAtTime(referenceTime); public int BeatDivisor => beatDivisor.Value; + + ControlPointInfo IBeatSyncProvider.ControlPoints => editorBeatmap.ControlPointInfo; + IClock IBeatSyncProvider.Clock => clock; + ChannelAmplitudes? IBeatSyncProvider.Amplitudes => Beatmap.Value.TrackLoaded ? Beatmap.Value.Track.CurrentAmplitudes : (ChannelAmplitudes?)null; } } diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index b59865ac1a..7b0b8440e6 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -31,9 +31,6 @@ namespace osu.Game.Screens.Edit.Timing [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } - [Resolved] - private EditorBeatmap editorBeatmap { get; set; } - [BackgroundDependencyLoader] private void load() { @@ -216,7 +213,10 @@ namespace osu.Game.Screens.Edit.Timing { base.Update(); - timingPoint = editorBeatmap.ControlPointInfo.TimingPointAt(BeatSyncClock.CurrentTime); + if (BeatSyncSource.ControlPoints == null || BeatSyncSource.Clock == null) + return; + + timingPoint = BeatSyncSource.ControlPoints.TimingPointAt(BeatSyncSource.Clock.CurrentTime); if (beatLength != timingPoint.BeatLength) { @@ -230,7 +230,7 @@ namespace osu.Game.Screens.Edit.Timing this.TransformBindableTo(interpolatedBpm, (int)Math.Round(timingPoint.BPM), 600, Easing.OutQuint); } - if (BeatSyncClock?.IsRunning != true && isSwinging) + if (BeatSyncSource.Clock?.IsRunning != true && isSwinging) { swing.ClearTransforms(true); @@ -258,7 +258,7 @@ namespace osu.Game.Screens.Edit.Timing float currentAngle = swing.Rotation; float targetAngle = currentAngle > 0 ? -angle : angle; - swing.RotateTo(targetAngle, beatLength, Easing.InOutQuad); + swing.RotateTo(targetAngle, beatLength, Easing.InOutSine); if (currentAngle != 0 && Math.Abs(currentAngle - targetAngle) > angle * 1.8f && isSwinging) { diff --git a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs index ea43fb1546..4ca5541362 100644 --- a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs +++ b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs @@ -12,8 +12,10 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Timing; using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Configuration; using osu.Game.Database; +using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Play { @@ -27,7 +29,7 @@ namespace osu.Game.Screens.Play /// /// This is intended to be used as a single controller for gameplay, or as a reference source for other s. /// - public class MasterGameplayClockContainer : GameplayClockContainer + public class MasterGameplayClockContainer : GameplayClockContainer, IBeatSyncProvider { /// /// Duration before gameplay start time required before skip button displays. @@ -250,6 +252,10 @@ namespace osu.Game.Screens.Play removeSourceClockAdjustments(); } + ControlPointInfo IBeatSyncProvider.ControlPoints => beatmap.Beatmap.ControlPointInfo; + IClock IBeatSyncProvider.Clock => GameplayClock; + ChannelAmplitudes? IBeatSyncProvider.Amplitudes => beatmap.TrackLoaded ? beatmap.Track.CurrentAmplitudes : (ChannelAmplitudes?)null; + private class HardwareCorrectionOffsetClock : FramedOffsetClock { private readonly BindableDouble pauseRateAdjust; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 51c1e6b43b..cbd9b03c32 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; +using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; @@ -16,8 +17,10 @@ using osu.Framework.Input.Events; using osu.Framework.Logging; using osu.Framework.Screens; using osu.Framework.Threading; +using osu.Framework.Timing; using osu.Game.Audio; using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Configuration; using osu.Game.Graphics.Containers; using osu.Game.IO.Archives; @@ -38,7 +41,7 @@ using osuTK.Graphics; namespace osu.Game.Screens.Play { [Cached] - public abstract class Player : ScreenWithBeatmapBackground, ISamplePlaybackDisabler, ILocalUserPlayInfo + public abstract class Player : ScreenWithBeatmapBackground, ISamplePlaybackDisabler, ILocalUserPlayInfo, IBeatSyncProvider { /// /// The delay upon completion of the beatmap before displaying the results screen. @@ -1108,5 +1111,9 @@ namespace osu.Game.Screens.Play IBindable ISamplePlaybackDisabler.SamplePlaybackDisabled => samplePlaybackDisabled; IBindable ILocalUserPlayInfo.IsPlaying => LocalUserPlaying; + + ControlPointInfo IBeatSyncProvider.ControlPoints => Beatmap.Value.Beatmap.ControlPointInfo; + IClock IBeatSyncProvider.Clock => GameplayClockContainer.GameplayClock; + ChannelAmplitudes? IBeatSyncProvider.Amplitudes => Beatmap.Value.TrackLoaded ? Beatmap.Value.Track.CurrentAmplitudes : (ChannelAmplitudes?)null; } } From 3a7233bd6ed5e2a3784de1825ac58ea1ec7ae840 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 May 2022 22:49:24 +0900 Subject: [PATCH 1136/2328] Move interface to more appropriate namespace --- .../{Graphics/Containers => Beatmaps}/IBeatSyncProvider.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename osu.Game/{Graphics/Containers => Beatmaps}/IBeatSyncProvider.cs (91%) diff --git a/osu.Game/Graphics/Containers/IBeatSyncProvider.cs b/osu.Game/Beatmaps/IBeatSyncProvider.cs similarity index 91% rename from osu.Game/Graphics/Containers/IBeatSyncProvider.cs rename to osu.Game/Beatmaps/IBeatSyncProvider.cs index d5be50297c..573f06ef9f 100644 --- a/osu.Game/Graphics/Containers/IBeatSyncProvider.cs +++ b/osu.Game/Beatmaps/IBeatSyncProvider.cs @@ -7,8 +7,9 @@ using osu.Framework.Allocation; using osu.Framework.Audio.Track; using osu.Framework.Timing; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Graphics.Containers; -namespace osu.Game.Graphics.Containers +namespace osu.Game.Beatmaps { /// /// Provides various data sources which allow for synchronising visuals to a known beat. From 007582afb9082782b1c18a61401a673198fe3370 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 May 2022 23:55:33 +0900 Subject: [PATCH 1137/2328] Remove unused usings resulting from namespace move --- osu.Game/OsuGameBase.cs | 1 - osu.Game/Screens/Edit/Editor.cs | 1 - osu.Game/Screens/Play/MasterGameplayClockContainer.cs | 1 - 3 files changed, 3 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 52052efd5d..ed2bfbc6e3 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -30,7 +30,6 @@ using osu.Game.Beatmaps.Formats; using osu.Game.Configuration; using osu.Game.Database; using osu.Game.Graphics; -using osu.Game.Graphics.Containers; using osu.Game.Graphics.Cursor; using osu.Game.Input; using osu.Game.Input.Bindings; diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index a50a70374b..0bb3f51903 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -27,7 +27,6 @@ using osu.Game.Beatmaps.ControlPoints; using osu.Game.Configuration; using osu.Game.Database; using osu.Game.Graphics; -using osu.Game.Graphics.Containers; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; diff --git a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs index 4ca5541362..d87d57ec49 100644 --- a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs +++ b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs @@ -15,7 +15,6 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Configuration; using osu.Game.Database; -using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Play { From c9ea87e6be1885fdb18bcc4e93bf21b5d0ad11e1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 May 2022 00:03:42 +0900 Subject: [PATCH 1138/2328] Revert easing for now --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 7b0b8440e6..4dd7a75d4a 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -258,7 +258,7 @@ namespace osu.Game.Screens.Edit.Timing float currentAngle = swing.Rotation; float targetAngle = currentAngle > 0 ? -angle : angle; - swing.RotateTo(targetAngle, beatLength, Easing.InOutSine); + swing.RotateTo(targetAngle, beatLength, Easing.InOutQuad); if (currentAngle != 0 && Math.Abs(currentAngle - targetAngle) > angle * 1.8f && isSwinging) { From 26985ca8afa855658cd32c7eb0c5669c5b32687f Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Sun, 22 May 2022 16:26:22 +0100 Subject: [PATCH 1139/2328] Store hitobject history in the hitobject --- .../Difficulty/CatchDifficultyCalculator.cs | 10 ++++++++- .../Preprocessing/CatchDifficultyHitObject.cs | 5 +++-- .../Difficulty/ManiaDifficultyCalculator.cs | 6 ++++- .../Preprocessing/ManiaDifficultyHitObject.cs | 5 +++-- .../Difficulty/Skills/Strain.cs | 6 ++--- .../Difficulty/OsuDifficultyCalculator.cs | 10 ++++----- .../Preprocessing/OsuDifficultyHitObject.cs | 9 ++++---- .../Difficulty/Skills/Aim.cs | 10 ++++----- .../Difficulty/Skills/Flashlight.cs | 7 +++--- .../Difficulty/Skills/Speed.cs | 22 +++++++++---------- .../Preprocessing/StaminaCheeseDetector.cs | 15 +++++++------ .../Preprocessing/TaikoDifficultyHitObject.cs | 15 +++++-------- .../Difficulty/Skills/Rhythm.cs | 2 +- .../Difficulty/Skills/Stamina.cs | 4 ++-- .../Difficulty/TaikoDifficultyCalculator.cs | 4 ++-- .../Preprocessing/DifficultyHitObject.cs | 18 ++++++++++++++- osu.Game/Rulesets/Difficulty/Skills/Skill.cs | 20 +---------------- .../Difficulty/Skills/StrainDecaySkill.cs | 2 +- .../Rulesets/Difficulty/Skills/StrainSkill.cs | 12 +++++----- 19 files changed, 94 insertions(+), 88 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index 0054047573..3826e4cec4 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -49,6 +49,9 @@ namespace osu.Game.Rulesets.Catch.Difficulty { CatchHitObject lastObject = null; + List objects = new List(); + int index = 0; + // In 2B beatmaps, it is possible that a normal Fruit is placed in the middle of a JuiceStream. foreach (var hitObject in beatmap.HitObjects .SelectMany(obj => obj is JuiceStream stream ? stream.NestedHitObjects.AsEnumerable() : new[] { obj }) @@ -60,10 +63,15 @@ namespace osu.Game.Rulesets.Catch.Difficulty continue; if (lastObject != null) - yield return new CatchDifficultyHitObject(hitObject, lastObject, clockRate, halfCatcherWidth); + { + objects.Add(new CatchDifficultyHitObject(hitObject, lastObject, clockRate, halfCatcherWidth, objects, index)); + index++; + } lastObject = hitObject; } + + return objects; } protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) diff --git a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs index b22ec93b43..8c229cf6c5 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Objects; @@ -24,8 +25,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing /// public readonly double StrainTime; - public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth) - : base(hitObject, lastObject, clockRate) + public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth, List objects, int position) + : base(hitObject, lastObject, clockRate, objects, position) { // We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps. float scalingFactor = normalized_hitobject_radius / halfCatcherWidth; diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs index b17aa7fc4d..7ce73c98d1 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -62,8 +62,12 @@ namespace osu.Game.Rulesets.Mania.Difficulty LegacySortHelper.Sort(sortedObjects, Comparer.Create((a, b) => (int)Math.Round(a.StartTime) - (int)Math.Round(b.StartTime))); + List objects = new List(); + for (int i = 1; i < sortedObjects.Length; i++) - yield return new ManiaDifficultyHitObject(sortedObjects[i], sortedObjects[i - 1], clockRate); + objects.Add(new ManiaDifficultyHitObject(sortedObjects[i], sortedObjects[i - 1], clockRate, objects, i - 1)); + + return objects; } // Sorting is done in CreateDifficultyHitObjects, since the full list of hitobjects is required. diff --git a/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs b/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs index 29ba934e9f..5c9b3b9b54 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs @@ -1,6 +1,7 @@ // 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 osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Objects; @@ -11,8 +12,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Preprocessing { public new ManiaHitObject BaseObject => (ManiaHitObject)base.BaseObject; - public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate) - : base(hitObject, lastObject, clockRate) + public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int position) + : base(hitObject, lastObject, clockRate, objects, position) { } } diff --git a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs index 31550a8105..626f1bebbd 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs @@ -84,9 +84,9 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Skills return individualStrain + overallStrain - CurrentStrain; } - protected override double CalculateInitialStrain(double offset) - => applyDecay(individualStrain, offset - Previous[0].StartTime, individual_decay_base) - + applyDecay(overallStrain, offset - Previous[0].StartTime, overall_decay_base); + protected override double CalculateInitialStrain(double offset, DifficultyHitObject current) + => applyDecay(individualStrain, offset - current.Previous(0).StartTime, individual_decay_base) + + applyDecay(overallStrain, offset - current.Previous(0).StartTime, overall_decay_base); private double applyDecay(double value, double deltaTime, double decayBase) => value * Math.Pow(decayBase, deltaTime / 1000); diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 4eb5c79808..3b21ab49c2 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -87,16 +87,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) { + List objects = new List(); + // The first jump is formed by the first two hitobjects of the map. // If the map has less than two OsuHitObjects, the enumerator will not return anything. for (int i = 1; i < beatmap.HitObjects.Count; i++) - { - var lastLast = i > 1 ? beatmap.HitObjects[i - 2] : null; - var last = beatmap.HitObjects[i - 1]; - var current = beatmap.HitObjects[i]; + objects.Add(new OsuDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate, objects, i - 1)); - yield return new OsuDifficultyHitObject(current, lastLast, last, clockRate); - } + return objects; } protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index cf4802d282..0598cbe4c9 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Mods; @@ -12,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing { public class OsuDifficultyHitObject : DifficultyHitObject { - private const int normalised_radius = 50; // Change radius to 50 to make 100 the diameter. Easier for mental maths. + private const int normalised_radius = 50; private const int min_delta_time = 25; private const float maximum_slider_radius = normalised_radius * 2.4f; private const float assumed_slider_radius = normalised_radius * 1.8f; @@ -74,10 +75,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing private readonly OsuHitObject lastLastObject; private readonly OsuHitObject lastObject; - public OsuDifficultyHitObject(HitObject hitObject, HitObject lastLastObject, HitObject lastObject, double clockRate) - : base(hitObject, lastObject, clockRate) + public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int position) + : base(hitObject, lastObject, clockRate, objects, position) { - this.lastLastObject = (OsuHitObject)lastLastObject; + lastLastObject = position > 1 ? (OsuHitObject)Previous(1).BaseObject : null; this.lastObject = (OsuHitObject)lastObject; // Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects. diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index a6301aed6d..e3ec997740 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -22,8 +22,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private readonly bool withSliders; - protected override int HistoryLength => 2; - private const double wide_angle_multiplier = 1.5; private const double acute_angle_multiplier = 2.0; private const double slider_multiplier = 1.5; @@ -36,12 +34,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private double strainValueOf(DifficultyHitObject current) { - if (current.BaseObject is Spinner || Previous.Count <= 1 || Previous[0].BaseObject is Spinner) + if (current.BaseObject is Spinner || current.Position <= 1 || current.Previous(0).BaseObject is Spinner) return 0; var osuCurrObj = (OsuDifficultyHitObject)current; - var osuLastObj = (OsuDifficultyHitObject)Previous[0]; - var osuLastLastObj = (OsuDifficultyHitObject)Previous[1]; + var osuLastObj = (OsuDifficultyHitObject)current.Previous(0); + var osuLastLastObj = (OsuDifficultyHitObject)current.Previous(1); // Calculate the velocity to the current hitobject, which starts with a base distance / time assuming the last object is a hitcircle. double currVelocity = osuCurrObj.LazyJumpDistance / osuCurrObj.StrainTime; @@ -152,7 +150,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); - protected override double CalculateInitialStrain(double time) => currentStrain * strainDecay(time - Previous[0].StartTime); + protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => currentStrain * strainDecay(time - current.Previous(0).StartTime); protected override double StrainValueAt(DifficultyHitObject current) { diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index d93007fae5..75796a5993 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -25,7 +25,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private double skillMultiplier => 0.05; private double strainDecayBase => 0.15; protected override double DecayWeight => 1.0; - protected override int HistoryLength => 10; // Look back for 10 notes is added for the sake of flashlight calculations. private readonly bool hidden; @@ -51,9 +50,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills OsuDifficultyHitObject lastObj = osuCurrent; // This is iterating backwards in time from the current object. - for (int i = 0; i < Previous.Count; i++) + for (int i = 0; i < Math.Min(current.Position, 10); i++) { - var currentObj = (OsuDifficultyHitObject)Previous[i]; + var currentObj = (OsuDifficultyHitObject)current.Previous(i); var currentHitObject = (OsuHitObject)(currentObj.BaseObject); if (!(currentObj.BaseObject is Spinner)) @@ -89,7 +88,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); - protected override double CalculateInitialStrain(double time) => currentStrain * strainDecay(time - Previous[0].StartTime); + protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => currentStrain * strainDecay(time - current.Previous(0).StartTime); protected override double StrainValueAt(DifficultyHitObject current) { diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index 06d1ef7346..f8905664f4 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -29,8 +29,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override int ReducedSectionCount => 5; protected override double DifficultyMultiplier => 1.04; - protected override int HistoryLength => 32; - private readonly double greatWindow; public Speed(Mod[] mods, double hitWindowGreat) @@ -55,20 +53,22 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills bool firstDeltaSwitch = false; + int historicalNoteCount = Math.Min(current.Position, 32); + int rhythmStart = 0; - while (rhythmStart < Previous.Count - 2 && current.StartTime - Previous[rhythmStart].StartTime < history_time_max) + while (rhythmStart < historicalNoteCount - 2 && current.StartTime - current.Previous(rhythmStart).StartTime < history_time_max) rhythmStart++; for (int i = rhythmStart; i > 0; i--) { - OsuDifficultyHitObject currObj = (OsuDifficultyHitObject)Previous[i - 1]; - OsuDifficultyHitObject prevObj = (OsuDifficultyHitObject)Previous[i]; - OsuDifficultyHitObject lastObj = (OsuDifficultyHitObject)Previous[i + 1]; + OsuDifficultyHitObject currObj = (OsuDifficultyHitObject)current.Previous(i - 1); + OsuDifficultyHitObject prevObj = (OsuDifficultyHitObject)current.Previous(i); + OsuDifficultyHitObject lastObj = (OsuDifficultyHitObject)current.Previous(i + 1); double currHistoricalDecay = (history_time_max - (current.StartTime - currObj.StartTime)) / history_time_max; // scales note 0 to 1 from history to now - currHistoricalDecay = Math.Min((double)(Previous.Count - i) / Previous.Count, currHistoricalDecay); // either we're limited by time or limited by object count. + currHistoricalDecay = Math.Min((double)(historicalNoteCount - i) / historicalNoteCount, currHistoricalDecay); // either we're limited by time or limited by object count. double currDelta = currObj.StrainTime; double prevDelta = prevObj.StrainTime; @@ -90,10 +90,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills } else { - if (Previous[i - 1].BaseObject is Slider) // bpm change is into slider, this is easy acc window + if (current.Previous(i - 1).BaseObject is Slider) // bpm change is into slider, this is easy acc window effectiveRatio *= 0.125; - if (Previous[i].BaseObject is Slider) // bpm change was from a slider, this is easier typically than circle -> circle + if (current.Previous(i).BaseObject is Slider) // bpm change was from a slider, this is easier typically than circle -> circle effectiveRatio *= 0.25; if (previousIslandSize == islandSize) // repeated island size (ex: triplet -> triplet) @@ -136,7 +136,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills // derive strainTime for calculation var osuCurrObj = (OsuDifficultyHitObject)current; - var osuPrevObj = Previous.Count > 0 ? (OsuDifficultyHitObject)Previous[0] : null; + var osuPrevObj = current.Position > 0 ? (OsuDifficultyHitObject)current.Previous(0) : null; double strainTime = osuCurrObj.StrainTime; double greatWindowFull = greatWindow * 2; @@ -164,7 +164,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); - protected override double CalculateInitialStrain(double time) => (currentStrain * currentRhythm) * strainDecay(time - Previous[0].StartTime); + protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => (currentStrain * currentRhythm) * strainDecay(time - current.Previous(0).StartTime); protected override double StrainValueAt(DifficultyHitObject current) { diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/StaminaCheeseDetector.cs b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/StaminaCheeseDetector.cs index 3b1a9ad777..586a7fb6a7 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/StaminaCheeseDetector.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/StaminaCheeseDetector.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Utils; using osu.Game.Rulesets.Taiko.Objects; @@ -34,9 +35,9 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing /// /// The list of all s in the map. /// - private readonly List hitObjects; + private readonly List hitObjects; - public StaminaCheeseDetector(List hitObjects) + public StaminaCheeseDetector(List hitObjects) { this.hitObjects = hitObjects; } @@ -62,7 +63,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing /// The length of a single repeating pattern to consider (triplets/quadruplets). private void findRolls(int patternLength) { - var history = new LimitedCapacityQueue(2 * patternLength); + var history = new LimitedCapacityQueue(2 * patternLength); // for convenience, we're tracking the index of the item *before* our suspected repeat's start, // as that index can be simply subtracted from the current index to get the number of elements in between @@ -97,11 +98,11 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing /// /// Determines whether the objects stored in contain a repetition of a pattern of length . /// - private static bool containsPatternRepeat(LimitedCapacityQueue history, int patternLength) + private static bool containsPatternRepeat(LimitedCapacityQueue history, int patternLength) { for (int j = 0; j < patternLength; j++) { - if (history[j].HitType != history[j + patternLength].HitType) + if (((TaikoDifficultyHitObject)history[j]).HitType != ((TaikoDifficultyHitObject)history[j + patternLength]).HitType) return false; } @@ -120,7 +121,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing for (int i = parity; i < hitObjects.Count; i += 2) { - if (hitObjects[i].HitType == type) + if (((TaikoDifficultyHitObject)hitObjects[i]).HitType == type) tlLength += 2; else tlLength = -2; @@ -139,7 +140,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing private void markObjectsAsCheese(int start, int end) { for (int i = start; i <= end; i++) - hitObjects[i].StaminaCheese = true; + ((TaikoDifficultyHitObject)hitObjects[i]).StaminaCheese = true; } } } diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs index ae33c184d0..79e760d149 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using System.Linq; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Objects; @@ -24,11 +25,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing /// public readonly HitType? HitType; - /// - /// The index of the object in the beatmap. - /// - public readonly int ObjectIndex; - /// /// Whether the object should carry a penalty due to being hittable using special techniques /// making it easier to do so. @@ -42,16 +38,15 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing /// The gameplay preceding . /// The gameplay preceding . /// The rate of the gameplay clock. Modified by speed-changing mods. - /// The index of the object in the beatmap. - public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, int objectIndex) - : base(hitObject, lastObject, clockRate) + /// The list of s in the current beatmap. + /// The index of the object in the beatmap. + public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, List objects, int position) + : base(hitObject, lastObject, clockRate, objects, position) { var currentHit = hitObject as Hit; Rhythm = getClosestRhythm(lastObject, lastLastObject, clockRate); HitType = currentHit?.Type; - - ObjectIndex = objectIndex; } /// diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs index 973e55f4b4..9150b6980b 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs @@ -106,7 +106,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills if (!samePattern(start, mostRecentPatternsToCompare)) continue; - int notesSince = hitObject.ObjectIndex - rhythmHistory[start].ObjectIndex; + int notesSince = hitObject.Position - rhythmHistory[start].Position; penalty *= repetitionPenalty(notesSince); break; } diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs index 54cf233d69..6922f57060 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs @@ -66,11 +66,11 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills TaikoDifficultyHitObject hitObject = (TaikoDifficultyHitObject)current; - if (hitObject.ObjectIndex % 2 == hand) + if (hitObject.Position % 2 == hand) { double objectStrain = 1; - if (hitObject.ObjectIndex == 1) + if (hitObject.Position == 1) return 1; notePairDurationHistory.Enqueue(hitObject.DeltaTime + offhandObjectDuration); diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index a9d512f076..f14765a925 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -47,13 +47,13 @@ namespace osu.Game.Rulesets.Taiko.Difficulty protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) { - List taikoDifficultyHitObjects = new List(); + List taikoDifficultyHitObjects = new List(); for (int i = 2; i < beatmap.HitObjects.Count; i++) { taikoDifficultyHitObjects.Add( new TaikoDifficultyHitObject( - beatmap.HitObjects[i], beatmap.HitObjects[i - 1], beatmap.HitObjects[i - 2], clockRate, i + beatmap.HitObjects[i], beatmap.HitObjects[i - 1], beatmap.HitObjects[i - 2], clockRate, taikoDifficultyHitObjects, i - 2 ) ); } diff --git a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs index 5edfb2207b..4f001a520c 100644 --- a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs +++ b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs @@ -1,6 +1,7 @@ // 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 osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Difficulty.Preprocessing @@ -10,6 +11,13 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing /// public class DifficultyHitObject { + private readonly List difficultyHitObjects; + + /// + /// The position of this in the list. + /// + public int Position; + /// /// The this wraps. /// @@ -41,13 +49,21 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing /// The which this wraps. /// The last which occurs before in the beatmap. /// The rate at which the gameplay clock is run at. - public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate) + /// The list of s in the current beatmap. + /// The position of this in the list. + public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int position) { + difficultyHitObjects = objects; + Position = position; BaseObject = hitObject; LastObject = lastObject; DeltaTime = (hitObject.StartTime - lastObject.StartTime) / clockRate; StartTime = hitObject.StartTime / clockRate; EndTime = hitObject.GetEndTime() / clockRate; } + + public DifficultyHitObject Previous(int backwardsIndex) => difficultyHitObjects[Position - (backwardsIndex + 1)]; + + public DifficultyHitObject Next(int forwardsIndex) => difficultyHitObjects[Position + (forwardsIndex + 1)]; } } diff --git a/osu.Game/Rulesets/Difficulty/Skills/Skill.cs b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs index b5c94ad806..f23f3b5f2a 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/Skill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using osu.Game.Rulesets.Difficulty.Preprocessing; -using osu.Game.Rulesets.Difficulty.Utils; using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Difficulty.Skills @@ -12,21 +11,10 @@ namespace osu.Game.Rulesets.Difficulty.Skills /// A bare minimal abstract skill for fully custom skill implementations. /// /// - /// This class should be considered a "processing" class and not persisted, as it keeps references to - /// gameplay objects after processing is run (see ). + /// This class should be considered a "processing" class and not persisted. /// public abstract class Skill { - /// - /// s that were processed previously. They can affect the strain values of the following objects. - /// - protected readonly ReverseQueue Previous; - - /// - /// Number of previous s to keep inside the queue. - /// - protected virtual int HistoryLength => 1; - /// /// Mods for use in skill calculations. /// @@ -37,17 +25,11 @@ namespace osu.Game.Rulesets.Difficulty.Skills protected Skill(Mod[] mods) { this.mods = mods; - Previous = new ReverseQueue(HistoryLength + 1); } internal void ProcessInternal(DifficultyHitObject current) { - while (Previous.Count > HistoryLength) - Previous.Dequeue(); - Process(current); - - Previous.Enqueue(current); } /// diff --git a/osu.Game/Rulesets/Difficulty/Skills/StrainDecaySkill.cs b/osu.Game/Rulesets/Difficulty/Skills/StrainDecaySkill.cs index d8babf2f32..3f3d57938b 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/StrainDecaySkill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/StrainDecaySkill.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Difficulty.Skills { } - protected override double CalculateInitialStrain(double time) => CurrentStrain * strainDecay(time - Previous[0].StartTime); + protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => CurrentStrain * strainDecay(time - current.Previous(0).StartTime); protected override double StrainValueAt(DifficultyHitObject current) { diff --git a/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs b/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs index 97266562e4..eb3203e9ec 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs @@ -47,13 +47,13 @@ namespace osu.Game.Rulesets.Difficulty.Skills protected sealed override void Process(DifficultyHitObject current) { // The first object doesn't generate a strain, so we begin with an incremented section end - if (Previous.Count == 0) + if (current.Position == 0) currentSectionEnd = Math.Ceiling(current.StartTime / SectionLength) * SectionLength; while (current.StartTime > currentSectionEnd) { saveCurrentPeak(); - startNewSectionFrom(currentSectionEnd); + startNewSectionFrom(currentSectionEnd, current); currentSectionEnd += SectionLength; } @@ -72,19 +72,21 @@ namespace osu.Game.Rulesets.Difficulty.Skills /// Sets the initial strain level for a new section. /// /// The beginning of the new section in milliseconds. - private void startNewSectionFrom(double time) + /// The current hit object. + private void startNewSectionFrom(double time, DifficultyHitObject current) { // The maximum strain of the new section is not zero by default // This means we need to capture the strain level at the beginning of the new section, and use that as the initial peak level. - currentSectionPeak = CalculateInitialStrain(time); + currentSectionPeak = CalculateInitialStrain(time, current); } /// /// Retrieves the peak strain at a point in time. /// /// The time to retrieve the peak strain at. + /// The current hit object. /// The peak strain. - protected abstract double CalculateInitialStrain(double time); + protected abstract double CalculateInitialStrain(double time, DifficultyHitObject current); /// /// Returns a live enumerable of the peak strains for each section of the beatmap, From 267bef959fd7049dcf80557196cd211e3f81686f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 May 2022 02:00:04 +0900 Subject: [PATCH 1140/2328] Remove unnecessary cache type specification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- osu.Game/Beatmaps/IBeatSyncProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/IBeatSyncProvider.cs b/osu.Game/Beatmaps/IBeatSyncProvider.cs index 573f06ef9f..cc1cfc3cb5 100644 --- a/osu.Game/Beatmaps/IBeatSyncProvider.cs +++ b/osu.Game/Beatmaps/IBeatSyncProvider.cs @@ -15,7 +15,7 @@ namespace osu.Game.Beatmaps /// Provides various data sources which allow for synchronising visuals to a known beat. /// Primarily intended for use with . /// - [Cached(typeof(IBeatSyncProvider))] + [Cached] public interface IBeatSyncProvider { ControlPointInfo? ControlPoints { get; } From 9c3d0dafbdba852857197bf13dbc2879328dceb3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 May 2022 02:00:20 +0900 Subject: [PATCH 1141/2328] Remove implementation at `Player` level Turns out this isn't required in the end due to implementation at `MasterGameplayClockContainer`. --- osu.Game/Screens/Play/Player.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index cbd9b03c32..51c1e6b43b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -8,7 +8,6 @@ using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; @@ -17,10 +16,8 @@ using osu.Framework.Input.Events; using osu.Framework.Logging; using osu.Framework.Screens; using osu.Framework.Threading; -using osu.Framework.Timing; using osu.Game.Audio; using osu.Game.Beatmaps; -using osu.Game.Beatmaps.ControlPoints; using osu.Game.Configuration; using osu.Game.Graphics.Containers; using osu.Game.IO.Archives; @@ -41,7 +38,7 @@ using osuTK.Graphics; namespace osu.Game.Screens.Play { [Cached] - public abstract class Player : ScreenWithBeatmapBackground, ISamplePlaybackDisabler, ILocalUserPlayInfo, IBeatSyncProvider + public abstract class Player : ScreenWithBeatmapBackground, ISamplePlaybackDisabler, ILocalUserPlayInfo { /// /// The delay upon completion of the beatmap before displaying the results screen. @@ -1111,9 +1108,5 @@ namespace osu.Game.Screens.Play IBindable ISamplePlaybackDisabler.SamplePlaybackDisabled => samplePlaybackDisabled; IBindable ILocalUserPlayInfo.IsPlaying => LocalUserPlaying; - - ControlPointInfo IBeatSyncProvider.ControlPoints => Beatmap.Value.Beatmap.ControlPointInfo; - IClock IBeatSyncProvider.Clock => GameplayClockContainer.GameplayClock; - ChannelAmplitudes? IBeatSyncProvider.Amplitudes => Beatmap.Value.TrackLoaded ? Beatmap.Value.Track.CurrentAmplitudes : (ChannelAmplitudes?)null; } } From 0bef2ca7526295767db063b0b9e92035411cda83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 22 May 2022 19:27:20 +0200 Subject: [PATCH 1142/2328] Adjust test slightly * Import `osuTK.Input` instead of using full qualified name * Use some more straightforward assertions --- .../TestSceneMultiplayerMatchSubScreen.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs index dd281e7738..7ae81c9800 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs @@ -6,6 +6,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Extensions; +using osu.Framework.Graphics.Containers; using osu.Framework.Platform; using osu.Framework.Screens; using osu.Framework.Testing; @@ -28,6 +29,7 @@ using osu.Game.Screens.OnlinePlay.Multiplayer.Match; using osu.Game.Screens.OnlinePlay.Multiplayer.Participants; using osu.Game.Tests.Beatmaps; using osu.Game.Tests.Resources; +using osuTK.Input; namespace osu.Game.Tests.Visual.Multiplayer { @@ -194,10 +196,9 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("wait for join", () => RoomJoined); - AddStep("press toggle mod select key", () => InputManager.Key(osuTK.Input.Key.F1)); + AddStep("press toggle mod select key", () => InputManager.Key(Key.F1)); - AddUntilStep("mod select contents loaded", - () => this.ChildrenOfType().Any() && this.ChildrenOfType().All(col => col.IsLoaded && col.ItemsLoaded)); + AddUntilStep("mod select shown", () => this.ChildrenOfType().Single().State.Value == Visibility.Visible); } [Test] @@ -214,10 +215,10 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("wait for join", () => RoomJoined); - AddStep("press toggle mod select key", () => InputManager.Key(osuTK.Input.Key.F1)); + AddStep("press toggle mod select key", () => InputManager.Key(Key.F1)); - AddAssert("mod select contents not loaded", - () => !(this.ChildrenOfType().Any() && this.ChildrenOfType().All(col => col.IsLoaded && col.ItemsLoaded))); + AddWaitStep("wait some", 3); + AddAssert("mod select not shown", () => this.ChildrenOfType().Single().State.Value == Visibility.Hidden); } [Test] From 40f560d7d0022c9882c0571e40d34658600e447d Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Sun, 22 May 2022 21:45:27 +0100 Subject: [PATCH 1143/2328] Remove internal process method --- osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs | 4 ++-- osu.Game/Rulesets/Difficulty/Skills/Skill.cs | 7 +------ osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index b5aec0d659..b030c0c560 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -67,7 +67,7 @@ namespace osu.Game.Rulesets.Difficulty foreach (var skill in skills) { cancellationToken.ThrowIfCancellationRequested(); - skill.ProcessInternal(hitObject); + skill.Process(hitObject); } } @@ -108,7 +108,7 @@ namespace osu.Game.Rulesets.Difficulty foreach (var skill in skills) { cancellationToken.ThrowIfCancellationRequested(); - skill.ProcessInternal(hitObject); + skill.Process(hitObject); } attribs.Add(new TimedDifficultyAttributes(hitObject.EndTime * clockRate, CreateDifficultyAttributes(progressiveBeatmap, playableMods, skills, clockRate))); diff --git a/osu.Game/Rulesets/Difficulty/Skills/Skill.cs b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs index f23f3b5f2a..770754f304 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/Skill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs @@ -27,16 +27,11 @@ namespace osu.Game.Rulesets.Difficulty.Skills this.mods = mods; } - internal void ProcessInternal(DifficultyHitObject current) - { - Process(current); - } - /// /// Process a . /// /// The to process. - protected abstract void Process(DifficultyHitObject current); + public abstract void Process(DifficultyHitObject current); /// /// Returns the calculated difficulty value representing all s that have been processed up to this point. diff --git a/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs b/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs index eb3203e9ec..6be10db8b3 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs @@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Difficulty.Skills /// /// Process a and update current strain values accordingly. /// - protected sealed override void Process(DifficultyHitObject current) + public sealed override void Process(DifficultyHitObject current) { // The first object doesn't generate a strain, so we begin with an incremented section end if (current.Position == 0) From afbb1fa750e8560481fbf43509ae166e822d87ff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 May 2022 14:06:00 +0900 Subject: [PATCH 1144/2328] Fix tournament user stat population potentially using wrong ruleset `OsuGameBase.Ruleset` is bound [late](https://github.com/ppy/osu/blob/7d0470794bcd454d3a93954ec4fe3415933627ef/osu.Game.Tournament/TournamentGameBase.cs#L169) so we must use the ladder one during user retrieval. Closes https://github.com/ppy/osu/issues/18363. --- osu.Game.Tournament/TournamentGameBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 363baccb37..6ae0312cce 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -259,7 +259,7 @@ namespace osu.Game.Tournament public void PopulateUser(APIUser user, Action success = null, Action failure = null, bool immediate = false) { - var req = new GetUserRequest(user.Id, Ruleset.Value); + var req = new GetUserRequest(user.Id, ladder.Ruleset.Value); if (immediate) { From 63a3829768be608c125076767538910104b4fe89 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 23 May 2022 14:19:25 +0900 Subject: [PATCH 1145/2328] Split out SingleKeyStamina class --- .../Difficulty/Skills/SingleKeyStamina.cs | 42 +++++++++++++++++++ .../Difficulty/Skills/Stamina.cs | 34 --------------- 2 files changed, 42 insertions(+), 34 deletions(-) create mode 100644 osu.Game.Rulesets.Taiko/Difficulty/Skills/SingleKeyStamina.cs diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/SingleKeyStamina.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/SingleKeyStamina.cs new file mode 100644 index 0000000000..cabfd231d8 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/SingleKeyStamina.cs @@ -0,0 +1,42 @@ +// 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.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Difficulty.Skills; + +namespace osu.Game.Rulesets.Taiko.Difficulty.Skills +{ + /// + /// Stamina of a single key, calculated based on repetition speed. + /// + public class SingleKeyStamina + { + private double? previousHitTime; + + /// + /// Similar to + /// + public double StrainValueOf(DifficultyHitObject current) + { + if (previousHitTime == null) + { + previousHitTime = current.StartTime; + return 0; + } + + double objectStrain = 0.5; + objectStrain += speedBonus(current.StartTime - previousHitTime.Value); + previousHitTime = current.StartTime; + return objectStrain; + } + + /// + /// Applies a speed bonus dependent on the time since the last hit performed using this key. + /// + /// The duration between the current and previous note hit using the same key. + private double speedBonus(double notePairDuration) + { + return 175 / (notePairDuration + 100); + } + } +} diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs index 744dafd57e..32d8b70485 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs @@ -9,40 +9,6 @@ using osu.Game.Rulesets.Taiko.Objects; namespace osu.Game.Rulesets.Taiko.Difficulty.Skills { - /// - /// Stamina of a single key, calculated based on repetition speed. - /// - public class SingleKeyStamina - { - private double? previousHitTime; - - /// - /// Similar to - /// - public double StrainValueOf(DifficultyHitObject current) - { - if (previousHitTime == null) - { - previousHitTime = current.StartTime; - return 0; - } - - double objectStrain = 0.5; - objectStrain += speedBonus(current.StartTime - previousHitTime.Value); - previousHitTime = current.StartTime; - return objectStrain; - } - - /// - /// Applies a speed bonus dependent on the time since the last hit performed using this key. - /// - /// The duration between the current and previous note hit using the same key. - private double speedBonus(double notePairDuration) - { - return 175 / (notePairDuration + 100); - } - } - /// /// Calculates the stamina coefficient of taiko difficulty. /// From 6cfe35360a6ed2e666047dce18a45570b098041a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 23 May 2022 14:36:06 +0900 Subject: [PATCH 1146/2328] Refactor key indexing --- .../Difficulty/Skills/Stamina.cs | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs index 32d8b70485..61bcbfa59d 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs @@ -20,26 +20,27 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills protected override double SkillMultiplier => 1; protected override double StrainDecayBase => 0.4; - /// - /// Stamina of each individual keys, calculated based on repetition speed. - /// - private readonly SingleKeyStamina[] keyStamina = + private readonly SingleKeyStamina[] centreKeyStamina = { new SingleKeyStamina(), - new SingleKeyStamina(), + new SingleKeyStamina() + }; + + private readonly SingleKeyStamina[] rimKeyStamina = + { new SingleKeyStamina(), new SingleKeyStamina() }; /// - /// Current index to for a don hit. + /// Current index into for a centre hit. /// - private int donIndex = 1; + private int centreKeyIndex; /// - /// Current index to for a kat hit. + /// Current index into for a rim hit. /// - private int katIndex = 3; + private int rimKeyIndex; /// /// Creates a skill. @@ -59,12 +60,12 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills // Alternate key for the same color. if (current.HitType == HitType.Centre) { - donIndex = donIndex == 0 ? 1 : 0; - return keyStamina[donIndex]; + centreKeyIndex = (centreKeyIndex + 1) % 2; + return centreKeyStamina[centreKeyIndex]; } - katIndex = katIndex == 2 ? 3 : 2; - return keyStamina[katIndex]; + rimKeyIndex = (rimKeyIndex + 1) % 2; + return rimKeyStamina[rimKeyIndex]; } protected override double StrainValueOf(DifficultyHitObject current) From d054e404dab139e3ec6a0d76cadb89f4cc6667a7 Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Mon, 23 May 2022 13:10:42 +0100 Subject: [PATCH 1147/2328] Set object list to read-only --- .../Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs index 4f001a520c..e082e077cf 100644 --- a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs +++ b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs @@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing /// public class DifficultyHitObject { - private readonly List difficultyHitObjects; + private readonly IReadOnlyList difficultyHitObjects; /// /// The position of this in the list. From 88217e0c984b63a29e0c70bdf41372067743b7ea Mon Sep 17 00:00:00 2001 From: Susko3 Date: Mon, 23 May 2022 20:22:27 +0200 Subject: [PATCH 1148/2328] Adjust `ScrollDelta` usages to account for normalised `IsPrecise` values --- osu.Game/Overlays/Volume/VolumeMeter.cs | 2 +- osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs | 8 +++++--- osu.Game/Screens/Edit/Editor.cs | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index 46b8b35da2..929c362bd8 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -329,7 +329,7 @@ namespace osu.Game.Overlays.Volume if (isPrecise) { - scrollAccumulation += delta * adjust_step * 0.1; + scrollAccumulation += delta * adjust_step; while (Precision.AlmostBigger(Math.Abs(scrollAccumulation), precision)) { diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index 5e6d9dbe34..27a3685f89 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -26,6 +26,8 @@ namespace osu.Game.Rulesets.Edit public abstract class DistancedHitObjectComposer : HitObjectComposer, IDistanceSnapProvider, IScrollBindingHandler where TObject : HitObject { + private const float adjust_step = 0.1f; + public Bindable DistanceSpacingMultiplier { get; } = new BindableDouble(1.0) { MinValue = 0.1, @@ -61,7 +63,7 @@ namespace osu.Game.Rulesets.Edit Child = distanceSpacingSlider = new ExpandableSlider> { Current = { BindTarget = DistanceSpacingMultiplier }, - KeyboardStep = 0.1f, + KeyboardStep = adjust_step, } } }); @@ -93,7 +95,7 @@ namespace osu.Game.Rulesets.Edit { case GlobalAction.EditorIncreaseDistanceSpacing: case GlobalAction.EditorDecreaseDistanceSpacing: - return adjustDistanceSpacing(e.Action, 0.1f); + return adjustDistanceSpacing(e.Action, adjust_step); } return false; @@ -109,7 +111,7 @@ namespace osu.Game.Rulesets.Edit { case GlobalAction.EditorIncreaseDistanceSpacing: case GlobalAction.EditorDecreaseDistanceSpacing: - return adjustDistanceSpacing(e.Action, e.ScrollAmount * (e.IsPrecise ? 0.01f : 0.1f)); + return adjustDistanceSpacing(e.Action, e.ScrollAmount * adjust_step); } return false; diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 0bb3f51903..eaacf74af3 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -540,7 +540,7 @@ namespace osu.Game.Screens.Edit if (scrollAccumulation != 0 && Math.Sign(scrollAccumulation) != scrollDirection) scrollAccumulation = scrollDirection * (precision - Math.Abs(scrollAccumulation)); - scrollAccumulation += scrollComponent * (e.IsPrecise ? 0.1 : 1); + scrollAccumulation += scrollComponent; // because we are doing snapped seeking, we need to add up precise scrolls until they accumulate to an arbitrary cut-off. while (Math.Abs(scrollAccumulation) >= precision) From 58d39734d07c0fdd90c2310b68186b82df4ac6c0 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 23 May 2022 20:23:50 +0100 Subject: [PATCH 1149/2328] Integrate `ChatOverlayV2` into main game --- osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs | 2 +- osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs | 2 +- osu.Game/Configuration/OsuConfigManager.cs | 2 +- osu.Game/OsuGame.cs | 4 ++-- osu.Game/Overlays/ChatOverlayV2.cs | 10 ++++++++-- .../Profile/Header/Components/MessageUserButton.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarChatButton.cs | 2 +- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs b/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs index e4871f611e..c8ea692bb2 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs @@ -40,7 +40,7 @@ namespace osu.Game.Tests.Visual.Navigation typeof(DashboardOverlay), typeof(NewsOverlay), typeof(ChannelManager), - typeof(ChatOverlay), + typeof(ChatOverlayV2), typeof(SettingsOverlay), typeof(UserProfileOverlay), typeof(BeatmapSetOverlay), diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index e27db00003..7268dd31f6 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -63,7 +63,7 @@ namespace osu.Game.Tests.Visual.Online Children = new Drawable[] { channelManager, - chatOverlay = new TestChatOverlayV2 { RelativeSizeAxes = Axes.Both }, + chatOverlay = new TestChatOverlayV2(), }, }; }); diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 20d555c16c..69e7dee1a5 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -46,7 +46,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation); - SetDefault(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2f, 1f); + SetDefault(OsuSetting.ChatDisplayHeight, ChatOverlayV2.DEFAULT_HEIGHT, 0.2f, 1f); SetDefault(OsuSetting.BeatmapListingCardSize, BeatmapCardSize.Normal); diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 785881d97a..402bd94f31 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -75,7 +75,7 @@ namespace osu.Game public Toolbar Toolbar; - private ChatOverlay chatOverlay; + private ChatOverlayV2 chatOverlay; private ChannelManager channelManager; @@ -848,7 +848,7 @@ namespace osu.Game loadComponentSingleFile(news = new NewsOverlay(), overlayContent.Add, true); var rankingsOverlay = loadComponentSingleFile(new RankingsOverlay(), overlayContent.Add, true); loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal, true); - loadComponentSingleFile(chatOverlay = new ChatOverlay(), overlayContent.Add, true); + loadComponentSingleFile(chatOverlay = new ChatOverlayV2(), overlayContent.Add, true); loadComponentSingleFile(new MessageNotifier(), AddInternal, true); loadComponentSingleFile(Settings = new SettingsOverlay(), leftFloatingOverlayContent.Add, true); loadComponentSingleFile(changelogOverlay = new ChangelogOverlay(), overlayContent.Add, true); diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index ef479ea21b..441042432a 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -47,8 +47,9 @@ namespace osu.Game.Overlays private bool isDraggingTopBar; private float dragStartChatHeight; + public const float DEFAULT_HEIGHT = 0.4f; + private const int transition_length = 500; - private const float default_chat_height = 0.4f; private const float top_bar_height = 40; private const float side_bar_width = 190; private const float chat_bar_height = 60; @@ -70,7 +71,7 @@ namespace osu.Game.Overlays public ChatOverlayV2() { - Height = default_chat_height; + Height = DEFAULT_HEIGHT; Masking = true; @@ -82,6 +83,7 @@ namespace osu.Game.Overlays Margin = new MarginPadding { Bottom = -corner_radius }; Padding = new MarginPadding { Bottom = corner_radius }; + RelativeSizeAxes = Axes.Both; Anchor = Anchor.BottomCentre; Origin = Anchor.BottomCentre; } @@ -294,6 +296,10 @@ namespace osu.Game.Overlays }); } } + + // Mark channel as read when channel switched + if (newChannel.Messages.Any()) + channelManager.MarkChannelAsRead(newChannel); } protected virtual ChatOverlayDrawableChannel CreateDrawableChannel(Channel newChannel) => new ChatOverlayDrawableChannel(newChannel); diff --git a/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs b/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs index e3dc5f818a..eafb453f75 100644 --- a/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Profile.Header.Components private UserProfileOverlay userOverlay { get; set; } [Resolved(CanBeNull = true)] - private ChatOverlay chatOverlay { get; set; } + private ChatOverlayV2 chatOverlay { get; set; } [Resolved] private IAPIProvider apiProvider { get; set; } diff --git a/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs b/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs index 2d3b33e9bc..20f405aae2 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Toolbar } [BackgroundDependencyLoader(true)] - private void load(ChatOverlay chat) + private void load(ChatOverlayV2 chat) { StateContainer = chat; } From d2a49ca266087d5342fb1c9aa65b45db9204a7a1 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 23 May 2022 20:24:17 +0100 Subject: [PATCH 1150/2328] Use `ChatOverlayV2` in message notifier and tests --- osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs | 2 +- osu.Game/Online/Chat/MessageNotifier.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs index 79f62a16e3..46f426597a 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs @@ -208,7 +208,7 @@ namespace osu.Game.Tests.Visual.Online }; [Cached] - public ChatOverlay ChatOverlay { get; } = new ChatOverlay(); + public ChatOverlayV2 ChatOverlay { get; } = new ChatOverlayV2(); private readonly MessageNotifier messageNotifier = new MessageNotifier(); diff --git a/osu.Game/Online/Chat/MessageNotifier.cs b/osu.Game/Online/Chat/MessageNotifier.cs index ca6082e19b..cea3e321fa 100644 --- a/osu.Game/Online/Chat/MessageNotifier.cs +++ b/osu.Game/Online/Chat/MessageNotifier.cs @@ -27,7 +27,7 @@ namespace osu.Game.Online.Chat private INotificationOverlay notifications { get; set; } [Resolved] - private ChatOverlay chatOverlay { get; set; } + private ChatOverlayV2 chatOverlay { get; set; } [Resolved] private ChannelManager channelManager { get; set; } @@ -170,7 +170,7 @@ namespace osu.Game.Online.Chat public override bool IsImportant => false; [BackgroundDependencyLoader] - private void load(OsuColour colours, ChatOverlay chatOverlay, INotificationOverlay notificationOverlay) + private void load(OsuColour colours, ChatOverlayV2 chatOverlay, INotificationOverlay notificationOverlay) { IconBackground.Colour = colours.PurpleDark; From 606f3b2bd18bc2ed780441a02f6698ba4bcbe6f0 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 23 May 2022 20:24:49 +0100 Subject: [PATCH 1151/2328] Use `ChatOverlayV2` in screen navigation tests --- .../Visual/Navigation/TestScenePerformFromScreen.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs index 2ce914ba3d..5d0116f80e 100644 --- a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs +++ b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs @@ -86,9 +86,9 @@ namespace osu.Game.Tests.Visual.Navigation [Test] public void TestOverlaysAlwaysClosed() { - ChatOverlay chat = null; + ChatOverlayV2 chat = null; AddUntilStep("is at menu", () => Game.ScreenStack.CurrentScreen is MainMenu); - AddUntilStep("wait for chat load", () => (chat = Game.ChildrenOfType().SingleOrDefault()) != null); + AddUntilStep("wait for chat load", () => (chat = Game.ChildrenOfType().SingleOrDefault()) != null); AddStep("show chat", () => InputManager.Key(Key.F8)); From 60b10fca4ec969997f77861beb12d724f0f15297 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 23 May 2022 20:25:01 +0100 Subject: [PATCH 1152/2328] Remove redundant caching of overlays in `ChatLink` test --- osu.Game.Tests/Visual/Online/TestSceneChatLink.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs b/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs index 6818147da4..a28de3be1e 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Chat; -using osu.Game.Overlays; using osu.Game.Overlays.Chat; using osuTK.Graphics; @@ -22,12 +21,10 @@ namespace osu.Game.Tests.Visual.Online public class TestSceneChatLink : OsuTestScene { private readonly TestChatLineContainer textContainer; - private readonly DialogOverlay dialogOverlay; private Color4 linkColour; public TestSceneChatLink() { - Add(dialogOverlay = new DialogOverlay { Depth = float.MinValue }); Add(textContainer = new TestChatLineContainer { Padding = new MarginPadding { Left = 20, Right = 20 }, @@ -47,9 +44,6 @@ namespace osu.Game.Tests.Visual.Online availableChannels.Add(new Channel { Name = "#english" }); availableChannels.Add(new Channel { Name = "#japanese" }); Dependencies.Cache(chatManager); - - Dependencies.Cache(new ChatOverlay()); - Dependencies.CacheAs(dialogOverlay); } [SetUp] From e990a247230d086f14a88e3976230055c5fd331a Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 23 May 2022 20:40:01 +0100 Subject: [PATCH 1153/2328] Remove redundant installation of `libavformat` in Linux CI runs Linux `libavformat` native libraries are now packaged with framework. --- .github/workflows/ci.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d5c565d60..320197b88e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,15 +78,6 @@ jobs: with: dotnet-version: "6.0.x" - # FIXME: libavformat is not included in Ubuntu. Let's fix that. - # https://github.com/ppy/osu-framework/issues/4349 - # Remove this once https://github.com/actions/virtual-environments/issues/3306 has been resolved. - - name: Install libavformat-dev - if: ${{matrix.os.fullname == 'ubuntu-latest'}} - run: | - sudo apt-get update && \ - sudo apt-get -y install libavformat-dev - - name: Compile run: dotnet build -c Debug -warnaserror osu.Desktop.slnf From 5dbec92d9e9973b144028edd8e72671f1635ea73 Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Mon, 23 May 2022 22:17:29 +0100 Subject: [PATCH 1154/2328] Update comments --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 2 +- .../Difficulty/Preprocessing/TaikoDifficultyHitObject.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 0598cbe4c9..591a6e4aa2 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing { public class OsuDifficultyHitObject : DifficultyHitObject { - private const int normalised_radius = 50; + private const int normalised_radius = 50; // Change radius to 50 to make 100 the diameter. Easier for mental maths. private const int min_delta_time = 25; private const float maximum_slider_radius = normalised_radius * 2.4f; private const float assumed_slider_radius = normalised_radius * 1.8f; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs index 79e760d149..a4b7609328 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing /// The gameplay preceding . /// The rate of the gameplay clock. Modified by speed-changing mods. /// The list of s in the current beatmap. - /// The index of the object in the beatmap. + /// The position of this in the list. public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, List objects, int position) : base(hitObject, lastObject, clockRate, objects, position) { From 14f14b431154f9f86d14f794ad64d60e1bd9b76a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 23 May 2022 23:37:05 +0200 Subject: [PATCH 1155/2328] Add failing test case for back button behaviour in song select --- .../Navigation/TestSceneScreenNavigation.cs | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs index a3e0caedb9..256f4a7423 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs @@ -8,9 +8,11 @@ using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Beatmaps; +using osu.Game.Collections; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Leaderboards; @@ -54,6 +56,39 @@ namespace osu.Game.Tests.Visual.Navigation exitViaEscapeAndConfirm(); } + [Test] + public void TestSongSelectBackActionHandling() + { + TestPlaySongSelect songSelect = null; + + PushAndConfirm(() => songSelect = new TestPlaySongSelect()); + + AddStep("set filter", () => songSelect.ChildrenOfType().Single().Current.Value = "test"); + AddStep("press back", () => InputManager.Click(MouseButton.Button1)); + + AddAssert("still at song select", () => Game.ScreenStack.CurrentScreen == songSelect); + AddAssert("filter cleared", () => string.IsNullOrEmpty(songSelect.ChildrenOfType().Single().Current.Value)); + + AddStep("set filter again", () => songSelect.ChildrenOfType().Single().Current.Value = "test"); + AddStep("open collections dropdown", () => + { + InputManager.MoveMouseTo(songSelect.ChildrenOfType().Single()); + InputManager.Click(MouseButton.Left); + }); + + AddStep("press back once", () => InputManager.Click(MouseButton.Button1)); + AddAssert("still at song select", () => Game.ScreenStack.CurrentScreen == songSelect); + AddAssert("collections dropdown closed", () => songSelect + .ChildrenOfType().Single() + .ChildrenOfType.DropdownMenu>().Single().State == MenuState.Closed); + + AddStep("press back a second time", () => InputManager.Click(MouseButton.Button1)); + AddAssert("filter cleared", () => string.IsNullOrEmpty(songSelect.ChildrenOfType().Single().Current.Value)); + + AddStep("press back a third time", () => InputManager.Click(MouseButton.Button1)); + ConfirmAtMainMenu(); + } + /// /// This tests that the F1 key will open the mod select overlay, and not be handled / blocked by the music controller (which has the same default binding /// but should be handled *after* song select). From 3847a586f110fec99f82645582a373da98776bff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 23 May 2022 23:37:40 +0200 Subject: [PATCH 1156/2328] Make `GlobalAction.Back` close all opened dropdown menus --- .../Graphics/UserInterface/OsuDropdown.cs | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 4e391c8221..23e05c7ccc 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -12,9 +12,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input.Bindings; +using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Input.Bindings; using osu.Game.Overlays; using osuTK; using osuTK.Graphics; @@ -31,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface #region OsuDropdownMenu - protected class OsuDropdownMenu : DropdownMenu + protected class OsuDropdownMenu : DropdownMenu, IKeyBindingHandler { public override bool HandleNonPositionalInput => State == MenuState.Open; @@ -275,6 +278,23 @@ namespace osu.Game.Graphics.UserInterface } #endregion + + public bool OnPressed(KeyBindingPressEvent e) + { + if (e.Repeat) return false; + + if (e.Action == GlobalAction.Back) + { + State = MenuState.Closed; + return true; + } + + return false; + } + + public void OnReleased(KeyBindingReleaseEvent e) + { + } } #endregion From 4cf8df16286337e07294a7e30565a204abccdcc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 23 May 2022 23:58:12 +0200 Subject: [PATCH 1157/2328] Fix test inteference from `TestOverlayClosing` --- osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs index 256f4a7423..c1f5f110d1 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs @@ -522,6 +522,9 @@ namespace osu.Game.Tests.Visual.Navigation AddStep("move cursor to background", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.BottomRight)); AddStep("click left mouse button", () => InputManager.Click(MouseButton.Left)); AddAssert("now playing is hidden", () => nowPlayingOverlay.State.Value == Visibility.Hidden); + + // move the mouse firmly inside game bounds to avoid interfering with other tests. + AddStep("center cursor", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.Centre)); } [Test] From eae23784662e89b9d1bdc4d5b0710afe77d41303 Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Tue, 24 May 2022 01:49:07 +0100 Subject: [PATCH 1158/2328] Add WIP to search filters --- osu.Game/Overlays/BeatmapListing/SearchCategory.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/BeatmapListing/SearchCategory.cs b/osu.Game/Overlays/BeatmapListing/SearchCategory.cs index d6ae41aba1..b52df6234f 100644 --- a/osu.Game/Overlays/BeatmapListing/SearchCategory.cs +++ b/osu.Game/Overlays/BeatmapListing/SearchCategory.cs @@ -32,6 +32,9 @@ namespace osu.Game.Overlays.BeatmapListing [Description("Pending & WIP")] Pending, + [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.StatusWip))] + Wip, + [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.StatusGraveyard))] Graveyard, From ed0b841df0ea3bd95315fd79f658e83446239e60 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Mon, 23 May 2022 13:19:01 -0700 Subject: [PATCH 1159/2328] Fix incorrect left/right clicking area of mod panels --- osu.Game/Overlays/Mods/ModColumn.cs | 2 +- osu.Game/Overlays/Mods/ModPanel.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 9bb3f8bd9e..42f9daec4d 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -267,7 +267,7 @@ namespace osu.Game.Overlays.Mods { cancellationTokenSource?.Cancel(); - var panels = availableMods.Select(mod => CreateModPanel(mod).With(panel => panel.Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0))); + var panels = availableMods.Select(mod => CreateModPanel(mod).With(panel => panel.Shear = Vector2.Zero)); Task? loadTask; diff --git a/osu.Game/Overlays/Mods/ModPanel.cs b/osu.Game/Overlays/Mods/ModPanel.cs index 7010342bd8..358bdd3202 100644 --- a/osu.Game/Overlays/Mods/ModPanel.cs +++ b/osu.Game/Overlays/Mods/ModPanel.cs @@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Mods Content.Masking = true; Content.CornerRadius = CORNER_RADIUS; Content.BorderThickness = 2; - Content.Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0); + Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0); Children = new Drawable[] { From 1f935cacf452b3a9f212551082d4a14e4a286972 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Mon, 23 May 2022 18:45:53 -0700 Subject: [PATCH 1160/2328] Add spotlighted beatmaps filter to beatmap listing --- osu.Game/Overlays/BeatmapListing/SearchGeneral.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/BeatmapListing/SearchGeneral.cs b/osu.Game/Overlays/BeatmapListing/SearchGeneral.cs index 9387020bdf..34ff5b9840 100644 --- a/osu.Game/Overlays/BeatmapListing/SearchGeneral.cs +++ b/osu.Game/Overlays/BeatmapListing/SearchGeneral.cs @@ -21,6 +21,9 @@ namespace osu.Game.Overlays.BeatmapListing [Description("Subscribed mappers")] Follows, + [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.GeneralSpotlights))] + Spotlights, + [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.GeneralFeaturedArtists))] [Description("Featured artists")] FeaturedArtists From 9259aa94f10897d044e590ad61e0aa6e5506bf7a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 24 May 2022 11:47:42 +0900 Subject: [PATCH 1161/2328] Fix Catmull slider parsing with duplicate initial point --- .../Formats/LegacyBeatmapDecoderTest.cs | 19 +++++++++++++++++++ ...catmull-duplicate-initial-controlpoint.osu | 2 ++ .../Objects/Legacy/ConvertHitObjectParser.cs | 6 ++++-- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Tests/Resources/catmull-duplicate-initial-controlpoint.osu diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 89baaf228d..e2d9910b82 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -898,5 +898,24 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.That(controlPoints[3].Type, Is.Null); } } + + [Test] + public void TestLegacyDuplicateInitialCatmullPointIsMerged() + { + var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; + + using (var resStream = TestResources.OpenResource("catmull-duplicate-initial-controlpoint.osu")) + using (var stream = new LineBufferedReader(resStream)) + { + var decoded = decoder.Decode(stream); + var controlPoints = ((IHasPath)decoded.HitObjects[0]).Path.ControlPoints; + + Assert.That(controlPoints.Count, Is.EqualTo(4)); + Assert.That(controlPoints[0].Type, Is.EqualTo(PathType.Catmull)); + Assert.That(controlPoints[0].Position, Is.EqualTo(Vector2.Zero)); + Assert.That(controlPoints[1].Type, Is.Null); + Assert.That(controlPoints[1].Position, Is.Not.EqualTo(Vector2.Zero)); + } + } } } diff --git a/osu.Game.Tests/Resources/catmull-duplicate-initial-controlpoint.osu b/osu.Game.Tests/Resources/catmull-duplicate-initial-controlpoint.osu new file mode 100644 index 0000000000..7062229eed --- /dev/null +++ b/osu.Game.Tests/Resources/catmull-duplicate-initial-controlpoint.osu @@ -0,0 +1,2 @@ +[HitObjects] +200,304,23875,6,0,C|200:304|288:304|288:208|352:208,1,260,8|0 \ No newline at end of file diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 7cf68a2df7..d3d1196eae 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -340,8 +340,10 @@ namespace osu.Game.Rulesets.Objects.Legacy if (vertices[endIndex].Position != vertices[endIndex - 1].Position) continue; - // Adjacent legacy Catmull segments should be treated as a single segment. - if (FormatVersion < LegacyBeatmapEncoder.FIRST_LAZER_VERSION && type == PathType.Catmull) + // Legacy Catmull sliders don't support multiple segments, so adjacent Catmull segments should be treated as a single one. + // Importantly, this is not applied to the first control point, which may duplicate the slider path's position + // resulting in a duplicate (0,0) control point in the resultant list. + if (type == PathType.Catmull && endIndex > 1 && FormatVersion < LegacyBeatmapEncoder.FIRST_LAZER_VERSION) continue; // The last control point of each segment is not allowed to start a new implicit segment. From 4bcf15f63257eb741775623ce5605bc5fb31220c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 May 2022 17:56:32 +0900 Subject: [PATCH 1162/2328] Refactor test to allow waveform testing --- .../Editing/TestSceneTapTimingControl.cs | 76 +++++++++++-------- 1 file changed, 46 insertions(+), 30 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs b/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs index de441995b5..46b45979ea 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs @@ -4,15 +4,15 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays; -using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu; using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Timing; using osuTK; @@ -22,9 +22,9 @@ namespace osu.Game.Tests.Visual.Editing [TestFixture] public class TestSceneTapTimingControl : EditorClockTestScene { - [Cached(typeof(EditorBeatmap))] - [Cached(typeof(IBeatSnapProvider))] - private readonly EditorBeatmap editorBeatmap; + private EditorBeatmap editorBeatmap => editorBeatmapContainer?.EditorBeatmap; + + private TestSceneHitObjectComposer.EditorBeatmapContainer editorBeatmapContainer; [Cached] private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue); @@ -33,38 +33,48 @@ namespace osu.Game.Tests.Visual.Editing private Bindable selectedGroup = new Bindable(); private TapTimingControl control; + private OsuSpriteText timingInfo; - public TestSceneTapTimingControl() + [Resolved] + private AudioManager audio { get; set; } + + [SetUpSteps] + public void SetUpSteps() { - var playableBeatmap = CreateBeatmap(new OsuRuleset().RulesetInfo); + AddStep("create beatmap", () => + { + Beatmap.Value = new WaveformTestBeatmap(audio); + }); - // Ensure time doesn't end while testing - playableBeatmap.BeatmapInfo.Length = 1200000; + AddStep("Create component", () => + { + Child = editorBeatmapContainer = new TestSceneHitObjectComposer.EditorBeatmapContainer(Beatmap.Value) + { + Children = new Drawable[] + { + new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Y, + Width = 400, + Scale = new Vector2(1.5f), + Child = control = new TapTimingControl(), + }, + timingInfo = new OsuSpriteText(), + } + }; - editorBeatmap = new EditorBeatmap(playableBeatmap); - - selectedGroup.Value = editorBeatmap.ControlPointInfo.Groups.First(); + selectedGroup.Value = editorBeatmap.ControlPointInfo.Groups.First(); + }); } - protected override void LoadComplete() + protected override void Update() { - base.LoadComplete(); + base.Update(); - Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap); - Beatmap.Disabled = true; - - Children = new Drawable[] - { - new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.Y, - Width = 400, - Scale = new Vector2(1.5f), - Child = control = new TapTimingControl(), - } - }; + if (selectedGroup.Value != null) + timingInfo.Text = $"offset: {selectedGroup.Value.Time:N2} bpm: {selectedGroup.Value.ControlPoints.OfType().First().BPM:N2}"; } [Test] @@ -104,7 +114,13 @@ namespace osu.Game.Tests.Visual.Editing .TriggerClick(); }); - AddSliderStep("BPM", 30, 400, 60, bpm => editorBeatmap.ControlPointInfo.TimingPoints.First().BeatLength = 60000f / bpm); + AddSliderStep("BPM", 30, 400, 128, bpm => + { + if (editorBeatmap == null) + return; + + editorBeatmap.ControlPointInfo.TimingPoints.First().BeatLength = 60000f / bpm; + }); } protected override void Dispose(bool isDisposing) From 588c5d158320bf5ad26e85337a46084b92d5bda8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 May 2022 19:52:01 +0900 Subject: [PATCH 1163/2328] Add initial waveform comparison display --- .../ControlPoints/TimingControlPoint.cs | 2 + .../Screens/Edit/Timing/TapTimingControl.cs | 36 ++++- .../Edit/Timing/WaveformComparisonDisplay.cs | 152 ++++++++++++++++++ 3 files changed, 184 insertions(+), 6 deletions(-) create mode 100644 osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs diff --git a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs index 922439fcb8..3a7c8b2ec0 100644 --- a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using osu.Framework.Bindables; using osu.Game.Beatmaps.Timing; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index 1b0f0a3f5e..d0ab4d1f98 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -24,8 +24,8 @@ namespace osu.Game.Screens.Edit.Timing [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider, OsuColour colours) { - Height = 200; RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; CornerRadius = LabelledDrawable.CORNER_RADIUS; Masking = true; @@ -39,20 +39,44 @@ namespace osu.Game.Screens.Edit.Timing }, new GridContainer { - RelativeSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, RowDimensions = new[] { - new Dimension(), + new Dimension(GridSizeMode.Absolute, 200), new Dimension(GridSizeMode.Absolute, 60), }, Content = new[] { new Drawable[] { - new MetronomeDisplay + new Container { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new GridContainer + { + RelativeSizeAxes = Axes.Both, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize), + new Dimension() + }, + Content = new[] + { + new Drawable[] + { + new MetronomeDisplay + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + }, + new WaveformComparisonDisplay(), + } + }, + } + } } }, new Drawable[] diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs new file mode 100644 index 0000000000..67a1d30ebe --- /dev/null +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -0,0 +1,152 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using System; +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Audio; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Overlays; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Screens.Edit.Timing +{ + internal class WaveformComparisonDisplay : CompositeDrawable + { + private const int total_waveforms = 8; + + private OsuSpriteText beatIndexText = null!; + + private readonly BindableNumber beatLength = new BindableDouble(); + + [Resolved] + private IBindable beatmap { get; set; } = null!; + + [Resolved] + private Bindable selectedGroup { get; set; } = null!; + + [Resolved] + private EditorClock editorClock { get; set; } = null!; + + [Resolved] + private OverlayColourProvider colourProvider { get; set; } = null!; + + private TimingControlPoint timingPoint = TimingControlPoint.DEFAULT; + + private int lastDisplayedBeatIndex; + + public WaveformComparisonDisplay() + { + RelativeSizeAxes = Axes.Both; + + CornerRadius = LabelledDrawable.CORNER_RADIUS; + Masking = true; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + for (int i = 0; i < total_waveforms; i++) + { + AddInternal(new WaveformGraph + { + RelativeSizeAxes = Axes.Both, + BaseColour = colourProvider.Colour0, + LowColour = colourProvider.Colour1, + MidColour = colourProvider.Colour2, + HighColour = colourProvider.Colour4, + Waveform = beatmap.Value.Waveform, + Resolution = 1, + RelativePositionAxes = Axes.Both, + Height = 1f / total_waveforms, + Y = (float)i / total_waveforms, + }); + } + + AddInternal(new Circle + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Colour = Color4.White, + RelativeSizeAxes = Axes.Y, + Width = 3, + }); + + AddInternal(beatIndexText = new OsuSpriteText + { + Margin = new MarginPadding(5), + }); + + selectedGroup.BindValueChanged(selectedGroupChanged, true); + beatLength.BindValueChanged(_ => showFrom(lastDisplayedBeatIndex), true); + } + + private void selectedGroupChanged(ValueChangedEvent group) + { + timingPoint = selectedGroup.Value?.ControlPoints.OfType().FirstOrDefault() + ?? TimingControlPoint.DEFAULT; + + beatLength.UnbindBindings(); + beatLength.BindTo(timingPoint.BeatLengthBindable); + } + + protected override bool OnHover(HoverEvent e) => true; + + protected override bool OnMouseMove(MouseMoveEvent e) + { + float trackLength = (float)beatmap.Value.Track.Length; + int totalBeatsAvailable = (int)(trackLength / timingPoint.BeatLength); + + Scheduler.AddOnce(showFrom, (int)(e.MousePosition.X / DrawWidth * totalBeatsAvailable)); + + return base.OnMouseMove(e); + } + + protected override void Update() + { + base.Update(); + + if (!IsHovered) + { + int beatOffset = (int)Math.Max(0, ((editorClock.CurrentTime - selectedGroup.Value.Time) / timingPoint.BeatLength)); + + showFrom(beatOffset); + } + } + + private void showFrom(int beatIndex) + { + const float visible_width = 300; + + float trackLength = (float)beatmap.Value.Track.Length; + float scale = trackLength / visible_width; + + beatIndexText.Text = beatIndex.ToString(); + + foreach (var waveform in InternalChildren.OfType()) + { + // offset to the required beat index. + float offset = (float)(selectedGroup.Value.Time + (beatIndex * timingPoint.BeatLength - (visible_width / 2))) / trackLength * scale; + + waveform.X = -offset; + waveform.Scale = new Vector2(scale, 1); + + beatIndex++; + } + + lastDisplayedBeatIndex = beatIndex; + } + } +} From 7040dec013d1c050d7d1d068af770f337f2be5f7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 May 2022 20:01:25 +0900 Subject: [PATCH 1164/2328] Fix disabled bindable woes by not using `TimingControlPoint.DEFAULT` --- .../Screens/Edit/Timing/WaveformComparisonDisplay.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index 67a1d30ebe..e410d380d6 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Edit.Timing private IBindable beatmap { get; set; } = null!; [Resolved] - private Bindable selectedGroup { get; set; } = null!; + private Bindable selectedGroup { get; set; } = null!; [Resolved] private EditorClock editorClock { get; set; } = null!; @@ -46,6 +46,8 @@ namespace osu.Game.Screens.Edit.Timing private int lastDisplayedBeatIndex; + private double offsetZeroTime => selectedGroup.Value?.Time ?? 0; + public WaveformComparisonDisplay() { RelativeSizeAxes = Axes.Both; @@ -93,10 +95,10 @@ namespace osu.Game.Screens.Edit.Timing beatLength.BindValueChanged(_ => showFrom(lastDisplayedBeatIndex), true); } - private void selectedGroupChanged(ValueChangedEvent group) + private void selectedGroupChanged(ValueChangedEvent group) { timingPoint = selectedGroup.Value?.ControlPoints.OfType().FirstOrDefault() - ?? TimingControlPoint.DEFAULT; + ?? new TimingControlPoint(); beatLength.UnbindBindings(); beatLength.BindTo(timingPoint.BeatLengthBindable); @@ -120,7 +122,7 @@ namespace osu.Game.Screens.Edit.Timing if (!IsHovered) { - int beatOffset = (int)Math.Max(0, ((editorClock.CurrentTime - selectedGroup.Value.Time) / timingPoint.BeatLength)); + int beatOffset = (int)Math.Max(0, ((editorClock.CurrentTime - offsetZeroTime) / timingPoint.BeatLength)); showFrom(beatOffset); } @@ -138,7 +140,7 @@ namespace osu.Game.Screens.Edit.Timing foreach (var waveform in InternalChildren.OfType()) { // offset to the required beat index. - float offset = (float)(selectedGroup.Value.Time + (beatIndex * timingPoint.BeatLength - (visible_width / 2))) / trackLength * scale; + float offset = (float)(offsetZeroTime + (beatIndex * timingPoint.BeatLength - (visible_width / 2))) / trackLength * scale; waveform.X = -offset; waveform.Scale = new Vector2(scale, 1); From c1720c128d1f591281194b4b76744ea7dcefd7cd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 May 2022 21:00:21 +0900 Subject: [PATCH 1165/2328] Dim rows which are not part of the active control point (and offset centre) --- .../Edit/Timing/WaveformComparisonDisplay.cs | 55 ++++++++++++++++--- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index e410d380d6..2667ae5396 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -33,6 +33,9 @@ namespace osu.Game.Screens.Edit.Timing [Resolved] private IBindable beatmap { get; set; } = null!; + [Resolved] + private EditorBeatmap editorBeatmap { get; set; } = null!; + [Resolved] private Bindable selectedGroup { get; set; } = null!; @@ -46,7 +49,10 @@ namespace osu.Game.Screens.Edit.Timing private int lastDisplayedBeatIndex; - private double offsetZeroTime => selectedGroup.Value?.Time ?? 0; + private double selectedGroupStartTime; + private double selectedGroupEndTime; + + private readonly BindableList controlPointGroups = new BindableList(); public WaveformComparisonDisplay() { @@ -88,20 +94,45 @@ namespace osu.Game.Screens.Edit.Timing AddInternal(beatIndexText = new OsuSpriteText { - Margin = new MarginPadding(5), + Anchor = Anchor.CentreLeft, + Margin = new MarginPadding(4), }); - selectedGroup.BindValueChanged(selectedGroupChanged, true); + selectedGroup.BindValueChanged(_ => updateTimingGroup(), true); + + ((IBindableList)controlPointGroups).BindTo(editorBeatmap.ControlPointInfo.Groups); + controlPointGroups.BindCollectionChanged((_, __) => updateTimingGroup()); + beatLength.BindValueChanged(_ => showFrom(lastDisplayedBeatIndex), true); } - private void selectedGroupChanged(ValueChangedEvent group) + private void updateTimingGroup() { - timingPoint = selectedGroup.Value?.ControlPoints.OfType().FirstOrDefault() - ?? new TimingControlPoint(); - beatLength.UnbindBindings(); + + selectedGroupStartTime = 0; + selectedGroupEndTime = beatmap.Value.Track.Length; + + var tcp = selectedGroup.Value?.ControlPoints.OfType().FirstOrDefault(); + + if (tcp == null) + { + timingPoint = new TimingControlPoint(); + return; + } + + timingPoint = tcp; beatLength.BindTo(timingPoint.BeatLengthBindable); + + selectedGroupStartTime = selectedGroup.Value?.Time ?? 0; + + var nextGroup = editorBeatmap.ControlPointInfo.TimingPoints + .SkipWhile(g => g != tcp) + .Skip(1) + .FirstOrDefault(); + + if (nextGroup != null) + selectedGroupEndTime = nextGroup.Time; } protected override bool OnHover(HoverEvent e) => true; @@ -122,7 +153,7 @@ namespace osu.Game.Screens.Edit.Timing if (!IsHovered) { - int beatOffset = (int)Math.Max(0, ((editorClock.CurrentTime - offsetZeroTime) / timingPoint.BeatLength)); + int beatOffset = (int)Math.Floor((editorClock.CurrentTimeAccurate - selectedGroupStartTime) / timingPoint.BeatLength); showFrom(beatOffset); } @@ -137,11 +168,17 @@ namespace osu.Game.Screens.Edit.Timing beatIndexText.Text = beatIndex.ToString(); + // Start displaying from before the current beat + beatIndex -= total_waveforms / 2; + foreach (var waveform in InternalChildren.OfType()) { // offset to the required beat index. - float offset = (float)(offsetZeroTime + (beatIndex * timingPoint.BeatLength - (visible_width / 2))) / trackLength * scale; + double time = selectedGroupStartTime + beatIndex * timingPoint.BeatLength; + float offset = (float)(time - visible_width / 2) / trackLength * scale; + + waveform.Alpha = time < selectedGroupStartTime || time > selectedGroupEndTime ? 0.2f : 1; waveform.X = -offset; waveform.Scale = new Vector2(scale, 1); From 4fcdcef166b5089fd9403011d2f8ae3405308059 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 May 2022 21:32:55 +0900 Subject: [PATCH 1166/2328] Add indexing on each wavefrom row --- .../Edit/Timing/WaveformComparisonDisplay.cs | 72 ++++++++++++------- 1 file changed, 46 insertions(+), 26 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index 2667ae5396..ad4e1e737d 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -26,8 +26,6 @@ namespace osu.Game.Screens.Edit.Timing { private const int total_waveforms = 8; - private OsuSpriteText beatIndexText = null!; - private readonly BindableNumber beatLength = new BindableDouble(); [Resolved] @@ -42,9 +40,6 @@ namespace osu.Game.Screens.Edit.Timing [Resolved] private EditorClock editorClock { get; set; } = null!; - [Resolved] - private OverlayColourProvider colourProvider { get; set; } = null!; - private TimingControlPoint timingPoint = TimingControlPoint.DEFAULT; private int lastDisplayedBeatIndex; @@ -68,15 +63,9 @@ namespace osu.Game.Screens.Edit.Timing for (int i = 0; i < total_waveforms; i++) { - AddInternal(new WaveformGraph + AddInternal(new WaveformRow { RelativeSizeAxes = Axes.Both, - BaseColour = colourProvider.Colour0, - LowColour = colourProvider.Colour1, - MidColour = colourProvider.Colour2, - HighColour = colourProvider.Colour4, - Waveform = beatmap.Value.Waveform, - Resolution = 1, RelativePositionAxes = Axes.Both, Height = 1f / total_waveforms, Y = (float)i / total_waveforms, @@ -92,12 +81,6 @@ namespace osu.Game.Screens.Edit.Timing Width = 3, }); - AddInternal(beatIndexText = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Margin = new MarginPadding(4), - }); - selectedGroup.BindValueChanged(_ => updateTimingGroup(), true); ((IBindableList)controlPointGroups).BindTo(editorBeatmap.ControlPointInfo.Groups); @@ -166,26 +149,63 @@ namespace osu.Game.Screens.Edit.Timing float trackLength = (float)beatmap.Value.Track.Length; float scale = trackLength / visible_width; - beatIndexText.Text = beatIndex.ToString(); - // Start displaying from before the current beat beatIndex -= total_waveforms / 2; - foreach (var waveform in InternalChildren.OfType()) + foreach (var row in InternalChildren.OfType()) { // offset to the required beat index. double time = selectedGroupStartTime + beatIndex * timingPoint.BeatLength; float offset = (float)(time - visible_width / 2) / trackLength * scale; - waveform.Alpha = time < selectedGroupStartTime || time > selectedGroupEndTime ? 0.2f : 1; - waveform.X = -offset; - waveform.Scale = new Vector2(scale, 1); - - beatIndex++; + row.Alpha = time < selectedGroupStartTime || time > selectedGroupEndTime ? 0.2f : 1; + row.WaveformOffset = -offset; + row.WaveformScale = new Vector2(scale, 1); + row.BeatIndex = beatIndex++; } lastDisplayedBeatIndex = beatIndex; } + + internal class WaveformRow : CompositeDrawable + { + private OsuSpriteText beatIndexText = null!; + private WaveformGraph waveformGraph = null!; + + [Resolved] + private OverlayColourProvider colourProvider { get; set; } = null!; + + [BackgroundDependencyLoader] + private void load(IBindable beatmap) + { + InternalChildren = new Drawable[] + { + waveformGraph = new WaveformGraph + { + RelativeSizeAxes = Axes.Both, + RelativePositionAxes = Axes.Both, + Waveform = beatmap.Value.Waveform, + Resolution = 1, + + BaseColour = colourProvider.Colour0, + LowColour = colourProvider.Colour1, + MidColour = colourProvider.Colour2, + HighColour = colourProvider.Colour4, + }, + beatIndexText = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Padding = new MarginPadding(5), + Colour = colourProvider.Content2 + } + }; + } + + public int BeatIndex { set => beatIndexText.Text = value.ToString(); } + public Vector2 WaveformScale { set => waveformGraph.Scale = value; } + public float WaveformOffset { set => waveformGraph.X = value; } + } } } From 49a21736464330baf0333ff5bfec2461885edd50 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 14:33:05 +0900 Subject: [PATCH 1167/2328] Avoid needlessly updating display (and add better documentation on chosen scale) --- .../Screens/Edit/Timing/WaveformComparisonDisplay.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index ad4e1e737d..0830ba8cf4 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -136,14 +136,21 @@ namespace osu.Game.Screens.Edit.Timing if (!IsHovered) { - int beatOffset = (int)Math.Floor((editorClock.CurrentTimeAccurate - selectedGroupStartTime) / timingPoint.BeatLength); + int currentBeat = (int)Math.Floor((editorClock.CurrentTimeAccurate - selectedGroupStartTime) / timingPoint.BeatLength); - showFrom(beatOffset); + showFrom(currentBeat); } } private void showFrom(int beatIndex) { + if (lastDisplayedBeatIndex == beatIndex) + return; + + // Chosen as a pretty usable number across all BPMs. + // Optimally we'd want this to scale with the BPM in question, but performing + // scaling of the display is both expensive in resampling, and decreases usability + // (as it is harder to track the waveform when making realtime adjustments). const float visible_width = 300; float trackLength = (float)beatmap.Value.Track.Length; From 1137545d4ab4d59e58891a5171932d900120cd2d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 16:02:01 +0900 Subject: [PATCH 1168/2328] Fix `Timeline` potentially not updating visuals to correct state on first display --- .../Screens/Edit/Compose/Components/Timeline/Timeline.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index 992ab7947e..6812bbb72d 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -163,10 +163,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline { base.LoadComplete(); + WaveformVisible.BindValueChanged(_ => updateWaveformOpacity()); waveformOpacity.BindValueChanged(_ => updateWaveformOpacity(), true); - WaveformVisible.ValueChanged += _ => updateWaveformOpacity(); - TicksVisible.ValueChanged += visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint); + TicksVisible.BindValueChanged(visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint), true); + ControlPointsVisible.BindValueChanged(visible => { if (visible.NewValue) From f00dd27fcdd762eccdec2ec780d427c0da023518 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 17:50:23 +0900 Subject: [PATCH 1169/2328] Move `OverlayColourProvider` provisioning of `RoundedButton` to `SettingsButton` for now --- osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs | 9 +++++---- osu.Game/Overlays/Settings/SettingsButton.cs | 9 +++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs index 3c0c3b69e8..cb8c63371d 100644 --- a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs @@ -2,13 +2,11 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Localisation; using osu.Game.Graphics.UserInterface; -using osu.Game.Overlays; namespace osu.Game.Graphics.UserInterfaceV2 { @@ -27,9 +25,12 @@ namespace osu.Game.Graphics.UserInterfaceV2 } [BackgroundDependencyLoader(true)] - private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours) + private void load(OsuColour colours) { - DefaultBackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3; + // According to flyte, buttons are supposed to have explicit colours for now. + // Not sure this is the correct direction, but we haven't decided on an `OverlayColourProvider` stand-in yet. + // This is a better default. See `SettingsButton` for an override which uses `OverlayColourProvider`. + DefaultBackgroundColour = colours.Blue3; } protected override void LoadComplete() diff --git a/osu.Game/Overlays/Settings/SettingsButton.cs b/osu.Game/Overlays/Settings/SettingsButton.cs index 10aea92b22..9e4dc763ec 100644 --- a/osu.Game/Overlays/Settings/SettingsButton.cs +++ b/osu.Game/Overlays/Settings/SettingsButton.cs @@ -3,9 +3,12 @@ using System.Collections.Generic; using System.Linq; +using JetBrains.Annotations; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; using osu.Framework.Localisation; +using osu.Game.Graphics; using osu.Game.Graphics.UserInterfaceV2; namespace osu.Game.Overlays.Settings @@ -18,6 +21,12 @@ namespace osu.Game.Overlays.Settings Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS, Right = SettingsPanel.CONTENT_MARGINS }; } + [BackgroundDependencyLoader(true)] + private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours) + { + DefaultBackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3; + } + public LocalisableString TooltipText { get; set; } public override IEnumerable FilterTerms From a346990a8c7a3b9986d8c712ea4be568e6cf9bec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 16:02:08 +0900 Subject: [PATCH 1170/2328] Remove `TriangleButton` usage in editor --- osu.Game/Screens/Edit/Timing/GroupSection.cs | 4 ++-- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 5 +++-- osu.Game/Screens/Edit/Verify/IssueList.cs | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/GroupSection.cs b/osu.Game/Screens/Edit/Timing/GroupSection.cs index 03059ff6e1..bb2dd35a9c 100644 --- a/osu.Game/Screens/Edit/Timing/GroupSection.cs +++ b/osu.Game/Screens/Edit/Timing/GroupSection.cs @@ -17,7 +17,7 @@ namespace osu.Game.Screens.Edit.Timing { private LabelledTextBox textBox; - private TriangleButton button; + private OsuButton button; [Resolved] protected Bindable SelectedGroup { get; private set; } @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Edit.Timing { Label = "Time" }, - button = new TriangleButton + button = new RoundedButton { Text = "Use current time", RelativeSizeAxes = Axes.X, diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index a4193d5084..5f1fd14617 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays; using osuTK; @@ -100,7 +101,7 @@ namespace osu.Game.Screens.Edit.Timing Spacing = new Vector2(5), Children = new Drawable[] { - deleteButton = new OsuButton + deleteButton = new RoundedButton { Text = "-", Size = new Vector2(30, 30), @@ -108,7 +109,7 @@ namespace osu.Game.Screens.Edit.Timing Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, }, - new OsuButton + new RoundedButton { Text = "+ Add at current time", Action = addNew, diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs index 5fe43199cc..415acc0e22 100644 --- a/osu.Game/Screens/Edit/Verify/IssueList.cs +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Checks.Components; @@ -67,7 +67,7 @@ namespace osu.Game.Screens.Edit.Verify Margin = new MarginPadding(20), Children = new Drawable[] { - new TriangleButton + new RoundedButton { Text = "Refresh", Action = refresh, From 4a88affd036f505c67e2ddbebdbb5e41ed1db339 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 17:02:19 +0900 Subject: [PATCH 1171/2328] Move beat divisor tick size retrieval to static methods --- osu.Game/Screens/Edit/BindableBeatDivisor.cs | 27 +++++++++ .../Timeline/TimelineTickDisplay.cs | 58 +++---------------- 2 files changed, 35 insertions(+), 50 deletions(-) diff --git a/osu.Game/Screens/Edit/BindableBeatDivisor.cs b/osu.Game/Screens/Edit/BindableBeatDivisor.cs index af958e3448..8f430dce77 100644 --- a/osu.Game/Screens/Edit/BindableBeatDivisor.cs +++ b/osu.Game/Screens/Edit/BindableBeatDivisor.cs @@ -5,6 +5,7 @@ using System.Linq; using osu.Framework.Bindables; using osu.Game.Graphics; using osu.Game.Screens.Edit.Compose.Components; +using osuTK; using osuTK.Graphics; namespace osu.Game.Screens.Edit @@ -100,6 +101,32 @@ namespace osu.Game.Screens.Edit } } + /// + /// Get a relative display size for the specified divisor. + /// + /// The beat divisor. + /// A relative size which can be used to display ticks. + public static Vector2 GetSize(int beatDivisor) + { + switch (beatDivisor) + { + case 1: + case 2: + return new Vector2(0.6f, 0.9f); + + case 3: + case 4: + return new Vector2(0.5f, 0.8f); + + case 6: + case 8: + return new Vector2(0.4f, 0.7f); + + default: + return new Vector2(0.3f, 0.6f); + } + } + /// /// Retrieves the applicable divisor for a specific beat index. /// diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs index 3a32dc18e5..fda8416ecd 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs @@ -11,6 +11,7 @@ using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts; using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations; +using osuTK; namespace osu.Game.Screens.Edit.Compose.Components.Timeline { @@ -132,10 +133,15 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline // even though "bar lines" take up the full vertical space, we render them in two pieces because it allows for less anchor/origin churn. + Vector2 size = Vector2.One; + + if (indexInBar != 1) + size = BindableBeatDivisor.GetSize(divisor); + var line = getNextUsableLine(); line.X = xPos; - line.Width = PointVisualisation.MAX_WIDTH * getWidth(indexInBar, divisor); - line.Height = 0.9f * getHeight(indexInBar, divisor); + line.Width = PointVisualisation.MAX_WIDTH * size.X; + line.Height = 0.9f * size.Y; line.Colour = colour; } @@ -170,54 +176,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline } } - private static float getWidth(int indexInBar, int divisor) - { - if (indexInBar == 0) - return 1; - - switch (divisor) - { - case 1: - case 2: - return 0.6f; - - case 3: - case 4: - return 0.5f; - - case 6: - case 8: - return 0.4f; - - default: - return 0.3f; - } - } - - private static float getHeight(int indexInBar, int divisor) - { - if (indexInBar == 0) - return 1; - - switch (divisor) - { - case 1: - case 2: - return 0.9f; - - case 3: - case 4: - return 0.8f; - - case 6: - case 8: - return 0.7f; - - default: - return 0.6f; - } - } - protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); From e6087f5f5be6c6d2038a8909564ae2bd3fc23386 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 16:51:21 +0900 Subject: [PATCH 1172/2328] Handle beat divisor input on mouse down, rather than mouse up It felt way too unresponsive. --- osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs index 370c9016c7..9eda540b70 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs @@ -453,6 +453,7 @@ namespace osu.Game.Screens.Edit.Compose.Components protected override bool OnMouseDown(MouseDownEvent e) { marker.Active = true; + handleMouseInput(e.ScreenSpaceMousePosition); return base.OnMouseDown(e); } From 3c2e57bf00f04cbe2ad74ba786674c986298ff7a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 16:50:16 +0900 Subject: [PATCH 1173/2328] Update `BeatDivisorControl` to better match new designs and metrics --- .../Editing/TestSceneBeatDivisorControl.cs | 5 ++ .../Compose/Components/BeatDivisorControl.cs | 78 ++++++------------- 2 files changed, 28 insertions(+), 55 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs b/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs index 6a0950c6dd..79be8a02c8 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs @@ -5,11 +5,13 @@ using System; using System.Diagnostics; using System.Linq; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; +using osu.Game.Overlays; using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Compose.Components; using osuTK; @@ -25,6 +27,9 @@ namespace osu.Game.Tests.Visual.Editing private SliderBar tickSliderBar => beatDivisorControl.ChildrenOfType>().Single(); private EquilateralTriangle tickMarkerHead => tickSliderBar.ChildrenOfType().Single(); + [Cached] + private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Green); + [SetUp] public void SetUp() => Schedule(() => { diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs index 370c9016c7..47f7f4b388 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs @@ -8,9 +8,7 @@ using Humanizer; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; @@ -22,6 +20,7 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Overlays; using osuTK; using osuTK.Graphics; using osuTK.Input; @@ -38,18 +37,17 @@ namespace osu.Game.Screens.Edit.Compose.Components } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { Masking = true; - CornerRadius = 5; InternalChildren = new Drawable[] { new Box { - Name = "Gray Background", + Name = "Main background", RelativeSizeAxes = Axes.Both, - Colour = colours.Gray4 + Colour = colourProvider.Background3, }, new GridContainer { @@ -65,9 +63,9 @@ namespace osu.Game.Screens.Edit.Compose.Components { new Box { - Name = "Black Background", + Name = "Tick area background", RelativeSizeAxes = Axes.Both, - Colour = Color4.Black + Colour = colourProvider.Background5, }, new TickSliderBar(beatDivisor) { @@ -86,7 +84,7 @@ namespace osu.Game.Screens.Edit.Compose.Components new Box { RelativeSizeAxes = Axes.Both, - Colour = colours.Gray4 + Colour = colourProvider.Background3 }, new Container { @@ -139,11 +137,6 @@ namespace osu.Game.Screens.Edit.Compose.Components RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = colours.Gray4 - }, new Container { RelativeSizeAxes = Axes.Both, @@ -402,15 +395,15 @@ namespace osu.Game.Screens.Edit.Compose.Components ClearInternal(); CurrentNumber.ValueChanged -= moveMarker; - foreach (int t in beatDivisor.ValidDivisors.Value.Presets) + foreach (int divisor in beatDivisor.ValidDivisors.Value.Presets) { - AddInternal(new Tick + AddInternal(new Tick(divisor) { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopCentre, - RelativePositionAxes = Axes.X, - Colour = BindableBeatDivisor.GetColourFor(t, colours), - X = getMappedPosition(t) + Anchor = Anchor.CentreLeft, + Origin = Anchor.Centre, + RelativePositionAxes = Axes.Both, + Colour = BindableBeatDivisor.GetColourFor(divisor, colours), + X = getMappedPosition(divisor), }); } @@ -422,7 +415,6 @@ namespace osu.Game.Screens.Edit.Compose.Components private void moveMarker(ValueChangedEvent divisor) { marker.MoveToX(getMappedPosition(divisor.NewValue), 100, Easing.OutQuint); - marker.Flash(); } protected override void UpdateValue(float value) @@ -489,29 +481,26 @@ namespace osu.Game.Screens.Edit.Compose.Components private float getMappedPosition(float divisor) => MathF.Pow((divisor - 1) / (beatDivisor.ValidDivisors.Value.Presets.Last() - 1), 0.90f); - private class Tick : CompositeDrawable + private class Tick : Circle { - public Tick() + public Tick(int divisor) { - Size = new Vector2(2.5f, 10); - + Size = new Vector2(6f, 12) * BindableBeatDivisor.GetSize(divisor); InternalChild = new Box { RelativeSizeAxes = Axes.Both }; - - CornerRadius = 0.5f; - Masking = true; } } private class Marker : CompositeDrawable { - private Color4 defaultColour; + [Resolved] + private OverlayColourProvider colourProvider { get; set; } - private const float size = 7; + private const float size = 10; [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load() { - Colour = defaultColour = colours.Gray4; + Colour = colourProvider.Background3; Anchor = Anchor.TopLeft; Origin = Anchor.TopCentre; @@ -521,15 +510,6 @@ namespace osu.Game.Screens.Edit.Compose.Components InternalChildren = new Drawable[] { - new Box - { - Width = 2, - RelativeSizeAxes = Axes.Y, - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, - Colour = ColourInfo.GradientVertical(Color4.White.Opacity(0.2f), Color4.White), - Blending = BlendingParameters.Additive, - }, new EquilateralTriangle { Origin = Anchor.BottomCentre, @@ -548,22 +528,10 @@ namespace osu.Game.Screens.Edit.Compose.Components get => active; set { - this.FadeColour(value ? Color4.White : defaultColour, 500, Easing.OutQuint); + this.FadeColour(value ? colourProvider.Background1 : colourProvider.Background3, 500, Easing.OutQuint); active = value; } } - - public void Flash() - { - bool wasActive = active; - - Active = true; - - if (wasActive) return; - - using (BeginDelayedSequence(50)) - Active = false; - } } } } From 3ace5f135e826ae73e7e5630ae7a369f5ee7d6fc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 18:25:57 +0900 Subject: [PATCH 1174/2328] Adjust marker to match design proportions --- .../Compose/Components/BeatDivisorControl.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs index 47f7f4b388..e3c862f91b 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs @@ -495,26 +495,22 @@ namespace osu.Game.Screens.Edit.Compose.Components [Resolved] private OverlayColourProvider colourProvider { get; set; } - private const float size = 10; - [BackgroundDependencyLoader] private void load() { Colour = colourProvider.Background3; - Anchor = Anchor.TopLeft; - Origin = Anchor.TopCentre; + Anchor = Anchor.BottomLeft; + Origin = Anchor.BottomCentre; + + Size = new Vector2(8, 6.5f); - Width = size; - RelativeSizeAxes = Axes.Y; RelativePositionAxes = Axes.X; InternalChildren = new Drawable[] { - new EquilateralTriangle + new Triangle { - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, - Height = size, + RelativeSizeAxes = Axes.Both, EdgeSmoothness = new Vector2(1), Colour = Color4.White, } From bb82abe48d81d596946d1781d0621c1bbf5f18da Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 18:38:08 +0900 Subject: [PATCH 1175/2328] Update test to use new triangle type resolution --- osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs b/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs index 79be8a02c8..cdd1175692 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs @@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.Editing private BindableBeatDivisor bindableBeatDivisor; private SliderBar tickSliderBar => beatDivisorControl.ChildrenOfType>().Single(); - private EquilateralTriangle tickMarkerHead => tickSliderBar.ChildrenOfType().Single(); + private Triangle tickMarkerHead => tickSliderBar.ChildrenOfType().Single(); [Cached] private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Green); From 33fd1555f23a45c4d325c4db4d4d2aa643a6c0c1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 18:42:40 +0900 Subject: [PATCH 1176/2328] Update `TestSceneRoundedButton` with new colour assertions --- .../UserInterface/TestSceneRoundedButton.cs | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs index f45c55d912..454a71e6d2 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs @@ -5,9 +5,12 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Testing; +using osu.Game.Graphics; using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays; +using osu.Game.Overlays.Settings; namespace osu.Game.Tests.Visual.UserInterface { @@ -15,14 +18,31 @@ namespace osu.Game.Tests.Visual.UserInterface { private readonly BindableBool enabled = new BindableBool(true); - protected override Drawable CreateContent() => new RoundedButton + protected override Drawable CreateContent() { - Width = 400, - Text = "Test button", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Enabled = { BindTarget = enabled }, - }; + return new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new RoundedButton + { + Width = 400, + Text = "Test button", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Enabled = { BindTarget = enabled }, + }, + new SettingsButton + { + Text = "Test button", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Enabled = { BindTarget = enabled }, + }, + } + }; + } [Test] public void TestDisabled() @@ -34,7 +54,8 @@ namespace osu.Game.Tests.Visual.UserInterface public void TestBackgroundColour() { AddStep("set red scheme", () => CreateThemedContent(OverlayColourScheme.Red)); - AddAssert("first button has correct colour", () => Cell(0, 1).ChildrenOfType().First().BackgroundColour == new OverlayColourProvider(OverlayColourScheme.Red).Highlight1); + AddAssert("rounded button has correct colour", () => Cell(0, 1).ChildrenOfType().First().BackgroundColour == new OsuColour().Blue3); + AddAssert("settings button has correct colour", () => Cell(0, 1).ChildrenOfType().First().BackgroundColour == new OverlayColourProvider(OverlayColourScheme.Red).Highlight1); } } } From 17206bbebf4635a635b612255ec8112466dd14c5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 16:15:24 +0900 Subject: [PATCH 1177/2328] Update screen padding and colouring to better match new designs --- .../Edit/DistancedHitObjectComposer.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 4 +-- .../Screens/Edit/EditorScreenWithTimeline.cs | 13 ++----- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 36 +++++++++---------- 4 files changed, 22 insertions(+), 33 deletions(-) diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index 5e6d9dbe34..7019dad803 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Edit { AddInternal(RightSideToolboxContainer = new ExpandingToolboxContainer(130, 250) { - Padding = new MarginPadding { Right = 10 }, + Padding = new MarginPadding(10), Alpha = DistanceSpacingMultiplier.Disabled ? 0 : 1, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index f8d796a778..f6fdb228ce 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -114,9 +114,9 @@ namespace osu.Game.Rulesets.Edit .WithChild(BlueprintContainer = CreateBlueprintContainer()) } }, - new ExpandingToolboxContainer(80, 200) + new ExpandingToolboxContainer(90, 200) { - Padding = new MarginPadding { Left = 10 }, + Padding = new MarginPadding(10), Children = new Drawable[] { new EditorToolboxGroup("toolbox (1-9)") diff --git a/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs b/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs index 0d59a7a1a8..5482aa4ff0 100644 --- a/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs +++ b/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs @@ -3,14 +3,13 @@ using JetBrains.Annotations; using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; using osu.Game.Screens.Edit.Compose.Components; using osu.Game.Screens.Edit.Compose.Components.Timeline; -using osuTK.Graphics; namespace osu.Game.Screens.Edit { @@ -33,7 +32,7 @@ namespace osu.Game.Screens.Edit private LoadingSpinner spinner; [BackgroundDependencyLoader(true)] - private void load([CanBeNull] BindableBeatDivisor beatDivisor) + private void load(OverlayColourProvider colourProvider, [CanBeNull] BindableBeatDivisor beatDivisor) { if (beatDivisor != null) this.beatDivisor.BindTo(beatDivisor); @@ -60,7 +59,7 @@ namespace osu.Game.Screens.Edit new Box { RelativeSizeAxes = Axes.Both, - Colour = Color4.Black.Opacity(0.5f) + Colour = colourProvider.Background4 }, new Container { @@ -106,12 +105,6 @@ namespace osu.Game.Screens.Edit Name = "Main content", RelativeSizeAxes = Axes.Both, Depth = float.MaxValue, - Padding = new MarginPadding - { - Horizontal = horizontal_margins, - Top = vertical_margins, - Bottom = vertical_margins - }, Child = spinner = new LoadingSpinner(true) { State = { Value = Visibility.Visible }, diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index 5f1fd14617..f71a8d7d22 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -16,7 +16,7 @@ using osuTK; namespace osu.Game.Screens.Edit.Timing { - public class TimingScreen : EditorRoundedScreen + public class TimingScreen : EditorScreenWithTimeline { [Cached] private Bindable selectedGroup = new Bindable(); @@ -26,27 +26,23 @@ namespace osu.Game.Screens.Edit.Timing { } - [BackgroundDependencyLoader] - private void load() + protected override Drawable CreateMainContent() => new GridContainer { - Add(new GridContainer + RelativeSizeAxes = Axes.Both, + ColumnDimensions = new[] { - RelativeSizeAxes = Axes.Both, - ColumnDimensions = new[] + new Dimension(), + new Dimension(GridSizeMode.Absolute, 350), + }, + Content = new[] + { + new Drawable[] { - new Dimension(), - new Dimension(GridSizeMode.Absolute, 350), + new ControlPointList(), + new ControlPointSettings(), }, - Content = new[] - { - new Drawable[] - { - new ControlPointList(), - new ControlPointSettings(), - }, - } - }); - } + } + }; public class ControlPointList : CompositeDrawable { @@ -77,12 +73,12 @@ namespace osu.Game.Screens.Edit.Timing { new Box { - Colour = colours.Background3, + Colour = colours.Background4, RelativeSizeAxes = Axes.Both, }, new Box { - Colour = colours.Background2, + Colour = colours.Background3, RelativeSizeAxes = Axes.Y, Width = ControlPointTable.TIMING_COLUMN_WIDTH + margins, }, From a905731053c2dfbcdab9466f0da2fe97a2cb1925 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 16:32:44 +0900 Subject: [PATCH 1178/2328] Update timeline colours and paddings to match new designs --- .../Compose/Components/Timeline/TimelineArea.cs | 13 +++++++------ osu.Game/Screens/Edit/EditorScreenWithTimeline.cs | 5 ++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs index 1541ceade5..4cffebc57c 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs @@ -2,12 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; using osuTK; namespace osu.Game.Screens.Edit.Compose.Components.Timeline @@ -27,10 +27,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline } [BackgroundDependencyLoader] - private void load() + private void load(OverlayColourProvider colourProvider) { Masking = true; - CornerRadius = 5; OsuCheckbox waveformCheckbox; OsuCheckbox controlPointsCheckbox; @@ -41,7 +40,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline new Box { RelativeSizeAxes = Axes.Both, - Colour = Color4Extensions.FromHex("111") + Colour = colourProvider.Background5 }, new GridContainer { @@ -55,12 +54,13 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline { RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, + Name = @"Toggle controls", Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, - Colour = Color4Extensions.FromHex("222") + Colour = colourProvider.Background2, }, new FillFlowContainer { @@ -94,12 +94,13 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline { RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, + Name = @"Zoom controls", Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, - Colour = Color4Extensions.FromHex("333") + Colour = colourProvider.Background3, }, new Container { diff --git a/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs b/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs index 5482aa4ff0..186a4bddb3 100644 --- a/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs +++ b/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs @@ -15,8 +15,7 @@ namespace osu.Game.Screens.Edit { public abstract class EditorScreenWithTimeline : EditorScreen { - private const float vertical_margins = 10; - private const float horizontal_margins = 20; + private const float padding = 10; private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor(); @@ -66,7 +65,7 @@ namespace osu.Game.Screens.Edit Name = "Timeline content", RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Horizontal = horizontal_margins, Vertical = vertical_margins }, + Padding = new MarginPadding { Horizontal = padding, Top = padding }, Child = new GridContainer { RelativeSizeAxes = Axes.X, From 1d196262d0a06e5d03db25ca1c99082a255c341e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 16:33:20 +0900 Subject: [PATCH 1179/2328] Remove unused `OnTimelineLoaded` flow --- osu.Game/Screens/Edit/EditorScreenWithTimeline.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs b/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs index 186a4bddb3..0b80af68f2 100644 --- a/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs +++ b/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs @@ -125,18 +125,10 @@ namespace osu.Game.Screens.Edit mainContent.Add(content); content.FadeInFromZero(300, Easing.OutQuint); - LoadComponentAsync(new TimelineArea(CreateTimelineContent()), t => - { - timelineContainer.Add(t); - OnTimelineLoaded(t); - }); + LoadComponentAsync(new TimelineArea(CreateTimelineContent()), timelineContainer.Add); }); } - protected virtual void OnTimelineLoaded(TimelineArea timelineArea) - { - } - protected abstract Drawable CreateMainContent(); protected virtual Drawable CreateTimelineContent() => new Container(); From c02ec050569e86811c1ad937a41edcbc95900451 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 17:13:44 +0900 Subject: [PATCH 1180/2328] Remove remaining usage of `EditorRoundedScreen` --- osu.Game/Screens/Edit/EditorRoundedScreen.cs | 53 ------------------- osu.Game/Screens/Edit/Setup/SetupScreen.cs | 12 ++++- .../Screens/Edit/Setup/SetupScreenHeader.cs | 2 +- osu.Game/Screens/Edit/Setup/SetupSection.cs | 2 +- osu.Game/Screens/Edit/Verify/VerifyScreen.cs | 5 +- 5 files changed, 14 insertions(+), 60 deletions(-) delete mode 100644 osu.Game/Screens/Edit/EditorRoundedScreen.cs diff --git a/osu.Game/Screens/Edit/EditorRoundedScreen.cs b/osu.Game/Screens/Edit/EditorRoundedScreen.cs deleted file mode 100644 index 62f40f0325..0000000000 --- a/osu.Game/Screens/Edit/EditorRoundedScreen.cs +++ /dev/null @@ -1,53 +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.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Overlays; - -namespace osu.Game.Screens.Edit -{ - public class EditorRoundedScreen : EditorScreen - { - public const int HORIZONTAL_PADDING = 100; - - private Container roundedContent; - - protected override Container Content => roundedContent; - - public EditorRoundedScreen(EditorScreenMode mode) - : base(mode) - { - } - - [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) - { - base.Content.Add(new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding(50), - Child = new Container - { - RelativeSizeAxes = Axes.Both, - Masking = true, - CornerRadius = 10, - Children = new Drawable[] - { - new Box - { - Colour = colourProvider.Background3, - RelativeSizeAxes = Axes.Both, - }, - roundedContent = new Container - { - RelativeSizeAxes = Axes.Both, - }, - } - } - }); - } - } -} diff --git a/osu.Game/Screens/Edit/Setup/SetupScreen.cs b/osu.Game/Screens/Edit/Setup/SetupScreen.cs index 231d977aab..b95aabc1c4 100644 --- a/osu.Game/Screens/Edit/Setup/SetupScreen.cs +++ b/osu.Game/Screens/Edit/Setup/SetupScreen.cs @@ -4,11 +4,13 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; +using osu.Game.Overlays; namespace osu.Game.Screens.Edit.Setup { - public class SetupScreen : EditorRoundedScreen + public class SetupScreen : EditorScreen { [Cached] private SectionsContainer sections { get; } = new SetupScreenSectionsContainer(); @@ -22,7 +24,7 @@ namespace osu.Game.Screens.Edit.Setup } [BackgroundDependencyLoader] - private void load(EditorBeatmap beatmap) + private void load(EditorBeatmap beatmap, OverlayColourProvider colourProvider) { var sectionsEnumerable = new List { @@ -37,6 +39,12 @@ namespace osu.Game.Screens.Edit.Setup if (rulesetSpecificSection != null) sectionsEnumerable.Add(rulesetSpecificSection); + Add(new Box + { + Colour = colourProvider.Background2, + RelativeSizeAxes = Axes.Both, + }); + Add(sections.With(s => { s.RelativeSizeAxes = Axes.Both; diff --git a/osu.Game/Screens/Edit/Setup/SetupScreenHeader.cs b/osu.Game/Screens/Edit/Setup/SetupScreenHeader.cs index 2d0afda001..2412f1c4ed 100644 --- a/osu.Game/Screens/Edit/Setup/SetupScreenHeader.cs +++ b/osu.Game/Screens/Edit/Setup/SetupScreenHeader.cs @@ -93,7 +93,7 @@ namespace osu.Game.Screens.Edit.Setup public SetupScreenTabControl() { - TabContainer.Margin = new MarginPadding { Horizontal = EditorRoundedScreen.HORIZONTAL_PADDING }; + TabContainer.Margin = new MarginPadding { Horizontal = 100 }; AddInternal(background = new Box { diff --git a/osu.Game/Screens/Edit/Setup/SetupSection.cs b/osu.Game/Screens/Edit/Setup/SetupSection.cs index 1dde6fb926..02bb05d227 100644 --- a/osu.Game/Screens/Edit/Setup/SetupSection.cs +++ b/osu.Game/Screens/Edit/Setup/SetupSection.cs @@ -40,7 +40,7 @@ namespace osu.Game.Screens.Edit.Setup Padding = new MarginPadding { Vertical = 10, - Horizontal = EditorRoundedScreen.HORIZONTAL_PADDING + Horizontal = 100 }; InternalChild = new FillFlowContainer diff --git a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs index 08643eb8c1..9dc5a53907 100644 --- a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs +++ b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs @@ -11,7 +11,7 @@ using osu.Game.Rulesets.Edit.Checks.Components; namespace osu.Game.Screens.Edit.Verify { [Cached] - public class VerifyScreen : EditorRoundedScreen + public class VerifyScreen : EditorScreen { public readonly Bindable SelectedIssue = new Bindable(); @@ -32,7 +32,6 @@ namespace osu.Game.Screens.Edit.Verify InterpretedDifficulty.Default = BeatmapDifficultyCache.GetDifficultyRating(EditorBeatmap.BeatmapInfo.StarRating); InterpretedDifficulty.SetDefault(); - IssueList = new IssueList(); Child = new Container { RelativeSizeAxes = Axes.Both, @@ -48,7 +47,7 @@ namespace osu.Game.Screens.Edit.Verify { new Drawable[] { - IssueList, + IssueList = new IssueList(), new IssueSettings(), }, } From 3f5ccd4db8c5aa6ae027b4c00a1df344891d3896 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 18:02:37 +0900 Subject: [PATCH 1181/2328] Update timing screen sections to newer design metrics --- osu.Game/Graphics/UserInterfaceV2/LabelledDrawable.cs | 2 +- osu.Game/Screens/Edit/EditorRoundedScreenSettings.cs | 5 ++++- osu.Game/Screens/Edit/Timing/Section.cs | 11 ++++++----- .../Screens/Edit/Timing/SliderWithTextBoxInput.cs | 2 ++ 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/UserInterfaceV2/LabelledDrawable.cs b/osu.Game/Graphics/UserInterfaceV2/LabelledDrawable.cs index 066e1a7978..2353d9e0e8 100644 --- a/osu.Game/Graphics/UserInterfaceV2/LabelledDrawable.cs +++ b/osu.Game/Graphics/UserInterfaceV2/LabelledDrawable.cs @@ -154,7 +154,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 [BackgroundDependencyLoader(true)] private void load(OverlayColourProvider? colourProvider, OsuColour osuColour) { - background.Colour = colourProvider?.Background4 ?? Color4Extensions.FromHex(@"1c2125"); + background.Colour = colourProvider?.Background5 ?? Color4Extensions.FromHex(@"1c2125"); descriptionText.Colour = osuColour.Yellow; } diff --git a/osu.Game/Screens/Edit/EditorRoundedScreenSettings.cs b/osu.Game/Screens/Edit/EditorRoundedScreenSettings.cs index cb17484d27..94a83a82aa 100644 --- a/osu.Game/Screens/Edit/EditorRoundedScreenSettings.cs +++ b/osu.Game/Screens/Edit/EditorRoundedScreenSettings.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; using osu.Game.Overlays; +using osuTK; namespace osu.Game.Screens.Edit { @@ -22,7 +23,7 @@ namespace osu.Game.Screens.Edit { new Box { - Colour = colours.Background4, + Colour = colours.Background6, RelativeSizeAxes = Axes.Both, }, new OsuScrollContainer @@ -33,6 +34,8 @@ namespace osu.Game.Screens.Edit RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, + Padding = new MarginPadding(10), + Spacing = new Vector2(10), Children = CreateSections() }, } diff --git a/osu.Game/Screens/Edit/Timing/Section.cs b/osu.Game/Screens/Edit/Timing/Section.cs index 8659b7aff6..139abfb187 100644 --- a/osu.Game/Screens/Edit/Timing/Section.cs +++ b/osu.Game/Screens/Edit/Timing/Section.cs @@ -44,9 +44,15 @@ namespace osu.Game.Screens.Edit.Timing AutoSizeAxes = Axes.Y; Masking = true; + CornerRadius = 5; InternalChildren = new Drawable[] { + new Box + { + Colour = colours.Background4, + RelativeSizeAxes = Axes.Both, + }, new Container { RelativeSizeAxes = Axes.X, @@ -69,11 +75,6 @@ namespace osu.Game.Screens.Edit.Timing AutoSizeAxes = Axes.Y, Children = new Drawable[] { - new Box - { - Colour = colours.Background3, - RelativeSizeAxes = Axes.Both, - }, Flow = new FillFlowContainer { Padding = new MarginPadding(20), diff --git a/osu.Game/Screens/Edit/Timing/SliderWithTextBoxInput.cs b/osu.Game/Screens/Edit/Timing/SliderWithTextBoxInput.cs index 67f1dacec4..9f036f0215 100644 --- a/osu.Game/Screens/Edit/Timing/SliderWithTextBoxInput.cs +++ b/osu.Game/Screens/Edit/Timing/SliderWithTextBoxInput.cs @@ -11,6 +11,7 @@ using osu.Framework.Localisation; using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays.Settings; using osu.Game.Utils; +using osuTK; namespace osu.Game.Screens.Edit.Timing { @@ -33,6 +34,7 @@ namespace osu.Game.Screens.Edit.Timing RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, + Spacing = new Vector2(20), Children = new Drawable[] { textBox = new LabelledTextBox From 648cee71061f043eb813c5eb7e01bebfd63ecb22 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 17:23:42 +0900 Subject: [PATCH 1182/2328] Remove editor screen transitions for now --- osu.Game/Screens/Edit/Editor.cs | 1 + osu.Game/Screens/Edit/EditorScreen.cs | 12 ++---------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 0bb3f51903..90bf9c6c3c 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -777,6 +777,7 @@ namespace osu.Game.Screens.Edit if ((currentScreen = screenContainer.SingleOrDefault(s => s.Type == e.NewValue)) != null) { screenContainer.ChangeChildDepth(currentScreen, lastScreen?.Depth + 1 ?? 0); + currentScreen.Show(); return; } diff --git a/osu.Game/Screens/Edit/EditorScreen.cs b/osu.Game/Screens/Edit/EditorScreen.cs index 2837cdcd9a..31c34edd7c 100644 --- a/osu.Game/Screens/Edit/EditorScreen.cs +++ b/osu.Game/Screens/Edit/EditorScreen.cs @@ -33,17 +33,9 @@ namespace osu.Game.Screens.Edit InternalChild = content = new PopoverContainer { RelativeSizeAxes = Axes.Both }; } - protected override void PopIn() - { - this.ScaleTo(1f, 200, Easing.OutQuint) - .FadeIn(200, Easing.OutQuint); - } + protected override void PopIn() => this.FadeIn(); - protected override void PopOut() - { - this.ScaleTo(0.98f, 200, Easing.OutQuint) - .FadeOut(200, Easing.OutQuint); - } + protected override void PopOut() => this.FadeOut(); #region Clipboard operations From 0bcf8c846c91fb5482615d39fb82b0b45498a82b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 17:36:43 +0900 Subject: [PATCH 1183/2328] Change editor colour scheme to aquamarine --- osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs | 2 +- osu.Game/Overlays/OverlayColourProvider.cs | 4 ++++ osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Tests/Visual/EditorClockTestScene.cs | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs b/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs index cdd1175692..073a228224 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs @@ -28,7 +28,7 @@ namespace osu.Game.Tests.Visual.Editing private Triangle tickMarkerHead => tickSliderBar.ChildrenOfType().Single(); [Cached] - private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Green); + private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Aquamarine); [SetUp] public void SetUp() => Schedule(() => diff --git a/osu.Game/Overlays/OverlayColourProvider.cs b/osu.Game/Overlays/OverlayColourProvider.cs index 7bddb924a0..a4f6527024 100644 --- a/osu.Game/Overlays/OverlayColourProvider.cs +++ b/osu.Game/Overlays/OverlayColourProvider.cs @@ -72,6 +72,9 @@ namespace osu.Game.Overlays case OverlayColourScheme.Green: return 125 / 360f; + case OverlayColourScheme.Aquamarine: + return 160 / 360f; + case OverlayColourScheme.Purple: return 255 / 360f; @@ -94,5 +97,6 @@ namespace osu.Game.Overlays Purple, Blue, Plum, + Aquamarine } } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 90bf9c6c3c..7e7764397c 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -140,7 +140,7 @@ namespace osu.Game.Screens.Edit public readonly EditorClipboard Clipboard = new EditorClipboard(); [Cached] - private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue); + private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine); public Editor(EditorLoader loader = null) { diff --git a/osu.Game/Tests/Visual/EditorClockTestScene.cs b/osu.Game/Tests/Visual/EditorClockTestScene.cs index 66ab427565..542f06f86b 100644 --- a/osu.Game/Tests/Visual/EditorClockTestScene.cs +++ b/osu.Game/Tests/Visual/EditorClockTestScene.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Input.Events; using osu.Game.Beatmaps; +using osu.Game.Overlays; using osu.Game.Screens.Edit; namespace osu.Game.Tests.Visual @@ -15,6 +16,9 @@ namespace osu.Game.Tests.Visual /// public abstract class EditorClockTestScene : OsuManualInputManagerTestScene { + [Cached] + private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Aquamarine); + protected readonly BindableBeatDivisor BeatDivisor = new BindableBeatDivisor(); protected new readonly EditorClock Clock; From 30b9e0e7abdc59c69c8ee9192b60c2a2430af263 Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Tue, 24 May 2022 16:30:25 +0100 Subject: [PATCH 1184/2328] Use object list size for object position --- .../Difficulty/CatchDifficultyCalculator.cs | 6 +----- .../Difficulty/Preprocessing/CatchDifficultyHitObject.cs | 4 ++-- .../Difficulty/ManiaDifficultyCalculator.cs | 2 +- .../Difficulty/Preprocessing/ManiaDifficultyHitObject.cs | 4 ++-- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 2 +- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 6 +++--- .../Difficulty/Preprocessing/TaikoDifficultyHitObject.cs | 5 ++--- .../Difficulty/TaikoDifficultyCalculator.cs | 2 +- .../Difficulty/Preprocessing/DifficultyHitObject.cs | 5 ++--- 9 files changed, 15 insertions(+), 21 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index 3826e4cec4..da85840171 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -50,7 +50,6 @@ namespace osu.Game.Rulesets.Catch.Difficulty CatchHitObject lastObject = null; List objects = new List(); - int index = 0; // In 2B beatmaps, it is possible that a normal Fruit is placed in the middle of a JuiceStream. foreach (var hitObject in beatmap.HitObjects @@ -63,10 +62,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty continue; if (lastObject != null) - { - objects.Add(new CatchDifficultyHitObject(hitObject, lastObject, clockRate, halfCatcherWidth, objects, index)); - index++; - } + objects.Add(new CatchDifficultyHitObject(hitObject, lastObject, clockRate, halfCatcherWidth, objects)); lastObject = hitObject; } diff --git a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs index 8c229cf6c5..60d6213525 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs @@ -25,8 +25,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing /// public readonly double StrainTime; - public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth, List objects, int position) - : base(hitObject, lastObject, clockRate, objects, position) + public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth, List objects) + : base(hitObject, lastObject, clockRate, objects) { // We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps. float scalingFactor = normalized_hitobject_radius / halfCatcherWidth; diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs index 7ce73c98d1..68c2acb2ed 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty List objects = new List(); for (int i = 1; i < sortedObjects.Length; i++) - objects.Add(new ManiaDifficultyHitObject(sortedObjects[i], sortedObjects[i - 1], clockRate, objects, i - 1)); + objects.Add(new ManiaDifficultyHitObject(sortedObjects[i], sortedObjects[i - 1], clockRate, objects)); return objects; } diff --git a/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs b/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs index 5c9b3b9b54..68f14ed128 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs @@ -12,8 +12,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Preprocessing { public new ManiaHitObject BaseObject => (ManiaHitObject)base.BaseObject; - public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int position) - : base(hitObject, lastObject, clockRate, objects, position) + public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects) + : base(hitObject, lastObject, clockRate, objects) { } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 3b21ab49c2..da9fb2bb08 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -92,7 +92,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty // The first jump is formed by the first two hitobjects of the map. // If the map has less than two OsuHitObjects, the enumerator will not return anything. for (int i = 1; i < beatmap.HitObjects.Count; i++) - objects.Add(new OsuDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate, objects, i - 1)); + objects.Add(new OsuDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate, objects)); return objects; } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 591a6e4aa2..c0d5f56cb5 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -75,10 +75,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing private readonly OsuHitObject lastLastObject; private readonly OsuHitObject lastObject; - public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int position) - : base(hitObject, lastObject, clockRate, objects, position) + public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects) + : base(hitObject, lastObject, clockRate, objects) { - lastLastObject = position > 1 ? (OsuHitObject)Previous(1).BaseObject : null; + lastLastObject = Position > 1 ? (OsuHitObject)Previous(1).BaseObject : null; this.lastObject = (OsuHitObject)lastObject; // Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects. diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs index a4b7609328..6dbaab44cf 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs @@ -39,9 +39,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing /// The gameplay preceding . /// The rate of the gameplay clock. Modified by speed-changing mods. /// The list of s in the current beatmap. - /// The position of this in the list. - public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, List objects, int position) - : base(hitObject, lastObject, clockRate, objects, position) + public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, List objects) + : base(hitObject, lastObject, clockRate, objects) { var currentHit = hitObject as Hit; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index 54cf0ae4fd..d6792f7227 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty { taikoDifficultyHitObjects.Add( new TaikoDifficultyHitObject( - beatmap.HitObjects[i], beatmap.HitObjects[i - 1], beatmap.HitObjects[i - 2], clockRate, taikoDifficultyHitObjects, i - 2 + beatmap.HitObjects[i], beatmap.HitObjects[i - 1], beatmap.HitObjects[i - 2], clockRate, taikoDifficultyHitObjects ) ); } diff --git a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs index e082e077cf..2891434e01 100644 --- a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs +++ b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs @@ -50,11 +50,10 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing /// The last which occurs before in the beatmap. /// The rate at which the gameplay clock is run at. /// The list of s in the current beatmap. - /// The position of this in the list. - public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int position) + public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects) { difficultyHitObjects = objects; - Position = position; + Position = objects.Count; BaseObject = hitObject; LastObject = lastObject; DeltaTime = (hitObject.StartTime - lastObject.StartTime) / clockRate; From 1ef711de411008ee7c1d76f538921aeafc8bc6ed Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Tue, 24 May 2022 16:40:24 +0100 Subject: [PATCH 1185/2328] Return null for out of range objects --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 2 +- .../Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index c0d5f56cb5..f599d2e32d 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects) : base(hitObject, lastObject, clockRate, objects) { - lastLastObject = Position > 1 ? (OsuHitObject)Previous(1).BaseObject : null; + lastLastObject = (OsuHitObject)Previous(1)?.BaseObject; this.lastObject = (OsuHitObject)lastObject; // Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects. diff --git a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs index 2891434e01..7e9c28f73c 100644 --- a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs +++ b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using System.Linq; using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Difficulty.Preprocessing @@ -61,8 +62,8 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing EndTime = hitObject.GetEndTime() / clockRate; } - public DifficultyHitObject Previous(int backwardsIndex) => difficultyHitObjects[Position - (backwardsIndex + 1)]; + public DifficultyHitObject Previous(int backwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Position - (backwardsIndex + 1)); - public DifficultyHitObject Next(int forwardsIndex) => difficultyHitObjects[Position + (forwardsIndex + 1)]; + public DifficultyHitObject Next(int forwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Position - (forwardsIndex + 1)); } } From bf35ded8711e0ccb439e80f7d09b3eff3aa3a085 Mon Sep 17 00:00:00 2001 From: apollo <83023433+apollo-dw@users.noreply.github.com> Date: Tue, 24 May 2022 17:06:11 +0100 Subject: [PATCH 1186/2328] Correct operation Co-authored-by: Salman Ahmed --- .../Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs index 7e9c28f73c..e067b0bb2f 100644 --- a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs +++ b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs @@ -64,6 +64,6 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing public DifficultyHitObject Previous(int backwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Position - (backwardsIndex + 1)); - public DifficultyHitObject Next(int forwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Position - (forwardsIndex + 1)); + public DifficultyHitObject Next(int forwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Position + (forwardsIndex + 1)); } } From fce527b0dfbcd056dc2b2590448ae2925c803d9e Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Tue, 24 May 2022 21:25:27 +0100 Subject: [PATCH 1187/2328] Schedule channel manager bindable events to ensure they happen after the first poll --- osu.Game/Overlays/ChatOverlayV2.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 441042432a..3aab81cb04 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -155,13 +155,15 @@ namespace osu.Game.Overlays chatHeight.BindValueChanged(height => { Height = height.NewValue; }, true); currentChannel.BindTo(channelManager.CurrentChannel); - currentChannel.BindValueChanged(currentChannelChanged, true); - joinedChannels.BindTo(channelManager.JoinedChannels); - joinedChannels.BindCollectionChanged(joinedChannelsChanged, true); - availableChannels.BindTo(channelManager.AvailableChannels); - availableChannels.BindCollectionChanged(availableChannelsChanged, true); + + Schedule(() => + { + currentChannel.BindValueChanged(currentChannelChanged, true); + joinedChannels.BindCollectionChanged(joinedChannelsChanged, true); + availableChannels.BindCollectionChanged(availableChannelsChanged, true); + }); channelList.OnRequestSelect += channel => channelManager.CurrentChannel.Value = channel; channelList.OnRequestLeave += channel => channelManager.LeaveChannel(channel); From c33aee17b002cc863ebb4826560de4257fe59ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 24 May 2022 23:14:28 +0200 Subject: [PATCH 1188/2328] Cache some more `OverlayColourProvider`s to fix tests --- .../Editor/TestSceneManiaComposeScreen.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneTimelineTickDisplay.cs | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaComposeScreen.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaComposeScreen.cs index 5dd7c23ab6..746bdae02e 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaComposeScreen.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaComposeScreen.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Database; +using osu.Game.Overlays; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Screens.Edit; @@ -45,6 +46,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor { (typeof(EditorBeatmap), editorBeatmap), (typeof(IBeatSnapProvider), editorBeatmap), + (typeof(OverlayColourProvider), new OverlayColourProvider(OverlayColourScheme.Green)), }, Child = new ComposeScreen { State = { Value = Visibility.Visible } }, }; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs b/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs index 30c8539d85..fa15c00cd4 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs @@ -9,6 +9,7 @@ using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; +using osu.Game.Overlays; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Beatmaps; @@ -47,6 +48,7 @@ namespace osu.Game.Tests.Visual.Editing { (typeof(EditorBeatmap), editorBeatmap), (typeof(IBeatSnapProvider), editorBeatmap), + (typeof(OverlayColourProvider), new OverlayColourProvider(OverlayColourScheme.Green)), }, Child = new ComposeScreen { State = { Value = Visibility.Visible } }, }; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTimelineTickDisplay.cs b/osu.Game.Tests/Visual/Editing/TestSceneTimelineTickDisplay.cs index 20e58c3d2a..b78512e469 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTimelineTickDisplay.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTimelineTickDisplay.cs @@ -4,6 +4,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Game.Overlays; using osu.Game.Screens.Edit.Compose.Components; using osuTK; @@ -14,6 +15,9 @@ namespace osu.Game.Tests.Visual.Editing { public override Drawable CreateTestComponent() => Empty(); // tick display is implicitly inside the timeline. + [Cached] + private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Green); + [BackgroundDependencyLoader] private void load() { From f6810d3f59d831e02ae1c4a42fe61001746858d8 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Tue, 24 May 2022 23:05:25 +0100 Subject: [PATCH 1189/2328] Add keyboard shortcuts to `ChatOverlayV2` with tests --- .../Visual/Online/TestSceneChatOverlayV2.cs | 72 +++++++++++++++++++ osu.Game/Overlays/ChatOverlayV2.cs | 52 +++++++++++++- 2 files changed, 122 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 7268dd31f6..0580d20171 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -12,6 +12,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Input; using osu.Framework.Logging; using osu.Framework.Testing; using osu.Framework.Utils; @@ -417,6 +418,67 @@ namespace osu.Game.Tests.Visual.Online AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); } + [Test] + public void TestKeyboardCloseAndRestoreChannel() + { + AddStep("Show overlay with channel 1", () => + { + channelManager.JoinChannel(testChannel1); + chatOverlay.Show(); + }); + AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + + AddStep("Press document close keys", () => InputManager.Keys(PlatformAction.DocumentClose)); + AddAssert("Listing is visible", () => listingIsVisible); + + AddStep("Press tab restore keys", () => InputManager.Keys(PlatformAction.TabRestore)); + AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + } + + [Test] + public void TestKeyboardNewChannel() + { + AddStep("Show overlay with channel 1", () => + { + channelManager.JoinChannel(testChannel1); + chatOverlay.Show(); + }); + AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + + AddStep("Press tab new keys", () => InputManager.Keys(PlatformAction.TabNew)); + AddAssert("Listing is visible", () => listingIsVisible); + } + + [Test] + public void TestKeyboardNextChannel() + { + Channel pmChannel1 = createPrivateChannel(); + Channel pmChannel2 = createPrivateChannel(); + + AddStep("Show overlay with channels", () => + { + channelManager.JoinChannel(testChannel1); + channelManager.JoinChannel(testChannel2); + channelManager.JoinChannel(pmChannel1); + channelManager.JoinChannel(pmChannel2); + chatOverlay.Show(); + }); + + AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + + AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext)); + AddAssert("Channel 2 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel2); + + AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext)); + AddAssert("PM Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == pmChannel1); + + AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext)); + AddAssert("PM Channel 2 displayed", () => channelIsVisible && currentDrawableChannel.Channel == pmChannel2); + + AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext)); + AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + } + private bool listingIsVisible => chatOverlay.ChildrenOfType().Single().State.Value == Visibility.Visible; @@ -467,6 +529,16 @@ namespace osu.Game.Tests.Visual.Online Type = ChannelType.Public, }; + private Channel createPrivateChannel() + { + int id = RNG.Next(0, 10000); + return new Channel(new APIUser + { + Id = id, + Username = $"test user {id}", + }); + } + private class TestChatOverlayV2 : ChatOverlayV2 { public bool SlowLoading { get; set; } diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 3aab81cb04..39717b1f31 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -13,6 +13,8 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; +using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Configuration; @@ -26,7 +28,7 @@ using osu.Game.Overlays.Chat.Listing; namespace osu.Game.Overlays { - public class ChatOverlayV2 : OsuFocusedOverlayContainer, INamedOverlayComponent + public class ChatOverlayV2 : OsuFocusedOverlayContainer, INamedOverlayComponent, IKeyBindingHandler { public string IconTexture => "Icons/Hexacons/messaging"; public LocalisableString Title => ChatStrings.HeaderTitle; @@ -197,6 +199,35 @@ namespace osu.Game.Overlays Show(); } + public bool OnPressed(KeyBindingPressEvent e) + { + switch (e.Action) + { + case PlatformAction.TabNew: + currentChannel.Value = channelList.ChannelListingChannel; + return true; + + case PlatformAction.DocumentClose: + channelManager.LeaveChannel(currentChannel.Value); + return true; + + case PlatformAction.TabRestore: + channelManager.JoinLastClosedChannel(); + return true; + + case PlatformAction.DocumentNext: + cycleChannel(); + return true; + + default: + return false; + } + } + + public void OnReleased(KeyBindingReleaseEvent e) + { + } + protected override bool OnDragStart(DragStartEvent e) { isDraggingTopBar = topBar.IsHovered; @@ -341,7 +372,7 @@ namespace osu.Game.Overlays private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs args) => channelListing.UpdateAvailableChannels(channelManager.AvailableChannels); - private IEnumerable filterChannels(IList channels) + private IEnumerable filterChannels(IEnumerable channels) => channels.Cast().Where(c => c.Type == ChannelType.Public || c.Type == ChannelType.PM); private void handleChatMessage(string message) @@ -354,5 +385,22 @@ namespace osu.Game.Overlays else channelManager.PostMessage(message); } + + private void cycleChannel() + { + List overlayChannels = filterChannels(channelManager.JoinedChannels).ToList(); + + if (overlayChannels.Count < 2) + return; + + int currentIdx = overlayChannels.IndexOf(currentChannel.Value); + int nextIdx = currentIdx + 1; + + // Cycle the list when reaching the end + if (nextIdx > overlayChannels.Count - 1) + nextIdx = 0; + + currentChannel.Value = overlayChannels[nextIdx]; + } } } From de5d2df100a58a5dcd407ab434f2512be215d400 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 12:17:11 +0900 Subject: [PATCH 1190/2328] Move UI scale setup to the beginning of the first run setup --- .../Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs | 4 ++-- osu.Game/Overlays/FirstRunSetupOverlay.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index 48b5690243..d09efdc925 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -185,7 +185,7 @@ namespace osu.Game.Tests.Visual.UserInterface { AddStep("step to next", () => overlay.NextButton.TriggerClick()); - AddAssert("is at known screen", () => overlay.CurrentScreen is ScreenBeatmaps); + AddAssert("is at known screen", () => overlay.CurrentScreen is ScreenUIScale); AddStep("hide", () => overlay.Hide()); AddAssert("overlay hidden", () => overlay.State.Value == Visibility.Hidden); @@ -195,7 +195,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("run notification action", () => lastNotification.Activated()); AddAssert("overlay shown", () => overlay.State.Value == Visibility.Visible); - AddAssert("is resumed", () => overlay.CurrentScreen is ScreenBeatmaps); + AddAssert("is resumed", () => overlay.CurrentScreen is ScreenUIScale); } // interface mocks break hot reload, mocking this stub implementation instead works around it. diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index 7b0de4affe..a5bece0832 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -76,10 +76,10 @@ namespace osu.Game.Overlays private void load(OsuColour colours, LegacyImportManager? legacyImportManager) { steps.Add(typeof(ScreenWelcome)); + steps.Add(typeof(ScreenUIScale)); steps.Add(typeof(ScreenBeatmaps)); if (legacyImportManager?.SupportsImportFromStable == true) steps.Add(typeof(ScreenImportFromStable)); - steps.Add(typeof(ScreenUIScale)); steps.Add(typeof(ScreenBehaviour)); Header.Title = FirstRunSetupOverlayStrings.FirstRunSetupTitle; From 87959a59d980286daf6c082ef3edda8494e94bf6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 18:28:29 +0900 Subject: [PATCH 1191/2328] Add missing "announce" channel type Of note, this doesn't mean the channels will display, but it does fix parsing errors which cause the whole chat display to fail. --- osu.Game/Online/Chat/ChannelType.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Online/Chat/ChannelType.cs b/osu.Game/Online/Chat/ChannelType.cs index 151efc4645..bd628e90c4 100644 --- a/osu.Game/Online/Chat/ChannelType.cs +++ b/osu.Game/Online/Chat/ChannelType.cs @@ -13,5 +13,6 @@ namespace osu.Game.Online.Chat PM, Group, System, + Announce, } } From a92089c443b9cd256f145aef6711b76bd4e18579 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 18:42:33 +0900 Subject: [PATCH 1192/2328] Change filter method to consider all non-system channels as joinable --- osu.Game/Overlays/ChatOverlayV2.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 39717b1f31..a23595e1c0 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -342,7 +342,7 @@ namespace osu.Game.Overlays switch (args.Action) { case NotifyCollectionChangedAction.Add: - IEnumerable newChannels = filterChannels(args.NewItems); + IEnumerable newChannels = filterToChatChannels(args.NewItems); foreach (var channel in newChannels) channelList.AddChannel(channel); @@ -350,7 +350,7 @@ namespace osu.Game.Overlays break; case NotifyCollectionChangedAction.Remove: - IEnumerable leftChannels = filterChannels(args.OldItems); + IEnumerable leftChannels = filterToChatChannels(args.OldItems); foreach (var channel in leftChannels) { @@ -372,8 +372,6 @@ namespace osu.Game.Overlays private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs args) => channelListing.UpdateAvailableChannels(channelManager.AvailableChannels); - private IEnumerable filterChannels(IEnumerable channels) - => channels.Cast().Where(c => c.Type == ChannelType.Public || c.Type == ChannelType.PM); private void handleChatMessage(string message) { @@ -402,5 +400,7 @@ namespace osu.Game.Overlays currentChannel.Value = overlayChannels[nextIdx]; } + + private IEnumerable filterToChatChannels(IEnumerable channels) => channels.Cast().Where(c => c.Type != ChannelType.System); } } From 49ab031e75f0398ed321b0664d68acee9aba5b31 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 18:42:49 +0900 Subject: [PATCH 1193/2328] Allow traversing in both directions using ctrl-tab shortcuts --- osu.Game/Overlays/ChatOverlayV2.cs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index a23595e1c0..d0355e0165 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -215,8 +215,12 @@ namespace osu.Game.Overlays channelManager.JoinLastClosedChannel(); return true; + case PlatformAction.DocumentPrevious: + cycleChannel(-1); + return true; + case PlatformAction.DocumentNext: - cycleChannel(); + cycleChannel(1); return true; default: @@ -372,7 +376,6 @@ namespace osu.Game.Overlays private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs args) => channelListing.UpdateAvailableChannels(channelManager.AvailableChannels); - private void handleChatMessage(string message) { if (string.IsNullOrWhiteSpace(message)) @@ -384,21 +387,16 @@ namespace osu.Game.Overlays channelManager.PostMessage(message); } - private void cycleChannel() + private void cycleChannel(int direction) { - List overlayChannels = filterChannels(channelManager.JoinedChannels).ToList(); + List overlayChannels = filterToChatChannels(channelManager.JoinedChannels).ToList(); if (overlayChannels.Count < 2) return; - int currentIdx = overlayChannels.IndexOf(currentChannel.Value); - int nextIdx = currentIdx + 1; + int currentIndex = overlayChannels.IndexOf(currentChannel.Value); - // Cycle the list when reaching the end - if (nextIdx > overlayChannels.Count - 1) - nextIdx = 0; - - currentChannel.Value = overlayChannels[nextIdx]; + currentChannel.Value = overlayChannels[(currentIndex + direction + overlayChannels.Count) % overlayChannels.Count]; } private IEnumerable filterToChatChannels(IEnumerable channels) => channels.Cast().Where(c => c.Type != ChannelType.System); From f1d4902be524cbd65a73c8298739ba36f1990ef4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 19:25:23 +0900 Subject: [PATCH 1194/2328] Remove unnecessary bindable cast --- osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index 0830ba8cf4..c80d3c4261 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -47,7 +47,7 @@ namespace osu.Game.Screens.Edit.Timing private double selectedGroupStartTime; private double selectedGroupEndTime; - private readonly BindableList controlPointGroups = new BindableList(); + private readonly IBindableList controlPointGroups = new BindableList(); public WaveformComparisonDisplay() { @@ -83,7 +83,7 @@ namespace osu.Game.Screens.Edit.Timing selectedGroup.BindValueChanged(_ => updateTimingGroup(), true); - ((IBindableList)controlPointGroups).BindTo(editorBeatmap.ControlPointInfo.Groups); + controlPointGroups.BindTo(editorBeatmap.ControlPointInfo.Groups); controlPointGroups.BindCollectionChanged((_, __) => updateTimingGroup()); beatLength.BindValueChanged(_ => showFrom(lastDisplayedBeatIndex), true); From 795c9fcbc9cfa9345d9ed1cbde3a8e9fc4a7606d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 19:38:50 +0900 Subject: [PATCH 1195/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index aaea784852..d5a77c6349 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5bc65ca507..32a0adb859 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 3597e7e5c0..112b5b4615 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 4a36f3aa4c5f7c6af19627ed38ccc48dc353a39f Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 25 May 2022 12:29:04 +0100 Subject: [PATCH 1196/2328] Ensure channel traversal shortcut is using visual order --- osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 7 +++++++ osu.Game/Overlays/ChatOverlayV2.cs | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index d1ceae604c..f212f5b162 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -4,6 +4,7 @@ #nullable enable using System; +using System.Linq; using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -22,6 +23,8 @@ namespace osu.Game.Overlays.Chat.ChannelList public Action? OnRequestSelect; public Action? OnRequestLeave; + public IEnumerable Channels => publicChannelFlow.Channels.Concat(privateChannelFlow.Channels); + public readonly ChannelListing.ChannelListingChannel ChannelListingChannel = new ChannelListing.ChannelListingChannel(); private readonly Dictionary channelMap = new Dictionary(); @@ -118,6 +121,10 @@ namespace osu.Game.Overlays.Chat.ChannelList private class ChannelListItemFlow : FillFlowContainer { + public IEnumerable Channels => Children.Where(c => c is ChannelListItem) + .Cast() + .Select(c => c.Channel); + public ChannelListItemFlow(string label) { Direction = FillDirection.Vertical; diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index d0355e0165..cc780073ce 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -389,7 +389,7 @@ namespace osu.Game.Overlays private void cycleChannel(int direction) { - List overlayChannels = filterToChatChannels(channelManager.JoinedChannels).ToList(); + List overlayChannels = channelList.Channels.ToList(); if (overlayChannels.Count < 2) return; @@ -399,6 +399,7 @@ namespace osu.Game.Overlays currentChannel.Value = overlayChannels[(currentIndex + direction + overlayChannels.Count) % overlayChannels.Count]; } - private IEnumerable filterToChatChannels(IEnumerable channels) => channels.Cast().Where(c => c.Type != ChannelType.System); + private IEnumerable filterToChatChannels(IEnumerable channels) + => channels.Cast().Where(c => c.Type == ChannelType.PM || c.Type == ChannelType.Public); } } From cd90d2931534bf8210fedfc6a4c2efbb5863d05a Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 25 May 2022 12:37:28 +0100 Subject: [PATCH 1197/2328] Ensure channel traversal shortcut scrolls channel list item into view --- osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 5 ++++- osu.Game/Overlays/ChatOverlayV2.cs | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index f212f5b162..2798841925 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -29,6 +29,7 @@ namespace osu.Game.Overlays.Chat.ChannelList private readonly Dictionary channelMap = new Dictionary(); + private OsuScrollContainer scroll = null!; private ChannelListItemFlow publicChannelFlow = null!; private ChannelListItemFlow privateChannelFlow = null!; private ChannelListItem selector = null!; @@ -43,7 +44,7 @@ namespace osu.Game.Overlays.Chat.ChannelList RelativeSizeAxes = Axes.Both, Colour = colourProvider.Background6, }, - new OsuScrollContainer + scroll = new OsuScrollContainer { Padding = new MarginPadding { Vertical = 7 }, RelativeSizeAxes = Axes.Both, @@ -104,6 +105,8 @@ namespace osu.Game.Overlays.Chat.ChannelList return channelMap[channel]; } + public void ScrollChannelIntoView(Channel channel) => scroll.ScrollIntoView(this.GetItem(channel)); + private ChannelListItemFlow getFlowForChannel(Channel channel) { switch (channel.Type) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index cc780073ce..ad7a856dbc 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -397,6 +397,8 @@ namespace osu.Game.Overlays int currentIndex = overlayChannels.IndexOf(currentChannel.Value); currentChannel.Value = overlayChannels[(currentIndex + direction + overlayChannels.Count) % overlayChannels.Count]; + + channelList.ScrollChannelIntoView(currentChannel.Value); } private IEnumerable filterToChatChannels(IEnumerable channels) From c4cae7f677968a72a4363ce9970f00b7891b9c2b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 22:19:24 +0900 Subject: [PATCH 1198/2328] Update `EditorMenuBar` to match new design language --- .../Edit/Components/Menus/EditorMenuBar.cs | 107 +++++++----------- 1 file changed, 44 insertions(+), 63 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs index 2a8435ff47..440071bc4c 100644 --- a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs +++ b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs @@ -2,16 +2,13 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; using osuTK; -using osuTK.Graphics; namespace osu.Game.Screens.Edit.Components.Menus { @@ -24,7 +21,12 @@ namespace osu.Game.Screens.Edit.Components.Menus MaskingContainer.CornerRadius = 0; ItemsContainer.Padding = new MarginPadding { Left = 100 }; - BackgroundColour = Color4Extensions.FromHex("111"); + } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + BackgroundColour = colourProvider.Background3; } protected override Framework.Graphics.UserInterface.Menu CreateSubMenu() => new SubMenu(); @@ -33,29 +35,26 @@ namespace osu.Game.Screens.Edit.Components.Menus private class DrawableEditorBarMenuItem : DrawableOsuMenuItem { - private BackgroundBox background; - public DrawableEditorBarMenuItem(MenuItem item) : base(item) { - Anchor = Anchor.CentreLeft; - Origin = Anchor.CentreLeft; - - StateChanged += stateChanged; } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { - ForegroundColour = colours.BlueLight; - BackgroundColour = Color4.Transparent; - ForegroundColourHover = Color4.White; - BackgroundColourHover = colours.Gray3; + ForegroundColour = colourProvider.Light3; + BackgroundColour = colourProvider.Background2; + ForegroundColourHover = colourProvider.Content1; + BackgroundColourHover = colourProvider.Background1; } - public override void SetFlowDirection(Direction direction) + protected override void LoadComplete() { - AutoSizeAxes = Axes.Both; + base.LoadComplete(); + + Foreground.Anchor = Anchor.CentreLeft; + Foreground.Origin = Anchor.CentreLeft; } protected override void UpdateBackgroundColour() @@ -74,54 +73,16 @@ namespace osu.Game.Screens.Edit.Components.Menus base.UpdateForegroundColour(); } - private void stateChanged(MenuItemState newState) - { - if (newState == MenuItemState.Selected) - background.Expand(); - else - background.Contract(); - } - - protected override Drawable CreateBackground() => background = new BackgroundBox(); protected override DrawableOsuMenuItem.TextContainer CreateTextContainer() => new TextContainer(); private new class TextContainer : DrawableOsuMenuItem.TextContainer { public TextContainer() { - NormalText.Font = NormalText.Font.With(size: 14); - BoldText.Font = BoldText.Font.With(size: 14); - NormalText.Margin = BoldText.Margin = new MarginPadding { Horizontal = 10, Vertical = MARGIN_VERTICAL }; + NormalText.Font = OsuFont.TorusAlternate; + BoldText.Font = OsuFont.TorusAlternate.With(weight: FontWeight.Bold); } } - - private class BackgroundBox : CompositeDrawable - { - private readonly Container innerBackground; - - public BackgroundBox() - { - RelativeSizeAxes = Axes.Both; - Masking = true; - InternalChild = innerBackground = new Container - { - RelativeSizeAxes = Axes.Both, - Masking = true, - CornerRadius = 4, - Child = new Box { RelativeSizeAxes = Axes.Both } - }; - } - - /// - /// Expands the background such that it doesn't show the bottom corners. - /// - public void Expand() => innerBackground.Height = 2; - - /// - /// Contracts the background such that it shows the bottom corners. - /// - public void Contract() => innerBackground.Height = 1; - } } private class SubMenu : OsuMenu @@ -129,14 +90,15 @@ namespace osu.Game.Screens.Edit.Components.Menus public SubMenu() : base(Direction.Vertical) { - OriginPosition = new Vector2(5, 1); - ItemsContainer.Padding = new MarginPadding { Top = 5, Bottom = 5 }; + ItemsContainer.Padding = new MarginPadding(); + + MaskingContainer.CornerRadius = 0; } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { - BackgroundColour = colours.Gray3; + BackgroundColour = colourProvider.Background2; } protected override Framework.Graphics.UserInterface.Menu CreateSubMenu() => new SubMenu(); @@ -147,9 +109,27 @@ namespace osu.Game.Screens.Edit.Components.Menus { case EditorMenuItemSpacer spacer: return new DrawableSpacer(spacer); + + default: + return new EditorMenuItem(item); + } + } + + private class EditorMenuItem : DrawableOsuMenuItem + { + public EditorMenuItem(MenuItem item) + : base(item) + { } - return base.CreateDrawableMenuItem(item); + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + BackgroundColour = colourProvider.Background2; + BackgroundColourHover = colourProvider.Background1; + + Foreground.Padding = new MarginPadding { Vertical = 2 }; + } } private class DrawableSpacer : DrawableOsuMenuItem @@ -157,6 +137,7 @@ namespace osu.Game.Screens.Edit.Components.Menus public DrawableSpacer(MenuItem item) : base(item) { + Scale = new Vector2(1, 0.3f); } protected override bool OnHover(HoverEvent e) => true; From 206f2ca208fafa01fbfbf616077027ba8360dc41 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 22:20:33 +0900 Subject: [PATCH 1199/2328] Rename screen switcher control to be in line with naming expectations --- ...nSelectionTabControl.cs => EditorScreenSwitcherControl.cs} | 4 ++-- osu.Game/Screens/Edit/Editor.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename osu.Game/Screens/Edit/Components/Menus/{ScreenSelectionTabControl.cs => EditorScreenSwitcherControl.cs} (94%) diff --git a/osu.Game/Screens/Edit/Components/Menus/ScreenSelectionTabControl.cs b/osu.Game/Screens/Edit/Components/Menus/EditorScreenSwitcherControl.cs similarity index 94% rename from osu.Game/Screens/Edit/Components/Menus/ScreenSelectionTabControl.cs rename to osu.Game/Screens/Edit/Components/Menus/EditorScreenSwitcherControl.cs index b8bc5cdf36..28a8efcdd2 100644 --- a/osu.Game/Screens/Edit/Components/Menus/ScreenSelectionTabControl.cs +++ b/osu.Game/Screens/Edit/Components/Menus/EditorScreenSwitcherControl.cs @@ -13,9 +13,9 @@ using osuTK.Graphics; namespace osu.Game.Screens.Edit.Components.Menus { - public class ScreenSelectionTabControl : OsuTabControl + public class EditorScreenSwitcherControl : OsuTabControl { - public ScreenSelectionTabControl() + public EditorScreenSwitcherControl() { AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 7e7764397c..bdf204c1b6 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -278,7 +278,7 @@ namespace osu.Game.Screens.Edit } } }, - new ScreenSelectionTabControl + new EditorScreenSwitcherControl { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, From 463b8130c8351e14d7c7295e54b0ea886739beee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 22:31:27 +0900 Subject: [PATCH 1200/2328] Update editor screen switcher to match new design language --- .../Menus/EditorScreenSwitcherControl.cs | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/Menus/EditorScreenSwitcherControl.cs b/osu.Game/Screens/Edit/Components/Menus/EditorScreenSwitcherControl.cs index 28a8efcdd2..8b868a4649 100644 --- a/osu.Game/Screens/Edit/Components/Menus/EditorScreenSwitcherControl.cs +++ b/osu.Game/Screens/Edit/Components/Menus/EditorScreenSwitcherControl.cs @@ -2,14 +2,13 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; using osuTK; -using osuTK.Graphics; namespace osu.Game.Screens.Edit.Components.Menus { @@ -22,22 +21,19 @@ namespace osu.Game.Screens.Edit.Components.Menus TabContainer.RelativeSizeAxes &= ~Axes.X; TabContainer.AutoSizeAxes = Axes.X; - TabContainer.Padding = new MarginPadding(); - - AddInternal(new Box - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - Height = 1, - Colour = Color4.White.Opacity(0.2f), - }); + TabContainer.Padding = new MarginPadding(10); } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { - AccentColour = colours.Yellow; + AccentColour = colourProvider.Light3; + + AddInternal(new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Background2, + }); } protected override Dropdown CreateDropdown() => null; @@ -54,6 +50,15 @@ namespace osu.Game.Screens.Edit.Components.Menus Text.Margin = new MarginPadding(); Text.Anchor = Anchor.CentreLeft; Text.Origin = Anchor.CentreLeft; + + Text.Font = OsuFont.TorusAlternate; + + Bar.Expire(); + } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { } protected override void OnActivated() From 91834f03190bfe66303975a54c3c07fbfb415b6a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 22:56:47 +0900 Subject: [PATCH 1201/2328] Fix missing colour dependency in menu bar test scene --- osu.Game.Tests/Visual/Editing/TestSceneEditorMenuBar.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorMenuBar.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorMenuBar.cs index 3cb44d9ae8..ad6fc55a32 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorMenuBar.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorMenuBar.cs @@ -2,10 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; using osu.Game.Screens.Edit.Components.Menus; namespace osu.Game.Tests.Visual.Editing @@ -13,6 +15,9 @@ namespace osu.Game.Tests.Visual.Editing [TestFixture] public class TestSceneEditorMenuBar : OsuTestScene { + [Cached] + private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Aquamarine); + public TestSceneEditorMenuBar() { Add(new Container From c0da05dda0454690d11d3d5536d322c80cced4c6 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 25 May 2022 15:15:26 +0100 Subject: [PATCH 1202/2328] Use an array of channels to exclude from the overlay --- osu.Game/Overlays/ChatOverlayV2.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index ad7a856dbc..9ca4d9cb6c 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -56,6 +56,13 @@ namespace osu.Game.Overlays private const float side_bar_width = 190; private const float chat_bar_height = 60; + private readonly ChannelType[] excluded_channel_types = new[] + { + ChannelType.Multiplayer, + ChannelType.Spectator, + ChannelType.Temporary, + }; + [Resolved] private OsuConfigManager config { get; set; } = null!; @@ -402,6 +409,6 @@ namespace osu.Game.Overlays } private IEnumerable filterToChatChannels(IEnumerable channels) - => channels.Cast().Where(c => c.Type == ChannelType.PM || c.Type == ChannelType.Public); + => channels.Cast().Where(c => !excluded_channel_types.Contains(c.Type)); } } From 997fc716e8609d84e157cf602e468699dff4d04b Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 25 May 2022 15:15:46 +0100 Subject: [PATCH 1203/2328] Split out the channel list labels from the channel list item flow --- .../Overlays/Chat/ChannelList/ChannelList.cs | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 2798841925..21b2251aca 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -57,12 +57,14 @@ namespace osu.Game.Overlays.Chat.ChannelList AutoSizeAxes = Axes.Y, Children = new Drawable[] { - publicChannelFlow = new ChannelListItemFlow("CHANNELS"), + new ChannelListLabel("CHANNELS"), + publicChannelFlow = new ChannelListItemFlow(), selector = new ChannelListItem(ChannelListingChannel) { Margin = new MarginPadding { Bottom = 10 }, }, - privateChannelFlow = new ChannelListItemFlow("DIRECT MESSAGES"), + new ChannelListLabel("DIRECT MESSAGES"), + privateChannelFlow = new ChannelListItemFlow(), }, }, }, @@ -105,7 +107,7 @@ namespace osu.Game.Overlays.Chat.ChannelList return channelMap[channel]; } - public void ScrollChannelIntoView(Channel channel) => scroll.ScrollIntoView(this.GetItem(channel)); + public void ScrollChannelIntoView(Channel channel) => scroll.ScrollIntoView(GetItem(channel)); private ChannelListItemFlow getFlowForChannel(Channel channel) { @@ -118,28 +120,29 @@ namespace osu.Game.Overlays.Chat.ChannelList return privateChannelFlow; default: - throw new ArgumentOutOfRangeException(); + return publicChannelFlow; } } - private class ChannelListItemFlow : FillFlowContainer + private class ChannelListLabel : OsuSpriteText { - public IEnumerable Channels => Children.Where(c => c is ChannelListItem) - .Cast() - .Select(c => c.Channel); + public ChannelListLabel(string label) + { + Text = label; + Margin = new MarginPadding { Left = 18, Bottom = 5 }; + Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold); + } + } - public ChannelListItemFlow(string label) + private class ChannelListItemFlow : FillFlowContainer + { + public IEnumerable Channels => Children.Select(c => c.Channel); + + public ChannelListItemFlow() { Direction = FillDirection.Vertical; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - - Add(new OsuSpriteText - { - Text = label, - Margin = new MarginPadding { Left = 18, Bottom = 5 }, - Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold), - }); } } } From 8791e3b9ef37071dae3f1e44a56060e889f3f7d1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 23:10:58 +0900 Subject: [PATCH 1204/2328] Split `BottomBar` out of `Editor` --- osu.Game/Screens/Edit/BottomBar.cs | 83 +++++++++++++++++++++ osu.Game/Screens/Edit/Editor.cs | 113 ++++++----------------------- 2 files changed, 107 insertions(+), 89 deletions(-) create mode 100644 osu.Game/Screens/Edit/BottomBar.cs diff --git a/osu.Game/Screens/Edit/BottomBar.cs b/osu.Game/Screens/Edit/BottomBar.cs new file mode 100644 index 0000000000..e48d54e811 --- /dev/null +++ b/osu.Game/Screens/Edit/BottomBar.cs @@ -0,0 +1,83 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Overlays; +using osu.Game.Screens.Edit.Components; +using osu.Game.Screens.Edit.Components.Timelines.Summary; +using osuTK; + +namespace osu.Game.Screens.Edit +{ + internal class BottomBar : CompositeDrawable + { + public TestGameplayButton TestGameplayButton { get; private set; } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider, Editor editor) + { + Anchor = Anchor.BottomLeft; + Origin = Anchor.BottomLeft; + + RelativeSizeAxes = Axes.X; + + Height = 60; + + InternalChildren = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Background4, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Child = new GridContainer + { + RelativeSizeAxes = Axes.Both, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, 220), + new Dimension(), + new Dimension(GridSizeMode.Absolute, 220), + new Dimension(GridSizeMode.Absolute, 120), + }, + Content = new[] + { + new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Right = 10 }, + Child = new TimeInfoContainer { RelativeSizeAxes = Axes.Both }, + }, + new SummaryTimeline + { + RelativeSizeAxes = Axes.Both, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = 10 }, + Child = new PlaybackControl { RelativeSizeAxes = Axes.Both }, + }, + TestGameplayButton = new TestGameplayButton + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = 10 }, + Size = new Vector2(1), + Action = editor.TestGameplay, + } + }, + } + }, + } + }; + } + } +} diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 7e7764397c..4281b49e76 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -12,7 +12,6 @@ using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Framework.Input.Bindings; @@ -26,7 +25,6 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Configuration; using osu.Game.Database; -using osu.Game.Graphics; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; @@ -37,9 +35,7 @@ using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; -using osu.Game.Screens.Edit.Components; using osu.Game.Screens.Edit.Components.Menus; -using osu.Game.Screens.Edit.Components.Timelines.Summary; using osu.Game.Screens.Edit.Compose; using osu.Game.Screens.Edit.Design; using osu.Game.Screens.Edit.GameplayTest; @@ -48,7 +44,6 @@ using osu.Game.Screens.Edit.Timing; using osu.Game.Screens.Edit.Verify; using osu.Game.Screens.Play; using osu.Game.Users; -using osuTK; using osuTK.Graphics; using osuTK.Input; @@ -119,13 +114,13 @@ namespace osu.Game.Screens.Edit private IBeatmap playableBeatmap; private EditorBeatmap editorBeatmap; + private BottomBar bottomBar; + [CanBeNull] // Should be non-null once it can support custom rulesets. private EditorChangeHandler changeHandler; private DependencyContainer dependencies; - private TestGameplayButton testGameplayButton; - private bool isNewBeatmap; protected override UserActivity InitialActivity => new UserActivity.Editing(Beatmap.Value.BeatmapInfo); @@ -148,7 +143,7 @@ namespace osu.Game.Screens.Edit } [BackgroundDependencyLoader] - private void load(OsuColour colours, OsuConfigManager config) + private void load(OsuConfigManager config) { var loadableBeatmap = Beatmap.Value; @@ -226,7 +221,7 @@ namespace osu.Game.Screens.Edit AddInternal(new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, - Children = new[] + Children = new Drawable[] { new Container { @@ -287,67 +282,7 @@ namespace osu.Game.Screens.Edit }, }, }, - new Container - { - Name = "Bottom bar", - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - Height = 60, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = colours.Gray2 - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Vertical = 5, Horizontal = 10 }, - Child = new GridContainer - { - RelativeSizeAxes = Axes.Both, - ColumnDimensions = new[] - { - new Dimension(GridSizeMode.Absolute, 220), - new Dimension(), - new Dimension(GridSizeMode.Absolute, 220), - new Dimension(GridSizeMode.Absolute, 120), - }, - Content = new[] - { - new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Right = 10 }, - Child = new TimeInfoContainer { RelativeSizeAxes = Axes.Both }, - }, - new SummaryTimeline - { - RelativeSizeAxes = Axes.Both, - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = 10 }, - Child = new PlaybackControl { RelativeSizeAxes = Axes.Both }, - }, - testGameplayButton = new TestGameplayButton - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = 10 }, - Size = new Vector2(1), - Action = testGameplay - } - }, - } - }, - } - } - }, + bottomBar = new BottomBar(), } }); @@ -392,6 +327,24 @@ namespace osu.Game.Screens.Edit Clipboard.Content.Value = state.ClipboardContent; }); + public void TestGameplay() + { + if (HasUnsavedChanges) + { + dialogOverlay.Push(new SaveBeforeGameplayTestDialog(() => + { + Save(); + pushEditorPlayer(); + })); + } + else + { + pushEditorPlayer(); + } + + void pushEditorPlayer() => this.Push(new EditorPlayerLoader(this)); + } + /// /// Saves the currently edited beatmap. /// @@ -589,7 +542,7 @@ namespace osu.Game.Screens.Edit return true; case GlobalAction.EditorTestGameplay: - testGameplayButton.TriggerClick(); + bottomBar.TestGameplayButton.TriggerClick(); return true; default: @@ -935,24 +888,6 @@ namespace osu.Game.Screens.Edit loader?.CancelPendingDifficultySwitch(); } - private void testGameplay() - { - if (HasUnsavedChanges) - { - dialogOverlay.Push(new SaveBeforeGameplayTestDialog(() => - { - Save(); - pushEditorPlayer(); - })); - } - else - { - pushEditorPlayer(); - } - - void pushEditorPlayer() => this.Push(new EditorPlayerLoader(this)); - } - public double SnapTime(double time, double? referenceTime) => editorBeatmap.SnapTime(time, referenceTime); public double GetBeatLengthAtTime(double referenceTime) => editorBeatmap.GetBeatLengthAtTime(referenceTime); From 2c61a9d3d1b4cf1035d3a087c283ac086c2682a4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 23:17:52 +0900 Subject: [PATCH 1205/2328] Update bottom bar components to new design language (mostly) --- osu.Game/Screens/Edit/BottomBar.cs | 19 +++---------------- .../Edit/Components/BottomBarContainer.cs | 16 ++++++++-------- .../Edit/Components/PlaybackControl.cs | 7 ++++--- .../Edit/Components/TimeInfoContainer.cs | 8 ++++++-- .../Timelines/Summary/SummaryTimeline.cs | 10 ++++++---- .../Timelines/Summary/TestGameplayButton.cs | 2 ++ 6 files changed, 29 insertions(+), 33 deletions(-) diff --git a/osu.Game/Screens/Edit/BottomBar.cs b/osu.Game/Screens/Edit/BottomBar.cs index e48d54e811..0f857940b3 100644 --- a/osu.Game/Screens/Edit/BottomBar.cs +++ b/osu.Game/Screens/Edit/BottomBar.cs @@ -50,22 +50,9 @@ namespace osu.Game.Screens.Edit { new Drawable[] { - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Right = 10 }, - Child = new TimeInfoContainer { RelativeSizeAxes = Axes.Both }, - }, - new SummaryTimeline - { - RelativeSizeAxes = Axes.Both, - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = 10 }, - Child = new PlaybackControl { RelativeSizeAxes = Axes.Both }, - }, + new TimeInfoContainer { RelativeSizeAxes = Axes.Both }, + new SummaryTimeline { RelativeSizeAxes = Axes.Both }, + new PlaybackControl { RelativeSizeAxes = Axes.Both }, TestGameplayButton = new TestGameplayButton { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Screens/Edit/Components/BottomBarContainer.cs b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs index 08091fc3f7..3c63da3a4a 100644 --- a/osu.Game/Screens/Edit/Components/BottomBarContainer.cs +++ b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs @@ -8,20 +8,19 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; -using osu.Game.Graphics; +using osuTK.Graphics; namespace osu.Game.Screens.Edit.Components { public class BottomBarContainer : Container { - private const float corner_radius = 5; private const float contents_padding = 15; protected readonly IBindable Beatmap = new Bindable(); protected readonly IBindable Track = new Bindable(); - private readonly Drawable background; + protected readonly Drawable Background; private readonly Container content; protected override Container Content => content; @@ -29,11 +28,14 @@ namespace osu.Game.Screens.Edit.Components public BottomBarContainer() { Masking = true; - CornerRadius = corner_radius; InternalChildren = new[] { - background = new Box { RelativeSizeAxes = Axes.Both }, + Background = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Transparent, + }, content = new Container { RelativeSizeAxes = Axes.Both, @@ -43,12 +45,10 @@ namespace osu.Game.Screens.Edit.Components } [BackgroundDependencyLoader] - private void load(IBindable beatmap, OsuColour colours, EditorClock clock) + private void load(IBindable beatmap, EditorClock clock) { Beatmap.BindTo(beatmap); Track.BindTo(clock.Track); - - background.Colour = colours.Gray1; } } } diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index bdc6e238c8..d1a999c2d1 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -16,6 +16,7 @@ using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; using osuTK.Input; namespace osu.Game.Screens.Edit.Components @@ -155,10 +156,10 @@ namespace osu.Game.Screens.Edit.Components private Color4 normalColour; [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { - text.Colour = normalColour = colours.YellowDarker; - textBold.Colour = hoveredColour = colours.Yellow; + text.Colour = normalColour = colourProvider.Light3; + textBold.Colour = hoveredColour = colourProvider.Content1; } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs index 0a8c339559..ac79a8ce7e 100644 --- a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs +++ b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs @@ -6,18 +6,22 @@ using osu.Game.Graphics.Sprites; using osu.Framework.Allocation; using osu.Game.Extensions; using osu.Game.Graphics; +using osu.Game.Overlays; namespace osu.Game.Screens.Edit.Components { public class TimeInfoContainer : BottomBarContainer { - private readonly OsuSpriteText trackTimer; + private OsuSpriteText trackTimer; [Resolved] private EditorClock editorClock { get; set; } - public TimeInfoContainer() + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) { + Background.Colour = colourProvider.Background5; + Children = new Drawable[] { trackTimer = new OsuSpriteText diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs index e90ae411de..1706c47c96 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs @@ -1,13 +1,13 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osuTK; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; +using osu.Game.Overlays; using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts; +using osuTK; namespace osu.Game.Screens.Edit.Components.Timelines.Summary { @@ -17,8 +17,10 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary public class SummaryTimeline : BottomBarContainer { [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { + Background.Colour = colourProvider.Background6; + Children = new Drawable[] { new MarkerPart { RelativeSizeAxes = Axes.Both }, @@ -41,7 +43,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary { Name = "centre line", RelativeSizeAxes = Axes.Both, - Colour = colours.Gray5, + Colour = colourProvider.Background2, Children = new Drawable[] { new Circle diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/TestGameplayButton.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/TestGameplayButton.cs index 0d7a4ad057..99cdc014aa 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/TestGameplayButton.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/TestGameplayButton.cs @@ -28,6 +28,8 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary BackgroundColour = colours.Orange1; SpriteText.Colour = colourProvider.Background6; + Content.CornerRadius = 0; + Text = "Test!"; } } From acd554d91820fa861612c9978d80bbbf2ad6c42c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 23:30:53 +0900 Subject: [PATCH 1206/2328] Update time info and add bpm --- .../Editing/TestScenePlaybackControl.cs | 2 +- .../Edit/Components/TimeInfoContainer.cs | 23 +++++++++++++++---- osu.Game/Tests/Visual/EditorClockTestScene.cs | 9 +++++++- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestScenePlaybackControl.cs b/osu.Game.Tests/Visual/Editing/TestScenePlaybackControl.cs index 6aa884a197..bf0a7876a9 100644 --- a/osu.Game.Tests/Visual/Editing/TestScenePlaybackControl.cs +++ b/osu.Game.Tests/Visual/Editing/TestScenePlaybackControl.cs @@ -12,7 +12,7 @@ using osuTK; namespace osu.Game.Tests.Visual.Editing { [TestFixture] - public class TestScenePlaybackControl : OsuTestScene + public class TestScenePlaybackControl : EditorClockTestScene { [BackgroundDependencyLoader] private void load() diff --git a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs index ac79a8ce7e..6024716f4b 100644 --- a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs +++ b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs @@ -7,18 +7,23 @@ using osu.Framework.Allocation; using osu.Game.Extensions; using osu.Game.Graphics; using osu.Game.Overlays; +using osuTK; namespace osu.Game.Screens.Edit.Components { public class TimeInfoContainer : BottomBarContainer { private OsuSpriteText trackTimer; + private OsuSpriteText bpm; + + [Resolved] + private EditorBeatmap editorBeatmap { get; set; } [Resolved] private EditorClock editorClock { get; set; } [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) + private void load(OsuColour colours, OverlayColourProvider colourProvider) { Background.Colour = colourProvider.Background5; @@ -28,10 +33,16 @@ namespace osu.Game.Screens.Edit.Components { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - // intentionally fudged centre to avoid movement of the number portion when - // going negative. - X = -35, - Font = OsuFont.GetFont(size: 25, fixedWidth: true), + Spacing = new Vector2(-2, 0), + Font = OsuFont.Torus.With(size: 36, fixedWidth: true, weight: FontWeight.Light), + Y = -10, + }, + bpm = new OsuSpriteText + { + Colour = colours.Orange1, + Anchor = Anchor.CentreRight, + Font = OsuFont.Torus.With(size: 18, weight: FontWeight.SemiBold), + Y = 5, } }; } @@ -40,6 +51,8 @@ namespace osu.Game.Screens.Edit.Components { base.Update(); trackTimer.Text = editorClock.CurrentTime.ToEditorFormattedString(); + bpm.Text = @$"{editorBeatmap.ControlPointInfo.TimingPointAt(editorClock.CurrentTime).BPM:0} BPM"; + bpm.X = 5 - trackTimer.DrawWidth; } } } diff --git a/osu.Game/Tests/Visual/EditorClockTestScene.cs b/osu.Game/Tests/Visual/EditorClockTestScene.cs index 542f06f86b..93dfe58076 100644 --- a/osu.Game/Tests/Visual/EditorClockTestScene.cs +++ b/osu.Game/Tests/Visual/EditorClockTestScene.cs @@ -6,6 +6,7 @@ using osu.Framework.Bindables; using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Overlays; +using osu.Game.Rulesets.Edit; using osu.Game.Screens.Edit; namespace osu.Game.Tests.Visual @@ -19,6 +20,10 @@ namespace osu.Game.Tests.Visual [Cached] private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Aquamarine); + [Cached(typeof(EditorBeatmap))] + [Cached(typeof(IBeatSnapProvider))] + private readonly EditorBeatmap editorBeatmap; + protected readonly BindableBeatDivisor BeatDivisor = new BindableBeatDivisor(); protected new readonly EditorClock Clock; @@ -26,7 +31,9 @@ namespace osu.Game.Tests.Visual protected EditorClockTestScene() { - Clock = new EditorClock(new Beatmap(), BeatDivisor) { IsCoupled = false }; + editorBeatmap = new EditorBeatmap(new Beatmap()); + + Clock = new EditorClock(editorBeatmap, BeatDivisor) { IsCoupled = false }; } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) From f94afa5f8cf0b384322ba12a1ca527b36bae1580 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 25 May 2022 18:28:18 +0100 Subject: [PATCH 1207/2328] Code quality --- osu.Game/Overlays/ChatOverlayV2.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 9ca4d9cb6c..68199c9d25 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -56,7 +56,7 @@ namespace osu.Game.Overlays private const float side_bar_width = 190; private const float chat_bar_height = 60; - private readonly ChannelType[] excluded_channel_types = new[] + private readonly ChannelType[] excludedChannelTypes = { ChannelType.Multiplayer, ChannelType.Spectator, @@ -409,6 +409,6 @@ namespace osu.Game.Overlays } private IEnumerable filterToChatChannels(IEnumerable channels) - => channels.Cast().Where(c => !excluded_channel_types.Contains(c.Type)); + => channels.Cast().Where(c => !excludedChannelTypes.Contains(c.Type)); } } From 4f8b6b52ba1757396e1ef407d47bed974d5568f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 25 May 2022 21:49:31 +0200 Subject: [PATCH 1208/2328] Add failing test coverage for select/deselect all enable behaviour --- .../Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs | 4 ++++ .../Visual/UserInterface/TestSceneModSelectOverlay.cs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs index c37bff2066..44ae467c80 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs @@ -73,12 +73,15 @@ namespace osu.Game.Tests.Visual.Multiplayer { createFreeModSelect(); + AddAssert("select all button enabled", () => this.ChildrenOfType().ElementAt(1).Enabled.Value); + AddStep("click select all button", () => { InputManager.MoveMouseTo(this.ChildrenOfType().ElementAt(1)); InputManager.Click(MouseButton.Left); }); AddUntilStep("all mods selected", assertAllAvailableModsSelected); + AddAssert("select all button disabled", () => !this.ChildrenOfType().ElementAt(1).Enabled.Value); AddStep("click deselect all button", () => { @@ -86,6 +89,7 @@ namespace osu.Game.Tests.Visual.Multiplayer InputManager.Click(MouseButton.Left); }); AddUntilStep("all mods deselected", () => !freeModSelectOverlay.SelectedMods.Value.Any()); + AddAssert("select all button enabled", () => this.ChildrenOfType().ElementAt(1).Enabled.Value); } private void createFreeModSelect() diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs index 75e30f76c3..0c3acded88 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs @@ -435,8 +435,11 @@ namespace osu.Game.Tests.Visual.UserInterface createScreen(); changeRuleset(0); + AddAssert("deselect all button disabled", () => !this.ChildrenOfType().Last().Enabled.Value); + AddStep("select DT + HD", () => SelectedMods.Value = new Mod[] { new OsuModDoubleTime(), new OsuModHidden() }); AddAssert("DT + HD selected", () => modSelectOverlay.ChildrenOfType().Count(panel => panel.Active.Value) == 2); + AddAssert("deselect all button enabled", () => this.ChildrenOfType().Last().Enabled.Value); AddStep("click deselect all button", () => { @@ -444,6 +447,7 @@ namespace osu.Game.Tests.Visual.UserInterface InputManager.Click(MouseButton.Left); }); AddUntilStep("all mods deselected", () => !SelectedMods.Value.Any()); + AddAssert("deselect all button disabled", () => !this.ChildrenOfType().Last().Enabled.Value); } [Test] From a4bd399b0cbd6a1c14a20fbb8fc2b431f2e97ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 25 May 2022 22:09:31 +0200 Subject: [PATCH 1209/2328] Split off "deselect all mods" button to separate class --- .../Overlays/Mods/DeselectAllModsButton.cs | 38 +++++++++++++++++++ osu.Game/Overlays/Mods/ModSelectOverlay.cs | 15 ++------ 2 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 osu.Game/Overlays/Mods/DeselectAllModsButton.cs diff --git a/osu.Game/Overlays/Mods/DeselectAllModsButton.cs b/osu.Game/Overlays/Mods/DeselectAllModsButton.cs new file mode 100644 index 0000000000..39009c8656 --- /dev/null +++ b/osu.Game/Overlays/Mods/DeselectAllModsButton.cs @@ -0,0 +1,38 @@ +// 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.Linq; +using osu.Framework.Bindables; +using osu.Framework.Input.Bindings; +using osu.Framework.Input.Events; +using osu.Game.Graphics.UserInterface; +using osu.Game.Input.Bindings; +using osu.Game.Localisation; +using osu.Game.Rulesets.Mods; + +namespace osu.Game.Overlays.Mods +{ + public class DeselectAllModsButton : ShearedButton, IKeyBindingHandler + { + public DeselectAllModsButton(ModSelectOverlay modSelectOverlay) + : base(ModSelectOverlay.BUTTON_WIDTH) + { + Text = CommonStrings.DeselectAll; + Action = modSelectOverlay.DeselectAll; + } + + public bool OnPressed(KeyBindingPressEvent e) + { + if (e.Repeat || e.Action != GlobalAction.DeselectAllMods) + return false; + + TriggerClick(); + return true; + } + + public void OnReleased(KeyBindingReleaseEvent e) + { + } + } +} diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index f1a998bd3c..ea7f969450 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Mods { public abstract class ModSelectOverlay : ShearedOverlayContainer, ISamplePlaybackDisabler { - protected const int BUTTON_WIDTH = 200; + public const int BUTTON_WIDTH = 200; [Cached] public Bindable> SelectedMods { get; private set; } = new Bindable>(Array.Empty()); @@ -76,11 +76,7 @@ namespace osu.Game.Overlays.Mods }; } - yield return deselectAllButton = new ShearedButton(BUTTON_WIDTH) - { - Text = CommonStrings.DeselectAll, - Action = DeselectAll - }; + yield return new DeselectAllModsButton(this); } private readonly Bindable>> availableMods = new Bindable>>(); @@ -98,7 +94,6 @@ namespace osu.Game.Overlays.Mods private DifficultyMultiplierDisplay? multiplierDisplay; private ShearedToggleButton? customisationButton; - private ShearedButton? deselectAllButton; protected ModSelectOverlay(OverlayColourScheme colourScheme = OverlayColourScheme.Green) : base(colourScheme) @@ -256,7 +251,7 @@ namespace osu.Game.Overlays.Mods /// /// Deselect all visible mods in all columns. /// - protected void DeselectAll() + public void DeselectAll() { foreach (var column in columnFlow.Columns) column.DeselectAll(); @@ -514,10 +509,6 @@ namespace osu.Game.Overlays.Mods hideOverlay(true); return true; } - - case GlobalAction.DeselectAllMods: - deselectAllButton?.TriggerClick(); - return true; } return base.OnPressed(e); From a3f29625587fd0cb52c8d4042dd1b48f82d62db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 25 May 2022 22:12:09 +0200 Subject: [PATCH 1210/2328] Disable "deselect all mods" button if none are selected --- osu.Game/Overlays/Mods/DeselectAllModsButton.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/osu.Game/Overlays/Mods/DeselectAllModsButton.cs b/osu.Game/Overlays/Mods/DeselectAllModsButton.cs index 39009c8656..8288d34c95 100644 --- a/osu.Game/Overlays/Mods/DeselectAllModsButton.cs +++ b/osu.Game/Overlays/Mods/DeselectAllModsButton.cs @@ -15,11 +15,27 @@ namespace osu.Game.Overlays.Mods { public class DeselectAllModsButton : ShearedButton, IKeyBindingHandler { + private readonly Bindable> selectedMods = new Bindable>(); + public DeselectAllModsButton(ModSelectOverlay modSelectOverlay) : base(ModSelectOverlay.BUTTON_WIDTH) { Text = CommonStrings.DeselectAll; Action = modSelectOverlay.DeselectAll; + + selectedMods.BindTo(modSelectOverlay.SelectedMods); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + selectedMods.BindValueChanged(_ => updateEnabledState(), true); + } + + private void updateEnabledState() + { + Enabled.Value = selectedMods.Value.Any(); } public bool OnPressed(KeyBindingPressEvent e) From f0303d76e8e8dfb4b174bec2bd15e5a9aae23f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 25 May 2022 22:18:30 +0200 Subject: [PATCH 1211/2328] Split off "select all mods" button to separate class --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 +- osu.Game/Overlays/Mods/SelectAllModsButton.cs | 35 +++++++++++++++++++ .../OnlinePlay/FreeModSelectOverlay.cs | 31 ++-------------- 3 files changed, 38 insertions(+), 30 deletions(-) create mode 100644 osu.Game/Overlays/Mods/SelectAllModsButton.cs diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index ea7f969450..d8355a4dea 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -242,7 +242,7 @@ namespace osu.Game.Overlays.Mods /// /// Select all visible mods in all columns. /// - protected void SelectAll() + public void SelectAll() { foreach (var column in columnFlow.Columns) column.SelectAll(); diff --git a/osu.Game/Overlays/Mods/SelectAllModsButton.cs b/osu.Game/Overlays/Mods/SelectAllModsButton.cs new file mode 100644 index 0000000000..b9d6bf9633 --- /dev/null +++ b/osu.Game/Overlays/Mods/SelectAllModsButton.cs @@ -0,0 +1,35 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Input; +using osu.Framework.Input.Bindings; +using osu.Framework.Input.Events; +using osu.Game.Graphics.UserInterface; +using osu.Game.Localisation; +using osu.Game.Screens.OnlinePlay; + +namespace osu.Game.Overlays.Mods +{ + public class SelectAllModsButton : ShearedButton, IKeyBindingHandler + { + public SelectAllModsButton(FreeModSelectOverlay modSelectOverlay) + : base(ModSelectOverlay.BUTTON_WIDTH) + { + Text = CommonStrings.SelectAll; + Action = modSelectOverlay.SelectAll; + } + + public bool OnPressed(KeyBindingPressEvent e) + { + if (e.Repeat || e.Action != PlatformAction.SelectAll) + return false; + + TriggerClick(); + return true; + } + + public void OnReleased(KeyBindingReleaseEvent e) + { + } + } +} diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs index f494f9799a..7c9184cc0f 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs @@ -6,18 +6,14 @@ using osu.Game.Overlays; using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; -using osu.Framework.Input; -using osu.Framework.Input.Bindings; -using osu.Framework.Input.Events; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; using osu.Game.Rulesets.Mods; using osuTK.Input; -using osu.Game.Localisation; namespace osu.Game.Screens.OnlinePlay { - public class FreeModSelectOverlay : ModSelectOverlay, IKeyBindingHandler + public class FreeModSelectOverlay : ModSelectOverlay { protected override bool ShowTotalMultiplier => false; @@ -29,8 +25,6 @@ namespace osu.Game.Screens.OnlinePlay set => base.IsValidMod = m => m.UserPlayable && value.Invoke(m); } - private ShearedButton selectAllButton; - public FreeModSelectOverlay() : base(OverlayColourScheme.Plum) { @@ -40,31 +34,10 @@ namespace osu.Game.Screens.OnlinePlay protected override ModColumn CreateModColumn(ModType modType, Key[] toggleKeys = null) => new ModColumn(modType, true, toggleKeys); protected override IEnumerable CreateFooterButtons() => base.CreateFooterButtons().Prepend( - selectAllButton = new ShearedButton(BUTTON_WIDTH) + new SelectAllModsButton(this) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - Text = CommonStrings.SelectAll, - Action = SelectAll }); - - public bool OnPressed(KeyBindingPressEvent e) - { - if (e.Repeat) - return false; - - switch (e.Action) - { - case PlatformAction.SelectAll: - selectAllButton.TriggerClick(); - return true; - } - - return false; - } - - public void OnReleased(KeyBindingReleaseEvent e) - { - } } } From 071e158a297139bff0812b567cf6f6064e98839e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 25 May 2022 22:20:10 +0200 Subject: [PATCH 1212/2328] Expose available mod state outwardly as a bindable --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 38 ++++++++++++++-------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index d8355a4dea..4bad34d94f 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -34,6 +34,15 @@ namespace osu.Game.Overlays.Mods [Cached] public Bindable> SelectedMods { get; private set; } = new Bindable>(Array.Empty()); + /// + /// Contains a dictionary with the current of all mods applicable for the current ruleset. + /// + /// + /// Contrary to and , the instances + /// inside the objects are owned solely by this instance. + /// + public Bindable>> AvailableMods { get; } = new Bindable>>(new Dictionary>()); + private Func isValidMod = m => true; /// @@ -79,9 +88,9 @@ namespace osu.Game.Overlays.Mods yield return new DeselectAllModsButton(this); } - private readonly Bindable>> availableMods = new Bindable>>(); - private readonly Dictionary> localAvailableMods = new Dictionary>(); - private IEnumerable allLocalAvailableMods => localAvailableMods.SelectMany(pair => pair.Value); + private readonly Bindable>> globalAvailableMods = new Bindable>>(); + + private IEnumerable allAvailableMods => AvailableMods.Value.SelectMany(pair => pair.Value); private readonly BindableBool customisationVisible = new BindableBool(); @@ -204,13 +213,13 @@ namespace osu.Game.Overlays.Mods }) }; - availableMods.BindTo(game.AvailableMods); + globalAvailableMods.BindTo(game.AvailableMods); } protected override void LoadComplete() { // this is called before base call so that the mod state is populated early, and the transition in `PopIn()` can play out properly. - availableMods.BindValueChanged(_ => createLocalMods(), true); + globalAvailableMods.BindValueChanged(_ => createLocalMods(), true); base.LoadComplete(); @@ -275,9 +284,9 @@ namespace osu.Game.Overlays.Mods private void createLocalMods() { - localAvailableMods.Clear(); + var newLocalAvailableMods = new Dictionary>(); - foreach (var (modType, mods) in availableMods.Value) + foreach (var (modType, mods) in globalAvailableMods.Value) { var modStates = mods.SelectMany(ModUtils.FlattenMod) .Select(mod => new ModState(mod.DeepClone())) @@ -286,18 +295,19 @@ namespace osu.Game.Overlays.Mods foreach (var modState in modStates) modState.Active.BindValueChanged(_ => updateFromInternalSelection()); - localAvailableMods[modType] = modStates; + newLocalAvailableMods[modType] = modStates; } + AvailableMods.Value = newLocalAvailableMods; filterMods(); foreach (var column in columnFlow.Columns) - column.AvailableMods = localAvailableMods.GetValueOrDefault(column.ModType, Array.Empty()); + column.AvailableMods = AvailableMods.Value.GetValueOrDefault(column.ModType, Array.Empty()); } private void filterMods() { - foreach (var modState in allLocalAvailableMods) + foreach (var modState in allAvailableMods) modState.Filtered.Value = !modState.Mod.HasImplementation || !IsValidMod.Invoke(modState.Mod); } @@ -378,7 +388,7 @@ namespace osu.Game.Overlays.Mods var newSelection = new List(); - foreach (var modState in allLocalAvailableMods) + foreach (var modState in allAvailableMods) { var matchingSelectedMod = SelectedMods.Value.SingleOrDefault(selected => selected.GetType() == modState.Mod.GetType()); @@ -405,9 +415,9 @@ namespace osu.Game.Overlays.Mods if (externalSelectionUpdateInProgress) return; - var candidateSelection = allLocalAvailableMods.Where(modState => modState.Active.Value) - .Select(modState => modState.Mod) - .ToArray(); + var candidateSelection = allAvailableMods.Where(modState => modState.Active.Value) + .Select(modState => modState.Mod) + .ToArray(); SelectedMods.Value = ComputeNewModsFromSelection(SelectedMods.Value, candidateSelection); } From a1b8fa09921666ee65531cea264aeade2aa5718b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 25 May 2022 22:24:26 +0200 Subject: [PATCH 1213/2328] Disable "select all mods" button if all are selected --- osu.Game/Overlays/Mods/SelectAllModsButton.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/osu.Game/Overlays/Mods/SelectAllModsButton.cs b/osu.Game/Overlays/Mods/SelectAllModsButton.cs index b9d6bf9633..f7078b2fa5 100644 --- a/osu.Game/Overlays/Mods/SelectAllModsButton.cs +++ b/osu.Game/Overlays/Mods/SelectAllModsButton.cs @@ -1,22 +1,48 @@ // 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.Linq; +using osu.Framework.Bindables; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; +using osu.Game.Rulesets.Mods; using osu.Game.Screens.OnlinePlay; namespace osu.Game.Overlays.Mods { public class SelectAllModsButton : ShearedButton, IKeyBindingHandler { + private readonly Bindable> selectedMods = new Bindable>(); + private readonly Bindable>> availableMods = new Bindable>>(); + public SelectAllModsButton(FreeModSelectOverlay modSelectOverlay) : base(ModSelectOverlay.BUTTON_WIDTH) { Text = CommonStrings.SelectAll; Action = modSelectOverlay.SelectAll; + + selectedMods.BindTo(modSelectOverlay.SelectedMods); + availableMods.BindTo(modSelectOverlay.AvailableMods); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + selectedMods.BindValueChanged(_ => Scheduler.AddOnce(updateEnabledState)); + availableMods.BindValueChanged(_ => Scheduler.AddOnce(updateEnabledState)); + updateEnabledState(); + } + + private void updateEnabledState() + { + Enabled.Value = availableMods.Value + .SelectMany(pair => pair.Value) + .Any(modState => !modState.Active.Value && !modState.Filtered.Value); } public bool OnPressed(KeyBindingPressEvent e) From af1d4d3aee582950473057e8733855c71ddbff62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 25 May 2022 22:27:54 +0200 Subject: [PATCH 1214/2328] Use more proper button subtypes in tests --- .../Multiplayer/TestSceneFreeModSelectOverlay.cs | 11 +++++------ .../Visual/UserInterface/TestSceneModSelectOverlay.cs | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs index 44ae467c80..a8471edbf8 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs @@ -9,7 +9,6 @@ using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Testing; -using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Mods; @@ -73,23 +72,23 @@ namespace osu.Game.Tests.Visual.Multiplayer { createFreeModSelect(); - AddAssert("select all button enabled", () => this.ChildrenOfType().ElementAt(1).Enabled.Value); + AddAssert("select all button enabled", () => this.ChildrenOfType().Single().Enabled.Value); AddStep("click select all button", () => { - InputManager.MoveMouseTo(this.ChildrenOfType().ElementAt(1)); + InputManager.MoveMouseTo(this.ChildrenOfType().Single()); InputManager.Click(MouseButton.Left); }); AddUntilStep("all mods selected", assertAllAvailableModsSelected); - AddAssert("select all button disabled", () => !this.ChildrenOfType().ElementAt(1).Enabled.Value); + AddAssert("select all button disabled", () => !this.ChildrenOfType().Single().Enabled.Value); AddStep("click deselect all button", () => { - InputManager.MoveMouseTo(this.ChildrenOfType().Last()); + InputManager.MoveMouseTo(this.ChildrenOfType().Single()); InputManager.Click(MouseButton.Left); }); AddUntilStep("all mods deselected", () => !freeModSelectOverlay.SelectedMods.Value.Any()); - AddAssert("select all button enabled", () => this.ChildrenOfType().ElementAt(1).Enabled.Value); + AddAssert("select all button enabled", () => this.ChildrenOfType().Single().Enabled.Value); } private void createFreeModSelect() diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs index 0c3acded88..9bb02c3e75 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs @@ -435,19 +435,19 @@ namespace osu.Game.Tests.Visual.UserInterface createScreen(); changeRuleset(0); - AddAssert("deselect all button disabled", () => !this.ChildrenOfType().Last().Enabled.Value); + AddAssert("deselect all button disabled", () => !this.ChildrenOfType().Single().Enabled.Value); AddStep("select DT + HD", () => SelectedMods.Value = new Mod[] { new OsuModDoubleTime(), new OsuModHidden() }); AddAssert("DT + HD selected", () => modSelectOverlay.ChildrenOfType().Count(panel => panel.Active.Value) == 2); - AddAssert("deselect all button enabled", () => this.ChildrenOfType().Last().Enabled.Value); + AddAssert("deselect all button enabled", () => this.ChildrenOfType().Single().Enabled.Value); AddStep("click deselect all button", () => { - InputManager.MoveMouseTo(this.ChildrenOfType().Last()); + InputManager.MoveMouseTo(this.ChildrenOfType().Single()); InputManager.Click(MouseButton.Left); }); AddUntilStep("all mods deselected", () => !SelectedMods.Value.Any()); - AddAssert("deselect all button disabled", () => !this.ChildrenOfType().Last().Enabled.Value); + AddAssert("deselect all button disabled", () => !this.ChildrenOfType().Single().Enabled.Value); } [Test] From b550cbc5a3e22421073401059c43c7b54095a623 Mon Sep 17 00:00:00 2001 From: Noah M Date: Wed, 25 May 2022 17:01:30 -0500 Subject: [PATCH 1215/2328] Fix failing code quality checks --- .../Overlays/Settings/Sections/Maintenance/GeneralSettings.cs | 2 +- .../Sections/Maintenance/MassVideoDeleteConfirmationDialog.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs index afc5cad893..37758875ea 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -67,7 +67,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance dialogOverlay?.Push(new MassVideoDeleteConfirmationDialog(() => { deleteBeatmapVideosButton.Enabled.Value = false; - Task.Run(() => beatmaps.DeleteVideos()).ContinueWith(t => Schedule(() => deleteBeatmapVideosButton.Enabled.Value = true)); + Task.Run(beatmaps.DeleteVideos).ContinueWith(t => Schedule(() => deleteBeatmapVideosButton.Enabled.Value = true)); })); } }); diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/MassVideoDeleteConfirmationDialog.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/MassVideoDeleteConfirmationDialog.cs index 522177807c..fc8c9d497b 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/MassVideoDeleteConfirmationDialog.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/MassVideoDeleteConfirmationDialog.cs @@ -7,7 +7,8 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance { public class MassVideoDeleteConfirmationDialog : MassDeleteConfirmationDialog { - public MassVideoDeleteConfirmationDialog(Action deleteAction) : base(deleteAction) + public MassVideoDeleteConfirmationDialog(Action deleteAction) + : base(deleteAction) { BodyText = "All beatmap videos? This cannot be undone!"; } From 10287e01505880f236667a636968c814f250c137 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Thu, 26 May 2022 00:08:00 -0400 Subject: [PATCH 1216/2328] initial implementation --- .../Mods/OsuEaseHitObjectPositionsMod.cs | 75 +++++++++++++++++++ .../Mods/OsuModMagnetised.cs | 59 ++------------- osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs | 39 ++++++++++ osu.Game.Rulesets.Osu/OsuRuleset.cs | 2 +- 4 files changed, 121 insertions(+), 54 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs create mode 100644 osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs diff --git a/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs new file mode 100644 index 0000000000..d81d86dc65 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs @@ -0,0 +1,75 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Bindables; +using osu.Framework.Utils; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Rulesets.Osu.UI; +using osu.Game.Rulesets.UI; +using osuTK; + +namespace osu.Game.Rulesets.Osu.Mods +{ + public abstract class OsuEaseHitObjectPositionsMod : Mod, IUpdatableByPlayfield, IApplicableToDrawableRuleset + { + public override ModType Type => ModType.Fun; + public override double ScoreMultiplier => 1; + public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay) }; + + protected BindableFloat EasementStrength = new BindableFloat(0.5f); + protected Vector2 CursorPosition; + protected DrawableHitObject WorkingHitObject; + protected abstract Vector2 DestinationVector { get; } + + private IFrameStableClock gameplayClock; + + public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) + { + gameplayClock = drawableRuleset.FrameStableClock; + + // Hide judgment displays and follow points as they won't make any sense. + // Judgements can potentially be turned on in a future where they display at a position relative to their drawable counterpart. + drawableRuleset.Playfield.DisplayJudgements.Value = false; + (drawableRuleset.Playfield as OsuPlayfield)?.FollowPoints.Hide(); + } + + public void Update(Playfield playfield) + { + CursorPosition = playfield.Cursor.ActiveCursor.DrawPosition; + + foreach (var drawable in playfield.HitObjectContainer.AliveObjects) + { + WorkingHitObject = drawable; + switch (drawable) + { + case DrawableHitCircle circle: + easeHitObjectPositionToVector(circle, DestinationVector); + break; + + case DrawableSlider slider: + + if (!slider.HeadCircle.Result.HasResult) + easeHitObjectPositionToVector(slider, DestinationVector); + else + easeHitObjectPositionToVector(slider, DestinationVector - slider.Ball.DrawPosition); + + break; + } + } + } + + private void easeHitObjectPositionToVector(DrawableHitObject hitObject, Vector2 destination) + { + double dampLength = Interpolation.Lerp(3000, 40, EasementStrength.Value); + + float x = (float)Interpolation.DampContinuously(hitObject.X, Math.Clamp(destination.X, 0, OsuPlayfield.BASE_SIZE.X), dampLength, gameplayClock.ElapsedFrameTime); + float y = (float)Interpolation.DampContinuously(hitObject.Y, Math.Clamp(destination.Y, 0, OsuPlayfield.BASE_SIZE.Y), dampLength, gameplayClock.ElapsedFrameTime); + + hitObject.Position = new Vector2(x, y); + } + } +} diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs b/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs index ca6e9cfb1d..ca69085e31 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs @@ -2,31 +2,23 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; -using osu.Framework.Utils; using osu.Game.Configuration; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects; -using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.Osu.UI; -using osu.Game.Rulesets.UI; using osuTK; namespace osu.Game.Rulesets.Osu.Mods { - internal class OsuModMagnetised : Mod, IUpdatableByPlayfield, IApplicableToDrawableRuleset + internal class OsuModMagnetised : OsuEaseHitObjectPositionsMod { public override string Name => "Magnetised"; public override string Acronym => "MG"; public override IconUsage? Icon => FontAwesome.Solid.Magnet; - public override ModType Type => ModType.Fun; public override string Description => "No need to chase the circles – your cursor is a magnet!"; - public override double ScoreMultiplier => 1; - public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay), typeof(OsuModRelax) }; + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModRelax), typeof(OsuModRepel) }).ToArray(); - private IFrameStableClock gameplayClock; + protected override Vector2 DestinationVector => CursorPosition; [SettingSource("Attraction strength", "How strong the pull is.", 0)] public BindableFloat AttractionStrength { get; } = new BindableFloat(0.5f) @@ -36,48 +28,9 @@ namespace osu.Game.Rulesets.Osu.Mods MaxValue = 1.0f, }; - public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) + public OsuModMagnetised() { - gameplayClock = drawableRuleset.FrameStableClock; - - // Hide judgment displays and follow points as they won't make any sense. - // Judgements can potentially be turned on in a future where they display at a position relative to their drawable counterpart. - drawableRuleset.Playfield.DisplayJudgements.Value = false; - (drawableRuleset.Playfield as OsuPlayfield)?.FollowPoints.Hide(); - } - - public void Update(Playfield playfield) - { - var cursorPos = playfield.Cursor.ActiveCursor.DrawPosition; - - foreach (var drawable in playfield.HitObjectContainer.AliveObjects) - { - switch (drawable) - { - case DrawableHitCircle circle: - easeTo(circle, cursorPos); - break; - - case DrawableSlider slider: - - if (!slider.HeadCircle.Result.HasResult) - easeTo(slider, cursorPos); - else - easeTo(slider, cursorPos - slider.Ball.DrawPosition); - - break; - } - } - } - - private void easeTo(DrawableHitObject hitObject, Vector2 destination) - { - double dampLength = Interpolation.Lerp(3000, 40, AttractionStrength.Value); - - float x = (float)Interpolation.DampContinuously(hitObject.X, destination.X, dampLength, gameplayClock.ElapsedFrameTime); - float y = (float)Interpolation.DampContinuously(hitObject.Y, destination.Y, dampLength, gameplayClock.ElapsedFrameTime); - - hitObject.Position = new Vector2(x, y); + EasementStrength.BindTo(AttractionStrength); } } } diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs new file mode 100644 index 0000000000..35f369d9c5 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs @@ -0,0 +1,39 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Linq; +using osu.Framework.Bindables; +using osu.Framework.Graphics.Sprites; +using osu.Game.Configuration; +using osuTK; + +namespace osu.Game.Rulesets.Osu.Mods +{ + internal class OsuModRepel : OsuEaseHitObjectPositionsMod + { + public override string Name => "Repel"; + public override string Acronym => "RP"; + public override IconUsage? Icon => FontAwesome.Solid.ExpandArrowsAlt; + public override string Description => "Run away!"; + public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModMagnetised)).ToArray(); + + [SettingSource("Repulsion strength", "How strong the repulsion is.", 0)] + public BindableFloat RepulsionStrength { get; } = new BindableFloat(0.5f) + { + Precision = 0.05f, + MinValue = 0.05f, + MaxValue = 1.0f, + }; + + protected override Vector2 DestinationVector => new Vector2( + 2 * WorkingHitObject.X - CursorPosition.X, + 2 * WorkingHitObject.Y - CursorPosition.Y + ); + + public OsuModRepel() + { + EasementStrength.BindTo(RepulsionStrength); + } + } +} diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 207e7a4ab0..09b85726ca 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -195,7 +195,7 @@ namespace osu.Game.Rulesets.Osu new OsuModApproachDifferent(), new OsuModMuted(), new OsuModNoScope(), - new OsuModMagnetised(), + new MultiMod(new OsuModMagnetised(), new OsuModRepel()), new ModAdaptiveSpeed() }; From 63dd9bd49372f0f051d86124fcd6b0a71a95ea1e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 26 May 2022 18:02:50 +0900 Subject: [PATCH 1217/2328] Expose `Reconnect` logic in `HubClientConnector` --- osu.Game/Online/HubClientConnector.cs | 34 ++++++++++++++++---------- osu.Game/Online/IHubClientConnector.cs | 5 ++++ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/osu.Game/Online/HubClientConnector.cs b/osu.Game/Online/HubClientConnector.cs index ca9bf00b23..5c11eed381 100644 --- a/osu.Game/Online/HubClientConnector.cs +++ b/osu.Game/Online/HubClientConnector.cs @@ -64,20 +64,28 @@ namespace osu.Game.Online this.preferMessagePack = preferMessagePack; apiState.BindTo(api.State); - apiState.BindValueChanged(state => - { - switch (state.NewValue) - { - case APIState.Failing: - case APIState.Offline: - Task.Run(() => disconnect(true)); - break; + apiState.BindValueChanged(state => connectIfPossible(), true); + } - case APIState.Online: - Task.Run(connect); - break; - } - }, true); + public void Reconnect() + { + Logger.Log($"{clientName} reconnecting...", LoggingTarget.Network); + Task.Run(connectIfPossible); + } + + private void connectIfPossible() + { + switch (apiState.Value) + { + case APIState.Failing: + case APIState.Offline: + Task.Run(() => disconnect(true)); + break; + + case APIState.Online: + Task.Run(connect); + break; + } } private async Task connect() diff --git a/osu.Game/Online/IHubClientConnector.cs b/osu.Game/Online/IHubClientConnector.cs index d2ceb1f030..b168e4669f 100644 --- a/osu.Game/Online/IHubClientConnector.cs +++ b/osu.Game/Online/IHubClientConnector.cs @@ -30,5 +30,10 @@ namespace osu.Game.Online /// Invoked whenever a new hub connection is built, to configure it before it's started. /// public Action? ConfigureConnection { get; set; } + + /// + /// Reconnect if already connected. + /// + void Reconnect(); } } From abb69a49b05591586adeb8034203cef2a07eee81 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 26 May 2022 18:03:41 +0900 Subject: [PATCH 1218/2328] Handle server shutdown messages in room creation and spectator initialisation --- osu.Game/Online/HubClientConnector.cs | 2 ++ .../Multiplayer/MultiplayerClientExtensions.cs | 18 ++++++++++++------ .../Multiplayer/OnlineMultiplayerClient.cs | 17 ++++++++++++++--- .../Online/Spectator/OnlineSpectatorClient.cs | 17 ++++++++++++++--- 4 files changed, 42 insertions(+), 12 deletions(-) diff --git a/osu.Game/Online/HubClientConnector.cs b/osu.Game/Online/HubClientConnector.cs index 5c11eed381..261724e315 100644 --- a/osu.Game/Online/HubClientConnector.cs +++ b/osu.Game/Online/HubClientConnector.cs @@ -20,6 +20,8 @@ namespace osu.Game.Online { public class HubClientConnector : IHubClientConnector { + public const string SERVER_SHUTDOWN_MESSAGE = "Server is shutting down."; + /// /// Invoked whenever a new hub connection is built, to configure it before it's started. /// diff --git a/osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs b/osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs index 4729765084..cda313bd0a 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs @@ -25,12 +25,7 @@ namespace osu.Game.Online.Multiplayer Debug.Assert(exception != null); - string message = exception is HubException - // HubExceptions arrive with additional message context added, but we want to display the human readable message: - // "An unexpected error occurred invoking 'AddPlaylistItem' on the server.InvalidStateException: Can't enqueue more than 3 items at once." - // We generally use the message field for a user-parseable error (eventually to be replaced), so drop the first part for now. - ? exception.Message.Substring(exception.Message.IndexOf(':') + 1).Trim() - : exception.Message; + string message = exception.GetHubExceptionMessage() ?? exception.Message; Logger.Log(message, level: LogLevel.Important); onError?.Invoke(exception); @@ -40,5 +35,16 @@ namespace osu.Game.Online.Multiplayer onSuccess?.Invoke(); } }); + + public static string? GetHubExceptionMessage(this Exception exception) + { + if (exception is HubException hubException) + // HubExceptions arrive with additional message context added, but we want to display the human readable message: + // "An unexpected error occurred invoking 'AddPlaylistItem' on the server.InvalidStateException: Can't enqueue more than 3 items at once." + // We generally use the message field for a user-parseable error (eventually to be replaced), so drop the first part for now. + return hubException.Message.Substring(exception.Message.IndexOf(':') + 1).Trim(); + + return null; + } } } diff --git a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs index 4dc23d8b85..a3423d4189 100644 --- a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs @@ -3,10 +3,12 @@ #nullable enable +using System; using System.Collections.Generic; using System.Diagnostics; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR.Client; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -71,14 +73,23 @@ namespace osu.Game.Online.Multiplayer } } - protected override Task JoinRoom(long roomId, string? password = null) + protected override async Task JoinRoom(long roomId, string? password = null) { if (!IsConnected.Value) - return Task.FromCanceled(new CancellationToken(true)); + throw new OperationCanceledException(); Debug.Assert(connection != null); - return connection.InvokeAsync(nameof(IMultiplayerServer.JoinRoomWithPassword), roomId, password ?? string.Empty); + try + { + return await connection.InvokeAsync(nameof(IMultiplayerServer.JoinRoomWithPassword), roomId, password ?? string.Empty); + } + catch (HubException exception) + { + if (exception.GetHubExceptionMessage() == HubClientConnector.SERVER_SHUTDOWN_MESSAGE) + connector?.Reconnect(); + throw; + } } protected override Task LeaveRoomInternal() diff --git a/osu.Game/Online/Spectator/OnlineSpectatorClient.cs b/osu.Game/Online/Spectator/OnlineSpectatorClient.cs index 4d6ca0b311..0f77f723db 100644 --- a/osu.Game/Online/Spectator/OnlineSpectatorClient.cs +++ b/osu.Game/Online/Spectator/OnlineSpectatorClient.cs @@ -5,10 +5,12 @@ using System.Diagnostics; using System.Threading.Tasks; +using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR.Client; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Online.API; +using osu.Game.Online.Multiplayer; namespace osu.Game.Online.Spectator { @@ -47,14 +49,23 @@ namespace osu.Game.Online.Spectator } } - protected override Task BeginPlayingInternal(SpectatorState state) + protected override async Task BeginPlayingInternal(SpectatorState state) { if (!IsConnected.Value) - return Task.CompletedTask; + return; Debug.Assert(connection != null); - return connection.SendAsync(nameof(ISpectatorServer.BeginPlaySession), state); + try + { + await connection.SendAsync(nameof(ISpectatorServer.BeginPlaySession), state); + } + catch (HubException exception) + { + if (exception.GetHubExceptionMessage() == HubClientConnector.SERVER_SHUTDOWN_MESSAGE) + connector?.Reconnect(); + throw; + } } protected override Task SendFramesInternal(FrameDataBundle bundle) From 7f4ea5d522de3dc6c53d9e6cb892720b580c47c5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 26 May 2022 18:12:28 +0900 Subject: [PATCH 1219/2328] Use left alignment and remove hacky text positioning code --- osu.Game/Screens/Edit/BottomBar.cs | 2 +- osu.Game/Screens/Edit/Components/TimeInfoContainer.cs | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/BottomBar.cs b/osu.Game/Screens/Edit/BottomBar.cs index 0f857940b3..5994184c11 100644 --- a/osu.Game/Screens/Edit/BottomBar.cs +++ b/osu.Game/Screens/Edit/BottomBar.cs @@ -41,7 +41,7 @@ namespace osu.Game.Screens.Edit RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { - new Dimension(GridSizeMode.Absolute, 220), + new Dimension(GridSizeMode.Absolute, 170), new Dimension(), new Dimension(GridSizeMode.Absolute, 220), new Dimension(GridSizeMode.Absolute, 120), diff --git a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs index 6024716f4b..bd5377e578 100644 --- a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs +++ b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs @@ -31,8 +31,8 @@ namespace osu.Game.Screens.Edit.Components { trackTimer = new OsuSpriteText { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, Spacing = new Vector2(-2, 0), Font = OsuFont.Torus.With(size: 36, fixedWidth: true, weight: FontWeight.Light), Y = -10, @@ -40,9 +40,9 @@ namespace osu.Game.Screens.Edit.Components bpm = new OsuSpriteText { Colour = colours.Orange1, - Anchor = Anchor.CentreRight, + Anchor = Anchor.CentreLeft, Font = OsuFont.Torus.With(size: 18, weight: FontWeight.SemiBold), - Y = 5, + Position = new Vector2(2, 5), } }; } @@ -52,7 +52,6 @@ namespace osu.Game.Screens.Edit.Components base.Update(); trackTimer.Text = editorClock.CurrentTime.ToEditorFormattedString(); bpm.Text = @$"{editorBeatmap.ControlPointInfo.TimingPointAt(editorClock.CurrentTime).BPM:0} BPM"; - bpm.X = 5 - trackTimer.DrawWidth; } } } From 93c94b8ea0f21cb19cfb22a1376b6a0ec61f4911 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 26 May 2022 18:30:37 +0900 Subject: [PATCH 1220/2328] Fix test caching woes --- osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs | 6 ++++++ osu.Game/Tests/Visual/EditorClockTestScene.cs | 11 +++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs index 4b9be77471..393d3886e7 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs @@ -2,10 +2,13 @@ // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Osu; +using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Components; +using osu.Game.Tests.Beatmaps; using osuTK; namespace osu.Game.Tests.Visual.Editing @@ -13,6 +16,9 @@ namespace osu.Game.Tests.Visual.Editing [TestFixture] public class TestSceneEditorClock : EditorClockTestScene { + [Cached] + private EditorBeatmap editorBeatmap = new EditorBeatmap(new TestBeatmap(new OsuRuleset().RulesetInfo)); + public TestSceneEditorClock() { Add(new FillFlowContainer diff --git a/osu.Game/Tests/Visual/EditorClockTestScene.cs b/osu.Game/Tests/Visual/EditorClockTestScene.cs index 93dfe58076..2d3e1960d9 100644 --- a/osu.Game/Tests/Visual/EditorClockTestScene.cs +++ b/osu.Game/Tests/Visual/EditorClockTestScene.cs @@ -6,7 +6,6 @@ using osu.Framework.Bindables; using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Overlays; -using osu.Game.Rulesets.Edit; using osu.Game.Screens.Edit; namespace osu.Game.Tests.Visual @@ -20,20 +19,16 @@ namespace osu.Game.Tests.Visual [Cached] private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Aquamarine); - [Cached(typeof(EditorBeatmap))] - [Cached(typeof(IBeatSnapProvider))] - private readonly EditorBeatmap editorBeatmap; - protected readonly BindableBeatDivisor BeatDivisor = new BindableBeatDivisor(); + + [Cached] protected new readonly EditorClock Clock; protected virtual bool ScrollUsingMouseWheel => true; protected EditorClockTestScene() { - editorBeatmap = new EditorBeatmap(new Beatmap()); - - Clock = new EditorClock(editorBeatmap, BeatDivisor) { IsCoupled = false }; + Clock = new EditorClock(new Beatmap(), BeatDivisor) { IsCoupled = false }; } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) From 08935cff86f8d962ea04044c720fea6cfed5964c Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 26 May 2022 18:37:04 +0900 Subject: [PATCH 1221/2328] Detect exclusive fullscreen on Windows --- .../Sections/Graphics/LayoutSettings.cs | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 602ace6dea..981f5dbac3 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; using osu.Framework.Platform; +using osu.Framework.Platform.Windows; using osu.Game.Configuration; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -34,10 +35,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private Bindable sizeFullscreen; private readonly BindableList resolutions = new BindableList(new[] { new Size(9999, 9999) }); + private readonly IBindable fullscreenCapability = new Bindable(FullscreenCapability.Capable); [Resolved] private OsuGameBase game { get; set; } + [Resolved] + private GameHost host { get; set; } + private SettingsDropdown resolutionDropdown; private SettingsDropdown displayDropdown; private SettingsDropdown windowModeDropdown; @@ -65,6 +70,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics windowModes.BindTo(host.Window.SupportedWindowModes); } + if (host.Window is WindowsWindow windowsWindow) + fullscreenCapability.BindTo(windowsWindow.FullscreenCapability); + Children = new Drawable[] { windowModeDropdown = new SettingsDropdown @@ -139,6 +147,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics } }, }; + + fullscreenCapability.BindValueChanged(_ => Schedule(updateScreenModeWarning), true); } protected override void LoadComplete() @@ -150,8 +160,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics windowModeDropdown.Current.BindValueChanged(mode => { updateDisplayModeDropdowns(); - - windowModeDropdown.WarningText = mode.NewValue != WindowMode.Fullscreen ? GraphicsSettingsStrings.NotFullscreenNote : default; + updateScreenModeWarning(); }, true); windowModes.BindCollectionChanged((sender, args) => @@ -213,6 +222,31 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics } } + private void updateScreenModeWarning() + { + if (windowModeDropdown.Current.Value != WindowMode.Fullscreen) + { + windowModeDropdown.WarningText = GraphicsSettingsStrings.NotFullscreenNote; + return; + } + + switch (fullscreenCapability.Value) + { + case FullscreenCapability.Unknown: + if (host.Window is WindowsWindow) + windowModeDropdown.WarningText = "Checking for exclusive fullscreen..."; + break; + + case FullscreenCapability.Capable: + windowModeDropdown.WarningText = default; + break; + + case FullscreenCapability.Incapable: + windowModeDropdown.WarningText = "Unable to enter exclusive fullscreen. You'll still experience some input latency."; + break; + } + } + private void bindPreviewEvent(Bindable bindable) { bindable.ValueChanged += _ => From a98d0cf0d8b6d8c91cdaff9626cc76859ca71537 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 26 May 2022 18:47:50 +0900 Subject: [PATCH 1222/2328] Simplify channel filter method --- osu.Game/Overlays/ChatOverlayV2.cs | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlayV2.cs index 68199c9d25..f2ec007b19 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlayV2.cs @@ -3,7 +3,6 @@ #nullable enable -using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; @@ -56,13 +55,6 @@ namespace osu.Game.Overlays private const float side_bar_width = 190; private const float chat_bar_height = 60; - private readonly ChannelType[] excludedChannelTypes = - { - ChannelType.Multiplayer, - ChannelType.Spectator, - ChannelType.Temporary, - }; - [Resolved] private OsuConfigManager config { get; set; } = null!; @@ -353,7 +345,7 @@ namespace osu.Game.Overlays switch (args.Action) { case NotifyCollectionChangedAction.Add: - IEnumerable newChannels = filterToChatChannels(args.NewItems); + IEnumerable newChannels = args.NewItems.OfType().Where(isChatChannel); foreach (var channel in newChannels) channelList.AddChannel(channel); @@ -361,7 +353,7 @@ namespace osu.Game.Overlays break; case NotifyCollectionChangedAction.Remove: - IEnumerable leftChannels = filterToChatChannels(args.OldItems); + IEnumerable leftChannels = args.OldItems.OfType().Where(isChatChannel); foreach (var channel in leftChannels) { @@ -408,7 +400,21 @@ namespace osu.Game.Overlays channelList.ScrollChannelIntoView(currentChannel.Value); } - private IEnumerable filterToChatChannels(IEnumerable channels) - => channels.Cast().Where(c => !excludedChannelTypes.Contains(c.Type)); + /// + /// Whether a channel should be displayed in this overlay, based on its type. + /// + private static bool isChatChannel(Channel channel) + { + switch (channel.Type) + { + case ChannelType.Multiplayer: + case ChannelType.Spectator: + case ChannelType.Temporary: + return false; + + default: + return true; + } + } } } From 3915b8e414a00e085e6c59a2da6c7df76f32fcc1 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 26 May 2022 20:01:33 +0900 Subject: [PATCH 1223/2328] Fix multiplayer race condition when starting gameplay --- .../Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs | 6 ++++++ .../OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs index 5dab845999..d9125dc0a0 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs @@ -149,6 +149,12 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer protected override void StartGameplay() { + // We can enter this screen one of two ways: + // 1. Via the automatic natural progression of PlayerLoader into Player. + // We'll arrive here in a Loaded state, and we need to let the server know that we're ready to start. + // 2. Via the server forcefully starting gameplay because players have been hanging out in PlayerLoader for too long. + // We'll arrive here in a Playing state, and we should neither show the loading spinner nor tell the server that we're ready to start (gameplay has already started). + if (client.LocalUser?.State == MultiplayerUserState.Loaded) { // block base call, but let the server know we are ready to start. diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs index 7f01bd64ab..e9bf5339a9 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs @@ -26,8 +26,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer } protected override bool ReadyForGameplay => - base.ReadyForGameplay - // The server is forcefully starting gameplay. + ( + // The user is ready to enter gameplay. + base.ReadyForGameplay + // And the server has received the message that we're loaded. + && multiplayerClient.LocalUser?.State == MultiplayerUserState.Loaded + ) + // Or the server is forcefully starting gameplay. || multiplayerClient.LocalUser?.State == MultiplayerUserState.Playing; protected override void OnPlayerLoaded() From 0224947de0b886468dad7940c4dd6cd94b242e13 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 26 May 2022 20:09:28 +0900 Subject: [PATCH 1224/2328] Add comment about how starting gameplay works --- osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs index d9125dc0a0..3bf8a09cb9 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs @@ -154,10 +154,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer // We'll arrive here in a Loaded state, and we need to let the server know that we're ready to start. // 2. Via the server forcefully starting gameplay because players have been hanging out in PlayerLoader for too long. // We'll arrive here in a Playing state, and we should neither show the loading spinner nor tell the server that we're ready to start (gameplay has already started). + // + // The base call is blocked here because in both cases gameplay is started only when the server says so via onGameplayStarted(). if (client.LocalUser?.State == MultiplayerUserState.Loaded) { - // block base call, but let the server know we are ready to start. loadingDisplay.Show(); client.ChangeState(MultiplayerUserState.ReadyForGameplay); } From 66a6467403d195013590f117eb362f249a692631 Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Thu, 26 May 2022 19:26:14 +0100 Subject: [PATCH 1225/2328] Pass object position to the object --- .../Difficulty/CatchDifficultyCalculator.cs | 2 +- .../Difficulty/Preprocessing/CatchDifficultyHitObject.cs | 4 ++-- .../Difficulty/ManiaDifficultyCalculator.cs | 2 +- .../Difficulty/Preprocessing/ManiaDifficultyHitObject.cs | 4 ++-- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 2 +- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 4 ++-- .../Difficulty/Preprocessing/TaikoDifficultyHitObject.cs | 5 +++-- .../Difficulty/TaikoDifficultyCalculator.cs | 2 +- .../Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs | 5 +++-- 9 files changed, 16 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index da85840171..8140ea6eaa 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty continue; if (lastObject != null) - objects.Add(new CatchDifficultyHitObject(hitObject, lastObject, clockRate, halfCatcherWidth, objects)); + objects.Add(new CatchDifficultyHitObject(hitObject, lastObject, clockRate, halfCatcherWidth, objects, objects.Count)); lastObject = hitObject; } diff --git a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs index 60d6213525..8c229cf6c5 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs @@ -25,8 +25,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing /// public readonly double StrainTime; - public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth, List objects) - : base(hitObject, lastObject, clockRate, objects) + public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth, List objects, int position) + : base(hitObject, lastObject, clockRate, objects, position) { // We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps. float scalingFactor = normalized_hitobject_radius / halfCatcherWidth; diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs index 68c2acb2ed..d1f6c2b5db 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty List objects = new List(); for (int i = 1; i < sortedObjects.Length; i++) - objects.Add(new ManiaDifficultyHitObject(sortedObjects[i], sortedObjects[i - 1], clockRate, objects)); + objects.Add(new ManiaDifficultyHitObject(sortedObjects[i], sortedObjects[i - 1], clockRate, objects, objects.Count)); return objects; } diff --git a/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs b/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs index 68f14ed128..5c9b3b9b54 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs @@ -12,8 +12,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Preprocessing { public new ManiaHitObject BaseObject => (ManiaHitObject)base.BaseObject; - public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects) - : base(hitObject, lastObject, clockRate, objects) + public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int position) + : base(hitObject, lastObject, clockRate, objects, position) { } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index da9fb2bb08..f074783ccf 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -92,7 +92,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty // The first jump is formed by the first two hitobjects of the map. // If the map has less than two OsuHitObjects, the enumerator will not return anything. for (int i = 1; i < beatmap.HitObjects.Count; i++) - objects.Add(new OsuDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate, objects)); + objects.Add(new OsuDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate, objects, objects.Count)); return objects; } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index f599d2e32d..0400dd0db1 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -75,8 +75,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing private readonly OsuHitObject lastLastObject; private readonly OsuHitObject lastObject; - public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects) - : base(hitObject, lastObject, clockRate, objects) + public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int position) + : base(hitObject, lastObject, clockRate, objects, position) { lastLastObject = (OsuHitObject)Previous(1)?.BaseObject; this.lastObject = (OsuHitObject)lastObject; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs index 6dbaab44cf..450eb63636 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs @@ -39,8 +39,9 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing /// The gameplay preceding . /// The rate of the gameplay clock. Modified by speed-changing mods. /// The list of s in the current beatmap. - public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, List objects) - : base(hitObject, lastObject, clockRate, objects) + /// /// The position of this in the list. + public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, List objects, int position) + : base(hitObject, lastObject, clockRate, objects, position) { var currentHit = hitObject as Hit; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index d6792f7227..ce5b1d2236 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty { taikoDifficultyHitObjects.Add( new TaikoDifficultyHitObject( - beatmap.HitObjects[i], beatmap.HitObjects[i - 1], beatmap.HitObjects[i - 2], clockRate, taikoDifficultyHitObjects + beatmap.HitObjects[i], beatmap.HitObjects[i - 1], beatmap.HitObjects[i - 2], clockRate, taikoDifficultyHitObjects, taikoDifficultyHitObjects.Count ) ); } diff --git a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs index e067b0bb2f..a886a0d992 100644 --- a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs +++ b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs @@ -51,10 +51,11 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing /// The last which occurs before in the beatmap. /// The rate at which the gameplay clock is run at. /// The list of s in the current beatmap. - public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects) + /// The position of this in the list. + public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int position) { difficultyHitObjects = objects; - Position = objects.Count; + Position = position; BaseObject = hitObject; LastObject = lastObject; DeltaTime = (hitObject.StartTime - lastObject.StartTime) / clockRate; From 3183621d3d20e05d65d4f6b9ea383d7cc6df3512 Mon Sep 17 00:00:00 2001 From: sw1tchbl4d3 Date: Thu, 26 May 2022 22:57:24 +0200 Subject: [PATCH 1226/2328] Add search bar for the `CurrentlyPlayingDisplay` --- .../Dashboard/CurrentlyPlayingDisplay.cs | 119 ++++++++++++++---- 1 file changed, 98 insertions(+), 21 deletions(-) diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index a9312e9a3a..1c14eee9c7 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -1,6 +1,7 @@ // 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.Collections.Specialized; using System.Diagnostics; using System.Linq; @@ -11,6 +12,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Screens; using osu.Game.Database; +using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Spectator; @@ -24,10 +27,17 @@ namespace osu.Game.Overlays.Dashboard { internal class CurrentlyPlayingDisplay : CompositeDrawable { + private const float search_bar_height = 40; + private const float search_bar_width = 250; + private readonly IBindableList playingUsers = new BindableList(); private FillFlowContainer userFlow; + private List currentUsers = new List(); + private FocusedTextBox searchBar; + private Container searchBarContainer; + [Resolved] private SpectatorClient spectatorClient { get; set; } @@ -37,13 +47,46 @@ namespace osu.Game.Overlays.Dashboard RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - InternalChild = userFlow = new FillFlowContainer + searchBarContainer = new Container + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Padding = new MarginPadding(10), + Child = searchBar = new FocusedTextBox + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Height = search_bar_height, + Width = search_bar_width, + + Colour = OsuColour.Gray(0.8f), + + PlaceholderText = "Search for User...", + HoldFocus = true, + ReleaseFocusOnCommit = true, + }, + }; + + userFlow = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding(10), + Padding = new MarginPadding { + Top = 10 + 10 + search_bar_height, + Bottom = 10, + Right = 10, + Left = 10, + }, Spacing = new Vector2(10), }; + + InternalChildren = new Drawable[] + { + searchBarContainer, + userFlow, + }; + + searchBar.Current.ValueChanged += onSearchBarValueChanged; } [Resolved] @@ -57,6 +100,57 @@ namespace osu.Game.Overlays.Dashboard playingUsers.BindCollectionChanged(onPlayingUsersChanged, true); } + private void addCard(int userId) + { + if (currentUsers.Contains(userId)) + return; + + users.GetUserAsync(userId).ContinueWith(task => + { + var user = task.GetResultSafely(); + + if (user == null) + return; + + if (!user.Username.ToLower().Contains(searchBar.Text.ToLower())) + return; + + Schedule(() => + { + // user may no longer be playing. + if (!playingUsers.Contains(user.Id)) + return; + + currentUsers.Add(user.Id); + + userFlow.Add(createUserPanel(user)); + }); + }); + } + + private void removeCard(PlayingUserPanel card) + { + if (card == null) + return; + + currentUsers.Remove(card.User.Id); + card.Expire(); + } + + private void onSearchBarValueChanged(ValueChangedEvent change) + { + foreach (PlayingUserPanel card in userFlow) + { + if (!card.User.Username.ToLower().Contains(change.NewValue.ToLower())) + removeCard(card); + } + + foreach (int userId in playingUsers) + { + addCard(userId); + } + } + private void onPlayingUsersChanged(object sender, NotifyCollectionChangedEventArgs e) => Schedule(() => { switch (e.Action) @@ -65,24 +159,7 @@ namespace osu.Game.Overlays.Dashboard Debug.Assert(e.NewItems != null); foreach (int userId in e.NewItems) - { - users.GetUserAsync(userId).ContinueWith(task => - { - var user = task.GetResultSafely(); - - if (user == null) - return; - - Schedule(() => - { - // user may no longer be playing. - if (!playingUsers.Contains(user.Id)) - return; - - userFlow.Add(createUserPanel(user)); - }); - }); - } + addCard(userId); break; @@ -90,7 +167,7 @@ namespace osu.Game.Overlays.Dashboard Debug.Assert(e.OldItems != null); foreach (int userId in e.OldItems) - userFlow.FirstOrDefault(card => card.User.Id == userId)?.Expire(); + removeCard(userFlow.FirstOrDefault(card => card.User.Id == userId)); break; } }); From de5b60ab66a6d33655e7b003c1ff21caa87867ad Mon Sep 17 00:00:00 2001 From: sw1tchbl4d3 Date: Fri, 27 May 2022 00:40:23 +0200 Subject: [PATCH 1227/2328] Move filtering from manual loops to `SearchContainer` --- .../Dashboard/CurrentlyPlayingDisplay.cs | 57 ++++++++----------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index 1c14eee9c7..7dd5c73b79 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -10,6 +10,7 @@ using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Game.Database; using osu.Game.Graphics; @@ -32,9 +33,8 @@ namespace osu.Game.Overlays.Dashboard private readonly IBindableList playingUsers = new BindableList(); - private FillFlowContainer userFlow; + private SearchContainer userFlow; - private List currentUsers = new List(); private FocusedTextBox searchBar; private Container searchBarContainer; @@ -67,7 +67,7 @@ namespace osu.Game.Overlays.Dashboard }, }; - userFlow = new FillFlowContainer + userFlow = new SearchContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -102,9 +102,6 @@ namespace osu.Game.Overlays.Dashboard private void addCard(int userId) { - if (currentUsers.Contains(userId)) - return; - users.GetUserAsync(userId).ContinueWith(task => { var user = task.GetResultSafely(); @@ -121,35 +118,12 @@ namespace osu.Game.Overlays.Dashboard if (!playingUsers.Contains(user.Id)) return; - currentUsers.Add(user.Id); - userFlow.Add(createUserPanel(user)); }); }); } - private void removeCard(PlayingUserPanel card) - { - if (card == null) - return; - - currentUsers.Remove(card.User.Id); - card.Expire(); - } - - private void onSearchBarValueChanged(ValueChangedEvent change) - { - foreach (PlayingUserPanel card in userFlow) - { - if (!card.User.Username.ToLower().Contains(change.NewValue.ToLower())) - removeCard(card); - } - - foreach (int userId in playingUsers) - { - addCard(userId); - } - } + private void onSearchBarValueChanged(ValueChangedEvent change) => userFlow.SearchTerm = searchBar.Text; private void onPlayingUsersChanged(object sender, NotifyCollectionChangedEventArgs e) => Schedule(() => { @@ -167,7 +141,7 @@ namespace osu.Game.Overlays.Dashboard Debug.Assert(e.OldItems != null); foreach (int userId in e.OldItems) - removeCard(userFlow.FirstOrDefault(card => card.User.Id == userId)); + userFlow.FirstOrDefault(card => card.User.Id == userId)?.Expire(); break; } }); @@ -179,16 +153,35 @@ namespace osu.Game.Overlays.Dashboard panel.Origin = Anchor.TopCentre; }); - private class PlayingUserPanel : CompositeDrawable + private class PlayingUserPanel : CompositeDrawable, IFilterable { public readonly APIUser User; + public IEnumerable FilterTerms => filterTerm; [Resolved(canBeNull: true)] private IPerformFromScreenRunner performer { get; set; } + private IEnumerable filterTerm; + + public bool MatchingFilter + { + set + { + if (value) + Show(); + else + Hide(); + } + } + + public bool FilteringActive + { + set { } + } public PlayingUserPanel(APIUser user) { User = user; + filterTerm = new LocalisableString[] { User.Username }; AutoSizeAxes = Axes.Both; } From a8e453e6601f495613b11ebbe42c635113cf4d8d Mon Sep 17 00:00:00 2001 From: sw1tchbl4d3 Date: Fri, 27 May 2022 00:43:29 +0200 Subject: [PATCH 1228/2328] Remove now unnecessary username filter check --- osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index 7dd5c73b79..f57c808144 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -109,9 +109,6 @@ namespace osu.Game.Overlays.Dashboard if (user == null) return; - if (!user.Username.ToLower().Contains(searchBar.Text.ToLower())) - return; - Schedule(() => { // user may no longer be playing. From 0cdefbc6df3200bbb758f99cad47d55168a9a812 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Thu, 26 May 2022 17:39:29 -0700 Subject: [PATCH 1229/2328] Add failing beatmap info status test --- .../Visual/Online/TestSceneBeatmapSetOverlay.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index 859727e632..80bb2aa2e8 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -10,6 +10,8 @@ using osu.Game.Rulesets; using System; using System.Collections.Generic; using System.Linq; +using osu.Framework.Testing; +using osu.Game.Beatmaps.Drawables; using osu.Game.Online.API.Requests.Responses; using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; @@ -101,6 +103,12 @@ namespace osu.Game.Tests.Visual.Online AddStep("show many difficulties", () => overlay.ShowBeatmapSet(createManyDifficultiesBeatmapSet())); downloadAssert(true); + + AddAssert("status is loved", () => overlay.ChildrenOfType().Single().Status == BeatmapOnlineStatus.Loved); + + AddStep("go to second beatmap", () => overlay.ChildrenOfType().ElementAt(1).TriggerClick()); + + AddAssert("status is graveyard", () => overlay.ChildrenOfType().Single().Status == BeatmapOnlineStatus.Graveyard); } [Test] @@ -232,6 +240,7 @@ namespace osu.Game.Tests.Visual.Online Fails = Enumerable.Range(1, 100).Select(j => j % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(j => j % 12 - 6).ToArray(), }, + Status = i % 2 == 0 ? BeatmapOnlineStatus.Graveyard : BeatmapOnlineStatus.Loved, }); } From 2b5aa35b56a0c23058ef9c658b4411f3d7e3ce4a Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Thu, 26 May 2022 17:39:16 -0700 Subject: [PATCH 1230/2328] Fix beatmap info status pill being incorrect on multiple status beatmaps --- osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs index 56efb725cd..e0fc7482f6 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -229,6 +230,8 @@ namespace osu.Game.Overlays.BeatmapSet { Details.BeatmapInfo = b.NewValue; externalLink.Link = $@"{api.WebsiteRootUrl}/beatmapsets/{BeatmapSet.Value?.OnlineID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineID}"; + + onlineStatusPill.Status = b.NewValue?.Status ?? BeatmapOnlineStatus.None; }; } @@ -272,7 +275,6 @@ namespace osu.Game.Overlays.BeatmapSet featuredArtist.Alpha = setInfo.NewValue.TrackId != null ? 1 : 0; onlineStatusPill.FadeIn(500, Easing.OutQuint); - onlineStatusPill.Status = setInfo.NewValue.Status; downloadButtonsContainer.FadeIn(transition_duration); favouriteButton.FadeIn(transition_duration); From 125dda716dbd42b0b2203a441c80c6eb546b893a Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Thu, 26 May 2022 19:46:42 -0700 Subject: [PATCH 1231/2328] Add failing scores container visibility test --- osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index 80bb2aa2e8..9d206af40e 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -13,6 +13,7 @@ using System.Linq; using osu.Framework.Testing; using osu.Game.Beatmaps.Drawables; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Overlays.BeatmapSet.Scores; using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tests.Visual.Online @@ -105,10 +106,12 @@ namespace osu.Game.Tests.Visual.Online downloadAssert(true); AddAssert("status is loved", () => overlay.ChildrenOfType().Single().Status == BeatmapOnlineStatus.Loved); + AddAssert("scores container is visible", () => overlay.ChildrenOfType().Single().Alpha == 1); AddStep("go to second beatmap", () => overlay.ChildrenOfType().ElementAt(1).TriggerClick()); AddAssert("status is graveyard", () => overlay.ChildrenOfType().Single().Status == BeatmapOnlineStatus.Graveyard); + AddAssert("scores container is hidden", () => overlay.ChildrenOfType().Single().Alpha == 0); } [Test] From 355456311447d46394adf2114d6118a11daf6564 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Thu, 26 May 2022 19:50:54 -0700 Subject: [PATCH 1232/2328] Fix beatmap info scores container not hiding when there's no leaderboard --- osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index 591e4cf73e..5f24a6549d 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -253,7 +253,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores noScoresPlaceholder.Hide(); - if (Beatmap.Value == null || Beatmap.Value.OnlineID <= 0 || (Beatmap.Value.BeatmapSet as IBeatmapSetOnlineInfo)?.Status <= BeatmapOnlineStatus.Pending) + if (Beatmap.Value == null || Beatmap.Value.OnlineID <= 0 || (Beatmap.Value.Status <= BeatmapOnlineStatus.Pending)) { Scores = null; Hide(); From 389020b4975636f63962e35c60049ac468ccae7f Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Thu, 26 May 2022 20:58:47 -0700 Subject: [PATCH 1233/2328] Fix scores container test failures --- osu.Game/Tests/Beatmaps/TestBeatmap.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Tests/Beatmaps/TestBeatmap.cs b/osu.Game/Tests/Beatmaps/TestBeatmap.cs index 3b4547cb49..ff670e1232 100644 --- a/osu.Game/Tests/Beatmaps/TestBeatmap.cs +++ b/osu.Game/Tests/Beatmaps/TestBeatmap.cs @@ -35,6 +35,7 @@ namespace osu.Game.Tests.Beatmaps BeatmapInfo.Length = 75000; BeatmapInfo.OnlineInfo = new APIBeatmap(); BeatmapInfo.OnlineID = Interlocked.Increment(ref onlineBeatmapID); + BeatmapInfo.Status = BeatmapOnlineStatus.Ranked; Debug.Assert(BeatmapInfo.BeatmapSet != null); From e551a536015a691297993eb5ce005c50e4d8f11a Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Thu, 26 May 2022 21:45:07 -0700 Subject: [PATCH 1234/2328] Fix checkmarks not showing on editor stateful menu items --- .../Edit/Components/Menus/EditorMenuBar.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs index 440071bc4c..20b8bba6da 100644 --- a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs +++ b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs @@ -110,11 +110,31 @@ namespace osu.Game.Screens.Edit.Components.Menus case EditorMenuItemSpacer spacer: return new DrawableSpacer(spacer); + case StatefulMenuItem stateful: + return new EditorStatefulMenuItem(stateful); + default: return new EditorMenuItem(item); } } + private class EditorStatefulMenuItem : DrawableStatefulMenuItem + { + public EditorStatefulMenuItem(StatefulMenuItem item) + : base(item) + { + } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + BackgroundColour = colourProvider.Background2; + BackgroundColourHover = colourProvider.Background1; + + Foreground.Padding = new MarginPadding { Vertical = 2 }; + } + } + private class EditorMenuItem : DrawableOsuMenuItem { public EditorMenuItem(MenuItem item) From 105d581f247ce41a9235e356104334b4c903ba46 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Thu, 26 May 2022 22:23:03 -0700 Subject: [PATCH 1235/2328] Use existing web localisation for chat strings --- osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 9 ++++++--- osu.Game/Overlays/Chat/ChatOverlayTopBar.cs | 3 ++- osu.Game/Overlays/Chat/ChatTextBar.cs | 5 +++-- osu.Game/Overlays/Chat/ChatTextBox.cs | 3 ++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 21b2251aca..ce1ed2b4d7 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -7,14 +7,17 @@ using System; using System.Linq; using System.Collections.Generic; using osu.Framework.Allocation; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; using osu.Game.Overlays.Chat.Listing; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.Chat.ChannelList { @@ -57,13 +60,13 @@ namespace osu.Game.Overlays.Chat.ChannelList AutoSizeAxes = Axes.Y, Children = new Drawable[] { - new ChannelListLabel("CHANNELS"), + new ChannelListLabel(ChatStrings.ChannelsListTitlePUBLIC.ToUpper()), publicChannelFlow = new ChannelListItemFlow(), selector = new ChannelListItem(ChannelListingChannel) { Margin = new MarginPadding { Bottom = 10 }, }, - new ChannelListLabel("DIRECT MESSAGES"), + new ChannelListLabel(ChatStrings.ChannelsListTitlePM.ToUpper()), privateChannelFlow = new ChannelListItemFlow(), }, }, @@ -126,7 +129,7 @@ namespace osu.Game.Overlays.Chat.ChannelList private class ChannelListLabel : OsuSpriteText { - public ChannelListLabel(string label) + public ChannelListLabel(LocalisableString label) { Text = label; Margin = new MarginPadding { Left = 18, Bottom = 5 }; diff --git a/osu.Game/Overlays/Chat/ChatOverlayTopBar.cs b/osu.Game/Overlays/Chat/ChatOverlayTopBar.cs index 3a8cd1fb91..79f22b51f7 100644 --- a/osu.Game/Overlays/Chat/ChatOverlayTopBar.cs +++ b/osu.Game/Overlays/Chat/ChatOverlayTopBar.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Resources.Localisation.Web; using osuTK; using osuTK.Graphics; @@ -58,7 +59,7 @@ namespace osu.Game.Overlays.Chat { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Text = "osu!chat", + Text = ChatStrings.TitleCompact, Font = OsuFont.Torus.With(size: 16, weight: FontWeight.SemiBold), Margin = new MarginPadding { Bottom = 2f }, }, diff --git a/osu.Game/Overlays/Chat/ChatTextBar.cs b/osu.Game/Overlays/Chat/ChatTextBar.cs index 404d686d91..4dc609acd1 100644 --- a/osu.Game/Overlays/Chat/ChatTextBar.cs +++ b/osu.Game/Overlays/Chat/ChatTextBar.cs @@ -14,6 +14,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; +using osu.Game.Resources.Localisation.Web; using osuTK; namespace osu.Game.Overlays.Chat @@ -141,11 +142,11 @@ namespace osu.Game.Overlays.Chat switch (newChannel?.Type) { case ChannelType.Public: - chattingText.Text = $"chatting in {newChannel.Name}"; + chattingText.Text = ChatStrings.TalkingIn(newChannel.Name); break; case ChannelType.PM: - chattingText.Text = $"chatting with {newChannel.Name}"; + chattingText.Text = ChatStrings.TalkingWith(newChannel.Name); break; default: diff --git a/osu.Game/Overlays/Chat/ChatTextBox.cs b/osu.Game/Overlays/Chat/ChatTextBox.cs index e0f949caba..1ee0e8445f 100644 --- a/osu.Game/Overlays/Chat/ChatTextBox.cs +++ b/osu.Game/Overlays/Chat/ChatTextBox.cs @@ -5,6 +5,7 @@ using osu.Framework.Bindables; using osu.Game.Graphics.UserInterface; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.Chat { @@ -22,7 +23,7 @@ namespace osu.Game.Overlays.Chat { bool showSearch = change.NewValue; - PlaceholderText = showSearch ? "type here to search" : "type here"; + PlaceholderText = showSearch ? HomeStrings.SearchPlaceholder : ChatStrings.InputPlaceholder; Text = string.Empty; }, true); } From 4967d036063f954cdd37ac33134288ebfb26a881 Mon Sep 17 00:00:00 2001 From: sw1tchbl4d3 Date: Fri, 27 May 2022 09:58:40 +0200 Subject: [PATCH 1236/2328] Update currently playing search bar to resemble existing UI --- .../Dashboard/CurrentlyPlayingDisplay.cs | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index f57c808144..b6deae27e5 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -10,6 +10,8 @@ using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Effects; +using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Game.Database; @@ -35,35 +37,42 @@ namespace osu.Game.Overlays.Dashboard private SearchContainer userFlow; - private FocusedTextBox searchBar; - private Container searchBarContainer; + private Box searchBarBackground; + private BasicSearchTextBox searchBar; + private Container searchBarContainer; [Resolved] private SpectatorClient spectatorClient { get; set; } [BackgroundDependencyLoader] - private void load() + private void load(OverlayColourProvider colourProvider) { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - searchBarContainer = new Container + searchBarBackground = new Box + { + RelativeSizeAxes = Axes.X, + Height = 10*2 + search_bar_height, + Colour = colourProvider.Background4, + }; + + searchBarContainer = new Container { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, Padding = new MarginPadding(10), - Child = searchBar = new FocusedTextBox + + Child = searchBar = new BasicSearchTextBox { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Height = search_bar_height, - Width = search_bar_width, - Colour = OsuColour.Gray(0.8f), + RelativeSizeAxes = Axes.X, - PlaceholderText = "Search for User...", - HoldFocus = true, - ReleaseFocusOnCommit = true, + PlaceholderText = "type to search", }, }; @@ -72,7 +81,7 @@ namespace osu.Game.Overlays.Dashboard RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { - Top = 10 + 10 + search_bar_height, + Top = 10*3 + search_bar_height, Bottom = 10, Right = 10, Left = 10, @@ -82,6 +91,7 @@ namespace osu.Game.Overlays.Dashboard InternalChildren = new Drawable[] { + searchBarBackground, searchBarContainer, userFlow, }; @@ -170,10 +180,7 @@ namespace osu.Game.Overlays.Dashboard } } - public bool FilteringActive - { - set { } - } + public bool FilteringActive { set; get; } public PlayingUserPanel(APIUser user) { From 7c459faaf0bd9978f44ec6b2436b08818561866b Mon Sep 17 00:00:00 2001 From: sw1tchbl4d3 Date: Fri, 27 May 2022 10:05:59 +0200 Subject: [PATCH 1237/2328] Remove unneeded search_bar_width and more --- osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index b6deae27e5..c7b08a1ffc 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -10,7 +10,6 @@ using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; using osu.Framework.Screens; @@ -30,8 +29,7 @@ namespace osu.Game.Overlays.Dashboard { internal class CurrentlyPlayingDisplay : CompositeDrawable { - private const float search_bar_height = 40; - private const float search_bar_width = 250; + private const float SEARCHBAR_HEIGHT = 40; private readonly IBindableList playingUsers = new BindableList(); @@ -53,7 +51,7 @@ namespace osu.Game.Overlays.Dashboard searchBarBackground = new Box { RelativeSizeAxes = Axes.X, - Height = 10*2 + search_bar_height, + Height = 10*2 + SEARCHBAR_HEIGHT, Colour = colourProvider.Background4, }; @@ -68,7 +66,7 @@ namespace osu.Game.Overlays.Dashboard { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Height = search_bar_height, + Height = SEARCHBAR_HEIGHT, RelativeSizeAxes = Axes.X, @@ -81,7 +79,7 @@ namespace osu.Game.Overlays.Dashboard RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { - Top = 10*3 + search_bar_height, + Top = 10*3 + SEARCHBAR_HEIGHT, Bottom = 10, Right = 10, Left = 10, From e53c8518debd9bf30961c620f7dffd4d92c450dd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 27 May 2022 19:18:37 +0900 Subject: [PATCH 1238/2328] Don't output beatmap parse failures in a visible manner The user can't do much about this. When a user reports a beatmap issue, the logs will still contain this useful information. Should be fine I think. As mentioned in https://github.com/ppy/osu/discussions/18426 https://github.com/ppy/osu/issues/750 https://github.com/ppy/osu/issues/18372 etc. --- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 0276abc3ff..ff13e61360 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -59,7 +59,7 @@ namespace osu.Game.Beatmaps.Formats } catch (Exception e) { - Logger.Log($"Failed to process line \"{line}\" into \"{output}\": {e.Message}", LoggingTarget.Runtime, LogLevel.Important); + Logger.Log($"Failed to process line \"{line}\" into \"{output}\": {e.Message}"); } } } From 6a0cf26722cfa9ab08de4f8f00156657c798afbd Mon Sep 17 00:00:00 2001 From: sw1tchbl4d3 Date: Fri, 27 May 2022 12:36:43 +0200 Subject: [PATCH 1239/2328] Make text localisable and add padding constant --- osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index c7b08a1ffc..d9418a303e 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -30,6 +30,7 @@ namespace osu.Game.Overlays.Dashboard internal class CurrentlyPlayingDisplay : CompositeDrawable { private const float SEARCHBAR_HEIGHT = 40; + private const float CONTAINER_PADDING = 10; private readonly IBindableList playingUsers = new BindableList(); @@ -51,7 +52,7 @@ namespace osu.Game.Overlays.Dashboard searchBarBackground = new Box { RelativeSizeAxes = Axes.X, - Height = 10*2 + SEARCHBAR_HEIGHT, + Height = CONTAINER_PADDING * 2 + SEARCHBAR_HEIGHT, Colour = colourProvider.Background4, }; @@ -70,7 +71,7 @@ namespace osu.Game.Overlays.Dashboard RelativeSizeAxes = Axes.X, - PlaceholderText = "type to search", + PlaceholderText = Resources.Localisation.Web.HomeStrings.SearchPlaceholder, }, }; @@ -79,7 +80,7 @@ namespace osu.Game.Overlays.Dashboard RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { - Top = 10*3 + SEARCHBAR_HEIGHT, + Top = CONTAINER_PADDING * 3 + SEARCHBAR_HEIGHT, Bottom = 10, Right = 10, Left = 10, From e1fd37fd4481a7bbee4e2bd20e4a65da943382f3 Mon Sep 17 00:00:00 2001 From: sw1tchbl4d3 Date: Fri, 27 May 2022 12:40:31 +0200 Subject: [PATCH 1240/2328] Use new padding constant where appropriate --- osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index d9418a303e..a9e9932b5b 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -61,7 +61,7 @@ namespace osu.Game.Overlays.Dashboard Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.X, - Padding = new MarginPadding(10), + Padding = new MarginPadding(CONTAINER_PADDING), Child = searchBar = new BasicSearchTextBox { @@ -81,9 +81,9 @@ namespace osu.Game.Overlays.Dashboard AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Top = CONTAINER_PADDING * 3 + SEARCHBAR_HEIGHT, - Bottom = 10, - Right = 10, - Left = 10, + Bottom = CONTAINER_PADDING, + Right = CONTAINER_PADDING, + Left = CONTAINER_PADDING, }, Spacing = new Vector2(10), }; From d94315ee3f320c4edcc562c642dabcd63ecceebd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 27 May 2022 20:03:30 +0900 Subject: [PATCH 1241/2328] Fix potential crash from unsafe drawable mutation in scoreboard update code --- .../Screens/OnlinePlay/Match/Components/MatchLeaderboard.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboard.cs b/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboard.cs index ea7de917e2..b92c197f5a 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboard.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboard.cs @@ -38,13 +38,13 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components var req = new GetRoomLeaderboardRequest(roomId.Value ?? 0); - req.Success += r => + req.Success += r => Schedule(() => { if (cancellationToken.IsCancellationRequested) return; SetScores(r.Leaderboard, r.UserScore); - }; + }); return req; } From ef47b380c602095a3d635017adb106b294f21e54 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 27 May 2022 20:18:46 +0900 Subject: [PATCH 1242/2328] Add featured artist playlist category --- .../Visual/Multiplayer/TestSceneDrawableRoom.cs | 6 ++++++ osu.Game/Online/Rooms/RoomCategory.cs | 5 +++++ .../OnlinePlay/Lounge/Components/DrawableRoom.cs | 2 +- .../OnlinePlay/Lounge/Components/RoomsContainer.cs | 2 +- .../OnlinePlay/Playlists/PlaylistsLoungeSubScreen.cs | 10 +++++++++- 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs index 7d010592ae..7c1620a345 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs @@ -124,6 +124,12 @@ namespace osu.Game.Tests.Visual.Multiplayer Status = { Value = new RoomStatusOpen() }, Category = { Value = RoomCategory.Spotlight }, }), + createLoungeRoom(new Room + { + Name = { Value = "Featured artist room" }, + Status = { Value = new RoomStatusOpen() }, + Category = { Value = RoomCategory.FeaturedArtist }, + }), } }; }); diff --git a/osu.Game/Online/Rooms/RoomCategory.cs b/osu.Game/Online/Rooms/RoomCategory.cs index a1dcfa5fd9..bca4d78359 100644 --- a/osu.Game/Online/Rooms/RoomCategory.cs +++ b/osu.Game/Online/Rooms/RoomCategory.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.ComponentModel; + namespace osu.Game.Online.Rooms { public enum RoomCategory @@ -8,5 +10,8 @@ namespace osu.Game.Online.Rooms // used for osu-web deserialization so names shouldn't be changed. Normal, Spotlight, + + [Description("Featured Artist")] + FeaturedArtist, } } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs index 8e3aa77e7b..772232f6b4 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs @@ -237,7 +237,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components roomCategory.BindTo(Room.Category); roomCategory.BindValueChanged(c => { - if (c.NewValue == RoomCategory.Spotlight) + if (c.NewValue > RoomCategory.Normal) specialCategoryPill.Show(); else specialCategoryPill.Hide(); diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs index d61fbea387..0fd9290880 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs @@ -128,7 +128,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components { foreach (var room in roomFlow) { - roomFlow.SetLayoutPosition(room, room.Room.Category.Value == RoomCategory.Spotlight + roomFlow.SetLayoutPosition(room, room.Room.Category.Value > RoomCategory.Normal // Always show spotlight playlists at the top of the listing. ? float.MinValue : -(room.Room.RoomID.Value ?? 0)); diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsLoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsLoungeSubScreen.cs index dced9b8691..b36e162e3d 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsLoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsLoungeSubScreen.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -49,6 +50,10 @@ namespace osu.Game.Screens.OnlinePlay.Playlists case PlaylistsCategory.Spotlight: criteria.Category = @"spotlight"; break; + + case PlaylistsCategory.FeaturedArtist: + criteria.Category = @"featured_artist"; + break; } return criteria; @@ -73,7 +78,10 @@ namespace osu.Game.Screens.OnlinePlay.Playlists { Any, Normal, - Spotlight + Spotlight, + + [Description("Featured Artist")] + FeaturedArtist, } } } From 883c6f1eb30f460790d4d74fbe16e96f08e866e6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 27 May 2022 20:19:03 +0900 Subject: [PATCH 1243/2328] Update colour of spotlights playlist to match new specs --- .../Components/RoomSpecialCategoryPill.cs | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs index 6cdbeb2af4..00e4fbf5eb 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs @@ -2,10 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Online.Rooms; using osuTK.Graphics; namespace osu.Game.Screens.OnlinePlay.Lounge.Components @@ -13,6 +15,10 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components public class RoomSpecialCategoryPill : OnlinePlayComposite { private SpriteText text; + private PillContainer pill; + + [Resolved] + private OsuColour colours { get; set; } public RoomSpecialCategoryPill() { @@ -20,9 +26,9 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load() { - InternalChild = new PillContainer + InternalChild = pill = new PillContainer { Background = { @@ -43,7 +49,21 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components { base.LoadComplete(); - Category.BindValueChanged(c => text.Text = c.NewValue.ToString(), true); + Category.BindValueChanged(c => + { + text.Text = c.NewValue.GetLocalisableDescription(); + + switch (c.NewValue) + { + case RoomCategory.Spotlight: + pill.Background.Colour = colours.Green2; + break; + + case RoomCategory.FeaturedArtist: + pill.Background.Colour = colours.Blue2; + break; + } + }, true); } } } From 2f57849bcba348d5eeb24c731d30234d465cab1a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 27 May 2022 20:58:13 +0900 Subject: [PATCH 1244/2328] Fix unexpected assertion failure --- osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs index 7c1620a345..3172a68b81 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs @@ -134,9 +134,9 @@ namespace osu.Game.Tests.Visual.Multiplayer }; }); - AddUntilStep("wait for panel load", () => rooms.Count == 5); + AddUntilStep("wait for panel load", () => rooms.Count == 6); AddUntilStep("correct status text", () => rooms.ChildrenOfType().Count(s => s.Text.ToString().StartsWith("Currently playing", StringComparison.Ordinal)) == 2); - AddUntilStep("correct status text", () => rooms.ChildrenOfType().Count(s => s.Text.ToString().StartsWith("Ready to play", StringComparison.Ordinal)) == 3); + AddUntilStep("correct status text", () => rooms.ChildrenOfType().Count(s => s.Text.ToString().StartsWith("Ready to play", StringComparison.Ordinal)) == 4); } [Test] From d9ecf69d208e8754cec9dae644a827180e473722 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 27 May 2022 23:29:39 +0900 Subject: [PATCH 1245/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index aaea784852..c51919894e 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5bc65ca507..8cf530ea3c 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 3597e7e5c0..79bd6bed9e 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 6960bec52d8824a086e96823c49a6a9f571a07c1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 27 May 2022 23:29:48 +0900 Subject: [PATCH 1246/2328] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index d5a77c6349..5688fd8cc4 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 32a0adb859..5de0f4346c 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 112b5b4615..c1a473ff75 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -62,7 +62,7 @@ - + From e2951d70d1eac5ee0f2291c2192ac9d8f8598269 Mon Sep 17 00:00:00 2001 From: sw1tchbl4d3 Date: Fri, 27 May 2022 16:38:54 +0200 Subject: [PATCH 1247/2328] Address code style issues --- .../TestSceneCurrentlyPlayingDisplay.cs | 4 +- .../Dashboard/CurrentlyPlayingDisplay.cs | 143 ++++++++---------- 2 files changed, 68 insertions(+), 79 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneCurrentlyPlayingDisplay.cs b/osu.Game.Tests/Visual/Online/TestSceneCurrentlyPlayingDisplay.cs index 35a4f8cf2d..edee26c081 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneCurrentlyPlayingDisplay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneCurrentlyPlayingDisplay.cs @@ -11,6 +11,7 @@ using osu.Framework.Testing; using osu.Game.Database; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Spectator; +using osu.Game.Overlays; using osu.Game.Overlays.Dashboard; using osu.Game.Tests.Visual.Spectator; using osu.Game.Users; @@ -42,7 +43,8 @@ namespace osu.Game.Tests.Visual.Online CachedDependencies = new (Type, object)[] { (typeof(SpectatorClient), spectatorClient), - (typeof(UserLookupCache), lookupCache) + (typeof(UserLookupCache), lookupCache), + (typeof(OverlayColourProvider), new OverlayColourProvider(OverlayColourScheme.Purple)), }, Child = currentlyPlaying = new CurrentlyPlayingDisplay { diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index a9e9932b5b..3020b37351 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -14,7 +14,6 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Game.Database; -using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; @@ -29,16 +28,13 @@ namespace osu.Game.Overlays.Dashboard { internal class CurrentlyPlayingDisplay : CompositeDrawable { - private const float SEARCHBAR_HEIGHT = 40; - private const float CONTAINER_PADDING = 10; + private const float searchbox_height = 40f; + private const float container_padding = 10f; private readonly IBindableList playingUsers = new BindableList(); private SearchContainer userFlow; - - private Box searchBarBackground; - private BasicSearchTextBox searchBar; - private Container searchBarContainer; + private BasicSearchTextBox userFlowSearchTextBox; [Resolved] private SpectatorClient spectatorClient { get; set; } @@ -49,53 +45,48 @@ namespace osu.Game.Overlays.Dashboard RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - searchBarBackground = new Box - { - RelativeSizeAxes = Axes.X, - Height = CONTAINER_PADDING * 2 + SEARCHBAR_HEIGHT, - Colour = colourProvider.Background4, - }; - - searchBarContainer = new Container - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - Padding = new MarginPadding(CONTAINER_PADDING), - - Child = searchBar = new BasicSearchTextBox - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Height = SEARCHBAR_HEIGHT, - - RelativeSizeAxes = Axes.X, - - PlaceholderText = Resources.Localisation.Web.HomeStrings.SearchPlaceholder, - }, - }; - - userFlow = new SearchContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { - Top = CONTAINER_PADDING * 3 + SEARCHBAR_HEIGHT, - Bottom = CONTAINER_PADDING, - Right = CONTAINER_PADDING, - Left = CONTAINER_PADDING, - }, - Spacing = new Vector2(10), - }; - InternalChildren = new Drawable[] { - searchBarBackground, - searchBarContainer, - userFlow, + new Box + { + RelativeSizeAxes = Axes.X, + Height = container_padding * 2 + searchbox_height, + Colour = colourProvider.Background4, + }, + + new Container + { + RelativeSizeAxes = Axes.X, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Padding = new MarginPadding(container_padding), + + Child = userFlowSearchTextBox = new BasicSearchTextBox + { + RelativeSizeAxes = Axes.X, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Height = searchbox_height, + PlaceholderText = Resources.Localisation.Web.HomeStrings.SearchPlaceholder, + }, + }, + + userFlow = new SearchContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding + { + Top = container_padding * 3 + searchbox_height, + Bottom = container_padding, + Right = container_padding, + Left = container_padding, + }, + Spacing = new Vector2(10), + }, }; - searchBar.Current.ValueChanged += onSearchBarValueChanged; + userFlowSearchTextBox.Current.ValueChanged += onSearchBarValueChanged; } [Resolved] @@ -109,27 +100,7 @@ namespace osu.Game.Overlays.Dashboard playingUsers.BindCollectionChanged(onPlayingUsersChanged, true); } - private void addCard(int userId) - { - users.GetUserAsync(userId).ContinueWith(task => - { - var user = task.GetResultSafely(); - - if (user == null) - return; - - Schedule(() => - { - // user may no longer be playing. - if (!playingUsers.Contains(user.Id)) - return; - - userFlow.Add(createUserPanel(user)); - }); - }); - } - - private void onSearchBarValueChanged(ValueChangedEvent change) => userFlow.SearchTerm = searchBar.Text; + private void onSearchBarValueChanged(ValueChangedEvent change) => userFlow.SearchTerm = userFlowSearchTextBox.Text; private void onPlayingUsersChanged(object sender, NotifyCollectionChangedEventArgs e) => Schedule(() => { @@ -139,7 +110,24 @@ namespace osu.Game.Overlays.Dashboard Debug.Assert(e.NewItems != null); foreach (int userId in e.NewItems) - addCard(userId); + { + users.GetUserAsync(userId).ContinueWith(task => + { + var user = task.GetResultSafely(); + + if (user == null) + return; + + Schedule(() => + { + // user may no longer be playing. + if (!playingUsers.Contains(user.Id)) + return; + + userFlow.Add(createUserPanel(user)); + }); + }); + } break; @@ -159,14 +147,15 @@ namespace osu.Game.Overlays.Dashboard panel.Origin = Anchor.TopCentre; }); - private class PlayingUserPanel : CompositeDrawable, IFilterable + public class PlayingUserPanel : CompositeDrawable, IFilterable { public readonly APIUser User; - public IEnumerable FilterTerms => filterTerm; + public IEnumerable FilterTerms { get; set; } [Resolved(canBeNull: true)] private IPerformFromScreenRunner performer { get; set; } - private IEnumerable filterTerm; + + public bool FilteringActive { set; get; } public bool MatchingFilter { @@ -179,12 +168,10 @@ namespace osu.Game.Overlays.Dashboard } } - public bool FilteringActive { set; get; } - public PlayingUserPanel(APIUser user) { User = user; - filterTerm = new LocalisableString[] { User.Username }; + FilterTerms = new LocalisableString[] { User.Username }; AutoSizeAxes = Axes.Both; } From a94432f3bd743ec4c98f8d45a2e095f6f5f85e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 27 May 2022 16:40:15 +0200 Subject: [PATCH 1248/2328] Fix drawable room border colour not matching badge --- osu.Game/Graphics/OsuColour.cs | 19 +++++++++++++++++++ .../Components/StatusColouredContainer.cs | 3 +-- .../Components/RoomSpecialCategoryPill.cs | 14 +++----------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index afedf36cad..7a6a677940 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -4,6 +4,7 @@ using System; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Beatmaps; +using osu.Game.Online.Rooms; using osu.Game.Overlays; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; @@ -188,6 +189,24 @@ namespace osu.Game.Graphics } } + /// + /// Retrieves the main accent colour for a . + /// + public Color4? ForRoomCategory(RoomCategory roomCategory) + { + switch (roomCategory) + { + case RoomCategory.Spotlight: + return Green2; + + case RoomCategory.FeaturedArtist: + return Blue2; + + default: + return null; + } + } + /// /// Returns a foreground text colour that is supposed to contrast well with /// the supplied . diff --git a/osu.Game/Screens/OnlinePlay/Components/StatusColouredContainer.cs b/osu.Game/Screens/OnlinePlay/Components/StatusColouredContainer.cs index 760de354dc..a7ea32ee7c 100644 --- a/osu.Game/Screens/OnlinePlay/Components/StatusColouredContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Components/StatusColouredContainer.cs @@ -30,8 +30,7 @@ namespace osu.Game.Screens.OnlinePlay.Components { status.BindValueChanged(s => { - this.FadeColour(category.Value == RoomCategory.Spotlight ? colours.Pink : s.NewValue.GetAppropriateColour(colours) - , transitionDuration); + this.FadeColour(colours.ForRoomCategory(category.Value) ?? s.NewValue.GetAppropriateColour(colours), transitionDuration); }, true); } } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs index 00e4fbf5eb..539af2ebaf 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Online.Rooms; using osuTK.Graphics; namespace osu.Game.Screens.OnlinePlay.Lounge.Components @@ -53,16 +52,9 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components { text.Text = c.NewValue.GetLocalisableDescription(); - switch (c.NewValue) - { - case RoomCategory.Spotlight: - pill.Background.Colour = colours.Green2; - break; - - case RoomCategory.FeaturedArtist: - pill.Background.Colour = colours.Blue2; - break; - } + var backgroundColour = colours.ForRoomCategory(Category.Value); + if (backgroundColour != null) + pill.Background.Colour = backgroundColour.Value; }, true); } } From 320b6ca6317139acb9b75df645c4bf4722266c9d Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Fri, 27 May 2022 16:06:23 +0100 Subject: [PATCH 1249/2328] Display Announce type channels separately in new chat overlay --- .../Visual/Online/TestSceneChannelList.cs | 19 +++++++++- .../Visual/Online/TestSceneChatOverlayV2.cs | 16 +++++++++ .../Overlays/Chat/ChannelList/ChannelList.cs | 36 +++++++++++++++---- osu.Game/Overlays/Chat/ChatTextBar.cs | 6 ++-- 4 files changed, 66 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs index e4bc5645b6..39a4f1a8a1 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs @@ -87,7 +87,7 @@ namespace osu.Game.Tests.Visual.Online { leaveText.Text = $"OnRequestLeave: {channel.Name}"; leaveText.FadeOutFromOne(1000, Easing.InQuint); - selected.Value = null; + selected.Value = channelList.ChannelListingChannel; channelList.RemoveChannel(channel); }; @@ -112,6 +112,12 @@ namespace osu.Game.Tests.Visual.Online for (int i = 0; i < 10; i++) channelList.AddChannel(createRandomPrivateChannel()); }); + + AddStep("Add Announce Channels", () => + { + for (int i = 0; i < 2; i++) + channelList.AddChannel(createRandomAnnounceChannel()); + }); } [Test] @@ -170,5 +176,16 @@ namespace osu.Game.Tests.Visual.Online Username = $"test user {id}", }); } + + private Channel createRandomAnnounceChannel() + { + int id = RNG.Next(0, 10000); + return new Channel + { + Name = $"Announce {id}", + Type = ChannelType.Announce, + Id = id, + }; + } } } diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 0580d20171..ed6e2bb2c0 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -452,6 +452,7 @@ namespace osu.Game.Tests.Visual.Online [Test] public void TestKeyboardNextChannel() { + Channel announceChannel = createAnnounceChannel(); Channel pmChannel1 = createPrivateChannel(); Channel pmChannel2 = createPrivateChannel(); @@ -461,6 +462,7 @@ namespace osu.Game.Tests.Visual.Online channelManager.JoinChannel(testChannel2); channelManager.JoinChannel(pmChannel1); channelManager.JoinChannel(pmChannel2); + channelManager.JoinChannel(announceChannel); chatOverlay.Show(); }); @@ -475,6 +477,9 @@ namespace osu.Game.Tests.Visual.Online AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext)); AddAssert("PM Channel 2 displayed", () => channelIsVisible && currentDrawableChannel.Channel == pmChannel2); + AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext)); + AddAssert("Announce channel displayed", () => channelIsVisible && currentDrawableChannel.Channel == announceChannel); + AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext)); AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); } @@ -539,6 +544,17 @@ namespace osu.Game.Tests.Visual.Online }); } + private Channel createAnnounceChannel() + { + int id = RNG.Next(0, 10000); + return new Channel + { + Name = $"Announce {id}", + Type = ChannelType.Announce, + Id = id, + }; + } + private class TestChatOverlayV2 : ChatOverlayV2 { public bool SlowLoading { get; set; } diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index ce1ed2b4d7..881491d2af 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -26,13 +26,16 @@ namespace osu.Game.Overlays.Chat.ChannelList public Action? OnRequestSelect; public Action? OnRequestLeave; - public IEnumerable Channels => publicChannelFlow.Channels.Concat(privateChannelFlow.Channels); + public IEnumerable Channels => + announceChannelFlow.Channels.Concat(publicChannelFlow.Channels).Concat(privateChannelFlow.Channels); public readonly ChannelListing.ChannelListingChannel ChannelListingChannel = new ChannelListing.ChannelListingChannel(); private readonly Dictionary channelMap = new Dictionary(); private OsuScrollContainer scroll = null!; + private ChannelListLabel announceChannelLabel = null!; + private ChannelListItemFlow announceChannelFlow = null!; private ChannelListItemFlow publicChannelFlow = null!; private ChannelListItemFlow privateChannelFlow = null!; private ChannelListItem selector = null!; @@ -49,7 +52,6 @@ namespace osu.Game.Overlays.Chat.ChannelList }, scroll = new OsuScrollContainer { - Padding = new MarginPadding { Vertical = 7 }, RelativeSizeAxes = Axes.Both, ScrollbarAnchor = Anchor.TopRight, ScrollDistance = 35f, @@ -60,12 +62,11 @@ namespace osu.Game.Overlays.Chat.ChannelList AutoSizeAxes = Axes.Y, Children = new Drawable[] { + announceChannelLabel = new ChannelListLabel(ChatStrings.ChannelsListTitleANNOUNCE.ToUpper()), + announceChannelFlow = new ChannelListItemFlow(), new ChannelListLabel(ChatStrings.ChannelsListTitlePUBLIC.ToUpper()), publicChannelFlow = new ChannelListItemFlow(), - selector = new ChannelListItem(ChannelListingChannel) - { - Margin = new MarginPadding { Bottom = 10 }, - }, + selector = new ChannelListItem(ChannelListingChannel), new ChannelListLabel(ChatStrings.ChannelsListTitlePM.ToUpper()), privateChannelFlow = new ChannelListItemFlow(), }, @@ -88,6 +89,8 @@ namespace osu.Game.Overlays.Chat.ChannelList ChannelListItemFlow flow = getFlowForChannel(channel); channelMap.Add(channel, item); flow.Add(item); + + updateVisibility(); } public void RemoveChannel(Channel channel) @@ -100,6 +103,8 @@ namespace osu.Game.Overlays.Chat.ChannelList channelMap.Remove(channel); flow.Remove(item); + + updateVisibility(); } public ChannelListItem GetItem(Channel channel) @@ -122,17 +127,34 @@ namespace osu.Game.Overlays.Chat.ChannelList case ChannelType.PM: return privateChannelFlow; + case ChannelType.Announce: + return announceChannelFlow; + default: return publicChannelFlow; } } + private void updateVisibility() + { + if (announceChannelFlow.Channels.Count() == 0) + { + announceChannelLabel.Hide(); + announceChannelFlow.Hide(); + } + else + { + announceChannelLabel.Show(); + announceChannelFlow.Show(); + } + } + private class ChannelListLabel : OsuSpriteText { public ChannelListLabel(LocalisableString label) { Text = label; - Margin = new MarginPadding { Left = 18, Bottom = 5 }; + Margin = new MarginPadding { Left = 18, Bottom = 5, Top = 8 }; Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold); } } diff --git a/osu.Game/Overlays/Chat/ChatTextBar.cs b/osu.Game/Overlays/Chat/ChatTextBar.cs index 4dc609acd1..5100959eeb 100644 --- a/osu.Game/Overlays/Chat/ChatTextBar.cs +++ b/osu.Game/Overlays/Chat/ChatTextBar.cs @@ -141,8 +141,8 @@ namespace osu.Game.Overlays.Chat switch (newChannel?.Type) { - case ChannelType.Public: - chattingText.Text = ChatStrings.TalkingIn(newChannel.Name); + case null: + chattingText.Text = string.Empty; break; case ChannelType.PM: @@ -150,7 +150,7 @@ namespace osu.Game.Overlays.Chat break; default: - chattingText.Text = string.Empty; + chattingText.Text = ChatStrings.TalkingIn(newChannel.Name); break; } }, true); From e950c8c1d032ac0aaae54cb35baab53a834e0acd Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Fri, 27 May 2022 19:46:53 +0100 Subject: [PATCH 1250/2328] Refactor `ChannelList` to use new `ChannelGroup` class for each type of channel --- .../Overlays/Chat/ChannelList/ChannelList.cs | 84 ++++++++++--------- 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 881491d2af..a46ae98dfa 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -26,18 +26,20 @@ namespace osu.Game.Overlays.Chat.ChannelList public Action? OnRequestSelect; public Action? OnRequestLeave; - public IEnumerable Channels => - announceChannelFlow.Channels.Concat(publicChannelFlow.Channels).Concat(privateChannelFlow.Channels); + public IEnumerable Channels => groupFlow.Children.Where(child => child is ChannelGroup) + .Cast() + .SelectMany(channelGroup => channelGroup.ItemFlow) + .Select(item => item.Channel); public readonly ChannelListing.ChannelListingChannel ChannelListingChannel = new ChannelListing.ChannelListingChannel(); private readonly Dictionary channelMap = new Dictionary(); private OsuScrollContainer scroll = null!; - private ChannelListLabel announceChannelLabel = null!; - private ChannelListItemFlow announceChannelFlow = null!; - private ChannelListItemFlow publicChannelFlow = null!; - private ChannelListItemFlow privateChannelFlow = null!; + private FillFlowContainer groupFlow = null!; + private ChannelGroup announceChannelGroup = null!; + private ChannelGroup publicChannelGroup = null!; + private ChannelGroup privateChannelGroup = null!; private ChannelListItem selector = null!; [BackgroundDependencyLoader] @@ -55,20 +57,17 @@ namespace osu.Game.Overlays.Chat.ChannelList RelativeSizeAxes = Axes.Both, ScrollbarAnchor = Anchor.TopRight, ScrollDistance = 35f, - Child = new FillFlowContainer + Child = groupFlow = new FillFlowContainer { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new Drawable[] { - announceChannelLabel = new ChannelListLabel(ChatStrings.ChannelsListTitleANNOUNCE.ToUpper()), - announceChannelFlow = new ChannelListItemFlow(), - new ChannelListLabel(ChatStrings.ChannelsListTitlePUBLIC.ToUpper()), - publicChannelFlow = new ChannelListItemFlow(), + announceChannelGroup = new ChannelGroup(ChatStrings.ChannelsListTitleANNOUNCE.ToUpper()), + publicChannelGroup = new ChannelGroup(ChatStrings.ChannelsListTitlePUBLIC.ToUpper()), selector = new ChannelListItem(ChannelListingChannel), - new ChannelListLabel(ChatStrings.ChannelsListTitlePM.ToUpper()), - privateChannelFlow = new ChannelListItemFlow(), + privateChannelGroup = new ChannelGroup(ChatStrings.ChannelsListTitlePM.ToUpper()), }, }, }, @@ -86,7 +85,7 @@ namespace osu.Game.Overlays.Chat.ChannelList item.OnRequestSelect += chan => OnRequestSelect?.Invoke(chan); item.OnRequestLeave += chan => OnRequestLeave?.Invoke(chan); - ChannelListItemFlow flow = getFlowForChannel(channel); + FillFlowContainer flow = getFlowForChannel(channel); channelMap.Add(channel, item); flow.Add(item); @@ -99,7 +98,7 @@ namespace osu.Game.Overlays.Chat.ChannelList return; ChannelListItem item = channelMap[channel]; - ChannelListItemFlow flow = getFlowForChannel(channel); + FillFlowContainer flow = getFlowForChannel(channel); channelMap.Remove(channel); flow.Remove(item); @@ -117,57 +116,60 @@ namespace osu.Game.Overlays.Chat.ChannelList public void ScrollChannelIntoView(Channel channel) => scroll.ScrollIntoView(GetItem(channel)); - private ChannelListItemFlow getFlowForChannel(Channel channel) + private FillFlowContainer getFlowForChannel(Channel channel) { switch (channel.Type) { case ChannelType.Public: - return publicChannelFlow; + return publicChannelGroup.ItemFlow; case ChannelType.PM: - return privateChannelFlow; + return privateChannelGroup.ItemFlow; case ChannelType.Announce: - return announceChannelFlow; + return announceChannelGroup.ItemFlow; default: - return publicChannelFlow; + return publicChannelGroup.ItemFlow; } } private void updateVisibility() { - if (announceChannelFlow.Channels.Count() == 0) - { - announceChannelLabel.Hide(); - announceChannelFlow.Hide(); - } + if (announceChannelGroup.ItemFlow.Children.Count == 0) + announceChannelGroup.Hide(); else - { - announceChannelLabel.Show(); - announceChannelFlow.Show(); - } + announceChannelGroup.Show(); } - private class ChannelListLabel : OsuSpriteText + private class ChannelGroup : FillFlowContainer { - public ChannelListLabel(LocalisableString label) - { - Text = label; - Margin = new MarginPadding { Left = 18, Bottom = 5, Top = 8 }; - Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold); - } - } + public FillFlowContainer ItemFlow => flow; - private class ChannelListItemFlow : FillFlowContainer - { - public IEnumerable Channels => Children.Select(c => c.Channel); + private readonly FillFlowContainer flow; - public ChannelListItemFlow() + public ChannelGroup(LocalisableString label) { Direction = FillDirection.Vertical; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; + Padding = new MarginPadding { Top = 8 }; + + Children = new Drawable[] + { + new OsuSpriteText + { + Text = label, + Margin = new MarginPadding { Left = 18, Bottom = 5 }, + Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold), + }, + flow = new FillFlowContainer + { + Direction = FillDirection.Vertical, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + }, + }; } } } From 254039b8fe9fa21ae584663b792aa7b81d650a29 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 28 May 2022 04:01:51 +0900 Subject: [PATCH 1251/2328] Address remaining code quality concerns --- .../Dashboard/CurrentlyPlayingDisplay.cs | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index 3020b37351..0a1cf5524f 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -18,6 +18,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Spectator; +using osu.Game.Resources.Localisation.Web; using osu.Game.Screens; using osu.Game.Screens.OnlinePlay.Match.Components; using osu.Game.Screens.Play; @@ -28,13 +29,13 @@ namespace osu.Game.Overlays.Dashboard { internal class CurrentlyPlayingDisplay : CompositeDrawable { - private const float searchbox_height = 40f; - private const float container_padding = 10f; + private const float search_textbox_height = 40; + private const float padding = 10; private readonly IBindableList playingUsers = new BindableList(); private SearchContainer userFlow; - private BasicSearchTextBox userFlowSearchTextBox; + private BasicSearchTextBox searchTextBox; [Resolved] private SpectatorClient spectatorClient { get; set; } @@ -50,43 +51,38 @@ namespace osu.Game.Overlays.Dashboard new Box { RelativeSizeAxes = Axes.X, - Height = container_padding * 2 + searchbox_height, + Height = padding * 2 + search_textbox_height, Colour = colourProvider.Background4, }, - new Container { RelativeSizeAxes = Axes.X, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Padding = new MarginPadding(container_padding), - - Child = userFlowSearchTextBox = new BasicSearchTextBox + Padding = new MarginPadding(padding), + Child = searchTextBox = new BasicSearchTextBox { RelativeSizeAxes = Axes.X, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Height = searchbox_height, - PlaceholderText = Resources.Localisation.Web.HomeStrings.SearchPlaceholder, + Height = search_textbox_height, + PlaceholderText = HomeStrings.SearchPlaceholder, }, }, - userFlow = new SearchContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + Spacing = new Vector2(10), Padding = new MarginPadding { - Top = container_padding * 3 + searchbox_height, - Bottom = container_padding, - Right = container_padding, - Left = container_padding, + Top = padding * 3 + search_textbox_height, + Bottom = padding, + Right = padding, + Left = padding, }, - Spacing = new Vector2(10), }, }; - userFlowSearchTextBox.Current.ValueChanged += onSearchBarValueChanged; + searchTextBox.Current.ValueChanged += text => userFlow.SearchTerm = text.NewValue; } [Resolved] @@ -100,8 +96,6 @@ namespace osu.Game.Overlays.Dashboard playingUsers.BindCollectionChanged(onPlayingUsersChanged, true); } - private void onSearchBarValueChanged(ValueChangedEvent change) => userFlow.SearchTerm = userFlowSearchTextBox.Text; - private void onPlayingUsersChanged(object sender, NotifyCollectionChangedEventArgs e) => Schedule(() => { switch (e.Action) @@ -150,7 +144,8 @@ namespace osu.Game.Overlays.Dashboard public class PlayingUserPanel : CompositeDrawable, IFilterable { public readonly APIUser User; - public IEnumerable FilterTerms { get; set; } + + public IEnumerable FilterTerms { get; } [Resolved(canBeNull: true)] private IPerformFromScreenRunner performer { get; set; } @@ -171,6 +166,7 @@ namespace osu.Game.Overlays.Dashboard public PlayingUserPanel(APIUser user) { User = user; + FilterTerms = new LocalisableString[] { User.Username }; AutoSizeAxes = Axes.Both; From 5eb16ff46c604417f4249eb4c7ebe03cd4d74b4a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 28 May 2022 04:02:35 +0900 Subject: [PATCH 1252/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 96a99cfdd2..ecc929a66d 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 1ae8275444..950d4ceae1 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 0a3bfa7ae8..bcff0d3c44 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From c5845f307a7cac07a13f39b52ef9ac71fd7e261c Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Fri, 27 May 2022 20:12:00 +0100 Subject: [PATCH 1253/2328] Code quality --- osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index a46ae98dfa..0f3d8574c1 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -27,9 +27,9 @@ namespace osu.Game.Overlays.Chat.ChannelList public Action? OnRequestLeave; public IEnumerable Channels => groupFlow.Children.Where(child => child is ChannelGroup) - .Cast() - .SelectMany(channelGroup => channelGroup.ItemFlow) - .Select(item => item.Channel); + .Cast() + .SelectMany(channelGroup => channelGroup.ItemFlow) + .Select(item => item.Channel); public readonly ChannelListing.ChannelListingChannel ChannelListingChannel = new ChannelListing.ChannelListingChannel(); @@ -144,9 +144,7 @@ namespace osu.Game.Overlays.Chat.ChannelList private class ChannelGroup : FillFlowContainer { - public FillFlowContainer ItemFlow => flow; - - private readonly FillFlowContainer flow; + public readonly FillFlowContainer ItemFlow; public ChannelGroup(LocalisableString label) { @@ -163,7 +161,7 @@ namespace osu.Game.Overlays.Chat.ChannelList Margin = new MarginPadding { Left = 18, Bottom = 5 }, Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold), }, - flow = new FillFlowContainer + ItemFlow = new FillFlowContainer { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, From cd84200ad9486ad9b4f1e62941244750a1dc593b Mon Sep 17 00:00:00 2001 From: sw1tchbl4d3 Date: Fri, 27 May 2022 21:23:37 +0200 Subject: [PATCH 1254/2328] Add HoldFocus and ReleaseFocusOnCommit attributes to searchbar --- osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index 0a1cf5524f..c8c53ec507 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -64,6 +64,8 @@ namespace osu.Game.Overlays.Dashboard Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Height = search_textbox_height, + ReleaseFocusOnCommit = false, + HoldFocus = true, PlaceholderText = HomeStrings.SearchPlaceholder, }, }, From 06832a4baf0cb8f6804aa31fcb4d540769be45e4 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 28 May 2022 01:05:07 +0300 Subject: [PATCH 1255/2328] Fix beatmap badge colours not updated inline with recent changes --- osu.Game/Graphics/OsuColour.cs | 7 +++++-- osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs | 2 +- osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index 7a6a677940..7fd94b57f3 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -197,10 +197,10 @@ namespace osu.Game.Graphics switch (roomCategory) { case RoomCategory.Spotlight: - return Green2; + return SpotlightColour; case RoomCategory.FeaturedArtist: - return Blue2; + return FeaturedArtistColour; default: return null; @@ -379,5 +379,8 @@ namespace osu.Game.Graphics public readonly Color4 ChatBlue = Color4Extensions.FromHex(@"17292e"); public readonly Color4 ContextMenuGray = Color4Extensions.FromHex(@"223034"); + + public Color4 SpotlightColour => Green2; + public Color4 FeaturedArtistColour => Blue2; } } diff --git a/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs b/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs index 4f336d85fc..20ee11c7f6 100644 --- a/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs +++ b/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.BeatmapSet private void load(OsuColour colours) { BadgeText = BeatmapsetsStrings.FeaturedArtistBadgeLabel; - BadgeColour = colours.Blue1; + BadgeColour = colours.FeaturedArtistColour; // todo: add linking support to allow redirecting featured artist badge to corresponding track. } } diff --git a/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs b/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs index 3204f79b21..9c5378a967 100644 --- a/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs +++ b/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.BeatmapSet private void load(OsuColour colours) { BadgeText = BeatmapsetsStrings.SpotlightBadgeLabel; - BadgeColour = colours.Pink1; + BadgeColour = colours.SpotlightColour; // todo: add linking support to allow redirecting spotlight badge to https://osu.ppy.sh/wiki/en/Beatmap_Spotlights. } } From aee3e2a4ed0c66f5e5ec2257d2ac11e9cbbcb950 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 28 May 2022 01:58:17 +0300 Subject: [PATCH 1256/2328] Add shadow effect to editor's bottom bar --- osu.Game/Screens/Edit/BottomBar.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game/Screens/Edit/BottomBar.cs b/osu.Game/Screens/Edit/BottomBar.cs index 5994184c11..62caaced89 100644 --- a/osu.Game/Screens/Edit/BottomBar.cs +++ b/osu.Game/Screens/Edit/BottomBar.cs @@ -2,13 +2,16 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Game.Overlays; using osu.Game.Screens.Edit.Components; using osu.Game.Screens.Edit.Components.Timelines.Summary; using osuTK; +using osuTK.Graphics; namespace osu.Game.Screens.Edit { @@ -26,6 +29,14 @@ namespace osu.Game.Screens.Edit Height = 60; + Masking = true; + EdgeEffect = new EdgeEffectParameters + { + Colour = Color4.Black.Opacity(0.2f), + Type = EdgeEffectType.Shadow, + Radius = 10f, + }; + InternalChildren = new Drawable[] { new Box From eec9248cdee0257912d936086147344d66eb2983 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 28 May 2022 02:10:18 +0300 Subject: [PATCH 1257/2328] Darken background colour in "setup" and "verify" screens --- osu.Game/Screens/Edit/Setup/SetupScreen.cs | 2 +- osu.Game/Screens/Edit/Verify/IssueList.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Setup/SetupScreen.cs b/osu.Game/Screens/Edit/Setup/SetupScreen.cs index b95aabc1c4..e0fc5f1aff 100644 --- a/osu.Game/Screens/Edit/Setup/SetupScreen.cs +++ b/osu.Game/Screens/Edit/Setup/SetupScreen.cs @@ -41,7 +41,7 @@ namespace osu.Game.Screens.Edit.Setup Add(new Box { - Colour = colourProvider.Background2, + Colour = colourProvider.Background3, RelativeSizeAxes = Axes.Both, }); diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs index 415acc0e22..84b2609a61 100644 --- a/osu.Game/Screens/Edit/Verify/IssueList.cs +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Edit.Verify { new Box { - Colour = colours.Background2, + Colour = colours.Background3, RelativeSizeAxes = Axes.Both, }, new OsuScrollContainer From e71d90716401b8e2bff5fd8c34a34f0cbee513ec Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 28 May 2022 02:20:04 +0300 Subject: [PATCH 1258/2328] Update row attribute background colour to fit screen --- osu.Game/Screens/Edit/Timing/RowAttribute.cs | 8 +++++--- .../Edit/Timing/RowAttributes/TimingRowAttribute.cs | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/RowAttribute.cs b/osu.Game/Screens/Edit/Timing/RowAttribute.cs index 74d43628e1..46bb62c9e0 100644 --- a/osu.Game/Screens/Edit/Timing/RowAttribute.cs +++ b/osu.Game/Screens/Edit/Timing/RowAttribute.cs @@ -19,6 +19,8 @@ namespace osu.Game.Screens.Edit.Timing private readonly string label; + protected Drawable Background { get; private set; } + protected FillFlowContainer Content { get; private set; } public RowAttribute(ControlPoint point, string label) @@ -41,11 +43,11 @@ namespace osu.Game.Screens.Edit.Timing Masking = true; CornerRadius = 3; - InternalChildren = new Drawable[] + InternalChildren = new[] { - new Box + Background = new Box { - Colour = overlayColours.Background4, + Colour = overlayColours.Background5, RelativeSizeAxes = Axes.Both, }, Content = new FillFlowContainer diff --git a/osu.Game/Screens/Edit/Timing/RowAttributes/TimingRowAttribute.cs b/osu.Game/Screens/Edit/Timing/RowAttributes/TimingRowAttribute.cs index f8ec4aef25..8a07088545 100644 --- a/osu.Game/Screens/Edit/Timing/RowAttributes/TimingRowAttribute.cs +++ b/osu.Game/Screens/Edit/Timing/RowAttributes/TimingRowAttribute.cs @@ -7,6 +7,7 @@ using osu.Framework.Extensions; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.Timing; using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; namespace osu.Game.Screens.Edit.Timing.RowAttributes { @@ -24,10 +25,12 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes } [BackgroundDependencyLoader] - private void load() + private void load(OverlayColourProvider colourProvider) { Content.Add(text = new AttributeText(Point)); + Background.Colour = colourProvider.Background4; + timeSignature.BindValueChanged(_ => updateText()); beatLength.BindValueChanged(_ => updateText(), true); } From d12e4928e62023e26aa90ce32bbf84f087886e7d Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 28 May 2022 03:09:04 +0300 Subject: [PATCH 1259/2328] Increase editor verify settings width to give more breathing space --- osu.Game/Screens/Edit/Verify/VerifyScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs index 9dc5a53907..036d7760b8 100644 --- a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs +++ b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs @@ -41,7 +41,7 @@ namespace osu.Game.Screens.Edit.Verify ColumnDimensions = new[] { new Dimension(), - new Dimension(GridSizeMode.Absolute, 200), + new Dimension(GridSizeMode.Absolute, 225), }, Content = new[] { From e12d188dad2c1bc47e77ae96222b36bb7d735a34 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 28 May 2022 04:05:24 +0300 Subject: [PATCH 1260/2328] Fix metronome speed not adjusted on different playback rates --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 4dd7a75d4a..57fcff6a4c 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Timing; using osu.Framework.Utils; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics.Containers; @@ -28,6 +29,8 @@ namespace osu.Game.Screens.Edit.Timing private Drawable weight; private Drawable stick; + private IAdjustableClock metronomeClock; + [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } @@ -192,6 +195,8 @@ namespace osu.Game.Screens.Edit.Timing Y = -3, }, }; + + Clock = new FramedClock(metronomeClock = new StopwatchClock(true)); } private double beatLength; @@ -216,6 +221,8 @@ namespace osu.Game.Screens.Edit.Timing if (BeatSyncSource.ControlPoints == null || BeatSyncSource.Clock == null) return; + metronomeClock.Rate = IsBeatSyncedWithTrack ? BeatSyncSource.Clock.Rate : 1; + timingPoint = BeatSyncSource.ControlPoints.TimingPointAt(BeatSyncSource.Clock.CurrentTime); if (beatLength != timingPoint.BeatLength) From 2fac710d4b728aff4b16a173408be1688c5e1739 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 28 May 2022 04:05:33 +0300 Subject: [PATCH 1261/2328] Add step for adjusting editor clock rate in test scene --- osu.Game/Tests/Visual/EditorClockTestScene.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game/Tests/Visual/EditorClockTestScene.cs b/osu.Game/Tests/Visual/EditorClockTestScene.cs index 2d3e1960d9..15e4fc4d8f 100644 --- a/osu.Game/Tests/Visual/EditorClockTestScene.cs +++ b/osu.Game/Tests/Visual/EditorClockTestScene.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Input.Events; using osu.Game.Beatmaps; @@ -24,6 +25,8 @@ namespace osu.Game.Tests.Visual [Cached] protected new readonly EditorClock Clock; + private readonly Bindable frequencyAdjustment = new BindableDouble(1); + protected virtual bool ScrollUsingMouseWheel => true; protected EditorClockTestScene() @@ -44,14 +47,21 @@ namespace osu.Game.Tests.Visual protected override void LoadComplete() { base.LoadComplete(); + Beatmap.BindValueChanged(beatmapChanged, true); + + AddSliderStep("editor clock rate", 0.0, 2.0, 1.0, v => frequencyAdjustment.Value = v); } private void beatmapChanged(ValueChangedEvent e) { + e.OldValue?.Track.RemoveAdjustment(AdjustableProperty.Frequency, frequencyAdjustment); + Clock.Beatmap = e.NewValue.Beatmap; Clock.ChangeSource(e.NewValue.Track); Clock.ProcessFrame(); + + e.NewValue.Track.AddAdjustment(AdjustableProperty.Frequency, frequencyAdjustment); } protected override void Update() From 93a8092da6504019b871ba4f219e8b9634715b28 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 28 May 2022 10:51:39 +0900 Subject: [PATCH 1262/2328] Increase usable width slightly further --- osu.Game/Screens/Edit/Verify/VerifyScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs index 036d7760b8..56e16bb746 100644 --- a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs +++ b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs @@ -41,7 +41,7 @@ namespace osu.Game.Screens.Edit.Verify ColumnDimensions = new[] { new Dimension(), - new Dimension(GridSizeMode.Absolute, 225), + new Dimension(GridSizeMode.Absolute, 250), }, Content = new[] { From 5d838628d7e49df3b3ce3e1768e6c19c68e366fe Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Fri, 27 May 2022 23:15:19 -0400 Subject: [PATCH 1263/2328] add test, fix formatting, expose easing function --- .../Mods/TestSceneOsuModRepel.cs | 27 +++++++++++++++++++ .../Mods/OsuEaseHitObjectPositionsMod.cs | 12 ++++----- 2 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs new file mode 100644 index 0000000000..6bd41e2fa5 --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs @@ -0,0 +1,27 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Game.Rulesets.Osu.Mods; + +namespace osu.Game.Rulesets.Osu.Tests.Mods +{ + public class TestSceneOsuModRepel : OsuModTestScene + { + [TestCase(0.1f)] + [TestCase(0.5f)] + [TestCase(1)] + public void TestRepel(float strength) + { + CreateModTest(new ModTestData + { + Mod = new OsuModRepel + { + RepulsionStrength = { Value = strength }, + }, + PassCondition = () => true, + Autoplay = false, + }); + } + } +} diff --git a/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs index d81d86dc65..2c344b7a68 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs @@ -23,8 +23,8 @@ namespace osu.Game.Rulesets.Osu.Mods protected BindableFloat EasementStrength = new BindableFloat(0.5f); protected Vector2 CursorPosition; protected DrawableHitObject WorkingHitObject; - protected abstract Vector2 DestinationVector { get; } - + protected virtual Vector2 DestinationVector => WorkingHitObject.Position; + private IFrameStableClock gameplayClock; public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) @@ -47,22 +47,22 @@ namespace osu.Game.Rulesets.Osu.Mods switch (drawable) { case DrawableHitCircle circle: - easeHitObjectPositionToVector(circle, DestinationVector); + EaseHitObjectPositionToVector(circle, DestinationVector); break; case DrawableSlider slider: if (!slider.HeadCircle.Result.HasResult) - easeHitObjectPositionToVector(slider, DestinationVector); + EaseHitObjectPositionToVector(slider, DestinationVector); else - easeHitObjectPositionToVector(slider, DestinationVector - slider.Ball.DrawPosition); + EaseHitObjectPositionToVector(slider, DestinationVector - slider.Ball.DrawPosition); break; } } } - private void easeHitObjectPositionToVector(DrawableHitObject hitObject, Vector2 destination) + protected void EaseHitObjectPositionToVector(DrawableHitObject hitObject, Vector2 destination) { double dampLength = Interpolation.Lerp(3000, 40, EasementStrength.Value); From ede3ab9dc00692559786b6e5691e07d8af3c12ee Mon Sep 17 00:00:00 2001 From: sw1tchbl4d3 Date: Sat, 28 May 2022 12:04:25 +0200 Subject: [PATCH 1264/2328] Add OnFocus handler to CurrentlyPlayingDisplay --- osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs | 8 ++++++++ osu.Game/Overlays/DashboardOverlay.cs | 2 ++ 2 files changed, 10 insertions(+) diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index c8c53ec507..23f67a06cb 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -11,6 +11,7 @@ using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Game.Database; @@ -98,6 +99,13 @@ namespace osu.Game.Overlays.Dashboard playingUsers.BindCollectionChanged(onPlayingUsersChanged, true); } + protected override void OnFocus(FocusEvent e) + { + base.OnFocus(e); + + searchTextBox.TakeFocus(); + } + private void onPlayingUsersChanged(object sender, NotifyCollectionChangedEventArgs e) => Schedule(() => { switch (e.Action) diff --git a/osu.Game/Overlays/DashboardOverlay.cs b/osu.Game/Overlays/DashboardOverlay.cs index 83ad8faf1c..79d972bdcc 100644 --- a/osu.Game/Overlays/DashboardOverlay.cs +++ b/osu.Game/Overlays/DashboardOverlay.cs @@ -16,6 +16,8 @@ namespace osu.Game.Overlays protected override DashboardOverlayHeader CreateHeader() => new DashboardOverlayHeader(); + public override bool AcceptsFocus => false; + protected override void CreateDisplayToLoad(DashboardOverlayTabs tab) { switch (tab) From e18fec3d896d8e0325614a65b4dc5e2f50af5b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 28 May 2022 13:59:10 +0200 Subject: [PATCH 1265/2328] Fix unobserved exceptions due to unimplemented beatmap converter `TestSceneStatisticsPanel` intends to check the operation of statistics panels using dummy ruleset classes. However, `StatisticsPanel` relies on being able to retrieve the playable beatmap, which requires a converter. One was not provided by the dummy rulesets, therefore the retrieval would fail with an unobserved exception. To fix, add a barebones converter implementation that is enough for the test to pass. --- .../Ranking/TestSceneStatisticsPanel.cs | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneStatisticsPanel.cs b/osu.Game.Tests/Visual/Ranking/TestSceneStatisticsPanel.cs index 35281a85eb..1efe6d7380 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneStatisticsPanel.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneStatisticsPanel.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Threading; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -13,6 +14,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Rulesets; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects; using osu.Game.Scoring; using osu.Game.Screens.Ranking.Statistics; using osu.Game.Rulesets.Osu.Objects; @@ -114,10 +116,7 @@ namespace osu.Game.Tests.Visual.Ranking throw new NotImplementedException(); } - public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) - { - throw new NotImplementedException(); - } + public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new TestBeatmapConverter(beatmap); public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) { @@ -151,6 +150,24 @@ namespace osu.Game.Tests.Visual.Ranking } } }; + + private class TestBeatmapConverter : IBeatmapConverter + { +#pragma warning disable CS0067 // The event is never used + public event Action> ObjectConverted; +#pragma warning restore CS0067 + + public IBeatmap Beatmap { get; } + + public TestBeatmapConverter(IBeatmap beatmap) + { + Beatmap = beatmap; + } + + public bool CanConvert() => true; + + public IBeatmap Convert(CancellationToken cancellationToken = default) => Beatmap.Clone(); + } } private class TestRulesetAllStatsRequireHitEvents : TestRuleset From 777d9af0f50082f24862d462aa891416ceef7235 Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Sat, 28 May 2022 13:28:04 +0100 Subject: [PATCH 1266/2328] Move object difficulty calculation to evaluator methods --- .../Difficulty/Evaluators/AimEvaluator.cs | 10 ++++++++++ .../Difficulty/Evaluators/FlashlightEvaluator.cs | 10 ++++++++++ .../Difficulty/Evaluators/RhythmEvaluator.cs | 10 ++++++++++ .../Difficulty/Evaluators/SpeedEvaluator.cs | 10 ++++++++++ 4 files changed, 40 insertions(+) create mode 100644 osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs create mode 100644 osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs create mode 100644 osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs create mode 100644 osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs new file mode 100644 index 0000000000..a573dd492c --- /dev/null +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators +{ + public class AimEvaluator + { + + } +} diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs new file mode 100644 index 0000000000..83b6cc75dd --- /dev/null +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators +{ + public class FlashlightEvaluator + { + + } +} diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs new file mode 100644 index 0000000000..0dd16f7313 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators +{ + public class RhythmEvaluator + { + + } +} diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs new file mode 100644 index 0000000000..84a39d8f9b --- /dev/null +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs @@ -0,0 +1,10 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators +{ + public class SpeedEvaluator + { + + } +} From b631cefc55c0f42f8528a9a92068ecb89c5c143a Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Sat, 28 May 2022 13:29:09 +0100 Subject: [PATCH 1267/2328] Move object difficulty calculation to evaluator methods --- .../Difficulty/Evaluators/AimEvaluator.cs | 129 +++++++++++++++- .../Evaluators/FlashlightEvaluator.cs | 63 +++++++- .../Difficulty/Evaluators/RhythmEvaluator.cs | 102 ++++++++++++- .../Difficulty/Evaluators/SpeedEvaluator.cs | 45 +++++- .../Difficulty/Skills/Aim.cs | 126 +--------------- .../Difficulty/Skills/Flashlight.cs | 64 +------- .../Difficulty/Skills/Speed.cs | 139 +----------------- 7 files changed, 338 insertions(+), 330 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs index a573dd492c..fb9ac0cafb 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs @@ -1,10 +1,135 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; +using osu.Game.Rulesets.Osu.Objects; + namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators { - public class AimEvaluator + public static class AimEvaluator { - + private const double wide_angle_multiplier = 1.5; + private const double acute_angle_multiplier = 2.0; + private const double slider_multiplier = 1.5; + private const double velocity_change_multiplier = 0.75; + + /// + /// Evaluates the difficulty of aiming the current object. + /// + public static double EvaluateDifficultyOf(DifficultyHitObject current, bool withSliders) + { + if (current.BaseObject is Spinner || current.Position <= 1 || current.Previous(0).BaseObject is Spinner) + return 0; + + var osuCurrObj = (OsuDifficultyHitObject)current; + var osuLastObj = (OsuDifficultyHitObject)current.Previous(0); + var osuLastLastObj = (OsuDifficultyHitObject)current.Previous(1); + + // Calculate the velocity to the current hitobject, which starts with a base distance / time assuming the last object is a hitcircle. + double currVelocity = osuCurrObj.LazyJumpDistance / osuCurrObj.StrainTime; + + // But if the last object is a slider, then we extend the travel velocity through the slider into the current object. + if (osuLastObj.BaseObject is Slider && withSliders) + { + double travelVelocity = osuLastObj.TravelDistance / osuLastObj.TravelTime; // calculate the slider velocity from slider head to slider end. + double movementVelocity = osuCurrObj.MinimumJumpDistance / osuCurrObj.MinimumJumpTime; // calculate the movement velocity from slider end to current object + + currVelocity = Math.Max(currVelocity, movementVelocity + travelVelocity); // take the larger total combined velocity. + } + + // As above, do the same for the previous hitobject. + double prevVelocity = osuLastObj.LazyJumpDistance / osuLastObj.StrainTime; + + if (osuLastLastObj.BaseObject is Slider && withSliders) + { + double travelVelocity = osuLastLastObj.TravelDistance / osuLastLastObj.TravelTime; + double movementVelocity = osuLastObj.MinimumJumpDistance / osuLastObj.MinimumJumpTime; + + prevVelocity = Math.Max(prevVelocity, movementVelocity + travelVelocity); + } + + double wideAngleBonus = 0; + double acuteAngleBonus = 0; + double sliderBonus = 0; + double velocityChangeBonus = 0; + + double aimStrain = currVelocity; // Start strain with regular velocity. + + if (Math.Max(osuCurrObj.StrainTime, osuLastObj.StrainTime) < 1.25 * Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime)) // If rhythms are the same. + { + if (osuCurrObj.Angle != null && osuLastObj.Angle != null && osuLastLastObj.Angle != null) + { + double currAngle = osuCurrObj.Angle.Value; + double lastAngle = osuLastObj.Angle.Value; + double lastLastAngle = osuLastLastObj.Angle.Value; + + // Rewarding angles, take the smaller velocity as base. + double angleBonus = Math.Min(currVelocity, prevVelocity); + + wideAngleBonus = calcWideAngleBonus(currAngle); + acuteAngleBonus = calcAcuteAngleBonus(currAngle); + + if (osuCurrObj.StrainTime > 100) // Only buff deltaTime exceeding 300 bpm 1/2. + acuteAngleBonus = 0; + else + { + acuteAngleBonus *= calcAcuteAngleBonus(lastAngle) // Multiply by previous angle, we don't want to buff unless this is a wiggle type pattern. + * Math.Min(angleBonus, 125 / osuCurrObj.StrainTime) // The maximum velocity we buff is equal to 125 / strainTime + * Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, (100 - osuCurrObj.StrainTime) / 25)), 2) // scale buff from 150 bpm 1/4 to 200 bpm 1/4 + * Math.Pow(Math.Sin(Math.PI / 2 * (Math.Clamp(osuCurrObj.LazyJumpDistance, 50, 100) - 50) / 50), 2); // Buff distance exceeding 50 (radius) up to 100 (diameter). + } + + // Penalize wide angles if they're repeated, reducing the penalty as the lastAngle gets more acute. + wideAngleBonus *= angleBonus * (1 - Math.Min(wideAngleBonus, Math.Pow(calcWideAngleBonus(lastAngle), 3))); + // Penalize acute angles if they're repeated, reducing the penalty as the lastLastAngle gets more obtuse. + acuteAngleBonus *= 0.5 + 0.5 * (1 - Math.Min(acuteAngleBonus, Math.Pow(calcAcuteAngleBonus(lastLastAngle), 3))); + } + } + + if (Math.Max(prevVelocity, currVelocity) != 0) + { + // We want to use the average velocity over the whole object when awarding differences, not the individual jump and slider path velocities. + prevVelocity = (osuLastObj.LazyJumpDistance + osuLastLastObj.TravelDistance) / osuLastObj.StrainTime; + currVelocity = (osuCurrObj.LazyJumpDistance + osuLastObj.TravelDistance) / osuCurrObj.StrainTime; + + // Scale with ratio of difference compared to 0.5 * max dist. + double distRatio = Math.Pow(Math.Sin(Math.PI / 2 * Math.Abs(prevVelocity - currVelocity) / Math.Max(prevVelocity, currVelocity)), 2); + + // Reward for % distance up to 125 / strainTime for overlaps where velocity is still changing. + double overlapVelocityBuff = Math.Min(125 / Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime), Math.Abs(prevVelocity - currVelocity)); + + // Reward for % distance slowed down compared to previous, paying attention to not award overlap + double nonOverlapVelocityBuff = Math.Abs(prevVelocity - currVelocity) + // do not award overlap + * Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, Math.Min(osuCurrObj.LazyJumpDistance, osuLastObj.LazyJumpDistance) / 100)), 2); + + // Choose the largest bonus, multiplied by ratio. + velocityChangeBonus = Math.Max(overlapVelocityBuff, nonOverlapVelocityBuff) * distRatio; + + // Penalize for rhythm changes. + velocityChangeBonus *= Math.Pow(Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime) / Math.Max(osuCurrObj.StrainTime, osuLastObj.StrainTime), 2); + } + + if (osuLastObj.TravelTime != 0) + { + // Reward sliders based on velocity. + sliderBonus = osuLastObj.TravelDistance / osuLastObj.TravelTime; + } + + // Add in acute angle bonus or wide angle bonus + velocity change bonus, whichever is larger. + aimStrain += Math.Max(acuteAngleBonus * acute_angle_multiplier, wideAngleBonus * wide_angle_multiplier + velocityChangeBonus * velocity_change_multiplier); + + // Add in additional slider velocity bonus. + if (withSliders) + aimStrain += sliderBonus * slider_multiplier; + + return aimStrain; + } + + private static double calcWideAngleBonus(double angle) => Math.Pow(Math.Sin(3.0 / 4 * (Math.Min(5.0 / 6 * Math.PI, Math.Max(Math.PI / 6, angle)) - Math.PI / 6)), 2); + + private static double calcAcuteAngleBonus(double angle) => 1 - calcWideAngleBonus(angle); } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs index 83b6cc75dd..d606527a1c 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs @@ -1,10 +1,69 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; +using osu.Game.Rulesets.Osu.Objects; + namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators { - public class FlashlightEvaluator + public static class FlashlightEvaluator { - + private const double max_opacity_bonus = 0.4; + private const double hidden_bonus = 0.2; + + public static double EvaluateDifficultyOf(DifficultyHitObject current, bool hidden) + { + if (current.BaseObject is Spinner) + return 0; + + var osuCurrent = (OsuDifficultyHitObject)current; + var osuHitObject = (OsuHitObject)(osuCurrent.BaseObject); + + double scalingFactor = 52.0 / osuHitObject.Radius; + double smallDistNerf = 1.0; + double cumulativeStrainTime = 0.0; + + double result = 0.0; + + OsuDifficultyHitObject lastObj = osuCurrent; + + // This is iterating backwards in time from the current object. + for (int i = 0; i < Math.Min(current.Position, 10); i++) + { + var currentObj = (OsuDifficultyHitObject)current.Previous(i); + var currentHitObject = (OsuHitObject)(currentObj.BaseObject); + + if (!(currentObj.BaseObject is Spinner)) + { + double jumpDistance = (osuHitObject.StackedPosition - currentHitObject.EndPosition).Length; + + cumulativeStrainTime += lastObj.StrainTime; + + // We want to nerf objects that can be easily seen within the Flashlight circle radius. + if (i == 0) + smallDistNerf = Math.Min(1.0, jumpDistance / 75.0); + + // We also want to nerf stacks so that only the first object of the stack is accounted for. + double stackNerf = Math.Min(1.0, (currentObj.LazyJumpDistance / scalingFactor) / 25.0); + + // Bonus based on how visible the object is. + double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.OpacityAt(currentHitObject.StartTime, hidden)); + + result += stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime; + } + + lastObj = currentObj; + } + + result = Math.Pow(smallDistNerf * result, 2.0); + + // Additional bonus for Hidden due to there being no approach circles. + if (hidden) + result *= 1.0 + hidden_bonus; + + return result; + } } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 0dd16f7313..1da5dd52d9 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -1,10 +1,108 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; +using osu.Game.Rulesets.Osu.Objects; + namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators { - public class RhythmEvaluator + public static class RhythmEvaluator { - + private const int history_time_max = 5000; // 5 seconds of calculatingRhythmBonus max. + private const double rhythm_multiplier = 0.75; + + /// + /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . + /// + public static double EvaluateDifficultyOf(DifficultyHitObject current, double greatWindow) + { + if (current.BaseObject is Spinner) + return 0; + + int previousIslandSize = 0; + + double rhythmComplexitySum = 0; + int islandSize = 1; + double startRatio = 0; // store the ratio of the current start of an island to buff for tighter rhythms + + bool firstDeltaSwitch = false; + + int historicalNoteCount = Math.Min(current.Position, 32); + + int rhythmStart = 0; + + while (rhythmStart < historicalNoteCount - 2 && current.StartTime - current.Previous(rhythmStart).StartTime < history_time_max) + rhythmStart++; + + for (int i = rhythmStart; i > 0; i--) + { + OsuDifficultyHitObject currObj = (OsuDifficultyHitObject)current.Previous(i - 1); + OsuDifficultyHitObject prevObj = (OsuDifficultyHitObject)current.Previous(i); + OsuDifficultyHitObject lastObj = (OsuDifficultyHitObject)current.Previous(i + 1); + + double currHistoricalDecay = (history_time_max - (current.StartTime - currObj.StartTime)) / history_time_max; // scales note 0 to 1 from history to now + + currHistoricalDecay = Math.Min((double)(historicalNoteCount - i) / historicalNoteCount, currHistoricalDecay); // either we're limited by time or limited by object count. + + double currDelta = currObj.StrainTime; + double prevDelta = prevObj.StrainTime; + double lastDelta = lastObj.StrainTime; + double currRatio = 1.0 + 6.0 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. + + double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - greatWindow * 0.6) / (greatWindow * 0.6)); + + windowPenalty = Math.Min(1, windowPenalty); + + double effectiveRatio = windowPenalty * currRatio; + + if (firstDeltaSwitch) + { + if (!(prevDelta > 1.25 * currDelta || prevDelta * 1.25 < currDelta)) + { + if (islandSize < 7) + islandSize++; // island is still progressing, count size. + } + else + { + if (current.Previous(i - 1).BaseObject is Slider) // bpm change is into slider, this is easy acc window + effectiveRatio *= 0.125; + + if (current.Previous(i).BaseObject is Slider) // bpm change was from a slider, this is easier typically than circle -> circle + effectiveRatio *= 0.25; + + if (previousIslandSize == islandSize) // repeated island size (ex: triplet -> triplet) + effectiveRatio *= 0.25; + + if (previousIslandSize % 2 == islandSize % 2) // repeated island polartiy (2 -> 4, 3 -> 5) + effectiveRatio *= 0.50; + + if (lastDelta > prevDelta + 10 && prevDelta > currDelta + 10) // previous increase happened a note ago, 1/1->1/2-1/4, dont want to buff this. + effectiveRatio *= 0.125; + + rhythmComplexitySum += Math.Sqrt(effectiveRatio * startRatio) * currHistoricalDecay * Math.Sqrt(4 + islandSize) / 2 * Math.Sqrt(4 + previousIslandSize) / 2; + + startRatio = effectiveRatio; + + previousIslandSize = islandSize; // log the last island size. + + if (prevDelta * 1.25 < currDelta) // we're slowing down, stop counting + firstDeltaSwitch = false; // if we're speeding up, this stays true and we keep counting island size. + + islandSize = 1; + } + } + else if (prevDelta > 1.25 * currDelta) // we want to be speeding up. + { + // Begin counting island until we change speed again. + firstDeltaSwitch = true; + startRatio = effectiveRatio; + islandSize = 1; + } + } + + return Math.Sqrt(4 + rhythmComplexitySum * rhythm_multiplier) / 2; //produces multiplier that can be applied to strain. range [1, infinity) (not really though) + } } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs index 84a39d8f9b..bf0f3e2a69 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs @@ -1,10 +1,51 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using osu.Framework.Utils; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; +using osu.Game.Rulesets.Osu.Objects; + namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators { - public class SpeedEvaluator + public static class SpeedEvaluator { - + private const double single_spacing_threshold = 125; + private const double min_speed_bonus = 75; // ~200BPM + private const double speed_balancing_factor = 40; + + public static double EvaluateDifficultyOf(DifficultyHitObject current, double greatWindow) + { + if (current.BaseObject is Spinner) + return 0; + + // derive strainTime for calculation + var osuCurrObj = (OsuDifficultyHitObject)current; + var osuPrevObj = current.Position > 0 ? (OsuDifficultyHitObject)current.Previous(0) : null; + + double strainTime = osuCurrObj.StrainTime; + double greatWindowFull = greatWindow * 2; + double speedWindowRatio = strainTime / greatWindowFull; + + // Aim to nerf cheesy rhythms (Very fast consecutive doubles with large deltatimes between) + if (osuPrevObj != null && strainTime < greatWindowFull && osuPrevObj.StrainTime > strainTime) + strainTime = Interpolation.Lerp(osuPrevObj.StrainTime, strainTime, speedWindowRatio); + + // Cap deltatime to the OD 300 hitwindow. + // 0.93 is derived from making sure 260bpm OD8 streams aren't nerfed harshly, whilst 0.92 limits the effect of the cap. + strainTime /= Math.Clamp((strainTime / greatWindowFull) / 0.93, 0.92, 1); + + // derive speedBonus for calculation + double speedBonus = 1.0; + + if (strainTime < min_speed_bonus) + speedBonus = 1 + 0.75 * Math.Pow((min_speed_bonus - strainTime) / speed_balancing_factor, 2); + + double travelDistance = osuPrevObj?.TravelDistance ?? 0; + double distance = Math.Min(single_spacing_threshold, travelDistance + osuCurrObj.MinimumJumpDistance); + + return (speedBonus + speedBonus * Math.Pow(distance / single_spacing_threshold, 3.5)) / strainTime; + } } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index e3ec997740..df6a5e3d00 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -4,8 +4,7 @@ using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; -using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Difficulty.Evaluators; namespace osu.Game.Rulesets.Osu.Difficulty.Skills { @@ -22,132 +21,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private readonly bool withSliders; - private const double wide_angle_multiplier = 1.5; - private const double acute_angle_multiplier = 2.0; - private const double slider_multiplier = 1.5; - private const double velocity_change_multiplier = 0.75; - private double currentStrain; private double skillMultiplier => 23.25; private double strainDecayBase => 0.15; - private double strainValueOf(DifficultyHitObject current) - { - if (current.BaseObject is Spinner || current.Position <= 1 || current.Previous(0).BaseObject is Spinner) - return 0; - - var osuCurrObj = (OsuDifficultyHitObject)current; - var osuLastObj = (OsuDifficultyHitObject)current.Previous(0); - var osuLastLastObj = (OsuDifficultyHitObject)current.Previous(1); - - // Calculate the velocity to the current hitobject, which starts with a base distance / time assuming the last object is a hitcircle. - double currVelocity = osuCurrObj.LazyJumpDistance / osuCurrObj.StrainTime; - - // But if the last object is a slider, then we extend the travel velocity through the slider into the current object. - if (osuLastObj.BaseObject is Slider && withSliders) - { - double travelVelocity = osuLastObj.TravelDistance / osuLastObj.TravelTime; // calculate the slider velocity from slider head to slider end. - double movementVelocity = osuCurrObj.MinimumJumpDistance / osuCurrObj.MinimumJumpTime; // calculate the movement velocity from slider end to current object - - currVelocity = Math.Max(currVelocity, movementVelocity + travelVelocity); // take the larger total combined velocity. - } - - // As above, do the same for the previous hitobject. - double prevVelocity = osuLastObj.LazyJumpDistance / osuLastObj.StrainTime; - - if (osuLastLastObj.BaseObject is Slider && withSliders) - { - double travelVelocity = osuLastLastObj.TravelDistance / osuLastLastObj.TravelTime; - double movementVelocity = osuLastObj.MinimumJumpDistance / osuLastObj.MinimumJumpTime; - - prevVelocity = Math.Max(prevVelocity, movementVelocity + travelVelocity); - } - - double wideAngleBonus = 0; - double acuteAngleBonus = 0; - double sliderBonus = 0; - double velocityChangeBonus = 0; - - double aimStrain = currVelocity; // Start strain with regular velocity. - - if (Math.Max(osuCurrObj.StrainTime, osuLastObj.StrainTime) < 1.25 * Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime)) // If rhythms are the same. - { - if (osuCurrObj.Angle != null && osuLastObj.Angle != null && osuLastLastObj.Angle != null) - { - double currAngle = osuCurrObj.Angle.Value; - double lastAngle = osuLastObj.Angle.Value; - double lastLastAngle = osuLastLastObj.Angle.Value; - - // Rewarding angles, take the smaller velocity as base. - double angleBonus = Math.Min(currVelocity, prevVelocity); - - wideAngleBonus = calcWideAngleBonus(currAngle); - acuteAngleBonus = calcAcuteAngleBonus(currAngle); - - if (osuCurrObj.StrainTime > 100) // Only buff deltaTime exceeding 300 bpm 1/2. - acuteAngleBonus = 0; - else - { - acuteAngleBonus *= calcAcuteAngleBonus(lastAngle) // Multiply by previous angle, we don't want to buff unless this is a wiggle type pattern. - * Math.Min(angleBonus, 125 / osuCurrObj.StrainTime) // The maximum velocity we buff is equal to 125 / strainTime - * Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, (100 - osuCurrObj.StrainTime) / 25)), 2) // scale buff from 150 bpm 1/4 to 200 bpm 1/4 - * Math.Pow(Math.Sin(Math.PI / 2 * (Math.Clamp(osuCurrObj.LazyJumpDistance, 50, 100) - 50) / 50), 2); // Buff distance exceeding 50 (radius) up to 100 (diameter). - } - - // Penalize wide angles if they're repeated, reducing the penalty as the lastAngle gets more acute. - wideAngleBonus *= angleBonus * (1 - Math.Min(wideAngleBonus, Math.Pow(calcWideAngleBonus(lastAngle), 3))); - // Penalize acute angles if they're repeated, reducing the penalty as the lastLastAngle gets more obtuse. - acuteAngleBonus *= 0.5 + 0.5 * (1 - Math.Min(acuteAngleBonus, Math.Pow(calcAcuteAngleBonus(lastLastAngle), 3))); - } - } - - if (Math.Max(prevVelocity, currVelocity) != 0) - { - // We want to use the average velocity over the whole object when awarding differences, not the individual jump and slider path velocities. - prevVelocity = (osuLastObj.LazyJumpDistance + osuLastLastObj.TravelDistance) / osuLastObj.StrainTime; - currVelocity = (osuCurrObj.LazyJumpDistance + osuLastObj.TravelDistance) / osuCurrObj.StrainTime; - - // Scale with ratio of difference compared to 0.5 * max dist. - double distRatio = Math.Pow(Math.Sin(Math.PI / 2 * Math.Abs(prevVelocity - currVelocity) / Math.Max(prevVelocity, currVelocity)), 2); - - // Reward for % distance up to 125 / strainTime for overlaps where velocity is still changing. - double overlapVelocityBuff = Math.Min(125 / Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime), Math.Abs(prevVelocity - currVelocity)); - - // Reward for % distance slowed down compared to previous, paying attention to not award overlap - double nonOverlapVelocityBuff = Math.Abs(prevVelocity - currVelocity) - // do not award overlap - * Math.Pow(Math.Sin(Math.PI / 2 * Math.Min(1, Math.Min(osuCurrObj.LazyJumpDistance, osuLastObj.LazyJumpDistance) / 100)), 2); - - // Choose the largest bonus, multiplied by ratio. - velocityChangeBonus = Math.Max(overlapVelocityBuff, nonOverlapVelocityBuff) * distRatio; - - // Penalize for rhythm changes. - velocityChangeBonus *= Math.Pow(Math.Min(osuCurrObj.StrainTime, osuLastObj.StrainTime) / Math.Max(osuCurrObj.StrainTime, osuLastObj.StrainTime), 2); - } - - if (osuLastObj.TravelTime != 0) - { - // Reward sliders based on velocity. - sliderBonus = osuLastObj.TravelDistance / osuLastObj.TravelTime; - } - - // Add in acute angle bonus or wide angle bonus + velocity change bonus, whichever is larger. - aimStrain += Math.Max(acuteAngleBonus * acute_angle_multiplier, wideAngleBonus * wide_angle_multiplier + velocityChangeBonus * velocity_change_multiplier); - - // Add in additional slider velocity bonus. - if (withSliders) - aimStrain += sliderBonus * slider_multiplier; - - return aimStrain; - } - - private double calcWideAngleBonus(double angle) => Math.Pow(Math.Sin(3.0 / 4 * (Math.Min(5.0 / 6 * Math.PI, Math.Max(Math.PI / 6, angle)) - Math.PI / 6)), 2); - - private double calcAcuteAngleBonus(double angle) => 1 - calcWideAngleBonus(angle); - - private double applyDiminishingExp(double val) => Math.Pow(val, 0.99); - private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => currentStrain * strainDecay(time - current.Previous(0).StartTime); @@ -155,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double StrainValueAt(DifficultyHitObject current) { currentStrain *= strainDecay(current.DeltaTime); - currentStrain += strainValueOf(current) * skillMultiplier; + currentStrain += AimEvaluator.EvaluateDifficultyOf(current, withSliders) * skillMultiplier; return currentStrain; } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 75796a5993..bd8e962122 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -5,9 +5,8 @@ using System; using System.Linq; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu.Difficulty.Evaluators; using osu.Game.Rulesets.Osu.Mods; -using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; -using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Difficulty.Skills { @@ -19,73 +18,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills public Flashlight(Mod[] mods) : base(mods) { - hidden = mods.Any(m => m is OsuModHidden); } private double skillMultiplier => 0.05; private double strainDecayBase => 0.15; protected override double DecayWeight => 1.0; - private readonly bool hidden; - - private const double max_opacity_bonus = 0.4; - private const double hidden_bonus = 0.2; - private double currentStrain; - private double strainValueOf(DifficultyHitObject current) - { - if (current.BaseObject is Spinner) - return 0; - - var osuCurrent = (OsuDifficultyHitObject)current; - var osuHitObject = (OsuHitObject)(osuCurrent.BaseObject); - - double scalingFactor = 52.0 / osuHitObject.Radius; - double smallDistNerf = 1.0; - double cumulativeStrainTime = 0.0; - - double result = 0.0; - - OsuDifficultyHitObject lastObj = osuCurrent; - - // This is iterating backwards in time from the current object. - for (int i = 0; i < Math.Min(current.Position, 10); i++) - { - var currentObj = (OsuDifficultyHitObject)current.Previous(i); - var currentHitObject = (OsuHitObject)(currentObj.BaseObject); - - if (!(currentObj.BaseObject is Spinner)) - { - double jumpDistance = (osuHitObject.StackedPosition - currentHitObject.EndPosition).Length; - - cumulativeStrainTime += lastObj.StrainTime; - - // We want to nerf objects that can be easily seen within the Flashlight circle radius. - if (i == 0) - smallDistNerf = Math.Min(1.0, jumpDistance / 75.0); - - // We also want to nerf stacks so that only the first object of the stack is accounted for. - double stackNerf = Math.Min(1.0, (currentObj.LazyJumpDistance / scalingFactor) / 25.0); - - // Bonus based on how visible the object is. - double opacityBonus = 1.0 + max_opacity_bonus * (1.0 - osuCurrent.OpacityAt(currentHitObject.StartTime, hidden)); - - result += stackNerf * opacityBonus * scalingFactor * jumpDistance / cumulativeStrainTime; - } - - lastObj = currentObj; - } - - result = Math.Pow(smallDistNerf * result, 2.0); - - // Additional bonus for Hidden due to there being no approach circles. - if (hidden) - result *= 1.0 + hidden_bonus; - - return result; - } - private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => currentStrain * strainDecay(time - current.Previous(0).StartTime); @@ -93,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double StrainValueAt(DifficultyHitObject current) { currentStrain *= strainDecay(current.DeltaTime); - currentStrain += strainValueOf(current) * skillMultiplier; + currentStrain += currentStrain += FlashlightEvaluator.EvaluateDifficultyOf(current, Mods.Any(m => m is OsuModHidden)) * skillMultiplier; return currentStrain; } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index f8905664f4..055e1cb66e 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -4,9 +4,7 @@ using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; -using osu.Game.Rulesets.Osu.Objects; -using osu.Framework.Utils; +using osu.Game.Rulesets.Osu.Difficulty.Evaluators; namespace osu.Game.Rulesets.Osu.Difficulty.Skills { @@ -15,12 +13,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills /// public class Speed : OsuStrainSkill { - private const double single_spacing_threshold = 125; - private const double rhythm_multiplier = 0.75; - private const int history_time_max = 5000; // 5 seconds of calculatingRhythmBonus max. - private const double min_speed_bonus = 75; // ~200BPM - private const double speed_balancing_factor = 40; - private double skillMultiplier => 1375; private double strainDecayBase => 0.3; @@ -37,131 +29,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills greatWindow = hitWindowGreat; } - /// - /// Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current . - /// - private double calculateRhythmBonus(DifficultyHitObject current) - { - if (current.BaseObject is Spinner) - return 0; - - int previousIslandSize = 0; - - double rhythmComplexitySum = 0; - int islandSize = 1; - double startRatio = 0; // store the ratio of the current start of an island to buff for tighter rhythms - - bool firstDeltaSwitch = false; - - int historicalNoteCount = Math.Min(current.Position, 32); - - int rhythmStart = 0; - - while (rhythmStart < historicalNoteCount - 2 && current.StartTime - current.Previous(rhythmStart).StartTime < history_time_max) - rhythmStart++; - - for (int i = rhythmStart; i > 0; i--) - { - OsuDifficultyHitObject currObj = (OsuDifficultyHitObject)current.Previous(i - 1); - OsuDifficultyHitObject prevObj = (OsuDifficultyHitObject)current.Previous(i); - OsuDifficultyHitObject lastObj = (OsuDifficultyHitObject)current.Previous(i + 1); - - double currHistoricalDecay = (history_time_max - (current.StartTime - currObj.StartTime)) / history_time_max; // scales note 0 to 1 from history to now - - currHistoricalDecay = Math.Min((double)(historicalNoteCount - i) / historicalNoteCount, currHistoricalDecay); // either we're limited by time or limited by object count. - - double currDelta = currObj.StrainTime; - double prevDelta = prevObj.StrainTime; - double lastDelta = lastObj.StrainTime; - double currRatio = 1.0 + 6.0 * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / (Math.Min(prevDelta, currDelta) / Math.Max(prevDelta, currDelta))), 2)); // fancy function to calculate rhythmbonuses. - - double windowPenalty = Math.Min(1, Math.Max(0, Math.Abs(prevDelta - currDelta) - greatWindow * 0.6) / (greatWindow * 0.6)); - - windowPenalty = Math.Min(1, windowPenalty); - - double effectiveRatio = windowPenalty * currRatio; - - if (firstDeltaSwitch) - { - if (!(prevDelta > 1.25 * currDelta || prevDelta * 1.25 < currDelta)) - { - if (islandSize < 7) - islandSize++; // island is still progressing, count size. - } - else - { - if (current.Previous(i - 1).BaseObject is Slider) // bpm change is into slider, this is easy acc window - effectiveRatio *= 0.125; - - if (current.Previous(i).BaseObject is Slider) // bpm change was from a slider, this is easier typically than circle -> circle - effectiveRatio *= 0.25; - - if (previousIslandSize == islandSize) // repeated island size (ex: triplet -> triplet) - effectiveRatio *= 0.25; - - if (previousIslandSize % 2 == islandSize % 2) // repeated island polartiy (2 -> 4, 3 -> 5) - effectiveRatio *= 0.50; - - if (lastDelta > prevDelta + 10 && prevDelta > currDelta + 10) // previous increase happened a note ago, 1/1->1/2-1/4, dont want to buff this. - effectiveRatio *= 0.125; - - rhythmComplexitySum += Math.Sqrt(effectiveRatio * startRatio) * currHistoricalDecay * Math.Sqrt(4 + islandSize) / 2 * Math.Sqrt(4 + previousIslandSize) / 2; - - startRatio = effectiveRatio; - - previousIslandSize = islandSize; // log the last island size. - - if (prevDelta * 1.25 < currDelta) // we're slowing down, stop counting - firstDeltaSwitch = false; // if we're speeding up, this stays true and we keep counting island size. - - islandSize = 1; - } - } - else if (prevDelta > 1.25 * currDelta) // we want to be speeding up. - { - // Begin counting island until we change speed again. - firstDeltaSwitch = true; - startRatio = effectiveRatio; - islandSize = 1; - } - } - - return Math.Sqrt(4 + rhythmComplexitySum * rhythm_multiplier) / 2; //produces multiplier that can be applied to strain. range [1, infinity) (not really though) - } - - private double strainValueOf(DifficultyHitObject current) - { - if (current.BaseObject is Spinner) - return 0; - - // derive strainTime for calculation - var osuCurrObj = (OsuDifficultyHitObject)current; - var osuPrevObj = current.Position > 0 ? (OsuDifficultyHitObject)current.Previous(0) : null; - - double strainTime = osuCurrObj.StrainTime; - double greatWindowFull = greatWindow * 2; - double speedWindowRatio = strainTime / greatWindowFull; - - // Aim to nerf cheesy rhythms (Very fast consecutive doubles with large deltatimes between) - if (osuPrevObj != null && strainTime < greatWindowFull && osuPrevObj.StrainTime > strainTime) - strainTime = Interpolation.Lerp(osuPrevObj.StrainTime, strainTime, speedWindowRatio); - - // Cap deltatime to the OD 300 hitwindow. - // 0.93 is derived from making sure 260bpm OD8 streams aren't nerfed harshly, whilst 0.92 limits the effect of the cap. - strainTime /= Math.Clamp((strainTime / greatWindowFull) / 0.93, 0.92, 1); - - // derive speedBonus for calculation - double speedBonus = 1.0; - - if (strainTime < min_speed_bonus) - speedBonus = 1 + 0.75 * Math.Pow((min_speed_bonus - strainTime) / speed_balancing_factor, 2); - - double travelDistance = osuPrevObj?.TravelDistance ?? 0; - double distance = Math.Min(single_spacing_threshold, travelDistance + osuCurrObj.MinimumJumpDistance); - - return (speedBonus + speedBonus * Math.Pow(distance / single_spacing_threshold, 3.5)) / strainTime; - } - private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => (currentStrain * currentRhythm) * strainDecay(time - current.Previous(0).StartTime); @@ -169,9 +36,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double StrainValueAt(DifficultyHitObject current) { currentStrain *= strainDecay(current.DeltaTime); - currentStrain += strainValueOf(current) * skillMultiplier; + currentStrain += SpeedEvaluator.EvaluateDifficultyOf(current, greatWindow) * skillMultiplier; - currentRhythm = calculateRhythmBonus(current); + currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current, greatWindow); return currentStrain * currentRhythm; } From 774ac13900677cdfe4c7de61e69dfa4ebde63ff3 Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Sat, 28 May 2022 14:09:08 +0100 Subject: [PATCH 1268/2328] Add xmldocs --- .../Difficulty/Evaluators/AimEvaluator.cs | 8 +++++++- .../Difficulty/Evaluators/FlashlightEvaluator.cs | 8 ++++++++ .../Difficulty/Evaluators/SpeedEvaluator.cs | 8 ++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs index fb9ac0cafb..f16e62d2a7 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs @@ -16,7 +16,13 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators private const double velocity_change_multiplier = 0.75; /// - /// Evaluates the difficulty of aiming the current object. + /// Evaluates the difficulty of aiming the current object, based on: + /// + /// cursor velocity to the current object, + /// angle difficulty, + /// sharp velocity increases, + /// and slider difficulty. + /// /// public static double EvaluateDifficultyOf(DifficultyHitObject current, bool withSliders) { diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs index d606527a1c..b13b641c6b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs @@ -13,6 +13,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators private const double max_opacity_bonus = 0.4; private const double hidden_bonus = 0.2; + /// + /// Evaluates the difficulty of memorising and hitting an object, based on: + /// + /// distance between the previous and current object, + /// the visual opacity of the current object, + /// and whether the hidden mod is enabled. + /// + /// public static double EvaluateDifficultyOf(DifficultyHitObject current, bool hidden) { if (current.BaseObject is Spinner) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs index bf0f3e2a69..17d4246c72 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs @@ -15,6 +15,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators private const double min_speed_bonus = 75; // ~200BPM private const double speed_balancing_factor = 40; + /// + /// Evaluates the difficulty of tapping the current object, based on: + /// + /// time between pressing the previous and current object, + /// distance between those objects, + /// and how easily they can be cheesed. + /// + /// public static double EvaluateDifficultyOf(DifficultyHitObject current, double greatWindow) { if (current.BaseObject is Spinner) From 1641918c515a49530f6c5ce921b40c52b2418463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 28 May 2022 14:25:59 +0200 Subject: [PATCH 1269/2328] Revert "Avoid throwing unobserved exception when `PerformancePointsCounter` requests timed attributes" This reverts commit 19b655d75bd589f25fa76057fe3e66ec5d98eb96. --- osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs b/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs index 019a9f9730..bdc98e53f9 100644 --- a/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs +++ b/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; +using System.Threading.Tasks; using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Audio.Track; @@ -80,16 +81,13 @@ namespace osu.Game.Screens.Play.HUD difficultyCache.GetTimedDifficultyAttributesAsync(gameplayWorkingBeatmap, gameplayState.Ruleset, clonedMods, loadCancellationSource.Token) .ContinueWith(task => Schedule(() => { - if (task.Exception != null) - return; - timedAttributes = task.GetResultSafely(); IsValid = true; if (lastJudgement != null) onJudgementChanged(lastJudgement); - })); + }), TaskContinuationOptions.OnlyOnRanToCompletion); } } From dcf3d7695484a7bc92b1892a5cf66af5ea0ba208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 28 May 2022 13:33:09 +0200 Subject: [PATCH 1270/2328] Fix unobserved exceptions due to using unconverted beatmap `TestSceneBeatmapSkinFallbacks` was locally caching a `GameplayState` instance to fulfill dependencies of a `SkinnableTargetComponentsContainer`. However, it was doing so using `new TestBeatmap()`, which is a raw decoded beatmap that hasn't been converted to any ruleset yet, which was causing failures in `BeatmapDifficultyCache.GetTimedDifficultyAttributesAsync()` as that method is expecting to receive a post-conversion, ready-for-gameplay beatmap. Resolve by proxying forward dependency instances from the already-known-to-be-working `actualComponentsContainer`. --- .../Gameplay/TestSceneBeatmapSkinFallbacks.cs | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapSkinFallbacks.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapSkinFallbacks.cs index 53364b6d89..e9aa85f4ce 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapSkinFallbacks.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapSkinFallbacks.cs @@ -6,7 +6,6 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; -using osu.Framework.Graphics.Containers; using osu.Framework.Lists; using osu.Framework.Testing; using osu.Framework.Timing; @@ -22,7 +21,6 @@ using osu.Game.Screens.Play; using osu.Game.Screens.Play.HUD; using osu.Game.Skinning; using osu.Game.Storyboards; -using osu.Game.Tests.Beatmaps; namespace osu.Game.Tests.Visual.Gameplay { @@ -33,18 +31,6 @@ namespace osu.Game.Tests.Visual.Gameplay [Resolved] private SkinManager skinManager { get; set; } - [Cached] - private ScoreProcessor scoreProcessor = new ScoreProcessor(new OsuRuleset()); - - [Cached(typeof(HealthProcessor))] - private HealthProcessor healthProcessor = new DrainingHealthProcessor(0); - - [Cached] - private GameplayState gameplayState = new GameplayState(new TestBeatmap(new OsuRuleset().RulesetInfo), new OsuRuleset()); - - [Cached] - private readonly GameplayClock gameplayClock = new GameplayClock(new FramedClock()); - protected override bool HasCustomSteps => true; [Test] @@ -81,11 +67,19 @@ namespace osu.Game.Tests.Visual.Gameplay if (expectedComponentsContainer == null) return false; - var expectedComponentsAdjustmentContainer = new Container + var expectedComponentsAdjustmentContainer = new DependencyProvidingContainer { Position = actualComponentsContainer.Parent.ToSpaceOfOtherDrawable(actualComponentsContainer.DrawPosition, Content), Size = actualComponentsContainer.DrawSize, Child = expectedComponentsContainer, + // proxy the same required dependencies that `actualComponentsContainer` is using. + CachedDependencies = new (Type, object)[] + { + (typeof(ScoreProcessor), actualComponentsContainer.Dependencies.Get()), + (typeof(HealthProcessor), actualComponentsContainer.Dependencies.Get()), + (typeof(GameplayState), actualComponentsContainer.Dependencies.Get()), + (typeof(GameplayClock), actualComponentsContainer.Dependencies.Get()) + }, }; Add(expectedComponentsAdjustmentContainer); From a8e1c5ba87f53dbe2a30bd81bad67f029dc02234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 28 May 2022 14:55:57 +0200 Subject: [PATCH 1271/2328] Fix remaining cases of incorrect `GameplayState` construction in tests Manual attempts to initialise replaced by a new `TestGameplayState` helper for ease of use. --- .../TestSceneGameplayCursor.cs | 4 +-- .../Visual/Gameplay/TestSceneHUDOverlay.cs | 4 +-- .../Gameplay/TestSceneReplayRecorder.cs | 6 ++-- .../TestSceneSkinEditorMultipleSkins.cs | 4 +-- .../Gameplay/TestSceneSkinnableHUDOverlay.cs | 4 +-- .../Visual/Gameplay/TestSceneSpectator.cs | 9 ++++-- .../Gameplay/TestSceneSpectatorPlayback.cs | 4 +-- osu.Game/Tests/Gameplay/TestGameplayState.cs | 32 +++++++++++++++++++ 8 files changed, 50 insertions(+), 17 deletions(-) create mode 100644 osu.Game/Tests/Gameplay/TestGameplayState.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs index a36f07ff7b..496d495b43 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs @@ -17,11 +17,11 @@ using osu.Framework.Testing.Input; using osu.Framework.Utils; using osu.Game.Audio; using osu.Game.Configuration; -using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Skinning; using osu.Game.Rulesets.Osu.UI.Cursor; using osu.Game.Screens.Play; using osu.Game.Skinning; +using osu.Game.Tests.Gameplay; using osuTK; namespace osu.Game.Rulesets.Osu.Tests @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Osu.Tests public TestSceneGameplayCursor() { var ruleset = new OsuRuleset(); - gameplayState = new GameplayState(CreateBeatmap(ruleset.RulesetInfo), ruleset, Array.Empty()); + gameplayState = TestGameplayState.Create(ruleset); AddStep("change background colour", () => { diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs index 2d12645811..83c557ee51 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs @@ -15,7 +15,7 @@ using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play; using osu.Game.Skinning; -using osu.Game.Tests.Beatmaps; +using osu.Game.Tests.Gameplay; using osuTK.Input; namespace osu.Game.Tests.Visual.Gameplay @@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual.Gameplay private HealthProcessor healthProcessor = new DrainingHealthProcessor(0); [Cached] - private GameplayState gameplayState = new GameplayState(new TestBeatmap(new OsuRuleset().RulesetInfo), new OsuRuleset()); + private GameplayState gameplayState = TestGameplayState.Create(new OsuRuleset()); [Cached] private readonly GameplayClock gameplayClock = new GameplayClock(new FramedClock()); diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs index 81763564fa..8362739d3b 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; @@ -14,16 +13,15 @@ using osu.Framework.Input.Events; using osu.Framework.Input.StateChanges; using osu.Framework.Testing; using osu.Framework.Threading; -using osu.Game.Beatmaps; using osu.Game.Graphics.Sprites; using osu.Game.Replays; using osu.Game.Rulesets; -using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.UI; using osu.Game.Scoring; using osu.Game.Screens.Play; +using osu.Game.Tests.Gameplay; using osu.Game.Tests.Mods; using osuTK; using osuTK.Graphics; @@ -41,7 +39,7 @@ namespace osu.Game.Tests.Visual.Gameplay private TestReplayRecorder recorder; [Cached] - private GameplayState gameplayState = new GameplayState(new Beatmap(), new OsuRuleset(), Array.Empty()); + private GameplayState gameplayState = TestGameplayState.Create(new OsuRuleset()); [SetUpSteps] public void SetUpSteps() diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorMultipleSkins.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorMultipleSkins.cs index 8150252d45..5f838b8813 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorMultipleSkins.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorMultipleSkins.cs @@ -11,7 +11,7 @@ using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play; using osu.Game.Skinning.Editor; -using osu.Game.Tests.Beatmaps; +using osu.Game.Tests.Gameplay; using osuTK.Input; namespace osu.Game.Tests.Visual.Gameplay @@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.Gameplay private HealthProcessor healthProcessor = new DrainingHealthProcessor(0); [Cached] - private GameplayState gameplayState = new GameplayState(new TestBeatmap(new OsuRuleset().RulesetInfo), new OsuRuleset()); + private GameplayState gameplayState = TestGameplayState.Create(new OsuRuleset()); [Cached] private readonly GameplayClock gameplayClock = new GameplayClock(new FramedClock()); diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs index ac5e408d90..5f2d9ee9e8 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs @@ -16,7 +16,7 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play; -using osu.Game.Tests.Beatmaps; +using osu.Game.Tests.Gameplay; using osuTK.Input; namespace osu.Game.Tests.Visual.Gameplay @@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.Gameplay private HealthProcessor healthProcessor = new DrainingHealthProcessor(0); [Cached] - private GameplayState gameplayState = new GameplayState(new TestBeatmap(new OsuRuleset().RulesetInfo), new OsuRuleset()); + private GameplayState gameplayState = TestGameplayState.Create(new OsuRuleset()); [Cached] private readonly GameplayClock gameplayClock = new GameplayClock(new FramedClock()); diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs index 8b420cebc8..b5cdd61ee5 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs @@ -18,8 +18,8 @@ using osu.Game.Rulesets.UI; using osu.Game.Scoring; using osu.Game.Screens; using osu.Game.Screens.Play; -using osu.Game.Tests.Beatmaps; using osu.Game.Tests.Beatmaps.IO; +using osu.Game.Tests.Gameplay; using osu.Game.Tests.Visual.Multiplayer; using osu.Game.Tests.Visual.Spectator; using osuTK; @@ -259,12 +259,15 @@ namespace osu.Game.Tests.Visual.Gameplay [Test] public void TestFinalFramesPurgedBeforeEndingPlay() { - AddStep("begin playing", () => spectatorClient.BeginPlaying(new GameplayState(new TestBeatmap(new OsuRuleset().RulesetInfo), new OsuRuleset()), new Score())); + AddStep("begin playing", () => spectatorClient.BeginPlaying(TestGameplayState.Create(new OsuRuleset()), new Score())); AddStep("send frames and finish play", () => { spectatorClient.HandleFrame(new OsuReplayFrame(1000, Vector2.Zero)); - spectatorClient.EndPlaying(new GameplayState(new TestBeatmap(new OsuRuleset().RulesetInfo), new OsuRuleset()) { HasPassed = true }); + + var completedGameplayState = TestGameplayState.Create(new OsuRuleset()); + completedGameplayState.HasPassed = true; + spectatorClient.EndPlaying(completedGameplayState); }); // We can't access API because we're an "online" test. diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs index f8748922cf..2d2e05c4c9 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs @@ -20,13 +20,13 @@ using osu.Game.Online.Spectator; using osu.Game.Replays; using osu.Game.Replays.Legacy; using osu.Game.Rulesets; -using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Replays.Types; using osu.Game.Rulesets.UI; using osu.Game.Scoring; using osu.Game.Screens.Play; +using osu.Game.Tests.Gameplay; using osu.Game.Tests.Mods; using osu.Game.Tests.Visual.Spectator; using osuTK; @@ -65,7 +65,7 @@ namespace osu.Game.Tests.Visual.Gameplay CachedDependencies = new[] { (typeof(SpectatorClient), (object)(spectatorClient = new TestSpectatorClient())), - (typeof(GameplayState), new GameplayState(new Beatmap(), new OsuRuleset(), Array.Empty())) + (typeof(GameplayState), TestGameplayState.Create(new OsuRuleset())) }, Children = new Drawable[] { diff --git a/osu.Game/Tests/Gameplay/TestGameplayState.cs b/osu.Game/Tests/Gameplay/TestGameplayState.cs new file mode 100644 index 0000000000..0d00f52d15 --- /dev/null +++ b/osu.Game/Tests/Gameplay/TestGameplayState.cs @@ -0,0 +1,32 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using System.Collections.Generic; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; +using osu.Game.Scoring; +using osu.Game.Screens.Play; +using osu.Game.Tests.Beatmaps; + +namespace osu.Game.Tests.Gameplay +{ + /// + /// Static class providing a convenience method to retrieve a correctly-initialised instance in testing scenarios. + /// + public static class TestGameplayState + { + /// + /// Creates a correctly-initialised instance for use in testing. + /// + public static GameplayState Create(Ruleset ruleset, IReadOnlyList? mods = null, Score? score = null) + { + var beatmap = new TestBeatmap(ruleset.RulesetInfo); + var workingBeatmap = new TestWorkingBeatmap(beatmap); + var playableBeatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods); + + return new GameplayState(playableBeatmap, ruleset, mods, score); + } + } +} From 0349d92f8b0b6802423efc5304df52f6db5af81c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 28 May 2022 17:45:00 +0300 Subject: [PATCH 1272/2328] Add failing test case --- .../Visual/Editing/TestSceneTimelineZoom.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs b/osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs new file mode 100644 index 0000000000..10f1f2fceb --- /dev/null +++ b/osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs @@ -0,0 +1,48 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Graphics; +using osu.Framework.Utils; + +namespace osu.Game.Tests.Visual.Editing +{ + public class TestSceneTimelineZoom : TimelineTestScene + { + public override Drawable CreateTestComponent() => Empty(); + + [Test] + public void TestVisibleRangeViaZoom() + { + double initialVisibleRange = 0; + + AddStep("reset zoom", () => TimelineArea.Timeline.Zoom = 100); + AddStep("get initial range", () => initialVisibleRange = TimelineArea.Timeline.VisibleRange); + + AddStep("scale zoom", () => TimelineArea.Timeline.Zoom = 200); + AddAssert("range halved", () => Precision.AlmostEquals(TimelineArea.Timeline.VisibleRange, initialVisibleRange / 2, 1)); + AddStep("descale zoom", () => TimelineArea.Timeline.Zoom = 50); + AddAssert("range doubled", () => Precision.AlmostEquals(TimelineArea.Timeline.VisibleRange, initialVisibleRange * 2, 1)); + + AddStep("restore zoom", () => TimelineArea.Timeline.Zoom = 100); + AddAssert("range restored", () => Precision.AlmostEquals(TimelineArea.Timeline.VisibleRange, initialVisibleRange, 1)); + } + + [Test] + public void TestVisibleRangeViaTimelineSize() + { + double initialVisibleRange = 0; + + AddStep("reset timeline size", () => TimelineArea.Timeline.Width = 1); + AddStep("get initial range", () => initialVisibleRange = TimelineArea.Timeline.VisibleRange); + + AddStep("scale timeline size", () => TimelineArea.Timeline.Width = 2); + AddAssert("range doubled", () => TimelineArea.Timeline.VisibleRange == initialVisibleRange * 2); + AddStep("descale timeline size", () => TimelineArea.Timeline.Width = 0.5f); + AddAssert("range halved", () => TimelineArea.Timeline.VisibleRange == initialVisibleRange / 2); + + AddStep("restore timeline size", () => TimelineArea.Timeline.Width = 1); + AddAssert("range restored", () => TimelineArea.Timeline.VisibleRange == initialVisibleRange); + } + } +} From 02baf9a97abe0fb6e94af53b83708a15a508d437 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 28 May 2022 17:45:33 +0300 Subject: [PATCH 1273/2328] Fix timeline objects disappearing prematurely on wide-screens --- osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index 6812bbb72d..2a6e8f5453 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -302,7 +302,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline /// /// The total amount of time visible on the timeline. /// - public double VisibleRange => track.Length / Zoom; + public double VisibleRange => (DisplayableContent / Content.DrawWidth) * track.Length; public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All) => new SnapResult(screenSpacePosition, beatSnapProvider.SnapTime(getTimeFromPosition(Content.ToLocalSpace(screenSpacePosition)))); From c7570fbce516ad0b35def7d696c885fd80f347f1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 29 May 2022 15:15:03 +0900 Subject: [PATCH 1274/2328] Fix potential `ObjectDisposedException` on realm notification in `SkinSection` --- osu.Game/Overlays/Settings/Sections/SkinSection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index a34776ddf0..264a05b4a7 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -111,7 +111,7 @@ namespace osu.Game.Overlays.Settings.Sections configBindable.Value = skin.NewValue.ID.ToString(); } - private void skinsChanged(IRealmCollection sender, ChangeSet changes, Exception error) + private void skinsChanged(IRealmCollection sender, ChangeSet changes, Exception error) => Schedule(() => { // This can only mean that realm is recycling, else we would see the protected skins. // Because we are using `Live<>` in this class, we don't need to worry about this scenario too much. @@ -130,7 +130,7 @@ namespace osu.Game.Overlays.Settings.Sections skinDropdown.Items = dropdownItems; updateSelectedSkinFromConfig(); - } + }); private void updateSelectedSkinFromConfig() { From 12d5b355e4d0385a0e0512adfc9a3d602c27c452 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 29 May 2022 15:22:23 +0300 Subject: [PATCH 1275/2328] Add failing test coverage --- .../TestSceneTimelineHitObjectBlueprint.cs | 24 +++++++++++++ .../Visual/Editing/TimelineTestScene.cs | 35 +++++++++++-------- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTimelineHitObjectBlueprint.cs b/osu.Game.Tests/Visual/Editing/TestSceneTimelineHitObjectBlueprint.cs index e6fad33a51..4bd90a0730 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTimelineHitObjectBlueprint.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTimelineHitObjectBlueprint.cs @@ -4,7 +4,9 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; +using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Screens.Edit.Compose.Components.Timeline; @@ -18,6 +20,28 @@ namespace osu.Game.Tests.Visual.Editing { public override Drawable CreateTestComponent() => new TimelineBlueprintContainer(Composer); + [Test] + public void TestContextMenu() + { + TimelineHitObjectBlueprint blueprint = null; + + AddStep("add object", () => + { + EditorBeatmap.Clear(); + EditorBeatmap.Add(new HitCircle { StartTime = 3000 }); + }); + + AddStep("click object", () => + { + blueprint = this.ChildrenOfType().Single(); + InputManager.MoveMouseTo(blueprint); + InputManager.Click(MouseButton.Left); + }); + + AddStep("right click", () => InputManager.Click(MouseButton.Right)); + AddAssert("context menu open", () => this.ChildrenOfType().SingleOrDefault()?.State == MenuState.Open); + } + [Test] public void TestDisallowZeroDurationObjects() { diff --git a/osu.Game.Tests/Visual/Editing/TimelineTestScene.cs b/osu.Game.Tests/Visual/Editing/TimelineTestScene.cs index 4aed445d9d..93bfb288d2 100644 --- a/osu.Game.Tests/Visual/Editing/TimelineTestScene.cs +++ b/osu.Game.Tests/Visual/Editing/TimelineTestScene.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; +using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Edit; using osu.Game.Screens.Edit; @@ -38,25 +39,29 @@ namespace osu.Game.Tests.Visual.Editing Composer = playable.BeatmapInfo.Ruleset.CreateInstance().CreateHitObjectComposer().With(d => d.Alpha = 0); - AddRange(new Drawable[] + Add(new OsuContextMenuContainer { - EditorBeatmap, - Composer, - new FillFlowContainer + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 5), - Children = new Drawable[] + EditorBeatmap, + Composer, + new FillFlowContainer { - new StartStopButton(), - new AudioVisualiser(), + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 5), + Children = new Drawable[] + { + new StartStopButton(), + new AudioVisualiser(), + } + }, + TimelineArea = new TimelineArea(CreateTestComponent()) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, } - }, - TimelineArea = new TimelineArea(CreateTestComponent()) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, } }); } From 9cc5df9b133450e987afce2187b01e73f0ba8c03 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 29 May 2022 14:56:51 +0300 Subject: [PATCH 1276/2328] Fix context menu no longer open on hitobjects in timeline --- osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index 6812bbb72d..89e9fb2404 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -16,6 +16,7 @@ using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osuTK; +using osuTK.Input; namespace osu.Game.Screens.Edit.Compose.Components.Timeline { @@ -273,7 +274,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline if (base.OnMouseDown(e)) beginUserDrag(); - return true; + // handling right button as well breaks context menus inside the timeline, only handle left button for now. + return e.Button == MouseButton.Left; } protected override void OnMouseUp(MouseUpEvent e) From 7c97719db1fa10a03ec3e5769b8c8cff4e67f4d6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 29 May 2022 21:28:09 +0900 Subject: [PATCH 1277/2328] Move `Schedule` to only drawable pieces --- osu.Game/Overlays/Settings/Sections/SkinSection.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index 264a05b4a7..a87e65b735 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -111,7 +111,7 @@ namespace osu.Game.Overlays.Settings.Sections configBindable.Value = skin.NewValue.ID.ToString(); } - private void skinsChanged(IRealmCollection sender, ChangeSet changes, Exception error) => Schedule(() => + private void skinsChanged(IRealmCollection sender, ChangeSet changes, Exception error) { // This can only mean that realm is recycling, else we would see the protected skins. // Because we are using `Live<>` in this class, we don't need to worry about this scenario too much. @@ -127,10 +127,13 @@ namespace osu.Game.Overlays.Settings.Sections dropdownItems.Add(skin.ToLive(realm)); dropdownItems.Insert(protectedCount, random_skin_info); - skinDropdown.Items = dropdownItems; + Schedule(() => + { + skinDropdown.Items = dropdownItems; - updateSelectedSkinFromConfig(); - }); + updateSelectedSkinFromConfig(); + }); + } private void updateSelectedSkinFromConfig() { From 70c8a439619910541cf4748d165efc3704103e05 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 29 May 2022 21:31:20 +0900 Subject: [PATCH 1278/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index ecc929a66d..c28085557e 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 950d4ceae1..79cfd7c917 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index bcff0d3c44..b1ba64beba 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From c078c06902014195534d24991d8e7168ddd4badc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 29 May 2022 22:55:53 +0900 Subject: [PATCH 1279/2328] Fix unsafe config fetching --- osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 0580d20171..4127b5f19b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -150,10 +150,14 @@ namespace osu.Game.Tests.Visual.Online public void TestChatHeight() { BindableFloat configChatHeight = new BindableFloat(); - config.BindWith(OsuSetting.ChatDisplayHeight, configChatHeight); + float newHeight = 0; - AddStep("Reset config chat height", () => configChatHeight.SetDefault()); + AddStep("Reset config chat height", () => + { + config.BindWith(OsuSetting.ChatDisplayHeight, configChatHeight); + configChatHeight.SetDefault(); + }); AddStep("Show overlay", () => chatOverlay.Show()); AddAssert("Overlay uses config height", () => chatOverlay.Height == configChatHeight.Default); AddStep("Click top bar", () => From 18f75d8c58e3aeb21011d1392ab8899d35ec9406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 29 May 2022 16:06:01 +0200 Subject: [PATCH 1280/2328] Remove redundant initialiser --- .../Visual/Editing/TestSceneTimelineHitObjectBlueprint.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTimelineHitObjectBlueprint.cs b/osu.Game.Tests/Visual/Editing/TestSceneTimelineHitObjectBlueprint.cs index 4bd90a0730..d55852ec43 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTimelineHitObjectBlueprint.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTimelineHitObjectBlueprint.cs @@ -23,7 +23,7 @@ namespace osu.Game.Tests.Visual.Editing [Test] public void TestContextMenu() { - TimelineHitObjectBlueprint blueprint = null; + TimelineHitObjectBlueprint blueprint; AddStep("add object", () => { From caee9e67b6687f94c1fa4e40b115c67a61a442b0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 29 May 2022 23:03:34 +0900 Subject: [PATCH 1281/2328] Centralise `DrawableChannel` checks and account for async load delays --- .../Visual/Online/TestSceneChatOverlayV2.cs | 51 ++++++++++--------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index 4127b5f19b..b333eee21b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -134,7 +134,7 @@ namespace osu.Game.Tests.Visual.Online channelManager.CurrentChannel.Value = joinedChannel; }); AddAssert("Overlay is visible", () => chatOverlay.State.Value == Visibility.Visible); - AddUntilStep("Channel is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + waitForChannel1Visible(); } [Test] @@ -181,7 +181,7 @@ namespace osu.Game.Tests.Visual.Online AddAssert("Listing is visible", () => listingIsVisible); AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); - AddUntilStep("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + waitForChannel1Visible(); } [Test] @@ -190,7 +190,7 @@ namespace osu.Game.Tests.Visual.Online AddStep("Show overlay", () => chatOverlay.Show()); AddAssert("Listing is visible", () => listingIsVisible); AddStep("Search for 'number 2'", () => chatOverlayTextBox.Text = "number 2"); - AddUntilStep("Only channel 2 visibile", () => + AddUntilStep("Only channel 2 visible", () => { IEnumerable listingItems = chatOverlay.ChildrenOfType() .Where(item => item.IsPresent); @@ -280,7 +280,7 @@ namespace osu.Game.Tests.Visual.Online }); }); AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel1)); - AddUntilStep("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + waitForChannel1Visible(); } [Test] @@ -303,7 +303,7 @@ namespace osu.Game.Tests.Visual.Online }); }); AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel2)); - AddUntilStep("Channel 2 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel2); + waitForChannel2Visible(); } [Test] @@ -327,7 +327,7 @@ namespace osu.Game.Tests.Visual.Online }); AddStep("Leave channel 2", () => channelManager.LeaveChannel(testChannel2)); AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel2)); - AddUntilStep("Channel 2 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel2); + waitForChannel2Visible(); } [Test] @@ -347,7 +347,7 @@ namespace osu.Game.Tests.Visual.Online }); }); AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel1)); - AddUntilStep("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + waitForChannel1Visible(); } [Test] @@ -368,7 +368,7 @@ namespace osu.Game.Tests.Visual.Online }); AddStep("Set null channel", () => channelManager.CurrentChannel.Value = null); AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, testChannel1)); - AddUntilStep("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + waitForChannel1Visible(); } [Test] @@ -378,6 +378,7 @@ namespace osu.Game.Tests.Visual.Online AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); + waitForChannel1Visible(); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); AddStep("Click drawable channel", () => clickDrawable(currentDrawableChannel)); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); @@ -415,11 +416,11 @@ namespace osu.Game.Tests.Visual.Online AddStep("Finish channel 2 load", () => chatOverlay.GetSlowLoadingChannel(testChannel2).LoadEvent.Set()); AddAssert("Channel 2 loaded", () => chatOverlay.GetSlowLoadingChannel(testChannel2).IsLoaded); - AddAssert("Channel 2 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel2); + waitForChannel2Visible(); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); AddAssert("Channel 1 loaded", () => chatOverlay.GetSlowLoadingChannel(testChannel1).IsLoaded); - AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + waitForChannel1Visible(); } [Test] @@ -430,13 +431,12 @@ namespace osu.Game.Tests.Visual.Online channelManager.JoinChannel(testChannel1); chatOverlay.Show(); }); - AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); - + waitForChannel1Visible(); AddStep("Press document close keys", () => InputManager.Keys(PlatformAction.DocumentClose)); AddAssert("Listing is visible", () => listingIsVisible); AddStep("Press tab restore keys", () => InputManager.Keys(PlatformAction.TabRestore)); - AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + waitForChannel1Visible(); } [Test] @@ -447,8 +447,7 @@ namespace osu.Game.Tests.Visual.Online channelManager.JoinChannel(testChannel1); chatOverlay.Show(); }); - AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); - + waitForChannel1Visible(); AddStep("Press tab new keys", () => InputManager.Keys(PlatformAction.TabNew)); AddAssert("Listing is visible", () => listingIsVisible); } @@ -468,21 +467,26 @@ namespace osu.Game.Tests.Visual.Online chatOverlay.Show(); }); - AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + waitForChannel1Visible(); + AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext)); + waitForChannel2Visible(); AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext)); - AddAssert("Channel 2 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel2); + AddUntilStep("PM Channel 1 displayed", () => channelIsVisible && currentDrawableChannel?.Channel == pmChannel1); AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext)); - AddAssert("PM Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == pmChannel1); + AddUntilStep("PM Channel 2 displayed", () => channelIsVisible && currentDrawableChannel?.Channel == pmChannel2); AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext)); - AddAssert("PM Channel 2 displayed", () => channelIsVisible && currentDrawableChannel.Channel == pmChannel2); - - AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext)); - AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1); + waitForChannel1Visible(); } + private void waitForChannel1Visible() => + AddUntilStep("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel?.Channel == testChannel1); + + private void waitForChannel2Visible() => + AddUntilStep("Channel 2 is visible", () => channelIsVisible && currentDrawableChannel?.Channel == testChannel2); + private bool listingIsVisible => chatOverlay.ChildrenOfType().Single().State.Value == Visibility.Visible; @@ -492,8 +496,9 @@ namespace osu.Game.Tests.Visual.Online private bool channelIsVisible => !listingIsVisible && !loadingIsVisible; + [CanBeNull] private DrawableChannel currentDrawableChannel => - chatOverlay.ChildrenOfType().Single(); + chatOverlay.ChildrenOfType().SingleOrDefault(); private ChannelListItem getChannelListItem(Channel channel) => chatOverlay.ChildrenOfType().Single(item => item.Channel == channel); From e69f8716cd05105e029f31ff3600200dec58c8c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 29 May 2022 18:56:37 +0200 Subject: [PATCH 1282/2328] Fix incorrect indent size --- osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 0f3d8574c1..20c8b6d32d 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -27,9 +27,9 @@ namespace osu.Game.Overlays.Chat.ChannelList public Action? OnRequestLeave; public IEnumerable Channels => groupFlow.Children.Where(child => child is ChannelGroup) - .Cast() - .SelectMany(channelGroup => channelGroup.ItemFlow) - .Select(item => item.Channel); + .Cast() + .SelectMany(channelGroup => channelGroup.ItemFlow) + .Select(item => item.Channel); public readonly ChannelListing.ChannelListingChannel ChannelListingChannel = new ChannelListing.ChannelListingChannel(); From e329c160b37bbccbd0231b67db2dd0ae6fa40be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 29 May 2022 18:58:27 +0200 Subject: [PATCH 1283/2328] Simplify channel retrieval expression --- osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 20c8b6d32d..47a2d234d1 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -26,8 +26,8 @@ namespace osu.Game.Overlays.Chat.ChannelList public Action? OnRequestSelect; public Action? OnRequestLeave; - public IEnumerable Channels => groupFlow.Children.Where(child => child is ChannelGroup) - .Cast() + public IEnumerable Channels => groupFlow.Children + .OfType() .SelectMany(channelGroup => channelGroup.ItemFlow) .Select(item => item.Channel); From c892ec83efb478c12c617bc191a7b964bc4d672b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 29 May 2022 20:15:17 +0200 Subject: [PATCH 1284/2328] Fix wrong sizing of editor timeline ticks --- .../Edit/Compose/Components/Timeline/TimelineTickDisplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs index fda8416ecd..9904d91653 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs @@ -135,7 +135,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline Vector2 size = Vector2.One; - if (indexInBar != 1) + if (indexInBar != 0) size = BindableBeatDivisor.GetSize(divisor); var line = getNextUsableLine(); From 8f596520f3ea360cd5398fa42c762a9a3ee37e66 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sun, 29 May 2022 20:07:42 +0100 Subject: [PATCH 1285/2328] Remove old chat overlay components --- .../Online/TestSceneChannelTabControl.cs | 129 ---- .../Visual/Online/TestSceneChatOverlay.cs | 663 ------------------ osu.Game/Online/Chat/ChannelManager.cs | 3 +- .../Chat/Selection/ChannelListItem.cs | 191 ----- .../Overlays/Chat/Selection/ChannelSection.cs | 58 -- .../Chat/Selection/ChannelSelectionOverlay.cs | 194 ----- .../Chat/Tabs/ChannelSelectorTabItem.cs | 46 -- .../Overlays/Chat/Tabs/ChannelTabControl.cs | 114 --- osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs | 238 ------- .../Chat/Tabs/PrivateChannelTabItem.cs | 95 --- osu.Game/Overlays/Chat/Tabs/TabCloseButton.cs | 55 -- osu.Game/Overlays/ChatOverlay.cs | 525 -------------- 12 files changed, 1 insertion(+), 2310 deletions(-) delete mode 100644 osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs delete mode 100644 osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs delete mode 100644 osu.Game/Overlays/Chat/Selection/ChannelListItem.cs delete mode 100644 osu.Game/Overlays/Chat/Selection/ChannelSection.cs delete mode 100644 osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs delete mode 100644 osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs delete mode 100644 osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs delete mode 100644 osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs delete mode 100644 osu.Game/Overlays/Chat/Tabs/PrivateChannelTabItem.cs delete mode 100644 osu.Game/Overlays/Chat/Tabs/TabCloseButton.cs delete mode 100644 osu.Game/Overlays/ChatOverlay.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs deleted file mode 100644 index e6eaffc4c1..0000000000 --- a/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs +++ /dev/null @@ -1,129 +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 System.Collections.Generic; -using System.Linq; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Utils; -using osu.Game.Graphics.Sprites; -using osu.Game.Online.API.Requests.Responses; -using osu.Game.Online.Chat; -using osu.Game.Overlays.Chat.Tabs; -using osuTK.Graphics; - -namespace osu.Game.Tests.Visual.Online -{ - public class TestSceneChannelTabControl : OsuTestScene - { - private readonly TestTabControl channelTabControl; - - public TestSceneChannelTabControl() - { - SpriteText currentText; - Add(new Container - { - RelativeSizeAxes = Axes.X, - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Children = new Drawable[] - { - channelTabControl = new TestTabControl - { - RelativeSizeAxes = Axes.X, - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Height = 50 - }, - new Box - { - Colour = Color4.Black.Opacity(0.1f), - RelativeSizeAxes = Axes.X, - Height = 50, - Depth = -1, - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - } - } - }); - - Add(new Container - { - Origin = Anchor.TopLeft, - Anchor = Anchor.TopLeft, - Children = new Drawable[] - { - currentText = new OsuSpriteText - { - Text = "Currently selected channel:" - } - } - }); - - channelTabControl.OnRequestLeave += channel => channelTabControl.RemoveChannel(channel); - channelTabControl.Current.ValueChanged += channel => currentText.Text = "Currently selected channel: " + channel.NewValue; - - AddStep("Add random private channel", addRandomPrivateChannel); - AddAssert("There is only one channels", () => channelTabControl.Items.Count == 2); - AddRepeatStep("Add 3 random private channels", addRandomPrivateChannel, 3); - AddAssert("There are four channels", () => channelTabControl.Items.Count == 5); - AddStep("Add random public channel", () => addChannel(RNG.Next().ToString())); - - AddRepeatStep("Select a random channel", () => - { - List validChannels = channelTabControl.Items.Where(c => !(c is ChannelSelectorTabItem.ChannelSelectorTabChannel)).ToList(); - channelTabControl.SelectChannel(validChannels[RNG.Next(0, validChannels.Count)]); - }, 20); - - Channel channelBefore = null; - AddStep("set first channel", () => channelTabControl.SelectChannel(channelBefore = channelTabControl.Items.First(c => !(c is ChannelSelectorTabItem.ChannelSelectorTabChannel)))); - - AddStep("select selector tab", () => channelTabControl.SelectChannel(channelTabControl.Items.Single(c => c is ChannelSelectorTabItem.ChannelSelectorTabChannel))); - AddAssert("selector tab is active", () => channelTabControl.ChannelSelectorActive.Value); - - AddAssert("check channel unchanged", () => channelBefore == channelTabControl.Current.Value); - - AddStep("set second channel", () => channelTabControl.SelectChannel(channelTabControl.Items.GetNext(channelBefore))); - AddAssert("selector tab is inactive", () => !channelTabControl.ChannelSelectorActive.Value); - - AddUntilStep("remove all channels", () => - { - foreach (var item in channelTabControl.Items.ToList()) - { - if (item is ChannelSelectorTabItem.ChannelSelectorTabChannel) - continue; - - channelTabControl.RemoveChannel(item); - return false; - } - - return true; - }); - - AddAssert("selector tab is active", () => channelTabControl.ChannelSelectorActive.Value); - } - - private void addRandomPrivateChannel() => - channelTabControl.AddChannel(new Channel(new APIUser - { - Id = RNG.Next(1000, 10000000), - Username = "Test User " + RNG.Next(1000) - })); - - private void addChannel(string name) => - channelTabControl.AddChannel(new Channel - { - Type = ChannelType.Public, - Name = name - }); - - private class TestTabControl : ChannelTabControl - { - public void SelectChannel(Channel channel) => base.SelectTab(TabMap[channel]); - } - } -} diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs deleted file mode 100644 index 4d1dee1650..0000000000 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs +++ /dev/null @@ -1,663 +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 System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using JetBrains.Annotations; -using NUnit.Framework; -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; -using osu.Framework.Testing; -using osu.Game.Graphics.UserInterface; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests; -using osu.Game.Online.API.Requests.Responses; -using osu.Game.Online.Chat; -using osu.Game.Overlays; -using osu.Game.Overlays.Chat; -using osu.Game.Overlays.Chat.Selection; -using osu.Game.Overlays.Chat.Tabs; -using osuTK.Input; - -namespace osu.Game.Tests.Visual.Online -{ - public class TestSceneChatOverlay : OsuManualInputManagerTestScene - { - private TestChatOverlay chatOverlay; - private ChannelManager channelManager; - - private IEnumerable visibleChannels => chatOverlay.ChannelTabControl.VisibleItems.Where(channel => channel.Name != "+"); - private IEnumerable joinedChannels => chatOverlay.ChannelTabControl.Items.Where(channel => channel.Name != "+"); - private readonly List channels; - - private Channel currentChannel => channelManager.CurrentChannel.Value; - private Channel nextChannel => joinedChannels.ElementAt(joinedChannels.ToList().IndexOf(currentChannel) + 1); - private Channel previousChannel => joinedChannels.ElementAt(joinedChannels.ToList().IndexOf(currentChannel) - 1); - private Channel channel1 => channels[0]; - private Channel channel2 => channels[1]; - private Channel channel3 => channels[2]; - - [CanBeNull] - private Func> onGetMessages; - - public TestSceneChatOverlay() - { - channels = Enumerable.Range(1, 10) - .Select(index => new Channel(new APIUser()) - { - Name = $"Channel no. {index}", - Topic = index == 3 ? null : $"We talk about the number {index} here", - Type = index % 2 == 0 ? ChannelType.PM : ChannelType.Temporary, - Id = index - }) - .ToList(); - } - - [SetUp] - public void Setup() - { - Schedule(() => - { - ChannelManagerContainer container; - - Child = container = new ChannelManagerContainer(channels) - { - RelativeSizeAxes = Axes.Both, - }; - - chatOverlay = container.ChatOverlay; - channelManager = container.ChannelManager; - }); - } - - [SetUpSteps] - public void SetUpSteps() - { - AddStep("register request handling", () => - { - onGetMessages = null; - - ((DummyAPIAccess)API).HandleRequest = req => - { - switch (req) - { - case JoinChannelRequest joinChannel: - joinChannel.TriggerSuccess(); - return true; - - case GetUserRequest getUser: - if (getUser.Lookup.Equals("some body", StringComparison.OrdinalIgnoreCase)) - { - getUser.TriggerSuccess(new APIUser - { - Username = "some body", - Id = 1, - }); - } - else - { - getUser.TriggerFailure(new WebException()); - } - - return true; - - case GetMessagesRequest getMessages: - var messages = onGetMessages?.Invoke(getMessages.Channel); - if (messages != null) - getMessages.TriggerSuccess(messages); - return true; - } - - return false; - }; - }); - } - - [Test] - public void TestHideOverlay() - { - AddStep("Open chat overlay", () => chatOverlay.Show()); - - AddAssert("Chat overlay is visible", () => chatOverlay.State.Value == Visibility.Visible); - AddAssert("Selector is visible", () => chatOverlay.SelectionOverlayState == Visibility.Visible); - - AddStep("Close chat overlay", () => chatOverlay.Hide()); - - AddAssert("Chat overlay was hidden", () => chatOverlay.State.Value == Visibility.Hidden); - AddAssert("Channel selection overlay was hidden", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); - } - - [Test] - public void TestChannelSelection() - { - AddStep("Open chat overlay", () => chatOverlay.Show()); - AddAssert("Selector is visible", () => chatOverlay.SelectionOverlayState == Visibility.Visible); - AddStep("Setup get message response", () => onGetMessages = channel => - { - if (channel == channel1) - { - return new List - { - new Message(1) - { - ChannelId = channel1.Id, - Content = "hello from channel 1!", - Sender = new APIUser - { - Id = 2, - Username = "test_user" - } - } - }; - } - - return null; - }); - - AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); - AddStep("Switch to channel 1", () => clickDrawable(chatOverlay.TabMap[channel1])); - - AddAssert("Current channel is channel 1", () => currentChannel == channel1); - AddUntilStep("Loading spinner hidden", () => chatOverlay.ChildrenOfType().All(spinner => !spinner.IsPresent)); - AddAssert("Channel message shown", () => chatOverlay.ChildrenOfType().Count() == 1); - AddAssert("Channel selector was closed", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); - } - - [Test] - public void TestSearchInSelector() - { - AddStep("Open chat overlay", () => chatOverlay.Show()); - AddStep("Search for 'no. 2'", () => chatOverlay.ChildrenOfType().First().Text = "no. 2"); - AddUntilStep("Only channel 2 visible", () => - { - var listItems = chatOverlay.ChildrenOfType().Where(c => c.IsPresent); - return listItems.Count() == 1 && listItems.Single().Channel == channel2; - }); - } - - [Test] - public void TestChannelShortcutKeys() - { - AddStep("Open chat overlay", () => chatOverlay.Show()); - AddStep("Join channels", () => channels.ForEach(channel => channelManager.JoinChannel(channel))); - AddStep("Close channel selector", () => InputManager.Key(Key.Escape)); - AddUntilStep("Wait for close", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); - - for (int zeroBasedIndex = 0; zeroBasedIndex < 10; ++zeroBasedIndex) - { - int oneBasedIndex = zeroBasedIndex + 1; - int targetNumberKey = oneBasedIndex % 10; - var targetChannel = channels[zeroBasedIndex]; - AddStep($"Press Alt+{targetNumberKey}", () => pressChannelHotkey(targetNumberKey)); - AddAssert($"Channel #{oneBasedIndex} is selected", () => currentChannel == targetChannel); - } - } - - private Channel expectedChannel; - - [Test] - public void TestCloseChannelBehaviour() - { - AddStep("Open chat overlay", () => chatOverlay.Show()); - AddUntilStep("Join until dropdown has channels", () => - { - if (visibleChannels.Count() < joinedChannels.Count()) - return true; - - // Using temporary channels because they don't hide their names when not active - channelManager.JoinChannel(new Channel - { - Name = $"Channel no. {joinedChannels.Count() + 11}", - Type = ChannelType.Temporary - }); - - return false; - }); - - AddStep("Switch to last tab", () => clickDrawable(chatOverlay.TabMap[visibleChannels.Last()])); - AddAssert("Last visible selected", () => currentChannel == visibleChannels.Last()); - - // Closing the last channel before dropdown - AddStep("Close current channel", () => - { - expectedChannel = nextChannel; - chatOverlay.ChannelTabControl.RemoveChannel(currentChannel); - }); - AddAssert("Next channel selected", () => currentChannel == expectedChannel); - AddAssert("Selector remained closed", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); - - // Depending on the window size, one more channel might need to be closed for the selectorTab to appear - AddUntilStep("Close channels until selector visible", () => - { - if (chatOverlay.ChannelTabControl.VisibleItems.Last().Name == "+") - return true; - - chatOverlay.ChannelTabControl.RemoveChannel(visibleChannels.Last()); - return false; - }); - AddAssert("Last visible selected", () => currentChannel == visibleChannels.Last()); - - // Closing the last channel with dropdown no longer present - AddStep("Close last when selector next", () => - { - expectedChannel = previousChannel; - chatOverlay.ChannelTabControl.RemoveChannel(currentChannel); - }); - AddAssert("Previous channel selected", () => currentChannel == expectedChannel); - - // Standard channel closing - AddStep("Switch to previous channel", () => chatOverlay.ChannelTabControl.SwitchTab(-1)); - AddStep("Close current channel", () => - { - expectedChannel = nextChannel; - chatOverlay.ChannelTabControl.RemoveChannel(currentChannel); - }); - AddAssert("Next channel selected", () => currentChannel == expectedChannel); - - // Selector reappearing after all channels closed - AddUntilStep("Close all channels", () => - { - if (!joinedChannels.Any()) - return true; - - chatOverlay.ChannelTabControl.RemoveChannel(joinedChannels.Last()); - return false; - }); - AddAssert("Selector is visible", () => chatOverlay.SelectionOverlayState == Visibility.Visible); - } - - [Test] - public void TestChannelCloseButton() - { - AddStep("Open chat overlay", () => chatOverlay.Show()); - AddStep("Join 2 channels", () => - { - channelManager.JoinChannel(channel1); - channelManager.JoinChannel(channel2); - }); - - // PM channel close button only appears when active - AddStep("Select PM channel", () => clickDrawable(chatOverlay.TabMap[channel2])); - AddStep("Click PM close button", () => clickDrawable(((TestPrivateChannelTabItem)chatOverlay.TabMap[channel2]).CloseButton.Child)); - AddAssert("PM channel closed", () => !channelManager.JoinedChannels.Contains(channel2)); - - // Non-PM chat channel close button only appears when hovered - AddStep("Hover normal channel tab", () => InputManager.MoveMouseTo(chatOverlay.TabMap[channel1])); - AddStep("Click normal close button", () => clickDrawable(((TestChannelTabItem)chatOverlay.TabMap[channel1]).CloseButton.Child)); - AddAssert("All channels closed", () => !channelManager.JoinedChannels.Any()); - } - - [Test] - public void TestCloseTabShortcut() - { - AddStep("Open chat overlay", () => chatOverlay.Show()); - AddStep("Join 2 channels", () => - { - channelManager.JoinChannel(channel1); - channelManager.JoinChannel(channel2); - }); - - // Want to close channel 2 - AddStep("Select channel 2", () => clickDrawable(chatOverlay.TabMap[channel2])); - AddStep("Close tab via shortcut", pressCloseDocumentKeys); - - // Channel 2 should be closed - AddAssert("Channel 1 open", () => channelManager.JoinedChannels.Contains(channel1)); - AddAssert("Channel 2 closed", () => !channelManager.JoinedChannels.Contains(channel2)); - - // Want to close channel 1 - AddStep("Select channel 1", () => clickDrawable(chatOverlay.TabMap[channel1])); - - AddStep("Close tab via shortcut", pressCloseDocumentKeys); - // Channel 1 and channel 2 should be closed - AddAssert("All channels closed", () => !channelManager.JoinedChannels.Any()); - } - - [Test] - public void TestNewTabShortcut() - { - AddStep("Open chat overlay", () => chatOverlay.Show()); - AddStep("Join 2 channels", () => - { - channelManager.JoinChannel(channel1); - channelManager.JoinChannel(channel2); - }); - - // Want to join another channel - AddStep("Press new tab shortcut", pressNewTabKeys); - - // Selector should be visible - AddAssert("Selector is visible", () => chatOverlay.SelectionOverlayState == Visibility.Visible); - } - - [Test] - public void TestRestoreTabShortcut() - { - AddStep("Open chat overlay", () => chatOverlay.Show()); - AddStep("Join 3 channels", () => - { - channelManager.JoinChannel(channel1); - channelManager.JoinChannel(channel2); - channelManager.JoinChannel(channel3); - }); - - // Should do nothing - AddStep("Restore tab via shortcut", pressRestoreTabKeys); - AddAssert("All channels still open", () => channelManager.JoinedChannels.Count == 3); - - // Close channel 1 - AddStep("Select channel 1", () => clickDrawable(chatOverlay.TabMap[channel1])); - AddStep("Click normal close button", () => clickDrawable(((TestChannelTabItem)chatOverlay.TabMap[channel1]).CloseButton.Child)); - AddAssert("Channel 1 closed", () => !channelManager.JoinedChannels.Contains(channel1)); - AddAssert("Other channels still open", () => channelManager.JoinedChannels.Count == 2); - - // Reopen channel 1 - AddStep("Restore tab via shortcut", pressRestoreTabKeys); - AddAssert("All channels now open", () => channelManager.JoinedChannels.Count == 3); - AddAssert("Current channel is channel 1", () => currentChannel == channel1); - - // Close two channels - AddStep("Select channel 1", () => clickDrawable(chatOverlay.TabMap[channel1])); - AddStep("Close channel 1", () => clickDrawable(((TestChannelTabItem)chatOverlay.TabMap[channel1]).CloseButton.Child)); - AddStep("Select channel 2", () => clickDrawable(chatOverlay.TabMap[channel2])); - AddStep("Close channel 2", () => clickDrawable(((TestPrivateChannelTabItem)chatOverlay.TabMap[channel2]).CloseButton.Child)); - AddAssert("Only one channel open", () => channelManager.JoinedChannels.Count == 1); - AddAssert("Current channel is channel 3", () => currentChannel == channel3); - - // Should first re-open channel 2 - AddStep("Restore tab via shortcut", pressRestoreTabKeys); - AddAssert("Channel 1 still closed", () => !channelManager.JoinedChannels.Contains(channel1)); - AddAssert("Channel 2 now open", () => channelManager.JoinedChannels.Contains(channel2)); - AddAssert("Current channel is channel 2", () => currentChannel == channel2); - - // Should then re-open channel 1 - AddStep("Restore tab via shortcut", pressRestoreTabKeys); - AddAssert("All channels now open", () => channelManager.JoinedChannels.Count == 3); - AddAssert("Current channel is channel 1", () => currentChannel == channel1); - } - - [Test] - public void TestChatCommand() - { - AddStep("Open chat overlay", () => chatOverlay.Show()); - AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); - AddStep("Select channel 1", () => clickDrawable(chatOverlay.TabMap[channel1])); - - AddStep("Open chat with user", () => channelManager.PostCommand("chat some body")); - AddAssert("PM channel is selected", () => - channelManager.CurrentChannel.Value.Type == ChannelType.PM && channelManager.CurrentChannel.Value.Users.Single().Username == "some body"); - - AddStep("Open chat with non-existent user", () => channelManager.PostCommand("chat nobody")); - AddAssert("Last message is error", () => channelManager.CurrentChannel.Value.Messages.Last() is ErrorMessage); - - // Make sure no unnecessary requests are made when the PM channel is already open. - AddStep("Select channel 1", () => clickDrawable(chatOverlay.TabMap[channel1])); - AddStep("Unregister request handling", () => ((DummyAPIAccess)API).HandleRequest = null); - AddStep("Open chat with user", () => channelManager.PostCommand("chat some body")); - AddAssert("PM channel is selected", () => - channelManager.CurrentChannel.Value.Type == ChannelType.PM && channelManager.CurrentChannel.Value.Users.Single().Username == "some body"); - } - - [Test] - public void TestMultiplayerChannelIsNotShown() - { - Channel multiplayerChannel = null; - - AddStep("open chat overlay", () => chatOverlay.Show()); - - AddStep("join multiplayer channel", () => channelManager.JoinChannel(multiplayerChannel = new Channel(new APIUser()) - { - Name = "#mp_1", - Type = ChannelType.Multiplayer, - })); - - AddAssert("channel joined", () => channelManager.JoinedChannels.Contains(multiplayerChannel)); - AddAssert("channel not present in overlay", () => !chatOverlay.TabMap.ContainsKey(multiplayerChannel)); - AddAssert("multiplayer channel is not current", () => channelManager.CurrentChannel.Value != multiplayerChannel); - - AddStep("leave channel", () => channelManager.LeaveChannel(multiplayerChannel)); - AddAssert("channel left", () => !channelManager.JoinedChannels.Contains(multiplayerChannel)); - } - - [Test] - public void TestHighlightOnCurrentChannel() - { - Message message = null; - - AddStep("Open chat overlay", () => chatOverlay.Show()); - AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); - AddStep("Select channel 1", () => clickDrawable(chatOverlay.TabMap[channel1])); - - AddStep("Send message in channel 1", () => - { - channel1.AddNewMessages(message = new Message - { - ChannelId = channel1.Id, - Content = "Message to highlight!", - Timestamp = DateTimeOffset.Now, - Sender = new APIUser - { - Id = 2, - Username = "Someone", - } - }); - }); - - AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, channel1)); - } - - [Test] - public void TestHighlightOnAnotherChannel() - { - Message message = null; - - AddStep("Open chat overlay", () => chatOverlay.Show()); - AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); - AddStep("Select channel 1", () => clickDrawable(chatOverlay.TabMap[channel1])); - - AddStep("Join channel 2", () => channelManager.JoinChannel(channel2)); - AddStep("Send message in channel 2", () => - { - channel2.AddNewMessages(message = new Message - { - ChannelId = channel2.Id, - Content = "Message to highlight!", - Timestamp = DateTimeOffset.Now, - Sender = new APIUser - { - Id = 2, - Username = "Someone", - } - }); - }); - - AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, channel2)); - AddAssert("Switched to channel 2", () => channelManager.CurrentChannel.Value == channel2); - } - - [Test] - public void TestHighlightOnLeftChannel() - { - Message message = null; - - AddStep("Open chat overlay", () => chatOverlay.Show()); - - AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); - AddStep("Select channel 1", () => clickDrawable(chatOverlay.TabMap[channel1])); - - AddStep("Join channel 2", () => channelManager.JoinChannel(channel2)); - AddStep("Send message in channel 2", () => - { - channel2.AddNewMessages(message = new Message - { - ChannelId = channel2.Id, - Content = "Message to highlight!", - Timestamp = DateTimeOffset.Now, - Sender = new APIUser - { - Id = 2, - Username = "Someone", - } - }); - }); - AddStep("Leave channel 2", () => channelManager.LeaveChannel(channel2)); - - AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, channel2)); - AddAssert("Switched to channel 2", () => channelManager.CurrentChannel.Value == channel2); - } - - [Test] - public void TestHighlightWhileChatNeverOpen() - { - Message message = null; - - AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); - - AddStep("Send message in channel 1", () => - { - channel1.AddNewMessages(message = new Message - { - ChannelId = channel1.Id, - Content = "Message to highlight!", - Timestamp = DateTimeOffset.Now, - Sender = new APIUser - { - Id = 2, - Username = "Someone", - } - }); - }); - - AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, channel1)); - } - - [Test] - public void TestHighlightWithNullChannel() - { - Message message = null; - - AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); - - AddStep("Send message in channel 1", () => - { - channel1.AddNewMessages(message = new Message - { - ChannelId = channel1.Id, - Content = "Message to highlight!", - Timestamp = DateTimeOffset.Now, - Sender = new APIUser - { - Id = 2, - Username = "Someone", - } - }); - }); - - AddStep("Set null channel", () => channelManager.CurrentChannel.Value = null); - AddStep("Highlight message", () => chatOverlay.HighlightMessage(message, channel1)); - } - - private void pressChannelHotkey(int number) - { - var channelKey = Key.Number0 + number; - InputManager.PressKey(Key.AltLeft); - InputManager.Key(channelKey); - InputManager.ReleaseKey(Key.AltLeft); - } - - private void pressCloseDocumentKeys() => InputManager.Keys(PlatformAction.DocumentClose); - - private void pressNewTabKeys() => InputManager.Keys(PlatformAction.TabNew); - - private void pressRestoreTabKeys() => InputManager.Keys(PlatformAction.TabRestore); - - private void clickDrawable(Drawable d) - { - InputManager.MoveMouseTo(d); - InputManager.Click(MouseButton.Left); - } - - private class ChannelManagerContainer : Container - { - public TestChatOverlay ChatOverlay { get; private set; } - - [Cached] - public ChannelManager ChannelManager { get; } = new ChannelManager(); - - private readonly List channels; - - public ChannelManagerContainer(List channels) - { - this.channels = channels; - } - - [BackgroundDependencyLoader] - private void load() - { - ((BindableList)ChannelManager.AvailableChannels).AddRange(channels); - - InternalChildren = new Drawable[] - { - ChannelManager, - ChatOverlay = new TestChatOverlay { RelativeSizeAxes = Axes.Both, }, - }; - } - } - - private class TestChatOverlay : ChatOverlay - { - public Visibility SelectionOverlayState => ChannelSelectionOverlay.State.Value; - - public new ChannelTabControl ChannelTabControl => base.ChannelTabControl; - - public new ChannelSelectionOverlay ChannelSelectionOverlay => base.ChannelSelectionOverlay; - - protected override ChannelTabControl CreateChannelTabControl() => new TestTabControl(); - - public IReadOnlyDictionary> TabMap => ((TestTabControl)ChannelTabControl).TabMap; - } - - private class TestTabControl : ChannelTabControl - { - protected override TabItem CreateTabItem(Channel value) - { - switch (value.Type) - { - case ChannelType.PM: - return new TestPrivateChannelTabItem(value); - - default: - return new TestChannelTabItem(value); - } - } - - public new IReadOnlyDictionary> TabMap => base.TabMap; - } - - private class TestChannelTabItem : ChannelTabItem - { - public TestChannelTabItem(Channel channel) - : base(channel) - { - } - - public new ClickableContainer CloseButton => base.CloseButton; - } - - private class TestPrivateChannelTabItem : PrivateChannelTabItem - { - public TestPrivateChannelTabItem(Channel channel) - : base(channel) - { - } - - public new ClickableContainer CloseButton => base.CloseButton; - } - } -} diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index b7d67de04d..31f67bcecc 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -15,7 +15,6 @@ using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Chat.Listing; -using osu.Game.Overlays.Chat.Tabs; namespace osu.Game.Online.Chat { @@ -134,7 +133,7 @@ namespace osu.Game.Online.Chat private void currentChannelChanged(ValueChangedEvent e) { - bool isSelectorChannel = e.NewValue is ChannelSelectorTabItem.ChannelSelectorTabChannel || e.NewValue is ChannelListing.ChannelListingChannel; + bool isSelectorChannel = e.NewValue is ChannelListing.ChannelListingChannel; if (!isSelectorChannel) JoinChannel(e.NewValue); diff --git a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs deleted file mode 100644 index 59989ade7b..0000000000 --- a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs +++ /dev/null @@ -1,191 +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 System; -using System.Collections.Generic; -using osuTK; -using osuTK.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.Events; -using osu.Framework.Localisation; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Online.Chat; -using osu.Game.Graphics.Containers; - -namespace osu.Game.Overlays.Chat.Selection -{ - public class ChannelListItem : OsuClickableContainer, IFilterable - { - private const float width_padding = 5; - private const float channel_width = 150; - private const float text_size = 15; - private const float transition_duration = 100; - - public readonly Channel Channel; - - private readonly Bindable joinedBind = new Bindable(); - private readonly OsuSpriteText name; - private readonly OsuSpriteText topic; - private readonly SpriteIcon joinedCheckmark; - - private Color4 joinedColour; - private Color4 topicColour; - private Color4 hoverColour; - - public IEnumerable FilterTerms => new LocalisableString[] { Channel.Name, Channel.Topic ?? string.Empty }; - - public bool MatchingFilter - { - set => this.FadeTo(value ? 1f : 0f, 100); - } - - public bool FilteringActive { get; set; } - - public Action OnRequestJoin; - public Action OnRequestLeave; - - public ChannelListItem(Channel channel) - { - Channel = channel; - - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - - Action = () => { (channel.Joined.Value ? OnRequestLeave : OnRequestJoin)?.Invoke(channel); }; - - Children = new Drawable[] - { - new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Horizontal, - Children = new Drawable[] - { - new Container - { - Children = new[] - { - joinedCheckmark = new SpriteIcon - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Icon = FontAwesome.Solid.CheckCircle, - Size = new Vector2(text_size), - Shadow = false, - Margin = new MarginPadding { Right = 10f }, - }, - }, - }, - new Container - { - Width = channel_width, - AutoSizeAxes = Axes.Y, - Children = new[] - { - name = new OsuSpriteText - { - Text = channel.ToString(), - Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold), - Shadow = false, - }, - }, - }, - new Container - { - RelativeSizeAxes = Axes.X, - Width = 0.7f, - AutoSizeAxes = Axes.Y, - Margin = new MarginPadding { Left = width_padding }, - Children = new[] - { - topic = new OsuSpriteText - { - Text = channel.Topic, - Font = OsuFont.GetFont(size: text_size, weight: FontWeight.SemiBold), - Shadow = false, - }, - }, - }, - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Margin = new MarginPadding { Left = width_padding }, - Spacing = new Vector2(3f, 0f), - Children = new Drawable[] - { - new SpriteIcon - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Icon = FontAwesome.Solid.User, - Size = new Vector2(text_size - 2), - Shadow = false, - }, - new OsuSpriteText - { - Text = @"0", - Font = OsuFont.GetFont(size: text_size, weight: FontWeight.SemiBold), - Shadow = false, - }, - }, - }, - }, - }, - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - topicColour = colours.Gray9; - joinedColour = colours.Blue; - hoverColour = colours.Yellow; - - joinedBind.ValueChanged += joined => updateColour(joined.NewValue); - joinedBind.BindTo(Channel.Joined); - - joinedBind.TriggerChange(); - FinishTransforms(true); - } - - protected override bool OnHover(HoverEvent e) - { - if (!Channel.Joined.Value) - name.FadeColour(hoverColour, 50, Easing.OutQuint); - - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - if (!Channel.Joined.Value) - name.FadeColour(Color4.White, transition_duration); - } - - private void updateColour(bool joined) - { - if (joined) - { - name.FadeColour(Color4.White, transition_duration); - joinedCheckmark.FadeTo(1f, transition_duration); - topic.FadeTo(0.8f, transition_duration); - topic.FadeColour(Color4.White, transition_duration); - this.FadeColour(joinedColour, transition_duration); - } - else - { - joinedCheckmark.FadeTo(0f, transition_duration); - topic.FadeTo(1f, transition_duration); - topic.FadeColour(topicColour, transition_duration); - this.FadeColour(Color4.White, transition_duration); - } - } - } -} diff --git a/osu.Game/Overlays/Chat/Selection/ChannelSection.cs b/osu.Game/Overlays/Chat/Selection/ChannelSection.cs deleted file mode 100644 index 070332180c..0000000000 --- a/osu.Game/Overlays/Chat/Selection/ChannelSection.cs +++ /dev/null @@ -1,58 +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 System; -using System.Collections.Generic; -using System.Linq; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Localisation; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Online.Chat; -using osuTK; - -namespace osu.Game.Overlays.Chat.Selection -{ - public class ChannelSection : Container, IHasFilterableChildren - { - public readonly FillFlowContainer ChannelFlow; - - public IEnumerable FilterableChildren => ChannelFlow.Children; - public IEnumerable FilterTerms => Array.Empty(); - - public bool MatchingFilter - { - set => this.FadeTo(value ? 1f : 0f, 100); - } - - public bool FilteringActive { get; set; } - - public IEnumerable Channels - { - set => ChannelFlow.ChildrenEnumerable = value.Select(c => new ChannelListItem(c)); - } - - public ChannelSection() - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - - Children = new Drawable[] - { - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold), - Text = "All Channels".ToUpperInvariant() - }, - ChannelFlow = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Margin = new MarginPadding { Top = 25 }, - Spacing = new Vector2(0f, 5f), - }, - }; - } - } -} diff --git a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs deleted file mode 100644 index 9b0354e264..0000000000 --- a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs +++ /dev/null @@ -1,194 +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 System; -using System.Collections.Generic; -using osuTK; -using osuTK.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.Events; -using osu.Game.Graphics; -using osu.Game.Graphics.Backgrounds; -using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; -using osu.Game.Online.Chat; -using osu.Game.Graphics.Containers; - -namespace osu.Game.Overlays.Chat.Selection -{ - public class ChannelSelectionOverlay : WaveOverlayContainer - { - public new const float WIDTH_PADDING = 170; - - private const float transition_duration = 500; - - private readonly Box bg; - private readonly Triangles triangles; - private readonly Box headerBg; - private readonly SearchTextBox search; - private readonly SearchContainer sectionsFlow; - - protected override bool DimMainContent => false; - - public Action OnRequestJoin; - public Action OnRequestLeave; - - public ChannelSelectionOverlay() - { - RelativeSizeAxes = Axes.X; - - Waves.FirstWaveColour = Color4Extensions.FromHex("353535"); - Waves.SecondWaveColour = Color4Extensions.FromHex("434343"); - Waves.ThirdWaveColour = Color4Extensions.FromHex("515151"); - Waves.FourthWaveColour = Color4Extensions.FromHex("595959"); - - Children = new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Both, - Masking = true, - Children = new Drawable[] - { - bg = new Box - { - RelativeSizeAxes = Axes.Both, - }, - triangles = new Triangles - { - RelativeSizeAxes = Axes.Both, - TriangleScale = 5, - }, - }, - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = 85, Right = WIDTH_PADDING }, - Children = new[] - { - new OsuScrollContainer - { - RelativeSizeAxes = Axes.Both, - Children = new[] - { - sectionsFlow = new SearchContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - LayoutDuration = 200, - LayoutEasing = Easing.OutQuint, - Spacing = new Vector2(0f, 20f), - Padding = new MarginPadding { Vertical = 20, Left = WIDTH_PADDING }, - }, - }, - }, - }, - }, - new Container - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Children = new Drawable[] - { - headerBg = new Box - { - RelativeSizeAxes = Axes.Both, - }, - new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0f, 10f), - Padding = new MarginPadding { Top = 10f, Bottom = 10f, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, - Children = new Drawable[] - { - new OsuSpriteText - { - Text = @"Chat Channels", - Font = OsuFont.GetFont(size: 20), - Shadow = false, - }, - search = new HeaderSearchTextBox { RelativeSizeAxes = Axes.X }, - }, - }, - }, - }, - }; - - search.Current.ValueChanged += term => sectionsFlow.SearchTerm = term.NewValue; - } - - public void UpdateAvailableChannels(IEnumerable channels) - { - Scheduler.Add(() => - { - sectionsFlow.ChildrenEnumerable = new[] - { - new ChannelSection { Channels = channels, }, - }; - - foreach (ChannelSection s in sectionsFlow.Children) - { - foreach (ChannelListItem c in s.ChannelFlow.Children) - { - c.OnRequestJoin = channel => { OnRequestJoin?.Invoke(channel); }; - c.OnRequestLeave = channel => { OnRequestLeave?.Invoke(channel); }; - } - } - }); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - bg.Colour = colours.Gray3; - triangles.ColourDark = colours.Gray3; - triangles.ColourLight = Color4Extensions.FromHex(@"353535"); - - headerBg.Colour = colours.Gray2.Opacity(0.75f); - } - - protected override void OnFocus(FocusEvent e) - { - search.TakeFocus(); - base.OnFocus(e); - } - - protected override void PopIn() - { - if (Alpha == 0) this.MoveToY(DrawHeight); - - this.FadeIn(transition_duration, Easing.OutQuint); - this.MoveToY(0, transition_duration, Easing.OutQuint); - - search.HoldFocus = true; - base.PopIn(); - } - - protected override void PopOut() - { - this.FadeOut(transition_duration, Easing.InSine); - this.MoveToY(DrawHeight, transition_duration, Easing.InSine); - - search.HoldFocus = false; - base.PopOut(); - } - - private class HeaderSearchTextBox : BasicSearchTextBox - { - [BackgroundDependencyLoader] - private void load() - { - BackgroundFocused = Color4.Black.Opacity(0.2f); - BackgroundUnfocused = Color4.Black.Opacity(0.2f); - } - } - } -} diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs deleted file mode 100644 index e3ede04edd..0000000000 --- a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs +++ /dev/null @@ -1,46 +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.Framework.Allocation; -using osu.Game.Graphics; -using osu.Game.Online.Chat; - -namespace osu.Game.Overlays.Chat.Tabs -{ - public class ChannelSelectorTabItem : ChannelTabItem - { - public override bool IsRemovable => false; - - public override bool IsSwitchable => false; - - protected override bool IsBoldWhenActive => false; - - public ChannelSelectorTabItem() - : base(new ChannelSelectorTabChannel()) - { - Depth = float.MaxValue; - Width = 45; - - Icon.Alpha = 0; - - Text.Font = Text.Font.With(size: 45); - Text.Truncate = false; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colour) - { - BackgroundInactive = colour.Gray2; - BackgroundActive = colour.Gray3; - } - - public class ChannelSelectorTabChannel : Channel - { - public ChannelSelectorTabChannel() - { - Name = "+"; - Type = ChannelType.System; - } - } - } -} diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs deleted file mode 100644 index c0de093425..0000000000 --- a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs +++ /dev/null @@ -1,114 +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.Framework.Graphics; -using osu.Framework.Graphics.UserInterface; -using osu.Game.Graphics.UserInterface; -using osu.Game.Online.Chat; -using osuTK; -using System; -using System.Linq; -using osu.Framework.Bindables; -using osu.Framework.Graphics.Containers; - -namespace osu.Game.Overlays.Chat.Tabs -{ - public class ChannelTabControl : OsuTabControl - { - public const float SHEAR_WIDTH = 10; - - public Action OnRequestLeave; - - public readonly Bindable ChannelSelectorActive = new Bindable(); - - private readonly ChannelSelectorTabItem selectorTab; - - public ChannelTabControl() - { - Padding = new MarginPadding { Left = 50 }; - - TabContainer.Spacing = new Vector2(-SHEAR_WIDTH, 0); - TabContainer.Masking = false; - - AddTabItem(selectorTab = new ChannelSelectorTabItem()); - - ChannelSelectorActive.BindTo(selectorTab.Active); - } - - protected override void AddTabItem(TabItem item, bool addToDropdown = true) - { - if (item != selectorTab && TabContainer.GetLayoutPosition(selectorTab) < float.MaxValue) - // performTabSort might've made selectorTab's position wonky, fix it - TabContainer.SetLayoutPosition(selectorTab, float.MaxValue); - - ((ChannelTabItem)item).OnRequestClose += channelItem => OnRequestLeave?.Invoke(channelItem.Value); - - base.AddTabItem(item, addToDropdown); - } - - protected override TabItem CreateTabItem(Channel value) - { - switch (value.Type) - { - default: - return new ChannelTabItem(value); - - case ChannelType.PM: - return new PrivateChannelTabItem(value); - } - } - - /// - /// Adds a channel to the ChannelTabControl. - /// The first channel added will automaticly selected. - /// - /// The channel that is going to be added. - public void AddChannel(Channel channel) - { - if (!Items.Contains(channel)) - AddItem(channel); - - Current.Value ??= channel; - } - - /// - /// Removes a channel from the ChannelTabControl. - /// If the selected channel is the one that is being removed, the next available channel will be selected. - /// - /// The channel that is going to be removed. - public void RemoveChannel(Channel channel) - { - RemoveItem(channel); - - if (SelectedTab == null) - SelectChannelSelectorTab(); - } - - public void SelectChannelSelectorTab() => SelectTab(selectorTab); - - protected override void SelectTab(TabItem tab) - { - if (tab is ChannelSelectorTabItem) - { - tab.Active.Value = true; - return; - } - - base.SelectTab(tab); - selectorTab.Active.Value = false; - } - - protected override TabFillFlowContainer CreateTabFlow() => new ChannelTabFillFlowContainer - { - Direction = FillDirection.Full, - RelativeSizeAxes = Axes.Both, - Depth = -1, - Masking = true - }; - - private class ChannelTabFillFlowContainer : TabFillFlowContainer - { - protected override int Compare(Drawable x, Drawable y) => CompareReverseChildID(x, y); - } - } -} diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs deleted file mode 100644 index 9d2cd8a21d..0000000000 --- a/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs +++ /dev/null @@ -1,238 +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 System; -using osu.Framework.Allocation; -using osu.Framework.Audio; -using osu.Framework.Audio.Sample; -using osu.Framework.Extensions; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Effects; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.Events; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; -using osu.Game.Online.Chat; -using osuTK; -using osuTK.Graphics; -using osuTK.Input; - -namespace osu.Game.Overlays.Chat.Tabs -{ - public class ChannelTabItem : TabItem - { - protected Color4 BackgroundInactive; - private Color4 backgroundHover; - protected Color4 BackgroundActive; - - public override bool IsRemovable => !Pinned; - - protected readonly SpriteText Text; - protected readonly ClickableContainer CloseButton; - private readonly Box box; - private readonly Box highlightBox; - protected readonly SpriteIcon Icon; - - public Action OnRequestClose; - private readonly Container content; - - protected override Container Content => content; - - private Sample sampleTabSwitched; - - public ChannelTabItem(Channel value) - : base(value) - { - Width = 150; - - RelativeSizeAxes = Axes.Y; - - Anchor = Anchor.BottomLeft; - Origin = Anchor.BottomLeft; - - Shear = new Vector2(ChannelTabControl.SHEAR_WIDTH / ChatOverlay.TAB_AREA_HEIGHT, 0); - - Masking = true; - - InternalChildren = new Drawable[] - { - box = new Box - { - EdgeSmoothness = new Vector2(1, 0), - RelativeSizeAxes = Axes.Both, - }, - highlightBox = new Box - { - Width = 5, - Alpha = 0, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - EdgeSmoothness = new Vector2(1, 0), - RelativeSizeAxes = Axes.Y, - }, - content = new Container - { - Shear = new Vector2(-ChannelTabControl.SHEAR_WIDTH / ChatOverlay.TAB_AREA_HEIGHT, 0), - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - Icon = new SpriteIcon - { - Icon = DisplayIcon, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Colour = Color4.Black, - X = -10, - Alpha = 0.2f, - Size = new Vector2(ChatOverlay.TAB_AREA_HEIGHT), - }, - Text = new OsuSpriteText - { - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - Text = value.ToString(), - Font = OsuFont.GetFont(size: 18), - Padding = new MarginPadding(5) - { - Left = LeftTextPadding, - Right = RightTextPadding, - }, - RelativeSizeAxes = Axes.X, - Truncate = true, - }, - CloseButton = new TabCloseButton - { - Alpha = 0, - Margin = new MarginPadding { Right = 20 }, - Origin = Anchor.CentreRight, - Anchor = Anchor.CentreRight, - Action = delegate - { - if (IsRemovable) OnRequestClose?.Invoke(this); - }, - }, - }, - }, - new HoverSounds() - }; - } - - protected virtual float LeftTextPadding => 5; - - protected virtual float RightTextPadding => IsRemovable ? 40 : 5; - - protected virtual IconUsage DisplayIcon => FontAwesome.Solid.Hashtag; - - protected virtual bool ShowCloseOnHover => true; - - protected virtual bool IsBoldWhenActive => true; - - protected override bool OnHover(HoverEvent e) - { - if (IsRemovable && ShowCloseOnHover) - CloseButton.FadeIn(200, Easing.OutQuint); - - if (!Active.Value) - box.FadeColour(backgroundHover, TRANSITION_LENGTH, Easing.OutQuint); - return true; - } - - protected override void OnHoverLost(HoverLostEvent e) - { - CloseButton.FadeOut(200, Easing.OutQuint); - updateState(); - } - - protected override void OnMouseUp(MouseUpEvent e) - { - switch (e.Button) - { - case MouseButton.Middle: - CloseButton.TriggerClick(); - break; - } - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours, AudioManager audio) - { - BackgroundActive = colours.ChatBlue; - BackgroundInactive = colours.Gray4; - backgroundHover = colours.Gray7; - sampleTabSwitched = audio.Samples.Get($@"UI/{HoverSampleSet.Default.GetDescription()}-select"); - - highlightBox.Colour = colours.Yellow; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - updateState(); - FinishTransforms(true); - } - - private void updateState() - { - if (Active.Value) - FadeActive(); - else - FadeInactive(); - } - - protected const float TRANSITION_LENGTH = 400; - - private readonly EdgeEffectParameters activateEdgeEffect = new EdgeEffectParameters - { - Type = EdgeEffectType.Shadow, - Radius = 15, - Colour = Color4.Black.Opacity(0.4f), - }; - - private readonly EdgeEffectParameters deactivateEdgeEffect = new EdgeEffectParameters - { - Type = EdgeEffectType.Shadow, - Radius = 10, - Colour = Color4.Black.Opacity(0.2f), - }; - - protected virtual void FadeActive() - { - this.ResizeHeightTo(1.1f, TRANSITION_LENGTH, Easing.OutQuint); - - TweenEdgeEffectTo(activateEdgeEffect, TRANSITION_LENGTH); - - box.FadeColour(BackgroundActive, TRANSITION_LENGTH, Easing.OutQuint); - highlightBox.FadeIn(TRANSITION_LENGTH, Easing.OutQuint); - - if (IsBoldWhenActive) Text.Font = Text.Font.With(weight: FontWeight.Bold); - } - - protected virtual void FadeInactive() - { - this.ResizeHeightTo(1, TRANSITION_LENGTH, Easing.OutQuint); - - TweenEdgeEffectTo(deactivateEdgeEffect, TRANSITION_LENGTH); - - box.FadeColour(IsHovered ? backgroundHover : BackgroundInactive, TRANSITION_LENGTH, Easing.OutQuint); - highlightBox.FadeOut(TRANSITION_LENGTH, Easing.OutQuint); - - Text.Font = Text.Font.With(weight: FontWeight.Medium); - } - - protected override void OnActivated() - { - if (IsLoaded) - sampleTabSwitched?.Play(); - - updateState(); - } - - protected override void OnDeactivated() => updateState(); - } -} diff --git a/osu.Game/Overlays/Chat/Tabs/PrivateChannelTabItem.cs b/osu.Game/Overlays/Chat/Tabs/PrivateChannelTabItem.cs deleted file mode 100644 index d01aec630e..0000000000 --- a/osu.Game/Overlays/Chat/Tabs/PrivateChannelTabItem.cs +++ /dev/null @@ -1,95 +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 System; -using System.Linq; -using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; -using osu.Game.Online.Chat; -using osu.Game.Users.Drawables; -using osuTK; - -namespace osu.Game.Overlays.Chat.Tabs -{ - public class PrivateChannelTabItem : ChannelTabItem - { - protected override IconUsage DisplayIcon => FontAwesome.Solid.At; - - public PrivateChannelTabItem(Channel value) - : base(value) - { - if (value.Type != ChannelType.PM) - throw new ArgumentException("Argument value needs to have the targettype user!"); - - DrawableAvatar avatar; - - AddRange(new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, - Margin = new MarginPadding - { - Horizontal = 3 - }, - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - Children = new Drawable[] - { - new CircularContainer - { - Scale = new Vector2(0.95f), - Size = new Vector2(ChatOverlay.TAB_AREA_HEIGHT), - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Masking = true, - Child = new DelayedLoadWrapper(avatar = new DrawableAvatar(value.Users.First()) - { - RelativeSizeAxes = Axes.Both - }) - { - RelativeSizeAxes = Axes.Both, - } - }, - } - }, - }); - - avatar.OnLoadComplete += d => d.FadeInFromZero(300, Easing.OutQuint); - } - - protected override float LeftTextPadding => base.LeftTextPadding + ChatOverlay.TAB_AREA_HEIGHT; - - protected override bool ShowCloseOnHover => false; - - protected override void FadeActive() - { - base.FadeActive(); - - this.ResizeWidthTo(200, TRANSITION_LENGTH, Easing.OutQuint); - CloseButton.FadeIn(TRANSITION_LENGTH, Easing.OutQuint); - } - - protected override void FadeInactive() - { - base.FadeInactive(); - - this.ResizeWidthTo(ChatOverlay.TAB_AREA_HEIGHT + 10, TRANSITION_LENGTH, Easing.OutQuint); - CloseButton.FadeOut(TRANSITION_LENGTH, Easing.OutQuint); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - var user = Value.Users.First(); - - BackgroundActive = user.Colour != null ? Color4Extensions.FromHex(user.Colour) : colours.BlueDark; - BackgroundInactive = BackgroundActive.Darken(0.5f); - } - } -} diff --git a/osu.Game/Overlays/Chat/Tabs/TabCloseButton.cs b/osu.Game/Overlays/Chat/Tabs/TabCloseButton.cs deleted file mode 100644 index 178afda5ac..0000000000 --- a/osu.Game/Overlays/Chat/Tabs/TabCloseButton.cs +++ /dev/null @@ -1,55 +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.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.Events; -using osu.Game.Graphics.Containers; -using osuTK; -using osuTK.Graphics; - -namespace osu.Game.Overlays.Chat.Tabs -{ - public class TabCloseButton : OsuClickableContainer - { - private readonly SpriteIcon icon; - - public TabCloseButton() - { - Size = new Vector2(20); - - Child = icon = new SpriteIcon - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Scale = new Vector2(0.75f), - Icon = FontAwesome.Solid.TimesCircle, - RelativeSizeAxes = Axes.Both, - }; - } - - protected override bool OnMouseDown(MouseDownEvent e) - { - icon.ScaleTo(0.5f, 1000, Easing.OutQuint); - return base.OnMouseDown(e); - } - - protected override void OnMouseUp(MouseUpEvent e) - { - icon.ScaleTo(0.75f, 1000, Easing.OutElastic); - base.OnMouseUp(e); - } - - protected override bool OnHover(HoverEvent e) - { - icon.FadeColour(Color4.Red, 200, Easing.OutQuint); - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - icon.FadeColour(Color4.White, 200, Easing.OutQuint); - base.OnHoverLost(e); - } - } -} diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs deleted file mode 100644 index 034670cf37..0000000000 --- a/osu.Game/Overlays/ChatOverlay.cs +++ /dev/null @@ -1,525 +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 System.Collections.Generic; -using System.Collections.Specialized; -using System.Diagnostics; -using System.Linq; -using osuTK; -using osuTK.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.Events; -using osu.Game.Configuration; -using osu.Game.Graphics; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.UserInterface; -using osu.Game.Online.Chat; -using osu.Game.Overlays.Chat; -using osu.Game.Overlays.Chat.Selection; -using osu.Game.Overlays.Chat.Tabs; -using osuTK.Input; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; -using osu.Framework.Input; -using osu.Framework.Input.Bindings; -using osu.Framework.Localisation; -using osu.Game.Localisation; -using osu.Game.Online; - -namespace osu.Game.Overlays -{ - public class ChatOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent, IKeyBindingHandler - { - public string IconTexture => "Icons/Hexacons/messaging"; - public LocalisableString Title => ChatStrings.HeaderTitle; - public LocalisableString Description => ChatStrings.HeaderDescription; - - private const float text_box_height = 60; - private const float channel_selection_min_height = 0.3f; - - [Resolved] - private ChannelManager channelManager { get; set; } - - private Container currentChannelContainer; - - private readonly List loadedChannels = new List(); - - private LoadingSpinner loading; - - private FocusedTextBox textBox; - - private const int transition_length = 500; - - public const float DEFAULT_HEIGHT = 0.4f; - - public const float TAB_AREA_HEIGHT = 50; - - protected ChannelTabControl ChannelTabControl; - - protected virtual ChannelTabControl CreateChannelTabControl() => new ChannelTabControl(); - - private Container chatContainer; - private TabsArea tabsArea; - private Box chatBackground; - private Box tabBackground; - - public Bindable ChatHeight { get; set; } - - private Container channelSelectionContainer; - protected ChannelSelectionOverlay ChannelSelectionOverlay; - - private readonly IBindableList availableChannels = new BindableList(); - private readonly IBindableList joinedChannels = new BindableList(); - private readonly Bindable currentChannel = new Bindable(); - - public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceivePositionalInputAt(screenSpacePos) - || (ChannelSelectionOverlay.State.Value == Visibility.Visible && ChannelSelectionOverlay.ReceivePositionalInputAt(screenSpacePos)); - - public ChatOverlay() - { - RelativeSizeAxes = Axes.Both; - RelativePositionAxes = Axes.Both; - Anchor = Anchor.BottomLeft; - Origin = Anchor.BottomLeft; - } - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config, OsuColour colours, TextureStore textures) - { - const float padding = 5; - - Children = new Drawable[] - { - channelSelectionContainer = new Container - { - RelativeSizeAxes = Axes.Both, - Height = 1f - DEFAULT_HEIGHT, - Masking = true, - Children = new[] - { - ChannelSelectionOverlay = new ChannelSelectionOverlay - { - RelativeSizeAxes = Axes.Both, - }, - }, - }, - chatContainer = new Container - { - Name = @"chat container", - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.Both, - Height = DEFAULT_HEIGHT, - Children = new[] - { - new Container - { - Name = @"chat area", - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = TAB_AREA_HEIGHT }, - Children = new Drawable[] - { - chatBackground = new Box - { - RelativeSizeAxes = Axes.Both, - }, - new OnlineViewContainer("Sign in to chat") - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - currentChannelContainer = new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding - { - Bottom = text_box_height - }, - }, - new Container - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - Height = text_box_height, - Padding = new MarginPadding - { - Top = padding * 2, - Bottom = padding * 2, - Left = ChatLine.LEFT_PADDING + padding * 2, - Right = padding * 2, - }, - Children = new Drawable[] - { - textBox = new FocusedTextBox - { - RelativeSizeAxes = Axes.Both, - Height = 1, - PlaceholderText = Resources.Localisation.Web.ChatStrings.InputPlaceholder, - ReleaseFocusOnCommit = false, - HoldFocus = true, - } - } - }, - loading = new LoadingSpinner(), - }, - } - } - }, - tabsArea = new TabsArea - { - Children = new Drawable[] - { - tabBackground = new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - }, - new Sprite - { - Texture = textures.Get(IconTexture), - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Size = new Vector2(OverlayTitle.ICON_SIZE), - Margin = new MarginPadding { Left = 10 }, - }, - ChannelTabControl = CreateChannelTabControl().With(d => - { - d.Anchor = Anchor.BottomLeft; - d.Origin = Anchor.BottomLeft; - d.RelativeSizeAxes = Axes.Both; - d.OnRequestLeave = channelManager.LeaveChannel; - d.IsSwitchable = true; - }), - } - }, - }, - }, - }; - - availableChannels.BindTo(channelManager.AvailableChannels); - joinedChannels.BindTo(channelManager.JoinedChannels); - currentChannel.BindTo(channelManager.CurrentChannel); - - textBox.OnCommit += postMessage; - - ChannelTabControl.Current.ValueChanged += current => currentChannel.Value = current.NewValue; - ChannelTabControl.ChannelSelectorActive.ValueChanged += active => ChannelSelectionOverlay.State.Value = active.NewValue ? Visibility.Visible : Visibility.Hidden; - ChannelSelectionOverlay.State.ValueChanged += state => - { - // Propagate the visibility state to ChannelSelectorActive - ChannelTabControl.ChannelSelectorActive.Value = state.NewValue == Visibility.Visible; - - if (state.NewValue == Visibility.Visible) - { - textBox.HoldFocus = false; - if (1f - ChatHeight.Value < channel_selection_min_height) - this.TransformBindableTo(ChatHeight, 1f - channel_selection_min_height, 800, Easing.OutQuint); - } - else - textBox.HoldFocus = true; - }; - - ChannelSelectionOverlay.OnRequestJoin = channel => channelManager.JoinChannel(channel); - ChannelSelectionOverlay.OnRequestLeave = channelManager.LeaveChannel; - - ChatHeight = config.GetBindable(OsuSetting.ChatDisplayHeight); - ChatHeight.BindValueChanged(height => - { - chatContainer.Height = height.NewValue; - channelSelectionContainer.Height = 1f - height.NewValue; - tabBackground.FadeTo(height.NewValue == 1f ? 1f : 0.8f, 200); - }, true); - - chatBackground.Colour = colours.ChatBlue; - - loading.Show(); - - // This is a relatively expensive (and blocking) operation. - // Scheduling it ensures that it won't be performed unless the user decides to open chat. - // TODO: Refactor OsuFocusedOverlayContainer / OverlayContainer to support delayed content loading. - Schedule(() => - { - // TODO: consider scheduling bindable callbacks to not perform when overlay is not present. - joinedChannels.BindCollectionChanged(joinedChannelsChanged, true); - availableChannels.BindCollectionChanged(availableChannelsChanged, true); - currentChannel.BindValueChanged(currentChannelChanged, true); - }); - } - - private void currentChannelChanged(ValueChangedEvent e) - { - if (e.NewValue == null) - { - textBox.Current.Disabled = true; - currentChannelContainer.Clear(false); - ChannelSelectionOverlay.Show(); - return; - } - - if (e.NewValue is ChannelSelectorTabItem.ChannelSelectorTabChannel) - return; - - textBox.Current.Disabled = e.NewValue.ReadOnly; - - if (ChannelTabControl.Current.Value != e.NewValue) - Scheduler.Add(() => ChannelTabControl.Current.Value = e.NewValue); - - var loaded = loadedChannels.Find(d => d.Channel == e.NewValue); - - if (loaded == null) - { - currentChannelContainer.FadeOut(500, Easing.OutQuint); - loading.Show(); - - loaded = new DrawableChannel(e.NewValue); - loadedChannels.Add(loaded); - LoadComponentAsync(loaded, l => - { - if (currentChannel.Value != e.NewValue) - return; - - // check once more to ensure the channel hasn't since been removed from the loaded channels list (may have been left by some automated means). - if (!loadedChannels.Contains(loaded)) - return; - - loading.Hide(); - - currentChannelContainer.Clear(false); - currentChannelContainer.Add(loaded); - currentChannelContainer.FadeIn(500, Easing.OutQuint); - }); - } - else - { - currentChannelContainer.Clear(false); - currentChannelContainer.Add(loaded); - } - - // mark channel as read when channel switched - if (e.NewValue.Messages.Any()) - channelManager.MarkChannelAsRead(e.NewValue); - } - - /// - /// Highlights a certain message in the specified channel. - /// - /// The message to highlight. - /// The channel containing the message. - public void HighlightMessage(Message message, Channel channel) - { - Debug.Assert(channel.Id == message.ChannelId); - - if (currentChannel.Value?.Id != channel.Id) - { - if (!channel.Joined.Value) - channel = channelManager.JoinChannel(channel); - - currentChannel.Value = channel; - } - - channel.HighlightedMessage.Value = message; - - Show(); - } - - private float startDragChatHeight; - private bool isDragging; - - protected override bool OnDragStart(DragStartEvent e) - { - isDragging = tabsArea.IsHovered; - - if (!isDragging) - return base.OnDragStart(e); - - startDragChatHeight = ChatHeight.Value; - return true; - } - - protected override void OnDrag(DragEvent e) - { - if (isDragging) - { - float targetChatHeight = startDragChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y; - - // If the channel selection screen is shown, mind its minimum height - if (ChannelSelectionOverlay.State.Value == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height) - targetChatHeight = 1f - channel_selection_min_height; - - ChatHeight.Value = targetChatHeight; - } - } - - protected override void OnDragEnd(DragEndEvent e) - { - isDragging = false; - base.OnDragEnd(e); - } - - private void selectTab(int index) - { - var channel = ChannelTabControl.Items - .Where(tab => !(tab is ChannelSelectorTabItem.ChannelSelectorTabChannel)) - .ElementAtOrDefault(index); - if (channel != null) - ChannelTabControl.Current.Value = channel; - } - - protected override bool OnKeyDown(KeyDownEvent e) - { - if (e.AltPressed) - { - switch (e.Key) - { - case Key.Number1: - case Key.Number2: - case Key.Number3: - case Key.Number4: - case Key.Number5: - case Key.Number6: - case Key.Number7: - case Key.Number8: - case Key.Number9: - selectTab((int)e.Key - (int)Key.Number1); - return true; - - case Key.Number0: - selectTab(9); - return true; - } - } - - return base.OnKeyDown(e); - } - - public bool OnPressed(KeyBindingPressEvent e) - { - switch (e.Action) - { - case PlatformAction.TabNew: - ChannelTabControl.SelectChannelSelectorTab(); - return true; - - case PlatformAction.TabRestore: - channelManager.JoinLastClosedChannel(); - return true; - - case PlatformAction.DocumentClose: - channelManager.LeaveChannel(currentChannel.Value); - return true; - } - - return false; - } - - public void OnReleased(KeyBindingReleaseEvent e) - { - } - - public override bool AcceptsFocus => true; - - protected override void OnFocus(FocusEvent e) - { - // this is necessary as textbox is masked away and therefore can't get focus :( - textBox.TakeFocus(); - base.OnFocus(e); - } - - protected override void PopIn() - { - this.MoveToY(0, transition_length, Easing.OutQuint); - this.FadeIn(transition_length, Easing.OutQuint); - - textBox.HoldFocus = true; - - base.PopIn(); - } - - protected override void PopOut() - { - this.MoveToY(Height, transition_length, Easing.InSine); - this.FadeOut(transition_length, Easing.InSine); - - ChannelSelectionOverlay.Hide(); - - textBox.HoldFocus = false; - base.PopOut(); - } - - private void joinedChannelsChanged(object sender, NotifyCollectionChangedEventArgs args) - { - switch (args.Action) - { - case NotifyCollectionChangedAction.Add: - foreach (Channel channel in args.NewItems.Cast()) - { - if (channel.Type != ChannelType.Multiplayer) - ChannelTabControl.AddChannel(channel); - } - - break; - - case NotifyCollectionChangedAction.Remove: - foreach (Channel channel in args.OldItems.Cast()) - { - if (!ChannelTabControl.Items.Contains(channel)) - continue; - - ChannelTabControl.RemoveChannel(channel); - - var loaded = loadedChannels.Find(c => c.Channel == channel); - - if (loaded != null) - { - // Because the container is only cleared in the async load callback of a new channel, it is forcefully cleared - // to ensure that the previous channel doesn't get updated after it's disposed - loadedChannels.Remove(loaded); - currentChannelContainer.Remove(loaded); - loaded.Dispose(); - } - } - - break; - } - } - - private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs args) - { - ChannelSelectionOverlay.UpdateAvailableChannels(availableChannels); - } - - private void postMessage(TextBox textBox, bool newText) - { - string text = textBox.Text.Trim(); - - if (string.IsNullOrWhiteSpace(text)) - return; - - if (text[0] == '/') - channelManager.PostCommand(text.Substring(1)); - else - channelManager.PostMessage(text); - - textBox.Text = string.Empty; - } - - private class TabsArea : Container - { - // IsHovered is used - public override bool HandlePositionalInput => true; - - public TabsArea() - { - Name = @"tabs area"; - RelativeSizeAxes = Axes.X; - Height = TAB_AREA_HEIGHT; - } - } - } -} From 03deb336b280aa3ccb86d0333186b871f17a8b95 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 May 2022 04:34:08 +0900 Subject: [PATCH 1286/2328] Fix some more chat tests failing intermittently MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` TearDown : osu.Framework.Testing.Drawables.Steps.AssertButton+TracedException : Channel 1 ready --TearDown at osu.Framework.Threading.ScheduledDelegate.RunTaskInternal() at osu.Framework.Threading.Scheduler.Update() at osu.Framework.Graphics.Drawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() at osu.Framework.Platform.GameHost.UpdateFrame() at osu.Framework.Threading.GameThread.processFrame() at osu.Framework.Threading.GameThread.RunSingleFrame() at osu.Framework.Threading.GameThread.g__runWork|66_0() at System.Threading.Thread.StartHelper.Callback(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) ----- One or more child tests had errors Exception doesn't have a stacktrace [runtime] 2022-05-29 19:29:09 [verbose]: 💨 Class: TestSceneChatOverlayV2 [runtime] 2022-05-29 19:29:09 [verbose]: 🔶 Test: TestSlowLoadingChannel [runtime] 2022-05-29 19:29:09 [verbose]: Chat is now polling every 60000 ms [runtime] 2022-05-29 19:29:09 [verbose]: 🔸 Step #1 Setup request handler [runtime] 2022-05-29 19:29:09 [verbose]: 🔸 Step #2 Add test channels [runtime] 2022-05-29 19:29:09 [verbose]: 🔸 Step #3 Show overlay (slow-loading) [runtime] 2022-05-29 19:29:09 [verbose]: 🔸 Step #4 Join channel 1 [runtime] 2022-05-29 19:29:09 [verbose]: 🔸 Step #5 Select channel 1 [runtime] 2022-05-29 19:29:09 [verbose]: 🔸 Step #6 Channel 1 loading [runtime] 2022-05-29 19:29:09 [verbose]: 🔸 Step #7 Join channel 2 [runtime] 2022-05-29 19:29:09 [verbose]: 🔸 Step #8 Select channel 2 [runtime] 2022-05-29 19:29:09 [verbose]: 🔸 Step #9 Channel 2 loading [runtime] 2022-05-29 19:29:09 [verbose]: 🔸 Step #10 Finish channel 1 load [runtime] 2022-05-29 19:29:09 [verbose]: 🔸 Step #11 Channel 1 ready [runtime] 2022-05-29 19:29:09 [verbose]: 💥 Failed [runtime] 2022-05-29 19:29:09 [verbose]: ⏳ Currently loading components (2) [runtime] 2022-05-29 19:29:09 [verbose]: TestSceneChatOverlayV2+SlowLoadingDrawableChannel [runtime] 2022-05-29 19:29:09 [verbose]: - thread: ThreadedTaskScheduler (LoadComponentsAsync (standard)) [runtime] 2022-05-29 19:29:09 [verbose]: - state: Loading [runtime] 2022-05-29 19:29:09 [verbose]: TestSceneChatOverlayV2+SlowLoadingDrawableChannel [runtime] 2022-05-29 19:29:09 [verbose]: - thread: ThreadedTaskScheduler (LoadComponentsAsync (standard)) [runtime] 2022-05-29 19:29:09 [verbose]: - state: Ready [runtime] 2022-05-29 19:29:09 [verbose]: 🧵 Task schedulers [runtime] 2022-05-29 19:29:09 [verbose]: LoadComponentsAsync (standard) concurrency:4 running:1 pending:0 [runtime] 2022-05-29 19:29:09 [verbose]: LoadComponentsAsync (long load) concurrency:4 running:0 pending:0 [runtime] 2022-05-29 19:29:09 [verbose]: 🎱 Thread pool [runtime] 2022-05-29 19:29:09 [verbose]: worker: min 32 max 32,767 available 32,765 [runtime] 2022-05-29 19:29:09 [verbose]: completion: min 32 max 1,000 available 1,000 ``` --- osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs index b333eee21b..ba4db50a11 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs @@ -404,22 +404,22 @@ namespace osu.Game.Tests.Visual.Online }); AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); - AddAssert("Channel 1 loading", () => !channelIsVisible && chatOverlay.GetSlowLoadingChannel(testChannel1).LoadState == LoadState.Loading); + AddUntilStep("Channel 1 loading", () => !channelIsVisible && chatOverlay.GetSlowLoadingChannel(testChannel1).LoadState == LoadState.Loading); AddStep("Join channel 2", () => channelManager.JoinChannel(testChannel2)); AddStep("Select channel 2", () => clickDrawable(getChannelListItem(testChannel2))); - AddAssert("Channel 2 loading", () => !channelIsVisible && chatOverlay.GetSlowLoadingChannel(testChannel2).LoadState == LoadState.Loading); + AddUntilStep("Channel 2 loading", () => !channelIsVisible && chatOverlay.GetSlowLoadingChannel(testChannel2).LoadState == LoadState.Loading); AddStep("Finish channel 1 load", () => chatOverlay.GetSlowLoadingChannel(testChannel1).LoadEvent.Set()); - AddAssert("Channel 1 ready", () => chatOverlay.GetSlowLoadingChannel(testChannel1).LoadState == LoadState.Ready); + AddUntilStep("Channel 1 ready", () => chatOverlay.GetSlowLoadingChannel(testChannel1).LoadState == LoadState.Ready); AddAssert("Channel 1 not displayed", () => !channelIsVisible); AddStep("Finish channel 2 load", () => chatOverlay.GetSlowLoadingChannel(testChannel2).LoadEvent.Set()); - AddAssert("Channel 2 loaded", () => chatOverlay.GetSlowLoadingChannel(testChannel2).IsLoaded); + AddUntilStep("Channel 2 loaded", () => chatOverlay.GetSlowLoadingChannel(testChannel2).IsLoaded); waitForChannel2Visible(); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); - AddAssert("Channel 1 loaded", () => chatOverlay.GetSlowLoadingChannel(testChannel1).IsLoaded); + AddUntilStep("Channel 1 loaded", () => chatOverlay.GetSlowLoadingChannel(testChannel1).IsLoaded); waitForChannel1Visible(); } From 45841673f6704da52cd689836950c8967e0cae57 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 May 2022 15:44:16 +0900 Subject: [PATCH 1287/2328] Update `OnlineLookupCache` to use async version of `Perform` call --- osu.Game/Database/OnlineLookupCache.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/OnlineLookupCache.cs b/osu.Game/Database/OnlineLookupCache.cs index 2f98aef58a..506103a2c0 100644 --- a/osu.Game/Database/OnlineLookupCache.cs +++ b/osu.Game/Database/OnlineLookupCache.cs @@ -91,7 +91,7 @@ namespace osu.Game.Database } } - private void performLookup() + private async Task performLookup() { // contains at most 50 unique IDs from tasks, which is used to perform the lookup. var nextTaskBatch = new Dictionary>>(); @@ -127,7 +127,7 @@ namespace osu.Game.Database // rather than queueing, we maintain our own single-threaded request stream. // todo: we probably want retry logic here. - api.Perform(request); + await api.PerformAsync(request).ConfigureAwait(false); finishPendingTask(); From a2a057440e87e5f494a8248f07f851e3a505d460 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 May 2022 16:05:32 +0900 Subject: [PATCH 1288/2328] Fail requests taretting the fake API with a more deliberate exception I think this feels better than relying on some other method to throw an exception. --- osu.Game/Online/API/DummyAPIAccess.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Online/API/DummyAPIAccess.cs b/osu.Game/Online/API/DummyAPIAccess.cs index f292e95bd1..8614cc79cb 100644 --- a/osu.Game/Online/API/DummyAPIAccess.cs +++ b/osu.Game/Online/API/DummyAPIAccess.cs @@ -65,9 +65,7 @@ namespace osu.Game.Online.API { if (HandleRequest?.Invoke(request) != true) { - // this will fail due to not receiving an APIAccess, and trigger a failure on the request. - // this is intended - any request in testing that needs non-failures should use HandleRequest. - request.Perform(this); + request.Fail(new InvalidOperationException($@"{nameof(DummyAPIAccess)} cannot process this request.")); } } From c18dd8c8fb29fb84c9459a3bed7bb58e429e257e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 May 2022 16:32:44 +0900 Subject: [PATCH 1289/2328] Ensure `Queue` operations on `DummyAPIAccess` are performed on the update thread --- osu.Game/Online/API/DummyAPIAccess.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/API/DummyAPIAccess.cs b/osu.Game/Online/API/DummyAPIAccess.cs index 8614cc79cb..d3707d977c 100644 --- a/osu.Game/Online/API/DummyAPIAccess.cs +++ b/osu.Game/Online/API/DummyAPIAccess.cs @@ -63,10 +63,13 @@ namespace osu.Game.Online.API public virtual void Queue(APIRequest request) { - if (HandleRequest?.Invoke(request) != true) + Schedule(() => { - request.Fail(new InvalidOperationException($@"{nameof(DummyAPIAccess)} cannot process this request.")); - } + if (HandleRequest?.Invoke(request) != true) + { + request.Fail(new InvalidOperationException($@"{nameof(DummyAPIAccess)} cannot process this request.")); + } + }); } public void Perform(APIRequest request) => HandleRequest?.Invoke(request); From f935f034c2a573bb5002b11d5f70b0987b2786a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 May 2022 16:33:07 +0900 Subject: [PATCH 1290/2328] Ensure request handling for `OnlinePlayTestScene` runs in a scheduled fashion --- .../Visual/OnlinePlay/OnlinePlayTestScene.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs b/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs index b6a347a896..32e42a945d 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Threading.Tasks; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -67,7 +68,24 @@ namespace osu.Game.Tests.Visual.OnlinePlay // To get around this, the BeatmapManager is looked up from the dependencies provided to the children of the test scene instead. var beatmapManager = dependencies.Get(); - ((DummyAPIAccess)API).HandleRequest = request => handler.HandleRequest(request, API.LocalUser.Value, beatmapManager); + ((DummyAPIAccess)API).HandleRequest = request => + { + TaskCompletionSource tcs = new TaskCompletionSource(); + + // Because some of the handlers use realm, we need to ensure the game is still alive when firing. + // If we don't, a stray `PerformAsync` could hit an `ObjectDisposedException` if running too late. + Scheduler.Add(() => + { + bool result = handler.HandleRequest(request, API.LocalUser.Value, beatmapManager); + tcs.SetResult(result); + }, false); + +#pragma warning disable RS0030 + // We can't GetResultSafely() here (will fail with "Can't use GetResultSafely from inside an async operation."), but Wait is safe enough due to + // the task being a TaskCompletionSource. + return tcs.Task.Result; +#pragma warning restore RS0030 + }; }); /// From dea7a27553a25caab9104b2a78fa2abc548ce6e1 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 30 May 2022 17:18:29 +0900 Subject: [PATCH 1291/2328] Adjust wording, add text for capable state --- .../Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 981f5dbac3..acbcdfcf76 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -234,15 +234,15 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { case FullscreenCapability.Unknown: if (host.Window is WindowsWindow) - windowModeDropdown.WarningText = "Checking for exclusive fullscreen..."; + windowModeDropdown.WarningText = "Checking for fullscreen capabilities..."; break; case FullscreenCapability.Capable: - windowModeDropdown.WarningText = default; + windowModeDropdown.WarningText = "osu! is running exclusive fullscreen, guaranteeing low latency!"; break; case FullscreenCapability.Incapable: - windowModeDropdown.WarningText = "Unable to enter exclusive fullscreen. You'll still experience some input latency."; + windowModeDropdown.WarningText = "Unable to run exclusive fullscreen. You'll still experience some input latency."; break; } } From 5f9a69e5c2f060cbcc2143f53cc7938953a94509 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 30 May 2022 17:19:03 +0900 Subject: [PATCH 1292/2328] Add localisation --- .../Localisation/LayoutSettingsStrings.cs | 29 +++++++++++++++++++ .../Sections/Graphics/LayoutSettings.cs | 6 ++-- 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 osu.Game/Localisation/LayoutSettingsStrings.cs diff --git a/osu.Game/Localisation/LayoutSettingsStrings.cs b/osu.Game/Localisation/LayoutSettingsStrings.cs new file mode 100644 index 0000000000..5ac28f19b3 --- /dev/null +++ b/osu.Game/Localisation/LayoutSettingsStrings.cs @@ -0,0 +1,29 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Localisation; + +namespace osu.Game.Localisation +{ + public static class LayoutSettingsStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.LayoutSettings"; + + /// + /// "Checking for fullscreen capabilities..." + /// + public static LocalisableString CheckingForFullscreenCapabilities => new TranslatableString(getKey(@"checking_for_fullscreen_capabilities"), @"Checking for fullscreen capabilities..."); + + /// + /// "osu! is running exclusive fullscreen, guaranteeing low latency!" + /// + public static LocalisableString OsuIsRunningExclusiveFullscreen => new TranslatableString(getKey(@"osu_is_running_exclusive_fullscreen"), @"osu! is running exclusive fullscreen, guaranteeing low latency!"); + + /// + /// "Unable to run exclusive fullscreen. You'll still experience some input latency." + /// + public static LocalisableString UnableToRunExclusiveFullscreen => new TranslatableString(getKey(@"unable_to_run_exclusive_fullscreen"), @"Unable to run exclusive fullscreen. You'll still experience some input latency."); + + private static string getKey(string key) => $@"{prefix}:{key}"; + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index acbcdfcf76..69a50c19b4 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -234,15 +234,15 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { case FullscreenCapability.Unknown: if (host.Window is WindowsWindow) - windowModeDropdown.WarningText = "Checking for fullscreen capabilities..."; + windowModeDropdown.WarningText = LayoutSettingsStrings.CheckingForFullscreenCapabilities; break; case FullscreenCapability.Capable: - windowModeDropdown.WarningText = "osu! is running exclusive fullscreen, guaranteeing low latency!"; + windowModeDropdown.WarningText = LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen; break; case FullscreenCapability.Incapable: - windowModeDropdown.WarningText = "Unable to run exclusive fullscreen. You'll still experience some input latency."; + windowModeDropdown.WarningText = LayoutSettingsStrings.UnableToRunExclusiveFullscreen; break; } } From f65d2db77f4374d57694f1e15583dfa95f0575a9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 May 2022 17:54:09 +0900 Subject: [PATCH 1293/2328] Remove "V2" suffix from `ChatOverlay` components --- osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs | 2 +- .../Visual/Navigation/TestScenePerformFromScreen.cs | 4 ++-- ...{TestSceneChatOverlayV2.cs => TestSceneChatOverlay.cs} | 8 ++++---- osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs | 2 +- osu.Game/Configuration/OsuConfigManager.cs | 2 +- osu.Game/Online/Chat/MessageNotifier.cs | 4 ++-- osu.Game/OsuGame.cs | 4 ++-- osu.Game/Overlays/{ChatOverlayV2.cs => ChatOverlay.cs} | 4 ++-- .../Profile/Header/Components/MessageUserButton.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarChatButton.cs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) rename osu.Game.Tests/Visual/Online/{TestSceneChatOverlayV2.cs => TestSceneChatOverlay.cs} (99%) rename osu.Game/Overlays/{ChatOverlayV2.cs => ChatOverlay.cs} (98%) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs b/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs index c8ea692bb2..e4871f611e 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs @@ -40,7 +40,7 @@ namespace osu.Game.Tests.Visual.Navigation typeof(DashboardOverlay), typeof(NewsOverlay), typeof(ChannelManager), - typeof(ChatOverlayV2), + typeof(ChatOverlay), typeof(SettingsOverlay), typeof(UserProfileOverlay), typeof(BeatmapSetOverlay), diff --git a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs index 5d0116f80e..2ce914ba3d 100644 --- a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs +++ b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs @@ -86,9 +86,9 @@ namespace osu.Game.Tests.Visual.Navigation [Test] public void TestOverlaysAlwaysClosed() { - ChatOverlayV2 chat = null; + ChatOverlay chat = null; AddUntilStep("is at menu", () => Game.ScreenStack.CurrentScreen is MainMenu); - AddUntilStep("wait for chat load", () => (chat = Game.ChildrenOfType().SingleOrDefault()) != null); + AddUntilStep("wait for chat load", () => (chat = Game.ChildrenOfType().SingleOrDefault()) != null); AddStep("show chat", () => InputManager.Key(Key.F8)); diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs similarity index 99% rename from osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs rename to osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs index 5f237b4b2d..4edbb9f215 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlayV2.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs @@ -32,9 +32,9 @@ using osuTK.Input; namespace osu.Game.Tests.Visual.Online { [TestFixture] - public class TestSceneChatOverlayV2 : OsuManualInputManagerTestScene + public class TestSceneChatOverlay : OsuManualInputManagerTestScene { - private TestChatOverlayV2 chatOverlay; + private TestChatOverlay chatOverlay; private ChannelManager channelManager; private APIUser testUser; @@ -64,7 +64,7 @@ namespace osu.Game.Tests.Visual.Online Children = new Drawable[] { channelManager, - chatOverlay = new TestChatOverlayV2(), + chatOverlay = new TestChatOverlay(), }, }; }); @@ -564,7 +564,7 @@ namespace osu.Game.Tests.Visual.Online }; } - private class TestChatOverlayV2 : ChatOverlayV2 + private class TestChatOverlay : ChatOverlay { public bool SlowLoading { get; set; } diff --git a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs index 46f426597a..79f62a16e3 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs @@ -208,7 +208,7 @@ namespace osu.Game.Tests.Visual.Online }; [Cached] - public ChatOverlayV2 ChatOverlay { get; } = new ChatOverlayV2(); + public ChatOverlay ChatOverlay { get; } = new ChatOverlay(); private readonly MessageNotifier messageNotifier = new MessageNotifier(); diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 69e7dee1a5..20d555c16c 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -46,7 +46,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation); - SetDefault(OsuSetting.ChatDisplayHeight, ChatOverlayV2.DEFAULT_HEIGHT, 0.2f, 1f); + SetDefault(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2f, 1f); SetDefault(OsuSetting.BeatmapListingCardSize, BeatmapCardSize.Normal); diff --git a/osu.Game/Online/Chat/MessageNotifier.cs b/osu.Game/Online/Chat/MessageNotifier.cs index cea3e321fa..ca6082e19b 100644 --- a/osu.Game/Online/Chat/MessageNotifier.cs +++ b/osu.Game/Online/Chat/MessageNotifier.cs @@ -27,7 +27,7 @@ namespace osu.Game.Online.Chat private INotificationOverlay notifications { get; set; } [Resolved] - private ChatOverlayV2 chatOverlay { get; set; } + private ChatOverlay chatOverlay { get; set; } [Resolved] private ChannelManager channelManager { get; set; } @@ -170,7 +170,7 @@ namespace osu.Game.Online.Chat public override bool IsImportant => false; [BackgroundDependencyLoader] - private void load(OsuColour colours, ChatOverlayV2 chatOverlay, INotificationOverlay notificationOverlay) + private void load(OsuColour colours, ChatOverlay chatOverlay, INotificationOverlay notificationOverlay) { IconBackground.Colour = colours.PurpleDark; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 402bd94f31..785881d97a 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -75,7 +75,7 @@ namespace osu.Game public Toolbar Toolbar; - private ChatOverlayV2 chatOverlay; + private ChatOverlay chatOverlay; private ChannelManager channelManager; @@ -848,7 +848,7 @@ namespace osu.Game loadComponentSingleFile(news = new NewsOverlay(), overlayContent.Add, true); var rankingsOverlay = loadComponentSingleFile(new RankingsOverlay(), overlayContent.Add, true); loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal, true); - loadComponentSingleFile(chatOverlay = new ChatOverlayV2(), overlayContent.Add, true); + loadComponentSingleFile(chatOverlay = new ChatOverlay(), overlayContent.Add, true); loadComponentSingleFile(new MessageNotifier(), AddInternal, true); loadComponentSingleFile(Settings = new SettingsOverlay(), leftFloatingOverlayContent.Add, true); loadComponentSingleFile(changelogOverlay = new ChangelogOverlay(), overlayContent.Add, true); diff --git a/osu.Game/Overlays/ChatOverlayV2.cs b/osu.Game/Overlays/ChatOverlay.cs similarity index 98% rename from osu.Game/Overlays/ChatOverlayV2.cs rename to osu.Game/Overlays/ChatOverlay.cs index f2ec007b19..02769b5d68 100644 --- a/osu.Game/Overlays/ChatOverlayV2.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -27,7 +27,7 @@ using osu.Game.Overlays.Chat.Listing; namespace osu.Game.Overlays { - public class ChatOverlayV2 : OsuFocusedOverlayContainer, INamedOverlayComponent, IKeyBindingHandler + public class ChatOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent, IKeyBindingHandler { public string IconTexture => "Icons/Hexacons/messaging"; public LocalisableString Title => ChatStrings.HeaderTitle; @@ -70,7 +70,7 @@ namespace osu.Game.Overlays private readonly IBindableList availableChannels = new BindableList(); private readonly IBindableList joinedChannels = new BindableList(); - public ChatOverlayV2() + public ChatOverlay() { Height = DEFAULT_HEIGHT; diff --git a/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs b/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs index eafb453f75..e3dc5f818a 100644 --- a/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Profile.Header.Components private UserProfileOverlay userOverlay { get; set; } [Resolved(CanBeNull = true)] - private ChatOverlayV2 chatOverlay { get; set; } + private ChatOverlay chatOverlay { get; set; } [Resolved] private IAPIProvider apiProvider { get; set; } diff --git a/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs b/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs index 20f405aae2..2d3b33e9bc 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Toolbar } [BackgroundDependencyLoader(true)] - private void load(ChatOverlayV2 chat) + private void load(ChatOverlay chat) { StateContainer = chat; } From 0981d415a1fe5ed295b21049cc451f5817b36e68 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 May 2022 17:57:48 +0900 Subject: [PATCH 1294/2328] Select correct channel regardless of load order --- osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs index 4edbb9f215..2cf1114f30 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs @@ -469,6 +469,8 @@ namespace osu.Game.Tests.Visual.Online chatOverlay.Show(); }); + AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); + waitForChannel1Visible(); AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext)); waitForChannel2Visible(); From c97b477485bc87d5841c6dffd884ad37971a51e5 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 30 May 2022 19:11:54 +0900 Subject: [PATCH 1295/2328] Fix inverted operation order --- osu.Game/Screens/Play/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 51c1e6b43b..b68ac3cb05 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -213,8 +213,8 @@ namespace osu.Game.Screens.Play dependencies.CacheAs(DrawableRuleset); ScoreProcessor = ruleset.CreateScoreProcessor(); - ScoreProcessor.ApplyBeatmap(playableBeatmap); ScoreProcessor.Mods.Value = gameplayMods; + ScoreProcessor.ApplyBeatmap(playableBeatmap); dependencies.CacheAs(ScoreProcessor); From a052e09ac3d4a9e8c0aa3a46f0bf859f3bab60a0 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 30 May 2022 19:14:03 +0900 Subject: [PATCH 1296/2328] Send ScoreProcessor statistics in SpectatorState --- osu.Game/Online/Spectator/SpectatorClient.cs | 3 + osu.Game/Online/Spectator/SpectatorState.cs | 18 ++++++ osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 59 ++++++++++---------- osu.Game/Screens/Play/GameplayState.cs | 12 ++-- osu.Game/Screens/Play/Player.cs | 2 +- 5 files changed, 61 insertions(+), 33 deletions(-) diff --git a/osu.Game/Online/Spectator/SpectatorClient.cs b/osu.Game/Online/Spectator/SpectatorClient.cs index 78beda6298..3c31acca01 100644 --- a/osu.Game/Online/Spectator/SpectatorClient.cs +++ b/osu.Game/Online/Spectator/SpectatorClient.cs @@ -172,6 +172,9 @@ namespace osu.Game.Online.Spectator currentState.RulesetID = score.ScoreInfo.RulesetID; currentState.Mods = score.ScoreInfo.Mods.Select(m => new APIMod(m)).ToArray(); currentState.State = SpectatedUserState.Playing; + currentState.MaxAchievableCombo = state.ScoreProcessor.MaxAchievableCombo; + currentState.MaxAchievableBaseScore = state.ScoreProcessor.MaxAchievableBaseScore; + currentState.TotalBasicHitObjects = state.ScoreProcessor.TotalBasicHitObjects; currentBeatmap = state.Beatmap; currentScore = score; diff --git a/osu.Game/Online/Spectator/SpectatorState.cs b/osu.Game/Online/Spectator/SpectatorState.cs index 77686d12da..8b2e90ead0 100644 --- a/osu.Game/Online/Spectator/SpectatorState.cs +++ b/osu.Game/Online/Spectator/SpectatorState.cs @@ -27,6 +27,24 @@ namespace osu.Game.Online.Spectator [Key(3)] public SpectatedUserState State { get; set; } + /// + /// The maximum achievable combo, if everything is hit perfectly. + /// + [Key(4)] + public int MaxAchievableCombo { get; set; } + + /// + /// The maximum achievable base score, if everything is hit perfectly. + /// + [Key(5)] + public double MaxAchievableBaseScore { get; set; } + + /// + /// The total number of basic (non-tick and non-bonus) hitobjects that can be hit. + /// + [Key(6)] + public int TotalBasicHitObjects { get; set; } + public bool Equals(SpectatorState other) { if (ReferenceEquals(null, other)) return false; diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 1dd1d1aeb6..ec09bfcfa3 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -88,17 +88,20 @@ namespace osu.Game.Rulesets.Scoring private readonly double accuracyPortion; private readonly double comboPortion; - private int maxAchievableCombo; + /// + /// The maximum achievable combo, if everything is hit perfectly. + /// + internal int MaxAchievableCombo; /// - /// The maximum achievable base score. + /// The maximum achievable base score, if everything is hit perfectly. /// - private double maxBaseScore; + internal double MaxAchievableBaseScore; /// - /// The maximum number of basic (non-tick and non-bonus) hitobjects. + /// The total number of basic (non-tick and non-bonus) hitobjects that can be hit. /// - private int maxBasicHitObjects; + internal int TotalBasicHitObjects; /// /// The maximum of a basic (non-tick and non-bonus) hitobject. @@ -106,9 +109,9 @@ namespace osu.Game.Rulesets.Scoring /// private HitResult? maxBasicResult; - private double rollingMaxBaseScore; - private double baseScore; - private int basicHitObjects; + private double rollingMaxAchievableBaseScore; + private double rollingBaseScore; + private int rollingBasicHitObjects; private bool beatmapApplied; private readonly Dictionary scoreResultCounts = new Dictionary(); @@ -175,12 +178,12 @@ namespace osu.Game.Rulesets.Scoring if (!result.Type.IsBonus()) { - baseScore += scoreIncrease; - rollingMaxBaseScore += result.Judgement.MaxNumericResult; + rollingBaseScore += scoreIncrease; + rollingMaxAchievableBaseScore += result.Judgement.MaxNumericResult; } if (result.Type.IsBasic()) - basicHitObjects++; + rollingBasicHitObjects++; hitEvents.Add(CreateHitEvent(result)); lastHitObject = result.HitObject; @@ -213,12 +216,12 @@ namespace osu.Game.Rulesets.Scoring if (!result.Type.IsBonus()) { - baseScore -= scoreIncrease; - rollingMaxBaseScore -= result.Judgement.MaxNumericResult; + rollingBaseScore -= scoreIncrease; + rollingMaxAchievableBaseScore -= result.Judgement.MaxNumericResult; } if (result.Type.IsBasic()) - basicHitObjects--; + rollingBasicHitObjects--; Debug.Assert(hitEvents.Count > 0); lastHitObject = hitEvents[^1].LastHitObject; @@ -229,12 +232,12 @@ namespace osu.Game.Rulesets.Scoring private void updateScore() { - double rollingAccuracyRatio = rollingMaxBaseScore > 0 ? baseScore / rollingMaxBaseScore : 1; - double accuracyRatio = maxBaseScore > 0 ? baseScore / maxBaseScore : 1; - double comboRatio = maxAchievableCombo > 0 ? (double)HighestCombo.Value / maxAchievableCombo : 1; + double rollingAccuracyRatio = rollingMaxAchievableBaseScore > 0 ? rollingBaseScore / rollingMaxAchievableBaseScore : 1; + double accuracyRatio = MaxAchievableBaseScore > 0 ? rollingBaseScore / MaxAchievableBaseScore : 1; + double comboRatio = MaxAchievableCombo > 0 ? (double)HighestCombo.Value / MaxAchievableCombo : 1; Accuracy.Value = rollingAccuracyRatio; - TotalScore.Value = ComputeScore(Mode.Value, accuracyRatio, comboRatio, getBonusScore(scoreResultCounts), maxBasicHitObjects); + TotalScore.Value = ComputeScore(Mode.Value, accuracyRatio, comboRatio, getBonusScore(scoreResultCounts), TotalBasicHitObjects); } /// @@ -288,10 +291,10 @@ namespace osu.Game.Rulesets.Scoring out _, out _); - double accuracyRatio = maxBaseScore > 0 ? extractedBaseScore / maxBaseScore : 1; - double comboRatio = maxAchievableCombo > 0 ? (double)scoreInfo.MaxCombo / maxAchievableCombo : 1; + double accuracyRatio = MaxAchievableBaseScore > 0 ? extractedBaseScore / MaxAchievableBaseScore : 1; + double comboRatio = MaxAchievableCombo > 0 ? (double)scoreInfo.MaxCombo / MaxAchievableCombo : 1; - return ComputeScore(mode, accuracyRatio, comboRatio, getBonusScore(scoreInfo.Statistics), maxBasicHitObjects); + return ComputeScore(mode, accuracyRatio, comboRatio, getBonusScore(scoreInfo.Statistics), TotalBasicHitObjects); } /// @@ -403,14 +406,14 @@ namespace osu.Game.Rulesets.Scoring if (storeResults) { - maxAchievableCombo = HighestCombo.Value; - maxBaseScore = baseScore; - maxBasicHitObjects = basicHitObjects; + MaxAchievableCombo = HighestCombo.Value; + MaxAchievableBaseScore = rollingBaseScore; + TotalBasicHitObjects = rollingBasicHitObjects; } - baseScore = 0; - rollingMaxBaseScore = 0; - basicHitObjects = 0; + rollingBaseScore = 0; + rollingMaxAchievableBaseScore = 0; + rollingBasicHitObjects = 0; TotalScore.Value = 0; Accuracy.Value = 1; @@ -444,7 +447,7 @@ namespace osu.Game.Rulesets.Scoring if (frame.Header == null) return; - extractFromStatistics(ruleset, frame.Header.Statistics, out baseScore, out rollingMaxBaseScore, out _, out _); + extractFromStatistics(ruleset, frame.Header.Statistics, out rollingBaseScore, out rollingMaxAchievableBaseScore, out _, out _); HighestCombo.Value = frame.Header.MaxCombo; scoreResultCounts.Clear(); diff --git a/osu.Game/Screens/Play/GameplayState.cs b/osu.Game/Screens/Play/GameplayState.cs index c6a072da74..586cdcda51 100644 --- a/osu.Game/Screens/Play/GameplayState.cs +++ b/osu.Game/Screens/Play/GameplayState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Collections.Generic; using osu.Framework.Bindables; @@ -8,10 +10,9 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; -#nullable enable - namespace osu.Game.Screens.Play { /// @@ -39,6 +40,8 @@ namespace osu.Game.Screens.Play /// public readonly Score Score; + public readonly ScoreProcessor ScoreProcessor; + /// /// Whether gameplay completed without the user failing. /// @@ -61,7 +64,7 @@ namespace osu.Game.Screens.Play private readonly Bindable lastJudgementResult = new Bindable(); - public GameplayState(IBeatmap beatmap, Ruleset ruleset, IReadOnlyList? mods = null, Score? score = null) + public GameplayState(IBeatmap beatmap, Ruleset ruleset, IReadOnlyList? mods = null, Score? score = null, ScoreProcessor? scoreProcessor = null) { Beatmap = beatmap; Ruleset = ruleset; @@ -72,7 +75,8 @@ namespace osu.Game.Screens.Play Ruleset = ruleset.RulesetInfo } }; - Mods = mods ?? ArraySegment.Empty; + Mods = mods ?? Array.Empty(); + ScoreProcessor = scoreProcessor ?? ruleset.CreateScoreProcessor(); } /// diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b68ac3cb05..dfc0fa1d1d 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -237,7 +237,7 @@ namespace osu.Game.Screens.Play Score.ScoreInfo.Ruleset = ruleset.RulesetInfo; Score.ScoreInfo.Mods = gameplayMods; - dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, gameplayMods, Score)); + dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, gameplayMods, Score, ScoreProcessor)); var rulesetSkinProvider = new RulesetSkinProvidingContainer(ruleset, playableBeatmap, Beatmap.Value.Skin); From 75b50de26971218024636fcdda74df87dbbc160b Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 30 May 2022 19:15:30 +0900 Subject: [PATCH 1297/2328] Implement score processor for spectator states --- .../Spectator/SpectatorScoreProcessor.cs | 204 ++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 osu.Game/Online/Spectator/SpectatorScoreProcessor.cs diff --git a/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs b/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs new file mode 100644 index 0000000000..99596fa1d3 --- /dev/null +++ b/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs @@ -0,0 +1,204 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Beatmaps.Timing; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Scoring; +using osu.Game.Scoring; + +namespace osu.Game.Online.Spectator +{ + /// + /// A wrapper over a for spectated users. + /// This should be used when a local "playable" beatmap is unavailable or expensive to generate for the spectated user. + /// + public class SpectatorScoreProcessor : Component + { + /// + /// The current total score. + /// + public readonly BindableDouble TotalScore = new BindableDouble { MinValue = 0 }; + + /// + /// The current accuracy. + /// + public readonly BindableDouble Accuracy = new BindableDouble(1) { MinValue = 0, MaxValue = 1 }; + + /// + /// The current combo. + /// + public readonly BindableInt Combo = new BindableInt(); + + /// + /// The used to calculate scores. + /// + public readonly Bindable Mode = new Bindable(); + + /// + /// The applied s. + /// + public IReadOnlyList Mods => scoreProcessor?.Mods.Value ?? Array.Empty(); + + [Resolved] + private SpectatorClient spectatorClient { get; set; } = null!; + + [Resolved] + private RulesetStore rulesetStore { get; set; } = null!; + + private readonly IBindableDictionary spectatorStates = new BindableDictionary(); + private readonly List replayFrames = new List(); + private readonly int userId; + + private ScoreProcessor? scoreProcessor; + private ScoreInfo? scoreInfo; + + public SpectatorScoreProcessor(int userId) + { + this.userId = userId; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + Mode.BindValueChanged(_ => UpdateScore()); + + spectatorStates.BindTo(spectatorClient.WatchedUserStates); + spectatorStates.BindCollectionChanged(onSpectatorStatesChanged, true); + + spectatorClient.OnNewFrames += onNewFrames; + } + + private void onSpectatorStatesChanged(object? sender, NotifyDictionaryChangedEventArgs e) + { + if (!spectatorStates.TryGetValue(userId, out var userState) || userState.BeatmapID == null || userState.RulesetID == null) + { + scoreProcessor?.RemoveAndDisposeImmediately(); + scoreProcessor = null; + scoreInfo = null; + replayFrames.Clear(); + return; + } + + if (scoreProcessor != null) + return; + + Debug.Assert(scoreInfo == null); + + RulesetInfo? rulesetInfo = rulesetStore.GetRuleset(userState.RulesetID.Value); + if (rulesetInfo == null) + return; + + Ruleset ruleset = rulesetInfo.CreateInstance(); + + scoreInfo = new ScoreInfo { Ruleset = rulesetInfo }; + scoreProcessor = ruleset.CreateScoreProcessor(); + + // Mods are required for score multiplier. + scoreProcessor.Mods.Value = userState.Mods.Select(m => m.ToMod(ruleset)).ToArray(); + + // Applying beatmap required to call ComputePartialScore(). + scoreProcessor.ApplyBeatmap(new DummyBeatmap()); + + scoreProcessor.MaxAchievableCombo = userState.MaxAchievableCombo; + scoreProcessor.MaxAchievableBaseScore = userState.MaxAchievableBaseScore; + scoreProcessor.TotalBasicHitObjects = userState.TotalBasicHitObjects; + } + + private void onNewFrames(int incomingUserId, FrameDataBundle bundle) + { + if (incomingUserId != userId) + return; + + Schedule(() => + { + if (scoreProcessor == null) + return; + + replayFrames.Add(new TimedFrame(bundle.Frames.First().Time, bundle.Header)); + UpdateScore(); + }); + } + + public void UpdateScore() + { + if (scoreInfo == null || replayFrames.Count == 0) + return; + + Debug.Assert(scoreProcessor != null); + + int frameIndex = replayFrames.BinarySearch(new TimedFrame(Time.Current)); + if (frameIndex < 0) + frameIndex = ~frameIndex; + frameIndex = Math.Clamp(frameIndex - 1, 0, replayFrames.Count - 1); + + TimedFrame frame = replayFrames[frameIndex]; + Debug.Assert(frame.Header != null); + + scoreInfo.MaxCombo = frame.Header.MaxCombo; + scoreInfo.Statistics = frame.Header.Statistics; + + Accuracy.Value = frame.Header.Accuracy; + Combo.Value = frame.Header.Combo; + TotalScore.Value = scoreProcessor.ComputePartialScore(Mode.Value, scoreInfo); + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + // ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract + if (spectatorClient != null) + spectatorClient.OnNewFrames -= onNewFrames; + } + + private class DummyBeatmap : IBeatmap + { + public BeatmapInfo BeatmapInfo { get; set; } = new BeatmapInfo(); + public BeatmapMetadata Metadata { get; } = new BeatmapMetadata(); + public BeatmapDifficulty Difficulty { get; set; } = new BeatmapDifficulty(); + public ControlPointInfo ControlPointInfo { get; set; } = new ControlPointInfo(); + public List Breaks { get; } = new List(); + public double TotalBreakTime => 0; + public IReadOnlyList HitObjects => Array.Empty(); + + public IEnumerable GetStatistics() => Array.Empty(); + + public double GetMostCommonBeatLength() => 0; + + public IBeatmap Clone() => throw new NotImplementedException(); + } + + private class TimedFrame : IComparable + { + public readonly double Time; + public readonly FrameHeader? Header; + + public TimedFrame(double time) + { + Time = time; + } + + public TimedFrame(double time, FrameHeader header) + { + Time = time; + Header = header; + } + + public int CompareTo(TimedFrame other) => Time.CompareTo(other.Time); + } + } +} From 22d998dc2a518728c00d1f2d84c40aef12479110 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 30 May 2022 19:18:38 +0900 Subject: [PATCH 1298/2328] Use new score processor in MultiplayerGameplayLeaderboard --- ...MultiplayerGameplayLeaderboardTestScene.cs | 35 +++-- .../TestSceneMultiSpectatorLeaderboard.cs | 6 +- ...TestSceneMultiplayerGameplayLeaderboard.cs | 42 ++++- ...ceneMultiplayerGameplayLeaderboardTeams.cs | 5 +- osu.Game/Online/Spectator/SpectatorClient.cs | 2 +- .../Multiplayer/MultiplayerPlayer.cs | 11 +- .../Spectate/MultiSpectatorLeaderboard.cs | 48 +----- .../Spectate/MultiSpectatorScreen.cs | 8 +- .../HUD/MultiplayerGameplayLeaderboard.cs | 147 +++++------------- 9 files changed, 110 insertions(+), 194 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs index 4e6342868a..62cea378e6 100644 --- a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs +++ b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs @@ -18,7 +18,6 @@ using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Multiplayer; using osu.Game.Online.Spectator; using osu.Game.Replays.Legacy; -using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; using osu.Game.Screens.Play.HUD; @@ -27,7 +26,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { public abstract class MultiplayerGameplayLeaderboardTestScene : OsuTestScene { - private const int total_users = 16; + protected const int TOTAL_USERS = 16; protected readonly BindableList MultiplayerUsers = new BindableList(); @@ -35,9 +34,10 @@ namespace osu.Game.Tests.Visual.Multiplayer protected virtual MultiplayerRoomUser CreateUser(int userId) => new MultiplayerRoomUser(userId); - protected abstract MultiplayerGameplayLeaderboard CreateLeaderboard(OsuScoreProcessor scoreProcessor); + protected abstract MultiplayerGameplayLeaderboard CreateLeaderboard(); private readonly BindableList multiplayerUserIds = new BindableList(); + private readonly BindableDictionary watchedUserStates = new BindableDictionary(); private OsuConfigManager config; @@ -81,6 +81,9 @@ namespace osu.Game.Tests.Visual.Multiplayer multiplayerClient.SetupGet(c => c.CurrentMatchPlayingUserIds) .Returns(() => multiplayerUserIds); + + spectatorClient.SetupGet(c => c.WatchedUserStates) + .Returns(() => watchedUserStates); } [SetUpSteps] @@ -100,8 +103,23 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("populate users", () => { MultiplayerUsers.Clear(); - for (int i = 0; i < total_users; i++) - MultiplayerUsers.Add(CreateUser(i)); + + for (int i = 0; i < TOTAL_USERS; i++) + { + var user = CreateUser(i); + + MultiplayerUsers.Add(user); + + watchedUserStates[i] = new SpectatorState + { + BeatmapID = 0, + RulesetID = 0, + Mods = user.Mods, + MaxAchievableCombo = 1000, + MaxAchievableBaseScore = 10000, + TotalBasicHitObjects = 1000 + }; + } }); AddStep("create leaderboard", () => @@ -109,13 +127,8 @@ namespace osu.Game.Tests.Visual.Multiplayer Leaderboard?.Expire(); Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value); - var playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value); - OsuScoreProcessor scoreProcessor = new OsuScoreProcessor(); - scoreProcessor.ApplyBeatmap(playableBeatmap); - Child = scoreProcessor; - - LoadComponentAsync(Leaderboard = CreateLeaderboard(scoreProcessor), Add); + LoadComponentAsync(Leaderboard = CreateLeaderboard(), Add); }); AddUntilStep("wait for load", () => Leaderboard.IsLoaded); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs index f57a54d84c..e94e198a4a 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs @@ -8,7 +8,6 @@ using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Multiplayer; -using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Screens.OnlinePlay.Multiplayer.Spectate; using osu.Game.Screens.Play.HUD; @@ -42,11 +41,8 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("create leaderboard", () => { Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value); - var playable = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value); - var scoreProcessor = new OsuScoreProcessor(); - scoreProcessor.ApplyBeatmap(playable); - LoadComponentAsync(leaderboard = new MultiSpectatorLeaderboard(Ruleset.Value, scoreProcessor, clocks.Keys.Select(id => new MultiplayerRoomUser(id)).ToArray()) + LoadComponentAsync(leaderboard = new MultiSpectatorLeaderboard(clocks.Keys.Select(id => new MultiplayerRoomUser(id)).ToArray()) { Expanded = { Value = true } }, Add); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs index 6e4aa48b0e..cbbd535cee 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs @@ -1,22 +1,58 @@ // 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.Linq; +using NUnit.Framework; using osu.Framework.Graphics; -using osu.Game.Rulesets.Osu.Scoring; +using osu.Game.Online.API; +using osu.Game.Online.Multiplayer; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu.Mods; using osu.Game.Screens.Play.HUD; namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneMultiplayerGameplayLeaderboard : MultiplayerGameplayLeaderboardTestScene { - protected override MultiplayerGameplayLeaderboard CreateLeaderboard(OsuScoreProcessor scoreProcessor) + protected override MultiplayerRoomUser CreateUser(int userId) { - return new MultiplayerGameplayLeaderboard(Ruleset.Value, scoreProcessor, MultiplayerUsers.ToArray()) + var user = base.CreateUser(userId); + + if (userId == TOTAL_USERS - 1) + user.Mods = new[] { new APIMod(new OsuModNoFail()) }; + + return user; + } + + protected override MultiplayerGameplayLeaderboard CreateLeaderboard() + { + return new TestLeaderboard(MultiplayerUsers.ToArray()) { Anchor = Anchor.Centre, Origin = Anchor.Centre, }; } + + [Test] + public void TestPerUserMods() + { + AddStep("first user has no mods", () => Assert.That(((TestLeaderboard)Leaderboard).UserMods[0], Is.Empty)); + AddStep("last user has NF mod", () => + { + Assert.That(((TestLeaderboard)Leaderboard).UserMods[TOTAL_USERS - 1], Has.One.Items); + Assert.That(((TestLeaderboard)Leaderboard).UserMods[TOTAL_USERS - 1].Single(), Is.TypeOf()); + }); + } + + private class TestLeaderboard : MultiplayerGameplayLeaderboard + { + public Dictionary> UserMods => UserScores.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.ScoreProcessor.Mods); + + public TestLeaderboard(MultiplayerRoomUser[] users) + : base(users) + { + } + } } } diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs index 5caab9487e..c25884039f 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs @@ -5,7 +5,6 @@ using System.Linq; using osu.Framework.Graphics; using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus; -using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Screens.OnlinePlay.Multiplayer; using osu.Game.Screens.Play.HUD; @@ -25,8 +24,8 @@ namespace osu.Game.Tests.Visual.Multiplayer return user; } - protected override MultiplayerGameplayLeaderboard CreateLeaderboard(OsuScoreProcessor scoreProcessor) => - new MultiplayerGameplayLeaderboard(Ruleset.Value, scoreProcessor, MultiplayerUsers.ToArray()) + protected override MultiplayerGameplayLeaderboard CreateLeaderboard() => + new MultiplayerGameplayLeaderboard(MultiplayerUsers.ToArray()) { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Online/Spectator/SpectatorClient.cs b/osu.Game/Online/Spectator/SpectatorClient.cs index 3c31acca01..527f6d06ce 100644 --- a/osu.Game/Online/Spectator/SpectatorClient.cs +++ b/osu.Game/Online/Spectator/SpectatorClient.cs @@ -39,7 +39,7 @@ namespace osu.Game.Online.Spectator /// /// The states of all users currently being watched. /// - public IBindableDictionary WatchedUserStates => watchedUserStates; + public virtual IBindableDictionary WatchedUserStates => watchedUserStates; /// /// A global list of all players currently playing. diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs index 3bf8a09cb9..f4bfec169d 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs @@ -82,7 +82,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer LocalUserPlaying.BindValueChanged(_ => updateLeaderboardExpandedState(), true); // todo: this should be implemented via a custom HUD implementation, and correctly masked to the main content area. - LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(GameplayState.Ruleset.RulesetInfo, ScoreProcessor, users), l => + LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(users), l => { if (!LoadedBeatmapSuccessfully) return; @@ -149,16 +149,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer protected override void StartGameplay() { - // We can enter this screen one of two ways: - // 1. Via the automatic natural progression of PlayerLoader into Player. - // We'll arrive here in a Loaded state, and we need to let the server know that we're ready to start. - // 2. Via the server forcefully starting gameplay because players have been hanging out in PlayerLoader for too long. - // We'll arrive here in a Playing state, and we should neither show the loading spinner nor tell the server that we're ready to start (gameplay has already started). - // - // The base call is blocked here because in both cases gameplay is started only when the server says so via onGameplayStarted(). - if (client.LocalUser?.State == MultiplayerUserState.Loaded) { + // block base call, but let the server know we are ready to start. loadingDisplay.Show(); client.ChangeState(MultiplayerUserState.ReadyForGameplay); } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs index 4545913db8..589f5ce988 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs @@ -2,19 +2,16 @@ // See the LICENCE file in the repository root for full licence text. using System; -using JetBrains.Annotations; using osu.Framework.Timing; using osu.Game.Online.Multiplayer; -using osu.Game.Rulesets; -using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play.HUD; namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate { public class MultiSpectatorLeaderboard : MultiplayerGameplayLeaderboard { - public MultiSpectatorLeaderboard(RulesetInfo ruleset, [NotNull] ScoreProcessor scoreProcessor, MultiplayerRoomUser[] users) - : base(ruleset, scoreProcessor, users) + public MultiSpectatorLeaderboard(MultiplayerRoomUser[] users) + : base(users) { } @@ -23,52 +20,15 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate if (!UserScores.TryGetValue(userId, out var data)) throw new ArgumentException(@"Provided user is not tracked by this leaderboard", nameof(userId)); - ((SpectatingTrackedUserData)data).Clock = clock; + data.ScoreProcessor.Clock = new FramedClock(clock); } - public void RemoveClock(int userId) - { - if (!UserScores.TryGetValue(userId, out var data)) - throw new ArgumentException(@"Provided user is not tracked by this leaderboard", nameof(userId)); - - ((SpectatingTrackedUserData)data).Clock = null; - } - - protected override TrackedUserData CreateUserData(MultiplayerRoomUser user, RulesetInfo ruleset, ScoreProcessor scoreProcessor) => new SpectatingTrackedUserData(user, ruleset, scoreProcessor); - protected override void Update() { base.Update(); foreach (var (_, data) in UserScores) - data.UpdateScore(); - } - - private class SpectatingTrackedUserData : TrackedUserData - { - [CanBeNull] - public IClock Clock; - - public SpectatingTrackedUserData(MultiplayerRoomUser user, RulesetInfo ruleset, ScoreProcessor scoreProcessor) - : base(user, ruleset, scoreProcessor) - { - } - - public override void UpdateScore() - { - if (Frames.Count == 0) - return; - - if (Clock == null) - return; - - int frameIndex = Frames.BinarySearch(new TimedFrame(Clock.CurrentTime)); - if (frameIndex < 0) - frameIndex = ~frameIndex; - frameIndex = Math.Clamp(frameIndex - 1, 0, Frames.Count - 1); - - SetFrame(Frames[frameIndex]); - } + data.ScoreProcessor.UpdateScore(); } } } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs index 2d03276fe5..d9c19cdfdd 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs @@ -128,12 +128,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate syncManager.AddPlayerClock(instances[i].GameplayClock); } - // Todo: This is not quite correct - it should be per-user to adjust for other mod combinations. - var playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value); - var scoreProcessor = Ruleset.Value.CreateInstance().CreateScoreProcessor(); - scoreProcessor.ApplyBeatmap(playableBeatmap); - - LoadComponentAsync(leaderboard = new MultiSpectatorLeaderboard(Ruleset.Value, scoreProcessor, users) + LoadComponentAsync(leaderboard = new MultiSpectatorLeaderboard(users) { Expanded = { Value = true }, }, l => @@ -240,7 +235,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate instance.FadeColour(colours.Gray4, 400, Easing.OutQuint); syncManager.RemovePlayerClock(instance.GameplayClock); - leaderboard.RemoveClock(userId); } public override bool OnBackButton() diff --git a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs index 41b40e9a91..5ee6000cf0 100644 --- a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs +++ b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; +using System.Threading; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions; @@ -17,9 +18,7 @@ using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus; using osu.Game.Online.Spectator; -using osu.Game.Rulesets; using osu.Game.Rulesets.Scoring; -using osu.Game.Scoring; using osuTK.Graphics; namespace osu.Game.Screens.Play.HUD @@ -43,8 +42,6 @@ namespace osu.Game.Screens.Play.HUD [Resolved] private UserLookupCache userLookupCache { get; set; } - private readonly RulesetInfo ruleset; - private readonly ScoreProcessor scoreProcessor; private readonly MultiplayerRoomUser[] playingUsers; private Bindable scoringMode; @@ -55,57 +52,56 @@ namespace osu.Game.Screens.Play.HUD /// /// Construct a new leaderboard. /// - /// The ruleset. - /// A score processor instance to handle score calculation for scores of users in the match. /// IDs of all users in this match. - public MultiplayerGameplayLeaderboard(RulesetInfo ruleset, ScoreProcessor scoreProcessor, MultiplayerRoomUser[] users) + public MultiplayerGameplayLeaderboard(MultiplayerRoomUser[] users) { - // todo: this will eventually need to be created per user to support different mod combinations. - this.ruleset = ruleset; - this.scoreProcessor = scoreProcessor; - playingUsers = users; } [BackgroundDependencyLoader] - private void load(OsuConfigManager config, IAPIProvider api) + private void load(OsuConfigManager config, IAPIProvider api, CancellationToken cancellationToken) { scoringMode = config.GetBindable(OsuSetting.ScoreDisplayMode); foreach (var user in playingUsers) { - var trackedUser = CreateUserData(user, ruleset, scoreProcessor); - - trackedUser.ScoringMode.BindTo(scoringMode); - trackedUser.Score.BindValueChanged(_ => Scheduler.AddOnce(updateTotals)); + var scoreProcessor = new SpectatorScoreProcessor(user.UserID); + scoreProcessor.Mode.BindTo(scoringMode); + scoreProcessor.TotalScore.BindValueChanged(_ => Scheduler.AddOnce(updateTotals)); + AddInternal(scoreProcessor); + var trackedUser = new TrackedUserData(user, scoreProcessor); UserScores[user.UserID] = trackedUser; if (trackedUser.Team is int team && !TeamScores.ContainsKey(team)) TeamScores.Add(team, new BindableLong()); } - userLookupCache.GetUsersAsync(playingUsers.Select(u => u.UserID).ToArray()).ContinueWith(task => Schedule(() => - { - var users = task.GetResultSafely(); + userLookupCache.GetUsersAsync(playingUsers.Select(u => u.UserID).ToArray(), cancellationToken) + .ContinueWith(task => + { + Schedule(() => + { + var users = task.GetResultSafely(); - for (int i = 0; i < users.Length; i++) - { - var user = users[i] ?? new APIUser - { - Id = playingUsers[i].UserID, - Username = "Unknown user", - }; + for (int i = 0; i < users.Length; i++) + { + var user = users[i] ?? new APIUser + { + Id = playingUsers[i].UserID, + Username = "Unknown user", + }; - var trackedUser = UserScores[user.Id]; + var trackedUser = UserScores[user.Id]; - var leaderboardScore = Add(user, user.Id == api.LocalUser.Value.Id); - leaderboardScore.Accuracy.BindTo(trackedUser.Accuracy); - leaderboardScore.TotalScore.BindTo(trackedUser.Score); - leaderboardScore.Combo.BindTo(trackedUser.CurrentCombo); - leaderboardScore.HasQuit.BindTo(trackedUser.UserQuit); - } - })); + var leaderboardScore = Add(user, user.Id == api.LocalUser.Value.Id); + leaderboardScore.Accuracy.BindTo(trackedUser.ScoreProcessor.Accuracy); + leaderboardScore.TotalScore.BindTo(trackedUser.ScoreProcessor.TotalScore); + leaderboardScore.Combo.BindTo(trackedUser.ScoreProcessor.Combo); + leaderboardScore.HasQuit.BindTo(trackedUser.UserQuit); + } + }); + }, cancellationToken); } protected override void LoadComplete() @@ -118,20 +114,15 @@ namespace osu.Game.Screens.Play.HUD spectatorClient.WatchUser(user.UserID); if (!multiplayerClient.CurrentMatchPlayingUserIds.Contains(user.UserID)) - usersChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, new[] { user.UserID })); + playingUsersChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, new[] { user.UserID })); } // bind here is to support players leaving the match. // new players are not supported. playingUserIds.BindTo(multiplayerClient.CurrentMatchPlayingUserIds); - playingUserIds.BindCollectionChanged(usersChanged); - - // this leaderboard should be guaranteed to be completely loaded before the gameplay starts (is a prerequisite in MultiplayerPlayer). - spectatorClient.OnNewFrames += handleIncomingFrames; + playingUserIds.BindCollectionChanged(playingUsersChanged); } - protected virtual TrackedUserData CreateUserData(MultiplayerRoomUser user, RulesetInfo ruleset, ScoreProcessor scoreProcessor) => new TrackedUserData(user, ruleset, scoreProcessor); - protected override GameplayLeaderboardScore CreateLeaderboardScoreDrawable(APIUser user, bool isTracked) { var leaderboardScore = base.CreateLeaderboardScoreDrawable(user, isTracked); @@ -157,7 +148,7 @@ namespace osu.Game.Screens.Play.HUD } } - private void usersChanged(object sender, NotifyCollectionChangedEventArgs e) + private void playingUsersChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { @@ -174,15 +165,6 @@ namespace osu.Game.Screens.Play.HUD } } - private void handleIncomingFrames(int userId, FrameDataBundle bundle) => Schedule(() => - { - if (!UserScores.TryGetValue(userId, out var trackedData)) - return; - - trackedData.Frames.Add(new TimedFrame(bundle.Frames.First().Time, bundle.Header)); - trackedData.UpdateScore(); - }); - private void updateTotals() { if (!hasTeams) @@ -196,7 +178,7 @@ namespace osu.Game.Screens.Play.HUD continue; if (TeamScores.TryGetValue(u.Team.Value, out var team)) - team.Value += (int)Math.Round(u.Score.Value); + team.Value += (int)Math.Round(u.ScoreProcessor.TotalScore.Value); } } @@ -207,83 +189,26 @@ namespace osu.Game.Screens.Play.HUD if (spectatorClient != null) { foreach (var user in playingUsers) - { spectatorClient.StopWatchingUser(user.UserID); - } - - spectatorClient.OnNewFrames -= handleIncomingFrames; } } protected class TrackedUserData { public readonly MultiplayerRoomUser User; - public readonly ScoreProcessor ScoreProcessor; + public readonly SpectatorScoreProcessor ScoreProcessor; - public readonly BindableDouble Score = new BindableDouble(); - public readonly BindableDouble Accuracy = new BindableDouble(1); - public readonly BindableInt CurrentCombo = new BindableInt(); public readonly BindableBool UserQuit = new BindableBool(); - public readonly IBindable ScoringMode = new Bindable(); - - public readonly List Frames = new List(); - public int? Team => (User.MatchState as TeamVersusUserState)?.TeamID; - private readonly ScoreInfo scoreInfo; - - public TrackedUserData(MultiplayerRoomUser user, RulesetInfo ruleset, ScoreProcessor scoreProcessor) + public TrackedUserData(MultiplayerRoomUser user, SpectatorScoreProcessor scoreProcessor) { User = user; ScoreProcessor = scoreProcessor; - - scoreInfo = new ScoreInfo { Ruleset = ruleset }; - - ScoringMode.BindValueChanged(_ => UpdateScore()); } public void MarkUserQuit() => UserQuit.Value = true; - - public virtual void UpdateScore() - { - if (Frames.Count == 0) - return; - - SetFrame(Frames.Last()); - } - - protected void SetFrame(TimedFrame frame) - { - var header = frame.Header; - - scoreInfo.MaxCombo = header.MaxCombo; - scoreInfo.Statistics = header.Statistics; - - Score.Value = ScoreProcessor.ComputePartialScore(ScoringMode.Value, scoreInfo); - - Accuracy.Value = header.Accuracy; - CurrentCombo.Value = header.Combo; - } - } - - protected class TimedFrame : IComparable - { - public readonly double Time; - public readonly FrameHeader Header; - - public TimedFrame(double time) - { - Time = time; - } - - public TimedFrame(double time, FrameHeader header) - { - Time = time; - Header = header; - } - - public int CompareTo(TimedFrame other) => Time.CompareTo(other.Time); } } } From 17174a7b099b753a2d6c8e7c90754f2060c8f163 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 May 2022 19:29:13 +0900 Subject: [PATCH 1299/2328] Ensure some results have been loaded in playlist results screen tests Basically, the failing delayed test would fire two web requests during the proceedings. In unfortunate timing, the first would succeed and the test would think "everything is okay", but the actual request loading results has not yet run. This check ensures *something* is loaded, which seems to be enough to make things reliable. --- .../Visual/Playlists/TestScenePlaylistsResultsScreen.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs index f5fe00458a..c532e8bc05 100644 --- a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs +++ b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs @@ -173,6 +173,8 @@ namespace osu.Game.Tests.Visual.Playlists { AddUntilStep("wait for scores loaded", () => requestComplete + // request handler may need to fire more than once to get scores. + && totalCount > 0 && resultsScreen.ScorePanelList.GetScorePanels().Count() == totalCount && resultsScreen.ScorePanelList.AllPanelsVisible); AddWaitStep("wait for display", 5); From 82a1ba1d46650bf11164e26537ddfa64ae995c84 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 May 2022 17:42:27 +0900 Subject: [PATCH 1300/2328] Use pooled memory for memory copies performed by `ZipArchiveReader` --- osu.Game/IO/Archives/ZipArchiveReader.cs | 56 +++++++++++++++++++++--- osu.Game/osu.Game.csproj | 1 + 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/osu.Game/IO/Archives/ZipArchiveReader.cs b/osu.Game/IO/Archives/ZipArchiveReader.cs index 80dfa104f3..ae2b85da51 100644 --- a/osu.Game/IO/Archives/ZipArchiveReader.cs +++ b/osu.Game/IO/Archives/ZipArchiveReader.cs @@ -1,11 +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 System.Buffers; using System.Collections.Generic; using System.IO; using System.Linq; +using Microsoft.Toolkit.HighPerformance; +using osu.Framework.Extensions; using osu.Framework.IO.Stores; using SharpCompress.Archives.Zip; +using SixLabors.ImageSharp.Memory; namespace osu.Game.IO.Archives { @@ -27,15 +31,12 @@ namespace osu.Game.IO.Archives if (entry == null) throw new FileNotFoundException(); - // allow seeking - MemoryStream copy = new MemoryStream(); + var owner = MemoryAllocator.Default.Allocate((int)entry.Size); using (Stream s = entry.OpenEntryStream()) - s.CopyTo(copy); + s.ReadToFill(owner.Memory.Span); - copy.Position = 0; - - return copy; + return new MemoryOwnerMemoryStream(owner); } public override void Dispose() @@ -45,5 +46,48 @@ namespace osu.Game.IO.Archives } public override IEnumerable Filenames => archive.Entries.Select(e => e.Key).ExcludeSystemFileNames(); + + private class MemoryOwnerMemoryStream : Stream + { + private readonly IMemoryOwner owner; + private readonly Stream stream; + + public MemoryOwnerMemoryStream(IMemoryOwner owner) + { + this.owner = owner; + + stream = owner.Memory.AsStream(); + } + + protected override void Dispose(bool disposing) + { + owner?.Dispose(); + base.Dispose(disposing); + } + + public override void Flush() => stream.Flush(); + + public override int Read(byte[] buffer, int offset, int count) => stream.Read(buffer, offset, count); + + public override long Seek(long offset, SeekOrigin origin) => stream.Seek(offset, origin); + + public override void SetLength(long value) => stream.SetLength(value); + + public override void Write(byte[] buffer, int offset, int count) => stream.Write(buffer, offset, count); + + public override bool CanRead => stream.CanRead; + + public override bool CanSeek => stream.CanSeek; + + public override bool CanWrite => stream.CanWrite; + + public override long Length => stream.Length; + + public override long Position + { + get => stream.Position; + set => stream.Position = value; + } + } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 79cfd7c917..6ce21ccad6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -29,6 +29,7 @@ + all From d6b18d87b8f7c14bb078dca1863a4283ee16cb7f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 May 2022 19:58:47 +0900 Subject: [PATCH 1301/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index c28085557e..116c7dbfcd 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6ce21ccad6..eb47d0468f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index b1ba64beba..ccecad6f82 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 0d7fa3b55cd0b7e1822b1d73e42969ee3e4d5be6 Mon Sep 17 00:00:00 2001 From: tornac1234 Date: Mon, 30 May 2022 22:38:47 +0200 Subject: [PATCH 1302/2328] Added rulesets rankings updating for Discord RPC --- osu.Desktop/DiscordRichPresence.cs | 57 ++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index d87b25a4c7..9f3a5b2f07 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using System.Text; using DiscordRPC; using DiscordRPC.Message; @@ -12,6 +13,7 @@ using osu.Framework.Logging; using osu.Game.Configuration; using osu.Game.Extensions; using osu.Game.Online.API; +using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; using osu.Game.Users; @@ -30,6 +32,9 @@ namespace osu.Desktop private IBindable user; + [Resolved] + private IAPIProvider api { get; set; } + private readonly IBindable status = new Bindable(); private readonly IBindable activity = new Bindable(); @@ -66,7 +71,7 @@ namespace osu.Desktop activity.BindTo(u.NewValue.Activity); }, true); - ruleset.BindValueChanged(_ => updateStatus()); + ruleset.BindValueChanged(_ => requestUserRulesetsRankings()); status.BindValueChanged(_ => updateStatus()); activity.BindValueChanged(_ => updateStatus()); privacyMode.BindValueChanged(_ => updateStatus()); @@ -77,7 +82,7 @@ namespace osu.Desktop private void onReady(object _, ReadyMessage __) { Logger.Log("Discord RPC Client ready.", LoggingTarget.Network, LogLevel.Debug); - updateStatus(); + requestUserRulesetsRankings(); } private void updateStatus() @@ -106,7 +111,12 @@ namespace osu.Desktop if (privacyMode.Value == DiscordRichPresenceMode.Limited) presence.Assets.LargeImageText = string.Empty; else - presence.Assets.LargeImageText = $"{user.Value.Username}" + (user.Value.Statistics?.GlobalRank > 0 ? $" (rank #{user.Value.Statistics.GlobalRank:N0})" : string.Empty); + { + if (user.Value.RulesetsStatistics != null && user.Value.RulesetsStatistics.TryGetValue(ruleset.Value.ShortName, out UserStatistics statistics)) + presence.Assets.LargeImageText = $"{user.Value.Username}" + (statistics.GlobalRank > 0 ? $" (rank #{statistics.GlobalRank:N0})" : string.Empty); + else + presence.Assets.LargeImageText = $"{user.Value.Username}" + (user.Value.Statistics?.GlobalRank > 0 ? $" (rank #{user.Value.Statistics.GlobalRank:N0})" : string.Empty); + } // update ruleset presence.Assets.SmallImageKey = ruleset.Value.IsLegacyRuleset() ? $"mode_{ruleset.Value.OnlineID}" : "mode_custom"; @@ -115,6 +125,47 @@ namespace osu.Desktop client.SetPresence(presence); } + private void requestUserRulesetsRankings() + { + RulesetInfo cachedRuleset = ruleset.Value; + + // When first logging in, we can't send a request with an empty id + if (api.LocalUser.Value.Id > 1) + { + var req = new GetUsersRequest(new int[] { api.LocalUser.Value.Id }); + req.Success += result => + { + if (result.Users.Count == 1) + { + APIUser apiUser = result.Users[0]; + user.Value.RulesetsStatistics = apiUser.RulesetsStatistics; + } + + updateStatus(); + }; + req.Failure += _ => updateStatus(); + + api.Queue(req); + } + else + { + var req = new GetUserRequest(api.LocalUser.Value.Username, ruleset.Value); + + req.Success += result => + { + user.Value.RulesetsStatistics ??= new Dictionary(); + user.Value.RulesetsStatistics[ruleset.Value.ShortName] = result.Statistics; + updateStatus(); + }; + req.Failure += error => + { + updateStatus(); + }; + + api.Queue(req); + } + } + private static readonly int ellipsis_length = Encoding.UTF8.GetByteCount(new[] { '…' }); private string truncate(string str) From a3f5e2458dd1a88d8448e157f2d751f9bcc7a2c6 Mon Sep 17 00:00:00 2001 From: tornac1234 Date: Mon, 30 May 2022 22:39:49 +0200 Subject: [PATCH 1303/2328] Show beatmap star rating in RPC --- osu.Desktop/DiscordRichPresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index 9f3a5b2f07..32c6931930 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -192,7 +192,7 @@ namespace osu.Desktop switch (activity) { case UserActivity.InGame game: - return game.BeatmapInfo.ToString(); + return $"[{Math.Round(game.BeatmapInfo.StarRating, 2)}*] {game.BeatmapInfo}"; case UserActivity.Editing edit: return edit.BeatmapInfo.ToString(); From bc1b20291bab23b2532b89985290b64e7fee169f Mon Sep 17 00:00:00 2001 From: tornac1234 Date: Mon, 30 May 2022 23:12:39 +0200 Subject: [PATCH 1304/2328] Revert "Show beatmap star rating in RPC" This reverts commit a3f5e2458dd1a88d8448e157f2d751f9bcc7a2c6. --- osu.Desktop/DiscordRichPresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index 32c6931930..9f3a5b2f07 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -192,7 +192,7 @@ namespace osu.Desktop switch (activity) { case UserActivity.InGame game: - return $"[{Math.Round(game.BeatmapInfo.StarRating, 2)}*] {game.BeatmapInfo}"; + return game.BeatmapInfo.ToString(); case UserActivity.Editing edit: return edit.BeatmapInfo.ToString(); From 80fa90f65d149d806a05a2e616f047616591ae04 Mon Sep 17 00:00:00 2001 From: tornac1234 Date: Mon, 30 May 2022 23:23:54 +0200 Subject: [PATCH 1305/2328] Removed a useless branch in the statistics request --- osu.Desktop/DiscordRichPresence.cs | 43 ++++++++---------------------- 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index 9f3a5b2f07..44a3a1622c 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -71,7 +71,7 @@ namespace osu.Desktop activity.BindTo(u.NewValue.Activity); }, true); - ruleset.BindValueChanged(_ => requestUserRulesetsRankings()); + ruleset.BindValueChanged(_ => updateStatus()); status.BindValueChanged(_ => updateStatus()); activity.BindValueChanged(_ => updateStatus()); privacyMode.BindValueChanged(_ => updateStatus()); @@ -129,41 +129,20 @@ namespace osu.Desktop { RulesetInfo cachedRuleset = ruleset.Value; - // When first logging in, we can't send a request with an empty id - if (api.LocalUser.Value.Id > 1) + var req = new GetUsersRequest(new int[] { api.LocalUser.Value.Id }); + req.Success += result => { - var req = new GetUsersRequest(new int[] { api.LocalUser.Value.Id }); - req.Success += result => + if (result.Users.Count == 1) { - if (result.Users.Count == 1) - { - APIUser apiUser = result.Users[0]; - user.Value.RulesetsStatistics = apiUser.RulesetsStatistics; - } + APIUser apiUser = result.Users[0]; + user.Value.RulesetsStatistics = apiUser.RulesetsStatistics; + } - updateStatus(); - }; - req.Failure += _ => updateStatus(); + updateStatus(); + }; + req.Failure += _ => updateStatus(); - api.Queue(req); - } - else - { - var req = new GetUserRequest(api.LocalUser.Value.Username, ruleset.Value); - - req.Success += result => - { - user.Value.RulesetsStatistics ??= new Dictionary(); - user.Value.RulesetsStatistics[ruleset.Value.ShortName] = result.Statistics; - updateStatus(); - }; - req.Failure += error => - { - updateStatus(); - }; - - api.Queue(req); - } + api.Queue(req); } private static readonly int ellipsis_length = Encoding.UTF8.GetByteCount(new[] { '…' }); From bcee9ac438cfbf755741279f3c2e9aaee19ec794 Mon Sep 17 00:00:00 2001 From: tornac1234 Date: Mon, 30 May 2022 23:32:55 +0200 Subject: [PATCH 1306/2328] Removed IAPIProvider from load and unified it's usage --- osu.Desktop/DiscordRichPresence.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index 44a3a1622c..14fea7a08d 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Collections.Generic; using System.Text; using DiscordRPC; using DiscordRPC.Message; @@ -33,7 +32,7 @@ namespace osu.Desktop private IBindable user; [Resolved] - private IAPIProvider api { get; set; } + private IAPIProvider provider { get; set; } private readonly IBindable status = new Bindable(); private readonly IBindable activity = new Bindable(); @@ -46,7 +45,7 @@ namespace osu.Desktop }; [BackgroundDependencyLoader] - private void load(IAPIProvider provider, OsuConfigManager config) + private void load(OsuConfigManager config) { client = new DiscordRpcClient(client_id) { @@ -129,7 +128,7 @@ namespace osu.Desktop { RulesetInfo cachedRuleset = ruleset.Value; - var req = new GetUsersRequest(new int[] { api.LocalUser.Value.Id }); + var req = new GetUsersRequest(new int[] { provider.LocalUser.Value.Id }); req.Success += result => { if (result.Users.Count == 1) @@ -142,7 +141,7 @@ namespace osu.Desktop }; req.Failure += _ => updateStatus(); - api.Queue(req); + provider.Queue(req); } private static readonly int ellipsis_length = Encoding.UTF8.GetByteCount(new[] { '…' }); From 477e520766ef2924e4bbc37ab5cb33cf085debfe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 12:24:44 +0900 Subject: [PATCH 1307/2328] Add comment regarding deadlock avoidance --- osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs b/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs index 32e42a945d..df3974664e 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs @@ -83,6 +83,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay #pragma warning disable RS0030 // We can't GetResultSafely() here (will fail with "Can't use GetResultSafely from inside an async operation."), but Wait is safe enough due to // the task being a TaskCompletionSource. + // Importantly, this doesn't deadlock because of the scheduler call above running inline where feasible (see the `false` argument). return tcs.Task.Result; #pragma warning restore RS0030 }; From 53844d3df1548a1db0c31ebc6cd82b9b529655af Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 14:01:42 +0900 Subject: [PATCH 1308/2328] Refactor settings item "warning" text to allow non-warning state --- .../Visual/Settings/TestSceneSettingsItem.cs | 19 +++++---- .../Sections/Graphics/LayoutSettings.cs | 8 ++-- .../Sections/Graphics/RendererSettings.cs | 11 +++++- .../Settings/Sections/Input/MouseSettings.cs | 4 +- .../Settings/Sections/Input/TabletSettings.cs | 5 ++- .../UserInterface/MainMenuSettings.cs | 5 ++- osu.Game/Overlays/Settings/SettingsItem.cs | 39 +++++++++++-------- .../Overlays/Settings/SettingsNoticeText.cs | 19 --------- 8 files changed, 57 insertions(+), 53 deletions(-) delete mode 100644 osu.Game/Overlays/Settings/SettingsNoticeText.cs diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs index 83265e13ad..f631e1603b 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs @@ -6,6 +6,7 @@ using NUnit.Framework; using osu.Framework.Bindables; using osu.Framework.Testing; using osu.Framework.Utils; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; @@ -83,7 +84,7 @@ namespace osu.Game.Tests.Visual.Settings AddStep("clear label", () => textBox.LabelText = default); AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(restoreDefaultValueButton.Parent.DrawHeight, control.DrawHeight, 1)); - AddStep("set warning text", () => textBox.WarningText = "This is some very important warning text! Hopefully it doesn't break the alignment of the default value indicator..."); + AddStep("set warning text", () => textBox.SetWarningText("This is some very important warning text! Hopefully it doesn't break the alignment of the default value indicator...")); AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(restoreDefaultValueButton.Parent.DrawHeight, control.DrawHeight, 1)); } @@ -129,16 +130,18 @@ namespace osu.Game.Tests.Visual.Settings SettingsNumberBox numberBox = null; AddStep("create settings item", () => Child = numberBox = new SettingsNumberBox()); - AddAssert("warning text not created", () => !numberBox.ChildrenOfType().Any()); + AddAssert("warning text not created", () => !numberBox.ChildrenOfType().Any()); - AddStep("set warning text", () => numberBox.WarningText = "this is a warning!"); - AddAssert("warning text created", () => numberBox.ChildrenOfType().Single().Alpha == 1); + AddStep("set warning text", () => numberBox.SetWarningText("this is a warning!")); + AddAssert("warning text created", () => numberBox.ChildrenOfType().Single().Alpha == 1); - AddStep("unset warning text", () => numberBox.WarningText = default); - AddAssert("warning text hidden", () => numberBox.ChildrenOfType().Single().Alpha == 0); + AddStep("unset warning text", () => numberBox.ClearWarningText()); + AddAssert("warning text hidden", () => !numberBox.ChildrenOfType().Any()); - AddStep("set warning text again", () => numberBox.WarningText = "another warning!"); - AddAssert("warning text shown again", () => numberBox.ChildrenOfType().Single().Alpha == 1); + AddStep("set warning text again", () => numberBox.SetWarningText("another warning!")); + AddAssert("warning text shown again", () => numberBox.ChildrenOfType().Single().Alpha == 1); + + AddStep("set non warning text", () => numberBox.SetWarningText("you did good!", false)); } } } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 69a50c19b4..1ebe5aa85e 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -226,7 +226,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { if (windowModeDropdown.Current.Value != WindowMode.Fullscreen) { - windowModeDropdown.WarningText = GraphicsSettingsStrings.NotFullscreenNote; + windowModeDropdown.SetWarningText(GraphicsSettingsStrings.NotFullscreenNote); return; } @@ -234,15 +234,15 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { case FullscreenCapability.Unknown: if (host.Window is WindowsWindow) - windowModeDropdown.WarningText = LayoutSettingsStrings.CheckingForFullscreenCapabilities; + windowModeDropdown.SetWarningText(LayoutSettingsStrings.CheckingForFullscreenCapabilities); break; case FullscreenCapability.Capable: - windowModeDropdown.WarningText = LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen; + windowModeDropdown.SetWarningText(LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen, false); break; case FullscreenCapability.Incapable: - windowModeDropdown.WarningText = LayoutSettingsStrings.UnableToRunExclusiveFullscreen; + windowModeDropdown.SetWarningText(LayoutSettingsStrings.UnableToRunExclusiveFullscreen); break; } } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs index 653f30a018..6ec4decdda 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs @@ -48,7 +48,16 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics frameLimiterDropdown.Current.BindValueChanged(limit => { - frameLimiterDropdown.WarningText = limit.NewValue == FrameSync.Unlimited ? GraphicsSettingsStrings.UnlimitedFramesNote : default; + switch (limit.NewValue) + { + case FrameSync.Unlimited: + frameLimiterDropdown.SetWarningText(GraphicsSettingsStrings.UnlimitedFramesNote); + break; + + default: + frameLimiterDropdown.ClearWarningText(); + break; + } }, true); } } diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 4235dc0a05..042cec106a 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -117,9 +117,9 @@ namespace osu.Game.Overlays.Settings.Sections.Input if (RuntimeInfo.OS != RuntimeInfo.Platform.Windows) { if (highPrecision.NewValue) - highPrecisionMouse.WarningText = MouseSettingsStrings.HighPrecisionPlatformWarning; + highPrecisionMouse.SetWarningText(MouseSettingsStrings.HighPrecisionPlatformWarning); else - highPrecisionMouse.WarningText = null; + highPrecisionMouse.ClearWarningText(); } }, true); } diff --git a/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs index 802d442ced..5d31c38ae7 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs @@ -11,6 +11,7 @@ using osu.Framework.Localisation; using osu.Framework.Platform; using osu.Framework.Threading; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osuTK; using osu.Game.Localisation; @@ -95,11 +96,13 @@ namespace osu.Game.Overlays.Settings.Sections.Input Origin = Anchor.TopCentre, Text = TabletSettingsStrings.NoTabletDetected, }, - new SettingsNoticeText(colours) + new LinkFlowContainer(cp => cp.Colour = colours.Yellow) { TextAnchor = Anchor.TopCentre, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, }.With(t => { if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows || RuntimeInfo.OS == RuntimeInfo.Platform.Linux) diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs index 284e9cb2de..d3cc889abe 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs @@ -61,7 +61,10 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface user.BindValueChanged(u => { - backgroundSourceDropdown.WarningText = u.NewValue?.IsSupporter != true ? UserInterfaceStrings.NotSupporterNote : default; + if (u.NewValue?.IsSupporter != true) + backgroundSourceDropdown.SetWarningText(UserInterfaceStrings.NotSupporterNote); + else + backgroundSourceDropdown.ClearWarningText(); }, true); } } diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index ee9daa1c0d..fa521c0126 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -70,27 +70,32 @@ namespace osu.Game.Overlays.Settings } /// - /// Text to be displayed at the bottom of this . + /// Clear any warning text. + /// + public void ClearWarningText() + { + warningText?.Expire(); + warningText = null; + } + + /// + /// Set the text to be displayed at the bottom of this . /// Generally used to recommend the user change their setting as the current one is considered sub-optimal. /// - public LocalisableString? WarningText + /// The text to display. + /// Whether the text is in a warning state. Will decide how this is visually represented. + public void SetWarningText(LocalisableString text, bool isWarning = true) { - set + ClearWarningText(); + + // construct lazily for cases where the label is not needed (may be provided by the Control). + FlowContent.Add(warningText = new LinkFlowContainer(cp => cp.Colour = isWarning ? colours.Yellow : colours.Green) { - bool hasValue = value != default; - - if (warningText == null) - { - if (!hasValue) - return; - - // construct lazily for cases where the label is not needed (may be provided by the Control). - FlowContent.Add(warningText = new SettingsNoticeText(colours) { Margin = new MarginPadding { Bottom = 5 } }); - } - - warningText.Alpha = hasValue ? 1 : 0; - warningText.Text = value ?? default; - } + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Margin = new MarginPadding { Bottom = 5 }, + Text = text, + }); } public virtual Bindable Current diff --git a/osu.Game/Overlays/Settings/SettingsNoticeText.cs b/osu.Game/Overlays/Settings/SettingsNoticeText.cs deleted file mode 100644 index 76ecf7edd4..0000000000 --- a/osu.Game/Overlays/Settings/SettingsNoticeText.cs +++ /dev/null @@ -1,19 +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.Framework.Graphics; -using osu.Game.Graphics; -using osu.Game.Graphics.Containers; - -namespace osu.Game.Overlays.Settings -{ - public class SettingsNoticeText : LinkFlowContainer - { - public SettingsNoticeText(OsuColour colours) - : base(s => s.Colour = colours.Yellow) - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - } - } -} From f7110116de361f40e6c8aeb76b761eb250714c9b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 14:04:56 +0900 Subject: [PATCH 1309/2328] Only display exclusive fullscreen hinting on windows --- .../Sections/Graphics/LayoutSettings.cs | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 1ebe5aa85e..53f84a9bb2 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -230,20 +230,27 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics return; } - switch (fullscreenCapability.Value) + if (host.Window is WindowsWindow) { - case FullscreenCapability.Unknown: - if (host.Window is WindowsWindow) + switch (fullscreenCapability.Value) + { + case FullscreenCapability.Unknown: windowModeDropdown.SetWarningText(LayoutSettingsStrings.CheckingForFullscreenCapabilities); - break; + break; - case FullscreenCapability.Capable: - windowModeDropdown.SetWarningText(LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen, false); - break; + case FullscreenCapability.Capable: + windowModeDropdown.SetWarningText(LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen, false); + break; - case FullscreenCapability.Incapable: - windowModeDropdown.SetWarningText(LayoutSettingsStrings.UnableToRunExclusiveFullscreen); - break; + case FullscreenCapability.Incapable: + windowModeDropdown.SetWarningText(LayoutSettingsStrings.UnableToRunExclusiveFullscreen); + break; + } + } + else + { + // We can only detect exclusive fullscreen status on windows currently. + windowModeDropdown.ClearWarningText(); } } From 27efeb7d4e1ce134aeb923d8f2f456d6b5b70f4e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 14:58:49 +0900 Subject: [PATCH 1310/2328] Fix `TimingSection` performing a beatmap save when switching bound timing points --- osu.Game/Screens/Edit/Timing/TimingSection.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Edit/Timing/TimingSection.cs b/osu.Game/Screens/Edit/Timing/TimingSection.cs index a5abd96d72..bebd4c1049 100644 --- a/osu.Game/Screens/Edit/Timing/TimingSection.cs +++ b/osu.Game/Screens/Edit/Timing/TimingSection.cs @@ -32,9 +32,11 @@ namespace osu.Game.Screens.Edit.Timing { if (point.NewValue != null) { + bpmTextEntry.Current.UnbindEvents(); bpmTextEntry.Bindable = point.NewValue.BeatLengthBindable; bpmTextEntry.Current.BindValueChanged(_ => ChangeHandler?.SaveState()); + timeSignature.Current.UnbindEvents(); timeSignature.Current = point.NewValue.TimeSignatureBindable; timeSignature.Current.BindValueChanged(_ => ChangeHandler?.SaveState()); } From cf5da44492a4d7da9c40d8e3f390e078e85cb94b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 15:00:30 +0900 Subject: [PATCH 1311/2328] Add automatic control point tracking to the timing screen --- .../Visual/Editing/TestSceneTimingScreen.cs | 48 ++++++++++++++- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 58 ++++++++++++++++++- 2 files changed, 104 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs b/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs index 17b8189fc7..3a709cb66d 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs @@ -1,14 +1,18 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; +using osu.Framework.Testing; using osu.Game.Overlays; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Timing; +using osu.Game.Screens.Edit.Timing.RowAttributes; +using osuTK.Input; namespace osu.Game.Tests.Visual.Editing { @@ -22,6 +26,8 @@ namespace osu.Game.Tests.Visual.Editing [Cached] private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue); + private TimingScreen timingScreen; + protected override bool ScrollUsingMouseWheel => false; public TestSceneTimingScreen() @@ -36,12 +42,52 @@ namespace osu.Game.Tests.Visual.Editing Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap); Beatmap.Disabled = true; - Child = new TimingScreen + Child = timingScreen = new TimingScreen { State = { Value = Visibility.Visible }, }; } + [SetUpSteps] + public void SetUpSteps() + { + AddStep("Stop clock", () => Clock.Stop()); + } + + [Test] + public void TestTrackingCurrentTimeWhileRunning() + { + AddStep("Select first effect point", () => + { + InputManager.MoveMouseTo(Child.ChildrenOfType().First()); + InputManager.Click(MouseButton.Left); + }); + + AddUntilStep("Selection changed", () => timingScreen.SelectedGroup.Value.Time == 54670); + AddUntilStep("Ensure seeked to correct time", () => Clock.CurrentTimeAccurate == 54670); + + AddStep("Seek to just before next point", () => Clock.Seek(69000)); + AddStep("Start clock", () => Clock.Start()); + + AddUntilStep("Selection changed", () => timingScreen.SelectedGroup.Value.Time == 69670); + } + + [Test] + public void TestTrackingCurrentTimeWhilePaused() + { + AddStep("Select first effect point", () => + { + InputManager.MoveMouseTo(Child.ChildrenOfType().First()); + InputManager.Click(MouseButton.Left); + }); + + AddUntilStep("Selection changed", () => timingScreen.SelectedGroup.Value.Time == 54670); + AddUntilStep("Ensure seeked to correct time", () => Clock.CurrentTimeAccurate == 54670); + + AddStep("Seek to later", () => Clock.Seek(80000)); + AddUntilStep("Selection changed", () => timingScreen.SelectedGroup.Value.Time == 69670); + } + protected override void Dispose(bool isDisposing) { Beatmap.Disabled = false; diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index f71a8d7d22..0cf4fca58a 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -1,6 +1,7 @@ // 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.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -19,7 +20,7 @@ namespace osu.Game.Screens.Edit.Timing public class TimingScreen : EditorScreenWithTimeline { [Cached] - private Bindable selectedGroup = new Bindable(); + public readonly Bindable SelectedGroup = new Bindable(); public TimingScreen() : base(EditorScreenMode.Timing) @@ -132,6 +133,61 @@ namespace osu.Game.Screens.Edit.Timing }, true); } + protected override void Update() + { + base.Update(); + + trackActivePoint(); + } + + /// + /// Given the user has selected a control point group, we want to track any group which is + /// active at the current point in time which matches the type the user has selected. + /// + /// So if the user is currently looking at a timing point and seeks into the future, a + /// future timing point would be automatically selected if it is now the new "current" point. + /// + private void trackActivePoint() + { + // For simplicity only match on the first type of the active control point. + var selectedPointType = selectedGroup.Value?.ControlPoints.FirstOrDefault()?.GetType(); + + if (selectedPointType != null) + { + // We don't have an efficient way of looking up groups currently, only individual point types. + // To improve the efficiency of this in the future, we should reconsider the overall structure of ControlPointInfo. + IEnumerable groups = Beatmap.ControlPointInfo.Groups; + + bool currentTimeBeforeSelectedGroup = clock.CurrentTimeAccurate < selectedGroup.Value.Time; + + // Decide whether we are searching backwards or forwards. + if (currentTimeBeforeSelectedGroup) + groups = groups.Reverse(); + + // Find the next group which has the same type as the selected one. + groups = groups.SkipWhile(g => g != selectedGroup.Value) + .Skip(1) + .Where(g => g.ControlPoints.Any(cp => cp.GetType() == selectedPointType)); + + ControlPointGroup newGroup = groups.FirstOrDefault(); + + if (newGroup != null) + { + if (currentTimeBeforeSelectedGroup) + { + // When seeking backwards, the first match from the LINQ query is always what we want. + selectedGroup.Value = newGroup; + } + else + { + // When seeking forwards, we also need to check that the next match is before the current time. + if (newGroup.Time <= clock.CurrentTimeAccurate) + selectedGroup.Value = newGroup; + } + } + } + } + private void delete() { if (selectedGroup.Value == null) From ebb83a5e497e69027aaaa9cef28704f7688e6d22 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 15:10:55 +0900 Subject: [PATCH 1312/2328] Add TODO about scroll behaviour which is missing --- osu.Game/Screens/Edit/Timing/ControlPointTable.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs index 0c12eff503..77d875b67f 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs @@ -61,6 +61,7 @@ namespace osu.Game.Screens.Edit.Timing selectedGroup.BindValueChanged(group => { + // TODO: This should scroll the selected row into view. foreach (var b in BackgroundFlow) b.Selected = b.Item == group.NewValue; }, true); } From 9746cbb1610383ccafc7957335a393b895c007f0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 15:54:07 +0900 Subject: [PATCH 1313/2328] Ensure rows have loaded before attempting to click them --- osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs b/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs index 3a709cb66d..a358166477 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs @@ -52,6 +52,8 @@ namespace osu.Game.Tests.Visual.Editing public void SetUpSteps() { AddStep("Stop clock", () => Clock.Stop()); + + AddUntilStep("wait for rows to load", () => Child.ChildrenOfType().Any()); } [Test] From 132c94c1b57ce391c48a1446b29ab606ca61789f Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 31 May 2022 17:16:23 +0900 Subject: [PATCH 1314/2328] Remove Ruleset parameter from ResetFromReplayFrame() --- .../Gameplay/TestSceneScoreProcessor.cs | 6 +++--- .../Rulesets/Scoring/JudgementProcessor.cs | 3 +-- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 18 +++++++----------- osu.Game/Rulesets/UI/RulesetInputManager.cs | 6 +----- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/osu.Game.Tests/Gameplay/TestSceneScoreProcessor.cs b/osu.Game.Tests/Gameplay/TestSceneScoreProcessor.cs index 9c307341bd..af4b002bc9 100644 --- a/osu.Game.Tests/Gameplay/TestSceneScoreProcessor.cs +++ b/osu.Game.Tests/Gameplay/TestSceneScoreProcessor.cs @@ -61,13 +61,13 @@ namespace osu.Game.Tests.Gameplay Assert.That(scoreProcessor.JudgedHits, Is.EqualTo(1)); // No header shouldn't cause any change - scoreProcessor.ResetFromReplayFrame(new OsuRuleset(), new OsuReplayFrame()); + scoreProcessor.ResetFromReplayFrame(new OsuReplayFrame()); Assert.That(scoreProcessor.TotalScore.Value, Is.EqualTo(1_000_000)); Assert.That(scoreProcessor.JudgedHits, Is.EqualTo(1)); // Reset with a miss instead. - scoreProcessor.ResetFromReplayFrame(new OsuRuleset(), new OsuReplayFrame + scoreProcessor.ResetFromReplayFrame(new OsuReplayFrame { Header = new FrameHeader(0, 0, 0, new Dictionary { { HitResult.Miss, 1 } }, DateTimeOffset.Now) }); @@ -76,7 +76,7 @@ namespace osu.Game.Tests.Gameplay Assert.That(scoreProcessor.JudgedHits, Is.EqualTo(1)); // Reset with no judged hit. - scoreProcessor.ResetFromReplayFrame(new OsuRuleset(), new OsuReplayFrame + scoreProcessor.ResetFromReplayFrame(new OsuReplayFrame { Header = new FrameHeader(0, 0, 0, new Dictionary(), DateTimeOffset.Now) }); diff --git a/osu.Game/Rulesets/Scoring/JudgementProcessor.cs b/osu.Game/Rulesets/Scoring/JudgementProcessor.cs index 94ddc32bb7..bfa67b8c45 100644 --- a/osu.Game/Rulesets/Scoring/JudgementProcessor.cs +++ b/osu.Game/Rulesets/Scoring/JudgementProcessor.cs @@ -117,9 +117,8 @@ namespace osu.Game.Rulesets.Scoring /// /// If the provided replay frame does not have any header information, this will be a noop. /// - /// The ruleset to be used for retrieving statistics. /// The replay frame to read header statistics from. - public virtual void ResetFromReplayFrame(Ruleset ruleset, ReplayFrame frame) + public virtual void ResetFromReplayFrame(ReplayFrame frame) { if (frame.Header == null) return; diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 1dd1d1aeb6..1403a3f243 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -251,8 +251,7 @@ namespace osu.Game.Rulesets.Scoring if (!ruleset.RulesetInfo.Equals(scoreInfo.Ruleset)) throw new ArgumentException($"Unexpected score ruleset. Expected \"{ruleset.RulesetInfo.ShortName}\" but was \"{scoreInfo.Ruleset.ShortName}\"."); - extractFromStatistics(ruleset, - scoreInfo.Statistics, + extractFromStatistics(scoreInfo.Statistics, out double extractedBaseScore, out double extractedMaxBaseScore, out int extractedMaxCombo, @@ -281,8 +280,7 @@ namespace osu.Game.Rulesets.Scoring if (!beatmapApplied) throw new InvalidOperationException($"Cannot compute partial score without calling {nameof(ApplyBeatmap)}."); - extractFromStatistics(ruleset, - scoreInfo.Statistics, + extractFromStatistics(scoreInfo.Statistics, out double extractedBaseScore, out _, out _, @@ -318,9 +316,7 @@ namespace osu.Game.Rulesets.Scoring // Note: This cannot be applied universally to all legacy scores, as some rulesets (e.g. catch) group multiple judgements together. if (scoreInfo.IsLegacyScore && scoreInfo.Ruleset.OnlineID == 3) { - extractFromStatistics( - ruleset, - scoreInfo.Statistics, + extractFromStatistics(scoreInfo.Statistics, out double computedBaseScore, out double computedMaxBaseScore, out _, @@ -437,14 +433,14 @@ namespace osu.Game.Rulesets.Scoring score.TotalScore = (long)Math.Round(ComputeFinalScore(ScoringMode.Standardised, score)); } - public override void ResetFromReplayFrame(Ruleset ruleset, ReplayFrame frame) + public override void ResetFromReplayFrame(ReplayFrame frame) { - base.ResetFromReplayFrame(ruleset, frame); + base.ResetFromReplayFrame(frame); if (frame.Header == null) return; - extractFromStatistics(ruleset, frame.Header.Statistics, out baseScore, out rollingMaxBaseScore, out _, out _); + extractFromStatistics(frame.Header.Statistics, out baseScore, out rollingMaxBaseScore, out _, out _); HighestCombo.Value = frame.Header.MaxCombo; scoreResultCounts.Clear(); @@ -455,7 +451,7 @@ namespace osu.Game.Rulesets.Scoring OnResetFromReplayFrame?.Invoke(); } - private void extractFromStatistics(Ruleset ruleset, IReadOnlyDictionary statistics, out double baseScore, out double maxBaseScore, out int maxCombo, + private void extractFromStatistics(IReadOnlyDictionary statistics, out double baseScore, out double maxBaseScore, out int maxCombo, out int basicHitObjects) { baseScore = 0; diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index 7d1b23f48b..b5390eb6e2 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -27,8 +27,6 @@ namespace osu.Game.Rulesets.UI { public readonly KeyBindingContainer KeyBindingContainer; - private readonly Ruleset ruleset; - [Resolved(CanBeNull = true)] private ScoreProcessor scoreProcessor { get; set; } @@ -57,8 +55,6 @@ namespace osu.Game.Rulesets.UI protected RulesetInputManager(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique) { - this.ruleset = ruleset.CreateInstance(); - InternalChild = KeyBindingContainer = CreateKeyBindingContainer(ruleset, variant, unique) .WithChild(content = new Container { RelativeSizeAxes = Axes.Both }); @@ -85,7 +81,7 @@ namespace osu.Game.Rulesets.UI break; case ReplayStatisticsFrameEvent statisticsStateChangeEvent: - scoreProcessor?.ResetFromReplayFrame(ruleset, statisticsStateChangeEvent.Frame); + scoreProcessor?.ResetFromReplayFrame(statisticsStateChangeEvent.Frame); break; default: From 655780fd986785d65db914275157825f0fad5046 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 18:27:18 +0900 Subject: [PATCH 1315/2328] Fix regression in bpm textbox binding logic --- osu.Game/Screens/Edit/Timing/TimingSection.cs | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingSection.cs b/osu.Game/Screens/Edit/Timing/TimingSection.cs index bebd4c1049..1a97058d73 100644 --- a/osu.Game/Screens/Edit/Timing/TimingSection.cs +++ b/osu.Game/Screens/Edit/Timing/TimingSection.cs @@ -28,17 +28,31 @@ namespace osu.Game.Screens.Edit.Timing }); } + protected override void LoadComplete() + { + base.LoadComplete(); + + bpmTextEntry.Current.BindValueChanged(_ => saveChanges()); + timeSignature.Current.BindValueChanged(_ => saveChanges()); + + void saveChanges() + { + if (!isRebinding) ChangeHandler?.SaveState(); + } + } + + private bool isRebinding; + protected override void OnControlPointChanged(ValueChangedEvent point) { if (point.NewValue != null) { - bpmTextEntry.Current.UnbindEvents(); - bpmTextEntry.Bindable = point.NewValue.BeatLengthBindable; - bpmTextEntry.Current.BindValueChanged(_ => ChangeHandler?.SaveState()); + isRebinding = true; - timeSignature.Current.UnbindEvents(); + bpmTextEntry.Bindable = point.NewValue.BeatLengthBindable; timeSignature.Current = point.NewValue.TimeSignatureBindable; - timeSignature.Current.BindValueChanged(_ => ChangeHandler?.SaveState()); + + isRebinding = false; } } From c0804803fd530beddd1f07ced27720b02ad92273 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 18:09:26 +0900 Subject: [PATCH 1316/2328] Add background to main waveform row --- .../Edit/Timing/WaveformComparisonDisplay.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index c80d3c4261..d212738d8d 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -63,7 +63,7 @@ namespace osu.Game.Screens.Edit.Timing for (int i = 0; i < total_waveforms; i++) { - AddInternal(new WaveformRow + AddInternal(new WaveformRow(i == total_waveforms / 2) { RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, @@ -177,17 +177,29 @@ namespace osu.Game.Screens.Edit.Timing internal class WaveformRow : CompositeDrawable { + private readonly bool isMainRow; private OsuSpriteText beatIndexText = null!; private WaveformGraph waveformGraph = null!; [Resolved] private OverlayColourProvider colourProvider { get; set; } = null!; + public WaveformRow(bool isMainRow) + { + this.isMainRow = isMainRow; + } + [BackgroundDependencyLoader] private void load(IBindable beatmap) { InternalChildren = new Drawable[] { + new Box + { + Colour = colourProvider.Background3, + Alpha = isMainRow ? 1 : 0, + RelativeSizeAxes = Axes.Both, + }, waveformGraph = new WaveformGraph { RelativeSizeAxes = Axes.Both, From 6bc68ada4380a612c243e207c56d3691f60cce7a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 16:15:53 +0900 Subject: [PATCH 1317/2328] Add ability to lock the `WaveformComparison` display to a current location --- .../Edit/Timing/WaveformComparisonDisplay.cs | 86 ++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index c80d3c4261..e86e75ad0d 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -14,6 +14,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays; @@ -26,6 +27,8 @@ namespace osu.Game.Screens.Edit.Timing { private const int total_waveforms = 8; + private const float corner_radius = LabelledDrawable.CORNER_RADIUS; + private readonly BindableNumber beatLength = new BindableDouble(); [Resolved] @@ -49,11 +52,18 @@ namespace osu.Game.Screens.Edit.Timing private readonly IBindableList controlPointGroups = new BindableList(); + private readonly BindableBool displayLocked = new BindableBool(); + + private LockedOverlay lockedOverlay = null!; + + [Resolved] + private OsuColour colours { get; set; } = null!; + public WaveformComparisonDisplay() { RelativeSizeAxes = Axes.Both; - CornerRadius = LabelledDrawable.CORNER_RADIUS; + CornerRadius = corner_radius; Masking = true; } @@ -81,12 +91,19 @@ namespace osu.Game.Screens.Edit.Timing Width = 3, }); + AddInternal(lockedOverlay = new LockedOverlay()); + selectedGroup.BindValueChanged(_ => updateTimingGroup(), true); controlPointGroups.BindTo(editorBeatmap.ControlPointInfo.Groups); controlPointGroups.BindCollectionChanged((_, __) => updateTimingGroup()); beatLength.BindValueChanged(_ => showFrom(lastDisplayedBeatIndex), true); + + displayLocked.BindValueChanged(locked => + { + lockedOverlay.FadeTo(locked.NewValue ? 1 : 0, 200, Easing.OutQuint); + }, true); } private void updateTimingGroup() @@ -130,6 +147,12 @@ namespace osu.Game.Screens.Edit.Timing return base.OnMouseMove(e); } + protected override bool OnClick(ClickEvent e) + { + displayLocked.Toggle(); + return true; + } + protected override void Update() { base.Update(); @@ -147,6 +170,9 @@ namespace osu.Game.Screens.Edit.Timing if (lastDisplayedBeatIndex == beatIndex) return; + if (displayLocked.Value) + return; + // Chosen as a pretty usable number across all BPMs. // Optimally we'd want this to scale with the BPM in question, but performing // scaling of the display is both expensive in resampling, and decreases usability @@ -175,6 +201,64 @@ namespace osu.Game.Screens.Edit.Timing lastDisplayedBeatIndex = beatIndex; } + internal class LockedOverlay : CompositeDrawable + { + private OsuSpriteText text = null!; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + RelativeSizeAxes = Axes.Both; + Masking = true; + CornerRadius = corner_radius; + BorderColour = colours.Red; + BorderThickness = 3; + Alpha = 0; + + InternalChildren = new Drawable[] + { + new Box + { + AlwaysPresent = true, + RelativeSizeAxes = Axes.Both, + Alpha = 0, + }, + new Container + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + new Box + { + Colour = colours.Red, + RelativeSizeAxes = Axes.Both, + }, + text = new OsuSpriteText + { + Colour = colours.GrayF, + Text = "Locked", + Margin = new MarginPadding(5), + Shadow = false, + Font = OsuFont.Default.With(size: 12, weight: FontWeight.SemiBold), + } + } + }, + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + text + .FadeIn().Then().Delay(500) + .FadeOut().Then().Delay(500) + .Loop(); + } + } + internal class WaveformRow : CompositeDrawable { private OsuSpriteText beatIndexText = null!; From c8f21ee8b2a8765477c62ff732678684869e010d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 16:32:02 +0900 Subject: [PATCH 1318/2328] Change `WaveformComparisonDisplay` to centre around a time offset rather than beat --- .../Edit/Timing/WaveformComparisonDisplay.cs | 48 +++++++++++-------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index e86e75ad0d..46ecf3d9f2 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -45,7 +45,7 @@ namespace osu.Game.Screens.Edit.Timing private TimingControlPoint timingPoint = TimingControlPoint.DEFAULT; - private int lastDisplayedBeatIndex; + private double displayedTime; private double selectedGroupStartTime; private double selectedGroupEndTime; @@ -56,9 +56,6 @@ namespace osu.Game.Screens.Edit.Timing private LockedOverlay lockedOverlay = null!; - [Resolved] - private OsuColour colours { get; set; } = null!; - public WaveformComparisonDisplay() { RelativeSizeAxes = Axes.Both; @@ -98,7 +95,7 @@ namespace osu.Game.Screens.Edit.Timing controlPointGroups.BindTo(editorBeatmap.ControlPointInfo.Groups); controlPointGroups.BindCollectionChanged((_, __) => updateTimingGroup()); - beatLength.BindValueChanged(_ => showFrom(lastDisplayedBeatIndex), true); + beatLength.BindValueChanged(_ => regenerateDisplay(), true); displayLocked.BindValueChanged(locked => { @@ -139,10 +136,13 @@ namespace osu.Game.Screens.Edit.Timing protected override bool OnMouseMove(MouseMoveEvent e) { - float trackLength = (float)beatmap.Value.Track.Length; - int totalBeatsAvailable = (int)(trackLength / timingPoint.BeatLength); + if (!displayLocked.Value) + { + float trackLength = (float)beatmap.Value.Track.Length; + int totalBeatsAvailable = (int)(trackLength / timingPoint.BeatLength); - Scheduler.AddOnce(showFrom, (int)(e.MousePosition.X / DrawWidth * totalBeatsAvailable)); + Scheduler.AddOnce(showFromBeat, (int)(e.MousePosition.X / DrawWidth * totalBeatsAvailable)); + } return base.OnMouseMove(e); } @@ -157,21 +157,29 @@ namespace osu.Game.Screens.Edit.Timing { base.Update(); - if (!IsHovered) + if (!IsHovered && !displayLocked.Value) { int currentBeat = (int)Math.Floor((editorClock.CurrentTimeAccurate - selectedGroupStartTime) / timingPoint.BeatLength); - showFrom(currentBeat); + showFromBeat(currentBeat); } } - private void showFrom(int beatIndex) + private void showFromBeat(int beatIndex) => + showFromTime(selectedGroupStartTime + beatIndex * timingPoint.BeatLength); + + private void showFromTime(double time) { - if (lastDisplayedBeatIndex == beatIndex) + if (displayedTime == time) return; - if (displayLocked.Value) - return; + displayedTime = time; + regenerateDisplay(); + } + + private void regenerateDisplay() + { + double index = (displayedTime - selectedGroupStartTime) / timingPoint.BeatLength; // Chosen as a pretty usable number across all BPMs. // Optimally we'd want this to scale with the BPM in question, but performing @@ -182,23 +190,25 @@ namespace osu.Game.Screens.Edit.Timing float trackLength = (float)beatmap.Value.Track.Length; float scale = trackLength / visible_width; + const int start_offset = total_waveforms / 2; + // Start displaying from before the current beat - beatIndex -= total_waveforms / 2; + index -= start_offset; foreach (var row in InternalChildren.OfType()) { // offset to the required beat index. - double time = selectedGroupStartTime + beatIndex * timingPoint.BeatLength; + double time = selectedGroupStartTime + index * timingPoint.BeatLength; float offset = (float)(time - visible_width / 2) / trackLength * scale; row.Alpha = time < selectedGroupStartTime || time > selectedGroupEndTime ? 0.2f : 1; row.WaveformOffset = -offset; row.WaveformScale = new Vector2(scale, 1); - row.BeatIndex = beatIndex++; - } + row.BeatIndex = (int)Math.Floor(index); - lastDisplayedBeatIndex = beatIndex; + index++; + } } internal class LockedOverlay : CompositeDrawable From 51014b8748a77964f0ff9b2266119e4e697e724b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 16:59:19 +0900 Subject: [PATCH 1319/2328] Ensure offset changes are correctly tracked by the display, even when locked --- .../Edit/Timing/WaveformComparisonDisplay.cs | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index 46ecf3d9f2..390965fbea 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -107,29 +107,37 @@ namespace osu.Game.Screens.Edit.Timing { beatLength.UnbindBindings(); - selectedGroupStartTime = 0; - selectedGroupEndTime = beatmap.Value.Track.Length; - var tcp = selectedGroup.Value?.ControlPoints.OfType().FirstOrDefault(); if (tcp == null) { timingPoint = new TimingControlPoint(); + // During movement of a control point's offset, this clause can be hit momentarily. + // We don't want to reset the `selectedGroupStartTime` here as we rely on having the + // last value to perform an offset traversal below. + selectedGroupEndTime = beatmap.Value.Track.Length; return; } timingPoint = tcp; beatLength.BindTo(timingPoint.BeatLengthBindable); - selectedGroupStartTime = selectedGroup.Value?.Time ?? 0; + double? newStartTime = selectedGroup.Value?.Time; + + if (newStartTime.HasValue && selectedGroupStartTime != newStartTime) + { + // The offset of the selected point may have changed. + // This handles the case the user has locked the view and expects the display to update with this change. + showFromTime(displayedTime + (newStartTime.Value - selectedGroupStartTime)); + } var nextGroup = editorBeatmap.ControlPointInfo.TimingPoints .SkipWhile(g => g != tcp) .Skip(1) .FirstOrDefault(); - if (nextGroup != null) - selectedGroupEndTime = nextGroup.Time; + selectedGroupStartTime = newStartTime ?? 0; + selectedGroupEndTime = nextGroup?.Time ?? beatmap.Value.Track.Length; } protected override bool OnHover(HoverEvent e) => true; From 94194a04f2931f5068b9ebb9e01de5f6dd13d8b0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 18:05:38 +0900 Subject: [PATCH 1320/2328] Animate adjustments --- .../Edit/Timing/WaveformComparisonDisplay.cs | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index 390965fbea..172f0ac9b1 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -95,7 +95,7 @@ namespace osu.Game.Screens.Edit.Timing controlPointGroups.BindTo(editorBeatmap.ControlPointInfo.Groups); controlPointGroups.BindCollectionChanged((_, __) => updateTimingGroup()); - beatLength.BindValueChanged(_ => regenerateDisplay(), true); + beatLength.BindValueChanged(_ => regenerateDisplay(true), true); displayLocked.BindValueChanged(locked => { @@ -128,7 +128,7 @@ namespace osu.Game.Screens.Edit.Timing { // The offset of the selected point may have changed. // This handles the case the user has locked the view and expects the display to update with this change. - showFromTime(displayedTime + (newStartTime.Value - selectedGroupStartTime)); + showFromTime(displayedTime + (newStartTime.Value - selectedGroupStartTime), true); } var nextGroup = editorBeatmap.ControlPointInfo.TimingPoints @@ -174,18 +174,18 @@ namespace osu.Game.Screens.Edit.Timing } private void showFromBeat(int beatIndex) => - showFromTime(selectedGroupStartTime + beatIndex * timingPoint.BeatLength); + showFromTime(selectedGroupStartTime + beatIndex * timingPoint.BeatLength, false); - private void showFromTime(double time) + private void showFromTime(double time, bool animated) { if (displayedTime == time) return; displayedTime = time; - regenerateDisplay(); + regenerateDisplay(animated); } - private void regenerateDisplay() + private void regenerateDisplay(bool animated) { double index = (displayedTime - selectedGroupStartTime) / timingPoint.BeatLength; @@ -211,7 +211,7 @@ namespace osu.Game.Screens.Edit.Timing float offset = (float)(time - visible_width / 2) / trackLength * scale; row.Alpha = time < selectedGroupStartTime || time > selectedGroupEndTime ? 0.2f : 1; - row.WaveformOffset = -offset; + row.WaveformOffsetTo(-offset, animated); row.WaveformScale = new Vector2(scale, 1); row.BeatIndex = (int)Math.Floor(index); @@ -314,7 +314,15 @@ namespace osu.Game.Screens.Edit.Timing public int BeatIndex { set => beatIndexText.Text = value.ToString(); } public Vector2 WaveformScale { set => waveformGraph.Scale = value; } - public float WaveformOffset { set => waveformGraph.X = value; } + + public void WaveformOffsetTo(float value, bool animated) => + this.TransformTo(nameof(waveformOffset), value, animated ? 300 : 0, Easing.OutQuint); + + private float waveformOffset + { + get => waveformGraph.X; + set => waveformGraph.X = value; + } } } } From 475cc8174ff036f626f883ab6a75774c960a5e74 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 18:17:08 +0900 Subject: [PATCH 1321/2328] Fix off-by-one display issue when adjusting offset --- .../Edit/Timing/WaveformComparisonDisplay.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index 172f0ac9b1..ce13a8a244 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -123,13 +123,7 @@ namespace osu.Game.Screens.Edit.Timing beatLength.BindTo(timingPoint.BeatLengthBindable); double? newStartTime = selectedGroup.Value?.Time; - - if (newStartTime.HasValue && selectedGroupStartTime != newStartTime) - { - // The offset of the selected point may have changed. - // This handles the case the user has locked the view and expects the display to update with this change. - showFromTime(displayedTime + (newStartTime.Value - selectedGroupStartTime), true); - } + double? offsetChange = newStartTime - selectedGroupStartTime; var nextGroup = editorBeatmap.ControlPointInfo.TimingPoints .SkipWhile(g => g != tcp) @@ -138,6 +132,13 @@ namespace osu.Game.Screens.Edit.Timing selectedGroupStartTime = newStartTime ?? 0; selectedGroupEndTime = nextGroup?.Time ?? beatmap.Value.Track.Length; + + if (newStartTime.HasValue && offsetChange.HasValue) + { + // The offset of the selected point may have changed. + // This handles the case the user has locked the view and expects the display to update with this change. + showFromTime(displayedTime + offsetChange.Value, true); + } } protected override bool OnHover(HoverEvent e) => true; From af0f934e1a1b47080aefb8f4353a411c3e20c732 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 31 May 2022 17:37:48 +0900 Subject: [PATCH 1322/2328] Move raw ScoreProcessor values into ScoringValues struct --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 111 +++++++++++++------- osu.Game/Scoring/ScoringValues.cs | 38 +++++++ 2 files changed, 111 insertions(+), 38 deletions(-) create mode 100644 osu.Game/Scoring/ScoringValues.cs diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 1403a3f243..493da763cb 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -88,17 +88,20 @@ namespace osu.Game.Rulesets.Scoring private readonly double accuracyPortion; private readonly double comboPortion; - private int maxAchievableCombo; + /// + /// Maximum achievable scoring values. + /// + private ScoringValues maximumScoringValues; /// - /// The maximum achievable base score. + /// Maximum achievable scoring values up to the current point in time. /// - private double maxBaseScore; + private ScoringValues rollingMaximumScoringValues; /// - /// The maximum number of basic (non-tick and non-bonus) hitobjects. + /// Scoring values for the current play. /// - private int maxBasicHitObjects; + private ScoringValues currentScoringValues; /// /// The maximum of a basic (non-tick and non-bonus) hitobject. @@ -106,9 +109,6 @@ namespace osu.Game.Rulesets.Scoring /// private HitResult? maxBasicResult; - private double rollingMaxBaseScore; - private double baseScore; - private int basicHitObjects; private bool beatmapApplied; private readonly Dictionary scoreResultCounts = new Dictionary(); @@ -164,23 +164,42 @@ namespace osu.Game.Rulesets.Scoring scoreResultCounts[result.Type] = scoreResultCounts.GetValueOrDefault(result.Type) + 1; if (!result.Type.IsScorable()) - return; + { + // The inverse of non-scorable (ignore) judgements may be bonus judgements. + if (result.Judgement.MaxResult.IsBonus()) + rollingMaximumScoringValues.BonusScore += result.Judgement.MaxNumericResult; + return; + } + + // Update rolling combo. if (result.Type.IncreasesCombo()) Combo.Value++; else if (result.Type.BreaksCombo()) Combo.Value = 0; - double scoreIncrease = result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; + // Update maximum combo. + currentScoringValues.MaxCombo = HighestCombo.Value; + rollingMaximumScoringValues.MaxCombo += result.Judgement.MaxResult.AffectsCombo() ? 1 : 0; - if (!result.Type.IsBonus()) + // Update base/bonus score. + if (result.Type.IsBonus()) { - baseScore += scoreIncrease; - rollingMaxBaseScore += result.Judgement.MaxNumericResult; + currentScoringValues.BonusScore += result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; + rollingMaximumScoringValues.BonusScore += result.Judgement.MaxNumericResult; + } + else + { + currentScoringValues.BaseScore += result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; + rollingMaximumScoringValues.BaseScore += result.Judgement.MaxNumericResult; } + // Update hitobject count. if (result.Type.IsBasic()) - basicHitObjects++; + { + currentScoringValues.HitObjects++; + rollingMaximumScoringValues.HitObjects++; + } hitEvents.Add(CreateHitEvent(result)); lastHitObject = result.HitObject; @@ -207,18 +226,36 @@ namespace osu.Game.Rulesets.Scoring scoreResultCounts[result.Type] = scoreResultCounts.GetValueOrDefault(result.Type) - 1; if (!result.Type.IsScorable()) - return; - - double scoreIncrease = result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; - - if (!result.Type.IsBonus()) { - baseScore -= scoreIncrease; - rollingMaxBaseScore -= result.Judgement.MaxNumericResult; + // The inverse of non-scorable (ignore) judgements may be bonus judgements. + if (result.Judgement.MaxResult.IsBonus()) + rollingMaximumScoringValues.BonusScore -= result.Judgement.MaxNumericResult; + + return; } + // Update maximum combo. + currentScoringValues.MaxCombo = HighestCombo.Value; + rollingMaximumScoringValues.MaxCombo -= result.Judgement.MaxResult.AffectsCombo() ? 1 : 0; + + // Update base/bonus score. + if (result.Type.IsBonus()) + { + currentScoringValues.BonusScore -= result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; + rollingMaximumScoringValues.BonusScore -= result.Judgement.MaxNumericResult; + } + else + { + currentScoringValues.BaseScore -= result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; + rollingMaximumScoringValues.BaseScore -= result.Judgement.MaxNumericResult; + } + + // Update hitobject count. if (result.Type.IsBasic()) - basicHitObjects--; + { + currentScoringValues.HitObjects--; + rollingMaximumScoringValues.HitObjects--; + } Debug.Assert(hitEvents.Count > 0); lastHitObject = hitEvents[^1].LastHitObject; @@ -229,12 +266,12 @@ namespace osu.Game.Rulesets.Scoring private void updateScore() { - double rollingAccuracyRatio = rollingMaxBaseScore > 0 ? baseScore / rollingMaxBaseScore : 1; - double accuracyRatio = maxBaseScore > 0 ? baseScore / maxBaseScore : 1; - double comboRatio = maxAchievableCombo > 0 ? (double)HighestCombo.Value / maxAchievableCombo : 1; + double rollingAccuracyRatio = rollingMaximumScoringValues.BaseScore > 0 ? currentScoringValues.BaseScore / rollingMaximumScoringValues.BaseScore : 1; + double accuracyRatio = maximumScoringValues.BaseScore > 0 ? currentScoringValues.BaseScore / maximumScoringValues.BaseScore : 1; + double comboRatio = maximumScoringValues.MaxCombo > 0 ? currentScoringValues.MaxCombo / maximumScoringValues.MaxCombo : 1; Accuracy.Value = rollingAccuracyRatio; - TotalScore.Value = ComputeScore(Mode.Value, accuracyRatio, comboRatio, getBonusScore(scoreResultCounts), maxBasicHitObjects); + TotalScore.Value = ComputeScore(Mode.Value, accuracyRatio, comboRatio, getBonusScore(scoreResultCounts), maximumScoringValues.HitObjects); } /// @@ -286,10 +323,10 @@ namespace osu.Game.Rulesets.Scoring out _, out _); - double accuracyRatio = maxBaseScore > 0 ? extractedBaseScore / maxBaseScore : 1; - double comboRatio = maxAchievableCombo > 0 ? (double)scoreInfo.MaxCombo / maxAchievableCombo : 1; + double accuracyRatio = maximumScoringValues.BaseScore > 0 ? extractedBaseScore / maximumScoringValues.BaseScore : 1; + double comboRatio = maximumScoringValues.MaxCombo > 0 ? (double)scoreInfo.MaxCombo / maximumScoringValues.MaxCombo : 1; - return ComputeScore(mode, accuracyRatio, comboRatio, getBonusScore(scoreInfo.Statistics), maxBasicHitObjects); + return ComputeScore(mode, accuracyRatio, comboRatio, getBonusScore(scoreInfo.Statistics), maximumScoringValues.HitObjects); } /// @@ -398,15 +435,10 @@ namespace osu.Game.Rulesets.Scoring lastHitObject = null; if (storeResults) - { - maxAchievableCombo = HighestCombo.Value; - maxBaseScore = baseScore; - maxBasicHitObjects = basicHitObjects; - } + maximumScoringValues = currentScoringValues; - baseScore = 0; - rollingMaxBaseScore = 0; - basicHitObjects = 0; + currentScoringValues = default; + rollingMaximumScoringValues = default; TotalScore.Value = 0; Accuracy.Value = 1; @@ -440,7 +472,10 @@ namespace osu.Game.Rulesets.Scoring if (frame.Header == null) return; - extractFromStatistics(frame.Header.Statistics, out baseScore, out rollingMaxBaseScore, out _, out _); + extractFromStatistics(frame.Header.Statistics, out double baseScore, out double rollingMaxBaseScore, out _, out _); + currentScoringValues.BaseScore = baseScore; + rollingMaximumScoringValues.BaseScore = rollingMaxBaseScore; + HighestCombo.Value = frame.Header.MaxCombo; scoreResultCounts.Clear(); diff --git a/osu.Game/Scoring/ScoringValues.cs b/osu.Game/Scoring/ScoringValues.cs new file mode 100644 index 0000000000..4b562c20e4 --- /dev/null +++ b/osu.Game/Scoring/ScoringValues.cs @@ -0,0 +1,38 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using MessagePack; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Scoring +{ + [MessagePackObject] + public struct ScoringValues + { + /// + /// The sum of all "basic" scoring values. See: and . + /// + [Key(0)] + public double BaseScore; + + /// + /// The sum of all "bonus" scoring values. See: and . + /// + [Key(1)] + public double BonusScore; + + /// + /// The highest achieved combo. + /// + [Key(2)] + public int MaxCombo; + + /// + /// The count of "basic" s. See: . + /// + [Key(3)] + public int HitObjects; + } +} From d0e3e50ca7c3ca2fa8b6a40ab74805b0e2904c58 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 31 May 2022 17:50:18 +0900 Subject: [PATCH 1323/2328] Extract score statistics directly into ScoringValues --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 104 +++++++++----------- 1 file changed, 49 insertions(+), 55 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 493da763cb..c108380396 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -288,16 +288,12 @@ namespace osu.Game.Rulesets.Scoring if (!ruleset.RulesetInfo.Equals(scoreInfo.Ruleset)) throw new ArgumentException($"Unexpected score ruleset. Expected \"{ruleset.RulesetInfo.ShortName}\" but was \"{scoreInfo.Ruleset.ShortName}\"."); - extractFromStatistics(scoreInfo.Statistics, - out double extractedBaseScore, - out double extractedMaxBaseScore, - out int extractedMaxCombo, - out int extractedBasicHitObjects); + extractFromStatistics(scoreInfo.Statistics, out var current, out var max); - double accuracyRatio = extractedMaxBaseScore > 0 ? extractedBaseScore / extractedMaxBaseScore : 1; - double comboRatio = extractedMaxCombo > 0 ? (double)scoreInfo.MaxCombo / extractedMaxCombo : 1; + double accuracyRatio = max.BaseScore > 0 ? current.BaseScore / max.BaseScore : 1; + double comboRatio = max.MaxCombo > 0 ? (double)scoreInfo.MaxCombo / max.MaxCombo : 1; - return ComputeScore(mode, accuracyRatio, comboRatio, getBonusScore(scoreInfo.Statistics), extractedBasicHitObjects); + return ComputeScore(mode, accuracyRatio, comboRatio, getBonusScore(scoreInfo.Statistics), max.HitObjects); } /// @@ -317,13 +313,9 @@ namespace osu.Game.Rulesets.Scoring if (!beatmapApplied) throw new InvalidOperationException($"Cannot compute partial score without calling {nameof(ApplyBeatmap)}."); - extractFromStatistics(scoreInfo.Statistics, - out double extractedBaseScore, - out _, - out _, - out _); + extractFromStatistics(scoreInfo.Statistics, out var current, out _); - double accuracyRatio = maximumScoringValues.BaseScore > 0 ? extractedBaseScore / maximumScoringValues.BaseScore : 1; + double accuracyRatio = maximumScoringValues.BaseScore > 0 ? current.BaseScore / maximumScoringValues.BaseScore : 1; double comboRatio = maximumScoringValues.MaxCombo > 0 ? (double)scoreInfo.MaxCombo / maximumScoringValues.MaxCombo : 1; return ComputeScore(mode, accuracyRatio, comboRatio, getBonusScore(scoreInfo.Statistics), maximumScoringValues.HitObjects); @@ -353,14 +345,9 @@ namespace osu.Game.Rulesets.Scoring // Note: This cannot be applied universally to all legacy scores, as some rulesets (e.g. catch) group multiple judgements together. if (scoreInfo.IsLegacyScore && scoreInfo.Ruleset.OnlineID == 3) { - extractFromStatistics(scoreInfo.Statistics, - out double computedBaseScore, - out double computedMaxBaseScore, - out _, - out _); - - if (computedMaxBaseScore > 0) - accuracyRatio = computedBaseScore / computedMaxBaseScore; + extractFromStatistics(scoreInfo.Statistics, out var current, out var maximum); + if (maximum.BaseScore > 0) + accuracyRatio = current.BaseScore / current.MaxCombo; } int computedBasicHitObjects = scoreInfo.Statistics.Where(kvp => kvp.Key.IsBasic()).Select(kvp => kvp.Value).Sum(); @@ -472,10 +459,7 @@ namespace osu.Game.Rulesets.Scoring if (frame.Header == null) return; - extractFromStatistics(frame.Header.Statistics, out double baseScore, out double rollingMaxBaseScore, out _, out _); - currentScoringValues.BaseScore = baseScore; - rollingMaximumScoringValues.BaseScore = rollingMaxBaseScore; - + extractFromStatistics(frame.Header.Statistics, out currentScoringValues, out rollingMaximumScoringValues); HighestCombo.Value = frame.Header.MaxCombo; scoreResultCounts.Clear(); @@ -486,49 +470,59 @@ namespace osu.Game.Rulesets.Scoring OnResetFromReplayFrame?.Invoke(); } - private void extractFromStatistics(IReadOnlyDictionary statistics, out double baseScore, out double maxBaseScore, out int maxCombo, - out int basicHitObjects) + private void extractFromStatistics(IReadOnlyDictionary statistics, out ScoringValues current, out ScoringValues maximum) { - baseScore = 0; - maxBaseScore = 0; - maxCombo = 0; - basicHitObjects = 0; + current = default; + maximum = default; foreach ((HitResult result, int count) in statistics) { - // Bonus scores are counted separately directly from the statistics dictionary later on. - if (!result.IsScorable() || result.IsBonus()) + if (!result.IsScorable()) continue; - // The maximum result of this judgement if it wasn't a miss. - // E.g. For a GOOD judgement, the max result is either GREAT/PERFECT depending on which one the ruleset uses (osu!: GREAT, osu!mania: PERFECT). - HitResult maxResult; - - switch (result) + if (result.IsBonus()) { - case HitResult.LargeTickHit: - case HitResult.LargeTickMiss: - maxResult = HitResult.LargeTickHit; - break; + current.BonusScore += count * Judgement.ToNumericResult(result); + maximum.BonusScore += count * Judgement.ToNumericResult(result); + } + else + { + // The maximum result of this judgement if it wasn't a miss. + // E.g. For a GOOD judgement, the max result is either GREAT/PERFECT depending on which one the ruleset uses (osu!: GREAT, osu!mania: PERFECT). + HitResult maxResult; - case HitResult.SmallTickHit: - case HitResult.SmallTickMiss: - maxResult = HitResult.SmallTickHit; - break; + switch (result) + { + case HitResult.LargeTickHit: + case HitResult.LargeTickMiss: + maxResult = HitResult.LargeTickHit; + break; - default: - maxResult = maxBasicResult ??= ruleset.GetHitResults().OrderByDescending(kvp => Judgement.ToNumericResult(kvp.result)).First().result; - break; + case HitResult.SmallTickHit: + case HitResult.SmallTickMiss: + maxResult = HitResult.SmallTickHit; + break; + + default: + maxResult = maxBasicResult ??= ruleset.GetHitResults().OrderByDescending(kvp => Judgement.ToNumericResult(kvp.result)).First().result; + break; + } + + current.BaseScore += count * Judgement.ToNumericResult(result); + maximum.BaseScore += count * Judgement.ToNumericResult(maxResult); } - baseScore += count * Judgement.ToNumericResult(result); - maxBaseScore += count * Judgement.ToNumericResult(maxResult); - if (result.AffectsCombo()) - maxCombo += count; + { + current.MaxCombo += count; + maximum.MaxCombo += count; + } if (result.IsBasic()) - basicHitObjects += count; + { + current.HitObjects += count; + maximum.HitObjects += count; + } } } From a809a19eeca00c59d67b7b3e638526137ea95e0d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 31 May 2022 17:51:46 +0900 Subject: [PATCH 1324/2328] Remove getBonusScore() --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 29 ++++++--------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index c108380396..372fcbb061 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -271,7 +271,7 @@ namespace osu.Game.Rulesets.Scoring double comboRatio = maximumScoringValues.MaxCombo > 0 ? currentScoringValues.MaxCombo / maximumScoringValues.MaxCombo : 1; Accuracy.Value = rollingAccuracyRatio; - TotalScore.Value = ComputeScore(Mode.Value, accuracyRatio, comboRatio, getBonusScore(scoreResultCounts), maximumScoringValues.HitObjects); + TotalScore.Value = ComputeScore(Mode.Value, accuracyRatio, comboRatio, currentScoringValues.BonusScore, maximumScoringValues.HitObjects); } /// @@ -293,7 +293,7 @@ namespace osu.Game.Rulesets.Scoring double accuracyRatio = max.BaseScore > 0 ? current.BaseScore / max.BaseScore : 1; double comboRatio = max.MaxCombo > 0 ? (double)scoreInfo.MaxCombo / max.MaxCombo : 1; - return ComputeScore(mode, accuracyRatio, comboRatio, getBonusScore(scoreInfo.Statistics), max.HitObjects); + return ComputeScore(mode, accuracyRatio, comboRatio, current.BonusScore, max.HitObjects); } /// @@ -318,7 +318,7 @@ namespace osu.Game.Rulesets.Scoring double accuracyRatio = maximumScoringValues.BaseScore > 0 ? current.BaseScore / maximumScoringValues.BaseScore : 1; double comboRatio = maximumScoringValues.MaxCombo > 0 ? (double)scoreInfo.MaxCombo / maximumScoringValues.MaxCombo : 1; - return ComputeScore(mode, accuracyRatio, comboRatio, getBonusScore(scoreInfo.Statistics), maximumScoringValues.HitObjects); + return ComputeScore(mode, accuracyRatio, comboRatio, current.BonusScore, maximumScoringValues.HitObjects); } /// @@ -340,19 +340,15 @@ namespace osu.Game.Rulesets.Scoring double accuracyRatio = scoreInfo.Accuracy; double comboRatio = maxAchievableCombo > 0 ? (double)scoreInfo.MaxCombo / maxAchievableCombo : 1; + extractFromStatistics(scoreInfo.Statistics, out var current, out var maximum); + // For legacy osu!mania scores, a full-GREAT score has 100% accuracy. If combined with a full-combo, the score becomes indistinguishable from a full-PERFECT score. // To get around this, the accuracy ratio is always recalculated based on the hit statistics rather than trusting the score. // Note: This cannot be applied universally to all legacy scores, as some rulesets (e.g. catch) group multiple judgements together. - if (scoreInfo.IsLegacyScore && scoreInfo.Ruleset.OnlineID == 3) - { - extractFromStatistics(scoreInfo.Statistics, out var current, out var maximum); - if (maximum.BaseScore > 0) - accuracyRatio = current.BaseScore / current.MaxCombo; - } + if (scoreInfo.IsLegacyScore && scoreInfo.Ruleset.OnlineID == 3 && maximum.BaseScore > 0) + accuracyRatio = current.BaseScore / current.MaxCombo; - int computedBasicHitObjects = scoreInfo.Statistics.Where(kvp => kvp.Key.IsBasic()).Select(kvp => kvp.Value).Sum(); - - return ComputeScore(mode, accuracyRatio, comboRatio, getBonusScore(scoreInfo.Statistics), computedBasicHitObjects); + return ComputeScore(mode, accuracyRatio, comboRatio, current.BonusScore, maximum.HitObjects); } /// @@ -382,15 +378,6 @@ namespace osu.Game.Rulesets.Scoring } } - /// - /// Calculates the total bonus score from score statistics. - /// - /// The score statistics. - /// The total bonus score. - private double getBonusScore(IReadOnlyDictionary statistics) - => statistics.GetValueOrDefault(HitResult.SmallBonus) * Judgement.SMALL_BONUS_SCORE - + statistics.GetValueOrDefault(HitResult.LargeBonus) * Judgement.LARGE_BONUS_SCORE; - private ScoreRank rankFrom(double acc) { if (acc == 1) From 2289812801ffc632dd318e626688b68b18613428 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 31 May 2022 17:57:12 +0900 Subject: [PATCH 1325/2328] Add method to compute score from ScoringValues --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 372fcbb061..27c2712641 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -351,6 +351,20 @@ namespace osu.Game.Rulesets.Scoring return ComputeScore(mode, accuracyRatio, comboRatio, current.BonusScore, maximum.HitObjects); } + /// + /// Computes the total score from scoring values. + /// + /// The to represent the score as. + /// The current scoring values. + /// The maximum scoring values. + /// The total score computed from the given scoring values. + public double ComputeScore(ScoringMode mode, ScoringValues current, ScoringValues maximum) + { + double accuracyRatio = maximum.BaseScore > 0 ? current.BaseScore / maximum.BaseScore : 1; + double comboRatio = maximum.MaxCombo > 0 ? current.MaxCombo / maximum.MaxCombo : 1; + return ComputeScore(mode, accuracyRatio, comboRatio, current.BonusScore, maximum.HitObjects); + } + /// /// Computes the total score from individual scoring components. /// From 6ccdb618531dd10a906bcc60649a1545a0cacb16 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 31 May 2022 18:01:02 +0900 Subject: [PATCH 1326/2328] Use new ComputeScore() overload in more cases --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 22 +++++++-------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 27c2712641..b286839fa7 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -266,12 +266,8 @@ namespace osu.Game.Rulesets.Scoring private void updateScore() { - double rollingAccuracyRatio = rollingMaximumScoringValues.BaseScore > 0 ? currentScoringValues.BaseScore / rollingMaximumScoringValues.BaseScore : 1; - double accuracyRatio = maximumScoringValues.BaseScore > 0 ? currentScoringValues.BaseScore / maximumScoringValues.BaseScore : 1; - double comboRatio = maximumScoringValues.MaxCombo > 0 ? currentScoringValues.MaxCombo / maximumScoringValues.MaxCombo : 1; - - Accuracy.Value = rollingAccuracyRatio; - TotalScore.Value = ComputeScore(Mode.Value, accuracyRatio, comboRatio, currentScoringValues.BonusScore, maximumScoringValues.HitObjects); + Accuracy.Value = rollingMaximumScoringValues.BaseScore > 0 ? currentScoringValues.BaseScore / rollingMaximumScoringValues.BaseScore : 1; + TotalScore.Value = ComputeScore(Mode.Value, currentScoringValues, maximumScoringValues); } /// @@ -288,12 +284,10 @@ namespace osu.Game.Rulesets.Scoring if (!ruleset.RulesetInfo.Equals(scoreInfo.Ruleset)) throw new ArgumentException($"Unexpected score ruleset. Expected \"{ruleset.RulesetInfo.ShortName}\" but was \"{scoreInfo.Ruleset.ShortName}\"."); - extractFromStatistics(scoreInfo.Statistics, out var current, out var max); + extractFromStatistics(scoreInfo.Statistics, out var current, out var maximum); + current.MaxCombo = scoreInfo.MaxCombo; - double accuracyRatio = max.BaseScore > 0 ? current.BaseScore / max.BaseScore : 1; - double comboRatio = max.MaxCombo > 0 ? (double)scoreInfo.MaxCombo / max.MaxCombo : 1; - - return ComputeScore(mode, accuracyRatio, comboRatio, current.BonusScore, max.HitObjects); + return ComputeScore(mode, current, maximum); } /// @@ -314,11 +308,9 @@ namespace osu.Game.Rulesets.Scoring throw new InvalidOperationException($"Cannot compute partial score without calling {nameof(ApplyBeatmap)}."); extractFromStatistics(scoreInfo.Statistics, out var current, out _); + current.MaxCombo = scoreInfo.MaxCombo; - double accuracyRatio = maximumScoringValues.BaseScore > 0 ? current.BaseScore / maximumScoringValues.BaseScore : 1; - double comboRatio = maximumScoringValues.MaxCombo > 0 ? (double)scoreInfo.MaxCombo / maximumScoringValues.MaxCombo : 1; - - return ComputeScore(mode, accuracyRatio, comboRatio, current.BonusScore, maximumScoringValues.HitObjects); + return ComputeScore(mode, current, maximumScoringValues); } /// From 20988be6bbad41cc663a8a216096b4a9c6bc5799 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 31 May 2022 18:01:11 +0900 Subject: [PATCH 1327/2328] Fix incorrect 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 b286839fa7..18b978b413 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -338,7 +338,7 @@ namespace osu.Game.Rulesets.Scoring // To get around this, the accuracy ratio is always recalculated based on the hit statistics rather than trusting the score. // Note: This cannot be applied universally to all legacy scores, as some rulesets (e.g. catch) group multiple judgements together. if (scoreInfo.IsLegacyScore && scoreInfo.Ruleset.OnlineID == 3 && maximum.BaseScore > 0) - accuracyRatio = current.BaseScore / current.MaxCombo; + accuracyRatio = current.BaseScore / maximum.BaseScore; return ComputeScore(mode, accuracyRatio, comboRatio, current.BonusScore, maximum.HitObjects); } From 44ca350822afee38e7f2c8f464a8b2d608871de2 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 31 May 2022 18:17:25 +0900 Subject: [PATCH 1328/2328] Reset minimal scoring values from frames --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 18b978b413..6351d15649 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -452,7 +452,12 @@ namespace osu.Game.Rulesets.Scoring if (frame.Header == null) return; - extractFromStatistics(frame.Header.Statistics, out currentScoringValues, out rollingMaximumScoringValues); + extractFromStatistics(frame.Header.Statistics, out var current, out var maximum); + currentScoringValues.BaseScore = current.BaseScore; + currentScoringValues.MaxCombo = frame.Header.MaxCombo; + rollingMaximumScoringValues.BaseScore = maximum.BaseScore; + rollingMaximumScoringValues.MaxCombo = maximum.MaxCombo; + HighestCombo.Value = frame.Header.MaxCombo; scoreResultCounts.Clear(); From d6d56ee22dfed6ab20f195efb7d53d48a4b9de35 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 31 May 2022 18:17:40 +0900 Subject: [PATCH 1329/2328] Fix unintentional truncation --- 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 6351d15649..afeef9341a 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -353,7 +353,7 @@ namespace osu.Game.Rulesets.Scoring public double ComputeScore(ScoringMode mode, ScoringValues current, ScoringValues maximum) { double accuracyRatio = maximum.BaseScore > 0 ? current.BaseScore / maximum.BaseScore : 1; - double comboRatio = maximum.MaxCombo > 0 ? current.MaxCombo / maximum.MaxCombo : 1; + double comboRatio = maximum.MaxCombo > 0 ? (double)current.MaxCombo / maximum.MaxCombo : 1; return ComputeScore(mode, accuracyRatio, comboRatio, current.BonusScore, maximum.HitObjects); } From 28d8799e119318b860c1d551ba79b66645a8682c Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 31 May 2022 18:39:29 +0900 Subject: [PATCH 1330/2328] Add overloads to + document + expose ExtractScoringValues --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 89 ++++++++++++++++++--- 1 file changed, 77 insertions(+), 12 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index afeef9341a..96cf4bcc24 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -11,6 +11,7 @@ using osu.Framework.Bindables; using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Extensions; +using osu.Game.Online.Spectator; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects; @@ -89,13 +90,16 @@ namespace osu.Game.Rulesets.Scoring private readonly double comboPortion; /// - /// Maximum achievable scoring values. + /// Scoring values for a perfect play. /// private ScoringValues maximumScoringValues; /// /// Maximum achievable scoring values up to the current point in time. /// + /// + /// This is only used to determine the accuracy with respect to the current point in time for an ongoing play session. + /// private ScoringValues rollingMaximumScoringValues; /// @@ -284,7 +288,7 @@ namespace osu.Game.Rulesets.Scoring if (!ruleset.RulesetInfo.Equals(scoreInfo.Ruleset)) throw new ArgumentException($"Unexpected score ruleset. Expected \"{ruleset.RulesetInfo.ShortName}\" but was \"{scoreInfo.Ruleset.ShortName}\"."); - extractFromStatistics(scoreInfo.Statistics, out var current, out var maximum); + extractScoringValues(scoreInfo.Statistics, out var current, out var maximum); current.MaxCombo = scoreInfo.MaxCombo; return ComputeScore(mode, current, maximum); @@ -307,7 +311,7 @@ namespace osu.Game.Rulesets.Scoring if (!beatmapApplied) throw new InvalidOperationException($"Cannot compute partial score without calling {nameof(ApplyBeatmap)}."); - extractFromStatistics(scoreInfo.Statistics, out var current, out _); + extractScoringValues(scoreInfo.Statistics, out var current, out _); current.MaxCombo = scoreInfo.MaxCombo; return ComputeScore(mode, current, maximumScoringValues); @@ -332,7 +336,7 @@ namespace osu.Game.Rulesets.Scoring double accuracyRatio = scoreInfo.Accuracy; double comboRatio = maxAchievableCombo > 0 ? (double)scoreInfo.MaxCombo / maxAchievableCombo : 1; - extractFromStatistics(scoreInfo.Statistics, out var current, out var maximum); + extractScoringValues(scoreInfo.Statistics, out var current, out var maximum); // For legacy osu!mania scores, a full-GREAT score has 100% accuracy. If combined with a full-combo, the score becomes indistinguishable from a full-PERFECT score. // To get around this, the accuracy ratio is always recalculated based on the hit statistics rather than trusting the score. @@ -452,7 +456,7 @@ namespace osu.Game.Rulesets.Scoring if (frame.Header == null) return; - extractFromStatistics(frame.Header.Statistics, out var current, out var maximum); + extractScoringValues(frame.Header.Statistics, out var current, out var maximum); currentScoringValues.BaseScore = current.BaseScore; currentScoringValues.MaxCombo = frame.Header.MaxCombo; rollingMaximumScoringValues.BaseScore = maximum.BaseScore; @@ -468,7 +472,72 @@ namespace osu.Game.Rulesets.Scoring OnResetFromReplayFrame?.Invoke(); } - private void extractFromStatistics(IReadOnlyDictionary statistics, out ScoringValues current, out ScoringValues maximum) + #region ScoringValue extraction + + /// + /// Applies a best-effort extraction of hit statistics into . + /// + /// + /// This method is useful in a variety of situations, with a few drawbacks that need to be considered: + /// + /// The maximum will always be 0. + /// The current and maximum will always be the same value. + /// + /// Consumers are expected to more accurately fill in the above values through external means. + /// + /// Ensure to fill in the maximum for use in + /// . + /// + /// + /// The score to extract scoring values from. + /// The "current" scoring values, representing the hit statistics as they appear. + /// The "maximum" scoring values, representing the hit statistics as if the maximum hit result was attained each time. + public void ExtractScoringValues(ScoreInfo scoreInfo, out ScoringValues current, out ScoringValues maximum) + { + extractScoringValues(scoreInfo.Statistics, out current, out maximum); + current.MaxCombo = scoreInfo.MaxCombo; + } + + /// + /// Applies a best-effort extraction of hit statistics into . + /// + /// + /// This method is useful in a variety of situations, with a few drawbacks that need to be considered: + /// + /// The maximum will always be 0. + /// The current and maximum will always be the same value. + /// + /// Consumers are expected to more accurately fill in the above values through external means. + /// + /// Ensure to fill in the maximum for use in + /// . + /// + /// + /// The replay frame header to extract scoring values from. + /// The "current" scoring values, representing the hit statistics as they appear. + /// The "maximum" scoring values, representing the hit statistics as if the maximum hit result was attained each time. + public void ExtractScoringValues(FrameHeader header, out ScoringValues current, out ScoringValues maximum) + { + extractScoringValues(header.Statistics, out current, out maximum); + current.MaxCombo = header.MaxCombo; + } + + /// + /// Applies a best-effort extraction of hit statistics into . + /// + /// + /// This method is useful in a variety of situations, with a few drawbacks that need to be considered: + /// + /// The current will always be 0. + /// The maximum will always be 0. + /// The current and maximum will always be the same value. + /// + /// Consumers are expected to more accurately fill in the above values (especially the current ) via external means (e.g. ). + /// + /// The hit statistics to extract scoring values from. + /// The "current" scoring values, representing the hit statistics as they appear. + /// The "maximum" scoring values, representing the hit statistics as if the maximum hit result was attained each time. + private void extractScoringValues(IReadOnlyDictionary statistics, out ScoringValues current, out ScoringValues maximum) { current = default; maximum = default; @@ -479,10 +548,7 @@ namespace osu.Game.Rulesets.Scoring continue; if (result.IsBonus()) - { current.BonusScore += count * Judgement.ToNumericResult(result); - maximum.BonusScore += count * Judgement.ToNumericResult(result); - } else { // The maximum result of this judgement if it wasn't a miss. @@ -511,10 +577,7 @@ namespace osu.Game.Rulesets.Scoring } if (result.AffectsCombo()) - { - current.MaxCombo += count; maximum.MaxCombo += count; - } if (result.IsBasic()) { @@ -524,6 +587,8 @@ namespace osu.Game.Rulesets.Scoring } } + #endregion + protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); From 93240073a645642f540fa9aab46e2fa7ce52490a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 31 May 2022 19:34:51 +0900 Subject: [PATCH 1331/2328] Rename field + rewrite xmldoc a bit --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 32 ++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 96cf4bcc24..4463941ec2 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -95,12 +95,12 @@ namespace osu.Game.Rulesets.Scoring private ScoringValues maximumScoringValues; /// - /// Maximum achievable scoring values up to the current point in time. + /// Scoring values for the current play assuming all perfect hits. /// /// /// This is only used to determine the accuracy with respect to the current point in time for an ongoing play session. /// - private ScoringValues rollingMaximumScoringValues; + private ScoringValues currentMaximumScoringValues; /// /// Scoring values for the current play. @@ -171,7 +171,7 @@ namespace osu.Game.Rulesets.Scoring { // The inverse of non-scorable (ignore) judgements may be bonus judgements. if (result.Judgement.MaxResult.IsBonus()) - rollingMaximumScoringValues.BonusScore += result.Judgement.MaxNumericResult; + currentMaximumScoringValues.BonusScore += result.Judgement.MaxNumericResult; return; } @@ -184,25 +184,25 @@ namespace osu.Game.Rulesets.Scoring // Update maximum combo. currentScoringValues.MaxCombo = HighestCombo.Value; - rollingMaximumScoringValues.MaxCombo += result.Judgement.MaxResult.AffectsCombo() ? 1 : 0; + currentMaximumScoringValues.MaxCombo += result.Judgement.MaxResult.AffectsCombo() ? 1 : 0; // Update base/bonus score. if (result.Type.IsBonus()) { currentScoringValues.BonusScore += result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; - rollingMaximumScoringValues.BonusScore += result.Judgement.MaxNumericResult; + currentMaximumScoringValues.BonusScore += result.Judgement.MaxNumericResult; } else { currentScoringValues.BaseScore += result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; - rollingMaximumScoringValues.BaseScore += result.Judgement.MaxNumericResult; + currentMaximumScoringValues.BaseScore += result.Judgement.MaxNumericResult; } // Update hitobject count. if (result.Type.IsBasic()) { currentScoringValues.HitObjects++; - rollingMaximumScoringValues.HitObjects++; + currentMaximumScoringValues.HitObjects++; } hitEvents.Add(CreateHitEvent(result)); @@ -233,32 +233,32 @@ namespace osu.Game.Rulesets.Scoring { // The inverse of non-scorable (ignore) judgements may be bonus judgements. if (result.Judgement.MaxResult.IsBonus()) - rollingMaximumScoringValues.BonusScore -= result.Judgement.MaxNumericResult; + currentMaximumScoringValues.BonusScore -= result.Judgement.MaxNumericResult; return; } // Update maximum combo. currentScoringValues.MaxCombo = HighestCombo.Value; - rollingMaximumScoringValues.MaxCombo -= result.Judgement.MaxResult.AffectsCombo() ? 1 : 0; + currentMaximumScoringValues.MaxCombo -= result.Judgement.MaxResult.AffectsCombo() ? 1 : 0; // Update base/bonus score. if (result.Type.IsBonus()) { currentScoringValues.BonusScore -= result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; - rollingMaximumScoringValues.BonusScore -= result.Judgement.MaxNumericResult; + currentMaximumScoringValues.BonusScore -= result.Judgement.MaxNumericResult; } else { currentScoringValues.BaseScore -= result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; - rollingMaximumScoringValues.BaseScore -= result.Judgement.MaxNumericResult; + currentMaximumScoringValues.BaseScore -= result.Judgement.MaxNumericResult; } // Update hitobject count. if (result.Type.IsBasic()) { currentScoringValues.HitObjects--; - rollingMaximumScoringValues.HitObjects--; + currentMaximumScoringValues.HitObjects--; } Debug.Assert(hitEvents.Count > 0); @@ -270,7 +270,7 @@ namespace osu.Game.Rulesets.Scoring private void updateScore() { - Accuracy.Value = rollingMaximumScoringValues.BaseScore > 0 ? currentScoringValues.BaseScore / rollingMaximumScoringValues.BaseScore : 1; + Accuracy.Value = currentMaximumScoringValues.BaseScore > 0 ? currentScoringValues.BaseScore / currentMaximumScoringValues.BaseScore : 1; TotalScore.Value = ComputeScore(Mode.Value, currentScoringValues, maximumScoringValues); } @@ -422,7 +422,7 @@ namespace osu.Game.Rulesets.Scoring maximumScoringValues = currentScoringValues; currentScoringValues = default; - rollingMaximumScoringValues = default; + currentMaximumScoringValues = default; TotalScore.Value = 0; Accuracy.Value = 1; @@ -459,8 +459,8 @@ namespace osu.Game.Rulesets.Scoring extractScoringValues(frame.Header.Statistics, out var current, out var maximum); currentScoringValues.BaseScore = current.BaseScore; currentScoringValues.MaxCombo = frame.Header.MaxCombo; - rollingMaximumScoringValues.BaseScore = maximum.BaseScore; - rollingMaximumScoringValues.MaxCombo = maximum.MaxCombo; + currentMaximumScoringValues.BaseScore = maximum.BaseScore; + currentMaximumScoringValues.MaxCombo = maximum.MaxCombo; HighestCombo.Value = frame.Header.MaxCombo; From 1e0ee1b2147ff532e7f3cea26e0c2708c4077fdc Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 31 May 2022 19:49:37 +0900 Subject: [PATCH 1332/2328] Expose MaximumScoringValues for user consumption --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 4463941ec2..8e69ffa0a0 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -92,7 +92,7 @@ namespace osu.Game.Rulesets.Scoring /// /// Scoring values for a perfect play. /// - private ScoringValues maximumScoringValues; + public ScoringValues MaximumScoringValues { get; private set; } /// /// Scoring values for the current play assuming all perfect hits. @@ -271,7 +271,7 @@ namespace osu.Game.Rulesets.Scoring private void updateScore() { Accuracy.Value = currentMaximumScoringValues.BaseScore > 0 ? currentScoringValues.BaseScore / currentMaximumScoringValues.BaseScore : 1; - TotalScore.Value = ComputeScore(Mode.Value, currentScoringValues, maximumScoringValues); + TotalScore.Value = ComputeScore(Mode.Value, currentScoringValues, MaximumScoringValues); } /// @@ -314,7 +314,7 @@ namespace osu.Game.Rulesets.Scoring extractScoringValues(scoreInfo.Statistics, out var current, out _); current.MaxCombo = scoreInfo.MaxCombo; - return ComputeScore(mode, current, maximumScoringValues); + return ComputeScore(mode, current, MaximumScoringValues); } /// @@ -419,7 +419,7 @@ namespace osu.Game.Rulesets.Scoring lastHitObject = null; if (storeResults) - maximumScoringValues = currentScoringValues; + MaximumScoringValues = currentScoringValues; currentScoringValues = default; currentMaximumScoringValues = default; From eaeb66547e3ceda671dcaa04850d247439893944 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 31 May 2022 19:58:44 +0900 Subject: [PATCH 1333/2328] Revert comment removal --- .../Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs index f4bfec169d..43b128b971 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs @@ -149,9 +149,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer protected override void StartGameplay() { + // We can enter this screen one of two ways: + // 1. Via the automatic natural progression of PlayerLoader into Player. + // We'll arrive here in a Loaded state, and we need to let the server know that we're ready to start. + // 2. Via the server forcefully starting gameplay because players have been hanging out in PlayerLoader for too long. + // We'll arrive here in a Playing state, and we should neither show the loading spinner nor tell the server that we're ready to start (gameplay has already started). + // + // The base call is blocked here because in both cases gameplay is started only when the server says so via onGameplayStarted(). + if (client.LocalUser?.State == MultiplayerUserState.Loaded) { - // block base call, but let the server know we are ready to start. loadingDisplay.Show(); client.ChangeState(MultiplayerUserState.ReadyForGameplay); } From a940676fc2ae5d24b34a8c500a8d6bc9fc4a57a2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 21:10:02 +0900 Subject: [PATCH 1334/2328] Add adjustment buttons --- .../Editing/TestSceneTapTimingControl.cs | 6 + osu.Game/Screens/Edit/Timing/AdjustButton.cs | 235 ++++++++++++++++++ .../Screens/Edit/Timing/TapTimingControl.cs | 65 ++++- 3 files changed, 305 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Screens/Edit/Timing/AdjustButton.cs diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs b/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs index 46b45979ea..8dd368f2a9 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs @@ -77,6 +77,12 @@ namespace osu.Game.Tests.Visual.Editing timingInfo.Text = $"offset: {selectedGroup.Value.Time:N2} bpm: {selectedGroup.Value.ControlPoints.OfType().First().BPM:N2}"; } + [Test] + public void TestNoop() + { + AddStep("do nothing", () => { }); + } + [Test] public void TestTapThenReset() { diff --git a/osu.Game/Screens/Edit/Timing/AdjustButton.cs b/osu.Game/Screens/Edit/Timing/AdjustButton.cs new file mode 100644 index 0000000000..b0a0517e94 --- /dev/null +++ b/osu.Game/Screens/Edit/Timing/AdjustButton.cs @@ -0,0 +1,235 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; +using osu.Framework.Localisation; +using osu.Framework.Threading; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; + +namespace osu.Game.Screens.Edit.Timing +{ + public class AdjustButton : CompositeDrawable + { + public Action Action; + + private readonly double adjustAmount; + private ScheduledDelegate adjustDelegate; + + private const int adjust_levels = 4; + + private const double initial_delay = 300; + + private const double minimum_delay = 80; + + public Container Content { get; set; } + + private double adjustDelay = initial_delay; + + private readonly Box background; + + private readonly OsuSpriteText text; + + public LocalisableString Text + { + get => text?.Text ?? default; + set + { + if (text != null) + text.Text = value; + } + } + + [Resolved] + private OverlayColourProvider colourProvider { get; set; } + + public AdjustButton(double adjustAmount) + { + this.adjustAmount = adjustAmount; + + CornerRadius = 5; + Masking = true; + + AddInternal(Content = new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both, + Depth = float.MaxValue + }, + text = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = OsuFont.Default.With(weight: FontWeight.SemiBold), + Padding = new MarginPadding(5), + Depth = float.MinValue + } + } + }); + } + + [BackgroundDependencyLoader] + private void load() + { + background.Colour = colourProvider.Background3; + + for (int i = 1; i <= adjust_levels; i++) + { + Content.Add(new IncrementBox(i, adjustAmount)); + Content.Add(new IncrementBox(-i, adjustAmount)); + } + } + + protected override bool OnMouseDown(MouseDownEvent e) + { + beginRepeat(); + return true; + } + + protected override void OnMouseUp(MouseUpEvent e) + { + adjustDelegate?.Cancel(); + base.OnMouseUp(e); + } + + private void beginRepeat() + { + adjustDelegate?.Cancel(); + + adjustDelay = initial_delay; + adjustNext(); + + void adjustNext() + { + var hoveredBox = Content.OfType().FirstOrDefault(d => d.IsHovered); + + if (hoveredBox != null) + { + Action(adjustAmount * hoveredBox.Multiplier); + + adjustDelay = Math.Max(minimum_delay, adjustDelay * 0.9f); + + hoveredBox.Flash(); + } + else + { + adjustDelay = initial_delay; + } + + adjustDelegate = Scheduler.AddDelayed(adjustNext, adjustDelay); + } + } + + private class IncrementBox : CompositeDrawable + { + public readonly float Multiplier; + + private readonly Box box; + private readonly OsuSpriteText text; + + public IncrementBox(int index, double amount) + { + Multiplier = Math.Sign(index) * convertMultiplier(index); + + float ratio = (float)index / adjust_levels; + + RelativeSizeAxes = Axes.Both; + + Width = 0.5f * Math.Abs(ratio); + + Anchor direction = index < 0 ? Anchor.x2 : Anchor.x0; + + Origin |= direction; + + Depth = Math.Abs(index); + + Anchor = Anchor.TopCentre; + + InternalChildren = new Drawable[] + { + box = new Box + { + RelativeSizeAxes = Axes.Both, + Blending = BlendingParameters.Additive + }, + text = new OsuSpriteText + { + Anchor = direction, + Origin = direction, + Font = OsuFont.Default.With(size: 10, weight: FontWeight.Bold), + Text = $"{(index > 0 ? "+" : "-")}{Math.Abs(Multiplier * amount)}", + Padding = new MarginPadding(5), + Alpha = 0, + } + }; + } + + [Resolved] + private OverlayColourProvider colourProvider { get; set; } + + protected override void LoadComplete() + { + base.LoadComplete(); + + box.Colour = colourProvider.Background1; + box.Alpha = 0.1f; + } + + private float convertMultiplier(int m) + { + switch (Math.Abs(m)) + { + default: return 1; + + case 2: return 2; + + case 3: return 5; + + case 4: return 10; + } + } + + protected override bool OnHover(HoverEvent e) + { + box.Colour = colourProvider.Colour0; + + box.FadeTo(0.2f, 100, Easing.OutQuint); + text.FadeIn(100, Easing.OutQuint); + return true; + } + + protected override void OnHoverLost(HoverLostEvent e) + { + box.Colour = colourProvider.Background1; + + box.FadeTo(0.1f, 500, Easing.OutQuint); + text.FadeOut(100, Easing.OutQuint); + base.OnHoverLost(e); + } + + public void Flash() + { + box + .FadeTo(0.4f, 20, Easing.OutQuint) + .Then() + .FadeTo(0.2f, 400, Easing.OutQuint); + + text + .MoveToY(-5, 20, Easing.OutQuint) + .Then() + .MoveToY(0, 400, Easing.OutQuint); + } + } + } +} diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index d0ab4d1f98..f9f5a20405 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -18,6 +19,9 @@ namespace osu.Game.Screens.Edit.Timing [Resolved] private EditorClock editorClock { get; set; } + [Resolved] + private EditorBeatmap beatmap { get; set; } + [Resolved] private Bindable selectedGroup { get; set; } @@ -45,6 +49,7 @@ namespace osu.Game.Screens.Edit.Timing { new Dimension(GridSizeMode.Absolute, 200), new Dimension(GridSizeMode.Absolute, 60), + new Dimension(GridSizeMode.Absolute, 60), }, Content = new[] { @@ -77,7 +82,36 @@ namespace osu.Game.Screens.Edit.Timing }, } } - } + }, + }, + new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(10), + Children = new Drawable[] + { + new AdjustButton(1) + { + Text = "Offset", + RelativeSizeAxes = Axes.X, + Width = 0.48f, + Height = 50, + Action = adjustOffset, + }, + new AdjustButton(0.1) + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Text = "BPM", + RelativeSizeAxes = Axes.X, + Width = 0.48f, + Height = 50, + Action = adjustBpm, + } + } + }, }, new Drawable[] { @@ -113,6 +147,35 @@ namespace osu.Game.Screens.Edit.Timing }; } + private void adjustOffset(double adjust) + { + // VERY TEMPORARY + var currentGroupItems = selectedGroup.Value.ControlPoints.ToArray(); + + beatmap.ControlPointInfo.RemoveGroup(selectedGroup.Value); + + double newOffset = selectedGroup.Value.Time + adjust; + + foreach (var cp in currentGroupItems) + beatmap.ControlPointInfo.Add(newOffset, cp); + + // the control point might not necessarily exist yet, if currentGroupItems was empty. + selectedGroup.Value = beatmap.ControlPointInfo.GroupAt(newOffset, true); + + if (!editorClock.IsRunning) + editorClock.Seek(newOffset); + } + + private void adjustBpm(double adjust) + { + var timing = selectedGroup.Value.ControlPoints.OfType().FirstOrDefault(); + + if (timing == null) + return; + + timing.BeatLength = 60000 / (timing.BPM + adjust); + } + private void tap() { editorClock.Seek(selectedGroup.Value.Time); From f99bcb23a0d296ef7cfd462276d86e730ed13cd8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 21:49:32 +0900 Subject: [PATCH 1335/2328] Automatically make first control point added to beatmap have timing data --- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index f71a8d7d22..c3b804c2d6 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -144,7 +144,14 @@ namespace osu.Game.Screens.Edit.Timing private void addNew() { - selectedGroup.Value = Beatmap.ControlPointInfo.GroupAt(clock.CurrentTime, true); + bool isFirstControlPoint = !Beatmap.ControlPointInfo.TimingPoints.Any(); + + var group = Beatmap.ControlPointInfo.GroupAt(clock.CurrentTime, true); + + if (isFirstControlPoint) + group.Add(new TimingControlPoint()); + + selectedGroup.Value = group; } } } From 8240b645b4c93c2d83d2deaa31c49274e8920463 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 21:49:47 +0900 Subject: [PATCH 1336/2328] Copy attribute types from currently selected control point to new placements --- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index c3b804c2d6..5ee6106c46 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -150,6 +151,23 @@ namespace osu.Game.Screens.Edit.Timing if (isFirstControlPoint) group.Add(new TimingControlPoint()); + else + { + // Try and create matching types from the currently selected control point. + var selected = selectedGroup.Value; + + if (selected != null) + { + foreach (var controlPoint in selected.ControlPoints) + { + if (Activator.CreateInstance(controlPoint.GetType()) is ControlPoint copy) + { + copy.CopyFrom(controlPoint); + group.Add(copy); + } + } + } + } selectedGroup.Value = group; } From bc22079fdcf4c06d89c38298ba83a526abc6f7b7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 22:02:30 +0900 Subject: [PATCH 1337/2328] Fix row selected colour flicker when changing offset rapidly --- osu.Game/Screens/Edit/EditorTable.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game/Screens/Edit/EditorTable.cs b/osu.Game/Screens/Edit/EditorTable.cs index a67a060134..26819dcfe7 100644 --- a/osu.Game/Screens/Edit/EditorTable.cs +++ b/osu.Game/Screens/Edit/EditorTable.cs @@ -99,6 +99,15 @@ namespace osu.Game.Screens.Edit colourSelected = colours.Colour3; } + protected override void LoadComplete() + { + base.LoadComplete(); + + // Reduce flicker of rows when offset is being changed rapidly. + // Probably need to reconsider this. + FinishTransforms(true); + } + private bool selected; public bool Selected From a434cc14a46eb7a4e7e301e12f90b60d1e220439 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 1 Jun 2022 09:34:46 +0900 Subject: [PATCH 1338/2328] Apply code reviews --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 8e69ffa0a0..5712d9c94a 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.Contracts; using System.Linq; using osu.Framework.Bindables; using osu.Framework.Utils; @@ -283,6 +284,7 @@ namespace osu.Game.Rulesets.Scoring /// The to represent the score as. /// The to compute the total score of. /// The total score in the given . + [Pure] public double ComputeFinalScore(ScoringMode mode, ScoreInfo scoreInfo) { if (!ruleset.RulesetInfo.Equals(scoreInfo.Ruleset)) @@ -303,6 +305,7 @@ namespace osu.Game.Rulesets.Scoring /// The to represent the score as. /// The to compute the total score of. /// The total score in the given . + [Pure] public double ComputePartialScore(ScoringMode mode, ScoreInfo scoreInfo) { if (!ruleset.RulesetInfo.Equals(scoreInfo.Ruleset)) @@ -328,6 +331,7 @@ namespace osu.Game.Rulesets.Scoring /// The to compute the total score of. /// The maximum achievable combo for the provided beatmap. /// The total score in the given . + [Pure] public double ComputeFinalLegacyScore(ScoringMode mode, ScoreInfo scoreInfo, int maxAchievableCombo) { if (!ruleset.RulesetInfo.Equals(scoreInfo.Ruleset)) @@ -354,6 +358,7 @@ namespace osu.Game.Rulesets.Scoring /// The current scoring values. /// The maximum scoring values. /// The total score computed from the given scoring values. + [Pure] public double ComputeScore(ScoringMode mode, ScoringValues current, ScoringValues maximum) { double accuracyRatio = maximum.BaseScore > 0 ? current.BaseScore / maximum.BaseScore : 1; @@ -370,6 +375,7 @@ namespace osu.Game.Rulesets.Scoring /// The total bonus score. /// The total number of basic (non-tick and non-bonus) hitobjects in the beatmap. /// The total score computed from the given scoring component ratios. + [Pure] public double ComputeScore(ScoringMode mode, double accuracyRatio, double comboRatio, double bonusScore, int totalBasicHitObjects) { switch (mode) @@ -492,7 +498,8 @@ namespace osu.Game.Rulesets.Scoring /// The score to extract scoring values from. /// The "current" scoring values, representing the hit statistics as they appear. /// The "maximum" scoring values, representing the hit statistics as if the maximum hit result was attained each time. - public void ExtractScoringValues(ScoreInfo scoreInfo, out ScoringValues current, out ScoringValues maximum) + [Pure] + internal void ExtractScoringValues(ScoreInfo scoreInfo, out ScoringValues current, out ScoringValues maximum) { extractScoringValues(scoreInfo.Statistics, out current, out maximum); current.MaxCombo = scoreInfo.MaxCombo; @@ -516,7 +523,8 @@ namespace osu.Game.Rulesets.Scoring /// The replay frame header to extract scoring values from. /// The "current" scoring values, representing the hit statistics as they appear. /// The "maximum" scoring values, representing the hit statistics as if the maximum hit result was attained each time. - public void ExtractScoringValues(FrameHeader header, out ScoringValues current, out ScoringValues maximum) + [Pure] + internal void ExtractScoringValues(FrameHeader header, out ScoringValues current, out ScoringValues maximum) { extractScoringValues(header.Statistics, out current, out maximum); current.MaxCombo = header.MaxCombo; @@ -537,6 +545,7 @@ namespace osu.Game.Rulesets.Scoring /// The hit statistics to extract scoring values from. /// The "current" scoring values, representing the hit statistics as they appear. /// The "maximum" scoring values, representing the hit statistics as if the maximum hit result was attained each time. + [Pure] private void extractScoringValues(IReadOnlyDictionary statistics, out ScoringValues current, out ScoringValues maximum) { current = default; From fc079ad8cfc1b458cbbf266bd39e8093b1ec91b2 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 1 Jun 2022 09:51:06 +0900 Subject: [PATCH 1339/2328] Refactor to reduce nested conditions --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 93 +++++++++------------ 1 file changed, 38 insertions(+), 55 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 5712d9c94a..26a32ab1a0 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -168,43 +168,20 @@ namespace osu.Game.Rulesets.Scoring scoreResultCounts[result.Type] = scoreResultCounts.GetValueOrDefault(result.Type) + 1; + // Always update the maximum scoring values. + applyResult(result.Judgement.MaxResult, ref currentMaximumScoringValues); + currentMaximumScoringValues.MaxCombo += result.Judgement.MaxResult.IncreasesCombo() ? 1 : 0; + if (!result.Type.IsScorable()) - { - // The inverse of non-scorable (ignore) judgements may be bonus judgements. - if (result.Judgement.MaxResult.IsBonus()) - currentMaximumScoringValues.BonusScore += result.Judgement.MaxNumericResult; - return; - } - // Update rolling combo. if (result.Type.IncreasesCombo()) Combo.Value++; else if (result.Type.BreaksCombo()) Combo.Value = 0; - // Update maximum combo. + applyResult(result.Type, ref currentScoringValues); currentScoringValues.MaxCombo = HighestCombo.Value; - currentMaximumScoringValues.MaxCombo += result.Judgement.MaxResult.AffectsCombo() ? 1 : 0; - - // Update base/bonus score. - if (result.Type.IsBonus()) - { - currentScoringValues.BonusScore += result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; - currentMaximumScoringValues.BonusScore += result.Judgement.MaxNumericResult; - } - else - { - currentScoringValues.BaseScore += result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; - currentMaximumScoringValues.BaseScore += result.Judgement.MaxNumericResult; - } - - // Update hitobject count. - if (result.Type.IsBasic()) - { - currentScoringValues.HitObjects++; - currentMaximumScoringValues.HitObjects++; - } hitEvents.Add(CreateHitEvent(result)); lastHitObject = result.HitObject; @@ -212,6 +189,20 @@ namespace osu.Game.Rulesets.Scoring updateScore(); } + private static void applyResult(HitResult result, ref ScoringValues scoringValues) + { + if (!result.IsScorable()) + return; + + if (result.IsBonus()) + scoringValues.BonusScore += result.IsHit() ? Judgement.ToNumericResult(result) : 0; + else + scoringValues.BaseScore += result.IsHit() ? Judgement.ToNumericResult(result) : 0; + + if (result.IsBasic()) + scoringValues.HitObjects++; + } + /// /// Creates the that describes a . /// @@ -230,37 +221,15 @@ namespace osu.Game.Rulesets.Scoring scoreResultCounts[result.Type] = scoreResultCounts.GetValueOrDefault(result.Type) - 1; + // Always update the maximum scoring values. + revertResult(result.Judgement.MaxResult, ref currentMaximumScoringValues); + currentMaximumScoringValues.MaxCombo -= result.Judgement.MaxResult.IncreasesCombo() ? 1 : 0; + if (!result.Type.IsScorable()) - { - // The inverse of non-scorable (ignore) judgements may be bonus judgements. - if (result.Judgement.MaxResult.IsBonus()) - currentMaximumScoringValues.BonusScore -= result.Judgement.MaxNumericResult; - return; - } - // Update maximum combo. + revertResult(result.Type, ref currentScoringValues); currentScoringValues.MaxCombo = HighestCombo.Value; - currentMaximumScoringValues.MaxCombo -= result.Judgement.MaxResult.AffectsCombo() ? 1 : 0; - - // Update base/bonus score. - if (result.Type.IsBonus()) - { - currentScoringValues.BonusScore -= result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; - currentMaximumScoringValues.BonusScore -= result.Judgement.MaxNumericResult; - } - else - { - currentScoringValues.BaseScore -= result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; - currentMaximumScoringValues.BaseScore -= result.Judgement.MaxNumericResult; - } - - // Update hitobject count. - if (result.Type.IsBasic()) - { - currentScoringValues.HitObjects--; - currentMaximumScoringValues.HitObjects--; - } Debug.Assert(hitEvents.Count > 0); lastHitObject = hitEvents[^1].LastHitObject; @@ -269,6 +238,20 @@ namespace osu.Game.Rulesets.Scoring updateScore(); } + private static void revertResult(HitResult result, ref ScoringValues scoringValues) + { + if (!result.IsScorable()) + return; + + if (result.IsBonus()) + scoringValues.BonusScore -= result.IsHit() ? Judgement.ToNumericResult(result) : 0; + else + scoringValues.BaseScore -= result.IsHit() ? Judgement.ToNumericResult(result) : 0; + + if (result.IsBasic()) + scoringValues.HitObjects--; + } + private void updateScore() { Accuracy.Value = currentMaximumScoringValues.BaseScore > 0 ? currentScoringValues.BaseScore / currentMaximumScoringValues.BaseScore : 1; From 50c3dfca318ee462abffa7435ebce3326ed68972 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 1 Jun 2022 09:34:46 +0900 Subject: [PATCH 1340/2328] Apply code reviews --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 8e69ffa0a0..5712d9c94a 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.Contracts; using System.Linq; using osu.Framework.Bindables; using osu.Framework.Utils; @@ -283,6 +284,7 @@ namespace osu.Game.Rulesets.Scoring /// The to represent the score as. /// The to compute the total score of. /// The total score in the given . + [Pure] public double ComputeFinalScore(ScoringMode mode, ScoreInfo scoreInfo) { if (!ruleset.RulesetInfo.Equals(scoreInfo.Ruleset)) @@ -303,6 +305,7 @@ namespace osu.Game.Rulesets.Scoring /// The to represent the score as. /// The to compute the total score of. /// The total score in the given . + [Pure] public double ComputePartialScore(ScoringMode mode, ScoreInfo scoreInfo) { if (!ruleset.RulesetInfo.Equals(scoreInfo.Ruleset)) @@ -328,6 +331,7 @@ namespace osu.Game.Rulesets.Scoring /// The to compute the total score of. /// The maximum achievable combo for the provided beatmap. /// The total score in the given . + [Pure] public double ComputeFinalLegacyScore(ScoringMode mode, ScoreInfo scoreInfo, int maxAchievableCombo) { if (!ruleset.RulesetInfo.Equals(scoreInfo.Ruleset)) @@ -354,6 +358,7 @@ namespace osu.Game.Rulesets.Scoring /// The current scoring values. /// The maximum scoring values. /// The total score computed from the given scoring values. + [Pure] public double ComputeScore(ScoringMode mode, ScoringValues current, ScoringValues maximum) { double accuracyRatio = maximum.BaseScore > 0 ? current.BaseScore / maximum.BaseScore : 1; @@ -370,6 +375,7 @@ namespace osu.Game.Rulesets.Scoring /// The total bonus score. /// The total number of basic (non-tick and non-bonus) hitobjects in the beatmap. /// The total score computed from the given scoring component ratios. + [Pure] public double ComputeScore(ScoringMode mode, double accuracyRatio, double comboRatio, double bonusScore, int totalBasicHitObjects) { switch (mode) @@ -492,7 +498,8 @@ namespace osu.Game.Rulesets.Scoring /// The score to extract scoring values from. /// The "current" scoring values, representing the hit statistics as they appear. /// The "maximum" scoring values, representing the hit statistics as if the maximum hit result was attained each time. - public void ExtractScoringValues(ScoreInfo scoreInfo, out ScoringValues current, out ScoringValues maximum) + [Pure] + internal void ExtractScoringValues(ScoreInfo scoreInfo, out ScoringValues current, out ScoringValues maximum) { extractScoringValues(scoreInfo.Statistics, out current, out maximum); current.MaxCombo = scoreInfo.MaxCombo; @@ -516,7 +523,8 @@ namespace osu.Game.Rulesets.Scoring /// The replay frame header to extract scoring values from. /// The "current" scoring values, representing the hit statistics as they appear. /// The "maximum" scoring values, representing the hit statistics as if the maximum hit result was attained each time. - public void ExtractScoringValues(FrameHeader header, out ScoringValues current, out ScoringValues maximum) + [Pure] + internal void ExtractScoringValues(FrameHeader header, out ScoringValues current, out ScoringValues maximum) { extractScoringValues(header.Statistics, out current, out maximum); current.MaxCombo = header.MaxCombo; @@ -537,6 +545,7 @@ namespace osu.Game.Rulesets.Scoring /// The hit statistics to extract scoring values from. /// The "current" scoring values, representing the hit statistics as they appear. /// The "maximum" scoring values, representing the hit statistics as if the maximum hit result was attained each time. + [Pure] private void extractScoringValues(IReadOnlyDictionary statistics, out ScoringValues current, out ScoringValues maximum) { current = default; From 425390e13bcb3aca9deb7329819883db4f2831e4 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 1 Jun 2022 09:51:06 +0900 Subject: [PATCH 1341/2328] Refactor to reduce nested conditions --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 93 +++++++++------------ 1 file changed, 38 insertions(+), 55 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 5712d9c94a..26a32ab1a0 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -168,43 +168,20 @@ namespace osu.Game.Rulesets.Scoring scoreResultCounts[result.Type] = scoreResultCounts.GetValueOrDefault(result.Type) + 1; + // Always update the maximum scoring values. + applyResult(result.Judgement.MaxResult, ref currentMaximumScoringValues); + currentMaximumScoringValues.MaxCombo += result.Judgement.MaxResult.IncreasesCombo() ? 1 : 0; + if (!result.Type.IsScorable()) - { - // The inverse of non-scorable (ignore) judgements may be bonus judgements. - if (result.Judgement.MaxResult.IsBonus()) - currentMaximumScoringValues.BonusScore += result.Judgement.MaxNumericResult; - return; - } - // Update rolling combo. if (result.Type.IncreasesCombo()) Combo.Value++; else if (result.Type.BreaksCombo()) Combo.Value = 0; - // Update maximum combo. + applyResult(result.Type, ref currentScoringValues); currentScoringValues.MaxCombo = HighestCombo.Value; - currentMaximumScoringValues.MaxCombo += result.Judgement.MaxResult.AffectsCombo() ? 1 : 0; - - // Update base/bonus score. - if (result.Type.IsBonus()) - { - currentScoringValues.BonusScore += result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; - currentMaximumScoringValues.BonusScore += result.Judgement.MaxNumericResult; - } - else - { - currentScoringValues.BaseScore += result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; - currentMaximumScoringValues.BaseScore += result.Judgement.MaxNumericResult; - } - - // Update hitobject count. - if (result.Type.IsBasic()) - { - currentScoringValues.HitObjects++; - currentMaximumScoringValues.HitObjects++; - } hitEvents.Add(CreateHitEvent(result)); lastHitObject = result.HitObject; @@ -212,6 +189,20 @@ namespace osu.Game.Rulesets.Scoring updateScore(); } + private static void applyResult(HitResult result, ref ScoringValues scoringValues) + { + if (!result.IsScorable()) + return; + + if (result.IsBonus()) + scoringValues.BonusScore += result.IsHit() ? Judgement.ToNumericResult(result) : 0; + else + scoringValues.BaseScore += result.IsHit() ? Judgement.ToNumericResult(result) : 0; + + if (result.IsBasic()) + scoringValues.HitObjects++; + } + /// /// Creates the that describes a . /// @@ -230,37 +221,15 @@ namespace osu.Game.Rulesets.Scoring scoreResultCounts[result.Type] = scoreResultCounts.GetValueOrDefault(result.Type) - 1; + // Always update the maximum scoring values. + revertResult(result.Judgement.MaxResult, ref currentMaximumScoringValues); + currentMaximumScoringValues.MaxCombo -= result.Judgement.MaxResult.IncreasesCombo() ? 1 : 0; + if (!result.Type.IsScorable()) - { - // The inverse of non-scorable (ignore) judgements may be bonus judgements. - if (result.Judgement.MaxResult.IsBonus()) - currentMaximumScoringValues.BonusScore -= result.Judgement.MaxNumericResult; - return; - } - // Update maximum combo. + revertResult(result.Type, ref currentScoringValues); currentScoringValues.MaxCombo = HighestCombo.Value; - currentMaximumScoringValues.MaxCombo -= result.Judgement.MaxResult.AffectsCombo() ? 1 : 0; - - // Update base/bonus score. - if (result.Type.IsBonus()) - { - currentScoringValues.BonusScore -= result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; - currentMaximumScoringValues.BonusScore -= result.Judgement.MaxNumericResult; - } - else - { - currentScoringValues.BaseScore -= result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; - currentMaximumScoringValues.BaseScore -= result.Judgement.MaxNumericResult; - } - - // Update hitobject count. - if (result.Type.IsBasic()) - { - currentScoringValues.HitObjects--; - currentMaximumScoringValues.HitObjects--; - } Debug.Assert(hitEvents.Count > 0); lastHitObject = hitEvents[^1].LastHitObject; @@ -269,6 +238,20 @@ namespace osu.Game.Rulesets.Scoring updateScore(); } + private static void revertResult(HitResult result, ref ScoringValues scoringValues) + { + if (!result.IsScorable()) + return; + + if (result.IsBonus()) + scoringValues.BonusScore -= result.IsHit() ? Judgement.ToNumericResult(result) : 0; + else + scoringValues.BaseScore -= result.IsHit() ? Judgement.ToNumericResult(result) : 0; + + if (result.IsBasic()) + scoringValues.HitObjects--; + } + private void updateScore() { Accuracy.Value = currentMaximumScoringValues.BaseScore > 0 ? currentScoringValues.BaseScore / currentMaximumScoringValues.BaseScore : 1; From 25941f618786ffd007f2be0e7be303d424593b2b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 10:47:45 +0900 Subject: [PATCH 1342/2328] Use `DeepClone` instead of reflection call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index 5ee6106c46..b94f3e3ef4 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -160,11 +160,7 @@ namespace osu.Game.Screens.Edit.Timing { foreach (var controlPoint in selected.ControlPoints) { - if (Activator.CreateInstance(controlPoint.GetType()) is ControlPoint copy) - { - copy.CopyFrom(controlPoint); - group.Add(copy); - } + group.Add(controlPoint.DeepClone()); } } } From 6042cf1a3b9fe2255346853ce791f037823d7ef6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 14:36:25 +0900 Subject: [PATCH 1343/2328] Add metronome sound Placeholder pending follow-up from @nekodex (which as discussed should probably have a second sound for the metronome locking into "stopped" position). --- .../Screens/Edit/Timing/MetronomeDisplay.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 57fcff6a4c..1f065d1551 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -3,6 +3,8 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Extensions.LocalisationExtensions; @@ -31,12 +33,16 @@ namespace osu.Game.Screens.Edit.Timing private IAdjustableClock metronomeClock; + private Sample clunk; + [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } [BackgroundDependencyLoader] - private void load() + private void load(AudioManager audio) { + clunk = audio.Samples.Get(@"Multiplayer/countdown-tick"); + const float taper = 25; const float swing_vertical_offset = -23; const float lower_cover_height = 32; @@ -269,8 +275,15 @@ namespace osu.Game.Screens.Edit.Timing if (currentAngle != 0 && Math.Abs(currentAngle - targetAngle) > angle * 1.8f && isSwinging) { - using (stick.BeginDelayedSequence(beatLength / 2)) + using (BeginDelayedSequence(beatLength / 2)) + { stick.FlashColour(overlayColourProvider.Content1, beatLength, Easing.OutQuint); + Schedule(() => + { + clunk.Frequency.Value = RNG.NextDouble(0.98f, 1.02f); + clunk?.Play(); + }); + } } } } From 58ba92772cd8acde594fb9dbc1ad6ba0271ecdf3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 16:01:34 +0900 Subject: [PATCH 1344/2328] Reword comment to read better MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index ce13a8a244..1f12e2e5c9 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -112,9 +112,10 @@ namespace osu.Game.Screens.Edit.Timing if (tcp == null) { timingPoint = new TimingControlPoint(); - // During movement of a control point's offset, this clause can be hit momentarily. + // During movement of a control point's offset, this clause can be hit momentarily, + // as moving a control point is implemented by removing it and inserting it at the new time. // We don't want to reset the `selectedGroupStartTime` here as we rely on having the - // last value to perform an offset traversal below. + // last value to update the waveform display below. selectedGroupEndTime = beatmap.Value.Track.Length; return; } From f3fd5bbfc13b027cbae8d657e2d5b8d32ddf9f40 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 16:05:29 +0900 Subject: [PATCH 1345/2328] Increase flash delay and ensure text is always shown immediately on lock --- .../Edit/Timing/WaveformComparisonDisplay.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index 1f12e2e5c9..4275eaf7d3 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -99,7 +99,10 @@ namespace osu.Game.Screens.Edit.Timing displayLocked.BindValueChanged(locked => { - lockedOverlay.FadeTo(locked.NewValue ? 1 : 0, 200, Easing.OutQuint); + if (locked.NewValue) + lockedOverlay.Show(); + else + lockedOverlay.Hide(); }, true); } @@ -268,15 +271,20 @@ namespace osu.Game.Screens.Edit.Timing }; } - protected override void LoadComplete() + public override void Show() { - base.LoadComplete(); + this.FadeIn(100, Easing.OutQuint); text - .FadeIn().Then().Delay(500) - .FadeOut().Then().Delay(500) + .FadeIn().Then().Delay(600) + .FadeOut().Then().Delay(600) .Loop(); } + + public override void Hide() + { + this.FadeOut(100, Easing.OutQuint); + } } internal class WaveformRow : CompositeDrawable From 42598ce22aa7852054ce74771b685db186d434aa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 16:51:34 +0900 Subject: [PATCH 1346/2328] Refactor `warning` to `notice` in method names and usages --- .../Visual/Settings/TestSceneSettingsItem.cs | 10 +++++----- .../Settings/Sections/Graphics/LayoutSettings.cs | 10 +++++----- .../Sections/Graphics/RendererSettings.cs | 4 ++-- .../Settings/Sections/Input/MouseSettings.cs | 4 ++-- .../Sections/UserInterface/MainMenuSettings.cs | 4 ++-- osu.Game/Overlays/Settings/SettingsItem.cs | 16 ++++++++-------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs index f631e1603b..3e679a7905 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs @@ -84,7 +84,7 @@ namespace osu.Game.Tests.Visual.Settings AddStep("clear label", () => textBox.LabelText = default); AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(restoreDefaultValueButton.Parent.DrawHeight, control.DrawHeight, 1)); - AddStep("set warning text", () => textBox.SetWarningText("This is some very important warning text! Hopefully it doesn't break the alignment of the default value indicator...")); + AddStep("set warning text", () => textBox.SetNoticeText("This is some very important warning text! Hopefully it doesn't break the alignment of the default value indicator...", true)); AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(restoreDefaultValueButton.Parent.DrawHeight, control.DrawHeight, 1)); } @@ -132,16 +132,16 @@ namespace osu.Game.Tests.Visual.Settings AddStep("create settings item", () => Child = numberBox = new SettingsNumberBox()); AddAssert("warning text not created", () => !numberBox.ChildrenOfType().Any()); - AddStep("set warning text", () => numberBox.SetWarningText("this is a warning!")); + AddStep("set warning text", () => numberBox.SetNoticeText("this is a warning!", true)); AddAssert("warning text created", () => numberBox.ChildrenOfType().Single().Alpha == 1); - AddStep("unset warning text", () => numberBox.ClearWarningText()); + AddStep("unset warning text", () => numberBox.ClearNoticeText()); AddAssert("warning text hidden", () => !numberBox.ChildrenOfType().Any()); - AddStep("set warning text again", () => numberBox.SetWarningText("another warning!")); + AddStep("set warning text again", () => numberBox.SetNoticeText("another warning!", true)); AddAssert("warning text shown again", () => numberBox.ChildrenOfType().Single().Alpha == 1); - AddStep("set non warning text", () => numberBox.SetWarningText("you did good!", false)); + AddStep("set non warning text", () => numberBox.SetNoticeText("you did good!")); } } } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 53f84a9bb2..d79ba593f7 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -226,7 +226,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { if (windowModeDropdown.Current.Value != WindowMode.Fullscreen) { - windowModeDropdown.SetWarningText(GraphicsSettingsStrings.NotFullscreenNote); + windowModeDropdown.SetNoticeText(GraphicsSettingsStrings.NotFullscreenNote, true); return; } @@ -235,22 +235,22 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics switch (fullscreenCapability.Value) { case FullscreenCapability.Unknown: - windowModeDropdown.SetWarningText(LayoutSettingsStrings.CheckingForFullscreenCapabilities); + windowModeDropdown.SetNoticeText(LayoutSettingsStrings.CheckingForFullscreenCapabilities, true); break; case FullscreenCapability.Capable: - windowModeDropdown.SetWarningText(LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen, false); + windowModeDropdown.SetNoticeText(LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen); break; case FullscreenCapability.Incapable: - windowModeDropdown.SetWarningText(LayoutSettingsStrings.UnableToRunExclusiveFullscreen); + windowModeDropdown.SetNoticeText(LayoutSettingsStrings.UnableToRunExclusiveFullscreen, true); break; } } else { // We can only detect exclusive fullscreen status on windows currently. - windowModeDropdown.ClearWarningText(); + windowModeDropdown.ClearNoticeText(); } } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs index 6ec4decdda..8c3e45cd62 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs @@ -51,11 +51,11 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics switch (limit.NewValue) { case FrameSync.Unlimited: - frameLimiterDropdown.SetWarningText(GraphicsSettingsStrings.UnlimitedFramesNote); + frameLimiterDropdown.SetNoticeText(GraphicsSettingsStrings.UnlimitedFramesNote, true); break; default: - frameLimiterDropdown.ClearWarningText(); + frameLimiterDropdown.ClearNoticeText(); break; } }, true); diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 042cec106a..1511d53b6b 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -117,9 +117,9 @@ namespace osu.Game.Overlays.Settings.Sections.Input if (RuntimeInfo.OS != RuntimeInfo.Platform.Windows) { if (highPrecision.NewValue) - highPrecisionMouse.SetWarningText(MouseSettingsStrings.HighPrecisionPlatformWarning); + highPrecisionMouse.SetNoticeText(MouseSettingsStrings.HighPrecisionPlatformWarning, true); else - highPrecisionMouse.ClearWarningText(); + highPrecisionMouse.ClearNoticeText(); } }, true); } diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs index d3cc889abe..fceffa09c5 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs @@ -62,9 +62,9 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface user.BindValueChanged(u => { if (u.NewValue?.IsSupporter != true) - backgroundSourceDropdown.SetWarningText(UserInterfaceStrings.NotSupporterNote); + backgroundSourceDropdown.SetNoticeText(UserInterfaceStrings.NotSupporterNote, true); else - backgroundSourceDropdown.ClearWarningText(); + backgroundSourceDropdown.ClearNoticeText(); }, true); } } diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index fa521c0126..ea076b77ac 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Settings private SpriteText labelText; - private OsuTextFlowContainer warningText; + private OsuTextFlowContainer noticeText; public bool ShowsDefaultIndicator = true; private readonly Container defaultValueIndicatorContainer; @@ -72,24 +72,24 @@ namespace osu.Game.Overlays.Settings /// /// Clear any warning text. /// - public void ClearWarningText() + public void ClearNoticeText() { - warningText?.Expire(); - warningText = null; + noticeText?.Expire(); + noticeText = null; } /// /// Set the text to be displayed at the bottom of this . - /// Generally used to recommend the user change their setting as the current one is considered sub-optimal. + /// Generally used to provide feedback to a user about a sub-optimal setting. /// /// The text to display. /// Whether the text is in a warning state. Will decide how this is visually represented. - public void SetWarningText(LocalisableString text, bool isWarning = true) + public void SetNoticeText(LocalisableString text, bool isWarning = false) { - ClearWarningText(); + ClearNoticeText(); // construct lazily for cases where the label is not needed (may be provided by the Control). - FlowContent.Add(warningText = new LinkFlowContainer(cp => cp.Colour = isWarning ? colours.Yellow : colours.Green) + FlowContent.Add(noticeText = new LinkFlowContainer(cp => cp.Colour = isWarning ? colours.Yellow : colours.Green) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, From c55c3325a4c7df43dbd8df314e29c9dc7e21354c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 17:43:40 +0900 Subject: [PATCH 1347/2328] Remove unused using statements --- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index b94f3e3ef4..3c59cfff64 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; From 8c54bd46bb2209e8f09965b2a2e5e06d82311e2a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 17:46:05 +0900 Subject: [PATCH 1348/2328] Rename button to more appropriate name --- osu.Game/Screens/Edit/Timing/TapTimingControl.cs | 4 ++-- .../Edit/Timing/{AdjustButton.cs => TimingAdjustButton.cs} | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) rename osu.Game/Screens/Edit/Timing/{AdjustButton.cs => TimingAdjustButton.cs} (96%) diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index f9f5a20405..990f8d2ce0 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -92,7 +92,7 @@ namespace osu.Game.Screens.Edit.Timing Padding = new MarginPadding(10), Children = new Drawable[] { - new AdjustButton(1) + new TimingAdjustButton(1) { Text = "Offset", RelativeSizeAxes = Axes.X, @@ -100,7 +100,7 @@ namespace osu.Game.Screens.Edit.Timing Height = 50, Action = adjustOffset, }, - new AdjustButton(0.1) + new TimingAdjustButton(0.1) { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, diff --git a/osu.Game/Screens/Edit/Timing/AdjustButton.cs b/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs similarity index 96% rename from osu.Game/Screens/Edit/Timing/AdjustButton.cs rename to osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs index b0a0517e94..335f593772 100644 --- a/osu.Game/Screens/Edit/Timing/AdjustButton.cs +++ b/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs @@ -16,7 +16,10 @@ using osu.Game.Overlays; namespace osu.Game.Screens.Edit.Timing { - public class AdjustButton : CompositeDrawable + /// + /// A button with variable constant output based on hold position and length. + /// + public class TimingAdjustButton : CompositeDrawable { public Action Action; @@ -50,7 +53,7 @@ namespace osu.Game.Screens.Edit.Timing [Resolved] private OverlayColourProvider colourProvider { get; set; } - public AdjustButton(double adjustAmount) + public TimingAdjustButton(double adjustAmount) { this.adjustAmount = adjustAmount; From 1293bbdbd931a7f17f5c5249e69593d0f16430c8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 17:46:33 +0900 Subject: [PATCH 1349/2328] Remove unnecessary null checks on `Text` property --- osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs b/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs index 335f593772..46bb8356f7 100644 --- a/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs +++ b/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs @@ -42,12 +42,8 @@ namespace osu.Game.Screens.Edit.Timing public LocalisableString Text { - get => text?.Text ?? default; - set - { - if (text != null) - text.Text = value; - } + get => text.Text; + set => text.Text = value; } [Resolved] From 187acb0718bda64c693f19ea9da3bb041d556161 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 17:57:53 +0900 Subject: [PATCH 1350/2328] Simplify linq tracking logic --- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 30 ++------------------ 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index 0cf4fca58a..ebb958f884 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -156,35 +156,11 @@ namespace osu.Game.Screens.Edit.Timing { // We don't have an efficient way of looking up groups currently, only individual point types. // To improve the efficiency of this in the future, we should reconsider the overall structure of ControlPointInfo. - IEnumerable groups = Beatmap.ControlPointInfo.Groups; - - bool currentTimeBeforeSelectedGroup = clock.CurrentTimeAccurate < selectedGroup.Value.Time; - - // Decide whether we are searching backwards or forwards. - if (currentTimeBeforeSelectedGroup) - groups = groups.Reverse(); // Find the next group which has the same type as the selected one. - groups = groups.SkipWhile(g => g != selectedGroup.Value) - .Skip(1) - .Where(g => g.ControlPoints.Any(cp => cp.GetType() == selectedPointType)); - - ControlPointGroup newGroup = groups.FirstOrDefault(); - - if (newGroup != null) - { - if (currentTimeBeforeSelectedGroup) - { - // When seeking backwards, the first match from the LINQ query is always what we want. - selectedGroup.Value = newGroup; - } - else - { - // When seeking forwards, we also need to check that the next match is before the current time. - if (newGroup.Time <= clock.CurrentTimeAccurate) - selectedGroup.Value = newGroup; - } - } + selectedGroup.Value = Beatmap.ControlPointInfo.Groups + .Where(g => g.ControlPoints.Any(cp => cp.GetType() == selectedPointType)) + .LastOrDefault(g => g.Time <= clock.CurrentTimeAccurate); } } From 0472881078490377697b66a7b4201dc341d87d84 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 18:03:03 +0900 Subject: [PATCH 1351/2328] Fix null check only covering one of two calls --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 1f065d1551..3a067a281e 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -278,11 +278,15 @@ namespace osu.Game.Screens.Edit.Timing using (BeginDelayedSequence(beatLength / 2)) { stick.FlashColour(overlayColourProvider.Content1, beatLength, Easing.OutQuint); - Schedule(() => + + if (clunk != null) { - clunk.Frequency.Value = RNG.NextDouble(0.98f, 1.02f); - clunk?.Play(); - }); + Schedule(() => + { + clunk.Frequency.Value = RNG.NextDouble(0.98f, 1.02f); + clunk.Play(); + }); + } } } } From 93b8c90ecca5cae08e7fce1b331f3c0f0bfe5739 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 18:04:13 +0900 Subject: [PATCH 1352/2328] Apply frequency adjust to channel rather than sample for safety --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 3a067a281e..4143c5ea55 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -279,14 +279,16 @@ namespace osu.Game.Screens.Edit.Timing { stick.FlashColour(overlayColourProvider.Content1, beatLength, Easing.OutQuint); - if (clunk != null) + Schedule(() => { - Schedule(() => + var channel = clunk?.GetChannel(); + + if (channel != null) { - clunk.Frequency.Value = RNG.NextDouble(0.98f, 1.02f); - clunk.Play(); - }); - } + channel.Frequency.Value = RNG.NextDouble(0.98f, 1.02f); + channel.Play(); + } + }); } } } From a4ec32b499dabcc1280033b1fe37688fbec1f5c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 18:02:17 +0900 Subject: [PATCH 1353/2328] Add button sound effect --- .../Screens/Edit/Timing/TimingAdjustButton.cs | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs b/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs index 46bb8356f7..9fc7e56a3d 100644 --- a/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs +++ b/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs @@ -4,6 +4,8 @@ using System; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -26,6 +28,8 @@ namespace osu.Game.Screens.Edit.Timing private readonly double adjustAmount; private ScheduledDelegate adjustDelegate; + private const int max_multiplier = 10; + private const int adjust_levels = 4; private const double initial_delay = 300; @@ -40,6 +44,8 @@ namespace osu.Game.Screens.Edit.Timing private readonly OsuSpriteText text; + private Sample sample; + public LocalisableString Text { get => text.Text; @@ -79,8 +85,10 @@ namespace osu.Game.Screens.Edit.Timing } [BackgroundDependencyLoader] - private void load() + private void load(AudioManager audio) { + sample = audio.Samples.Get(@"UI/notch-tick"); + background.Colour = colourProvider.Background3; for (int i = 1; i <= adjust_levels; i++) @@ -120,6 +128,17 @@ namespace osu.Game.Screens.Edit.Timing adjustDelay = Math.Max(minimum_delay, adjustDelay * 0.9f); hoveredBox.Flash(); + + var channel = sample?.GetChannel(); + + if (channel != null) + { + double repeatModifier = 0.05f * (Math.Abs(adjustDelay - initial_delay) / minimum_delay); + double multiplierModifier = (hoveredBox.Multiplier / max_multiplier) * 0.2f; + + channel.Frequency.Value = 1 + multiplierModifier + repeatModifier; + channel.Play(); + } } else { @@ -195,7 +214,8 @@ namespace osu.Game.Screens.Edit.Timing case 3: return 5; - case 4: return 10; + case 4: + return max_multiplier; } } From caa29e1f9ecff4c86e973a7ad7309c482d13927d Mon Sep 17 00:00:00 2001 From: tornac1234 Date: Wed, 1 Jun 2022 12:05:24 +0200 Subject: [PATCH 1354/2328] Removed ruleset rankings request from DiscordRichPresence.cs --- osu.Desktop/DiscordRichPresence.cs | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index 14fea7a08d..0d276d963f 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -12,7 +12,6 @@ using osu.Framework.Logging; using osu.Game.Configuration; using osu.Game.Extensions; using osu.Game.Online.API; -using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; using osu.Game.Users; @@ -81,7 +80,7 @@ namespace osu.Desktop private void onReady(object _, ReadyMessage __) { Logger.Log("Discord RPC Client ready.", LoggingTarget.Network, LogLevel.Debug); - requestUserRulesetsRankings(); + updateStatus(); } private void updateStatus() @@ -124,26 +123,6 @@ namespace osu.Desktop client.SetPresence(presence); } - private void requestUserRulesetsRankings() - { - RulesetInfo cachedRuleset = ruleset.Value; - - var req = new GetUsersRequest(new int[] { provider.LocalUser.Value.Id }); - req.Success += result => - { - if (result.Users.Count == 1) - { - APIUser apiUser = result.Users[0]; - user.Value.RulesetsStatistics = apiUser.RulesetsStatistics; - } - - updateStatus(); - }; - req.Failure += _ => updateStatus(); - - provider.Queue(req); - } - private static readonly int ellipsis_length = Encoding.UTF8.GetByteCount(new[] { '…' }); private string truncate(string str) From 534e8f8fac69c2df110922f17b1b6f79ecfde98f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 20:20:16 +0900 Subject: [PATCH 1355/2328] Only switch to found group if non-null --- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index ebb958f884..d7ca306037 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -158,9 +158,12 @@ namespace osu.Game.Screens.Edit.Timing // To improve the efficiency of this in the future, we should reconsider the overall structure of ControlPointInfo. // Find the next group which has the same type as the selected one. - selectedGroup.Value = Beatmap.ControlPointInfo.Groups - .Where(g => g.ControlPoints.Any(cp => cp.GetType() == selectedPointType)) - .LastOrDefault(g => g.Time <= clock.CurrentTimeAccurate); + var found = Beatmap.ControlPointInfo.Groups + .Where(g => g.ControlPoints.Any(cp => cp.GetType() == selectedPointType)) + .LastOrDefault(g => g.Time <= clock.CurrentTimeAccurate); + + if (found != null) + selectedGroup.Value = found; } } From e2cdc66f6d378c20511c3be2fe724aa0f68a3eca Mon Sep 17 00:00:00 2001 From: tornac1234 Date: Wed, 1 Jun 2022 13:31:38 +0200 Subject: [PATCH 1356/2328] Added user RulesetsStatistics fetching when connecting --- osu.Game/Online/API/APIAccess.cs | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 62ddd49881..f59bee1065 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -171,12 +171,32 @@ namespace osu.Game.Online.API }; userReq.Success += u => { - localUser.Value = u; - // todo: save/pull from settings - localUser.Value.Status.Value = new UserStatusOnline(); + u.Status.Value = new UserStatusOnline(); failureCount = 0; + + // getting user's full statistics (concerning every ruleset) + // we delay the localUser.Value setting because BindValueChanged won't record two value changes in a row + var statsRequest = new GetUsersRequest(new int[] { u.Id }); + statsRequest.Failure += _ => + { + localUser.Value = u; + failConnectionProcess(); + }; + statsRequest.Success += result => + { + if (result.Users.Count == 1) + { + u.RulesetsStatistics = result.Users[0].RulesetsStatistics; + localUser.Value = u; + return; + } + // Should never... happen ? + statsRequest.Fail(new Exception("Empty response for GetUsersRequest")); + }; + + handleRequest(statsRequest); }; if (!handleRequest(userReq)) From cb37dd74c19f9bb21c754128f8850123f1a83359 Mon Sep 17 00:00:00 2001 From: "Hugo \"ThePooN\" Denizart" Date: Wed, 1 Jun 2022 17:14:07 +0200 Subject: [PATCH 1357/2328] =?UTF-8?q?=F0=9F=94=A7=20Add=20prefix=20to=20Se?= =?UTF-8?q?ntry=20release=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sentry-release.yml | 2 +- osu.Game/Utils/SentryLogger.cs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sentry-release.yml b/.github/workflows/sentry-release.yml index 8ca9f38234..794943c4b1 100644 --- a/.github/workflows/sentry-release.yml +++ b/.github/workflows/sentry-release.yml @@ -23,4 +23,4 @@ jobs: SENTRY_URL: https://sentry.ppy.sh/ with: environment: production - version: ${{ github.ref }} + version: osu/${{ github.ref_name }} diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index 137bf7e0aa..a4f8ea0ef6 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -48,9 +48,8 @@ namespace osu.Game.Utils options.AutoSessionTracking = true; options.IsEnvironmentUser = false; - // The reported release needs to match release tags on github in order for sentry - // to automatically associate and track against releases. - options.Release = game.Version.Replace($@"-{OsuGameBase.BUILD_SUFFIX}", string.Empty); + // The reported release needs to match version as reported to Sentry in .github/workflows/sentry-release.yml + options.Release = $"osu/{game.Version.Replace($@"-{OsuGameBase.BUILD_SUFFIX}", string.Empty)}"; }); Logger.NewEntry += processLogEntry; From 384cdcbc40e0a193a7e8d9102e44b93579eef869 Mon Sep 17 00:00:00 2001 From: "Hugo \"ThePooN\" Denizart" Date: Wed, 1 Jun 2022 18:12:29 +0200 Subject: [PATCH 1358/2328] =?UTF-8?q?=F0=9F=9A=91=20Fix=20use=20of=20illeg?= =?UTF-8?q?al=20character=20in=20Sentry's=20release=20name=20scheme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sentry-release.yml | 2 +- osu.Game/Utils/SentryLogger.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sentry-release.yml b/.github/workflows/sentry-release.yml index 794943c4b1..442b97c473 100644 --- a/.github/workflows/sentry-release.yml +++ b/.github/workflows/sentry-release.yml @@ -23,4 +23,4 @@ jobs: SENTRY_URL: https://sentry.ppy.sh/ with: environment: production - version: osu/${{ github.ref_name }} + version: osu@${{ github.ref_name }} diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index a4f8ea0ef6..ecc7fc4774 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -49,7 +49,7 @@ namespace osu.Game.Utils options.AutoSessionTracking = true; options.IsEnvironmentUser = false; // The reported release needs to match version as reported to Sentry in .github/workflows/sentry-release.yml - options.Release = $"osu/{game.Version.Replace($@"-{OsuGameBase.BUILD_SUFFIX}", string.Empty)}"; + options.Release = $"osu@{game.Version.Replace($@"-{OsuGameBase.BUILD_SUFFIX}", string.Empty)}"; }); Logger.NewEntry += processLogEntry; From 6b709de2c26d259676e158e35a228e82eab13071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 1 Jun 2022 20:18:02 +0200 Subject: [PATCH 1359/2328] Remove unused using directive --- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index d7ca306037..d104cc4b5c 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -1,7 +1,6 @@ // 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.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; From 801e11d8418b49018d9174629d413e14bd7b36ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 1 Jun 2022 20:25:56 +0200 Subject: [PATCH 1360/2328] Apply performance regression fix to effect section too --- osu.Game/Screens/Edit/Timing/EffectSection.cs | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/EffectSection.cs b/osu.Game/Screens/Edit/Timing/EffectSection.cs index c8944d0357..c9f73411f1 100644 --- a/osu.Game/Screens/Edit/Timing/EffectSection.cs +++ b/osu.Game/Screens/Edit/Timing/EffectSection.cs @@ -31,18 +31,33 @@ namespace osu.Game.Screens.Edit.Timing }); } + protected override void LoadComplete() + { + base.LoadComplete(); + + kiai.Current.BindValueChanged(_ => saveChanges()); + omitBarLine.Current.BindValueChanged(_ => saveChanges()); + scrollSpeedSlider.Current.BindValueChanged(_ => saveChanges()); + + void saveChanges() + { + if (!isRebinding) ChangeHandler?.SaveState(); + } + } + + private bool isRebinding; + protected override void OnControlPointChanged(ValueChangedEvent point) { if (point.NewValue != null) { + isRebinding = true; + kiai.Current = point.NewValue.KiaiModeBindable; - kiai.Current.BindValueChanged(_ => ChangeHandler?.SaveState()); - omitBarLine.Current = point.NewValue.OmitFirstBarLineBindable; - omitBarLine.Current.BindValueChanged(_ => ChangeHandler?.SaveState()); - scrollSpeedSlider.Current = point.NewValue.ScrollSpeedBindable; - scrollSpeedSlider.Current.BindValueChanged(_ => ChangeHandler?.SaveState()); + + isRebinding = false; } } From e551e486977bef815098a9047a4b89529a7267df Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 2 Jun 2022 11:01:46 +0900 Subject: [PATCH 1361/2328] Use ScoreInfo overload in more places --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 26a32ab1a0..853f43ddb6 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -273,8 +273,7 @@ namespace osu.Game.Rulesets.Scoring if (!ruleset.RulesetInfo.Equals(scoreInfo.Ruleset)) throw new ArgumentException($"Unexpected score ruleset. Expected \"{ruleset.RulesetInfo.ShortName}\" but was \"{scoreInfo.Ruleset.ShortName}\"."); - extractScoringValues(scoreInfo.Statistics, out var current, out var maximum); - current.MaxCombo = scoreInfo.MaxCombo; + ExtractScoringValues(scoreInfo, out var current, out var maximum); return ComputeScore(mode, current, maximum); } @@ -297,8 +296,7 @@ namespace osu.Game.Rulesets.Scoring if (!beatmapApplied) throw new InvalidOperationException($"Cannot compute partial score without calling {nameof(ApplyBeatmap)}."); - extractScoringValues(scoreInfo.Statistics, out var current, out _); - current.MaxCombo = scoreInfo.MaxCombo; + ExtractScoringValues(scoreInfo, out var current, out _); return ComputeScore(mode, current, MaximumScoringValues); } @@ -323,7 +321,7 @@ namespace osu.Game.Rulesets.Scoring double accuracyRatio = scoreInfo.Accuracy; double comboRatio = maxAchievableCombo > 0 ? (double)scoreInfo.MaxCombo / maxAchievableCombo : 1; - extractScoringValues(scoreInfo.Statistics, out var current, out var maximum); + ExtractScoringValues(scoreInfo, out var current, out var maximum); // For legacy osu!mania scores, a full-GREAT score has 100% accuracy. If combined with a full-combo, the score becomes indistinguishable from a full-PERFECT score. // To get around this, the accuracy ratio is always recalculated based on the hit statistics rather than trusting the score. From d12f6ea2213da50789f48c9cf3f0e65a55e1ae93 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 18:53:35 +0900 Subject: [PATCH 1362/2328] Add basics of tap button --- .../Visual/Editing/TestSceneTapButton.cs | 48 +++++++ osu.Game/Screens/Edit/Timing/TapButton.cs | 122 ++++++++++++++++++ .../Screens/Edit/Timing/TapTimingControl.cs | 9 ++ 3 files changed, 179 insertions(+) create mode 100644 osu.Game.Tests/Visual/Editing/TestSceneTapButton.cs create mode 100644 osu.Game/Screens/Edit/Timing/TapButton.cs diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTapButton.cs b/osu.Game.Tests/Visual/Editing/TestSceneTapButton.cs new file mode 100644 index 0000000000..d8141619ab --- /dev/null +++ b/osu.Game.Tests/Visual/Editing/TestSceneTapButton.cs @@ -0,0 +1,48 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Overlays; +using osu.Game.Screens.Edit.Timing; +using osuTK; +using osuTK.Input; + +namespace osu.Game.Tests.Visual.Editing +{ + public class TestSceneTapButton : OsuManualInputManagerTestScene + { + private TapButton tapButton; + + [Cached] + private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Aquamarine); + + [Test] + public void TestBasic() + { + AddStep("create button", () => + { + Child = tapButton = new TapButton + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Scale = new Vector2(4), + }; + }); + + bool pressed = false; + + AddRepeatStep("Press button", () => + { + InputManager.MoveMouseTo(tapButton); + if (!pressed) + InputManager.PressButton(MouseButton.Left); + else + InputManager.ReleaseButton(MouseButton.Left); + + pressed = !pressed; + }, 100); + } + } +} diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs new file mode 100644 index 0000000000..59ec966fe0 --- /dev/null +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -0,0 +1,122 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; +using osu.Game.Overlays; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Screens.Edit.Timing +{ + internal class TapButton : CircularContainer + { + public const float SIZE = 100; + + [Resolved] + private OverlayColourProvider colourProvider { get; set; } + + private Circle hoverLayer; + private CircularContainer innerCircle; + private Circle outerCircle; + + private Container scaleContainer; + + [BackgroundDependencyLoader] + private void load() + { + Size = new Vector2(SIZE); + + const float ring_width = 20; + const float light_padding = 3; + + InternalChild = scaleContainer = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + outerCircle = new Circle + { + RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Background3 + }, + new CircularContainer + { + RelativeSizeAxes = Axes.Both, + Name = "outer masking", + Masking = true, + BorderThickness = light_padding, + BorderColour = colourProvider.Background3, + Children = new Drawable[] + { + new Box + { + Colour = Color4.Black, + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true, + }, + } + }, + innerCircle = new CircularContainer + { + Size = new Vector2(SIZE - ring_width + light_padding), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Masking = true, + BorderThickness = light_padding, + BorderColour = colourProvider.Background3, + Children = new Drawable[] + { + new Box + { + Colour = colourProvider.Background2, + RelativeSizeAxes = Axes.Both, + AlwaysPresent = true, + }, + } + }, + hoverLayer = new Circle + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White.Opacity(0.01f), + Blending = BlendingParameters.Additive, + Alpha = 0, + }, + } + }; + } + + protected override bool OnHover(HoverEvent e) + { + hoverLayer.FadeIn(500, Easing.OutQuint); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + hoverLayer.FadeOut(500, Easing.OutQuint); + base.OnHoverLost(e); + } + + protected override bool OnMouseDown(MouseDownEvent e) + { + scaleContainer.ScaleTo(0.98f, 200, Easing.OutQuint); + innerCircle.ScaleTo(0.95f, 200, Easing.OutQuint); + return base.OnMouseDown(e); + } + + protected override void OnMouseUp(MouseUpEvent e) + { + scaleContainer.ScaleTo(1, 1200, Easing.OutQuint); + innerCircle.ScaleTo(1, 1200, Easing.OutQuint); + base.OnMouseUp(e); + } + } +} diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index 990f8d2ce0..20d6c656ff 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -50,6 +50,7 @@ namespace osu.Game.Screens.Edit.Timing new Dimension(GridSizeMode.Absolute, 200), new Dimension(GridSizeMode.Absolute, 60), new Dimension(GridSizeMode.Absolute, 60), + new Dimension(GridSizeMode.Absolute, 120), }, Content = new[] { @@ -141,6 +142,14 @@ namespace osu.Game.Screens.Edit.Timing } } }, + }, + new Drawable[] + { + new TapButton + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + } } } }, From c3ba7b2c3beef436f9a03b4210ff3181e9d79a4d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 19:45:11 +0900 Subject: [PATCH 1363/2328] Add lights --- osu.Game/Screens/Edit/Timing/TapButton.cs | 150 +++++++++++++++++++--- 1 file changed, 132 insertions(+), 18 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index 59ec966fe0..3eb8e23bad 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -6,7 +6,10 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; using osu.Game.Overlays; using osuTK; using osuTK.Graphics; @@ -21,17 +24,23 @@ namespace osu.Game.Screens.Edit.Timing private OverlayColourProvider colourProvider { get; set; } private Circle hoverLayer; + private CircularContainer innerCircle; - private Circle outerCircle; + private Box innerCircleHighlight; + + private int currentLight; private Container scaleContainer; + private Container lights; + + private const int light_count = 6; [BackgroundDependencyLoader] private void load() { Size = new Vector2(SIZE); - const float ring_width = 20; + const float ring_width = 18; const float light_padding = 3; InternalChild = scaleContainer = new Container @@ -41,11 +50,15 @@ namespace osu.Game.Screens.Edit.Timing RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - outerCircle = new Circle + new Circle { RelativeSizeAxes = Axes.Both, Colour = colourProvider.Background3 }, + lights = new Container + { + RelativeSizeAxes = Axes.Both, + }, new CircularContainer { RelativeSizeAxes = Axes.Both, @@ -64,35 +77,65 @@ namespace osu.Game.Screens.Edit.Timing }, } }, + new Circle + { + Size = new Vector2(SIZE - ring_width * 2 + light_padding * 2), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Colour = colourProvider.Background3, + }, innerCircle = new CircularContainer { - Size = new Vector2(SIZE - ring_width + light_padding), + Size = new Vector2(SIZE - ring_width * 2), Anchor = Anchor.Centre, Origin = Anchor.Centre, Masking = true, - BorderThickness = light_padding, - BorderColour = colourProvider.Background3, Children = new Drawable[] { new Box { Colour = colourProvider.Background2, RelativeSizeAxes = Axes.Both, - AlwaysPresent = true, + }, + innerCircleHighlight = new Box + { + Colour = colourProvider.Colour3, + Blending = BlendingParameters.Additive, + RelativeSizeAxes = Axes.Both, + Alpha = 0, + }, + new OsuSpriteText + { + Font = OsuFont.Torus.With(size: 20), + Colour = colourProvider.Background1, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "Tap!" + }, + hoverLayer = new Circle + { + RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Background1.Opacity(0.3f), + Blending = BlendingParameters.Additive, + Alpha = 0, }, } }, - hoverLayer = new Circle - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.White.Opacity(0.01f), - Blending = BlendingParameters.Additive, - Alpha = 0, - }, } }; + + for (int i = 0; i < light_count; i++) + { + lights.Add(new Light + { + Rotation = i * (360f / light_count) + }); + } } + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => + hoverLayer.ReceivePositionalInputAt(screenSpacePos); + protected override bool OnHover(HoverEvent e) { hoverLayer.FadeIn(500, Easing.OutQuint); @@ -107,16 +150,87 @@ namespace osu.Game.Screens.Edit.Timing protected override bool OnMouseDown(MouseDownEvent e) { - scaleContainer.ScaleTo(0.98f, 200, Easing.OutQuint); - innerCircle.ScaleTo(0.95f, 200, Easing.OutQuint); + const double in_duration = 100; + + scaleContainer.ScaleTo(0.99f, in_duration, Easing.OutQuint); + innerCircle.ScaleTo(0.96f, in_duration, Easing.OutQuint); + + innerCircleHighlight + .FadeIn(50, Easing.OutQuint) + .FlashColour(Color4.White, 1000, Easing.OutQuint); + + lights[currentLight % light_count].Hide(); + lights[(currentLight + light_count / 2) % light_count].Hide(); + + currentLight++; + + lights[currentLight % light_count].Show(); + lights[(currentLight + light_count / 2) % light_count].Show(); + return base.OnMouseDown(e); } protected override void OnMouseUp(MouseUpEvent e) { - scaleContainer.ScaleTo(1, 1200, Easing.OutQuint); - innerCircle.ScaleTo(1, 1200, Easing.OutQuint); + const double out_duration = 800; + + scaleContainer.ScaleTo(1, out_duration, Easing.OutQuint); + innerCircle.ScaleTo(1, out_duration, Easing.OutQuint); + innerCircleHighlight.FadeOut(out_duration, Easing.OutQuint); base.OnMouseUp(e); } + + private class Light : CompositeDrawable + { + private CircularProgress fill; + + [Resolved] + private OverlayColourProvider colourProvider { get; set; } + + [BackgroundDependencyLoader] + private void load() + { + RelativeSizeAxes = Axes.Both; + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + InternalChildren = new Drawable[] + { + new CircularProgress + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(0.99f), + Current = { Value = 1f / light_count - 0.01f }, + Colour = colourProvider.Background2, + }, + fill = new CircularProgress + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Alpha = 0, + Size = new Vector2(0.99f), + Current = { Value = 1f / light_count - 0.01f }, + Colour = colourProvider.Colour1, + Blending = BlendingParameters.Additive + }, + }; + } + + public override void Show() + { + fill + .FadeIn(50, Easing.OutQuint) + .FlashColour(Color4.White, 1000, Easing.OutQuint); + } + + public override void Hide() + { + fill + .FadeOut(300, Easing.OutQuint); + } + } } } From 3c7a04256fda8041f4e8e5b51a4a2ba8050cb345 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 20:04:44 +0900 Subject: [PATCH 1364/2328] Add glow --- osu.Game/Screens/Edit/Timing/TapButton.cs | 62 +++++++++++++++++------ 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index 3eb8e23bad..f7a5a0ca7b 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; @@ -32,6 +33,8 @@ namespace osu.Game.Screens.Edit.Timing private Container scaleContainer; private Container lights; + private Container lightsGlow; + private OsuSpriteText text; private const int light_count = 6; @@ -79,11 +82,16 @@ namespace osu.Game.Screens.Edit.Timing }, new Circle { + Name = "inner masking", Size = new Vector2(SIZE - ring_width * 2 + light_padding * 2), Anchor = Anchor.Centre, Origin = Anchor.Centre, Colour = colourProvider.Background3, }, + lightsGlow = new Container + { + RelativeSizeAxes = Axes.Both, + }, innerCircle = new CircularContainer { Size = new Vector2(SIZE - ring_width * 2), @@ -104,7 +112,7 @@ namespace osu.Game.Screens.Edit.Timing RelativeSizeAxes = Axes.Both, Alpha = 0, }, - new OsuSpriteText + text = new OsuSpriteText { Font = OsuFont.Torus.With(size: 20), Colour = colourProvider.Background1, @@ -126,10 +134,13 @@ namespace osu.Game.Screens.Edit.Timing for (int i = 0; i < light_count; i++) { - lights.Add(new Light + var light = new Light { Rotation = i * (360f / light_count) - }); + }; + + lights.Add(light); + lightsGlow.Add(light.Glow.CreateProxy()); } } @@ -152,6 +163,8 @@ namespace osu.Game.Screens.Edit.Timing { const double in_duration = 100; + text.FadeColour(colourProvider.Background4, in_duration, Easing.OutQuint); + scaleContainer.ScaleTo(0.99f, in_duration, Easing.OutQuint); innerCircle.ScaleTo(0.96f, in_duration, Easing.OutQuint); @@ -174,6 +187,8 @@ namespace osu.Game.Screens.Edit.Timing { const double out_duration = 800; + text.FadeColour(colourProvider.Background1, out_duration, Easing.OutQuint); + scaleContainer.ScaleTo(1, out_duration, Easing.OutQuint); innerCircle.ScaleTo(1, out_duration, Easing.OutQuint); innerCircleHighlight.FadeOut(out_duration, Easing.OutQuint); @@ -182,7 +197,9 @@ namespace osu.Game.Screens.Edit.Timing private class Light : CompositeDrawable { - private CircularProgress fill; + public Drawable Glow { get; private set; } + + private Container fillContent; [Resolved] private OverlayColourProvider colourProvider { get; set; } @@ -194,41 +211,56 @@ namespace osu.Game.Screens.Edit.Timing Anchor = Anchor.Centre; Origin = Anchor.Centre; + Size = new Vector2(0.98f); // Avoid bleed into masking edge. + InternalChildren = new Drawable[] { new CircularProgress { RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(0.99f), Current = { Value = 1f / light_count - 0.01f }, Colour = colourProvider.Background2, }, - fill = new CircularProgress + fillContent = new Container { RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, Alpha = 0, - Size = new Vector2(0.99f), - Current = { Value = 1f / light_count - 0.01f }, Colour = colourProvider.Colour1, - Blending = BlendingParameters.Additive + Children = new[] + { + new CircularProgress + { + RelativeSizeAxes = Axes.Both, + Current = { Value = 1f / light_count - 0.01f }, + Blending = BlendingParameters.Additive + }, + Glow = new CircularProgress + { + RelativeSizeAxes = Axes.Both, + Current = { Value = 1f / light_count - 0.01f }, + Blending = BlendingParameters.Additive + }.WithEffect(new GlowEffect + { + Colour = colourProvider.Colour1.Opacity(0.4f), + BlurSigma = new Vector2(9f), + Strength = 10, + PadExtent = true + }), + } }, }; } public override void Show() { - fill + fillContent .FadeIn(50, Easing.OutQuint) .FlashColour(Color4.White, 1000, Easing.OutQuint); } public override void Hide() { - fill + fillContent .FadeOut(300, Easing.OutQuint); } } From a2d177d7d258cba760086a59a413584367ff7efd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 20:37:02 +0900 Subject: [PATCH 1365/2328] Add BPM display and tracking --- osu.Game/Screens/Edit/Timing/TapButton.cs | 109 +++++++++++++++++++--- 1 file changed, 98 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index f7a5a0ca7b..9c6dde4ffe 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -1,14 +1,19 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Collections.Generic; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; +using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Overlays; @@ -34,7 +39,12 @@ namespace osu.Game.Screens.Edit.Timing private Container scaleContainer; private Container lights; private Container lightsGlow; - private OsuSpriteText text; + private OsuSpriteText bpmText; + private Container textContainer; + + private bool grabbedMouseDown; + + private ScheduledDelegate resetDelegate; private const int light_count = 6; @@ -65,7 +75,7 @@ namespace osu.Game.Screens.Edit.Timing new CircularContainer { RelativeSizeAxes = Axes.Both, - Name = "outer masking", + Name = @"outer masking", Masking = true, BorderThickness = light_padding, BorderColour = colourProvider.Background3, @@ -82,7 +92,7 @@ namespace osu.Game.Screens.Edit.Timing }, new Circle { - Name = "inner masking", + Name = @"inner masking", Size = new Vector2(SIZE - ring_width * 2 + light_padding * 2), Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -112,13 +122,27 @@ namespace osu.Game.Screens.Edit.Timing RelativeSizeAxes = Axes.Both, Alpha = 0, }, - text = new OsuSpriteText + textContainer = new Container { - Font = OsuFont.Torus.With(size: 20), + RelativeSizeAxes = Axes.Both, Colour = colourProvider.Background1, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Text = "Tap!" + Children = new Drawable[] + { + new OsuSpriteText + { + Font = OsuFont.Torus.With(size: 20), + Anchor = Anchor.Centre, + Origin = Anchor.BottomCentre, + Y = 3, + Text = "Tap" + }, + bpmText = new OsuSpriteText + { + Font = OsuFont.Torus.With(size: 14), + Anchor = Anchor.Centre, + Origin = Anchor.TopCentre, + }, + } }, hoverLayer = new Circle { @@ -142,20 +166,38 @@ namespace osu.Game.Screens.Edit.Timing lights.Add(light); lightsGlow.Add(light.Glow.CreateProxy()); } + + reset(); } public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => hoverLayer.ReceivePositionalInputAt(screenSpacePos); + private ColourInfo textColour + { + get + { + if (grabbedMouseDown) + return colourProvider.Background4; + + if (IsHovered) + return colourProvider.Content2; + + return colourProvider.Background1; + } + } + protected override bool OnHover(HoverEvent e) { hoverLayer.FadeIn(500, Easing.OutQuint); + textContainer.FadeColour(textColour, 500, Easing.OutQuint); return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { hoverLayer.FadeOut(500, Easing.OutQuint); + textContainer.FadeColour(textColour, 500, Easing.OutQuint); base.OnHoverLost(e); } @@ -163,7 +205,14 @@ namespace osu.Game.Screens.Edit.Timing { const double in_duration = 100; - text.FadeColour(colourProvider.Background4, in_duration, Easing.OutQuint); + grabbedMouseDown = true; + + handleTap(); + + resetDelegate?.Cancel(); + resetDelegate = Scheduler.AddDelayed(reset, 1000); + + textContainer.FadeColour(textColour, in_duration, Easing.OutQuint); scaleContainer.ScaleTo(0.99f, in_duration, Easing.OutQuint); innerCircle.ScaleTo(0.96f, in_duration, Easing.OutQuint); @@ -180,14 +229,16 @@ namespace osu.Game.Screens.Edit.Timing lights[currentLight % light_count].Show(); lights[(currentLight + light_count / 2) % light_count].Show(); - return base.OnMouseDown(e); + return true; } protected override void OnMouseUp(MouseUpEvent e) { const double out_duration = 800; - text.FadeColour(colourProvider.Background1, out_duration, Easing.OutQuint); + grabbedMouseDown = false; + + textContainer.FadeColour(textColour, out_duration, Easing.OutQuint); scaleContainer.ScaleTo(1, out_duration, Easing.OutQuint); innerCircle.ScaleTo(1, out_duration, Easing.OutQuint); @@ -195,6 +246,42 @@ namespace osu.Game.Screens.Edit.Timing base.OnMouseUp(e); } + private readonly List tapTimings = new List(); + + private void reset() + { + bpmText.FadeOut(500, Easing.OutQuint); + + using (BeginDelayedSequence(tapTimings.Count > 0 ? 500 : 0)) + { + Schedule(() => bpmText.Text = "the beat!"); + bpmText.FadeIn(800, Easing.OutQuint); + } + + foreach (var light in lights) + light.Hide(); + + tapTimings.Clear(); + } + + private void handleTap() + { + tapTimings.Add(Clock.CurrentTime); + + if (tapTimings.Count > 8) + tapTimings.RemoveAt(0); + + if (tapTimings.Count < 5) + { + bpmText.Text = new string('.', tapTimings.Count); + return; + } + + double bpm = Math.Round(60000 / ((tapTimings.Last() - tapTimings.First()) / (tapTimings.Count - 1))); + + bpmText.Text = $"{bpm} BPM"; + } + private class Light : CompositeDrawable { public Drawable Glow { get; private set; } From d47a3bb8e4948aefff1d8d07e965eac729455cf6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 20:44:05 +0900 Subject: [PATCH 1366/2328] Use NRT and transfer BPM --- osu.Game/Screens/Edit/Timing/TapButton.cs | 41 ++++++++++++++++------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index 9c6dde4ffe..d85edb6cce 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -1,10 +1,13 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -14,6 +17,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Framework.Threading; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Overlays; @@ -27,24 +31,27 @@ namespace osu.Game.Screens.Edit.Timing public const float SIZE = 100; [Resolved] - private OverlayColourProvider colourProvider { get; set; } + private OverlayColourProvider colourProvider { get; set; } = null!; - private Circle hoverLayer; + [Resolved(canBeNull: true)] + private Bindable? selectedGroup { get; set; } - private CircularContainer innerCircle; - private Box innerCircleHighlight; + private Circle hoverLayer = null!; + + private CircularContainer innerCircle = null!; + private Box innerCircleHighlight = null!; private int currentLight; - private Container scaleContainer; - private Container lights; - private Container lightsGlow; - private OsuSpriteText bpmText; - private Container textContainer; + private Container scaleContainer = null!; + private Container lights = null!; + private Container lightsGlow = null!; + private OsuSpriteText bpmText = null!; + private Container textContainer = null!; private bool grabbedMouseDown; - private ScheduledDelegate resetDelegate; + private ScheduledDelegate? resetDelegate; private const int light_count = 6; @@ -280,16 +287,24 @@ namespace osu.Game.Screens.Edit.Timing double bpm = Math.Round(60000 / ((tapTimings.Last() - tapTimings.First()) / (tapTimings.Count - 1))); bpmText.Text = $"{bpm} BPM"; + + var timingPoint = selectedGroup?.Value.ControlPoints.OfType().FirstOrDefault(); + + if (timingPoint != null) + { + // Intentionally use the rounded BPM here. + timingPoint.BeatLength = 60000 / bpm; + } } private class Light : CompositeDrawable { - public Drawable Glow { get; private set; } + public Drawable Glow { get; private set; } = null!; - private Container fillContent; + private Container fillContent = null!; [Resolved] - private OverlayColourProvider colourProvider { get; set; } + private OverlayColourProvider colourProvider { get; set; } = null!; [BackgroundDependencyLoader] private void load() From 96ccd29bdc9d2372abdca8fe1a8ba284e87ceb3c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 20:48:06 +0900 Subject: [PATCH 1367/2328] Don't play metronome click when tapping for timing --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 5 +++++ osu.Game/Screens/Edit/Timing/TapButton.cs | 4 ++++ osu.Game/Screens/Edit/Timing/TapTimingControl.cs | 12 +++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 4143c5ea55..2ecd66a05f 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -38,6 +38,8 @@ namespace osu.Game.Screens.Edit.Timing [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } + public bool EnableClicking { get; set; } = true; + [BackgroundDependencyLoader] private void load(AudioManager audio) { @@ -281,6 +283,9 @@ namespace osu.Game.Screens.Edit.Timing Schedule(() => { + if (!EnableClicking) + return; + var channel = clunk?.GetChannel(); if (channel != null) diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index d85edb6cce..fb5580c6ac 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -30,6 +30,8 @@ namespace osu.Game.Screens.Edit.Timing { public const float SIZE = 100; + public readonly BindableBool IsHandlingTapping = new BindableBool(); + [Resolved] private OverlayColourProvider colourProvider { get; set; } = null!; @@ -213,6 +215,7 @@ namespace osu.Game.Screens.Edit.Timing const double in_duration = 100; grabbedMouseDown = true; + IsHandlingTapping.Value = true; handleTap(); @@ -269,6 +272,7 @@ namespace osu.Game.Screens.Edit.Timing light.Hide(); tapTimings.Clear(); + IsHandlingTapping.Value = false; } private void handleTap() diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index 20d6c656ff..16e9f703c8 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -25,6 +25,10 @@ namespace osu.Game.Screens.Edit.Timing [Resolved] private Bindable selectedGroup { get; set; } + private readonly BindableBool isHandlingTapping = new BindableBool(); + + private MetronomeDisplay metronome; + [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider, OsuColour colours) { @@ -73,7 +77,7 @@ namespace osu.Game.Screens.Edit.Timing { new Drawable[] { - new MetronomeDisplay + metronome = new MetronomeDisplay { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, @@ -149,11 +153,17 @@ namespace osu.Game.Screens.Edit.Timing { Anchor = Anchor.Centre, Origin = Anchor.Centre, + IsHandlingTapping = { BindTarget = isHandlingTapping } } } } }, }; + + isHandlingTapping.BindValueChanged(handling => + { + metronome.EnableClicking = !handling.NewValue; + }, true); } private void adjustOffset(double adjust) From b88bce9b8baf47dc54b27e041d9a51c41e672dfc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 20:57:16 +0900 Subject: [PATCH 1368/2328] Restart track playback when tapping to time --- osu.Game/Screens/Edit/Timing/TapTimingControl.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index 16e9f703c8..6640eeaa38 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -163,6 +163,12 @@ namespace osu.Game.Screens.Edit.Timing isHandlingTapping.BindValueChanged(handling => { metronome.EnableClicking = !handling.NewValue; + + if (handling.NewValue) + { + editorClock.Seek(selectedGroup.Value.Time); + editorClock.Start(); + } }, true); } From f3f7e28353d340b916a2d4ba7735e21de3c51c16 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 20:57:24 +0900 Subject: [PATCH 1369/2328] Ignore initial taps as they are generally inaccurate --- osu.Game/Screens/Edit/Timing/TapButton.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index fb5580c6ac..65f31f4396 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -275,20 +275,23 @@ namespace osu.Game.Screens.Edit.Timing IsHandlingTapping.Value = false; } + private const int initial_taps_to_ignore = 4; + private const int max_taps_to_consider = 8; + private void handleTap() { tapTimings.Add(Clock.CurrentTime); - if (tapTimings.Count > 8) + if (tapTimings.Count > initial_taps_to_ignore + max_taps_to_consider) tapTimings.RemoveAt(0); - if (tapTimings.Count < 5) + if (tapTimings.Count < initial_taps_to_ignore * 2) { bpmText.Text = new string('.', tapTimings.Count); return; } - double bpm = Math.Round(60000 / ((tapTimings.Last() - tapTimings.First()) / (tapTimings.Count - 1))); + double bpm = Math.Round(60000 / ((tapTimings.Last() - tapTimings.Skip(initial_taps_to_ignore).First()) / (tapTimings.Count - initial_taps_to_ignore - 1))); bpmText.Text = $"{bpm} BPM"; From d4e88441eceabfd2fce25cfb268836e896c5473d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 22:00:34 +0900 Subject: [PATCH 1370/2328] Adjust metrics to make timing section fit better in editor --- osu.Game/Screens/Edit/Timing/GroupSection.cs | 2 +- osu.Game/Screens/Edit/Timing/Section.cs | 2 +- osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/GroupSection.cs b/osu.Game/Screens/Edit/Timing/GroupSection.cs index bb2dd35a9c..f613488aae 100644 --- a/osu.Game/Screens/Edit/Timing/GroupSection.cs +++ b/osu.Game/Screens/Edit/Timing/GroupSection.cs @@ -37,7 +37,7 @@ namespace osu.Game.Screens.Edit.Timing RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - Padding = new MarginPadding(10); + Padding = new MarginPadding(10) { Bottom = 0 }; InternalChildren = new Drawable[] { diff --git a/osu.Game/Screens/Edit/Timing/Section.cs b/osu.Game/Screens/Edit/Timing/Section.cs index 139abfb187..17147c21f4 100644 --- a/osu.Game/Screens/Edit/Timing/Section.cs +++ b/osu.Game/Screens/Edit/Timing/Section.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Edit.Timing { Flow = new FillFlowContainer { - Padding = new MarginPadding(20), + Padding = new MarginPadding(10) { Top = 0 }, Spacing = new Vector2(20), RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs b/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs index 9fc7e56a3d..eecd85fbca 100644 --- a/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs +++ b/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs @@ -187,7 +187,7 @@ namespace osu.Game.Screens.Edit.Timing Origin = direction, Font = OsuFont.Default.With(size: 10, weight: FontWeight.Bold), Text = $"{(index > 0 ? "+" : "-")}{Math.Abs(Multiplier * amount)}", - Padding = new MarginPadding(5), + Padding = new MarginPadding(2), Alpha = 0, } }; From 781a1527b10e8c5d846b335e2961d1749aa2c995 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 22:00:54 +0900 Subject: [PATCH 1371/2328] Adjust button metrics and move surrounding buttons to be more integrated --- osu.Game/Screens/Edit/Timing/TapButton.cs | 27 +-- .../Screens/Edit/Timing/TapTimingControl.cs | 159 +++++++++++++----- 2 files changed, 130 insertions(+), 56 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index 65f31f4396..d18f65c2eb 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Edit.Timing { internal class TapButton : CircularContainer { - public const float SIZE = 100; + public const float SIZE = 140; public readonly BindableBool IsHandlingTapping = new BindableBool(); @@ -62,7 +62,7 @@ namespace osu.Game.Screens.Edit.Timing { Size = new Vector2(SIZE); - const float ring_width = 18; + const float ring_width = 22; const float light_padding = 3; InternalChild = scaleContainer = new Container @@ -75,7 +75,7 @@ namespace osu.Game.Screens.Edit.Timing new Circle { RelativeSizeAxes = Axes.Both, - Colour = colourProvider.Background3 + Colour = colourProvider.Background4 }, lights = new Container { @@ -87,7 +87,7 @@ namespace osu.Game.Screens.Edit.Timing Name = @"outer masking", Masking = true, BorderThickness = light_padding, - BorderColour = colourProvider.Background3, + BorderColour = colourProvider.Background4, Children = new Drawable[] { new Box @@ -105,7 +105,7 @@ namespace osu.Game.Screens.Edit.Timing Size = new Vector2(SIZE - ring_width * 2 + light_padding * 2), Anchor = Anchor.Centre, Origin = Anchor.Centre, - Colour = colourProvider.Background3, + Colour = colourProvider.Background4, }, lightsGlow = new Container { @@ -139,17 +139,18 @@ namespace osu.Game.Screens.Edit.Timing { new OsuSpriteText { - Font = OsuFont.Torus.With(size: 20), + Font = OsuFont.Torus.With(size: 34, weight: FontWeight.SemiBold), Anchor = Anchor.Centre, Origin = Anchor.BottomCentre, - Y = 3, - Text = "Tap" + Y = 5, + Text = "Tap", }, bpmText = new OsuSpriteText { - Font = OsuFont.Torus.With(size: 14), + Font = OsuFont.Torus.With(size: 23, weight: FontWeight.Regular), Anchor = Anchor.Centre, Origin = Anchor.TopCentre, + Y = -1, }, } }, @@ -200,7 +201,7 @@ namespace osu.Game.Screens.Edit.Timing { hoverLayer.FadeIn(500, Easing.OutQuint); textContainer.FadeColour(textColour, 500, Easing.OutQuint); - return base.OnHover(e); + return true; } protected override void OnHoverLost(HoverLostEvent e) @@ -322,12 +323,14 @@ namespace osu.Game.Screens.Edit.Timing Size = new Vector2(0.98f); // Avoid bleed into masking edge. + const float angular_gap = 0.007f; + InternalChildren = new Drawable[] { new CircularProgress { RelativeSizeAxes = Axes.Both, - Current = { Value = 1f / light_count - 0.01f }, + Current = { Value = 1f / light_count - angular_gap }, Colour = colourProvider.Background2, }, fillContent = new Container @@ -340,7 +343,7 @@ namespace osu.Game.Screens.Edit.Timing new CircularProgress { RelativeSizeAxes = Axes.Both, - Current = { Value = 1f / light_count - 0.01f }, + Current = { Value = 1f / light_count - angular_gap }, Blending = BlendingParameters.Additive }, Glow = new CircularProgress diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index 6640eeaa38..f8975c5b11 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -7,10 +7,14 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Events; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays; +using osuTK; namespace osu.Game.Screens.Edit.Timing { @@ -32,6 +36,8 @@ namespace osu.Game.Screens.Edit.Timing [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider, OsuColour colours) { + const float padding = 10; + RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; @@ -52,9 +58,8 @@ namespace osu.Game.Screens.Edit.Timing RowDimensions = new[] { new Dimension(GridSizeMode.Absolute, 200), - new Dimension(GridSizeMode.Absolute, 60), - new Dimension(GridSizeMode.Absolute, 60), - new Dimension(GridSizeMode.Absolute, 120), + new Dimension(GridSizeMode.Absolute, 50), + new Dimension(GridSizeMode.Absolute, TapButton.SIZE + padding), }, Content = new[] { @@ -63,6 +68,7 @@ namespace osu.Game.Screens.Edit.Timing new Container { RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(padding), Children = new Drawable[] { new GridContainer @@ -94,15 +100,14 @@ namespace osu.Game.Screens.Edit.Timing new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding(10), + Padding = new MarginPadding { Bottom = padding, Horizontal = padding }, Children = new Drawable[] { new TimingAdjustButton(1) { Text = "Offset", - RelativeSizeAxes = Axes.X, - Width = 0.48f, - Height = 50, + RelativeSizeAxes = Axes.Both, + Size = new Vector2(0.48f, 1), Action = adjustOffset, }, new TimingAdjustButton(0.1) @@ -110,9 +115,8 @@ namespace osu.Game.Screens.Edit.Timing Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Text = "BPM", - RelativeSizeAxes = Axes.X, - Width = 0.48f, - Height = 50, + RelativeSizeAxes = Axes.Both, + Size = new Vector2(0.48f, 1), Action = adjustBpm, } } @@ -123,39 +127,47 @@ namespace osu.Game.Screens.Edit.Timing new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding(10), + Padding = new MarginPadding { Bottom = padding, Horizontal = padding }, Children = new Drawable[] { - new RoundedButton + new Container { - Text = "Reset", - BackgroundColour = colours.Pink, - RelativeSizeAxes = Axes.X, - Width = 0.3f, - Action = reset, + RelativeSizeAxes = Axes.Y, + Anchor = Anchor.Centre, + Origin = Anchor.CentreRight, + Height = 0.98f, + Width = TapButton.SIZE / 1.3f, + Masking = true, + CornerRadius = 15, + Children = new Drawable[] + { + new LessRoundedButton(FontAwesome.Solid.Stop, Anchor.TopLeft) + { + BackgroundColour = colourProvider.Background1, + RelativeSizeAxes = Axes.Both, + Height = 0.49f, + Action = reset, + }, + new LessRoundedButton(FontAwesome.Solid.Play, Anchor.BottomLeft) + { + BackgroundColour = colourProvider.Background1, + RelativeSizeAxes = Axes.Both, + Height = 0.49f, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Action = start, + }, + }, }, - new RoundedButton + new TapButton { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Text = "Play from start", - RelativeSizeAxes = Axes.X, - BackgroundColour = colourProvider.Background1, - Width = 0.68f, - Action = tap, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + IsHandlingTapping = { BindTarget = isHandlingTapping } } } }, }, - new Drawable[] - { - new TapButton - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - IsHandlingTapping = { BindTarget = isHandlingTapping } - } - } } }, }; @@ -165,13 +177,78 @@ namespace osu.Game.Screens.Edit.Timing metronome.EnableClicking = !handling.NewValue; if (handling.NewValue) - { - editorClock.Seek(selectedGroup.Value.Time); - editorClock.Start(); - } + start(); }, true); } + private class LessRoundedButton : OsuButton + { + private readonly IconUsage icon; + private readonly Anchor anchor; + + private SpriteIcon spriteIcon; + + public LessRoundedButton(IconUsage icon, Anchor anchor) + { + this.icon = icon; + this.anchor = anchor; + } + + [Resolved] + private OverlayColourProvider colourProvider { get; set; } + + protected override void LoadComplete() + { + base.LoadComplete(); + + Content.CornerRadius = 0; + Content.Masking = false; + + BackgroundColour = colourProvider.Background2; + + Content.Add(new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(15), + Children = new Drawable[] + { + spriteIcon = new SpriteIcon + { + Icon = icon, + Size = new Vector2(22), + Anchor = anchor, + Origin = anchor, + Colour = colourProvider.Background1, + }, + } + }); + } + + protected override bool OnMouseDown(MouseDownEvent e) + { + // scale looks bad so don't call base. + return false; + } + + protected override bool OnHover(HoverEvent e) + { + spriteIcon.FadeColour(colourProvider.Content2, 200, Easing.OutQuint); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + spriteIcon.FadeColour(colourProvider.Background1, 200, Easing.OutQuint); + base.OnHoverLost(e); + } + } + + private void start() + { + editorClock.Seek(selectedGroup.Value.Time); + editorClock.Start(); + } + private void adjustOffset(double adjust) { // VERY TEMPORARY @@ -201,12 +278,6 @@ namespace osu.Game.Screens.Edit.Timing timing.BeatLength = 60000 / (timing.BPM + adjust); } - private void tap() - { - editorClock.Seek(selectedGroup.Value.Time); - editorClock.Start(); - } - private void reset() { editorClock.Stop(); From 0c493dd3592f96abd63f3390bb1160f9a99ecf6d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 12:27:11 +0900 Subject: [PATCH 1372/2328] Add key binding for tap button --- .../Input/Bindings/GlobalActionContainer.cs | 4 +++ .../GlobalActionKeyBindingStrings.cs | 5 ++++ osu.Game/Screens/Edit/Timing/TapButton.cs | 25 +++++++++++++++++-- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index 69ea6b00ca..3da5f3212e 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -80,6 +80,7 @@ namespace osu.Game.Input.Bindings new KeyBinding(new[] { InputKey.K }, GlobalAction.EditorNudgeRight), new KeyBinding(new[] { InputKey.G }, GlobalAction.EditorCycleGridDisplayMode), new KeyBinding(new[] { InputKey.F5 }, GlobalAction.EditorTestGameplay), + new KeyBinding(new[] { InputKey.T }, GlobalAction.EditorTapForBPM), new KeyBinding(new[] { InputKey.Control, InputKey.H }, GlobalAction.EditorFlipHorizontally), new KeyBinding(new[] { InputKey.Control, InputKey.J }, GlobalAction.EditorFlipVertically), new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.MouseWheelDown }, GlobalAction.EditorDecreaseDistanceSpacing), @@ -322,5 +323,8 @@ namespace osu.Game.Input.Bindings [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.DeselectAllMods))] DeselectAllMods, + + [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorTapForBPM))] + EditorTapForBPM, } } diff --git a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs index e392ae619f..586e29a432 100644 --- a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs +++ b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs @@ -174,6 +174,11 @@ namespace osu.Game.Localisation /// public static LocalisableString EditorTimingMode => new TranslatableString(getKey(@"editor_timing_mode"), @"Timing mode"); + /// + /// "Tap for BPM" + /// + public static LocalisableString EditorTapForBPM => new TranslatableString(getKey(@"editor_tap_for_bpm"), @"Tap for BPM"); + /// /// "Cycle grid display mode" /// diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index d18f65c2eb..614e7aecde 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -15,18 +15,21 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Framework.Threading; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Input.Bindings; using osu.Game.Overlays; using osuTK; using osuTK.Graphics; +using osuTK.Input; namespace osu.Game.Screens.Edit.Timing { - internal class TapButton : CircularContainer + internal class TapButton : CircularContainer, IKeyBindingHandler { public const float SIZE = 140; @@ -57,6 +60,8 @@ namespace osu.Game.Screens.Edit.Timing private const int light_count = 6; + private readonly List tapTimings = new List(); + [BackgroundDependencyLoader] private void load() { @@ -257,7 +262,23 @@ namespace osu.Game.Screens.Edit.Timing base.OnMouseUp(e); } - private readonly List tapTimings = new List(); + public bool OnPressed(KeyBindingPressEvent e) + { + if (e.Action == GlobalAction.EditorTapForBPM && !e.Repeat) + { + // Direct through mouse handling to achieve animation + OnMouseDown(new MouseDownEvent(e.CurrentState, MouseButton.Left)); + return true; + } + + return false; + } + + public void OnReleased(KeyBindingReleaseEvent e) + { + if (e.Action == GlobalAction.EditorTapForBPM) + OnMouseUp(new MouseUpEvent(e.CurrentState, MouseButton.Left)); + } private void reset() { From 943e904c71f74feda0765075798140c2370ac46c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 12:55:03 +0900 Subject: [PATCH 1373/2328] Fix reset happening on mouse down instead of mouse up Also some reorganisation of file content for legibility --- osu.Game/Screens/Edit/Timing/TapButton.cs | 49 ++++++++++++----------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index 614e7aecde..7f913e386e 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -60,6 +60,10 @@ namespace osu.Game.Screens.Edit.Timing private const int light_count = 6; + private const int initial_taps_to_ignore = 4; + + private const int max_taps_to_consider = 8; + private readonly List tapTimings = new List(); [BackgroundDependencyLoader] @@ -223,10 +227,9 @@ namespace osu.Game.Screens.Edit.Timing grabbedMouseDown = true; IsHandlingTapping.Value = true; - handleTap(); - resetDelegate?.Cancel(); - resetDelegate = Scheduler.AddDelayed(reset, 1000); + + handleTap(); textContainer.FadeColour(textColour, in_duration, Easing.OutQuint); @@ -259,6 +262,9 @@ namespace osu.Game.Screens.Edit.Timing scaleContainer.ScaleTo(1, out_duration, Easing.OutQuint); innerCircle.ScaleTo(1, out_duration, Easing.OutQuint); innerCircleHighlight.FadeOut(out_duration, Easing.OutQuint); + + resetDelegate = Scheduler.AddDelayed(reset, 1000); + base.OnMouseUp(e); } @@ -280,26 +286,6 @@ namespace osu.Game.Screens.Edit.Timing OnMouseUp(new MouseUpEvent(e.CurrentState, MouseButton.Left)); } - private void reset() - { - bpmText.FadeOut(500, Easing.OutQuint); - - using (BeginDelayedSequence(tapTimings.Count > 0 ? 500 : 0)) - { - Schedule(() => bpmText.Text = "the beat!"); - bpmText.FadeIn(800, Easing.OutQuint); - } - - foreach (var light in lights) - light.Hide(); - - tapTimings.Clear(); - IsHandlingTapping.Value = false; - } - - private const int initial_taps_to_ignore = 4; - private const int max_taps_to_consider = 8; - private void handleTap() { tapTimings.Add(Clock.CurrentTime); @@ -326,6 +312,23 @@ namespace osu.Game.Screens.Edit.Timing } } + private void reset() + { + bpmText.FadeOut(500, Easing.OutQuint); + + using (BeginDelayedSequence(tapTimings.Count > 0 ? 500 : 0)) + { + Schedule(() => bpmText.Text = "the beat!"); + bpmText.FadeIn(800, Easing.OutQuint); + } + + foreach (var light in lights) + light.Hide(); + + tapTimings.Clear(); + IsHandlingTapping.Value = false; + } + private class Light : CompositeDrawable { public Drawable Glow { get; private set; } = null!; From d99d37c0a60c6eb95d43e920331210d4af315d6f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 13:06:18 +0900 Subject: [PATCH 1374/2328] Apply current track rate to calculated BPM --- osu.Game/Screens/Edit/Timing/TapButton.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index 7f913e386e..6b9ac7be5c 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -18,6 +18,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Framework.Threading; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -41,6 +42,9 @@ namespace osu.Game.Screens.Edit.Timing [Resolved(canBeNull: true)] private Bindable? selectedGroup { get; set; } + [Resolved(canBeNull: true)] + private IBeatSyncProvider? beatSyncSource { get; set; } + private Circle hoverLayer = null!; private CircularContainer innerCircle = null!; @@ -299,7 +303,10 @@ namespace osu.Game.Screens.Edit.Timing return; } - double bpm = Math.Round(60000 / ((tapTimings.Last() - tapTimings.Skip(initial_taps_to_ignore).First()) / (tapTimings.Count - initial_taps_to_ignore - 1))); + double averageBeatLength = (tapTimings.Last() - tapTimings.Skip(initial_taps_to_ignore).First()) / (tapTimings.Count - initial_taps_to_ignore - 1); + double clockRate = beatSyncSource?.Clock?.Rate ?? 1; + + double bpm = Math.Round(60000 / averageBeatLength / clockRate); bpmText.Text = $"{bpm} BPM"; From ac3793f340d14cd3a9d0a7b4dc738f3ee6c96f35 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 13:10:50 +0900 Subject: [PATCH 1375/2328] Move inline class to end and apply NRT --- .../Screens/Edit/Timing/TapTimingControl.cs | 108 +++++++++--------- 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index f8975c5b11..9b5574d3cb 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -21,17 +23,17 @@ namespace osu.Game.Screens.Edit.Timing public class TapTimingControl : CompositeDrawable { [Resolved] - private EditorClock editorClock { get; set; } + private EditorClock editorClock { get; set; } = null!; [Resolved] - private EditorBeatmap beatmap { get; set; } + private EditorBeatmap beatmap { get; set; } = null!; [Resolved] - private Bindable selectedGroup { get; set; } + private Bindable selectedGroup { get; set; } = null!; private readonly BindableBool isHandlingTapping = new BindableBool(); - private MetronomeDisplay metronome; + private MetronomeDisplay metronome = null!; [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider, OsuColour colours) @@ -141,14 +143,14 @@ namespace osu.Game.Screens.Edit.Timing CornerRadius = 15, Children = new Drawable[] { - new LessRoundedButton(FontAwesome.Solid.Stop, Anchor.TopLeft) + new InlineButton(FontAwesome.Solid.Stop, Anchor.TopLeft) { BackgroundColour = colourProvider.Background1, RelativeSizeAxes = Axes.Both, Height = 0.49f, Action = reset, }, - new LessRoundedButton(FontAwesome.Solid.Play, Anchor.BottomLeft) + new InlineButton(FontAwesome.Solid.Play, Anchor.BottomLeft) { BackgroundColour = colourProvider.Background1, RelativeSizeAxes = Axes.Both, @@ -181,22 +183,63 @@ namespace osu.Game.Screens.Edit.Timing }, true); } - private class LessRoundedButton : OsuButton + private void start() + { + editorClock.Seek(selectedGroup.Value.Time); + editorClock.Start(); + } + + private void reset() + { + editorClock.Stop(); + editorClock.Seek(selectedGroup.Value.Time); + } + + private void adjustOffset(double adjust) + { + // VERY TEMPORARY + var currentGroupItems = selectedGroup.Value.ControlPoints.ToArray(); + + beatmap.ControlPointInfo.RemoveGroup(selectedGroup.Value); + + double newOffset = selectedGroup.Value.Time + adjust; + + foreach (var cp in currentGroupItems) + beatmap.ControlPointInfo.Add(newOffset, cp); + + // the control point might not necessarily exist yet, if currentGroupItems was empty. + selectedGroup.Value = beatmap.ControlPointInfo.GroupAt(newOffset, true); + + if (!editorClock.IsRunning) + editorClock.Seek(newOffset); + } + + private void adjustBpm(double adjust) + { + var timing = selectedGroup.Value.ControlPoints.OfType().FirstOrDefault(); + + if (timing == null) + return; + + timing.BeatLength = 60000 / (timing.BPM + adjust); + } + + private class InlineButton : OsuButton { private readonly IconUsage icon; private readonly Anchor anchor; - private SpriteIcon spriteIcon; + private SpriteIcon spriteIcon = null!; - public LessRoundedButton(IconUsage icon, Anchor anchor) + [Resolved] + private OverlayColourProvider colourProvider { get; set; } = null!; + + public InlineButton(IconUsage icon, Anchor anchor) { this.icon = icon; this.anchor = anchor; } - [Resolved] - private OverlayColourProvider colourProvider { get; set; } - protected override void LoadComplete() { base.LoadComplete(); @@ -242,46 +285,5 @@ namespace osu.Game.Screens.Edit.Timing base.OnHoverLost(e); } } - - private void start() - { - editorClock.Seek(selectedGroup.Value.Time); - editorClock.Start(); - } - - private void adjustOffset(double adjust) - { - // VERY TEMPORARY - var currentGroupItems = selectedGroup.Value.ControlPoints.ToArray(); - - beatmap.ControlPointInfo.RemoveGroup(selectedGroup.Value); - - double newOffset = selectedGroup.Value.Time + adjust; - - foreach (var cp in currentGroupItems) - beatmap.ControlPointInfo.Add(newOffset, cp); - - // the control point might not necessarily exist yet, if currentGroupItems was empty. - selectedGroup.Value = beatmap.ControlPointInfo.GroupAt(newOffset, true); - - if (!editorClock.IsRunning) - editorClock.Seek(newOffset); - } - - private void adjustBpm(double adjust) - { - var timing = selectedGroup.Value.ControlPoints.OfType().FirstOrDefault(); - - if (timing == null) - return; - - timing.BeatLength = 60000 / (timing.BPM + adjust); - } - - private void reset() - { - editorClock.Stop(); - editorClock.Seek(selectedGroup.Value.Time); - } } } From 15f8d318eb05355d09fce8e457d0bbfb9660377a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 13:13:00 +0900 Subject: [PATCH 1376/2328] Add note about glow code (please look away) --- osu.Game/Screens/Edit/Timing/TapButton.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index 6b9ac7be5c..0cb2ac3d1a 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -377,6 +377,9 @@ namespace osu.Game.Screens.Edit.Timing Current = { Value = 1f / light_count - angular_gap }, Blending = BlendingParameters.Additive }, + // Please do not try and make sense of this. + // Getting the visual effect I was going for relies on what I can only imagine is broken implementation + // of `PadExtent`. If that's ever fixed in the future this will likely need to be adjusted. Glow = new CircularProgress { RelativeSizeAxes = Axes.Both, From 060372a129a4e42fc3d2f67a9118874e3aa13fb3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 13:16:31 +0900 Subject: [PATCH 1377/2328] Split out transition length constants --- osu.Game/Screens/Edit/Timing/TapButton.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index 0cb2ac3d1a..4eeb358066 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -68,6 +68,8 @@ namespace osu.Game.Screens.Edit.Timing private const int max_taps_to_consider = 8; + private const double transition_length = 500; + private readonly List tapTimings = new List(); [BackgroundDependencyLoader] @@ -212,15 +214,15 @@ namespace osu.Game.Screens.Edit.Timing protected override bool OnHover(HoverEvent e) { - hoverLayer.FadeIn(500, Easing.OutQuint); - textContainer.FadeColour(textColour, 500, Easing.OutQuint); + hoverLayer.FadeIn(transition_length, Easing.OutQuint); + textContainer.FadeColour(textColour, transition_length, Easing.OutQuint); return true; } protected override void OnHoverLost(HoverLostEvent e) { - hoverLayer.FadeOut(500, Easing.OutQuint); - textContainer.FadeColour(textColour, 500, Easing.OutQuint); + hoverLayer.FadeOut(transition_length, Easing.OutQuint); + textContainer.FadeColour(textColour, transition_length, Easing.OutQuint); base.OnHoverLost(e); } @@ -265,6 +267,7 @@ namespace osu.Game.Screens.Edit.Timing scaleContainer.ScaleTo(1, out_duration, Easing.OutQuint); innerCircle.ScaleTo(1, out_duration, Easing.OutQuint); + innerCircleHighlight.FadeOut(out_duration, Easing.OutQuint); resetDelegate = Scheduler.AddDelayed(reset, 1000); @@ -321,9 +324,9 @@ namespace osu.Game.Screens.Edit.Timing private void reset() { - bpmText.FadeOut(500, Easing.OutQuint); + bpmText.FadeOut(transition_length, Easing.OutQuint); - using (BeginDelayedSequence(tapTimings.Count > 0 ? 500 : 0)) + using (BeginDelayedSequence(tapTimings.Count > 0 ? transition_length : 0)) { Schedule(() => bpmText.Text = "the beat!"); bpmText.FadeIn(800, Easing.OutQuint); From 600da89f72bcca5668b548896d5a3c9880deb1fd Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 2 Jun 2022 14:22:12 +0900 Subject: [PATCH 1378/2328] Fix disposing previous leaderboard too late --- .../Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs index e94e198a4a..b115fa4ff2 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using NUnit.Framework; +using osu.Framework.Graphics; using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game.Online.API.Requests.Responses; @@ -23,7 +24,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("reset", () => { - Clear(); + leaderboard?.RemoveAndDisposeImmediately(); clocks = new Dictionary { From 793dfe2bc82f6dbff756b08bafe8c024fcee016b Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 2 Jun 2022 14:22:45 +0900 Subject: [PATCH 1379/2328] Mark players as playing --- .../Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs index b115fa4ff2..60215dc8b3 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs @@ -32,10 +32,10 @@ namespace osu.Game.Tests.Visual.Multiplayer { PLAYER_2_ID, new ManualClock() } }; - foreach ((int userId, var _) in clocks) + foreach ((int userId, _) in clocks) { SpectatorClient.SendStartPlay(userId, 0); - OnlinePlayDependencies.MultiplayerClient.AddUser(new APIUser { Id = userId }); + OnlinePlayDependencies.MultiplayerClient.AddUser(new APIUser { Id = userId }, true); } }); From 6fb1fe06a03c56325f0f3d97fbbb8f3912ab79a1 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 2 Jun 2022 14:47:04 +0900 Subject: [PATCH 1380/2328] Remove unnecessary ApplyBeatmap call --- .../Spectator/SpectatorScoreProcessor.cs | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs b/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs index e81cf433a5..634af73c44 100644 --- a/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs +++ b/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs @@ -10,12 +10,8 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Game.Beatmaps; -using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Beatmaps.Timing; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; @@ -109,10 +105,7 @@ namespace osu.Game.Online.Spectator spectatorState = userState; scoreInfo = new ScoreInfo { Ruleset = rulesetInfo }; scoreProcessor = ruleset.CreateScoreProcessor(); - - // Mods are required for score multiplier. scoreProcessor.Mods.Value = userState.Mods.Select(m => m.ToMod(ruleset)).ToArray(); - scoreProcessor.ApplyBeatmap(new DummyBeatmap()); } private void onNewFrames(int incomingUserId, FrameDataBundle bundle) @@ -165,23 +158,6 @@ namespace osu.Game.Online.Spectator spectatorClient.OnNewFrames -= onNewFrames; } - private class DummyBeatmap : IBeatmap - { - public BeatmapInfo BeatmapInfo { get; set; } = new BeatmapInfo(); - public BeatmapMetadata Metadata { get; } = new BeatmapMetadata(); - public BeatmapDifficulty Difficulty { get; set; } = new BeatmapDifficulty(); - public ControlPointInfo ControlPointInfo { get; set; } = new ControlPointInfo(); - public List Breaks { get; } = new List(); - public double TotalBreakTime => 0; - public IReadOnlyList HitObjects => Array.Empty(); - - public IEnumerable GetStatistics() => Array.Empty(); - - public double GetMostCommonBeatLength() => 0; - - public IBeatmap Clone() => throw new NotImplementedException(); - } - private class TimedFrame : IComparable { public readonly double Time; From 2209a009f9dc15f857a16e6580ce904bc796583a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 2 Jun 2022 14:48:55 +0900 Subject: [PATCH 1381/2328] Don't process clock --- .../OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs index 589f5ce988..671f872188 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs @@ -20,6 +20,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate if (!UserScores.TryGetValue(userId, out var data)) throw new ArgumentException(@"Provided user is not tracked by this leaderboard", nameof(userId)); + data.ScoreProcessor.ProcessCustomClock = false; data.ScoreProcessor.Clock = new FramedClock(clock); } From 4d9a77bdc06cc3ea368ff8865f8fdfc710c6098d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 2 Jun 2022 15:02:44 +0900 Subject: [PATCH 1382/2328] Stop using Drawable.Clock altogether --- .../Online/Spectator/SpectatorScoreProcessor.cs | 14 +++++++++++++- .../Spectate/MultiSpectatorLeaderboard.cs | 3 +-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs b/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs index 634af73c44..c1829a7023 100644 --- a/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs +++ b/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs @@ -10,6 +10,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Timing; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; @@ -48,6 +49,17 @@ namespace osu.Game.Online.Spectator /// public IReadOnlyList Mods => scoreProcessor?.Mods.Value ?? Array.Empty(); + private IClock? referenceClock; + + /// + /// The clock used to determine the current score. + /// + public IClock ReferenceClock + { + get => referenceClock ?? Clock; + set => referenceClock = value; + } + [Resolved] private SpectatorClient spectatorClient { get; set; } = null!; @@ -131,7 +143,7 @@ namespace osu.Game.Online.Spectator Debug.Assert(spectatorState != null); Debug.Assert(scoreProcessor != null); - int frameIndex = replayFrames.BinarySearch(new TimedFrame(Time.Current)); + int frameIndex = replayFrames.BinarySearch(new TimedFrame(ReferenceClock.CurrentTime)); if (frameIndex < 0) frameIndex = ~frameIndex; frameIndex = Math.Clamp(frameIndex - 1, 0, replayFrames.Count - 1); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs index 671f872188..4e9ab07e4c 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs @@ -20,8 +20,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate if (!UserScores.TryGetValue(userId, out var data)) throw new ArgumentException(@"Provided user is not tracked by this leaderboard", nameof(userId)); - data.ScoreProcessor.ProcessCustomClock = false; - data.ScoreProcessor.Clock = new FramedClock(clock); + data.ScoreProcessor.ReferenceClock = clock; } protected override void Update() From 5bd9d882195dbe1f1f60032f2456a062a2072501 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 16:34:23 +0900 Subject: [PATCH 1383/2328] Fix tutorial download state not matching correctly when already available locally Closes https://github.com/ppy/osu/issues/18468. This doesn't stop the tutorial from downloading a second time, but at least displays the correct status afterwards. Avoiding the download is a bit more involved and requires a change to the flow. Probably not worth it just yet. To test, recommend switching to production environment, as dev server doesn't have correct metadata for tutorial resulting in weirdness. --- osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs | 2 ++ osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs index 84903d381a..5ebdee0b09 100644 --- a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs +++ b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs @@ -85,6 +85,8 @@ namespace osu.Game.Beatmaps.Drawables downloadTrackers.Add(beatmapDownloadTracker); AddInternal(beatmapDownloadTracker); + // Note that this is downloading the beatmaps even if they are already downloaded. + // We could rely more on `BeatmapDownloadTracker`'s exposed state to avoid this. beatmapDownloader.Download(beatmapSet); } } diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs index 17e04c0c99..ddcee7c040 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs @@ -154,12 +154,15 @@ namespace osu.Game.Overlays.FirstRunSetup var downloadTracker = tutorialDownloader.DownloadTrackers.First(); + downloadTracker.State.BindValueChanged(state => + { + if (state.NewValue == DownloadState.LocallyAvailable) + downloadTutorialButton.Complete(); + }, true); + downloadTracker.Progress.BindValueChanged(progress => { downloadTutorialButton.SetProgress(progress.NewValue, false); - - if (progress.NewValue == 1) - downloadTutorialButton.Complete(); }, true); } From 055845d4f56db74f7840adf74d76cbce1fe6b687 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 2 Jun 2022 16:34:36 +0900 Subject: [PATCH 1384/2328] Throw exception on access before ApplyBeatmap() --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 853f43ddb6..dd977a5c50 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -93,7 +93,18 @@ namespace osu.Game.Rulesets.Scoring /// /// Scoring values for a perfect play. /// - public ScoringValues MaximumScoringValues { get; private set; } + public ScoringValues MaximumScoringValues + { + get + { + if (!beatmapApplied) + throw new InvalidOperationException($"Cannot access maximum scoring values before calling {nameof(ApplyBeatmap)}."); + + return maximumScoringValues; + } + } + + private ScoringValues maximumScoringValues; /// /// Scoring values for the current play assuming all perfect hits. @@ -255,7 +266,7 @@ namespace osu.Game.Rulesets.Scoring private void updateScore() { Accuracy.Value = currentMaximumScoringValues.BaseScore > 0 ? currentScoringValues.BaseScore / currentMaximumScoringValues.BaseScore : 1; - TotalScore.Value = ComputeScore(Mode.Value, currentScoringValues, MaximumScoringValues); + TotalScore.Value = ComputeScore(Mode.Value, currentScoringValues, maximumScoringValues); } /// @@ -406,7 +417,7 @@ namespace osu.Game.Rulesets.Scoring lastHitObject = null; if (storeResults) - MaximumScoringValues = currentScoringValues; + maximumScoringValues = currentScoringValues; currentScoringValues = default; currentMaximumScoringValues = default; From a638392e81e9656b305a0b4c9ed8b0c8d4cd347d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 2 Jun 2022 16:35:50 +0900 Subject: [PATCH 1385/2328] Rename member --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 22 ++++++++++----------- osu.Game/Scoring/ScoringValues.cs | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index dd977a5c50..4a5897c621 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -211,7 +211,7 @@ namespace osu.Game.Rulesets.Scoring scoringValues.BaseScore += result.IsHit() ? Judgement.ToNumericResult(result) : 0; if (result.IsBasic()) - scoringValues.HitObjects++; + scoringValues.CountBasicHitObjects++; } /// @@ -260,7 +260,7 @@ namespace osu.Game.Rulesets.Scoring scoringValues.BaseScore -= result.IsHit() ? Judgement.ToNumericResult(result) : 0; if (result.IsBasic()) - scoringValues.HitObjects--; + scoringValues.CountBasicHitObjects--; } private void updateScore() @@ -340,7 +340,7 @@ namespace osu.Game.Rulesets.Scoring if (scoreInfo.IsLegacyScore && scoreInfo.Ruleset.OnlineID == 3 && maximum.BaseScore > 0) accuracyRatio = current.BaseScore / maximum.BaseScore; - return ComputeScore(mode, accuracyRatio, comboRatio, current.BonusScore, maximum.HitObjects); + return ComputeScore(mode, accuracyRatio, comboRatio, current.BonusScore, maximum.CountBasicHitObjects); } /// @@ -355,7 +355,7 @@ namespace osu.Game.Rulesets.Scoring { double accuracyRatio = maximum.BaseScore > 0 ? current.BaseScore / maximum.BaseScore : 1; double comboRatio = maximum.MaxCombo > 0 ? (double)current.MaxCombo / maximum.MaxCombo : 1; - return ComputeScore(mode, accuracyRatio, comboRatio, current.BonusScore, maximum.HitObjects); + return ComputeScore(mode, accuracyRatio, comboRatio, current.BonusScore, maximum.CountBasicHitObjects); } /// @@ -479,11 +479,11 @@ namespace osu.Game.Rulesets.Scoring /// This method is useful in a variety of situations, with a few drawbacks that need to be considered: /// /// The maximum will always be 0. - /// The current and maximum will always be the same value. + /// The current and maximum will always be the same value. /// /// Consumers are expected to more accurately fill in the above values through external means. /// - /// Ensure to fill in the maximum for use in + /// Ensure to fill in the maximum for use in /// . /// /// @@ -504,11 +504,11 @@ namespace osu.Game.Rulesets.Scoring /// This method is useful in a variety of situations, with a few drawbacks that need to be considered: /// /// The maximum will always be 0. - /// The current and maximum will always be the same value. + /// The current and maximum will always be the same value. /// /// Consumers are expected to more accurately fill in the above values through external means. /// - /// Ensure to fill in the maximum for use in + /// Ensure to fill in the maximum for use in /// . /// /// @@ -530,7 +530,7 @@ namespace osu.Game.Rulesets.Scoring /// /// The current will always be 0. /// The maximum will always be 0. - /// The current and maximum will always be the same value. + /// The current and maximum will always be the same value. /// /// Consumers are expected to more accurately fill in the above values (especially the current ) via external means (e.g. ). /// @@ -582,8 +582,8 @@ namespace osu.Game.Rulesets.Scoring if (result.IsBasic()) { - current.HitObjects += count; - maximum.HitObjects += count; + current.CountBasicHitObjects += count; + maximum.CountBasicHitObjects += count; } } } diff --git a/osu.Game/Scoring/ScoringValues.cs b/osu.Game/Scoring/ScoringValues.cs index 4b562c20e4..09ecd8e336 100644 --- a/osu.Game/Scoring/ScoringValues.cs +++ b/osu.Game/Scoring/ScoringValues.cs @@ -33,6 +33,6 @@ namespace osu.Game.Scoring /// The count of "basic" s. See: . /// [Key(3)] - public int HitObjects; + public int CountBasicHitObjects; } } From 773ba971173ef2a79fa5cfe2cdc4a91b2c676af4 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 2 Jun 2022 16:39:50 +0900 Subject: [PATCH 1386/2328] Add xmldoc to ScoringValues --- osu.Game/Scoring/ScoringValues.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Scoring/ScoringValues.cs b/osu.Game/Scoring/ScoringValues.cs index 09ecd8e336..d31cd7c68b 100644 --- a/osu.Game/Scoring/ScoringValues.cs +++ b/osu.Game/Scoring/ScoringValues.cs @@ -8,6 +8,9 @@ using osu.Game.Rulesets.Scoring; namespace osu.Game.Scoring { + /// + /// Stores the required scoring data that fulfils the minimum requirements for a to calculate score. + /// [MessagePackObject] public struct ScoringValues { From 4abfb3561142fef1eb9e2a8b8cb2169bff0955c3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 16:58:14 +0900 Subject: [PATCH 1387/2328] Improve light rotational alignment and increase light count to 8 --- osu.Game/Screens/Edit/Timing/TapButton.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index 4eeb358066..3b4d63f7b8 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -62,7 +62,7 @@ namespace osu.Game.Screens.Edit.Timing private ScheduledDelegate? resetDelegate; - private const int light_count = 6; + private const int light_count = 8; private const int initial_taps_to_ignore = 4; @@ -70,6 +70,8 @@ namespace osu.Game.Screens.Edit.Timing private const double transition_length = 500; + private const float angular_light_gap = 0.007f; + private readonly List tapTimings = new List(); [BackgroundDependencyLoader] @@ -185,7 +187,7 @@ namespace osu.Game.Screens.Edit.Timing { var light = new Light { - Rotation = i * (360f / light_count) + Rotation = (i + 1) * (360f / light_count) + 360 * angular_light_gap / 2, }; lights.Add(light); @@ -336,6 +338,7 @@ namespace osu.Game.Screens.Edit.Timing light.Hide(); tapTimings.Clear(); + currentLight = 0; IsHandlingTapping.Value = false; } @@ -357,14 +360,12 @@ namespace osu.Game.Screens.Edit.Timing Size = new Vector2(0.98f); // Avoid bleed into masking edge. - const float angular_gap = 0.007f; - InternalChildren = new Drawable[] { new CircularProgress { RelativeSizeAxes = Axes.Both, - Current = { Value = 1f / light_count - angular_gap }, + Current = { Value = 1f / light_count - angular_light_gap }, Colour = colourProvider.Background2, }, fillContent = new Container @@ -377,7 +378,7 @@ namespace osu.Game.Screens.Edit.Timing new CircularProgress { RelativeSizeAxes = Axes.Both, - Current = { Value = 1f / light_count - angular_gap }, + Current = { Value = 1f / light_count - angular_light_gap }, Blending = BlendingParameters.Additive }, // Please do not try and make sense of this. From e75609dfb9dd33cc30ffb5779da80e9988c7031b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 17:03:48 +0900 Subject: [PATCH 1388/2328] Increase taps to consider for better results for longer tap periods --- osu.Game/Screens/Edit/Timing/TapButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index 3b4d63f7b8..5453fcd68d 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -66,7 +66,7 @@ namespace osu.Game.Screens.Edit.Timing private const int initial_taps_to_ignore = 4; - private const int max_taps_to_consider = 8; + private const int max_taps_to_consider = 16; private const double transition_length = 500; From ee4beefd9584358229f2478f0aee7ef3e98cc093 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 17:27:51 +0900 Subject: [PATCH 1389/2328] Increase max taps to 128 for now Will revisit this in the future with a more sound algorithm. --- osu.Game/Screens/Edit/Timing/TapButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index 5453fcd68d..a6227cbe27 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -66,7 +66,7 @@ namespace osu.Game.Screens.Edit.Timing private const int initial_taps_to_ignore = 4; - private const int max_taps_to_consider = 16; + private const int max_taps_to_consider = 128; private const double transition_length = 500; From c42485cea9314356e93c507d42516cc00ac36c6e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 17:29:39 +0900 Subject: [PATCH 1390/2328] Fix test button references --- .../Editing/TestSceneTapTimingControl.cs | 54 +++++++++---------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs b/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs index 8dd368f2a9..a1218aa3e7 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs @@ -11,7 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Timing; @@ -77,34 +77,6 @@ namespace osu.Game.Tests.Visual.Editing timingInfo.Text = $"offset: {selectedGroup.Value.Time:N2} bpm: {selectedGroup.Value.ControlPoints.OfType().First().BPM:N2}"; } - [Test] - public void TestNoop() - { - AddStep("do nothing", () => { }); - } - - [Test] - public void TestTapThenReset() - { - AddStep("click tap button", () => - { - control.ChildrenOfType() - .Last() - .TriggerClick(); - }); - - AddUntilStep("wait for track playing", () => Clock.IsRunning); - - AddStep("click reset button", () => - { - control.ChildrenOfType() - .First() - .TriggerClick(); - }); - - AddUntilStep("wait for track stopped", () => !Clock.IsRunning); - } - [Test] public void TestBasic() { @@ -115,7 +87,7 @@ namespace osu.Game.Tests.Visual.Editing AddStep("click tap button", () => { - control.ChildrenOfType() + control.ChildrenOfType() .Last() .TriggerClick(); }); @@ -129,6 +101,28 @@ namespace osu.Game.Tests.Visual.Editing }); } + [Test] + public void TestTapThenReset() + { + AddStep("click tap button", () => + { + control.ChildrenOfType() + .Last() + .TriggerClick(); + }); + + AddUntilStep("wait for track playing", () => Clock.IsRunning); + + AddStep("click reset button", () => + { + control.ChildrenOfType() + .First() + .TriggerClick(); + }); + + AddUntilStep("wait for track stopped", () => !Clock.IsRunning); + } + protected override void Dispose(bool isDisposing) { Beatmap.Disabled = false; From 5a0f716bf24b8613564f75eb293e9b76699144fd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 18:14:26 +0900 Subject: [PATCH 1391/2328] Fix timing screen crash when attempting to add group to self Closes #18527. --- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index 40e6e8082a..8b1f881f88 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -189,7 +189,7 @@ namespace osu.Game.Screens.Edit.Timing // Try and create matching types from the currently selected control point. var selected = selectedGroup.Value; - if (selected != null) + if (selected != null && selected != group) { foreach (var controlPoint in selected.ControlPoints) { From 0b125ade4c439b1c3a664b683f1040f95cb58efc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 18:18:18 +0900 Subject: [PATCH 1392/2328] Allow clicking away to deselect the current control point group --- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index 40e6e8082a..fabc087952 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -7,6 +7,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -132,6 +133,12 @@ namespace osu.Game.Screens.Edit.Timing }, true); } + protected override bool OnClick(ClickEvent e) + { + selectedGroup.Value = null; + return true; + } + protected override void Update() { base.Update(); From 2fa4d46f73f2e4ec778605acf9b9fc6c69b1fad5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 18:28:13 +0900 Subject: [PATCH 1393/2328] Change text on timing group add button when it is going to clone instead Also disables the button when it would otherwise have no effect. --- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index 40e6e8082a..c6ac859cce 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -51,6 +51,8 @@ namespace osu.Game.Screens.Edit.Timing private readonly IBindableList controlPointGroups = new BindableList(); + private RoundedButton addButton; + [Resolved] private EditorClock clock { get; set; } @@ -105,9 +107,8 @@ namespace osu.Game.Screens.Edit.Timing Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, }, - new RoundedButton + addButton = new RoundedButton { - Text = "+ Add at current time", Action = addNew, Size = new Vector2(160, 30), Anchor = Anchor.BottomRight, @@ -122,7 +123,14 @@ namespace osu.Game.Screens.Edit.Timing { base.LoadComplete(); - selectedGroup.BindValueChanged(selected => { deleteButton.Enabled.Value = selected.NewValue != null; }, true); + selectedGroup.BindValueChanged(selected => + { + deleteButton.Enabled.Value = selected.NewValue != null; + + addButton.Text = selected.NewValue != null + ? "+ Clone to current time" + : "+ Add at current time"; + }, true); controlPointGroups.BindTo(Beatmap.ControlPointInfo.Groups); controlPointGroups.BindCollectionChanged((sender, args) => @@ -137,6 +145,8 @@ namespace osu.Game.Screens.Edit.Timing base.Update(); trackActivePoint(); + + addButton.Enabled.Value = clock.CurrentTimeAccurate != selectedGroup.Value?.Time; } /// From ad3c093a084cf035b2982a4497937fcbdfaa2551 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 18:33:09 +0900 Subject: [PATCH 1394/2328] Improve group tracking logic to avoid switching which point type unnecessarily --- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index 40e6e8082a..aba6b2f23e 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -139,6 +140,8 @@ namespace osu.Game.Screens.Edit.Timing trackActivePoint(); } + private Type trackedType; + /// /// Given the user has selected a control point group, we want to track any group which is /// active at the current point in time which matches the type the user has selected. @@ -149,16 +152,27 @@ namespace osu.Game.Screens.Edit.Timing private void trackActivePoint() { // For simplicity only match on the first type of the active control point. - var selectedPointType = selectedGroup.Value?.ControlPoints.FirstOrDefault()?.GetType(); + if (selectedGroup.Value == null) + trackedType = null; + else + { + // If the selected group only has one control point, update the tracking type. + if (selectedGroup.Value.ControlPoints.Count == 1) + trackedType = selectedGroup.Value?.ControlPoints.Single().GetType(); + // If the selected group has more than one control point, choose the first as the tracking type + // if we don't already have a singular tracked type. + else if (trackedType == null) + trackedType = selectedGroup.Value?.ControlPoints.FirstOrDefault()?.GetType(); + } - if (selectedPointType != null) + if (trackedType != null) { // We don't have an efficient way of looking up groups currently, only individual point types. // To improve the efficiency of this in the future, we should reconsider the overall structure of ControlPointInfo. // Find the next group which has the same type as the selected one. var found = Beatmap.ControlPointInfo.Groups - .Where(g => g.ControlPoints.Any(cp => cp.GetType() == selectedPointType)) + .Where(g => g.ControlPoints.Any(cp => cp.GetType() == trackedType)) .LastOrDefault(g => g.Time <= clock.CurrentTimeAccurate); if (found != null) From b1ffffc1acfbf216103b4a683db98800d7f883ca Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 2 Jun 2022 19:16:31 +0900 Subject: [PATCH 1395/2328] Calculate true combo value in ManiaDifficultyCalculator --- .../Difficulty/ManiaDifficultyCalculator.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs index b17aa7fc4d..88f51bf961 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -52,10 +52,18 @@ namespace osu.Game.Rulesets.Mania.Difficulty // This is done the way it is to introduce fractional differences in order to match osu-stable for the time being. GreatHitWindow = Math.Ceiling((int)(getHitWindow300(mods) * clockRate) / clockRate), ScoreMultiplier = getScoreMultiplier(mods), - MaxCombo = beatmap.HitObjects.Sum(h => h is HoldNote ? 2 : 1), + MaxCombo = beatmap.HitObjects.Sum(maxComboForObject) }; } + private static int maxComboForObject(HitObject hitObject) + { + if (hitObject is HoldNote hold) + return 1 + (int)((hold.EndTime - hold.StartTime) / 100); + + return 1; + } + protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) { var sortedObjects = beatmap.HitObjects.ToArray(); From a287fd73bbc81ca412d7b67fb33783483ed5b964 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 2 Jun 2022 19:16:38 +0900 Subject: [PATCH 1396/2328] Write MaxCombo attribute for mania --- .../Difficulty/ManiaDifficultyAttributes.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs index 5b7a460079..c35a3dcdc2 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty foreach (var v in base.ToDatabaseAttributes()) yield return v; - // Todo: osu!mania doesn't output MaxCombo attribute for some reason. + yield return (ATTRIB_ID_MAX_COMBO, MaxCombo); yield return (ATTRIB_ID_DIFFICULTY, StarRating); yield return (ATTRIB_ID_GREAT_HIT_WINDOW, GreatHitWindow); yield return (ATTRIB_ID_SCORE_MULTIPLIER, ScoreMultiplier); @@ -39,6 +39,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty { base.FromDatabaseAttributes(values); + MaxCombo = (int)values[ATTRIB_ID_MAX_COMBO]; StarRating = values[ATTRIB_ID_DIFFICULTY]; GreatHitWindow = values[ATTRIB_ID_GREAT_HIT_WINDOW]; ScoreMultiplier = values[ATTRIB_ID_SCORE_MULTIPLIER]; From ec24b32fa69a85fccd9df7da892397eb2b90e41b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 2 Jun 2022 20:36:28 +0200 Subject: [PATCH 1397/2328] Add NRT coverage for `FileChooserLabelledTextBox` --- .../Screens/Edit/Setup/FileChooserLabelledTextBox.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs b/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs index aae19396db..790613fc74 100644 --- a/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Collections.Generic; using System.IO; @@ -27,10 +29,10 @@ namespace osu.Game.Screens.Edit.Setup public IEnumerable HandledExtensions => handledExtensions; - private readonly Bindable currentFile = new Bindable(); + private readonly Bindable currentFile = new Bindable(); [Resolved] - private OsuGameBase game { get; set; } + private OsuGameBase game { get; set; } = null!; public FileChooserLabelledTextBox(params string[] handledExtensions) { @@ -45,7 +47,7 @@ namespace osu.Game.Screens.Edit.Setup currentFile.BindValueChanged(onFileSelected); } - private void onFileSelected(ValueChangedEvent file) + private void onFileSelected(ValueChangedEvent file) { if (file.NewValue == null) return; @@ -72,7 +74,7 @@ namespace osu.Game.Screens.Edit.Setup private class FileChooserPopover : OsuPopover { - public FileChooserPopover(string[] handledExtensions, Bindable currentFile) + public FileChooserPopover(string[] handledExtensions, Bindable currentFile) { Child = new Container { From cf9b78ea2a11f1c44d90bfa1702ad3daad4d4173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 2 Jun 2022 20:38:14 +0200 Subject: [PATCH 1398/2328] Improve safety of `FileChooserLabelledTextBox` disposal --- osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs b/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs index 790613fc74..fd916894ea 100644 --- a/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs @@ -11,6 +11,7 @@ using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions; +using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; @@ -67,7 +68,9 @@ namespace osu.Game.Screens.Edit.Setup protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - game.UnregisterImportHandler(this); + + if (game.IsNotNull()) + game.UnregisterImportHandler(this); } public override Popover GetPopover() => new FileChooserPopover(handledExtensions, currentFile); From 6f1437e73dcb62e2253d4285fc34c8b33f37e9dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 2 Jun 2022 21:15:11 +0200 Subject: [PATCH 1399/2328] Fix compilation failure due not applying rename fully --- .../Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs index 5e125c1a62..a738debecc 100644 --- a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs +++ b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs @@ -119,7 +119,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { BaseScore = 10000, MaxCombo = 1000, - HitObjects = 1000 + CountBasicHitObjects = 1000 } }; } From 60fb5d5e6c721b6a975356524869a4785bee2f70 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 3 Jun 2022 02:03:04 +0300 Subject: [PATCH 1400/2328] Revert "Fix timeline objects disappearing prematurely on wide-screens" This reverts commit 02baf9a97abe0fb6e94af53b83708a15a508d437. --- osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index 733b6c5f24..89e9fb2404 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -304,7 +304,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline /// /// The total amount of time visible on the timeline. /// - public double VisibleRange => (DisplayableContent / Content.DrawWidth) * track.Length; + public double VisibleRange => track.Length / Zoom; public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All) => new SnapResult(screenSpacePosition, beatSnapProvider.SnapTime(getTimeFromPosition(Content.ToLocalSpace(screenSpacePosition)))); From ca68751fdcd1c3b0a01ead44e776600f0127e05b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 3 Jun 2022 02:22:16 +0300 Subject: [PATCH 1401/2328] Update test to match expectation --- osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs b/osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs index 10f1f2fceb..d726bd004e 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs @@ -12,7 +12,7 @@ namespace osu.Game.Tests.Visual.Editing public override Drawable CreateTestComponent() => Empty(); [Test] - public void TestVisibleRangeViaZoom() + public void TestVisibleRangeUpdatesOnZoomChange() { double initialVisibleRange = 0; @@ -29,7 +29,7 @@ namespace osu.Game.Tests.Visual.Editing } [Test] - public void TestVisibleRangeViaTimelineSize() + public void TestVisibleRangeConstantOnSizeChange() { double initialVisibleRange = 0; @@ -37,12 +37,12 @@ namespace osu.Game.Tests.Visual.Editing AddStep("get initial range", () => initialVisibleRange = TimelineArea.Timeline.VisibleRange); AddStep("scale timeline size", () => TimelineArea.Timeline.Width = 2); - AddAssert("range doubled", () => TimelineArea.Timeline.VisibleRange == initialVisibleRange * 2); + AddAssert("same range", () => TimelineArea.Timeline.VisibleRange == initialVisibleRange); AddStep("descale timeline size", () => TimelineArea.Timeline.Width = 0.5f); - AddAssert("range halved", () => TimelineArea.Timeline.VisibleRange == initialVisibleRange / 2); + AddAssert("same range", () => TimelineArea.Timeline.VisibleRange == initialVisibleRange); AddStep("restore timeline size", () => TimelineArea.Timeline.Width = 1); - AddAssert("range restored", () => TimelineArea.Timeline.VisibleRange == initialVisibleRange); + AddAssert("same range", () => TimelineArea.Timeline.VisibleRange == initialVisibleRange); } } } From 588151f48b3afde6d8e006daaa235367d5583a7d Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 3 Jun 2022 02:26:46 +0300 Subject: [PATCH 1402/2328] Add new failing test coverage --- .../Editing/TestSceneZoomableScrollContainer.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs b/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs index 95d11d6909..2d056bafdd 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs @@ -44,7 +44,12 @@ namespace osu.Game.Tests.Visual.Editing RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(30) }, - scrollContainer = new ZoomableScrollContainer { RelativeSizeAxes = Axes.Both } + scrollContainer = new ZoomableScrollContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + } } }, new MenuCursor() @@ -62,7 +67,15 @@ namespace osu.Game.Tests.Visual.Editing [Test] public void TestWidthInitialization() { - AddAssert("Inner container width was initialized", () => innerBox.DrawWidth > 0); + AddAssert("Inner container width was initialized", () => innerBox.DrawWidth == scrollContainer.DrawWidth); + } + + [Test] + public void TestWidthUpdatesOnDrawSizeChanges() + { + AddStep("Shrink scroll container", () => scrollContainer.Width = 0.5f); + AddAssert("Scroll container width shrunk", () => scrollContainer.DrawWidth == scrollContainer.Parent.DrawWidth / 2); + AddAssert("Inner container width matches scroll container", () => innerBox.DrawWidth == scrollContainer.DrawWidth); } [Test] From 21385655fed9137e350811f66b5ff9ae418f0ada Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 3 Jun 2022 02:27:16 +0300 Subject: [PATCH 1403/2328] Fix `ZoomableScrollContainer` not updating on parent size changes --- .../Timeline/ZoomableScrollContainer.cs | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs index 35d103ddf1..d008368b69 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Transforms; using osu.Framework.Input.Events; +using osu.Framework.Layout; using osu.Framework.Timing; using osu.Framework.Utils; using osu.Game.Graphics.Containers; @@ -40,10 +41,14 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline [Resolved(canBeNull: true)] private IFrameBasedClock editorClock { get; set; } + private readonly LayoutValue zoomedContentWidthCache = new LayoutValue(Invalidation.DrawSize); + public ZoomableScrollContainer() : base(Direction.Horizontal) { base.Content.Add(zoomedContent = new Container { RelativeSizeAxes = Axes.Y }); + + AddLayout(zoomedContentWidthCache); } private float minZoom = 1; @@ -103,12 +108,12 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline } } - protected override void LoadComplete() + protected override void Update() { - base.LoadComplete(); + base.Update(); - // This width only gets updated on the application of a transform, so this needs to be initialized here. - updateZoomedContentWidth(); + if (!zoomedContentWidthCache.IsValid) + updateZoomedContentWidth(); } protected override bool OnScroll(ScrollEvent e) @@ -128,7 +133,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline return base.OnScroll(e); } - private void updateZoomedContentWidth() => zoomedContent.Width = DrawWidth * currentZoom; + private void updateZoomedContentWidth() + { + zoomedContent.Width = DrawWidth * currentZoom; + zoomedContentWidthCache.Validate(); + } private float zoomTarget = 1; @@ -199,8 +208,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline float targetOffset = expectedWidth * (focusPoint / contentSize) - focusOffset; d.currentZoom = newZoom; - d.updateZoomedContentWidth(); + // Temporarily here to make sure ScrollTo gets the correct DrawSize for scrollable area. // TODO: Make sure draw size gets invalidated properly on the framework side, and remove this once it is. d.Invalidate(Invalidation.DrawSize); From efbde06c11229a3a8501ece576b1a10c13cc70ae Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 3 Jun 2022 05:02:00 +0300 Subject: [PATCH 1404/2328] Split button repeating logic from `TimingAdjustButton` to own component --- .../Edit/Timing/RepeatingButtonBehaviour.cs | 93 +++++++++++++++++++ .../Screens/Edit/Timing/TimingAdjustButton.cs | 80 ++++------------ 2 files changed, 110 insertions(+), 63 deletions(-) create mode 100644 osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs diff --git a/osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs b/osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs new file mode 100644 index 0000000000..5c9f384a2e --- /dev/null +++ b/osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs @@ -0,0 +1,93 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Input.Events; +using osu.Framework.Threading; + +namespace osu.Game.Screens.Edit.Timing +{ + /// + /// Represents a component that provides the behaviour of triggering button clicks repeatedly while holding with mouse. + /// + public class RepeatingButtonBehaviour : CompositeDrawable + { + private const double initial_delay = 300; + private const double minimum_delay = 80; + + private readonly Drawable button; + + private Sample sample; + + /// + /// An additive modifier for the frequency of the sample played on next actuation. + /// This can be adjusted during the button's event to affect the repeat sample playback of that click. + /// + public double SampleFrequencyModifier { get; set; } + + public RepeatingButtonBehaviour(Drawable button) + { + this.button = button; + + RelativeSizeAxes = Axes.Both; + } + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + sample = audio.Samples.Get(@"UI/notch-tick"); + } + + protected override bool OnMouseDown(MouseDownEvent e) + { + beginRepeat(); + return true; + } + + protected override void OnMouseUp(MouseUpEvent e) + { + adjustDelegate?.Cancel(); + base.OnMouseUp(e); + } + + private ScheduledDelegate adjustDelegate; + private double adjustDelay = initial_delay; + + private void beginRepeat() + { + adjustDelegate?.Cancel(); + + adjustDelay = initial_delay; + adjustNext(); + + void adjustNext() + { + if (IsHovered) + { + button.TriggerClick(); + adjustDelay = Math.Max(minimum_delay, adjustDelay * 0.9f); + + var channel = sample?.GetChannel(); + + if (channel != null) + { + double repeatModifier = 0.05f * (Math.Abs(adjustDelay - initial_delay) / minimum_delay); + channel.Frequency.Value = 1 + repeatModifier + SampleFrequencyModifier; + channel.Play(); + } + } + else + { + adjustDelay = initial_delay; + } + + adjustDelegate = Scheduler.AddDelayed(adjustNext, adjustDelay); + } + } + } +} diff --git a/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs b/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs index 9fc7e56a3d..6e7338fa15 100644 --- a/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs +++ b/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs @@ -4,14 +4,11 @@ using System; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Audio; -using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Framework.Localisation; -using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Overlays; @@ -26,32 +23,24 @@ namespace osu.Game.Screens.Edit.Timing public Action Action; private readonly double adjustAmount; - private ScheduledDelegate adjustDelegate; private const int max_multiplier = 10; - private const int adjust_levels = 4; - private const double initial_delay = 300; - - private const double minimum_delay = 80; - public Container Content { get; set; } - private double adjustDelay = initial_delay; - private readonly Box background; private readonly OsuSpriteText text; - private Sample sample; - public LocalisableString Text { get => text.Text; set => text.Text = value; } + private readonly RepeatingButtonBehaviour repeatBehaviour; + [Resolved] private OverlayColourProvider colourProvider { get; set; } @@ -82,13 +71,13 @@ namespace osu.Game.Screens.Edit.Timing } } }); + + AddInternal(repeatBehaviour = new RepeatingButtonBehaviour(this)); } [BackgroundDependencyLoader] - private void load(AudioManager audio) + private void load() { - sample = audio.Samples.Get(@"UI/notch-tick"); - background.Colour = colourProvider.Background3; for (int i = 1; i <= adjust_levels; i++) @@ -98,57 +87,22 @@ namespace osu.Game.Screens.Edit.Timing } } - protected override bool OnMouseDown(MouseDownEvent e) + protected override bool OnHover(HoverEvent e) => true; + + protected override bool OnClick(ClickEvent e) { - beginRepeat(); + var hoveredBox = Content.OfType().FirstOrDefault(d => d.IsHovered); + if (hoveredBox == null) + return false; + + Action(adjustAmount * hoveredBox.Multiplier); + + hoveredBox.Flash(); + + repeatBehaviour.SampleFrequencyModifier = (hoveredBox.Multiplier / max_multiplier) * 0.2; return true; } - protected override void OnMouseUp(MouseUpEvent e) - { - adjustDelegate?.Cancel(); - base.OnMouseUp(e); - } - - private void beginRepeat() - { - adjustDelegate?.Cancel(); - - adjustDelay = initial_delay; - adjustNext(); - - void adjustNext() - { - var hoveredBox = Content.OfType().FirstOrDefault(d => d.IsHovered); - - if (hoveredBox != null) - { - Action(adjustAmount * hoveredBox.Multiplier); - - adjustDelay = Math.Max(minimum_delay, adjustDelay * 0.9f); - - hoveredBox.Flash(); - - var channel = sample?.GetChannel(); - - if (channel != null) - { - double repeatModifier = 0.05f * (Math.Abs(adjustDelay - initial_delay) / minimum_delay); - double multiplierModifier = (hoveredBox.Multiplier / max_multiplier) * 0.2f; - - channel.Frequency.Value = 1 + multiplierModifier + repeatModifier; - channel.Play(); - } - } - else - { - adjustDelay = initial_delay; - } - - adjustDelegate = Scheduler.AddDelayed(adjustNext, adjustDelay); - } - } - private class IncrementBox : CompositeDrawable { public readonly float Multiplier; From b51e0a50472e2415928a38dd9263bdfa04e3e8d5 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 3 Jun 2022 05:03:22 +0300 Subject: [PATCH 1405/2328] Share button repeating logic with `TimelineButton` for better UX --- .../Components/Timeline/TimelineButton.cs | 47 ++----------------- 1 file changed, 5 insertions(+), 42 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs index 5550c6a748..4c0c0335dd 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs @@ -6,13 +6,11 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.Events; -using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; +using osu.Game.Screens.Edit.Timing; using osuTK; using osuTK.Graphics; -using osuTK.Input; namespace osu.Game.Screens.Edit.Compose.Components.Timeline { @@ -27,7 +25,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline set => button.Icon = value; } - private readonly IconButton button; + private readonly TimelineIconButton button; public TimelineButton() { @@ -54,46 +52,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline IconHoverColour = Color4.White; HoverColour = OsuColour.Gray(0.25f); FlashColour = OsuColour.Gray(0.5f); + + Add(new RepeatingButtonBehaviour(this)); } - private ScheduledDelegate repeatSchedule; - - /// - /// The initial delay before mouse down repeat begins. - /// - private const int repeat_initial_delay = 250; - - /// - /// The delay between mouse down repeats after the initial repeat. - /// - private const int repeat_tick_rate = 70; - - protected override bool OnClick(ClickEvent e) - { - // don't actuate a click since we are manually handling repeats. - return true; - } - - protected override bool OnMouseDown(MouseDownEvent e) - { - if (e.Button == MouseButton.Left) - { - Action clickAction = () => base.OnClick(new ClickEvent(e.CurrentState, e.Button)); - - // run once for initial down - clickAction(); - - Scheduler.Add(repeatSchedule = new ScheduledDelegate(clickAction, Clock.CurrentTime + repeat_initial_delay, repeat_tick_rate)); - } - - return base.OnMouseDown(e); - } - - protected override void OnMouseUp(MouseUpEvent e) - { - repeatSchedule?.Cancel(); - base.OnMouseUp(e); - } + protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds(sampleSet); } } } From 1b4c89c418a66aecadac765be1560f1ad3d4a215 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Jun 2022 14:01:04 +0900 Subject: [PATCH 1406/2328] Update realm to latest version Contains minor changes to async usage in line with upstream API changes. I believe a feedback issue we were seeing with offset changes (the only component using async write flow) may have been resolved by these upstream changes (see [release notes](https://github.com/realm/realm-dotnet/releases/tag/10.14.0)) but am not investigating further just yet. --- osu.Game.Tests/Database/BeatmapImporterTests.cs | 2 +- osu.Game/Database/RealmAccess.cs | 2 +- osu.Game/osu.Game.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index 00276955aa..d4956e97e0 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -710,7 +710,7 @@ namespace osu.Game.Tests.Database var imported = await LoadOszIntoStore(importer, realm.Realm); - realm.Realm.Write(() => + await realm.Realm.WriteAsync(() => { foreach (var b in imported.Beatmaps) b.OnlineID = -1; diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index dbd3b96763..086ec52d80 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -392,7 +392,7 @@ namespace osu.Game.Database { total_writes_async.Value++; using (var realm = getRealmInstance()) - await realm.WriteAsync(action); + await realm.WriteAsync(() => action(realm)); } /// diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index eb47d0468f..97a36e9bc6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + From f224a3e922d5d8953b5c1446bb3aad4d0d11d363 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Jun 2022 14:18:47 +0900 Subject: [PATCH 1407/2328] Update silly mobile project references --- osu.Android.props | 2 +- osu.iOS.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 116c7dbfcd..35d902493e 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -56,6 +56,6 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index ccecad6f82..64ba7fe22e 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -89,6 +89,6 @@ - + From 3aa8bc933dc45f8c5428e0f8a5e9a73aa51e651f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 3 Jun 2022 08:21:35 +0300 Subject: [PATCH 1408/2328] Add sentry tag for selected beatmap --- osu.Game/Utils/SentryLogger.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index ecc7fc4774..bba1e514c5 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -159,6 +159,7 @@ namespace osu.Game.Utils Game = game.Clock.CurrentTime, }; + scope.SetTag(@"beatmap", $"{beatmap.OnlineID}"); scope.SetTag(@"ruleset", ruleset.ShortName); scope.SetTag(@"os", $"{RuntimeInfo.OS} ({Environment.OSVersion})"); scope.SetTag(@"processor count", Environment.ProcessorCount.ToString()); From 6cb8b2d6f47f64591d9aa3e6768a68f23c582a1e Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 3 Jun 2022 09:37:17 +0300 Subject: [PATCH 1409/2328] Set default window mode to "Borderless" rather than "Fullscreen" on macOS --- osu.Game/OsuGame.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 785881d97a..1c25c45bc3 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -9,6 +9,7 @@ using System.Threading; using System.Threading.Tasks; using Humanizer; using JetBrains.Annotations; +using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; @@ -658,11 +659,14 @@ namespace osu.Game } protected override IDictionary GetFrameworkConfigDefaults() - => new Dictionary + { + return new Dictionary { - // General expectation that osu! starts in fullscreen by default (also gives the most predictable performance) - { FrameworkSetting.WindowMode, WindowMode.Fullscreen } + // General expectation that osu! starts in fullscreen by default (also gives the most predictable performance). + // However, macOS is bound to have issues when using exclusive fullscreen as it takes full control away from OS, therefore borderless is default there. + { FrameworkSetting.WindowMode, RuntimeInfo.IsApple ? WindowMode.Borderless : WindowMode.Fullscreen } }; + } protected override void LoadComplete() { From 1af51a2b1919a39bb90d63b1edfd1e29f6f18dad Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Jun 2022 16:00:40 +0900 Subject: [PATCH 1410/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 35d902493e..d5f0d32b80 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 97a36e9bc6..45e7ff91c0 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 64ba7fe22e..16b7d49f3f 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From eb2d822530227d303d2d10f661a2a544c3f1a3ae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 14:28:48 +0900 Subject: [PATCH 1411/2328] Fix web requests potentially being performed after cancelled Closes https://github.com/ppy/osu/issues/18524. --- osu.Game/Online/API/APIRequest.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/API/APIRequest.cs b/osu.Game/Online/API/APIRequest.cs index 776ff5fd8f..451ea117d5 100644 --- a/osu.Game/Online/API/APIRequest.cs +++ b/osu.Game/Online/API/APIRequest.cs @@ -121,8 +121,16 @@ namespace osu.Game.Online.API if (isFailing) return; - Logger.Log($@"Performing request {this}", LoggingTarget.Network); - WebRequest.Perform(); + try + { + Logger.Log($@"Performing request {this}", LoggingTarget.Network); + WebRequest.Perform(); + } + catch (OperationCanceledException) + { + // ignore this. internally Perform is running async and the fail state may have changed since + // the last check of `isFailing` above. + } if (isFailing) return; From 54a32bde44fd1fdc421a47fbd2b9cc89978d5703 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Jun 2022 16:29:55 +0900 Subject: [PATCH 1412/2328] Don't report sentry errors from builds targetting a different server --- osu.Game/OsuGameBase.cs | 5 ++++- osu.Game/Utils/SentryLogger.cs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 666413004a..5dbdf6f602 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -80,6 +80,9 @@ namespace osu.Game public virtual bool UseDevelopmentServer => DebugUtils.IsDebugBuild; + internal EndpointConfiguration CreateEndpoints() => + UseDevelopmentServer ? (EndpointConfiguration)new DevelopmentEndpointConfiguration() : new ProductionEndpointConfiguration(); + public virtual Version AssemblyVersion => Assembly.GetEntryAssembly()?.GetName().Version ?? new Version(); /// @@ -268,7 +271,7 @@ namespace osu.Game dependencies.Cache(SkinManager = new SkinManager(Storage, realm, Host, Resources, Audio, Scheduler)); dependencies.CacheAs(SkinManager); - EndpointConfiguration endpoints = UseDevelopmentServer ? (EndpointConfiguration)new DevelopmentEndpointConfiguration() : new ProductionEndpointConfiguration(); + EndpointConfiguration endpoints = CreateEndpoints(); MessageFormatter.WebsiteRootUrl = endpoints.WebsiteRootUrl; diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index bba1e514c5..c12fd607b4 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -43,7 +43,7 @@ namespace osu.Game.Utils sentrySession = SentrySdk.Init(options => { // Not setting the dsn will completely disable sentry. - if (game.IsDeployedBuild) + if (game.IsDeployedBuild && game.CreateEndpoints().WebsiteRootUrl.EndsWith(@".ppy.sh", StringComparison.Ordinal)) options.Dsn = "https://ad9f78529cef40ac874afb95a9aca04e@sentry.ppy.sh/2"; options.AutoSessionTracking = true; From 1a835f062213c8d86fddaa73e30f33f75245996d Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 3 Jun 2022 10:23:38 +0300 Subject: [PATCH 1413/2328] Add warning note when running fullscreen on macOS --- osu.Game/Localisation/LayoutSettingsStrings.cs | 5 +++++ .../Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/osu.Game/Localisation/LayoutSettingsStrings.cs b/osu.Game/Localisation/LayoutSettingsStrings.cs index 5ac28f19b3..8b7ad5918b 100644 --- a/osu.Game/Localisation/LayoutSettingsStrings.cs +++ b/osu.Game/Localisation/LayoutSettingsStrings.cs @@ -24,6 +24,11 @@ namespace osu.Game.Localisation /// public static LocalisableString UnableToRunExclusiveFullscreen => new TranslatableString(getKey(@"unable_to_run_exclusive_fullscreen"), @"Unable to run exclusive fullscreen. You'll still experience some input latency."); + /// + /// "Running fullscreen on macOS takes full control away from the system, this could lead to system-wide freezes if the game becomes unresponsive." + /// + public static LocalisableString FullscreenMacOSNote => new TranslatableString(getKey(@"fullscreen_macos_note"), @"Running fullscreen on macOS takes full control away from the system, this could lead to system-wide freezes if the game becomes unresponsive."); + private static string getKey(string key) => $@"{prefix}:{key}"; } } \ No newline at end of file diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index d79ba593f7..53b6f89c1f 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -4,6 +4,7 @@ using System; using System.Drawing; using System.Linq; +using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Configuration; @@ -230,6 +231,12 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics return; } + if (RuntimeInfo.OS == RuntimeInfo.Platform.macOS) + { + windowModeDropdown.SetNoticeText(LayoutSettingsStrings.FullscreenMacOSNote, true); + return; + } + if (host.Window is WindowsWindow) { switch (fullscreenCapability.Value) From 3ad1180c48c1856a5f10640d4688e4c2be25b245 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 3 Jun 2022 10:32:43 +0300 Subject: [PATCH 1414/2328] Use `macOS` instead of `IsApple` for better safety --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 1c25c45bc3..b91d523151 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -664,7 +664,7 @@ namespace osu.Game { // General expectation that osu! starts in fullscreen by default (also gives the most predictable performance). // However, macOS is bound to have issues when using exclusive fullscreen as it takes full control away from OS, therefore borderless is default there. - { FrameworkSetting.WindowMode, RuntimeInfo.IsApple ? WindowMode.Borderless : WindowMode.Fullscreen } + { FrameworkSetting.WindowMode, RuntimeInfo.OS == RuntimeInfo.Platform.macOS ? WindowMode.Borderless : WindowMode.Fullscreen } }; } From e779b460e42cb89f4a196035164dda9f4cae9dd5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Jun 2022 16:49:08 +0900 Subject: [PATCH 1415/2328] Use `Component` instead of `CompositeDrawable` --- osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs b/osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs index 5c9f384a2e..595305b20f 100644 --- a/osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs +++ b/osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs @@ -6,7 +6,6 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; using osu.Framework.Threading; @@ -15,7 +14,7 @@ namespace osu.Game.Screens.Edit.Timing /// /// Represents a component that provides the behaviour of triggering button clicks repeatedly while holding with mouse. /// - public class RepeatingButtonBehaviour : CompositeDrawable + public class RepeatingButtonBehaviour : Component { private const double initial_delay = 300; private const double minimum_delay = 80; From 902a0a3255d2773988e74eaa27dc9a061c79b56d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 3 Jun 2022 16:50:42 +0900 Subject: [PATCH 1416/2328] Update max combo test value --- .../ManiaDifficultyCalculatorTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs index 715614a201..a5bd126782 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs @@ -14,11 +14,11 @@ namespace osu.Game.Rulesets.Mania.Tests { protected override string ResourceAssembly => "osu.Game.Rulesets.Mania"; - [TestCase(2.3449735700206298d, 151, "diffcalc-test")] + [TestCase(2.3449735700206298d, 242, "diffcalc-test")] public void Test(double expectedStarRating, int expectedMaxCombo, string name) => base.Test(expectedStarRating, expectedMaxCombo, name); - [TestCase(2.7879104989252959d, 151, "diffcalc-test")] + [TestCase(2.7879104989252959d, 242, "diffcalc-test")] public void TestClockRateAdjusted(double expectedStarRating, int expectedMaxCombo, string name) => Test(expectedStarRating, expectedMaxCombo, name, new ManiaModDoubleTime()); From 7b28451e3d872d03fac0411e189da2642a0426a2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 3 Jun 2022 10:50:52 +0300 Subject: [PATCH 1417/2328] Improve warning message for user --- osu.Game/Localisation/LayoutSettingsStrings.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Localisation/LayoutSettingsStrings.cs b/osu.Game/Localisation/LayoutSettingsStrings.cs index 8b7ad5918b..b4326b8e39 100644 --- a/osu.Game/Localisation/LayoutSettingsStrings.cs +++ b/osu.Game/Localisation/LayoutSettingsStrings.cs @@ -25,10 +25,10 @@ namespace osu.Game.Localisation public static LocalisableString UnableToRunExclusiveFullscreen => new TranslatableString(getKey(@"unable_to_run_exclusive_fullscreen"), @"Unable to run exclusive fullscreen. You'll still experience some input latency."); /// - /// "Running fullscreen on macOS takes full control away from the system, this could lead to system-wide freezes if the game becomes unresponsive." + /// "Using fullscreen on macOS makes interacting with the menu bar and spaces no longer work, and may lead to freezes if a system dialog is presented. Using borderless is recommended." /// - public static LocalisableString FullscreenMacOSNote => new TranslatableString(getKey(@"fullscreen_macos_note"), @"Running fullscreen on macOS takes full control away from the system, this could lead to system-wide freezes if the game becomes unresponsive."); + public static LocalisableString FullscreenMacOSNote => new TranslatableString(getKey(@"fullscreen_macos_note"), @"Using fullscreen on macOS makes interacting with the menu bar and spaces no longer work, and may lead to freezes if a system dialog is presented. Using borderless is recommended."); private static string getKey(string key) => $@"{prefix}:{key}"; } -} \ No newline at end of file +} From cd999cf7ac936756f055fe57e88b20d6af6c47ed Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 3 Jun 2022 10:51:20 +0300 Subject: [PATCH 1418/2328] Fix back-to-front conditional --- .../Settings/Sections/Graphics/LayoutSettings.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 53b6f89c1f..05890ad882 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -225,15 +225,19 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private void updateScreenModeWarning() { - if (windowModeDropdown.Current.Value != WindowMode.Fullscreen) + if (RuntimeInfo.OS == RuntimeInfo.Platform.macOS) { - windowModeDropdown.SetNoticeText(GraphicsSettingsStrings.NotFullscreenNote, true); + if (windowModeDropdown.Current.Value == WindowMode.Fullscreen) + windowModeDropdown.SetNoticeText(LayoutSettingsStrings.FullscreenMacOSNote, true); + else + windowModeDropdown.ClearNoticeText(); + return; } - if (RuntimeInfo.OS == RuntimeInfo.Platform.macOS) + if (windowModeDropdown.Current.Value != WindowMode.Fullscreen) { - windowModeDropdown.SetNoticeText(LayoutSettingsStrings.FullscreenMacOSNote, true); + windowModeDropdown.SetNoticeText(GraphicsSettingsStrings.NotFullscreenNote, true); return; } From cd3edc869c3455fd77aa0348566faccd079a1b97 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Jun 2022 17:00:00 +0900 Subject: [PATCH 1419/2328] Remove unnecessary nesting of `IconButton` and update design a touch --- .../Components/Timeline/TimelineButton.cs | 63 +++++-------------- 1 file changed, 15 insertions(+), 48 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs index 4c0c0335dd..e0b21b2e22 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs @@ -1,62 +1,29 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; +using osu.Framework.Allocation; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; using osu.Game.Screens.Edit.Timing; -using osuTK; -using osuTK.Graphics; namespace osu.Game.Screens.Edit.Compose.Components.Timeline { - public class TimelineButton : CompositeDrawable + public class TimelineButton : IconButton { - public Action Action; - public readonly BindableBool Enabled = new BindableBool(true); - - public IconUsage Icon + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) { - get => button.Icon; - set => button.Icon = value; + // These are using colourProvider but don't match the design. + // Just something to fit until someone implements the updated design. + IconColour = colourProvider.Background1; + IconHoverColour = colourProvider.Content2; + + HoverColour = colourProvider.Background1; + FlashColour = colourProvider.Content2; + + Add(new RepeatingButtonBehaviour(this)); } - private readonly TimelineIconButton button; - - public TimelineButton() - { - InternalChild = button = new TimelineIconButton { Action = () => Action?.Invoke() }; - - button.Enabled.BindTo(Enabled); - Width = button.Width; - } - - protected override void Update() - { - base.Update(); - - button.Size = new Vector2(button.Width, DrawHeight); - } - - private class TimelineIconButton : IconButton - { - public TimelineIconButton() - { - Anchor = Anchor.Centre; - Origin = Anchor.Centre; - IconColour = OsuColour.Gray(0.35f); - IconHoverColour = Color4.White; - HoverColour = OsuColour.Gray(0.25f); - FlashColour = OsuColour.Gray(0.5f); - - Add(new RepeatingButtonBehaviour(this)); - } - - protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds(sampleSet); - } + protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds(sampleSet); } } From 2aabcf51ae9271d51ed97d6b425115d31d8bea9d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 3 Jun 2022 18:47:07 +0900 Subject: [PATCH 1420/2328] Update framework again --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index d5f0d32b80..0058bb3577 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 45e7ff91c0..2285f61331 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 16b7d49f3f..b134a7e356 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 646f5f0f33c47efb4fcfd6656bc470209ff538c3 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 3 Jun 2022 19:17:31 +0900 Subject: [PATCH 1421/2328] Isolate "server-side" multiplayer rooms in testing --- osu.Game/Online/Rooms/Room.cs | 7 +++++++ .../Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/osu.Game/Online/Rooms/Room.cs b/osu.Game/Online/Rooms/Room.cs index 60c0503ddd..1933267efd 100644 --- a/osu.Game/Online/Rooms/Room.cs +++ b/osu.Game/Online/Rooms/Room.cs @@ -162,6 +162,13 @@ namespace osu.Game.Online.Rooms Password.BindValueChanged(p => HasPassword.Value = !string.IsNullOrEmpty(p.NewValue)); } + /// + /// Copies values from another into this one. + /// + /// + /// **Beware**: This will store references between s. + /// + /// The to copy values from. public void CopyFrom(Room other) { RoomID.Value = other.RoomID.Value; diff --git a/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs b/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs index 8290af8f78..392f32badc 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Newtonsoft.Json; using osu.Game.Beatmaps; using osu.Game.Online.API; using osu.Game.Online.API.Requests; @@ -44,9 +45,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay switch (request) { case CreateRoomRequest createRoomRequest: - var apiRoom = new Room(); - - apiRoom.CopyFrom(createRoomRequest.Room); + var apiRoom = cloneRoom(createRoomRequest.Room); // Passwords are explicitly not copied between rooms. apiRoom.HasPassword.Value = !string.IsNullOrEmpty(createRoomRequest.Room.Password.Value); @@ -178,12 +177,13 @@ namespace osu.Game.Tests.Visual.OnlinePlay private Room createResponseRoom(Room room, bool withParticipants) { - var responseRoom = new Room(); - responseRoom.CopyFrom(room); + var responseRoom = cloneRoom(room); responseRoom.Password.Value = null; if (!withParticipants) responseRoom.RecentParticipants.Clear(); return responseRoom; } + + private Room cloneRoom(Room source) => JsonConvert.DeserializeObject(JsonConvert.SerializeObject(source)); } } From 524599568919c6b03c0fa3fc19f3ea69b77ab094 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 3 Jun 2022 19:50:21 +0900 Subject: [PATCH 1422/2328] Use IsNotNull() helper --- osu.Game/Online/Spectator/SpectatorScoreProcessor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs b/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs index c1829a7023..a1e8715c8f 100644 --- a/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs +++ b/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs @@ -9,6 +9,7 @@ using System.Diagnostics; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; using osu.Framework.Timing; using osu.Game.Rulesets; @@ -165,8 +166,7 @@ namespace osu.Game.Online.Spectator { base.Dispose(isDisposing); - // ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract - if (spectatorClient != null) + if (spectatorClient.IsNotNull()) spectatorClient.OnNewFrames -= onNewFrames; } From 68337df64377032faa9b86538164dacb30551fcf Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 3 Jun 2022 20:04:20 +0900 Subject: [PATCH 1423/2328] Fix tests by creating a score processor --- osu.Game/Tests/Gameplay/TestGameplayState.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Tests/Gameplay/TestGameplayState.cs b/osu.Game/Tests/Gameplay/TestGameplayState.cs index 0d00f52d15..f14f8c44ec 100644 --- a/osu.Game/Tests/Gameplay/TestGameplayState.cs +++ b/osu.Game/Tests/Gameplay/TestGameplayState.cs @@ -26,7 +26,10 @@ namespace osu.Game.Tests.Gameplay var workingBeatmap = new TestWorkingBeatmap(beatmap); var playableBeatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods); - return new GameplayState(playableBeatmap, ruleset, mods, score); + var scoreProcessor = ruleset.CreateScoreProcessor(); + scoreProcessor.ApplyBeatmap(playableBeatmap); + + return new GameplayState(playableBeatmap, ruleset, mods, score, scoreProcessor); } } } From 77289c72249566cea9fd1fc10854af4cddca4cb5 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 3 Jun 2022 20:36:11 +0900 Subject: [PATCH 1424/2328] Fix inability to serialise-then-deserialise playlist items --- osu.Game/Online/Rooms/PlaylistItem.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/Rooms/PlaylistItem.cs b/osu.Game/Online/Rooms/PlaylistItem.cs index 6ec884d79c..12091bae88 100644 --- a/osu.Game/Online/Rooms/PlaylistItem.cs +++ b/osu.Game/Online/Rooms/PlaylistItem.cs @@ -61,7 +61,13 @@ namespace osu.Game.Online.Rooms /// Used for serialising to the API. /// [JsonProperty("beatmap_id")] - private int onlineBeatmapId => Beatmap.OnlineID; + private int onlineBeatmapId + { + get => Beatmap.OnlineID; + // This setter is only required for client-side serialise-then-deserialise operations. + // Serialisation is supposed to emit only a `beatmap_id`, but a (non-null) `beatmap` is required on deserialise. + set => Beatmap = new APIBeatmap { OnlineID = value }; + } /// /// A beatmap representing this playlist item. From 41ff170b6043d67308673182765837e10fabca6c Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 3 Jun 2022 21:12:09 +0900 Subject: [PATCH 1425/2328] Fix playlist IDs not being returned --- .../Visual/OnlinePlay/TestRoomRequestsHandler.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs b/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs index 392f32badc..3a668d6931 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Newtonsoft.Json; using osu.Game.Beatmaps; @@ -184,6 +185,18 @@ namespace osu.Game.Tests.Visual.OnlinePlay return responseRoom; } - private Room cloneRoom(Room source) => JsonConvert.DeserializeObject(JsonConvert.SerializeObject(source)); + private Room cloneRoom(Room source) + { + var result = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(source)); + Debug.Assert(result != null); + + // Playlist item IDs aren't serialised. + if (source.CurrentPlaylistItem.Value != null) + result.CurrentPlaylistItem.Value.ID = source.CurrentPlaylistItem.Value.ID; + for (int i = 0; i < source.Playlist.Count; i++) + result.Playlist[i].ID = source.Playlist[i].ID; + + return result; + } } } From 06ac3c1ad353bdbe25caba972759eb531bd5c5d2 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 3 Jun 2022 21:12:28 +0900 Subject: [PATCH 1426/2328] Make MultiplayerClient update CurrentPlaylistItem --- osu.Game/Online/Multiplayer/MultiplayerClient.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index cae675b406..c95f3fa579 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -197,6 +197,7 @@ namespace osu.Game.Online.Multiplayer APIRoom.Playlist.Clear(); APIRoom.Playlist.AddRange(joinedRoom.Playlist.Select(createPlaylistItem)); + APIRoom.CurrentPlaylistItem.Value = APIRoom.Playlist.Single(item => item.ID == joinedRoom.Settings.PlaylistItemId); Debug.Assert(LocalUser != null); addUserToAPIRoom(LocalUser); @@ -737,6 +738,7 @@ namespace osu.Game.Online.Multiplayer APIRoom.Type.Value = Room.Settings.MatchType; APIRoom.QueueMode.Value = Room.Settings.QueueMode; APIRoom.AutoStartDuration.Value = Room.Settings.AutoStartDuration; + APIRoom.CurrentPlaylistItem.Value = APIRoom.Playlist.Single(item => item.ID == settings.PlaylistItemId); RoomUpdated?.Invoke(); } From 3df4d1b0e6328da0d20d1d24e36508666bdb1afb Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 3 Jun 2022 21:17:47 +0900 Subject: [PATCH 1427/2328] Fix incorrect HasPassword value for returned rooms --- osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs b/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs index 3a668d6931..8fea77833e 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs @@ -179,9 +179,15 @@ namespace osu.Game.Tests.Visual.OnlinePlay private Room createResponseRoom(Room room, bool withParticipants) { var responseRoom = cloneRoom(room); + + // Password is hidden from the response, and is only propagated via HasPassword. + bool hadPassword = responseRoom.HasPassword.Value; responseRoom.Password.Value = null; + responseRoom.HasPassword.Value = hadPassword; + if (!withParticipants) responseRoom.RecentParticipants.Clear(); + return responseRoom; } From 365819865e04b490c30784b8fec3805a7a1fdb66 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Wed, 1 Jun 2022 21:00:14 +0900 Subject: [PATCH 1428/2328] Remove 'submit' sample usages --- osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs | 2 +- osu.Game/Graphics/UserInterface/BackButton.cs | 2 +- osu.Game/Graphics/UserInterface/DialogButton.cs | 4 ++-- osu.Game/Graphics/UserInterface/ExternalLinkButton.cs | 2 +- osu.Game/Graphics/UserInterface/HoverSampleSet.cs | 3 --- osu.Game/Online/Chat/DrawableLinkCompiler.cs | 1 - osu.Game/Overlays/News/NewsCard.cs | 2 -- osu.Game/Overlays/News/Sidebar/MonthSection.cs | 2 -- .../Overlays/Profile/Sections/BeatmapMetadataContainer.cs | 2 -- osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs | 2 +- osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs | 2 +- osu.Game/Users/Drawables/ClickableAvatar.cs | 6 ------ osu.Game/Users/Drawables/UpdateableFlag.cs | 2 +- osu.Game/Users/UserPanel.cs | 2 +- 14 files changed, 9 insertions(+), 25 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs index 9a17d6dc9b..08aaa8da42 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs @@ -35,7 +35,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards protected readonly BeatmapDownloadTracker DownloadTracker; protected BeatmapCard(APIBeatmapSet beatmapSet, bool allowExpansion = true) - : base(HoverSampleSet.Submit) + : base(HoverSampleSet.Button) { Expanded = new BindableBool { Disabled = !allowExpansion }; diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index 1b564ef1b4..2b59ee0282 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -21,7 +21,7 @@ namespace osu.Game.Graphics.UserInterface { Size = TwoLayerButton.SIZE_EXTENDED; - Child = button = new TwoLayerButton(HoverSampleSet.Submit) + Child = button = new TwoLayerButton { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index ad69ec4078..69fbd744c9 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -56,8 +56,8 @@ namespace osu.Game.Graphics.UserInterface private readonly SpriteText spriteText; private Vector2 hoverSpacing => new Vector2(3f, 0f); - public DialogButton() - : base(HoverSampleSet.Submit) + public DialogButton(HoverSampleSet sampleSet = HoverSampleSet.Button) + : base(sampleSet) { RelativeSizeAxes = Axes.X; diff --git a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs index 0df69a5b54..1730e1478f 100644 --- a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs +++ b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs @@ -36,7 +36,7 @@ namespace osu.Game.Graphics.UserInterface Icon = FontAwesome.Solid.ExternalLinkAlt, RelativeSizeAxes = Axes.Both }, - new HoverClickSounds(HoverSampleSet.Submit) + new HoverClickSounds() }; } diff --git a/osu.Game/Graphics/UserInterface/HoverSampleSet.cs b/osu.Game/Graphics/UserInterface/HoverSampleSet.cs index a5ea6fcfbf..b88f81a143 100644 --- a/osu.Game/Graphics/UserInterface/HoverSampleSet.cs +++ b/osu.Game/Graphics/UserInterface/HoverSampleSet.cs @@ -10,9 +10,6 @@ namespace osu.Game.Graphics.UserInterface [Description("default")] Default, - [Description("submit")] - Submit, - [Description("button")] Button, diff --git a/osu.Game/Online/Chat/DrawableLinkCompiler.cs b/osu.Game/Online/Chat/DrawableLinkCompiler.cs index 8356b36667..3b0d049528 100644 --- a/osu.Game/Online/Chat/DrawableLinkCompiler.cs +++ b/osu.Game/Online/Chat/DrawableLinkCompiler.cs @@ -38,7 +38,6 @@ namespace osu.Game.Online.Chat } public DrawableLinkCompiler(IEnumerable parts) - : base(HoverSampleSet.Submit) { Parts = parts.ToList(); } diff --git a/osu.Game/Overlays/News/NewsCard.cs b/osu.Game/Overlays/News/NewsCard.cs index 68d0704825..5ce0b9df9c 100644 --- a/osu.Game/Overlays/News/NewsCard.cs +++ b/osu.Game/Overlays/News/NewsCard.cs @@ -14,7 +14,6 @@ using osu.Framework.Platform; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.News @@ -29,7 +28,6 @@ namespace osu.Game.Overlays.News private TextFlowContainer main; public NewsCard(APINewsPost post) - : base(HoverSampleSet.Submit) { this.post = post; diff --git a/osu.Game/Overlays/News/Sidebar/MonthSection.cs b/osu.Game/Overlays/News/Sidebar/MonthSection.cs index aa83f89689..e2ce25660e 100644 --- a/osu.Game/Overlays/News/Sidebar/MonthSection.cs +++ b/osu.Game/Overlays/News/Sidebar/MonthSection.cs @@ -18,7 +18,6 @@ using System.Diagnostics; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Platform; -using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.News.Sidebar { @@ -129,7 +128,6 @@ namespace osu.Game.Overlays.News.Sidebar private readonly APINewsPost post; public PostButton(APINewsPost post) - : base(HoverSampleSet.Submit) { this.post = post; diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index 94ef5e5d86..13465f3bf8 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Profile.Sections { @@ -18,7 +17,6 @@ namespace osu.Game.Overlays.Profile.Sections private readonly IBeatmapInfo beatmapInfo; protected BeatmapMetadataContainer(IBeatmapInfo beatmapInfo) - : base(HoverSampleSet.Submit) { this.beatmapInfo = beatmapInfo; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs index 35c903eb0c..0015cf8bf9 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge private void load(AudioManager audio) { sampleSelect = audio.Samples.Get($@"UI/{HoverSampleSet.Default.GetDescription()}-select"); - sampleJoin = audio.Samples.Get($@"UI/{HoverSampleSet.Submit.GetDescription()}-select"); + sampleJoin = audio.Samples.Get($@"UI/{HoverSampleSet.Button.GetDescription()}-select"); AddRangeInternal(new Drawable[] { diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index 6ecb96f723..df7dd47ef3 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Select.Options public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos); public BeatmapOptionsButton() - : base(HoverSampleSet.Submit) + : base(HoverSampleSet.Button) { Width = width; RelativeSizeAxes = Axes.Y; diff --git a/osu.Game/Users/Drawables/ClickableAvatar.cs b/osu.Game/Users/Drawables/ClickableAvatar.cs index 0dd135b500..d85648c078 100644 --- a/osu.Game/Users/Drawables/ClickableAvatar.cs +++ b/osu.Game/Users/Drawables/ClickableAvatar.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Users.Drawables @@ -74,11 +73,6 @@ namespace osu.Game.Users.Drawables { private LocalisableString tooltip = default_tooltip_text; - public ClickableArea() - : base(HoverSampleSet.Submit) - { - } - public override LocalisableString TooltipText { get => Enabled.Value ? tooltip : default; diff --git a/osu.Game/Users/Drawables/UpdateableFlag.cs b/osu.Game/Users/Drawables/UpdateableFlag.cs index e5debc0683..d0ef760e59 100644 --- a/osu.Game/Users/Drawables/UpdateableFlag.cs +++ b/osu.Game/Users/Drawables/UpdateableFlag.cs @@ -49,7 +49,7 @@ namespace osu.Game.Users.Drawables { RelativeSizeAxes = Axes.Both }, - new HoverClickSounds(HoverSampleSet.Submit) + new HoverClickSounds() } }; } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 248debf1d3..40d70ca406 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -32,7 +32,7 @@ namespace osu.Game.Users protected Drawable Background { get; private set; } protected UserPanel(APIUser user) - : base(HoverSampleSet.Submit) + : base(HoverSampleSet.Button) { if (user == null) throw new ArgumentNullException(nameof(user)); From 2878bb592fc317b36b6f49127da42543027fb28b Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Fri, 3 Jun 2022 22:22:32 +0900 Subject: [PATCH 1429/2328] Use more appropriate sounds for certain components --- .../UserInterface/ShearedToggleButton.cs | 8 ++++-- .../Overlays/BeatmapListing/FilterTabItem.cs | 2 +- .../Chat/Listing/ChannelListingItem.cs | 27 +++++++++++++++++-- .../Header/Components/ExpandDetailsButton.cs | 2 +- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs b/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs index 4780270f66..ee59da7279 100644 --- a/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs +++ b/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs @@ -13,6 +13,7 @@ namespace osu.Game.Graphics.UserInterface { public class ShearedToggleButton : ShearedButton { + private Sample? sampleClick; private Sample? sampleOff; private Sample? sampleOn; @@ -39,8 +40,9 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(AudioManager audio) { - sampleOn = audio.Samples.Get(@"UI/check-on"); - sampleOff = audio.Samples.Get(@"UI/check-off"); + sampleClick = audio.Samples.Get(@"UI/default-select"); + sampleOn = audio.Samples.Get(@"UI/dropdown-open"); + sampleOff = audio.Samples.Get(@"UI/dropdown-close"); } protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds(sampleSet); @@ -67,6 +69,8 @@ namespace osu.Game.Graphics.UserInterface private void playSample() { + sampleClick?.Play(); + if (Active.Value) sampleOn?.Play(); else diff --git a/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs b/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs index 52dfcad2cc..ff43170207 100644 --- a/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs +++ b/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs @@ -40,7 +40,7 @@ namespace osu.Game.Overlays.BeatmapListing Font = OsuFont.GetFont(size: 13, weight: FontWeight.Regular), Text = LabelFor(Value) }, - new HoverClickSounds() + new HoverClickSounds(HoverSampleSet.TabSelect) }); Enabled.Value = true; diff --git a/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs b/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs index 86c81d5d79..2a21d30a4a 100644 --- a/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs +++ b/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs @@ -6,6 +6,8 @@ using System; using System.Collections.Generic; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -16,6 +18,7 @@ using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using osu.Game.Online.Chat; using osuTK; @@ -32,6 +35,8 @@ namespace osu.Game.Overlays.Chat.Listing public IEnumerable FilterTerms => new LocalisableString[] { Channel.Name, Channel.Topic ?? string.Empty }; public bool MatchingFilter { set => this.FadeTo(value ? 1f : 0f, 100); } + protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds(); + private Box hoverBox = null!; private SpriteIcon checkbox = null!; private OsuSpriteText channelText = null!; @@ -46,14 +51,20 @@ namespace osu.Game.Overlays.Chat.Listing private const float vertical_margin = 1.5f; + private Sample? sampleJoin; + private Sample? sampleLeave; + public ChannelListingItem(Channel channel) { Channel = channel; } [BackgroundDependencyLoader] - private void load() + private void load(AudioManager audio) { + sampleJoin = audio.Samples.Get(@"UI/check-on"); + sampleLeave = audio.Samples.Get(@"UI/check-off"); + Masking = true; CornerRadius = 5; RelativeSizeAxes = Axes.X; @@ -156,7 +167,19 @@ namespace osu.Game.Overlays.Chat.Listing } }, true); - Action = () => (channelJoined.Value ? OnRequestLeave : OnRequestJoin)?.Invoke(Channel); + Action = () => + { + if (channelJoined.Value) + { + OnRequestLeave?.Invoke(Channel); + sampleLeave?.Play(); + } + else + { + OnRequestJoin?.Invoke(Channel); + sampleJoin?.Play(); + } + }; } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs b/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs index b4a5d5e31b..4cfdf5cc86 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs @@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Profile.Header.Components private Sample sampleOpen; private Sample sampleClose; - protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds(); + protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverClickSounds(); public ExpandDetailsButton() { From 6115275bc240e72a1744c8917e59d0ecef653cbb Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Fri, 3 Jun 2022 22:28:36 +0900 Subject: [PATCH 1430/2328] Use 'default' sampleset for toolbar and repurpose 'toolbar' select sample temporarily --- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 2 -- osu.Game/Overlays/Toolbar/ToolbarClock.cs | 2 -- osu.Game/Screens/Select/FooterButton.cs | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 4a839b048c..b686f11c13 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -20,7 +20,6 @@ using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; using osuTK; using osuTK.Graphics; @@ -83,7 +82,6 @@ namespace osu.Game.Overlays.Toolbar private RealmAccess realm { get; set; } protected ToolbarButton() - : base(HoverSampleSet.Toolbar) { Width = Toolbar.HEIGHT; RelativeSizeAxes = Axes.Y; diff --git a/osu.Game/Overlays/Toolbar/ToolbarClock.cs b/osu.Game/Overlays/Toolbar/ToolbarClock.cs index 308359570f..12529da07f 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarClock.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarClock.cs @@ -11,7 +11,6 @@ using osu.Framework.Input.Events; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.UserInterface; using osuTK; using osuTK.Graphics; @@ -29,7 +28,6 @@ namespace osu.Game.Overlays.Toolbar private AnalogClockDisplay analog; public ToolbarClock() - : base(HoverSampleSet.Toolbar) { RelativeSizeAxes = Axes.Y; AutoSizeAxes = Axes.X; diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 9cb178ca8b..1587f43258 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -66,7 +66,7 @@ namespace osu.Game.Screens.Select private readonly Box light; public FooterButton() - : base(HoverSampleSet.Button) + : base(HoverSampleSet.Toolbar) { AutoSizeAxes = Axes.Both; Shear = SHEAR; From 396a566a0e577b0f2b1a2ba71ee2f1aa687b6c7b Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Fri, 3 Jun 2022 22:29:03 +0900 Subject: [PATCH 1431/2328] Add some randomness to click samples --- osu.Game/Graphics/UserInterface/HoverClickSounds.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs index 12819840e5..ba253a7c71 100644 --- a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs @@ -7,6 +7,7 @@ using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Extensions; using osu.Framework.Input.Events; +using osu.Framework.Utils; using osuTK.Input; namespace osu.Game.Graphics.UserInterface @@ -37,7 +38,10 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnClick(ClickEvent e) { if (buttons.Contains(e.Button) && Contains(e.ScreenSpaceMousePosition)) - sampleClick?.Play(); + { + sampleClick.Frequency.Value = 0.99 + RNG.NextDouble(0.02); + sampleClick.Play(); + } return base.OnClick(e); } From 64616a6d73b3f074b2b133ff4acfce32c3297ee1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Jun 2022 00:18:54 +0900 Subject: [PATCH 1432/2328] Remove completely gimped implementation in `VolumeMeter` --- osu.Game/Overlays/Volume/VolumeMeter.cs | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index 929c362bd8..5dfcb94faf 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -15,7 +15,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Framework.Threading; using osu.Framework.Utils; @@ -28,7 +27,7 @@ using osuTK.Graphics; namespace osu.Game.Overlays.Volume { - public class VolumeMeter : Container, IKeyBindingHandler, IStateful + public class VolumeMeter : Container, IStateful { private CircularProgress volumeCircle; private CircularProgress volumeCircleGlow; @@ -365,27 +364,6 @@ namespace osu.Game.Overlays.Volume { } - public bool OnPressed(KeyBindingPressEvent e) - { - if (!IsHovered) - return false; - - switch (e.Action) - { - case GlobalAction.SelectPreviousGroup: - State = SelectionState.Selected; - adjust(1, false); - return true; - - case GlobalAction.SelectNextGroup: - State = SelectionState.Selected; - adjust(-1, false); - return true; - } - - return false; - } - public void OnReleased(KeyBindingReleaseEvent e) { } From 712253a35b74d2c5fb4c92bb86e298ebec8f2717 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Jun 2022 01:04:23 +0900 Subject: [PATCH 1433/2328] Make non-localisable strings in `VolumeMeter` verbatim --- osu.Game/Overlays/Volume/VolumeMeter.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index 5dfcb94faf..24d9f785f2 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -79,7 +79,7 @@ namespace osu.Game.Overlays.Volume [BackgroundDependencyLoader] private void load(OsuColour colours, AudioManager audio) { - hoverSample = audio.Samples.Get($"UI/{HoverSampleSet.Button.GetDescription()}-hover"); + hoverSample = audio.Samples.Get($@"UI/{HoverSampleSet.Button.GetDescription()}-hover"); notchSample = audio.Samples.Get(@"UI/notch-tick"); sampleLastPlaybackTime = Time.Current; @@ -131,7 +131,7 @@ namespace osu.Game.Overlays.Volume { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Name = "Progress under covers for smoothing", + Name = @"Progress under covers for smoothing", RelativeSizeAxes = Axes.Both, Rotation = 180, Child = volumeCircle = new CircularProgress @@ -143,7 +143,7 @@ namespace osu.Game.Overlays.Volume }, new Circle { - Name = "Inner Cover", + Name = @"Inner Cover", Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, @@ -152,7 +152,7 @@ namespace osu.Game.Overlays.Volume }, new Container { - Name = "Progress overlay for glow", + Name = @"Progress overlay for glow", Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, From d0e098fbcdb02b597a28b07123605d7aef561205 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Jun 2022 01:04:46 +0900 Subject: [PATCH 1434/2328] Allow using arrow keys to navigate volume controls when controls are already visible --- osu.Game/Overlays/VolumeOverlay.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/osu.Game/Overlays/VolumeOverlay.cs b/osu.Game/Overlays/VolumeOverlay.cs index a96949e96f..9d2ed3f837 100644 --- a/osu.Game/Overlays/VolumeOverlay.cs +++ b/osu.Game/Overlays/VolumeOverlay.cs @@ -17,6 +17,7 @@ using osu.Game.Input.Bindings; using osu.Game.Overlays.Volume; using osuTK; using osuTK.Graphics; +using osuTK.Input; namespace osu.Game.Overlays { @@ -171,6 +172,30 @@ namespace osu.Game.Overlays return base.OnMouseMove(e); } + protected override bool OnKeyDown(KeyDownEvent e) + { + switch (e.Key) + { + case Key.Left: + Adjust(GlobalAction.PreviousVolumeMeter); + return true; + + case Key.Right: + Adjust(GlobalAction.NextVolumeMeter); + return true; + + case Key.Down: + Adjust(GlobalAction.DecreaseVolume); + return true; + + case Key.Up: + Adjust(GlobalAction.IncreaseVolume); + return true; + } + + return base.OnKeyDown(e); + } + protected override bool OnHover(HoverEvent e) { schedulePopOut(); From 045e0446370a7ff0c4b4d7d5035ae7ca92ec3189 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 4 Jun 2022 01:14:41 +0300 Subject: [PATCH 1435/2328] Expose `LegacySkinTransformer`'s underlying skin for pattern-matching --- osu.Game/Skinning/LegacySkinTransformer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Skinning/LegacySkinTransformer.cs b/osu.Game/Skinning/LegacySkinTransformer.cs index 9481fc7182..34714b9dc5 100644 --- a/osu.Game/Skinning/LegacySkinTransformer.cs +++ b/osu.Game/Skinning/LegacySkinTransformer.cs @@ -23,7 +23,7 @@ namespace osu.Game.Skinning /// The which is being transformed. /// [NotNull] - protected internal ISkin Skin { get; } + public ISkin Skin { get; } protected LegacySkinTransformer([NotNull] ISkin skin) { From fe96e15b1b32301d405b8755431f301e0555a80f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 4 Jun 2022 01:15:03 +0300 Subject: [PATCH 1436/2328] Update spinner approach circle to handle `LegacySkinTransformer` --- .../Skinning/Legacy/LegacyNewStyleSpinner.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyNewStyleSpinner.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyNewStyleSpinner.cs index 1e170036e4..a58f62736b 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyNewStyleSpinner.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyNewStyleSpinner.cs @@ -78,7 +78,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy } }); - if (!(source.FindProvider(s => s.GetTexture("spinner-top") != null) is DefaultLegacySkin)) + var topProvider = source.FindProvider(s => s.GetTexture("spinner-top") != null); + + if (topProvider is LegacySkinTransformer transformer && !(transformer.Skin is DefaultLegacySkin)) { AddInternal(ApproachCircle = new Sprite { From b342aad24a906f15da6652935fefdb9aee91c776 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Thu, 2 Jun 2022 20:53:14 -0700 Subject: [PATCH 1437/2328] Revert/fix some incorrectly used sorting localisation --- osu.Game/Screens/Select/Filter/SortMode.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/Filter/SortMode.cs b/osu.Game/Screens/Select/Filter/SortMode.cs index 5dfa2a2664..3dd3381059 100644 --- a/osu.Game/Screens/Select/Filter/SortMode.cs +++ b/osu.Game/Screens/Select/Filter/SortMode.cs @@ -15,7 +15,7 @@ namespace osu.Game.Screens.Select.Filter [Description("Author")] Author, - [LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowStatsBpm))] + [LocalisableDescription(typeof(SortStrings), nameof(SortStrings.ArtistTracksBpm))] BPM, [Description("Date Added")] @@ -28,10 +28,10 @@ namespace osu.Game.Screens.Select.Filter Length, // todo: pending support (https://github.com/ppy/osu/issues/4917) - // [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchFiltersRank))] + // [Description("Rank Achieved")] // RankAchieved, - [LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowInfoSource))] + [Description("Source")] Source, [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingTitle))] From 58c8562cb0d64ef5287a5a5d7dc8ff022dd3ce11 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Thu, 2 Jun 2022 20:30:56 -0700 Subject: [PATCH 1438/2328] Fix username placeholder text casing and missing localisation on registration form --- osu.Game/Overlays/AccountCreation/ScreenEntry.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs index 1be1321d85..f4f958e4a4 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs @@ -5,6 +5,7 @@ using System; using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Utils; @@ -69,7 +70,7 @@ namespace osu.Game.Overlays.AccountCreation }, usernameTextBox = new OsuTextBox { - PlaceholderText = UsersStrings.LoginUsername, + PlaceholderText = UsersStrings.LoginUsername.ToLower(), RelativeSizeAxes = Axes.X, TabbableContentContainer = this }, @@ -91,7 +92,7 @@ namespace osu.Game.Overlays.AccountCreation }, passwordTextBox = new OsuPasswordTextBox { - PlaceholderText = "password", + PlaceholderText = UsersStrings.LoginPassword.ToLower(), RelativeSizeAxes = Axes.X, TabbableContentContainer = this, }, From 4b54fedd88e5389eda73e2f363fc6c8a115032b0 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Thu, 2 Jun 2022 20:28:59 -0700 Subject: [PATCH 1439/2328] Add back hide common string using new `ToSentence()` extension method --- osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 9772b1feb3..98b885eb43 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -8,6 +8,7 @@ using System.Threading; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; @@ -244,7 +245,7 @@ namespace osu.Game.Screens.Select.Carousel } if (hideRequested != null) - items.Add(new OsuMenuItem("Hide", MenuItemType.Destructive, () => hideRequested(beatmapInfo))); + items.Add(new OsuMenuItem(CommonStrings.ButtonsHide.ToSentence(), MenuItemType.Destructive, () => hideRequested(beatmapInfo))); return items.ToArray(); } From 30cf6bffad8a0848ed32ca60f0fd0c8f6c914a71 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Fri, 3 Jun 2022 21:41:34 -0700 Subject: [PATCH 1440/2328] Add tooltips to beatmap card icon pills --- .../Drawables/Cards/BeatmapCardExtra.cs | 5 ++--- .../Drawables/Cards/BeatmapCardNormal.cs | 5 ++--- osu.Game/Beatmaps/Drawables/Cards/IconPill.cs | 8 ++++++-- .../Drawables/Cards/StoryboardIconPill.cs | 19 +++++++++++++++++++ .../Beatmaps/Drawables/Cards/VideoIconPill.cs | 19 +++++++++++++++++++ 5 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 osu.Game/Beatmaps/Drawables/Cards/StoryboardIconPill.cs create mode 100644 osu.Game/Beatmaps/Drawables/Cards/VideoIconPill.cs diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs index 58c1ebee0f..7826d64296 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs @@ -6,7 +6,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Game.Beatmaps.Drawables.Cards.Statistics; using osu.Game.Graphics; @@ -245,10 +244,10 @@ namespace osu.Game.Beatmaps.Drawables.Cards }); if (BeatmapSet.HasVideo) - leftIconArea.Add(new IconPill(FontAwesome.Solid.Film) { IconSize = new Vector2(20) }); + leftIconArea.Add(new VideoIconPill { IconSize = new Vector2(20) }); if (BeatmapSet.HasStoryboard) - leftIconArea.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) }); + leftIconArea.Add(new StoryboardIconPill { IconSize = new Vector2(20) }); if (BeatmapSet.FeaturedInSpotlight) { diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs index 3d7e81de21..c1ba521925 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Game.Beatmaps.Drawables.Cards.Statistics; using osu.Game.Graphics; @@ -226,10 +225,10 @@ namespace osu.Game.Beatmaps.Drawables.Cards }); if (BeatmapSet.HasVideo) - leftIconArea.Add(new IconPill(FontAwesome.Solid.Film) { IconSize = new Vector2(20) }); + leftIconArea.Add(new VideoIconPill { IconSize = new Vector2(20) }); if (BeatmapSet.HasStoryboard) - leftIconArea.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) }); + leftIconArea.Add(new StoryboardIconPill { IconSize = new Vector2(20) }); if (BeatmapSet.FeaturedInSpotlight) { diff --git a/osu.Game/Beatmaps/Drawables/Cards/IconPill.cs b/osu.Game/Beatmaps/Drawables/Cards/IconPill.cs index c55e9c0a28..1b2c5d3ffc 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/IconPill.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/IconPill.cs @@ -3,14 +3,16 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Localisation; using osuTK; using osuTK.Graphics; namespace osu.Game.Beatmaps.Drawables.Cards { - public class IconPill : CircularContainer + public abstract class IconPill : CircularContainer, IHasTooltip { public Vector2 IconSize { @@ -20,7 +22,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards private readonly Container iconContainer; - public IconPill(IconUsage icon) + protected IconPill(IconUsage icon) { AutoSizeAxes = Axes.Both; Masking = true; @@ -47,5 +49,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards }, }; } + + public abstract LocalisableString TooltipText { get; } } } diff --git a/osu.Game/Beatmaps/Drawables/Cards/StoryboardIconPill.cs b/osu.Game/Beatmaps/Drawables/Cards/StoryboardIconPill.cs new file mode 100644 index 0000000000..2ebf9107f5 --- /dev/null +++ b/osu.Game/Beatmaps/Drawables/Cards/StoryboardIconPill.cs @@ -0,0 +1,19 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics.Sprites; +using osu.Framework.Localisation; +using osu.Game.Resources.Localisation.Web; + +namespace osu.Game.Beatmaps.Drawables.Cards +{ + public class StoryboardIconPill : IconPill + { + public StoryboardIconPill() + : base(FontAwesome.Solid.Image) + { + } + + public override LocalisableString TooltipText => BeatmapsetsStrings.ShowInfoStoryboard; + } +} diff --git a/osu.Game/Beatmaps/Drawables/Cards/VideoIconPill.cs b/osu.Game/Beatmaps/Drawables/Cards/VideoIconPill.cs new file mode 100644 index 0000000000..b81e18b0dd --- /dev/null +++ b/osu.Game/Beatmaps/Drawables/Cards/VideoIconPill.cs @@ -0,0 +1,19 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics.Sprites; +using osu.Framework.Localisation; +using osu.Game.Resources.Localisation.Web; + +namespace osu.Game.Beatmaps.Drawables.Cards +{ + public class VideoIconPill : IconPill + { + public VideoIconPill() + : base(FontAwesome.Solid.Film) + { + } + + public override LocalisableString TooltipText => BeatmapsetsStrings.ShowInfoVideo; + } +} From 8ad588d9279058f0746c204e9dfe08e7dbdc43f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Jun 2022 22:12:53 +0900 Subject: [PATCH 1441/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 0058bb3577..ab96504e94 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2285f61331..fd6715c58a 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index b134a7e356..9a36e1073b 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From c0aaeff2b3cfbf7ab75d17ba839af27165986afd Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Sat, 4 Jun 2022 16:11:49 +0100 Subject: [PATCH 1442/2328] Update `DaySeparator` to use new design throughout Moves `DaySeparator` chat component to it's own file and update it to match new chat design. Makes use of several virtual attributes that can be overridden to update spacing and layout in other usage contexts. Remove redundant usage of `ChatOverlayDaySeparator`, since the new design is now part of the base class. Create `StandAloneDaySeparator` to use in `StandAloneChatDisplay` which overrides attributes to match correct spacing and layout for its design. Ensure that `DrawableChannel.CreateDaySeparator` returns type of `DaySeparator` instead of `Drawable`. --- .../Online/TestSceneStandAloneChatDisplay.cs | 4 +- osu.Game/Online/Chat/StandAloneChatDisplay.cs | 34 ++++-- .../Chat/ChatOverlayDrawableChannel.cs | 82 +------------- osu.Game/Overlays/Chat/DaySeparator.cs | 105 ++++++++++++++++++ osu.Game/Overlays/Chat/DrawableChannel.cs | 80 +------------ 5 files changed, 138 insertions(+), 167 deletions(-) create mode 100644 osu.Game/Overlays/Chat/DaySeparator.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs b/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs index 860ef5d565..cb52f41c33 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs @@ -128,11 +128,11 @@ namespace osu.Game.Tests.Visual.Online AddAssert("Ensure no adjacent day separators", () => { - var indices = chatDisplay.FillFlow.OfType().Select(ds => chatDisplay.FillFlow.IndexOf(ds)); + var indices = chatDisplay.FillFlow.OfType().Select(ds => chatDisplay.FillFlow.IndexOf(ds)); foreach (int i in indices) { - if (i < chatDisplay.FillFlow.Count && chatDisplay.FillFlow[i + 1] is DrawableChannel.DaySeparator) + if (i < chatDisplay.FillFlow.Count && chatDisplay.FillFlow[i + 1] is DaySeparator) return false; } diff --git a/osu.Game/Online/Chat/StandAloneChatDisplay.cs b/osu.Game/Online/Chat/StandAloneChatDisplay.cs index b7e1bc999b..f57ffcfe25 100644 --- a/osu.Game/Online/Chat/StandAloneChatDisplay.cs +++ b/osu.Game/Online/Chat/StandAloneChatDisplay.cs @@ -155,9 +155,6 @@ namespace osu.Game.Online.Chat { public Func CreateChatLineAction; - [Resolved] - private OsuColour colours { get; set; } - public StandAloneDrawableChannel(Channel channel) : base(channel) { @@ -166,25 +163,40 @@ namespace osu.Game.Online.Chat [BackgroundDependencyLoader] private void load() { + // TODO: Remove once DrawableChannel & ChatLine padding is fixed ChatLineFlow.Padding = new MarginPadding { Horizontal = 0 }; } protected override ChatLine CreateChatLine(Message m) => CreateChatLineAction(m); - protected override Drawable CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) + protected override DaySeparator CreateDaySeparator(DateTimeOffset time) => new StandAloneDaySeparator(time); + } + + protected class StandAloneDaySeparator : DaySeparator + { + protected override float TextSize => 14; + protected override float LineHeight => 1; + protected override float Spacing => 10; + protected override float DateAlign => 120; + + public StandAloneDaySeparator(DateTimeOffset time) + : base(time) { - TextSize = 14, - Colour = colours.Yellow, - LineHeight = 1, - Padding = new MarginPadding { Horizontal = 10 }, - Margin = new MarginPadding { Vertical = 5 }, - }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Height = 25; + Colour = colours.Yellow; + // TODO: Remove once DrawableChannel & ChatLine padding is fixed + Padding = new MarginPadding { Horizontal = 10 }; + } } protected class StandAloneMessage : ChatLine { protected override float TextSize => 15; - protected override float HorizontalPadding => 10; protected override float MessagePadding => 120; protected override float TimestampPadding => 50; diff --git a/osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs b/osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs index 3b47adc4b7..a5d22f678e 100644 --- a/osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs +++ b/osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs @@ -6,10 +6,6 @@ using System; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; namespace osu.Game.Overlays.Chat @@ -24,85 +20,19 @@ namespace osu.Game.Overlays.Chat [BackgroundDependencyLoader] private void load() { + // TODO: Remove once DrawableChannel & ChatLine padding is fixed ChatLineFlow.Padding = new MarginPadding(0); } - protected override Drawable CreateDaySeparator(DateTimeOffset time) => new ChatOverlayDaySeparator(time); + protected override DaySeparator CreateDaySeparator(DateTimeOffset time) => new ChatOverlayDaySeparator(time); - private class ChatOverlayDaySeparator : Container + private class ChatOverlayDaySeparator : DaySeparator { - private readonly DateTimeOffset time; - public ChatOverlayDaySeparator(DateTimeOffset time) + : base(time) { - this.time = time; - } - - [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - Padding = new MarginPadding { Horizontal = 15, Vertical = 20 }; - Child = new GridContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - ColumnDimensions = new[] - { - new Dimension(GridSizeMode.Absolute, 200), - new Dimension(GridSizeMode.Absolute, 15), - new Dimension(), - }, - Content = new[] - { - new[] - { - new GridContainer - { - RelativeSizeAxes = Axes.Both, - ColumnDimensions = new[] - { - new Dimension(), - new Dimension(GridSizeMode.Absolute, 15), - new Dimension(GridSizeMode.AutoSize), - }, - Content = new[] - { - new[] - { - new Circle - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Colour = colourProvider.Background5, - RelativeSizeAxes = Axes.X, - Height = 2, - }, - Drawable.Empty(), - new OsuSpriteText - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Text = time.ToLocalTime().ToString("dd MMMM yyyy").ToUpper(), - Font = OsuFont.Torus.With(size: 15, weight: FontWeight.SemiBold), - Colour = colourProvider.Content1, - }, - }, - }, - }, - Drawable.Empty(), - new Circle - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Colour = colourProvider.Background5, - RelativeSizeAxes = Axes.X, - Height = 2, - }, - }, - }, - }; + // TODO: Remove once DrawableChannel & ChatLine padding is fixed + Padding = new MarginPadding { Horizontal = 15 }; } } } diff --git a/osu.Game/Overlays/Chat/DaySeparator.cs b/osu.Game/Overlays/Chat/DaySeparator.cs new file mode 100644 index 0000000000..2e3796151c --- /dev/null +++ b/osu.Game/Overlays/Chat/DaySeparator.cs @@ -0,0 +1,105 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using System; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Overlays.Chat +{ + public class DaySeparator : Container + { + protected virtual float TextSize => 15; + + protected virtual float LineHeight => 2; + + protected virtual float DateAlign => 200; + + protected virtual float Spacing => 15; + + private readonly DateTimeOffset time; + + [Resolved(CanBeNull = true)] + private OverlayColourProvider? colourProvider { get; set; } + + public DaySeparator(DateTimeOffset time) + { + this.time = time; + Height = 40; + } + + [BackgroundDependencyLoader] + private void load() + { + RelativeSizeAxes = Axes.X; + Child = new GridContainer + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + RowDimensions = new[] { new Dimension() }, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, DateAlign), + new Dimension(GridSizeMode.Absolute, Spacing), + new Dimension(), + }, + Content = new[] + { + new[] + { + new GridContainer + { + RelativeSizeAxes = Axes.Both, + RowDimensions = new[] { new Dimension() }, + ColumnDimensions = new[] + { + new Dimension(), + new Dimension(GridSizeMode.Absolute, Spacing), + new Dimension(GridSizeMode.AutoSize), + }, + Content = new[] + { + new[] + { + new Circle + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Height = LineHeight, + Colour = colourProvider?.Background5 ?? Colour4.White, + }, + Drawable.Empty(), + new OsuSpriteText + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Text = time.ToLocalTime().ToString("dd MMMM yyyy").ToUpper(), + Font = OsuFont.Torus.With(size: TextSize, weight: FontWeight.SemiBold), + Colour = colourProvider?.Content1 ?? Colour4.White, + }, + } + }, + }, + Drawable.Empty(), + new Circle + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Height = LineHeight, + Colour = colourProvider?.Background5 ?? Colour4.White, + }, + } + } + }; + } + } +} diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index f2d4a3e301..f0d4d12f4f 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -7,14 +7,9 @@ using System.Diagnostics; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; using osu.Game.Graphics.Cursor; -using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; using osuTK.Graphics; @@ -40,9 +35,6 @@ namespace osu.Game.Overlays.Chat } } - [Resolved] - private OsuColour colours { get; set; } - public DrawableChannel(Channel channel) { Channel = channel; @@ -67,7 +59,7 @@ namespace osu.Game.Overlays.Chat Padding = new MarginPadding { Bottom = 5 }, Child = ChatLineFlow = new FillFlowContainer { - Padding = new MarginPadding { Left = 20, Right = 20 }, + Padding = new MarginPadding { Horizontal = 15 }, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, @@ -121,11 +113,7 @@ namespace osu.Game.Overlays.Chat protected virtual ChatLine CreateChatLine(Message m) => new ChatLine(m); - protected virtual Drawable CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) - { - Colour = colours.ChatBlue.Lighten(0.7f), - Margin = new MarginPadding { Vertical = 10 }, - }; + protected virtual DaySeparator CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time); private void newMessagesArrived(IEnumerable newMessages) => Schedule(() => { @@ -203,69 +191,5 @@ namespace osu.Game.Overlays.Chat }); private IEnumerable chatLines => ChatLineFlow.Children.OfType(); - - public class DaySeparator : Container - { - public float TextSize - { - get => text.Font.Size; - set => text.Font = text.Font.With(size: value); - } - - private float lineHeight = 2; - - public float LineHeight - { - get => lineHeight; - set => lineHeight = leftBox.Height = rightBox.Height = value; - } - - private readonly SpriteText text; - private readonly Box leftBox; - private readonly Box rightBox; - - public DaySeparator(DateTimeOffset time) - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - Child = new GridContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - ColumnDimensions = new[] - { - new Dimension(), - new Dimension(GridSizeMode.AutoSize), - new Dimension(), - }, - RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), }, - Content = new[] - { - new Drawable[] - { - leftBox = new Box - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.X, - Height = lineHeight, - }, - text = new OsuSpriteText - { - Margin = new MarginPadding { Horizontal = 10 }, - Text = time.ToLocalTime().ToString("dd MMM yyyy"), - }, - rightBox = new Box - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.X, - Height = lineHeight, - }, - } - } - }; - } - } } } From f1af3205ca2ee2a92727e9c95b0cc8044b215a41 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 5 Jun 2022 13:15:05 +0900 Subject: [PATCH 1443/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index ab96504e94..aad8cf10d0 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index fd6715c58a..ca92d06aed 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 9a36e1073b..a0fafa635b 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 6351f652a2eeaeb2128254638bb9e4143edb5f59 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 6 Jun 2022 17:56:25 +0900 Subject: [PATCH 1444/2328] Fix combo starting at 0 when spectating --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 4a5897c621..df094ddb7c 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -460,6 +460,7 @@ namespace osu.Game.Rulesets.Scoring currentMaximumScoringValues.BaseScore = maximum.BaseScore; currentMaximumScoringValues.MaxCombo = maximum.MaxCombo; + Combo.Value = frame.Header.Combo; HighestCombo.Value = frame.Header.MaxCombo; scoreResultCounts.Clear(); From 4e35ac8d4c5bba0c1577f9ab859b4d319c34dc7c Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 6 Jun 2022 18:01:52 +0900 Subject: [PATCH 1445/2328] Add test --- osu.Game.Tests/Gameplay/TestSceneScoreProcessor.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game.Tests/Gameplay/TestSceneScoreProcessor.cs b/osu.Game.Tests/Gameplay/TestSceneScoreProcessor.cs index af4b002bc9..97be1dcfaa 100644 --- a/osu.Game.Tests/Gameplay/TestSceneScoreProcessor.cs +++ b/osu.Game.Tests/Gameplay/TestSceneScoreProcessor.cs @@ -59,12 +59,14 @@ namespace osu.Game.Tests.Gameplay scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new TestJudgement(HitResult.Great)) { Type = HitResult.Great }); Assert.That(scoreProcessor.TotalScore.Value, Is.EqualTo(1_000_000)); Assert.That(scoreProcessor.JudgedHits, Is.EqualTo(1)); + Assert.That(scoreProcessor.Combo.Value, Is.EqualTo(1)); // No header shouldn't cause any change scoreProcessor.ResetFromReplayFrame(new OsuReplayFrame()); Assert.That(scoreProcessor.TotalScore.Value, Is.EqualTo(1_000_000)); Assert.That(scoreProcessor.JudgedHits, Is.EqualTo(1)); + Assert.That(scoreProcessor.Combo.Value, Is.EqualTo(1)); // Reset with a miss instead. scoreProcessor.ResetFromReplayFrame(new OsuReplayFrame @@ -74,6 +76,7 @@ namespace osu.Game.Tests.Gameplay Assert.That(scoreProcessor.TotalScore.Value, Is.Zero); Assert.That(scoreProcessor.JudgedHits, Is.EqualTo(1)); + Assert.That(scoreProcessor.Combo.Value, Is.EqualTo(0)); // Reset with no judged hit. scoreProcessor.ResetFromReplayFrame(new OsuReplayFrame @@ -83,6 +86,7 @@ namespace osu.Game.Tests.Gameplay Assert.That(scoreProcessor.TotalScore.Value, Is.Zero); Assert.That(scoreProcessor.JudgedHits, Is.Zero); + Assert.That(scoreProcessor.Combo.Value, Is.EqualTo(0)); } private class TestJudgement : Judgement From cd0e0fe70feda949ced24a7b4ba0e3f522001b40 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Jun 2022 18:02:42 +0900 Subject: [PATCH 1446/2328] Fix skin editor not accounting for aspect ratios in base-game sizing logic --- .../Screens/Edit/Components/EditorSidebar.cs | 4 ++- osu.Game/Skinning/Editor/SkinEditor.cs | 6 ++-- osu.Game/Skinning/Editor/SkinEditorOverlay.cs | 31 +++++++++++++++++-- .../Skinning/Editor/SkinEditorSceneLibrary.cs | 4 ++- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/EditorSidebar.cs b/osu.Game/Screens/Edit/Components/EditorSidebar.cs index 4edcef41b1..4e9b1d5222 100644 --- a/osu.Game/Screens/Edit/Components/EditorSidebar.cs +++ b/osu.Game/Screens/Edit/Components/EditorSidebar.cs @@ -16,13 +16,15 @@ namespace osu.Game.Screens.Edit.Components /// internal class EditorSidebar : Container { + public const float WIDTH = 250; + private readonly Box background; protected override Container Content { get; } public EditorSidebar() { - Width = 250; + Width = WIDTH; RelativeSizeAxes = Axes.Y; InternalChildren = new Drawable[] diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index e36d5ca3c6..30c33006ad 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -29,6 +29,8 @@ namespace osu.Game.Skinning.Editor { public const double TRANSITION_DURATION = 500; + public const float MENU_HEIGHT = 40; + public readonly BindableList SelectedComponents = new BindableList(); protected override bool StartHidden => true; @@ -78,8 +80,6 @@ namespace osu.Game.Skinning.Editor { RelativeSizeAxes = Axes.Both; - const float menu_height = 40; - InternalChild = new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, @@ -102,7 +102,7 @@ namespace osu.Game.Skinning.Editor Name = "Menu container", RelativeSizeAxes = Axes.X, Depth = float.MinValue, - Height = menu_height, + Height = MENU_HEIGHT, Children = new Drawable[] { new EditorMenuBar diff --git a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs index 497283a820..6b4b8abe1a 100644 --- a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs +++ b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs @@ -4,14 +4,17 @@ using System.Diagnostics; using JetBrains.Annotations; using osu.Framework.Allocation; +using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; +using osu.Framework.Layout; using osu.Game.Graphics.Containers; using osu.Game.Input.Bindings; using osu.Game.Screens; +using osu.Game.Screens.Edit.Components; namespace osu.Game.Skinning.Editor { @@ -81,15 +84,37 @@ namespace osu.Game.Skinning.Editor protected override void PopOut() => skinEditor?.Hide(); + protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source) + { + if (invalidation.HasFlagFast(Invalidation.DrawSize)) + Scheduler.AddOnce(updateScreenSizing); + + return base.OnInvalidate(invalidation, source); + } + + private void updateScreenSizing() + { + if (skinEditor?.State.Value != Visibility.Visible) return; + + float relativeSidebarWidth = EditorSidebar.WIDTH / DrawWidth; + float relativeToolbarHeight = (SkinEditorSceneLibrary.HEIGHT + SkinEditor.MENU_HEIGHT) / DrawHeight; + + var rect = new RectangleF( + relativeSidebarWidth, + relativeToolbarHeight, + 1 - relativeSidebarWidth * 2, + 1f - relativeToolbarHeight); + + scalingContainer.SetCustomRect(rect, true); + } + private void updateComponentVisibility() { Debug.Assert(skinEditor != null); - const float toolbar_padding_requirement = 0.18f; - if (skinEditor.State.Value == Visibility.Visible) { - scalingContainer.SetCustomRect(new RectangleF(toolbar_padding_requirement, 0.2f, 0.8f - toolbar_padding_requirement, 0.7f), true); + Scheduler.AddOnce(updateScreenSizing); game?.Toolbar.Hide(); game?.CloseAllOverlays(); diff --git a/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs b/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs index 2124ba9b6d..dc5a8aefc0 100644 --- a/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs +++ b/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs @@ -27,6 +27,8 @@ namespace osu.Game.Skinning.Editor { public class SkinEditorSceneLibrary : CompositeDrawable { + public const float HEIGHT = BUTTON_HEIGHT + padding * 2; + public const float BUTTON_HEIGHT = 40; private const float padding = 10; @@ -42,7 +44,7 @@ namespace osu.Game.Skinning.Editor public SkinEditorSceneLibrary() { - Height = BUTTON_HEIGHT + padding * 2; + Height = HEIGHT; } [BackgroundDependencyLoader] From 003a3de270ad5585ce5bdbc02ef2d622bc8b4a84 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Jun 2022 18:06:46 +0900 Subject: [PATCH 1447/2328] Adjust transitions to look better --- osu.Game/Graphics/Containers/ScalingContainer.cs | 14 +++++++------- osu.Game/Skinning/Editor/SkinEditor.cs | 5 ++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index 11bfd80ec1..5c6e315225 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -21,7 +21,7 @@ namespace osu.Game.Graphics.Containers /// public class ScalingContainer : Container { - private const float duration = 500; + internal const float TRANSITION_DURATION = 500; private Bindable sizeX; private Bindable sizeY; @@ -99,7 +99,7 @@ namespace osu.Game.Graphics.Containers if (applyUIScale) { uiScale = osuConfig.GetBindable(OsuSetting.UIScale); - uiScale.BindValueChanged(args => this.TransformTo(nameof(CurrentScale), args.NewValue, duration, Easing.OutQuart), true); + uiScale.BindValueChanged(args => this.TransformTo(nameof(CurrentScale), args.NewValue, TRANSITION_DURATION, Easing.OutQuart), true); } } @@ -163,10 +163,10 @@ namespace osu.Game.Graphics.Containers backgroundStack.Push(new ScalingBackgroundScreen()); } - backgroundStack.FadeIn(duration); + backgroundStack.FadeIn(TRANSITION_DURATION); } else - backgroundStack?.FadeOut(duration); + backgroundStack?.FadeOut(TRANSITION_DURATION); } RectangleF targetRect = new RectangleF(Vector2.Zero, Vector2.One); @@ -195,13 +195,13 @@ namespace osu.Game.Graphics.Containers if (requiresMasking) sizableContainer.Masking = true; - sizableContainer.MoveTo(targetRect.Location, duration, Easing.OutQuart); - sizableContainer.ResizeTo(targetRect.Size, duration, Easing.OutQuart); + sizableContainer.MoveTo(targetRect.Location, TRANSITION_DURATION, Easing.OutQuart); + sizableContainer.ResizeTo(targetRect.Size, TRANSITION_DURATION, Easing.OutQuart); // Of note, this will not work great in the case of nested ScalingContainers where multiple are applying corner radius. // Masking and corner radius should likely only be applied at one point in the full game stack to fix this. // An example of how this can occur is when the skin editor is visible and the game screen scaling is set to "Everything". - sizableContainer.TransformTo(nameof(CornerRadius), requiresMasking ? corner_radius : 0, duration, requiresMasking ? Easing.OutQuart : Easing.None) + sizableContainer.TransformTo(nameof(CornerRadius), requiresMasking ? corner_radius : 0, TRANSITION_DURATION, requiresMasking ? Easing.OutQuart : Easing.None) .OnComplete(_ => { sizableContainer.Masking = requiresMasking; }); } diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index 30c33006ad..095763de18 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -322,7 +322,10 @@ namespace osu.Game.Skinning.Editor protected override void PopIn() { - this.FadeIn(TRANSITION_DURATION, Easing.OutQuint); + this + // align animation to happen after the majority of the ScalingContainer animation completes. + .Delay(ScalingContainer.TRANSITION_DURATION * 0.3f) + .FadeIn(TRANSITION_DURATION, Easing.OutQuint); } protected override void PopOut() From 28c9c61f71e89d80528369718e02d4cbe7a5499f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Jun 2022 18:26:52 +0900 Subject: [PATCH 1448/2328] Fix potential null reference in skin editor if target screen is null (during exit) ```csharp [runtime] 2022-06-06 09:24:31 [verbose]: Host execution state changed to Stopping [runtime] 2022-06-06 09:24:31 [error]: An unhandled error has occurred. [runtime] 2022-06-06 09:24:31 [error]: System.NullReferenceException: Object reference not set to an instance of an object. [runtime] 2022-06-06 09:24:31 [error]: at osu.Game.Skinning.Editor.SkinEditorOverlay.setTarget(OsuScreen target) in /Users/dean/Projects/osu/osu.Game/Skinning/Editor/SkinEditorOverlay.cs:line 173 [runtime] 2022-06-06 09:24:31 [error]: at osu.Framework.Threading.ScheduledDelegate.RunTaskInternal() [runtime] 2022-06-06 09:24:31 [error]: at osu.Framework.Threading.Scheduler.Update() [runtime] 2022-06-06 09:24:31 [error]: at osu.Framework.Graphics.Drawable.UpdateSubTree() [runtime] 2022-06-06 09:24:31 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() [runtime] 2022-06-06 09:24:31 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() [runtime] 2022-06-06 09:24:31 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() [runtime] 2022-06-06 09:24:31 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() ``` --- osu.Game/Skinning/Editor/SkinEditorOverlay.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs index 497283a820..d4acfd1c4e 100644 --- a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs +++ b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs @@ -127,6 +127,9 @@ namespace osu.Game.Skinning.Editor private void setTarget(OsuScreen target) { + if (target == null) + return; + Debug.Assert(skinEditor != null); if (!target.IsLoaded) From a8764b67e1ac962cdbb78d97ddba6ab270167e78 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Jun 2022 18:27:41 +0900 Subject: [PATCH 1449/2328] Add padding and avoid using invalidation (triggers too often when toolbar is being toggled) --- osu.Game/Skinning/Editor/SkinEditorOverlay.cs | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs index 6b4b8abe1a..c96abe3e1e 100644 --- a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs +++ b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs @@ -15,6 +15,7 @@ using osu.Game.Graphics.Containers; using osu.Game.Input.Bindings; using osu.Game.Screens; using osu.Game.Screens.Edit.Components; +using osuTK; namespace osu.Game.Skinning.Editor { @@ -36,6 +37,8 @@ namespace osu.Game.Skinning.Editor private OsuScreen lastTargetScreen; + private Vector2 lastDrawSize; + public SkinEditorOverlay(ScalingContainer scalingContainer) { this.scalingContainer = scalingContainer; @@ -92,18 +95,31 @@ namespace osu.Game.Skinning.Editor return base.OnInvalidate(invalidation, source); } + protected override void Update() + { + base.Update(); + + if (game.DrawSize != lastDrawSize) + { + lastDrawSize = game.DrawSize; + updateScreenSizing(); + } + } + private void updateScreenSizing() { if (skinEditor?.State.Value != Visibility.Visible) return; - float relativeSidebarWidth = EditorSidebar.WIDTH / DrawWidth; - float relativeToolbarHeight = (SkinEditorSceneLibrary.HEIGHT + SkinEditor.MENU_HEIGHT) / DrawHeight; + const float padding = 10; + + float relativeSidebarWidth = (EditorSidebar.WIDTH + padding) / DrawWidth; + float relativeToolbarHeight = (SkinEditorSceneLibrary.HEIGHT + SkinEditor.MENU_HEIGHT + padding) / DrawHeight; var rect = new RectangleF( relativeSidebarWidth, relativeToolbarHeight, 1 - relativeSidebarWidth * 2, - 1f - relativeToolbarHeight); + 1f - relativeToolbarHeight - padding / DrawHeight); scalingContainer.SetCustomRect(rect, true); } From 3862681d94d93b1a6642b15d2416d31102a8754b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Jun 2022 19:43:08 +0900 Subject: [PATCH 1450/2328] Change `skin.ini` boolean parsing to match osu!stable Closes https://github.com/ppy/osu/issues/18579. --- osu.Game/Skinning/LegacySkin.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index b65ba8b04c..9524d3f615 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -303,8 +303,13 @@ namespace osu.Game.Skinning if (Configuration.ConfigDictionary.TryGetValue(lookup.ToString(), out string val)) { // special case for handling skins which use 1 or 0 to signify a boolean state. + // ..or in some cases 2 (https://github.com/ppy/osu/issues/18579). if (typeof(TValue) == typeof(bool)) - val = val == "1" ? "true" : "false"; + { + val = bool.TryParse(val, out bool boolVal) + ? Convert.ChangeType(boolVal, typeof(bool)).ToString() + : Convert.ChangeType(Convert.ToInt32(val), typeof(bool)).ToString(); + } var bindable = new Bindable(); if (val != null) From da000ee5f0f28b162ae5f09054158e62123f03d2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Jun 2022 20:11:43 +0900 Subject: [PATCH 1451/2328] Centralise video file extensions --- osu.Game/Beatmaps/BeatmapModelManager.cs | 4 ++-- osu.Game/Graphics/UserInterfaceV2/OsuFileSelector.cs | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapModelManager.cs b/osu.Game/Beatmaps/BeatmapModelManager.cs index 9d3ea7d192..541a78089e 100644 --- a/osu.Game/Beatmaps/BeatmapModelManager.cs +++ b/osu.Game/Beatmaps/BeatmapModelManager.cs @@ -34,7 +34,7 @@ namespace osu.Game.Beatmaps protected override string[] HashableFileTypes => new[] { ".osu" }; - private static readonly string[] video_extensions = { ".mp4", ".mov", ".avi", ".flv" }; + public static readonly string[] VIDEO_EXTENSIONS = { ".mp4", ".mov", ".avi", ".flv" }; public BeatmapModelManager(RealmAccess realm, Storage storage, BeatmapOnlineLookupQueue? onlineLookupQueue = null) : base(realm, storage, onlineLookupQueue) @@ -146,7 +146,7 @@ namespace osu.Game.Beatmaps notification.Text = $"Deleting videos from {HumanisedModelName}s ({++i} of {items.Count})"; - var video = b.Files.FirstOrDefault(f => video_extensions.Any(ex => f.Filename.EndsWith(ex, StringComparison.Ordinal))); + var video = b.Files.FirstOrDefault(f => VIDEO_EXTENSIONS.Any(ex => f.Filename.EndsWith(ex, StringComparison.Ordinal))); if (video != null) DeleteFile(b, video); diff --git a/osu.Game/Graphics/UserInterfaceV2/OsuFileSelector.cs b/osu.Game/Graphics/UserInterfaceV2/OsuFileSelector.cs index 3d09d09833..d9dbf4974b 100644 --- a/osu.Game/Graphics/UserInterfaceV2/OsuFileSelector.cs +++ b/osu.Game/Graphics/UserInterfaceV2/OsuFileSelector.cs @@ -2,11 +2,13 @@ // See the LICENCE file in the repository root for full licence text. using System.IO; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; +using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -65,6 +67,9 @@ namespace osu.Game.Graphics.UserInterfaceV2 { get { + if (BeatmapModelManager.VIDEO_EXTENSIONS.Contains(File.Extension)) + return FontAwesome.Regular.FileVideo; + switch (File.Extension) { case @".ogg": @@ -77,12 +82,6 @@ namespace osu.Game.Graphics.UserInterfaceV2 case @".png": return FontAwesome.Regular.FileImage; - case @".mp4": - case @".avi": - case @".mov": - case @".flv": - return FontAwesome.Regular.FileVideo; - default: return FontAwesome.Regular.File; } From b104b7a90d3a50f3c89ac791a8d5bf316a686600 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Jun 2022 20:12:18 +0900 Subject: [PATCH 1452/2328] Rename method to mention "all" --- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- .../Overlays/Settings/Sections/Maintenance/GeneralSettings.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 92266924df..dba457c81c 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -319,7 +319,7 @@ namespace osu.Game.Beatmaps }); } - public void DeleteVideos() + public void DeleteAllVideos() { realm.Write(r => { diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs index 37758875ea..054de8dbd7 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -67,7 +67,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance dialogOverlay?.Push(new MassVideoDeleteConfirmationDialog(() => { deleteBeatmapVideosButton.Enabled.Value = false; - Task.Run(beatmaps.DeleteVideos).ContinueWith(t => Schedule(() => deleteBeatmapVideosButton.Enabled.Value = true)); + Task.Run(beatmaps.DeleteAllVideos).ContinueWith(t => Schedule(() => deleteBeatmapVideosButton.Enabled.Value = true)); })); } }); From f96340e37d3d852a67132175dd0bffc70d8b360e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Jun 2022 20:18:32 +0900 Subject: [PATCH 1453/2328] Improve messaging of deletion progress / completion --- osu.Game/Beatmaps/BeatmapModelManager.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapModelManager.cs b/osu.Game/Beatmaps/BeatmapModelManager.cs index 541a78089e..ed64a43097 100644 --- a/osu.Game/Beatmaps/BeatmapModelManager.cs +++ b/osu.Game/Beatmaps/BeatmapModelManager.cs @@ -130,13 +130,15 @@ namespace osu.Game.Beatmaps { Progress = 0, Text = $"Preparing to delete all {HumanisedModelName} videos...", - CompletionText = $"Deleted all {HumanisedModelName} videos!", + CompletionText = $"No videos found to delete!", State = ProgressNotificationState.Active, }; + if (!silent) PostNotification?.Invoke(notification); int i = 0; + int deleted = 0; foreach (var b in items) { @@ -144,13 +146,18 @@ namespace osu.Game.Beatmaps // user requested abort return; - notification.Text = $"Deleting videos from {HumanisedModelName}s ({++i} of {items.Count})"; - var video = b.Files.FirstOrDefault(f => VIDEO_EXTENSIONS.Any(ex => f.Filename.EndsWith(ex, StringComparison.Ordinal))); - if (video != null) - DeleteFile(b, video); - notification.Progress = (float)i / items.Count; + if (video != null) + { + DeleteFile(b, video); + deleted++; + notification.CompletionText = $"Deleted {deleted} {HumanisedModelName} video(s)!"; + } + + notification.Text = $"Deleting videos from {HumanisedModelName}s ({deleted} deleted)"; + + notification.Progress = (float)++i / items.Count; } notification.State = ProgressNotificationState.Completed; From 3b4b35c51e3618e995058dde2494053d76e704f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Jun 2022 20:18:57 +0900 Subject: [PATCH 1454/2328] Remove unnecessary string interpolation --- osu.Game/Beatmaps/BeatmapModelManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapModelManager.cs b/osu.Game/Beatmaps/BeatmapModelManager.cs index ed64a43097..277047348e 100644 --- a/osu.Game/Beatmaps/BeatmapModelManager.cs +++ b/osu.Game/Beatmaps/BeatmapModelManager.cs @@ -130,7 +130,7 @@ namespace osu.Game.Beatmaps { Progress = 0, Text = $"Preparing to delete all {HumanisedModelName} videos...", - CompletionText = $"No videos found to delete!", + CompletionText = "No videos found to delete!", State = ProgressNotificationState.Active, }; From 211f0d1e04c5cad2d892dfae2086f1bb299db163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 6 Jun 2022 19:57:08 +0200 Subject: [PATCH 1455/2328] Expand test coverage for parsing bool skin config values --- .../Skins/TestSceneSkinConfigurationLookup.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Skins/TestSceneSkinConfigurationLookup.cs b/osu.Game.Tests/Skins/TestSceneSkinConfigurationLookup.cs index d3cacaa88c..d68398236a 100644 --- a/osu.Game.Tests/Skins/TestSceneSkinConfigurationLookup.cs +++ b/osu.Game.Tests/Skins/TestSceneSkinConfigurationLookup.cs @@ -59,11 +59,13 @@ namespace osu.Game.Tests.Skins AddAssert("Check float parse lookup", () => requester.GetConfig("FloatTest")?.Value == 1.1f); } - [Test] - public void TestBoolLookup() + [TestCase("0", false)] + [TestCase("1", true)] + [TestCase("2", true)] // https://github.com/ppy/osu/issues/18579 + public void TestBoolLookup(string originalValue, bool expectedParsedValue) { - AddStep("Add config values", () => userSource.Configuration.ConfigDictionary["BoolTest"] = "1"); - AddAssert("Check bool parse lookup", () => requester.GetConfig("BoolTest")?.Value == true); + AddStep("Add config values", () => userSource.Configuration.ConfigDictionary["BoolTest"] = originalValue); + AddAssert("Check bool parse lookup", () => requester.GetConfig("BoolTest")?.Value == expectedParsedValue); } [Test] From 0eaf420fa1d20c94b1b867f204294ddbff04a560 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 7 Jun 2022 00:29:14 +0300 Subject: [PATCH 1456/2328] Specify full size for spinner ticks container --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index a904658a4c..fa095edafa 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -79,7 +79,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { Result = { BindTarget = SpinsPerMinute }, }, - ticks = new Container(), + ticks = new Container + { + RelativeSizeAxes = Axes.Both, + }, new AspectContainer { Anchor = Anchor.Centre, From 4158146c719f6ef3d7f58991b284cf599426d8e5 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 7 Jun 2022 00:29:53 +0300 Subject: [PATCH 1457/2328] Fix spinenr tick samples not positioned at centre Causing samples to be played at left ear rather than centre. --- .../Objects/Drawables/DrawableSpinnerTick.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs index 726fbd3ea6..39239c8233 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Graphics; + namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSpinnerTick : DrawableOsuHitObject @@ -10,13 +12,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected DrawableSpinner DrawableSpinner => (DrawableSpinner)ParentHitObject; public DrawableSpinnerTick() - : base(null) + : this(null) { } public DrawableSpinnerTick(SpinnerTick spinnerTick) : base(spinnerTick) { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; } protected override double MaximumJudgementOffset => DrawableSpinner.HitObject.Duration; From b6e97e699a9f411f07062228697713e9a61b5539 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 7 Jun 2022 00:34:18 +0300 Subject: [PATCH 1458/2328] Remove unnecessary position specification --- osu.Game.Rulesets.Osu/Objects/Spinner.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index ddee4d3ebd..1a130e96b3 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -69,8 +69,8 @@ namespace osu.Game.Rulesets.Osu.Objects double startTime = StartTime + (float)(i + 1) / totalSpins * Duration; AddNested(i < SpinsRequired - ? new SpinnerTick { StartTime = startTime, Position = Position } - : new SpinnerBonusTick { StartTime = startTime, Position = Position }); + ? new SpinnerTick { StartTime = startTime } + : new SpinnerBonusTick { StartTime = startTime }); } } From 46eba86ad17f9721c57f66fbb7578b9b8e59695b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 09:29:30 +0900 Subject: [PATCH 1459/2328] Remove unintended left-over invalidation code --- osu.Game/Skinning/Editor/SkinEditorOverlay.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs index c96abe3e1e..ffd94e0aad 100644 --- a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs +++ b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs @@ -4,13 +4,11 @@ using System.Diagnostics; using JetBrains.Annotations; using osu.Framework.Allocation; -using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; -using osu.Framework.Layout; using osu.Game.Graphics.Containers; using osu.Game.Input.Bindings; using osu.Game.Screens; @@ -87,14 +85,6 @@ namespace osu.Game.Skinning.Editor protected override void PopOut() => skinEditor?.Hide(); - protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source) - { - if (invalidation.HasFlagFast(Invalidation.DrawSize)) - Scheduler.AddOnce(updateScreenSizing); - - return base.OnInvalidate(invalidation, source); - } - protected override void Update() { base.Update(); From de224e79c79863f268367392574df539d6ddac80 Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Tue, 7 Jun 2022 10:32:51 +0800 Subject: [PATCH 1460/2328] Limit slider rotation when the slider is too large --- .../OsuHitObjectGenerationUtils_Reposition.cs | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs index a77d1f8b0f..477ef2d55d 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs @@ -198,6 +198,27 @@ namespace osu.Game.Rulesets.Osu.Utils var slider = (Slider)workingObject.HitObject; var possibleMovementBounds = calculatePossibleMovementBounds(slider); + // The slider rotation applied in computeModifiedPosition might make it impossible to fit the slider into the playfield + // For example, a long horizontal slider will be off-screen when rotated by 90 degrees + // In this case, limit the rotation to either 0 or 180 degrees + if (possibleMovementBounds.Width < 0 || possibleMovementBounds.Height < 0) + { + float currentRotation = getSliderRotation(slider); + float diff1 = getAngleDifference(workingObject.RotationOriginal, currentRotation); + float diff2 = getAngleDifference(workingObject.RotationOriginal + MathF.PI, currentRotation); + + if (diff1 < diff2) + { + RotateSlider(slider, workingObject.RotationOriginal - getSliderRotation(slider)); + } + else + { + RotateSlider(slider, workingObject.RotationOriginal + MathF.PI - getSliderRotation(slider)); + } + + possibleMovementBounds = calculatePossibleMovementBounds(slider); + } + var previousPosition = workingObject.PositionModified; // Clamp slider position to the placement area @@ -355,6 +376,18 @@ namespace osu.Game.Rulesets.Osu.Utils return MathF.Atan2(endPositionVector.Y, endPositionVector.X); } + /// + /// Get the absolute difference between 2 angles measured in Radians. + /// + /// The first angle + /// The second angle + /// The absolute difference with interval [0, MathF.PI) + private static float getAngleDifference(float angle1, float angle2) + { + float diff = MathF.Abs(angle1 - angle2) % (MathF.PI * 2); + return MathF.Min(diff, MathF.PI * 2 - diff); + } + public class ObjectPositionInfo { /// @@ -397,6 +430,7 @@ namespace osu.Game.Rulesets.Osu.Utils private class WorkingObject { + public float RotationOriginal { get; } public Vector2 PositionOriginal { get; } public Vector2 PositionModified { get; set; } public Vector2 EndPositionModified { get; set; } @@ -407,6 +441,7 @@ namespace osu.Game.Rulesets.Osu.Utils public WorkingObject(ObjectPositionInfo positionInfo) { PositionInfo = positionInfo; + RotationOriginal = HitObject is Slider slider ? getSliderRotation(slider) : 0; PositionModified = PositionOriginal = HitObject.Position; EndPositionModified = HitObject.EndPosition; } From 0bfbfc6411afaf3315b151594832f4d62e518a6c Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 7 Jun 2022 11:51:24 +0900 Subject: [PATCH 1461/2328] Update package --- .config/dotnet-tools.json | 2 +- osu.Game/osu.Game.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 65ac05261a..cbd0231fdb 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -21,7 +21,7 @@ ] }, "ppy.localisationanalyser.tools": { - "version": "2022.417.0", + "version": "2022.607.0", "commands": [ "localisation" ] diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index ca92d06aed..63b8cf4cb5 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -31,7 +31,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive From f576d53aed47845b562360dd77c5d018d5a3cef2 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 7 Jun 2022 11:54:31 +0900 Subject: [PATCH 1462/2328] Update some unmatching strings --- osu.Game/Localisation/AudioSettingsStrings.cs | 6 +++--- osu.Game/Localisation/GlobalActionKeyBindingStrings.cs | 4 ++-- osu.Game/Localisation/JoystickSettingsStrings.cs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Localisation/AudioSettingsStrings.cs b/osu.Game/Localisation/AudioSettingsStrings.cs index f298717c99..0f0f560df9 100644 --- a/osu.Game/Localisation/AudioSettingsStrings.cs +++ b/osu.Game/Localisation/AudioSettingsStrings.cs @@ -30,12 +30,12 @@ namespace osu.Game.Localisation public static LocalisableString OutputDevice => new TranslatableString(getKey(@"output_device"), @"Output device"); /// - /// "Master" + /// "Hitsound stereo separation" /// public static LocalisableString PositionalLevel => new TranslatableString(getKey(@"positional_hitsound_audio_level"), @"Hitsound stereo separation"); /// - /// "Level" + /// "Master" /// public static LocalisableString MasterVolume => new TranslatableString(getKey(@"master_volume"), @"Master"); @@ -69,6 +69,6 @@ namespace osu.Game.Localisation /// public static LocalisableString OffsetWizard => new TranslatableString(getKey(@"offset_wizard"), @"Offset wizard"); - private static string getKey(string key) => $"{prefix}:{key}"; + private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs index 586e29a432..82d03dbb5b 100644 --- a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs +++ b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs @@ -210,7 +210,7 @@ namespace osu.Game.Localisation public static LocalisableString ToggleInGameInterface => new TranslatableString(getKey(@"toggle_in_game_interface"), @"Toggle in-game interface"); /// - /// "Toggle Mod Select" + /// "Toggle mod select" /// public static LocalisableString ToggleModSelection => new TranslatableString(getKey(@"toggle_mod_selection"), @"Toggle mod select"); @@ -299,6 +299,6 @@ namespace osu.Game.Localisation /// public static LocalisableString ToggleChatFocus => new TranslatableString(getKey(@"toggle_chat_focus"), @"Toggle chat focus"); - private static string getKey(string key) => $"{prefix}:{key}"; + private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game/Localisation/JoystickSettingsStrings.cs b/osu.Game/Localisation/JoystickSettingsStrings.cs index 410cd0a6f5..976ec1adde 100644 --- a/osu.Game/Localisation/JoystickSettingsStrings.cs +++ b/osu.Game/Localisation/JoystickSettingsStrings.cs @@ -15,10 +15,10 @@ namespace osu.Game.Localisation public static LocalisableString JoystickGamepad => new TranslatableString(getKey(@"joystick_gamepad"), @"Joystick / Gamepad"); /// - /// "Deadzone Threshold" + /// "Deadzone" /// public static LocalisableString DeadzoneThreshold => new TranslatableString(getKey(@"deadzone_threshold"), @"Deadzone"); private static string getKey(string key) => $@"{prefix}:{key}"; } -} \ No newline at end of file +} From ef5d601f6783ab6e5d0cc452e8a00f142132288e Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Tue, 7 Jun 2022 12:05:03 +0800 Subject: [PATCH 1463/2328] Fix difficulty name overflow in score panel --- .../Visual/Ranking/TestSceneExpandedPanelMiddleContent.cs | 1 + osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelMiddleContent.cs b/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelMiddleContent.cs index 8b646df362..2a31728f87 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelMiddleContent.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelMiddleContent.cs @@ -96,6 +96,7 @@ namespace osu.Game.Tests.Visual.Ranking beatmap.Metadata.Author = author; beatmap.Metadata.Title = "Verrrrrrrrrrrrrrrrrrry looooooooooooooooooooooooong beatmap title"; beatmap.Metadata.Artist = "Verrrrrrrrrrrrrrrrrrry looooooooooooooooooooooooong beatmap artist"; + beatmap.DifficultyName = "Verrrrrrrrrrrrrrrrrrry looooooooooooooooooooooooong difficulty name"; return beatmap; } diff --git a/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs b/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs index 5b3129dad6..b924fbd5df 100644 --- a/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs +++ b/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs @@ -159,6 +159,8 @@ namespace osu.Game.Screens.Ranking.Expanded Origin = Anchor.TopCentre, Text = beatmap.DifficultyName, Font = OsuFont.Torus.With(size: 16, weight: FontWeight.SemiBold), + MaxWidth = ScorePanel.EXPANDED_WIDTH - padding * 2, + Truncate = true, }, new OsuTextFlowContainer(s => s.Font = OsuFont.Torus.With(size: 12)) { From ac5b1fba1fc5993a61d60cbdcd7e48c20f6809c6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 15:36:26 +0900 Subject: [PATCH 1464/2328] Add blacklisted auto-import rules which conflict with osu!/osu!framework naming --- osu.sln.DotSettings | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 68cf8138e2..286a1eb29f 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -790,6 +790,15 @@ See the LICENCE file in the repository root for full licence text. <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + True + True + True + True + True + True + True + True + True True True True From df9174ec009fe71e873ea5712937fa85cd1a8a51 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 15:40:54 +0900 Subject: [PATCH 1465/2328] Remove import popup dialog from song select This has been replaced in spirit by the first run overlay. --- .../Navigation/TestSceneScreenNavigation.cs | 2 -- .../Screens/Select/ImportFromStablePopup.cs | 33 ------------------- osu.Game/Screens/Select/SongSelect.cs | 30 +++-------------- 3 files changed, 4 insertions(+), 61 deletions(-) delete mode 100644 osu.Game/Screens/Select/ImportFromStablePopup.cs diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs index c1f5f110d1..51bb27f93e 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs @@ -609,8 +609,6 @@ namespace osu.Game.Tests.Visual.Navigation public ModSelectOverlay ModSelectOverlay => ModSelect; public BeatmapOptionsOverlay BeatmapOptionsOverlay => BeatmapOptions; - - protected override bool DisplayStableImportPrompt => false; } } } diff --git a/osu.Game/Screens/Select/ImportFromStablePopup.cs b/osu.Game/Screens/Select/ImportFromStablePopup.cs deleted file mode 100644 index d8137432bd..0000000000 --- a/osu.Game/Screens/Select/ImportFromStablePopup.cs +++ /dev/null @@ -1,33 +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 System; -using osu.Framework.Graphics.Sprites; -using osu.Game.Overlays.Dialog; - -namespace osu.Game.Screens.Select -{ - public class ImportFromStablePopup : PopupDialog - { - public ImportFromStablePopup(Action importFromStable) - { - HeaderText = @"You have no beatmaps!"; - BodyText = "Would you like to import your beatmaps, skins, collections and scores from an existing osu!stable installation?\nThis will create a second copy of all files on disk."; - - Icon = FontAwesome.Solid.Plane; - - Buttons = new PopupDialogButton[] - { - new PopupDialogOkButton - { - Text = @"Yes please!", - Action = importFromStable - }, - new PopupDialogCancelButton - { - Text = @"No, I'd like to start from scratch", - }, - }; - } - } -} diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 8870239485..242e741475 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -28,7 +28,6 @@ using osuTK.Input; using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using osu.Framework.Audio.Track; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Bindings; @@ -37,7 +36,6 @@ using osu.Game.Graphics.UserInterface; using System.Diagnostics; using JetBrains.Annotations; using osu.Game.Screens.Play; -using osu.Game.Database; using osu.Game.Skinning; namespace osu.Game.Screens.Select @@ -59,8 +57,6 @@ namespace osu.Game.Screens.Select protected virtual bool ShowFooter => true; - protected virtual bool DisplayStableImportPrompt => legacyImportManager?.SupportsImportFromStable == true; - public override bool? AllowTrackAdjustments => true; /// @@ -94,14 +90,13 @@ namespace osu.Game.Screens.Select protected Container LeftArea { get; private set; } private BeatmapInfoWedge beatmapInfoWedge; - private IDialogOverlay dialogOverlay; + + [Resolved] + private IDialogOverlay dialogOverlay { get; set; } [Resolved] private BeatmapManager beatmaps { get; set; } - [Resolved(CanBeNull = true)] - private LegacyImportManager legacyImportManager { get; set; } - protected ModSelectOverlay ModSelect { get; private set; } protected Sample SampleConfirm { get; private set; } @@ -127,7 +122,7 @@ namespace osu.Game.Screens.Select internal IOverlayManager OverlayManager { get; private set; } [BackgroundDependencyLoader(true)] - private void load(AudioManager audio, IDialogOverlay dialog, OsuColour colours, ManageCollectionsDialog manageCollectionsDialog, DifficultyRecommender recommender) + private void load(AudioManager audio, OsuColour colours, ManageCollectionsDialog manageCollectionsDialog, DifficultyRecommender recommender) { // initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter). transferRulesetValue(); @@ -289,26 +284,9 @@ namespace osu.Game.Screens.Select BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo)); } - dialogOverlay = dialog; - sampleChangeDifficulty = audio.Samples.Get(@"SongSelect/select-difficulty"); sampleChangeBeatmap = audio.Samples.Get(@"SongSelect/select-expand"); SampleConfirm = audio.Samples.Get(@"SongSelect/confirm-selection"); - - if (dialogOverlay != null) - { - Schedule(() => - { - // if we have no beatmaps, let's prompt the user to import from over a stable install if he has one. - if (beatmaps.QueryBeatmapSet(s => !s.Protected && !s.DeletePending) == null && DisplayStableImportPrompt) - { - dialogOverlay.Push(new ImportFromStablePopup(() => - { - Task.Run(() => legacyImportManager.ImportFromStableAsync(StableContent.All)); - })); - } - }); - } } protected override void LoadComplete() From 0d32c94104d9da5b47d5b835d2cf91d6a0d077f6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 16:32:15 +0900 Subject: [PATCH 1466/2328] Add initial implementation of beatmap carousel no-results-placeholder --- .../SongSelect/TestScenePlaySongSelect.cs | 34 +++++ osu.Game/Screens/Select/BeatmapCarousel.cs | 15 ++- .../Screens/Select/NoResultsPlaceholder.cs | 122 ++++++++++++++++++ 3 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Screens/Select/NoResultsPlaceholder.cs diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index aad7f6b301..77f5bd83d6 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -18,6 +18,7 @@ using osu.Game.Database; using osu.Game.Extensions; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Online.Chat; using osu.Game.Overlays; using osu.Game.Overlays.Mods; using osu.Game.Rulesets; @@ -80,6 +81,37 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep("delete all beatmaps", () => manager?.Delete()); } + [Test] + public void TestPlaceholderBeatmapPresence() + { + createSongSelect(); + + AddUntilStep("wait for placeholder visible", () => getPlaceholder()?.State.Value == Visibility.Visible); + + addRulesetImportStep(0); + AddUntilStep("wait for placeholder hidden", () => getPlaceholder()?.State.Value == Visibility.Hidden); + + AddStep("delete all beatmaps", () => manager?.Delete()); + AddUntilStep("wait for placeholder visible", () => getPlaceholder()?.State.Value == Visibility.Visible); + } + + [Test] + public void TestPlaceholderConvertSetting() + { + changeRuleset(2); + addRulesetImportStep(0); + AddStep("change convert setting", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, false)); + + createSongSelect(); + + AddUntilStep("wait for placeholder visible", () => getPlaceholder()?.State.Value == Visibility.Visible); + + AddStep("click link in placeholder", () => getPlaceholder().ChildrenOfType().First().TriggerClick()); + + AddUntilStep("convert setting changed", () => config.Get(OsuSetting.ShowConvertedBeatmaps)); + AddUntilStep("wait for placeholder visible", () => getPlaceholder()?.State.Value == Visibility.Hidden); + } + [Test] public void TestSingleFilterOnEnter() { @@ -941,6 +973,8 @@ namespace osu.Game.Tests.Visual.SongSelect private int getBeatmapIndex(BeatmapSetInfo set, BeatmapInfo info) => set.Beatmaps.IndexOf(info); + private NoResultsPlaceholder getPlaceholder() => songSelect.ChildrenOfType().FirstOrDefault(); + private int getCurrentBeatmapIndex() => getBeatmapIndex(songSelect.Carousel.SelectedBeatmapSet, songSelect.Carousel.SelectedBeatmapInfo); private int getDifficultyIconIndex(DrawableCarouselBeatmapSet set, FilterableDifficultyIcon icon) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index a59f14647d..b7d253d7de 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -97,6 +97,8 @@ namespace osu.Game.Screens.Select protected readonly CarouselScrollContainer Scroll; + private readonly NoResultsPlaceholder noResultsPlaceholder; + private IEnumerable beatmapSets => root.Children.OfType(); // todo: only used for testing, maybe remove. @@ -170,7 +172,8 @@ namespace osu.Game.Screens.Select Scroll = new CarouselScrollContainer { RelativeSizeAxes = Axes.Both, - } + }, + noResultsPlaceholder = new NoResultsPlaceholder() } }; } @@ -648,8 +651,18 @@ namespace osu.Game.Screens.Select // First we iterate over all non-filtered carousel items and populate their // vertical position data. if (revalidateItems) + { updateYPositions(); + if (visibleItems.Count == 0) + { + noResultsPlaceholder.Filter = activeCriteria; + noResultsPlaceholder.Show(); + } + else + noResultsPlaceholder.Hide(); + } + // if there is a pending scroll action we apply it without animation and transfer the difference in position to the panels. // this is intentionally applied before updating the visible range below, to avoid animating new items (sourced from pool) from locations off-screen, as it looks bad. if (pendingScrollOperation != PendingScrollOperation.None) diff --git a/osu.Game/Screens/Select/NoResultsPlaceholder.cs b/osu.Game/Screens/Select/NoResultsPlaceholder.cs new file mode 100644 index 0000000000..0188dbd7db --- /dev/null +++ b/osu.Game/Screens/Select/NoResultsPlaceholder.cs @@ -0,0 +1,122 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Game.Beatmaps; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Online.Chat; +using osu.Game.Overlays; +using osuTK; + +namespace osu.Game.Screens.Select +{ + public class NoResultsPlaceholder : CompositeDrawable + { + private FilterCriteria filter; + + private LinkFlowContainer textFlow; + + [Resolved] + private BeatmapManager beatmaps { get; set; } + + [Resolved(CanBeNull = true)] + private FirstRunSetupOverlay firstRunSetupOverlay { get; set; } + + public FilterCriteria Filter + { + get => filter; + set + { + filter = value; + Scheduler.AddOnce(updateText); + } + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Masking = true; + CornerRadius = 10; + + Width = 300; + AutoSizeAxes = Axes.Y; + + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + InternalChildren = new Drawable[] + { + new Box + { + Colour = colours.Gray2, + RelativeSizeAxes = Axes.Both, + }, + new SpriteIcon + { + Icon = FontAwesome.Regular.QuestionCircle, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Margin = new MarginPadding(10), + Size = new Vector2(50), + }, + textFlow = new LinkFlowContainer + { + Y = 70, + Padding = new MarginPadding(10), + TextAnchor = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + } + }; + } + + public override void Show() + { + this.FadeIn(600, Easing.OutQuint); + + this.ScaleTo(0.8f) + .ScaleTo(1f, 1000, Easing.OutElastic); + + Scheduler.AddOnce(updateText); + } + + public override void Hide() + { + this.FadeOut(200, Easing.OutQuint); + } + + private void updateText() + { + textFlow.Clear(); + + if (beatmaps.QueryBeatmapSet(s => !s.Protected && !s.DeletePending) == null) + { + textFlow.AddParagraph("No beatmaps found!"); + textFlow.AddParagraph(string.Empty); + + textFlow.AddParagraph("Consider running the "); + textFlow.AddLink("first run setup", () => firstRunSetupOverlay?.Show()); + textFlow.AddText(" to load or import some beatmaps!"); + } + else + { + textFlow.AddParagraph("No beatmaps match your filter criteria!"); + textFlow.AddParagraph(string.Empty); + + // TODO: hint when beatmaps are available in another ruleset + // TODO: hint when beatmaps are available by toggling "show converted". + if (!string.IsNullOrEmpty(filter?.SearchText)) + { + textFlow.AddParagraph("You can try "); + textFlow.AddLink("searching online", LinkAction.SearchBeatmapSet, filter.SearchText); + textFlow.AddText(" for this query."); + } + } + } + } +} From a04af1ca5f4ffb39b31b9ca3d33f47d5cec1393e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 16:45:20 +0900 Subject: [PATCH 1467/2328] Enable nullable and add hinting at convert filter criteria --- .../Screens/Select/NoResultsPlaceholder.cs | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Select/NoResultsPlaceholder.cs b/osu.Game/Screens/Select/NoResultsPlaceholder.cs index 0188dbd7db..1b81deb30e 100644 --- a/osu.Game/Screens/Select/NoResultsPlaceholder.cs +++ b/osu.Game/Screens/Select/NoResultsPlaceholder.cs @@ -1,12 +1,15 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; +using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Online.Chat; @@ -17,19 +20,21 @@ namespace osu.Game.Screens.Select { public class NoResultsPlaceholder : CompositeDrawable { - private FilterCriteria filter; + private FilterCriteria? filter; - private LinkFlowContainer textFlow; + private LinkFlowContainer textFlow = null!; [Resolved] - private BeatmapManager beatmaps { get; set; } + private BeatmapManager beatmaps { get; set; } = null!; - [Resolved(CanBeNull = true)] - private FirstRunSetupOverlay firstRunSetupOverlay { get; set; } + [Resolved] + private FirstRunSetupOverlay? firstRunSetupOverlay { get; set; } + + [Resolved] + private OsuConfigManager config { get; set; } = null!; public FilterCriteria Filter { - get => filter; set { filter = value; @@ -108,9 +113,18 @@ namespace osu.Game.Screens.Select textFlow.AddParagraph("No beatmaps match your filter criteria!"); textFlow.AddParagraph(string.Empty); - // TODO: hint when beatmaps are available in another ruleset - // TODO: hint when beatmaps are available by toggling "show converted". - if (!string.IsNullOrEmpty(filter?.SearchText)) + if (string.IsNullOrEmpty(filter?.SearchText)) + { + // TODO: Add realm queries to hint at which ruleset results are available in (and allow clicking to switch). + // TODO: Make this message more certain by ensuring the osu! beatmaps exist before suggesting. + if (filter?.Ruleset.OnlineID > 0 && !filter.AllowConvertedBeatmaps) + { + textFlow.AddParagraph("Beatmaps may be available by "); + textFlow.AddLink("enabling automatic conversion", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, true)); + textFlow.AddText("!"); + } + } + else { textFlow.AddParagraph("You can try "); textFlow.AddLink("searching online", LinkAction.SearchBeatmapSet, filter.SearchText); From f8524c3af4409d799b28a681b0ac3e35b25c87b0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 17:13:04 +0900 Subject: [PATCH 1468/2328] Use `VisibilityContainer` to avoid too many animations triggering --- .../Screens/Select/NoResultsPlaceholder.cs | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Select/NoResultsPlaceholder.cs b/osu.Game/Screens/Select/NoResultsPlaceholder.cs index 1b81deb30e..28a0541a22 100644 --- a/osu.Game/Screens/Select/NoResultsPlaceholder.cs +++ b/osu.Game/Screens/Select/NoResultsPlaceholder.cs @@ -12,13 +12,14 @@ using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Localisation; using osu.Game.Online.Chat; using osu.Game.Overlays; using osuTK; namespace osu.Game.Screens.Select { - public class NoResultsPlaceholder : CompositeDrawable + public class NoResultsPlaceholder : VisibilityContainer { private FilterCriteria? filter; @@ -37,6 +38,9 @@ namespace osu.Game.Screens.Select { set { + if (filter == value) + return; + filter = value; Scheduler.AddOnce(updateText); } @@ -63,7 +67,7 @@ namespace osu.Game.Screens.Select }, new SpriteIcon { - Icon = FontAwesome.Regular.QuestionCircle, + Icon = FontAwesome.Regular.SadTear, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Margin = new MarginPadding(10), @@ -71,7 +75,7 @@ namespace osu.Game.Screens.Select }, textFlow = new LinkFlowContainer { - Y = 70, + Y = 60, Padding = new MarginPadding(10), TextAnchor = Anchor.TopCentre, RelativeSizeAxes = Axes.X, @@ -80,23 +84,26 @@ namespace osu.Game.Screens.Select }; } - public override void Show() + protected override void PopIn() { this.FadeIn(600, Easing.OutQuint); - this.ScaleTo(0.8f) - .ScaleTo(1f, 1000, Easing.OutElastic); - Scheduler.AddOnce(updateText); } - public override void Hide() + protected override void PopOut() { this.FadeOut(200, Easing.OutQuint); } private void updateText() { + // TODO: Refresh this text when new beatmaps are imported. Right now it won't get up-to-date suggestions. + + // Bounce should play every time the filter criteria is updated. + this.ScaleTo(0.9f) + .ScaleTo(1f, 1000, Easing.OutElastic); + textFlow.Clear(); if (beatmaps.QueryBeatmapSet(s => !s.Protected && !s.DeletePending) == null) @@ -104,9 +111,9 @@ namespace osu.Game.Screens.Select textFlow.AddParagraph("No beatmaps found!"); textFlow.AddParagraph(string.Empty); - textFlow.AddParagraph("Consider running the "); - textFlow.AddLink("first run setup", () => firstRunSetupOverlay?.Show()); - textFlow.AddText(" to load or import some beatmaps!"); + textFlow.AddParagraph("Consider using the \""); + textFlow.AddLink(FirstRunSetupOverlayStrings.FirstRunSetupTitle, () => firstRunSetupOverlay?.Show()); + textFlow.AddText("\" to download or import some beatmaps!"); } else { @@ -131,6 +138,8 @@ namespace osu.Game.Screens.Select textFlow.AddText(" for this query."); } } + + // TODO: add clickable link to reset criteria. } } } From 430bacf91722a182472f6ab45a931aea2b808ab9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 13:50:53 +0900 Subject: [PATCH 1469/2328] Add initial layout of comparison screens --- .../Settings/TestSceneLatencyComparer.cs | 261 ++++++++++++++++++ 1 file changed, 261 insertions(+) create mode 100644 osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs diff --git a/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs b/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs new file mode 100644 index 0000000000..cf9a01f0b1 --- /dev/null +++ b/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs @@ -0,0 +1,261 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; +using osu.Framework.Input.Events; +using osu.Framework.Screens; +using osu.Game.Screens; +using osuTK; +using osuTK.Graphics; +using osuTK.Input; + +namespace osu.Game.Tests.Visual.Settings +{ + public class TestSceneLatencyComparer : ScreenTestScene + { + [Test] + public void TestBasic() + { + AddStep("Load screen", () => LoadScreen(new LatencyComparerScreen())); + } + } + + public class LatencyComparerScreen : OsuScreen + { + private FrameSync previousFrameSyncMode; + + public override bool HideOverlaysOnEnter => true; + + public override bool CursorVisible => false; + + [Resolved] + private FrameworkConfigManager config { get; set; } = null!; + + public LatencyComparerScreen() + { + InternalChildren = new Drawable[] + { + new GridContainer + { + RelativeSizeAxes = Axes.Both, + RowDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, 100), + new Dimension(), + new Dimension(GridSizeMode.Absolute, 100), + }, + Content = new[] + { + new Drawable[] + { + // header content + }, + new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new LatencyArea(10) + { + Width = 0.5f, + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + }, + new LatencyArea(0) + { + Width = 0.5f, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + }, + new Box + { + Colour = Color4.Black, + Width = 50, + RelativeSizeAxes = Axes.Y, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }, + } + }, + }, + new Drawable[] + { + // footer content + }, + } + } + }; + } + + public override void OnEntering(ScreenTransitionEvent e) + { + base.OnEntering(e); + + previousFrameSyncMode = config.Get(FrameworkSetting.FrameSync); + config.SetValue(FrameworkSetting.FrameSync, FrameSync.Unlimited); + // host.AllowBenchmarkUnlimitedFrames = true; + } + + public override bool OnExiting(ScreenExitEvent e) + { + // host.AllowBenchmarkUnlimitedFrames = false; + config.SetValue(FrameworkSetting.FrameSync, previousFrameSyncMode); + return base.OnExiting(e); + } + + public class LatencyArea : CompositeDrawable + { + private readonly int inducedLatency; + + public LatencyArea(int inducedLatency) + { + this.inducedLatency = inducedLatency; + RelativeSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + new Box + { + Colour = Color4.Blue, + RelativeSizeAxes = Axes.Both, + }, + new LatencyMovableBox + { + RelativeSizeAxes = Axes.Both, + }, + new LatencyCursorContainer + { + RelativeSizeAxes = Axes.Both, + } + }; + } + + private long frameCount; + + public override bool UpdateSubTree() + { + if (inducedLatency > 0 && ++frameCount % inducedLatency != 0) + return false; + + return base.UpdateSubTree(); + } + + public class LatencyMovableBox : CompositeDrawable + { + private Box box = null!; + private InputManager inputManager = null!; + + public LatencyMovableBox() + { + Masking = true; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + inputManager = GetContainingInputManager(); + + InternalChild = box = new Box + { + Size = new Vector2(40), + Position = DrawSize / 2, + Origin = Anchor.Centre, + }; + } + + protected override bool OnHover(HoverEvent e) => false; + + private double? lastFrameTime; + + protected override void Update() + { + base.Update(); + + if (!IsHovered) + return; + + if (lastFrameTime != null) + { + float movementAmount = (float)(Clock.CurrentTime - lastFrameTime); + + foreach (var key in inputManager.CurrentState.Keyboard.Keys) + { + switch (key) + { + case Key.Up: + box.Y -= movementAmount; + break; + + case Key.Down: + box.Y += movementAmount; + break; + + case Key.Left: + box.X -= movementAmount; + break; + + case Key.Right: + box.X += movementAmount; + break; + } + } + } + + lastFrameTime = Clock.CurrentTime; + } + } + + public class LatencyCursorContainer : CompositeDrawable + { + private readonly Circle cursor; + private InputManager inputManager = null!; + + public LatencyCursorContainer() + { + Masking = true; + + InternalChild = cursor = new Circle + { + Size = new Vector2(40), + Origin = Anchor.Centre, + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + inputManager = GetContainingInputManager(); + } + + protected override bool OnHover(HoverEvent e) => false; + + protected override void Update() + { + if (IsHovered) + { + cursor.Position = ToLocalSpace(inputManager.CurrentState.Mouse.Position); + cursor.Alpha = 1; + } + else + { + cursor.Alpha = 0; + } + + base.Update(); + } + } + } + } +} From 0adeccbf03fa872b0d937f4a0ce3142324809ede Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 14:40:21 +0900 Subject: [PATCH 1470/2328] Add full latency testing flow --- .../Settings/TestSceneLatencyComparer.cs | 242 ----------- osu.Game/Screens/LatencyComparerScreen.cs | 385 ++++++++++++++++++ 2 files changed, 385 insertions(+), 242 deletions(-) create mode 100644 osu.Game/Screens/LatencyComparerScreen.cs diff --git a/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs b/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs index cf9a01f0b1..8a5db7bd95 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs @@ -4,18 +4,7 @@ #nullable enable using NUnit.Framework; -using osu.Framework.Allocation; -using osu.Framework.Configuration; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; -using osu.Framework.Input.Events; -using osu.Framework.Screens; using osu.Game.Screens; -using osuTK; -using osuTK.Graphics; -using osuTK.Input; namespace osu.Game.Tests.Visual.Settings { @@ -27,235 +16,4 @@ namespace osu.Game.Tests.Visual.Settings AddStep("Load screen", () => LoadScreen(new LatencyComparerScreen())); } } - - public class LatencyComparerScreen : OsuScreen - { - private FrameSync previousFrameSyncMode; - - public override bool HideOverlaysOnEnter => true; - - public override bool CursorVisible => false; - - [Resolved] - private FrameworkConfigManager config { get; set; } = null!; - - public LatencyComparerScreen() - { - InternalChildren = new Drawable[] - { - new GridContainer - { - RelativeSizeAxes = Axes.Both, - RowDimensions = new[] - { - new Dimension(GridSizeMode.Absolute, 100), - new Dimension(), - new Dimension(GridSizeMode.Absolute, 100), - }, - Content = new[] - { - new Drawable[] - { - // header content - }, - new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - new LatencyArea(10) - { - Width = 0.5f, - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - }, - new LatencyArea(0) - { - Width = 0.5f, - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - }, - new Box - { - Colour = Color4.Black, - Width = 50, - RelativeSizeAxes = Axes.Y, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - }, - } - }, - }, - new Drawable[] - { - // footer content - }, - } - } - }; - } - - public override void OnEntering(ScreenTransitionEvent e) - { - base.OnEntering(e); - - previousFrameSyncMode = config.Get(FrameworkSetting.FrameSync); - config.SetValue(FrameworkSetting.FrameSync, FrameSync.Unlimited); - // host.AllowBenchmarkUnlimitedFrames = true; - } - - public override bool OnExiting(ScreenExitEvent e) - { - // host.AllowBenchmarkUnlimitedFrames = false; - config.SetValue(FrameworkSetting.FrameSync, previousFrameSyncMode); - return base.OnExiting(e); - } - - public class LatencyArea : CompositeDrawable - { - private readonly int inducedLatency; - - public LatencyArea(int inducedLatency) - { - this.inducedLatency = inducedLatency; - RelativeSizeAxes = Axes.Both; - - InternalChildren = new Drawable[] - { - new Box - { - Colour = Color4.Blue, - RelativeSizeAxes = Axes.Both, - }, - new LatencyMovableBox - { - RelativeSizeAxes = Axes.Both, - }, - new LatencyCursorContainer - { - RelativeSizeAxes = Axes.Both, - } - }; - } - - private long frameCount; - - public override bool UpdateSubTree() - { - if (inducedLatency > 0 && ++frameCount % inducedLatency != 0) - return false; - - return base.UpdateSubTree(); - } - - public class LatencyMovableBox : CompositeDrawable - { - private Box box = null!; - private InputManager inputManager = null!; - - public LatencyMovableBox() - { - Masking = true; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - inputManager = GetContainingInputManager(); - - InternalChild = box = new Box - { - Size = new Vector2(40), - Position = DrawSize / 2, - Origin = Anchor.Centre, - }; - } - - protected override bool OnHover(HoverEvent e) => false; - - private double? lastFrameTime; - - protected override void Update() - { - base.Update(); - - if (!IsHovered) - return; - - if (lastFrameTime != null) - { - float movementAmount = (float)(Clock.CurrentTime - lastFrameTime); - - foreach (var key in inputManager.CurrentState.Keyboard.Keys) - { - switch (key) - { - case Key.Up: - box.Y -= movementAmount; - break; - - case Key.Down: - box.Y += movementAmount; - break; - - case Key.Left: - box.X -= movementAmount; - break; - - case Key.Right: - box.X += movementAmount; - break; - } - } - } - - lastFrameTime = Clock.CurrentTime; - } - } - - public class LatencyCursorContainer : CompositeDrawable - { - private readonly Circle cursor; - private InputManager inputManager = null!; - - public LatencyCursorContainer() - { - Masking = true; - - InternalChild = cursor = new Circle - { - Size = new Vector2(40), - Origin = Anchor.Centre, - }; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - inputManager = GetContainingInputManager(); - } - - protected override bool OnHover(HoverEvent e) => false; - - protected override void Update() - { - if (IsHovered) - { - cursor.Position = ToLocalSpace(inputManager.CurrentState.Mouse.Position); - cursor.Alpha = 1; - } - else - { - cursor.Alpha = 0; - } - - base.Update(); - } - } - } - } } diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/LatencyComparerScreen.cs new file mode 100644 index 0000000000..b247337e4e --- /dev/null +++ b/osu.Game/Screens/LatencyComparerScreen.cs @@ -0,0 +1,385 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using System; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; +using osu.Framework.Input.Events; +using osu.Framework.Screens; +using osu.Framework.Utils; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; +using osu.Game.Overlays.Settings; +using osuTK; +using osuTK.Input; + +namespace osu.Game.Screens +{ + public class LatencyComparerScreen : OsuScreen + { + private FrameSync previousFrameSyncMode; + + private readonly OsuSpriteText statusText; + + public override bool HideOverlaysOnEnter => true; + + public override bool CursorVisible => false; + + public override float BackgroundParallaxAmount => 0; + + private readonly Container latencyAreaContainer; + + [Cached] + private readonly OverlayColourProvider overlayColourProvider = new OverlayColourProvider(OverlayColourScheme.Orange); + + [Resolved] + private FrameworkConfigManager config { get; set; } = null!; + + public LatencyComparerScreen() + { + InternalChildren = new Drawable[] + { + latencyAreaContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, + // Make sure the edge between the two comparisons can't be used to ascertain latency. + new Box + { + Name = "separator", + Colour = ColourInfo.GradientHorizontal(overlayColourProvider.Background6, overlayColourProvider.Background6.Opacity(0)), + Width = 50, + RelativeSizeAxes = Axes.Y, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopLeft, + }, + new Box + { + Name = "separator", + Colour = ColourInfo.GradientHorizontal(overlayColourProvider.Background6.Opacity(0), overlayColourProvider.Background6), + Width = 50, + RelativeSizeAxes = Axes.Y, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopRight, + }, + statusText = new OsuSpriteText + { + Font = OsuFont.Default.With(size: 40), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + }; + } + + public override void OnEntering(ScreenTransitionEvent e) + { + base.OnEntering(e); + + previousFrameSyncMode = config.Get(FrameworkSetting.FrameSync); + config.SetValue(FrameworkSetting.FrameSync, FrameSync.Unlimited); + // host.AllowBenchmarkUnlimitedFrames = true; + } + + public override bool OnExiting(ScreenExitEvent e) + { + // host.AllowBenchmarkUnlimitedFrames = false; + config.SetValue(FrameworkSetting.FrameSync, previousFrameSyncMode); + return base.OnExiting(e); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + loadNextRound(); + } + + private int round; + + private const int rounds_to_complete = 10; + + private int correctCount; + + private void recordResult(bool correct) + { + if (correct) + correctCount++; + + if (round < rounds_to_complete) + loadNextRound(); + else + { + showResults(); + } + } + + private void loadNextRound() + { + round++; + statusText.Text = $"Round {round} of {rounds_to_complete}"; + + latencyAreaContainer.Clear(); + + const int induced_latency = 1; + + int betterSide = RNG.Next(0, 2); + + latencyAreaContainer.Add(new LatencyArea(betterSide == 1 ? induced_latency : 0) + { + Width = 0.5f, + ReportBetter = () => recordResult(betterSide == 0) + }); + + latencyAreaContainer.Add(new LatencyArea(betterSide == 0 ? induced_latency : 0) + { + Width = 0.5f, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + ReportBetter = () => recordResult(betterSide == 1) + }); + } + + private void showResults() + { + AddInternal(new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new Box + { + Colour = overlayColourProvider.Background1, + RelativeSizeAxes = Axes.Both, + }, + + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 40)) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + TextAnchor = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Text = $"You scored {correctCount} out of {rounds_to_complete} ({(float)correctCount / rounds_to_complete:P0})!" + } + } + }); + } + + public class LatencyArea : CompositeDrawable + { + [Resolved] + private OverlayColourProvider overlayColourProvider { get; set; } = null!; + + public Action? ReportBetter { get; set; } + + private Drawable background = null!; + + private readonly int inducedLatency; + + public LatencyArea(int inducedLatency) + { + this.inducedLatency = inducedLatency; + + RelativeSizeAxes = Axes.Both; + Masking = true; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + InternalChildren = new[] + { + background = new Box + { + Colour = overlayColourProvider.Background6, + RelativeSizeAxes = Axes.Both, + }, + new LatencyMovableBox + { + RelativeSizeAxes = Axes.Both, + }, + new LatencyCursorContainer + { + RelativeSizeAxes = Axes.Both, + }, + new Button + { + Text = "Feels better", + Y = 20, + Width = 0.8f, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Action = () => ReportBetter?.Invoke(), + }, + }; + + base.LoadComplete(); + this.FadeInFromZero(500, Easing.OutQuint); + } + + public class Button : SettingsButton + { + [Resolved] + private OverlayColourProvider overlayColourProvider { get; set; } = null!; + + protected override void LoadComplete() + { + base.LoadComplete(); + + Height = 50; + SpriteText.Colour = overlayColourProvider.Background6; + SpriteText.Font = OsuFont.TorusAlternate.With(size: 34); + } + } + + protected override bool OnHover(HoverEvent e) + { + background.FadeColour(overlayColourProvider.Background4, 200, Easing.OutQuint); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + background.FadeColour(overlayColourProvider.Background6, 200, Easing.OutQuint); + base.OnHoverLost(e); + } + + private long frameCount; + + public override bool UpdateSubTree() + { + if (inducedLatency > 0 && ++frameCount % inducedLatency != 0) + return false; + + return base.UpdateSubTree(); + } + + public class LatencyMovableBox : CompositeDrawable + { + private Box box = null!; + private InputManager inputManager = null!; + + [Resolved] + private OverlayColourProvider overlayColourProvider { get; set; } = null!; + + protected override void LoadComplete() + { + base.LoadComplete(); + + inputManager = GetContainingInputManager(); + + InternalChild = box = new Box + { + Size = new Vector2(40), + RelativePositionAxes = Axes.Both, + Position = new Vector2(0.5f), + Origin = Anchor.Centre, + Colour = overlayColourProvider.Colour1, + }; + } + + protected override bool OnHover(HoverEvent e) => false; + + private double? lastFrameTime; + + protected override void Update() + { + base.Update(); + + if (!IsHovered) + { + lastFrameTime = null; + return; + } + + if (lastFrameTime != null) + { + float movementAmount = (float)(Clock.CurrentTime - lastFrameTime) / 400; + + foreach (var key in inputManager.CurrentState.Keyboard.Keys) + { + switch (key) + { + case Key.Up: + box.Y = MathHelper.Clamp(box.Y - movementAmount, 0.1f, 0.9f); + break; + + case Key.Down: + box.Y = MathHelper.Clamp(box.Y + movementAmount, 0.1f, 0.9f); + break; + + case Key.Z: + case Key.Left: + box.X = MathHelper.Clamp(box.X - movementAmount, 0.1f, 0.9f); + break; + + case Key.X: + case Key.Right: + box.X = MathHelper.Clamp(box.X + movementAmount, 0.1f, 0.9f); + break; + } + } + } + + lastFrameTime = Clock.CurrentTime; + } + } + + public class LatencyCursorContainer : CompositeDrawable + { + private Circle cursor = null!; + private InputManager inputManager = null!; + + [Resolved] + private OverlayColourProvider overlayColourProvider { get; set; } = null!; + + public LatencyCursorContainer() + { + Masking = true; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + InternalChild = cursor = new Circle + { + Size = new Vector2(40), + Origin = Anchor.Centre, + Colour = overlayColourProvider.Colour2, + }; + + inputManager = GetContainingInputManager(); + } + + protected override bool OnHover(HoverEvent e) => false; + + protected override void Update() + { + if (IsHovered) + { + cursor.Position = ToLocalSpace(inputManager.CurrentState.Mouse.Position); + cursor.Alpha = 1; + } + else + { + cursor.Alpha = 0; + } + + base.Update(); + } + } + } + } +} From 20cfa5d83fbe783e3f0520c216c871ccc27d17c8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 14:40:28 +0900 Subject: [PATCH 1471/2328] Add button to access latency comparer from game --- .../Sections/DebugSettings/GeneralSettings.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs index 8833420523..318cdbd6a7 100644 --- a/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs @@ -30,13 +30,18 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings { LabelText = DebugSettingsStrings.BypassFrontToBackPass, Current = config.GetBindable(DebugSetting.BypassFrontToBackPass) + }, + new SettingsButton + { + Text = DebugSettingsStrings.ImportFiles, + Action = () => performer?.PerformFromScreen(menu => menu.Push(new FileImportScreen())) + }, + new SettingsButton + { + Text = @"Run latency comparer", + Action = () => performer?.PerformFromScreen(menu => menu.Push(new LatencyComparerScreen())) } }; - Add(new SettingsButton - { - Text = DebugSettingsStrings.ImportFiles, - Action = () => performer?.PerformFromScreen(menu => menu.Push(new FileImportScreen())) - }); } } } From c323c67d7d20da709af17d690d4abe52a17edb0b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 14:51:16 +0900 Subject: [PATCH 1472/2328] Allow increasing confidence by playing longer --- osu.Game/Screens/LatencyComparerScreen.cs | 123 ++++++++++++++-------- 1 file changed, 80 insertions(+), 43 deletions(-) diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/LatencyComparerScreen.cs index b247337e4e..c39760e5be 100644 --- a/osu.Game/Screens/LatencyComparerScreen.cs +++ b/osu.Game/Screens/LatencyComparerScreen.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens { private FrameSync previousFrameSyncMode; - private readonly OsuSpriteText statusText; + private readonly OsuTextFlowContainer statusText; public override bool HideOverlaysOnEnter => true; @@ -37,7 +37,9 @@ namespace osu.Game.Screens public override float BackgroundParallaxAmount => 0; - private readonly Container latencyAreaContainer; + private readonly Container mainArea; + + private readonly Container resultsArea; [Cached] private readonly OverlayColourProvider overlayColourProvider = new OverlayColourProvider(OverlayColourScheme.Orange); @@ -49,7 +51,12 @@ namespace osu.Game.Screens { InternalChildren = new Drawable[] { - latencyAreaContainer = new Container + new Box + { + Colour = overlayColourProvider.Background6, + RelativeSizeAxes = Axes.Both, + }, + mainArea = new Container { RelativeSizeAxes = Axes.Both, }, @@ -72,11 +79,17 @@ namespace osu.Game.Screens Anchor = Anchor.TopCentre, Origin = Anchor.TopRight, }, - statusText = new OsuSpriteText + statusText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 40)) { - Font = OsuFont.Default.With(size: 40), Anchor = Anchor.Centre, Origin = Anchor.Centre, + TextAnchor = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + }, + resultsArea = new Container + { + RelativeSizeAxes = Axes.Both, }, }; } @@ -109,13 +122,14 @@ namespace osu.Game.Screens private const int rounds_to_complete = 10; private int correctCount; + private int targetRoundCount = rounds_to_complete; private void recordResult(bool correct) { if (correct) correctCount++; - if (round < rounds_to_complete) + if (round < targetRoundCount) loadNextRound(); else { @@ -126,21 +140,21 @@ namespace osu.Game.Screens private void loadNextRound() { round++; - statusText.Text = $"Round {round} of {rounds_to_complete}"; + statusText.Text = $"Round {round} of {targetRoundCount}"; - latencyAreaContainer.Clear(); + mainArea.Clear(); const int induced_latency = 1; int betterSide = RNG.Next(0, 2); - latencyAreaContainer.Add(new LatencyArea(betterSide == 1 ? induced_latency : 0) + mainArea.Add(new LatencyArea(betterSide == 1 ? induced_latency : 0) { Width = 0.5f, ReportBetter = () => recordResult(betterSide == 0) }); - latencyAreaContainer.Add(new LatencyArea(betterSide == 0 ? induced_latency : 0) + mainArea.Add(new LatencyArea(betterSide == 0 ? induced_latency : 0) { Width = 0.5f, Anchor = Anchor.TopRight, @@ -151,25 +165,27 @@ namespace osu.Game.Screens private void showResults() { - AddInternal(new Container + mainArea.Clear(); + + statusText.Text = $"You scored {correctCount} out of {targetRoundCount} ({(float)correctCount / targetRoundCount:P0})!"; + + resultsArea.Add(new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new Box - { - Colour = overlayColourProvider.Background1, - RelativeSizeAxes = Axes.Both, - }, - - new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 40)) + new Button { + Text = "Increase confidence", Anchor = Anchor.Centre, Origin = Anchor.Centre, - TextAnchor = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Text = $"You scored {correctCount} out of {rounds_to_complete} ({(float)correctCount / rounds_to_complete:P0})!" + Y = 100, + Action = () => + { + resultsArea.Clear(); + targetRoundCount += rounds_to_complete; + loadNextRound(); + } } } }); @@ -186,6 +202,12 @@ namespace osu.Game.Screens private readonly int inducedLatency; + private Container interactivePieces = null!; + + private Button button = null!; + + private long frameCount; + public LatencyArea(int inducedLatency) { this.inducedLatency = inducedLatency; @@ -205,17 +227,26 @@ namespace osu.Game.Screens Colour = overlayColourProvider.Background6, RelativeSizeAxes = Axes.Both, }, - new LatencyMovableBox + interactivePieces = new Container { RelativeSizeAxes = Axes.Both, + Alpha = 0, + Children = new Drawable[] + { + new LatencyMovableBox + { + RelativeSizeAxes = Axes.Both, + }, + new LatencyCursorContainer + { + RelativeSizeAxes = Axes.Both, + }, + } }, - new LatencyCursorContainer - { - RelativeSizeAxes = Axes.Both, - }, - new Button + button = new Button { Text = "Feels better", + Alpha = 0, Y = 20, Width = 0.8f, Anchor = Anchor.TopCentre, @@ -226,20 +257,11 @@ namespace osu.Game.Screens base.LoadComplete(); this.FadeInFromZero(500, Easing.OutQuint); - } - public class Button : SettingsButton - { - [Resolved] - private OverlayColourProvider overlayColourProvider { get; set; } = null!; - - protected override void LoadComplete() + using (BeginDelayedSequence(500)) { - base.LoadComplete(); - - Height = 50; - SpriteText.Colour = overlayColourProvider.Background6; - SpriteText.Font = OsuFont.TorusAlternate.With(size: 34); + interactivePieces.FadeIn(500, Easing.OutQuint); + button.FadeIn(500, Easing.OutQuint); } } @@ -255,11 +277,9 @@ namespace osu.Game.Screens base.OnHoverLost(e); } - private long frameCount; - public override bool UpdateSubTree() { - if (inducedLatency > 0 && ++frameCount % inducedLatency != 0) + if (background?.Alpha == 1 && inducedLatency > 0 && ++frameCount % inducedLatency != 0) return false; return base.UpdateSubTree(); @@ -367,6 +387,8 @@ namespace osu.Game.Screens protected override void Update() { + cursor.Colour = inputManager.CurrentState.Mouse.IsPressed(MouseButton.Left) ? overlayColourProvider.Content1 : overlayColourProvider.Colour2; + if (IsHovered) { cursor.Position = ToLocalSpace(inputManager.CurrentState.Mouse.Position); @@ -381,5 +403,20 @@ namespace osu.Game.Screens } } } + + public class Button : SettingsButton + { + [Resolved] + private OverlayColourProvider overlayColourProvider { get; set; } = null!; + + protected override void LoadComplete() + { + base.LoadComplete(); + + Height = 100; + SpriteText.Colour = overlayColourProvider.Background6; + SpriteText.Font = OsuFont.TorusAlternate.With(size: 34); + } + } } } From 3bd8bbd297b623bc53e1b974afa2067ba92e4005 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 15:21:19 +0900 Subject: [PATCH 1473/2328] Add explanatory text --- osu.Game/Screens/LatencyComparerScreen.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/LatencyComparerScreen.cs index c39760e5be..75bf7795ce 100644 --- a/osu.Game/Screens/LatencyComparerScreen.cs +++ b/osu.Game/Screens/LatencyComparerScreen.cs @@ -17,7 +17,6 @@ using osu.Framework.Screens; using osu.Framework.Utils; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; using osu.Game.Overlays; using osu.Game.Overlays.Settings; using osuTK; @@ -37,6 +36,8 @@ namespace osu.Game.Screens public override float BackgroundParallaxAmount => 0; + private readonly OsuTextFlowContainer explanatoryText; + private readonly Container mainArea; private readonly Container resultsArea; @@ -79,6 +80,20 @@ namespace osu.Game.Screens Anchor = Anchor.TopCentre, Origin = Anchor.TopRight, }, + explanatoryText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + TextAnchor = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Y = 200, + Text = @"Welcome to the latency comparer! +Use the arrow keys or Z/X to move the square. +You can click the targets but you don't have to. +Do whatever you need to try and perceive the difference in latency, then choose your best side. +", + }, statusText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 40)) { Anchor = Anchor.Centre, @@ -126,6 +141,8 @@ namespace osu.Game.Screens private void recordResult(bool correct) { + explanatoryText.FadeOut(500, Easing.OutQuint); + if (correct) correctCount++; @@ -198,7 +215,7 @@ namespace osu.Game.Screens public Action? ReportBetter { get; set; } - private Drawable background = null!; + private Drawable? background; private readonly int inducedLatency; From a175defefd3bc40d98d916de5608da9b656742fd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 18:11:54 +0900 Subject: [PATCH 1474/2328] Add difficulty levels --- osu.Game/Screens/LatencyComparerScreen.cs | 110 ++++++++++++++-------- 1 file changed, 73 insertions(+), 37 deletions(-) diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/LatencyComparerScreen.cs index 75bf7795ce..689729fa68 100644 --- a/osu.Game/Screens/LatencyComparerScreen.cs +++ b/osu.Game/Screens/LatencyComparerScreen.cs @@ -4,6 +4,7 @@ #nullable enable using System; +using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; @@ -45,9 +46,20 @@ namespace osu.Game.Screens [Cached] private readonly OverlayColourProvider overlayColourProvider = new OverlayColourProvider(OverlayColourScheme.Orange); + [Resolved] + private OsuColour colours { get; set; } = null!; + [Resolved] private FrameworkConfigManager config { get; set; } = null!; + private const int rounds_to_complete = 5; + + private int round; + private int correctCount; + private int targetRoundCount = rounds_to_complete; + + private int difficulty = 1; + public LatencyComparerScreen() { InternalChildren = new Drawable[] @@ -82,12 +94,11 @@ namespace osu.Game.Screens }, explanatoryText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, TextAnchor = Anchor.TopCentre, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Y = 200, Text = @"Welcome to the latency comparer! Use the arrow keys or Z/X to move the square. You can click the targets but you don't have to. @@ -96,9 +107,10 @@ Do whatever you need to try and perceive the difference in latency, then choose }, statusText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 40)) { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, TextAnchor = Anchor.TopCentre, + Y = 200, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, }, @@ -132,13 +144,6 @@ Do whatever you need to try and perceive the difference in latency, then choose loadNextRound(); } - private int round; - - private const int rounds_to_complete = 10; - - private int correctCount; - private int targetRoundCount = rounds_to_complete; - private void recordResult(bool correct) { explanatoryText.FadeOut(500, Easing.OutQuint); @@ -157,21 +162,21 @@ Do whatever you need to try and perceive the difference in latency, then choose private void loadNextRound() { round++; - statusText.Text = $"Round {round} of {targetRoundCount}"; + statusText.Text = $"Difficulty {difficulty}\nRound {round} of {targetRoundCount}"; mainArea.Clear(); - const int induced_latency = 1; + const int induced_latency = 500; int betterSide = RNG.Next(0, 2); - mainArea.Add(new LatencyArea(betterSide == 1 ? induced_latency : 0) + mainArea.Add(new LatencyArea(betterSide == 1 ? induced_latency / difficulty : 0) { Width = 0.5f, ReportBetter = () => recordResult(betterSide == 0) }); - mainArea.Add(new LatencyArea(betterSide == 0 ? induced_latency : 0) + mainArea.Add(new LatencyArea(betterSide == 0 ? induced_latency / difficulty : 0) { Width = 0.5f, Anchor = Anchor.TopRight, @@ -186,28 +191,70 @@ Do whatever you need to try and perceive the difference in latency, then choose statusText.Text = $"You scored {correctCount} out of {targetRoundCount} ({(float)correctCount / targetRoundCount:P0})!"; - resultsArea.Add(new Container + resultsArea.Add(new FillFlowContainer { RelativeSizeAxes = Axes.Both, + Y = 100, + Spacing = new Vector2(20), Children = new Drawable[] { new Button { - Text = "Increase confidence", + Text = "Increase confidence at current level", Anchor = Anchor.Centre, Origin = Anchor.Centre, - Y = 100, Action = () => { resultsArea.Clear(); targetRoundCount += rounds_to_complete; loadNextRound(); } + }, + new Button + { + Text = "Increase difficulty", + BackgroundColour = colours.Red2, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Action = () => + { + changeDifficulty(difficulty + 1); + } + }, + new Button + { + Text = "Decrease difficulty", + BackgroundColour = colours.Green, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Enabled = { Value = difficulty > 1 }, + Action = () => + { + resultsArea.Clear(); + correctCount = 0; + targetRoundCount = rounds_to_complete; + difficulty--; + loadNextRound(); + } } } }); } + private void changeDifficulty(int diff) + { + Debug.Assert(diff > 0); + + resultsArea.Clear(); + + correctCount = 0; + round = 0; + + targetRoundCount = rounds_to_complete; + difficulty = diff; + loadNextRound(); + } + public class LatencyArea : CompositeDrawable { [Resolved] @@ -219,10 +266,6 @@ Do whatever you need to try and perceive the difference in latency, then choose private readonly int inducedLatency; - private Container interactivePieces = null!; - - private Button button = null!; - private long frameCount; public LatencyArea(int inducedLatency) @@ -244,10 +287,9 @@ Do whatever you need to try and perceive the difference in latency, then choose Colour = overlayColourProvider.Background6, RelativeSizeAxes = Axes.Both, }, - interactivePieces = new Container + new Container { RelativeSizeAxes = Axes.Both, - Alpha = 0, Children = new Drawable[] { new LatencyMovableBox @@ -260,10 +302,9 @@ Do whatever you need to try and perceive the difference in latency, then choose }, } }, - button = new Button + new Button { Text = "Feels better", - Alpha = 0, Y = 20, Width = 0.8f, Anchor = Anchor.TopCentre, @@ -271,15 +312,6 @@ Do whatever you need to try and perceive the difference in latency, then choose Action = () => ReportBetter?.Invoke(), }, }; - - base.LoadComplete(); - this.FadeInFromZero(500, Easing.OutQuint); - - using (BeginDelayedSequence(500)) - { - interactivePieces.FadeIn(500, Easing.OutQuint); - button.FadeIn(500, Easing.OutQuint); - } } protected override bool OnHover(HoverEvent e) @@ -344,7 +376,11 @@ Do whatever you need to try and perceive the difference in latency, then choose { float movementAmount = (float)(Clock.CurrentTime - lastFrameTime) / 400; - foreach (var key in inputManager.CurrentState.Keyboard.Keys) + var buttons = inputManager.CurrentState.Keyboard.Keys; + + box.Colour = buttons.HasAnyButtonPressed ? overlayColourProvider.Content1 : overlayColourProvider.Colour1; + + foreach (var key in buttons) { switch (key) { From 3fc8ac0ec72f51c47dab588acbea8679f66b90bd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 18:27:42 +0900 Subject: [PATCH 1475/2328] Add key bindings everywhere --- osu.Game/Graphics/UserInterface/OsuButton.cs | 2 +- osu.Game/Screens/LatencyComparerScreen.cs | 56 +++++++++++++------- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 08514d94c3..044df13152 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -20,7 +20,7 @@ namespace osu.Game.Graphics.UserInterface /// public class OsuButton : Button { - public LocalisableString Text + public virtual LocalisableString Text { get => SpriteText?.Text ?? default; set diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/LatencyComparerScreen.cs index 689729fa68..b61905a1e7 100644 --- a/osu.Game/Screens/LatencyComparerScreen.cs +++ b/osu.Game/Screens/LatencyComparerScreen.cs @@ -14,8 +14,10 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Framework.Input.Events; +using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Framework.Utils; +using osu.Game.Extensions; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Overlays; @@ -170,13 +172,13 @@ Do whatever you need to try and perceive the difference in latency, then choose int betterSide = RNG.Next(0, 2); - mainArea.Add(new LatencyArea(betterSide == 1 ? induced_latency / difficulty : 0) + mainArea.Add(new LatencyArea(Key.Number1, betterSide == 1 ? induced_latency / difficulty : 0) { Width = 0.5f, ReportBetter = () => recordResult(betterSide == 0) }); - mainArea.Add(new LatencyArea(betterSide == 0 ? induced_latency / difficulty : 0) + mainArea.Add(new LatencyArea(Key.Number2, betterSide == 0 ? induced_latency / difficulty : 0) { Width = 0.5f, Anchor = Anchor.TopRight, @@ -198,7 +200,7 @@ Do whatever you need to try and perceive the difference in latency, then choose Spacing = new Vector2(20), Children = new Drawable[] { - new Button + new Button(Key.R) { Text = "Increase confidence at current level", Anchor = Anchor.Centre, @@ -210,32 +212,22 @@ Do whatever you need to try and perceive the difference in latency, then choose loadNextRound(); } }, - new Button + new Button(Key.I) { Text = "Increase difficulty", BackgroundColour = colours.Red2, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Action = () => - { - changeDifficulty(difficulty + 1); - } + Action = () => changeDifficulty(difficulty + 1) }, - new Button + new Button(Key.D) { Text = "Decrease difficulty", BackgroundColour = colours.Green, Anchor = Anchor.Centre, Origin = Anchor.Centre, + Action = () => changeDifficulty(difficulty - 1), Enabled = { Value = difficulty > 1 }, - Action = () => - { - resultsArea.Clear(); - correctCount = 0; - targetRoundCount = rounds_to_complete; - difficulty--; - loadNextRound(); - } } } }); @@ -264,12 +256,14 @@ Do whatever you need to try and perceive the difference in latency, then choose private Drawable? background; + private readonly Key key; private readonly int inducedLatency; private long frameCount; - public LatencyArea(int inducedLatency) + public LatencyArea(Key key, int inducedLatency) { + this.key = key; this.inducedLatency = inducedLatency; RelativeSizeAxes = Axes.Both; @@ -302,7 +296,7 @@ Do whatever you need to try and perceive the difference in latency, then choose }, } }, - new Button + new Button(key) { Text = "Feels better", Y = 20, @@ -459,6 +453,30 @@ Do whatever you need to try and perceive the difference in latency, then choose public class Button : SettingsButton { + private readonly Key key; + + public Button(Key key) + { + this.key = key; + } + + public override LocalisableString Text + { + get => base.Text; + set => base.Text = $"{value} (Press {key.ToString().Replace("Number", string.Empty)})"; + } + + protected override bool OnKeyDown(KeyDownEvent e) + { + if (!e.Repeat && e.Key == key) + { + TriggerClick(); + return true; + } + + return base.OnKeyDown(e); + } + [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } = null!; From 8578f12a58a5b4043fa97b512686a227a90b4067 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 7 Jun 2022 18:35:10 +0900 Subject: [PATCH 1476/2328] Fix taiko circle fills missing after rewind --- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 504b10e9bc..2dd332fc13 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -8,6 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Pooling; +using osu.Framework.Graphics.Primitives; using osu.Game.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Judgements; @@ -321,12 +322,14 @@ namespace osu.Game.Rulesets.Taiko.UI private class ProxyContainer : LifetimeManagementContainer { - public new MarginPadding Padding - { - set => base.Padding = value; - } - public void Add(Drawable proxy) => AddInternal(proxy); + + public override bool UpdateSubTreeMasking(Drawable source, RectangleF maskingBounds) + { + // DrawableHitObject disables masking. + // Hitobject content is proxied and unproxied based on hit status and the IsMaskedAway value could get stuck because of this. + return false; + } } } } From c0e88d957730239a3a7ad6c24bbecaf1e43a0432 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 19:03:26 +0900 Subject: [PATCH 1477/2328] Add better messaging and pass/fail cutoff --- osu.Game/Screens/LatencyComparerScreen.cs | 89 +++++++++++++++++++++-- 1 file changed, 83 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/LatencyComparerScreen.cs index b61905a1e7..31d2a56770 100644 --- a/osu.Game/Screens/LatencyComparerScreen.cs +++ b/osu.Game/Screens/LatencyComparerScreen.cs @@ -15,9 +15,10 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Framework.Input.Events; using osu.Framework.Localisation; +using osu.Framework.Platform; +using osu.Framework.Platform.Windows; using osu.Framework.Screens; using osu.Framework.Utils; -using osu.Game.Extensions; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Overlays; @@ -30,6 +31,7 @@ namespace osu.Game.Screens public class LatencyComparerScreen : OsuScreen { private FrameSync previousFrameSyncMode; + private double previousActiveHz; private readonly OsuTextFlowContainer statusText; @@ -45,6 +47,11 @@ namespace osu.Game.Screens private readonly Container resultsArea; + /// + /// The rate at which the game host should attempt to run. + /// + private const int target_host_update_frames = 4000; + [Cached] private readonly OverlayColourProvider overlayColourProvider = new OverlayColourProvider(OverlayColourScheme.Orange); @@ -62,6 +69,9 @@ namespace osu.Game.Screens private int difficulty = 1; + [Resolved] + private GameHost host { get; set; } = null!; + public LatencyComparerScreen() { InternalChildren = new Drawable[] @@ -128,7 +138,9 @@ Do whatever you need to try and perceive the difference in latency, then choose base.OnEntering(e); previousFrameSyncMode = config.Get(FrameworkSetting.FrameSync); + previousActiveHz = host.UpdateThread.ActiveHz; config.SetValue(FrameworkSetting.FrameSync, FrameSync.Unlimited); + host.UpdateThread.ActiveHz = target_host_update_frames; // host.AllowBenchmarkUnlimitedFrames = true; } @@ -136,6 +148,7 @@ Do whatever you need to try and perceive the difference in latency, then choose { // host.AllowBenchmarkUnlimitedFrames = false; config.SetValue(FrameworkSetting.FrameSync, previousFrameSyncMode); + host.UpdateThread.ActiveHz = previousActiveHz; return base.OnExiting(e); } @@ -191,7 +204,33 @@ Do whatever you need to try and perceive the difference in latency, then choose { mainArea.Clear(); - statusText.Text = $"You scored {correctCount} out of {targetRoundCount} ({(float)correctCount / targetRoundCount:P0})!"; + var displayMode = host.Window.CurrentDisplayMode.Value; + + string exclusive = "unknown"; + + if (host.Window is WindowsWindow windowsWindow) + exclusive = windowsWindow.FullscreenCapability.ToString(); + + statusText.Clear(); + + float successRate = (float)correctCount / targetRoundCount; + bool isPass = successRate > 0.8f; + + statusText.AddParagraph($"You scored {correctCount} out of {targetRoundCount} ({successRate:P0})!", cp => cp.Colour = isPass ? colours.Green : colours.Red); + + statusText.AddParagraph($"Level {difficulty} (comparing {host.UpdateThread.Clock.FramesPerSecond:N0}hz and {mapDifficultyToTargetFrameRate(difficulty):N0}hz)", + cp => cp.Font = OsuFont.Default.With(size: 15)); + + statusText.AddParagraph($"Refresh rate: {displayMode.RefreshRate:N0} ExclusiveFullscren: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15)); + + string cannotIncreaseReason = string.Empty; + + if (!isPass) + cannotIncreaseReason = "You didn't score high enough (over 80% required)!"; + else if (mapDifficultyToTargetFrameRate(difficulty + 1) > target_host_update_frames) + cannotIncreaseReason = "You've reached the limits of this comparison mode."; + else if (mapDifficultyToTargetFrameRate(difficulty + 1) < host.UpdateThread.ActiveHz) + cannotIncreaseReason = "Game is not running fast enough to test this level"; resultsArea.Add(new FillFlowContainer { @@ -205,6 +244,7 @@ Do whatever you need to try and perceive the difference in latency, then choose Text = "Increase confidence at current level", Anchor = Anchor.Centre, Origin = Anchor.Centre, + TooltipText = "The longer you chain, the more sure you will be!", Action = () => { resultsArea.Clear(); @@ -218,16 +258,17 @@ Do whatever you need to try and perceive the difference in latency, then choose BackgroundColour = colours.Red2, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Action = () => changeDifficulty(difficulty + 1) + Action = () => changeDifficulty(difficulty + 1), + Enabled = { Value = string.IsNullOrEmpty(cannotIncreaseReason) }, + TooltipText = cannotIncreaseReason }, new Button(Key.D) { - Text = "Decrease difficulty", + Text = difficulty == 1 ? "Restart" : "Decrease difficulty", BackgroundColour = colours.Green, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Action = () => changeDifficulty(difficulty - 1), - Enabled = { Value = difficulty > 1 }, + Action = () => changeDifficulty(Math.Max(difficulty - 1, 1)), } } }); @@ -247,6 +288,42 @@ Do whatever you need to try and perceive the difference in latency, then choose loadNextRound(); } + private static int mapDifficultyToTargetFrameRate(int difficulty) + { + switch (difficulty) + { + case 1: + return 15; + + case 2: + return 30; + + case 3: + return 45; + + case 4: + return 60; + + case 5: + return 120; + + case 6: + return 240; + + case 7: + return 480; + + case 8: + return 720; + + case 9: + return 960; + + default: + return 1000 + ((difficulty - 10) * 500); + } + } + public class LatencyArea : CompositeDrawable { [Resolved] From 2e7a96621896904db8976b75575ed6700b9a05c3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 19:31:56 +0900 Subject: [PATCH 1478/2328] Add proper frame rate limiting and fix mouse cursor missing at results --- osu.Game/Screens/LatencyComparerScreen.cs | 50 ++++++++++++----------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/LatencyComparerScreen.cs index 31d2a56770..405b13cfc1 100644 --- a/osu.Game/Screens/LatencyComparerScreen.cs +++ b/osu.Game/Screens/LatencyComparerScreen.cs @@ -37,7 +37,7 @@ namespace osu.Game.Screens public override bool HideOverlaysOnEnter => true; - public override bool CursorVisible => false; + public override bool CursorVisible => mainArea.Count == 0; public override float BackgroundParallaxAmount => 0; @@ -181,17 +181,15 @@ Do whatever you need to try and perceive the difference in latency, then choose mainArea.Clear(); - const int induced_latency = 500; - int betterSide = RNG.Next(0, 2); - mainArea.Add(new LatencyArea(Key.Number1, betterSide == 1 ? induced_latency / difficulty : 0) + mainArea.Add(new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(difficulty) : 0) { Width = 0.5f, ReportBetter = () => recordResult(betterSide == 0) }); - mainArea.Add(new LatencyArea(Key.Number2, betterSide == 0 ? induced_latency / difficulty : 0) + mainArea.Add(new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(difficulty) : 0) { Width = 0.5f, Anchor = Anchor.TopRight, @@ -218,7 +216,7 @@ Do whatever you need to try and perceive the difference in latency, then choose statusText.AddParagraph($"You scored {correctCount} out of {targetRoundCount} ({successRate:P0})!", cp => cp.Colour = isPass ? colours.Green : colours.Red); - statusText.AddParagraph($"Level {difficulty} (comparing {host.UpdateThread.Clock.FramesPerSecond:N0}hz and {mapDifficultyToTargetFrameRate(difficulty):N0}hz)", + statusText.AddParagraph($"Level {difficulty} (comparing {mapDifficultyToTargetFrameRate(difficulty):N0}hz with {host.UpdateThread.Clock.FramesPerSecond:N0}hz)", cp => cp.Font = OsuFont.Default.With(size: 15)); statusText.AddParagraph($"Refresh rate: {displayMode.RefreshRate:N0} ExclusiveFullscren: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15)); @@ -229,7 +227,7 @@ Do whatever you need to try and perceive the difference in latency, then choose cannotIncreaseReason = "You didn't score high enough (over 80% required)!"; else if (mapDifficultyToTargetFrameRate(difficulty + 1) > target_host_update_frames) cannotIncreaseReason = "You've reached the limits of this comparison mode."; - else if (mapDifficultyToTargetFrameRate(difficulty + 1) < host.UpdateThread.ActiveHz) + else if (mapDifficultyToTargetFrameRate(difficulty + 1) > Clock.FramesPerSecond) cannotIncreaseReason = "Game is not running fast enough to test this level"; resultsArea.Add(new FillFlowContainer @@ -244,13 +242,14 @@ Do whatever you need to try and perceive the difference in latency, then choose Text = "Increase confidence at current level", Anchor = Anchor.Centre, Origin = Anchor.Centre, - TooltipText = "The longer you chain, the more sure you will be!", Action = () => { resultsArea.Clear(); targetRoundCount += rounds_to_complete; loadNextRound(); - } + }, + TooltipText = isPass ? "The longer you chain, the more sure you will be!" : "You've reached your limits", + Enabled = { Value = string.IsNullOrEmpty(cannotIncreaseReason) }, }, new Button(Key.I) { @@ -334,14 +333,12 @@ Do whatever you need to try and perceive the difference in latency, then choose private Drawable? background; private readonly Key key; - private readonly int inducedLatency; + private readonly int targetFrameRate; - private long frameCount; - - public LatencyArea(Key key, int inducedLatency) + public LatencyArea(Key key, int targetFrameRate) { this.key = key; - this.inducedLatency = inducedLatency; + this.targetFrameRate = targetFrameRate; RelativeSizeAxes = Axes.Both; Masking = true; @@ -358,6 +355,15 @@ Do whatever you need to try and perceive the difference in latency, then choose Colour = overlayColourProvider.Background6, RelativeSizeAxes = Axes.Both, }, + new Button(key) + { + Text = "Feels better", + Y = 20, + Width = 0.8f, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Action = () => ReportBetter?.Invoke(), + }, new Container { RelativeSizeAxes = Axes.Both, @@ -373,15 +379,6 @@ Do whatever you need to try and perceive the difference in latency, then choose }, } }, - new Button(key) - { - Text = "Feels better", - Y = 20, - Width = 0.8f, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Action = () => ReportBetter?.Invoke(), - }, }; } @@ -397,11 +394,16 @@ Do whatever you need to try and perceive the difference in latency, then choose base.OnHoverLost(e); } + private double lastFrameTime; + public override bool UpdateSubTree() { - if (background?.Alpha == 1 && inducedLatency > 0 && ++frameCount % inducedLatency != 0) + double elapsed = Clock.CurrentTime - lastFrameTime; + if (targetFrameRate > 0 && elapsed < 1000.0 / targetFrameRate) return false; + lastFrameTime = Clock.CurrentTime; + return base.UpdateSubTree(); } From 43a04010a784c3284a15a1c38afc0a0266b2fc5d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 19:43:33 +0900 Subject: [PATCH 1479/2328] Add display of polling rate --- osu.Game/Screens/LatencyComparerScreen.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/LatencyComparerScreen.cs index 405b13cfc1..ba3355110d 100644 --- a/osu.Game/Screens/LatencyComparerScreen.cs +++ b/osu.Game/Screens/LatencyComparerScreen.cs @@ -69,6 +69,9 @@ namespace osu.Game.Screens private int difficulty = 1; + private double lastPoll; + private int pollingMax; + [Resolved] private GameHost host { get; set; } = null!; @@ -133,6 +136,14 @@ Do whatever you need to try and perceive the difference in latency, then choose }; } + protected override bool OnMouseMove(MouseMoveEvent e) + { + if (lastPoll > 0) + pollingMax = (int)Math.Max(pollingMax, 1000 / (Clock.CurrentTime - lastPoll)); + lastPoll = Clock.CurrentTime; + return base.OnMouseMove(e); + } + public override void OnEntering(ScreenTransitionEvent e) { base.OnEntering(e); @@ -217,9 +228,9 @@ Do whatever you need to try and perceive the difference in latency, then choose statusText.AddParagraph($"You scored {correctCount} out of {targetRoundCount} ({successRate:P0})!", cp => cp.Colour = isPass ? colours.Green : colours.Red); statusText.AddParagraph($"Level {difficulty} (comparing {mapDifficultyToTargetFrameRate(difficulty):N0}hz with {host.UpdateThread.Clock.FramesPerSecond:N0}hz)", - cp => cp.Font = OsuFont.Default.With(size: 15)); + cp => cp.Font = OsuFont.Default.With(size: 24)); - statusText.AddParagraph($"Refresh rate: {displayMode.RefreshRate:N0} ExclusiveFullscren: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15)); + statusText.AddParagraph($"Input: {pollingMax}hz Monitor: {displayMode.RefreshRate:N0}hz Exclusive: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15)); string cannotIncreaseReason = string.Empty; @@ -281,6 +292,8 @@ Do whatever you need to try and perceive the difference in latency, then choose correctCount = 0; round = 0; + pollingMax = 0; + lastPoll = 0; targetRoundCount = rounds_to_complete; difficulty = diff; From 146225d87eca2222979b892d01074643c2c5b00d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 20:02:26 +0900 Subject: [PATCH 1480/2328] Fix multiple issues with layout and text --- osu.Game/Screens/LatencyComparerScreen.cs | 27 +++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/LatencyComparerScreen.cs index ba3355110d..0af0ab8419 100644 --- a/osu.Game/Screens/LatencyComparerScreen.cs +++ b/osu.Game/Screens/LatencyComparerScreen.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Framework.Input.Events; using osu.Framework.Localisation; @@ -125,7 +126,7 @@ Do whatever you need to try and perceive the difference in latency, then choose Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, TextAnchor = Anchor.TopCentre, - Y = 200, + Y = 150, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, }, @@ -225,12 +226,21 @@ Do whatever you need to try and perceive the difference in latency, then choose float successRate = (float)correctCount / targetRoundCount; bool isPass = successRate > 0.8f; - statusText.AddParagraph($"You scored {correctCount} out of {targetRoundCount} ({successRate:P0})!", cp => cp.Colour = isPass ? colours.Green : colours.Red); - - statusText.AddParagraph($"Level {difficulty} (comparing {mapDifficultyToTargetFrameRate(difficulty):N0}hz with {host.UpdateThread.Clock.FramesPerSecond:N0}hz)", + statusText.AddParagraph($"You scored {correctCount} out of {targetRoundCount} ({successRate:0%})!", cp => cp.Colour = isPass ? colours.Green : colours.Red); + statusText.AddParagraph($"Level {difficulty} ({mapDifficultyToTargetFrameRate(difficulty):N0} hz)", cp => cp.Font = OsuFont.Default.With(size: 24)); - statusText.AddParagraph($"Input: {pollingMax}hz Monitor: {displayMode.RefreshRate:N0}hz Exclusive: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15)); + statusText.AddParagraph(string.Empty); + statusText.AddParagraph(string.Empty); + statusText.AddIcon(isPass ? FontAwesome.Regular.CheckCircle : FontAwesome.Regular.TimesCircle, cp => cp.Colour = isPass ? colours.Green : colours.Red); + statusText.AddParagraph(string.Empty); + + statusText.AddParagraph($"Polling: {pollingMax} hz Monitor: {displayMode.RefreshRate:N0} hz Exclusive: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15)); + + statusText.AddParagraph($"Input: {host.InputThread.Clock.FramesPerSecond} hz " + + $"Update: {host.UpdateThread.Clock.FramesPerSecond} hz " + + $"Draw: {host.DrawThread.Clock.FramesPerSecond} hz" + , cp => cp.Font = OsuFont.Default.With(size: 15)); string cannotIncreaseReason = string.Empty; @@ -243,9 +253,12 @@ Do whatever you need to try and perceive the difference in latency, then choose resultsArea.Add(new FillFlowContainer { - RelativeSizeAxes = Axes.Both, - Y = 100, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, Spacing = new Vector2(20), + Padding = new MarginPadding(20), Children = new Drawable[] { new Button(Key.R) From 00a6cbe53f623fc4e1cc058e305ba526895a7813 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 20:03:49 +0900 Subject: [PATCH 1481/2328] Allow using J/K to move box as well --- osu.Game/Screens/LatencyComparerScreen.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/LatencyComparerScreen.cs index 0af0ab8419..3cbce0e995 100644 --- a/osu.Game/Screens/LatencyComparerScreen.cs +++ b/osu.Game/Screens/LatencyComparerScreen.cs @@ -116,7 +116,7 @@ namespace osu.Game.Screens RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Text = @"Welcome to the latency comparer! -Use the arrow keys or Z/X to move the square. +Use the arrow keys, Z/X/J/K to move the square. You can click the targets but you don't have to. Do whatever you need to try and perceive the difference in latency, then choose your best side. ", @@ -483,10 +483,12 @@ Do whatever you need to try and perceive the difference in latency, then choose { switch (key) { + case Key.K: case Key.Up: box.Y = MathHelper.Clamp(box.Y - movementAmount, 0.1f, 0.9f); break; + case Key.J: case Key.Down: box.Y = MathHelper.Clamp(box.Y + movementAmount, 0.1f, 0.9f); break; From 60d7060baa9737fc05267b7790aec6c7c1f083cb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 20:28:42 +0900 Subject: [PATCH 1482/2328] Add tab focus support --- osu.Game/Screens/LatencyComparerScreen.cs | 68 ++++++++++++++++++----- 1 file changed, 53 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/LatencyComparerScreen.cs index 3cbce0e995..6758908c3e 100644 --- a/osu.Game/Screens/LatencyComparerScreen.cs +++ b/osu.Game/Screens/LatencyComparerScreen.cs @@ -5,7 +5,9 @@ using System; using System.Diagnostics; +using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -44,7 +46,7 @@ namespace osu.Game.Screens private readonly OsuTextFlowContainer explanatoryText; - private readonly Container mainArea; + private readonly Container mainArea; private readonly Container resultsArea; @@ -85,7 +87,7 @@ namespace osu.Game.Screens Colour = overlayColourProvider.Background6, RelativeSizeAxes = Axes.Both, }, - mainArea = new Container + mainArea = new Container { RelativeSizeAxes = Axes.Both, }, @@ -118,6 +120,7 @@ namespace osu.Game.Screens Text = @"Welcome to the latency comparer! Use the arrow keys, Z/X/J/K to move the square. You can click the targets but you don't have to. +Use the Tab key to change focus. Do whatever you need to try and perceive the difference in latency, then choose your best side. ", }, @@ -171,6 +174,20 @@ Do whatever you need to try and perceive the difference in latency, then choose loadNextRound(); } + protected override bool OnKeyDown(KeyDownEvent e) + { + switch (e.Key) + { + case Key.Tab: + var firstArea = mainArea.FirstOrDefault(a => !a.IsActiveArea.Value); + if (firstArea != null) + firstArea.IsActiveArea.Value = true; + return true; + } + + return base.OnKeyDown(e); + } + private void recordResult(bool correct) { explanatoryText.FadeOut(500, Easing.OutQuint); @@ -198,7 +215,8 @@ Do whatever you need to try and perceive the difference in latency, then choose mainArea.Add(new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(difficulty) : 0) { Width = 0.5f, - ReportBetter = () => recordResult(betterSide == 0) + ReportBetter = () => recordResult(betterSide == 0), + IsActiveArea = { Value = true } }); mainArea.Add(new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(difficulty) : 0) @@ -208,6 +226,15 @@ Do whatever you need to try and perceive the difference in latency, then choose Origin = Anchor.TopRight, ReportBetter = () => recordResult(betterSide == 1) }); + + foreach (var area in mainArea) + { + area.IsActiveArea.BindValueChanged(active => + { + if (active.NewValue) + mainArea.Children.First(a => a != area).IsActiveArea.Value = false; + }); + } } private void showResults() @@ -361,6 +388,8 @@ Do whatever you need to try and perceive the difference in latency, then choose private readonly Key key; private readonly int targetFrameRate; + public readonly BindableBool IsActiveArea = new BindableBool(); + public LatencyArea(Key key, int targetFrameRate) { this.key = key; @@ -395,31 +424,30 @@ Do whatever you need to try and perceive the difference in latency, then choose RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new LatencyMovableBox + new LatencyMovableBox(IsActiveArea) { RelativeSizeAxes = Axes.Both, }, - new LatencyCursorContainer + new LatencyCursorContainer(IsActiveArea) { RelativeSizeAxes = Axes.Both, }, } }, }; + + IsActiveArea.BindValueChanged(active => + { + background.FadeColour(active.NewValue ? overlayColourProvider.Background4 : overlayColourProvider.Background6, 200, Easing.OutQuint); + }, true); } protected override bool OnHover(HoverEvent e) { - background.FadeColour(overlayColourProvider.Background4, 200, Easing.OutQuint); + IsActiveArea.Value = true; return base.OnHover(e); } - protected override void OnHoverLost(HoverLostEvent e) - { - background.FadeColour(overlayColourProvider.Background6, 200, Easing.OutQuint); - base.OnHoverLost(e); - } - private double lastFrameTime; public override bool UpdateSubTree() @@ -438,9 +466,16 @@ Do whatever you need to try and perceive the difference in latency, then choose private Box box = null!; private InputManager inputManager = null!; + private readonly BindableBool isActive; + [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } = null!; + public LatencyMovableBox(BindableBool isActive) + { + this.isActive = isActive; + } + protected override void LoadComplete() { base.LoadComplete(); @@ -465,7 +500,7 @@ Do whatever you need to try and perceive the difference in latency, then choose { base.Update(); - if (!IsHovered) + if (!isActive.Value) { lastFrameTime = null; return; @@ -515,11 +550,14 @@ Do whatever you need to try and perceive the difference in latency, then choose private Circle cursor = null!; private InputManager inputManager = null!; + private readonly BindableBool isActive; + [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } = null!; - public LatencyCursorContainer() + public LatencyCursorContainer(BindableBool isActive) { + this.isActive = isActive; Masking = true; } @@ -543,7 +581,7 @@ Do whatever you need to try and perceive the difference in latency, then choose { cursor.Colour = inputManager.CurrentState.Mouse.IsPressed(MouseButton.Left) ? overlayColourProvider.Content1 : overlayColourProvider.Colour2; - if (IsHovered) + if (isActive.Value) { cursor.Position = ToLocalSpace(inputManager.CurrentState.Mouse.Position); cursor.Alpha = 1; From f2524fc3d7e7ad8515d12cbce8f4a3bf17bbb677 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 20:42:19 +0900 Subject: [PATCH 1483/2328] Increase separator width --- osu.Game/Screens/LatencyComparerScreen.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/LatencyComparerScreen.cs index 6758908c3e..75e6643e32 100644 --- a/osu.Game/Screens/LatencyComparerScreen.cs +++ b/osu.Game/Screens/LatencyComparerScreen.cs @@ -96,7 +96,7 @@ namespace osu.Game.Screens { Name = "separator", Colour = ColourInfo.GradientHorizontal(overlayColourProvider.Background6, overlayColourProvider.Background6.Opacity(0)), - Width = 50, + Width = 100, RelativeSizeAxes = Axes.Y, Anchor = Anchor.TopCentre, Origin = Anchor.TopLeft, @@ -105,7 +105,7 @@ namespace osu.Game.Screens { Name = "separator", Colour = ColourInfo.GradientHorizontal(overlayColourProvider.Background6.Opacity(0), overlayColourProvider.Background6), - Width = 50, + Width = 100, RelativeSizeAxes = Axes.Y, Anchor = Anchor.TopCentre, Origin = Anchor.TopRight, From 0561e9cc751915a5bab9cb6434eff0842e5e7449 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 20:45:37 +0900 Subject: [PATCH 1484/2328] Fix mouse focus not always working --- osu.Game/Screens/LatencyComparerScreen.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/LatencyComparerScreen.cs index 75e6643e32..0a966502b5 100644 --- a/osu.Game/Screens/LatencyComparerScreen.cs +++ b/osu.Game/Screens/LatencyComparerScreen.cs @@ -442,10 +442,10 @@ Do whatever you need to try and perceive the difference in latency, then choose }, true); } - protected override bool OnHover(HoverEvent e) + protected override bool OnMouseMove(MouseMoveEvent e) { IsActiveArea.Value = true; - return base.OnHover(e); + return base.OnMouseMove(e); } private double lastFrameTime; From b7bdad407486266b5c5446fde71c7108c0adc225 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Tue, 7 Jun 2022 09:36:44 -0400 Subject: [PATCH 1485/2328] clamp sliders, expose slider bounds function --- .../Mods/OsuEaseHitObjectPositionsMod.cs | 16 ++++----- .../Mods/OsuModMagnetised.cs | 7 +--- osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs | 33 ++++++++++++++----- .../OsuHitObjectGenerationUtils_Reposition.cs | 22 ++++++++----- 4 files changed, 48 insertions(+), 30 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs index 2c344b7a68..74391e53a2 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs @@ -20,10 +20,10 @@ namespace osu.Game.Rulesets.Osu.Mods public override double ScoreMultiplier => 1; public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay) }; - protected BindableFloat EasementStrength = new BindableFloat(0.5f); + public abstract BindableFloat EasementStrength { get; } protected Vector2 CursorPosition; protected DrawableHitObject WorkingHitObject; - protected virtual Vector2 DestinationVector => WorkingHitObject.Position; + protected abstract Vector2 DestinationVector { get; } private IFrameStableClock gameplayClock; @@ -47,27 +47,27 @@ namespace osu.Game.Rulesets.Osu.Mods switch (drawable) { case DrawableHitCircle circle: - EaseHitObjectPositionToVector(circle, DestinationVector); + easeHitObjectPositionToVector(circle, DestinationVector); break; case DrawableSlider slider: if (!slider.HeadCircle.Result.HasResult) - EaseHitObjectPositionToVector(slider, DestinationVector); + easeHitObjectPositionToVector(slider, DestinationVector); else - EaseHitObjectPositionToVector(slider, DestinationVector - slider.Ball.DrawPosition); + easeHitObjectPositionToVector(slider, DestinationVector - slider.Ball.DrawPosition); break; } } } - protected void EaseHitObjectPositionToVector(DrawableHitObject hitObject, Vector2 destination) + private void easeHitObjectPositionToVector(DrawableHitObject hitObject, Vector2 destination) { double dampLength = Interpolation.Lerp(3000, 40, EasementStrength.Value); - float x = (float)Interpolation.DampContinuously(hitObject.X, Math.Clamp(destination.X, 0, OsuPlayfield.BASE_SIZE.X), dampLength, gameplayClock.ElapsedFrameTime); - float y = (float)Interpolation.DampContinuously(hitObject.Y, Math.Clamp(destination.Y, 0, OsuPlayfield.BASE_SIZE.Y), dampLength, gameplayClock.ElapsedFrameTime); + float x = (float)Interpolation.DampContinuously(hitObject.X, destination.X, dampLength, gameplayClock.ElapsedFrameTime); + float y = (float)Interpolation.DampContinuously(hitObject.Y, destination.Y, dampLength, gameplayClock.ElapsedFrameTime); hitObject.Position = new Vector2(x, y); } diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs b/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs index ca69085e31..1c10d61c99 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs @@ -21,16 +21,11 @@ namespace osu.Game.Rulesets.Osu.Mods protected override Vector2 DestinationVector => CursorPosition; [SettingSource("Attraction strength", "How strong the pull is.", 0)] - public BindableFloat AttractionStrength { get; } = new BindableFloat(0.5f) + public override BindableFloat EasementStrength { get; } = new BindableFloat(0.5f) { Precision = 0.05f, MinValue = 0.05f, MaxValue = 1.0f, }; - - public OsuModMagnetised() - { - EasementStrength.BindTo(AttractionStrength); - } } } diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs index 35f369d9c5..fec66e3ef1 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs @@ -6,6 +6,9 @@ using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; +using osu.Game.Rulesets.Osu.Utils; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.UI; using osuTK; namespace osu.Game.Rulesets.Osu.Mods @@ -19,21 +22,35 @@ namespace osu.Game.Rulesets.Osu.Mods public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModMagnetised)).ToArray(); [SettingSource("Repulsion strength", "How strong the repulsion is.", 0)] - public BindableFloat RepulsionStrength { get; } = new BindableFloat(0.5f) + public override BindableFloat EasementStrength { get; } = new BindableFloat(0.5f) { Precision = 0.05f, MinValue = 0.05f, MaxValue = 1.0f, }; - protected override Vector2 DestinationVector => new Vector2( - 2 * WorkingHitObject.X - CursorPosition.X, - 2 * WorkingHitObject.Y - CursorPosition.Y - ); - - public OsuModRepel() + protected override Vector2 DestinationVector { - EasementStrength.BindTo(RepulsionStrength); + get + { + float x = Math.Clamp(2 * WorkingHitObject.X - CursorPosition.X, 0, OsuPlayfield.BASE_SIZE.X); + float y = Math.Clamp(2 * WorkingHitObject.Y - CursorPosition.Y, 0, OsuPlayfield.BASE_SIZE.Y); + + if (WorkingHitObject.HitObject is Slider slider) + { + var possibleMovementBounds = OsuHitObjectGenerationUtils.CalculatePossibleMovementBounds(slider, false); + + x = possibleMovementBounds.Width < 0 + ? x + : Math.Clamp(x, possibleMovementBounds.Left, possibleMovementBounds.Right); + + y = possibleMovementBounds.Height < 0 + ? y + : Math.Clamp(y, possibleMovementBounds.Top, possibleMovementBounds.Bottom); + } + + return new Vector2(x, y); + } } } } diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs index d1bc3b45df..765477fba2 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs @@ -167,7 +167,7 @@ namespace osu.Game.Rulesets.Osu.Utils private static Vector2 clampSliderToPlayfield(WorkingObject workingObject) { var slider = (Slider)workingObject.HitObject; - var possibleMovementBounds = calculatePossibleMovementBounds(slider); + var possibleMovementBounds = CalculatePossibleMovementBounds(slider); var previousPosition = workingObject.PositionModified; @@ -212,10 +212,13 @@ namespace osu.Game.Rulesets.Osu.Utils /// Calculates a which contains all of the possible movements of the slider (in relative X/Y coordinates) /// such that the entire slider is inside the playfield. /// + /// The for which to calculate a movement bounding box. + /// Whether the movement bounding box should account for the slider's follow circle. Defaults to true. + /// A which contains all of the possible movements of the slider such that the entire slider is inside the playfield. /// /// If the slider is larger than the playfield, the returned may have negative width/height. /// - private static RectangleF calculatePossibleMovementBounds(Slider slider) + public static RectangleF CalculatePossibleMovementBounds(Slider slider, bool accountForFollowCircleRadius = true) { var pathPositions = new List(); slider.Path.GetPathToProgress(pathPositions, 0, 1); @@ -236,14 +239,17 @@ namespace osu.Game.Rulesets.Osu.Utils maxY = MathF.Max(maxY, pos.Y); } - // Take the circle radius into account. - float radius = (float)slider.Radius; + if (accountForFollowCircleRadius) + { + // Take the circle radius into account. + float radius = (float)slider.Radius; - minX -= radius; - minY -= radius; + minX -= radius; + minY -= radius; - maxX += radius; - maxY += radius; + maxX += radius; + maxY += radius; + } // Given the bounding box of the slider (via min/max X/Y), // the amount that the slider can move to the left is minX (with the sign flipped, since positive X is to the right), From e5171aaebf60a7ab17b31f7295a71f4278efde4b Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Tue, 7 Jun 2022 09:48:53 -0400 Subject: [PATCH 1486/2328] update tests to match new bindable names --- osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs | 2 +- osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs index 9b49e60363..29ec91cda8 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods { Mod = new OsuModMagnetised { - AttractionStrength = { Value = strength }, + EasementStrength = { Value = strength }, }, PassCondition = () => true, Autoplay = false, diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs index 6bd41e2fa5..bdd4ed7fb9 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods { Mod = new OsuModRepel { - RepulsionStrength = { Value = strength }, + EasementStrength = { Value = strength }, }, PassCondition = () => true, Autoplay = false, From c1ef59ab03fa2d4c2e496378dc20a36182e53a46 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 22:52:24 +0900 Subject: [PATCH 1487/2328] Add more comprehensive certification flow (and remove "difficulty" terminology) --- osu.Game/Screens/LatencyComparerScreen.cs | 122 +++++++++++++++------- 1 file changed, 87 insertions(+), 35 deletions(-) diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/LatencyComparerScreen.cs index 0a966502b5..c1e514687a 100644 --- a/osu.Game/Screens/LatencyComparerScreen.cs +++ b/osu.Game/Screens/LatencyComparerScreen.cs @@ -13,6 +13,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; @@ -24,6 +25,7 @@ using osu.Framework.Screens; using osu.Framework.Utils; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; using osu.Game.Overlays; using osu.Game.Overlays.Settings; using osuTK; @@ -66,11 +68,13 @@ namespace osu.Game.Screens private const int rounds_to_complete = 5; + private const int rounds_to_complete_certified = 20; + private int round; private int correctCount; private int targetRoundCount = rounds_to_complete; - private int difficulty = 1; + private int difficultyLevel = 1; private double lastPoll; private int pollingMax; @@ -124,6 +128,10 @@ Use the Tab key to change focus. Do whatever you need to try and perceive the difference in latency, then choose your best side. ", }, + resultsArea = new Container + { + RelativeSizeAxes = Axes.Both, + }, statusText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 40)) { Anchor = Anchor.TopCentre, @@ -133,10 +141,6 @@ Do whatever you need to try and perceive the difference in latency, then choose RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, }, - resultsArea = new Container - { - RelativeSizeAxes = Axes.Both, - }, }; } @@ -206,20 +210,20 @@ Do whatever you need to try and perceive the difference in latency, then choose private void loadNextRound() { round++; - statusText.Text = $"Difficulty {difficulty}\nRound {round} of {targetRoundCount}"; + statusText.Text = $"Level {difficultyLevel}\nRound {round} of {targetRoundCount}"; mainArea.Clear(); int betterSide = RNG.Next(0, 2); - mainArea.Add(new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(difficulty) : 0) + mainArea.Add(new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(difficultyLevel) : 0) { Width = 0.5f, ReportBetter = () => recordResult(betterSide == 0), IsActiveArea = { Value = true } }); - mainArea.Add(new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(difficulty) : 0) + mainArea.Add(new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(difficultyLevel) : 0) { Width = 0.5f, Anchor = Anchor.TopRight, @@ -251,10 +255,10 @@ Do whatever you need to try and perceive the difference in latency, then choose statusText.Clear(); float successRate = (float)correctCount / targetRoundCount; - bool isPass = successRate > 0.8f; + bool isPass = successRate == 1; statusText.AddParagraph($"You scored {correctCount} out of {targetRoundCount} ({successRate:0%})!", cp => cp.Colour = isPass ? colours.Green : colours.Red); - statusText.AddParagraph($"Level {difficulty} ({mapDifficultyToTargetFrameRate(difficulty):N0} hz)", + statusText.AddParagraph($"Level {difficultyLevel} ({mapDifficultyToTargetFrameRate(difficultyLevel):N0} hz)", cp => cp.Font = OsuFont.Default.With(size: 24)); statusText.AddParagraph(string.Empty); @@ -262,6 +266,12 @@ Do whatever you need to try and perceive the difference in latency, then choose statusText.AddIcon(isPass ? FontAwesome.Regular.CheckCircle : FontAwesome.Regular.TimesCircle, cp => cp.Colour = isPass ? colours.Green : colours.Red); statusText.AddParagraph(string.Empty); + if (!isPass && difficultyLevel > 1) + { + statusText.AddParagraph("To complete certification, decrease the difficulty level until you can get 20 tests correct in a row!", cp => cp.Font = OsuFont.Default.With(size: 24)); + statusText.AddParagraph(string.Empty); + } + statusText.AddParagraph($"Polling: {pollingMax} hz Monitor: {displayMode.RefreshRate:N0} hz Exclusive: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15)); statusText.AddParagraph($"Input: {host.InputThread.Clock.FramesPerSecond} hz " @@ -269,13 +279,55 @@ Do whatever you need to try and perceive the difference in latency, then choose + $"Draw: {host.DrawThread.Clock.FramesPerSecond} hz" , cp => cp.Font = OsuFont.Default.With(size: 15)); + int certificationRemaining = !isPass ? rounds_to_complete_certified : rounds_to_complete_certified - correctCount; + + if (isPass && certificationRemaining <= 0) + { + Drawable background; + Drawable certifiedText; + + resultsArea.AddRange(new[] + { + background = new Box + { + Colour = overlayColourProvider.Background4, + RelativeSizeAxes = Axes.Both, + }, + (certifiedText = new OsuSpriteText + { + Alpha = 0, + Font = OsuFont.TorusAlternate.With(size: 80, weight: FontWeight.Bold), + Text = "Certified!", + Blending = BlendingParameters.Additive, + }).WithEffect(new GlowEffect + { + Colour = overlayColourProvider.Colour1, + }).With(e => + { + e.Anchor = Anchor.Centre; + e.Origin = Anchor.Centre; + }) + }); + + background.FadeInFromZero(1000, Easing.OutQuint); + + certifiedText.FadeInFromZero(500, Easing.InQuint); + + certifiedText + .ScaleTo(10) + .ScaleTo(1, 600, Easing.InQuad) + .Then() + .ScaleTo(1.05f, 10000, Easing.OutQuint); + return; + } + string cannotIncreaseReason = string.Empty; if (!isPass) - cannotIncreaseReason = "You didn't score high enough (over 80% required)!"; - else if (mapDifficultyToTargetFrameRate(difficulty + 1) > target_host_update_frames) + cannotIncreaseReason = "You didn't get a perfect score."; + else if (mapDifficultyToTargetFrameRate(difficultyLevel + 1) > target_host_update_frames) cannotIncreaseReason = "You've reached the limits of this comparison mode."; - else if (mapDifficultyToTargetFrameRate(difficulty + 1) > Clock.FramesPerSecond) + else if (mapDifficultyToTargetFrameRate(difficultyLevel + 1) > Clock.FramesPerSecond) cannotIncreaseReason = "Game is not running fast enough to test this level"; resultsArea.Add(new FillFlowContainer @@ -288,9 +340,27 @@ Do whatever you need to try and perceive the difference in latency, then choose Padding = new MarginPadding(20), Children = new Drawable[] { + new Button(Key.Enter) + { + Text = "Continue to next level", + BackgroundColour = colours.Red2, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Action = () => changeDifficulty(difficultyLevel + 1), + Enabled = { Value = string.IsNullOrEmpty(cannotIncreaseReason) }, + TooltipText = cannotIncreaseReason + }, + new Button(Key.D) + { + Text = difficultyLevel == 1 ? "Retry" : "Return to last level", + BackgroundColour = colours.Green, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Action = () => changeDifficulty(Math.Max(difficultyLevel - 1, 1)), + }, new Button(Key.R) { - Text = "Increase confidence at current level", + Text = $"Continue towards certification at this level ({certificationRemaining} more)", Anchor = Anchor.Centre, Origin = Anchor.Centre, Action = () => @@ -299,27 +369,9 @@ Do whatever you need to try and perceive the difference in latency, then choose targetRoundCount += rounds_to_complete; loadNextRound(); }, - TooltipText = isPass ? "The longer you chain, the more sure you will be!" : "You've reached your limits", - Enabled = { Value = string.IsNullOrEmpty(cannotIncreaseReason) }, + TooltipText = isPass ? $"Chain {rounds_to_complete_certified} to confirm your perception!" : "You've reached your limits. Go to the previous level to complete certification!", + Enabled = { Value = isPass }, }, - new Button(Key.I) - { - Text = "Increase difficulty", - BackgroundColour = colours.Red2, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Action = () => changeDifficulty(difficulty + 1), - Enabled = { Value = string.IsNullOrEmpty(cannotIncreaseReason) }, - TooltipText = cannotIncreaseReason - }, - new Button(Key.D) - { - Text = difficulty == 1 ? "Restart" : "Decrease difficulty", - BackgroundColour = colours.Green, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Action = () => changeDifficulty(Math.Max(difficulty - 1, 1)), - } } }); } @@ -336,7 +388,7 @@ Do whatever you need to try and perceive the difference in latency, then choose lastPoll = 0; targetRoundCount = rounds_to_complete; - difficulty = diff; + difficultyLevel = diff; loadNextRound(); } From 058760253a225bcbc90e1248960d0fd3e7696fbc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 23:02:15 +0900 Subject: [PATCH 1488/2328] Add test coverage of certification flow --- .../Settings/TestSceneLatencyComparer.cs | 44 +++++++++++++++++-- osu.Game/Screens/LatencyComparerScreen.cs | 9 ++-- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs b/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs index 8a5db7bd95..4706ecb149 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs @@ -3,17 +3,55 @@ #nullable enable +using System.Linq; using NUnit.Framework; +using osu.Framework.Testing; +using osu.Game.Graphics.UserInterface; using osu.Game.Screens; +using osuTK.Input; namespace osu.Game.Tests.Visual.Settings { public class TestSceneLatencyComparer : ScreenTestScene { - [Test] - public void TestBasic() + private LatencyComparerScreen latencyComparer = null!; + + public override void SetUpSteps() { - AddStep("Load screen", () => LoadScreen(new LatencyComparerScreen())); + base.SetUpSteps(); + AddStep("Load screen", () => LoadScreen(latencyComparer = new LatencyComparerScreen())); + } + + [Test] + public void TestCertification() + { + for (int i = 0; i < 4; i++) + { + clickCorrectUntilResults(); + AddAssert("check at results", () => !latencyComparer.ChildrenOfType().Any()); + AddStep("hit c to continue", () => InputManager.Key(Key.C)); + } + + AddAssert("check at results", () => !latencyComparer.ChildrenOfType().Any()); + + AddAssert("check no buttons", () => !latencyComparer.ChildrenOfType().Any()); + } + + private void clickCorrectUntilResults() + { + AddUntilStep("click correct button until results", () => + { + var latencyArea = latencyComparer + .ChildrenOfType() + .SingleOrDefault(a => a.TargetFrameRate == 0); + + // reached results + if (latencyArea == null) + return true; + + latencyArea.ChildrenOfType().Single().TriggerClick(); + return false; + }); } } } diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/LatencyComparerScreen.cs index c1e514687a..45e62646b1 100644 --- a/osu.Game/Screens/LatencyComparerScreen.cs +++ b/osu.Game/Screens/LatencyComparerScreen.cs @@ -358,7 +358,7 @@ Do whatever you need to try and perceive the difference in latency, then choose Origin = Anchor.Centre, Action = () => changeDifficulty(Math.Max(difficultyLevel - 1, 1)), }, - new Button(Key.R) + new Button(Key.C) { Text = $"Continue towards certification at this level ({certificationRemaining} more)", Anchor = Anchor.Centre, @@ -438,14 +438,15 @@ Do whatever you need to try and perceive the difference in latency, then choose private Drawable? background; private readonly Key key; - private readonly int targetFrameRate; + + public readonly int TargetFrameRate; public readonly BindableBool IsActiveArea = new BindableBool(); public LatencyArea(Key key, int targetFrameRate) { this.key = key; - this.targetFrameRate = targetFrameRate; + TargetFrameRate = targetFrameRate; RelativeSizeAxes = Axes.Both; Masking = true; @@ -505,7 +506,7 @@ Do whatever you need to try and perceive the difference in latency, then choose public override bool UpdateSubTree() { double elapsed = Clock.CurrentTime - lastFrameTime; - if (targetFrameRate > 0 && elapsed < 1000.0 / targetFrameRate) + if (TargetFrameRate > 0 && elapsed < 1000.0 / TargetFrameRate) return false; lastFrameTime = Clock.CurrentTime; From 95dea00725ed8c4c669a54d517a95405449d14f8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 23:10:08 +0900 Subject: [PATCH 1489/2328] Tidy up code and namespaces --- .../Settings/TestSceneLatencyComparer.cs | 8 +- .../Sections/DebugSettings/GeneralSettings.cs | 1 + osu.Game/Screens/Utility/ButtonWithKeyBind.cs | 53 +++ osu.Game/Screens/Utility/LatencyArea.cs | 239 +++++++++++ .../{ => Utility}/LatencyComparerScreen.cs | 379 +++--------------- 5 files changed, 355 insertions(+), 325 deletions(-) create mode 100644 osu.Game/Screens/Utility/ButtonWithKeyBind.cs create mode 100644 osu.Game/Screens/Utility/LatencyArea.cs rename osu.Game/Screens/{ => Utility}/LatencyComparerScreen.cs (59%) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs b/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs index 4706ecb149..e4b9b21470 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs @@ -7,7 +7,7 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; -using osu.Game.Screens; +using osu.Game.Screens.Utility; using osuTK.Input; namespace osu.Game.Tests.Visual.Settings @@ -28,11 +28,11 @@ namespace osu.Game.Tests.Visual.Settings for (int i = 0; i < 4; i++) { clickCorrectUntilResults(); - AddAssert("check at results", () => !latencyComparer.ChildrenOfType().Any()); + AddAssert("check at results", () => !latencyComparer.ChildrenOfType().Any()); AddStep("hit c to continue", () => InputManager.Key(Key.C)); } - AddAssert("check at results", () => !latencyComparer.ChildrenOfType().Any()); + AddAssert("check at results", () => !latencyComparer.ChildrenOfType().Any()); AddAssert("check no buttons", () => !latencyComparer.ChildrenOfType().Any()); } @@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.Settings AddUntilStep("click correct button until results", () => { var latencyArea = latencyComparer - .ChildrenOfType() + .ChildrenOfType() .SingleOrDefault(a => a.TargetFrameRate == 0); // reached results diff --git a/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs index 318cdbd6a7..80e5235449 100644 --- a/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs @@ -9,6 +9,7 @@ using osu.Framework.Screens; using osu.Game.Localisation; using osu.Game.Screens; using osu.Game.Screens.Import; +using osu.Game.Screens.Utility; namespace osu.Game.Overlays.Settings.Sections.DebugSettings { diff --git a/osu.Game/Screens/Utility/ButtonWithKeyBind.cs b/osu.Game/Screens/Utility/ButtonWithKeyBind.cs new file mode 100644 index 0000000000..20e39ffa6a --- /dev/null +++ b/osu.Game/Screens/Utility/ButtonWithKeyBind.cs @@ -0,0 +1,53 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable +using osu.Framework.Allocation; +using osu.Framework.Input.Events; +using osu.Framework.Localisation; +using osu.Game.Graphics; +using osu.Game.Overlays; +using osu.Game.Overlays.Settings; +using osuTK.Input; + +namespace osu.Game.Screens.Utility +{ + public class ButtonWithKeyBind : SettingsButton + { + private readonly Key key; + + public ButtonWithKeyBind(Key key) + { + this.key = key; + } + + public override LocalisableString Text + { + get => base.Text; + set => base.Text = $"{value} (Press {key.ToString().Replace("Number", string.Empty)})"; + } + + protected override bool OnKeyDown(KeyDownEvent e) + { + if (!e.Repeat && e.Key == key) + { + TriggerClick(); + return true; + } + + return base.OnKeyDown(e); + } + + [Resolved] + private OverlayColourProvider overlayColourProvider { get; set; } = null!; + + protected override void LoadComplete() + { + base.LoadComplete(); + + Height = 100; + SpriteText.Colour = overlayColourProvider.Background6; + SpriteText.Font = OsuFont.TorusAlternate.With(size: 34); + } + } +} diff --git a/osu.Game/Screens/Utility/LatencyArea.cs b/osu.Game/Screens/Utility/LatencyArea.cs new file mode 100644 index 0000000000..a82efa1e26 --- /dev/null +++ b/osu.Game/Screens/Utility/LatencyArea.cs @@ -0,0 +1,239 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable +using System; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; +using osu.Framework.Input.Events; +using osu.Game.Overlays; +using osuTK; +using osuTK.Input; + +namespace osu.Game.Screens.Utility +{ + public class LatencyArea : CompositeDrawable + { + [Resolved] + private OverlayColourProvider overlayColourProvider { get; set; } = null!; + + public Action? ReportUserBest { get; set; } + + private Drawable? background; + + private readonly Key key; + + public readonly int TargetFrameRate; + + public readonly BindableBool IsActiveArea = new BindableBool(); + + public LatencyArea(Key key, int targetFrameRate) + { + this.key = key; + TargetFrameRate = targetFrameRate; + + RelativeSizeAxes = Axes.Both; + Masking = true; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + InternalChildren = new[] + { + background = new Box + { + Colour = overlayColourProvider.Background6, + RelativeSizeAxes = Axes.Both, + }, + new ButtonWithKeyBind(key) + { + Text = "Feels better", + Y = 20, + Width = 0.8f, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Action = () => ReportUserBest?.Invoke(), + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new LatencyMovableBox(IsActiveArea) + { + RelativeSizeAxes = Axes.Both, + }, + new LatencyCursorContainer(IsActiveArea) + { + RelativeSizeAxes = Axes.Both, + }, + } + }, + }; + + IsActiveArea.BindValueChanged(active => + { + background.FadeColour(active.NewValue ? overlayColourProvider.Background4 : overlayColourProvider.Background6, 200, Easing.OutQuint); + }, true); + } + + protected override bool OnMouseMove(MouseMoveEvent e) + { + IsActiveArea.Value = true; + return base.OnMouseMove(e); + } + + private double lastFrameTime; + + public override bool UpdateSubTree() + { + double elapsed = Clock.CurrentTime - lastFrameTime; + if (TargetFrameRate > 0 && elapsed < 1000.0 / TargetFrameRate) + return false; + + lastFrameTime = Clock.CurrentTime; + + return base.UpdateSubTree(); + } + + public class LatencyMovableBox : CompositeDrawable + { + private Box box = null!; + private InputManager inputManager = null!; + + private readonly BindableBool isActive; + + [Resolved] + private OverlayColourProvider overlayColourProvider { get; set; } = null!; + + public LatencyMovableBox(BindableBool isActive) + { + this.isActive = isActive; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + inputManager = GetContainingInputManager(); + + InternalChild = box = new Box + { + Size = new Vector2(40), + RelativePositionAxes = Axes.Both, + Position = new Vector2(0.5f), + Origin = Anchor.Centre, + Colour = overlayColourProvider.Colour1, + }; + } + + protected override bool OnHover(HoverEvent e) => false; + + private double? lastFrameTime; + + protected override void Update() + { + base.Update(); + + if (!isActive.Value) + { + lastFrameTime = null; + return; + } + + if (lastFrameTime != null) + { + float movementAmount = (float)(Clock.CurrentTime - lastFrameTime) / 400; + + var buttons = inputManager.CurrentState.Keyboard.Keys; + + box.Colour = buttons.HasAnyButtonPressed ? overlayColourProvider.Content1 : overlayColourProvider.Colour1; + + foreach (var key in buttons) + { + switch (key) + { + case Key.K: + case Key.Up: + box.Y = MathHelper.Clamp(box.Y - movementAmount, 0.1f, 0.9f); + break; + + case Key.J: + case Key.Down: + box.Y = MathHelper.Clamp(box.Y + movementAmount, 0.1f, 0.9f); + break; + + case Key.Z: + case Key.Left: + box.X = MathHelper.Clamp(box.X - movementAmount, 0.1f, 0.9f); + break; + + case Key.X: + case Key.Right: + box.X = MathHelper.Clamp(box.X + movementAmount, 0.1f, 0.9f); + break; + } + } + } + + lastFrameTime = Clock.CurrentTime; + } + } + + public class LatencyCursorContainer : CompositeDrawable + { + private Circle cursor = null!; + private InputManager inputManager = null!; + + private readonly BindableBool isActive; + + [Resolved] + private OverlayColourProvider overlayColourProvider { get; set; } = null!; + + public LatencyCursorContainer(BindableBool isActive) + { + this.isActive = isActive; + Masking = true; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + InternalChild = cursor = new Circle + { + Size = new Vector2(40), + Origin = Anchor.Centre, + Colour = overlayColourProvider.Colour2, + }; + + inputManager = GetContainingInputManager(); + } + + protected override bool OnHover(HoverEvent e) => false; + + protected override void Update() + { + cursor.Colour = inputManager.CurrentState.Mouse.IsPressed(MouseButton.Left) ? overlayColourProvider.Content1 : overlayColourProvider.Colour2; + + if (isActive.Value) + { + cursor.Position = ToLocalSpace(inputManager.CurrentState.Mouse.Position); + cursor.Alpha = 1; + } + else + { + cursor.Alpha = 0; + } + + base.Update(); + } + } + } +} diff --git a/osu.Game/Screens/LatencyComparerScreen.cs b/osu.Game/Screens/Utility/LatencyComparerScreen.cs similarity index 59% rename from osu.Game/Screens/LatencyComparerScreen.cs rename to osu.Game/Screens/Utility/LatencyComparerScreen.cs index 45e62646b1..1e859a2956 100644 --- a/osu.Game/Screens/LatencyComparerScreen.cs +++ b/osu.Game/Screens/Utility/LatencyComparerScreen.cs @@ -7,7 +7,6 @@ using System; using System.Diagnostics; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -16,9 +15,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; using osu.Framework.Input.Events; -using osu.Framework.Localisation; using osu.Framework.Platform; using osu.Framework.Platform.Windows; using osu.Framework.Screens; @@ -27,11 +24,10 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Overlays; -using osu.Game.Overlays.Settings; using osuTK; using osuTK.Input; -namespace osu.Game.Screens +namespace osu.Game.Screens.Utility { public class LatencyComparerScreen : OsuScreen { @@ -174,7 +170,6 @@ Do whatever you need to try and perceive the difference in latency, then choose protected override void LoadComplete() { base.LoadComplete(); - loadNextRound(); } @@ -192,55 +187,6 @@ Do whatever you need to try and perceive the difference in latency, then choose return base.OnKeyDown(e); } - private void recordResult(bool correct) - { - explanatoryText.FadeOut(500, Easing.OutQuint); - - if (correct) - correctCount++; - - if (round < targetRoundCount) - loadNextRound(); - else - { - showResults(); - } - } - - private void loadNextRound() - { - round++; - statusText.Text = $"Level {difficultyLevel}\nRound {round} of {targetRoundCount}"; - - mainArea.Clear(); - - int betterSide = RNG.Next(0, 2); - - mainArea.Add(new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(difficultyLevel) : 0) - { - Width = 0.5f, - ReportBetter = () => recordResult(betterSide == 0), - IsActiveArea = { Value = true } - }); - - mainArea.Add(new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(difficultyLevel) : 0) - { - Width = 0.5f, - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - ReportBetter = () => recordResult(betterSide == 1) - }); - - foreach (var area in mainArea) - { - area.IsActiveArea.BindValueChanged(active => - { - if (active.NewValue) - mainArea.Children.First(a => a != area).IsActiveArea.Value = false; - }); - } - } - private void showResults() { mainArea.Clear(); @@ -340,7 +286,7 @@ Do whatever you need to try and perceive the difference in latency, then choose Padding = new MarginPadding(20), Children = new Drawable[] { - new Button(Key.Enter) + new ButtonWithKeyBind(Key.Enter) { Text = "Continue to next level", BackgroundColour = colours.Red2, @@ -350,7 +296,7 @@ Do whatever you need to try and perceive the difference in latency, then choose Enabled = { Value = string.IsNullOrEmpty(cannotIncreaseReason) }, TooltipText = cannotIncreaseReason }, - new Button(Key.D) + new ButtonWithKeyBind(Key.D) { Text = difficultyLevel == 1 ? "Retry" : "Return to last level", BackgroundColour = colours.Green, @@ -358,7 +304,7 @@ Do whatever you need to try and perceive the difference in latency, then choose Origin = Anchor.Centre, Action = () => changeDifficulty(Math.Max(difficultyLevel - 1, 1)), }, - new Button(Key.C) + new ButtonWithKeyBind(Key.C) { Text = $"Continue towards certification at this level ({certificationRemaining} more)", Anchor = Anchor.Centre, @@ -376,9 +322,9 @@ Do whatever you need to try and perceive the difference in latency, then choose }); } - private void changeDifficulty(int diff) + private void changeDifficulty(int difficulty) { - Debug.Assert(diff > 0); + Debug.Assert(difficulty > 0); resultsArea.Clear(); @@ -388,10 +334,61 @@ Do whatever you need to try and perceive the difference in latency, then choose lastPoll = 0; targetRoundCount = rounds_to_complete; - difficultyLevel = diff; + difficultyLevel = difficulty; + loadNextRound(); } + private void loadNextRound() + { + round++; + statusText.Text = $"Level {difficultyLevel}\nRound {round} of {targetRoundCount}"; + + mainArea.Clear(); + + int betterSide = RNG.Next(0, 2); + + mainArea.AddRange(new[] + { + new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(difficultyLevel) : 0) + { + Width = 0.5f, + IsActiveArea = { Value = true }, + ReportUserBest = () => recordResult(betterSide == 0), + }, + new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(difficultyLevel) : 0) + { + Width = 0.5f, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + ReportUserBest = () => recordResult(betterSide == 1) + } + }); + + foreach (var area in mainArea) + { + area.IsActiveArea.BindValueChanged(active => + { + if (active.NewValue) + mainArea.Children.First(a => a != area).IsActiveArea.Value = false; + }); + } + } + + private void recordResult(bool correct) + { + // Fading this out will improve the frame rate after the first round due to less text on screen. + explanatoryText.FadeOut(500, Easing.OutQuint); + + if (correct) + correctCount++; + + if (round < targetRoundCount) + loadNextRound(); + else + showResults(); + } + private static int mapDifficultyToTargetFrameRate(int difficulty) { switch (difficulty) @@ -427,265 +424,5 @@ Do whatever you need to try and perceive the difference in latency, then choose return 1000 + ((difficulty - 10) * 500); } } - - public class LatencyArea : CompositeDrawable - { - [Resolved] - private OverlayColourProvider overlayColourProvider { get; set; } = null!; - - public Action? ReportBetter { get; set; } - - private Drawable? background; - - private readonly Key key; - - public readonly int TargetFrameRate; - - public readonly BindableBool IsActiveArea = new BindableBool(); - - public LatencyArea(Key key, int targetFrameRate) - { - this.key = key; - TargetFrameRate = targetFrameRate; - - RelativeSizeAxes = Axes.Both; - Masking = true; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - InternalChildren = new[] - { - background = new Box - { - Colour = overlayColourProvider.Background6, - RelativeSizeAxes = Axes.Both, - }, - new Button(key) - { - Text = "Feels better", - Y = 20, - Width = 0.8f, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Action = () => ReportBetter?.Invoke(), - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - new LatencyMovableBox(IsActiveArea) - { - RelativeSizeAxes = Axes.Both, - }, - new LatencyCursorContainer(IsActiveArea) - { - RelativeSizeAxes = Axes.Both, - }, - } - }, - }; - - IsActiveArea.BindValueChanged(active => - { - background.FadeColour(active.NewValue ? overlayColourProvider.Background4 : overlayColourProvider.Background6, 200, Easing.OutQuint); - }, true); - } - - protected override bool OnMouseMove(MouseMoveEvent e) - { - IsActiveArea.Value = true; - return base.OnMouseMove(e); - } - - private double lastFrameTime; - - public override bool UpdateSubTree() - { - double elapsed = Clock.CurrentTime - lastFrameTime; - if (TargetFrameRate > 0 && elapsed < 1000.0 / TargetFrameRate) - return false; - - lastFrameTime = Clock.CurrentTime; - - return base.UpdateSubTree(); - } - - public class LatencyMovableBox : CompositeDrawable - { - private Box box = null!; - private InputManager inputManager = null!; - - private readonly BindableBool isActive; - - [Resolved] - private OverlayColourProvider overlayColourProvider { get; set; } = null!; - - public LatencyMovableBox(BindableBool isActive) - { - this.isActive = isActive; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - inputManager = GetContainingInputManager(); - - InternalChild = box = new Box - { - Size = new Vector2(40), - RelativePositionAxes = Axes.Both, - Position = new Vector2(0.5f), - Origin = Anchor.Centre, - Colour = overlayColourProvider.Colour1, - }; - } - - protected override bool OnHover(HoverEvent e) => false; - - private double? lastFrameTime; - - protected override void Update() - { - base.Update(); - - if (!isActive.Value) - { - lastFrameTime = null; - return; - } - - if (lastFrameTime != null) - { - float movementAmount = (float)(Clock.CurrentTime - lastFrameTime) / 400; - - var buttons = inputManager.CurrentState.Keyboard.Keys; - - box.Colour = buttons.HasAnyButtonPressed ? overlayColourProvider.Content1 : overlayColourProvider.Colour1; - - foreach (var key in buttons) - { - switch (key) - { - case Key.K: - case Key.Up: - box.Y = MathHelper.Clamp(box.Y - movementAmount, 0.1f, 0.9f); - break; - - case Key.J: - case Key.Down: - box.Y = MathHelper.Clamp(box.Y + movementAmount, 0.1f, 0.9f); - break; - - case Key.Z: - case Key.Left: - box.X = MathHelper.Clamp(box.X - movementAmount, 0.1f, 0.9f); - break; - - case Key.X: - case Key.Right: - box.X = MathHelper.Clamp(box.X + movementAmount, 0.1f, 0.9f); - break; - } - } - } - - lastFrameTime = Clock.CurrentTime; - } - } - - public class LatencyCursorContainer : CompositeDrawable - { - private Circle cursor = null!; - private InputManager inputManager = null!; - - private readonly BindableBool isActive; - - [Resolved] - private OverlayColourProvider overlayColourProvider { get; set; } = null!; - - public LatencyCursorContainer(BindableBool isActive) - { - this.isActive = isActive; - Masking = true; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - InternalChild = cursor = new Circle - { - Size = new Vector2(40), - Origin = Anchor.Centre, - Colour = overlayColourProvider.Colour2, - }; - - inputManager = GetContainingInputManager(); - } - - protected override bool OnHover(HoverEvent e) => false; - - protected override void Update() - { - cursor.Colour = inputManager.CurrentState.Mouse.IsPressed(MouseButton.Left) ? overlayColourProvider.Content1 : overlayColourProvider.Colour2; - - if (isActive.Value) - { - cursor.Position = ToLocalSpace(inputManager.CurrentState.Mouse.Position); - cursor.Alpha = 1; - } - else - { - cursor.Alpha = 0; - } - - base.Update(); - } - } - } - - public class Button : SettingsButton - { - private readonly Key key; - - public Button(Key key) - { - this.key = key; - } - - public override LocalisableString Text - { - get => base.Text; - set => base.Text = $"{value} (Press {key.ToString().Replace("Number", string.Empty)})"; - } - - protected override bool OnKeyDown(KeyDownEvent e) - { - if (!e.Repeat && e.Key == key) - { - TriggerClick(); - return true; - } - - return base.OnKeyDown(e); - } - - [Resolved] - private OverlayColourProvider overlayColourProvider { get; set; } = null!; - - protected override void LoadComplete() - { - base.LoadComplete(); - - Height = 100; - SpriteText.Colour = overlayColourProvider.Background6; - SpriteText.Font = OsuFont.TorusAlternate.With(size: 34); - } - } } } From 1a1dfaeae66628ff4b8a8cab18b6477cade2c0c4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 23:25:45 +0900 Subject: [PATCH 1490/2328] Update framework --- osu.Android.props | 2 +- osu.Game/Screens/Utility/LatencyComparerScreen.cs | 4 ++-- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index aad8cf10d0..155a21bacb 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/Screens/Utility/LatencyComparerScreen.cs b/osu.Game/Screens/Utility/LatencyComparerScreen.cs index 1e859a2956..b25e6ee901 100644 --- a/osu.Game/Screens/Utility/LatencyComparerScreen.cs +++ b/osu.Game/Screens/Utility/LatencyComparerScreen.cs @@ -156,12 +156,12 @@ Do whatever you need to try and perceive the difference in latency, then choose previousActiveHz = host.UpdateThread.ActiveHz; config.SetValue(FrameworkSetting.FrameSync, FrameSync.Unlimited); host.UpdateThread.ActiveHz = target_host_update_frames; - // host.AllowBenchmarkUnlimitedFrames = true; + host.AllowBenchmarkUnlimitedFrames = true; } public override bool OnExiting(ScreenExitEvent e) { - // host.AllowBenchmarkUnlimitedFrames = false; + host.AllowBenchmarkUnlimitedFrames = false; config.SetValue(FrameworkSetting.FrameSync, previousFrameSyncMode); host.UpdateThread.ActiveHz = previousActiveHz; return base.OnExiting(e); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 63b8cf4cb5..b6218c5950 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index a0fafa635b..ba57aba01b 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 9da99a0ddfe730b96db3375636b903217cfe0e01 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 23:34:19 +0900 Subject: [PATCH 1491/2328] Rename to latency certifier --- ...parer.cs => TestSceneLatencyCertifierScreen.cs} | 14 +++++++------- .../Sections/DebugSettings/GeneralSettings.cs | 2 +- ...ComparerScreen.cs => LatencyCertifierScreen.cs} | 7 +++---- 3 files changed, 11 insertions(+), 12 deletions(-) rename osu.Game.Tests/Visual/Settings/{TestSceneLatencyComparer.cs => TestSceneLatencyCertifierScreen.cs} (68%) rename osu.Game/Screens/Utility/{LatencyComparerScreen.cs => LatencyCertifierScreen.cs} (98%) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs similarity index 68% rename from osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs rename to osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs index e4b9b21470..687d7c490c 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneLatencyComparer.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs @@ -12,14 +12,14 @@ using osuTK.Input; namespace osu.Game.Tests.Visual.Settings { - public class TestSceneLatencyComparer : ScreenTestScene + public class TestSceneLatencyCertifierScreen : ScreenTestScene { - private LatencyComparerScreen latencyComparer = null!; + private LatencyCertifierScreen latencyCertifier = null!; public override void SetUpSteps() { base.SetUpSteps(); - AddStep("Load screen", () => LoadScreen(latencyComparer = new LatencyComparerScreen())); + AddStep("Load screen", () => LoadScreen(latencyCertifier = new LatencyCertifierScreen())); } [Test] @@ -28,20 +28,20 @@ namespace osu.Game.Tests.Visual.Settings for (int i = 0; i < 4; i++) { clickCorrectUntilResults(); - AddAssert("check at results", () => !latencyComparer.ChildrenOfType().Any()); + AddAssert("check at results", () => !latencyCertifier.ChildrenOfType().Any()); AddStep("hit c to continue", () => InputManager.Key(Key.C)); } - AddAssert("check at results", () => !latencyComparer.ChildrenOfType().Any()); + AddAssert("check at results", () => !latencyCertifier.ChildrenOfType().Any()); - AddAssert("check no buttons", () => !latencyComparer.ChildrenOfType().Any()); + AddAssert("check no buttons", () => !latencyCertifier.ChildrenOfType().Any()); } private void clickCorrectUntilResults() { AddUntilStep("click correct button until results", () => { - var latencyArea = latencyComparer + var latencyArea = latencyCertifier .ChildrenOfType() .SingleOrDefault(a => a.TargetFrameRate == 0); diff --git a/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs index 80e5235449..cd8cf8f64f 100644 --- a/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs @@ -40,7 +40,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings new SettingsButton { Text = @"Run latency comparer", - Action = () => performer?.PerformFromScreen(menu => menu.Push(new LatencyComparerScreen())) + Action = () => performer?.PerformFromScreen(menu => menu.Push(new LatencyCertifierScreen())) } }; } diff --git a/osu.Game/Screens/Utility/LatencyComparerScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs similarity index 98% rename from osu.Game/Screens/Utility/LatencyComparerScreen.cs rename to osu.Game/Screens/Utility/LatencyCertifierScreen.cs index b25e6ee901..157998184c 100644 --- a/osu.Game/Screens/Utility/LatencyComparerScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -29,7 +29,7 @@ using osuTK.Input; namespace osu.Game.Screens.Utility { - public class LatencyComparerScreen : OsuScreen + public class LatencyCertifierScreen : OsuScreen { private FrameSync previousFrameSyncMode; private double previousActiveHz; @@ -78,7 +78,7 @@ namespace osu.Game.Screens.Utility [Resolved] private GameHost host { get; set; } = null!; - public LatencyComparerScreen() + public LatencyCertifierScreen() { InternalChildren = new Drawable[] { @@ -117,9 +117,8 @@ namespace osu.Game.Screens.Utility TextAnchor = Anchor.TopCentre, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Text = @"Welcome to the latency comparer! + Text = @"Welcome to the latency certifier! Use the arrow keys, Z/X/J/K to move the square. -You can click the targets but you don't have to. Use the Tab key to change focus. Do whatever you need to try and perceive the difference in latency, then choose your best side. ", From 2e0b8884105f977ed6cfc2d582a7aca1796bf004 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 16:31:58 +0900 Subject: [PATCH 1492/2328] Fix song select carousel invalidating every frame during global overlay dimming --- osu.Game/Screens/Select/BeatmapCarousel.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index a59f14647d..8a588c519b 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -10,6 +10,7 @@ using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Caching; +using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Pooling; @@ -633,7 +634,7 @@ namespace osu.Game.Screens.Select protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source) { // handles the vertical size of the carousel changing (ie. on window resize when aspect ratio has changed). - if ((invalidation & Invalidation.Layout) > 0) + if (invalidation.HasFlagFast(Invalidation.DrawSize)) itemsCache.Invalidate(); return base.OnInvalidate(invalidation, source); From 228683e956217baaa211117af3d256fca8190303 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jun 2022 23:48:34 +0900 Subject: [PATCH 1493/2328] Fix nullability of `dialogOverlay` dependency --- osu.Game/Screens/Select/SongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 242e741475..3bfdc845ab 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -91,7 +91,7 @@ namespace osu.Game.Screens.Select private BeatmapInfoWedge beatmapInfoWedge; - [Resolved] + [Resolved(canBeNull: true)] private IDialogOverlay dialogOverlay { get; set; } [Resolved] From b924aa3296bbc6ccb9c6cf0f1f4140580ffc833b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 8 Jun 2022 00:36:19 +0900 Subject: [PATCH 1494/2328] Fix tests failing when run headless --- .../Visual/Settings/TestSceneLatencyCertifierScreen.cs | 3 ++- osu.Game/Screens/Utility/LatencyCertifierScreen.cs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs index 687d7c490c..6d8c6d3c54 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs @@ -19,7 +19,9 @@ namespace osu.Game.Tests.Visual.Settings public override void SetUpSteps() { base.SetUpSteps(); + AddStep("Load screen", () => LoadScreen(latencyCertifier = new LatencyCertifierScreen())); + AddUntilStep("wait for load", () => latencyCertifier.IsLoaded); } [Test] @@ -33,7 +35,6 @@ namespace osu.Game.Tests.Visual.Settings } AddAssert("check at results", () => !latencyCertifier.ChildrenOfType().Any()); - AddAssert("check no buttons", () => !latencyCertifier.ChildrenOfType().Any()); } diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 157998184c..568e477d8f 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -190,7 +190,7 @@ Do whatever you need to try and perceive the difference in latency, then choose { mainArea.Clear(); - var displayMode = host.Window.CurrentDisplayMode.Value; + var displayMode = host.Window?.CurrentDisplayMode.Value; string exclusive = "unknown"; @@ -217,7 +217,7 @@ Do whatever you need to try and perceive the difference in latency, then choose statusText.AddParagraph(string.Empty); } - statusText.AddParagraph($"Polling: {pollingMax} hz Monitor: {displayMode.RefreshRate:N0} hz Exclusive: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15)); + statusText.AddParagraph($"Polling: {pollingMax} hz Monitor: {displayMode?.RefreshRate ?? 0:N0} hz Exclusive: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15)); statusText.AddParagraph($"Input: {host.InputThread.Clock.FramesPerSecond} hz " + $"Update: {host.UpdateThread.Clock.FramesPerSecond} hz " From f21c9fb520190d51a9e499b57f5410ab16978564 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Tue, 7 Jun 2022 12:05:53 -0400 Subject: [PATCH 1495/2328] add newline --- osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs index 74391e53a2..d0f115def3 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs @@ -44,6 +44,7 @@ namespace osu.Game.Rulesets.Osu.Mods foreach (var drawable in playfield.HitObjectContainer.AliveObjects) { WorkingHitObject = drawable; + switch (drawable) { case DrawableHitCircle circle: From 2f635fa8546bbd5efabb6ecb60b0c32792c32703 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Tue, 7 Jun 2022 01:37:46 +0100 Subject: [PATCH 1496/2328] Refactor `ChatLine` and fix `DrawableChannel` flow padding Refactors `ChatLine` component to use more sensible override properties and layout using grid container. Moves creation of username component into its own method to simplify BDL. Updates padding of base `DrawableChannel` flow padding. Removes usage of `ChatOverlayDrawableChannel` since it's overrides are no longer needed. Updates usage of `StandAloneChatDisplay` to use new override properties of `DrawableChannel`. --- .../Visual/Online/TestSceneChatOverlay.cs | 6 +- osu.Game/Online/Chat/StandAloneChatDisplay.cs | 19 +- osu.Game/Overlays/Chat/ChatLine.cs | 192 +++++++++--------- .../Chat/ChatOverlayDrawableChannel.cs | 39 ---- osu.Game/Overlays/Chat/DaySeparator.cs | 2 +- osu.Game/Overlays/Chat/DrawableChannel.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 12 +- 7 files changed, 114 insertions(+), 158 deletions(-) delete mode 100644 osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs index 2cf1114f30..97221329f5 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs @@ -572,15 +572,15 @@ namespace osu.Game.Tests.Visual.Online public SlowLoadingDrawableChannel GetSlowLoadingChannel(Channel channel) => DrawableChannels.OfType().Single(c => c.Channel == channel); - protected override ChatOverlayDrawableChannel CreateDrawableChannel(Channel newChannel) + protected override DrawableChannel CreateDrawableChannel(Channel newChannel) { return SlowLoading ? new SlowLoadingDrawableChannel(newChannel) - : new ChatOverlayDrawableChannel(newChannel); + : new DrawableChannel(newChannel); } } - private class SlowLoadingDrawableChannel : ChatOverlayDrawableChannel + private class SlowLoadingDrawableChannel : DrawableChannel { public readonly ManualResetEventSlim LoadEvent = new ManualResetEventSlim(); diff --git a/osu.Game/Online/Chat/StandAloneChatDisplay.cs b/osu.Game/Online/Chat/StandAloneChatDisplay.cs index f57ffcfe25..bbfffea6fd 100644 --- a/osu.Game/Online/Chat/StandAloneChatDisplay.cs +++ b/osu.Game/Online/Chat/StandAloneChatDisplay.cs @@ -160,13 +160,6 @@ namespace osu.Game.Online.Chat { } - [BackgroundDependencyLoader] - private void load() - { - // TODO: Remove once DrawableChannel & ChatLine padding is fixed - ChatLineFlow.Padding = new MarginPadding { Horizontal = 0 }; - } - protected override ChatLine CreateChatLine(Message m) => CreateChatLineAction(m); protected override DaySeparator CreateDaySeparator(DateTimeOffset time) => new StandAloneDaySeparator(time); @@ -176,8 +169,8 @@ namespace osu.Game.Online.Chat { protected override float TextSize => 14; protected override float LineHeight => 1; - protected override float Spacing => 10; - protected override float DateAlign => 120; + protected override float Spacing => 5; + protected override float DateAlign => 125; public StandAloneDaySeparator(DateTimeOffset time) : base(time) @@ -189,17 +182,15 @@ namespace osu.Game.Online.Chat { Height = 25; Colour = colours.Yellow; - // TODO: Remove once DrawableChannel & ChatLine padding is fixed - Padding = new MarginPadding { Horizontal = 10 }; } } protected class StandAloneMessage : ChatLine { protected override float TextSize => 15; - protected override float HorizontalPadding => 10; - protected override float MessagePadding => 120; - protected override float TimestampPadding => 50; + protected override float Spacing => 5; + protected override float TimestampWidth => 45; + protected override float UsernameWidth => 75; public StandAloneMessage(Message message) : base(message) diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index a1d8cd5d38..13f66089d9 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -26,22 +26,14 @@ namespace osu.Game.Overlays.Chat { public class ChatLine : CompositeDrawable { - public const float LEFT_PADDING = default_message_padding + default_horizontal_padding * 2; - - private const float default_message_padding = 200; - - protected virtual float MessagePadding => default_message_padding; - - private const float default_timestamp_padding = 65; - - protected virtual float TimestampPadding => default_timestamp_padding; - - private const float default_horizontal_padding = 15; - - protected virtual float HorizontalPadding => default_horizontal_padding; - protected virtual float TextSize => 20; + protected virtual float Spacing => 15; + + protected virtual float TimestampWidth => 60; + + protected virtual float UsernameWidth => 130; + private Color4 usernameColour; private OsuSpriteText timestamp; @@ -49,7 +41,6 @@ namespace osu.Game.Overlays.Chat public ChatLine(Message message) { Message = message; - Padding = new MarginPadding { Left = HorizontalPadding, Right = HorizontalPadding }; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; } @@ -90,88 +81,45 @@ namespace osu.Game.Overlays.Chat ? Color4Extensions.FromHex(message.Sender.Colour) : username_colours[message.Sender.Id % username_colours.Length]; - Drawable effectedUsername = username = new OsuSpriteText + InternalChild = new GridContainer { - Shadow = false, - Colour = senderHasColour ? colours.ChatBlue : usernameColour, - Truncate = true, - EllipsisString = "… :", - Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true), - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - MaxWidth = MessagePadding - TimestampPadding - }; - - if (senderHasColour) - { - // Background effect - effectedUsername = new Container + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, + ColumnDimensions = new[] { - AutoSizeAxes = Axes.Both, - Masking = true, - CornerRadius = 4, - EdgeEffect = new EdgeEffectParameters - { - Roundness = 1, - Radius = 1, - Colour = Color4.Black.Opacity(0.3f), - Offset = new Vector2(0, 1), - Type = EdgeEffectType.Shadow, - }, - Child = new Container - { - AutoSizeAxes = Axes.Both, - Y = 0, - Masking = true, - CornerRadius = 4, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = usernameColour, - }, - new Container - { - AutoSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = 4, Right = 4, Bottom = 1, Top = -2 }, - Child = username - } - } - } - }; - } - - InternalChildren = new Drawable[] - { - new Container - { - Size = new Vector2(MessagePadding, TextSize), - Children = new Drawable[] - { - timestamp = new OsuSpriteText - { - Shadow = false, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Font = OsuFont.GetFont(size: TextSize * 0.75f, weight: FontWeight.SemiBold, fixedWidth: true) - }, - new MessageSender(message.Sender) - { - AutoSizeAxes = Axes.Both, - Origin = Anchor.TopRight, - Anchor = Anchor.TopRight, - Child = effectedUsername, - }, - } + new Dimension(GridSizeMode.Absolute, TimestampWidth + Spacing + UsernameWidth + Spacing), + new Dimension(), }, - new Container + Content = new[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Left = MessagePadding + HorizontalPadding }, - Children = new Drawable[] + new Drawable[] { + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + timestamp = new OsuSpriteText + { + Shadow = false, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Font = OsuFont.GetFont(size: TextSize * 0.75f, weight: FontWeight.SemiBold, fixedWidth: true), + MaxWidth = TimestampWidth, + }, + new MessageSender(message.Sender) + { + Width = UsernameWidth, + AutoSizeAxes = Axes.Y, + Origin = Anchor.TopRight, + Anchor = Anchor.TopRight, + Child = createUsername(), + Margin = new MarginPadding { Horizontal = Spacing }, + }, + }, + }, ContentFlow = new LinkFlowContainer(t => { t.Shadow = false; @@ -190,7 +138,7 @@ namespace osu.Game.Overlays.Chat AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, } - } + }, } }; } @@ -233,7 +181,7 @@ namespace osu.Game.Overlays.Chat timestamp.FadeTo(message is LocalEchoMessage ? 0 : 1, 500, Easing.OutQuint); timestamp.Text = $@"{message.Timestamp.LocalDateTime:HH:mm:ss}"; - username.Text = $@"{message.Sender.Username}" + (senderHasColour || message.IsAction ? "" : ":"); + username.Text = $@"{message.Sender.Username}"; // remove non-existent channels from the link list message.Links.RemoveAll(link => link.Action == LinkAction.OpenChannel && chatManager?.AvailableChannels.Any(c => c.Name == link.Argument.ToString()) != true); @@ -242,6 +190,62 @@ namespace osu.Game.Overlays.Chat ContentFlow.AddLinks(message.DisplayContent, message.Links); } + private Drawable createUsername() + { + username = new OsuSpriteText + { + Shadow = false, + Colour = senderHasColour ? colours.ChatBlue : usernameColour, + Truncate = true, + EllipsisString = "…", + Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true), + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + MaxWidth = UsernameWidth, + }; + + if (!senderHasColour) + return username; + + // Background effect + return new Container + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Masking = true, + CornerRadius = 4, + EdgeEffect = new EdgeEffectParameters + { + Roundness = 1, + Radius = 1, + Colour = Color4.Black.Opacity(0.3f), + Offset = new Vector2(0, 1), + Type = EdgeEffectType.Shadow, + }, + Child = new Container + { + AutoSizeAxes = Axes.Both, + Masking = true, + CornerRadius = 4, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = usernameColour, + }, + new Container + { + AutoSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = 4, Right = 4, Bottom = 1, Top = -2 }, + Child = username + } + } + } + }; + } + private class MessageSender : OsuClickableContainer, IHasContextMenu { private readonly APIUser sender; diff --git a/osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs b/osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs deleted file mode 100644 index a5d22f678e..0000000000 --- a/osu.Game/Overlays/Chat/ChatOverlayDrawableChannel.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -#nullable enable - -using System; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Game.Online.Chat; - -namespace osu.Game.Overlays.Chat -{ - public class ChatOverlayDrawableChannel : DrawableChannel - { - public ChatOverlayDrawableChannel(Channel channel) - : base(channel) - { - } - - [BackgroundDependencyLoader] - private void load() - { - // TODO: Remove once DrawableChannel & ChatLine padding is fixed - ChatLineFlow.Padding = new MarginPadding(0); - } - - protected override DaySeparator CreateDaySeparator(DateTimeOffset time) => new ChatOverlayDaySeparator(time); - - private class ChatOverlayDaySeparator : DaySeparator - { - public ChatOverlayDaySeparator(DateTimeOffset time) - : base(time) - { - // TODO: Remove once DrawableChannel & ChatLine padding is fixed - Padding = new MarginPadding { Horizontal = 15 }; - } - } - } -} diff --git a/osu.Game/Overlays/Chat/DaySeparator.cs b/osu.Game/Overlays/Chat/DaySeparator.cs index 2e3796151c..9ae35b0c38 100644 --- a/osu.Game/Overlays/Chat/DaySeparator.cs +++ b/osu.Game/Overlays/Chat/DaySeparator.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Chat protected virtual float LineHeight => 2; - protected virtual float DateAlign => 200; + protected virtual float DateAlign => 205; protected virtual float Spacing => 15; diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index f0d4d12f4f..c3a341bca4 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -59,7 +59,7 @@ namespace osu.Game.Overlays.Chat Padding = new MarginPadding { Bottom = 5 }, Child = ChatLineFlow = new FillFlowContainer { - Padding = new MarginPadding { Horizontal = 15 }, + Padding = new MarginPadding { Horizontal = 10 }, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 02769b5d68..f04bf76c18 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -38,9 +38,9 @@ namespace osu.Game.Overlays private LoadingLayer loading = null!; private ChannelListing channelListing = null!; private ChatTextBar textBar = null!; - private Container currentChannelContainer = null!; + private Container currentChannelContainer = null!; - private readonly Dictionary loadedChannels = new Dictionary(); + private readonly Dictionary loadedChannels = new Dictionary(); protected IEnumerable DrawableChannels => loadedChannels.Values; @@ -126,7 +126,7 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both, Colour = colourProvider.Background4, }, - currentChannelContainer = new Container + currentChannelContainer = new Container { RelativeSizeAxes = Axes.Both, }, @@ -313,7 +313,7 @@ namespace osu.Game.Overlays loading.Show(); // Ensure the drawable channel is stored before async load to prevent double loading - ChatOverlayDrawableChannel drawableChannel = CreateDrawableChannel(newChannel); + DrawableChannel drawableChannel = CreateDrawableChannel(newChannel); loadedChannels.Add(newChannel, drawableChannel); LoadComponentAsync(drawableChannel, loadedDrawable => @@ -338,7 +338,7 @@ namespace osu.Game.Overlays channelManager.MarkChannelAsRead(newChannel); } - protected virtual ChatOverlayDrawableChannel CreateDrawableChannel(Channel newChannel) => new ChatOverlayDrawableChannel(newChannel); + protected virtual DrawableChannel CreateDrawableChannel(Channel newChannel) => new DrawableChannel(newChannel); private void joinedChannelsChanged(object sender, NotifyCollectionChangedEventArgs args) { @@ -361,7 +361,7 @@ namespace osu.Game.Overlays if (loadedChannels.ContainsKey(channel)) { - ChatOverlayDrawableChannel loaded = loadedChannels[channel]; + DrawableChannel loaded = loadedChannels[channel]; loadedChannels.Remove(channel); // DrawableChannel removed from cache must be manually disposed loaded.Dispose(); From 6c053291443ead7a3f9f0afe18085fe8c915d77f Mon Sep 17 00:00:00 2001 From: theangryepicbanana Date: Tue, 7 Jun 2022 18:01:40 -0400 Subject: [PATCH 1497/2328] Close #5820 (Ability to delete a single skin) --- osu.Game/Localisation/SkinSettingsStrings.cs | 5 ++ .../Overlays/Settings/Sections/SkinSection.cs | 34 +++++++++++++ osu.Game/Screens/Select/SkinDeleteDialog.cs | 48 +++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 osu.Game/Screens/Select/SkinDeleteDialog.cs diff --git a/osu.Game/Localisation/SkinSettingsStrings.cs b/osu.Game/Localisation/SkinSettingsStrings.cs index 8b74b94d59..81035c5a5e 100644 --- a/osu.Game/Localisation/SkinSettingsStrings.cs +++ b/osu.Game/Localisation/SkinSettingsStrings.cs @@ -54,6 +54,11 @@ namespace osu.Game.Localisation /// public static LocalisableString ExportSkinButton => new TranslatableString(getKey(@"export_skin_button"), @"Export selected skin"); + /// + /// "Delete selected skin" + /// + public static LocalisableString DeleteSkinButton => new TranslatableString(getKey(@"delete_skin_button"), @"Delete selected skin"); + private static string getKey(string key) => $"{prefix}:{key}"; } } diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index a87e65b735..e9713ad507 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -16,6 +16,7 @@ using osu.Game.Configuration; using osu.Game.Database; using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; +using osu.Game.Screens.Select; using osu.Game.Skinning; using osu.Game.Skinning.Editor; using Realms; @@ -67,6 +68,7 @@ namespace osu.Game.Overlays.Settings.Sections Action = () => skinEditor?.ToggleVisibility(), }, new ExportSkinButton(), + new DeleteSkinButton(), }; config.BindWith(OsuSetting.Skin, configBindable); @@ -202,5 +204,37 @@ namespace osu.Game.Overlays.Settings.Sections } } } + + public class DeleteSkinButton : DangerousSettingsButton + { + [Resolved] + private SkinManager skins { get; set; } + + [Resolved(CanBeNull = true)] + private IDialogOverlay dialogOverlay { get; set; } + + private Bindable currentSkin; + + [BackgroundDependencyLoader] + private void load() + { + Text = SkinSettingsStrings.DeleteSkinButton; + Action = delete; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + currentSkin = skins.CurrentSkin.GetBoundCopy(); + currentSkin.BindValueChanged(skin => Enabled.Value = skin.NewValue.SkinInfo.PerformRead(s => !s.Protected), true); + } + + private void delete() + { + if (dialogOverlay != null) + dialogOverlay.Push(new SkinDeleteDialog(currentSkin.Value)); + } + } } } diff --git a/osu.Game/Screens/Select/SkinDeleteDialog.cs b/osu.Game/Screens/Select/SkinDeleteDialog.cs new file mode 100644 index 0000000000..a971cca401 --- /dev/null +++ b/osu.Game/Screens/Select/SkinDeleteDialog.cs @@ -0,0 +1,48 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics.Sprites; +using osu.Game.Skinning; +using osu.Game.Overlays.Dialog; +using osu.Game.Database; + +namespace osu.Game.Screens.Select +{ + public class SkinDeleteDialog : PopupDialog + { + private SkinManager manager; + + [BackgroundDependencyLoader] + private void load(SkinManager skinManager) + { + manager = skinManager; + } + + public SkinDeleteDialog(Skin skin) + { + skin.SkinInfo.PerformRead(s => + { + BodyText = s.Name; + + Icon = FontAwesome.Regular.TrashAlt; + HeaderText = @"Confirm deletion of"; + Buttons = new PopupDialogButton[] + { + new PopupDialogDangerousButton + { + Text = @"Yes. Totally. Delete it.", + Action = () => { + manager.Delete(s); + manager.CurrentSkinInfo.Value = DefaultSkin.CreateInfo().ToLiveUnmanaged(); + }, + }, + new PopupDialogCancelButton + { + Text = @"Firetruck, I didn't mean to!", + }, + }; + }); + } + } +} From c69d53df0035ed1a469233cbbcd145ca706979ad Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 8 Jun 2022 04:29:48 +0300 Subject: [PATCH 1498/2328] Add failing test case --- .../Visual/Online/TestSceneMessageNotifier.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs index 79f62a16e3..5f7c8b3c51 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; @@ -178,6 +179,36 @@ namespace osu.Game.Tests.Visual.Online AddAssert("1 notification fired", () => testContainer.NotificationOverlay.UnreadCount.Value == 1); } + /// + /// Ensures that handles channels which have not been or could not be resolved (i.e. = 0). + /// + [Test] + public void TestSendInUnresolvedChannel() + { + int i = 1; + Channel unresolved = null; + + AddRepeatStep("join unresolved channels", () => testContainer.ChannelManager.JoinChannel(unresolved = new Channel(new APIUser + { + Id = 100 + i, + Username = $"Foreign #{i++}", + })), 5); + + AddStep("send message in unresolved channel", () => + { + Debug.Assert(unresolved.Id == 0); + + unresolved.AddLocalEcho(new LocalEchoMessage + { + Sender = API.LocalUser.Value, + ChannelId = unresolved.Id, + Content = "Some message", + }); + }); + + AddAssert("no notifications fired", () => testContainer.NotificationOverlay.UnreadCount.Value == 0); + } + private void receiveMessage(APIUser sender, Channel channel, string content) => channel.AddNewMessages(createMessage(sender, channel, content)); private Message createMessage(APIUser sender, Channel channel, string content) => new Message(messageIdCounter++) From 830ff666888e2d82303c38e6284553e1c169c698 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 8 Jun 2022 04:31:31 +0300 Subject: [PATCH 1499/2328] Fix message notifier not handling unresolved PM channels --- osu.Game/Online/Chat/MessageNotifier.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/Chat/MessageNotifier.cs b/osu.Game/Online/Chat/MessageNotifier.cs index ca6082e19b..fbc5ef79ef 100644 --- a/osu.Game/Online/Chat/MessageNotifier.cs +++ b/osu.Game/Online/Chat/MessageNotifier.cs @@ -77,7 +77,7 @@ namespace osu.Game.Online.Chat if (!messages.Any()) return; - var channel = channelManager.JoinedChannels.SingleOrDefault(c => c.Id == messages.First().ChannelId); + var channel = channelManager.JoinedChannels.SingleOrDefault(c => c.Id > 0 && c.Id == messages.First().ChannelId); if (channel == null) return; From f54a68f6cae2ff193c6ad94b23d11f918ec3197f Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Wed, 8 Jun 2022 01:00:47 -0400 Subject: [PATCH 1500/2328] scale down repulsion strength --- osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs | 3 ++- osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs index d0f115def3..e93863fa96 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs @@ -21,6 +21,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay) }; public abstract BindableFloat EasementStrength { get; } + protected virtual float EasementStrengthMultiplier => 1.0f; protected Vector2 CursorPosition; protected DrawableHitObject WorkingHitObject; protected abstract Vector2 DestinationVector { get; } @@ -65,7 +66,7 @@ namespace osu.Game.Rulesets.Osu.Mods private void easeHitObjectPositionToVector(DrawableHitObject hitObject, Vector2 destination) { - double dampLength = Interpolation.Lerp(3000, 40, EasementStrength.Value); + double dampLength = Interpolation.Lerp(3000, 40, EasementStrength.Value * EasementStrengthMultiplier); float x = (float)Interpolation.DampContinuously(hitObject.X, destination.X, dampLength, gameplayClock.ElapsedFrameTime); float y = (float)Interpolation.DampContinuously(hitObject.Y, destination.Y, dampLength, gameplayClock.ElapsedFrameTime); diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs index fec66e3ef1..95242808af 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs @@ -22,13 +22,15 @@ namespace osu.Game.Rulesets.Osu.Mods public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModMagnetised)).ToArray(); [SettingSource("Repulsion strength", "How strong the repulsion is.", 0)] - public override BindableFloat EasementStrength { get; } = new BindableFloat(0.5f) + public override BindableFloat EasementStrength { get; } = new BindableFloat(0.6f) { Precision = 0.05f, MinValue = 0.05f, MaxValue = 1.0f, }; + protected override float EasementStrengthMultiplier => 0.8f; + protected override Vector2 DestinationVector { get From 5157a78ae6f7fbb2c94482aeae8ac0b0e556bd2a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 8 Jun 2022 16:53:06 +0900 Subject: [PATCH 1501/2328] Isolate nested sample screens from main game to avoid toolbar interactions --- .../Overlays/FirstRunSetup/ScreenUIScale.cs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs index 8452691bb5..f09a26a527 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs @@ -126,6 +126,7 @@ namespace osu.Game.Overlays.FirstRunSetup private class SampleScreenContainer : CompositeDrawable { private readonly OsuScreen screen; + // Minimal isolation from main game. [Cached] @@ -151,6 +152,9 @@ namespace osu.Game.Overlays.FirstRunSetup RelativeSizeAxes = Axes.Both; } + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => + new DependencyContainer(new DependencyIsolationContainer(base.CreateChildDependencies(parent))); + [BackgroundDependencyLoader] private void load(AudioManager audio, TextureStore textures, RulesetStore rulesets) { @@ -197,5 +201,41 @@ namespace osu.Game.Overlays.FirstRunSetup stack.PushSynchronously(screen); } } + + private class DependencyIsolationContainer : IReadOnlyDependencyContainer + { + private readonly IReadOnlyDependencyContainer parentDependencies; + + private readonly Type[] isolatedTypes = + { + typeof(OsuGame) + }; + + public DependencyIsolationContainer(IReadOnlyDependencyContainer parentDependencies) + { + this.parentDependencies = parentDependencies; + } + + public object Get(Type type) + { + if (isolatedTypes.Contains(type)) + return null; + + return parentDependencies.Get(type); + } + + public object Get(Type type, CacheInfo info) + { + if (isolatedTypes.Contains(type)) + return null; + + return parentDependencies.Get(type, info); + } + + public void Inject(T instance) where T : class + { + parentDependencies.Inject(instance); + } + } } } From 3a90aa0b9b9ccb909616a9c828c9c0fdaeb845a3 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 8 Jun 2022 17:57:59 +0900 Subject: [PATCH 1502/2328] Fix code styling --- osu.Game/Overlays/Settings/Sections/SkinSection.cs | 3 +-- osu.Game/Screens/Select/SkinDeleteDialog.cs | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index e9713ad507..b83600a16d 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -232,8 +232,7 @@ namespace osu.Game.Overlays.Settings.Sections private void delete() { - if (dialogOverlay != null) - dialogOverlay.Push(new SkinDeleteDialog(currentSkin.Value)); + dialogOverlay?.Push(new SkinDeleteDialog(currentSkin.Value)); } } } diff --git a/osu.Game/Screens/Select/SkinDeleteDialog.cs b/osu.Game/Screens/Select/SkinDeleteDialog.cs index a971cca401..c7c36fb92c 100644 --- a/osu.Game/Screens/Select/SkinDeleteDialog.cs +++ b/osu.Game/Screens/Select/SkinDeleteDialog.cs @@ -32,7 +32,11 @@ namespace osu.Game.Screens.Select new PopupDialogDangerousButton { Text = @"Yes. Totally. Delete it.", - Action = () => { + Action = () => + { + if (manager == null) + return; + manager.Delete(s); manager.CurrentSkinInfo.Value = DefaultSkin.CreateInfo().ToLiveUnmanaged(); }, From cf438b1a44781bfc0bee8597f8945eddec5a2036 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 8 Jun 2022 18:01:54 +0900 Subject: [PATCH 1503/2328] Add index on `MD5Hash` property Reduces actual query overhead significantly --- osu.Game/Beatmaps/BeatmapInfo.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index abc9020dc6..5925dd7064 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -90,6 +90,7 @@ namespace osu.Game.Beatmaps public double StarRating { get; set; } + [Indexed] public string MD5Hash { get; set; } = string.Empty; [JsonIgnore] From f8594acb1d4018feb2e12af710f103be72580f15 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 8 Jun 2022 18:10:41 +0900 Subject: [PATCH 1504/2328] Cleanup dialog implementation --- osu.Game/Screens/Select/SkinDeleteDialog.cs | 48 ++++++++------------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/osu.Game/Screens/Select/SkinDeleteDialog.cs b/osu.Game/Screens/Select/SkinDeleteDialog.cs index c7c36fb92c..4262118658 100644 --- a/osu.Game/Screens/Select/SkinDeleteDialog.cs +++ b/osu.Game/Screens/Select/SkinDeleteDialog.cs @@ -5,48 +5,38 @@ using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osu.Game.Skinning; using osu.Game.Overlays.Dialog; -using osu.Game.Database; namespace osu.Game.Screens.Select { public class SkinDeleteDialog : PopupDialog { - private SkinManager manager; - - [BackgroundDependencyLoader] - private void load(SkinManager skinManager) - { - manager = skinManager; - } + [Resolved] + private SkinManager manager { get; set; } public SkinDeleteDialog(Skin skin) { - skin.SkinInfo.PerformRead(s => + BodyText = skin.SkinInfo.Value.Name; + Icon = FontAwesome.Regular.TrashAlt; + HeaderText = @"Confirm deletion of"; + Buttons = new PopupDialogButton[] { - BodyText = s.Name; - - Icon = FontAwesome.Regular.TrashAlt; - HeaderText = @"Confirm deletion of"; - Buttons = new PopupDialogButton[] + new PopupDialogDangerousButton { - new PopupDialogDangerousButton + Text = @"Yes. Totally. Delete it.", + Action = () => { - Text = @"Yes. Totally. Delete it.", - Action = () => - { - if (manager == null) - return; + if (manager == null) + return; - manager.Delete(s); - manager.CurrentSkinInfo.Value = DefaultSkin.CreateInfo().ToLiveUnmanaged(); - }, + manager.Delete(skin.SkinInfo.Value); + manager.CurrentSkinInfo.SetDefault(); }, - new PopupDialogCancelButton - { - Text = @"Firetruck, I didn't mean to!", - }, - }; - }); + }, + new PopupDialogCancelButton + { + Text = @"Firetruck, I didn't mean to!", + }, + }; } } } From 42cd7d9e6ea9942edad6e2751c008d1281718aec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 8 Jun 2022 18:23:09 +0900 Subject: [PATCH 1505/2328] Change `CollectionManager` to only store MD5 hashes instead of full `BeatmapInfo` --- .../TestSceneManageCollectionsDialog.cs | 6 +++--- .../Visual/SongSelect/TestSceneFilterControl.cs | 6 +++--- osu.Game/Collections/BeatmapCollection.cs | 4 ++-- .../Collections/CollectionFilterDropdown.cs | 10 +++++----- osu.Game/Collections/CollectionManager.cs | 17 ++++++----------- osu.Game/Overlays/Music/Playlist.cs | 17 ++++++++++++++++- .../Screens/Select/Carousel/CarouselBeatmap.cs | 2 +- .../Select/Carousel/DrawableCarouselBeatmap.cs | 6 +++--- .../Carousel/DrawableCarouselBeatmapSet.cs | 8 ++++---- 9 files changed, 43 insertions(+), 33 deletions(-) diff --git a/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs b/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs index 888002eb36..caf3473c45 100644 --- a/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs +++ b/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs @@ -152,7 +152,7 @@ namespace osu.Game.Tests.Visual.Collections AddStep("add two collections with same name", () => manager.Collections.AddRange(new[] { new BeatmapCollection { Name = { Value = "1" } }, - new BeatmapCollection { Name = { Value = "1" }, Beatmaps = { beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps[0] } }, + new BeatmapCollection { Name = { Value = "1" }, Beatmaps = { beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps[0].MD5Hash } }, })); } @@ -162,7 +162,7 @@ namespace osu.Game.Tests.Visual.Collections AddStep("add two collections", () => manager.Collections.AddRange(new[] { new BeatmapCollection { Name = { Value = "1" } }, - new BeatmapCollection { Name = { Value = "2" }, Beatmaps = { beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps[0] } }, + new BeatmapCollection { Name = { Value = "2" }, Beatmaps = { beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps[0].MD5Hash } }, })); assertCollectionCount(2); @@ -198,7 +198,7 @@ namespace osu.Game.Tests.Visual.Collections { AddStep("add two collections", () => manager.Collections.AddRange(new[] { - new BeatmapCollection { Name = { Value = "1" }, Beatmaps = { beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps[0] } }, + new BeatmapCollection { Name = { Value = "1" }, Beatmaps = { beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps[0].MD5Hash } }, })); assertCollectionCount(1); diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs index b7ec128596..db49ec06f8 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs @@ -151,7 +151,7 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep("add collection", () => collectionManager.Collections.Add(new BeatmapCollection { Name = { Value = "1" } })); AddAssert("button is plus", () => getAddOrRemoveButton(1).Icon.Equals(FontAwesome.Solid.PlusSquare)); - AddStep("add beatmap to collection", () => collectionManager.Collections[0].Beatmaps.Add(Beatmap.Value.BeatmapInfo)); + AddStep("add beatmap to collection", () => collectionManager.Collections[0].Beatmaps.Add(Beatmap.Value.BeatmapInfo.MD5Hash)); AddAssert("button is minus", () => getAddOrRemoveButton(1).Icon.Equals(FontAwesome.Solid.MinusSquare)); AddStep("remove beatmap from collection", () => collectionManager.Collections[0].Beatmaps.Clear()); @@ -169,11 +169,11 @@ namespace osu.Game.Tests.Visual.SongSelect AddAssert("button is plus", () => getAddOrRemoveButton(1).Icon.Equals(FontAwesome.Solid.PlusSquare)); addClickAddOrRemoveButtonStep(1); - AddAssert("collection contains beatmap", () => collectionManager.Collections[0].Beatmaps.Contains(Beatmap.Value.BeatmapInfo)); + AddAssert("collection contains beatmap", () => collectionManager.Collections[0].Beatmaps.Contains(Beatmap.Value.BeatmapInfo.MD5Hash)); AddAssert("button is minus", () => getAddOrRemoveButton(1).Icon.Equals(FontAwesome.Solid.MinusSquare)); addClickAddOrRemoveButtonStep(1); - AddAssert("collection does not contain beatmap", () => !collectionManager.Collections[0].Beatmaps.Contains(Beatmap.Value.BeatmapInfo)); + AddAssert("collection does not contain beatmap", () => !collectionManager.Collections[0].Beatmaps.Contains(Beatmap.Value.BeatmapInfo.MD5Hash)); AddAssert("button is plus", () => getAddOrRemoveButton(1).Icon.Equals(FontAwesome.Solid.PlusSquare)); } diff --git a/osu.Game/Collections/BeatmapCollection.cs b/osu.Game/Collections/BeatmapCollection.cs index 7e4b15ecf9..ca0f57f638 100644 --- a/osu.Game/Collections/BeatmapCollection.cs +++ b/osu.Game/Collections/BeatmapCollection.cs @@ -23,9 +23,9 @@ namespace osu.Game.Collections public readonly Bindable Name = new Bindable(); /// - /// The beatmaps contained by the collection. + /// The es of beatmaps contained by the collection. /// - public readonly BindableList Beatmaps = new BindableList(); + public readonly BindableList Beatmaps = new BindableList(); /// /// The date when this collection was last modified. diff --git a/osu.Game/Collections/CollectionFilterDropdown.cs b/osu.Game/Collections/CollectionFilterDropdown.cs index c46ba8e06e..97e5711d75 100644 --- a/osu.Game/Collections/CollectionFilterDropdown.cs +++ b/osu.Game/Collections/CollectionFilterDropdown.cs @@ -38,7 +38,7 @@ namespace osu.Game.Collections } private readonly IBindableList collections = new BindableList(); - private readonly IBindableList beatmaps = new BindableList(); + private readonly IBindableList beatmaps = new BindableList(); private readonly BindableList filters = new BindableList(); [Resolved(CanBeNull = true)] @@ -196,7 +196,7 @@ namespace osu.Game.Collections private IBindable beatmap { get; set; } [CanBeNull] - private readonly BindableList collectionBeatmaps; + private readonly BindableList collectionBeatmaps; [NotNull] private readonly Bindable collectionName; @@ -258,7 +258,7 @@ namespace osu.Game.Collections { Debug.Assert(collectionBeatmaps != null); - beatmapInCollection = collectionBeatmaps.Contains(beatmap.Value.BeatmapInfo); + beatmapInCollection = collectionBeatmaps.Contains(beatmap.Value.BeatmapInfo.MD5Hash); addOrRemoveButton.Enabled.Value = !beatmap.IsDefault; addOrRemoveButton.Icon = beatmapInCollection ? FontAwesome.Solid.MinusSquare : FontAwesome.Solid.PlusSquare; @@ -285,8 +285,8 @@ namespace osu.Game.Collections { Debug.Assert(collectionBeatmaps != null); - if (!collectionBeatmaps.Remove(beatmap.Value.BeatmapInfo)) - collectionBeatmaps.Add(beatmap.Value.BeatmapInfo); + if (!collectionBeatmaps.Remove(beatmap.Value.BeatmapInfo.MD5Hash)) + collectionBeatmaps.Add(beatmap.Value.BeatmapInfo.MD5Hash); } protected override Drawable CreateContent() => content = (Content)base.CreateContent(); diff --git a/osu.Game/Collections/CollectionManager.cs b/osu.Game/Collections/CollectionManager.cs index 700b0f5dcb..30171a71af 100644 --- a/osu.Game/Collections/CollectionManager.cs +++ b/osu.Game/Collections/CollectionManager.cs @@ -13,7 +13,6 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Logging; using osu.Framework.Platform; -using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.IO; using osu.Game.IO.Legacy; @@ -40,9 +39,6 @@ namespace osu.Game.Collections public readonly BindableList Collections = new BindableList(); - [Resolved] - private BeatmapManager beatmaps { get; set; } - private readonly Storage storage; public CollectionManager(Storage storage) @@ -173,7 +169,7 @@ namespace osu.Game.Collections if (existing == null) Collections.Add(existing = new BeatmapCollection { Name = { Value = newCol.Name.Value } }); - foreach (var newBeatmap in newCol.Beatmaps) + foreach (string newBeatmap in newCol.Beatmaps) { if (!existing.Beatmaps.Contains(newBeatmap)) existing.Beatmaps.Add(newBeatmap); @@ -226,9 +222,7 @@ namespace osu.Game.Collections string checksum = sr.ReadString(); - var beatmap = beatmaps.QueryBeatmap(b => b.MD5Hash == checksum); - if (beatmap != null) - collection.Beatmaps.Add(beatmap); + collection.Beatmaps.Add(checksum); } if (notification != null) @@ -299,11 +293,12 @@ namespace osu.Game.Collections { sw.Write(c.Name.Value); - var beatmapsCopy = c.Beatmaps.ToArray(); + string[] beatmapsCopy = c.Beatmaps.ToArray(); + sw.Write(beatmapsCopy.Length); - foreach (var b in beatmapsCopy) - sw.Write(b.MD5Hash); + foreach (string b in beatmapsCopy) + sw.Write(b); } } diff --git a/osu.Game/Overlays/Music/Playlist.cs b/osu.Game/Overlays/Music/Playlist.cs index 24d867141c..4653a65041 100644 --- a/osu.Game/Overlays/Music/Playlist.cs +++ b/osu.Game/Overlays/Music/Playlist.cs @@ -30,7 +30,22 @@ namespace osu.Game.Overlays.Music var items = (SearchContainer>>)ListContainer; foreach (var item in items.OfType()) - item.InSelectedCollection = criteria.Collection?.Beatmaps.Any(b => item.Model.ID == b.BeatmapSet?.ID) ?? true; + { + var beatmapHashes = item.Model.Value.Beatmaps.Select(b => b.MD5Hash); + + bool contained = false; + + foreach (string hash in beatmapHashes) + { + if (criteria.Collection?.Beatmaps.Contains(hash) == true) + { + contained = true; + break; + } + } + + item.InSelectedCollection = contained; + } items.SearchTerm = criteria.SearchText; } diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs index fd6a869938..de9899f288 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs @@ -72,7 +72,7 @@ namespace osu.Game.Screens.Select.Carousel } if (match) - match &= criteria.Collection?.Beatmaps.Contains(BeatmapInfo) ?? true; + match &= criteria.Collection?.Beatmaps.Contains(BeatmapInfo.MD5Hash) ?? true; if (match && criteria.RulesetCriteria != null) match &= criteria.RulesetCriteria.Matches(BeatmapInfo); diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 98b885eb43..79d27e9d9d 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -256,12 +256,12 @@ namespace osu.Game.Screens.Select.Carousel return new ToggleMenuItem(collection.Name.Value, MenuItemType.Standard, s => { if (s) - collection.Beatmaps.Add(beatmapInfo); + collection.Beatmaps.Add(beatmapInfo.MD5Hash); else - collection.Beatmaps.Remove(beatmapInfo); + collection.Beatmaps.Remove(beatmapInfo.MD5Hash); }) { - State = { Value = collection.Beatmaps.Contains(beatmapInfo) } + State = { Value = collection.Beatmaps.Contains(beatmapInfo.MD5Hash) } }; } diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 2d70b1aecb..ade89c5b35 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -245,7 +245,7 @@ namespace osu.Game.Screens.Select.Carousel TernaryState state; - int countExisting = beatmapSet.Beatmaps.Count(b => collection.Beatmaps.Contains(b)); + int countExisting = beatmapSet.Beatmaps.Count(b => collection.Beatmaps.Contains(b.MD5Hash)); if (countExisting == beatmapSet.Beatmaps.Count) state = TernaryState.True; @@ -261,14 +261,14 @@ namespace osu.Game.Screens.Select.Carousel switch (s) { case TernaryState.True: - if (collection.Beatmaps.Contains(b)) + if (collection.Beatmaps.Contains(b.MD5Hash)) continue; - collection.Beatmaps.Add(b); + collection.Beatmaps.Add(b.MD5Hash); break; case TernaryState.False: - collection.Beatmaps.Remove(b); + collection.Beatmaps.Remove(b.MD5Hash); break; } } From 3d4d87bcb2194ad2c48aa9d41569170a0d91913a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 8 Jun 2022 18:34:28 +0900 Subject: [PATCH 1506/2328] Update test expectations --- osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs b/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs index 5cbede54f5..db6e93206d 100644 --- a/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs +++ b/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs @@ -50,10 +50,10 @@ namespace osu.Game.Tests.Collections.IO Assert.That(osu.CollectionManager.Collections.Count, Is.EqualTo(2)); Assert.That(osu.CollectionManager.Collections[0].Name.Value, Is.EqualTo("First")); - Assert.That(osu.CollectionManager.Collections[0].Beatmaps.Count, Is.Zero); + Assert.That(osu.CollectionManager.Collections[0].Beatmaps.Count, Is.EqualTo(1)); Assert.That(osu.CollectionManager.Collections[1].Name.Value, Is.EqualTo("Second")); - Assert.That(osu.CollectionManager.Collections[1].Beatmaps.Count, Is.Zero); + Assert.That(osu.CollectionManager.Collections[1].Beatmaps.Count, Is.EqualTo(12)); } finally { From c661f2b059e983938a4b2cbdb5f90e915968c1cb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 8 Jun 2022 18:54:23 +0900 Subject: [PATCH 1507/2328] Ensure `ChannelManager` has access to API from point of construction Closes https://github.com/ppy/osu/issues/18451. --- osu.Game.Tests/Chat/TestSceneChannelManager.cs | 8 ++++---- osu.Game.Tests/Visual/Online/TestSceneChatLink.cs | 2 +- .../Visual/Online/TestSceneChatOverlay.cs | 2 +- .../Visual/Online/TestSceneMessageNotifier.cs | 7 ++++--- .../Online/TestSceneStandAloneChatDisplay.cs | 14 ++++++++++---- .../Components/TournamentMatchChatDisplay.cs | 5 +++-- osu.Game/Online/Chat/ChannelManager.cs | 6 +++--- osu.Game/OsuGame.cs | 2 +- 8 files changed, 27 insertions(+), 19 deletions(-) diff --git a/osu.Game.Tests/Chat/TestSceneChannelManager.cs b/osu.Game.Tests/Chat/TestSceneChannelManager.cs index eaacc623c9..2bb6459f20 100644 --- a/osu.Game.Tests/Chat/TestSceneChannelManager.cs +++ b/osu.Game.Tests/Chat/TestSceneChannelManager.cs @@ -25,7 +25,7 @@ namespace osu.Game.Tests.Chat [SetUp] public void Setup() => Schedule(() => { - var container = new ChannelManagerContainer(); + var container = new ChannelManagerContainer(API); Child = container; channelManager = container.ChannelManager; }); @@ -145,11 +145,11 @@ namespace osu.Game.Tests.Chat private class ChannelManagerContainer : CompositeDrawable { [Cached] - public ChannelManager ChannelManager { get; } = new ChannelManager(); + public ChannelManager ChannelManager { get; } - public ChannelManagerContainer() + public ChannelManagerContainer(IAPIProvider apiProvider) { - InternalChild = ChannelManager; + InternalChild = ChannelManager = new ChannelManager(apiProvider); } } } diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs b/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs index a28de3be1e..4d227af2cb 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs @@ -39,7 +39,7 @@ namespace osu.Game.Tests.Visual.Online { linkColour = colours.Blue; - var chatManager = new ChannelManager(); + var chatManager = new ChannelManager(API); BindableList availableChannels = (BindableList)chatManager.AvailableChannels; availableChannels.Add(new Channel { Name = "#english" }); availableChannels.Add(new Channel { Name = "#japanese" }); diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs index 97221329f5..e3792c0780 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs @@ -59,7 +59,7 @@ namespace osu.Game.Tests.Visual.Online RelativeSizeAxes = Axes.Both, CachedDependencies = new (Type, object)[] { - (typeof(ChannelManager), channelManager = new ChannelManager()), + (typeof(ChannelManager), channelManager = new ChannelManager(API)), }, Children = new Drawable[] { diff --git a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs index 5f7c8b3c51..c7ca3b4457 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs @@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual.Online Schedule(() => { - Child = testContainer = new TestContainer(new[] { publicChannel, privateMessageChannel }) + Child = testContainer = new TestContainer(API, new[] { publicChannel, privateMessageChannel }) { RelativeSizeAxes = Axes.Both, }; @@ -229,7 +229,7 @@ namespace osu.Game.Tests.Visual.Online private class TestContainer : Container { [Cached] - public ChannelManager ChannelManager { get; } = new ChannelManager(); + public ChannelManager ChannelManager { get; } [Cached(typeof(INotificationOverlay))] public NotificationOverlay NotificationOverlay { get; } = new NotificationOverlay @@ -245,9 +245,10 @@ namespace osu.Game.Tests.Visual.Online private readonly Channel[] channels; - public TestContainer(Channel[] channels) + public TestContainer(IAPIProvider api, Channel[] channels) { this.channels = channels; + ChannelManager = new ChannelManager(api); } [BackgroundDependencyLoader] diff --git a/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs b/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs index cb52f41c33..8d5eebd31f 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs @@ -11,6 +11,7 @@ using NUnit.Framework; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Framework.Utils; +using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Chat; using osuTK.Input; @@ -44,17 +45,22 @@ namespace osu.Game.Tests.Visual.Online Id = 5, }; - [Cached] - private ChannelManager channelManager = new ChannelManager(); + private ChannelManager channelManager; private TestStandAloneChatDisplay chatDisplay; private int messageIdSequence; private Channel testChannel; - public TestSceneStandAloneChatDisplay() + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - Add(channelManager); + Add(channelManager = new ChannelManager(parent.Get())); + + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + + dependencies.Cache(channelManager); + + return dependencies; } [SetUp] diff --git a/osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs b/osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs index a5ead6c2f0..c30250c86a 100644 --- a/osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs +++ b/osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs @@ -5,6 +5,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Game.Online.API; using osu.Game.Online.Chat; using osu.Game.Overlays.Chat; using osu.Game.Tournament.IPC; @@ -29,7 +30,7 @@ namespace osu.Game.Tournament.Components } [BackgroundDependencyLoader(true)] - private void load(MatchIPCInfo ipc) + private void load(MatchIPCInfo ipc, IAPIProvider api) { if (ipc != null) { @@ -45,7 +46,7 @@ namespace osu.Game.Tournament.Components if (manager == null) { - AddInternal(manager = new ChannelManager { HighPollRate = { Value = true } }); + AddInternal(manager = new ChannelManager(api) { HighPollRate = { Value = true } }); Channel.BindTo(manager.CurrentChannel); } diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 31f67bcecc..c96e7c4cd3 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -61,8 +61,7 @@ namespace osu.Game.Online.Chat /// public IBindableList AvailableChannels => availableChannels; - [Resolved] - private IAPIProvider api { get; set; } + private readonly IAPIProvider api; [Resolved] private UserLookupCache users { get; set; } @@ -71,8 +70,9 @@ namespace osu.Game.Online.Chat private readonly IBindable isIdle = new BindableBool(); - public ChannelManager() + public ChannelManager(IAPIProvider api) { + this.api = api; CurrentChannel.ValueChanged += currentChannelChanged; } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index b91d523151..1f9a1ce938 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -851,7 +851,7 @@ namespace osu.Game loadComponentSingleFile(dashboard = new DashboardOverlay(), overlayContent.Add, true); loadComponentSingleFile(news = new NewsOverlay(), overlayContent.Add, true); var rankingsOverlay = loadComponentSingleFile(new RankingsOverlay(), overlayContent.Add, true); - loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal, true); + loadComponentSingleFile(channelManager = new ChannelManager(API), AddInternal, true); loadComponentSingleFile(chatOverlay = new ChatOverlay(), overlayContent.Add, true); loadComponentSingleFile(new MessageNotifier(), AddInternal, true); loadComponentSingleFile(Settings = new SettingsOverlay(), leftFloatingOverlayContent.Add, true); From 6aa84425a28eb420c0388d20b93d38cc26f61f17 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 8 Jun 2022 19:26:34 +0900 Subject: [PATCH 1508/2328] Add comment explaining test expectations --- osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs b/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs index db6e93206d..73152c33d9 100644 --- a/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs +++ b/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs @@ -49,6 +49,11 @@ namespace osu.Game.Tests.Collections.IO Assert.That(osu.CollectionManager.Collections.Count, Is.EqualTo(2)); + // Even with no beatmaps imported, collections are tracking the hashes and will continue to. + // In the future this whole mechanism will be replaced with having the collections in realm, + // but until that happens it makes rough sense that we want to track not-yet-imported beatmaps + // and have them associate with collections if/when they become available. + Assert.That(osu.CollectionManager.Collections[0].Name.Value, Is.EqualTo("First")); Assert.That(osu.CollectionManager.Collections[0].Beatmaps.Count, Is.EqualTo(1)); From c22bffaa012ed7750c011fc3796e9ef6d997786b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 8 Jun 2022 19:30:18 +0900 Subject: [PATCH 1509/2328] Fix filter failure when no collection is selected --- osu.Game/Overlays/Music/Playlist.cs | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/Music/Playlist.cs b/osu.Game/Overlays/Music/Playlist.cs index 4653a65041..1d8163b57b 100644 --- a/osu.Game/Overlays/Music/Playlist.cs +++ b/osu.Game/Overlays/Music/Playlist.cs @@ -31,20 +31,25 @@ namespace osu.Game.Overlays.Music foreach (var item in items.OfType()) { - var beatmapHashes = item.Model.Value.Beatmaps.Select(b => b.MD5Hash); - - bool contained = false; - - foreach (string hash in beatmapHashes) + if (criteria.Collection == null) + item.InSelectedCollection = true; + else { - if (criteria.Collection?.Beatmaps.Contains(hash) == true) - { - contained = true; - break; - } - } + var beatmapHashes = item.Model.Value.Beatmaps.Select(b => b.MD5Hash); - item.InSelectedCollection = contained; + bool contained = false; + + foreach (string hash in beatmapHashes) + { + if (criteria.Collection?.Beatmaps.Contains(hash) == true) + { + contained = true; + break; + } + } + + item.InSelectedCollection = contained; + } } items.SearchTerm = criteria.SearchText; From dfa31df2af366a5f3cf7e836a80d335151f3ba37 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 8 Jun 2022 13:42:30 +0100 Subject: [PATCH 1510/2328] Use `#nullable enable` in `ChatLine` --- osu.Game/Overlays/Chat/ChatLine.cs | 69 ++++++++++++++++-------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index 13f66089d9..6cd0b76a49 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Linq; using System.Collections.Generic; @@ -26,33 +28,6 @@ namespace osu.Game.Overlays.Chat { public class ChatLine : CompositeDrawable { - protected virtual float TextSize => 20; - - protected virtual float Spacing => 15; - - protected virtual float TimestampWidth => 60; - - protected virtual float UsernameWidth => 130; - - private Color4 usernameColour; - - private OsuSpriteText timestamp; - - public ChatLine(Message message) - { - Message = message; - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - } - - [Resolved(CanBeNull = true)] - private ChannelManager chatManager { get; set; } - - private Message message; - private OsuSpriteText username; - - public LinkFlowContainer ContentFlow { get; private set; } - public Message Message { get => message; @@ -69,10 +44,40 @@ namespace osu.Game.Overlays.Chat } } + public LinkFlowContainer ContentFlow { get; private set; } = null!; + + protected virtual float TextSize => 20; + + protected virtual float Spacing => 15; + + protected virtual float TimestampWidth => 60; + + protected virtual float UsernameWidth => 130; + + private Color4 usernameColour; + + private OsuSpriteText timestamp = null!; + + private Message message = null!; + + private OsuSpriteText username = null!; + + private Container? highlight; + private bool senderHasColour => !string.IsNullOrEmpty(message.Sender.Colour); + [Resolved(CanBeNull = true)] + private ChannelManager? chatManager { get; set; } + [Resolved] - private OsuColour colours { get; set; } + private OsuColour colours { get; set; } = null!; + + public ChatLine(Message message) + { + Message = message; + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + } [BackgroundDependencyLoader] private void load() @@ -151,8 +156,6 @@ namespace osu.Game.Overlays.Chat FinishTransforms(true); } - private Container highlight; - /// /// Performs a highlight animation on this . /// @@ -250,10 +253,10 @@ namespace osu.Game.Overlays.Chat { private readonly APIUser sender; - private Action startChatAction; + private Action startChatAction = null!; [Resolved] - private IAPIProvider api { get; set; } + private IAPIProvider api { get; set; } = null!; public MessageSender(APIUser sender) { @@ -261,7 +264,7 @@ namespace osu.Game.Overlays.Chat } [BackgroundDependencyLoader(true)] - private void load(UserProfileOverlay profile, ChannelManager chatManager) + private void load(UserProfileOverlay? profile, ChannelManager? chatManager) { Action = () => profile?.ShowUser(sender); startChatAction = () => chatManager?.OpenPrivateChannel(sender); From 04b434b8cee80b5d90a290caf766ea7e02287a06 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 8 Jun 2022 13:51:16 +0100 Subject: [PATCH 1511/2328] Update `ChatLine` timestamp and message colours --- osu.Game/Overlays/Chat/ChatLine.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index 6cd0b76a49..a6ea4307ee 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -66,6 +66,8 @@ namespace osu.Game.Overlays.Chat private bool senderHasColour => !string.IsNullOrEmpty(message.Sender.Colour); + private bool messageHasColour => Message.IsAction && senderHasColour; + [Resolved(CanBeNull = true)] private ChannelManager? chatManager { get; set; } @@ -80,7 +82,7 @@ namespace osu.Game.Overlays.Chat } [BackgroundDependencyLoader] - private void load() + private void load(OverlayColourProvider? colourProvider) { usernameColour = senderHasColour ? Color4Extensions.FromHex(message.Sender.Colour) @@ -113,6 +115,7 @@ namespace osu.Game.Overlays.Chat Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(size: TextSize * 0.75f, weight: FontWeight.SemiBold, fixedWidth: true), MaxWidth = TimestampWidth, + Colour = colourProvider?.Background1 ?? Colour4.White, }, new MessageSender(message.Sender) { @@ -128,16 +131,8 @@ namespace osu.Game.Overlays.Chat ContentFlow = new LinkFlowContainer(t => { t.Shadow = false; - - if (Message.IsAction) - { - t.Font = OsuFont.GetFont(italics: true); - - if (senderHasColour) - t.Colour = Color4Extensions.FromHex(message.Sender.Colour); - } - - t.Font = t.Font.With(size: TextSize); + t.Font = t.Font.With(size: TextSize, italics: Message.IsAction); + t.Colour = messageHasColour ? Color4Extensions.FromHex(message.Sender.Colour) : colourProvider?.Content1 ?? Colour4.White; }) { AutoSizeAxes = Axes.Y, From c2ed41d097f67659c684fa8cdb18984ff3db88b5 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 8 Jun 2022 15:10:19 +0100 Subject: [PATCH 1512/2328] Remove `CanBeNull` specification from DI attributes --- osu.Game/Overlays/Chat/ChatLine.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index a6ea4307ee..56e39f212d 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -68,7 +68,7 @@ namespace osu.Game.Overlays.Chat private bool messageHasColour => Message.IsAction && senderHasColour; - [Resolved(CanBeNull = true)] + [Resolved] private ChannelManager? chatManager { get; set; } [Resolved] @@ -258,7 +258,7 @@ namespace osu.Game.Overlays.Chat this.sender = sender; } - [BackgroundDependencyLoader(true)] + [BackgroundDependencyLoader] private void load(UserProfileOverlay? profile, ChannelManager? chatManager) { Action = () => profile?.ShowUser(sender); From bf67b35aded88dbe5a553ea480c36d04824e8fce Mon Sep 17 00:00:00 2001 From: Endrik Tombak Date: Wed, 8 Jun 2022 17:44:57 +0300 Subject: [PATCH 1513/2328] Use new own profile statistics in difficulty recommender --- .../TestSceneBeatmapRecommendations.cs | 43 +++++-------- osu.Game/Beatmaps/DifficultyRecommender.cs | 64 +++++-------------- 2 files changed, 32 insertions(+), 75 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs index 940d001c5b..a78a8aa028 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs @@ -5,12 +5,11 @@ using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Extensions; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests; -using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; using osu.Game.Rulesets.Catch; using osu.Game.Rulesets.Mania; @@ -23,38 +22,28 @@ namespace osu.Game.Tests.Visual.SongSelect { public class TestSceneBeatmapRecommendations : OsuGameTestScene { + [Resolved] + private IRulesetStore rulesetStore { get; set; } + [SetUpSteps] public override void SetUpSteps() { - AddStep("register request handling", () => - { - ((DummyAPIAccess)API).HandleRequest = req => - { - switch (req) - { - case GetUserRequest userRequest: - userRequest.TriggerSuccess(getUser(userRequest.Ruleset.OnlineID)); - return true; - } - - return false; - }; - }); - base.SetUpSteps(); - APIUser getUser(int? rulesetID) + AddStep("populate ruleset statistics", () => { - return new APIUser + Dictionary rulesetStatistics = new Dictionary(); + + rulesetStore.AvailableRulesets.Where(ruleset => ruleset.IsLegacyRuleset()).ForEach(rulesetInfo => { - Username = @"Dummy", - Id = 1001, - Statistics = new UserStatistics + rulesetStatistics[rulesetInfo.ShortName] = new UserStatistics { - PP = getNecessaryPP(rulesetID) - } - }; - } + PP = getNecessaryPP(rulesetInfo.OnlineID) + }; + }); + + API.LocalUser.Value.RulesetsStatistics = rulesetStatistics; + }); decimal getNecessaryPP(int? rulesetID) { diff --git a/osu.Game/Beatmaps/DifficultyRecommender.cs b/osu.Game/Beatmaps/DifficultyRecommender.cs index 93c2fccbc7..72f1931c86 100644 --- a/osu.Game/Beatmaps/DifficultyRecommender.cs +++ b/osu.Game/Beatmaps/DifficultyRecommender.cs @@ -7,11 +7,8 @@ using System.Linq; using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; -using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; -using osu.Game.Extensions; using osu.Game.Online.API; -using osu.Game.Online.API.Requests; using osu.Game.Rulesets; namespace osu.Game.Beatmaps @@ -25,26 +22,15 @@ namespace osu.Game.Beatmaps [Resolved] private IAPIProvider api { get; set; } - [Resolved] - private IRulesetStore rulesets { get; set; } - [Resolved] private Bindable ruleset { get; set; } - /// - /// The user for which the last requests were run. - /// - private int? requestedUserId; - - private readonly Dictionary recommendedDifficultyMapping = new Dictionary(); - - private readonly IBindable apiState = new Bindable(); + private readonly Dictionary recommendedDifficultyMapping = new Dictionary(); [BackgroundDependencyLoader] private void load() { - apiState.BindTo(api.State); - apiState.BindValueChanged(onlineStateChanged, true); + api.LocalUser.BindValueChanged(_ => populateValues(), true); } /// @@ -58,12 +44,12 @@ namespace osu.Game.Beatmaps [CanBeNull] public BeatmapInfo GetRecommendedBeatmap(IEnumerable beatmaps) { - foreach (var r in orderedRulesets) + foreach (string r in orderedRulesets) { if (!recommendedDifficultyMapping.TryGetValue(r, out double recommendation)) continue; - BeatmapInfo beatmapInfo = beatmaps.Where(b => b.Ruleset.Equals(r)).OrderBy(b => + BeatmapInfo beatmapInfo = beatmaps.Where(b => b.Ruleset.ShortName.Equals(r)).OrderBy(b => { double difference = b.StarRating - recommendation; return difference >= 0 ? difference * 2 : difference * -1; // prefer easier over harder @@ -76,55 +62,37 @@ namespace osu.Game.Beatmaps return null; } - private void fetchRecommendedValues() + private void populateValues() { - if (recommendedDifficultyMapping.Count > 0 && api.LocalUser.Value.Id == requestedUserId) + if (api.LocalUser.Value.RulesetsStatistics == null) return; - requestedUserId = api.LocalUser.Value.Id; - - // only query API for built-in rulesets - rulesets.AvailableRulesets.Where(ruleset => ruleset.IsLegacyRuleset()).ForEach(rulesetInfo => + foreach (var statistic in api.LocalUser.Value.RulesetsStatistics) { - var req = new GetUserRequest(api.LocalUser.Value.Id, rulesetInfo); - - req.Success += result => - { - // algorithm taken from https://github.com/ppy/osu-web/blob/e6e2825516449e3d0f3f5e1852c6bdd3428c3437/app/Models/User.php#L1505 - recommendedDifficultyMapping[rulesetInfo] = Math.Pow((double)(result.Statistics.PP ?? 0), 0.4) * 0.195; - }; - - api.Queue(req); - }); + decimal? pp = api.LocalUser.Value.RulesetsStatistics[statistic.Key].PP; + // algorithm taken from https://github.com/ppy/osu-web/blob/e6e2825516449e3d0f3f5e1852c6bdd3428c3437/app/Models/User.php#L1505 + double recommended = Math.Pow((double)(pp ?? 0), 0.4) * 0.195; + recommendedDifficultyMapping[statistic.Key] = recommended; + } } /// /// Rulesets ordered descending by their respective recommended difficulties. /// The currently selected ruleset will always be first. /// - private IEnumerable orderedRulesets + private IEnumerable orderedRulesets { get { if (LoadState < LoadState.Ready || ruleset.Value == null) - return Enumerable.Empty(); + return Enumerable.Empty(); return recommendedDifficultyMapping .OrderByDescending(pair => pair.Value) .Select(pair => pair.Key) - .Where(r => !r.Equals(ruleset.Value)) - .Prepend(ruleset.Value); + .Where(r => !r.Equals(ruleset.Value.ShortName)) + .Prepend(ruleset.Value.ShortName); } } - - private void onlineStateChanged(ValueChangedEvent state) => Schedule(() => - { - switch (state.NewValue) - { - case APIState.Online: - fetchRecommendedValues(); - break; - } - }); } } From eb33922417f451914a57d763b4a304a501309e63 Mon Sep 17 00:00:00 2001 From: tornac1234 Date: Wed, 8 Jun 2022 18:13:08 +0200 Subject: [PATCH 1514/2328] Revert "Added user RulesetsStatistics fetching when connecting" This reverts commit e2cdc66f6d378c20511c3be2fe724aa0f68a3eca. --- osu.Game/Online/API/APIAccess.cs | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index f59bee1065..62ddd49881 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -171,32 +171,12 @@ namespace osu.Game.Online.API }; userReq.Success += u => { + localUser.Value = u; + // todo: save/pull from settings - u.Status.Value = new UserStatusOnline(); + localUser.Value.Status.Value = new UserStatusOnline(); failureCount = 0; - - // getting user's full statistics (concerning every ruleset) - // we delay the localUser.Value setting because BindValueChanged won't record two value changes in a row - var statsRequest = new GetUsersRequest(new int[] { u.Id }); - statsRequest.Failure += _ => - { - localUser.Value = u; - failConnectionProcess(); - }; - statsRequest.Success += result => - { - if (result.Users.Count == 1) - { - u.RulesetsStatistics = result.Users[0].RulesetsStatistics; - localUser.Value = u; - return; - } - // Should never... happen ? - statsRequest.Fail(new Exception("Empty response for GetUsersRequest")); - }; - - handleRequest(statsRequest); }; if (!handleRequest(userReq)) From c90b2858619e6a03d58e192a8912de64646b827d Mon Sep 17 00:00:00 2001 From: Endrik Tombak Date: Wed, 8 Jun 2022 21:10:27 +0300 Subject: [PATCH 1515/2328] Change variable name and inline it --- osu.Game/Beatmaps/DifficultyRecommender.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/DifficultyRecommender.cs b/osu.Game/Beatmaps/DifficultyRecommender.cs index 72f1931c86..4629b20569 100644 --- a/osu.Game/Beatmaps/DifficultyRecommender.cs +++ b/osu.Game/Beatmaps/DifficultyRecommender.cs @@ -67,12 +67,10 @@ namespace osu.Game.Beatmaps if (api.LocalUser.Value.RulesetsStatistics == null) return; - foreach (var statistic in api.LocalUser.Value.RulesetsStatistics) + foreach (var kvp in api.LocalUser.Value.RulesetsStatistics) { - decimal? pp = api.LocalUser.Value.RulesetsStatistics[statistic.Key].PP; // algorithm taken from https://github.com/ppy/osu-web/blob/e6e2825516449e3d0f3f5e1852c6bdd3428c3437/app/Models/User.php#L1505 - double recommended = Math.Pow((double)(pp ?? 0), 0.4) * 0.195; - recommendedDifficultyMapping[statistic.Key] = recommended; + recommendedDifficultyMapping[kvp.Key] = Math.Pow((double)(kvp.Value.PP ?? 0), 0.4) * 0.195; } } From c6264d5b3d5487fac84f94eb8d915e83af20cd68 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Wed, 8 Jun 2022 11:57:20 -0700 Subject: [PATCH 1516/2328] Split beatmap set overlay tests to online and offline --- .../Online/TestSceneBeatmapSetOverlay.cs | 9 ------- .../TestSceneOnlineBeatmapSetOverlay.cs | 26 +++++++++++++++++++ 2 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 osu.Game.Tests/Visual/Online/TestSceneOnlineBeatmapSetOverlay.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index 9d206af40e..417296a1a1 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -18,13 +18,10 @@ using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tests.Visual.Online { - [TestFixture] public class TestSceneBeatmapSetOverlay : OsuTestScene { private readonly TestBeatmapSetOverlay overlay; - protected override bool UseOnlineAPI => true; - private int nextBeatmapSetId = 1; public TestSceneBeatmapSetOverlay() @@ -41,12 +38,6 @@ namespace osu.Game.Tests.Visual.Online AddStep(@"show loading", () => overlay.ShowBeatmapSet(null)); } - [Test] - public void TestOnline() - { - AddStep(@"show online", () => overlay.FetchAndShowBeatmapSet(55)); - } - [Test] public void TestLocalBeatmaps() { diff --git a/osu.Game.Tests/Visual/Online/TestSceneOnlineBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneOnlineBeatmapSetOverlay.cs new file mode 100644 index 0000000000..4e88570ca0 --- /dev/null +++ b/osu.Game.Tests/Visual/Online/TestSceneOnlineBeatmapSetOverlay.cs @@ -0,0 +1,26 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Game.Overlays; + +namespace osu.Game.Tests.Visual.Online +{ + public class TestSceneOnlineBeatmapSetOverlay : OsuTestScene + { + private readonly BeatmapSetOverlay overlay; + + protected override bool UseOnlineAPI => true; + + public TestSceneOnlineBeatmapSetOverlay() + { + Add(overlay = new BeatmapSetOverlay()); + } + + [Test] + public void TestOnline() + { + AddStep(@"show online", () => overlay.FetchAndShowBeatmapSet(55)); + } + } +} From 5c138de446f2fc157a21d977c774d47ab4e0a9b1 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Wed, 8 Jun 2022 12:10:02 -0700 Subject: [PATCH 1517/2328] Add failing mod selector visibility test --- osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index 417296a1a1..c933e1a54e 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -98,6 +98,7 @@ namespace osu.Game.Tests.Visual.Online AddAssert("status is loved", () => overlay.ChildrenOfType().Single().Status == BeatmapOnlineStatus.Loved); AddAssert("scores container is visible", () => overlay.ChildrenOfType().Single().Alpha == 1); + AddAssert("mod selector is visible", () => overlay.ChildrenOfType().Single().Alpha == 1); AddStep("go to second beatmap", () => overlay.ChildrenOfType().ElementAt(1).TriggerClick()); From f3371e8bc8bd4065c4115ff8ae6200ebbf9869ae Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Sun, 29 May 2022 21:13:53 -0700 Subject: [PATCH 1518/2328] Always show mod selector on beatmap info leaderboards regardless of supporter --- osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index 5f24a6549d..ebfb8f124b 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -242,8 +242,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores modSelector.DeselectAll(); else getScores(); - - modSelector.FadeTo(userIsSupporter ? 1 : 0); } private void getScores() @@ -260,7 +258,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores return; } - if (scope.Value != BeatmapLeaderboardScope.Global && !userIsSupporter) + if ((scope.Value != BeatmapLeaderboardScope.Global || modSelector.SelectedMods.Count > 0) && !userIsSupporter) { Scores = null; notSupporterPlaceholder.Show(); From 3799689c7dd6ac73560f8f24a483b3734a6505e2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 9 Jun 2022 12:32:30 +0900 Subject: [PATCH 1519/2328] Tidy up variable naming and layout --- osu.Desktop/DiscordRichPresence.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index 0d276d963f..bc5763a3b4 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -31,7 +31,7 @@ namespace osu.Desktop private IBindable user; [Resolved] - private IAPIProvider provider { get; set; } + private IAPIProvider api { get; set; } private readonly IBindable status = new Bindable(); private readonly IBindable activity = new Bindable(); @@ -60,7 +60,8 @@ namespace osu.Desktop config.BindWith(OsuSetting.DiscordRichPresence, privacyMode); - (user = provider.LocalUser.GetBoundCopy()).BindValueChanged(u => + user = api.LocalUser.GetBoundCopy(); + user.BindValueChanged(u => { status.UnbindBindings(); status.BindTo(u.NewValue.Status); From bfde334e77f4c297618e161d02654405521279f4 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 9 Jun 2022 14:03:21 +0900 Subject: [PATCH 1520/2328] Allow beatmaps to load endlessly when entering Player --- osu.Game/Screens/Play/Player.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index dfc0fa1d1d..8151bb452e 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -4,6 +4,7 @@ using System; using System.IO; using System.Linq; +using System.Threading; using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -181,7 +182,7 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader(true)] - private void load(AudioManager audio, OsuConfigManager config, OsuGameBase game) + private void load(AudioManager audio, OsuConfigManager config, OsuGameBase game, CancellationToken cancellationToken) { var gameplayMods = Mods.Value.Select(m => m.DeepClone()).ToArray(); @@ -194,7 +195,7 @@ namespace osu.Game.Screens.Play if (Beatmap.Value is DummyWorkingBeatmap) return; - IBeatmap playableBeatmap = loadPlayableBeatmap(gameplayMods); + IBeatmap playableBeatmap = loadPlayableBeatmap(gameplayMods, cancellationToken); if (playableBeatmap == null) return; @@ -483,7 +484,7 @@ namespace osu.Game.Screens.Play } } - private IBeatmap loadPlayableBeatmap(Mod[] gameplayMods) + private IBeatmap loadPlayableBeatmap(Mod[] gameplayMods, CancellationToken cancellationToken) { IBeatmap playable; @@ -500,7 +501,7 @@ namespace osu.Game.Screens.Play try { - playable = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo, gameplayMods); + playable = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo, gameplayMods, cancellationToken); } catch (BeatmapInvalidForRulesetException) { @@ -508,7 +509,7 @@ namespace osu.Game.Screens.Play rulesetInfo = Beatmap.Value.BeatmapInfo.Ruleset; ruleset = rulesetInfo.CreateInstance(); - playable = Beatmap.Value.GetPlayableBeatmap(rulesetInfo, gameplayMods); + playable = Beatmap.Value.GetPlayableBeatmap(rulesetInfo, gameplayMods, cancellationToken); } if (playable.HitObjects.Count == 0) From ec03dc16db09e501fb2c73ab031c32c98faa4e40 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 9 Jun 2022 14:13:13 +0900 Subject: [PATCH 1521/2328] Don't trigger notification when user quit --- osu.Game/Screens/Play/Player.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 8151bb452e..5548203fe2 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -520,7 +520,8 @@ namespace osu.Game.Screens.Play } catch (Exception e) { - Logger.Error(e, "Could not load beatmap successfully!"); + if (this.IsCurrentScreen()) + Logger.Error(e, "Could not load beatmap successfully!"); //couldn't load, hard abort! return null; } From 6e450b7350ccc570509f343112883b6d473b4ca6 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 9 Jun 2022 14:35:52 +0900 Subject: [PATCH 1522/2328] Explicitly handle operation cancelled exceptions --- osu.Game/Screens/Play/Player.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 5548203fe2..d6f6a06eb7 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -518,10 +518,14 @@ namespace osu.Game.Screens.Play return null; } } + catch (OperationCanceledException) + { + // Load has been cancelled. No logging is required. + return null; + } catch (Exception e) { - if (this.IsCurrentScreen()) - Logger.Error(e, "Could not load beatmap successfully!"); + Logger.Error(e, "Could not load beatmap successfully!"); //couldn't load, hard abort! return null; } From 6d2a2ba7d6fcb5e22397f13d9755453a3e3678da Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 9 Jun 2022 18:49:11 +0900 Subject: [PATCH 1523/2328] Rename Position -> Index --- .../Preprocessing/CatchDifficultyHitObject.cs | 4 ++-- .../Preprocessing/ManiaDifficultyHitObject.cs | 4 ++-- .../Preprocessing/OsuDifficultyHitObject.cs | 4 ++-- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 2 +- .../Difficulty/Skills/Flashlight.cs | 2 +- osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs | 4 ++-- .../Preprocessing/TaikoDifficultyHitObject.cs | 6 +++--- .../Difficulty/Skills/Rhythm.cs | 2 +- .../Preprocessing/DifficultyHitObject.cs | 14 +++++++------- osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs index 8c229cf6c5..3bcfce3a56 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs @@ -25,8 +25,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing /// public readonly double StrainTime; - public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth, List objects, int position) - : base(hitObject, lastObject, clockRate, objects, position) + public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth, List objects, int index) + : base(hitObject, lastObject, clockRate, objects, index) { // We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps. float scalingFactor = normalized_hitobject_radius / halfCatcherWidth; diff --git a/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs b/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs index 5c9b3b9b54..1c4204145b 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs @@ -12,8 +12,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Preprocessing { public new ManiaHitObject BaseObject => (ManiaHitObject)base.BaseObject; - public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int position) - : base(hitObject, lastObject, clockRate, objects, position) + public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int index) + : base(hitObject, lastObject, clockRate, objects, index) { } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 0400dd0db1..989d407bd0 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -75,8 +75,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing private readonly OsuHitObject lastLastObject; private readonly OsuHitObject lastObject; - public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int position) - : base(hitObject, lastObject, clockRate, objects, position) + public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int index) + : base(hitObject, lastObject, clockRate, objects, index) { lastLastObject = (OsuHitObject)Previous(1)?.BaseObject; this.lastObject = (OsuHitObject)lastObject; diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index e3ec997740..7e0b9b572b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private double strainValueOf(DifficultyHitObject current) { - if (current.BaseObject is Spinner || current.Position <= 1 || current.Previous(0).BaseObject is Spinner) + if (current.BaseObject is Spinner || current.Index <= 1 || current.Previous(0).BaseObject is Spinner) return 0; var osuCurrObj = (OsuDifficultyHitObject)current; diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 75796a5993..cf0a7d3359 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills OsuDifficultyHitObject lastObj = osuCurrent; // This is iterating backwards in time from the current object. - for (int i = 0; i < Math.Min(current.Position, 10); i++) + for (int i = 0; i < Math.Min(current.Index, 10); i++) { var currentObj = (OsuDifficultyHitObject)current.Previous(i); var currentHitObject = (OsuHitObject)(currentObj.BaseObject); diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index f8905664f4..232c9526bc 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills bool firstDeltaSwitch = false; - int historicalNoteCount = Math.Min(current.Position, 32); + int historicalNoteCount = Math.Min(current.Index, 32); int rhythmStart = 0; @@ -136,7 +136,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills // derive strainTime for calculation var osuCurrObj = (OsuDifficultyHitObject)current; - var osuPrevObj = current.Position > 0 ? (OsuDifficultyHitObject)current.Previous(0) : null; + var osuPrevObj = current.Index > 0 ? (OsuDifficultyHitObject)current.Previous(0) : null; double strainTime = osuCurrObj.StrainTime; double greatWindowFull = greatWindow * 2; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs index 450eb63636..d9049c45ea 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs @@ -39,9 +39,9 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing /// The gameplay preceding . /// The rate of the gameplay clock. Modified by speed-changing mods. /// The list of s in the current beatmap. - /// /// The position of this in the list. - public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, List objects, int position) - : base(hitObject, lastObject, clockRate, objects, position) + /// /// The position of this in the list. + public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, List objects, int index) + : base(hitObject, lastObject, clockRate, objects, index) { var currentHit = hitObject as Hit; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs index 9150b6980b..46b24af903 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs @@ -106,7 +106,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills if (!samePattern(start, mostRecentPatternsToCompare)) continue; - int notesSince = hitObject.Position - rhythmHistory[start].Position; + int notesSince = hitObject.Index - rhythmHistory[start].Index; penalty *= repetitionPenalty(notesSince); break; } diff --git a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs index a886a0d992..5a2a40e241 100644 --- a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs +++ b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs @@ -15,9 +15,9 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing private readonly IReadOnlyList difficultyHitObjects; /// - /// The position of this in the list. + /// The index of this in the list of all s. /// - public int Position; + public int Index; /// /// The this wraps. @@ -51,11 +51,11 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing /// The last which occurs before in the beatmap. /// The rate at which the gameplay clock is run at. /// The list of s in the current beatmap. - /// The position of this in the list. - public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int position) + /// The index of this in list. + public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int index) { difficultyHitObjects = objects; - Position = position; + Index = index; BaseObject = hitObject; LastObject = lastObject; DeltaTime = (hitObject.StartTime - lastObject.StartTime) / clockRate; @@ -63,8 +63,8 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing EndTime = hitObject.GetEndTime() / clockRate; } - public DifficultyHitObject Previous(int backwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Position - (backwardsIndex + 1)); + public DifficultyHitObject Previous(int backwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Index - (backwardsIndex + 1)); - public DifficultyHitObject Next(int forwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Position + (forwardsIndex + 1)); + public DifficultyHitObject Next(int forwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Index + (forwardsIndex + 1)); } } diff --git a/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs b/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs index 6be10db8b3..0b327046b3 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs @@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Difficulty.Skills public sealed override void Process(DifficultyHitObject current) { // The first object doesn't generate a strain, so we begin with an incremented section end - if (current.Position == 0) + if (current.Index == 0) currentSectionEnd = Math.Ceiling(current.StartTime / SectionLength) * SectionLength; while (current.StartTime > currentSectionEnd) From 70ebfbcf5e9372658a500a8d861dfa5bc22f7e81 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 9 Jun 2022 19:26:24 +0900 Subject: [PATCH 1524/2328] Add recommendation text and adjust weightings to read better --- .../Screens/Utility/LatencyCertifierScreen.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 568e477d8f..2fb673c537 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -213,16 +213,16 @@ Do whatever you need to try and perceive the difference in latency, then choose if (!isPass && difficultyLevel > 1) { - statusText.AddParagraph("To complete certification, decrease the difficulty level until you can get 20 tests correct in a row!", cp => cp.Font = OsuFont.Default.With(size: 24)); + statusText.AddParagraph("To complete certification, decrease the difficulty level until you can get 20 tests correct in a row!", cp => cp.Font = OsuFont.Default.With(size: 24, weight: FontWeight.SemiBold)); statusText.AddParagraph(string.Empty); } - statusText.AddParagraph($"Polling: {pollingMax} hz Monitor: {displayMode?.RefreshRate ?? 0:N0} hz Exclusive: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15)); + statusText.AddParagraph($"Polling: {pollingMax} hz Monitor: {displayMode?.RefreshRate ?? 0:N0} hz Exclusive: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15, weight: FontWeight.SemiBold)); statusText.AddParagraph($"Input: {host.InputThread.Clock.FramesPerSecond} hz " + $"Update: {host.UpdateThread.Clock.FramesPerSecond} hz " + $"Draw: {host.DrawThread.Clock.FramesPerSecond} hz" - , cp => cp.Font = OsuFont.Default.With(size: 15)); + , cp => cp.Font = OsuFont.Default.With(size: 15, weight: FontWeight.SemiBold)); int certificationRemaining = !isPass ? rounds_to_complete_certified : rounds_to_complete_certified - correctCount; @@ -247,11 +247,20 @@ Do whatever you need to try and perceive the difference in latency, then choose }).WithEffect(new GlowEffect { Colour = overlayColourProvider.Colour1, + PadExtent = true }).With(e => { e.Anchor = Anchor.Centre; e.Origin = Anchor.Centre; - }) + }), + new OsuSpriteText + { + Text = $"You should use a frame limiter with update rate of {mapDifficultyToTargetFrameRate(difficultyLevel + 1)} hz (or fps) for best results!", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold), + Y = 80, + } }); background.FadeInFromZero(1000, Easing.OutQuint); From 6e883a69d9e98947053646d6f166afe0bf4a277a Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Thu, 9 Jun 2022 18:07:37 -0400 Subject: [PATCH 1525/2328] revert slider radius parameter addition --- osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs | 2 +- .../OsuHitObjectGenerationUtils_Reposition.cs | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs index 95242808af..3261076084 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs @@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Mods if (WorkingHitObject.HitObject is Slider slider) { - var possibleMovementBounds = OsuHitObjectGenerationUtils.CalculatePossibleMovementBounds(slider, false); + var possibleMovementBounds = OsuHitObjectGenerationUtils.CalculatePossibleMovementBounds(slider); x = possibleMovementBounds.Width < 0 ? x diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs index 765477fba2..5e11ede91f 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs @@ -213,12 +213,11 @@ namespace osu.Game.Rulesets.Osu.Utils /// such that the entire slider is inside the playfield. /// /// The for which to calculate a movement bounding box. - /// Whether the movement bounding box should account for the slider's follow circle. Defaults to true. /// A which contains all of the possible movements of the slider such that the entire slider is inside the playfield. /// /// If the slider is larger than the playfield, the returned may have negative width/height. /// - public static RectangleF CalculatePossibleMovementBounds(Slider slider, bool accountForFollowCircleRadius = true) + public static RectangleF CalculatePossibleMovementBounds(Slider slider) { var pathPositions = new List(); slider.Path.GetPathToProgress(pathPositions, 0, 1); @@ -239,17 +238,14 @@ namespace osu.Game.Rulesets.Osu.Utils maxY = MathF.Max(maxY, pos.Y); } - if (accountForFollowCircleRadius) - { - // Take the circle radius into account. - float radius = (float)slider.Radius; + // Take the circle radius into account. + float radius = (float)slider.Radius; - minX -= radius; - minY -= radius; + minX -= radius; + minY -= radius; - maxX += radius; - maxY += radius; - } + maxX += radius; + maxY += radius; // Given the bounding box of the slider (via min/max X/Y), // the amount that the slider can move to the left is minX (with the sign flipped, since positive X is to the right), From 4e01db03bb3a6002590dac58e04005cf9c528193 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Thu, 9 Jun 2022 18:25:04 -0400 Subject: [PATCH 1526/2328] don't specify icon --- osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs index 3261076084..da6686d314 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs @@ -4,7 +4,6 @@ using System; using System.Linq; using osu.Framework.Bindables; -using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; using osu.Game.Rulesets.Osu.Utils; using osu.Game.Rulesets.Osu.Objects; @@ -17,7 +16,6 @@ namespace osu.Game.Rulesets.Osu.Mods { public override string Name => "Repel"; public override string Acronym => "RP"; - public override IconUsage? Icon => FontAwesome.Solid.ExpandArrowsAlt; public override string Description => "Run away!"; public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModMagnetised)).ToArray(); From 569c39942a5b74ae51847c64e0f230f8973ec994 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Thu, 9 Jun 2022 18:26:18 -0400 Subject: [PATCH 1527/2328] replace easement with easing --- .../Mods/TestSceneOsuModMagnetised.cs | 2 +- osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs | 6 +++--- osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs index 29ec91cda8..bab47fa851 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods { Mod = new OsuModMagnetised { - EasementStrength = { Value = strength }, + EasingStrength = { Value = strength }, }, PassCondition = () => true, Autoplay = false, diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs index bdd4ed7fb9..0462f60991 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods { Mod = new OsuModRepel { - EasementStrength = { Value = strength }, + EasingStrength = { Value = strength }, }, PassCondition = () => true, Autoplay = false, diff --git a/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs index e93863fa96..0ba3a204f9 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs @@ -20,8 +20,8 @@ namespace osu.Game.Rulesets.Osu.Mods public override double ScoreMultiplier => 1; public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay) }; - public abstract BindableFloat EasementStrength { get; } - protected virtual float EasementStrengthMultiplier => 1.0f; + public abstract BindableFloat EasingStrength { get; } + protected virtual float EasingStrengthMultiplier => 1.0f; protected Vector2 CursorPosition; protected DrawableHitObject WorkingHitObject; protected abstract Vector2 DestinationVector { get; } @@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Osu.Mods private void easeHitObjectPositionToVector(DrawableHitObject hitObject, Vector2 destination) { - double dampLength = Interpolation.Lerp(3000, 40, EasementStrength.Value * EasementStrengthMultiplier); + double dampLength = Interpolation.Lerp(3000, 40, EasingStrength.Value * EasingStrengthMultiplier); float x = (float)Interpolation.DampContinuously(hitObject.X, destination.X, dampLength, gameplayClock.ElapsedFrameTime); float y = (float)Interpolation.DampContinuously(hitObject.Y, destination.Y, dampLength, gameplayClock.ElapsedFrameTime); diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs b/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs index 1c10d61c99..b8c976cf9f 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Mods protected override Vector2 DestinationVector => CursorPosition; [SettingSource("Attraction strength", "How strong the pull is.", 0)] - public override BindableFloat EasementStrength { get; } = new BindableFloat(0.5f) + public override BindableFloat EasingStrength { get; } = new BindableFloat(0.5f) { Precision = 0.05f, MinValue = 0.05f, diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs index da6686d314..1622400eac 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs @@ -20,14 +20,14 @@ namespace osu.Game.Rulesets.Osu.Mods public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModMagnetised)).ToArray(); [SettingSource("Repulsion strength", "How strong the repulsion is.", 0)] - public override BindableFloat EasementStrength { get; } = new BindableFloat(0.6f) + public override BindableFloat EasingStrength { get; } = new BindableFloat(0.6f) { Precision = 0.05f, MinValue = 0.05f, MaxValue = 1.0f, }; - protected override float EasementStrengthMultiplier => 0.8f; + protected override float EasingStrengthMultiplier => 0.8f; protected override Vector2 DestinationVector { From 2fe34f188f4c6d4294cd98f2f4d18a921f5949a1 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Thu, 9 Jun 2022 18:52:10 -0400 Subject: [PATCH 1528/2328] shamelessly copy osumodmagnetised --- .../Mods/TestSceneOsuModMagnetised.cs | 2 +- .../Mods/TestSceneOsuModRepel.cs | 2 +- .../Mods/OsuEaseHitObjectPositionsMod.cs | 77 ------------------- .../Mods/OsuModMagnetised.cs | 62 +++++++++++++-- osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs | 74 ++++++++++++++---- 5 files changed, 118 insertions(+), 99 deletions(-) delete mode 100644 osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs index bab47fa851..9b49e60363 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods { Mod = new OsuModMagnetised { - EasingStrength = { Value = strength }, + AttractionStrength = { Value = strength }, }, PassCondition = () => true, Autoplay = false, diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs index 0462f60991..6bd41e2fa5 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModRepel.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods { Mod = new OsuModRepel { - EasingStrength = { Value = strength }, + RepulsionStrength = { Value = strength }, }, PassCondition = () => true, Autoplay = false, diff --git a/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs deleted file mode 100644 index 0ba3a204f9..0000000000 --- a/osu.Game.Rulesets.Osu/Mods/OsuEaseHitObjectPositionsMod.cs +++ /dev/null @@ -1,77 +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 System; -using osu.Framework.Bindables; -using osu.Framework.Utils; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects; -using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.Osu.UI; -using osu.Game.Rulesets.UI; -using osuTK; - -namespace osu.Game.Rulesets.Osu.Mods -{ - public abstract class OsuEaseHitObjectPositionsMod : Mod, IUpdatableByPlayfield, IApplicableToDrawableRuleset - { - public override ModType Type => ModType.Fun; - public override double ScoreMultiplier => 1; - public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay) }; - - public abstract BindableFloat EasingStrength { get; } - protected virtual float EasingStrengthMultiplier => 1.0f; - protected Vector2 CursorPosition; - protected DrawableHitObject WorkingHitObject; - protected abstract Vector2 DestinationVector { get; } - - private IFrameStableClock gameplayClock; - - public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) - { - gameplayClock = drawableRuleset.FrameStableClock; - - // Hide judgment displays and follow points as they won't make any sense. - // Judgements can potentially be turned on in a future where they display at a position relative to their drawable counterpart. - drawableRuleset.Playfield.DisplayJudgements.Value = false; - (drawableRuleset.Playfield as OsuPlayfield)?.FollowPoints.Hide(); - } - - public void Update(Playfield playfield) - { - CursorPosition = playfield.Cursor.ActiveCursor.DrawPosition; - - foreach (var drawable in playfield.HitObjectContainer.AliveObjects) - { - WorkingHitObject = drawable; - - switch (drawable) - { - case DrawableHitCircle circle: - easeHitObjectPositionToVector(circle, DestinationVector); - break; - - case DrawableSlider slider: - - if (!slider.HeadCircle.Result.HasResult) - easeHitObjectPositionToVector(slider, DestinationVector); - else - easeHitObjectPositionToVector(slider, DestinationVector - slider.Ball.DrawPosition); - - break; - } - } - } - - private void easeHitObjectPositionToVector(DrawableHitObject hitObject, Vector2 destination) - { - double dampLength = Interpolation.Lerp(3000, 40, EasingStrength.Value * EasingStrengthMultiplier); - - float x = (float)Interpolation.DampContinuously(hitObject.X, destination.X, dampLength, gameplayClock.ElapsedFrameTime); - float y = (float)Interpolation.DampContinuously(hitObject.Y, destination.Y, dampLength, gameplayClock.ElapsedFrameTime); - - hitObject.Position = new Vector2(x, y); - } - } -} diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs b/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs index b8c976cf9f..97a573f1b4 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs @@ -2,30 +2,82 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; +using osu.Framework.Utils; using osu.Game.Configuration; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Rulesets.Osu.UI; +using osu.Game.Rulesets.UI; using osuTK; namespace osu.Game.Rulesets.Osu.Mods { - internal class OsuModMagnetised : OsuEaseHitObjectPositionsMod + internal class OsuModMagnetised : Mod, IUpdatableByPlayfield, IApplicableToDrawableRuleset { public override string Name => "Magnetised"; public override string Acronym => "MG"; public override IconUsage? Icon => FontAwesome.Solid.Magnet; + public override ModType Type => ModType.Fun; public override string Description => "No need to chase the circles – your cursor is a magnet!"; - public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModRelax), typeof(OsuModRepel) }).ToArray(); + public override double ScoreMultiplier => 1; + public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay), typeof(OsuModRelax), typeof(OsuModRepel) }; - protected override Vector2 DestinationVector => CursorPosition; + private IFrameStableClock gameplayClock; [SettingSource("Attraction strength", "How strong the pull is.", 0)] - public override BindableFloat EasingStrength { get; } = new BindableFloat(0.5f) + public BindableFloat AttractionStrength { get; } = new BindableFloat(0.5f) { Precision = 0.05f, MinValue = 0.05f, MaxValue = 1.0f, }; + + public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) + { + gameplayClock = drawableRuleset.FrameStableClock; + + // Hide judgment displays and follow points as they won't make any sense. + // Judgements can potentially be turned on in a future where they display at a position relative to their drawable counterpart. + drawableRuleset.Playfield.DisplayJudgements.Value = false; + (drawableRuleset.Playfield as OsuPlayfield)?.FollowPoints.Hide(); + } + + public void Update(Playfield playfield) + { + var cursorPos = playfield.Cursor.ActiveCursor.DrawPosition; + + foreach (var drawable in playfield.HitObjectContainer.AliveObjects) + { + switch (drawable) + { + case DrawableHitCircle circle: + easeTo(circle, cursorPos); + break; + + case DrawableSlider slider: + + if (!slider.HeadCircle.Result.HasResult) + easeTo(slider, cursorPos); + else + easeTo(slider, cursorPos - slider.Ball.DrawPosition); + + break; + } + } + } + + private void easeTo(DrawableHitObject hitObject, Vector2 destination) + { + double dampLength = Interpolation.Lerp(3000, 40, AttractionStrength.Value); + + float x = (float)Interpolation.DampContinuously(hitObject.X, destination.X, dampLength, gameplayClock.ElapsedFrameTime); + float y = (float)Interpolation.DampContinuously(hitObject.Y, destination.Y, dampLength, gameplayClock.ElapsedFrameTime); + + hitObject.Position = new Vector2(x, y); + } } } diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs index 1622400eac..807be997db 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs @@ -2,43 +2,61 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Linq; using osu.Framework.Bindables; +using osu.Framework.Utils; using osu.Game.Configuration; -using osu.Game.Rulesets.Osu.Utils; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.UI; +using osu.Game.Rulesets.Osu.Utils; +using osu.Game.Rulesets.UI; using osuTK; namespace osu.Game.Rulesets.Osu.Mods { - internal class OsuModRepel : OsuEaseHitObjectPositionsMod + internal class OsuModRepel : Mod, IUpdatableByPlayfield, IApplicableToDrawableRuleset { public override string Name => "Repel"; public override string Acronym => "RP"; + public override ModType Type => ModType.Fun; public override string Description => "Run away!"; - public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModMagnetised)).ToArray(); + public override double ScoreMultiplier => 1; + public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay), typeof(OsuModMagnetised) }; + + private IFrameStableClock gameplayClock; [SettingSource("Repulsion strength", "How strong the repulsion is.", 0)] - public override BindableFloat EasingStrength { get; } = new BindableFloat(0.6f) + public BindableFloat RepulsionStrength { get; } = new BindableFloat(0.6f) { Precision = 0.05f, MinValue = 0.05f, MaxValue = 1.0f, }; - protected override float EasingStrengthMultiplier => 0.8f; - - protected override Vector2 DestinationVector + public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) { - get - { - float x = Math.Clamp(2 * WorkingHitObject.X - CursorPosition.X, 0, OsuPlayfield.BASE_SIZE.X); - float y = Math.Clamp(2 * WorkingHitObject.Y - CursorPosition.Y, 0, OsuPlayfield.BASE_SIZE.Y); + gameplayClock = drawableRuleset.FrameStableClock; - if (WorkingHitObject.HitObject is Slider slider) + // Hide judgment displays and follow points as they won't make any sense. + // Judgements can potentially be turned on in a future where they display at a position relative to their drawable counterpart. + drawableRuleset.Playfield.DisplayJudgements.Value = false; + (drawableRuleset.Playfield as OsuPlayfield)?.FollowPoints.Hide(); + } + + public void Update(Playfield playfield) + { + var cursorPos = playfield.Cursor.ActiveCursor.DrawPosition; + + foreach (var drawable in playfield.HitObjectContainer.AliveObjects) + { + float x = Math.Clamp(2 * drawable.X - cursorPos.X, 0, OsuPlayfield.BASE_SIZE.X); + float y = Math.Clamp(2 * drawable.Y - cursorPos.Y, 0, OsuPlayfield.BASE_SIZE.Y); + + if (drawable.HitObject is Slider thisSlider) { - var possibleMovementBounds = OsuHitObjectGenerationUtils.CalculatePossibleMovementBounds(slider); + var possibleMovementBounds = OsuHitObjectGenerationUtils.CalculatePossibleMovementBounds(thisSlider); x = possibleMovementBounds.Width < 0 ? x @@ -49,8 +67,34 @@ namespace osu.Game.Rulesets.Osu.Mods : Math.Clamp(y, possibleMovementBounds.Top, possibleMovementBounds.Bottom); } - return new Vector2(x, y); + var destination = new Vector2(x, y); + + switch (drawable) + { + case DrawableHitCircle circle: + easeTo(circle, destination); + break; + + case DrawableSlider slider: + + if (!slider.HeadCircle.Result.HasResult) + easeTo(slider, destination); + else + easeTo(slider, destination - slider.Ball.DrawPosition); + + break; + } } } + + private void easeTo(DrawableHitObject hitObject, Vector2 destination) + { + double dampLength = Interpolation.Lerp(3000, 40, 0.8 * RepulsionStrength.Value); + + float x = (float)Interpolation.DampContinuously(hitObject.X, destination.X, dampLength, gameplayClock.ElapsedFrameTime); + float y = (float)Interpolation.DampContinuously(hitObject.Y, destination.Y, dampLength, gameplayClock.ElapsedFrameTime); + + hitObject.Position = new Vector2(x, y); + } } } From 3b229624dd2c257b7ccbc85d9b057eb3938a7ed3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 14:02:58 +0900 Subject: [PATCH 1529/2328] Simplify contains check to use LINQ the whole way --- osu.Game/Overlays/Music/Playlist.cs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/osu.Game/Overlays/Music/Playlist.cs b/osu.Game/Overlays/Music/Playlist.cs index 1d8163b57b..9d31af256f 100644 --- a/osu.Game/Overlays/Music/Playlist.cs +++ b/osu.Game/Overlays/Music/Playlist.cs @@ -35,20 +35,8 @@ namespace osu.Game.Overlays.Music item.InSelectedCollection = true; else { - var beatmapHashes = item.Model.Value.Beatmaps.Select(b => b.MD5Hash); - - bool contained = false; - - foreach (string hash in beatmapHashes) - { - if (criteria.Collection?.Beatmaps.Contains(hash) == true) - { - contained = true; - break; - } - } - - item.InSelectedCollection = contained; + item.InSelectedCollection = item.Model.Value.Beatmaps.Select(b => b.MD5Hash) + .Any(criteria.Collection.Beatmaps.Contains); } } From 4a5e86e451733c7b0fe9fdf7622f0392905be4fb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 14:03:51 +0900 Subject: [PATCH 1530/2328] Rename `Beatmaps` to `BeatmapHashes` for clarity --- .../Collections/IO/ImportCollectionsTest.cs | 16 ++++++++-------- .../TestSceneManageCollectionsDialog.cs | 6 +++--- .../Visual/SongSelect/TestSceneFilterControl.cs | 8 ++++---- osu.Game/Collections/BeatmapCollection.cs | 4 ++-- osu.Game/Collections/CollectionFilterDropdown.cs | 6 +++--- osu.Game/Collections/CollectionManager.cs | 10 +++++----- osu.Game/Collections/DeleteCollectionDialog.cs | 2 +- .../Collections/DrawableCollectionListItem.cs | 2 +- osu.Game/Overlays/Music/Playlist.cs | 2 +- .../Screens/Select/Carousel/CarouselBeatmap.cs | 2 +- .../Select/Carousel/DrawableCarouselBeatmap.cs | 6 +++--- .../Carousel/DrawableCarouselBeatmapSet.cs | 8 ++++---- 12 files changed, 36 insertions(+), 36 deletions(-) diff --git a/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs b/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs index 73152c33d9..41bc075803 100644 --- a/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs +++ b/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs @@ -55,10 +55,10 @@ namespace osu.Game.Tests.Collections.IO // and have them associate with collections if/when they become available. Assert.That(osu.CollectionManager.Collections[0].Name.Value, Is.EqualTo("First")); - Assert.That(osu.CollectionManager.Collections[0].Beatmaps.Count, Is.EqualTo(1)); + Assert.That(osu.CollectionManager.Collections[0].BeatmapHashes.Count, Is.EqualTo(1)); Assert.That(osu.CollectionManager.Collections[1].Name.Value, Is.EqualTo("Second")); - Assert.That(osu.CollectionManager.Collections[1].Beatmaps.Count, Is.EqualTo(12)); + Assert.That(osu.CollectionManager.Collections[1].BeatmapHashes.Count, Is.EqualTo(12)); } finally { @@ -81,10 +81,10 @@ namespace osu.Game.Tests.Collections.IO Assert.That(osu.CollectionManager.Collections.Count, Is.EqualTo(2)); Assert.That(osu.CollectionManager.Collections[0].Name.Value, Is.EqualTo("First")); - Assert.That(osu.CollectionManager.Collections[0].Beatmaps.Count, Is.EqualTo(1)); + Assert.That(osu.CollectionManager.Collections[0].BeatmapHashes.Count, Is.EqualTo(1)); Assert.That(osu.CollectionManager.Collections[1].Name.Value, Is.EqualTo("Second")); - Assert.That(osu.CollectionManager.Collections[1].Beatmaps.Count, Is.EqualTo(12)); + Assert.That(osu.CollectionManager.Collections[1].BeatmapHashes.Count, Is.EqualTo(12)); } finally { @@ -147,8 +147,8 @@ namespace osu.Game.Tests.Collections.IO await importCollectionsFromStream(osu, TestResources.OpenResource("Collections/collections.db")); // Move first beatmap from second collection into the first. - osu.CollectionManager.Collections[0].Beatmaps.Add(osu.CollectionManager.Collections[1].Beatmaps[0]); - osu.CollectionManager.Collections[1].Beatmaps.RemoveAt(0); + osu.CollectionManager.Collections[0].BeatmapHashes.Add(osu.CollectionManager.Collections[1].BeatmapHashes[0]); + osu.CollectionManager.Collections[1].BeatmapHashes.RemoveAt(0); // Rename the second collecction. osu.CollectionManager.Collections[1].Name.Value = "Another"; @@ -169,10 +169,10 @@ namespace osu.Game.Tests.Collections.IO Assert.That(osu.CollectionManager.Collections.Count, Is.EqualTo(2)); Assert.That(osu.CollectionManager.Collections[0].Name.Value, Is.EqualTo("First")); - Assert.That(osu.CollectionManager.Collections[0].Beatmaps.Count, Is.EqualTo(2)); + Assert.That(osu.CollectionManager.Collections[0].BeatmapHashes.Count, Is.EqualTo(2)); Assert.That(osu.CollectionManager.Collections[1].Name.Value, Is.EqualTo("Another")); - Assert.That(osu.CollectionManager.Collections[1].Beatmaps.Count, Is.EqualTo(11)); + Assert.That(osu.CollectionManager.Collections[1].BeatmapHashes.Count, Is.EqualTo(11)); } finally { diff --git a/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs b/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs index caf3473c45..602c7c84b8 100644 --- a/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs +++ b/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs @@ -152,7 +152,7 @@ namespace osu.Game.Tests.Visual.Collections AddStep("add two collections with same name", () => manager.Collections.AddRange(new[] { new BeatmapCollection { Name = { Value = "1" } }, - new BeatmapCollection { Name = { Value = "1" }, Beatmaps = { beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps[0].MD5Hash } }, + new BeatmapCollection { Name = { Value = "1" }, BeatmapHashes = { beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps[0].MD5Hash } }, })); } @@ -162,7 +162,7 @@ namespace osu.Game.Tests.Visual.Collections AddStep("add two collections", () => manager.Collections.AddRange(new[] { new BeatmapCollection { Name = { Value = "1" } }, - new BeatmapCollection { Name = { Value = "2" }, Beatmaps = { beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps[0].MD5Hash } }, + new BeatmapCollection { Name = { Value = "2" }, BeatmapHashes = { beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps[0].MD5Hash } }, })); assertCollectionCount(2); @@ -198,7 +198,7 @@ namespace osu.Game.Tests.Visual.Collections { AddStep("add two collections", () => manager.Collections.AddRange(new[] { - new BeatmapCollection { Name = { Value = "1" }, Beatmaps = { beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps[0].MD5Hash } }, + new BeatmapCollection { Name = { Value = "1" }, BeatmapHashes = { beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps[0].MD5Hash } }, })); assertCollectionCount(1); diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs index db49ec06f8..b42ce3ff87 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs @@ -151,10 +151,10 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep("add collection", () => collectionManager.Collections.Add(new BeatmapCollection { Name = { Value = "1" } })); AddAssert("button is plus", () => getAddOrRemoveButton(1).Icon.Equals(FontAwesome.Solid.PlusSquare)); - AddStep("add beatmap to collection", () => collectionManager.Collections[0].Beatmaps.Add(Beatmap.Value.BeatmapInfo.MD5Hash)); + AddStep("add beatmap to collection", () => collectionManager.Collections[0].BeatmapHashes.Add(Beatmap.Value.BeatmapInfo.MD5Hash)); AddAssert("button is minus", () => getAddOrRemoveButton(1).Icon.Equals(FontAwesome.Solid.MinusSquare)); - AddStep("remove beatmap from collection", () => collectionManager.Collections[0].Beatmaps.Clear()); + AddStep("remove beatmap from collection", () => collectionManager.Collections[0].BeatmapHashes.Clear()); AddAssert("button is plus", () => getAddOrRemoveButton(1).Icon.Equals(FontAwesome.Solid.PlusSquare)); } @@ -169,11 +169,11 @@ namespace osu.Game.Tests.Visual.SongSelect AddAssert("button is plus", () => getAddOrRemoveButton(1).Icon.Equals(FontAwesome.Solid.PlusSquare)); addClickAddOrRemoveButtonStep(1); - AddAssert("collection contains beatmap", () => collectionManager.Collections[0].Beatmaps.Contains(Beatmap.Value.BeatmapInfo.MD5Hash)); + AddAssert("collection contains beatmap", () => collectionManager.Collections[0].BeatmapHashes.Contains(Beatmap.Value.BeatmapInfo.MD5Hash)); AddAssert("button is minus", () => getAddOrRemoveButton(1).Icon.Equals(FontAwesome.Solid.MinusSquare)); addClickAddOrRemoveButtonStep(1); - AddAssert("collection does not contain beatmap", () => !collectionManager.Collections[0].Beatmaps.Contains(Beatmap.Value.BeatmapInfo.MD5Hash)); + AddAssert("collection does not contain beatmap", () => !collectionManager.Collections[0].BeatmapHashes.Contains(Beatmap.Value.BeatmapInfo.MD5Hash)); AddAssert("button is plus", () => getAddOrRemoveButton(1).Icon.Equals(FontAwesome.Solid.PlusSquare)); } diff --git a/osu.Game/Collections/BeatmapCollection.cs b/osu.Game/Collections/BeatmapCollection.cs index ca0f57f638..cf95c74b46 100644 --- a/osu.Game/Collections/BeatmapCollection.cs +++ b/osu.Game/Collections/BeatmapCollection.cs @@ -25,7 +25,7 @@ namespace osu.Game.Collections /// /// The es of beatmaps contained by the collection. /// - public readonly BindableList Beatmaps = new BindableList(); + public readonly BindableList BeatmapHashes = new BindableList(); /// /// The date when this collection was last modified. @@ -34,7 +34,7 @@ namespace osu.Game.Collections public BeatmapCollection() { - Beatmaps.CollectionChanged += (_, __) => onChange(); + BeatmapHashes.CollectionChanged += (_, __) => onChange(); Name.ValueChanged += _ => onChange(); } diff --git a/osu.Game/Collections/CollectionFilterDropdown.cs b/osu.Game/Collections/CollectionFilterDropdown.cs index 97e5711d75..100074d186 100644 --- a/osu.Game/Collections/CollectionFilterDropdown.cs +++ b/osu.Game/Collections/CollectionFilterDropdown.cs @@ -95,10 +95,10 @@ namespace osu.Game.Collections beatmaps.CollectionChanged -= filterBeatmapsChanged; if (filter.OldValue?.Collection != null) - beatmaps.UnbindFrom(filter.OldValue.Collection.Beatmaps); + beatmaps.UnbindFrom(filter.OldValue.Collection.BeatmapHashes); if (filter.NewValue?.Collection != null) - beatmaps.BindTo(filter.NewValue.Collection.Beatmaps); + beatmaps.BindTo(filter.NewValue.Collection.BeatmapHashes); beatmaps.CollectionChanged += filterBeatmapsChanged; @@ -208,7 +208,7 @@ namespace osu.Game.Collections public CollectionDropdownMenuItem(MenuItem item) : base(item) { - collectionBeatmaps = Item.Collection?.Beatmaps.GetBoundCopy(); + collectionBeatmaps = Item.Collection?.BeatmapHashes.GetBoundCopy(); collectionName = Item.CollectionName.GetBoundCopy(); } diff --git a/osu.Game/Collections/CollectionManager.cs b/osu.Game/Collections/CollectionManager.cs index 30171a71af..104ec4beb2 100644 --- a/osu.Game/Collections/CollectionManager.cs +++ b/osu.Game/Collections/CollectionManager.cs @@ -169,10 +169,10 @@ namespace osu.Game.Collections if (existing == null) Collections.Add(existing = new BeatmapCollection { Name = { Value = newCol.Name.Value } }); - foreach (string newBeatmap in newCol.Beatmaps) + foreach (string newBeatmap in newCol.BeatmapHashes) { - if (!existing.Beatmaps.Contains(newBeatmap)) - existing.Beatmaps.Add(newBeatmap); + if (!existing.BeatmapHashes.Contains(newBeatmap)) + existing.BeatmapHashes.Add(newBeatmap); } } @@ -222,7 +222,7 @@ namespace osu.Game.Collections string checksum = sr.ReadString(); - collection.Beatmaps.Add(checksum); + collection.BeatmapHashes.Add(checksum); } if (notification != null) @@ -293,7 +293,7 @@ namespace osu.Game.Collections { sw.Write(c.Name.Value); - string[] beatmapsCopy = c.Beatmaps.ToArray(); + string[] beatmapsCopy = c.BeatmapHashes.ToArray(); sw.Write(beatmapsCopy.Length); diff --git a/osu.Game/Collections/DeleteCollectionDialog.cs b/osu.Game/Collections/DeleteCollectionDialog.cs index e5a2f6fb81..e59adb14a6 100644 --- a/osu.Game/Collections/DeleteCollectionDialog.cs +++ b/osu.Game/Collections/DeleteCollectionDialog.cs @@ -13,7 +13,7 @@ namespace osu.Game.Collections public DeleteCollectionDialog(BeatmapCollection collection, Action deleteAction) { HeaderText = "Confirm deletion of"; - BodyText = $"{collection.Name.Value} ({"beatmap".ToQuantity(collection.Beatmaps.Count)})"; + BodyText = $"{collection.Name.Value} ({"beatmap".ToQuantity(collection.BeatmapHashes.Count)})"; Icon = FontAwesome.Regular.TrashAlt; diff --git a/osu.Game/Collections/DrawableCollectionListItem.cs b/osu.Game/Collections/DrawableCollectionListItem.cs index 5a20b7e7bd..5064041737 100644 --- a/osu.Game/Collections/DrawableCollectionListItem.cs +++ b/osu.Game/Collections/DrawableCollectionListItem.cs @@ -225,7 +225,7 @@ namespace osu.Game.Collections { background.FlashColour(Color4.White, 150); - if (collection.Beatmaps.Count == 0) + if (collection.BeatmapHashes.Count == 0) deleteCollection(); else dialogOverlay?.Push(new DeleteCollectionDialog(collection, deleteCollection)); diff --git a/osu.Game/Overlays/Music/Playlist.cs b/osu.Game/Overlays/Music/Playlist.cs index 9d31af256f..ff8f3197f9 100644 --- a/osu.Game/Overlays/Music/Playlist.cs +++ b/osu.Game/Overlays/Music/Playlist.cs @@ -36,7 +36,7 @@ namespace osu.Game.Overlays.Music else { item.InSelectedCollection = item.Model.Value.Beatmaps.Select(b => b.MD5Hash) - .Any(criteria.Collection.Beatmaps.Contains); + .Any(criteria.Collection.BeatmapHashes.Contains); } } diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs index de9899f288..c3f6b3ad83 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs @@ -72,7 +72,7 @@ namespace osu.Game.Screens.Select.Carousel } if (match) - match &= criteria.Collection?.Beatmaps.Contains(BeatmapInfo.MD5Hash) ?? true; + match &= criteria.Collection?.BeatmapHashes.Contains(BeatmapInfo.MD5Hash) ?? true; if (match && criteria.RulesetCriteria != null) match &= criteria.RulesetCriteria.Matches(BeatmapInfo); diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 79d27e9d9d..065a29b53c 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -256,12 +256,12 @@ namespace osu.Game.Screens.Select.Carousel return new ToggleMenuItem(collection.Name.Value, MenuItemType.Standard, s => { if (s) - collection.Beatmaps.Add(beatmapInfo.MD5Hash); + collection.BeatmapHashes.Add(beatmapInfo.MD5Hash); else - collection.Beatmaps.Remove(beatmapInfo.MD5Hash); + collection.BeatmapHashes.Remove(beatmapInfo.MD5Hash); }) { - State = { Value = collection.Beatmaps.Contains(beatmapInfo.MD5Hash) } + State = { Value = collection.BeatmapHashes.Contains(beatmapInfo.MD5Hash) } }; } diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index ade89c5b35..80f1231454 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -245,7 +245,7 @@ namespace osu.Game.Screens.Select.Carousel TernaryState state; - int countExisting = beatmapSet.Beatmaps.Count(b => collection.Beatmaps.Contains(b.MD5Hash)); + int countExisting = beatmapSet.Beatmaps.Count(b => collection.BeatmapHashes.Contains(b.MD5Hash)); if (countExisting == beatmapSet.Beatmaps.Count) state = TernaryState.True; @@ -261,14 +261,14 @@ namespace osu.Game.Screens.Select.Carousel switch (s) { case TernaryState.True: - if (collection.Beatmaps.Contains(b.MD5Hash)) + if (collection.BeatmapHashes.Contains(b.MD5Hash)) continue; - collection.Beatmaps.Add(b.MD5Hash); + collection.BeatmapHashes.Add(b.MD5Hash); break; case TernaryState.False: - collection.Beatmaps.Remove(b.MD5Hash); + collection.BeatmapHashes.Remove(b.MD5Hash); break; } } From c625c929e5974f0b544758eb72a422a4cbf2def2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 14:16:56 +0900 Subject: [PATCH 1531/2328] Update button text to match new terminology --- .../Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs index cd8cf8f64f..2b845e9d6b 100644 --- a/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings }, new SettingsButton { - Text = @"Run latency comparer", + Text = @"Run latency certifier", Action = () => performer?.PerformFromScreen(menu => menu.Push(new LatencyCertifierScreen())) } }; From 613814c26cbec49a6c8b2952864c560b1a0dd49a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 14:18:35 +0900 Subject: [PATCH 1532/2328] Make `TargetFrameRate` nullable --- osu.Game/Screens/Utility/LatencyArea.cs | 7 ++++--- osu.Game/Screens/Utility/LatencyCertifierScreen.cs | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Utility/LatencyArea.cs b/osu.Game/Screens/Utility/LatencyArea.cs index a82efa1e26..a2991d3fa8 100644 --- a/osu.Game/Screens/Utility/LatencyArea.cs +++ b/osu.Game/Screens/Utility/LatencyArea.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. #nullable enable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -27,11 +28,11 @@ namespace osu.Game.Screens.Utility private readonly Key key; - public readonly int TargetFrameRate; + public readonly int? TargetFrameRate; public readonly BindableBool IsActiveArea = new BindableBool(); - public LatencyArea(Key key, int targetFrameRate) + public LatencyArea(Key key, int? targetFrameRate) { this.key = key; TargetFrameRate = targetFrameRate; @@ -94,7 +95,7 @@ namespace osu.Game.Screens.Utility public override bool UpdateSubTree() { double elapsed = Clock.CurrentTime - lastFrameTime; - if (TargetFrameRate > 0 && elapsed < 1000.0 / TargetFrameRate) + if (TargetFrameRate.HasValue && elapsed < 1000.0 / TargetFrameRate) return false; lastFrameTime = Clock.CurrentTime; diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 2fb673c537..a5ed573d88 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -358,13 +358,13 @@ Do whatever you need to try and perceive the difference in latency, then choose mainArea.AddRange(new[] { - new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(difficultyLevel) : 0) + new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(difficultyLevel) : (int?)null) { Width = 0.5f, IsActiveArea = { Value = true }, ReportUserBest = () => recordResult(betterSide == 0), }, - new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(difficultyLevel) : 0) + new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(difficultyLevel) : (int?)null) { Width = 0.5f, Anchor = Anchor.TopRight, From 69b856bd58d37f18433ae95363d5416c5581c7e3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 14:23:24 +0900 Subject: [PATCH 1533/2328] Rename rounds variables to hopefully read better --- .../Screens/Utility/LatencyCertifierScreen.cs | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index a5ed573d88..2602238820 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -66,9 +66,9 @@ namespace osu.Game.Screens.Utility private const int rounds_to_complete_certified = 20; - private int round; - private int correctCount; - private int targetRoundCount = rounds_to_complete; + private int attemptsAtCurrentDifficulty; + private int correctAtCurrentDifficulty; + private int totalRoundForNextResultsScreen = rounds_to_complete; private int difficultyLevel = 1; @@ -199,10 +199,10 @@ Do whatever you need to try and perceive the difference in latency, then choose statusText.Clear(); - float successRate = (float)correctCount / targetRoundCount; + float successRate = (float)correctAtCurrentDifficulty / totalRoundForNextResultsScreen; bool isPass = successRate == 1; - statusText.AddParagraph($"You scored {correctCount} out of {targetRoundCount} ({successRate:0%})!", cp => cp.Colour = isPass ? colours.Green : colours.Red); + statusText.AddParagraph($"You scored {correctAtCurrentDifficulty} out of {totalRoundForNextResultsScreen} ({successRate:0%})!", cp => cp.Colour = isPass ? colours.Green : colours.Red); statusText.AddParagraph($"Level {difficultyLevel} ({mapDifficultyToTargetFrameRate(difficultyLevel):N0} hz)", cp => cp.Font = OsuFont.Default.With(size: 24)); @@ -213,18 +213,20 @@ Do whatever you need to try and perceive the difference in latency, then choose if (!isPass && difficultyLevel > 1) { - statusText.AddParagraph("To complete certification, decrease the difficulty level until you can get 20 tests correct in a row!", cp => cp.Font = OsuFont.Default.With(size: 24, weight: FontWeight.SemiBold)); + statusText.AddParagraph("To complete certification, decrease the difficulty level until you can get 20 tests correct in a row!", + cp => cp.Font = OsuFont.Default.With(size: 24, weight: FontWeight.SemiBold)); statusText.AddParagraph(string.Empty); } - statusText.AddParagraph($"Polling: {pollingMax} hz Monitor: {displayMode?.RefreshRate ?? 0:N0} hz Exclusive: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15, weight: FontWeight.SemiBold)); + statusText.AddParagraph($"Polling: {pollingMax} hz Monitor: {displayMode?.RefreshRate ?? 0:N0} hz Exclusive: {exclusive}", + cp => cp.Font = OsuFont.Default.With(size: 15, weight: FontWeight.SemiBold)); statusText.AddParagraph($"Input: {host.InputThread.Clock.FramesPerSecond} hz " + $"Update: {host.UpdateThread.Clock.FramesPerSecond} hz " + $"Draw: {host.DrawThread.Clock.FramesPerSecond} hz" , cp => cp.Font = OsuFont.Default.With(size: 15, weight: FontWeight.SemiBold)); - int certificationRemaining = !isPass ? rounds_to_complete_certified : rounds_to_complete_certified - correctCount; + int certificationRemaining = !isPass ? rounds_to_complete_certified : rounds_to_complete_certified - correctAtCurrentDifficulty; if (isPass && certificationRemaining <= 0) { @@ -320,7 +322,7 @@ Do whatever you need to try and perceive the difference in latency, then choose Action = () => { resultsArea.Clear(); - targetRoundCount += rounds_to_complete; + totalRoundForNextResultsScreen += rounds_to_complete; loadNextRound(); }, TooltipText = isPass ? $"Chain {rounds_to_complete_certified} to confirm your perception!" : "You've reached your limits. Go to the previous level to complete certification!", @@ -336,12 +338,13 @@ Do whatever you need to try and perceive the difference in latency, then choose resultsArea.Clear(); - correctCount = 0; - round = 0; + correctAtCurrentDifficulty = 0; + attemptsAtCurrentDifficulty = 0; + pollingMax = 0; lastPoll = 0; - targetRoundCount = rounds_to_complete; + totalRoundForNextResultsScreen = rounds_to_complete; difficultyLevel = difficulty; loadNextRound(); @@ -349,8 +352,8 @@ Do whatever you need to try and perceive the difference in latency, then choose private void loadNextRound() { - round++; - statusText.Text = $"Level {difficultyLevel}\nRound {round} of {targetRoundCount}"; + attemptsAtCurrentDifficulty++; + statusText.Text = $"Level {difficultyLevel}\nRound {attemptsAtCurrentDifficulty} of {totalRoundForNextResultsScreen}"; mainArea.Clear(); @@ -389,9 +392,9 @@ Do whatever you need to try and perceive the difference in latency, then choose explanatoryText.FadeOut(500, Easing.OutQuint); if (correct) - correctCount++; + correctAtCurrentDifficulty++; - if (round < targetRoundCount) + if (attemptsAtCurrentDifficulty < totalRoundForNextResultsScreen) loadNextRound(); else showResults(); From 5b8bd24140e08e468e751e5746c65b2349cf2603 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 14:25:15 +0900 Subject: [PATCH 1534/2328] Simplify text when reaching maximum supported level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- osu.Game/Screens/Utility/LatencyCertifierScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 2602238820..678a2855a7 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -282,7 +282,7 @@ Do whatever you need to try and perceive the difference in latency, then choose if (!isPass) cannotIncreaseReason = "You didn't get a perfect score."; else if (mapDifficultyToTargetFrameRate(difficultyLevel + 1) > target_host_update_frames) - cannotIncreaseReason = "You've reached the limits of this comparison mode."; + cannotIncreaseReason = "You've reached the maximum level."; else if (mapDifficultyToTargetFrameRate(difficultyLevel + 1) > Clock.FramesPerSecond) cannotIncreaseReason = "Game is not running fast enough to test this level"; From f71343c880294fa905bd728fe288ea8db5fff0fa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 14:28:46 +0900 Subject: [PATCH 1535/2328] Fix box colour getting stuck when changing active mode --- osu.Game/Screens/Utility/LatencyArea.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Utility/LatencyArea.cs b/osu.Game/Screens/Utility/LatencyArea.cs index a2991d3fa8..2ef48bb571 100644 --- a/osu.Game/Screens/Utility/LatencyArea.cs +++ b/osu.Game/Screens/Utility/LatencyArea.cs @@ -145,6 +145,7 @@ namespace osu.Game.Screens.Utility if (!isActive.Value) { lastFrameTime = null; + box.Colour = overlayColourProvider.Colour1; return; } From eb16de9c718b7374753ba5f8ab55a273f7d40af7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 14:38:04 +0900 Subject: [PATCH 1536/2328] Use upper-case "Hz" --- osu.Game/Screens/Utility/LatencyCertifierScreen.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 678a2855a7..41952faf25 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -203,7 +203,7 @@ Do whatever you need to try and perceive the difference in latency, then choose bool isPass = successRate == 1; statusText.AddParagraph($"You scored {correctAtCurrentDifficulty} out of {totalRoundForNextResultsScreen} ({successRate:0%})!", cp => cp.Colour = isPass ? colours.Green : colours.Red); - statusText.AddParagraph($"Level {difficultyLevel} ({mapDifficultyToTargetFrameRate(difficultyLevel):N0} hz)", + statusText.AddParagraph($"Level {difficultyLevel} ({mapDifficultyToTargetFrameRate(difficultyLevel):N0} Hz)", cp => cp.Font = OsuFont.Default.With(size: 24)); statusText.AddParagraph(string.Empty); @@ -218,12 +218,12 @@ Do whatever you need to try and perceive the difference in latency, then choose statusText.AddParagraph(string.Empty); } - statusText.AddParagraph($"Polling: {pollingMax} hz Monitor: {displayMode?.RefreshRate ?? 0:N0} hz Exclusive: {exclusive}", + statusText.AddParagraph($"Polling: {pollingMax} Hz Monitor: {displayMode?.RefreshRate ?? 0:N0} Hz Exclusive: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15, weight: FontWeight.SemiBold)); - statusText.AddParagraph($"Input: {host.InputThread.Clock.FramesPerSecond} hz " - + $"Update: {host.UpdateThread.Clock.FramesPerSecond} hz " - + $"Draw: {host.DrawThread.Clock.FramesPerSecond} hz" + statusText.AddParagraph($"Input: {host.InputThread.Clock.FramesPerSecond} Hz " + + $"Update: {host.UpdateThread.Clock.FramesPerSecond} Hz " + + $"Draw: {host.DrawThread.Clock.FramesPerSecond} Hz" , cp => cp.Font = OsuFont.Default.With(size: 15, weight: FontWeight.SemiBold)); int certificationRemaining = !isPass ? rounds_to_complete_certified : rounds_to_complete_certified - correctAtCurrentDifficulty; @@ -257,7 +257,7 @@ Do whatever you need to try and perceive the difference in latency, then choose }), new OsuSpriteText { - Text = $"You should use a frame limiter with update rate of {mapDifficultyToTargetFrameRate(difficultyLevel + 1)} hz (or fps) for best results!", + Text = $"You should use a frame limiter with update rate of {mapDifficultyToTargetFrameRate(difficultyLevel + 1)} Hz (or fps) for best results!", Anchor = Anchor.Centre, Origin = Anchor.Centre, Font = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold), From 7d8601090336f41df99676b0b8fc79e35be20225 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 14:41:22 +0900 Subject: [PATCH 1537/2328] Fix test regression --- .../Visual/Settings/TestSceneLatencyCertifierScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs index 6d8c6d3c54..dd287c4f6a 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs @@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual.Settings { var latencyArea = latencyCertifier .ChildrenOfType() - .SingleOrDefault(a => a.TargetFrameRate == 0); + .SingleOrDefault(a => a.TargetFrameRate == null); // reached results if (latencyArea == null) From 5541ebc76b438d0caa56060a73b9e3078b743258 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 15:02:26 +0900 Subject: [PATCH 1538/2328] Revert `OsuButton` changes --- osu.Game/Graphics/UserInterface/OsuButton.cs | 2 +- osu.Game/Screens/Utility/ButtonWithKeyBind.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 044df13152..08514d94c3 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -20,7 +20,7 @@ namespace osu.Game.Graphics.UserInterface /// public class OsuButton : Button { - public virtual LocalisableString Text + public LocalisableString Text { get => SpriteText?.Text ?? default; set diff --git a/osu.Game/Screens/Utility/ButtonWithKeyBind.cs b/osu.Game/Screens/Utility/ButtonWithKeyBind.cs index 20e39ffa6a..ef87e0bca7 100644 --- a/osu.Game/Screens/Utility/ButtonWithKeyBind.cs +++ b/osu.Game/Screens/Utility/ButtonWithKeyBind.cs @@ -21,7 +21,7 @@ namespace osu.Game.Screens.Utility this.key = key; } - public override LocalisableString Text + public new LocalisableString Text { get => base.Text; set => base.Text = $"{value} (Press {key.ToString().Replace("Number", string.Empty)})"; From e0644f27262daa99187180a74211cfe8dcbf42be Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 15:19:10 +0900 Subject: [PATCH 1539/2328] Simplify flow of progression to be linear --- .../TestSceneLatencyCertifierScreen.cs | 34 ++- .../Screens/Utility/LatencyCertifierScreen.cs | 204 ++++++++++-------- 2 files changed, 142 insertions(+), 96 deletions(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs index dd287c4f6a..81faf31c69 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs @@ -29,22 +29,46 @@ namespace osu.Game.Tests.Visual.Settings { for (int i = 0; i < 4; i++) { - clickCorrectUntilResults(); - AddAssert("check at results", () => !latencyCertifier.ChildrenOfType().Any()); - AddStep("hit c to continue", () => InputManager.Key(Key.C)); + int difficulty = i + 1; + + checkDifficulty(difficulty); + clickUntilResults(true); + continueFromResults(); } + checkDifficulty(5); + clickUntilResults(false); + continueFromResults(); + checkDifficulty(4); + + clickUntilResults(false); + continueFromResults(); + checkDifficulty(3); + + clickUntilResults(true); AddAssert("check at results", () => !latencyCertifier.ChildrenOfType().Any()); AddAssert("check no buttons", () => !latencyCertifier.ChildrenOfType().Any()); + checkDifficulty(3); } - private void clickCorrectUntilResults() + private void continueFromResults() + { + AddAssert("check at results", () => !latencyCertifier.ChildrenOfType().Any()); + AddStep("hit enter to continue", () => InputManager.Key(Key.Enter)); + } + + private void checkDifficulty(int difficulty) + { + AddAssert($"difficulty is {difficulty}", () => latencyCertifier.DifficultyLevel == difficulty); + } + + private void clickUntilResults(bool clickCorrect) { AddUntilStep("click correct button until results", () => { var latencyArea = latencyCertifier .ChildrenOfType() - .SingleOrDefault(a => a.TargetFrameRate == null); + .SingleOrDefault(a => clickCorrect ? a.TargetFrameRate == null : a.TargetFrameRate != null); // reached results if (latencyArea == null) diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 41952faf25..0a9d98450f 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -66,11 +66,17 @@ namespace osu.Game.Screens.Utility private const int rounds_to_complete_certified = 20; + /// + /// Whether we are now in certification mode and decreasing difficulty. + /// + private bool isCertifying; + + private int totalRoundForNextResultsScreen => isCertifying ? rounds_to_complete_certified : rounds_to_complete; + private int attemptsAtCurrentDifficulty; private int correctAtCurrentDifficulty; - private int totalRoundForNextResultsScreen = rounds_to_complete; - private int difficultyLevel = 1; + public int DifficultyLevel { get; private set; } = 1; private double lastPoll; private int pollingMax; @@ -199,11 +205,11 @@ Do whatever you need to try and perceive the difference in latency, then choose statusText.Clear(); - float successRate = (float)correctAtCurrentDifficulty / totalRoundForNextResultsScreen; + float successRate = (float)correctAtCurrentDifficulty / attemptsAtCurrentDifficulty; bool isPass = successRate == 1; - statusText.AddParagraph($"You scored {correctAtCurrentDifficulty} out of {totalRoundForNextResultsScreen} ({successRate:0%})!", cp => cp.Colour = isPass ? colours.Green : colours.Red); - statusText.AddParagraph($"Level {difficultyLevel} ({mapDifficultyToTargetFrameRate(difficultyLevel):N0} Hz)", + statusText.AddParagraph($"You scored {correctAtCurrentDifficulty} out of {attemptsAtCurrentDifficulty} ({successRate:0%})!", cp => cp.Colour = isPass ? colours.Green : colours.Red); + statusText.AddParagraph($"Level {DifficultyLevel} ({mapDifficultyToTargetFrameRate(DifficultyLevel):N0} Hz)", cp => cp.Font = OsuFont.Default.With(size: 24)); statusText.AddParagraph(string.Empty); @@ -211,9 +217,9 @@ Do whatever you need to try and perceive the difference in latency, then choose statusText.AddIcon(isPass ? FontAwesome.Regular.CheckCircle : FontAwesome.Regular.TimesCircle, cp => cp.Colour = isPass ? colours.Green : colours.Red); statusText.AddParagraph(string.Empty); - if (!isPass && difficultyLevel > 1) + if (!isPass && DifficultyLevel > 1) { - statusText.AddParagraph("To complete certification, decrease the difficulty level until you can get 20 tests correct in a row!", + statusText.AddParagraph("To complete certification, the difficulty level will now decrease until you can get 20 rounds correct in a row!", cp => cp.Font = OsuFont.Default.With(size: 24, weight: FontWeight.SemiBold)); statusText.AddParagraph(string.Empty); } @@ -226,67 +232,22 @@ Do whatever you need to try and perceive the difference in latency, then choose + $"Draw: {host.DrawThread.Clock.FramesPerSecond} Hz" , cp => cp.Font = OsuFont.Default.With(size: 15, weight: FontWeight.SemiBold)); - int certificationRemaining = !isPass ? rounds_to_complete_certified : rounds_to_complete_certified - correctAtCurrentDifficulty; - - if (isPass && certificationRemaining <= 0) + if (isCertifying && isPass) { - Drawable background; - Drawable certifiedText; - - resultsArea.AddRange(new[] - { - background = new Box - { - Colour = overlayColourProvider.Background4, - RelativeSizeAxes = Axes.Both, - }, - (certifiedText = new OsuSpriteText - { - Alpha = 0, - Font = OsuFont.TorusAlternate.With(size: 80, weight: FontWeight.Bold), - Text = "Certified!", - Blending = BlendingParameters.Additive, - }).WithEffect(new GlowEffect - { - Colour = overlayColourProvider.Colour1, - PadExtent = true - }).With(e => - { - e.Anchor = Anchor.Centre; - e.Origin = Anchor.Centre; - }), - new OsuSpriteText - { - Text = $"You should use a frame limiter with update rate of {mapDifficultyToTargetFrameRate(difficultyLevel + 1)} Hz (or fps) for best results!", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Font = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold), - Y = 80, - } - }); - - background.FadeInFromZero(1000, Easing.OutQuint); - - certifiedText.FadeInFromZero(500, Easing.InQuint); - - certifiedText - .ScaleTo(10) - .ScaleTo(1, 600, Easing.InQuad) - .Then() - .ScaleTo(1.05f, 10000, Easing.OutQuint); + showCertifiedScreen(); return; } string cannotIncreaseReason = string.Empty; - if (!isPass) - cannotIncreaseReason = "You didn't get a perfect score."; - else if (mapDifficultyToTargetFrameRate(difficultyLevel + 1) > target_host_update_frames) + if (mapDifficultyToTargetFrameRate(DifficultyLevel + 1) > target_host_update_frames) cannotIncreaseReason = "You've reached the maximum level."; - else if (mapDifficultyToTargetFrameRate(difficultyLevel + 1) > Clock.FramesPerSecond) + else if (mapDifficultyToTargetFrameRate(DifficultyLevel + 1) > Clock.FramesPerSecond) cannotIncreaseReason = "Game is not running fast enough to test this level"; - resultsArea.Add(new FillFlowContainer + FillFlowContainer buttonFlow; + + resultsArea.Add(buttonFlow = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -294,42 +255,104 @@ Do whatever you need to try and perceive the difference in latency, then choose Origin = Anchor.BottomLeft, Spacing = new Vector2(20), Padding = new MarginPadding(20), - Children = new Drawable[] + }); + + if (isPass) + { + buttonFlow.Add(new ButtonWithKeyBind(Key.Enter) { - new ButtonWithKeyBind(Key.Enter) + Text = "Continue to next level", + BackgroundColour = colours.Green, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Action = () => changeDifficulty(DifficultyLevel + 1), + Enabled = { Value = string.IsNullOrEmpty(cannotIncreaseReason) }, + TooltipText = cannotIncreaseReason + }); + } + else + { + if (DifficultyLevel == 1) + { + buttonFlow.Add(new ButtonWithKeyBind(Key.Enter) { - Text = "Continue to next level", - BackgroundColour = colours.Red2, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Action = () => changeDifficulty(difficultyLevel + 1), - Enabled = { Value = string.IsNullOrEmpty(cannotIncreaseReason) }, - TooltipText = cannotIncreaseReason - }, - new ButtonWithKeyBind(Key.D) - { - Text = difficultyLevel == 1 ? "Retry" : "Return to last level", - BackgroundColour = colours.Green, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Action = () => changeDifficulty(Math.Max(difficultyLevel - 1, 1)), - }, - new ButtonWithKeyBind(Key.C) - { - Text = $"Continue towards certification at this level ({certificationRemaining} more)", + Text = "Retry", + TooltipText = "Are you even trying..?", + BackgroundColour = colours.Pink2, Anchor = Anchor.Centre, Origin = Anchor.Centre, Action = () => { - resultsArea.Clear(); - totalRoundForNextResultsScreen += rounds_to_complete; - loadNextRound(); + isCertifying = false; + changeDifficulty(1); }, - TooltipText = isPass ? $"Chain {rounds_to_complete_certified} to confirm your perception!" : "You've reached your limits. Go to the previous level to complete certification!", - Enabled = { Value = isPass }, - }, + }); + } + else + { + buttonFlow.Add(new ButtonWithKeyBind(Key.Enter) + { + Text = "Begin certification at last level", + BackgroundColour = colours.Yellow, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Action = () => + { + isCertifying = true; + changeDifficulty(DifficultyLevel - 1); + }, + TooltipText = isPass ? $"Chain {rounds_to_complete_certified} rounds to confirm your perception!" : "You've reached your limits. Go to the previous level to complete certification!", + }); + } + } + } + + private void showCertifiedScreen() + { + Drawable background; + Drawable certifiedText; + + resultsArea.AddRange(new[] + { + background = new Box + { + Colour = overlayColourProvider.Background4, + RelativeSizeAxes = Axes.Both, + }, + (certifiedText = new OsuSpriteText + { + Alpha = 0, + Font = OsuFont.TorusAlternate.With(size: 80, weight: FontWeight.Bold), + Text = "Certified!", + Blending = BlendingParameters.Additive, + }).WithEffect(new GlowEffect + { + Colour = overlayColourProvider.Colour1, + PadExtent = true + }).With(e => + { + e.Anchor = Anchor.Centre; + e.Origin = Anchor.Centre; + }), + new OsuSpriteText + { + Text = $"You should use a frame limiter with update rate of {mapDifficultyToTargetFrameRate(DifficultyLevel + 1)} Hz (or fps) for best results!", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold), + Y = 80, } }); + + background.FadeInFromZero(1000, Easing.OutQuint); + + certifiedText.FadeInFromZero(500, Easing.InQuint); + + certifiedText + .ScaleTo(10) + .ScaleTo(1, 600, Easing.InQuad) + .Then() + .ScaleTo(1.05f, 10000, Easing.OutQuint); } private void changeDifficulty(int difficulty) @@ -344,8 +367,7 @@ Do whatever you need to try and perceive the difference in latency, then choose pollingMax = 0; lastPoll = 0; - totalRoundForNextResultsScreen = rounds_to_complete; - difficultyLevel = difficulty; + DifficultyLevel = difficulty; loadNextRound(); } @@ -353,7 +375,7 @@ Do whatever you need to try and perceive the difference in latency, then choose private void loadNextRound() { attemptsAtCurrentDifficulty++; - statusText.Text = $"Level {difficultyLevel}\nRound {attemptsAtCurrentDifficulty} of {totalRoundForNextResultsScreen}"; + statusText.Text = $"Level {DifficultyLevel}\nRound {attemptsAtCurrentDifficulty} of {totalRoundForNextResultsScreen}"; mainArea.Clear(); @@ -361,13 +383,13 @@ Do whatever you need to try and perceive the difference in latency, then choose mainArea.AddRange(new[] { - new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(difficultyLevel) : (int?)null) + new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(DifficultyLevel) : (int?)null) { Width = 0.5f, IsActiveArea = { Value = true }, ReportUserBest = () => recordResult(betterSide == 0), }, - new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(difficultyLevel) : (int?)null) + new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(DifficultyLevel) : (int?)null) { Width = 0.5f, Anchor = Anchor.TopRight, From 936b38e0c54f878442dae0b670148f16931d0ff0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 16:13:53 +0900 Subject: [PATCH 1540/2328] Reduce test coverage to a point where headless tests will run correctly --- .../TestSceneLatencyCertifierScreen.cs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs index 81faf31c69..af6681e9cf 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs @@ -27,28 +27,19 @@ namespace osu.Game.Tests.Visual.Settings [Test] public void TestCertification() { - for (int i = 0; i < 4; i++) - { - int difficulty = i + 1; - - checkDifficulty(difficulty); - clickUntilResults(true); - continueFromResults(); - } - - checkDifficulty(5); - clickUntilResults(false); + checkDifficulty(1); + clickUntilResults(true); continueFromResults(); - checkDifficulty(4); + checkDifficulty(2); clickUntilResults(false); continueFromResults(); - checkDifficulty(3); + checkDifficulty(1); clickUntilResults(true); AddAssert("check at results", () => !latencyCertifier.ChildrenOfType().Any()); AddAssert("check no buttons", () => !latencyCertifier.ChildrenOfType().Any()); - checkDifficulty(3); + checkDifficulty(1); } private void continueFromResults() From e7602563fb770d9f82b92c3bf7b50e7e10753f50 Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Fri, 10 Jun 2022 10:28:14 +0100 Subject: [PATCH 1541/2328] Fetch lastlast object from beatmap, not objects list --- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 5 ++++- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index f074783ccf..0fa69c180a 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -92,7 +92,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty // The first jump is formed by the first two hitobjects of the map. // If the map has less than two OsuHitObjects, the enumerator will not return anything. for (int i = 1; i < beatmap.HitObjects.Count; i++) - objects.Add(new OsuDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate, objects, objects.Count)); + { + var lastLast = i > 1 ? beatmap.HitObjects[i - 2] : null; + objects.Add(new OsuDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], lastLast, clockRate, objects, objects.Count)); + } return objects; } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 989d407bd0..20921dd282 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -75,10 +75,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing private readonly OsuHitObject lastLastObject; private readonly OsuHitObject lastObject; - public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int index) + public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, List objects, int index) : base(hitObject, lastObject, clockRate, objects, index) { - lastLastObject = (OsuHitObject)Previous(1)?.BaseObject; + this.lastLastObject = (OsuHitObject)lastLastObject; this.lastObject = (OsuHitObject)lastObject; // Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects. From 53eb5c176c48fd86677f22a5cf09fe7575ce64e4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 16:22:34 +0900 Subject: [PATCH 1542/2328] Create setup for adding other visual display modes --- osu.Game/Screens/Utility/CircleGameplay.cs | 12 + osu.Game/Screens/Utility/LatencyArea.cs | 206 +++++------------- .../Screens/Utility/LatencyCertifierScreen.cs | 16 +- osu.Game/Screens/Utility/LatencyVisualMode.cs | 13 ++ .../LatencyCursorContainer.cs | 67 ++++++ .../SampleComponents/LatencyMovableBox.cs | 102 +++++++++ osu.Game/Screens/Utility/ScrollingGameplay.cs | 12 + 7 files changed, 277 insertions(+), 151 deletions(-) create mode 100644 osu.Game/Screens/Utility/CircleGameplay.cs create mode 100644 osu.Game/Screens/Utility/LatencyVisualMode.cs create mode 100644 osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs create mode 100644 osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs create mode 100644 osu.Game/Screens/Utility/ScrollingGameplay.cs diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs new file mode 100644 index 0000000000..0667a54ced --- /dev/null +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -0,0 +1,12 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Screens.Utility +{ + public class CircleGameplay : CompositeDrawable + { + } +} diff --git a/osu.Game/Screens/Utility/LatencyArea.cs b/osu.Game/Screens/Utility/LatencyArea.cs index 2ef48bb571..5b48a10a49 100644 --- a/osu.Game/Screens/Utility/LatencyArea.cs +++ b/osu.Game/Screens/Utility/LatencyArea.cs @@ -9,10 +9,9 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; using osu.Framework.Input.Events; using osu.Game.Overlays; -using osuTK; +using osu.Game.Screens.Utility.SampleComponents; using osuTK.Input; namespace osu.Game.Screens.Utility @@ -28,10 +27,14 @@ namespace osu.Game.Screens.Utility private readonly Key key; + private Container visualContent = null!; + public readonly int? TargetFrameRate; public readonly BindableBool IsActiveArea = new BindableBool(); + public readonly Bindable VisualMode = new Bindable(); + public LatencyArea(Key key, int? targetFrameRate) { this.key = key; @@ -61,20 +64,9 @@ namespace osu.Game.Screens.Utility Origin = Anchor.TopCentre, Action = () => ReportUserBest?.Invoke(), }, - new Container + visualContent = new Container { RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - new LatencyMovableBox(IsActiveArea) - { - RelativeSizeAxes = Axes.Both, - }, - new LatencyCursorContainer(IsActiveArea) - { - RelativeSizeAxes = Axes.Both, - }, - } }, }; @@ -82,6 +74,57 @@ namespace osu.Game.Screens.Utility { background.FadeColour(active.NewValue ? overlayColourProvider.Background4 : overlayColourProvider.Background6, 200, Easing.OutQuint); }, true); + + VisualMode.BindValueChanged(mode => + { + switch (mode.NewValue) + { + case LatencyVisualMode.Simple: + visualContent.Children = new Drawable[] + { + new LatencyMovableBox(IsActiveArea) + { + RelativeSizeAxes = Axes.Both, + }, + new LatencyCursorContainer(IsActiveArea) + { + RelativeSizeAxes = Axes.Both, + }, + }; + break; + + case LatencyVisualMode.CircleGameplay: + visualContent.Children = new Drawable[] + { + new CircleGameplay + { + RelativeSizeAxes = Axes.Both, + }, + new LatencyCursorContainer(IsActiveArea) + { + RelativeSizeAxes = Axes.Both, + }, + }; + break; + + case LatencyVisualMode.ScrollingGameplay: + visualContent.Children = new Drawable[] + { + new ScrollingGameplay + { + RelativeSizeAxes = Axes.Both, + }, + new LatencyCursorContainer(IsActiveArea) + { + RelativeSizeAxes = Axes.Both, + }, + }; + break; + + default: + throw new ArgumentOutOfRangeException(); + } + }, true); } protected override bool OnMouseMove(MouseMoveEvent e) @@ -102,140 +145,5 @@ namespace osu.Game.Screens.Utility return base.UpdateSubTree(); } - - public class LatencyMovableBox : CompositeDrawable - { - private Box box = null!; - private InputManager inputManager = null!; - - private readonly BindableBool isActive; - - [Resolved] - private OverlayColourProvider overlayColourProvider { get; set; } = null!; - - public LatencyMovableBox(BindableBool isActive) - { - this.isActive = isActive; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - inputManager = GetContainingInputManager(); - - InternalChild = box = new Box - { - Size = new Vector2(40), - RelativePositionAxes = Axes.Both, - Position = new Vector2(0.5f), - Origin = Anchor.Centre, - Colour = overlayColourProvider.Colour1, - }; - } - - protected override bool OnHover(HoverEvent e) => false; - - private double? lastFrameTime; - - protected override void Update() - { - base.Update(); - - if (!isActive.Value) - { - lastFrameTime = null; - box.Colour = overlayColourProvider.Colour1; - return; - } - - if (lastFrameTime != null) - { - float movementAmount = (float)(Clock.CurrentTime - lastFrameTime) / 400; - - var buttons = inputManager.CurrentState.Keyboard.Keys; - - box.Colour = buttons.HasAnyButtonPressed ? overlayColourProvider.Content1 : overlayColourProvider.Colour1; - - foreach (var key in buttons) - { - switch (key) - { - case Key.K: - case Key.Up: - box.Y = MathHelper.Clamp(box.Y - movementAmount, 0.1f, 0.9f); - break; - - case Key.J: - case Key.Down: - box.Y = MathHelper.Clamp(box.Y + movementAmount, 0.1f, 0.9f); - break; - - case Key.Z: - case Key.Left: - box.X = MathHelper.Clamp(box.X - movementAmount, 0.1f, 0.9f); - break; - - case Key.X: - case Key.Right: - box.X = MathHelper.Clamp(box.X + movementAmount, 0.1f, 0.9f); - break; - } - } - } - - lastFrameTime = Clock.CurrentTime; - } - } - - public class LatencyCursorContainer : CompositeDrawable - { - private Circle cursor = null!; - private InputManager inputManager = null!; - - private readonly BindableBool isActive; - - [Resolved] - private OverlayColourProvider overlayColourProvider { get; set; } = null!; - - public LatencyCursorContainer(BindableBool isActive) - { - this.isActive = isActive; - Masking = true; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - InternalChild = cursor = new Circle - { - Size = new Vector2(40), - Origin = Anchor.Centre, - Colour = overlayColourProvider.Colour2, - }; - - inputManager = GetContainingInputManager(); - } - - protected override bool OnHover(HoverEvent e) => false; - - protected override void Update() - { - cursor.Colour = inputManager.CurrentState.Mouse.IsPressed(MouseButton.Left) ? overlayColourProvider.Content1 : overlayColourProvider.Colour2; - - if (isActive.Value) - { - cursor.Position = ToLocalSpace(inputManager.CurrentState.Mouse.Position); - cursor.Alpha = 1; - } - else - { - cursor.Alpha = 0; - } - - base.Update(); - } - } } } diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 0a9d98450f..00821ab773 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -7,6 +7,7 @@ using System; using System.Diagnostics; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -62,6 +63,8 @@ namespace osu.Game.Screens.Utility [Resolved] private FrameworkConfigManager config { get; set; } = null!; + private readonly Bindable visualMode = new Bindable(); + private const int rounds_to_complete = 5; private const int rounds_to_complete_certified = 20; @@ -124,8 +127,9 @@ namespace osu.Game.Screens.Utility RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Text = @"Welcome to the latency certifier! -Use the arrow keys, Z/X/J/K to move the square. +Use the arrow keys, Z/X/F/J to control the display. Use the Tab key to change focus. +Change display modes with Space. Do whatever you need to try and perceive the difference in latency, then choose your best side. ", }, @@ -182,6 +186,10 @@ Do whatever you need to try and perceive the difference in latency, then choose { switch (e.Key) { + case Key.Space: + visualMode.Value = (LatencyVisualMode)(((int)visualMode.Value + 1) % 3); + return true; + case Key.Tab: var firstArea = mainArea.FirstOrDefault(a => !a.IsActiveArea.Value); if (firstArea != null) @@ -301,7 +309,9 @@ Do whatever you need to try and perceive the difference in latency, then choose isCertifying = true; changeDifficulty(DifficultyLevel - 1); }, - TooltipText = isPass ? $"Chain {rounds_to_complete_certified} rounds to confirm your perception!" : "You've reached your limits. Go to the previous level to complete certification!", + TooltipText = isPass + ? $"Chain {rounds_to_complete_certified} rounds to confirm your perception!" + : "You've reached your limits. Go to the previous level to complete certification!", }); } } @@ -386,12 +396,14 @@ Do whatever you need to try and perceive the difference in latency, then choose new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(DifficultyLevel) : (int?)null) { Width = 0.5f, + VisualMode = { BindTarget = visualMode }, IsActiveArea = { Value = true }, ReportUserBest = () => recordResult(betterSide == 0), }, new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(DifficultyLevel) : (int?)null) { Width = 0.5f, + VisualMode = { BindTarget = visualMode }, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, ReportUserBest = () => recordResult(betterSide == 1) diff --git a/osu.Game/Screens/Utility/LatencyVisualMode.cs b/osu.Game/Screens/Utility/LatencyVisualMode.cs new file mode 100644 index 0000000000..55dab86f9e --- /dev/null +++ b/osu.Game/Screens/Utility/LatencyVisualMode.cs @@ -0,0 +1,13 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable +namespace osu.Game.Screens.Utility +{ + public enum LatencyVisualMode + { + Simple, + CircleGameplay, + ScrollingGameplay, + } +} diff --git a/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs b/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs new file mode 100644 index 0000000000..753310c3b3 --- /dev/null +++ b/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs @@ -0,0 +1,67 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; +using osu.Framework.Input.Events; +using osu.Game.Overlays; +using osuTK; +using osuTK.Input; + +namespace osu.Game.Screens.Utility.SampleComponents +{ + public class LatencyCursorContainer : CompositeDrawable + { + private Circle cursor = null!; + private InputManager inputManager = null!; + + private readonly BindableBool isActive; + + [Resolved] + private OverlayColourProvider overlayColourProvider { get; set; } = null!; + + public LatencyCursorContainer(BindableBool isActive) + { + this.isActive = isActive; + Masking = true; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + InternalChild = cursor = new Circle + { + Size = new Vector2(40), + Origin = Anchor.Centre, + Colour = overlayColourProvider.Colour2, + }; + + inputManager = GetContainingInputManager(); + } + + protected override bool OnHover(HoverEvent e) => false; + + protected override void Update() + { + cursor.Colour = inputManager.CurrentState.Mouse.IsPressed(MouseButton.Left) ? overlayColourProvider.Content1 : overlayColourProvider.Colour2; + + if (isActive.Value) + { + cursor.Position = ToLocalSpace(inputManager.CurrentState.Mouse.Position); + cursor.Alpha = 1; + } + else + { + cursor.Alpha = 0; + } + + base.Update(); + } + } +} diff --git a/osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs b/osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs new file mode 100644 index 0000000000..418d45489f --- /dev/null +++ b/osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs @@ -0,0 +1,102 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; +using osu.Framework.Input.Events; +using osu.Game.Overlays; +using osuTK; +using osuTK.Input; + +namespace osu.Game.Screens.Utility.SampleComponents +{ + public class LatencyMovableBox : CompositeDrawable + { + private Box box = null!; + private InputManager inputManager = null!; + + private readonly BindableBool isActive; + + [Resolved] + private OverlayColourProvider overlayColourProvider { get; set; } = null!; + + public LatencyMovableBox(BindableBool isActive) + { + this.isActive = isActive; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + inputManager = GetContainingInputManager(); + + InternalChild = box = new Box + { + Size = new Vector2(40), + RelativePositionAxes = Axes.Both, + Position = new Vector2(0.5f), + Origin = Anchor.Centre, + Colour = overlayColourProvider.Colour1, + }; + } + + protected override bool OnHover(HoverEvent e) => false; + + private double? lastFrameTime; + + protected override void Update() + { + base.Update(); + + if (!isActive.Value) + { + lastFrameTime = null; + box.Colour = overlayColourProvider.Colour1; + return; + } + + if (lastFrameTime != null) + { + float movementAmount = (float)(Clock.CurrentTime - lastFrameTime) / 400; + + var buttons = inputManager.CurrentState.Keyboard.Keys; + + box.Colour = buttons.HasAnyButtonPressed ? overlayColourProvider.Content1 : overlayColourProvider.Colour1; + + foreach (var key in buttons) + { + switch (key) + { + case Key.F: + case Key.Up: + box.Y = MathHelper.Clamp(box.Y - movementAmount, 0.1f, 0.9f); + break; + + case Key.K: + case Key.Down: + box.Y = MathHelper.Clamp(box.Y + movementAmount, 0.1f, 0.9f); + break; + + case Key.Z: + case Key.Left: + box.X = MathHelper.Clamp(box.X - movementAmount, 0.1f, 0.9f); + break; + + case Key.X: + case Key.Right: + box.X = MathHelper.Clamp(box.X + movementAmount, 0.1f, 0.9f); + break; + } + } + } + + lastFrameTime = Clock.CurrentTime; + } + } +} diff --git a/osu.Game/Screens/Utility/ScrollingGameplay.cs b/osu.Game/Screens/Utility/ScrollingGameplay.cs new file mode 100644 index 0000000000..31920d27e7 --- /dev/null +++ b/osu.Game/Screens/Utility/ScrollingGameplay.cs @@ -0,0 +1,12 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Screens.Utility +{ + public class ScrollingGameplay : CompositeDrawable + { + } +} From e9547542ead87b0f2df143f191daf0d4d74009e0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 17:17:09 +0900 Subject: [PATCH 1543/2328] Add circle gameplay --- osu.Game/Screens/Utility/CircleGameplay.cs | 163 ++++++++++++++++++++- 1 file changed, 162 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs index 0667a54ced..abd7c40532 100644 --- a/osu.Game/Screens/Utility/CircleGameplay.cs +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -2,11 +2,172 @@ // See the LICENCE file in the repository root for full licence text. #nullable enable +using System; +using System.Collections.Generic; +using osu.Framework.Audio.Track; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Scoring; +using osuTK; +using osuTK.Graphics; namespace osu.Game.Screens.Utility { - public class CircleGameplay : CompositeDrawable + public class CircleGameplay : BeatSyncedContainer { + private int nextLocation; + + private OsuSpriteText unstableRate = null!; + + private readonly List hitEvents = new List(); + + protected override void LoadComplete() + { + base.LoadComplete(); + + InternalChildren = new Drawable[] + { + unstableRate = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = OsuFont.Default.With(size: 24) + } + }; + } + + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes) + { + base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + + nextLocation++; + + Vector2 location; + + switch (nextLocation % 4) + { + default: + location = new Vector2(0.25f, 0.25f); + break; + + case 1: + location = new Vector2(0.75f, 0.75f); + break; + + case 2: + location = new Vector2(0.75f, 0.25f); + break; + + case 3: + location = new Vector2(0.25f, 0.75f); + break; + } + + AddInternal(new SampleHitCircle(Clock.CurrentTime + timingPoint.BeatLength) + { + RelativePositionAxes = Axes.Both, + Position = location, + Hit = hit, + }); + } + + private void hit(HitEvent h) + { + hitEvents.Add(h); + unstableRate.Text = $"{hitEvents.CalculateUnstableRate():N1}"; + } + + public class SampleHitCircle : CompositeDrawable + { + public HitEvent? HitEvent; + + public Action? Hit { get; set; } + + public readonly double HitTime; + + private readonly CircularContainer approach; + private readonly Circle circle; + + private const float size = 100; + + public SampleHitCircle(double hitTime) + { + HitTime = hitTime; + + Origin = Anchor.Centre; + + AutoSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + circle = new Circle + { + Colour = Color4.White, + Size = new Vector2(size), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + approach = new CircularContainer + { + BorderColour = Color4.Yellow, + Size = new Vector2(size), + Masking = true, + BorderThickness = 4, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new Box + { + Colour = Color4.Black, + Alpha = 0, + AlwaysPresent = true, + RelativeSizeAxes = Axes.Both, + }, + } + }, + }; + } + + protected override bool OnMouseDown(MouseDownEvent e) + { + if (HitEvent != null) + return false; + + approach.Expire(); + + circle + .FadeOut(200) + .ScaleTo(1.5f, 200); + + HitEvent = new HitEvent(Clock.CurrentTime - HitTime, HitResult.Good, new HitObject + { + HitWindows = new HitWindows(), + }, null, null); + + Hit?.Invoke(HitEvent.Value); + + this.Delay(200).Expire(); + + return true; + } + + protected override void Update() + { + base.Update(); + + approach.Scale = new Vector2((float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / 40, 1, 100)); + + if (Clock.CurrentTime > HitTime + 80) + Expire(); + } + } } } From c657ef272287d0c83d57f652363b23abb55eb2cb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 17:27:06 +0900 Subject: [PATCH 1544/2328] Add ability to adjust spacing --- osu.Game/Screens/Utility/CircleGameplay.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs index abd7c40532..c97b5dd7a7 100644 --- a/osu.Game/Screens/Utility/CircleGameplay.cs +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -51,22 +51,27 @@ namespace osu.Game.Screens.Utility Vector2 location; + const float spacing = 0.1f; + + const float spacing_low = 0.5f - spacing; + const float spacing_high = 0.5f + spacing; + switch (nextLocation % 4) { default: - location = new Vector2(0.25f, 0.25f); + location = new Vector2(spacing_low, spacing_low); break; case 1: - location = new Vector2(0.75f, 0.75f); + location = new Vector2(spacing_high, spacing_high); break; case 2: - location = new Vector2(0.75f, 0.25f); + location = new Vector2(spacing_high, spacing_low); break; case 3: - location = new Vector2(0.25f, 0.75f); + location = new Vector2(spacing_low, spacing_high); break; } @@ -97,6 +102,9 @@ namespace osu.Game.Screens.Utility private const float size = 100; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) + => circle.ReceivePositionalInputAt(screenSpacePos); + public SampleHitCircle(double hitTime) { HitTime = hitTime; @@ -163,7 +171,7 @@ namespace osu.Game.Screens.Utility { base.Update(); - approach.Scale = new Vector2((float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / 40, 1, 100)); + approach.Scale = new Vector2((float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / 60, 1, 100)); if (Clock.CurrentTime > HitTime + 80) Expire(); From d46739ff0bc53f5dc2bceaa3894c3d9509ab99e0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 18:18:18 +0900 Subject: [PATCH 1545/2328] Add circle gameplay test coverage --- .../Visual/Settings/TestSceneLatencyCertifierScreen.cs | 6 ++++++ osu.Game/Screens/Utility/LatencyCertifierScreen.cs | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs index af6681e9cf..079796df2e 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs @@ -24,6 +24,12 @@ namespace osu.Game.Tests.Visual.Settings AddUntilStep("wait for load", () => latencyCertifier.IsLoaded); } + [Test] + public void TestCircleGameplay() + { + AddStep("set visual mode to circles", () => latencyCertifier.VisualMode.Value = LatencyVisualMode.CircleGameplay); + } + [Test] public void TestCertification() { diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 00821ab773..658e0537c6 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -63,7 +63,7 @@ namespace osu.Game.Screens.Utility [Resolved] private FrameworkConfigManager config { get; set; } = null!; - private readonly Bindable visualMode = new Bindable(); + public readonly Bindable VisualMode = new Bindable(); private const int rounds_to_complete = 5; @@ -187,7 +187,7 @@ Do whatever you need to try and perceive the difference in latency, then choose switch (e.Key) { case Key.Space: - visualMode.Value = (LatencyVisualMode)(((int)visualMode.Value + 1) % 3); + VisualMode.Value = (LatencyVisualMode)(((int)VisualMode.Value + 1) % 3); return true; case Key.Tab: @@ -396,14 +396,14 @@ Do whatever you need to try and perceive the difference in latency, then choose new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(DifficultyLevel) : (int?)null) { Width = 0.5f, - VisualMode = { BindTarget = visualMode }, + VisualMode = { BindTarget = VisualMode }, IsActiveArea = { Value = true }, ReportUserBest = () => recordResult(betterSide == 0), }, new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(DifficultyLevel) : (int?)null) { Width = 0.5f, - VisualMode = { BindTarget = visualMode }, + VisualMode = { BindTarget = VisualMode }, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, ReportUserBest = () => recordResult(betterSide == 1) From 5c7d29cd31de5b62ba70cd37ff1904b2747fcd73 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 18:18:24 +0900 Subject: [PATCH 1546/2328] Remove dependency on game-wide audio --- osu.Game/Screens/Utility/CircleGameplay.cs | 38 +++++++++++++++------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs index c97b5dd7a7..2847f1b84d 100644 --- a/osu.Game/Screens/Utility/CircleGameplay.cs +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -4,14 +4,11 @@ #nullable enable using System; using System.Collections.Generic; -using osu.Framework.Audio.Track; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; -using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; -using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; @@ -20,7 +17,7 @@ using osuTK.Graphics; namespace osu.Game.Screens.Utility { - public class CircleGameplay : BeatSyncedContainer + public class CircleGameplay : CompositeDrawable { private int nextLocation; @@ -28,6 +25,12 @@ namespace osu.Game.Screens.Utility private readonly List hitEvents = new List(); + private int? lastGeneratedBeat; + + private const double beat_length = 500; + private const double approach_rate_milliseconds = 100; + private const float spacing = 0.1f; + protected override void LoadComplete() { base.LoadComplete(); @@ -43,16 +46,26 @@ namespace osu.Game.Screens.Utility }; } - protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes) + protected override void Update() { - base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + base.Update(); + int nextBeat = (int)(Clock.CurrentTime / beat_length); + + if (lastGeneratedBeat == null || nextBeat != lastGeneratedBeat) + { + // generate four beats ahead to allow time for beats to display. + newBeat(nextBeat + 4); + lastGeneratedBeat = nextBeat; + } + } + + private void newBeat(int index) + { nextLocation++; Vector2 location; - const float spacing = 0.1f; - const float spacing_low = 0.5f - spacing; const float spacing_high = 0.5f + spacing; @@ -75,7 +88,7 @@ namespace osu.Game.Screens.Utility break; } - AddInternal(new SampleHitCircle(Clock.CurrentTime + timingPoint.BeatLength) + AddInternal(new SampleHitCircle(index * beat_length) { RelativePositionAxes = Axes.Both, Position = location, @@ -113,6 +126,8 @@ namespace osu.Game.Screens.Utility AutoSizeAxes = Axes.Both; + AlwaysPresent = true; + InternalChildren = new Drawable[] { circle = new Circle @@ -171,9 +186,10 @@ namespace osu.Game.Screens.Utility { base.Update(); - approach.Scale = new Vector2((float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / 60, 1, 100)); + approach.Scale = new Vector2(1 + (float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / approach_rate_milliseconds, 0, 100)); + Alpha = (float)MathHelper.Clamp((Clock.CurrentTime - HitTime + 600) / 400, 0, 1); - if (Clock.CurrentTime > HitTime + 80) + if (Clock.CurrentTime > HitTime + 200) Expire(); } } From 5deaa42e9feaa8b9dfe5610e32225015d2f95df0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 18:20:15 +0900 Subject: [PATCH 1547/2328] Stop music on entering latency certification screen --- osu.Game/Screens/Utility/LatencyCertifierScreen.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 658e0537c6..2570db0e24 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -87,6 +87,9 @@ namespace osu.Game.Screens.Utility [Resolved] private GameHost host { get; set; } = null!; + [Resolved] + private MusicController musicController { get; set; } = null!; + public LatencyCertifierScreen() { InternalChildren = new Drawable[] @@ -166,6 +169,8 @@ Do whatever you need to try and perceive the difference in latency, then choose config.SetValue(FrameworkSetting.FrameSync, FrameSync.Unlimited); host.UpdateThread.ActiveHz = target_host_update_frames; host.AllowBenchmarkUnlimitedFrames = true; + + musicController.Stop(); } public override bool OnExiting(ScreenExitEvent e) From ba14d646c337a0e31e021a6077a2417e5f3d7729 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 18:27:58 +0900 Subject: [PATCH 1548/2328] Add static configuration --- osu.Game/Screens/Utility/CircleGameplay.cs | 79 ++++++++++++++++------ 1 file changed, 59 insertions(+), 20 deletions(-) diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs index 2847f1b84d..91bf582fd6 100644 --- a/osu.Game/Screens/Utility/CircleGameplay.cs +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -4,12 +4,15 @@ #nullable enable using System; using System.Collections.Generic; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; using osuTK; @@ -25,11 +28,11 @@ namespace osu.Game.Screens.Utility private readonly List hitEvents = new List(); - private int? lastGeneratedBeat; + private double? lastGeneratedBeatTime; - private const double beat_length = 500; - private const double approach_rate_milliseconds = 100; - private const float spacing = 0.1f; + private static readonly BindableDouble beat_length = new BindableDouble(500) { MinValue = 200, MaxValue = 1000 }; + private static readonly BindableDouble approach_rate_milliseconds = new BindableDouble(100) { MinValue = 50, MaxValue = 500 }; + private static readonly BindableFloat spacing = new BindableFloat(0.2f) { MinValue = 0.05f, MaxValue = 0.4f }; protected override void LoadComplete() { @@ -37,12 +40,40 @@ namespace osu.Game.Screens.Utility InternalChildren = new Drawable[] { + new FillFlowContainer + { + AutoSizeAxes = Axes.Y, + Width = 400, + Spacing = new Vector2(2), + Direction = FillDirection.Vertical, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new SettingsSlider + { + LabelText = "time spacing", + Current = beat_length + }, + new SettingsSlider + { + LabelText = "visual spacing", + Current = spacing + }, + new SettingsSlider + { + LabelText = "approach time", + Current = approach_rate_milliseconds + }, + } + }, unstableRate = new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = OsuFont.Default.With(size: 24) - } + Font = OsuFont.Default.With(size: 24), + Y = -100, + }, }; } @@ -50,45 +81,53 @@ namespace osu.Game.Screens.Utility { base.Update(); - int nextBeat = (int)(Clock.CurrentTime / beat_length); + // We want to generate a few hit objects ahead of the current time (to allow them to animate). - if (lastGeneratedBeat == null || nextBeat != lastGeneratedBeat) + int nextBeat = (int)(Clock.CurrentTime / beat_length.Value) + 1; + + double generateUpTo = (nextBeat + 2) * beat_length.Value; + + while (lastGeneratedBeatTime == null || lastGeneratedBeatTime < generateUpTo) { - // generate four beats ahead to allow time for beats to display. - newBeat(nextBeat + 4); - lastGeneratedBeat = nextBeat; + double time = ++nextBeat * beat_length.Value; + + if (time <= lastGeneratedBeatTime) + continue; + + newBeat(time); + lastGeneratedBeatTime = time; } } - private void newBeat(int index) + private void newBeat(double time) { nextLocation++; Vector2 location; - const float spacing_low = 0.5f - spacing; - const float spacing_high = 0.5f + spacing; + float spacingLow = 0.5f - spacing.Value; + float spacingHigh = 0.5f + spacing.Value; switch (nextLocation % 4) { default: - location = new Vector2(spacing_low, spacing_low); + location = new Vector2(spacingLow, spacingLow); break; case 1: - location = new Vector2(spacing_high, spacing_high); + location = new Vector2(spacingHigh, spacingHigh); break; case 2: - location = new Vector2(spacing_high, spacing_low); + location = new Vector2(spacingHigh, spacingLow); break; case 3: - location = new Vector2(spacing_low, spacing_high); + location = new Vector2(spacingLow, spacingHigh); break; } - AddInternal(new SampleHitCircle(index * beat_length) + AddInternal(new SampleHitCircle(time) { RelativePositionAxes = Axes.Both, Position = location, @@ -186,7 +225,7 @@ namespace osu.Game.Screens.Utility { base.Update(); - approach.Scale = new Vector2(1 + (float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / approach_rate_milliseconds, 0, 100)); + approach.Scale = new Vector2(1 + (float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / approach_rate_milliseconds.Value, 0, 100)); Alpha = (float)MathHelper.Clamp((Clock.CurrentTime - HitTime + 600) / 400, 0, 1); if (Clock.CurrentTime > HitTime + 200) From 7f4a54096f41fef7073153df5bbc8ce8e7bc30af Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 18:37:53 +0900 Subject: [PATCH 1549/2328] Fix circles in the future being hittable --- osu.Game/Screens/Utility/CircleGameplay.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs index 91bf582fd6..c55c10dcb8 100644 --- a/osu.Game/Screens/Utility/CircleGameplay.cs +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -203,6 +203,9 @@ namespace osu.Game.Screens.Utility if (HitEvent != null) return false; + if (Math.Abs(Clock.CurrentTime - HitTime) > 200) + return false; + approach.Expire(); circle @@ -225,11 +228,14 @@ namespace osu.Game.Screens.Utility { base.Update(); - approach.Scale = new Vector2(1 + (float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / approach_rate_milliseconds.Value, 0, 100)); - Alpha = (float)MathHelper.Clamp((Clock.CurrentTime - HitTime + 600) / 400, 0, 1); + if (HitEvent == null) + { + approach.Scale = new Vector2(1 + (float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / approach_rate_milliseconds.Value, 0, 100)); + Alpha = (float)MathHelper.Clamp((Clock.CurrentTime - HitTime + 600) / 400, 0, 1); - if (Clock.CurrentTime > HitTime + 200) - Expire(); + if (Clock.CurrentTime > HitTime + 200) + Expire(); + } } } } From 2f1c331f65027aed7c3dafaf89d8717521728af9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 19:33:01 +0900 Subject: [PATCH 1550/2328] Move shared logic to `LatencySampleComponent` and implement key support for circle gameplay --- osu.Game/Screens/Utility/CircleGameplay.cs | 56 ++++++++++++------- osu.Game/Screens/Utility/LatencyArea.cs | 9 +-- .../LatencyCursorContainer.cs | 24 +++----- .../SampleComponents/LatencyMovableBox.cs | 36 +++--------- .../LatencySampleComponent.cs | 43 ++++++++++++++ 5 files changed, 101 insertions(+), 67 deletions(-) create mode 100644 osu.Game/Screens/Utility/SampleComponents/LatencySampleComponent.cs diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs index c55c10dcb8..bc3342fa3f 100644 --- a/osu.Game/Screens/Utility/CircleGameplay.cs +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -8,13 +8,14 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; +using osu.Game.Screens.Utility.SampleComponents; using osuTK; using osuTK.Graphics; @@ -141,7 +142,7 @@ namespace osu.Game.Screens.Utility unstableRate.Text = $"{hitEvents.CalculateUnstableRate():N1}"; } - public class SampleHitCircle : CompositeDrawable + public class SampleHitCircle : LatencySampleComponent { public HitEvent? HitEvent; @@ -198,6 +199,8 @@ namespace osu.Game.Screens.Utility }; } + protected override bool OnHover(HoverEvent e) => true; + protected override bool OnMouseDown(MouseDownEvent e) { if (HitEvent != null) @@ -206,6 +209,37 @@ namespace osu.Game.Screens.Utility if (Math.Abs(Clock.CurrentTime - HitTime) > 200) return false; + attemptHit(); + return true; + } + + protected override bool OnKeyDown(KeyDownEvent e) + { + if (!IsActive.Value) + return false; + + if (IsHovered) + attemptHit(); + return base.OnKeyDown(e); + } + + protected override void UpdateAtLimitedRate(InputState inputState) + { + if (HitEvent == null) + { + approach.Scale = new Vector2(1 + (float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / approach_rate_milliseconds.Value, 0, 100)); + Alpha = (float)MathHelper.Clamp((Clock.CurrentTime - HitTime + 600) / 400, 0, 1); + + if (Clock.CurrentTime > HitTime + 200) + Expire(); + } + } + + private void attemptHit() => Schedule(() => + { + if (HitEvent != null) + return; + approach.Expire(); circle @@ -220,23 +254,7 @@ namespace osu.Game.Screens.Utility Hit?.Invoke(HitEvent.Value); this.Delay(200).Expire(); - - return true; - } - - protected override void Update() - { - base.Update(); - - if (HitEvent == null) - { - approach.Scale = new Vector2(1 + (float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / approach_rate_milliseconds.Value, 0, 100)); - Alpha = (float)MathHelper.Clamp((Clock.CurrentTime - HitTime + 600) / 400, 0, 1); - - if (Clock.CurrentTime > HitTime + 200) - Expire(); - } - } + }); } } } diff --git a/osu.Game/Screens/Utility/LatencyArea.cs b/osu.Game/Screens/Utility/LatencyArea.cs index 5b48a10a49..21688f0b0c 100644 --- a/osu.Game/Screens/Utility/LatencyArea.cs +++ b/osu.Game/Screens/Utility/LatencyArea.cs @@ -16,6 +16,7 @@ using osuTK.Input; namespace osu.Game.Screens.Utility { + [Cached] public class LatencyArea : CompositeDrawable { [Resolved] @@ -82,11 +83,11 @@ namespace osu.Game.Screens.Utility case LatencyVisualMode.Simple: visualContent.Children = new Drawable[] { - new LatencyMovableBox(IsActiveArea) + new LatencyMovableBox { RelativeSizeAxes = Axes.Both, }, - new LatencyCursorContainer(IsActiveArea) + new LatencyCursorContainer { RelativeSizeAxes = Axes.Both, }, @@ -100,7 +101,7 @@ namespace osu.Game.Screens.Utility { RelativeSizeAxes = Axes.Both, }, - new LatencyCursorContainer(IsActiveArea) + new LatencyCursorContainer { RelativeSizeAxes = Axes.Both, }, @@ -114,7 +115,7 @@ namespace osu.Game.Screens.Utility { RelativeSizeAxes = Axes.Both, }, - new LatencyCursorContainer(IsActiveArea) + new LatencyCursorContainer { RelativeSizeAxes = Axes.Both, }, diff --git a/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs b/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs index 753310c3b3..e4c2b504cb 100644 --- a/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs +++ b/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs @@ -3,31 +3,25 @@ #nullable enable using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; using osu.Framework.Input.Events; +using osu.Framework.Input.States; using osu.Game.Overlays; using osuTK; using osuTK.Input; namespace osu.Game.Screens.Utility.SampleComponents { - public class LatencyCursorContainer : CompositeDrawable + public class LatencyCursorContainer : LatencySampleComponent { private Circle cursor = null!; - private InputManager inputManager = null!; - - private readonly BindableBool isActive; [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } = null!; - public LatencyCursorContainer(BindableBool isActive) + public LatencyCursorContainer() { - this.isActive = isActive; Masking = true; } @@ -41,27 +35,23 @@ namespace osu.Game.Screens.Utility.SampleComponents Origin = Anchor.Centre, Colour = overlayColourProvider.Colour2, }; - - inputManager = GetContainingInputManager(); } protected override bool OnHover(HoverEvent e) => false; - protected override void Update() + protected override void UpdateAtLimitedRate(InputState inputState) { - cursor.Colour = inputManager.CurrentState.Mouse.IsPressed(MouseButton.Left) ? overlayColourProvider.Content1 : overlayColourProvider.Colour2; + cursor.Colour = inputState.Mouse.IsPressed(MouseButton.Left) ? overlayColourProvider.Content1 : overlayColourProvider.Colour2; - if (isActive.Value) + if (IsActive.Value) { - cursor.Position = ToLocalSpace(inputManager.CurrentState.Mouse.Position); + cursor.Position = ToLocalSpace(inputState.Mouse.Position); cursor.Alpha = 1; } else { cursor.Alpha = 0; } - - base.Update(); } } } diff --git a/osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs b/osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs index 418d45489f..56c8aa2ed5 100644 --- a/osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs +++ b/osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs @@ -2,47 +2,31 @@ // See the LICENCE file in the repository root for full licence text. #nullable enable -using osu.Framework.Allocation; -using osu.Framework.Bindables; + using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; using osu.Framework.Input.Events; -using osu.Game.Overlays; +using osu.Framework.Input.States; using osuTK; using osuTK.Input; namespace osu.Game.Screens.Utility.SampleComponents { - public class LatencyMovableBox : CompositeDrawable + public class LatencyMovableBox : LatencySampleComponent { private Box box = null!; - private InputManager inputManager = null!; - - private readonly BindableBool isActive; - - [Resolved] - private OverlayColourProvider overlayColourProvider { get; set; } = null!; - - public LatencyMovableBox(BindableBool isActive) - { - this.isActive = isActive; - } protected override void LoadComplete() { base.LoadComplete(); - inputManager = GetContainingInputManager(); - InternalChild = box = new Box { Size = new Vector2(40), RelativePositionAxes = Axes.Both, Position = new Vector2(0.5f), Origin = Anchor.Centre, - Colour = overlayColourProvider.Colour1, + Colour = OverlayColourProvider.Colour1, }; } @@ -50,14 +34,12 @@ namespace osu.Game.Screens.Utility.SampleComponents private double? lastFrameTime; - protected override void Update() + protected override void UpdateAtLimitedRate(InputState inputState) { - base.Update(); - - if (!isActive.Value) + if (!IsActive.Value) { lastFrameTime = null; - box.Colour = overlayColourProvider.Colour1; + box.Colour = OverlayColourProvider.Colour1; return; } @@ -65,9 +47,9 @@ namespace osu.Game.Screens.Utility.SampleComponents { float movementAmount = (float)(Clock.CurrentTime - lastFrameTime) / 400; - var buttons = inputManager.CurrentState.Keyboard.Keys; + var buttons = inputState.Keyboard.Keys; - box.Colour = buttons.HasAnyButtonPressed ? overlayColourProvider.Content1 : overlayColourProvider.Colour1; + box.Colour = buttons.HasAnyButtonPressed ? OverlayColourProvider.Content1 : OverlayColourProvider.Colour1; foreach (var key in buttons) { diff --git a/osu.Game/Screens/Utility/SampleComponents/LatencySampleComponent.cs b/osu.Game/Screens/Utility/SampleComponents/LatencySampleComponent.cs new file mode 100644 index 0000000000..03f6b46852 --- /dev/null +++ b/osu.Game/Screens/Utility/SampleComponents/LatencySampleComponent.cs @@ -0,0 +1,43 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics.Containers; +using osu.Framework.Input; +using osu.Framework.Input.States; +using osu.Game.Overlays; + +namespace osu.Game.Screens.Utility.SampleComponents +{ + public abstract class LatencySampleComponent : CompositeDrawable + { + protected readonly BindableBool IsActive = new BindableBool(); + + private InputManager inputManager = null!; + + [Resolved] + private LatencyArea latencyArea { get; set; } = null!; + + [Resolved] + protected OverlayColourProvider OverlayColourProvider { get; private set; } = null!; + + protected override void LoadComplete() + { + base.LoadComplete(); + + inputManager = GetContainingInputManager(); + IsActive.BindTo(latencyArea.IsActiveArea); + } + + protected sealed override void Update() + { + base.Update(); + UpdateAtLimitedRate(inputManager.CurrentState); + } + + protected abstract void UpdateAtLimitedRate(InputState inputState); + } +} From 41d16c613da5a93cc48b97f8b62ab00ff480bd11 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 19:35:21 +0900 Subject: [PATCH 1551/2328] Fix being able to hit way too early using keyboard --- osu.Game/Screens/Utility/CircleGameplay.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs index bc3342fa3f..d31b98fe6e 100644 --- a/osu.Game/Screens/Utility/CircleGameplay.cs +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -218,6 +218,9 @@ namespace osu.Game.Screens.Utility if (!IsActive.Value) return false; + if (Math.Abs(Clock.CurrentTime - HitTime) > 200) + return false; + if (IsHovered) attemptHit(); return base.OnKeyDown(e); @@ -240,6 +243,10 @@ namespace osu.Game.Screens.Utility if (HitEvent != null) return; + // in case it was hit outside of display range, show immediately + // so the user isn't confused. + this.FadeIn(); + approach.Expire(); circle From a6fd61c4448a4e77495f41a95f04a8abcaeb6999 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 19:42:07 +0900 Subject: [PATCH 1552/2328] Default to circle gameplay mode --- osu.Game/Screens/Utility/LatencyVisualMode.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Utility/LatencyVisualMode.cs b/osu.Game/Screens/Utility/LatencyVisualMode.cs index 55dab86f9e..cc15f79be8 100644 --- a/osu.Game/Screens/Utility/LatencyVisualMode.cs +++ b/osu.Game/Screens/Utility/LatencyVisualMode.cs @@ -6,8 +6,8 @@ namespace osu.Game.Screens.Utility { public enum LatencyVisualMode { - Simple, CircleGameplay, ScrollingGameplay, + Simple, } } From ef5c1a1ecbd51d82b92fc6490c540a4c002d3fd3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 19:42:17 +0900 Subject: [PATCH 1553/2328] Improve visuals of circle gameplay mode --- osu.Game/Screens/Utility/CircleGameplay.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs index d31b98fe6e..9fb8eb2761 100644 --- a/osu.Game/Screens/Utility/CircleGameplay.cs +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -4,6 +4,7 @@ #nullable enable using System; using System.Collections.Generic; +using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -17,7 +18,6 @@ using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Utility.SampleComponents; using osuTK; -using osuTK.Graphics; namespace osu.Game.Screens.Utility { @@ -150,8 +150,8 @@ namespace osu.Game.Screens.Utility public readonly double HitTime; - private readonly CircularContainer approach; - private readonly Circle circle; + private CircularContainer approach = null!; + private Circle circle = null!; private const float size = 100; @@ -163,23 +163,25 @@ namespace osu.Game.Screens.Utility HitTime = hitTime; Origin = Anchor.Centre; - AutoSizeAxes = Axes.Both; - AlwaysPresent = true; + } + [BackgroundDependencyLoader] + private void load() + { InternalChildren = new Drawable[] { circle = new Circle { - Colour = Color4.White, + Colour = OverlayColourProvider.Content1, Size = new Vector2(size), Anchor = Anchor.Centre, Origin = Anchor.Centre, }, approach = new CircularContainer { - BorderColour = Color4.Yellow, + BorderColour = OverlayColourProvider.Colour1, Size = new Vector2(size), Masking = true, BorderThickness = 4, @@ -189,7 +191,6 @@ namespace osu.Game.Screens.Utility { new Box { - Colour = Color4.Black, Alpha = 0, AlwaysPresent = true, RelativeSizeAxes = Axes.Both, From 837958b254943d025914db3c664ba1784137aeba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 19:43:09 +0900 Subject: [PATCH 1554/2328] Remove scrolling gameplay mode for now --- osu.Game/Screens/Utility/LatencyArea.cs | 14 -------------- osu.Game/Screens/Utility/LatencyVisualMode.cs | 1 - 2 files changed, 15 deletions(-) diff --git a/osu.Game/Screens/Utility/LatencyArea.cs b/osu.Game/Screens/Utility/LatencyArea.cs index 21688f0b0c..3b9e95ce16 100644 --- a/osu.Game/Screens/Utility/LatencyArea.cs +++ b/osu.Game/Screens/Utility/LatencyArea.cs @@ -108,20 +108,6 @@ namespace osu.Game.Screens.Utility }; break; - case LatencyVisualMode.ScrollingGameplay: - visualContent.Children = new Drawable[] - { - new ScrollingGameplay - { - RelativeSizeAxes = Axes.Both, - }, - new LatencyCursorContainer - { - RelativeSizeAxes = Axes.Both, - }, - }; - break; - default: throw new ArgumentOutOfRangeException(); } diff --git a/osu.Game/Screens/Utility/LatencyVisualMode.cs b/osu.Game/Screens/Utility/LatencyVisualMode.cs index cc15f79be8..f9f51f0829 100644 --- a/osu.Game/Screens/Utility/LatencyVisualMode.cs +++ b/osu.Game/Screens/Utility/LatencyVisualMode.cs @@ -7,7 +7,6 @@ namespace osu.Game.Screens.Utility public enum LatencyVisualMode { CircleGameplay, - ScrollingGameplay, Simple, } } From 18f74b2840fd2e3ecc8bb8322262e5fa5c3a6a98 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 20:04:51 +0900 Subject: [PATCH 1555/2328] Move settings and bindables to a sane location --- osu.Game/Screens/Utility/CircleGameplay.cs | 68 +++++++------------ .../Screens/Utility/LatencyCertifierScreen.cs | 60 ++++++++++++++-- .../LatencySampleComponent.cs | 12 ++++ 3 files changed, 90 insertions(+), 50 deletions(-) diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs index 9fb8eb2761..4bfc10548f 100644 --- a/osu.Game/Screens/Utility/CircleGameplay.cs +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -13,7 +12,6 @@ using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Utility.SampleComponents; @@ -21,7 +19,7 @@ using osuTK; namespace osu.Game.Screens.Utility { - public class CircleGameplay : CompositeDrawable + public class CircleGameplay : LatencySampleComponent { private int nextLocation; @@ -31,9 +29,7 @@ namespace osu.Game.Screens.Utility private double? lastGeneratedBeatTime; - private static readonly BindableDouble beat_length = new BindableDouble(500) { MinValue = 200, MaxValue = 1000 }; - private static readonly BindableDouble approach_rate_milliseconds = new BindableDouble(100) { MinValue = 50, MaxValue = 500 }; - private static readonly BindableFloat spacing = new BindableFloat(0.2f) { MinValue = 0.05f, MaxValue = 0.4f }; + private Container circles = null!; protected override void LoadComplete() { @@ -41,33 +37,6 @@ namespace osu.Game.Screens.Utility InternalChildren = new Drawable[] { - new FillFlowContainer - { - AutoSizeAxes = Axes.Y, - Width = 400, - Spacing = new Vector2(2), - Direction = FillDirection.Vertical, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Children = new Drawable[] - { - new SettingsSlider - { - LabelText = "time spacing", - Current = beat_length - }, - new SettingsSlider - { - LabelText = "visual spacing", - Current = spacing - }, - new SettingsSlider - { - LabelText = "approach time", - Current = approach_rate_milliseconds - }, - } - }, unstableRate = new OsuSpriteText { Anchor = Anchor.Centre, @@ -75,22 +44,31 @@ namespace osu.Game.Screens.Utility Font = OsuFont.Default.With(size: 24), Y = -100, }, + circles = new Container + { + RelativeSizeAxes = Axes.Both, + }, }; + + SampleBPM.BindValueChanged(_ => + { + circles.Clear(); + lastGeneratedBeatTime = null; + }); } - protected override void Update() + protected override void UpdateAtLimitedRate(InputState inputState) { - base.Update(); + double beatLength = 60000 / SampleBPM.Value; + + int nextBeat = (int)(Clock.CurrentTime / beatLength) + 1; // We want to generate a few hit objects ahead of the current time (to allow them to animate). - - int nextBeat = (int)(Clock.CurrentTime / beat_length.Value) + 1; - - double generateUpTo = (nextBeat + 2) * beat_length.Value; + double generateUpTo = (nextBeat + 2) * beatLength; while (lastGeneratedBeatTime == null || lastGeneratedBeatTime < generateUpTo) { - double time = ++nextBeat * beat_length.Value; + double time = ++nextBeat * beatLength; if (time <= lastGeneratedBeatTime) continue; @@ -106,8 +84,8 @@ namespace osu.Game.Screens.Utility Vector2 location; - float spacingLow = 0.5f - spacing.Value; - float spacingHigh = 0.5f + spacing.Value; + float spacingLow = 0.5f - SampleVisualSpacing.Value; + float spacingHigh = 0.5f + SampleVisualSpacing.Value; switch (nextLocation % 4) { @@ -128,7 +106,7 @@ namespace osu.Game.Screens.Utility break; } - AddInternal(new SampleHitCircle(time) + circles.Add(new SampleHitCircle(time) { RelativePositionAxes = Axes.Both, Position = location, @@ -139,7 +117,7 @@ namespace osu.Game.Screens.Utility private void hit(HitEvent h) { hitEvents.Add(h); - unstableRate.Text = $"{hitEvents.CalculateUnstableRate():N1}"; + unstableRate.Text = $"UR: {hitEvents.CalculateUnstableRate()}"; } public class SampleHitCircle : LatencySampleComponent @@ -231,7 +209,7 @@ namespace osu.Game.Screens.Utility { if (HitEvent == null) { - approach.Scale = new Vector2(1 + (float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / approach_rate_milliseconds.Value, 0, 100)); + approach.Scale = new Vector2(1 + (float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / SampleApproachRate.Value, 0, 100)); Alpha = (float)MathHelper.Clamp((Clock.CurrentTime - HitTime + 600) / 400, 0, 1); if (Clock.CurrentTime > HitTime + 200) diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 2570db0e24..79736ea17d 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -25,11 +25,13 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Overlays; +using osu.Game.Overlays.Settings; using osuTK; using osuTK.Input; namespace osu.Game.Screens.Utility { + [Cached] public class LatencyCertifierScreen : OsuScreen { private FrameSync previousFrameSyncMode; @@ -49,6 +51,10 @@ namespace osu.Game.Screens.Utility private readonly Container resultsArea; + public readonly BindableDouble SampleBPM = new BindableDouble(120) { MinValue = 60, MaxValue = 300 }; + public readonly BindableDouble SampleApproachRate = new BindableDouble(100) { MinValue = 50, MaxValue = 500 }; + public readonly BindableFloat SampleVisualSpacing = new BindableFloat(0.2f) { MinValue = 0.05f, MaxValue = 0.3f }; + /// /// The rate at which the game host should attempt to run. /// @@ -84,6 +90,8 @@ namespace osu.Game.Screens.Utility private double lastPoll; private int pollingMax; + private readonly FillFlowContainer settings; + [Resolved] private GameHost host { get; set; } = null!; @@ -122,19 +130,30 @@ namespace osu.Game.Screens.Utility Anchor = Anchor.TopCentre, Origin = Anchor.TopRight, }, - explanatoryText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + settings = new FillFlowContainer { + Name = "Settings", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Padding = new MarginPadding(10), + Spacing = new Vector2(2), + Direction = FillDirection.Vertical, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - TextAnchor = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Text = @"Welcome to the latency certifier! + Child = explanatoryText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + TextAnchor = Anchor.TopCentre, + Text = @"Welcome to the latency certifier! Use the arrow keys, Z/X/F/J to control the display. Use the Tab key to change focus. Change display modes with Space. Do whatever you need to try and perceive the difference in latency, then choose your best side. ", + }, }, resultsArea = new Container { @@ -423,6 +442,37 @@ Do whatever you need to try and perceive the difference in latency, then choose mainArea.Children.First(a => a != area).IsActiveArea.Value = false; }); } + + settings.AddRange(new Drawable[] + { + new SettingsSlider + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.None, + Width = 400, + LabelText = "bpm", + Current = SampleBPM + }, + new SettingsSlider + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.None, + Width = 400, + LabelText = "visual spacing", + Current = SampleVisualSpacing + }, + new SettingsSlider + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.None, + Width = 400, + LabelText = "approach rate", + Current = SampleApproachRate + }, + }); } private void recordResult(bool correct) diff --git a/osu.Game/Screens/Utility/SampleComponents/LatencySampleComponent.cs b/osu.Game/Screens/Utility/SampleComponents/LatencySampleComponent.cs index 03f6b46852..c3233d5aa5 100644 --- a/osu.Game/Screens/Utility/SampleComponents/LatencySampleComponent.cs +++ b/osu.Game/Screens/Utility/SampleComponents/LatencySampleComponent.cs @@ -14,6 +14,10 @@ namespace osu.Game.Screens.Utility.SampleComponents { public abstract class LatencySampleComponent : CompositeDrawable { + protected readonly BindableDouble SampleBPM = new BindableDouble(); + protected readonly BindableDouble SampleApproachRate = new BindableDouble(); + protected readonly BindableFloat SampleVisualSpacing = new BindableFloat(); + protected readonly BindableBool IsActive = new BindableBool(); private InputManager inputManager = null!; @@ -24,6 +28,14 @@ namespace osu.Game.Screens.Utility.SampleComponents [Resolved] protected OverlayColourProvider OverlayColourProvider { get; private set; } = null!; + [BackgroundDependencyLoader] + private void load(LatencyCertifierScreen latencyCertifierScreen) + { + SampleBPM.BindTo(latencyCertifierScreen.SampleBPM); + SampleApproachRate.BindTo(latencyCertifierScreen.SampleApproachRate); + SampleVisualSpacing.BindTo(latencyCertifierScreen.SampleVisualSpacing); + } + protected override void LoadComplete() { base.LoadComplete(); From 213ccfb74330bc4f7b42068e6be881213cbf25ee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 20:08:53 +0900 Subject: [PATCH 1556/2328] Improve explanation text and add link to wiki --- .../Screens/Utility/LatencyCertifierScreen.cs | 18 +++++++++--------- .../SampleComponents/LatencyMovableBox.cs | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 79736ea17d..bcdba370f5 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -45,7 +45,7 @@ namespace osu.Game.Screens.Utility public override float BackgroundParallaxAmount => 0; - private readonly OsuTextFlowContainer explanatoryText; + private readonly LinkFlowContainer explanatoryText; private readonly Container mainArea; @@ -134,25 +134,19 @@ namespace osu.Game.Screens.Utility { Name = "Settings", AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, + Width = 800, Padding = new MarginPadding(10), Spacing = new Vector2(2), Direction = FillDirection.Vertical, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Child = explanatoryText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + Child = explanatoryText = new LinkFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, TextAnchor = Anchor.TopCentre, - Text = @"Welcome to the latency certifier! -Use the arrow keys, Z/X/F/J to control the display. -Use the Tab key to change focus. -Change display modes with Space. -Do whatever you need to try and perceive the difference in latency, then choose your best side. -", }, }, resultsArea = new Container @@ -169,6 +163,12 @@ Do whatever you need to try and perceive the difference in latency, then choose AutoSizeAxes = Axes.Y, }, }; + + explanatoryText.AddParagraph(@"Welcome to the latency certifier!"); + explanatoryText.AddParagraph(@"Do whatever you need to try and perceive the difference in latency, then choose your best side. Read more about the methodology "); + explanatoryText.AddLink("here", "https://github.com/ppy/osu/wiki/Latency-and-unlimited-frame-rates"); + explanatoryText.AddParagraph(@"Use the arrow keys or Z/X/F/J to control the display."); + explanatoryText.AddParagraph(@"Tab key to change focus. Space to change display mode"); } protected override bool OnMouseMove(MouseMoveEvent e) diff --git a/osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs b/osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs index 56c8aa2ed5..a7da05fbb1 100644 --- a/osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs +++ b/osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs @@ -60,7 +60,7 @@ namespace osu.Game.Screens.Utility.SampleComponents box.Y = MathHelper.Clamp(box.Y - movementAmount, 0.1f, 0.9f); break; - case Key.K: + case Key.J: case Key.Down: box.Y = MathHelper.Clamp(box.Y + movementAmount, 0.1f, 0.9f); break; From b956a916c1309f3fd599938dfea6fea39c152217 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 20:21:03 +0900 Subject: [PATCH 1557/2328] Make units sane --- osu.Game/Screens/Utility/CircleGameplay.cs | 11 ++++++++--- osu.Game/Screens/Utility/LatencyCertifierScreen.cs | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs index 4bfc10548f..5f08367336 100644 --- a/osu.Game/Screens/Utility/CircleGameplay.cs +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Framework.Input.States; +using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Objects; @@ -84,8 +85,10 @@ namespace osu.Game.Screens.Utility Vector2 location; - float spacingLow = 0.5f - SampleVisualSpacing.Value; - float spacingHigh = 0.5f + SampleVisualSpacing.Value; + float adjust = SampleVisualSpacing.Value * 0.25f; + + float spacingLow = 0.5f - adjust; + float spacingHigh = 0.5f + adjust; switch (nextLocation % 4) { @@ -209,7 +212,9 @@ namespace osu.Game.Screens.Utility { if (HitEvent == null) { - approach.Scale = new Vector2(1 + (float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / SampleApproachRate.Value, 0, 100)); + double preempt = (float)IBeatmapDifficultyInfo.DifficultyRange(SampleApproachRate.Value, 1800, 1200, 450); + + approach.Scale = new Vector2(1 + 4 * (float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / preempt, 0, 100)); Alpha = (float)MathHelper.Clamp((Clock.CurrentTime - HitTime + 600) / 400, 0, 1); if (Clock.CurrentTime > HitTime + 200) diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index bcdba370f5..251a94e705 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -52,8 +52,8 @@ namespace osu.Game.Screens.Utility private readonly Container resultsArea; public readonly BindableDouble SampleBPM = new BindableDouble(120) { MinValue = 60, MaxValue = 300 }; - public readonly BindableDouble SampleApproachRate = new BindableDouble(100) { MinValue = 50, MaxValue = 500 }; - public readonly BindableFloat SampleVisualSpacing = new BindableFloat(0.2f) { MinValue = 0.05f, MaxValue = 0.3f }; + public readonly BindableDouble SampleApproachRate = new BindableDouble(9) { MinValue = 5, MaxValue = 12, Precision = 0.1 }; + public readonly BindableFloat SampleVisualSpacing = new BindableFloat(0.5f) { MinValue = 0f, MaxValue = 1, Precision = 0.1f }; /// /// The rate at which the game host should attempt to run. From 8ce545ff9d87f13706ed77182988b9baeb2dec2c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 20:25:33 +0900 Subject: [PATCH 1558/2328] Fix visuals in circle gameplay and greedy hover --- osu.Game/Screens/Utility/CircleGameplay.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs index 5f08367336..47129c7581 100644 --- a/osu.Game/Screens/Utility/CircleGameplay.cs +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -120,7 +120,7 @@ namespace osu.Game.Screens.Utility private void hit(HitEvent h) { hitEvents.Add(h); - unstableRate.Text = $"UR: {hitEvents.CalculateUnstableRate()}"; + unstableRate.Text = $"UR: {hitEvents.CalculateUnstableRate():N0}"; } public class SampleHitCircle : LatencySampleComponent @@ -149,7 +149,7 @@ namespace osu.Game.Screens.Utility } [BackgroundDependencyLoader] - private void load() + private void load(OsuColour colours) { InternalChildren = new Drawable[] { @@ -162,7 +162,7 @@ namespace osu.Game.Screens.Utility }, approach = new CircularContainer { - BorderColour = OverlayColourProvider.Colour1, + BorderColour = colours.Blue, Size = new Vector2(size), Masking = true, BorderThickness = 4, @@ -181,8 +181,6 @@ namespace osu.Game.Screens.Utility }; } - protected override bool OnHover(HoverEvent e) => true; - protected override bool OnMouseDown(MouseDownEvent e) { if (HitEvent != null) From 096d6df8684d5eda673ef6f081c3c744ee4f5daa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jun 2022 20:33:01 +0900 Subject: [PATCH 1559/2328] Fix regression in testing and setting logic --- .../TestSceneLatencyCertifierScreen.cs | 1 - .../Screens/Utility/LatencyCertifierScreen.cs | 78 +++++++++---------- 2 files changed, 38 insertions(+), 41 deletions(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs index 079796df2e..ee18afcbaf 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs @@ -44,7 +44,6 @@ namespace osu.Game.Tests.Visual.Settings clickUntilResults(true); AddAssert("check at results", () => !latencyCertifier.ChildrenOfType().Any()); - AddAssert("check no buttons", () => !latencyCertifier.ChildrenOfType().Any()); checkDifficulty(1); } diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 251a94e705..00b6a25ac3 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -90,8 +90,6 @@ namespace osu.Game.Screens.Utility private double lastPoll; private int pollingMax; - private readonly FillFlowContainer settings; - [Resolved] private GameHost host { get; set; } = null!; @@ -130,7 +128,7 @@ namespace osu.Game.Screens.Utility Anchor = Anchor.TopCentre, Origin = Anchor.TopRight, }, - settings = new FillFlowContainer + new FillFlowContainer { Name = "Settings", AutoSizeAxes = Axes.Y, @@ -140,13 +138,43 @@ namespace osu.Game.Screens.Utility Direction = FillDirection.Vertical, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Child = explanatoryText = new LinkFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + Children = new Drawable[] { - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - TextAnchor = Anchor.TopCentre, + explanatoryText = new LinkFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + TextAnchor = Anchor.TopCentre, + }, + new SettingsSlider + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.None, + Width = 400, + LabelText = "bpm", + Current = SampleBPM + }, + new SettingsSlider + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.None, + Width = 400, + LabelText = "visual spacing", + Current = SampleVisualSpacing + }, + new SettingsSlider + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.None, + Width = 400, + LabelText = "approach rate", + Current = SampleApproachRate + }, }, }, resultsArea = new Container @@ -227,6 +255,7 @@ namespace osu.Game.Screens.Utility private void showResults() { mainArea.Clear(); + resultsArea.Clear(); var displayMode = host.Window?.CurrentDisplayMode.Value; @@ -442,37 +471,6 @@ namespace osu.Game.Screens.Utility mainArea.Children.First(a => a != area).IsActiveArea.Value = false; }); } - - settings.AddRange(new Drawable[] - { - new SettingsSlider - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.None, - Width = 400, - LabelText = "bpm", - Current = SampleBPM - }, - new SettingsSlider - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.None, - Width = 400, - LabelText = "visual spacing", - Current = SampleVisualSpacing - }, - new SettingsSlider - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.None, - Width = 400, - LabelText = "approach rate", - Current = SampleApproachRate - }, - }); } private void recordResult(bool correct) From e3418f570ab76610fb7c4658263e3686b843c2e7 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Mon, 25 Apr 2022 22:48:12 -0700 Subject: [PATCH 1560/2328] Fix app version not updating on windows uninstaller entry --- osu.Desktop/Program.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 405f0a8006..f95348aa3f 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -113,6 +113,9 @@ namespace osu.Desktop { tools.CreateShortcutForThisExe(); tools.CreateUninstallerRegistryEntry(); + }, onAppUpdate: (version, tools) => + { + tools.CreateUninstallerRegistryEntry(); }, onAppUninstall: (version, tools) => { tools.RemoveShortcutForThisExe(); From 8562641560345f3c000a63ea1c9a15baf9853507 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 11 Jun 2022 12:48:31 +0900 Subject: [PATCH 1561/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 155a21bacb..3b70df82c2 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b6218c5950..19ec7ebcd0 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index ba57aba01b..c971612f62 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 06f070c3ec118a6f1b8df8430c5c046b0c4bed3f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 11 Jun 2022 14:58:16 +0300 Subject: [PATCH 1562/2328] Fix latency certifier potentially reporting infinite mouse polling rate --- osu.Game/Screens/Utility/LatencyCertifierScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 0a9d98450f..5c12dd3a83 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -147,7 +147,7 @@ Do whatever you need to try and perceive the difference in latency, then choose protected override bool OnMouseMove(MouseMoveEvent e) { - if (lastPoll > 0) + if (lastPoll > 0 && Clock.CurrentTime != lastPoll) pollingMax = (int)Math.Max(pollingMax, 1000 / (Clock.CurrentTime - lastPoll)); lastPoll = Clock.CurrentTime; return base.OnMouseMove(e); From 68da9f038661544f54c3a102e0a13527d3a3945d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 11 Jun 2022 21:27:44 +0900 Subject: [PATCH 1563/2328] Add explicit precision for BPM adjustment Co-authored-by: Salman Ahmed --- osu.Game/Screens/Utility/LatencyCertifierScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 00b6a25ac3..2195298ff1 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Utility private readonly Container resultsArea; - public readonly BindableDouble SampleBPM = new BindableDouble(120) { MinValue = 60, MaxValue = 300 }; + public readonly BindableDouble SampleBPM = new BindableDouble(120) { MinValue = 60, MaxValue = 300, Precision = 1 }; public readonly BindableDouble SampleApproachRate = new BindableDouble(9) { MinValue = 5, MaxValue = 12, Precision = 0.1 }; public readonly BindableFloat SampleVisualSpacing = new BindableFloat(0.5f) { MinValue = 0f, MaxValue = 1, Precision = 0.1f }; From d130e7ebff5167f48f4d39ef108aa33abc98dc80 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 11 Jun 2022 21:30:33 +0900 Subject: [PATCH 1564/2328] Remove `ScrollingGameplay` class for now --- osu.Game/Screens/Utility/ScrollingGameplay.cs | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 osu.Game/Screens/Utility/ScrollingGameplay.cs diff --git a/osu.Game/Screens/Utility/ScrollingGameplay.cs b/osu.Game/Screens/Utility/ScrollingGameplay.cs deleted file mode 100644 index 31920d27e7..0000000000 --- a/osu.Game/Screens/Utility/ScrollingGameplay.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -#nullable enable -using osu.Framework.Graphics.Containers; - -namespace osu.Game.Screens.Utility -{ - public class ScrollingGameplay : CompositeDrawable - { - } -} From c697dc90e4ae1fca938104920a3092519aa220b7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 11 Jun 2022 21:32:02 +0900 Subject: [PATCH 1565/2328] Hide settings at results screen --- osu.Game/Screens/Utility/LatencyCertifierScreen.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 2195298ff1..558a16db6d 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -90,6 +90,8 @@ namespace osu.Game.Screens.Utility private double lastPoll; private int pollingMax; + private readonly FillFlowContainer settings; + [Resolved] private GameHost host { get; set; } = null!; @@ -128,7 +130,7 @@ namespace osu.Game.Screens.Utility Anchor = Anchor.TopCentre, Origin = Anchor.TopRight, }, - new FillFlowContainer + settings = new FillFlowContainer { Name = "Settings", AutoSizeAxes = Axes.Y, @@ -256,6 +258,7 @@ namespace osu.Game.Screens.Utility { mainArea.Clear(); resultsArea.Clear(); + settings.Hide(); var displayMode = host.Window?.CurrentDisplayMode.Value; @@ -437,6 +440,8 @@ namespace osu.Game.Screens.Utility private void loadNextRound() { + settings.Show(); + attemptsAtCurrentDifficulty++; statusText.Text = $"Level {DifficultyLevel}\nRound {attemptsAtCurrentDifficulty} of {totalRoundForNextResultsScreen}"; From 0c333e5c0884ece7e336e1656fafd56a2e5a9650 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 11 Jun 2022 21:34:00 +0900 Subject: [PATCH 1566/2328] Link directly to methodology section Co-authored-by: Salman Ahmed --- osu.Game/Screens/Utility/LatencyCertifierScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 558a16db6d..6bd07ac1a4 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -196,7 +196,7 @@ namespace osu.Game.Screens.Utility explanatoryText.AddParagraph(@"Welcome to the latency certifier!"); explanatoryText.AddParagraph(@"Do whatever you need to try and perceive the difference in latency, then choose your best side. Read more about the methodology "); - explanatoryText.AddLink("here", "https://github.com/ppy/osu/wiki/Latency-and-unlimited-frame-rates"); + explanatoryText.AddLink("here", "https://github.com/ppy/osu/wiki/Latency-and-unlimited-frame-rates#methodology"); explanatoryText.AddParagraph(@"Use the arrow keys or Z/X/F/J to control the display."); explanatoryText.AddParagraph(@"Tab key to change focus. Space to change display mode"); } From 8d53ed64a3d8da3d3925a8675c9eb590cf878141 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 11 Jun 2022 21:36:41 +0900 Subject: [PATCH 1567/2328] Fix mode cycling and add test coverage --- .../Visual/Settings/TestSceneLatencyCertifierScreen.cs | 6 ++++++ osu.Game/Screens/Utility/LatencyCertifierScreen.cs | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs index ee18afcbaf..151d9236ea 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs @@ -30,6 +30,12 @@ namespace osu.Game.Tests.Visual.Settings AddStep("set visual mode to circles", () => latencyCertifier.VisualMode.Value = LatencyVisualMode.CircleGameplay); } + [Test] + public void TestCycleVisualModes() + { + AddRepeatStep("cycle mode", () => InputManager.Key(Key.Space), 6); + } + [Test] public void TestCertification() { diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 6bd07ac1a4..514fa42248 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -241,7 +241,8 @@ namespace osu.Game.Screens.Utility switch (e.Key) { case Key.Space: - VisualMode.Value = (LatencyVisualMode)(((int)VisualMode.Value + 1) % 3); + int availableModes = Enum.GetValues(typeof(LatencyVisualMode)).Length; + VisualMode.Value = (LatencyVisualMode)(((int)VisualMode.Value + 1) % availableModes); return true; case Key.Tab: From 419b5791c968e15889150d24beabd1e971ee9783 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 11 Jun 2022 15:50:34 +0300 Subject: [PATCH 1568/2328] Move circle duration to constant --- osu.Game/Screens/Utility/CircleGameplay.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs index 47129c7581..6c7cc0b80b 100644 --- a/osu.Game/Screens/Utility/CircleGameplay.cs +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -135,6 +135,7 @@ namespace osu.Game.Screens.Utility private Circle circle = null!; private const float size = 100; + private const float duration = 200; public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => circle.ReceivePositionalInputAt(screenSpacePos); @@ -186,7 +187,7 @@ namespace osu.Game.Screens.Utility if (HitEvent != null) return false; - if (Math.Abs(Clock.CurrentTime - HitTime) > 200) + if (Math.Abs(Clock.CurrentTime - HitTime) > duration) return false; attemptHit(); @@ -198,7 +199,7 @@ namespace osu.Game.Screens.Utility if (!IsActive.Value) return false; - if (Math.Abs(Clock.CurrentTime - HitTime) > 200) + if (Math.Abs(Clock.CurrentTime - HitTime) > duration) return false; if (IsHovered) @@ -215,7 +216,7 @@ namespace osu.Game.Screens.Utility approach.Scale = new Vector2(1 + 4 * (float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / preempt, 0, 100)); Alpha = (float)MathHelper.Clamp((Clock.CurrentTime - HitTime + 600) / 400, 0, 1); - if (Clock.CurrentTime > HitTime + 200) + if (Clock.CurrentTime > HitTime + duration) Expire(); } } @@ -232,8 +233,8 @@ namespace osu.Game.Screens.Utility approach.Expire(); circle - .FadeOut(200) - .ScaleTo(1.5f, 200); + .FadeOut(duration) + .ScaleTo(1.5f, duration); HitEvent = new HitEvent(Clock.CurrentTime - HitTime, HitResult.Good, new HitObject { @@ -242,7 +243,7 @@ namespace osu.Game.Screens.Utility Hit?.Invoke(HitEvent.Value); - this.Delay(200).Expire(); + this.Delay(duration).Expire(); }); } } From 5b3b9a2cd34541a20abee4d53f8e12621fff2090 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 11 Jun 2022 16:21:22 +0300 Subject: [PATCH 1569/2328] Add test coverage for "simple" mode --- .../Visual/Settings/TestSceneLatencyCertifierScreen.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs index 151d9236ea..d6e0f995e5 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs @@ -24,6 +24,12 @@ namespace osu.Game.Tests.Visual.Settings AddUntilStep("wait for load", () => latencyCertifier.IsLoaded); } + [Test] + public void TestSimple() + { + AddStep("set visual mode to simple", () => latencyCertifier.VisualMode.Value = LatencyVisualMode.Simple); + } + [Test] public void TestCircleGameplay() { From 52c8cea27dc8e0400fd125b80e262378b8a79153 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 11 Jun 2022 22:30:56 +0900 Subject: [PATCH 1570/2328] Update spectator/multiplayer endpoint in line with new deployment --- osu.Game/Online/ProductionEndpointConfiguration.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/ProductionEndpointConfiguration.cs b/osu.Game/Online/ProductionEndpointConfiguration.cs index e44dad1db5..c6ddc03564 100644 --- a/osu.Game/Online/ProductionEndpointConfiguration.cs +++ b/osu.Game/Online/ProductionEndpointConfiguration.cs @@ -10,8 +10,8 @@ namespace osu.Game.Online WebsiteRootUrl = APIEndpointUrl = @"https://osu.ppy.sh"; APIClientSecret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk"; APIClientID = "5"; - SpectatorEndpointUrl = "https://spectator2.ppy.sh/spectator"; - MultiplayerEndpointUrl = "https://spectator2.ppy.sh/multiplayer"; + SpectatorEndpointUrl = "https://spectator.ppy.sh/spectator"; + MultiplayerEndpointUrl = "https://spectator.ppy.sh/multiplayer"; } } } From af353c37c0b1a021d409aecfc267799abd0a2023 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 11 Jun 2022 23:54:11 +0900 Subject: [PATCH 1571/2328] Don't show UR for now --- osu.Game/Screens/Utility/CircleGameplay.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs index 6c7cc0b80b..d710b26738 100644 --- a/osu.Game/Screens/Utility/CircleGameplay.cs +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -120,7 +120,10 @@ namespace osu.Game.Screens.Utility private void hit(HitEvent h) { hitEvents.Add(h); - unstableRate.Text = $"UR: {hitEvents.CalculateUnstableRate():N0}"; + + // Disabled to keep things simple based on internal feedback nothing it's not helpful. + // Can be reconsidered in the future. + // unstableRate.Text = $"UR: {hitEvents.CalculateUnstableRate():N0}"; } public class SampleHitCircle : LatencySampleComponent From 486f762f44cf3d1c7173e01c23cab5135307e388 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sun, 12 Jun 2022 00:13:35 +0900 Subject: [PATCH 1572/2328] Fix inspection by removing unstable rate code --- osu.Game/Screens/Utility/CircleGameplay.cs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs index d710b26738..dd59721a65 100644 --- a/osu.Game/Screens/Utility/CircleGameplay.cs +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. #nullable enable + using System; using System.Collections.Generic; using osu.Framework.Allocation; @@ -12,7 +13,6 @@ using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Utility.SampleComponents; @@ -24,8 +24,6 @@ namespace osu.Game.Screens.Utility { private int nextLocation; - private OsuSpriteText unstableRate = null!; - private readonly List hitEvents = new List(); private double? lastGeneratedBeatTime; @@ -38,13 +36,6 @@ namespace osu.Game.Screens.Utility InternalChildren = new Drawable[] { - unstableRate = new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Font = OsuFont.Default.With(size: 24), - Y = -100, - }, circles = new Container { RelativeSizeAxes = Axes.Both, @@ -120,10 +111,6 @@ namespace osu.Game.Screens.Utility private void hit(HitEvent h) { hitEvents.Add(h); - - // Disabled to keep things simple based on internal feedback nothing it's not helpful. - // Can be reconsidered in the future. - // unstableRate.Text = $"UR: {hitEvents.CalculateUnstableRate():N0}"; } public class SampleHitCircle : LatencySampleComponent From 038021f682c5fcbc9fd4f6a34bda5e5f9db5e659 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 11 Jun 2022 20:24:50 +0300 Subject: [PATCH 1573/2328] Add failing test case --- .../Visual/Editing/TestSceneComposerSelection.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs b/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs index dddd9f07ab..7fe98b9f09 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets; +using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Objects; @@ -61,6 +62,21 @@ namespace osu.Game.Tests.Visual.Editing AddUntilStep("context menu is visible", () => contextMenuContainer.ChildrenOfType().Single().State == MenuState.Open); } + [Test] + public void TestSelectAndShowContextMenuOutsideBounds() + { + var addedObject = new HitCircle { StartTime = 100, Position = OsuPlayfield.BASE_SIZE }; + AddStep("add hitobject", () => EditorBeatmap.Add(addedObject)); + + AddStep("descale blueprint container", () => this.ChildrenOfType().Single().Scale = new Vector2(0.5f)); + AddStep("move mouse to bottom-right", () => InputManager.MoveMouseTo(blueprintContainer.ScreenSpaceDrawQuad.BottomRight + new Vector2(20))); + + AddStep("right click", () => InputManager.Click(MouseButton.Right)); + + AddUntilStep("hitobject selected", () => EditorBeatmap.SelectedHitObjects.Single() == addedObject); + AddUntilStep("context menu is visible", () => contextMenuContainer.ChildrenOfType().Single().State == MenuState.Open); + } + [Test] public void TestNudgeSelection() { From 85fc218edf0d8f2c688af226265ef3e9373c5a4c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 11 Jun 2022 20:53:53 +0300 Subject: [PATCH 1574/2328] Provide context menu items at `BlueprintContainer` for out-of-bounds support --- .../Compose/Components/BlueprintContainer.cs | 30 ++++++++++++++++++- .../Components/EditorSelectionHandler.cs | 2 +- .../Compose/Components/SelectionHandler.cs | 28 ++--------------- .../Skinning/Editor/SkinSelectionHandler.cs | 2 +- 4 files changed, 34 insertions(+), 28 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index d56dc176f6..5fdd7c0e81 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -11,11 +11,14 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Graphics.UserInterface; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets.Edit; using osuTK; using osuTK.Input; @@ -26,7 +29,7 @@ namespace osu.Game.Screens.Edit.Compose.Components /// A container which provides a "blueprint" display of items. /// Includes selection and manipulation support via a . /// - public abstract class BlueprintContainer : CompositeDrawable, IKeyBindingHandler + public abstract class BlueprintContainer : CompositeDrawable, IKeyBindingHandler, IHasContextMenu where T : class { protected DragBox DragBox { get; private set; } @@ -534,5 +537,30 @@ namespace osu.Game.Screens.Edit.Compose.Components } #endregion + + #region Context Menu + + public MenuItem[] ContextMenuItems + { + get + { + var selectedBlueprints = SelectionHandler.SelectedBlueprints; + if (!selectedBlueprints.Any(b => b.IsHovered)) + return Array.Empty(); + + var items = new List(); + + items.AddRange(SelectionHandler.GetContextMenuItemsForSelection(selectedBlueprints)); + + if (selectedBlueprints.Count == 1) + items.AddRange(selectedBlueprints[0].ContextMenuItems); + + items.Add(new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, SelectionHandler.DeleteSelected)); + + return items.ToArray(); + } + } + + #endregion } } diff --git a/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs index 7f693996a4..5fa98aea01 100644 --- a/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs +++ b/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs @@ -165,7 +165,7 @@ namespace osu.Game.Screens.Edit.Compose.Components /// /// The current selection. /// The relevant menu items. - protected override IEnumerable GetContextMenuItemsForSelection(IEnumerable> selection) + protected internal override IEnumerable GetContextMenuItemsForSelection(IEnumerable> selection) { if (SelectedBlueprints.All(b => b.Item is IHasComboInformation)) { diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs index 78b98a3649..d4ffb67a51 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs @@ -8,7 +8,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; @@ -17,7 +16,6 @@ using osu.Framework.Input.Events; using osu.Framework.Utils; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; -using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets.Edit; using osuTK; using osuTK.Input; @@ -27,7 +25,7 @@ namespace osu.Game.Screens.Edit.Compose.Components /// /// A component which outlines items and handles movement of selections. /// - public abstract class SelectionHandler : CompositeDrawable, IKeyBindingHandler, IKeyBindingHandler, IHasContextMenu + public abstract class SelectionHandler : CompositeDrawable, IKeyBindingHandler, IKeyBindingHandler { /// /// The currently selected blueprints. @@ -292,7 +290,7 @@ namespace osu.Game.Screens.Edit.Compose.Components return true; } - protected void DeleteSelected() + protected internal void DeleteSelected() { DeleteItems(selectedBlueprints.Select(b => b.Item)); } @@ -345,32 +343,12 @@ namespace osu.Game.Screens.Edit.Compose.Components #region Context Menu - public MenuItem[] ContextMenuItems - { - get - { - if (!SelectedBlueprints.Any(b => b.IsHovered)) - return Array.Empty(); - - var items = new List(); - - items.AddRange(GetContextMenuItemsForSelection(SelectedBlueprints)); - - if (SelectedBlueprints.Count == 1) - items.AddRange(SelectedBlueprints[0].ContextMenuItems); - - items.Add(new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, DeleteSelected)); - - return items.ToArray(); - } - } - /// /// Provide context menu items relevant to current selection. Calling base is not required. /// /// The current selection. /// The relevant menu items. - protected virtual IEnumerable GetContextMenuItemsForSelection(IEnumerable> selection) + protected internal virtual IEnumerable GetContextMenuItemsForSelection(IEnumerable> selection) => Enumerable.Empty(); #endregion diff --git a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs index 943425e099..3ead8fee17 100644 --- a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs +++ b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs @@ -180,7 +180,7 @@ namespace osu.Game.Skinning.Editor protected override void DeleteItems(IEnumerable items) => skinEditor.DeleteItems(items.ToArray()); - protected override IEnumerable GetContextMenuItemsForSelection(IEnumerable> selection) + protected internal override IEnumerable GetContextMenuItemsForSelection(IEnumerable> selection) { var closestItem = new TernaryStateRadioMenuItem("Closest", MenuItemType.Standard, _ => applyClosestAnchors()) { From 20e7f32fd9b495f2437048a0cb1bddb549a3f92d Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 12 Jun 2022 17:53:10 +0300 Subject: [PATCH 1575/2328] Improve test case to work in headless --- osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs b/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs index 7fe98b9f09..17ca9da8f8 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs @@ -69,7 +69,7 @@ namespace osu.Game.Tests.Visual.Editing AddStep("add hitobject", () => EditorBeatmap.Add(addedObject)); AddStep("descale blueprint container", () => this.ChildrenOfType().Single().Scale = new Vector2(0.5f)); - AddStep("move mouse to bottom-right", () => InputManager.MoveMouseTo(blueprintContainer.ScreenSpaceDrawQuad.BottomRight + new Vector2(20))); + AddStep("move mouse to bottom-right", () => InputManager.MoveMouseTo(blueprintContainer.ToScreenSpace(blueprintContainer.LayoutRectangle.BottomRight + new Vector2(10)))); AddStep("right click", () => InputManager.Click(MouseButton.Right)); From 051aa8f028d8235c648331899e72d6cddd971b92 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 13 Jun 2022 04:43:14 +0300 Subject: [PATCH 1576/2328] Mark family strings as verbatim --- osu.Game/Graphics/OsuFont.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index edb484021c..080d952cbd 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -54,16 +54,16 @@ namespace osu.Game.Graphics switch (typeface) { case Typeface.Venera: - return "Venera"; + return @"Venera"; case Typeface.Torus: - return "Torus"; + return @"Torus"; case Typeface.TorusAlternate: - return "Torus-Alternate"; + return @"Torus-Alternate"; case Typeface.Inter: - return "Inter"; + return @"Inter"; } return null; From 79713556608b60d4e5b80fb23ad3322245dbfe69 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 13 Jun 2022 04:44:28 +0300 Subject: [PATCH 1577/2328] Fix torus "medium" weight not mapped to "regular" when using `With` --- osu.Game/Graphics/OsuFont.cs | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index 080d952cbd..44303b8527 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -35,7 +35,10 @@ namespace osu.Game.Graphics /// Whether all characters should be spaced the same distance apart. /// The . public static FontUsage GetFont(Typeface typeface = Typeface.Torus, float size = DEFAULT_FONT_SIZE, FontWeight weight = FontWeight.Medium, bool italics = false, bool fixedWidth = false) - => new FontUsage(GetFamilyString(typeface), size, GetWeightString(typeface, weight), getItalics(italics), fixedWidth); + { + string familyString = GetFamilyString(typeface); + return new FontUsage(familyString, size, GetWeightString(familyString, weight), getItalics(italics), fixedWidth); + } private static bool getItalics(in bool italicsRequested) { @@ -72,25 +75,17 @@ namespace osu.Game.Graphics /// /// Retrieves the string representation of a . /// - /// The . - /// The . - /// The string representation of in the specified . - public static string GetWeightString(Typeface typeface, FontWeight weight) + /// The font family. + /// The font weight. + /// The string representation of in the specified . + public static string GetWeightString(string family, FontWeight weight) { - if (typeface == Typeface.Torus && weight == FontWeight.Medium) + if (family == @"Torus" && weight == FontWeight.Medium) // torus doesn't have a medium; fallback to regular. weight = FontWeight.Regular; - return GetWeightString(GetFamilyString(typeface), weight); + return weight.ToString(); } - - /// - /// Retrieves the string representation of a . - /// - /// The family string. - /// The . - /// The string representation of in the specified . - public static string GetWeightString(string family, FontWeight weight) => weight.ToString(); } public static class OsuFontExtensions From 3aec0fe9b6c07348e71c4b929fe0d0e09a764c66 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 13 Jun 2022 04:45:07 +0300 Subject: [PATCH 1578/2328] Fix torus alternate not mapping "medium" weight to "regular" --- osu.Game/Graphics/OsuFont.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index 44303b8527..0cd3097af5 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -80,7 +80,7 @@ namespace osu.Game.Graphics /// The string representation of in the specified . public static string GetWeightString(string family, FontWeight weight) { - if (family == @"Torus" && weight == FontWeight.Medium) + if ((family == @"Torus" || family == @"Torus-Alternate") && weight == FontWeight.Medium) // torus doesn't have a medium; fallback to regular. weight = FontWeight.Regular; From dfc643fd8ccce3266ba5a0cd326466e118732e6e Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 13 Jun 2022 12:35:09 +0900 Subject: [PATCH 1579/2328] Match family string via GetFamilyString() --- osu.Game/Graphics/OsuFont.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index 0cd3097af5..9d4e97b88e 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -80,7 +80,7 @@ namespace osu.Game.Graphics /// The string representation of in the specified . public static string GetWeightString(string family, FontWeight weight) { - if ((family == @"Torus" || family == @"Torus-Alternate") && weight == FontWeight.Medium) + if ((family == GetFamilyString(Typeface.Torus) || family == GetFamilyString(Typeface.TorusAlternate)) && weight == FontWeight.Medium) // torus doesn't have a medium; fallback to regular. weight = FontWeight.Regular; From 77fcf35d1d56211e865fd8e774068cf20bb956d1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 Jun 2022 15:40:21 +0900 Subject: [PATCH 1580/2328] Remove unlimited frame limiter warning This should not be required now that we have a 1,000 Hz limiter in place. --- .../Localisation/GraphicsSettingsStrings.cs | 5 ---- .../Sections/Graphics/RendererSettings.cs | 23 +------------------ 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/osu.Game/Localisation/GraphicsSettingsStrings.cs b/osu.Game/Localisation/GraphicsSettingsStrings.cs index 1c9aa64df5..38355d9041 100644 --- a/osu.Game/Localisation/GraphicsSettingsStrings.cs +++ b/osu.Game/Localisation/GraphicsSettingsStrings.cs @@ -34,11 +34,6 @@ namespace osu.Game.Localisation /// public static LocalisableString ShowFPS => new TranslatableString(getKey(@"show_fps"), @"Show FPS"); - /// - /// "Using unlimited frame limiter can lead to stutters, bad performance and overheating. It will not improve perceived latency. "2x refresh rate" is recommended." - /// - public static LocalisableString UnlimitedFramesNote => new TranslatableString(getKey(@"unlimited_frames_note"), @"Using unlimited frame limiter can lead to stutters, bad performance and overheating. It will not improve perceived latency. ""2x refresh rate"" is recommended."); - /// /// "Layout" /// diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs index 8c3e45cd62..5ba8e724cf 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs @@ -15,8 +15,6 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { protected override LocalisableString Header => GraphicsSettingsStrings.RendererHeader; - private SettingsEnumDropdown frameLimiterDropdown; - [BackgroundDependencyLoader] private void load(FrameworkConfigManager config, OsuConfigManager osuConfig) { @@ -24,7 +22,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics Children = new Drawable[] { // TODO: this needs to be a custom dropdown at some point - frameLimiterDropdown = new SettingsEnumDropdown + new SettingsEnumDropdown { LabelText = GraphicsSettingsStrings.FrameLimiter, Current = config.GetBindable(FrameworkSetting.FrameSync) @@ -41,24 +39,5 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }, }; } - - protected override void LoadComplete() - { - base.LoadComplete(); - - frameLimiterDropdown.Current.BindValueChanged(limit => - { - switch (limit.NewValue) - { - case FrameSync.Unlimited: - frameLimiterDropdown.SetNoticeText(GraphicsSettingsStrings.UnlimitedFramesNote, true); - break; - - default: - frameLimiterDropdown.ClearNoticeText(); - break; - } - }, true); - } } } From 7e7716f942a5ef2df2e49c8783c9f1fa829614a3 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 13 Jun 2022 15:40:11 +0900 Subject: [PATCH 1581/2328] Support undo/redo for control points --- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 +- osu.Game/Screens/Edit/EditorBeatmap.cs | 59 ++++++----- .../Edit/LegacyEditorBeatmapPatcher.cs | 100 ++++++++++++------ 3 files changed, 105 insertions(+), 56 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index ff13e61360..25551d1ef6 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -143,7 +143,7 @@ namespace osu.Game.Beatmaps.Formats protected string CleanFilename(string path) => path.Trim('"').ToStandardisedPath(); - protected enum Section + public enum Section { General, Editor, diff --git a/osu.Game/Screens/Edit/EditorBeatmap.cs b/osu.Game/Screens/Edit/EditorBeatmap.cs index c9449f3259..577a8291ad 100644 --- a/osu.Game/Screens/Edit/EditorBeatmap.cs +++ b/osu.Game/Screens/Edit/EditorBeatmap.cs @@ -71,31 +71,7 @@ namespace osu.Game.Screens.Edit public EditorBeatmap(IBeatmap playableBeatmap, ISkin beatmapSkin = null, BeatmapInfo beatmapInfo = null) { PlayableBeatmap = playableBeatmap; - - // ensure we are not working with legacy control points. - // if we leave the legacy points around they will be applied over any local changes on - // ApplyDefaults calls. this should eventually be removed once the default logic is moved to the decoder/converter. - if (PlayableBeatmap.ControlPointInfo is LegacyControlPointInfo) - { - var newControlPoints = new ControlPointInfo(); - - foreach (var controlPoint in PlayableBeatmap.ControlPointInfo.AllControlPoints) - { - switch (controlPoint) - { - case DifficultyControlPoint _: - case SampleControlPoint _: - // skip legacy types. - continue; - - default: - newControlPoints.Add(controlPoint.Time, controlPoint); - break; - } - } - - playableBeatmap.ControlPointInfo = newControlPoints; - } + PlayableBeatmap.ControlPointInfo = ConvertControlPoints(PlayableBeatmap.ControlPointInfo); this.beatmapInfo = beatmapInfo ?? playableBeatmap.BeatmapInfo; @@ -108,6 +84,39 @@ namespace osu.Game.Screens.Edit trackStartTime(obj); } + /// + /// Converts a such that the resultant is non-legacy. + /// + /// The to convert. + /// The non-legacy . is returned if already non-legacy. + public static ControlPointInfo ConvertControlPoints(ControlPointInfo incoming) + { + // ensure we are not working with legacy control points. + // if we leave the legacy points around they will be applied over any local changes on + // ApplyDefaults calls. this should eventually be removed once the default logic is moved to the decoder/converter. + if (!(incoming is LegacyControlPointInfo)) + return incoming; + + var newControlPoints = new ControlPointInfo(); + + foreach (var controlPoint in incoming.AllControlPoints) + { + switch (controlPoint) + { + case DifficultyControlPoint _: + case SampleControlPoint _: + // skip legacy types. + continue; + + default: + newControlPoints.Add(controlPoint.Time, controlPoint); + break; + } + } + + return newControlPoints; + } + public BeatmapInfo BeatmapInfo { get => beatmapInfo; diff --git a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs index 3ed2a7efe2..ba9a7ed1a3 100644 --- a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs +++ b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs @@ -7,9 +7,11 @@ using System.Diagnostics; using System.IO; using System.Text; using DiffPlex; +using DiffPlex.Model; using osu.Framework.Audio.Track; using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Formats; using osu.Game.IO; using osu.Game.Skinning; using Decoder = osu.Game.Beatmaps.Formats.Decoder; @@ -32,61 +34,99 @@ namespace osu.Game.Screens.Edit { // Diff the beatmaps var result = new Differ().CreateLineDiffs(readString(currentState), readString(newState), true, false); + IBeatmap newBeatmap = null; + + editorBeatmap.BeginChange(); + processHitObjects(result, () => newBeatmap ??= readBeatmap(newState)); + processTimingPoints(result, () => newBeatmap ??= readBeatmap(newState)); + editorBeatmap.EndChange(); + } + + private void processTimingPoints(DiffResult result, Func getNewBeatmap) + { + findChangedIndices(result, LegacyDecoder.Section.TimingPoints, out var removedIndices, out var addedIndices); + + if (removedIndices.Count == 0 && addedIndices.Count == 0) + return; + + // Due to conversion from legacy to non-legacy control points, it becomes difficult to diff control points correctly. + // So instead _all_ control points are reloaded if _any_ control point is changed. + + var newControlPoints = EditorBeatmap.ConvertControlPoints(getNewBeatmap().ControlPointInfo); + + editorBeatmap.ControlPointInfo.Clear(); + foreach (var point in newControlPoints.AllControlPoints) + editorBeatmap.ControlPointInfo.Add(point.Time, point); + } + + private void processHitObjects(DiffResult result, Func getNewBeatmap) + { + findChangedIndices(result, LegacyDecoder.Section.HitObjects, out var removedIndices, out var addedIndices); + + foreach (int removed in removedIndices) + editorBeatmap.RemoveAt(removed); + + if (addedIndices.Count > 0) + { + var newBeatmap = getNewBeatmap(); + + foreach (int i in addedIndices) + editorBeatmap.Insert(i, newBeatmap.HitObjects[i]); + } + } + + private void findChangedIndices(DiffResult result, LegacyDecoder.Section section, out List removedIndices, out List addedIndices) + { + removedIndices = new List(); + addedIndices = new List(); // Find the index of [HitObject] sections. Lines changed prior to this index are ignored. - int oldHitObjectsIndex = Array.IndexOf(result.PiecesOld, "[HitObjects]"); - int newHitObjectsIndex = Array.IndexOf(result.PiecesNew, "[HitObjects]"); + int oldSectionStartIndex = Array.IndexOf(result.PiecesOld, $"[{section}]"); + int oldSectionEndIndex = Array.FindIndex(result.PiecesOld, oldSectionStartIndex + 1, s => s.StartsWith(@"[", StringComparison.Ordinal)); - Debug.Assert(oldHitObjectsIndex >= 0); - Debug.Assert(newHitObjectsIndex >= 0); + if (oldSectionEndIndex == -1) + oldSectionEndIndex = result.PiecesOld.Length; - var toRemove = new List(); - var toAdd = new List(); + int newSectionStartIndex = Array.IndexOf(result.PiecesNew, $"[{section}]"); + int newSectionEndIndex = Array.FindIndex(result.PiecesNew, newSectionStartIndex + 1, s => s.StartsWith(@"[", StringComparison.Ordinal)); + + if (newSectionEndIndex == -1) + newSectionEndIndex = result.PiecesOld.Length; + + Debug.Assert(oldSectionStartIndex >= 0); + Debug.Assert(newSectionStartIndex >= 0); foreach (var block in result.DiffBlocks) { - // Removed hitobjects + // Removed indices for (int i = 0; i < block.DeleteCountA; i++) { - int hoIndex = block.DeleteStartA + i - oldHitObjectsIndex - 1; + int objectIndex = block.DeleteStartA + i; - if (hoIndex < 0) + if (objectIndex <= oldSectionStartIndex || objectIndex >= oldSectionEndIndex) continue; - toRemove.Add(hoIndex); + removedIndices.Add(objectIndex - oldSectionStartIndex - 1); } - // Added hitobjects + // Added indices for (int i = 0; i < block.InsertCountB; i++) { - int hoIndex = block.InsertStartB + i - newHitObjectsIndex - 1; + int objectIndex = block.InsertStartB + i; - if (hoIndex < 0) + if (objectIndex <= newSectionStartIndex || objectIndex >= newSectionEndIndex) continue; - toAdd.Add(hoIndex); + addedIndices.Add(objectIndex - newSectionStartIndex - 1); } } // Sort the indices to ensure that removal + insertion indices don't get jumbled up post-removal or post-insertion. // This isn't strictly required, but the differ makes no guarantees about order. - toRemove.Sort(); - toAdd.Sort(); + removedIndices.Sort(); + addedIndices.Sort(); - editorBeatmap.BeginChange(); - - // Apply the changes. - for (int i = toRemove.Count - 1; i >= 0; i--) - editorBeatmap.RemoveAt(toRemove[i]); - - if (toAdd.Count > 0) - { - IBeatmap newBeatmap = readBeatmap(newState); - foreach (int i in toAdd) - editorBeatmap.Insert(i, newBeatmap.HitObjects[i]); - } - - editorBeatmap.EndChange(); + removedIndices.Reverse(); } private string readString(byte[] state) => Encoding.UTF8.GetString(state); From 776e7c0c718e531874247c5c5dca8c0294cd2a04 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 13 Jun 2022 15:40:18 +0900 Subject: [PATCH 1582/2328] Work around performance issues --- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index f498aa917e..015e7f5bc1 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -137,8 +137,12 @@ namespace osu.Game.Screens.Edit.Timing controlPointGroups.BindTo(Beatmap.ControlPointInfo.Groups); controlPointGroups.BindCollectionChanged((sender, args) => { - table.ControlGroups = controlPointGroups; - changeHandler?.SaveState(); + // This AddOnce() works around performance issues from the LegacyEditorBeatmapPatcher re-initialising all control points every undo & redo. + Scheduler.AddOnce(() => + { + table.ControlGroups = controlPointGroups; + changeHandler?.SaveState(); + }); }, true); } From 5a18547342d1c7a242052fb28ecc72159e128f0d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 13 Jun 2022 15:58:11 +0900 Subject: [PATCH 1583/2328] Compare by `char` Co-authored-by: Berkan Diler --- osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs index ba9a7ed1a3..c668778be2 100644 --- a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs +++ b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs @@ -82,13 +82,13 @@ namespace osu.Game.Screens.Edit // Find the index of [HitObject] sections. Lines changed prior to this index are ignored. int oldSectionStartIndex = Array.IndexOf(result.PiecesOld, $"[{section}]"); - int oldSectionEndIndex = Array.FindIndex(result.PiecesOld, oldSectionStartIndex + 1, s => s.StartsWith(@"[", StringComparison.Ordinal)); + int oldSectionEndIndex = Array.FindIndex(result.PiecesOld, oldSectionStartIndex + 1, s => s.StartsWith('[')); if (oldSectionEndIndex == -1) oldSectionEndIndex = result.PiecesOld.Length; int newSectionStartIndex = Array.IndexOf(result.PiecesNew, $"[{section}]"); - int newSectionEndIndex = Array.FindIndex(result.PiecesNew, newSectionStartIndex + 1, s => s.StartsWith(@"[", StringComparison.Ordinal)); + int newSectionEndIndex = Array.FindIndex(result.PiecesNew, newSectionStartIndex + 1, s => s.StartsWith('[')); if (newSectionEndIndex == -1) newSectionEndIndex = result.PiecesOld.Length; From 17eaf7bb5c2d1041738ccf780c96e1b1214a2e21 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 Jun 2022 16:35:46 +0900 Subject: [PATCH 1584/2328] Add failing test coverage showing hit meters don't update when not visible --- .../Visual/Gameplay/TestSceneHitErrorMeter.cs | 30 +++++++++++++++++++ .../HUD/HitErrorMeters/ColourHitErrorMeter.cs | 12 ++++---- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs index 7febb54010..cbf9760e21 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs @@ -142,6 +142,36 @@ namespace osu.Game.Tests.Visual.Gameplay AddAssert("no circle added", () => !this.ChildrenOfType().Any()); } + [Test] + public void TestProcessingWhileHidden() + { + AddStep("OD 1", () => recreateDisplay(new OsuHitWindows(), 1)); + + AddStep("hide displays", () => + { + foreach (var hitErrorMeter in this.ChildrenOfType()) + hitErrorMeter.Hide(); + }); + + AddRepeatStep("hit", () => newJudgement(), ColourHitErrorMeter.MAX_DISPLAYED_JUDGEMENTS * 2); + + AddAssert("bars added", () => this.ChildrenOfType().Any()); + AddAssert("circle added", () => this.ChildrenOfType().Any()); + + AddUntilStep("wait for bars to disappear", () => !this.ChildrenOfType().Any()); + AddUntilStep("ensure max circles not exceeded", () => + { + return this.ChildrenOfType() + .All(m => m.ChildrenOfType().Count() <= ColourHitErrorMeter.MAX_DISPLAYED_JUDGEMENTS); + }); + + AddStep("show displays", () => + { + foreach (var hitErrorMeter in this.ChildrenOfType()) + hitErrorMeter.Show(); + }); + } + [Test] public void TestClear() { diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs index 5012be7249..9948b968d1 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs @@ -15,7 +15,11 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters { public class ColourHitErrorMeter : HitErrorMeter { + internal const int MAX_DISPLAYED_JUDGEMENTS = 20; + private const int animation_duration = 200; + private const int drawable_judgement_size = 8; + private const int spacing = 2; private readonly JudgementFlow judgementsFlow; @@ -37,16 +41,12 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters private class JudgementFlow : FillFlowContainer { - private const int max_available_judgements = 20; - private const int drawable_judgement_size = 8; - private const int spacing = 2; - public override IEnumerable FlowingChildren => base.FlowingChildren.Reverse(); public JudgementFlow() { AutoSizeAxes = Axes.X; - Height = max_available_judgements * (drawable_judgement_size + spacing) - spacing; + Height = MAX_DISPLAYED_JUDGEMENTS * (drawable_judgement_size + spacing) - spacing; Spacing = new Vector2(0, spacing); Direction = FillDirection.Vertical; LayoutDuration = animation_duration; @@ -57,7 +57,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters { Add(new HitErrorCircle(colour, drawable_judgement_size)); - if (Children.Count > max_available_judgements) + if (Children.Count > MAX_DISPLAYED_JUDGEMENTS) Children.FirstOrDefault(c => !c.IsRemoved)?.Remove(); } } From 86163d2225157af9c874af5b2dd59208572f8349 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 Jun 2022 16:37:26 +0900 Subject: [PATCH 1585/2328] Fix hit error meters not updating visual state when hidden It is an expectation of users that when the HUD is shown after a period of being hidden, it will visually reflect the state based on recent judgements. To achieve this, I've added `AlwaysPresent` and moved the transform application to the meter level, rather than at a child level. If this is seen as a bad direction, `AlwaysPresent` can be applied to the drawable children and the transforms can be moved back. Also of note, `ColourHitErrorMeter` is pretty weird. The flow class could potentially be removed and reduce `AlwaysPresent` usage by one. Can do that refactor as part of this PR if preferred. Closes #18624. --- .../HUD/HitErrorMeters/BarHitErrorMeter.cs | 35 ++++++++++--------- .../HUD/HitErrorMeters/ColourHitErrorMeter.cs | 34 +++++++----------- .../Play/HUD/HitErrorMeters/HitErrorMeter.cs | 2 ++ 3 files changed, 33 insertions(+), 38 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs index dca50c07ad..79fd22eb0e 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs @@ -400,6 +400,9 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters { const int arrow_move_duration = 800; + const int judgement_fade_in_duration = 100; + const int judgement_fade_out_duration = 5000; + if (!judgement.IsHit || judgement.HitObject.HitWindows?.WindowFor(HitResult.Miss) == 0) return; @@ -420,12 +423,26 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters } } - judgementsContainer.Add(new JudgementLine + var judgementLine = new JudgementLine { JudgementLineThickness = { BindTarget = JudgementLineThickness }, Y = getRelativeJudgementPosition(judgement.TimeOffset), Colour = GetColourForHitResult(judgement.Type), - }); + Alpha = 0, + Width = 0, + }; + + judgementsContainer.Add(judgementLine); + + // Importantly, transforms should be applied in this method rather than constructed drawables + // to ensure that they are applied even when the `HitErrorMeter` is hidden (see `AlwaysPresent` usage). + judgementLine + .FadeTo(0.6f, judgement_fade_in_duration, Easing.OutQuint) + .ResizeWidthTo(1, judgement_fade_in_duration, Easing.OutQuint) + .Then() + .FadeOut(judgement_fade_out_duration) + .ResizeWidthTo(0, judgement_fade_out_duration, Easing.InQuint) + .Expire(); arrow.MoveToY( getRelativeJudgementPosition(floatingAverage = floatingAverage * 0.9 + judgement.TimeOffset * 0.1) @@ -456,23 +473,9 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters protected override void LoadComplete() { - const int judgement_fade_in_duration = 100; - const int judgement_fade_out_duration = 5000; - base.LoadComplete(); - Alpha = 0; - Width = 0; - JudgementLineThickness.BindValueChanged(thickness => Height = thickness.NewValue, true); - - this - .FadeTo(0.6f, judgement_fade_in_duration, Easing.OutQuint) - .ResizeWidthTo(1, judgement_fade_in_duration, Easing.OutQuint) - .Then() - .FadeOut(judgement_fade_out_duration) - .ResizeWidthTo(0, judgement_fade_out_duration, Easing.InQuint) - .Expire(); } } diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs index 9948b968d1..285a2f8251 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs @@ -51,47 +51,37 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters Direction = FillDirection.Vertical; LayoutDuration = animation_duration; LayoutEasing = Easing.OutQuint; + AlwaysPresent = true; } public void Push(Color4 colour) { - Add(new HitErrorCircle(colour, drawable_judgement_size)); + var hitErrorCircle = new HitErrorCircle(colour); + + Add(hitErrorCircle); + + hitErrorCircle.FadeInFromZero(animation_duration, Easing.OutQuint); + hitErrorCircle.MoveToY(-drawable_judgement_size); + hitErrorCircle.MoveToY(0, animation_duration, Easing.OutQuint); if (Children.Count > MAX_DISPLAYED_JUDGEMENTS) Children.FirstOrDefault(c => !c.IsRemoved)?.Remove(); } } - internal class HitErrorCircle : Container + internal class HitErrorCircle : Circle { public bool IsRemoved { get; private set; } - private readonly Circle circle; - - public HitErrorCircle(Color4 colour, int size) + public HitErrorCircle(Color4 colour) { - Size = new Vector2(size); - Child = circle = new Circle - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - Colour = colour - }; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - circle.FadeInFromZero(animation_duration, Easing.OutQuint); - circle.MoveToY(-DrawSize.Y); - circle.MoveToY(0, animation_duration, Easing.OutQuint); + Colour = colour; + Size = new Vector2(drawable_judgement_size); } public void Remove() { IsRemoved = true; - this.FadeOut(animation_duration, Easing.OutQuint).Expire(); } } diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs index 1f08cb8aa7..c4e738de28 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs @@ -37,6 +37,8 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters { base.LoadComplete(); + AlwaysPresent = true; + if (gameplayClockContainer != null) gameplayClockContainer.OnSeek += Clear; From 285e5abb417e43fb8b95054edeba2d2a05d6e90d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 13 Jun 2022 16:55:46 +0900 Subject: [PATCH 1586/2328] Fix incorrect fallback value --- osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs index c668778be2..939d319405 100644 --- a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs +++ b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs @@ -91,7 +91,7 @@ namespace osu.Game.Screens.Edit int newSectionEndIndex = Array.FindIndex(result.PiecesNew, newSectionStartIndex + 1, s => s.StartsWith('[')); if (newSectionEndIndex == -1) - newSectionEndIndex = result.PiecesOld.Length; + newSectionEndIndex = result.PiecesNew.Length; Debug.Assert(oldSectionStartIndex >= 0); Debug.Assert(newSectionStartIndex >= 0); From a8286bdf0486b5c18e480afd2facf77c24714b58 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 13 Jun 2022 16:56:08 +0900 Subject: [PATCH 1587/2328] Fix assertion failures --- osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs index 939d319405..b56d990d75 100644 --- a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs +++ b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs @@ -82,14 +82,18 @@ namespace osu.Game.Screens.Edit // Find the index of [HitObject] sections. Lines changed prior to this index are ignored. int oldSectionStartIndex = Array.IndexOf(result.PiecesOld, $"[{section}]"); - int oldSectionEndIndex = Array.FindIndex(result.PiecesOld, oldSectionStartIndex + 1, s => s.StartsWith('[')); + if (oldSectionStartIndex == -1) + return; + int oldSectionEndIndex = Array.FindIndex(result.PiecesOld, oldSectionStartIndex + 1, s => s.StartsWith('[')); if (oldSectionEndIndex == -1) oldSectionEndIndex = result.PiecesOld.Length; int newSectionStartIndex = Array.IndexOf(result.PiecesNew, $"[{section}]"); - int newSectionEndIndex = Array.FindIndex(result.PiecesNew, newSectionStartIndex + 1, s => s.StartsWith('[')); + if (newSectionStartIndex == -1) + return; + int newSectionEndIndex = Array.FindIndex(result.PiecesNew, newSectionStartIndex + 1, s => s.StartsWith('[')); if (newSectionEndIndex == -1) newSectionEndIndex = result.PiecesNew.Length; From c178e5d5923cdbcc6ace0adad7b475c3865f1a66 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 13 Jun 2022 16:58:43 +0900 Subject: [PATCH 1588/2328] Add explanatory comment --- osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs index b56d990d75..66ece8fcfa 100644 --- a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs +++ b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs @@ -130,6 +130,8 @@ namespace osu.Game.Screens.Edit removedIndices.Sort(); addedIndices.Sort(); + // The expected usage of this returned list is to iterate from the start to the end of the list, such that + // these indices need to appear in reverse order for the usage to not have to deal with decrementing indices. removedIndices.Reverse(); } From f997886142cf6fcad1e4c20078bb4f45be2f74cb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 Jun 2022 17:18:32 +0900 Subject: [PATCH 1589/2328] Add scrolling gameplay visualisation mode to latency certifier --- .../TestSceneLatencyCertifierScreen.cs | 6 + osu.Game/Screens/Utility/LatencyArea.cs | 14 ++ osu.Game/Screens/Utility/LatencyVisualMode.cs | 1 + osu.Game/Screens/Utility/ScrollingGameplay.cs | 201 ++++++++++++++++++ 4 files changed, 222 insertions(+) create mode 100644 osu.Game/Screens/Utility/ScrollingGameplay.cs diff --git a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs index d6e0f995e5..fe14935479 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs @@ -36,6 +36,12 @@ namespace osu.Game.Tests.Visual.Settings AddStep("set visual mode to circles", () => latencyCertifier.VisualMode.Value = LatencyVisualMode.CircleGameplay); } + [Test] + public void TestScrollingGameplay() + { + AddStep("set visual mode to scrolling", () => latencyCertifier.VisualMode.Value = LatencyVisualMode.ScrollingGameplay); + } + [Test] public void TestCycleVisualModes() { diff --git a/osu.Game/Screens/Utility/LatencyArea.cs b/osu.Game/Screens/Utility/LatencyArea.cs index 3b9e95ce16..21688f0b0c 100644 --- a/osu.Game/Screens/Utility/LatencyArea.cs +++ b/osu.Game/Screens/Utility/LatencyArea.cs @@ -108,6 +108,20 @@ namespace osu.Game.Screens.Utility }; break; + case LatencyVisualMode.ScrollingGameplay: + visualContent.Children = new Drawable[] + { + new ScrollingGameplay + { + RelativeSizeAxes = Axes.Both, + }, + new LatencyCursorContainer + { + RelativeSizeAxes = Axes.Both, + }, + }; + break; + default: throw new ArgumentOutOfRangeException(); } diff --git a/osu.Game/Screens/Utility/LatencyVisualMode.cs b/osu.Game/Screens/Utility/LatencyVisualMode.cs index f9f51f0829..cc15f79be8 100644 --- a/osu.Game/Screens/Utility/LatencyVisualMode.cs +++ b/osu.Game/Screens/Utility/LatencyVisualMode.cs @@ -7,6 +7,7 @@ namespace osu.Game.Screens.Utility public enum LatencyVisualMode { CircleGameplay, + ScrollingGameplay, Simple, } } diff --git a/osu.Game/Screens/Utility/ScrollingGameplay.cs b/osu.Game/Screens/Utility/ScrollingGameplay.cs new file mode 100644 index 0000000000..a32fd3b37f --- /dev/null +++ b/osu.Game/Screens/Utility/ScrollingGameplay.cs @@ -0,0 +1,201 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable +using System; +using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; +using osu.Framework.Input.States; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Scoring; +using osu.Game.Screens.Utility.SampleComponents; +using osuTK; +using osuTK.Input; + +namespace osu.Game.Screens.Utility +{ + public class ScrollingGameplay : LatencySampleComponent + { + private const float judgement_position = 0.8f; + private const float bar_height = 20; + + private int nextLocation; + + private readonly List hitEvents = new List(); + + private double? lastGeneratedBeatTime; + + private Container circles = null!; + + protected override void LoadComplete() + { + base.LoadComplete(); + + InternalChildren = new Drawable[] + { + new Box + { + Name = "judgement bar", + Colour = OverlayColourProvider.Content2, + RelativeSizeAxes = Axes.X, + RelativePositionAxes = Axes.Y, + Y = judgement_position, + Height = bar_height, + }, + circles = new Container + { + RelativeSizeAxes = Axes.Both, + }, + }; + + SampleBPM.BindValueChanged(_ => + { + circles.Clear(); + lastGeneratedBeatTime = null; + }); + } + + protected override void UpdateAtLimitedRate(InputState inputState) + { + double beatLength = 60000 / SampleBPM.Value; + + int nextBeat = (int)(Clock.CurrentTime / beatLength) + 1; + + // We want to generate a few hit objects ahead of the current time (to allow them to animate). + double generateUpTo = (nextBeat + 2) * beatLength; + + while (lastGeneratedBeatTime == null || lastGeneratedBeatTime < generateUpTo) + { + double time = ++nextBeat * beatLength; + + if (time <= lastGeneratedBeatTime) + continue; + + newBeat(time); + lastGeneratedBeatTime = time; + } + } + + private void newBeat(double time) + { + const float columns = 4; + + float adjustedXPos = ((1f + nextLocation++ % columns) - columns / 2) / columns; + + circles.Add(new SampleNote(time) + { + RelativePositionAxes = Axes.Both, + X = 0.5f + SampleVisualSpacing.Value * (adjustedXPos * 0.5f), + Scale = new Vector2(0.4f + (0.8f * SampleVisualSpacing.Value), 1), + Hit = hit, + }); + } + + private void hit(HitEvent h) + { + hitEvents.Add(h); + } + + public class SampleNote : LatencySampleComponent + { + public HitEvent? HitEvent; + + public Action? Hit { get; set; } + + public readonly double HitTime; + + private Box box = null!; + + private const float size = 100; + private const float duration = 200; + + public SampleNote(double hitTime) + { + HitTime = hitTime; + + Origin = Anchor.Centre; + AutoSizeAxes = Axes.Both; + AlwaysPresent = true; + } + + [BackgroundDependencyLoader] + private void load() + { + InternalChildren = new Drawable[] + { + box = new Box + { + Colour = OverlayColourProvider.Content1, + Size = new Vector2(size, bar_height), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + }; + } + + protected override bool OnKeyDown(KeyDownEvent e) + { + if (!IsActive.Value) + return false; + + if (Math.Abs(Clock.CurrentTime - HitTime) > duration) + return false; + + // Allow using any key that isn't used by the latency certifier itself. + switch (e.Key) + { + case Key.Space: + case Key.Number1: + case Key.Number2: + case Key.Tab: + return false; + } + + attemptHit(); + return true; + } + + protected override void UpdateAtLimitedRate(InputState inputState) + { + if (HitEvent == null) + { + double preempt = (float)IBeatmapDifficultyInfo.DifficultyRange(SampleApproachRate.Value, 1800, 1200, 450); + + Alpha = (float)MathHelper.Clamp((Clock.CurrentTime - HitTime + 600) / 400, 0, 1); + Y = judgement_position - (float)((HitTime - Clock.CurrentTime) / preempt); + + if (Clock.CurrentTime > HitTime + duration) + Expire(); + } + } + + private void attemptHit() => Schedule(() => + { + if (HitEvent != null) + return; + + // in case it was hit outside of display range, show immediately + // so the user isn't confused. + this.FadeIn(); + + box + .FadeOut(duration / 2) + .ScaleTo(1.5f, duration / 2); + + HitEvent = new HitEvent(Clock.CurrentTime - HitTime, HitResult.Good, new HitObject + { + HitWindows = new HitWindows(), + }, null, null); + + Hit?.Invoke(HitEvent.Value); + + this.Delay(duration).Expire(); + }); + } + } +} From f680f4d26bce5cc1d3fbc07946a8256d200b6aab Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 13 Jun 2022 17:36:32 +0900 Subject: [PATCH 1590/2328] Apply refactorings from review --- .../Screens/Edit/LegacyEditorBeatmapPatcher.cs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs index 66ece8fcfa..00cb95dd79 100644 --- a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs +++ b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Text; using DiffPlex; @@ -63,8 +62,8 @@ namespace osu.Game.Screens.Edit { findChangedIndices(result, LegacyDecoder.Section.HitObjects, out var removedIndices, out var addedIndices); - foreach (int removed in removedIndices) - editorBeatmap.RemoveAt(removed); + for (int i = removedIndices.Count - 1; i >= 0; i--) + editorBeatmap.RemoveAt(removedIndices[i]); if (addedIndices.Count > 0) { @@ -80,7 +79,7 @@ namespace osu.Game.Screens.Edit removedIndices = new List(); addedIndices = new List(); - // Find the index of [HitObject] sections. Lines changed prior to this index are ignored. + // Find the start and end indices of the relevant section headers in both the old and the new beatmap file. Lines changed outside of the modified ranges are ignored. int oldSectionStartIndex = Array.IndexOf(result.PiecesOld, $"[{section}]"); if (oldSectionStartIndex == -1) return; @@ -97,9 +96,6 @@ namespace osu.Game.Screens.Edit if (newSectionEndIndex == -1) newSectionEndIndex = result.PiecesNew.Length; - Debug.Assert(oldSectionStartIndex >= 0); - Debug.Assert(newSectionStartIndex >= 0); - foreach (var block in result.DiffBlocks) { // Removed indices @@ -129,10 +125,6 @@ namespace osu.Game.Screens.Edit // This isn't strictly required, but the differ makes no guarantees about order. removedIndices.Sort(); addedIndices.Sort(); - - // The expected usage of this returned list is to iterate from the start to the end of the list, such that - // these indices need to appear in reverse order for the usage to not have to deal with decrementing indices. - removedIndices.Reverse(); } private string readString(byte[] state) => Encoding.UTF8.GetString(state); From 336df62a1fb0c6d3556db8e348ebbb0f9233d97f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 Jun 2022 18:57:29 +0900 Subject: [PATCH 1591/2328] Remove unnecessary file existence check This is not required due to `createFileInfos` always being run before we get to this point (I believe this was added after the initial code to check existence was added). This flow is covered in `BeatmapImportTests.TestImportThenReimportAfterMissingFiles`, which still passes with the change. While this check isn't doing any harm, as I'm going through the flow for import-skipping, less checks are appreciated. --- osu.Game/Stores/RealmArchiveModelImporter.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Stores/RealmArchiveModelImporter.cs b/osu.Game/Stores/RealmArchiveModelImporter.cs index 6d1449a4b4..e7477cfffc 100644 --- a/osu.Game/Stores/RealmArchiveModelImporter.cs +++ b/osu.Game/Stores/RealmArchiveModelImporter.cs @@ -521,8 +521,7 @@ namespace osu.Game.Stores // for the best or worst, we copy and import files of a new import before checking whether // it is a duplicate. so to check if anything has changed, we can just compare all File IDs. getIDs(existing.Files).SequenceEqual(getIDs(import.Files)) && - getFilenames(existing.Files).SequenceEqual(getFilenames(import.Files)) && - checkAllFilesExist(existing); + getFilenames(existing.Files).SequenceEqual(getFilenames(import.Files)); private bool checkAllFilesExist(TModel model) => model.Files.All(f => Files.Storage.Exists(f.File.GetStoragePath())); From b300bc1e24d758416e2f6c1e2e27621e44b0cdee Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 13 Jun 2022 20:41:32 +0900 Subject: [PATCH 1592/2328] Fix ever-increasing flashlight-strain --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index bd8e962122..f5b8afb40a 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double StrainValueAt(DifficultyHitObject current) { currentStrain *= strainDecay(current.DeltaTime); - currentStrain += currentStrain += FlashlightEvaluator.EvaluateDifficultyOf(current, Mods.Any(m => m is OsuModHidden)) * skillMultiplier; + currentStrain += FlashlightEvaluator.EvaluateDifficultyOf(current, Mods.Any(m => m is OsuModHidden)) * skillMultiplier; return currentStrain; } From f73142c50f841711baf3a5354a919cdbb51d97de Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 13 Jun 2022 20:43:54 +0900 Subject: [PATCH 1593/2328] Remove for loop --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index f5b8afb40a..590ab6ea61 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -15,9 +15,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills /// public class Flashlight : OsuStrainSkill { + private readonly bool hasHiddenMod; + public Flashlight(Mod[] mods) : base(mods) { + hasHiddenMod = mods.Any(m => m is OsuModHidden); } private double skillMultiplier => 0.05; @@ -33,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double StrainValueAt(DifficultyHitObject current) { currentStrain *= strainDecay(current.DeltaTime); - currentStrain += FlashlightEvaluator.EvaluateDifficultyOf(current, Mods.Any(m => m is OsuModHidden)) * skillMultiplier; + currentStrain += FlashlightEvaluator.EvaluateDifficultyOf(current, hasHiddenMod) * skillMultiplier; return currentStrain; } From bd9ea9bd6fa8f1717e601ef5b7c24076714875e2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 Jun 2022 23:54:43 +0900 Subject: [PATCH 1594/2328] Revert most unnecessary changes Turns out `AlwaysPresent` at top level is actually enough. This reverts commit 86163d2225157af9c874af5b2dd59208572f8349. --- .../HUD/HitErrorMeters/BarHitErrorMeter.cs | 35 +++++++++---------- .../HUD/HitErrorMeters/ColourHitErrorMeter.cs | 34 +++++++++++------- .../Play/HUD/HitErrorMeters/HitErrorMeter.cs | 5 +-- 3 files changed, 41 insertions(+), 33 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs index 79fd22eb0e..dca50c07ad 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs @@ -400,9 +400,6 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters { const int arrow_move_duration = 800; - const int judgement_fade_in_duration = 100; - const int judgement_fade_out_duration = 5000; - if (!judgement.IsHit || judgement.HitObject.HitWindows?.WindowFor(HitResult.Miss) == 0) return; @@ -423,26 +420,12 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters } } - var judgementLine = new JudgementLine + judgementsContainer.Add(new JudgementLine { JudgementLineThickness = { BindTarget = JudgementLineThickness }, Y = getRelativeJudgementPosition(judgement.TimeOffset), Colour = GetColourForHitResult(judgement.Type), - Alpha = 0, - Width = 0, - }; - - judgementsContainer.Add(judgementLine); - - // Importantly, transforms should be applied in this method rather than constructed drawables - // to ensure that they are applied even when the `HitErrorMeter` is hidden (see `AlwaysPresent` usage). - judgementLine - .FadeTo(0.6f, judgement_fade_in_duration, Easing.OutQuint) - .ResizeWidthTo(1, judgement_fade_in_duration, Easing.OutQuint) - .Then() - .FadeOut(judgement_fade_out_duration) - .ResizeWidthTo(0, judgement_fade_out_duration, Easing.InQuint) - .Expire(); + }); arrow.MoveToY( getRelativeJudgementPosition(floatingAverage = floatingAverage * 0.9 + judgement.TimeOffset * 0.1) @@ -473,9 +456,23 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters protected override void LoadComplete() { + const int judgement_fade_in_duration = 100; + const int judgement_fade_out_duration = 5000; + base.LoadComplete(); + Alpha = 0; + Width = 0; + JudgementLineThickness.BindValueChanged(thickness => Height = thickness.NewValue, true); + + this + .FadeTo(0.6f, judgement_fade_in_duration, Easing.OutQuint) + .ResizeWidthTo(1, judgement_fade_in_duration, Easing.OutQuint) + .Then() + .FadeOut(judgement_fade_out_duration) + .ResizeWidthTo(0, judgement_fade_out_duration, Easing.InQuint) + .Expire(); } } diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs index 285a2f8251..9948b968d1 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs @@ -51,37 +51,47 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters Direction = FillDirection.Vertical; LayoutDuration = animation_duration; LayoutEasing = Easing.OutQuint; - AlwaysPresent = true; } public void Push(Color4 colour) { - var hitErrorCircle = new HitErrorCircle(colour); - - Add(hitErrorCircle); - - hitErrorCircle.FadeInFromZero(animation_duration, Easing.OutQuint); - hitErrorCircle.MoveToY(-drawable_judgement_size); - hitErrorCircle.MoveToY(0, animation_duration, Easing.OutQuint); + Add(new HitErrorCircle(colour, drawable_judgement_size)); if (Children.Count > MAX_DISPLAYED_JUDGEMENTS) Children.FirstOrDefault(c => !c.IsRemoved)?.Remove(); } } - internal class HitErrorCircle : Circle + internal class HitErrorCircle : Container { public bool IsRemoved { get; private set; } - public HitErrorCircle(Color4 colour) + private readonly Circle circle; + + public HitErrorCircle(Color4 colour, int size) { - Colour = colour; - Size = new Vector2(drawable_judgement_size); + Size = new Vector2(size); + Child = circle = new Circle + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + Colour = colour + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + circle.FadeInFromZero(animation_duration, Easing.OutQuint); + circle.MoveToY(-DrawSize.Y); + circle.MoveToY(0, animation_duration, Easing.OutQuint); } public void Remove() { IsRemoved = true; + this.FadeOut(animation_duration, Easing.OutQuint).Expire(); } } diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs index c4e738de28..e7aaee9fa1 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs @@ -31,14 +31,15 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters private void load(DrawableRuleset drawableRuleset) { HitWindows = drawableRuleset?.FirstAvailableHitWindows ?? HitWindows.Empty; + + // This is to allow the visual state to be correct after HUD comes visible after being hidden. + AlwaysPresent = true; } protected override void LoadComplete() { base.LoadComplete(); - AlwaysPresent = true; - if (gameplayClockContainer != null) gameplayClockContainer.OnSeek += Clear; From 737197591d812d0abdbf733d05bd4e411b050a9a Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Mon, 13 Jun 2022 17:49:56 +0100 Subject: [PATCH 1595/2328] Change doubletap algorithm --- .../Difficulty/Evaluators/SpeedEvaluator.cs | 18 ++++++++++++------ .../Difficulty/Skills/Speed.cs | 3 ++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs index 85203dd157..e68e7a8653 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using osu.Framework.Utils; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; using osu.Game.Rulesets.Osu.Objects; @@ -31,14 +30,21 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators // derive strainTime for calculation var osuCurrObj = (OsuDifficultyHitObject)current; var osuPrevObj = current.Index > 0 ? (OsuDifficultyHitObject)current.Previous(0) : null; + var osuNextObj = (OsuDifficultyHitObject)current.Next(0); double strainTime = osuCurrObj.StrainTime; double greatWindowFull = greatWindow * 2; - double speedWindowRatio = strainTime / greatWindowFull; + double doubletapness = 1; - // Aim to nerf cheesy rhythms (Very fast consecutive doubles with large deltatimes between) - if (osuPrevObj != null && strainTime < greatWindowFull && osuPrevObj.StrainTime > strainTime) - strainTime = Interpolation.Lerp(osuPrevObj.StrainTime, strainTime, speedWindowRatio); + // Nerf doubletappable doubles. + if (osuNextObj != null) + { + double currDeltaTime = Math.Max(1, osuCurrObj.DeltaTime); + double nextDeltaTime = Math.Max(1, osuNextObj.DeltaTime); + double speedRatio = Math.Min(1, currDeltaTime / nextDeltaTime); + double windowRatio = Math.Min(1, currDeltaTime / greatWindowFull); + doubletapness = Math.Pow(speedRatio, 1 - windowRatio); + } // Cap deltatime to the OD 300 hitwindow. // 0.93 is derived from making sure 260bpm OD8 streams aren't nerfed harshly, whilst 0.92 limits the effect of the cap. @@ -53,7 +59,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators double travelDistance = osuPrevObj?.TravelDistance ?? 0; double distance = Math.Min(single_spacing_threshold, travelDistance + osuCurrObj.MinimumJumpDistance); - return (speedBonus + speedBonus * Math.Pow(distance / single_spacing_threshold, 3.5)) / strainTime; + return (speedBonus + speedBonus * Math.Pow(distance / single_spacing_threshold, 3.5)) * doubletapness / strainTime; } } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index 055e1cb66e..3e4e55262c 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -5,6 +5,7 @@ using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Difficulty.Evaluators; +using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; namespace osu.Game.Rulesets.Osu.Difficulty.Skills { @@ -35,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double StrainValueAt(DifficultyHitObject current) { - currentStrain *= strainDecay(current.DeltaTime); + currentStrain *= strainDecay(((OsuDifficultyHitObject)current).StrainTime); currentStrain += SpeedEvaluator.EvaluateDifficultyOf(current, greatWindow) * skillMultiplier; currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current, greatWindow); From 9fc04924eba411f1bcdf6794fa694718abac34ff Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 14 Jun 2022 00:02:02 +0300 Subject: [PATCH 1596/2328] Revert "Provide context menu items at `BlueprintContainer` for out-of-bounds support" This reverts commit 85fc218edf0d8f2c688af226265ef3e9373c5a4c. --- .../Compose/Components/BlueprintContainer.cs | 30 +------------------ .../Components/EditorSelectionHandler.cs | 2 +- .../Compose/Components/SelectionHandler.cs | 28 +++++++++++++++-- .../Skinning/Editor/SkinSelectionHandler.cs | 2 +- 4 files changed, 28 insertions(+), 34 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index 5fdd7c0e81..d56dc176f6 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -11,14 +11,11 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Graphics.UserInterface; -using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets.Edit; using osuTK; using osuTK.Input; @@ -29,7 +26,7 @@ namespace osu.Game.Screens.Edit.Compose.Components /// A container which provides a "blueprint" display of items. /// Includes selection and manipulation support via a . /// - public abstract class BlueprintContainer : CompositeDrawable, IKeyBindingHandler, IHasContextMenu + public abstract class BlueprintContainer : CompositeDrawable, IKeyBindingHandler where T : class { protected DragBox DragBox { get; private set; } @@ -537,30 +534,5 @@ namespace osu.Game.Screens.Edit.Compose.Components } #endregion - - #region Context Menu - - public MenuItem[] ContextMenuItems - { - get - { - var selectedBlueprints = SelectionHandler.SelectedBlueprints; - if (!selectedBlueprints.Any(b => b.IsHovered)) - return Array.Empty(); - - var items = new List(); - - items.AddRange(SelectionHandler.GetContextMenuItemsForSelection(selectedBlueprints)); - - if (selectedBlueprints.Count == 1) - items.AddRange(selectedBlueprints[0].ContextMenuItems); - - items.Add(new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, SelectionHandler.DeleteSelected)); - - return items.ToArray(); - } - } - - #endregion } } diff --git a/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs index 5fa98aea01..7f693996a4 100644 --- a/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs +++ b/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs @@ -165,7 +165,7 @@ namespace osu.Game.Screens.Edit.Compose.Components /// /// The current selection. /// The relevant menu items. - protected internal override IEnumerable GetContextMenuItemsForSelection(IEnumerable> selection) + protected override IEnumerable GetContextMenuItemsForSelection(IEnumerable> selection) { if (SelectedBlueprints.All(b => b.Item is IHasComboInformation)) { diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs index d4ffb67a51..78b98a3649 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs @@ -8,6 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; @@ -16,6 +17,7 @@ using osu.Framework.Input.Events; using osu.Framework.Utils; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; +using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets.Edit; using osuTK; using osuTK.Input; @@ -25,7 +27,7 @@ namespace osu.Game.Screens.Edit.Compose.Components /// /// A component which outlines items and handles movement of selections. /// - public abstract class SelectionHandler : CompositeDrawable, IKeyBindingHandler, IKeyBindingHandler + public abstract class SelectionHandler : CompositeDrawable, IKeyBindingHandler, IKeyBindingHandler, IHasContextMenu { /// /// The currently selected blueprints. @@ -290,7 +292,7 @@ namespace osu.Game.Screens.Edit.Compose.Components return true; } - protected internal void DeleteSelected() + protected void DeleteSelected() { DeleteItems(selectedBlueprints.Select(b => b.Item)); } @@ -343,12 +345,32 @@ namespace osu.Game.Screens.Edit.Compose.Components #region Context Menu + public MenuItem[] ContextMenuItems + { + get + { + if (!SelectedBlueprints.Any(b => b.IsHovered)) + return Array.Empty(); + + var items = new List(); + + items.AddRange(GetContextMenuItemsForSelection(SelectedBlueprints)); + + if (SelectedBlueprints.Count == 1) + items.AddRange(SelectedBlueprints[0].ContextMenuItems); + + items.Add(new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, DeleteSelected)); + + return items.ToArray(); + } + } + /// /// Provide context menu items relevant to current selection. Calling base is not required. /// /// The current selection. /// The relevant menu items. - protected internal virtual IEnumerable GetContextMenuItemsForSelection(IEnumerable> selection) + protected virtual IEnumerable GetContextMenuItemsForSelection(IEnumerable> selection) => Enumerable.Empty(); #endregion diff --git a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs index 3ead8fee17..943425e099 100644 --- a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs +++ b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs @@ -180,7 +180,7 @@ namespace osu.Game.Skinning.Editor protected override void DeleteItems(IEnumerable items) => skinEditor.DeleteItems(items.ToArray()); - protected internal override IEnumerable GetContextMenuItemsForSelection(IEnumerable> selection) + protected override IEnumerable GetContextMenuItemsForSelection(IEnumerable> selection) { var closestItem = new TernaryStateRadioMenuItem("Closest", MenuItemType.Standard, _ => applyClosestAnchors()) { From c49b8e4a5cc4ae14c9dd25d2030c7410bb1f1dba Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 14 Jun 2022 00:19:15 +0300 Subject: [PATCH 1597/2328] Allow `BlueprintContainer` and `SelectionHandler` to receive input outside bounds --- .../Screens/Edit/Compose/Components/BlueprintContainer.cs | 7 +++++++ .../Edit/Compose/Components/ComposeBlueprintContainer.cs | 2 -- .../Screens/Edit/Compose/Components/SelectionHandler.cs | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index d56dc176f6..fbec80a63b 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -106,6 +106,13 @@ namespace osu.Game.Screens.Edit.Compose.Components /// protected virtual bool AllowDeselectionDuringDrag => true; + /// + /// Positional input must be received outside the container's bounds, + /// in order to handle blueprints which are partially offscreen. + /// + /// + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; + protected override bool OnMouseDown(MouseDownEvent e) { bool selectionPerformed = performMouseDownActions(e); diff --git a/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs index 68be20720d..0be2cb4462 100644 --- a/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs @@ -30,8 +30,6 @@ namespace osu.Game.Screens.Edit.Compose.Components /// public class ComposeBlueprintContainer : EditorBlueprintContainer { - public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; - private readonly Container placementBlueprintContainer; protected new EditorSelectionHandler SelectionHandler => (EditorSelectionHandler)base.SelectionHandler; diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs index 78b98a3649..e5020afcde 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs @@ -97,6 +97,13 @@ namespace osu.Game.Screens.Edit.Compose.Components #region User Input Handling + /// + /// Positional input must be received outside the container's bounds, + /// in order to handle blueprints which are partially offscreen. + /// + /// + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; + /// /// Handles the selected items being moved. /// From fa4930c5865a414bb3d1d811cbca69b9a08f2c13 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 14 Jun 2022 00:19:47 +0300 Subject: [PATCH 1598/2328] Remove no longer necessary `ReceivePositionalInputAt` overrides in timeline components --- .../Components/Timeline/TimelineBlueprintContainer.cs | 3 --- .../Components/Timeline/TimelineSelectionHandler.cs | 7 ------- 2 files changed, 10 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs index a9e9ef5001..1c0c2fb215 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs @@ -33,9 +33,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline private Bindable placement; private SelectionBlueprint placementBlueprint; - // We want children within the timeline to be interactable - public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => timeline.ScreenSpaceDrawQuad.Contains(screenSpacePos); - public TimelineBlueprintContainer(HitObjectComposer composer) : base(composer) { diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineSelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineSelectionHandler.cs index e98cf8332f..da12ab521f 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineSelectionHandler.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineSelectionHandler.cs @@ -6,23 +6,16 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using JetBrains.Annotations; -using osu.Framework.Allocation; using osu.Framework.Input.Events; using osu.Game.Input.Bindings; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; -using osuTK; using osuTK.Input; namespace osu.Game.Screens.Edit.Compose.Components.Timeline { internal class TimelineSelectionHandler : EditorSelectionHandler { - [Resolved] - private Timeline timeline { get; set; } - - public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => timeline.ScreenSpaceDrawQuad.Contains(screenSpacePos); - // for now we always allow movement. snapping is provided by the Timeline's "distance" snap implementation public override bool HandleMovement(MoveSelectionEvent moveEvent) => true; From a20e43c2ae9f7fad40736eb8658a2245731b782d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jun 2022 18:22:23 +0900 Subject: [PATCH 1599/2328] Ensure containers which are being used to hide HUD elements still update for now I don't think this is necessarily a final solution (as this means all HUD elements are adding overhead even when not visible), but this will make the implementations much easier for the time being. I've checked and can't notice any perceivable overhead in profiling so we should be fine for now. --- osu.Game/Screens/Play/HUDOverlay.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index f6087e0958..6419532221 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -86,7 +86,10 @@ namespace osu.Game.Screens.Play Children = new Drawable[] { CreateFailingLayer(), - mainComponents = new MainComponentsContainer(), + mainComponents = new MainComponentsContainer + { + AlwaysPresent = true, + }, topRightElements = new FillFlowContainer { Anchor = Anchor.TopRight, @@ -108,6 +111,7 @@ namespace osu.Game.Screens.Play Margin = new MarginPadding(10), Spacing = new Vector2(10), AutoSizeAxes = Axes.Both, + AlwaysPresent = true, LayoutDuration = FADE_DURATION / 2, LayoutEasing = FADE_EASING, Direction = FillDirection.Vertical, From 0147a8ecee356c4454dda943ad6f9c5f5bc0bcf2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jun 2022 18:35:33 +0900 Subject: [PATCH 1600/2328] Add test coverage of HUD components still getting updated when hidden --- .../Visual/Gameplay/TestSceneHUDOverlay.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs index 83c557ee51..949f0f667b 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs @@ -14,6 +14,7 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play; +using osu.Game.Screens.Play.HUD.HitErrorMeters; using osu.Game.Skinning; using osu.Game.Tests.Gameplay; using osuTK.Input; @@ -145,6 +146,26 @@ namespace osu.Game.Tests.Visual.Gameplay AddAssert("key counters still hidden", () => !keyCounterFlow.IsPresent); } + [Test] + public void TestHiddenHUDDoesntBlockComponentUpdates() + { + int updateCount = 0; + + AddStep("set hud to never show", () => localConfig.SetValue(OsuSetting.HUDVisibilityMode, HUDVisibilityMode.Never)); + + createNew(); + + AddUntilStep("wait for hud load", () => hudOverlay.IsLoaded); + AddUntilStep("wait for components to be hidden", () => hudOverlay.ChildrenOfType().Single().Alpha == 0); + + AddStep("bind on update", () => + { + hudOverlay.ChildrenOfType().First().OnUpdate += _ => updateCount++; + }); + + AddUntilStep("wait for updates", () => updateCount > 0); + } + [Test] public void TestHiddenHUDDoesntBlockSkinnableComponentsLoad() { @@ -153,7 +174,7 @@ namespace osu.Game.Tests.Visual.Gameplay createNew(); AddUntilStep("wait for hud load", () => hudOverlay.IsLoaded); - AddUntilStep("wait for components to be hidden", () => !hudOverlay.ChildrenOfType().Single().IsPresent); + AddUntilStep("wait for components to be hidden", () => hudOverlay.ChildrenOfType().Single().Alpha == 0); AddStep("reload components", () => hudOverlay.ChildrenOfType().Single().Reload()); AddUntilStep("skinnable components loaded", () => hudOverlay.ChildrenOfType().Single().ComponentsLoaded); From aeca138930f7ab95eae73f3fea586c25606d9032 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jun 2022 18:48:57 +0900 Subject: [PATCH 1601/2328] Fix ctrl-z in editor also seeking to start in addition to undo --- osu.Game/Screens/Edit/Editor.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 1414644a54..e4a18b8478 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -422,6 +422,8 @@ namespace osu.Game.Screens.Edit protected override bool OnKeyDown(KeyDownEvent e) { + if (e.ControlPressed || e.AltPressed || e.SuperPressed) return false; + switch (e.Key) { case Key.Left: From c30644328cf1a9e855dde91ba4676d73f384cee4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jun 2022 19:21:02 +0900 Subject: [PATCH 1602/2328] Fix timing adjustment repeat buttons firing one change per repeat invocation --- osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs | 5 +++++ osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs b/osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs index 595305b20f..3b78402f8a 100644 --- a/osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs +++ b/osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs @@ -23,6 +23,9 @@ namespace osu.Game.Screens.Edit.Timing private Sample sample; + public Action RepeatBegan; + public Action RepeatEnded; + /// /// An additive modifier for the frequency of the sample played on next actuation. /// This can be adjusted during the button's event to affect the repeat sample playback of that click. @@ -44,6 +47,7 @@ namespace osu.Game.Screens.Edit.Timing protected override bool OnMouseDown(MouseDownEvent e) { + RepeatBegan?.Invoke(); beginRepeat(); return true; } @@ -51,6 +55,7 @@ namespace osu.Game.Screens.Edit.Timing protected override void OnMouseUp(MouseUpEvent e) { adjustDelegate?.Cancel(); + RepeatEnded?.Invoke(); base.OnMouseUp(e); } diff --git a/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs b/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs index 9540547d89..8aa0a88c3b 100644 --- a/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs +++ b/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs @@ -44,6 +44,9 @@ namespace osu.Game.Screens.Edit.Timing [Resolved] private OverlayColourProvider colourProvider { get; set; } + [Resolved] + private EditorBeatmap editorBeatmap { get; set; } + public TimingAdjustButton(double adjustAmount) { this.adjustAmount = adjustAmount; @@ -72,7 +75,11 @@ namespace osu.Game.Screens.Edit.Timing } }); - AddInternal(repeatBehaviour = new RepeatingButtonBehaviour(this)); + AddInternal(repeatBehaviour = new RepeatingButtonBehaviour(this) + { + RepeatBegan = () => editorBeatmap.BeginChange(), + RepeatEnded = () => editorBeatmap.EndChange() + }); } [BackgroundDependencyLoader] From d73c0ca65949fa2bff7f8fb4602a350ac8048856 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jun 2022 19:38:51 +0900 Subject: [PATCH 1603/2328] Remove unused methods from `IModelImporter` All the xmldoc is already present in `RealmArchiveModelImporter` so nothing is lost here. --- osu.Game/Database/IModelImporter.cs | 43 +++++++---------------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/osu.Game/Database/IModelImporter.cs b/osu.Game/Database/IModelImporter.cs index 90df13477e..b59636e88d 100644 --- a/osu.Game/Database/IModelImporter.cs +++ b/osu.Game/Database/IModelImporter.cs @@ -1,14 +1,12 @@ // 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.Threading; -using System.Threading.Tasks; -using osu.Game.IO.Archives; -using osu.Game.Overlays.Notifications; - #nullable enable +using System.Collections.Generic; +using System.Threading.Tasks; +using osu.Game.Overlays.Notifications; + namespace osu.Game.Database { /// @@ -18,35 +16,14 @@ namespace osu.Game.Database public interface IModelImporter : IPostNotifications, IPostImports, ICanAcceptFiles where TModel : class, IHasGuidPrimaryKey { + /// + /// Process multiple import tasks, updating a tracking notification with progress. + /// + /// The notification to update. + /// The import tasks. + /// The imported models. Task>> Import(ProgressNotification notification, params ImportTask[] tasks); - /// - /// Import one from the filesystem and delete the file on success. - /// Note that this bypasses the UI flow and should only be used for special cases or testing. - /// - /// The containing data about the to import. - /// Whether this is a low priority import. - /// An optional cancellation token. - /// The imported model, if successful. - Task?> Import(ImportTask task, bool lowPriority = false, CancellationToken cancellationToken = default); - - /// - /// Silently import an item from an . - /// - /// The archive to be imported. - /// Whether this is a low priority import. - /// An optional cancellation token. - Task?> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default); - - /// - /// Silently import an item from a . - /// - /// The model to be imported. - /// An optional archive to use for model population. - /// Whether this is a low priority import. - /// An optional cancellation token. - Live? Import(TModel item, ArchiveReader? archive = null, bool lowPriority = false, CancellationToken cancellationToken = default); - /// /// A user displayable name for the model type associated with this manager. /// From ca0765a9326100a25994df7acee884a913e60170 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jun 2022 19:46:59 +0900 Subject: [PATCH 1604/2328] Tidy up various delegation implementations --- osu.Game/Scoring/ScoreManager.cs | 50 +++-------------- osu.Game/Skinning/SkinManager.cs | 88 ++++++++---------------------- osu.Game/Stores/BeatmapImporter.cs | 3 - 3 files changed, 32 insertions(+), 109 deletions(-) diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index fbec6ea1fb..e086135296 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -266,57 +266,23 @@ namespace osu.Game.Scoring }); } - public void Delete(List items, bool silent = false) - { - scoreModelManager.Delete(items, silent); - } + public void Delete(List items, bool silent = false) => scoreModelManager.Delete(items, silent); - public void Undelete(List items, bool silent = false) - { - scoreModelManager.Undelete(items, silent); - } + public void Undelete(List items, bool silent = false) => scoreModelManager.Undelete(items, silent); - public void Undelete(ScoreInfo item) - { - scoreModelManager.Undelete(item); - } + public void Undelete(ScoreInfo item) => scoreModelManager.Undelete(item); - public Task Import(params string[] paths) - { - return scoreModelManager.Import(paths); - } + public Task Import(params string[] paths) => scoreModelManager.Import(paths); - public Task Import(params ImportTask[] tasks) - { - return scoreModelManager.Import(tasks); - } + public Task Import(params ImportTask[] tasks) => scoreModelManager.Import(tasks); public IEnumerable HandledExtensions => scoreModelManager.HandledExtensions; - public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) - { - return scoreModelManager.Import(notification, tasks); - } + public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => scoreModelManager.Import(notification, tasks); - public Task> Import(ImportTask task, bool lowPriority = false, CancellationToken cancellationToken = default) - { - return scoreModelManager.Import(task, lowPriority, cancellationToken); - } + public Live Import(ScoreInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) => scoreModelManager.Import(item, archive, lowPriority, cancellationToken); - public Task> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default) - { - return scoreModelManager.Import(archive, lowPriority, cancellationToken); - } - - public Live Import(ScoreInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) - { - return scoreModelManager.Import(item, archive, lowPriority, cancellationToken); - } - - public bool IsAvailableLocally(ScoreInfo model) - { - return scoreModelManager.IsAvailableLocally(model); - } + public bool IsAvailableLocally(ScoreInfo model) => scoreModelManager.IsAvailableLocally(model); #endregion diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index 5e1902f520..e04bdce5fd 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -268,37 +268,21 @@ namespace osu.Game.Skinning set => skinModelManager.PostImport = value; } - public Task Import(params string[] paths) - { - return skinModelManager.Import(paths); - } + public Task Import(params string[] paths) => skinModelManager.Import(paths); - public Task Import(params ImportTask[] tasks) - { - return skinModelManager.Import(tasks); - } + public Task Import(params ImportTask[] tasks) => skinModelManager.Import(tasks); public IEnumerable HandledExtensions => skinModelManager.HandledExtensions; - public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) - { - return skinModelManager.Import(notification, tasks); - } + public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => skinModelManager.Import(notification, tasks); - public Task> Import(ImportTask task, bool lowPriority = false, CancellationToken cancellationToken = default) - { - return skinModelManager.Import(task, lowPriority, cancellationToken); - } + public Task> Import(ImportTask task, bool lowPriority = false, CancellationToken cancellationToken = default) => skinModelManager.Import(task, lowPriority, cancellationToken); - public Task> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default) - { - return skinModelManager.Import(archive, lowPriority, cancellationToken); - } + public Task> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default) => + skinModelManager.Import(archive, lowPriority, cancellationToken); - public Live Import(SkinInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) - { - return skinModelManager.Import(item, archive, lowPriority, cancellationToken); - } + public Live Import(SkinInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) => + skinModelManager.Import(item, archive, lowPriority, cancellationToken); #endregion @@ -323,46 +307,22 @@ namespace osu.Game.Skinning }); } + public bool Delete(SkinInfo item) => skinModelManager.Delete(item); + + public void Delete(List items, bool silent = false) => skinModelManager.Delete(items, silent); + + public void Undelete(List items, bool silent = false) => skinModelManager.Undelete(items, silent); + + public void Undelete(SkinInfo item) => skinModelManager.Undelete(item); + + public bool IsAvailableLocally(SkinInfo model) => skinModelManager.IsAvailableLocally(model); + + public void ReplaceFile(SkinInfo model, RealmNamedFileUsage file, Stream contents) => skinModelManager.ReplaceFile(model, file, contents); + + public void DeleteFile(SkinInfo model, RealmNamedFileUsage file) => skinModelManager.DeleteFile(model, file); + + public void AddFile(SkinInfo model, Stream contents, string filename) => skinModelManager.AddFile(model, contents, filename); + #endregion - - public bool Delete(SkinInfo item) - { - return skinModelManager.Delete(item); - } - - public void Delete(List items, bool silent = false) - { - skinModelManager.Delete(items, silent); - } - - public void Undelete(List items, bool silent = false) - { - skinModelManager.Undelete(items, silent); - } - - public void Undelete(SkinInfo item) - { - skinModelManager.Undelete(item); - } - - public bool IsAvailableLocally(SkinInfo model) - { - return skinModelManager.IsAvailableLocally(model); - } - - public void ReplaceFile(SkinInfo model, RealmNamedFileUsage file, Stream contents) - { - skinModelManager.ReplaceFile(model, file, contents); - } - - public void DeleteFile(SkinInfo model, RealmNamedFileUsage file) - { - skinModelManager.DeleteFile(model, file); - } - - public void AddFile(SkinInfo model, Stream contents, string filename) - { - skinModelManager.AddFile(model, contents, filename); - } } } diff --git a/osu.Game/Stores/BeatmapImporter.cs b/osu.Game/Stores/BeatmapImporter.cs index f04a0210ef..3d89dfeca9 100644 --- a/osu.Game/Stores/BeatmapImporter.cs +++ b/osu.Game/Stores/BeatmapImporter.cs @@ -39,9 +39,6 @@ namespace osu.Game.Stores protected override string[] HashableFileTypes => new[] { ".osu" }; - // protected override bool CheckLocalAvailability(RealmBeatmapSet model, System.Linq.IQueryable items) - // => base.CheckLocalAvailability(model, items) || (model.OnlineID > -1)); - private readonly BeatmapOnlineLookupQueue? onlineLookupQueue; protected BeatmapImporter(RealmAccess realm, Storage storage, BeatmapOnlineLookupQueue? onlineLookupQueue = null) From 9f599a5ab4b32cace5f90cc9eb158a4da90c759f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jun 2022 19:52:30 +0900 Subject: [PATCH 1605/2328] Remove unused `lowPriority` flag from one `Import` method --- .../Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs | 4 ++-- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- osu.Game/Scoring/ScoreManager.cs | 2 +- osu.Game/Skinning/SkinManager.cs | 2 +- osu.Game/Stores/RealmArchiveModelImporter.cs | 5 ++--- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs index db988a544d..278acce3e5 100644 --- a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs +++ b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs @@ -225,10 +225,10 @@ namespace osu.Game.Tests.Online this.testBeatmapManager = testBeatmapManager; } - public override Live Import(BeatmapSetInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) + public override Live Import(BeatmapSetInfo item, ArchiveReader archive = null, CancellationToken cancellationToken = default) { testBeatmapManager.AllowImport.Task.WaitSafely(); - return (testBeatmapManager.CurrentImport = base.Import(item, archive, lowPriority, cancellationToken)); + return (testBeatmapManager.CurrentImport = base.Import(item, archive, cancellationToken)); } } } diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index dba457c81c..1a536a22b1 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -374,7 +374,7 @@ namespace osu.Game.Beatmaps public Live? Import(BeatmapSetInfo item, ArchiveReader? archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) { - return beatmapModelManager.Import(item, archive, lowPriority, cancellationToken); + return beatmapModelManager.Import(item, archive, cancellationToken); } public IEnumerable HandledExtensions => beatmapModelManager.HandledExtensions; diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index e086135296..d42bf1b454 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -280,7 +280,7 @@ namespace osu.Game.Scoring public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => scoreModelManager.Import(notification, tasks); - public Live Import(ScoreInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) => scoreModelManager.Import(item, archive, lowPriority, cancellationToken); + public Live Import(ScoreInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) => scoreModelManager.Import(item, archive, cancellationToken); public bool IsAvailableLocally(ScoreInfo model) => scoreModelManager.IsAvailableLocally(model); diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index e04bdce5fd..7ec922987b 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -282,7 +282,7 @@ namespace osu.Game.Skinning skinModelManager.Import(archive, lowPriority, cancellationToken); public Live Import(SkinInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) => - skinModelManager.Import(item, archive, lowPriority, cancellationToken); + skinModelManager.Import(item, archive, cancellationToken); #endregion diff --git a/osu.Game/Stores/RealmArchiveModelImporter.cs b/osu.Game/Stores/RealmArchiveModelImporter.cs index e7477cfffc..1ff42130b1 100644 --- a/osu.Game/Stores/RealmArchiveModelImporter.cs +++ b/osu.Game/Stores/RealmArchiveModelImporter.cs @@ -250,7 +250,7 @@ namespace osu.Game.Stores return null; } - var scheduledImport = Task.Factory.StartNew(() => Import(model, archive, lowPriority, cancellationToken), + var scheduledImport = Task.Factory.StartNew(() => Import(model, archive, cancellationToken), cancellationToken, TaskCreationOptions.HideScheduler, lowPriority ? import_scheduler_low_priority : import_scheduler); @@ -318,9 +318,8 @@ namespace osu.Game.Stores /// /// The model to be imported. /// An optional archive to use for model population. - /// Whether this is a low priority import. /// An optional cancellation token. - public virtual Live? Import(TModel item, ArchiveReader? archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) + public virtual Live? Import(TModel item, ArchiveReader? archive = null, CancellationToken cancellationToken = default) { return Realm.Run(realm => { From 84e526a2d94d7a20fa53c3a84b0bcdda53a4c70f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jun 2022 20:00:08 +0900 Subject: [PATCH 1606/2328] Move methods around to make more sense --- osu.Game/Stores/RealmArchiveModelImporter.cs | 110 +++++++++---------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/osu.Game/Stores/RealmArchiveModelImporter.cs b/osu.Game/Stores/RealmArchiveModelImporter.cs index 1ff42130b1..4ea2a10288 100644 --- a/osu.Game/Stores/RealmArchiveModelImporter.cs +++ b/osu.Game/Stores/RealmArchiveModelImporter.cs @@ -258,61 +258,6 @@ namespace osu.Game.Stores return await scheduledImport.ConfigureAwait(false); } - /// - /// Any file extensions which should be included in hash creation. - /// Generally should include all file types which determine the file's uniqueness. - /// Large files should be avoided if possible. - /// - /// - /// This is only used by the default hash implementation. If is overridden, it will not be used. - /// - protected abstract string[] HashableFileTypes { get; } - - internal static void LogForModel(TModel? model, string message, Exception? e = null) - { - string trimmedHash; - if (model == null || !model.IsValid || string.IsNullOrEmpty(model.Hash)) - trimmedHash = "?????"; - else - trimmedHash = model.Hash.Substring(0, 5); - - string prefix = $"[{trimmedHash}]"; - - if (e != null) - Logger.Error(e, $"{prefix} {message}", LoggingTarget.Database); - else - Logger.Log($"{prefix} {message}", LoggingTarget.Database); - } - - /// - /// Whether the implementation overrides with a custom implementation. - /// Custom hash implementations must bypass the early exit in the import flow (see usage). - /// - protected virtual bool HasCustomHashFunction => false; - - /// - /// Create a SHA-2 hash from the provided archive based on file content of all files matching . - /// - /// - /// In the case of no matching files, a hash will be generated from the passed archive's . - /// - protected virtual string ComputeHash(TModel item) - { - // for now, concatenate all hashable files in the set to create a unique hash. - MemoryStream hashable = new MemoryStream(); - - foreach (RealmNamedFileUsage file in item.Files.Where(f => HashableFileTypes.Any(ext => f.Filename.EndsWith(ext, StringComparison.OrdinalIgnoreCase))).OrderBy(f => f.Filename)) - { - using (Stream s = Files.Store.GetStream(file.File.GetStoragePath())) - s.CopyTo(hashable); - } - - if (hashable.Length > 0) - return hashable.ComputeSHA2Hash(); - - return item.Hash; - } - /// /// Silently import an item from a . /// @@ -419,6 +364,61 @@ namespace osu.Game.Stores }); } + /// + /// Any file extensions which should be included in hash creation. + /// Generally should include all file types which determine the file's uniqueness. + /// Large files should be avoided if possible. + /// + /// + /// This is only used by the default hash implementation. If is overridden, it will not be used. + /// + protected abstract string[] HashableFileTypes { get; } + + internal static void LogForModel(TModel? model, string message, Exception? e = null) + { + string trimmedHash; + if (model == null || !model.IsValid || string.IsNullOrEmpty(model.Hash)) + trimmedHash = "?????"; + else + trimmedHash = model.Hash.Substring(0, 5); + + string prefix = $"[{trimmedHash}]"; + + if (e != null) + Logger.Error(e, $"{prefix} {message}", LoggingTarget.Database); + else + Logger.Log($"{prefix} {message}", LoggingTarget.Database); + } + + /// + /// Whether the implementation overrides with a custom implementation. + /// Custom hash implementations must bypass the early exit in the import flow (see usage). + /// + protected virtual bool HasCustomHashFunction => false; + + /// + /// Create a SHA-2 hash from the provided archive based on file content of all files matching . + /// + /// + /// In the case of no matching files, a hash will be generated from the passed archive's . + /// + protected virtual string ComputeHash(TModel item) + { + // for now, concatenate all hashable files in the set to create a unique hash. + MemoryStream hashable = new MemoryStream(); + + foreach (RealmNamedFileUsage file in item.Files.Where(f => HashableFileTypes.Any(ext => f.Filename.EndsWith(ext, StringComparison.OrdinalIgnoreCase))).OrderBy(f => f.Filename)) + { + using (Stream s = Files.Store.GetStream(file.File.GetStoragePath())) + s.CopyTo(hashable); + } + + if (hashable.Length > 0) + return hashable.ComputeSHA2Hash(); + + return item.Hash; + } + private string computeHashFast(ArchiveReader reader) { MemoryStream hashable = new MemoryStream(); From e96c5ce70375a9011da05a4e8bc61a01a7ec16f1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jun 2022 20:00:16 +0900 Subject: [PATCH 1607/2328] Move and correct xmldoc to interfaces --- osu.Game/Database/ICanAcceptFiles.cs | 10 +++++++++- osu.Game/Stores/RealmArchiveModelImporter.cs | 8 -------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game/Database/ICanAcceptFiles.cs b/osu.Game/Database/ICanAcceptFiles.cs index 74fd6fcc36..3cec3b8a8e 100644 --- a/osu.Game/Database/ICanAcceptFiles.cs +++ b/osu.Game/Database/ICanAcceptFiles.cs @@ -12,14 +12,22 @@ namespace osu.Game.Database public interface ICanAcceptFiles { /// - /// Import the specified paths. + /// Import one or more items from filesystem . /// + /// + /// This will be treated as a low priority batch import if more than one path is specified. + /// This will post notifications tracking progress. + /// /// The files which should be imported. Task Import(params string[] paths); /// /// Import the specified files from the given import tasks. /// + /// + /// This will be treated as a low priority batch import if more than one path is specified. + /// This will post notifications tracking progress. + /// /// The import tasks from which the files should be imported. Task Import(params ImportTask[] tasks); diff --git a/osu.Game/Stores/RealmArchiveModelImporter.cs b/osu.Game/Stores/RealmArchiveModelImporter.cs index 4ea2a10288..35ec0c8532 100644 --- a/osu.Game/Stores/RealmArchiveModelImporter.cs +++ b/osu.Game/Stores/RealmArchiveModelImporter.cs @@ -78,14 +78,6 @@ namespace osu.Game.Stores Files = new RealmFileStore(realm, storage); } - /// - /// Import one or more items from filesystem . - /// - /// - /// This will be treated as a low priority import if more than one path is specified; use to always import at standard priority. - /// This will post notifications tracking progress. - /// - /// One or more archive locations on disk. public Task Import(params string[] paths) { var notification = new ProgressNotification { State = ProgressNotificationState.Active }; From 6250caca29a086a4d8861c5b8c1a13e2510af1dd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jun 2022 20:01:11 +0900 Subject: [PATCH 1608/2328] Remove duplicate implementation of same thing --- osu.Game/Stores/RealmArchiveModelImporter.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/osu.Game/Stores/RealmArchiveModelImporter.cs b/osu.Game/Stores/RealmArchiveModelImporter.cs index 35ec0c8532..82b77bfb05 100644 --- a/osu.Game/Stores/RealmArchiveModelImporter.cs +++ b/osu.Game/Stores/RealmArchiveModelImporter.cs @@ -78,14 +78,7 @@ namespace osu.Game.Stores Files = new RealmFileStore(realm, storage); } - public Task Import(params string[] paths) - { - var notification = new ProgressNotification { State = ProgressNotificationState.Active }; - - PostNotification?.Invoke(notification); - - return Import(notification, paths.Select(p => new ImportTask(p)).ToArray()); - } + public Task Import(params string[] paths) => Import(paths.Select(p => new ImportTask(p)).ToArray()); public Task Import(params ImportTask[] tasks) { From 94ba71aa1323d27ccf97949b914ca15e9b61fd85 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jun 2022 20:21:28 +0900 Subject: [PATCH 1609/2328] Remove one more usage of `lowPriority` --- osu.Game/Beatmaps/BeatmapManager.cs | 30 ++++++----------------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 1a536a22b1..51f4d23bb4 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -347,35 +347,17 @@ namespace osu.Game.Beatmaps #region Implementation of ICanAcceptFiles - public Task Import(params string[] paths) - { - return beatmapModelManager.Import(paths); - } + public Task Import(params string[] paths) => beatmapModelManager.Import(paths); - public Task Import(params ImportTask[] tasks) - { - return beatmapModelManager.Import(tasks); - } + public Task Import(params ImportTask[] tasks) => beatmapModelManager.Import(tasks); - public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) - { - return beatmapModelManager.Import(notification, tasks); - } + public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => beatmapModelManager.Import(notification, tasks); - public Task?> Import(ImportTask task, bool lowPriority = false, CancellationToken cancellationToken = default) - { - return beatmapModelManager.Import(task, lowPriority, cancellationToken); - } + public Task?> Import(ImportTask task, bool lowPriority = false, CancellationToken cancellationToken = default) => beatmapModelManager.Import(task, lowPriority, cancellationToken); - public Task?> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default) - { - return beatmapModelManager.Import(archive, lowPriority, cancellationToken); - } + public Task?> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default) => beatmapModelManager.Import(archive, lowPriority, cancellationToken); - public Live? Import(BeatmapSetInfo item, ArchiveReader? archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) - { - return beatmapModelManager.Import(item, archive, cancellationToken); - } + public Live? Import(BeatmapSetInfo item, ArchiveReader? archive = null, CancellationToken cancellationToken = default) => beatmapModelManager.Import(item, archive, cancellationToken); public IEnumerable HandledExtensions => beatmapModelManager.HandledExtensions; From 2634e569440d8ada58be6995f07929d5d42a1ae9 Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Tue, 14 Jun 2022 16:16:12 +0100 Subject: [PATCH 1610/2328] Further adjustments --- .../Difficulty/Evaluators/SpeedEvaluator.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs index e68e7a8653..3be4d621eb 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs @@ -41,8 +41,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators { double currDeltaTime = Math.Max(1, osuCurrObj.DeltaTime); double nextDeltaTime = Math.Max(1, osuNextObj.DeltaTime); - double speedRatio = Math.Min(1, currDeltaTime / nextDeltaTime); - double windowRatio = Math.Min(1, currDeltaTime / greatWindowFull); + double deltaDifference = Math.Abs(nextDeltaTime - currDeltaTime); + double speedRatio = Math.Min(1, currDeltaTime / deltaDifference); + double windowRatio = Math.Pow(Math.Min(1, currDeltaTime / greatWindowFull), 2); doubletapness = Math.Pow(speedRatio, 1 - windowRatio); } From 7affef75b05ac886b74f7d5580ba8d2ab4714faa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jun 2022 20:25:38 +0900 Subject: [PATCH 1611/2328] Remove unused `Import` method in `SkinManager` --- osu.Game/Skinning/SkinManager.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index 7ec922987b..6002bafa8d 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -281,9 +281,6 @@ namespace osu.Game.Skinning public Task> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default) => skinModelManager.Import(archive, lowPriority, cancellationToken); - public Live Import(SkinInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) => - skinModelManager.Import(item, archive, cancellationToken); - #endregion #region Implementation of IModelManager From 2f8290831a3a370ae2d677b4227a60e9e5589f1c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jun 2022 20:34:23 +0900 Subject: [PATCH 1612/2328] Skip quick import clause when importing a single item Closes https://github.com/ppy/osu/issues/18600. --- ...eneOnlinePlayBeatmapAvailabilityTracker.cs | 4 +- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- osu.Game/Scoring/ScoreManager.cs | 2 +- osu.Game/Stores/RealmArchiveModelImporter.cs | 156 +++++++++--------- 4 files changed, 81 insertions(+), 83 deletions(-) diff --git a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs index 278acce3e5..5cae576db1 100644 --- a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs +++ b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs @@ -225,10 +225,10 @@ namespace osu.Game.Tests.Online this.testBeatmapManager = testBeatmapManager; } - public override Live Import(BeatmapSetInfo item, ArchiveReader archive = null, CancellationToken cancellationToken = default) + public override Live Import(BeatmapSetInfo item, ArchiveReader archive = null, bool quickSkipIfExisting = false, CancellationToken cancellationToken = default) { testBeatmapManager.AllowImport.Task.WaitSafely(); - return (testBeatmapManager.CurrentImport = base.Import(item, archive, cancellationToken)); + return (testBeatmapManager.CurrentImport = base.Import(item, archive, quickSkipIfExisting, cancellationToken)); } } } diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 51f4d23bb4..ab614106cc 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -357,7 +357,7 @@ namespace osu.Game.Beatmaps public Task?> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default) => beatmapModelManager.Import(archive, lowPriority, cancellationToken); - public Live? Import(BeatmapSetInfo item, ArchiveReader? archive = null, CancellationToken cancellationToken = default) => beatmapModelManager.Import(item, archive, cancellationToken); + public Live? Import(BeatmapSetInfo item, ArchiveReader? archive = null, CancellationToken cancellationToken = default) => beatmapModelManager.Import(item, archive, false, cancellationToken); public IEnumerable HandledExtensions => beatmapModelManager.HandledExtensions; diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index d42bf1b454..e086135296 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -280,7 +280,7 @@ namespace osu.Game.Scoring public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => scoreModelManager.Import(notification, tasks); - public Live Import(ScoreInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) => scoreModelManager.Import(item, archive, cancellationToken); + public Live Import(ScoreInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) => scoreModelManager.Import(item, archive, lowPriority, cancellationToken); public bool IsAvailableLocally(ScoreInfo model) => scoreModelManager.IsAvailableLocally(model); diff --git a/osu.Game/Stores/RealmArchiveModelImporter.cs b/osu.Game/Stores/RealmArchiveModelImporter.cs index 82b77bfb05..ac8a38fe37 100644 --- a/osu.Game/Stores/RealmArchiveModelImporter.cs +++ b/osu.Game/Stores/RealmArchiveModelImporter.cs @@ -235,7 +235,7 @@ namespace osu.Game.Stores return null; } - var scheduledImport = Task.Factory.StartNew(() => Import(model, archive, cancellationToken), + var scheduledImport = Task.Factory.StartNew(() => Import(model, archive, lowPriority, cancellationToken), cancellationToken, TaskCreationOptions.HideScheduler, lowPriority ? import_scheduler_low_priority : import_scheduler); @@ -248,106 +248,104 @@ namespace osu.Game.Stores /// /// The model to be imported. /// An optional archive to use for model population. + /// If true, imports will be skipped before they begin, given an existing model matches on hash and filenames. Should generally only be used for large batch imports, as it may defy user expectations when updating an existing model. /// An optional cancellation token. - public virtual Live? Import(TModel item, ArchiveReader? archive = null, CancellationToken cancellationToken = default) + public virtual Live? Import(TModel item, ArchiveReader? archive = null, bool quickSkipIfExisting = false, CancellationToken cancellationToken = default) => Realm.Run(realm => { - return Realm.Run(realm => + cancellationToken.ThrowIfCancellationRequested(); + + bool checkedExisting = false; + TModel? existing = null; + + if (quickSkipIfExisting && archive != null && !HasCustomHashFunction) { - cancellationToken.ThrowIfCancellationRequested(); + // this is a fast bail condition to improve large import performance. + item.Hash = computeHashFast(archive); - bool checkedExisting = false; - TModel? existing = null; + checkedExisting = true; + existing = CheckForExisting(item, realm); - if (archive != null && !HasCustomHashFunction) + if (existing != null) { - // this is a fast bail condition to improve large import performance. - item.Hash = computeHashFast(archive); + // bare minimum comparisons + // + // note that this should really be checking filesizes on disk (of existing files) for some degree of sanity. + // or alternatively doing a faster hash check. either of these require database changes and reprocessing of existing files. + if (CanSkipImport(existing, item) && + getFilenames(existing.Files).SequenceEqual(getShortenedFilenames(archive).Select(p => p.shortened).OrderBy(f => f)) && + checkAllFilesExist(existing)) + { + LogForModel(item, @$"Found existing (optimised) {HumanisedModelName} for {item} (ID {existing.ID}) – skipping import."); - checkedExisting = true; - existing = CheckForExisting(item, realm); + using (var transaction = realm.BeginWrite()) + { + UndeleteForReuse(existing); + transaction.Commit(); + } + + return existing.ToLive(Realm); + } + + LogForModel(item, @"Found existing (optimised) but failed pre-check."); + } + } + + try + { + LogForModel(item, @"Beginning import..."); + + // TODO: do we want to make the transaction this local? not 100% sure, will need further investigation. + using (var transaction = realm.BeginWrite()) + { + if (archive != null) + // TODO: look into rollback of file additions (or delayed commit). + item.Files.AddRange(createFileInfos(archive, Files, realm)); + + item.Hash = ComputeHash(item); + + // TODO: we may want to run this outside of the transaction. + Populate(item, archive, realm, cancellationToken); + + if (!checkedExisting) + existing = CheckForExisting(item, realm); if (existing != null) { - // bare minimum comparisons - // - // note that this should really be checking filesizes on disk (of existing files) for some degree of sanity. - // or alternatively doing a faster hash check. either of these require database changes and reprocessing of existing files. - if (CanSkipImport(existing, item) && - getFilenames(existing.Files).SequenceEqual(getShortenedFilenames(archive).Select(p => p.shortened).OrderBy(f => f)) && - checkAllFilesExist(existing)) + if (CanReuseExisting(existing, item)) { - LogForModel(item, @$"Found existing (optimised) {HumanisedModelName} for {item} (ID {existing.ID}) – skipping import."); + LogForModel(item, @$"Found existing {HumanisedModelName} for {item} (ID {existing.ID}) – skipping import."); - using (var transaction = realm.BeginWrite()) - { - UndeleteForReuse(existing); - transaction.Commit(); - } + UndeleteForReuse(existing); + transaction.Commit(); return existing.ToLive(Realm); } - LogForModel(item, @"Found existing (optimised) but failed pre-check."); - } - } + LogForModel(item, @"Found existing but failed re-use check."); - try - { - LogForModel(item, @"Beginning import..."); - - // TODO: do we want to make the transaction this local? not 100% sure, will need further investigation. - using (var transaction = realm.BeginWrite()) - { - if (archive != null) - // TODO: look into rollback of file additions (or delayed commit). - item.Files.AddRange(createFileInfos(archive, Files, realm)); - - item.Hash = ComputeHash(item); - - // TODO: we may want to run this outside of the transaction. - Populate(item, archive, realm, cancellationToken); - - if (!checkedExisting) - existing = CheckForExisting(item, realm); - - if (existing != null) - { - if (CanReuseExisting(existing, item)) - { - LogForModel(item, @$"Found existing {HumanisedModelName} for {item} (ID {existing.ID}) – skipping import."); - - UndeleteForReuse(existing); - transaction.Commit(); - - return existing.ToLive(Realm); - } - - LogForModel(item, @"Found existing but failed re-use check."); - - existing.DeletePending = true; - } - - PreImport(item, realm); - - // import to store - realm.Add(item); - - transaction.Commit(); + existing.DeletePending = true; } - LogForModel(item, @"Import successfully completed!"); - } - catch (Exception e) - { - if (!(e is TaskCanceledException)) - LogForModel(item, @"Database import or population failed and has been rolled back.", e); + PreImport(item, realm); - throw; + // import to store + realm.Add(item); + + transaction.Commit(); } - return (Live?)item.ToLive(Realm); - }); - } + LogForModel(item, @"Import successfully completed!"); + } + catch (Exception e) + { + if (!(e is TaskCanceledException)) + LogForModel(item, @"Database import or population failed and has been rolled back.", e); + + throw; + } + + return (Live?)item.ToLive(Realm); + }); /// /// Any file extensions which should be included in hash creation. From f11fe543859fcefed2a94145e47d399c5d5b14f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 00:27:09 +0900 Subject: [PATCH 1613/2328] Remove custom hash function flow --- .../Database/BeatmapImporterTests.cs | 23 +++++-------------- osu.Game/Skinning/SkinModelManager.cs | 2 -- osu.Game/Stores/RealmArchiveModelImporter.cs | 10 ++------ osu.Game/Tests/Visual/EditorTestScene.cs | 13 +---------- 4 files changed, 9 insertions(+), 39 deletions(-) diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index d4956e97e0..ab40ed2453 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Collections.Generic; using System.Diagnostics; @@ -12,7 +14,6 @@ using NUnit.Framework; using osu.Framework.Extensions; using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Logging; -using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Extensions; @@ -28,8 +29,6 @@ using SharpCompress.Archives.Zip; using SharpCompress.Common; using SharpCompress.Writers.Zip; -#nullable enable - namespace osu.Game.Tests.Database { [TestFixture] @@ -622,7 +621,7 @@ namespace osu.Game.Tests.Database using var importer = new BeatmapModelManager(realm, storage); using var store = new RealmRulesetStore(realm, storage); - var imported = await LoadOszIntoStore(importer, realm.Realm); + var imported = await LoadOszIntoStore(importer, realm.Realm, batchImport: true); deleteBeatmapSet(imported, realm.Realm); @@ -678,7 +677,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new NonOptimisedBeatmapImporter(realm, storage); + using var importer = new BeatmapModelManager(realm, storage); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -960,11 +959,11 @@ namespace osu.Game.Tests.Database return realm.All().FirstOrDefault(beatmapSet => beatmapSet.ID == importedSet!.ID); } - public static async Task LoadOszIntoStore(BeatmapImporter importer, Realm realm, string? path = null, bool virtualTrack = false) + public static async Task LoadOszIntoStore(BeatmapImporter importer, Realm realm, string? path = null, bool virtualTrack = false, bool batchImport = false) { string? temp = path ?? TestResources.GetTestBeatmapForImport(virtualTrack); - var importedSet = await importer.Import(new ImportTask(temp)); + var importedSet = await importer.Import(new ImportTask(temp), batchImport); Assert.NotNull(importedSet); Debug.Assert(importedSet != null); @@ -1081,15 +1080,5 @@ namespace osu.Game.Tests.Database Assert.Fail(failureMessage); } - - public class NonOptimisedBeatmapImporter : BeatmapImporter - { - public NonOptimisedBeatmapImporter(RealmAccess realm, Storage storage) - : base(realm, storage) - { - } - - protected override bool HasCustomHashFunction => true; - } } } diff --git a/osu.Game/Skinning/SkinModelManager.cs b/osu.Game/Skinning/SkinModelManager.cs index 23813e8eb2..0a18449800 100644 --- a/osu.Game/Skinning/SkinModelManager.cs +++ b/osu.Game/Skinning/SkinModelManager.cs @@ -46,8 +46,6 @@ namespace osu.Game.Skinning private const string unknown_creator_string = @"Unknown"; - protected override bool HasCustomHashFunction => true; - protected override void Populate(SkinInfo model, ArchiveReader? archive, Realm realm, CancellationToken cancellationToken = default) { var skinInfoFile = model.Files.SingleOrDefault(f => f.Filename == skin_info_file); diff --git a/osu.Game/Stores/RealmArchiveModelImporter.cs b/osu.Game/Stores/RealmArchiveModelImporter.cs index ac8a38fe37..976b26aac2 100644 --- a/osu.Game/Stores/RealmArchiveModelImporter.cs +++ b/osu.Game/Stores/RealmArchiveModelImporter.cs @@ -257,7 +257,7 @@ namespace osu.Game.Stores bool checkedExisting = false; TModel? existing = null; - if (quickSkipIfExisting && archive != null && !HasCustomHashFunction) + if (quickSkipIfExisting && archive != null) { // this is a fast bail condition to improve large import performance. item.Hash = computeHashFast(archive); @@ -373,19 +373,13 @@ namespace osu.Game.Stores Logger.Log($"{prefix} {message}", LoggingTarget.Database); } - /// - /// Whether the implementation overrides with a custom implementation. - /// Custom hash implementations must bypass the early exit in the import flow (see usage). - /// - protected virtual bool HasCustomHashFunction => false; - /// /// Create a SHA-2 hash from the provided archive based on file content of all files matching . /// /// /// In the case of no matching files, a hash will be generated from the passed archive's . /// - protected virtual string ComputeHash(TModel item) + protected string ComputeHash(TModel item) { // for now, concatenate all hashable files in the set to create a unique hash. MemoryStream hashable = new MemoryStream(); diff --git a/osu.Game/Tests/Visual/EditorTestScene.cs b/osu.Game/Tests/Visual/EditorTestScene.cs index 46f31ae53b..8e9bb6ff78 100644 --- a/osu.Game/Tests/Visual/EditorTestScene.cs +++ b/osu.Game/Tests/Visual/EditorTestScene.cs @@ -147,7 +147,7 @@ namespace osu.Game.Tests.Visual protected override BeatmapModelManager CreateBeatmapModelManager(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapOnlineLookupQueue onlineLookupQueue) { - return new TestBeatmapModelManager(storage, realm, onlineLookupQueue); + return new BeatmapModelManager(realm, storage, onlineLookupQueue); } protected override WorkingBeatmapCache CreateWorkingBeatmapCache(AudioManager audioManager, IResourceStore resources, IResourceStore storage, WorkingBeatmap defaultBeatmap, GameHost host) @@ -181,17 +181,6 @@ namespace osu.Game.Tests.Visual => testBeatmapManager.TestBeatmap; } - internal class TestBeatmapModelManager : BeatmapModelManager - { - public TestBeatmapModelManager(Storage storage, RealmAccess databaseAccess, BeatmapOnlineLookupQueue beatmapOnlineLookupQueue) - : base(databaseAccess, storage, beatmapOnlineLookupQueue) - { - } - - protected override string ComputeHash(BeatmapSetInfo item) - => string.Empty; - } - public override void Save(BeatmapInfo info, IBeatmap beatmapContent, ISkin beatmapSkin = null) { // don't actually care about saving for this context. From 88d5e074a8c6ca4060101ca0747bfc5bf01b4f1a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 00:46:00 +0900 Subject: [PATCH 1614/2328] Rename `lowPriority` to `batchImport` --- ...eneOnlinePlayBeatmapAvailabilityTracker.cs | 4 +-- osu.Game/Beatmaps/BeatmapManager.cs | 4 +-- osu.Game/Scoring/ScoreManager.cs | 2 +- osu.Game/Skinning/SkinManager.cs | 6 ++-- osu.Game/Stores/RealmArchiveModelImporter.cs | 33 ++++++++----------- 5 files changed, 22 insertions(+), 27 deletions(-) diff --git a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs index 5cae576db1..4f255ddd00 100644 --- a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs +++ b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs @@ -225,10 +225,10 @@ namespace osu.Game.Tests.Online this.testBeatmapManager = testBeatmapManager; } - public override Live Import(BeatmapSetInfo item, ArchiveReader archive = null, bool quickSkipIfExisting = false, CancellationToken cancellationToken = default) + public override Live Import(BeatmapSetInfo item, ArchiveReader archive = null, bool batchImport = false, CancellationToken cancellationToken = default) { testBeatmapManager.AllowImport.Task.WaitSafely(); - return (testBeatmapManager.CurrentImport = base.Import(item, archive, quickSkipIfExisting, cancellationToken)); + return (testBeatmapManager.CurrentImport = base.Import(item, archive, batchImport, cancellationToken)); } } } diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index ab614106cc..e156c2b430 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -353,9 +353,9 @@ namespace osu.Game.Beatmaps public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => beatmapModelManager.Import(notification, tasks); - public Task?> Import(ImportTask task, bool lowPriority = false, CancellationToken cancellationToken = default) => beatmapModelManager.Import(task, lowPriority, cancellationToken); + public Task?> Import(ImportTask task, bool batchImport = false, CancellationToken cancellationToken = default) => beatmapModelManager.Import(task, batchImport, cancellationToken); - public Task?> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default) => beatmapModelManager.Import(archive, lowPriority, cancellationToken); + public Task?> Import(ArchiveReader archive, bool batchImport = false, CancellationToken cancellationToken = default) => beatmapModelManager.Import(archive, batchImport, cancellationToken); public Live? Import(BeatmapSetInfo item, ArchiveReader? archive = null, CancellationToken cancellationToken = default) => beatmapModelManager.Import(item, archive, false, cancellationToken); diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index e086135296..e857d2109f 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -280,7 +280,7 @@ namespace osu.Game.Scoring public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => scoreModelManager.Import(notification, tasks); - public Live Import(ScoreInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) => scoreModelManager.Import(item, archive, lowPriority, cancellationToken); + public Live Import(ScoreInfo item, ArchiveReader archive = null, bool batchImport = false, CancellationToken cancellationToken = default) => scoreModelManager.Import(item, archive, batchImport, cancellationToken); public bool IsAvailableLocally(ScoreInfo model) => scoreModelManager.IsAvailableLocally(model); diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index 6002bafa8d..f296386d34 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -276,10 +276,10 @@ namespace osu.Game.Skinning public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => skinModelManager.Import(notification, tasks); - public Task> Import(ImportTask task, bool lowPriority = false, CancellationToken cancellationToken = default) => skinModelManager.Import(task, lowPriority, cancellationToken); + public Task> Import(ImportTask task, bool batchImport = false, CancellationToken cancellationToken = default) => skinModelManager.Import(task, batchImport, cancellationToken); - public Task> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default) => - skinModelManager.Import(archive, lowPriority, cancellationToken); + public Task> Import(ArchiveReader archive, bool batchImport = false, CancellationToken cancellationToken = default) => + skinModelManager.Import(archive, batchImport, cancellationToken); #endregion diff --git a/osu.Game/Stores/RealmArchiveModelImporter.cs b/osu.Game/Stores/RealmArchiveModelImporter.cs index 976b26aac2..c6231e5583 100644 --- a/osu.Game/Stores/RealmArchiveModelImporter.cs +++ b/osu.Game/Stores/RealmArchiveModelImporter.cs @@ -34,11 +34,6 @@ namespace osu.Game.Stores { private const int import_queue_request_concurrency = 1; - /// - /// The size of a batch import operation before considering it a lower priority operation. - /// - private const int low_priority_import_batch_size = 1; - /// /// A singleton scheduler shared by all . /// @@ -49,11 +44,11 @@ namespace osu.Game.Stores private static readonly ThreadedTaskScheduler import_scheduler = new ThreadedTaskScheduler(import_queue_request_concurrency, nameof(RealmArchiveModelImporter)); /// - /// A second scheduler for lower priority imports. + /// A second scheduler for batch imports. /// For simplicity, these will just run in parallel with normal priority imports, but a future refactor would see this implemented via a custom scheduler/queue. /// See https://gist.github.com/peppy/f0e118a14751fc832ca30dd48ba3876b for an incomplete version of this. /// - private static readonly ThreadedTaskScheduler import_scheduler_low_priority = new ThreadedTaskScheduler(import_queue_request_concurrency, nameof(RealmArchiveModelImporter)); + private static readonly ThreadedTaskScheduler import_scheduler_batch = new ThreadedTaskScheduler(import_queue_request_concurrency, nameof(RealmArchiveModelImporter)); public virtual IEnumerable HandledExtensions => new[] { @".zip" }; @@ -105,7 +100,7 @@ namespace osu.Game.Stores var imported = new List>(); - bool isLowPriorityImport = tasks.Length > low_priority_import_batch_size; + bool isBatchImport = tasks.Length > 1; try { @@ -115,7 +110,7 @@ namespace osu.Game.Stores try { - var model = await Import(task, isLowPriorityImport, notification.CancellationToken).ConfigureAwait(false); + var model = await Import(task, isBatchImport, notification.CancellationToken).ConfigureAwait(false); lock (imported) { @@ -178,16 +173,16 @@ namespace osu.Game.Stores /// Note that this bypasses the UI flow and should only be used for special cases or testing. /// /// The containing data about the to import. - /// Whether this is a low priority import. + /// Whether this is a low priority import. /// An optional cancellation token. /// The imported model, if successful. - public async Task?> Import(ImportTask task, bool lowPriority = false, CancellationToken cancellationToken = default) + public async Task?> Import(ImportTask task, bool batchImport = false, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); Live? import; using (ArchiveReader reader = task.GetReader()) - import = await Import(reader, lowPriority, cancellationToken).ConfigureAwait(false); + import = await Import(reader, batchImport, cancellationToken).ConfigureAwait(false); // We may or may not want to delete the file depending on where it is stored. // e.g. reconstructing/repairing database with items from default storage. @@ -210,9 +205,9 @@ namespace osu.Game.Stores /// Silently import an item from an . /// /// The archive to be imported. - /// Whether this is a low priority import. + /// Whether this is a low priority import. /// An optional cancellation token. - public async Task?> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default) + public async Task?> Import(ArchiveReader archive, bool batchImport = false, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -235,10 +230,10 @@ namespace osu.Game.Stores return null; } - var scheduledImport = Task.Factory.StartNew(() => Import(model, archive, lowPriority, cancellationToken), + var scheduledImport = Task.Factory.StartNew(() => Import(model, archive, batchImport, cancellationToken), cancellationToken, TaskCreationOptions.HideScheduler, - lowPriority ? import_scheduler_low_priority : import_scheduler); + batchImport ? import_scheduler_batch : import_scheduler); return await scheduledImport.ConfigureAwait(false); } @@ -248,16 +243,16 @@ namespace osu.Game.Stores /// /// The model to be imported. /// An optional archive to use for model population. - /// If true, imports will be skipped before they begin, given an existing model matches on hash and filenames. Should generally only be used for large batch imports, as it may defy user expectations when updating an existing model. + /// If true, imports will be skipped before they begin, given an existing model matches on hash and filenames. Should generally only be used for large batch imports, as it may defy user expectations when updating an existing model. /// An optional cancellation token. - public virtual Live? Import(TModel item, ArchiveReader? archive = null, bool quickSkipIfExisting = false, CancellationToken cancellationToken = default) => Realm.Run(realm => + public virtual Live? Import(TModel item, ArchiveReader? archive = null, bool batchImport = false, CancellationToken cancellationToken = default) => Realm.Run(realm => { cancellationToken.ThrowIfCancellationRequested(); bool checkedExisting = false; TModel? existing = null; - if (quickSkipIfExisting && archive != null) + if (batchImport && archive != null) { // this is a fast bail condition to improve large import performance. item.Hash = computeHashFast(archive); From cac724f43679950579ba217d3a337d6d96d0d9da Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 00:48:00 +0900 Subject: [PATCH 1615/2328] Re-enable ignored tests that will work again now --- osu.Game.Tests/Database/BeatmapImporterTests.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index ab40ed2453..de2bbeb791 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -393,7 +393,6 @@ namespace osu.Game.Tests.Database } [Test] - [Ignore("intentionally broken by import optimisations")] public void TestImportThenImportWithChangedFile() { RunTestWithRealmAsync(async (realm, storage) => @@ -490,7 +489,6 @@ namespace osu.Game.Tests.Database } [Test] - [Ignore("intentionally broken by import optimisations")] public void TestImportCorruptThenImport() { RunTestWithRealmAsync(async (realm, storage) => @@ -502,16 +500,18 @@ namespace osu.Game.Tests.Database var firstFile = imported.Files.First(); + var fileStorage = storage.GetStorageForDirectory("files"); + long originalLength; - using (var stream = storage.GetStream(firstFile.File.GetStoragePath())) + using (var stream = fileStorage.GetStream(firstFile.File.GetStoragePath())) originalLength = stream.Length; - using (var stream = storage.CreateFileSafely(firstFile.File.GetStoragePath())) + using (var stream = fileStorage.CreateFileSafely(firstFile.File.GetStoragePath())) stream.WriteByte(0); var importedSecondTime = await LoadOszIntoStore(importer, realm.Realm); - using (var stream = storage.GetStream(firstFile.File.GetStoragePath())) + using (var stream = fileStorage.GetStream(firstFile.File.GetStoragePath())) Assert.AreEqual(stream.Length, originalLength, "Corruption was not fixed on second import"); // check the newly "imported" beatmap is actually just the restored previous import. since it matches hash. From 6be42094581b72719011148b8018463ebe4057b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 01:04:43 +0900 Subject: [PATCH 1616/2328] Fix `AlwaysPresent` specification in wrong container --- osu.Game/Screens/Play/HUDOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 6419532221..89329bfc65 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -94,6 +94,7 @@ namespace osu.Game.Screens.Play { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, + AlwaysPresent = true, Margin = new MarginPadding(10), Spacing = new Vector2(10), AutoSizeAxes = Axes.Both, @@ -111,7 +112,6 @@ namespace osu.Game.Screens.Play Margin = new MarginPadding(10), Spacing = new Vector2(10), AutoSizeAxes = Axes.Both, - AlwaysPresent = true, LayoutDuration = FADE_DURATION / 2, LayoutEasing = FADE_EASING, Direction = FillDirection.Vertical, From cd74f22e12b67165899120e17edf5456e66e2aae Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 14 Jun 2022 19:04:01 +0300 Subject: [PATCH 1617/2328] Add failing test case --- .../Visual/Menus/TestSceneToolbar.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs index dbc7e54b5e..eb77453199 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs @@ -6,11 +6,16 @@ using Moq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Testing; +using osu.Game.Graphics.Containers; using osu.Game.Overlays; using osu.Game.Overlays.Toolbar; using osu.Game.Rulesets; +using osuTK.Graphics; using osuTK.Input; namespace osu.Game.Tests.Visual.Menus @@ -95,6 +100,28 @@ namespace osu.Game.Tests.Visual.Menus AddAssert("toolbar is visible", () => toolbar.State.Value == Visibility.Visible); } + [Test] + public void TestScrollInput() + { + OsuScrollContainer scroll = null; + + AddStep("add scroll layer", () => Add(scroll = new OsuScrollContainer + { + Depth = 1f, + RelativeSizeAxes = Axes.Both, + Child = new Box + { + RelativeSizeAxes = Axes.X, + Height = DrawHeight * 2, + Colour = ColourInfo.GradientVertical(Color4.Gray, Color4.DarkGray), + } + })); + + AddStep("hover toolbar", () => InputManager.MoveMouseTo(toolbar)); + AddStep("perform scroll", () => InputManager.ScrollVerticalBy(500)); + AddAssert("not scrolled", () => scroll.Current == 0); + } + public class TestToolbar : Toolbar { public new Bindable OverlayActivationMode => base.OverlayActivationMode as Bindable; From d89c11e49e8cf37a24afbafbfa723166a90d4464 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 14 Jun 2022 19:04:32 +0300 Subject: [PATCH 1618/2328] Allow `Toolbar` to block scroll input from passing through --- osu.Game/Overlays/Toolbar/Toolbar.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index b7fb2e45be..3b6e99fe98 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -41,8 +41,6 @@ namespace osu.Game.Overlays.Toolbar // Toolbar and its components need keyboard input even when hidden. public override bool PropagateNonPositionalInputSubTree => true; - protected override bool BlockScrollInput => false; - public Toolbar() { RelativeSizeAxes = Axes.X; From 49ec2572b8e5bc9eec1d0e929a8bd79878a25da4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 01:43:10 +0900 Subject: [PATCH 1619/2328] Allow scrolling overflow of ruleset buttons in the toolbar --- osu.Game/Overlays/Toolbar/Toolbar.cs | 141 ++++++++++++++++----- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 2 +- 2 files changed, 107 insertions(+), 36 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 3b6e99fe98..1e21e7e16c 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -14,6 +14,7 @@ using osu.Framework.Bindables; using osu.Framework.Input.Events; using osu.Game.Rulesets; using osu.Framework.Input.Bindings; +using osu.Game.Graphics.Containers; using osu.Game.Input.Bindings; namespace osu.Game.Overlays.Toolbar @@ -65,45 +66,115 @@ namespace osu.Game.Overlays.Toolbar Children = new Drawable[] { new ToolbarBackground(), - new FillFlowContainer + new GridContainer { - Direction = FillDirection.Horizontal, - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, - Children = new Drawable[] + RelativeSizeAxes = Axes.Both, + ColumnDimensions = new[] { - new ToolbarSettingsButton(), - new ToolbarHomeButton + new Dimension(GridSizeMode.AutoSize), + new Dimension(), + new Dimension(GridSizeMode.AutoSize) + }, + Content = new[] + { + new Drawable[] { - Action = () => OnHome?.Invoke() + new Container + { + Name = "Left buttons", + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Depth = float.MinValue, + Children = new Drawable[] + { + new Box + { + Colour = OsuColour.Gray(0.1f), + RelativeSizeAxes = Axes.Both, + }, + new FillFlowContainer + { + Direction = FillDirection.Horizontal, + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Children = new Drawable[] + { + new ToolbarSettingsButton(), + new ToolbarHomeButton + { + Action = () => OnHome?.Invoke() + }, + }, + }, + } + }, + new Container + { + Name = "Ruleset selector", + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new OsuScrollContainer(Direction.Horizontal) + { + ScrollbarVisible = false, + RelativeSizeAxes = Axes.Both, + Masking = false, + Children = new Drawable[] + { + rulesetSelector = new ToolbarRulesetSelector() + } + }, + new Box + { + Colour = ColourInfo.GradientHorizontal(OsuColour.Gray(0.1f).Opacity(0), OsuColour.Gray(0.1f)), + Width = 50, + RelativeSizeAxes = Axes.Y, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + }, + } + }, + new Container + { + Name = "Right buttons", + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Children = new Drawable[] + { + new Box + { + Colour = OsuColour.Gray(0.1f), + RelativeSizeAxes = Axes.Both, + }, + new FillFlowContainer + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Direction = FillDirection.Horizontal, + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Children = new Drawable[] + { + new ToolbarNewsButton(), + new ToolbarChangelogButton(), + new ToolbarRankingsButton(), + new ToolbarBeatmapListingButton(), + new ToolbarChatButton(), + new ToolbarSocialButton(), + new ToolbarWikiButton(), + new ToolbarMusicButton(), + //new ToolbarButton + //{ + // Icon = FontAwesome.Solid.search + //}, + userButton = new ToolbarUserButton(), + new ToolbarClock(), + new ToolbarNotificationButton(), + } + }, + } + }, }, - rulesetSelector = new ToolbarRulesetSelector() - } - }, - new FillFlowContainer - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Direction = FillDirection.Horizontal, - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, - Children = new Drawable[] - { - new ToolbarNewsButton(), - new ToolbarChangelogButton(), - new ToolbarRankingsButton(), - new ToolbarBeatmapListingButton(), - new ToolbarChatButton(), - new ToolbarSocialButton(), - new ToolbarWikiButton(), - new ToolbarMusicButton(), - //new ToolbarButton - //{ - // Icon = FontAwesome.Solid.search - //}, - userButton = new ToolbarUserButton(), - new ToolbarClock(), - new ToolbarNotificationButton(), } } }; diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index b686f11c13..b2b80f0e05 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -161,7 +161,7 @@ namespace osu.Game.Overlays.Toolbar }; } - protected override bool OnMouseDown(MouseDownEvent e) => true; + protected override bool OnMouseDown(MouseDownEvent e) => false; protected override bool OnClick(ClickEvent e) { From 0d36495cfca7d79a3b81f51550613f82a551823a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 02:25:06 +0900 Subject: [PATCH 1620/2328] Fix up code quality, use more correct URL and update button text --- osu.Desktop/DiscordRichPresence.cs | 37 +++++++++++++++++++----------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index 6700184e0b..27c6062bb3 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -9,6 +9,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Logging; +using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Extensions; using osu.Game.Online.API; @@ -102,11 +103,17 @@ namespace osu.Desktop presence.State = truncate(activity.Value.Status); presence.Details = truncate(getDetails(activity.Value)); - if (getOnlineID(activity.Value) != null) + if (getBeatmap(activity.Value) is IBeatmapInfo beatmap && beatmap.OnlineID > 0) { - presence.Buttons = new Button[] + string rulesetShortName = (activity.Value as UserActivity.InGame)?.Ruleset.ShortName ?? string.Empty; + + presence.Buttons = new[] { - new Button() { Label = "Open Beatmap", Url = $"https://osu.ppy.sh/b/{getOnlineID(activity.Value)}" } + new Button + { + Label = "View beatmap", + Url = $@"{api.WebsiteRootUrl}/beatmapsets/{beatmap.BeatmapSet?.OnlineID}#{rulesetShortName}/{beatmap.OnlineID}" + } }; } else @@ -159,6 +166,20 @@ namespace osu.Desktop }); } + private IBeatmapInfo getBeatmap(UserActivity activity) + { + switch (activity) + { + case UserActivity.InGame game: + return game.BeatmapInfo; + + case UserActivity.Editing edit: + return edit.BeatmapInfo; + } + + return null; + } + private string getDetails(UserActivity activity) { switch (activity) @@ -176,16 +197,6 @@ namespace osu.Desktop return string.Empty; } - private int? getOnlineID(UserActivity activity) - { - if (activity is UserActivity.InGame game && game.BeatmapInfo.OnlineID > 0) - { - return game.BeatmapInfo.OnlineID; - } - - return null; - } - protected override void Dispose(bool isDisposing) { client.Dispose(); From 1951eb30bc52d3991125557b76d570d9c5e0cc74 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 02:27:49 +0900 Subject: [PATCH 1621/2328] Remove call to `RegisterUriScheme` Seems both unnecessary, and crashes the whole came on macOS. --- osu.Desktop/DiscordRichPresence.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index 27c6062bb3..82e5932443 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -52,8 +52,6 @@ namespace osu.Desktop SkipIdenticalPresence = false // handles better on discord IPC loss, see updateStatus call in onReady. }; - client.RegisterUriScheme(); - client.OnReady += onReady; // safety measure for now, until we performance test / improve backoff for failed connections. From c55c7becba0bfec5794400ea153cdfb7d403d7d4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 02:38:44 +0900 Subject: [PATCH 1622/2328] Always use current ruleset to ensure URL is valid --- osu.Desktop/DiscordRichPresence.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index 82e5932443..43acac4f3e 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -103,14 +103,12 @@ namespace osu.Desktop if (getBeatmap(activity.Value) is IBeatmapInfo beatmap && beatmap.OnlineID > 0) { - string rulesetShortName = (activity.Value as UserActivity.InGame)?.Ruleset.ShortName ?? string.Empty; - presence.Buttons = new[] { new Button { Label = "View beatmap", - Url = $@"{api.WebsiteRootUrl}/beatmapsets/{beatmap.BeatmapSet?.OnlineID}#{rulesetShortName}/{beatmap.OnlineID}" + Url = $@"{api.WebsiteRootUrl}/beatmapsets/{beatmap.BeatmapSet?.OnlineID}#{ruleset.Value.ShortName}/{beatmap.OnlineID}" } }; } From 6fe5cacd3c5ccc9102a1444ecbeef563f35381d8 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 14 Jun 2022 20:05:07 +0300 Subject: [PATCH 1623/2328] Fix hot reload crashing toolbar test scene --- .../Visual/Menus/TestSceneToolbar.cs | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs index eb77453199..7cb467aa19 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Linq; +using JetBrains.Annotations; using Moq; using NUnit.Framework; using osu.Framework.Allocation; @@ -13,6 +14,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Testing; using osu.Game.Graphics.Containers; using osu.Game.Overlays; +using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Toolbar; using osu.Game.Rulesets; using osuTK.Graphics; @@ -28,14 +30,14 @@ namespace osu.Game.Tests.Visual.Menus [Resolved] private IRulesetStore rulesets { get; set; } - private readonly Mock notifications = new Mock(); + private readonly Mock notifications = new Mock(); private readonly BindableInt unreadNotificationCount = new BindableInt(); [BackgroundDependencyLoader] private void load() { - Dependencies.CacheAs(notifications.Object); + Dependencies.CacheAs(notifications.Object); notifications.SetupGet(n => n.UnreadCount).Returns(unreadNotificationCount); } @@ -126,5 +128,21 @@ namespace osu.Game.Tests.Visual.Menus { public new Bindable OverlayActivationMode => base.OverlayActivationMode as Bindable; } + + // interface mocks break hot reload, mocking this stub implementation instead works around it. + // see: https://github.com/moq/moq4/issues/1252 + [UsedImplicitly] + public class TestNotificationOverlay : INotificationOverlay + { + public virtual void Post(Notification notification) + { + } + + public virtual void Hide() + { + } + + public virtual IBindable UnreadCount => null; + } } } From 7f23677972b5bfc794eabdfce1361d025fa5bf70 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 14 Jun 2022 20:35:09 +0300 Subject: [PATCH 1624/2328] Add volume control support via toolbar music button --- .../Visual/Menus/TestSceneToolbar.cs | 38 ++++++++++++++++++- .../Overlays/Toolbar/ToolbarMusicButton.cs | 10 +++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs index 7cb467aa19..09fae2fb77 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs @@ -30,6 +30,21 @@ namespace osu.Game.Tests.Visual.Menus [Resolved] private IRulesetStore rulesets { get; set; } + [Cached] + private readonly NowPlayingOverlay nowPlayingOverlay = new NowPlayingOverlay + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Y = Toolbar.HEIGHT, + }; + + [Cached] + private readonly VolumeOverlay volumeOverlay = new VolumeOverlay + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + }; + private readonly Mock notifications = new Mock(); private readonly BindableInt unreadNotificationCount = new BindableInt(); @@ -44,7 +59,15 @@ namespace osu.Game.Tests.Visual.Menus [SetUp] public void SetUp() => Schedule(() => { - Child = toolbar = new TestToolbar { State = { Value = Visibility.Visible } }; + Remove(nowPlayingOverlay); + Remove(volumeOverlay); + + Children = new Drawable[] + { + nowPlayingOverlay, + volumeOverlay, + toolbar = new TestToolbar { State = { Value = Visibility.Visible } }, + }; }); [Test] @@ -124,6 +147,19 @@ namespace osu.Game.Tests.Visual.Menus AddAssert("not scrolled", () => scroll.Current == 0); } + [Test] + public void TestVolumeControlViaMusicButton() + { + AddStep("hover toolbar music button", () => InputManager.MoveMouseTo(this.ChildrenOfType().Single())); + + AddStep("reset volume", () => Audio.Volume.Value = 1); + + AddRepeatStep("scroll down", () => InputManager.ScrollVerticalBy(-10), 5); + AddAssert("volume lowered down", () => Audio.Volume.Value < 1); + AddRepeatStep("scroll up", () => InputManager.ScrollVerticalBy(10), 5); + AddAssert("volume raised up", () => Audio.Volume.Value == 1); + } + public class TestToolbar : Toolbar { public new Bindable OverlayActivationMode => base.OverlayActivationMode as Bindable; diff --git a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs index 0f5e8e5456..9804c857bf 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs @@ -3,6 +3,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Input.Events; using osu.Game.Input.Bindings; namespace osu.Game.Overlays.Toolbar @@ -21,5 +22,14 @@ namespace osu.Game.Overlays.Toolbar { StateContainer = music; } + + [Resolved(canBeNull: true)] + private VolumeOverlay volume { get; set; } + + protected override bool OnScroll(ScrollEvent e) + { + volume?.Adjust(GlobalAction.IncreaseVolume, e.ScrollDelta.Y, e.IsPrecise); + return true; + } } } From 1f31e3fb5199b646c00ed448fe1ca2b7658752e8 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 14 Jun 2022 22:13:26 +0300 Subject: [PATCH 1625/2328] Add volume UI to toolbar music button --- .../Overlays/Toolbar/ToolbarMusicButton.cs | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs index 9804c857bf..34dc3b4080 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs @@ -2,30 +2,79 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Bindables; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Game.Input.Bindings; +using osuTK.Graphics; namespace osu.Game.Overlays.Toolbar { public class ToolbarMusicButton : ToolbarOverlayToggleButton { + private Circle volumeBar; + protected override Anchor TooltipAnchor => Anchor.TopRight; public ToolbarMusicButton() { Hotkey = GlobalAction.ToggleNowPlaying; + AutoSizeAxes = Axes.X; } [BackgroundDependencyLoader(true)] private void load(NowPlayingOverlay music) { StateContainer = music; + + Flow.Padding = new MarginPadding { Horizontal = Toolbar.HEIGHT / 4 }; + Flow.Add(new Container + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Width = 3f, + Height = IconContainer.Height, + Margin = new MarginPadding { Horizontal = 2.5f }, + Masking = true, + Children = new[] + { + new Circle + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White.Opacity(0.25f), + }, + volumeBar = new Circle + { + RelativeSizeAxes = Axes.Both, + Height = 0f, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Colour = Color4.White, + } + } + }); } + [Resolved] + private AudioManager audio { get; set; } + [Resolved(canBeNull: true)] private VolumeOverlay volume { get; set; } + private IBindable globalVolume; + + protected override void LoadComplete() + { + base.LoadComplete(); + + globalVolume = audio.Volume.GetBoundCopy(); + globalVolume.BindValueChanged(v => volumeBar.Height = (float)v.NewValue, true); + } + protected override bool OnScroll(ScrollEvent e) { volume?.Adjust(GlobalAction.IncreaseVolume, e.ScrollDelta.Y, e.IsPrecise); From 1171d44ad972573af689ee469c752f32168017a2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 03:34:08 +0300 Subject: [PATCH 1626/2328] Add failing test case --- .../Navigation/TestSceneFirstRunGame.cs | 46 +++++++++++++++++++ osu.Game/OsuGame.cs | 8 ++-- osu.Game/Tests/Visual/OsuGameTestScene.cs | 2 + 3 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 osu.Game.Tests/Visual/Navigation/TestSceneFirstRunGame.cs diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunGame.cs b/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunGame.cs new file mode 100644 index 0000000000..37d7faf1fb --- /dev/null +++ b/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunGame.cs @@ -0,0 +1,46 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Graphics.Containers; +using osu.Framework.Platform; +using osu.Game.Configuration; +using osu.Game.Online.API; +using osu.Game.Overlays.Notifications; + +namespace osu.Game.Tests.Visual.Navigation +{ + [System.ComponentModel.Description("game with first-run setup overlay")] + public class TestSceneFirstRunGame : OsuGameTestScene + { + public override void SetUpSteps() + { + base.SetUpSteps(); + + AddUntilStep("Wait for first-run setup", () => Game.FirstRunOverlay.State.Value == Visibility.Visible); + } + + [Test] + public void TestImportantNotificationDoesntInterruptSetup() + { + AddStep("post important notification", () => Game.Notifications.Post(new SimpleNotification { Text = "Important notification" })); + AddAssert("first-run setup still visible", () => Game.FirstRunOverlay.State.Value == Visibility.Visible); + } + + protected override TestOsuGame CreateTestGame() => new FirstRunGame(LocalStorage, API); + + private class FirstRunGame : TestOsuGame + { + public FirstRunGame(Storage storage, IAPIProvider api, string[] args = null) + : base(storage, api, args) + { + } + + protected override void LoadComplete() + { + base.LoadComplete(); + LocalConfig.SetValue(OsuSetting.ShowFirstRunSetup, true); + } + } + } +} diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 1f9a1ce938..200f7613a1 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -153,7 +153,7 @@ namespace osu.Game protected SettingsOverlay Settings; - private FirstRunSetupOverlay firstRunOverlay; + protected FirstRunSetupOverlay FirstRunOverlay { get; private set; } private VolumeOverlay volume; @@ -845,7 +845,7 @@ namespace osu.Game loadComponentSingleFile(CreateUpdateManager(), Add, true); // overlay elements - loadComponentSingleFile(firstRunOverlay = new FirstRunSetupOverlay(), overlayContent.Add, true); + loadComponentSingleFile(FirstRunOverlay = new FirstRunSetupOverlay(), overlayContent.Add, true); loadComponentSingleFile(new ManageCollectionsDialog(), overlayContent.Add, true); loadComponentSingleFile(beatmapListing = new BeatmapListingOverlay(), overlayContent.Add, true); loadComponentSingleFile(dashboard = new DashboardOverlay(), overlayContent.Add, true); @@ -896,7 +896,7 @@ namespace osu.Game Add(new MusicKeyBindingHandler()); // side overlays which cancel each other. - var singleDisplaySideOverlays = new OverlayContainer[] { Settings, Notifications, firstRunOverlay }; + var singleDisplaySideOverlays = new OverlayContainer[] { Settings, Notifications, FirstRunOverlay }; foreach (var overlay in singleDisplaySideOverlays) { @@ -921,7 +921,7 @@ namespace osu.Game } // ensure only one of these overlays are open at once. - var singleDisplayOverlays = new OverlayContainer[] { firstRunOverlay, chatOverlay, news, dashboard, beatmapListing, changelogOverlay, rankingsOverlay, wikiOverlay }; + var singleDisplayOverlays = new OverlayContainer[] { FirstRunOverlay, chatOverlay, news, dashboard, beatmapListing, changelogOverlay, rankingsOverlay, wikiOverlay }; foreach (var overlay in singleDisplayOverlays) { diff --git a/osu.Game/Tests/Visual/OsuGameTestScene.cs b/osu.Game/Tests/Visual/OsuGameTestScene.cs index 6e4adb4d4c..5995b30b60 100644 --- a/osu.Game/Tests/Visual/OsuGameTestScene.cs +++ b/osu.Game/Tests/Visual/OsuGameTestScene.cs @@ -132,6 +132,8 @@ namespace osu.Game.Tests.Visual public new NotificationOverlay Notifications => base.Notifications; + public new FirstRunSetupOverlay FirstRunOverlay => base.FirstRunOverlay; + public new MusicController MusicController => base.MusicController; public new OsuConfigManager LocalConfig => base.LocalConfig; From ddeee09a5193fd79135540b26c54e81a14590e70 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 03:36:38 +0300 Subject: [PATCH 1627/2328] Fix important notifications interrupting first-run setup --- osu.Game/Overlays/NotificationOverlay.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index f1ed5c4ba6..e4ee2fe049 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -35,6 +35,9 @@ namespace osu.Game.Overlays [Resolved] private AudioManager audio { get; set; } + [Resolved(canBeNull: true)] + private FirstRunSetupOverlay firstRunSetup { get; set; } + [BackgroundDependencyLoader] private void load() { @@ -130,7 +133,9 @@ namespace osu.Game.Overlays var section = sections.Children.FirstOrDefault(s => s.AcceptTypes.Any(accept => accept.IsAssignableFrom(ourType))); section?.Add(notification, notification.DisplayOnTop ? -runningDepth : runningDepth); - if (notification.IsImportant) + // we don't want important notifications interrupting user on first-run setup. + // (this can happen when importing beatmaps inside setup, which posts import notifications) + if (notification.IsImportant && firstRunSetup?.State.Value != Visibility.Visible) Show(); updateCounts(); From 850afcb1c3f9d8dfb35a39ae85a24458e180f1f2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 05:43:39 +0300 Subject: [PATCH 1628/2328] Add failing test case --- .../Editing/TestSceneZoomableScrollContainer.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs b/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs index 2d056bafdd..43e3404d98 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs @@ -78,6 +78,21 @@ namespace osu.Game.Tests.Visual.Editing AddAssert("Inner container width matches scroll container", () => innerBox.DrawWidth == scrollContainer.DrawWidth); } + [Test] + public void TestZoomRangeUpdate() + { + AddStep("set zoom to 2", () => scrollContainer.Zoom = 2); + AddStep("set min zoom to 5", () => scrollContainer.MinZoom = 5); + AddAssert("zoom = 5", () => scrollContainer.Zoom == 5); + + AddStep("set max zoom to 10", () => scrollContainer.MaxZoom = 10); + AddAssert("zoom = 5", () => scrollContainer.Zoom == 5); + + AddStep("set min zoom to 20", () => scrollContainer.MinZoom = 20); + AddStep("set max zoom to 40", () => scrollContainer.MaxZoom = 40); + AddAssert("zoom = 20", () => scrollContainer.Zoom == 20); + } + [Test] public void TestZoom0() { From 268a7e13343c13001384ac9a700582f9f81464c9 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 05:19:51 +0300 Subject: [PATCH 1629/2328] Fix `ZoomableScrollContainer` attempting to update zoom with overlapping range --- .../Components/Timeline/ZoomableScrollContainer.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs index d008368b69..d58cb27274 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs @@ -66,8 +66,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline minZoom = value; - if (Zoom < value) - Zoom = value; + // ensure zoom range is in valid state before updating zoom. + if (MinZoom < MaxZoom) + Zoom = Zoom; } } @@ -86,8 +87,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline maxZoom = value; - if (Zoom > value) - Zoom = value; + // ensure zoom range is in valid state before updating zoom. + if (MaxZoom > MinZoom) + Zoom = Zoom; } } From ee8045d5079b8cda129910297d00baa26c3420ec Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 06:31:26 +0300 Subject: [PATCH 1630/2328] Add failing test case --- .../Database/LegacyBeatmapImporterTest.cs | 67 +++++++++++++++++++ osu.Game/IO/StableStorage.cs | 4 +- 2 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Tests/Database/LegacyBeatmapImporterTest.cs diff --git a/osu.Game.Tests/Database/LegacyBeatmapImporterTest.cs b/osu.Game.Tests/Database/LegacyBeatmapImporterTest.cs new file mode 100644 index 0000000000..145ba2c730 --- /dev/null +++ b/osu.Game.Tests/Database/LegacyBeatmapImporterTest.cs @@ -0,0 +1,67 @@ +// 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 System.Linq; +using NUnit.Framework; +using osu.Framework.Platform; +using osu.Framework.Testing; +using osu.Game.Database; +using osu.Game.IO; + +namespace osu.Game.Tests.Database +{ + [TestFixture] + public class LegacyBeatmapImporterTest + { + private readonly TestLegacyBeatmapImporter importer = new TestLegacyBeatmapImporter(); + + [Test] + public void TestSongsSubdirectories() + { + using (var storage = new TemporaryNativeStorage("stable-songs-folder")) + { + var songsStorage = storage.GetStorageForDirectory(StableStorage.STABLE_DEFAULT_SONGS_PATH); + + // normal beatmap folder + var beatmap1 = songsStorage.GetStorageForDirectory("beatmap1"); + beatmap1.CreateFileSafely("beatmap.osu"); + + // songs subdirectory + var subdirectory = songsStorage.GetStorageForDirectory("subdirectory"); + subdirectory.CreateFileSafely(subdirectory.GetFullPath(Path.Combine("beatmap2", "beatmap.osu"), true)); + subdirectory.CreateFileSafely(subdirectory.GetFullPath(Path.Combine("beatmap3", "beatmap.osu"), true)); + subdirectory.CreateFileSafely(subdirectory.GetFullPath(Path.Combine("sub-subdirectory", "beatmap4", "beatmap.osu"), true)); + + // songs subdirectory with system file + var subdirectory2 = songsStorage.GetStorageForDirectory("subdirectory2"); + subdirectory2.CreateFileSafely(subdirectory2.GetFullPath(".DS_Store")); + subdirectory2.CreateFileSafely(subdirectory2.GetFullPath(Path.Combine("beatmap5", "beatmap.osu"), true)); + subdirectory2.CreateFileSafely(subdirectory2.GetFullPath(Path.Combine("beatmap6", "beatmap.osu"), true)); + + // empty songs subdirectory + songsStorage.GetStorageForDirectory("subdirectory3"); + + string[] paths = importer.GetStableImportPaths(songsStorage).ToArray(); + Assert.That(paths.Length, Is.EqualTo(6)); + Assert.That(paths.Contains(songsStorage.GetFullPath("beatmap1"))); + Assert.That(paths.Contains(songsStorage.GetFullPath(Path.Combine("subdirectory", "beatmap2")))); + Assert.That(paths.Contains(songsStorage.GetFullPath(Path.Combine("subdirectory", "beatmap3")))); + Assert.That(paths.Contains(songsStorage.GetFullPath(Path.Combine("subdirectory", "sub-subdirectory", "beatmap4")))); + Assert.That(paths.Contains(songsStorage.GetFullPath(Path.Combine("subdirectory2", "beatmap5")))); + Assert.That(paths.Contains(songsStorage.GetFullPath(Path.Combine("subdirectory2", "beatmap6")))); + } + } + + private class TestLegacyBeatmapImporter : LegacyBeatmapImporter + { + public TestLegacyBeatmapImporter() + : base(null) + { + } + + public new IEnumerable GetStableImportPaths(Storage storage) => base.GetStableImportPaths(storage); + } + } +} diff --git a/osu.Game/IO/StableStorage.cs b/osu.Game/IO/StableStorage.cs index 84b7da91fc..d4ff8fcdda 100644 --- a/osu.Game/IO/StableStorage.cs +++ b/osu.Game/IO/StableStorage.cs @@ -14,7 +14,7 @@ namespace osu.Game.IO /// public class StableStorage : DesktopStorage { - private const string stable_default_songs_path = "Songs"; + public const string STABLE_DEFAULT_SONGS_PATH = "Songs"; private readonly DesktopGameHost host; private readonly Lazy songsPath; @@ -62,7 +62,7 @@ namespace osu.Game.IO } } - return GetFullPath(stable_default_songs_path); + return GetFullPath(STABLE_DEFAULT_SONGS_PATH); } } } From 22c09ec893b184b6a3611eae18a5daa43b85b5a7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 06:53:49 +0300 Subject: [PATCH 1631/2328] Handle subdirectories during beatmap stable import --- osu.Game/Database/LegacyBeatmapImporter.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/osu.Game/Database/LegacyBeatmapImporter.cs b/osu.Game/Database/LegacyBeatmapImporter.cs index 97f6eba6c2..9ce267086d 100644 --- a/osu.Game/Database/LegacyBeatmapImporter.cs +++ b/osu.Game/Database/LegacyBeatmapImporter.cs @@ -1,6 +1,9 @@ // 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.Linq; +using osu.Framework.IO.Stores; using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.IO; @@ -13,6 +16,24 @@ namespace osu.Game.Database protected override Storage PrepareStableStorage(StableStorage stableStorage) => stableStorage.GetSongStorage(); + protected override IEnumerable GetStableImportPaths(Storage storage) + { + foreach (string beatmapDirectory in storage.GetDirectories(string.Empty)) + { + var beatmapStorage = storage.GetStorageForDirectory(beatmapDirectory); + + if (!beatmapStorage.GetFiles(string.Empty).ExcludeSystemFileNames().Any()) + { + // if a directory doesn't contain files, attempt looking for beatmaps inside of that directory. + // this is a special behaviour in stable for beatmaps only, see https://github.com/ppy/osu/issues/18615. + foreach (string beatmapInDirectory in GetStableImportPaths(beatmapStorage)) + yield return beatmapStorage.GetFullPath(beatmapInDirectory); + } + else + yield return storage.GetFullPath(beatmapDirectory); + } + } + public LegacyBeatmapImporter(IModelImporter importer) : base(importer) { From d3feb07bc1b6b861ac9db641226eee5c14344469 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 07:57:16 +0300 Subject: [PATCH 1632/2328] Split zoom updating to named method with value as optional --- .../Timeline/ZoomableScrollContainer.cs | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs index d58cb27274..bc6c66625c 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline // ensure zoom range is in valid state before updating zoom. if (MinZoom < MaxZoom) - Zoom = Zoom; + updateZoom(); } } @@ -89,7 +89,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline // ensure zoom range is in valid state before updating zoom. if (MaxZoom > MinZoom) - Zoom = Zoom; + updateZoom(); } } @@ -99,15 +99,17 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline public float Zoom { get => zoomTarget; - set - { - value = Math.Clamp(value, MinZoom, MaxZoom); + set => updateZoom(value); + } - if (IsLoaded) - setZoomTarget(value, ToSpaceOfOtherDrawable(new Vector2(DrawWidth / 2, 0), zoomedContent).X); - else - currentZoom = zoomTarget = value; - } + private void updateZoom(float? value = null) + { + float newZoom = Math.Clamp(value ?? Zoom, MinZoom, MaxZoom); + + if (IsLoaded) + setZoomTarget(newZoom, ToSpaceOfOtherDrawable(new Vector2(DrawWidth / 2, 0), zoomedContent).X); + else + currentZoom = zoomTarget = newZoom; } protected override void Update() From 3d638abc52d39a33b64388610a006f007f413100 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 08:24:18 +0300 Subject: [PATCH 1633/2328] Fix test files stream not disposed after creation --- .../Database/LegacyBeatmapImporterTest.cs | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Database/LegacyBeatmapImporterTest.cs b/osu.Game.Tests/Database/LegacyBeatmapImporterTest.cs index 145ba2c730..2af46374fe 100644 --- a/osu.Game.Tests/Database/LegacyBeatmapImporterTest.cs +++ b/osu.Game.Tests/Database/LegacyBeatmapImporterTest.cs @@ -26,19 +26,19 @@ namespace osu.Game.Tests.Database // normal beatmap folder var beatmap1 = songsStorage.GetStorageForDirectory("beatmap1"); - beatmap1.CreateFileSafely("beatmap.osu"); + createFile(beatmap1, "beatmap.osu"); // songs subdirectory var subdirectory = songsStorage.GetStorageForDirectory("subdirectory"); - subdirectory.CreateFileSafely(subdirectory.GetFullPath(Path.Combine("beatmap2", "beatmap.osu"), true)); - subdirectory.CreateFileSafely(subdirectory.GetFullPath(Path.Combine("beatmap3", "beatmap.osu"), true)); - subdirectory.CreateFileSafely(subdirectory.GetFullPath(Path.Combine("sub-subdirectory", "beatmap4", "beatmap.osu"), true)); + createFile(subdirectory, Path.Combine("beatmap2", "beatmap.osu")); + createFile(subdirectory, Path.Combine("beatmap3", "beatmap.osu")); + createFile(subdirectory, Path.Combine("sub-subdirectory", "beatmap4", "beatmap.osu")); // songs subdirectory with system file var subdirectory2 = songsStorage.GetStorageForDirectory("subdirectory2"); - subdirectory2.CreateFileSafely(subdirectory2.GetFullPath(".DS_Store")); - subdirectory2.CreateFileSafely(subdirectory2.GetFullPath(Path.Combine("beatmap5", "beatmap.osu"), true)); - subdirectory2.CreateFileSafely(subdirectory2.GetFullPath(Path.Combine("beatmap6", "beatmap.osu"), true)); + createFile(subdirectory2, ".DS_Store"); + createFile(subdirectory2, Path.Combine("beatmap5", "beatmap.osu")); + createFile(subdirectory2, Path.Combine("beatmap6", "beatmap.osu")); // empty songs subdirectory songsStorage.GetStorageForDirectory("subdirectory3"); @@ -52,6 +52,12 @@ namespace osu.Game.Tests.Database Assert.That(paths.Contains(songsStorage.GetFullPath(Path.Combine("subdirectory2", "beatmap5")))); Assert.That(paths.Contains(songsStorage.GetFullPath(Path.Combine("subdirectory2", "beatmap6")))); } + + static void createFile(Storage storage, string path) + { + using (var stream = storage.CreateFileSafely(path)) + stream.WriteByte(0); + } } private class TestLegacyBeatmapImporter : LegacyBeatmapImporter From f3f0960335303bcdc8a53a491fe02fd12580dff2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 09:02:48 +0300 Subject: [PATCH 1634/2328] Use unified filename for background and track during editor import --- .../Editing/TestSceneEditorBeatmapCreation.cs | 3 ++ .../Screens/Edit/Setup/ResourcesSection.cs | 29 +++++++++++-------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs index b109234fec..841f50e7bd 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs @@ -101,6 +101,9 @@ namespace osu.Game.Tests.Visual.Editing File.Delete(temp); Directory.Delete(extractedFolder, true); + // ensure audio file is copied to beatmap as "audio.mp3" rather than original filename. + Assert.That(Beatmap.Value.Metadata.AudioFile == "audio.mp3"); + return success; }); diff --git a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs index 1e97218074..9d4e72d1f3 100644 --- a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs +++ b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs @@ -64,26 +64,28 @@ namespace osu.Game.Screens.Edit.Setup public bool ChangeBackgroundImage(string path) { - var info = new FileInfo(path); + var source = new FileInfo(path); - if (!info.Exists) + if (!source.Exists) return false; var set = working.Value.BeatmapSetInfo; + var destination = new FileInfo($@"bg{source.Extension}"); + // remove the previous background for now. // in the future we probably want to check if this is being used elsewhere (other difficulties?) - var oldFile = set.Files.FirstOrDefault(f => f.Filename == working.Value.Metadata.BackgroundFile); + var oldFile = set.Files.FirstOrDefault(f => Path.GetFileNameWithoutExtension(f.Filename) == destination.Name); - using (var stream = info.OpenRead()) + using (var stream = source.OpenRead()) { if (oldFile != null) beatmaps.DeleteFile(set, oldFile); - beatmaps.AddFile(set, stream, info.Name); + beatmaps.AddFile(set, stream, destination.Name); } - working.Value.Metadata.BackgroundFile = info.Name; + working.Value.Metadata.BackgroundFile = destination.Name; header.Background.UpdateBackground(); return true; @@ -91,25 +93,28 @@ namespace osu.Game.Screens.Edit.Setup public bool ChangeAudioTrack(string path) { - var info = new FileInfo(path); + var source = new FileInfo(path); - if (!info.Exists) + if (!source.Exists) return false; var set = working.Value.BeatmapSetInfo; + var destination = new FileInfo($@"audio{source.Extension}"); + // remove the previous audio track for now. // in the future we probably want to check if this is being used elsewhere (other difficulties?) - var oldFile = set.Files.FirstOrDefault(f => f.Filename == working.Value.Metadata.AudioFile); + var oldFile = set.Files.FirstOrDefault(f => Path.GetFileNameWithoutExtension(f.Filename) == destination.Name); - using (var stream = info.OpenRead()) + using (var stream = source.OpenRead()) { if (oldFile != null) beatmaps.DeleteFile(set, oldFile); - beatmaps.AddFile(set, stream, info.Name); + + beatmaps.AddFile(set, stream, destination.Name); } - working.Value.Metadata.AudioFile = info.Name; + working.Value.Metadata.AudioFile = destination.Name; music.ReloadCurrentTrack(); From cca7633e590700a483d71ed27a3bd3debfb4891d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 15:05:51 +0900 Subject: [PATCH 1635/2328] Rename variables and remove unnecessary nested call to `GetFullPath` --- osu.Game/Database/LegacyBeatmapImporter.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Database/LegacyBeatmapImporter.cs b/osu.Game/Database/LegacyBeatmapImporter.cs index 9ce267086d..3477312154 100644 --- a/osu.Game/Database/LegacyBeatmapImporter.cs +++ b/osu.Game/Database/LegacyBeatmapImporter.cs @@ -18,19 +18,19 @@ namespace osu.Game.Database protected override IEnumerable GetStableImportPaths(Storage storage) { - foreach (string beatmapDirectory in storage.GetDirectories(string.Empty)) + foreach (string directory in storage.GetDirectories(string.Empty)) { - var beatmapStorage = storage.GetStorageForDirectory(beatmapDirectory); + var directoryStorage = storage.GetStorageForDirectory(directory); - if (!beatmapStorage.GetFiles(string.Empty).ExcludeSystemFileNames().Any()) + if (!directoryStorage.GetFiles(string.Empty).ExcludeSystemFileNames().Any()) { // if a directory doesn't contain files, attempt looking for beatmaps inside of that directory. // this is a special behaviour in stable for beatmaps only, see https://github.com/ppy/osu/issues/18615. - foreach (string beatmapInDirectory in GetStableImportPaths(beatmapStorage)) - yield return beatmapStorage.GetFullPath(beatmapInDirectory); + foreach (string subDirectory in GetStableImportPaths(directoryStorage)) + yield return subDirectory; } else - yield return storage.GetFullPath(beatmapDirectory); + yield return storage.GetFullPath(directory); } } From abe947bcb07ff67e974b67f580dac0dd07f28d2f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 15:31:45 +0900 Subject: [PATCH 1636/2328] Update outdated xmldoc comments --- osu.Game/Stores/RealmArchiveModelImporter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Stores/RealmArchiveModelImporter.cs b/osu.Game/Stores/RealmArchiveModelImporter.cs index c6231e5583..4bbd6b2264 100644 --- a/osu.Game/Stores/RealmArchiveModelImporter.cs +++ b/osu.Game/Stores/RealmArchiveModelImporter.cs @@ -173,7 +173,7 @@ namespace osu.Game.Stores /// Note that this bypasses the UI flow and should only be used for special cases or testing. /// /// The containing data about the to import. - /// Whether this is a low priority import. + /// Whether this import is part of a larger batch. /// An optional cancellation token. /// The imported model, if successful. public async Task?> Import(ImportTask task, bool batchImport = false, CancellationToken cancellationToken = default) @@ -205,7 +205,7 @@ namespace osu.Game.Stores /// Silently import an item from an . /// /// The archive to be imported. - /// Whether this is a low priority import. + /// Whether this import is part of a larger batch. /// An optional cancellation token. public async Task?> Import(ArchiveReader archive, bool batchImport = false, CancellationToken cancellationToken = default) { From 5201057a626f5f5fa6eeff0105df50621e1d03df Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 15:31:58 +0900 Subject: [PATCH 1637/2328] Change batch import to require at least 10 items --- osu.Game/Stores/RealmArchiveModelImporter.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Stores/RealmArchiveModelImporter.cs b/osu.Game/Stores/RealmArchiveModelImporter.cs index 4bbd6b2264..7f31bc66be 100644 --- a/osu.Game/Stores/RealmArchiveModelImporter.cs +++ b/osu.Game/Stores/RealmArchiveModelImporter.cs @@ -32,8 +32,17 @@ namespace osu.Game.Stores public abstract class RealmArchiveModelImporter : IModelImporter where TModel : RealmObject, IHasRealmFiles, IHasGuidPrimaryKey, ISoftDelete { + /// + /// The maximum number of concurrent imports to run per import scheduler. + /// private const int import_queue_request_concurrency = 1; + /// + /// The minimum number of items in a single import call in order for the import to be processed as a batch. + /// Batch imports will apply optimisations preferring speed over consistency when detecting changes in already-imported items. + /// + private const int minimum_items_considered_batch_import = 10; + /// /// A singleton scheduler shared by all . /// @@ -100,7 +109,7 @@ namespace osu.Game.Stores var imported = new List>(); - bool isBatchImport = tasks.Length > 1; + bool isBatchImport = tasks.Length >= minimum_items_considered_batch_import; try { From 930ec2a19775cc43719dc648a1568f3b6b742df7 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Wed, 15 Jun 2022 12:33:21 +0900 Subject: [PATCH 1638/2328] Add specific samples for dialog 'Ok' and 'Cancel' buttons --- osu.Game/Graphics/UserInterface/HoverSampleSet.cs | 8 +++++++- osu.Game/Overlays/Dialog/PopupDialogButton.cs | 3 ++- osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs | 6 ++++++ osu.Game/Overlays/Dialog/PopupDialogOkButton.cs | 6 ++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/HoverSampleSet.cs b/osu.Game/Graphics/UserInterface/HoverSampleSet.cs index b88f81a143..0bf44321dd 100644 --- a/osu.Game/Graphics/UserInterface/HoverSampleSet.cs +++ b/osu.Game/Graphics/UserInterface/HoverSampleSet.cs @@ -20,6 +20,12 @@ namespace osu.Game.Graphics.UserInterface TabSelect, [Description("scrolltotop")] - ScrollToTop + ScrollToTop, + + [Description("dialog-cancel")] + DialogCancel, + + [Description("dialog-ok")] + DialogOk } } diff --git a/osu.Game/Overlays/Dialog/PopupDialogButton.cs b/osu.Game/Overlays/Dialog/PopupDialogButton.cs index 76ee438d6d..9ee1018651 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogButton.cs @@ -8,7 +8,8 @@ namespace osu.Game.Overlays.Dialog { public class PopupDialogButton : DialogButton { - public PopupDialogButton() + public PopupDialogButton(HoverSampleSet sampleSet = HoverSampleSet.Button) + : base(sampleSet) { Height = 50; BackgroundColour = Color4Extensions.FromHex(@"150e14"); diff --git a/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs b/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs index 754003c1c1..186099ce23 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs @@ -3,6 +3,7 @@ using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Dialog { @@ -13,5 +14,10 @@ namespace osu.Game.Overlays.Dialog { ButtonColour = colours.Blue; } + + public PopupDialogCancelButton() + : base(HoverSampleSet.DialogCancel) + { + } } } diff --git a/osu.Game/Overlays/Dialog/PopupDialogOkButton.cs b/osu.Game/Overlays/Dialog/PopupDialogOkButton.cs index 6c2bf6f1e6..1ac8dd0db6 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogOkButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogOkButton.cs @@ -3,6 +3,7 @@ using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Dialog { @@ -13,5 +14,10 @@ namespace osu.Game.Overlays.Dialog { ButtonColour = colours.Pink; } + + public PopupDialogOkButton() + : base(HoverSampleSet.DialogOk) + { + } } } From af87722be8024c8c93a6cc29792af150ff18a48d Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Wed, 15 Jun 2022 12:43:21 +0900 Subject: [PATCH 1639/2328] Add audio feedback for 'Dangerous' dialog buttons --- .../Dialog/PopupDialogDangerousButton.cs | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs index 6239c5e409..9db2589147 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs @@ -2,9 +2,13 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; +using osu.Framework.Utils; +using osu.Game.Audio.Effects; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -47,8 +51,39 @@ namespace osu.Game.Overlays.Dialog { } + private Sample tickSample; + private Sample confirmSample; + private bool isTicking; + private double lastTickPlaybackTime; + private AudioFilter lowPassFilter = null!; + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + lowPassFilter = new AudioFilter(audio.SampleMixer); + tickSample = audio.Samples.Get(@"UI/dialog-dangerous-tick"); + confirmSample = audio.Samples.Get(@"UI/dialog-dangerous-select"); + } + + protected override void Update() + { + base.Update(); + + if (!isTicking) return; + + if (Precision.AlmostEquals(Progress.Value, 1)) + { + confirmSample?.Play(); + isTicking = false; + } + + if (Clock.CurrentTime - lastTickPlaybackTime >= 30) + playTick(Progress.Value); + } + protected override bool OnMouseDown(MouseDownEvent e) { + startTickSound(); BeginConfirm(); return true; } @@ -56,7 +91,35 @@ namespace osu.Game.Overlays.Dialog protected override void OnMouseUp(MouseUpEvent e) { if (!e.HasAnyButtonPressed) + { + stopTickSound(); AbortConfirm(); + } + } + + private void playTick(double progress) + { + lowPassFilter.CutoffTo((int)(Progress.Value * AudioFilter.MAX_LOWPASS_CUTOFF * 0.5f)); + + tickSample.Frequency.Value = 1 + progress * 0.5f; + tickSample.Volume.Value = 0.5f + progress / 2f; + tickSample.Play(); + + lastTickPlaybackTime = Clock.CurrentTime; + } + + private void startTickSound() + { + lowPassFilter.CutoffTo(0); + playTick(Progress.Value); + isTicking = true; + } + + private void stopTickSound() + { + isTicking = false; + lastTickPlaybackTime = Clock.CurrentTime; + lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF); } } } From 6b744a14b0b7be3c0a0a36764359707cc5f80dab Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Wed, 15 Jun 2022 13:04:08 +0900 Subject: [PATCH 1640/2328] Move 'back' sample playback from OnResuming to OnExiting --- osu.Game/Screens/Menu/MainMenu.cs | 2 ++ osu.Game/Screens/OsuScreen.cs | 8 ++++---- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 6fc8039413..bcd4baa818 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -66,6 +66,8 @@ namespace osu.Game.Screens.Menu protected override BackgroundScreen CreateBackground() => background; + protected override bool PlayExitSound => false; + private Bindable holdDelay; private Bindable loginDisplayed; diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 77db1285bd..e742a2821f 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens private Sample sampleExit; - protected virtual bool PlayResumeSound => true; + protected virtual bool PlayExitSound => true; public virtual float BackgroundParallaxAmount => 1; @@ -173,9 +173,6 @@ namespace osu.Game.Screens public override void OnResuming(ScreenTransitionEvent e) { - if (PlayResumeSound) - sampleExit?.Play(); - applyArrivingDefaults(true); // it's feasible to resume to a screen if the target screen never loaded successfully. @@ -215,6 +212,9 @@ namespace osu.Game.Screens public override bool OnExiting(ScreenExitEvent e) { + if (PlayExitSound) + sampleExit?.Play(); + if (ValidForResume && logo != null) onExitingLogo(); diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index d75466764d..b7b3c6fde1 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play // We show the previous screen status protected override UserActivity? InitialActivity => null; - protected override bool PlayResumeSound => false; + protected override bool PlayExitSound => false; protected BeatmapMetadataDisplay MetadataInfo { get; private set; } = null!; From 5e3ccf7087d3a7ca4c6562eeb1728c98439341d0 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Wed, 15 Jun 2022 13:04:17 +0900 Subject: [PATCH 1641/2328] Don't play 'back' sample when exiting Editor --- osu.Game/Screens/Edit/Editor.cs | 2 ++ osu.Game/Screens/Edit/EditorLoader.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index e4a18b8478..2c13fe79b6 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -63,6 +63,8 @@ namespace osu.Game.Screens.Edit public override bool? AllowTrackAdjustments => false; + protected override bool PlayExitSound => false; + protected bool HasUnsavedChanges { get diff --git a/osu.Game/Screens/Edit/EditorLoader.cs b/osu.Game/Screens/Edit/EditorLoader.cs index 0a2b8437fa..94eb6d5e70 100644 --- a/osu.Game/Screens/Edit/EditorLoader.cs +++ b/osu.Game/Screens/Edit/EditorLoader.cs @@ -40,6 +40,8 @@ namespace osu.Game.Screens.Edit public override bool DisallowExternalBeatmapRulesetChanges => true; + protected override bool PlayExitSound => false; + [Resolved] private BeatmapManager beatmapManager { get; set; } From 5eb56ab814a465e0ef52daaeb40b59a626bc4dae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 15:41:38 +0900 Subject: [PATCH 1642/2328] Ensure `Master` volume is updated when scrolling on toolbar button --- osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs | 1 + osu.Game/Overlays/VolumeOverlay.cs | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs index 34dc3b4080..0c948990a0 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs @@ -77,6 +77,7 @@ namespace osu.Game.Overlays.Toolbar protected override bool OnScroll(ScrollEvent e) { + volume?.FocusMasterVolume(); volume?.Adjust(GlobalAction.IncreaseVolume, e.ScrollDelta.Y, e.IsPrecise); return true; } diff --git a/osu.Game/Overlays/VolumeOverlay.cs b/osu.Game/Overlays/VolumeOverlay.cs index 9d2ed3f837..46ea45491e 100644 --- a/osu.Game/Overlays/VolumeOverlay.cs +++ b/osu.Game/Overlays/VolumeOverlay.cs @@ -140,11 +140,16 @@ namespace osu.Game.Overlays private ScheduledDelegate popOutDelegate; + public void FocusMasterVolume() + { + volumeMeters.Select(volumeMeterMaster); + } + public override void Show() { // Focus on the master meter as a default if previously hidden if (State.Value == Visibility.Hidden) - volumeMeters.Select(volumeMeterMaster); + FocusMasterVolume(); if (State.Value == Visibility.Visible) schedulePopOut(); From 6a8cf514e0f18291d6d136db3f565dadf31740d1 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 09:52:12 +0300 Subject: [PATCH 1643/2328] Update background/track file chooser to not display filename --- .../UserInterfaceV2/LabelledComponent.cs | 2 +- ...elledTextBox.cs => LabelledFileChooser.cs} | 15 +++++--- .../Screens/Edit/Setup/ResourcesSection.cs | 37 ++++++++++++------- 3 files changed, 35 insertions(+), 19 deletions(-) rename osu.Game/Screens/Edit/Setup/{FileChooserLabelledTextBox.cs => LabelledFileChooser.cs} (86%) diff --git a/osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs b/osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs index dd6a902989..77267e453c 100644 --- a/osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs +++ b/osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs @@ -15,7 +15,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 { } - public Bindable Current + public virtual Bindable Current { get => Component.Current; set => Component.Current = value; diff --git a/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs similarity index 86% rename from osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs rename to osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs index fd916894ea..745c989b3b 100644 --- a/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs @@ -21,10 +21,7 @@ using osuTK; namespace osu.Game.Screens.Edit.Setup { - /// - /// A labelled textbox which reveals an inline file chooser when clicked. - /// - internal class FileChooserLabelledTextBox : LabelledTextBoxWithPopover, ICanAcceptFiles + internal class LabelledFileChooser : LabelledTextBoxWithPopover, ICanAcceptFiles { private readonly string[] handledExtensions; @@ -35,7 +32,15 @@ namespace osu.Game.Screens.Edit.Setup [Resolved] private OsuGameBase game { get; set; } = null!; - public FileChooserLabelledTextBox(params string[] handledExtensions) + private readonly BindableWithCurrent current = new BindableWithCurrent(); + + public override Bindable Current + { + get => current.Current; + set => current.Current = value; + } + + public LabelledFileChooser(params string[] handledExtensions) { this.handledExtensions = handledExtensions; } diff --git a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs index 9d4e72d1f3..36edb5dd83 100644 --- a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs +++ b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs @@ -8,15 +8,14 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Beatmaps; -using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays; namespace osu.Game.Screens.Edit.Setup { internal class ResourcesSection : SetupSection { - private LabelledTextBox audioTrackTextBox; - private LabelledTextBox backgroundTextBox; + private LabelledFileChooser audioTrackChooser; + private LabelledFileChooser backgroundChooser; public override LocalisableString Title => "Resources"; @@ -40,26 +39,24 @@ namespace osu.Game.Screens.Edit.Setup { Children = new Drawable[] { - backgroundTextBox = new FileChooserLabelledTextBox(".jpg", ".jpeg", ".png") + backgroundChooser = new LabelledFileChooser(".jpg", ".jpeg", ".png") { Label = "Background", FixedLabelWidth = LABEL_WIDTH, - PlaceholderText = "Click to select a background image", Current = { Value = working.Value.Metadata.BackgroundFile }, TabbableContentContainer = this }, - audioTrackTextBox = new FileChooserLabelledTextBox(".mp3", ".ogg") + audioTrackChooser = new LabelledFileChooser(".mp3", ".ogg") { Label = "Audio Track", FixedLabelWidth = LABEL_WIDTH, - PlaceholderText = "Click to select a track", Current = { Value = working.Value.Metadata.AudioFile }, TabbableContentContainer = this }, }; - backgroundTextBox.Current.BindValueChanged(backgroundChanged); - audioTrackTextBox.Current.BindValueChanged(audioTrackChanged); + backgroundChooser.Current.BindValueChanged(backgroundChanged, true); + audioTrackChooser.Current.BindValueChanged(audioTrackChanged, true); } public bool ChangeBackgroundImage(string path) @@ -124,14 +121,28 @@ namespace osu.Game.Screens.Edit.Setup private void backgroundChanged(ValueChangedEvent filePath) { - if (!ChangeBackgroundImage(filePath.NewValue)) - backgroundTextBox.Current.Value = filePath.OldValue; + backgroundChooser.PlaceholderText = string.IsNullOrEmpty(filePath.NewValue) + ? "Click to select a background image" + : "Click to replace the background image"; + + if (filePath.NewValue != filePath.OldValue) + { + if (!ChangeBackgroundImage(filePath.NewValue)) + backgroundChooser.Current.Value = filePath.OldValue; + } } private void audioTrackChanged(ValueChangedEvent filePath) { - if (!ChangeAudioTrack(filePath.NewValue)) - audioTrackTextBox.Current.Value = filePath.OldValue; + audioTrackChooser.PlaceholderText = string.IsNullOrEmpty(filePath.NewValue) + ? "Click to select a track" + : "Click to replace the track"; + + if (filePath.NewValue != filePath.OldValue) + { + if (!ChangeAudioTrack(filePath.NewValue)) + audioTrackChooser.Current.Value = filePath.OldValue; + } } } } From 3df9d7c9e1b37d386b43f739eb8f8383122d2d2a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 15:56:59 +0900 Subject: [PATCH 1644/2328] Add a bit more animation when adjusting --- .../Overlays/Toolbar/ToolbarMusicButton.cs | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs index 0c948990a0..689b750826 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs @@ -8,7 +8,9 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Transforms; using osu.Framework.Input.Events; +using osu.Framework.Threading; using osu.Game.Input.Bindings; using osuTK.Graphics; @@ -32,7 +34,7 @@ namespace osu.Game.Overlays.Toolbar StateContainer = music; Flow.Padding = new MarginPadding { Horizontal = Toolbar.HEIGHT / 4 }; - Flow.Add(new Container + Flow.Add(volumeDisplay = new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, @@ -66,20 +68,46 @@ namespace osu.Game.Overlays.Toolbar private VolumeOverlay volume { get; set; } private IBindable globalVolume; + private Container volumeDisplay; protected override void LoadComplete() { base.LoadComplete(); globalVolume = audio.Volume.GetBoundCopy(); - globalVolume.BindValueChanged(v => volumeBar.Height = (float)v.NewValue, true); + globalVolume.BindValueChanged(v => volumeBar.ResizeHeightTo((float)v.NewValue, 200, Easing.OutQuint), true); } protected override bool OnScroll(ScrollEvent e) { - volume?.FocusMasterVolume(); + focusForAdjustment(); volume?.Adjust(GlobalAction.IncreaseVolume, e.ScrollDelta.Y, e.IsPrecise); return true; } + + private void focusForAdjustment() + { + volume?.FocusMasterVolume(); + expandVolumeBarTemporarily(); + } + + private TransformSequence expandTransform; + private ScheduledDelegate contractTransform; + + private void expandVolumeBarTemporarily() + { + // avoid starting a new transform if one is already active. + if (expandTransform == null) + { + expandTransform = volumeDisplay.ResizeWidthTo(6, 500, Easing.OutQuint); + expandTransform.Finally(_ => expandTransform = null); + } + + contractTransform?.Cancel(); + contractTransform = Scheduler.AddDelayed(() => + { + volumeDisplay.ResizeWidthTo(3f, 500, Easing.OutQuint); + }, 1000); + } } } From 873806c2ea4112d4ef7510d37933340b7921a1b1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 15:57:09 +0900 Subject: [PATCH 1645/2328] Add keyboard adjustment support --- .../Visual/Menus/TestSceneToolbar.cs | 15 ++++++++++++++- .../Overlays/Toolbar/ToolbarMusicButton.cs | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs index 09fae2fb77..f230e48b11 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs @@ -148,7 +148,7 @@ namespace osu.Game.Tests.Visual.Menus } [Test] - public void TestVolumeControlViaMusicButton() + public void TestVolumeControlViaMusicButtonScroll() { AddStep("hover toolbar music button", () => InputManager.MoveMouseTo(this.ChildrenOfType().Single())); @@ -160,6 +160,19 @@ namespace osu.Game.Tests.Visual.Menus AddAssert("volume raised up", () => Audio.Volume.Value == 1); } + [Test] + public void TestVolumeControlViaMusicButtonArrowKeys() + { + AddStep("hover toolbar music button", () => InputManager.MoveMouseTo(this.ChildrenOfType().Single())); + + AddStep("reset volume", () => Audio.Volume.Value = 1); + + AddRepeatStep("arrow down", () => InputManager.Key(Key.Down), 5); + AddAssert("volume lowered down", () => Audio.Volume.Value < 1); + AddRepeatStep("arrow up", () => InputManager.Key(Key.Up), 5); + AddAssert("volume raised up", () => Audio.Volume.Value == 1); + } + public class TestToolbar : Toolbar { public new Bindable OverlayActivationMode => base.OverlayActivationMode as Bindable; diff --git a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs index 689b750826..2104fcbbfe 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs @@ -13,6 +13,7 @@ using osu.Framework.Input.Events; using osu.Framework.Threading; using osu.Game.Input.Bindings; using osuTK.Graphics; +using osuTK.Input; namespace osu.Game.Overlays.Toolbar { @@ -78,6 +79,24 @@ namespace osu.Game.Overlays.Toolbar globalVolume.BindValueChanged(v => volumeBar.ResizeHeightTo((float)v.NewValue, 200, Easing.OutQuint), true); } + protected override bool OnKeyDown(KeyDownEvent e) + { + switch (e.Key) + { + case Key.Up: + focusForAdjustment(); + volume?.Adjust(GlobalAction.IncreaseVolume); + return true; + + case Key.Down: + focusForAdjustment(); + volume?.Adjust(GlobalAction.IncreaseVolume, -1); + return true; + } + + return base.OnKeyDown(e); + } + protected override bool OnScroll(ScrollEvent e) { focusForAdjustment(); From eac0ca4db6c4daca0e962802beca715735484549 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 16:14:46 +0900 Subject: [PATCH 1646/2328] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 3b70df82c2..81f1a3e259 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 19ec7ebcd0..f8ff29d58a 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -37,7 +37,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index c971612f62..929df0736b 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -62,7 +62,7 @@ - + From 583619b9151fad54c4abde8c915846fda62b0bd5 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 10:21:27 +0300 Subject: [PATCH 1647/2328] Use `GlobalAction.DecreaseVolume` instead --- osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs index 2104fcbbfe..d59127d61f 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs @@ -90,7 +90,7 @@ namespace osu.Game.Overlays.Toolbar case Key.Down: focusForAdjustment(); - volume?.Adjust(GlobalAction.IncreaseVolume, -1); + volume?.Adjust(GlobalAction.DecreaseVolume); return true; } From 1f1633ddc2260fe6c71ce64e04d3509eb617c377 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 16:50:23 +0900 Subject: [PATCH 1648/2328] Remove `Update` method processing of samples in `PopupDialogDangerousButton` --- .../Dialog/PopupDialogDangerousButton.cs | 62 ++++++++----------- 1 file changed, 26 insertions(+), 36 deletions(-) diff --git a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs index 9db2589147..1cf8578852 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs @@ -4,10 +4,10 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; -using osu.Framework.Utils; using osu.Game.Audio.Effects; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -53,37 +53,33 @@ namespace osu.Game.Overlays.Dialog private Sample tickSample; private Sample confirmSample; - private bool isTicking; private double lastTickPlaybackTime; private AudioFilter lowPassFilter = null!; [BackgroundDependencyLoader] private void load(AudioManager audio) { - lowPassFilter = new AudioFilter(audio.SampleMixer); tickSample = audio.Samples.Get(@"UI/dialog-dangerous-tick"); confirmSample = audio.Samples.Get(@"UI/dialog-dangerous-select"); + + AddInternal(lowPassFilter = new AudioFilter(audio.SampleMixer)); } - protected override void Update() + protected override void LoadComplete() { - base.Update(); + base.LoadComplete(); + Progress.BindValueChanged(progressChanged); + } - if (!isTicking) return; - - if (Precision.AlmostEquals(Progress.Value, 1)) - { - confirmSample?.Play(); - isTicking = false; - } - - if (Clock.CurrentTime - lastTickPlaybackTime >= 30) - playTick(Progress.Value); + protected override void Confirm() + { + lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF); + confirmSample?.Play(); + base.Confirm(); } protected override bool OnMouseDown(MouseDownEvent e) { - startTickSound(); BeginConfirm(); return true; } @@ -92,34 +88,28 @@ namespace osu.Game.Overlays.Dialog { if (!e.HasAnyButtonPressed) { - stopTickSound(); AbortConfirm(); } } - private void playTick(double progress) + private void progressChanged(ValueChangedEvent progress) { - lowPassFilter.CutoffTo((int)(Progress.Value * AudioFilter.MAX_LOWPASS_CUTOFF * 0.5f)); + if (progress.NewValue < progress.OldValue) + { + lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF); + return; + } - tickSample.Frequency.Value = 1 + progress * 0.5f; - tickSample.Volume.Value = 0.5f + progress / 2f; - tickSample.Play(); + if (Clock.CurrentTime - lastTickPlaybackTime >= 30) + { + lowPassFilter.CutoffTo((int)(progress.NewValue * AudioFilter.MAX_LOWPASS_CUTOFF * 0.5)); - lastTickPlaybackTime = Clock.CurrentTime; - } + tickSample.Frequency.Value = 1 + progress.NewValue * 0.5f; + tickSample.Volume.Value = 0.5f + progress.NewValue / 2f; + tickSample.Play(); - private void startTickSound() - { - lowPassFilter.CutoffTo(0); - playTick(Progress.Value); - isTicking = true; - } - - private void stopTickSound() - { - isTicking = false; - lastTickPlaybackTime = Clock.CurrentTime; - lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF); + lastTickPlaybackTime = Clock.CurrentTime; + } } } } From accd6031bdf041bcee12ffdf7265d3c01616f872 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 16:53:56 +0900 Subject: [PATCH 1649/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 3b70df82c2..4d9f86cc64 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 19ec7ebcd0..51950c0bdc 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index c971612f62..a009885458 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 94aa2248cae85c8843fa7f7fe2887c8d2513d0fa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 17:31:45 +0900 Subject: [PATCH 1650/2328] Move filter reset to more appropriate location --- .../Dialog/PopupDialogDangerousButton.cs | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs index 1cf8578852..90ac2d8a08 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs @@ -88,28 +88,24 @@ namespace osu.Game.Overlays.Dialog { if (!e.HasAnyButtonPressed) { + lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF); AbortConfirm(); } } private void progressChanged(ValueChangedEvent progress) { - if (progress.NewValue < progress.OldValue) - { - lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF); - return; - } + if (progress.NewValue < progress.OldValue) return; - if (Clock.CurrentTime - lastTickPlaybackTime >= 30) - { - lowPassFilter.CutoffTo((int)(progress.NewValue * AudioFilter.MAX_LOWPASS_CUTOFF * 0.5)); + if (Clock.CurrentTime - lastTickPlaybackTime < 30) return; - tickSample.Frequency.Value = 1 + progress.NewValue * 0.5f; - tickSample.Volume.Value = 0.5f + progress.NewValue / 2f; - tickSample.Play(); + lowPassFilter.CutoffTo((int)(progress.NewValue * AudioFilter.MAX_LOWPASS_CUTOFF * 0.5)); - lastTickPlaybackTime = Clock.CurrentTime; - } + tickSample.Frequency.Value = 1 + progress.NewValue * 0.5f; + tickSample.Volume.Value = 0.5f + progress.NewValue / 2f; + tickSample.Play(); + + lastTickPlaybackTime = Clock.CurrentTime; } } } From b3aa4fcf02b6b289ea7979135369a0bfdb459791 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 17:33:05 +0900 Subject: [PATCH 1651/2328] Adjust a channel rather than the overall sample --- osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs index 90ac2d8a08..d145a1c7da 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs @@ -101,9 +101,12 @@ namespace osu.Game.Overlays.Dialog lowPassFilter.CutoffTo((int)(progress.NewValue * AudioFilter.MAX_LOWPASS_CUTOFF * 0.5)); - tickSample.Frequency.Value = 1 + progress.NewValue * 0.5f; - tickSample.Volume.Value = 0.5f + progress.NewValue / 2f; - tickSample.Play(); + var channel = tickSample.GetChannel(); + + channel.Frequency.Value = 1 + progress.NewValue * 0.5f; + channel.Volume.Value = 0.5f + progress.NewValue / 2f; + + channel.Play(); lastTickPlaybackTime = Clock.CurrentTime; } From 6136e4e27aeb09a69bce778b85362813867d7f05 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 17:37:14 +0900 Subject: [PATCH 1652/2328] Don't play exit sound if screen is in a non-resumable state when exiting --- osu.Game/Screens/Edit/EditorLoader.cs | 2 -- osu.Game/Screens/OsuScreen.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game/Screens/Edit/EditorLoader.cs b/osu.Game/Screens/Edit/EditorLoader.cs index 94eb6d5e70..0a2b8437fa 100644 --- a/osu.Game/Screens/Edit/EditorLoader.cs +++ b/osu.Game/Screens/Edit/EditorLoader.cs @@ -40,8 +40,6 @@ namespace osu.Game.Screens.Edit public override bool DisallowExternalBeatmapRulesetChanges => true; - protected override bool PlayExitSound => false; - [Resolved] private BeatmapManager beatmapManager { get; set; } diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index e742a2821f..810aadffad 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -212,7 +212,7 @@ namespace osu.Game.Screens public override bool OnExiting(ScreenExitEvent e) { - if (PlayExitSound) + if (ValidForResume && PlayExitSound) sampleExit?.Play(); if (ValidForResume && logo != null) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index b7b3c6fde1..f3b22c3355 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -51,8 +51,6 @@ namespace osu.Game.Screens.Play // We show the previous screen status protected override UserActivity? InitialActivity => null; - protected override bool PlayExitSound => false; - protected BeatmapMetadataDisplay MetadataInfo { get; private set; } = null!; /// From 7ac5019c0828e78062521afba451bbb2c2f5b8a0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 17:37:30 +0900 Subject: [PATCH 1653/2328] Fix intro screens playing exit sounds --- osu.Game/Screens/Menu/IntroScreen.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs index d4072d6202..c9b9bb344d 100644 --- a/osu.Game/Screens/Menu/IntroScreen.cs +++ b/osu.Game/Screens/Menu/IntroScreen.cs @@ -63,6 +63,8 @@ namespace osu.Game.Screens.Menu protected virtual string SeeyaSampleName => "Intro/seeya"; + protected override bool PlayExitSound => false; + private LeasedBindable beatmap; private OsuScreen nextScreen; From fd4529aa7c504cf2f820ee75c99bef219189f41f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 17:37:54 +0900 Subject: [PATCH 1654/2328] Play editor exit sound if no confirmation buttons were shown during exit process --- osu.Game/Screens/Edit/Editor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 2c13fe79b6..4e35f3c34e 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -63,7 +63,7 @@ namespace osu.Game.Screens.Edit public override bool? AllowTrackAdjustments => false; - protected override bool PlayExitSound => false; + protected override bool PlayExitSound => !HasUnsavedChanges; protected bool HasUnsavedChanges { From 713cff3403d31c628965915262dd7b0a664858b7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 17:49:09 +0900 Subject: [PATCH 1655/2328] Don't play editor exit sound when changing difficulties --- osu.Game/Screens/Edit/Editor.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 4e35f3c34e..6c30413d8c 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -63,7 +63,9 @@ namespace osu.Game.Screens.Edit public override bool? AllowTrackAdjustments => false; - protected override bool PlayExitSound => !HasUnsavedChanges; + protected override bool PlayExitSound => !HasUnsavedChanges && !isChangingDifficulties; + + private bool isChangingDifficulties; protected bool HasUnsavedChanges { @@ -859,7 +861,10 @@ namespace osu.Game.Screens.Edit } private void switchToNewDifficulty(RulesetInfo rulesetInfo, bool createCopy) - => loader?.ScheduleSwitchToNewDifficulty(editorBeatmap.BeatmapInfo, rulesetInfo, createCopy, GetState(rulesetInfo)); + { + isChangingDifficulties = true; + loader?.ScheduleSwitchToNewDifficulty(editorBeatmap.BeatmapInfo, rulesetInfo, createCopy, GetState(rulesetInfo)); + } private EditorMenuItem createDifficultySwitchMenu() { From be2b4e68b9e90fb42cc27032015b4885da10293e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 17:49:18 +0900 Subject: [PATCH 1656/2328] Don't play player exit sound when restarting --- osu.Game/Screens/Play/Player.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index d6f6a06eb7..33a20ff190 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -53,6 +53,8 @@ namespace osu.Game.Screens.Play public override bool AllowBackButton => false; // handled by HoldForMenuButton + protected override bool PlayExitSound => !isRestarting; + protected override UserActivity InitialActivity => new UserActivity.InSoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value); public override float BackgroundParallaxAmount => 0.1f; @@ -75,6 +77,8 @@ namespace osu.Game.Screens.Play public Action RestartRequested; + private bool isRestarting; + private Bindable mouseWheelDisabled; private readonly Bindable storyboardReplacesBackground = new Bindable(); @@ -643,6 +647,8 @@ namespace osu.Game.Screens.Play if (!Configuration.AllowRestart) return; + isRestarting = true; + // at the point of restarting the track should either already be paused or the volume should be zero. // stopping here is to ensure music doesn't become audible after exiting back to PlayerLoader. musicController.Stop(); From c27e5d1216e7be5f9c149b58e0ff9e42a5206aa4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 18:44:02 +0900 Subject: [PATCH 1657/2328] Fix editor still playing back sound when exiting with confirmation --- osu.Game/Screens/Edit/Editor.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 6c30413d8c..1fbc1b4bd6 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -63,9 +63,7 @@ namespace osu.Game.Screens.Edit public override bool? AllowTrackAdjustments => false; - protected override bool PlayExitSound => !HasUnsavedChanges && !isChangingDifficulties; - - private bool isChangingDifficulties; + protected override bool PlayExitSound => !ExitConfirmed && !switchingDifficulty; protected bool HasUnsavedChanges { @@ -103,6 +101,8 @@ namespace osu.Game.Screens.Edit protected bool ExitConfirmed { get; private set; } + private bool switchingDifficulty; + private string lastSavedHash; private Container screenContainer; @@ -862,7 +862,7 @@ namespace osu.Game.Screens.Edit private void switchToNewDifficulty(RulesetInfo rulesetInfo, bool createCopy) { - isChangingDifficulties = true; + switchingDifficulty = true; loader?.ScheduleSwitchToNewDifficulty(editorBeatmap.BeatmapInfo, rulesetInfo, createCopy, GetState(rulesetInfo)); } From 1520ccf865a4b019be3191231ee526a29b7882ae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 18:44:16 +0900 Subject: [PATCH 1658/2328] Fix double back sound due to sub screen presence in multiplayer/playlists --- osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs index f2429c1944..b1c10f4a4a 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs @@ -37,6 +37,8 @@ namespace osu.Game.Screens.OnlinePlay.Lounge { public override string Title => "Lounge"; + protected override bool PlayExitSound => false; + protected override BackgroundScreen CreateBackground() => new LoungeBackgroundScreen { SelectedRoom = { BindTarget = SelectedRoom } From d89c80ace2df4bdb7e26e5543d692e0ffc053261 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 15 Jun 2022 18:44:15 +0900 Subject: [PATCH 1659/2328] Block operations during beatmap selection in match --- .../Multiplayer/MultiplayerMatchSongSelect.cs | 43 +++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs index 929c3ee321..b2355a9021 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs @@ -1,6 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + +using System; using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; @@ -18,11 +21,15 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer public class MultiplayerMatchSongSelect : OnlinePlaySongSelect { [Resolved] - private MultiplayerClient client { get; set; } + private MultiplayerClient client { get; set; } = null!; + + [Resolved] + private OngoingOperationTracker operationTracker { get; set; } = null!; private readonly long? itemToEdit; - private LoadingLayer loadingLayer; + private LoadingLayer loadingLayer = null!; + private IDisposable? selectionOperation; /// /// Construct a new instance of multiplayer song select. @@ -31,7 +38,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer /// The item to be edited. May be null, in which case a new item will be added to the playlist. /// An optional initial beatmap selection to perform. /// An optional initial ruleset selection to perform. - public MultiplayerMatchSongSelect(Room room, long? itemToEdit = null, WorkingBeatmap beatmap = null, RulesetInfo ruleset = null) + public MultiplayerMatchSongSelect(Room room, long? itemToEdit = null, WorkingBeatmap? beatmap = null, RulesetInfo? ruleset = null) : base(room) { this.itemToEdit = itemToEdit; @@ -58,6 +65,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer // Otherwise, update the playlist directly in preparation for it to be submitted to the API on match creation. if (client.Room != null) { + selectionOperation = operationTracker.BeginOperation(); + loadingLayer.Show(); var multiplayerItem = new MultiplayerPlaylistItem @@ -72,18 +81,28 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer Task task = itemToEdit != null ? client.EditPlaylistItem(multiplayerItem) : client.AddPlaylistItem(multiplayerItem); - task.FireAndForget(onSuccess: () => Schedule(() => + task.FireAndForget(onSuccess: () => { - loadingLayer.Hide(); + selectionOperation.Dispose(); - // If an error or server side trigger occurred this screen may have already exited by external means. - if (this.IsCurrentScreen()) - this.Exit(); - }), onError: _ => Schedule(() => + Schedule(() => + { + loadingLayer.Hide(); + + // If an error or server side trigger occurred this screen may have already exited by external means. + if (this.IsCurrentScreen()) + this.Exit(); + }); + }, onError: _ => { - loadingLayer.Hide(); - Carousel.AllowSelection = true; - })); + selectionOperation.Dispose(); + + Schedule(() => + { + loadingLayer.Hide(); + Carousel.AllowSelection = true; + }); + }); } else { From 7a2919975a93bac1279abfc62f3ff61293f1207c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 18:48:22 +0900 Subject: [PATCH 1660/2328] Fix sound clash when exiting a multiplayer room with confirmation --- .../Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs index 769873f74c..dc78cb10ef 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs @@ -41,6 +41,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer public override string ShortTitle => "room"; + protected override bool PlayExitSound => !exitConfirmed; + [Resolved] private MultiplayerClient client { get; set; } From 9edc4fc181ccf0e4c8e9d276a5adf989f7474b16 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 17:11:11 +0900 Subject: [PATCH 1661/2328] Remove unnecessary `ShouldDeleteArchive` override (already done in base implementation) --- osu.Game/Beatmaps/BeatmapModelManager.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapModelManager.cs b/osu.Game/Beatmaps/BeatmapModelManager.cs index 277047348e..c7600bf64c 100644 --- a/osu.Game/Beatmaps/BeatmapModelManager.cs +++ b/osu.Game/Beatmaps/BeatmapModelManager.cs @@ -41,8 +41,6 @@ namespace osu.Game.Beatmaps { } - protected override bool ShouldDeleteArchive(string path) => Path.GetExtension(path)?.ToLowerInvariant() == ".osz"; - /// /// Saves an file against a given . /// From 23d7667f39929ee41234510ffdd521f9623b5f60 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 17:12:01 +0900 Subject: [PATCH 1662/2328] Move `BeatmapImporter` to correct namespace --- osu.Game/{Stores => Beatmaps}/BeatmapImporter.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename osu.Game/{Stores => Beatmaps}/BeatmapImporter.cs (99%) diff --git a/osu.Game/Stores/BeatmapImporter.cs b/osu.Game/Beatmaps/BeatmapImporter.cs similarity index 99% rename from osu.Game/Stores/BeatmapImporter.cs rename to osu.Game/Beatmaps/BeatmapImporter.cs index 3d89dfeca9..4a50e8da98 100644 --- a/osu.Game/Stores/BeatmapImporter.cs +++ b/osu.Game/Beatmaps/BeatmapImporter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Collections.Generic; using System.IO; @@ -13,7 +15,6 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Framework.Testing; -using osu.Game.Beatmaps; using osu.Game.Beatmaps.Formats; using osu.Game.Database; using osu.Game.Extensions; @@ -23,11 +24,10 @@ using osu.Game.Models; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; using osu.Game.Skinning; +using osu.Game.Stores; using Realms; -#nullable enable - -namespace osu.Game.Stores +namespace osu.Game.Beatmaps { /// /// Handles the storage and retrieval of Beatmaps/WorkingBeatmaps. From f23ddfe6ccf7a966773848a61c659aca83454f5b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jun 2022 17:13:32 +0900 Subject: [PATCH 1663/2328] Move remaining realm classes out of `Stores` namespace --- osu.Game.Tests/Database/BeatmapImporterTests.cs | 1 - osu.Game.Tests/Database/FileStoreTests.cs | 6 +++--- osu.Game/Beatmaps/BeatmapImporter.cs | 1 - osu.Game/Beatmaps/BeatmapManager.cs | 1 - osu.Game/Beatmaps/BeatmapModelManager.cs | 1 - osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs | 1 - osu.Game/Database/ImportTask.cs | 1 - osu.Game/Database/RealmAccess.cs | 1 - osu.Game/{Stores => Database}/RealmArchiveModelImporter.cs | 7 +++---- osu.Game/{Stores => Database}/RealmArchiveModelManager.cs | 7 +++---- osu.Game/{Stores => Database}/RealmFileStore.cs | 7 +++---- osu.Game/Scoring/ScoreModelManager.cs | 1 - osu.Game/Skinning/SkinModelManager.cs | 1 - osu.Game/Storyboards/Drawables/DrawableStoryboard.cs | 1 - 14 files changed, 12 insertions(+), 25 deletions(-) rename osu.Game/{Stores => Database}/RealmArchiveModelImporter.cs (99%) rename osu.Game/{Stores => Database}/RealmArchiveModelManager.cs (99%) rename osu.Game/{Stores => Database}/RealmFileStore.cs (98%) diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index de2bbeb791..a057f893f4 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -21,7 +21,6 @@ using osu.Game.IO.Archives; using osu.Game.Models; using osu.Game.Overlays.Notifications; using osu.Game.Rulesets; -using osu.Game.Stores; using osu.Game.Tests.Resources; using Realms; using SharpCompress.Archives; diff --git a/osu.Game.Tests/Database/FileStoreTests.cs b/osu.Game.Tests/Database/FileStoreTests.cs index 98b0ed99b5..13af05bbbb 100644 --- a/osu.Game.Tests/Database/FileStoreTests.cs +++ b/osu.Game.Tests/Database/FileStoreTests.cs @@ -1,16 +1,16 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System.Diagnostics; using System.IO; using System.Linq; using NUnit.Framework; using osu.Framework.Logging; +using osu.Game.Database; using osu.Game.Extensions; using osu.Game.Models; -using osu.Game.Stores; - -#nullable enable namespace osu.Game.Tests.Database { diff --git a/osu.Game/Beatmaps/BeatmapImporter.cs b/osu.Game/Beatmaps/BeatmapImporter.cs index 4a50e8da98..a2ab70fed8 100644 --- a/osu.Game/Beatmaps/BeatmapImporter.cs +++ b/osu.Game/Beatmaps/BeatmapImporter.cs @@ -24,7 +24,6 @@ using osu.Game.Models; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; using osu.Game.Skinning; -using osu.Game.Stores; using Realms; namespace osu.Game.Beatmaps diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index e156c2b430..9397c2f3b2 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -21,7 +21,6 @@ using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Notifications; using osu.Game.Rulesets; using osu.Game.Skinning; -using osu.Game.Stores; using osu.Game.Utils; #nullable enable diff --git a/osu.Game/Beatmaps/BeatmapModelManager.cs b/osu.Game/Beatmaps/BeatmapModelManager.cs index c7600bf64c..055eb36850 100644 --- a/osu.Game/Beatmaps/BeatmapModelManager.cs +++ b/osu.Game/Beatmaps/BeatmapModelManager.cs @@ -15,7 +15,6 @@ using osu.Game.Beatmaps.Formats; using osu.Game.Database; using osu.Game.Extensions; using osu.Game.Skinning; -using osu.Game.Stores; using osu.Game.Overlays.Notifications; #nullable enable diff --git a/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs b/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs index fc39887e79..44fa8092fb 100644 --- a/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs +++ b/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs @@ -17,7 +17,6 @@ using osu.Framework.Threading; using osu.Game.Database; using osu.Game.Online.API; using osu.Game.Online.API.Requests; -using osu.Game.Stores; using SharpCompress.Compressors; using SharpCompress.Compressors.BZip2; diff --git a/osu.Game/Database/ImportTask.cs b/osu.Game/Database/ImportTask.cs index d75c1a73e6..41ce0339a1 100644 --- a/osu.Game/Database/ImportTask.cs +++ b/osu.Game/Database/ImportTask.cs @@ -6,7 +6,6 @@ using System.IO; using osu.Framework.Extensions; using osu.Game.IO.Archives; -using osu.Game.Stores; using osu.Game.Utils; using SharpCompress.Common; diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 086ec52d80..de7e3020c6 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -28,7 +28,6 @@ using osu.Game.Models; using osu.Game.Rulesets; using osu.Game.Scoring; using osu.Game.Skinning; -using osu.Game.Stores; using Realms; using Realms.Exceptions; diff --git a/osu.Game/Stores/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs similarity index 99% rename from osu.Game/Stores/RealmArchiveModelImporter.cs rename to osu.Game/Database/RealmArchiveModelImporter.cs index 7f31bc66be..4153f421ef 100644 --- a/osu.Game/Stores/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Collections.Generic; using System.IO; @@ -13,16 +15,13 @@ using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Framework.Threading; -using osu.Game.Database; using osu.Game.Extensions; using osu.Game.IO.Archives; using osu.Game.Models; using osu.Game.Overlays.Notifications; using Realms; -#nullable enable - -namespace osu.Game.Stores +namespace osu.Game.Database { /// /// Encapsulates a model store class to give it import functionality. diff --git a/osu.Game/Stores/RealmArchiveModelManager.cs b/osu.Game/Database/RealmArchiveModelManager.cs similarity index 99% rename from osu.Game/Stores/RealmArchiveModelManager.cs rename to osu.Game/Database/RealmArchiveModelManager.cs index cc8229b436..371b9be575 100644 --- a/osu.Game/Stores/RealmArchiveModelManager.cs +++ b/osu.Game/Database/RealmArchiveModelManager.cs @@ -1,20 +1,19 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Collections.Generic; using System.IO; using System.Linq; using osu.Framework.Platform; -using osu.Game.Database; using osu.Game.Extensions; using osu.Game.Models; using osu.Game.Overlays.Notifications; using Realms; -#nullable enable - -namespace osu.Game.Stores +namespace osu.Game.Database { /// /// Class which adds all the missing pieces bridging the gap between and (legacy) ArchiveModelManager. diff --git a/osu.Game/Stores/RealmFileStore.cs b/osu.Game/Database/RealmFileStore.cs similarity index 98% rename from osu.Game/Stores/RealmFileStore.cs rename to osu.Game/Database/RealmFileStore.cs index 457d70f29a..94f04ff0f3 100644 --- a/osu.Game/Stores/RealmFileStore.cs +++ b/osu.Game/Database/RealmFileStore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.IO; using System.Linq; @@ -9,14 +11,11 @@ using osu.Framework.IO.Stores; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Framework.Testing; -using osu.Game.Database; using osu.Game.Extensions; using osu.Game.Models; using Realms; -#nullable enable - -namespace osu.Game.Stores +namespace osu.Game.Database { /// /// Handles the storing of files to the file system (and database) backing. diff --git a/osu.Game/Scoring/ScoreModelManager.cs b/osu.Game/Scoring/ScoreModelManager.cs index 59102360f9..c88955c5fd 100644 --- a/osu.Game/Scoring/ScoreModelManager.cs +++ b/osu.Game/Scoring/ScoreModelManager.cs @@ -13,7 +13,6 @@ using osu.Game.Database; using osu.Game.IO.Archives; using osu.Game.Rulesets; using osu.Game.Scoring.Legacy; -using osu.Game.Stores; using Realms; #nullable enable diff --git a/osu.Game/Skinning/SkinModelManager.cs b/osu.Game/Skinning/SkinModelManager.cs index 0a18449800..ca90f41080 100644 --- a/osu.Game/Skinning/SkinModelManager.cs +++ b/osu.Game/Skinning/SkinModelManager.cs @@ -14,7 +14,6 @@ using osu.Game.Database; using osu.Game.Extensions; using osu.Game.IO; using osu.Game.IO.Archives; -using osu.Game.Stores; using Realms; #nullable enable diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs index a0fb7b0b4a..0a5d51f62e 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs @@ -15,7 +15,6 @@ using osu.Framework.Platform; using osu.Game.Database; using osu.Game.Rulesets.Mods; using osu.Game.Screens.Play; -using osu.Game.Stores; namespace osu.Game.Storyboards.Drawables { From 1ff070f5ff3722ee464c1196f987f678b725aa21 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 17:45:31 +0300 Subject: [PATCH 1664/2328] Decouple `LabelledFileChooser` from `LabelledTextBoxWithPopover` --- .../Screens/Edit/Setup/LabelledFileChooser.cs | 33 +++++++++++++++++-- .../Screens/Edit/Setup/ResourcesSection.cs | 4 +-- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs index 745c989b3b..2cb3af61c8 100644 --- a/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs +++ b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs @@ -14,14 +14,20 @@ using osu.Framework.Extensions; using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Localisation; using osu.Game.Database; using osu.Game.Graphics.UserInterfaceV2; using osuTK; namespace osu.Game.Screens.Edit.Setup { - internal class LabelledFileChooser : LabelledTextBoxWithPopover, ICanAcceptFiles + /// + /// A labelled drawable displaying file chooser on click, with placeholder text support. + /// todo: this should probably not use PopoverTextBox just to display placeholder text, but is the best way for now. + /// + internal class LabelledFileChooser : LabelledDrawable, IHasCurrentValue, ICanAcceptFiles, IHasPopover { private readonly string[] handledExtensions; @@ -34,13 +40,25 @@ namespace osu.Game.Screens.Edit.Setup private readonly BindableWithCurrent current = new BindableWithCurrent(); - public override Bindable Current + public Bindable Current { get => current.Current; set => current.Current = value; } + public LocalisableString Text + { + get => Component.PlaceholderText; + set => Component.PlaceholderText = value; + } + + public CompositeDrawable TabbableContentContainer + { + set => Component.TabbableContentContainer = value; + } + public LabelledFileChooser(params string[] handledExtensions) + : base(false) { this.handledExtensions = handledExtensions; } @@ -78,7 +96,16 @@ namespace osu.Game.Screens.Edit.Setup game.UnregisterImportHandler(this); } - public override Popover GetPopover() => new FileChooserPopover(handledExtensions, currentFile); + protected override LabelledTextBoxWithPopover.PopoverTextBox CreateComponent() => new LabelledTextBoxWithPopover.PopoverTextBox + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + CornerRadius = CORNER_RADIUS, + OnFocused = this.ShowPopover, + }; + + public Popover GetPopover() => new FileChooserPopover(handledExtensions, currentFile); private class FileChooserPopover : OsuPopover { diff --git a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs index 36edb5dd83..b4e350b94b 100644 --- a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs +++ b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs @@ -121,7 +121,7 @@ namespace osu.Game.Screens.Edit.Setup private void backgroundChanged(ValueChangedEvent filePath) { - backgroundChooser.PlaceholderText = string.IsNullOrEmpty(filePath.NewValue) + backgroundChooser.Text = string.IsNullOrEmpty(filePath.NewValue) ? "Click to select a background image" : "Click to replace the background image"; @@ -134,7 +134,7 @@ namespace osu.Game.Screens.Edit.Setup private void audioTrackChanged(ValueChangedEvent filePath) { - audioTrackChooser.PlaceholderText = string.IsNullOrEmpty(filePath.NewValue) + audioTrackChooser.Text = string.IsNullOrEmpty(filePath.NewValue) ? "Click to select a track" : "Click to replace the track"; From 026bad7fc49bdbd116910514c1c9836eaba30d13 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 18:11:28 +0300 Subject: [PATCH 1665/2328] Use notification processing mode logic instead --- osu.Game/Overlays/NotificationOverlay.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index e4ee2fe049..b772dffa73 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -38,6 +38,8 @@ namespace osu.Game.Overlays [Resolved(canBeNull: true)] private FirstRunSetupOverlay firstRunSetup { get; set; } + private IBindable firstRunSetupState; + [BackgroundDependencyLoader] private void load() { @@ -84,7 +86,7 @@ namespace osu.Game.Overlays private void updateProcessingMode() { - bool enabled = OverlayActivationMode.Value == OverlayActivation.All || State.Value == Visibility.Visible; + bool enabled = (OverlayActivationMode.Value == OverlayActivation.All && firstRunSetupState?.Value != Visibility.Visible) || State.Value == Visibility.Visible; notificationsEnabler?.Cancel(); @@ -100,6 +102,10 @@ namespace osu.Game.Overlays base.LoadComplete(); State.ValueChanged += _ => updateProcessingMode(); + + firstRunSetupState = firstRunSetup.State.GetBoundCopy(); + firstRunSetupState.ValueChanged += _ => updateProcessingMode(); + OverlayActivationMode.BindValueChanged(_ => updateProcessingMode(), true); } @@ -133,9 +139,7 @@ namespace osu.Game.Overlays var section = sections.Children.FirstOrDefault(s => s.AcceptTypes.Any(accept => accept.IsAssignableFrom(ourType))); section?.Add(notification, notification.DisplayOnTop ? -runningDepth : runningDepth); - // we don't want important notifications interrupting user on first-run setup. - // (this can happen when importing beatmaps inside setup, which posts import notifications) - if (notification.IsImportant && firstRunSetup?.State.Value != Visibility.Visible) + if (notification.IsImportant) Show(); updateCounts(); From 387c54c25219aea13c8473880823b51e5201ff1f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 18:11:46 +0300 Subject: [PATCH 1666/2328] Ensure notification is displayed after first-run setup is hidden --- .../Visual/Navigation/TestSceneFirstRunGame.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunGame.cs b/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunGame.cs index 37d7faf1fb..18c6e84950 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunGame.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunGame.cs @@ -24,7 +24,17 @@ namespace osu.Game.Tests.Visual.Navigation public void TestImportantNotificationDoesntInterruptSetup() { AddStep("post important notification", () => Game.Notifications.Post(new SimpleNotification { Text = "Important notification" })); + AddAssert("no notification posted", () => Game.Notifications.UnreadCount.Value == 0); AddAssert("first-run setup still visible", () => Game.FirstRunOverlay.State.Value == Visibility.Visible); + + AddUntilStep("finish first-run setup", () => + { + Game.FirstRunOverlay.NextButton.TriggerClick(); + return Game.FirstRunOverlay.State.Value == Visibility.Hidden; + }); + AddWaitStep("wait for post delay", 5); + AddAssert("notifications shown", () => Game.Notifications.State.Value == Visibility.Visible); + AddAssert("notification posted", () => Game.Notifications.UnreadCount.Value == 1); } protected override TestOsuGame CreateTestGame() => new FirstRunGame(LocalStorage, API); From 0418d70056c3211ff20b48293bf3e04de64fdafa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 15 Jun 2022 16:38:02 +0200 Subject: [PATCH 1667/2328] Add test coverage for ignoring null mods returned by rulesets --- .../TestSceneBrokenRulesetHandling.cs | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 osu.Game.Tests/Rulesets/TestSceneBrokenRulesetHandling.cs diff --git a/osu.Game.Tests/Rulesets/TestSceneBrokenRulesetHandling.cs b/osu.Game.Tests/Rulesets/TestSceneBrokenRulesetHandling.cs new file mode 100644 index 0000000000..9d27abf0b4 --- /dev/null +++ b/osu.Game.Tests/Rulesets/TestSceneBrokenRulesetHandling.cs @@ -0,0 +1,49 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Testing; +using osu.Game.Beatmaps; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.UI; +using osu.Game.Tests.Visual; + +namespace osu.Game.Tests.Rulesets +{ + [HeadlessTest] + public class TestSceneBrokenRulesetHandling : OsuTestScene + { + [Resolved] + private OsuGameBase gameBase { get; set; } = null!; + + [Test] + public void TestNullModsReturnedByRulesetAreIgnored() + { + AddStep("set ruleset with null mods", () => Ruleset.Value = new TestRulesetWithNullMods().RulesetInfo); + AddAssert("no null mods in available mods", () => gameBase.AvailableMods.Value.SelectMany(kvp => kvp.Value).All(mod => mod != null)); + } + +#nullable disable // purposefully disabling nullability to simulate broken or unannotated API user code. + + private class TestRulesetWithNullMods : Ruleset + { + public override string ShortName => "nullmods"; + public override string Description => "nullmods"; + + public override IEnumerable GetModsFor(ModType type) => new Mod[] { null }; + + public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList mods = null) => null; + public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => null; + public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => null; + } + +#nullable enable + } +} From 6e5e506fb46adca7971089acb75e7a1d446b130e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 15 Jun 2022 16:18:56 +0200 Subject: [PATCH 1668/2328] Add protection against rulesets returning null mods --- osu.Game/OsuGameBase.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 5dbdf6f602..e6f1452c3f 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -519,7 +519,9 @@ namespace osu.Game foreach (ModType type in Enum.GetValues(typeof(ModType))) { - dict[type] = instance.GetModsFor(type).ToList(); + dict[type] = instance.GetModsFor(type) + .Where(mod => mod != null) + .ToList(); } if (!SelectedMods.Disabled) From 665ef5fdcc06c9d8bcdb8bfb705b1ebee8e61047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 15 Jun 2022 17:16:17 +0200 Subject: [PATCH 1669/2328] Add test coverage for API-incompatible rulesets wrt mods --- .../TestSceneBrokenRulesetHandling.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/osu.Game.Tests/Rulesets/TestSceneBrokenRulesetHandling.cs b/osu.Game.Tests/Rulesets/TestSceneBrokenRulesetHandling.cs index 9d27abf0b4..243a93b4e5 100644 --- a/osu.Game.Tests/Rulesets/TestSceneBrokenRulesetHandling.cs +++ b/osu.Game.Tests/Rulesets/TestSceneBrokenRulesetHandling.cs @@ -3,6 +3,7 @@ #nullable enable +using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; @@ -12,6 +13,7 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.UI; using osu.Game.Tests.Visual; @@ -23,6 +25,12 @@ namespace osu.Game.Tests.Rulesets [Resolved] private OsuGameBase gameBase { get; set; } = null!; + [SetUpSteps] + public void SetUpSteps() + { + AddStep("reset ruleset", () => Ruleset.Value = new OsuRuleset().RulesetInfo); + } + [Test] public void TestNullModsReturnedByRulesetAreIgnored() { @@ -30,6 +38,17 @@ namespace osu.Game.Tests.Rulesets AddAssert("no null mods in available mods", () => gameBase.AvailableMods.Value.SelectMany(kvp => kvp.Value).All(mod => mod != null)); } + [Test] + public void TestRulesetRevertedIfModsCannotBeRetrieved() + { + RulesetInfo ruleset = null!; + + AddStep("store current ruleset", () => ruleset = Ruleset.Value); + + AddStep("set API incompatible ruleset", () => Ruleset.Value = new TestAPIIncompatibleRuleset().RulesetInfo); + AddAssert("ruleset not changed", () => Ruleset.Value.Equals(ruleset)); + } + #nullable disable // purposefully disabling nullability to simulate broken or unannotated API user code. private class TestRulesetWithNullMods : Ruleset @@ -44,6 +63,19 @@ namespace osu.Game.Tests.Rulesets public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => null; } + private class TestAPIIncompatibleRuleset : Ruleset + { + public override string ShortName => "incompatible"; + public override string Description => "incompatible"; + + // simulate API incompatibility by throwing similar exceptions. + public override IEnumerable GetModsFor(ModType type) => throw new MissingMethodException(); + + public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList mods = null) => null; + public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => null; + public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => null; + } + #nullable enable } } From e74b563b91e1526420363e4c507f19d494e241ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 15 Jun 2022 17:22:39 +0200 Subject: [PATCH 1670/2328] Add protection against arbitrary exceptions from `GetModsFor()` --- osu.Game/OsuGameBase.cs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index e6f1452c3f..2885d9413d 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -511,23 +511,34 @@ namespace osu.Game if (instance == null) { // reject the change if the ruleset is not available. - Ruleset.Value = r.OldValue?.Available == true ? r.OldValue : RulesetStore.AvailableRulesets.First(); + revertRulesetChange(); return; } var dict = new Dictionary>(); - foreach (ModType type in Enum.GetValues(typeof(ModType))) + try { - dict[type] = instance.GetModsFor(type) - .Where(mod => mod != null) - .ToList(); + foreach (ModType type in Enum.GetValues(typeof(ModType))) + { + dict[type] = instance.GetModsFor(type) + .Where(mod => mod != null) + .ToList(); + } + } + catch (Exception e) + { + Logger.Error(e, $"Could not load mods for \"{instance.RulesetInfo.Name}\" ruleset. Current ruleset has been rolled back."); + revertRulesetChange(); + return; } if (!SelectedMods.Disabled) SelectedMods.Value = Array.Empty(); AvailableMods.Value = dict; + + void revertRulesetChange() => Ruleset.Value = r.OldValue?.Available == true ? r.OldValue : RulesetStore.AvailableRulesets.First(); } private int allowableExceptions; From 30382b0445e4676ecf73710c8cfb4d7fcc5fb622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 15 Jun 2022 17:26:54 +0200 Subject: [PATCH 1671/2328] Fill out `GetModsFor()` xmldoc and annotate items as non-null --- osu.Game/OsuGameBase.cs | 2 ++ osu.Game/Rulesets/Ruleset.cs | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 2885d9413d..e34a67fd02 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -522,6 +522,8 @@ namespace osu.Game foreach (ModType type in Enum.GetValues(typeof(ModType))) { dict[type] = instance.GetModsFor(type) + // Rulesets should never return null mods, but let's be defensive just in case. + // ReSharper disable once ConditionIsAlwaysTrueOrFalse .Where(mod => mod != null) .ToList(); } diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index b7c6132bdb..9dec6984ea 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -93,6 +93,15 @@ namespace osu.Game.Rulesets return AllMods.FirstOrDefault(m => m is T)?.CreateInstance() as T; } + /// + /// Creates an enumerable with mods that are supported by the ruleset for the supplied . + /// + /// + /// If there are no applicable mods from the given in this ruleset, + /// then the proper behaviour is to return an empty enumerable. + /// mods should not be present in the returned enumerable. + /// + [ItemNotNull] public abstract IEnumerable GetModsFor(ModType type); /// From 6ee1c35c8f4db78a4c74970618656a424be59a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 15 Jun 2022 17:28:31 +0200 Subject: [PATCH 1672/2328] Fix template projects returning null mods from `GetModsFor()` --- .../osu.Game.Rulesets.EmptyFreeform/EmptyFreeformRuleset.cs | 3 ++- .../osu.Game.Rulesets.Pippidon/PippidonRuleset.cs | 3 ++- .../osu.Game.Rulesets.EmptyScrolling/EmptyScrollingRuleset.cs | 3 ++- .../osu.Game.Rulesets.Pippidon/PippidonRuleset.cs | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform/EmptyFreeformRuleset.cs b/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform/EmptyFreeformRuleset.cs index baf503085d..00754c6346 100644 --- a/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform/EmptyFreeformRuleset.cs +++ b/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform/EmptyFreeformRuleset.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -41,7 +42,7 @@ namespace osu.Game.Rulesets.EmptyFreeform return new[] { new EmptyFreeformModAutoplay() }; default: - return new Mod[] { null }; + return Array.Empty(); } } diff --git a/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon/PippidonRuleset.cs b/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon/PippidonRuleset.cs index 15e988f466..7dcdac7019 100644 --- a/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon/PippidonRuleset.cs +++ b/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon/PippidonRuleset.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; @@ -37,7 +38,7 @@ namespace osu.Game.Rulesets.Pippidon return new[] { new PippidonModAutoplay() }; default: - return new Mod[] { null }; + return Array.Empty(); } } diff --git a/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling/EmptyScrollingRuleset.cs b/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling/EmptyScrollingRuleset.cs index b9bed74c88..c8f0c07724 100644 --- a/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling/EmptyScrollingRuleset.cs +++ b/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling/EmptyScrollingRuleset.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; @@ -34,7 +35,7 @@ namespace osu.Game.Rulesets.EmptyScrolling return new[] { new EmptyScrollingModAutoplay() }; default: - return new Mod[] { null }; + return Array.Empty(); } } diff --git a/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon/PippidonRuleset.cs b/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon/PippidonRuleset.cs index ea94ceb4b5..d4566477db 100644 --- a/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon/PippidonRuleset.cs +++ b/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon/PippidonRuleset.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; @@ -34,7 +35,7 @@ namespace osu.Game.Rulesets.Pippidon return new[] { new PippidonModAutoplay() }; default: - return new Mod[] { null }; + return Array.Empty(); } } From 1acbb87aa6d88555f3f783b8f4088c783e82792a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 15 Jun 2022 17:39:30 +0200 Subject: [PATCH 1673/2328] Ensure `AvailableMods.Value` is never null --- osu.Game/OsuGameBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index e34a67fd02..993ca5b5e8 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -159,7 +159,7 @@ namespace osu.Game /// /// Mods available for the current . /// - public readonly Bindable>> AvailableMods = new Bindable>>(); + public readonly Bindable>> AvailableMods = new Bindable>>(new Dictionary>()); private BeatmapDifficultyCache difficultyCache; From e7dcbddbeb4eb4febf48c79578c3d2595b27e765 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 18:53:49 +0300 Subject: [PATCH 1674/2328] Fix potential null reference --- osu.Game/Overlays/NotificationOverlay.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index b772dffa73..1fe446454c 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Linq; +using JetBrains.Annotations; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -36,8 +37,10 @@ namespace osu.Game.Overlays private AudioManager audio { get; set; } [Resolved(canBeNull: true)] + [CanBeNull] private FirstRunSetupOverlay firstRunSetup { get; set; } + [CanBeNull] private IBindable firstRunSetupState; [BackgroundDependencyLoader] @@ -103,8 +106,10 @@ namespace osu.Game.Overlays State.ValueChanged += _ => updateProcessingMode(); - firstRunSetupState = firstRunSetup.State.GetBoundCopy(); - firstRunSetupState.ValueChanged += _ => updateProcessingMode(); + firstRunSetupState = firstRunSetup?.State.GetBoundCopy(); + + if (firstRunSetupState != null) + firstRunSetupState.ValueChanged += _ => updateProcessingMode(); OverlayActivationMode.BindValueChanged(_ => updateProcessingMode(), true); } From 5d74d92fcf030d6c98fb8941ea3159914b09a6dd Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 19:28:43 +0300 Subject: [PATCH 1675/2328] Revert `virtual` current bindable --- osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs b/osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs index 77267e453c..dd6a902989 100644 --- a/osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs +++ b/osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs @@ -15,7 +15,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 { } - public virtual Bindable Current + public Bindable Current { get => Component.Current; set => Component.Current = value; From 2c35b1404b877767e2c39ac6218a05c3e6b1572c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 19:29:09 +0300 Subject: [PATCH 1676/2328] Use `FileInfo` as current bindable type --- .../Editing/TestSceneEditorBeatmapCreation.cs | 2 +- .../Screens/Edit/Setup/LabelledFileChooser.cs | 21 +++++------ .../Screens/Edit/Setup/ResourcesSection.cs | 36 +++++++++---------- 3 files changed, 27 insertions(+), 32 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs index 841f50e7bd..6bcd947f2f 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs @@ -96,7 +96,7 @@ namespace osu.Game.Tests.Visual.Editing using (var zip = ZipArchive.Open(temp)) zip.WriteToDirectory(extractedFolder); - bool success = setup.ChildrenOfType().First().ChangeAudioTrack(Path.Combine(extractedFolder, "03. Renatus - Soleily 192kbps.mp3")); + bool success = setup.ChildrenOfType().First().ChangeAudioTrack(new FileInfo(Path.Combine(extractedFolder, "03. Renatus - Soleily 192kbps.mp3"))); File.Delete(temp); Directory.Delete(extractedFolder, true); diff --git a/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs index 2cb3af61c8..6c56320666 100644 --- a/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs +++ b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs @@ -27,20 +27,18 @@ namespace osu.Game.Screens.Edit.Setup /// A labelled drawable displaying file chooser on click, with placeholder text support. /// todo: this should probably not use PopoverTextBox just to display placeholder text, but is the best way for now. /// - internal class LabelledFileChooser : LabelledDrawable, IHasCurrentValue, ICanAcceptFiles, IHasPopover + internal class LabelledFileChooser : LabelledDrawable, IHasCurrentValue, ICanAcceptFiles, IHasPopover { private readonly string[] handledExtensions; public IEnumerable HandledExtensions => handledExtensions; - private readonly Bindable currentFile = new Bindable(); - [Resolved] private OsuGameBase game { get; set; } = null!; - private readonly BindableWithCurrent current = new BindableWithCurrent(); + private readonly BindableWithCurrent current = new BindableWithCurrent(); - public Bindable Current + public Bindable Current { get => current.Current; set => current.Current = value; @@ -68,21 +66,18 @@ namespace osu.Game.Screens.Edit.Setup base.LoadComplete(); game.RegisterImportHandler(this); - currentFile.BindValueChanged(onFileSelected); + Current.BindValueChanged(onFileSelected); } private void onFileSelected(ValueChangedEvent file) { - if (file.NewValue == null) - return; - - this.HidePopover(); - Current.Value = file.NewValue.FullName; + if (file.NewValue != null) + this.HidePopover(); } Task ICanAcceptFiles.Import(params string[] paths) { - Schedule(() => currentFile.Value = new FileInfo(paths.First())); + Schedule(() => Current.Value = new FileInfo(paths.First())); return Task.CompletedTask; } @@ -105,7 +100,7 @@ namespace osu.Game.Screens.Edit.Setup OnFocused = this.ShowPopover, }; - public Popover GetPopover() => new FileChooserPopover(handledExtensions, currentFile); + public Popover GetPopover() => new FileChooserPopover(handledExtensions, Current); private class FileChooserPopover : OsuPopover { diff --git a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs index b4e350b94b..2471886d9b 100644 --- a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs +++ b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs @@ -43,26 +43,28 @@ namespace osu.Game.Screens.Edit.Setup { Label = "Background", FixedLabelWidth = LABEL_WIDTH, - Current = { Value = working.Value.Metadata.BackgroundFile }, TabbableContentContainer = this }, audioTrackChooser = new LabelledFileChooser(".mp3", ".ogg") { Label = "Audio Track", FixedLabelWidth = LABEL_WIDTH, - Current = { Value = working.Value.Metadata.AudioFile }, TabbableContentContainer = this }, }; + if (!string.IsNullOrEmpty(working.Value.Metadata.BackgroundFile)) + backgroundChooser.Current.Value = new FileInfo(working.Value.Metadata.BackgroundFile); + + if (!string.IsNullOrEmpty(working.Value.Metadata.AudioFile)) + audioTrackChooser.Current.Value = new FileInfo(working.Value.Metadata.AudioFile); + backgroundChooser.Current.BindValueChanged(backgroundChanged, true); audioTrackChooser.Current.BindValueChanged(audioTrackChanged, true); } - public bool ChangeBackgroundImage(string path) + public bool ChangeBackgroundImage(FileInfo source) { - var source = new FileInfo(path); - if (!source.Exists) return false; @@ -88,10 +90,8 @@ namespace osu.Game.Screens.Edit.Setup return true; } - public bool ChangeAudioTrack(string path) + public bool ChangeAudioTrack(FileInfo source) { - var source = new FileInfo(path); - if (!source.Exists) return false; @@ -119,29 +119,29 @@ namespace osu.Game.Screens.Edit.Setup return true; } - private void backgroundChanged(ValueChangedEvent filePath) + private void backgroundChanged(ValueChangedEvent file) { - backgroundChooser.Text = string.IsNullOrEmpty(filePath.NewValue) + backgroundChooser.Text = file.NewValue == null ? "Click to select a background image" : "Click to replace the background image"; - if (filePath.NewValue != filePath.OldValue) + if (file.NewValue != file.OldValue) { - if (!ChangeBackgroundImage(filePath.NewValue)) - backgroundChooser.Current.Value = filePath.OldValue; + if (!ChangeBackgroundImage(file.NewValue)) + backgroundChooser.Current.Value = file.OldValue; } } - private void audioTrackChanged(ValueChangedEvent filePath) + private void audioTrackChanged(ValueChangedEvent file) { - audioTrackChooser.Text = string.IsNullOrEmpty(filePath.NewValue) + audioTrackChooser.Text = file.NewValue == null ? "Click to select a track" : "Click to replace the track"; - if (filePath.NewValue != filePath.OldValue) + if (file.NewValue != file.OldValue) { - if (!ChangeAudioTrack(filePath.NewValue)) - audioTrackChooser.Current.Value = filePath.OldValue; + if (!ChangeAudioTrack(file.NewValue)) + audioTrackChooser.Current.Value = file.OldValue; } } } From f88c568c8d684920f72d8b74d617e114de8811e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 15 Jun 2022 19:53:04 +0200 Subject: [PATCH 1677/2328] Update flag sizes after switch to twemoji assets The old flags used a size of 150x100, while the new assets based on twemoji use a size of 150x108. Update existing usages to match this new aspect ratio better. --- osu.Game.Tournament/Components/DrawableTeamFlag.cs | 2 +- .../Screens/Drawings/Components/ScrollingTeamContainer.cs | 2 +- osu.Game/Online/Leaderboards/LeaderboardScore.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs | 2 +- osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs | 2 +- osu.Game/Overlays/Rankings/CountryPill.cs | 2 +- osu.Game/Overlays/Rankings/Tables/RankingsTable.cs | 2 +- .../OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs | 2 +- osu.Game/Users/ExtendedUserPanel.cs | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tournament/Components/DrawableTeamFlag.cs b/osu.Game.Tournament/Components/DrawableTeamFlag.cs index 75991a1ab8..f8c2612d71 100644 --- a/osu.Game.Tournament/Components/DrawableTeamFlag.cs +++ b/osu.Game.Tournament/Components/DrawableTeamFlag.cs @@ -32,7 +32,7 @@ namespace osu.Game.Tournament.Components { if (team == null) return; - Size = new Vector2(75, 50); + Size = new Vector2(75, 54); Masking = true; CornerRadius = 5; Child = flagSprite = new Sprite diff --git a/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs b/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs index 6fec74f95b..f1022a0402 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs @@ -310,7 +310,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components public class ScrollingTeam : DrawableTournamentTeam { public const float WIDTH = 58; - public const float HEIGHT = 41; + public const float HEIGHT = 44; private readonly Box outline; diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index c75e98cdaa..93a42bffb0 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -183,7 +183,7 @@ namespace osu.Game.Online.Leaderboards { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Size = new Vector2(30f, 20f), + Size = new Vector2(28, 20), }, new DateLabel(Score.Date) { diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 86e72e9faa..4b3407ba4c 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -165,7 +165,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores }, new UpdateableFlag(score.User.Country) { - Size = new Vector2(19, 13), + Size = new Vector2(19, 14), ShowPlaceholderOnNull = false, }, username, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs index 5c3906cb39..1c0fcf0e3c 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs @@ -116,7 +116,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Size = new Vector2(19, 13), + Size = new Vector2(19, 14), Margin = new MarginPadding { Top = 3 }, // makes spacing look more even ShowPlaceholderOnNull = false, }, diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index 6ba5cb2f7f..3b76dc01ee 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -133,7 +133,7 @@ namespace osu.Game.Overlays.Profile.Header { userFlag = new UpdateableFlag { - Size = new Vector2(30, 20), + Size = new Vector2(28, 20), ShowPlaceholderOnNull = false, }, userCountryText = new OsuSpriteText diff --git a/osu.Game/Overlays/Rankings/CountryPill.cs b/osu.Game/Overlays/Rankings/CountryPill.cs index edd7b596d2..3878e2ea4e 100644 --- a/osu.Game/Overlays/Rankings/CountryPill.cs +++ b/osu.Game/Overlays/Rankings/CountryPill.cs @@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Rankings { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(30, 20) + Size = new Vector2(28, 20) }, countryName = new OsuSpriteText { diff --git a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs index fd69b6c80a..9658679067 100644 --- a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs @@ -97,7 +97,7 @@ namespace osu.Game.Overlays.Rankings.Tables { new UpdateableFlag(GetCountry(item)) { - Size = new Vector2(30, 20), + Size = new Vector2(28, 20), ShowPlaceholderOnNull = false, }, CreateFlagContent(item) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs index e091559046..498a7d9972 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs @@ -125,7 +125,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Size = new Vector2(30, 20), + Size = new Vector2(28, 20), Country = user?.Country }, new OsuSpriteText diff --git a/osu.Game/Users/ExtendedUserPanel.cs b/osu.Game/Users/ExtendedUserPanel.cs index d0f693c37c..6733ff8b05 100644 --- a/osu.Game/Users/ExtendedUserPanel.cs +++ b/osu.Game/Users/ExtendedUserPanel.cs @@ -53,7 +53,7 @@ namespace osu.Game.Users protected UpdateableFlag CreateFlag() => new UpdateableFlag(User.Country) { - Size = new Vector2(39, 26), + Size = new Vector2(36, 26), Action = Action, }; From 88376da2cfc3f8d129e3a87e454ddd4c0a960265 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 16 Jun 2022 13:47:30 +0900 Subject: [PATCH 1678/2328] Run template tests on CI --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 320197b88e..6281357648 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,7 +82,7 @@ jobs: run: dotnet build -c Debug -warnaserror osu.Desktop.slnf - name: Test - run: dotnet test $pwd/*.Tests/bin/Debug/*/*.Tests.dll --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx" + run: dotnet test $pwd/**/*.Tests/bin/Debug/*/*.Tests.dll --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx" shell: pwsh # Attempt to upload results even if test fails. From ac554ca51f80f9dc5cddf584793fa6980b8366c1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 15:06:34 +0900 Subject: [PATCH 1679/2328] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index eb5e209e29..8fcd7ef8c0 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a0bf43e06b..e9bf000109 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -37,7 +37,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 6f76bd654a..dd344b0cd0 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -62,7 +62,7 @@ - + From 89533fa33d32954a889ff0dcc307a16b2a4519bb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 15:40:17 +0900 Subject: [PATCH 1680/2328] Fix `Disclaimer` screen handling user change events after initial display Unnecessary overhead, but also should resolve a production hard crash. --- osu.Game/Screens/Menu/Disclaimer.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 24412cd85e..3482b171a3 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -171,6 +171,14 @@ namespace osu.Game.Screens.Menu ((IBindable)currentUser).BindTo(api.LocalUser); } + public override void OnSuspending(ScreenTransitionEvent e) + { + base.OnSuspending(e); + + // Once this screen has finished being displayed, we don't want to unnecessarily handle user change events. + currentUser.UnbindAll(); + } + public override void OnEntering(ScreenTransitionEvent e) { base.OnEntering(e); From ec53d87c307f286c725fd612b2d897100c2b86af Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 16:04:52 +0900 Subject: [PATCH 1681/2328] Fix unsafe sample playback in `GameplaySampleTriggerSource` Resolves https://github.com/ppy/osu/issues/18727. Added delay from `Schedule` should be minimal as it is always called from the `Update` thread (input propagation) anyway. --- osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs b/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs index c18698f77e..6b5cdc4ddf 100644 --- a/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs +++ b/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs @@ -56,12 +56,12 @@ namespace osu.Game.Rulesets.UI PlaySamples(samples); } - protected void PlaySamples(ISampleInfo[] samples) + protected void PlaySamples(ISampleInfo[] samples) => Schedule(() => { var hitSound = getNextSample(); hitSound.Samples = samples; hitSound.Play(); - } + }); protected HitObject GetMostValidObject() { From 739a69646798bfdcdbd8ab42554cd4c89744eb83 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 16:48:06 +0900 Subject: [PATCH 1682/2328] Ensure reading of existing databases when making backups doesn't create a file --- osu.Game/Database/DatabaseContextFactory.cs | 2 +- osu.Game/Database/RealmAccess.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/DatabaseContextFactory.cs b/osu.Game/Database/DatabaseContextFactory.cs index 45557aa5ec..d222aec6b3 100644 --- a/osu.Game/Database/DatabaseContextFactory.cs +++ b/osu.Game/Database/DatabaseContextFactory.cs @@ -151,7 +151,7 @@ namespace osu.Game.Database { Logger.Log($"Creating full EF database backup at {backupFilename}", LoggingTarget.Database); - using (var source = storage.GetStream(DATABASE_NAME)) + using (var source = storage.GetStream(DATABASE_NAME, mode: FileMode.Open)) using (var destination = storage.GetStream(backupFilename, FileAccess.Write, FileMode.CreateNew)) source.CopyTo(destination); } diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index de7e3020c6..bd47920f82 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -762,7 +762,7 @@ namespace osu.Game.Database { try { - using (var source = storage.GetStream(Filename)) + using (var source = storage.GetStream(Filename, mode: FileMode.Open)) using (var destination = storage.GetStream(backupFilename, FileAccess.Write, FileMode.CreateNew)) source.CopyTo(destination); return; From 17dbb599d145248a013cd639dd4efdf37fcee162 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 16:48:52 +0900 Subject: [PATCH 1683/2328] Don't backup collection database This is no longer required due to recent changes which mean the collection database will retain beatmap references even if they aren't loaded locally (see https://github.com/ppy/osu/pull/18619). --- osu.Game/OsuGameBase.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 5dbdf6f602..3f896ff52e 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -244,15 +244,6 @@ namespace osu.Game EFContextFactory.CreateBackup(Path.Combine(backup_folder, $"client.{migration}.db")); realm.CreateBackup(Path.Combine(backup_folder, $"client.{migration}.realm")); - - using (var source = Storage.GetStream("collection.db")) - { - if (source != null) - { - using (var destination = Storage.CreateFileSafely(Path.Combine(backup_folder, $"collection.{migration}.db"))) - source.CopyTo(destination); - } - } } dependencies.CacheAs(Storage); From 4526f8c07d79d380a39cda62204b30e15e4c75f1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 16:50:00 +0900 Subject: [PATCH 1684/2328] Move database backup creation to async thread where possible --- osu.Game/Database/EFToRealmMigrator.cs | 13 ++++++++++++- osu.Game/Database/RealmAccess.cs | 4 ++-- osu.Game/OsuGameBase.cs | 13 ------------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/osu.Game/Database/EFToRealmMigrator.cs b/osu.Game/Database/EFToRealmMigrator.cs index 4e98b7d3d2..d2f52fa635 100644 --- a/osu.Game/Database/EFToRealmMigrator.cs +++ b/osu.Game/Database/EFToRealmMigrator.cs @@ -123,8 +123,18 @@ namespace osu.Game.Database private void beginMigration() { + const string backup_folder = "backups"; + + string backupSuffix = $"before_final_migration_{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}"; + + // required for initial backup. + var realmBlockOperations = realm.BlockAllOperations(); + Task.Factory.StartNew(() => { + realm.CreateBackup(Path.Combine(backup_folder, $"client.{backupSuffix}.realm"), realmBlockOperations); + efContextFactory.CreateBackup(Path.Combine(backup_folder, $"client.{backupSuffix}.db")); + using (var ef = efContextFactory.Get()) { realm.Write(r => @@ -182,7 +192,6 @@ namespace osu.Game.Database true); const string attachment_filename = "attach_me.zip"; - const string backup_folder = "backups"; var backupStorage = storage.GetStorageForDirectory(backup_folder); @@ -209,6 +218,8 @@ namespace osu.Game.Database // If we were to not do this, the migration would run another time the next time the user starts the game. deletePreRealmData(); + realmBlockOperations.Dispose(); + migrationCompleted.SetResult(true); efContextFactory.SetMigrationCompletion(); }); diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index bd47920f82..b144b70574 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -750,9 +750,9 @@ namespace osu.Game.Database private string? getRulesetShortNameFromLegacyID(long rulesetId) => efContextFactory?.Get().RulesetInfo.FirstOrDefault(r => r.ID == rulesetId)?.ShortName; - public void CreateBackup(string backupFilename) + public void CreateBackup(string backupFilename, IDisposable? blockAllOperations = null) { - using (BlockAllOperations()) + using (blockAllOperations ?? BlockAllOperations()) { Logger.Log($"Creating full realm database backup at {backupFilename}", LoggingTarget.Database); diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 3f896ff52e..a4e6486c46 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -233,19 +233,6 @@ namespace osu.Game Decoder.RegisterDependencies(RulesetStore); - // Backup is taken here rather than in EFToRealmMigrator to avoid recycling realm contexts - // after initial usages below. It can be moved once a direction is established for handling re-subscription. - // See https://github.com/ppy/osu/pull/16547 for more discussion. - if (EFContextFactory != null) - { - const string backup_folder = "backups"; - - string migration = $"before_final_migration_{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}"; - - EFContextFactory.CreateBackup(Path.Combine(backup_folder, $"client.{migration}.db")); - realm.CreateBackup(Path.Combine(backup_folder, $"client.{migration}.realm")); - } - dependencies.CacheAs(Storage); var largeStore = new LargeTextureStore(Host.CreateTextureLoaderStore(new NamespacedResourceStore(Resources, @"Textures"))); From 6b30ee095041719fbeed4149e4e8f4c0325fc78b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 17:26:43 +0900 Subject: [PATCH 1685/2328] Tidy up DI and binding logic --- osu.Game/Overlays/NotificationOverlay.cs | 25 +++++++++--------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 1fe446454c..d50768f43e 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -36,15 +36,10 @@ namespace osu.Game.Overlays [Resolved] private AudioManager audio { get; set; } - [Resolved(canBeNull: true)] - [CanBeNull] - private FirstRunSetupOverlay firstRunSetup { get; set; } + private readonly IBindable firstRunSetupVisibility = new Bindable(); - [CanBeNull] - private IBindable firstRunSetupState; - - [BackgroundDependencyLoader] - private void load() + [BackgroundDependencyLoader(true)] + private void load([CanBeNull] FirstRunSetupOverlay firstRunSetup) { X = WIDTH; Width = WIDTH; @@ -83,13 +78,16 @@ namespace osu.Game.Overlays } } }; + + if (firstRunSetup != null) + firstRunSetupVisibility.BindTo(firstRunSetup.State); } private ScheduledDelegate notificationsEnabler; private void updateProcessingMode() { - bool enabled = (OverlayActivationMode.Value == OverlayActivation.All && firstRunSetupState?.Value != Visibility.Visible) || State.Value == Visibility.Visible; + bool enabled = (OverlayActivationMode.Value == OverlayActivation.All && firstRunSetupVisibility?.Value != Visibility.Visible) || State.Value == Visibility.Visible; notificationsEnabler?.Cancel(); @@ -104,13 +102,8 @@ namespace osu.Game.Overlays { base.LoadComplete(); - State.ValueChanged += _ => updateProcessingMode(); - - firstRunSetupState = firstRunSetup?.State.GetBoundCopy(); - - if (firstRunSetupState != null) - firstRunSetupState.ValueChanged += _ => updateProcessingMode(); - + State.BindValueChanged(_ => updateProcessingMode()); + firstRunSetupVisibility.BindValueChanged(_ => updateProcessingMode()); OverlayActivationMode.BindValueChanged(_ => updateProcessingMode(), true); } From 251923c1067ab2e5e43c1ea8b4a819dff2187b37 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 17:28:08 +0900 Subject: [PATCH 1686/2328] Convert `NotificationOverlay` to NRT --- osu.Game/Overlays/NotificationOverlay.cs | 27 ++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index d50768f43e..d83839fa2c 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -1,21 +1,22 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System.Linq; -using JetBrains.Annotations; -using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Overlays.Notifications; -using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics.Containers; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; +using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; using osu.Framework.Logging; using osu.Framework.Threading; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Overlays.Notifications; using osu.Game.Resources.Localisation.Web; using NotificationsStrings = osu.Game.Localisation.NotificationsStrings; @@ -31,15 +32,15 @@ namespace osu.Game.Overlays public const float TRANSITION_LENGTH = 600; - private FlowContainer sections; + private FlowContainer sections = null!; [Resolved] - private AudioManager audio { get; set; } + private AudioManager audio { get; set; } = null!; private readonly IBindable firstRunSetupVisibility = new Bindable(); - [BackgroundDependencyLoader(true)] - private void load([CanBeNull] FirstRunSetupOverlay firstRunSetup) + [BackgroundDependencyLoader] + private void load(FirstRunSetupOverlay? firstRunSetup) { X = WIDTH; Width = WIDTH; @@ -83,11 +84,11 @@ namespace osu.Game.Overlays firstRunSetupVisibility.BindTo(firstRunSetup.State); } - private ScheduledDelegate notificationsEnabler; + private ScheduledDelegate? notificationsEnabler; private void updateProcessingMode() { - bool enabled = (OverlayActivationMode.Value == OverlayActivation.All && firstRunSetupVisibility?.Value != Visibility.Visible) || State.Value == Visibility.Visible; + bool enabled = (OverlayActivationMode.Value == OverlayActivation.All && firstRunSetupVisibility.Value != Visibility.Visible) || State.Value == Visibility.Visible; notificationsEnabler?.Cancel(); From 4c372539a15fc1be0ff437dc3a007c9019282244 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 17:57:04 +0900 Subject: [PATCH 1687/2328] Consolidate remaining methods in `BeatmapModelManager` --- osu.Game/Beatmaps/BeatmapModelManager.cs | 30 +++++++----------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapModelManager.cs b/osu.Game/Beatmaps/BeatmapModelManager.cs index 055eb36850..11230caa7d 100644 --- a/osu.Game/Beatmaps/BeatmapModelManager.cs +++ b/osu.Game/Beatmaps/BeatmapModelManager.cs @@ -29,10 +29,6 @@ namespace osu.Game.Beatmaps /// public IWorkingBeatmapCache? WorkingBeatmapCache { private get; set; } - public override IEnumerable HandledExtensions => new[] { ".osz" }; - - protected override string[] HashableFileTypes => new[] { ".osu" }; - public static readonly string[] VIDEO_EXTENSIONS = { ".mp4", ".mov", ".avi", ".flv" }; public BeatmapModelManager(RealmAccess realm, Storage storage, BeatmapOnlineLookupQueue? onlineLookupQueue = null) @@ -71,7 +67,7 @@ namespace osu.Game.Beatmaps // AddFile generally handles updating/replacing files, but this is a case where the filename may have also changed so let's delete for simplicity. var existingFileInfo = setInfo.Files.SingleOrDefault(f => string.Equals(f.Filename, beatmapInfo.Path, StringComparison.OrdinalIgnoreCase)); - string targetFilename = getFilename(beatmapInfo); + string targetFilename = createBeatmapFilenameFromMetadata(beatmapInfo); // ensure that two difficulties from the set don't point at the same beatmap file. if (setInfo.Beatmaps.Any(b => b.ID != beatmapInfo.ID && string.Equals(b.Path, targetFilename, StringComparison.OrdinalIgnoreCase))) @@ -83,17 +79,18 @@ namespace osu.Game.Beatmaps beatmapInfo.MD5Hash = stream.ComputeMD5Hash(); beatmapInfo.Hash = stream.ComputeSHA2Hash(); - AddFile(setInfo, stream, getFilename(beatmapInfo)); - Update(setInfo); + AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo)); + + Realm.Write(r => setInfo.CopyChangesToRealm(r.Find(setInfo.ID))); } WorkingBeatmapCache?.Invalidate(beatmapInfo); - } - private static string getFilename(BeatmapInfo beatmapInfo) - { - var metadata = beatmapInfo.Metadata; - return $"{metadata.Artist} - {metadata.Title} ({metadata.Author.Username}) [{beatmapInfo.DifficultyName}].osu".GetValidArchiveContentFilename(); + static string createBeatmapFilenameFromMetadata(BeatmapInfo beatmapInfo) + { + var metadata = beatmapInfo.Metadata; + return $"{metadata.Artist} - {metadata.Title} ({metadata.Author.Username}) [{beatmapInfo.DifficultyName}].osu".GetValidArchiveContentFilename(); + } } /// @@ -106,15 +103,6 @@ namespace osu.Game.Beatmaps return Realm.Run(realm => realm.All().FirstOrDefault(query)?.Detach()); } - public void Update(BeatmapSetInfo item) - { - Realm.Write(r => - { - var existing = r.Find(item.ID); - item.CopyChangesToRealm(existing); - }); - } - /// /// Delete videos from a list of beatmaps. /// This will post notifications tracking progress. From 84dba36cf564e49cdf526588d111c2ed28975587 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 17:59:07 +0900 Subject: [PATCH 1688/2328] Update usages of `BeatmapModelManager` which only require importing to use `BeatmapImporter` --- .../Database/BeatmapImporterTests.cs | 52 +++++++++---------- osu.Game/Beatmaps/BeatmapImporter.cs | 4 +- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index a057f893f4..03e388c821 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -38,7 +38,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using (var importer = new BeatmapModelManager(realm, storage)) + using (var importer = new BeatmapImporter(realm, storage)) using (new RealmRulesetStore(realm, storage)) { Live? beatmapSet; @@ -82,7 +82,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using (var importer = new BeatmapModelManager(realm, storage)) + using (var importer = new BeatmapImporter(realm, storage)) using (new RealmRulesetStore(realm, storage)) { Live? beatmapSet; @@ -141,7 +141,7 @@ namespace osu.Game.Tests.Database { BeatmapSetInfo? detachedSet = null; - using (var importer = new BeatmapModelManager(realm, storage)) + using (var importer = new BeatmapImporter(realm, storage)) using (new RealmRulesetStore(realm, storage)) { Task.Run(async () => @@ -170,7 +170,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using (var importer = new BeatmapModelManager(realm, storage)) + using (var importer = new BeatmapImporter(realm, storage)) using (new RealmRulesetStore(realm, storage)) { Live? imported; @@ -202,7 +202,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); await LoadOszIntoStore(importer, realm.Realm); @@ -214,7 +214,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -232,7 +232,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -246,7 +246,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); string? tempPath = TestResources.GetTestBeatmapForImport(); @@ -276,7 +276,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -296,7 +296,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -345,7 +345,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -396,7 +396,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -444,7 +444,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -492,7 +492,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -527,7 +527,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); var progressNotification = new ImportProgressNotification(); @@ -565,7 +565,7 @@ namespace osu.Game.Tests.Database Interlocked.Increment(ref loggedExceptionCount); }; - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -617,7 +617,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm, batchImport: true); @@ -644,7 +644,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realmFactory, storage) => { - using var importer = new BeatmapModelManager(realmFactory, storage); + using var importer = new BeatmapImporter(realmFactory, storage); using var store = new RealmRulesetStore(realmFactory, storage); var imported = await LoadOszIntoStore(importer, realmFactory.Realm); @@ -676,7 +676,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -703,7 +703,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -729,7 +729,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealm((realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); var metadata = new BeatmapMetadata @@ -777,7 +777,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -794,7 +794,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -830,7 +830,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -872,7 +872,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -923,7 +923,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapModelManager(realm, storage); + using var importer = new BeatmapImporter(realm, storage); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); diff --git a/osu.Game/Beatmaps/BeatmapImporter.cs b/osu.Game/Beatmaps/BeatmapImporter.cs index a2ab70fed8..eded4cf9d1 100644 --- a/osu.Game/Beatmaps/BeatmapImporter.cs +++ b/osu.Game/Beatmaps/BeatmapImporter.cs @@ -32,7 +32,7 @@ namespace osu.Game.Beatmaps /// Handles the storage and retrieval of Beatmaps/WorkingBeatmaps. /// [ExcludeFromDynamicCompile] - public abstract class BeatmapImporter : RealmArchiveModelManager, IDisposable + public class BeatmapImporter : RealmArchiveModelManager, IDisposable { public override IEnumerable HandledExtensions => new[] { ".osz" }; @@ -40,7 +40,7 @@ namespace osu.Game.Beatmaps private readonly BeatmapOnlineLookupQueue? onlineLookupQueue; - protected BeatmapImporter(RealmAccess realm, Storage storage, BeatmapOnlineLookupQueue? onlineLookupQueue = null) + public BeatmapImporter(RealmAccess realm, Storage storage, BeatmapOnlineLookupQueue? onlineLookupQueue = null) : base(storage, realm) { this.onlineLookupQueue = onlineLookupQueue; From 8ea3042435ed60906f01037c1cc36bb312cd5f73 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 18:00:27 +0900 Subject: [PATCH 1689/2328] Move file extensions specification to common class --- osu.Game/Beatmaps/BeatmapModelManager.cs | 4 +--- osu.Game/Graphics/UserInterfaceV2/OsuFileSelector.cs | 3 +-- osu.Game/OsuGameBase.cs | 2 ++ 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapModelManager.cs b/osu.Game/Beatmaps/BeatmapModelManager.cs index 11230caa7d..768bed6d67 100644 --- a/osu.Game/Beatmaps/BeatmapModelManager.cs +++ b/osu.Game/Beatmaps/BeatmapModelManager.cs @@ -29,8 +29,6 @@ namespace osu.Game.Beatmaps /// public IWorkingBeatmapCache? WorkingBeatmapCache { private get; set; } - public static readonly string[] VIDEO_EXTENSIONS = { ".mp4", ".mov", ".avi", ".flv" }; - public BeatmapModelManager(RealmAccess realm, Storage storage, BeatmapOnlineLookupQueue? onlineLookupQueue = null) : base(realm, storage, onlineLookupQueue) { @@ -131,7 +129,7 @@ namespace osu.Game.Beatmaps // user requested abort return; - var video = b.Files.FirstOrDefault(f => VIDEO_EXTENSIONS.Any(ex => f.Filename.EndsWith(ex, StringComparison.Ordinal))); + var video = b.Files.FirstOrDefault(f => OsuGameBase.VIDEO_EXTENSIONS.Any(ex => f.Filename.EndsWith(ex, StringComparison.Ordinal))); if (video != null) { diff --git a/osu.Game/Graphics/UserInterfaceV2/OsuFileSelector.cs b/osu.Game/Graphics/UserInterfaceV2/OsuFileSelector.cs index d9dbf4974b..7c88e12dd3 100644 --- a/osu.Game/Graphics/UserInterfaceV2/OsuFileSelector.cs +++ b/osu.Game/Graphics/UserInterfaceV2/OsuFileSelector.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -67,7 +66,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 { get { - if (BeatmapModelManager.VIDEO_EXTENSIONS.Contains(File.Extension)) + if (OsuGameBase.VIDEO_EXTENSIONS.Contains(File.Extension)) return FontAwesome.Regular.FileVideo; switch (File.Extension) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 993ca5b5e8..5c8620fba4 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -57,6 +57,8 @@ namespace osu.Game /// public partial class OsuGameBase : Framework.Game, ICanAcceptFiles, IBeatSyncProvider { + public static readonly string[] VIDEO_EXTENSIONS = { ".mp4", ".mov", ".avi", ".flv" }; + public const string OSU_PROTOCOL = "osu://"; public const string CLIENT_STREAM_NAME = @"lazer"; From 1f3e1b2d974f5e4c2fd1383963b744408f99ed9c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 18:07:04 +0900 Subject: [PATCH 1690/2328] Combine `BeatmapManager` and `BeatmapModelManager` into one class --- ...eneOnlinePlayBeatmapAvailabilityTracker.cs | 8 +- osu.Game/Beatmaps/BeatmapManager.cs | 192 ++++++++++++++---- osu.Game/Beatmaps/BeatmapModelManager.cs | 149 -------------- .../Database/RealmArchiveModelImporter.cs | 2 +- osu.Game/Tests/Visual/EditorTestScene.cs | 4 +- 5 files changed, 154 insertions(+), 201 deletions(-) delete mode 100644 osu.Game/Beatmaps/BeatmapModelManager.cs diff --git a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs index 4f255ddd00..915ad50d2b 100644 --- a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs +++ b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs @@ -210,16 +210,16 @@ namespace osu.Game.Tests.Online { } - protected override BeatmapModelManager CreateBeatmapModelManager(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapOnlineLookupQueue onlineLookupQueue) + protected override BeatmapImporter CreateBeatmapImporter(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapOnlineLookupQueue onlineLookupQueue) { - return new TestBeatmapModelManager(this, storage, realm, onlineLookupQueue); + return new TestBeatmapImporter(this, storage, realm, onlineLookupQueue); } - internal class TestBeatmapModelManager : BeatmapModelManager + internal class TestBeatmapImporter : BeatmapImporter { private readonly TestBeatmapManager testBeatmapManager; - public TestBeatmapModelManager(TestBeatmapManager testBeatmapManager, Storage storage, RealmAccess databaseAccess, BeatmapOnlineLookupQueue beatmapOnlineLookupQueue) + public TestBeatmapImporter(TestBeatmapManager testBeatmapManager, Storage storage, RealmAccess databaseAccess, BeatmapOnlineLookupQueue beatmapOnlineLookupQueue) : base(databaseAccess, storage, beatmapOnlineLookupQueue) { this.testBeatmapManager = testBeatmapManager; diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 9397c2f3b2..63bd7dc710 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -1,19 +1,26 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable enable + using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Linq.Expressions; +using System.Text; using System.Threading; using System.Threading.Tasks; using osu.Framework.Audio; using osu.Framework.Audio.Track; +using osu.Framework.Extensions; using osu.Framework.IO.Stores; using osu.Framework.Platform; using osu.Framework.Testing; +using osu.Game.Beatmaps.Formats; using osu.Game.Database; +using osu.Game.Extensions; using osu.Game.IO.Archives; using osu.Game.Models; using osu.Game.Online.API; @@ -23,8 +30,6 @@ using osu.Game.Rulesets; using osu.Game.Skinning; using osu.Game.Utils; -#nullable enable - namespace osu.Game.Beatmaps { /// @@ -35,14 +40,15 @@ namespace osu.Game.Beatmaps { public ITrackStore BeatmapTrackStore { get; } - private readonly BeatmapModelManager beatmapModelManager; + private readonly BeatmapImporter beatmapImporter; private readonly WorkingBeatmapCache workingBeatmapCache; private readonly BeatmapOnlineLookupQueue? onlineBeatmapLookupQueue; private readonly RealmAccess realm; - public BeatmapManager(Storage storage, RealmAccess realm, RulesetStore rulesets, IAPIProvider? api, AudioManager audioManager, IResourceStore gameResources, GameHost? host = null, WorkingBeatmap? defaultBeatmap = null, bool performOnlineLookups = false) + public BeatmapManager(Storage storage, RealmAccess realm, RulesetStore rulesets, IAPIProvider? api, AudioManager audioManager, IResourceStore gameResources, GameHost? host = null, + WorkingBeatmap? defaultBeatmap = null, bool performOnlineLookups = false) { this.realm = realm; @@ -58,19 +64,18 @@ namespace osu.Game.Beatmaps BeatmapTrackStore = audioManager.GetTrackStore(userResources); - beatmapModelManager = CreateBeatmapModelManager(storage, realm, rulesets, onlineBeatmapLookupQueue); + beatmapImporter = CreateBeatmapImporter(storage, realm, rulesets, onlineBeatmapLookupQueue); workingBeatmapCache = CreateWorkingBeatmapCache(audioManager, gameResources, userResources, defaultBeatmap, host); - - beatmapModelManager.WorkingBeatmapCache = workingBeatmapCache; } - protected virtual WorkingBeatmapCache CreateWorkingBeatmapCache(AudioManager audioManager, IResourceStore resources, IResourceStore storage, WorkingBeatmap? defaultBeatmap, GameHost? host) + protected virtual WorkingBeatmapCache CreateWorkingBeatmapCache(AudioManager audioManager, IResourceStore resources, IResourceStore storage, WorkingBeatmap? defaultBeatmap, + GameHost? host) { return new WorkingBeatmapCache(BeatmapTrackStore, audioManager, resources, storage, defaultBeatmap, host); } - protected virtual BeatmapModelManager CreateBeatmapModelManager(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapOnlineLookupQueue? onlineLookupQueue) => - new BeatmapModelManager(realm, storage, onlineLookupQueue); + protected virtual BeatmapImporter CreateBeatmapImporter(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapOnlineLookupQueue? onlineLookupQueue) => + new BeatmapImporter(realm, storage, onlineLookupQueue); /// /// Create a new beatmap set, backed by a model, @@ -99,7 +104,7 @@ namespace osu.Game.Beatmaps foreach (BeatmapInfo b in beatmapSet.Beatmaps) b.BeatmapSet = beatmapSet; - var imported = beatmapModelManager.Import(beatmapSet); + var imported = beatmapImporter.Import(beatmapSet); if (imported == null) throw new InvalidOperationException("Failed to import new beatmap"); @@ -169,12 +174,12 @@ namespace osu.Game.Beatmaps private WorkingBeatmap addDifficultyToSet(BeatmapSetInfo targetBeatmapSet, IBeatmap newBeatmap, ISkin beatmapSkin) { // populate circular beatmap set info <-> beatmap info references manually. - // several places like `BeatmapModelManager.Save()` or `GetWorkingBeatmap()` + // several places like `BeatmapImporter.Save()` or `GetWorkingBeatmap()` // rely on them being freely traversable in both directions for correct operation. targetBeatmapSet.Beatmaps.Add(newBeatmap.BeatmapInfo); newBeatmap.BeatmapInfo.BeatmapSet = targetBeatmapSet; - beatmapModelManager.Save(newBeatmap.BeatmapInfo, newBeatmap, beatmapSkin); + Save(newBeatmap.BeatmapInfo, newBeatmap, beatmapSkin); workingBeatmapCache.Invalidate(targetBeatmapSet); return GetWorkingBeatmap(newBeatmap.BeatmapInfo); @@ -255,23 +260,14 @@ namespace osu.Game.Beatmaps return realm.Run(r => r.All().FirstOrDefault(query)?.ToLive(realm)); } - #region Delegation to BeatmapModelManager (methods which previously existed locally). + #region Delegation to BeatmapImporter (methods which previously existed locally). /// /// Perform a lookup query on available s. /// /// The query. /// The first result for the provided query, or null if no results were found. - public BeatmapInfo? QueryBeatmap(Expression> query) => beatmapModelManager.QueryBeatmap(query)?.Detach(); - - /// - /// Saves an file against a given . - /// - /// The to save the content against. The file referenced by will be replaced. - /// The content to write. - /// The beatmap content to write, null if to be omitted. - public virtual void Save(BeatmapInfo info, IBeatmap beatmapContent, ISkin? beatmapSkin = null) => - beatmapModelManager.Save(info, beatmapContent, beatmapSkin); + public BeatmapInfo? QueryBeatmap(Expression> query) => realm.Run(r => r.All().FirstOrDefault(query)?.Detach()); /// /// A default representation of a WorkingBeatmap to use when no beatmap is available. @@ -281,9 +277,10 @@ namespace osu.Game.Beatmaps /// /// Fired when a notification should be presented to the user. /// - public Action PostNotification + public Action? PostNotification { - set => beatmapModelManager.PostNotification = value; + get => beatmapImporter.PostNotification; + set => beatmapImporter.PostNotification = value; } #endregion @@ -292,17 +289,17 @@ namespace osu.Game.Beatmaps public bool IsAvailableLocally(BeatmapSetInfo model) { - return beatmapModelManager.IsAvailableLocally(model); + return beatmapImporter.IsAvailableLocally(model); } public bool Delete(BeatmapSetInfo item) { - return beatmapModelManager.Delete(item); + return beatmapImporter.Delete(item); } public void Delete(List items, bool silent = false) { - beatmapModelManager.Delete(items, silent); + beatmapImporter.Delete(items, silent); } public void Delete(Expression>? filter = null, bool silent = false) @@ -314,51 +311,156 @@ namespace osu.Game.Beatmaps if (filter != null) items = items.Where(filter); - beatmapModelManager.Delete(items.ToList(), silent); + beatmapImporter.Delete(items.ToList(), silent); }); } + /// + /// Saves an file against a given . + /// + /// The to save the content against. The file referenced by will be replaced. + /// The content to write. + /// The beatmap content to write, null if to be omitted. + public virtual void Save(BeatmapInfo beatmapInfo, IBeatmap beatmapContent, ISkin? beatmapSkin = null) + { + var setInfo = beatmapInfo.BeatmapSet; + Debug.Assert(setInfo != null); + + // Difficulty settings must be copied first due to the clone in `Beatmap<>.BeatmapInfo_Set`. + // This should hopefully be temporary, assuming said clone is eventually removed. + + // Warning: The directionality here is important. Changes have to be copied *from* beatmapContent (which comes from editor and is being saved) + // *to* the beatmapInfo (which is a database model and needs to receive values without the taiko slider velocity multiplier for correct operation). + // CopyTo() will undo such adjustments, while CopyFrom() will not. + beatmapContent.Difficulty.CopyTo(beatmapInfo.Difficulty); + + // All changes to metadata are made in the provided beatmapInfo, so this should be copied to the `IBeatmap` before encoding. + beatmapContent.BeatmapInfo = beatmapInfo; + + using (var stream = new MemoryStream()) + { + using (var sw = new StreamWriter(stream, Encoding.UTF8, 1024, true)) + new LegacyBeatmapEncoder(beatmapContent, beatmapSkin).Encode(sw); + + stream.Seek(0, SeekOrigin.Begin); + + // AddFile generally handles updating/replacing files, but this is a case where the filename may have also changed so let's delete for simplicity. + var existingFileInfo = setInfo.Files.SingleOrDefault(f => string.Equals(f.Filename, beatmapInfo.Path, StringComparison.OrdinalIgnoreCase)); + string targetFilename = createBeatmapFilenameFromMetadata(beatmapInfo); + + // ensure that two difficulties from the set don't point at the same beatmap file. + if (setInfo.Beatmaps.Any(b => b.ID != beatmapInfo.ID && string.Equals(b.Path, targetFilename, StringComparison.OrdinalIgnoreCase))) + throw new InvalidOperationException($"{setInfo.GetDisplayString()} already has a difficulty with the name of '{beatmapInfo.DifficultyName}'."); + + if (existingFileInfo != null) + DeleteFile(setInfo, existingFileInfo); + + beatmapInfo.MD5Hash = stream.ComputeMD5Hash(); + beatmapInfo.Hash = stream.ComputeSHA2Hash(); + + AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo)); + + realm.Write(r => setInfo.CopyChangesToRealm(r.Find(setInfo.ID))); + } + + workingBeatmapCache.Invalidate(beatmapInfo); + + static string createBeatmapFilenameFromMetadata(BeatmapInfo beatmapInfo) + { + var metadata = beatmapInfo.Metadata; + return $"{metadata.Artist} - {metadata.Title} ({metadata.Author.Username}) [{beatmapInfo.DifficultyName}].osu".GetValidArchiveContentFilename(); + } + } + public void DeleteAllVideos() { realm.Write(r => { var items = r.All().Where(s => !s.DeletePending && !s.Protected); - beatmapModelManager.DeleteVideos(items.ToList()); + DeleteVideos(items.ToList()); }); } + /// + /// Delete videos from a list of beatmaps. + /// This will post notifications tracking progress. + /// + public void DeleteVideos(List items, bool silent = false) + { + if (items.Count == 0) return; + + var notification = new ProgressNotification + { + Progress = 0, + Text = $"Preparing to delete all {beatmapImporter.HumanisedModelName} videos...", + CompletionText = "No videos found to delete!", + State = ProgressNotificationState.Active, + }; + + if (!silent) + PostNotification?.Invoke(notification); + + int i = 0; + int deleted = 0; + + foreach (var b in items) + { + if (notification.State == ProgressNotificationState.Cancelled) + // user requested abort + return; + + var video = b.Files.FirstOrDefault(f => OsuGameBase.VIDEO_EXTENSIONS.Any(ex => f.Filename.EndsWith(ex, StringComparison.Ordinal))); + + if (video != null) + { + DeleteFile(b, video); + deleted++; + notification.CompletionText = $"Deleted {deleted} {beatmapImporter.HumanisedModelName} video(s)!"; + } + + notification.Text = $"Deleting videos from {beatmapImporter.HumanisedModelName}s ({deleted} deleted)"; + + notification.Progress = (float)++i / items.Count; + } + + notification.State = ProgressNotificationState.Completed; + } + public void UndeleteAll() { - realm.Run(r => beatmapModelManager.Undelete(r.All().Where(s => s.DeletePending).ToList())); + realm.Run(r => beatmapImporter.Undelete(r.All().Where(s => s.DeletePending).ToList())); } public void Undelete(List items, bool silent = false) { - beatmapModelManager.Undelete(items, silent); + beatmapImporter.Undelete(items, silent); } public void Undelete(BeatmapSetInfo item) { - beatmapModelManager.Undelete(item); + beatmapImporter.Undelete(item); } #endregion #region Implementation of ICanAcceptFiles - public Task Import(params string[] paths) => beatmapModelManager.Import(paths); + public Task Import(params string[] paths) => beatmapImporter.Import(paths); - public Task Import(params ImportTask[] tasks) => beatmapModelManager.Import(tasks); + public Task Import(params ImportTask[] tasks) => beatmapImporter.Import(tasks); - public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => beatmapModelManager.Import(notification, tasks); + public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => beatmapImporter.Import(notification, tasks); - public Task?> Import(ImportTask task, bool batchImport = false, CancellationToken cancellationToken = default) => beatmapModelManager.Import(task, batchImport, cancellationToken); + public Task?> Import(ImportTask task, bool batchImport = false, CancellationToken cancellationToken = default) => + beatmapImporter.Import(task, batchImport, cancellationToken); - public Task?> Import(ArchiveReader archive, bool batchImport = false, CancellationToken cancellationToken = default) => beatmapModelManager.Import(archive, batchImport, cancellationToken); + public Task?> Import(ArchiveReader archive, bool batchImport = false, CancellationToken cancellationToken = default) => + beatmapImporter.Import(archive, batchImport, cancellationToken); - public Live? Import(BeatmapSetInfo item, ArchiveReader? archive = null, CancellationToken cancellationToken = default) => beatmapModelManager.Import(item, archive, false, cancellationToken); + public Live? Import(BeatmapSetInfo item, ArchiveReader? archive = null, CancellationToken cancellationToken = default) => + beatmapImporter.Import(item, archive, false, cancellationToken); - public IEnumerable HandledExtensions => beatmapModelManager.HandledExtensions; + public IEnumerable HandledExtensions => beatmapImporter.HandledExtensions; #endregion @@ -400,17 +502,17 @@ namespace osu.Game.Beatmaps public void ReplaceFile(BeatmapSetInfo model, RealmNamedFileUsage file, Stream contents) { - beatmapModelManager.ReplaceFile(model, file, contents); + beatmapImporter.ReplaceFile(model, file, contents); } public void DeleteFile(BeatmapSetInfo model, RealmNamedFileUsage file) { - beatmapModelManager.DeleteFile(model, file); + beatmapImporter.DeleteFile(model, file); } public void AddFile(BeatmapSetInfo model, Stream contents, string filename) { - beatmapModelManager.AddFile(model, contents, filename); + beatmapImporter.AddFile(model, contents, filename); } #endregion @@ -428,7 +530,7 @@ namespace osu.Game.Beatmaps public Action>>? PostImport { - set => beatmapModelManager.PostImport = value; + set => beatmapImporter.PostImport = value; } #endregion diff --git a/osu.Game/Beatmaps/BeatmapModelManager.cs b/osu.Game/Beatmaps/BeatmapModelManager.cs deleted file mode 100644 index 768bed6d67..0000000000 --- a/osu.Game/Beatmaps/BeatmapModelManager.cs +++ /dev/null @@ -1,149 +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 System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using osu.Framework.Extensions; -using osu.Framework.Platform; -using osu.Framework.Testing; -using osu.Game.Beatmaps.Formats; -using osu.Game.Database; -using osu.Game.Extensions; -using osu.Game.Skinning; -using osu.Game.Overlays.Notifications; - -#nullable enable - -namespace osu.Game.Beatmaps -{ - [ExcludeFromDynamicCompile] - public class BeatmapModelManager : BeatmapImporter - { - /// - /// The game working beatmap cache, used to invalidate entries on changes. - /// - public IWorkingBeatmapCache? WorkingBeatmapCache { private get; set; } - - public BeatmapModelManager(RealmAccess realm, Storage storage, BeatmapOnlineLookupQueue? onlineLookupQueue = null) - : base(realm, storage, onlineLookupQueue) - { - } - - /// - /// Saves an file against a given . - /// - /// The to save the content against. The file referenced by will be replaced. - /// The content to write. - /// The beatmap content to write, null if to be omitted. - public void Save(BeatmapInfo beatmapInfo, IBeatmap beatmapContent, ISkin? beatmapSkin = null) - { - var setInfo = beatmapInfo.BeatmapSet; - Debug.Assert(setInfo != null); - - // Difficulty settings must be copied first due to the clone in `Beatmap<>.BeatmapInfo_Set`. - // This should hopefully be temporary, assuming said clone is eventually removed. - - // Warning: The directionality here is important. Changes have to be copied *from* beatmapContent (which comes from editor and is being saved) - // *to* the beatmapInfo (which is a database model and needs to receive values without the taiko slider velocity multiplier for correct operation). - // CopyTo() will undo such adjustments, while CopyFrom() will not. - beatmapContent.Difficulty.CopyTo(beatmapInfo.Difficulty); - - // All changes to metadata are made in the provided beatmapInfo, so this should be copied to the `IBeatmap` before encoding. - beatmapContent.BeatmapInfo = beatmapInfo; - - using (var stream = new MemoryStream()) - { - using (var sw = new StreamWriter(stream, Encoding.UTF8, 1024, true)) - new LegacyBeatmapEncoder(beatmapContent, beatmapSkin).Encode(sw); - - stream.Seek(0, SeekOrigin.Begin); - - // AddFile generally handles updating/replacing files, but this is a case where the filename may have also changed so let's delete for simplicity. - var existingFileInfo = setInfo.Files.SingleOrDefault(f => string.Equals(f.Filename, beatmapInfo.Path, StringComparison.OrdinalIgnoreCase)); - string targetFilename = createBeatmapFilenameFromMetadata(beatmapInfo); - - // ensure that two difficulties from the set don't point at the same beatmap file. - if (setInfo.Beatmaps.Any(b => b.ID != beatmapInfo.ID && string.Equals(b.Path, targetFilename, StringComparison.OrdinalIgnoreCase))) - throw new InvalidOperationException($"{setInfo.GetDisplayString()} already has a difficulty with the name of '{beatmapInfo.DifficultyName}'."); - - if (existingFileInfo != null) - DeleteFile(setInfo, existingFileInfo); - - beatmapInfo.MD5Hash = stream.ComputeMD5Hash(); - beatmapInfo.Hash = stream.ComputeSHA2Hash(); - - AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo)); - - Realm.Write(r => setInfo.CopyChangesToRealm(r.Find(setInfo.ID))); - } - - WorkingBeatmapCache?.Invalidate(beatmapInfo); - - static string createBeatmapFilenameFromMetadata(BeatmapInfo beatmapInfo) - { - var metadata = beatmapInfo.Metadata; - return $"{metadata.Artist} - {metadata.Title} ({metadata.Author.Username}) [{beatmapInfo.DifficultyName}].osu".GetValidArchiveContentFilename(); - } - } - - /// - /// Perform a lookup query on available s. - /// - /// The query. - /// The first result for the provided query, or null if no results were found. - public BeatmapInfo? QueryBeatmap(Expression> query) - { - return Realm.Run(realm => realm.All().FirstOrDefault(query)?.Detach()); - } - - /// - /// Delete videos from a list of beatmaps. - /// This will post notifications tracking progress. - /// - public void DeleteVideos(List items, bool silent = false) - { - if (items.Count == 0) return; - - var notification = new ProgressNotification - { - Progress = 0, - Text = $"Preparing to delete all {HumanisedModelName} videos...", - CompletionText = "No videos found to delete!", - State = ProgressNotificationState.Active, - }; - - if (!silent) - PostNotification?.Invoke(notification); - - int i = 0; - int deleted = 0; - - foreach (var b in items) - { - if (notification.State == ProgressNotificationState.Cancelled) - // user requested abort - return; - - var video = b.Files.FirstOrDefault(f => OsuGameBase.VIDEO_EXTENSIONS.Any(ex => f.Filename.EndsWith(ex, StringComparison.Ordinal))); - - if (video != null) - { - DeleteFile(b, video); - deleted++; - notification.CompletionText = $"Deleted {deleted} {HumanisedModelName} video(s)!"; - } - - notification.Text = $"Deleting videos from {HumanisedModelName}s ({deleted} deleted)"; - - notification.Progress = (float)++i / items.Count; - } - - notification.State = ProgressNotificationState.Completed; - } - } -} diff --git a/osu.Game/Database/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs index 4153f421ef..32e71c5521 100644 --- a/osu.Game/Database/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -72,7 +72,7 @@ namespace osu.Game.Database /// /// Set an endpoint for notifications to be posted to. /// - public Action? PostNotification { protected get; set; } + public Action? PostNotification { get; set; } protected RealmArchiveModelImporter(Storage storage, RealmAccess realm) { diff --git a/osu.Game/Tests/Visual/EditorTestScene.cs b/osu.Game/Tests/Visual/EditorTestScene.cs index 8e9bb6ff78..fbb5209513 100644 --- a/osu.Game/Tests/Visual/EditorTestScene.cs +++ b/osu.Game/Tests/Visual/EditorTestScene.cs @@ -145,9 +145,9 @@ namespace osu.Game.Tests.Visual { } - protected override BeatmapModelManager CreateBeatmapModelManager(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapOnlineLookupQueue onlineLookupQueue) + protected override BeatmapImporter CreateBeatmapImporter(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapOnlineLookupQueue onlineLookupQueue) { - return new BeatmapModelManager(realm, storage, onlineLookupQueue); + return new BeatmapImporter(realm, storage, onlineLookupQueue); } protected override WorkingBeatmapCache CreateWorkingBeatmapCache(AudioManager audioManager, IResourceStore resources, IResourceStore storage, WorkingBeatmap defaultBeatmap, GameHost host) From 4d9e3d1982b836c7ff4eaf10d6a4b83bc0c1719f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 18:11:50 +0900 Subject: [PATCH 1691/2328] Rename Score/Skin `ModelManager` classes to `Importer` for now --- ...{ScoreModelManager.cs => ScoreImporter.cs} | 4 +- osu.Game/Scoring/ScoreManager.cs | 34 +++++++-------- .../{SkinModelManager.cs => SkinImporter.cs} | 4 +- osu.Game/Skinning/SkinManager.cs | 42 +++++++++---------- 4 files changed, 42 insertions(+), 42 deletions(-) rename osu.Game/Scoring/{ScoreModelManager.cs => ScoreImporter.cs} (93%) rename osu.Game/Skinning/{SkinModelManager.cs => SkinImporter.cs} (98%) diff --git a/osu.Game/Scoring/ScoreModelManager.cs b/osu.Game/Scoring/ScoreImporter.cs similarity index 93% rename from osu.Game/Scoring/ScoreModelManager.cs rename to osu.Game/Scoring/ScoreImporter.cs index c88955c5fd..76c43ba2e2 100644 --- a/osu.Game/Scoring/ScoreModelManager.cs +++ b/osu.Game/Scoring/ScoreImporter.cs @@ -19,7 +19,7 @@ using Realms; namespace osu.Game.Scoring { - public class ScoreModelManager : RealmArchiveModelManager + public class ScoreImporter : RealmArchiveModelManager { public override IEnumerable HandledExtensions => new[] { ".osr" }; @@ -28,7 +28,7 @@ namespace osu.Game.Scoring private readonly RulesetStore rulesets; private readonly Func beatmaps; - public ScoreModelManager(RulesetStore rulesets, Func beatmaps, Storage storage, RealmAccess realm) + public ScoreImporter(RulesetStore rulesets, Func beatmaps, Storage storage, RealmAccess realm) : base(storage, realm) { this.rulesets = rulesets; diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index e857d2109f..125746d5dd 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -28,7 +28,7 @@ namespace osu.Game.Scoring private readonly Scheduler scheduler; private readonly Func difficulties; private readonly OsuConfigManager configManager; - private readonly ScoreModelManager scoreModelManager; + private readonly ScoreImporter scoreImporter; public ScoreManager(RulesetStore rulesets, Func beatmaps, Storage storage, RealmAccess realm, Scheduler scheduler, Func difficulties = null, OsuConfigManager configManager = null) @@ -38,10 +38,10 @@ namespace osu.Game.Scoring this.difficulties = difficulties; this.configManager = configManager; - scoreModelManager = new ScoreModelManager(rulesets, beatmaps, storage, realm); + scoreImporter = new ScoreImporter(rulesets, beatmaps, storage, realm); } - public Score GetScore(ScoreInfo score) => scoreModelManager.GetScore(score); + public Score GetScore(ScoreInfo score) => scoreImporter.GetScore(score); /// /// Perform a lookup query on available s. @@ -231,7 +231,7 @@ namespace osu.Game.Scoring public Action PostNotification { - set => scoreModelManager.PostNotification = value; + set => scoreImporter.PostNotification = value; } #endregion @@ -240,7 +240,7 @@ namespace osu.Game.Scoring public bool Delete(ScoreInfo item) { - return scoreModelManager.Delete(item); + return scoreImporter.Delete(item); } public void Delete([CanBeNull] Expression> filter = null, bool silent = false) @@ -253,7 +253,7 @@ namespace osu.Game.Scoring if (filter != null) items = items.Where(filter); - scoreModelManager.Delete(items.ToList(), silent); + scoreImporter.Delete(items.ToList(), silent); }); } @@ -262,27 +262,27 @@ namespace osu.Game.Scoring realm.Run(r => { var beatmapScores = r.Find(beatmap.ID).Scores.ToList(); - scoreModelManager.Delete(beatmapScores, silent); + scoreImporter.Delete(beatmapScores, silent); }); } - public void Delete(List items, bool silent = false) => scoreModelManager.Delete(items, silent); + public void Delete(List items, bool silent = false) => scoreImporter.Delete(items, silent); - public void Undelete(List items, bool silent = false) => scoreModelManager.Undelete(items, silent); + public void Undelete(List items, bool silent = false) => scoreImporter.Undelete(items, silent); - public void Undelete(ScoreInfo item) => scoreModelManager.Undelete(item); + public void Undelete(ScoreInfo item) => scoreImporter.Undelete(item); - public Task Import(params string[] paths) => scoreModelManager.Import(paths); + public Task Import(params string[] paths) => scoreImporter.Import(paths); - public Task Import(params ImportTask[] tasks) => scoreModelManager.Import(tasks); + public Task Import(params ImportTask[] tasks) => scoreImporter.Import(tasks); - public IEnumerable HandledExtensions => scoreModelManager.HandledExtensions; + public IEnumerable HandledExtensions => scoreImporter.HandledExtensions; - public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => scoreModelManager.Import(notification, tasks); + public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => scoreImporter.Import(notification, tasks); - public Live Import(ScoreInfo item, ArchiveReader archive = null, bool batchImport = false, CancellationToken cancellationToken = default) => scoreModelManager.Import(item, archive, batchImport, cancellationToken); + public Live Import(ScoreInfo item, ArchiveReader archive = null, bool batchImport = false, CancellationToken cancellationToken = default) => scoreImporter.Import(item, archive, batchImport, cancellationToken); - public bool IsAvailableLocally(ScoreInfo model) => scoreModelManager.IsAvailableLocally(model); + public bool IsAvailableLocally(ScoreInfo model) => scoreImporter.IsAvailableLocally(model); #endregion @@ -290,7 +290,7 @@ namespace osu.Game.Scoring public Action>> PostImport { - set => scoreModelManager.PostImport = value; + set => scoreImporter.PostImport = value; } #endregion diff --git a/osu.Game/Skinning/SkinModelManager.cs b/osu.Game/Skinning/SkinImporter.cs similarity index 98% rename from osu.Game/Skinning/SkinModelManager.cs rename to osu.Game/Skinning/SkinImporter.cs index ca90f41080..67626a45a8 100644 --- a/osu.Game/Skinning/SkinModelManager.cs +++ b/osu.Game/Skinning/SkinImporter.cs @@ -20,13 +20,13 @@ using Realms; namespace osu.Game.Skinning { - public class SkinModelManager : RealmArchiveModelManager + public class SkinImporter : RealmArchiveModelManager { private const string skin_info_file = "skininfo.json"; private readonly IStorageResourceProvider skinResources; - public SkinModelManager(Storage storage, RealmAccess realm, IStorageResourceProvider skinResources) + public SkinImporter(Storage storage, RealmAccess realm, IStorageResourceProvider skinResources) : base(storage, realm) { this.skinResources = skinResources; diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index f296386d34..f244657ea3 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -55,7 +55,7 @@ namespace osu.Game.Skinning Default = Skinning.DefaultSkin.CreateInfo().ToLiveUnmanaged() }; - private readonly SkinModelManager skinModelManager; + private readonly SkinImporter skinImporter; private readonly RealmAccess realm; private readonly IResourceStore userFiles; @@ -80,7 +80,7 @@ namespace osu.Game.Skinning userFiles = new StorageBackedResourceStore(storage.GetStorageForDirectory("files")); - skinModelManager = new SkinModelManager(storage, realm, this); + skinImporter = new SkinImporter(storage, realm, this); var defaultSkins = new[] { @@ -166,7 +166,7 @@ namespace osu.Game.Skinning Name = NamingUtils.GetNextBestName(existingSkinNames, $@"{s.Name} (modified)") }; - var result = skinModelManager.Import(skinInfo); + var result = skinImporter.Import(skinInfo); if (result != null) { @@ -186,7 +186,7 @@ namespace osu.Game.Skinning if (!skin.SkinInfo.IsManaged) throw new InvalidOperationException($"Attempting to save a skin which is not yet tracked. Call {nameof(EnsureMutableSkin)} first."); - skinModelManager.Save(skin); + skinImporter.Save(skin); } /// @@ -260,26 +260,26 @@ namespace osu.Game.Skinning public Action PostNotification { - set => skinModelManager.PostNotification = value; + set => skinImporter.PostNotification = value; } public Action>> PostImport { - set => skinModelManager.PostImport = value; + set => skinImporter.PostImport = value; } - public Task Import(params string[] paths) => skinModelManager.Import(paths); + public Task Import(params string[] paths) => skinImporter.Import(paths); - public Task Import(params ImportTask[] tasks) => skinModelManager.Import(tasks); + public Task Import(params ImportTask[] tasks) => skinImporter.Import(tasks); - public IEnumerable HandledExtensions => skinModelManager.HandledExtensions; + public IEnumerable HandledExtensions => skinImporter.HandledExtensions; - public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => skinModelManager.Import(notification, tasks); + public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => skinImporter.Import(notification, tasks); - public Task> Import(ImportTask task, bool batchImport = false, CancellationToken cancellationToken = default) => skinModelManager.Import(task, batchImport, cancellationToken); + public Task> Import(ImportTask task, bool batchImport = false, CancellationToken cancellationToken = default) => skinImporter.Import(task, batchImport, cancellationToken); public Task> Import(ArchiveReader archive, bool batchImport = false, CancellationToken cancellationToken = default) => - skinModelManager.Import(archive, batchImport, cancellationToken); + skinImporter.Import(archive, batchImport, cancellationToken); #endregion @@ -300,25 +300,25 @@ namespace osu.Game.Skinning if (items.Any(s => s.ID == currentUserSkin)) scheduler.Add(() => CurrentSkinInfo.Value = Skinning.DefaultSkin.CreateInfo().ToLiveUnmanaged()); - skinModelManager.Delete(items.ToList(), silent); + skinImporter.Delete(items.ToList(), silent); }); } - public bool Delete(SkinInfo item) => skinModelManager.Delete(item); + public bool Delete(SkinInfo item) => skinImporter.Delete(item); - public void Delete(List items, bool silent = false) => skinModelManager.Delete(items, silent); + public void Delete(List items, bool silent = false) => skinImporter.Delete(items, silent); - public void Undelete(List items, bool silent = false) => skinModelManager.Undelete(items, silent); + public void Undelete(List items, bool silent = false) => skinImporter.Undelete(items, silent); - public void Undelete(SkinInfo item) => skinModelManager.Undelete(item); + public void Undelete(SkinInfo item) => skinImporter.Undelete(item); - public bool IsAvailableLocally(SkinInfo model) => skinModelManager.IsAvailableLocally(model); + public bool IsAvailableLocally(SkinInfo model) => skinImporter.IsAvailableLocally(model); - public void ReplaceFile(SkinInfo model, RealmNamedFileUsage file, Stream contents) => skinModelManager.ReplaceFile(model, file, contents); + public void ReplaceFile(SkinInfo model, RealmNamedFileUsage file, Stream contents) => skinImporter.ReplaceFile(model, file, contents); - public void DeleteFile(SkinInfo model, RealmNamedFileUsage file) => skinModelManager.DeleteFile(model, file); + public void DeleteFile(SkinInfo model, RealmNamedFileUsage file) => skinImporter.DeleteFile(model, file); - public void AddFile(SkinInfo model, Stream contents, string filename) => skinModelManager.AddFile(model, contents, filename); + public void AddFile(SkinInfo model, Stream contents, string filename) => skinImporter.AddFile(model, contents, filename); #endregion } From 04e4c5ef8867a043ce722e8067fa27d6fc629d80 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 18:26:13 +0900 Subject: [PATCH 1692/2328] Move and adjust implementation regions to restore sanity --- osu.Game/Beatmaps/BeatmapManager.cs | 65 ++++++++++------------------- 1 file changed, 23 insertions(+), 42 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 63bd7dc710..a4ac161223 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -260,8 +260,6 @@ namespace osu.Game.Beatmaps return realm.Run(r => r.All().FirstOrDefault(query)?.ToLive(realm)); } - #region Delegation to BeatmapImporter (methods which previously existed locally). - /// /// Perform a lookup query on available s. /// @@ -283,38 +281,6 @@ namespace osu.Game.Beatmaps set => beatmapImporter.PostNotification = value; } - #endregion - - #region Implementation of IModelManager - - public bool IsAvailableLocally(BeatmapSetInfo model) - { - return beatmapImporter.IsAvailableLocally(model); - } - - public bool Delete(BeatmapSetInfo item) - { - return beatmapImporter.Delete(item); - } - - public void Delete(List items, bool silent = false) - { - beatmapImporter.Delete(items, silent); - } - - public void Delete(Expression>? filter = null, bool silent = false) - { - realm.Run(r => - { - var items = r.All().Where(s => !s.DeletePending && !s.Protected); - - if (filter != null) - items = items.Where(filter); - - beatmapImporter.Delete(items.ToList(), silent); - }); - } - /// /// Saves an file against a given . /// @@ -381,6 +347,19 @@ namespace osu.Game.Beatmaps }); } + public void Delete(Expression>? filter = null, bool silent = false) + { + realm.Run(r => + { + var items = r.All().Where(s => !s.DeletePending && !s.Protected); + + if (filter != null) + items = items.Where(filter); + + beatmapImporter.Delete(items.ToList(), silent); + }); + } + /// /// Delete videos from a list of beatmaps. /// This will post notifications tracking progress. @@ -431,15 +410,17 @@ namespace osu.Game.Beatmaps realm.Run(r => beatmapImporter.Undelete(r.All().Where(s => s.DeletePending).ToList())); } - public void Undelete(List items, bool silent = false) - { - beatmapImporter.Undelete(items, silent); - } + #region Implementation of IModelManager - public void Undelete(BeatmapSetInfo item) - { - beatmapImporter.Undelete(item); - } + public bool IsAvailableLocally(BeatmapSetInfo model) => beatmapImporter.IsAvailableLocally(model); + + public bool Delete(BeatmapSetInfo item) => beatmapImporter.Delete(item); + + public void Delete(List items, bool silent = false) => beatmapImporter.Delete(items, silent); + + public void Undelete(List items, bool silent = false) => beatmapImporter.Undelete(items, silent); + + public void Undelete(BeatmapSetInfo item) => beatmapImporter.Undelete(item); #endregion From 8a5755ca527965acbf913611ddb464992d204f88 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 18:27:16 +0900 Subject: [PATCH 1693/2328] Remove pointless override in test implementation --- osu.Game/Tests/Visual/EditorTestScene.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Game/Tests/Visual/EditorTestScene.cs b/osu.Game/Tests/Visual/EditorTestScene.cs index fbb5209513..d4a624f26a 100644 --- a/osu.Game/Tests/Visual/EditorTestScene.cs +++ b/osu.Game/Tests/Visual/EditorTestScene.cs @@ -145,11 +145,6 @@ namespace osu.Game.Tests.Visual { } - protected override BeatmapImporter CreateBeatmapImporter(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapOnlineLookupQueue onlineLookupQueue) - { - return new BeatmapImporter(realm, storage, onlineLookupQueue); - } - protected override WorkingBeatmapCache CreateWorkingBeatmapCache(AudioManager audioManager, IResourceStore resources, IResourceStore storage, WorkingBeatmap defaultBeatmap, GameHost host) { return new TestWorkingBeatmapCache(this, audioManager, resources, storage, defaultBeatmap, host); From f3984d98e654fdf93d011d795672270b9f7692b0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 18:53:13 +0900 Subject: [PATCH 1694/2328] Remove `RealmArchiveModelManager` from hierarchy --- .../Database/BeatmapImporterTests.cs | 56 ++++++++++--------- ...eneOnlinePlayBeatmapAvailabilityTracker.cs | 2 +- osu.Game/Beatmaps/BeatmapImporter.cs | 9 +-- osu.Game/Beatmaps/BeatmapManager.cs | 51 ++--------------- osu.Game/Database/ImportTask.cs | 2 +- osu.Game/Database/RealmArchiveModelManager.cs | 22 ++++---- osu.Game/Scoring/ScoreImporter.cs | 7 +-- osu.Game/Scoring/ScoreManager.cs | 33 ++--------- osu.Game/Skinning/SkinImporter.cs | 20 ++++--- osu.Game/Skinning/SkinManager.cs | 32 +---------- 10 files changed, 69 insertions(+), 165 deletions(-) diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index 03e388c821..53d13f0d4e 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -38,7 +38,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using (var importer = new BeatmapImporter(realm, storage)) + using (var importer = new BeatmapImporter(storage, realm)) using (new RealmRulesetStore(realm, storage)) { Live? beatmapSet; @@ -82,7 +82,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using (var importer = new BeatmapImporter(realm, storage)) + using (var importer = new BeatmapImporter(storage, realm)) using (new RealmRulesetStore(realm, storage)) { Live? beatmapSet; @@ -141,7 +141,9 @@ namespace osu.Game.Tests.Database { BeatmapSetInfo? detachedSet = null; - using (var importer = new BeatmapImporter(realm, storage)) + var manager = new ModelManager(storage, realm); + + using (var importer = new BeatmapImporter(storage, realm)) using (new RealmRulesetStore(realm, storage)) { Task.Run(async () => @@ -160,7 +162,7 @@ namespace osu.Game.Tests.Database }).WaitSafely(); Debug.Assert(detachedSet != null); - importer.AddFile(detachedSet, new MemoryStream(), "test"); + manager.AddFile(detachedSet, new MemoryStream(), "test"); } }); } @@ -170,7 +172,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using (var importer = new BeatmapImporter(realm, storage)) + using (var importer = new BeatmapImporter(storage, realm)) using (new RealmRulesetStore(realm, storage)) { Live? imported; @@ -202,7 +204,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); await LoadOszIntoStore(importer, realm.Realm); @@ -214,7 +216,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -232,7 +234,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -246,7 +248,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? tempPath = TestResources.GetTestBeatmapForImport(); @@ -276,7 +278,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -296,7 +298,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -345,7 +347,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -396,7 +398,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -444,7 +446,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -492,7 +494,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -527,7 +529,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var progressNotification = new ImportProgressNotification(); @@ -565,7 +567,7 @@ namespace osu.Game.Tests.Database Interlocked.Increment(ref loggedExceptionCount); }; - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -617,7 +619,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm, batchImport: true); @@ -644,7 +646,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realmFactory, storage) => { - using var importer = new BeatmapImporter(realmFactory, storage); + using var importer = new BeatmapImporter(storage, realmFactory); using var store = new RealmRulesetStore(realmFactory, storage); var imported = await LoadOszIntoStore(importer, realmFactory.Realm); @@ -676,7 +678,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -703,7 +705,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -729,7 +731,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealm((realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var metadata = new BeatmapMetadata @@ -777,7 +779,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -794,7 +796,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -830,7 +832,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -872,7 +874,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -923,7 +925,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(realm, storage); + using var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); diff --git a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs index 915ad50d2b..c26d7937ad 100644 --- a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs +++ b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs @@ -220,7 +220,7 @@ namespace osu.Game.Tests.Online private readonly TestBeatmapManager testBeatmapManager; public TestBeatmapImporter(TestBeatmapManager testBeatmapManager, Storage storage, RealmAccess databaseAccess, BeatmapOnlineLookupQueue beatmapOnlineLookupQueue) - : base(databaseAccess, storage, beatmapOnlineLookupQueue) + : base(storage, databaseAccess, beatmapOnlineLookupQueue) { this.testBeatmapManager = testBeatmapManager; } diff --git a/osu.Game/Beatmaps/BeatmapImporter.cs b/osu.Game/Beatmaps/BeatmapImporter.cs index eded4cf9d1..5e3aa434b8 100644 --- a/osu.Game/Beatmaps/BeatmapImporter.cs +++ b/osu.Game/Beatmaps/BeatmapImporter.cs @@ -32,7 +32,7 @@ namespace osu.Game.Beatmaps /// Handles the storage and retrieval of Beatmaps/WorkingBeatmaps. /// [ExcludeFromDynamicCompile] - public class BeatmapImporter : RealmArchiveModelManager, IDisposable + public class BeatmapImporter : RealmArchiveModelImporter, IDisposable { public override IEnumerable HandledExtensions => new[] { ".osz" }; @@ -40,7 +40,7 @@ namespace osu.Game.Beatmaps private readonly BeatmapOnlineLookupQueue? onlineLookupQueue; - public BeatmapImporter(RealmAccess realm, Storage storage, BeatmapOnlineLookupQueue? onlineLookupQueue = null) + public BeatmapImporter(Storage storage, RealmAccess realm, BeatmapOnlineLookupQueue? onlineLookupQueue = null) : base(storage, realm) { this.onlineLookupQueue = onlineLookupQueue; @@ -165,11 +165,6 @@ namespace osu.Game.Beatmaps existing.DateAdded = DateTimeOffset.UtcNow; } - public override bool IsAvailableLocally(BeatmapSetInfo model) - { - return Realm.Run(realm => realm.All().Any(s => s.OnlineID == model.OnlineID)); - } - public override string HumanisedModelName => "beatmap"; protected override BeatmapSetInfo? CreateModel(ArchiveReader reader) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index a4ac161223..662931cd17 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -36,7 +36,7 @@ namespace osu.Game.Beatmaps /// Handles general operations related to global beatmap management. /// [ExcludeFromDynamicCompile] - public class BeatmapManager : IModelManager, IModelFileManager, IModelImporter, IWorkingBeatmapCache, IDisposable + public class BeatmapManager : ModelManager, IModelImporter, IWorkingBeatmapCache, IDisposable { public ITrackStore BeatmapTrackStore { get; } @@ -49,6 +49,7 @@ namespace osu.Game.Beatmaps public BeatmapManager(Storage storage, RealmAccess realm, RulesetStore rulesets, IAPIProvider? api, AudioManager audioManager, IResourceStore gameResources, GameHost? host = null, WorkingBeatmap? defaultBeatmap = null, bool performOnlineLookups = false) + : base(storage, realm) { this.realm = realm; @@ -75,7 +76,7 @@ namespace osu.Game.Beatmaps } protected virtual BeatmapImporter CreateBeatmapImporter(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapOnlineLookupQueue? onlineLookupQueue) => - new BeatmapImporter(realm, storage, onlineLookupQueue); + new BeatmapImporter(storage, realm, onlineLookupQueue); /// /// Create a new beatmap set, backed by a model, @@ -272,15 +273,6 @@ namespace osu.Game.Beatmaps /// public IWorkingBeatmap DefaultBeatmap => workingBeatmapCache.DefaultBeatmap; - /// - /// Fired when a notification should be presented to the user. - /// - public Action? PostNotification - { - get => beatmapImporter.PostNotification; - set => beatmapImporter.PostNotification = value; - } - /// /// Saves an file against a given . /// @@ -356,7 +348,7 @@ namespace osu.Game.Beatmaps if (filter != null) items = items.Where(filter); - beatmapImporter.Delete(items.ToList(), silent); + Delete(items.ToList(), silent); }); } @@ -407,23 +399,9 @@ namespace osu.Game.Beatmaps public void UndeleteAll() { - realm.Run(r => beatmapImporter.Undelete(r.All().Where(s => s.DeletePending).ToList())); + realm.Run(r => Undelete(r.All().Where(s => s.DeletePending).ToList())); } - #region Implementation of IModelManager - - public bool IsAvailableLocally(BeatmapSetInfo model) => beatmapImporter.IsAvailableLocally(model); - - public bool Delete(BeatmapSetInfo item) => beatmapImporter.Delete(item); - - public void Delete(List items, bool silent = false) => beatmapImporter.Delete(items, silent); - - public void Undelete(List items, bool silent = false) => beatmapImporter.Undelete(items, silent); - - public void Undelete(BeatmapSetInfo item) => beatmapImporter.Undelete(item); - - #endregion - #region Implementation of ICanAcceptFiles public Task Import(params string[] paths) => beatmapImporter.Import(paths); @@ -479,25 +457,6 @@ namespace osu.Game.Beatmaps #endregion - #region Implementation of IModelFileManager - - public void ReplaceFile(BeatmapSetInfo model, RealmNamedFileUsage file, Stream contents) - { - beatmapImporter.ReplaceFile(model, file, contents); - } - - public void DeleteFile(BeatmapSetInfo model, RealmNamedFileUsage file) - { - beatmapImporter.DeleteFile(model, file); - } - - public void AddFile(BeatmapSetInfo model, Stream contents, string filename) - { - beatmapImporter.AddFile(model, contents, filename); - } - - #endregion - #region Implementation of IDisposable public void Dispose() diff --git a/osu.Game/Database/ImportTask.cs b/osu.Game/Database/ImportTask.cs index 41ce0339a1..e34b4c76a9 100644 --- a/osu.Game/Database/ImportTask.cs +++ b/osu.Game/Database/ImportTask.cs @@ -12,7 +12,7 @@ using SharpCompress.Common; namespace osu.Game.Database { /// - /// An encapsulated import task to be imported to an . + /// An encapsulated import task to be imported to an . /// public class ImportTask { diff --git a/osu.Game/Database/RealmArchiveModelManager.cs b/osu.Game/Database/RealmArchiveModelManager.cs index 371b9be575..5056b0d49f 100644 --- a/osu.Game/Database/RealmArchiveModelManager.cs +++ b/osu.Game/Database/RealmArchiveModelManager.cs @@ -15,18 +15,17 @@ using Realms; namespace osu.Game.Database { - /// - /// Class which adds all the missing pieces bridging the gap between and (legacy) ArchiveModelManager. - /// - public abstract class RealmArchiveModelManager : RealmArchiveModelImporter, IModelManager, IModelFileManager + public class ModelManager : IModelManager, IModelFileManager where TModel : RealmObject, IHasRealmFiles, IHasGuidPrimaryKey, ISoftDelete { + protected RealmAccess Realm; + private readonly RealmFileStore realmFileStore; - protected RealmArchiveModelManager(Storage storage, RealmAccess realm) - : base(storage, realm) + public ModelManager(Storage storage, RealmAccess realm) { realmFileStore = new RealmFileStore(realm, storage); + Realm = realm; } public void DeleteFile(TModel item, RealmNamedFileUsage file) => @@ -62,7 +61,7 @@ namespace osu.Game.Database /// /// Delete a file from within an ongoing realm transaction. /// - protected void DeleteFile(TModel item, RealmNamedFileUsage file, Realm realm) + public void DeleteFile(TModel item, RealmNamedFileUsage file, Realm realm) { item.Files.Remove(file); } @@ -70,7 +69,7 @@ namespace osu.Game.Database /// /// Replace a file from within an ongoing realm transaction. /// - protected void ReplaceFile(RealmNamedFileUsage file, Stream contents, Realm realm) + public void ReplaceFile(RealmNamedFileUsage file, Stream contents, Realm realm) { file.File = realmFileStore.Add(contents, realm); } @@ -78,7 +77,7 @@ namespace osu.Game.Database /// /// Add a file from within an ongoing realm transaction. If the file already exists, it is overwritten. /// - protected void AddFile(TModel item, Stream contents, string filename, Realm realm) + public void AddFile(TModel item, Stream contents, string filename, Realm realm) { var existing = item.Files.FirstOrDefault(f => string.Equals(f.Filename, filename, StringComparison.OrdinalIgnoreCase)); @@ -200,6 +199,9 @@ namespace osu.Game.Database }); } - public abstract bool IsAvailableLocally(TModel model); + // TODO: implement + public virtual bool IsAvailableLocally(TModel model) => true; + public Action? PostNotification { get; set; } + public string HumanisedModelName { get; set; } = "wang"; } } diff --git a/osu.Game/Scoring/ScoreImporter.cs b/osu.Game/Scoring/ScoreImporter.cs index 76c43ba2e2..7d1aa4b01d 100644 --- a/osu.Game/Scoring/ScoreImporter.cs +++ b/osu.Game/Scoring/ScoreImporter.cs @@ -19,7 +19,7 @@ using Realms; namespace osu.Game.Scoring { - public class ScoreImporter : RealmArchiveModelManager + public class ScoreImporter : RealmArchiveModelImporter { public override IEnumerable HandledExtensions => new[] { ".osr" }; @@ -70,10 +70,5 @@ namespace osu.Game.Scoring if (string.IsNullOrEmpty(model.StatisticsJson)) model.StatisticsJson = JsonConvert.SerializeObject(model.Statistics); } - - public override bool IsAvailableLocally(ScoreInfo model) - { - return Realm.Run(realm => realm.All().Any(s => s.OnlineID == model.OnlineID)); - } } } diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 125746d5dd..da77b0bc6c 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -22,7 +22,7 @@ using osu.Game.Rulesets.Scoring; namespace osu.Game.Scoring { - public class ScoreManager : IModelManager, IModelImporter + public class ScoreManager : ModelManager, IModelImporter { private readonly RealmAccess realm; private readonly Scheduler scheduler; @@ -32,6 +32,7 @@ namespace osu.Game.Scoring public ScoreManager(RulesetStore rulesets, Func beatmaps, Storage storage, RealmAccess realm, Scheduler scheduler, Func difficulties = null, OsuConfigManager configManager = null) + : base(storage, realm) { this.realm = realm; this.scheduler = scheduler; @@ -227,22 +228,6 @@ namespace osu.Game.Scoring } } - #region Implementation of IPostNotifications - - public Action PostNotification - { - set => scoreImporter.PostNotification = value; - } - - #endregion - - #region Implementation of IModelManager - - public bool Delete(ScoreInfo item) - { - return scoreImporter.Delete(item); - } - public void Delete([CanBeNull] Expression> filter = null, bool silent = false) { realm.Run(r => @@ -253,7 +238,7 @@ namespace osu.Game.Scoring if (filter != null) items = items.Where(filter); - scoreImporter.Delete(items.ToList(), silent); + Delete(items.ToList(), silent); }); } @@ -262,16 +247,10 @@ namespace osu.Game.Scoring realm.Run(r => { var beatmapScores = r.Find(beatmap.ID).Scores.ToList(); - scoreImporter.Delete(beatmapScores, silent); + Delete(beatmapScores, silent); }); } - public void Delete(List items, bool silent = false) => scoreImporter.Delete(items, silent); - - public void Undelete(List items, bool silent = false) => scoreImporter.Undelete(items, silent); - - public void Undelete(ScoreInfo item) => scoreImporter.Undelete(item); - public Task Import(params string[] paths) => scoreImporter.Import(paths); public Task Import(params ImportTask[] tasks) => scoreImporter.Import(tasks); @@ -282,10 +261,6 @@ namespace osu.Game.Scoring public Live Import(ScoreInfo item, ArchiveReader archive = null, bool batchImport = false, CancellationToken cancellationToken = default) => scoreImporter.Import(item, archive, batchImport, cancellationToken); - public bool IsAvailableLocally(ScoreInfo model) => scoreImporter.IsAvailableLocally(model); - - #endregion - #region Implementation of IPresentImports public Action>> PostImport diff --git a/osu.Game/Skinning/SkinImporter.cs b/osu.Game/Skinning/SkinImporter.cs index 67626a45a8..7b82655dca 100644 --- a/osu.Game/Skinning/SkinImporter.cs +++ b/osu.Game/Skinning/SkinImporter.cs @@ -20,17 +20,21 @@ using Realms; namespace osu.Game.Skinning { - public class SkinImporter : RealmArchiveModelManager + public class SkinImporter : RealmArchiveModelImporter { private const string skin_info_file = "skininfo.json"; private readonly IStorageResourceProvider skinResources; + private readonly ModelManager modelManager; + public SkinImporter(Storage storage, RealmAccess realm, IStorageResourceProvider skinResources) : base(storage, realm) { this.skinResources = skinResources; + modelManager = new ModelManager(storage, realm); + // can be removed 20220420. populateMissingHashes(); } @@ -154,7 +158,7 @@ namespace osu.Game.Skinning sw.WriteLine(line); } - ReplaceFile(existingFile, stream, realm); + modelManager.ReplaceFile(existingFile, stream, realm); // can be removed 20220502. if (!ensureIniWasUpdated(item)) @@ -184,7 +188,7 @@ namespace osu.Game.Skinning sw.WriteLine(line); } - AddFile(item, stream, @"skin.ini", realm); + modelManager.AddFile(item, stream, @"skin.ini", realm); } item.Hash = ComputeHash(item); @@ -216,7 +220,7 @@ namespace osu.Game.Skinning } catch (Exception e) { - Delete(skin); + modelManager.Delete(skin); Logger.Error(e, $"Existing skin {skin} has been deleted during hash recomputation due to being invalid"); } } @@ -234,7 +238,7 @@ namespace osu.Game.Skinning using (var streamContent = new MemoryStream(Encoding.UTF8.GetBytes(skinInfoJson))) { - AddFile(s, streamContent, skin_info_file, s.Realm); + modelManager.AddFile(s, streamContent, skin_info_file, s.Realm); } // Then serialise each of the drawable component groups into respective files. @@ -249,16 +253,14 @@ namespace osu.Game.Skinning var oldFile = s.Files.FirstOrDefault(f => f.Filename == filename); if (oldFile != null) - ReplaceFile(oldFile, streamContent, s.Realm); + modelManager.ReplaceFile(oldFile, streamContent, s.Realm); else - AddFile(s, streamContent, filename, s.Realm); + modelManager.AddFile(s, streamContent, filename, s.Realm); } } s.Hash = ComputeHash(s); }); } - - public override bool IsAvailableLocally(SkinInfo model) => true; // skins do not have online download support yet. } } diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index f244657ea3..491de0c152 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Linq.Expressions; using System.Threading; @@ -24,7 +23,6 @@ using osu.Game.Audio; using osu.Game.Database; using osu.Game.IO; using osu.Game.IO.Archives; -using osu.Game.Models; using osu.Game.Overlays.Notifications; using osu.Game.Utils; @@ -38,7 +36,7 @@ namespace osu.Game.Skinning /// For gameplay components, see which adds extra legacy and toggle logic that may affect the lookup process. /// [ExcludeFromDynamicCompile] - public class SkinManager : ISkinSource, IStorageResourceProvider, IModelImporter, IModelManager, IModelFileManager + public class SkinManager : ModelManager, ISkinSource, IStorageResourceProvider, IModelImporter { private readonly AudioManager audio; @@ -71,6 +69,7 @@ namespace osu.Game.Skinning public Skin DefaultLegacySkin { get; } public SkinManager(Storage storage, RealmAccess realm, GameHost host, IResourceStore resources, AudioManager audio, Scheduler scheduler) + : base(storage, realm) { this.realm = realm; this.audio = audio; @@ -258,11 +257,6 @@ namespace osu.Game.Skinning #region Implementation of IModelImporter - public Action PostNotification - { - set => skinImporter.PostNotification = value; - } - public Action>> PostImport { set => skinImporter.PostImport = value; @@ -283,8 +277,6 @@ namespace osu.Game.Skinning #endregion - #region Implementation of IModelManager - public void Delete([CanBeNull] Expression> filter = null, bool silent = false) { realm.Run(r => @@ -300,26 +292,8 @@ namespace osu.Game.Skinning if (items.Any(s => s.ID == currentUserSkin)) scheduler.Add(() => CurrentSkinInfo.Value = Skinning.DefaultSkin.CreateInfo().ToLiveUnmanaged()); - skinImporter.Delete(items.ToList(), silent); + Delete(items.ToList(), silent); }); } - - public bool Delete(SkinInfo item) => skinImporter.Delete(item); - - public void Delete(List items, bool silent = false) => skinImporter.Delete(items, silent); - - public void Undelete(List items, bool silent = false) => skinImporter.Undelete(items, silent); - - public void Undelete(SkinInfo item) => skinImporter.Undelete(item); - - public bool IsAvailableLocally(SkinInfo model) => skinImporter.IsAvailableLocally(model); - - public void ReplaceFile(SkinInfo model, RealmNamedFileUsage file, Stream contents) => skinImporter.ReplaceFile(model, file, contents); - - public void DeleteFile(SkinInfo model, RealmNamedFileUsage file) => skinImporter.DeleteFile(model, file); - - public void AddFile(SkinInfo model, Stream contents, string filename) => skinImporter.AddFile(model, contents, filename); - - #endregion } } From 72c5b9009d6743a4aab0666a5ef919d21e91ccaa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 18:56:53 +0900 Subject: [PATCH 1695/2328] Remove local `realm` fields in manager classes --- osu.Game/Beatmaps/BeatmapManager.cs | 26 ++++++++----------- osu.Game/Database/RealmArchiveModelManager.cs | 2 +- osu.Game/Scoring/ScoreManager.cs | 8 +++--- osu.Game/Skinning/SkinManager.cs | 14 +++++----- 4 files changed, 21 insertions(+), 29 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 662931cd17..33e8cea380 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -45,14 +45,10 @@ namespace osu.Game.Beatmaps private readonly WorkingBeatmapCache workingBeatmapCache; private readonly BeatmapOnlineLookupQueue? onlineBeatmapLookupQueue; - private readonly RealmAccess realm; - public BeatmapManager(Storage storage, RealmAccess realm, RulesetStore rulesets, IAPIProvider? api, AudioManager audioManager, IResourceStore gameResources, GameHost? host = null, WorkingBeatmap? defaultBeatmap = null, bool performOnlineLookups = false) : base(storage, realm) { - this.realm = realm; - if (performOnlineLookups) { if (api == null) @@ -192,7 +188,7 @@ namespace osu.Game.Beatmaps /// The beatmap difficulty to hide. public void Hide(BeatmapInfo beatmapInfo) { - realm.Run(r => + Realm.Run(r => { using (var transaction = r.BeginWrite()) { @@ -211,7 +207,7 @@ namespace osu.Game.Beatmaps /// The beatmap difficulty to restore. public void Restore(BeatmapInfo beatmapInfo) { - realm.Run(r => + Realm.Run(r => { using (var transaction = r.BeginWrite()) { @@ -226,7 +222,7 @@ namespace osu.Game.Beatmaps public void RestoreAll() { - realm.Run(r => + Realm.Run(r => { using (var transaction = r.BeginWrite()) { @@ -244,7 +240,7 @@ namespace osu.Game.Beatmaps /// A list of available . public List GetAllUsableBeatmapSets() { - return realm.Run(r => + return Realm.Run(r => { r.Refresh(); return r.All().Where(b => !b.DeletePending).Detach(); @@ -258,7 +254,7 @@ namespace osu.Game.Beatmaps /// The first result for the provided query, or null if no results were found. public Live? QueryBeatmapSet(Expression> query) { - return realm.Run(r => r.All().FirstOrDefault(query)?.ToLive(realm)); + return Realm.Run(r => r.All().FirstOrDefault(query)?.ToLive(Realm)); } /// @@ -266,7 +262,7 @@ namespace osu.Game.Beatmaps /// /// The query. /// The first result for the provided query, or null if no results were found. - public BeatmapInfo? QueryBeatmap(Expression> query) => realm.Run(r => r.All().FirstOrDefault(query)?.Detach()); + public BeatmapInfo? QueryBeatmap(Expression> query) => Realm.Run(r => r.All().FirstOrDefault(query)?.Detach()); /// /// A default representation of a WorkingBeatmap to use when no beatmap is available. @@ -318,7 +314,7 @@ namespace osu.Game.Beatmaps AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo)); - realm.Write(r => setInfo.CopyChangesToRealm(r.Find(setInfo.ID))); + Realm.Write(r => setInfo.CopyChangesToRealm(r.Find(setInfo.ID))); } workingBeatmapCache.Invalidate(beatmapInfo); @@ -332,7 +328,7 @@ namespace osu.Game.Beatmaps public void DeleteAllVideos() { - realm.Write(r => + Realm.Write(r => { var items = r.All().Where(s => !s.DeletePending && !s.Protected); DeleteVideos(items.ToList()); @@ -341,7 +337,7 @@ namespace osu.Game.Beatmaps public void Delete(Expression>? filter = null, bool silent = false) { - realm.Run(r => + Realm.Run(r => { var items = r.All().Where(s => !s.DeletePending && !s.Protected); @@ -399,7 +395,7 @@ namespace osu.Game.Beatmaps public void UndeleteAll() { - realm.Run(r => Undelete(r.All().Where(s => s.DeletePending).ToList())); + Realm.Run(r => Undelete(r.All().Where(s => s.DeletePending).ToList())); } #region Implementation of ICanAcceptFiles @@ -431,7 +427,7 @@ namespace osu.Game.Beatmaps // If we seem to be missing files, now is a good time to re-fetch. if (importedBeatmap?.BeatmapSet?.Files.Count == 0) { - realm.Run(r => + Realm.Run(r => { var refetch = r.Find(importedBeatmap.ID)?.Detach(); diff --git a/osu.Game/Database/RealmArchiveModelManager.cs b/osu.Game/Database/RealmArchiveModelManager.cs index 5056b0d49f..bf4a8ca969 100644 --- a/osu.Game/Database/RealmArchiveModelManager.cs +++ b/osu.Game/Database/RealmArchiveModelManager.cs @@ -18,7 +18,7 @@ namespace osu.Game.Database public class ModelManager : IModelManager, IModelFileManager where TModel : RealmObject, IHasRealmFiles, IHasGuidPrimaryKey, ISoftDelete { - protected RealmAccess Realm; + protected RealmAccess Realm { get; } private readonly RealmFileStore realmFileStore; diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index da77b0bc6c..2b13b5cf4e 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -24,7 +24,6 @@ namespace osu.Game.Scoring { public class ScoreManager : ModelManager, IModelImporter { - private readonly RealmAccess realm; private readonly Scheduler scheduler; private readonly Func difficulties; private readonly OsuConfigManager configManager; @@ -34,7 +33,6 @@ namespace osu.Game.Scoring Func difficulties = null, OsuConfigManager configManager = null) : base(storage, realm) { - this.realm = realm; this.scheduler = scheduler; this.difficulties = difficulties; this.configManager = configManager; @@ -51,7 +49,7 @@ namespace osu.Game.Scoring /// The first result for the provided query, or null if no results were found. public ScoreInfo Query(Expression> query) { - return realm.Run(r => r.All().FirstOrDefault(query)?.Detach()); + return Realm.Run(r => r.All().FirstOrDefault(query)?.Detach()); } /// @@ -230,7 +228,7 @@ namespace osu.Game.Scoring public void Delete([CanBeNull] Expression> filter = null, bool silent = false) { - realm.Run(r => + Realm.Run(r => { var items = r.All() .Where(s => !s.DeletePending); @@ -244,7 +242,7 @@ namespace osu.Game.Scoring public void Delete(BeatmapInfo beatmap, bool silent = false) { - realm.Run(r => + Realm.Run(r => { var beatmapScores = r.Find(beatmap.ID).Scores.ToList(); Delete(beatmapScores, silent); diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index 491de0c152..33af46bc1c 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -54,7 +54,6 @@ namespace osu.Game.Skinning }; private readonly SkinImporter skinImporter; - private readonly RealmAccess realm; private readonly IResourceStore userFiles; @@ -71,7 +70,6 @@ namespace osu.Game.Skinning public SkinManager(Storage storage, RealmAccess realm, GameHost host, IResourceStore resources, AudioManager audio, Scheduler scheduler) : base(storage, realm) { - this.realm = realm; this.audio = audio; this.scheduler = scheduler; this.host = host; @@ -114,7 +112,7 @@ namespace osu.Game.Skinning public void SelectRandomSkin() { - realm.Run(r => + Realm.Run(r => { // choose from only user skins, removing the current selection to ensure a new one is chosen. var randomChoices = r.All().Where(s => !s.DeletePending && s.ID != CurrentSkinInfo.Value.ID).ToArray(); @@ -127,7 +125,7 @@ namespace osu.Game.Skinning var chosen = randomChoices.ElementAt(RNG.Next(0, randomChoices.Length)); - CurrentSkinInfo.Value = chosen.ToLive(realm); + CurrentSkinInfo.Value = chosen.ToLive(Realm); }); } @@ -152,7 +150,7 @@ namespace osu.Game.Skinning if (!s.Protected) return false; - string[] existingSkinNames = realm.Run(r => r.All() + string[] existingSkinNames = Realm.Run(r => r.All() .Where(skin => !skin.DeletePending) .AsEnumerable() .Select(skin => skin.Name).ToArray()); @@ -195,7 +193,7 @@ namespace osu.Game.Skinning /// The first result for the provided query, or null if no results were found. public Live Query(Expression> query) { - return realm.Run(r => r.All().FirstOrDefault(query)?.ToLive(realm)); + return Realm.Run(r => r.All().FirstOrDefault(query)?.ToLive(Realm)); } public event Action SourceChanged; @@ -250,7 +248,7 @@ namespace osu.Game.Skinning AudioManager IStorageResourceProvider.AudioManager => audio; IResourceStore IStorageResourceProvider.Resources => resources; IResourceStore IStorageResourceProvider.Files => userFiles; - RealmAccess IStorageResourceProvider.RealmAccess => realm; + RealmAccess IStorageResourceProvider.RealmAccess => Realm; IResourceStore IStorageResourceProvider.CreateTextureLoaderStore(IResourceStore underlyingStore) => host.CreateTextureLoaderStore(underlyingStore); #endregion @@ -279,7 +277,7 @@ namespace osu.Game.Skinning public void Delete([CanBeNull] Expression> filter = null, bool silent = false) { - realm.Run(r => + Realm.Run(r => { var items = r.All() .Where(s => !s.Protected && !s.DeletePending); From a635664a86de13d2f46d04daa2bbd8d27f0db238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 16 Jun 2022 12:01:53 +0200 Subject: [PATCH 1696/2328] Fix invalid method reference in comment `BeatmapModelManager.Save()` was moved to `BeatmapManager`, not to `BeatmapImporter`. --- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index a4ac161223..ea804dea72 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -174,7 +174,7 @@ namespace osu.Game.Beatmaps private WorkingBeatmap addDifficultyToSet(BeatmapSetInfo targetBeatmapSet, IBeatmap newBeatmap, ISkin beatmapSkin) { // populate circular beatmap set info <-> beatmap info references manually. - // several places like `BeatmapImporter.Save()` or `GetWorkingBeatmap()` + // several places like `Save()` or `GetWorkingBeatmap()` // rely on them being freely traversable in both directions for correct operation. targetBeatmapSet.Beatmaps.Add(newBeatmap.BeatmapInfo); newBeatmap.BeatmapInfo.BeatmapSet = targetBeatmapSet; From ce3d3a967c6e5a13e34578c8c122a7a81ef5a357 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 19:05:25 +0900 Subject: [PATCH 1697/2328] Reimplement missing methods --- osu.Game/Beatmaps/BeatmapManager.cs | 10 +++++++--- osu.Game/Database/RealmArchiveModelManager.cs | 5 +++-- osu.Game/Scoring/ScoreManager.cs | 5 ++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 33e8cea380..778829cba8 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -359,7 +359,7 @@ namespace osu.Game.Beatmaps var notification = new ProgressNotification { Progress = 0, - Text = $"Preparing to delete all {beatmapImporter.HumanisedModelName} videos...", + Text = $"Preparing to delete all {HumanisedModelName} videos...", CompletionText = "No videos found to delete!", State = ProgressNotificationState.Active, }; @@ -382,10 +382,10 @@ namespace osu.Game.Beatmaps { DeleteFile(b, video); deleted++; - notification.CompletionText = $"Deleted {deleted} {beatmapImporter.HumanisedModelName} video(s)!"; + notification.CompletionText = $"Deleted {deleted} {HumanisedModelName} video(s)!"; } - notification.Text = $"Deleting videos from {beatmapImporter.HumanisedModelName}s ({deleted} deleted)"; + notification.Text = $"Deleting videos from {HumanisedModelName}s ({deleted} deleted)"; notification.Progress = (float)++i / items.Count; } @@ -451,6 +451,8 @@ namespace osu.Game.Beatmaps void IWorkingBeatmapCache.Invalidate(BeatmapSetInfo beatmapSetInfo) => workingBeatmapCache.Invalidate(beatmapSetInfo); void IWorkingBeatmapCache.Invalidate(BeatmapInfo beatmapInfo) => workingBeatmapCache.Invalidate(beatmapInfo); + public override bool IsAvailableLocally(BeatmapSetInfo model) => Realm.Run(realm => realm.All().Any(s => s.OnlineID == model.OnlineID)); + #endregion #region Implementation of IDisposable @@ -470,5 +472,7 @@ namespace osu.Game.Beatmaps } #endregion + + public override string HumanisedModelName => "beatmap"; } } diff --git a/osu.Game/Database/RealmArchiveModelManager.cs b/osu.Game/Database/RealmArchiveModelManager.cs index bf4a8ca969..795647e94c 100644 --- a/osu.Game/Database/RealmArchiveModelManager.cs +++ b/osu.Game/Database/RealmArchiveModelManager.cs @@ -199,9 +199,10 @@ namespace osu.Game.Database }); } - // TODO: implement public virtual bool IsAvailableLocally(TModel model) => true; + public Action? PostNotification { get; set; } - public string HumanisedModelName { get; set; } = "wang"; + + public virtual string HumanisedModelName => $"{typeof(TModel).Name.Replace(@"Info", "").ToLower()}"; } } diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 2b13b5cf4e..9b5eab96e8 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -253,11 +253,14 @@ namespace osu.Game.Scoring public Task Import(params ImportTask[] tasks) => scoreImporter.Import(tasks); + public override bool IsAvailableLocally(ScoreInfo model) => Realm.Run(realm => realm.All().Any(s => s.OnlineID == model.OnlineID)); + public IEnumerable HandledExtensions => scoreImporter.HandledExtensions; public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => scoreImporter.Import(notification, tasks); - public Live Import(ScoreInfo item, ArchiveReader archive = null, bool batchImport = false, CancellationToken cancellationToken = default) => scoreImporter.Import(item, archive, batchImport, cancellationToken); + public Live Import(ScoreInfo item, ArchiveReader archive = null, bool batchImport = false, CancellationToken cancellationToken = default) => + scoreImporter.Import(item, archive, batchImport, cancellationToken); #region Implementation of IPresentImports From 3860f0b3e5b8e3105501cd89dfddaa6da874334b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 19:08:59 +0900 Subject: [PATCH 1698/2328] Remove unused `GetWorkingBetamap` method --- osu.Game/Beatmaps/BeatmapManager.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 778829cba8..583594b152 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -439,15 +439,6 @@ namespace osu.Game.Beatmaps return workingBeatmapCache.GetWorkingBeatmap(importedBeatmap); } - public WorkingBeatmap GetWorkingBeatmap(Live? importedBeatmap) - { - WorkingBeatmap working = workingBeatmapCache.GetWorkingBeatmap(null); - - importedBeatmap?.PerformRead(b => working = workingBeatmapCache.GetWorkingBeatmap(b)); - - return working; - } - void IWorkingBeatmapCache.Invalidate(BeatmapSetInfo beatmapSetInfo) => workingBeatmapCache.Invalidate(beatmapSetInfo); void IWorkingBeatmapCache.Invalidate(BeatmapInfo beatmapInfo) => workingBeatmapCache.Invalidate(beatmapInfo); From 448eee051ad5e727c4c2436c116e3fa61eb62860 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 19:41:14 +0900 Subject: [PATCH 1699/2328] Update filename to match new class name --- .../Database/{RealmArchiveModelManager.cs => ModelManager.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename osu.Game/Database/{RealmArchiveModelManager.cs => ModelManager.cs} (100%) diff --git a/osu.Game/Database/RealmArchiveModelManager.cs b/osu.Game/Database/ModelManager.cs similarity index 100% rename from osu.Game/Database/RealmArchiveModelManager.cs rename to osu.Game/Database/ModelManager.cs From e66ccfd980e55027a3cd8ae40cd9689babddf401 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 19:48:18 +0900 Subject: [PATCH 1700/2328] Add back missing notification flow --- osu.Game/Beatmaps/BeatmapManager.cs | 2 ++ osu.Game/Scoring/ScoreManager.cs | 5 ++++- osu.Game/Skinning/SkinManager.cs | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 583594b152..fcc78bc34d 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -62,6 +62,8 @@ namespace osu.Game.Beatmaps BeatmapTrackStore = audioManager.GetTrackStore(userResources); beatmapImporter = CreateBeatmapImporter(storage, realm, rulesets, onlineBeatmapLookupQueue); + beatmapImporter.PostNotification = obj => PostNotification?.Invoke(obj); + workingBeatmapCache = CreateWorkingBeatmapCache(audioManager, gameResources, userResources, defaultBeatmap, host); } diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 9b5eab96e8..4627ca414a 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -37,7 +37,10 @@ namespace osu.Game.Scoring this.difficulties = difficulties; this.configManager = configManager; - scoreImporter = new ScoreImporter(rulesets, beatmaps, storage, realm); + scoreImporter = new ScoreImporter(rulesets, beatmaps, storage, realm) + { + PostNotification = obj => PostNotification?.Invoke(obj) + }; } public Score GetScore(ScoreInfo score) => scoreImporter.GetScore(score); diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index 33af46bc1c..813ed3e066 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -77,7 +77,10 @@ namespace osu.Game.Skinning userFiles = new StorageBackedResourceStore(storage.GetStorageForDirectory("files")); - skinImporter = new SkinImporter(storage, realm, this); + skinImporter = new SkinImporter(storage, realm, this) + { + PostNotification = obj => PostNotification?.Invoke(obj), + }; var defaultSkins = new[] { From 7b0fad6461342948385a75166d68df24b175d18c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 23:29:33 +0900 Subject: [PATCH 1701/2328] Null disposal token after use --- osu.Game/Database/EFToRealmMigrator.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Database/EFToRealmMigrator.cs b/osu.Game/Database/EFToRealmMigrator.cs index d2f52fa635..aa25c76943 100644 --- a/osu.Game/Database/EFToRealmMigrator.cs +++ b/osu.Game/Database/EFToRealmMigrator.cs @@ -133,6 +133,8 @@ namespace osu.Game.Database Task.Factory.StartNew(() => { realm.CreateBackup(Path.Combine(backup_folder, $"client.{backupSuffix}.realm"), realmBlockOperations); + realmBlockOperations = null; + efContextFactory.CreateBackup(Path.Combine(backup_folder, $"client.{backupSuffix}.db")); using (var ef = efContextFactory.Get()) @@ -218,7 +220,7 @@ namespace osu.Game.Database // If we were to not do this, the migration would run another time the next time the user starts the game. deletePreRealmData(); - realmBlockOperations.Dispose(); + realmBlockOperations?.Dispose(); migrationCompleted.SetResult(true); efContextFactory.SetMigrationCompletion(); From 7809566f166e847b80723bf2bab3bc9f6a190f40 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 23:31:38 +0900 Subject: [PATCH 1702/2328] Add explanatory comments --- osu.Game/Database/EFToRealmMigrator.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Database/EFToRealmMigrator.cs b/osu.Game/Database/EFToRealmMigrator.cs index aa25c76943..74a3edc3ee 100644 --- a/osu.Game/Database/EFToRealmMigrator.cs +++ b/osu.Game/Database/EFToRealmMigrator.cs @@ -133,6 +133,9 @@ namespace osu.Game.Database Task.Factory.StartNew(() => { realm.CreateBackup(Path.Combine(backup_folder, $"client.{backupSuffix}.realm"), realmBlockOperations); + + // Above call will dispose of the blocking token when done. + // Clean up here so we don't accidentally dispose twice. realmBlockOperations = null; efContextFactory.CreateBackup(Path.Combine(backup_folder, $"client.{backupSuffix}.db")); @@ -220,6 +223,7 @@ namespace osu.Game.Database // If we were to not do this, the migration would run another time the next time the user starts the game. deletePreRealmData(); + // If something went wrong and the disposal token wasn't invoked above, ensure it is here. realmBlockOperations?.Dispose(); migrationCompleted.SetResult(true); From bf6c6682bcf05ae241bb41d4f60de4960d29acb4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 23:37:24 +0900 Subject: [PATCH 1703/2328] Move null to finally --- osu.Game/Database/EFToRealmMigrator.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game/Database/EFToRealmMigrator.cs b/osu.Game/Database/EFToRealmMigrator.cs index 74a3edc3ee..2486071c01 100644 --- a/osu.Game/Database/EFToRealmMigrator.cs +++ b/osu.Game/Database/EFToRealmMigrator.cs @@ -132,11 +132,16 @@ namespace osu.Game.Database Task.Factory.StartNew(() => { - realm.CreateBackup(Path.Combine(backup_folder, $"client.{backupSuffix}.realm"), realmBlockOperations); - - // Above call will dispose of the blocking token when done. - // Clean up here so we don't accidentally dispose twice. - realmBlockOperations = null; + try + { + realm.CreateBackup(Path.Combine(backup_folder, $"client.{backupSuffix}.realm"), realmBlockOperations); + } + finally + { + // Above call will dispose of the blocking token when done. + // Clean up here so we don't accidentally dispose twice. + realmBlockOperations = null; + } efContextFactory.CreateBackup(Path.Combine(backup_folder, $"client.{backupSuffix}.db")); From f1081db953887ba597675c772772d5a8ca94acff Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 16 Jun 2022 18:48:32 +0300 Subject: [PATCH 1704/2328] Fix background/track implicitly renamed on initial load --- .../Screens/Edit/Setup/ResourcesSection.cs | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs index 2471886d9b..5054f7a393 100644 --- a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs +++ b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs @@ -59,8 +59,10 @@ namespace osu.Game.Screens.Edit.Setup if (!string.IsNullOrEmpty(working.Value.Metadata.AudioFile)) audioTrackChooser.Current.Value = new FileInfo(working.Value.Metadata.AudioFile); - backgroundChooser.Current.BindValueChanged(backgroundChanged, true); - audioTrackChooser.Current.BindValueChanged(audioTrackChanged, true); + backgroundChooser.Current.BindValueChanged(backgroundChanged); + audioTrackChooser.Current.BindValueChanged(audioTrackChanged); + + updatePlaceholderText(); } public bool ChangeBackgroundImage(FileInfo source) @@ -121,28 +123,29 @@ namespace osu.Game.Screens.Edit.Setup private void backgroundChanged(ValueChangedEvent file) { - backgroundChooser.Text = file.NewValue == null - ? "Click to select a background image" - : "Click to replace the background image"; + if (!ChangeBackgroundImage(file.NewValue)) + backgroundChooser.Current.Value = file.OldValue; - if (file.NewValue != file.OldValue) - { - if (!ChangeBackgroundImage(file.NewValue)) - backgroundChooser.Current.Value = file.OldValue; - } + updatePlaceholderText(); } private void audioTrackChanged(ValueChangedEvent file) { - audioTrackChooser.Text = file.NewValue == null + if (!ChangeAudioTrack(file.NewValue)) + audioTrackChooser.Current.Value = file.OldValue; + + updatePlaceholderText(); + } + + private void updatePlaceholderText() + { + audioTrackChooser.Text = audioTrackChooser.Current.Value == null ? "Click to select a track" : "Click to replace the track"; - if (file.NewValue != file.OldValue) - { - if (!ChangeAudioTrack(file.NewValue)) - audioTrackChooser.Current.Value = file.OldValue; - } + backgroundChooser.Text = backgroundChooser.Current.Value == null + ? "Click to select a background image" + : "Click to replace the background image"; } } } From 6aee6895863be43435e648161c0c3e831cae5507 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 16 Jun 2022 18:50:28 +0300 Subject: [PATCH 1705/2328] Fix previous file lookup not using metadata properties --- osu.Game/Screens/Edit/Setup/ResourcesSection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs index 5054f7a393..1a37f539e8 100644 --- a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs +++ b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs @@ -76,7 +76,7 @@ namespace osu.Game.Screens.Edit.Setup // remove the previous background for now. // in the future we probably want to check if this is being used elsewhere (other difficulties?) - var oldFile = set.Files.FirstOrDefault(f => Path.GetFileNameWithoutExtension(f.Filename) == destination.Name); + var oldFile = set.Files.FirstOrDefault(f => f.Filename == working.Value.Metadata.BackgroundFile); using (var stream = source.OpenRead()) { @@ -103,7 +103,7 @@ namespace osu.Game.Screens.Edit.Setup // remove the previous audio track for now. // in the future we probably want to check if this is being used elsewhere (other difficulties?) - var oldFile = set.Files.FirstOrDefault(f => Path.GetFileNameWithoutExtension(f.Filename) == destination.Name); + var oldFile = set.Files.FirstOrDefault(f => f.Filename == working.Value.Metadata.AudioFile); using (var stream = source.OpenRead()) { From 52538dc7083f2063149c8f08a249921c3c429acc Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 16 Jun 2022 19:46:04 +0300 Subject: [PATCH 1706/2328] Refactor `LatencyCursorContainer` to become a cursor container --- .../LatencyCursorContainer.cs | 48 +++++++++---------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs b/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs index e4c2b504cb..ecd3837512 100644 --- a/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs +++ b/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs @@ -2,55 +2,51 @@ // See the LICENCE file in the repository root for full licence text. #nullable enable -using osu.Framework.Allocation; + using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Framework.Input.States; -using osu.Game.Overlays; using osuTK; using osuTK.Input; namespace osu.Game.Screens.Utility.SampleComponents { - public class LatencyCursorContainer : LatencySampleComponent + public class LatencyCursorContainer : CursorContainer { - private Circle cursor = null!; + protected override Drawable CreateCursor() => new LatencyCursor(); - [Resolved] - private OverlayColourProvider overlayColourProvider { get; set; } = null!; + public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks; public LatencyCursorContainer() { - Masking = true; + State.Value = Visibility.Hidden; } - protected override void LoadComplete() + protected override bool OnMouseMove(MouseMoveEvent e) { - base.LoadComplete(); - - InternalChild = cursor = new Circle - { - Size = new Vector2(40), - Origin = Anchor.Centre, - Colour = overlayColourProvider.Colour2, - }; + // CursorContainer implements IRequireHighFrequencyMousePosition, which bypasses limited rate updating, therefore scheduling is required. + // We can alternatively solve this by a PassThroughInputManager layer inside LatencyArea, + // but that would mean including input lag to this test, which may not be desired. + Schedule(() => base.OnMouseMove(e)); + return false; } - protected override bool OnHover(HoverEvent e) => false; - - protected override void UpdateAtLimitedRate(InputState inputState) + private class LatencyCursor : LatencySampleComponent { - cursor.Colour = inputState.Mouse.IsPressed(MouseButton.Left) ? overlayColourProvider.Content1 : overlayColourProvider.Colour2; - - if (IsActive.Value) + public LatencyCursor() { - cursor.Position = ToLocalSpace(inputState.Mouse.Position); - cursor.Alpha = 1; + AutoSizeAxes = Axes.Both; + Origin = Anchor.Centre; + + InternalChild = new Circle { Size = new Vector2(40) }; } - else + + protected override void UpdateAtLimitedRate(InputState inputState) { - cursor.Alpha = 0; + Colour = inputState.Mouse.IsPressed(MouseButton.Left) ? OverlayColourProvider.Content1 : OverlayColourProvider.Colour2; } } } From ed6817ae6a68b2385b8f0591453367d88a423459 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 16 Jun 2022 19:46:31 +0300 Subject: [PATCH 1707/2328] Allow switching between latency and menu cursor using `IProvideCursor` --- osu.Game/Screens/Utility/LatencyArea.cs | 14 ++++++++++---- osu.Game/Screens/Utility/LatencyCertifierScreen.cs | 2 -- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Utility/LatencyArea.cs b/osu.Game/Screens/Utility/LatencyArea.cs index 21688f0b0c..86cdbd39b9 100644 --- a/osu.Game/Screens/Utility/LatencyArea.cs +++ b/osu.Game/Screens/Utility/LatencyArea.cs @@ -8,8 +8,10 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; +using osu.Game.Graphics.Cursor; using osu.Game.Overlays; using osu.Game.Screens.Utility.SampleComponents; using osuTK.Input; @@ -17,7 +19,7 @@ using osuTK.Input; namespace osu.Game.Screens.Utility { [Cached] - public class LatencyArea : CompositeDrawable + public class LatencyArea : CompositeDrawable, IProvideCursor { [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } = null!; @@ -36,6 +38,10 @@ namespace osu.Game.Screens.Utility public readonly Bindable VisualMode = new Bindable(); + public CursorContainer? Cursor { get; private set; } + + public bool ProvidingUserCursor => IsActiveArea.Value; + public LatencyArea(Key key, int? targetFrameRate) { this.key = key; @@ -87,7 +93,7 @@ namespace osu.Game.Screens.Utility { RelativeSizeAxes = Axes.Both, }, - new LatencyCursorContainer + Cursor = new LatencyCursorContainer { RelativeSizeAxes = Axes.Both, }, @@ -101,7 +107,7 @@ namespace osu.Game.Screens.Utility { RelativeSizeAxes = Axes.Both, }, - new LatencyCursorContainer + Cursor = new LatencyCursorContainer { RelativeSizeAxes = Axes.Both, }, @@ -115,7 +121,7 @@ namespace osu.Game.Screens.Utility { RelativeSizeAxes = Axes.Both, }, - new LatencyCursorContainer + Cursor = new LatencyCursorContainer { RelativeSizeAxes = Axes.Both, }, diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 8210e6825a..f8587e166c 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -41,8 +41,6 @@ namespace osu.Game.Screens.Utility public override bool HideOverlaysOnEnter => true; - public override bool CursorVisible => mainArea.Count == 0; - public override float BackgroundParallaxAmount => 0; private readonly LinkFlowContainer explanatoryText; From beb03316400ddbffecdf84943fb5e6f0a486d165 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 16 Jun 2022 19:56:56 +0300 Subject: [PATCH 1708/2328] Let latency certifier buttons steal hover from area --- osu.Game/Screens/Utility/ButtonWithKeyBind.cs | 2 ++ osu.Game/Screens/Utility/LatencyArea.cs | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Utility/ButtonWithKeyBind.cs b/osu.Game/Screens/Utility/ButtonWithKeyBind.cs index ef87e0bca7..ad60baafab 100644 --- a/osu.Game/Screens/Utility/ButtonWithKeyBind.cs +++ b/osu.Game/Screens/Utility/ButtonWithKeyBind.cs @@ -38,6 +38,8 @@ namespace osu.Game.Screens.Utility return base.OnKeyDown(e); } + protected override bool OnHover(HoverEvent e) => true; + [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } = null!; diff --git a/osu.Game/Screens/Utility/LatencyArea.cs b/osu.Game/Screens/Utility/LatencyArea.cs index 86cdbd39b9..da37cab334 100644 --- a/osu.Game/Screens/Utility/LatencyArea.cs +++ b/osu.Game/Screens/Utility/LatencyArea.cs @@ -62,6 +62,10 @@ namespace osu.Game.Screens.Utility Colour = overlayColourProvider.Background6, RelativeSizeAxes = Axes.Both, }, + visualContent = new Container + { + RelativeSizeAxes = Axes.Both, + }, new ButtonWithKeyBind(key) { Text = "Feels better", @@ -71,10 +75,6 @@ namespace osu.Game.Screens.Utility Origin = Anchor.TopCentre, Action = () => ReportUserBest?.Invoke(), }, - visualContent = new Container - { - RelativeSizeAxes = Axes.Both, - }, }; IsActiveArea.BindValueChanged(active => From 8e088140b2c7709a8e5a49aa1efcec8c19815db9 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 16 Jun 2022 20:09:10 +0300 Subject: [PATCH 1709/2328] Reword comment since `IRequireHighFrequencyMousePosition` isn't the issue --- .../Screens/Utility/SampleComponents/LatencyCursorContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs b/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs index ecd3837512..656aa6a8b3 100644 --- a/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs +++ b/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs @@ -27,7 +27,7 @@ namespace osu.Game.Screens.Utility.SampleComponents protected override bool OnMouseMove(MouseMoveEvent e) { - // CursorContainer implements IRequireHighFrequencyMousePosition, which bypasses limited rate updating, therefore scheduling is required. + // Scheduling is required to ensure updating of cursor position happens in limited rate. // We can alternatively solve this by a PassThroughInputManager layer inside LatencyArea, // but that would mean including input lag to this test, which may not be desired. Schedule(() => base.OnMouseMove(e)); From 42378dbb88b4ec81863c978e5b27595577341bc8 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 16 Jun 2022 20:22:56 +0300 Subject: [PATCH 1710/2328] Improve test coverage to ensure volume is unaffected when mouse is away --- .../Visual/Menus/TestSceneToolbar.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs index f230e48b11..0b99c781ef 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs @@ -17,6 +17,7 @@ using osu.Game.Overlays; using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Toolbar; using osu.Game.Rulesets; +using osuTK; using osuTK.Graphics; using osuTK.Input; @@ -153,11 +154,23 @@ namespace osu.Game.Tests.Visual.Menus AddStep("hover toolbar music button", () => InputManager.MoveMouseTo(this.ChildrenOfType().Single())); AddStep("reset volume", () => Audio.Volume.Value = 1); + AddStep("hide volume overlay", () => volumeOverlay.Hide()); AddRepeatStep("scroll down", () => InputManager.ScrollVerticalBy(-10), 5); AddAssert("volume lowered down", () => Audio.Volume.Value < 1); AddRepeatStep("scroll up", () => InputManager.ScrollVerticalBy(10), 5); AddAssert("volume raised up", () => Audio.Volume.Value == 1); + + AddStep("move mouse away", () => InputManager.MoveMouseTo(Vector2.Zero)); + AddAssert("button not hovered", () => !this.ChildrenOfType().Single().IsHovered); + + AddStep("set volume to 0.5", () => Audio.Volume.Value = 0.5); + AddStep("hide volume overlay", () => volumeOverlay.Hide()); + + AddRepeatStep("scroll down", () => InputManager.ScrollVerticalBy(-10), 5); + AddAssert("volume not changed", () => Audio.Volume.Value == 0.5); + AddRepeatStep("scroll up", () => InputManager.ScrollVerticalBy(10), 5); + AddAssert("volume not changed", () => Audio.Volume.Value == 0.5); } [Test] @@ -166,11 +179,24 @@ namespace osu.Game.Tests.Visual.Menus AddStep("hover toolbar music button", () => InputManager.MoveMouseTo(this.ChildrenOfType().Single())); AddStep("reset volume", () => Audio.Volume.Value = 1); + AddStep("hide volume overlay", () => volumeOverlay.Hide()); AddRepeatStep("arrow down", () => InputManager.Key(Key.Down), 5); AddAssert("volume lowered down", () => Audio.Volume.Value < 1); AddRepeatStep("arrow up", () => InputManager.Key(Key.Up), 5); AddAssert("volume raised up", () => Audio.Volume.Value == 1); + + AddStep("hide volume overlay", () => volumeOverlay.Hide()); + AddStep("move mouse away", () => InputManager.MoveMouseTo(Vector2.Zero)); + AddAssert("button not hovered", () => !this.ChildrenOfType().Single().IsHovered); + + AddStep("set volume", () => Audio.Volume.Value = 0.5); + AddStep("hide volume overlay", () => volumeOverlay.Hide()); + + AddRepeatStep("arrow down", () => InputManager.Key(Key.Down), 5); + AddAssert("volume not changed", () => Audio.Volume.Value == 0.5); + AddRepeatStep("arrow up", () => InputManager.Key(Key.Up), 5); + AddAssert("volume not changed", () => Audio.Volume.Value == 0.5); } public class TestToolbar : Toolbar From e4ddf03ad637f99f581903793bbee45715477f7c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 16 Jun 2022 20:22:25 +0300 Subject: [PATCH 1711/2328] Fix toolbar music button handling keys while not hovered --- osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs index d59127d61f..9590c1aa3b 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs @@ -81,6 +81,9 @@ namespace osu.Game.Overlays.Toolbar protected override bool OnKeyDown(KeyDownEvent e) { + if (!IsHovered) + return false; + switch (e.Key) { case Key.Up: From f7a27b412a18e8db958266e49df116c3ebfb8d7f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 16 Jun 2022 20:35:30 +0300 Subject: [PATCH 1712/2328] Revert "Let latency certifier buttons steal hover from area" This reverts commit beb03316400ddbffecdf84943fb5e6f0a486d165. --- osu.Game/Screens/Utility/ButtonWithKeyBind.cs | 2 -- osu.Game/Screens/Utility/LatencyArea.cs | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Utility/ButtonWithKeyBind.cs b/osu.Game/Screens/Utility/ButtonWithKeyBind.cs index ad60baafab..ef87e0bca7 100644 --- a/osu.Game/Screens/Utility/ButtonWithKeyBind.cs +++ b/osu.Game/Screens/Utility/ButtonWithKeyBind.cs @@ -38,8 +38,6 @@ namespace osu.Game.Screens.Utility return base.OnKeyDown(e); } - protected override bool OnHover(HoverEvent e) => true; - [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } = null!; diff --git a/osu.Game/Screens/Utility/LatencyArea.cs b/osu.Game/Screens/Utility/LatencyArea.cs index da37cab334..86cdbd39b9 100644 --- a/osu.Game/Screens/Utility/LatencyArea.cs +++ b/osu.Game/Screens/Utility/LatencyArea.cs @@ -62,10 +62,6 @@ namespace osu.Game.Screens.Utility Colour = overlayColourProvider.Background6, RelativeSizeAxes = Axes.Both, }, - visualContent = new Container - { - RelativeSizeAxes = Axes.Both, - }, new ButtonWithKeyBind(key) { Text = "Feels better", @@ -75,6 +71,10 @@ namespace osu.Game.Screens.Utility Origin = Anchor.TopCentre, Action = () => ReportUserBest?.Invoke(), }, + visualContent = new Container + { + RelativeSizeAxes = Axes.Both, + }, }; IsActiveArea.BindValueChanged(active => From db02cb81c5aac24b82f08986d8c43a28ad24d208 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 16 Jun 2022 20:48:17 +0300 Subject: [PATCH 1713/2328] Fix file chooser path not opening home directory initially --- osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs index 6c56320666..ab83c2a2e4 100644 --- a/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs +++ b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs @@ -36,6 +36,8 @@ namespace osu.Game.Screens.Edit.Setup [Resolved] private OsuGameBase game { get; set; } = null!; + private string? chooserPath; + private readonly BindableWithCurrent current = new BindableWithCurrent(); public Bindable Current @@ -73,6 +75,8 @@ namespace osu.Game.Screens.Edit.Setup { if (file.NewValue != null) this.HidePopover(); + + chooserPath = file.NewValue?.DirectoryName; } Task ICanAcceptFiles.Import(params string[] paths) @@ -100,16 +104,16 @@ namespace osu.Game.Screens.Edit.Setup OnFocused = this.ShowPopover, }; - public Popover GetPopover() => new FileChooserPopover(handledExtensions, Current); + public Popover GetPopover() => new FileChooserPopover(handledExtensions, Current, chooserPath); private class FileChooserPopover : OsuPopover { - public FileChooserPopover(string[] handledExtensions, Bindable currentFile) + public FileChooserPopover(string[] handledExtensions, Bindable currentFile, string? chooserPath) { Child = new Container { Size = new Vector2(600, 400), - Child = new OsuFileSelector(currentFile.Value?.DirectoryName, handledExtensions) + Child = new OsuFileSelector(chooserPath, handledExtensions) { RelativeSizeAxes = Axes.Both, CurrentFile = { BindTarget = currentFile } From 9141a7a907377fd0f005e4f7b30ccc8d9ab27265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 16 Jun 2022 20:45:55 +0200 Subject: [PATCH 1714/2328] Revert Xamarin regression workaround in Android CI build definition This commit is a revert of 53e52d2c4b8f32eb7ce07cb7c2ed8a8cae05c5a3. Partially done because the workaround is no longer needed, partially because macOS images have begun to fail after a new image rollout with bumped NuGet versions. --- .github/workflows/ci.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6281357648..8dd6ae8197 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,27 +96,20 @@ jobs: build-only-android: name: Build only (Android) - runs-on: macos-latest + runs-on: windows-latest timeout-minutes: 60 steps: - name: Checkout uses: actions/checkout@v2 - # Pin Xamarin.Android version to 11.2 for now to avoid build failures caused by a Xamarin-side regression. - # See: https://github.com/xamarin/xamarin-android/issues/6284 - # This can be removed/reverted when the fix makes it to upstream and is deployed on github runners. - - name: Set default Xamarin SDK version - run: | - $VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --android=11.2 - - name: Install .NET 6.0.x uses: actions/setup-dotnet@v1 with: dotnet-version: "6.0.x" - # Contrary to seemingly any other msbuild, msbuild running on macOS/Mono - # cannot accept .sln(f) files as arguments. - # Build just the main game for now. + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1 + - name: Build run: msbuild osu.Android/osu.Android.csproj /restore /p:Configuration=Debug From 6ff6a3f5b3395e32288bc04bab964410eb260dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 16 Jun 2022 21:51:31 +0200 Subject: [PATCH 1715/2328] Rename and document `chooserPath` --- osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs index ab83c2a2e4..5a2ac7424c 100644 --- a/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs +++ b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs @@ -17,6 +17,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.UserInterface; using osu.Framework.Localisation; +using osu.Framework.Platform; using osu.Game.Database; using osu.Game.Graphics.UserInterfaceV2; using osuTK; @@ -36,7 +37,14 @@ namespace osu.Game.Screens.Edit.Setup [Resolved] private OsuGameBase game { get; set; } = null!; - private string? chooserPath; + /// + /// The initial path to use when displaying the . + /// + /// + /// Uses a value before the first selection is made + /// to ensure that the first selection starts at . + /// + private string? initialChooserPath; private readonly BindableWithCurrent current = new BindableWithCurrent(); @@ -76,7 +84,7 @@ namespace osu.Game.Screens.Edit.Setup if (file.NewValue != null) this.HidePopover(); - chooserPath = file.NewValue?.DirectoryName; + initialChooserPath = file.NewValue?.DirectoryName; } Task ICanAcceptFiles.Import(params string[] paths) @@ -104,7 +112,7 @@ namespace osu.Game.Screens.Edit.Setup OnFocused = this.ShowPopover, }; - public Popover GetPopover() => new FileChooserPopover(handledExtensions, Current, chooserPath); + public Popover GetPopover() => new FileChooserPopover(handledExtensions, Current, initialChooserPath); private class FileChooserPopover : OsuPopover { From 968640c95176f4a771ab6208234045f40e4ca281 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 17 Jun 2022 16:34:09 +0900 Subject: [PATCH 1716/2328] Enable NRT by default --- Directory.Build.props | 1 + 1 file changed, 1 insertion(+) diff --git a/Directory.Build.props b/Directory.Build.props index 73a150d3e3..dbc84fb88f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,6 +3,7 @@ 8.0 true + enable $(MSBuildThisFileDirectory)app.manifest From f8830c6850128456266c82de83273204f8b74ac0 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 17 Jun 2022 16:37:17 +0900 Subject: [PATCH 1717/2328] Automated #nullable processing --- osu.Android/GameplayScreenRotationLocker.cs | 2 ++ osu.Android/OsuGameActivity.cs | 2 ++ osu.Android/OsuGameAndroid.cs | 2 ++ osu.Android/Properties/AssemblyInfo.cs | 2 ++ osu.Desktop/DiscordRichPresence.cs | 2 ++ .../LegacyIpc/LegacyIpcDifficultyCalculationRequest.cs | 2 ++ .../LegacyIpc/LegacyIpcDifficultyCalculationResponse.cs | 2 ++ osu.Desktop/LegacyIpc/LegacyIpcMessage.cs | 2 ++ osu.Desktop/LegacyIpc/LegacyTcpIpcProvider.cs | 2 -- osu.Desktop/OsuGameDesktop.cs | 2 ++ osu.Desktop/Program.cs | 2 ++ osu.Desktop/Security/ElevatedPrivilegesChecker.cs | 2 ++ osu.Desktop/Updater/SquirrelUpdateManager.cs | 2 ++ osu.Desktop/Windows/GameplayWinKeyBlocker.cs | 2 ++ osu.Desktop/Windows/WindowsKey.cs | 2 ++ osu.Game.Benchmarks/BenchmarkBeatmapParsing.cs | 2 ++ osu.Game.Benchmarks/BenchmarkMod.cs | 2 ++ osu.Game.Benchmarks/BenchmarkRealmReads.cs | 2 ++ osu.Game.Benchmarks/BenchmarkRuleset.cs | 2 ++ osu.Game.Benchmarks/BenchmarkTest.cs | 2 ++ osu.Game.Benchmarks/Program.cs | 2 ++ osu.Game.Rulesets.Catch.Tests.Android/MainActivity.cs | 2 ++ osu.Game.Rulesets.Catch.Tests.iOS/AppDelegate.cs | 2 ++ osu.Game.Rulesets.Catch.Tests.iOS/Application.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs | 2 ++ .../CatchDifficultyCalculatorTest.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/CatchLegacyModConversionTest.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/CatchSkinColourDecodingTest.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/CatchSkinnableTestScene.cs | 2 ++ .../Editor/CatchEditorTestSceneContainer.cs | 2 ++ .../Editor/CatchPlacementBlueprintTestScene.cs | 2 ++ .../Editor/CatchSelectionBlueprintTestScene.cs | 2 ++ .../Editor/Checks/TestCheckBananaShowerGap.cs | 2 ++ .../Editor/TestSceneBananaShowerPlacementBlueprint.cs | 2 ++ .../Editor/TestSceneCatchDistanceSnapGrid.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/Editor/TestSceneEditor.cs | 2 ++ .../Editor/TestSceneFruitPlacementBlueprint.cs | 2 ++ .../Editor/TestSceneJuiceStreamPlacementBlueprint.cs | 2 ++ .../Editor/TestSceneJuiceStreamSelectionBlueprint.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/JuiceStreamPathTest.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/Mods/CatchModMirrorTest.cs | 2 ++ .../Mods/TestSceneCatchModNoScope.cs | 2 ++ .../Mods/TestSceneCatchModPerfect.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneBananaShower.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayer.cs | 2 ++ .../TestSceneCatchPlayerLegacySkin.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneCatchReplay.cs | 2 ++ .../TestSceneCatchSkinConfiguration.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneComboCounter.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs | 2 ++ .../TestSceneDrawableHitObjectsHidden.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneFruitObjects.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneFruitRandomness.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneFruitVisualChange.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneHyperDashColouring.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs | 2 ++ osu.Game.Rulesets.Catch.Tests/TestSceneLegacyBeatmapSkin.cs | 2 ++ osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs | 2 ++ osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs | 2 ++ osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs | 2 ++ osu.Game.Rulesets.Catch/CatchInputManager.cs | 2 ++ osu.Game.Rulesets.Catch/CatchRuleset.cs | 2 ++ osu.Game.Rulesets.Catch/CatchSkinComponent.cs | 2 ++ osu.Game.Rulesets.Catch/CatchSkinComponents.cs | 2 ++ .../Difficulty/CatchDifficultyAttributes.cs | 2 ++ .../Difficulty/CatchDifficultyCalculator.cs | 2 ++ .../Difficulty/CatchPerformanceAttributes.cs | 2 ++ .../Difficulty/CatchPerformanceCalculator.cs | 2 ++ .../Difficulty/Preprocessing/CatchDifficultyHitObject.cs | 2 ++ osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs | 2 ++ osu.Game.Rulesets.Catch/Edit/BananaShowerCompositionTool.cs | 2 ++ .../Edit/Blueprints/BananaShowerPlacementBlueprint.cs | 2 ++ .../Edit/Blueprints/BananaShowerSelectionBlueprint.cs | 2 ++ .../Edit/Blueprints/CatchPlacementBlueprint.cs | 2 ++ .../Edit/Blueprints/CatchSelectionBlueprint.cs | 2 ++ .../Edit/Blueprints/Components/EditablePath.cs | 2 ++ .../Edit/Blueprints/Components/FruitOutline.cs | 2 ++ .../Edit/Blueprints/Components/NestedOutlineContainer.cs | 2 ++ .../Edit/Blueprints/Components/PlacementEditablePath.cs | 2 ++ .../Edit/Blueprints/Components/ScrollingPath.cs | 2 ++ .../Edit/Blueprints/Components/SelectionEditablePath.cs | 2 ++ .../Edit/Blueprints/Components/TimeSpanOutline.cs | 2 ++ .../Edit/Blueprints/Components/VertexPiece.cs | 2 ++ .../Edit/Blueprints/Components/VertexState.cs | 2 -- .../Edit/Blueprints/FruitPlacementBlueprint.cs | 2 ++ .../Edit/Blueprints/FruitSelectionBlueprint.cs | 2 ++ .../Edit/Blueprints/JuiceStreamPlacementBlueprint.cs | 2 ++ .../Edit/Blueprints/JuiceStreamSelectionBlueprint.cs | 2 ++ osu.Game.Rulesets.Catch/Edit/CatchBeatmapVerifier.cs | 2 ++ osu.Game.Rulesets.Catch/Edit/CatchBlueprintContainer.cs | 2 ++ osu.Game.Rulesets.Catch/Edit/CatchDistanceSnapGrid.cs | 2 ++ osu.Game.Rulesets.Catch/Edit/CatchEditorPlayfield.cs | 2 ++ osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs | 2 ++ osu.Game.Rulesets.Catch/Edit/CatchHitObjectUtils.cs | 2 ++ osu.Game.Rulesets.Catch/Edit/CatchSelectionHandler.cs | 2 ++ osu.Game.Rulesets.Catch/Edit/Checks/CheckBananaShowerGap.cs | 2 ++ osu.Game.Rulesets.Catch/Edit/DrawableCatchEditorRuleset.cs | 2 ++ osu.Game.Rulesets.Catch/Edit/FruitCompositionTool.cs | 2 ++ osu.Game.Rulesets.Catch/Edit/JuiceStreamCompositionTool.cs | 2 ++ osu.Game.Rulesets.Catch/Edit/PositionRange.cs | 2 -- osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs | 2 ++ osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs | 2 ++ osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs | 2 ++ osu.Game.Rulesets.Catch/Judgements/CatchJudgementResult.cs | 2 ++ .../Judgements/CatchTinyDropletJudgement.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModAutoplay.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModCinema.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModClassic.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModDaycore.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModDifficultyAdjust.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModDoubleTime.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModEasy.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModFloatingFruits.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModHalfTime.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModHidden.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModMirror.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModMuted.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModNightcore.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModNoFail.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModNoScope.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModPerfect.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModRelax.cs | 2 ++ osu.Game.Rulesets.Catch/Mods/CatchModSuddenDeath.cs | 2 ++ osu.Game.Rulesets.Catch/Objects/Banana.cs | 2 -- osu.Game.Rulesets.Catch/Objects/BananaShower.cs | 2 ++ osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs | 2 ++ osu.Game.Rulesets.Catch/Objects/Drawables/CaughtBanana.cs | 2 ++ osu.Game.Rulesets.Catch/Objects/Drawables/CaughtDroplet.cs | 2 ++ osu.Game.Rulesets.Catch/Objects/Drawables/CaughtFruit.cs | 2 ++ osu.Game.Rulesets.Catch/Objects/Drawables/CaughtObject.cs | 2 ++ osu.Game.Rulesets.Catch/Objects/Drawables/DrawableBanana.cs | 2 ++ .../Objects/Drawables/DrawableBananaShower.cs | 2 ++ .../Objects/Drawables/DrawableCatchHitObject.cs | 2 ++ osu.Game.Rulesets.Catch/Objects/Drawables/DrawableDroplet.cs | 2 ++ osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs | 2 ++ .../Objects/Drawables/DrawableJuiceStream.cs | 2 ++ .../Objects/Drawables/DrawablePalpableCatchHitObject.cs | 2 ++ .../Objects/Drawables/DrawableTinyDroplet.cs | 2 ++ .../Objects/Drawables/IHasCatchObjectState.cs | 2 ++ osu.Game.Rulesets.Catch/Objects/Droplet.cs | 2 ++ osu.Game.Rulesets.Catch/Objects/Fruit.cs | 2 ++ osu.Game.Rulesets.Catch/Objects/FruitVisualRepresentation.cs | 2 ++ osu.Game.Rulesets.Catch/Objects/JuiceStream.cs | 2 ++ osu.Game.Rulesets.Catch/Objects/JuiceStreamPath.cs | 2 -- osu.Game.Rulesets.Catch/Objects/JuiceStreamPathVertex.cs | 2 -- osu.Game.Rulesets.Catch/Objects/PalpableCatchHitObject.cs | 2 ++ osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs | 2 ++ osu.Game.Rulesets.Catch/Properties/AssemblyInfo.cs | 2 ++ osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs | 2 ++ .../Replays/CatchFramedReplayInputHandler.cs | 2 ++ osu.Game.Rulesets.Catch/Replays/CatchReplayFrame.cs | 2 ++ osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/CatchSkinColour.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/CatchSkinConfiguration.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/Default/BananaPiece.cs | 2 ++ .../Skinning/Default/BananaPulpFormation.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/Default/BorderPiece.cs | 2 ++ .../Skinning/Default/CatchHitObjectPiece.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/Default/DefaultCatcher.cs | 2 ++ .../Skinning/Default/DefaultHitExplosion.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/Default/DropletPiece.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/Default/FruitPiece.cs | 2 ++ .../Skinning/Default/FruitPulpFormation.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/Default/HyperBorderPiece.cs | 2 ++ .../Skinning/Default/HyperDropletBorderPiece.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/Default/Pulp.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/Default/PulpFormation.cs | 2 ++ .../Skinning/Legacy/CatchLegacySkinTransformer.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyBananaPiece.cs | 2 ++ .../Skinning/Legacy/LegacyCatchComboCounter.cs | 2 ++ .../Skinning/Legacy/LegacyCatchHitObjectPiece.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherNew.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherOld.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyDropletPiece.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyFruitPiece.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyHitExplosion.cs | 2 ++ osu.Game.Rulesets.Catch/UI/CatchComboDisplay.cs | 2 ++ osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 2 ++ .../UI/CatchPlayfieldAdjustmentContainer.cs | 2 ++ osu.Game.Rulesets.Catch/UI/CatchReplayRecorder.cs | 2 ++ osu.Game.Rulesets.Catch/UI/Catcher.cs | 2 ++ osu.Game.Rulesets.Catch/UI/CatcherAnimationState.cs | 2 ++ osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 2 ++ osu.Game.Rulesets.Catch/UI/CatcherTrail.cs | 2 ++ osu.Game.Rulesets.Catch/UI/CatcherTrailAnimation.cs | 2 ++ osu.Game.Rulesets.Catch/UI/CatcherTrailDisplay.cs | 2 ++ osu.Game.Rulesets.Catch/UI/CatcherTrailEntry.cs | 2 ++ osu.Game.Rulesets.Catch/UI/Direction.cs | 2 ++ osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs | 2 ++ osu.Game.Rulesets.Catch/UI/DroppedObjectContainer.cs | 2 ++ osu.Game.Rulesets.Catch/UI/HitExplosion.cs | 2 -- osu.Game.Rulesets.Catch/UI/HitExplosionContainer.cs | 2 ++ osu.Game.Rulesets.Catch/UI/HitExplosionEntry.cs | 2 -- osu.Game.Rulesets.Catch/UI/ICatchComboCounter.cs | 2 ++ osu.Game.Rulesets.Catch/UI/IHitExplosion.cs | 2 -- osu.Game.Rulesets.Catch/UI/SkinnableCatcher.cs | 2 ++ osu.Game.Rulesets.Mania.Tests.Android/MainActivity.cs | 2 ++ osu.Game.Rulesets.Mania.Tests.iOS/AppDelegate.cs | 2 ++ osu.Game.Rulesets.Mania.Tests.iOS/Application.cs | 2 ++ .../Editor/ManiaPlacementBlueprintTestScene.cs | 2 ++ .../Editor/ManiaSelectionBlueprintTestScene.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/Editor/TestSceneEditor.cs | 2 ++ .../Editor/TestSceneHoldNotePlacementBlueprint.cs | 2 ++ .../Editor/TestSceneHoldNoteSelectionBlueprint.cs | 2 ++ .../Editor/TestSceneManiaBeatSnapGrid.cs | 2 ++ .../Editor/TestSceneManiaComposeScreen.cs | 2 ++ .../Editor/TestSceneManiaHitObjectComposer.cs | 2 ++ .../Editor/TestSceneNotePlacementBlueprint.cs | 2 ++ .../Editor/TestSceneNoteSelectionBlueprint.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs | 2 ++ .../ManiaBeatmapSampleConversionTest.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/ManiaColumnTypeTest.cs | 2 ++ .../ManiaDifficultyCalculatorTest.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/ManiaInputTestScene.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/ManiaLegacyModConversionTest.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/ManiaLegacyReplayTest.cs | 2 ++ .../Mods/TestSceneManiaModConstantSpeed.cs | 2 ++ .../Mods/TestSceneManiaModHoldOff.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModInvert.cs | 2 ++ .../Mods/TestSceneManiaModPerfect.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/Skinning/ColumnTestContainer.cs | 2 ++ .../Skinning/ManiaHitObjectTestScene.cs | 2 ++ .../Skinning/ManiaSkinnableTestScene.cs | 2 ++ .../Skinning/TestSceneColumnBackground.cs | 2 ++ .../Skinning/TestSceneColumnHitObjectArea.cs | 2 ++ .../Skinning/TestSceneDrawableJudgement.cs | 2 ++ .../Skinning/TestSceneHitExplosion.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneHoldNote.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneKeyArea.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneNote.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/Skinning/TestScenePlayfield.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneStage.cs | 2 ++ .../Skinning/TestSceneStageBackground.cs | 2 ++ .../Skinning/TestSceneStageForeground.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/TestSceneAutoGeneration.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/TestSceneColumn.cs | 2 ++ .../TestSceneDrawableManiaHitObject.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs | 2 ++ .../TestSceneManiaHitObjectSamples.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/TestSceneManiaPlayer.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/TestSceneNotes.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/TestSceneOutOfOrderHits.cs | 2 ++ .../TestScenePlayfieldCoveringContainer.cs | 2 ++ osu.Game.Rulesets.Mania.Tests/TestSceneStage.cs | 2 ++ .../TestSceneTimingBasedNoteColouring.cs | 2 ++ osu.Game.Rulesets.Mania/Beatmaps/ColumnType.cs | 2 ++ osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs | 2 ++ osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs | 2 ++ .../Patterns/Legacy/DistanceObjectPatternGenerator.cs | 2 ++ .../Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs | 2 ++ .../Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs | 2 ++ .../Beatmaps/Patterns/Legacy/PatternGenerator.cs | 2 ++ .../Beatmaps/Patterns/Legacy/PatternType.cs | 2 ++ osu.Game.Rulesets.Mania/Beatmaps/Patterns/Pattern.cs | 2 ++ osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs | 2 ++ osu.Game.Rulesets.Mania/Beatmaps/StageDefinition.cs | 2 ++ .../Configuration/ManiaRulesetConfigManager.cs | 2 ++ .../Difficulty/ManiaDifficultyAttributes.cs | 2 ++ .../Difficulty/ManiaDifficultyCalculator.cs | 2 ++ .../Difficulty/ManiaPerformanceAttributes.cs | 2 ++ .../Difficulty/ManiaPerformanceCalculator.cs | 2 ++ .../Difficulty/Preprocessing/ManiaDifficultyHitObject.cs | 2 ++ osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs | 2 ++ osu.Game.Rulesets.Mania/DualStageVariantGenerator.cs | 2 ++ .../Edit/Blueprints/Components/EditBodyPiece.cs | 2 ++ .../Edit/Blueprints/Components/EditNotePiece.cs | 2 ++ .../Edit/Blueprints/HoldNotePlacementBlueprint.cs | 2 ++ .../Edit/Blueprints/HoldNoteSelectionBlueprint.cs | 2 ++ .../Edit/Blueprints/ManiaPlacementBlueprint.cs | 2 ++ .../Edit/Blueprints/ManiaSelectionBlueprint.cs | 2 ++ .../Edit/Blueprints/NotePlacementBlueprint.cs | 2 ++ .../Edit/Blueprints/NoteSelectionBlueprint.cs | 2 ++ osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs | 2 ++ osu.Game.Rulesets.Mania/Edit/HoldNoteCompositionTool.cs | 2 ++ osu.Game.Rulesets.Mania/Edit/ManiaBeatSnapGrid.cs | 2 ++ osu.Game.Rulesets.Mania/Edit/ManiaBlueprintContainer.cs | 2 ++ osu.Game.Rulesets.Mania/Edit/ManiaEditorPlayfield.cs | 2 ++ osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs | 2 ++ osu.Game.Rulesets.Mania/Edit/ManiaSelectionHandler.cs | 2 ++ osu.Game.Rulesets.Mania/Edit/NoteCompositionTool.cs | 2 ++ osu.Game.Rulesets.Mania/Edit/Setup/ManiaSetupSection.cs | 2 ++ osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs | 2 ++ osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs | 2 ++ osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs | 2 ++ osu.Game.Rulesets.Mania/ManiaInputManager.cs | 2 ++ osu.Game.Rulesets.Mania/ManiaRuleset.cs | 2 ++ osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs | 2 ++ osu.Game.Rulesets.Mania/ManiaSkinComponent.cs | 2 ++ osu.Game.Rulesets.Mania/MathUtils/LegacySortHelper.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/IPlayfieldTypeMod.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModAutoplay.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModCinema.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModClassic.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModConstantSpeed.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModDaycore.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModDifficultyAdjust.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModDoubleTime.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModEasy.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModFadeIn.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModHalfTime.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModHardRock.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModHidden.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModInvert.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModKey1.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModKey10.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModKey2.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModKey3.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModKey4.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModKey5.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModKey6.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModKey7.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModKey8.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModKey9.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModMuted.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModNightcore.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModNoFail.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModPlayfieldCover.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs | 2 ++ osu.Game.Rulesets.Mania/Mods/ManiaModSuddenDeath.cs | 2 ++ osu.Game.Rulesets.Mania/Objects/BarLine.cs | 2 ++ osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs | 2 ++ osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs | 2 ++ .../Objects/Drawables/DrawableHoldNoteHead.cs | 2 ++ .../Objects/Drawables/DrawableHoldNoteTail.cs | 2 ++ .../Objects/Drawables/DrawableHoldNoteTick.cs | 2 ++ .../Objects/Drawables/DrawableManiaHitObject.cs | 2 ++ osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs | 2 ++ osu.Game.Rulesets.Mania/Objects/HeadNote.cs | 2 ++ osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 2 ++ osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs | 2 ++ osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs | 2 ++ osu.Game.Rulesets.Mania/Objects/Note.cs | 2 ++ osu.Game.Rulesets.Mania/Objects/TailNote.cs | 2 ++ osu.Game.Rulesets.Mania/Properties/AssemblyInfo.cs | 2 ++ osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs | 2 ++ .../Replays/ManiaFramedReplayInputHandler.cs | 2 ++ osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs | 2 ++ osu.Game.Rulesets.Mania/Scoring/ManiaHealthProcessor.cs | 2 ++ osu.Game.Rulesets.Mania/Scoring/ManiaHitWindows.cs | 2 ++ osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs | 2 ++ osu.Game.Rulesets.Mania/SingleStageVariantGenerator.cs | 2 ++ osu.Game.Rulesets.Mania/Skinning/Default/DefaultBodyPiece.cs | 2 ++ osu.Game.Rulesets.Mania/Skinning/Default/DefaultNotePiece.cs | 2 ++ osu.Game.Rulesets.Mania/Skinning/Default/IHoldNoteBody.cs | 2 ++ .../Skinning/Legacy/HitTargetInsetContainer.cs | 2 ++ osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyBodyPiece.cs | 2 ++ .../Skinning/Legacy/LegacyColumnBackground.cs | 2 ++ osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHitExplosion.cs | 2 ++ osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHitTarget.cs | 2 ++ .../Skinning/Legacy/LegacyHoldNoteHeadPiece.cs | 2 ++ .../Skinning/Legacy/LegacyHoldNoteTailPiece.cs | 2 ++ osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyKeyArea.cs | 2 ++ .../Skinning/Legacy/LegacyManiaColumnElement.cs | 2 ++ .../Skinning/Legacy/LegacyManiaJudgementPiece.cs | 2 ++ osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs | 2 ++ .../Skinning/Legacy/LegacyStageBackground.cs | 2 ++ .../Skinning/Legacy/LegacyStageForeground.cs | 2 ++ .../Skinning/Legacy/ManiaLegacySkinTransformer.cs | 2 ++ osu.Game.Rulesets.Mania/Skinning/ManiaSkinConfigExtensions.cs | 2 ++ .../Skinning/ManiaSkinConfigurationLookup.cs | 2 ++ osu.Game.Rulesets.Mania/UI/Column.cs | 2 ++ osu.Game.Rulesets.Mania/UI/ColumnFlow.cs | 2 ++ osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs | 2 ++ osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs | 2 ++ .../UI/Components/DefaultColumnBackground.cs | 2 ++ osu.Game.Rulesets.Mania/UI/Components/DefaultHitTarget.cs | 2 ++ osu.Game.Rulesets.Mania/UI/Components/DefaultKeyArea.cs | 2 ++ .../UI/Components/DefaultStageBackground.cs | 2 ++ osu.Game.Rulesets.Mania/UI/Components/HitObjectArea.cs | 2 ++ osu.Game.Rulesets.Mania/UI/DefaultHitExplosion.cs | 2 ++ osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs | 2 ++ osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs | 2 ++ osu.Game.Rulesets.Mania/UI/IHitExplosion.cs | 2 ++ osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 2 ++ .../UI/ManiaPlayfieldAdjustmentContainer.cs | 2 ++ osu.Game.Rulesets.Mania/UI/ManiaReplayRecorder.cs | 2 ++ osu.Game.Rulesets.Mania/UI/ManiaScrollingDirection.cs | 2 ++ osu.Game.Rulesets.Mania/UI/OrderedHitPolicy.cs | 2 ++ osu.Game.Rulesets.Mania/UI/PlayfieldCoveringWrapper.cs | 2 ++ osu.Game.Rulesets.Mania/UI/PoolableHitExplosion.cs | 2 ++ osu.Game.Rulesets.Mania/UI/Stage.cs | 2 ++ osu.Game.Rulesets.Mania/VariantMappingGenerator.cs | 2 ++ osu.Game.Rulesets.Osu.Tests.Android/MainActivity.cs | 2 ++ osu.Game.Rulesets.Osu.Tests.iOS/AppDelegate.cs | 2 ++ osu.Game.Rulesets.Osu.Tests.iOS/Application.cs | 2 ++ .../Editor/Checks/CheckLowDiffOverlapsTest.cs | 2 ++ .../Editor/Checks/CheckOffscreenObjectsTest.cs | 2 ++ .../Editor/Checks/CheckTimeDistanceEqualityTest.cs | 2 ++ .../Editor/Checks/CheckTooShortSlidersTest.cs | 2 ++ .../Editor/Checks/CheckTooShortSpinnersTest.cs | 2 ++ .../Editor/TestSceneHitCirclePlacementBlueprint.cs | 2 ++ .../Editor/TestSceneHitCircleSelectionBlueprint.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectBeatSnap.cs | 2 ++ .../Editor/TestSceneObjectObjectSnap.cs | 2 ++ .../Editor/TestSceneOsuDistanceSnapGrid.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditor.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditorGrids.cs | 2 ++ .../Editor/TestSceneOsuEditorSelectInvalidPath.cs | 2 ++ .../Editor/TestScenePathControlPointVisualiser.cs | 2 ++ .../Editor/TestSceneSliderControlPointPiece.cs | 2 ++ .../Editor/TestSceneSliderLengthValidity.cs | 2 ++ .../Editor/TestSceneSliderPlacementBlueprint.cs | 2 ++ .../Editor/TestSceneSliderSelectionBlueprint.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs | 2 ++ .../Editor/TestSceneSliderStreamConversion.cs | 2 ++ .../Editor/TestSceneSliderVelocityAdjust.cs | 2 ++ .../Editor/TestSceneSpinnerPlacementBlueprint.cs | 2 ++ .../Editor/TestSceneSpinnerSelectionBlueprint.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/Editor/TestSliderScaling.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs | 2 -- osu.Game.Rulesets.Osu.Tests/Mods/OsuModTestScene.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAlternate.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAutoplay.cs | 2 ++ .../Mods/TestSceneOsuModDifficultyAdjust.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModDoubleTime.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModHidden.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMuted.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModNoScope.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModPerfect.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSpunOut.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/OsuLegacyModConversionTest.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/OsuSkinnableTestScene.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/StackingTest.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestPlayfieldBorder.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneAccuracyHeatmap.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneCursorParticles.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneCursorTrail.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneDrawableJudgement.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneFollowPoints.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneHitCircle.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleApplication.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleArea.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleComboChange.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleHidden.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleKiai.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLongCombo.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs | 2 ++ .../TestSceneMissHitWindowJudgements.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneNoSpinnerStacking.cs | 2 ++ .../TestSceneObjectOrderedHitPolicy.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneOsuFlashlight.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneOsuHitObjectSamples.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneOsuPlayer.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneResumeOverlay.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneShaking.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneSkinFallbacks.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneSlider.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneSliderApplication.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneSliderComboChange.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneSliderHidden.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerApplication.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerHidden.cs | 2 ++ osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs | 2 ++ .../TestSceneStartTimeOrderedHitPolicy.cs | 2 ++ osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs | 2 ++ osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs | 2 ++ osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs | 2 ++ .../Configuration/OsuRulesetConfigManager.cs | 2 ++ osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs | 2 ++ .../Difficulty/Evaluators/FlashlightEvaluator.cs | 2 ++ .../Difficulty/Evaluators/RhythmEvaluator.cs | 2 ++ osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs | 2 ++ osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs | 2 ++ osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 2 ++ osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceAttributes.cs | 2 ++ osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs | 2 ++ .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 2 ++ osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 2 ++ osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 2 ++ osu.Game.Rulesets.Osu/Difficulty/Skills/OsuStrainSkill.cs | 2 ++ osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs | 2 ++ osu.Game.Rulesets.Osu/Edit/Blueprints/BlueprintPiece.cs | 2 ++ .../HitCircles/Components/HitCircleOverlapMarker.cs | 2 ++ .../Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs | 2 ++ .../Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs | 2 ++ .../Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs | 2 ++ .../Edit/Blueprints/OsuSelectionBlueprint.cs | 2 ++ .../Sliders/Components/PathControlPointConnectionPiece.cs | 2 ++ .../Blueprints/Sliders/Components/PathControlPointPiece.cs | 2 ++ .../Sliders/Components/PathControlPointVisualiser.cs | 2 ++ .../Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs | 2 ++ .../Edit/Blueprints/Sliders/SliderCircleOverlay.cs | 2 ++ .../Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs | 2 ++ .../Edit/Blueprints/Sliders/SliderPosition.cs | 2 ++ .../Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs | 2 ++ .../Edit/Blueprints/Spinners/Components/SpinnerPiece.cs | 2 ++ .../Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs | 2 ++ .../Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs | 2 ++ osu.Game.Rulesets.Osu/Edit/Checks/CheckLowDiffOverlaps.cs | 2 ++ osu.Game.Rulesets.Osu/Edit/Checks/CheckOffscreenObjects.cs | 2 ++ .../Edit/Checks/CheckTimeDistanceEquality.cs | 2 ++ osu.Game.Rulesets.Osu/Edit/Checks/CheckTooShortSliders.cs | 2 ++ osu.Game.Rulesets.Osu/Edit/Checks/CheckTooShortSpinners.cs | 2 ++ osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs | 2 ++ osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs | 2 ++ osu.Game.Rulesets.Osu/Edit/OsuBeatmapVerifier.cs | 2 ++ osu.Game.Rulesets.Osu/Edit/OsuBlueprintContainer.cs | 2 ++ osu.Game.Rulesets.Osu/Edit/OsuDistanceSnapGrid.cs | 2 ++ osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 2 ++ osu.Game.Rulesets.Osu/Edit/OsuRectangularPositionSnapGrid.cs | 2 ++ osu.Game.Rulesets.Osu/Edit/OsuSelectionHandler.cs | 2 -- osu.Game.Rulesets.Osu/Edit/Setup/OsuSetupSection.cs | 2 ++ osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs | 2 ++ osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs | 2 ++ osu.Game.Rulesets.Osu/Judgements/ComboResult.cs | 2 ++ .../Judgements/OsuHitCircleJudgementResult.cs | 2 ++ osu.Game.Rulesets.Osu/Judgements/OsuIgnoreJudgement.cs | 2 ++ osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs | 2 ++ osu.Game.Rulesets.Osu/Judgements/OsuJudgementResult.cs | 2 ++ osu.Game.Rulesets.Osu/Judgements/OsuSpinnerJudgementResult.cs | 2 ++ osu.Game.Rulesets.Osu/Judgements/SliderTickJudgement.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/IHidesApproachCircles.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/IRequiresApproachCircles.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModBarrelRoll.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModDaycore.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModDeflate.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModDoubleTime.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModEasy.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModHalfTime.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModMirror.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModMuted.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModNightcore.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModNoFail.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModNoScope.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModObjectScaleTween.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModPerfect.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs | 2 -- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModSpinIn.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModSuddenDeath.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModTouchDevice.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModTraceable.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 2 ++ osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 2 ++ .../Objects/Drawables/Connections/FollowPoint.cs | 2 ++ .../Objects/Drawables/Connections/FollowPointConnection.cs | 2 ++ .../Objects/Drawables/Connections/FollowPointLifetimeEntry.cs | 2 -- .../Objects/Drawables/Connections/FollowPointRenderer.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs | 2 ++ .../Objects/Drawables/DrawableOsuHitObject.cs | 2 ++ .../Objects/Drawables/DrawableOsuJudgement.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs | 2 ++ .../Objects/Drawables/DrawableSliderRepeat.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 2 ++ .../Objects/Drawables/DrawableSpinnerBonusTick.cs | 2 ++ .../Objects/Drawables/DrawableSpinnerTick.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/Drawables/IRequireTracking.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/Drawables/ITrackSnaking.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/Drawables/SkinnableLighting.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/HitCircle.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/ISliderProgress.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/SliderEndCircle.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/SliderHeadCircle.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/SliderRepeat.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/SliderTick.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/Spinner.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/SpinnerBonusTick.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs | 2 ++ osu.Game.Rulesets.Osu/OsuInputManager.cs | 2 ++ osu.Game.Rulesets.Osu/OsuRuleset.cs | 2 ++ osu.Game.Rulesets.Osu/OsuSkinComponent.cs | 2 ++ osu.Game.Rulesets.Osu/OsuSkinComponents.cs | 2 ++ osu.Game.Rulesets.Osu/Properties/AssemblyInfo.cs | 2 ++ osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs | 2 ++ osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs | 2 ++ osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs | 2 ++ osu.Game.Rulesets.Osu/Replays/OsuReplayFrame.cs | 2 ++ osu.Game.Rulesets.Osu/Scoring/OsuHitWindows.cs | 2 ++ osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/CirclePiece.cs | 2 ++ .../Skinning/Default/DefaultApproachCircle.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinner.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinnerDisc.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/DrawableSliderPath.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/ExplodePiece.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/FlashPiece.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/GlowPiece.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/IHasMainCirclePiece.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/KiaiFlash.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/MainCirclePiece.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/ManualSliderBody.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/NumberPiece.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/PlaySliderBody.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/ReverseArrowPiece.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/RingPiece.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/SliderBody.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/SnakingSliderBody.cs | 2 ++ .../Skinning/Default/SpinnerBackgroundLayer.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/SpinnerCentreLayer.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/SpinnerFill.cs | 2 ++ .../Skinning/Default/SpinnerRotationTracker.cs | 2 ++ .../Skinning/Default/SpinnerSpmCalculator.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/SpinnerTicks.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Default/TrianglesPiece.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/IHasApproachCircle.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Legacy/KiaiFlashingDrawable.cs | 2 -- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyApproachCircle.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursor.cs | 2 ++ .../Skinning/Legacy/LegacyCursorParticles.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs | 2 ++ .../Skinning/Legacy/LegacyMainCirclePiece.cs | 2 -- .../Skinning/Legacy/LegacyNewStyleSpinner.cs | 2 ++ .../Skinning/Legacy/LegacyOldStyleSpinner.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyReverseArrow.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs | 2 ++ .../Skinning/Legacy/LegacySliderHeadHitCircle.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySpinner.cs | 2 ++ .../Skinning/Legacy/OsuLegacySkinTransformer.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/NonPlayfieldSprite.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/OsuSkinColour.cs | 2 ++ osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs | 2 ++ osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs | 2 ++ osu.Game.Rulesets.Osu/UI/AnyOrderHitPolicy.cs | 2 ++ osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs | 2 ++ osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs | 2 ++ osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs | 2 ++ osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorSprite.cs | 2 ++ osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs | 2 ++ osu.Game.Rulesets.Osu/UI/IHitPolicy.cs | 2 ++ osu.Game.Rulesets.Osu/UI/ObjectOrderedHitPolicy.cs | 2 ++ osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 2 ++ osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs | 2 ++ osu.Game.Rulesets.Osu/UI/OsuReplayRecorder.cs | 2 ++ osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs | 2 ++ osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs | 2 ++ osu.Game.Rulesets.Osu/UI/StartTimeOrderedHitPolicy.cs | 2 ++ osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs | 2 ++ .../Utils/OsuHitObjectGenerationUtils_Reposition.cs | 2 -- osu.Game.Rulesets.Taiko.Tests.Android/MainActivity.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests.iOS/AppDelegate.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests.iOS/Application.cs | 2 ++ .../DrawableTaikoRulesetTestScene.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/DrawableTestHit.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/DrawableTestStrongHit.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneEditor.cs | 2 ++ .../Editor/TestSceneTaikoEditorSaving.cs | 2 ++ .../Editor/TestSceneTaikoHitObjectComposer.cs | 2 ++ .../HitObjectApplicationTestScene.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/Mods/TaikoModTestScene.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModHidden.cs | 2 ++ .../Mods/TestSceneTaikoModPerfect.cs | 2 ++ .../Skinning/TaikoSkinnableTestScene.cs | 2 ++ .../Skinning/TestSceneDrawableBarLine.cs | 2 ++ .../Skinning/TestSceneDrawableDrumRoll.cs | 2 ++ .../Skinning/TestSceneDrawableHit.cs | 2 ++ .../Skinning/TestSceneDrawableTaikoMascot.cs | 2 ++ .../Skinning/TestSceneHitExplosion.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneInputDrum.cs | 2 ++ .../Skinning/TestSceneKiaiHitExplosion.cs | 2 ++ .../Skinning/TestSceneTaikoPlayfield.cs | 2 ++ .../Skinning/TestSceneTaikoScroller.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs | 2 ++ .../TaikoDifficultyCalculatorTest.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/TaikoLegacyModConversionTest.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/TestSceneBarLineApplication.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/TestSceneDrumRollApplication.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/TestSceneDrumRollJudgements.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/TestSceneFlyingHits.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/TestSceneHitApplication.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/TestSceneHits.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/TestSceneSampleOutput.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/TestSceneSwellJudgements.cs | 2 ++ .../TestSceneTaikoHitObjectSamples.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayer.cs | 2 ++ osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs | 2 ++ osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs | 2 ++ osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 2 ++ .../Difficulty/Preprocessing/TaikoDifficultyHitObject.cs | 2 ++ .../Preprocessing/TaikoDifficultyHitObjectRhythm.cs | 2 ++ osu.Game.Rulesets.Taiko/Difficulty/Skills/Colour.cs | 2 ++ osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs | 2 ++ osu.Game.Rulesets.Taiko/Difficulty/Skills/SingleKeyStamina.cs | 2 ++ osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs | 2 ++ .../Difficulty/TaikoDifficultyAttributes.cs | 2 ++ .../Difficulty/TaikoDifficultyCalculator.cs | 2 ++ .../Difficulty/TaikoPerformanceAttributes.cs | 2 ++ .../Difficulty/TaikoPerformanceCalculator.cs | 2 ++ .../Edit/Blueprints/DrumRollPlacementBlueprint.cs | 2 ++ osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPiece.cs | 2 ++ .../Edit/Blueprints/HitPlacementBlueprint.cs | 2 ++ osu.Game.Rulesets.Taiko/Edit/Blueprints/LengthPiece.cs | 2 ++ .../Edit/Blueprints/SwellPlacementBlueprint.cs | 2 ++ .../Edit/Blueprints/TaikoSelectionBlueprint.cs | 2 ++ .../Edit/Blueprints/TaikoSpanPlacementBlueprint.cs | 2 ++ osu.Game.Rulesets.Taiko/Edit/DrumRollCompositionTool.cs | 2 ++ osu.Game.Rulesets.Taiko/Edit/HitCompositionTool.cs | 2 ++ osu.Game.Rulesets.Taiko/Edit/SwellCompositionTool.cs | 2 ++ osu.Game.Rulesets.Taiko/Edit/TaikoBlueprintContainer.cs | 2 ++ osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs | 2 ++ osu.Game.Rulesets.Taiko/Edit/TaikoSelectionHandler.cs | 2 ++ osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollJudgement.cs | 2 ++ .../Judgements/TaikoDrumRollTickJudgement.cs | 2 ++ osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs | 2 ++ osu.Game.Rulesets.Taiko/Judgements/TaikoStrongJudgement.cs | 2 ++ osu.Game.Rulesets.Taiko/Judgements/TaikoSwellJudgement.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModAutoplay.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModCinema.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModClassic.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModDaycore.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModDifficultyAdjust.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModDoubleTime.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModEasy.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModHalfTime.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModHardRock.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModMuted.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModNightcore.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModNoFail.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModPerfect.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModRandom.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModRelax.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModSuddenDeath.cs | 2 ++ osu.Game.Rulesets.Taiko/Mods/TaikoModSwap.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/BarLine.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs | 2 ++ .../Objects/Drawables/DrawableDrumRollTick.cs | 2 ++ .../Objects/Drawables/DrawableFlyingHit.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs | 2 ++ .../Objects/Drawables/DrawableStrongNestedHit.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs | 2 ++ .../Objects/Drawables/DrawableSwellTick.cs | 2 ++ .../Objects/Drawables/DrawableTaikoHitObject.cs | 2 ++ .../Objects/Drawables/DrawableTaikoStrongableHitObject.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/Hit.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/HitType.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/IgnoreHit.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/StrongNestedHitObject.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/Swell.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/SwellTick.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/TaikoStrongableHitObject.cs | 2 ++ osu.Game.Rulesets.Taiko/Properties/AssemblyInfo.cs | 2 ++ osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs | 2 ++ .../Replays/TaikoFramedReplayInputHandler.cs | 2 ++ osu.Game.Rulesets.Taiko/Replays/TaikoReplayFrame.cs | 2 ++ osu.Game.Rulesets.Taiko/Scoring/TaikoHealthProcessor.cs | 2 ++ osu.Game.Rulesets.Taiko/Scoring/TaikoHitWindows.cs | 2 ++ osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs | 2 ++ .../Skinning/Default/CentreHitCirclePiece.cs | 2 ++ osu.Game.Rulesets.Taiko/Skinning/Default/CirclePiece.cs | 2 ++ .../Skinning/Default/ElongatedCirclePiece.cs | 2 ++ osu.Game.Rulesets.Taiko/Skinning/Default/RimHitCirclePiece.cs | 2 ++ osu.Game.Rulesets.Taiko/Skinning/Default/SwellSymbolPiece.cs | 2 ++ osu.Game.Rulesets.Taiko/Skinning/Default/TickPiece.cs | 2 ++ osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyBarLine.cs | 2 ++ osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyCirclePiece.cs | 2 ++ osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyDrumRoll.cs | 2 ++ osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyHit.cs | 2 ++ osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyHitExplosion.cs | 2 ++ osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyInputDrum.cs | 2 ++ .../Skinning/Legacy/LegacyTaikoScroller.cs | 2 ++ .../Skinning/Legacy/TaikoLegacyHitTarget.cs | 2 ++ .../Skinning/Legacy/TaikoLegacyPlayfieldBackgroundRight.cs | 2 ++ .../Skinning/Legacy/TaikoLegacySkinTransformer.cs | 2 ++ osu.Game.Rulesets.Taiko/TaikoInputManager.cs | 2 ++ osu.Game.Rulesets.Taiko/TaikoRuleset.cs | 2 ++ osu.Game.Rulesets.Taiko/TaikoSkinComponent.cs | 2 ++ osu.Game.Rulesets.Taiko/TaikoSkinComponents.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/BarLinePlayfield.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/DefaultHitExplosion.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/DefaultKiaiHitExplosion.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/DrawableTaikoMascot.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/DrumRollHitContainer.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/DrumSampleTriggerSource.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/HitExplosion.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/HitExplosionPool.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/IAnimatableHitExplosion.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/InputDrum.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/PlayfieldBackgroundLeft.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/PlayfieldBackgroundRight.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/TaikoHitTarget.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimationState.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 2 ++ .../UI/TaikoPlayfieldAdjustmentContainer.cs | 2 ++ osu.Game.Rulesets.Taiko/UI/TaikoReplayRecorder.cs | 2 ++ osu.Game.Tests.Android/MainActivity.cs | 2 ++ osu.Game.Tests.iOS/AppDelegate.cs | 2 ++ osu.Game.Tests.iOS/Application.cs | 2 ++ osu.Game.Tests/Audio/SampleInfoEqualityTest.cs | 2 ++ osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs | 2 ++ osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapEncoderTest.cs | 2 ++ osu.Game.Tests/Beatmaps/Formats/LegacyDecoderTest.cs | 2 ++ osu.Game.Tests/Beatmaps/Formats/LegacyScoreDecoderTest.cs | 2 ++ .../Beatmaps/Formats/LegacyStoryboardDecoderTest.cs | 2 ++ osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs | 2 ++ osu.Game.Tests/Beatmaps/Formats/ParsingTest.cs | 2 ++ osu.Game.Tests/Beatmaps/IO/BeatmapImportHelper.cs | 2 ++ osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs | 2 ++ osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs | 2 ++ osu.Game.Tests/Beatmaps/SliderEventGenerationTest.cs | 2 ++ osu.Game.Tests/Beatmaps/TestSceneBeatmapDifficultyCache.cs | 2 ++ osu.Game.Tests/Beatmaps/TestSceneEditorBeatmap.cs | 2 ++ osu.Game.Tests/Beatmaps/ToStringFormattingTest.cs | 2 ++ osu.Game.Tests/Beatmaps/WorkingBeatmapTest.cs | 2 ++ osu.Game.Tests/Chat/MessageFormatterTests.cs | 2 ++ osu.Game.Tests/Chat/TestSceneChannelManager.cs | 2 ++ osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs | 2 ++ osu.Game.Tests/Database/BeatmapImporterTests.cs | 2 -- osu.Game.Tests/Database/FileStoreTests.cs | 2 -- osu.Game.Tests/Database/GeneralUsageTests.cs | 2 -- osu.Game.Tests/Database/LegacyBeatmapImporterTest.cs | 2 ++ osu.Game.Tests/Database/RealmLiveTests.cs | 2 -- osu.Game.Tests/Database/RealmSubscriptionRegistrationTests.cs | 2 -- osu.Game.Tests/Database/RealmTest.cs | 2 -- osu.Game.Tests/Database/RulesetStoreTests.cs | 2 ++ osu.Game.Tests/Database/TestRealmKeyBindingStore.cs | 2 ++ osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs | 2 ++ osu.Game.Tests/Editing/Checks/CheckAudioQualityTest.cs | 2 ++ osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs | 2 ++ osu.Game.Tests/Editing/Checks/CheckConcurrentObjectsTest.cs | 2 ++ osu.Game.Tests/Editing/Checks/CheckFewHitsoundsTest.cs | 2 ++ osu.Game.Tests/Editing/Checks/CheckFilePresenceTest.cs | 2 ++ osu.Game.Tests/Editing/Checks/CheckMutedObjectsTest.cs | 2 ++ osu.Game.Tests/Editing/Checks/CheckTestHelpers.cs | 2 ++ osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs | 2 ++ osu.Game.Tests/Editing/Checks/CheckUnsnappedObjectsTest.cs | 2 ++ osu.Game.Tests/Editing/Checks/CheckZeroByteFilesTest.cs | 2 ++ osu.Game.Tests/Editing/Checks/CheckZeroLengthObjectsTest.cs | 2 ++ osu.Game.Tests/Editing/Checks/MockNestableHitObject.cs | 2 ++ osu.Game.Tests/Editing/EditorChangeHandlerTest.cs | 2 ++ osu.Game.Tests/Editing/LegacyEditorBeatmapPatcherTest.cs | 2 ++ .../Editing/TestSceneHitObjectComposerDistanceSnapping.cs | 2 ++ .../Editing/TestSceneHitObjectContainerEventBuffer.cs | 2 ++ osu.Game.Tests/Editing/TransactionalCommitComponentTest.cs | 2 ++ osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs | 2 ++ osu.Game.Tests/Gameplay/TestSceneDrawableHitObject.cs | 2 ++ osu.Game.Tests/Gameplay/TestSceneHitObjectAccentColour.cs | 2 ++ osu.Game.Tests/Gameplay/TestSceneHitObjectContainer.cs | 2 ++ osu.Game.Tests/Gameplay/TestSceneHitObjectSamples.cs | 2 ++ .../Gameplay/TestSceneMasterGameplayClockContainer.cs | 2 ++ osu.Game.Tests/Gameplay/TestSceneProxyContainer.cs | 2 ++ osu.Game.Tests/Gameplay/TestSceneScoreProcessor.cs | 2 ++ osu.Game.Tests/Gameplay/TestSceneStoryboardSamples.cs | 2 ++ osu.Game.Tests/ImportTest.cs | 2 ++ osu.Game.Tests/Input/ConfineMouseTrackerTest.cs | 2 ++ .../Localisation/BeatmapMetadataRomanisationTest.cs | 2 ++ osu.Game.Tests/Models/DisplayStringTest.cs | 2 -- osu.Game.Tests/Mods/ModDifficultyAdjustTest.cs | 2 ++ osu.Game.Tests/Mods/ModSettingsEqualityComparison.cs | 2 ++ osu.Game.Tests/Mods/ModSettingsTest.cs | 2 ++ osu.Game.Tests/Mods/ModUtilsTest.cs | 2 ++ osu.Game.Tests/Mods/MultiModIncompatibilityTest.cs | 2 ++ osu.Game.Tests/Mods/SettingsSourceAttributeTest.cs | 2 ++ osu.Game.Tests/Mods/TestCustomisableModRuleset.cs | 2 ++ osu.Game.Tests/NonVisual/BarLineGeneratorTest.cs | 2 ++ osu.Game.Tests/NonVisual/BeatmapSetInfoEqualityTest.cs | 2 ++ osu.Game.Tests/NonVisual/ClosestBeatDivisorTest.cs | 2 ++ osu.Game.Tests/NonVisual/ControlPointInfoTest.cs | 2 ++ osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs | 2 ++ .../NonVisual/DifficultyAdjustmentModCombinationsTest.cs | 2 ++ osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs | 2 ++ osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs | 2 ++ osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs | 2 ++ osu.Game.Tests/NonVisual/FormatUtilsTest.cs | 2 ++ osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs | 2 ++ osu.Game.Tests/NonVisual/GameplayClockTest.cs | 2 ++ osu.Game.Tests/NonVisual/LimitedCapacityQueueTest.cs | 2 ++ .../NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs | 2 ++ osu.Game.Tests/NonVisual/OngoingOperationTrackerTest.cs | 2 ++ osu.Game.Tests/NonVisual/PeriodTrackerTest.cs | 2 ++ osu.Game.Tests/NonVisual/Ranking/UnstableRateTest.cs | 2 ++ osu.Game.Tests/NonVisual/ReverseQueueTest.cs | 2 ++ osu.Game.Tests/NonVisual/RulesetInfoOrderingTest.cs | 2 ++ osu.Game.Tests/NonVisual/ScoreInfoTest.cs | 2 ++ osu.Game.Tests/NonVisual/SessionStaticsTest.cs | 2 ++ osu.Game.Tests/NonVisual/Skinning/LegacySkinAnimationTest.cs | 2 ++ .../NonVisual/Skinning/LegacySkinTextureFallbackTest.cs | 2 ++ osu.Game.Tests/NonVisual/TaskChainTest.cs | 2 ++ osu.Game.Tests/NonVisual/TimeDisplayExtensionTest.cs | 2 ++ osu.Game.Tests/Online/Chat/MessageNotifierTest.cs | 2 ++ osu.Game.Tests/Online/TestAPIModJsonSerialization.cs | 2 ++ osu.Game.Tests/Online/TestAPIModMessagePackSerialization.cs | 2 ++ osu.Game.Tests/Online/TestDummyAPIRequestHandling.cs | 2 ++ .../Online/TestMultiplayerMessagePackSerialization.cs | 2 ++ osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs | 2 ++ .../Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs | 2 ++ .../Online/TestSubmittableScoreJsonSerialization.cs | 2 ++ osu.Game.Tests/OnlinePlay/PlaylistExtensionsTest.cs | 2 ++ osu.Game.Tests/OnlinePlay/TestSceneCatchUpSyncManager.cs | 2 ++ osu.Game.Tests/Resources/TestResources.cs | 2 ++ osu.Game.Tests/Rulesets/Mods/ModTimeRampTest.cs | 2 ++ osu.Game.Tests/Rulesets/Scoring/ScoreProcessorTest.cs | 2 ++ .../Rulesets/TestSceneDrawableRulesetDependencies.cs | 2 ++ .../Rulesets/TestSceneRulesetSkinProvidingContainer.cs | 2 ++ osu.Game.Tests/Scores/IO/ImportScoreTest.cs | 2 ++ osu.Game.Tests/Scores/IO/TestScoreEquality.cs | 2 ++ osu.Game.Tests/ScrollAlgorithms/ConstantScrollTest.cs | 2 ++ osu.Game.Tests/ScrollAlgorithms/OverlappingScrollTest.cs | 2 ++ osu.Game.Tests/ScrollAlgorithms/SequentialScrollTest.cs | 2 ++ osu.Game.Tests/Skins/IO/ImportSkinTest.cs | 2 ++ osu.Game.Tests/Skins/LegacyManiaSkinDecoderTest.cs | 2 ++ osu.Game.Tests/Skins/LegacySkinDecoderTest.cs | 2 ++ osu.Game.Tests/Skins/TestSceneBeatmapSkinLookupDisables.cs | 2 ++ osu.Game.Tests/Skins/TestSceneBeatmapSkinResources.cs | 2 ++ osu.Game.Tests/Skins/TestSceneSkinConfigurationLookup.cs | 2 ++ osu.Game.Tests/Skins/TestSceneSkinProvidingContainer.cs | 2 ++ osu.Game.Tests/Skins/TestSceneSkinResources.cs | 2 ++ osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs | 2 ++ osu.Game.Tests/Utils/NamingUtilsTest.cs | 2 ++ osu.Game.Tests/Visual/Audio/TestSceneAudioFilter.cs | 2 ++ .../Visual/Background/TestSceneBackgroundScreenDefault.cs | 2 ++ .../Visual/Background/TestSceneSeasonalBackgroundLoader.cs | 2 ++ .../Visual/Background/TestSceneUserDimBackgrounds.cs | 2 ++ osu.Game.Tests/Visual/Background/TestSceneUserDimContainer.cs | 2 ++ osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs | 2 ++ .../Visual/Beatmaps/TestSceneBeatmapCardDifficultyList.cs | 2 ++ .../Visual/Beatmaps/TestSceneBeatmapCardDownloadButton.cs | 2 ++ .../Visual/Beatmaps/TestSceneBeatmapCardFavouriteButton.cs | 2 ++ .../Visual/Beatmaps/TestSceneBeatmapCardThumbnail.cs | 2 ++ .../Visual/Beatmaps/TestSceneBeatmapSetOnlineStatusPill.cs | 2 ++ .../Visual/Beatmaps/TestSceneDifficultySpectrumDisplay.cs | 2 ++ .../Visual/Collections/TestSceneManageCollectionsDialog.cs | 2 ++ .../Visual/Colours/TestSceneStarDifficultyColours.cs | 2 ++ osu.Game.Tests/Visual/Components/TestSceneIdleTracker.cs | 2 ++ osu.Game.Tests/Visual/Components/TestScenePollingComponent.cs | 2 ++ .../Visual/Components/TestScenePreviewTrackManager.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneBlueprintOrdering.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneComposeSelectBox.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneDesignSection.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneDifficultySwitching.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs | 2 ++ .../Visual/Editing/TestSceneEditorBeatmapCreation.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneEditorChangeStates.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneEditorClipboard.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs | 2 ++ .../Visual/Editing/TestSceneEditorComposeRadioButtons.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneEditorMenuBar.cs | 2 ++ .../Visual/Editing/TestSceneEditorSamplePlayback.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneEditorScreenModes.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneEditorSeekSnapping.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs | 2 ++ .../Visual/Editing/TestSceneEditorSummaryTimeline.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneEditorTestGameplay.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs | 2 ++ .../Editing/TestSceneHitObjectDifficultyPointAdjustments.cs | 2 ++ .../Editing/TestSceneHitObjectSamplePointAdjustments.cs | 2 ++ .../Visual/Editing/TestSceneLabelledTimeSignature.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneMetadataSection.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestScenePlaybackControl.cs | 2 ++ .../Visual/Editing/TestSceneRectangularPositionSnapGrid.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneSetupScreen.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneTapButton.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs | 2 ++ .../Visual/Editing/TestSceneTimelineBlueprintContainer.cs | 2 ++ .../Visual/Editing/TestSceneTimelineHitObjectBlueprint.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneTimelineSelection.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneTimelineTickDisplay.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs | 2 ++ osu.Game.Tests/Visual/Editing/TestSceneWaveform.cs | 2 ++ .../Visual/Editing/TestSceneZoomableScrollContainer.cs | 2 ++ osu.Game.Tests/Visual/Editing/TimelineTestScene.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/OsuPlayerTestScene.cs | 2 ++ .../Visual/Gameplay/SkinnableHUDComponentTestScene.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneAllRulesetPlayers.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs | 2 ++ .../Visual/Gameplay/TestSceneBeatmapOffsetControl.cs | 2 ++ .../Visual/Gameplay/TestSceneBeatmapSkinFallbacks.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneBreakTracker.cs | 2 ++ .../Visual/Gameplay/TestSceneCompletionCancellation.cs | 2 ++ .../Visual/Gameplay/TestSceneDrawableScrollingRuleset.cs | 2 ++ .../Visual/Gameplay/TestSceneDrawableStoryboardSprite.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneFailingLayer.cs | 2 ++ .../Visual/Gameplay/TestSceneFrameStabilityContainer.cs | 2 ++ .../Visual/Gameplay/TestSceneGameplayLeaderboard.cs | 2 ++ .../Visual/Gameplay/TestSceneGameplayMenuOverlay.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs | 2 ++ .../Visual/Gameplay/TestSceneGameplaySamplePlayback.cs | 2 ++ .../Visual/Gameplay/TestSceneGameplaySampleTriggerSource.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneHoldForMenuButton.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneKeyBindings.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneKeyCounter.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneMedalOverlay.cs | 2 ++ .../Visual/Gameplay/TestSceneNightcoreBeatContainer.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneOverlayActivation.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneParticleExplosion.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneParticleSpewer.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestScenePause.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestScenePauseWhenInactive.cs | 2 ++ .../Visual/Gameplay/TestScenePerformancePointsCounter.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs | 2 ++ .../Visual/Gameplay/TestScenePlayerReferenceLeaking.cs | 2 ++ .../Visual/Gameplay/TestScenePlayerScoreSubmission.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestScenePoolingRuleset.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneReplay.cs | 2 ++ .../Visual/Gameplay/TestSceneReplayDownloadButton.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneReplayPlayer.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs | 2 ++ .../Visual/Gameplay/TestSceneScrollingHitObjects.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs | 2 ++ .../Visual/Gameplay/TestSceneSkinEditorComponentsList.cs | 2 ++ .../Visual/Gameplay/TestSceneSkinEditorMultipleSkins.cs | 2 ++ .../Visual/Gameplay/TestSceneSkinnableAccuracyCounter.cs | 2 ++ .../Visual/Gameplay/TestSceneSkinnableComboCounter.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableDrawable.cs | 2 ++ .../Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs | 2 ++ .../Visual/Gameplay/TestSceneSkinnableHealthDisplay.cs | 2 ++ .../Visual/Gameplay/TestSceneSkinnableScoreCounter.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneSkipOverlay.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneSliderPath.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneSongProgress.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorHost.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneStarCounter.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneStoryboard.cs | 2 ++ .../Visual/Gameplay/TestSceneStoryboardSamplePlayback.cs | 2 ++ .../Visual/Gameplay/TestSceneStoryboardWithOutro.cs | 2 ++ osu.Game.Tests/Visual/Gameplay/TestSceneUnknownMod.cs | 2 ++ .../Visual/Gameplay/TestSceneUnstableRateCounter.cs | 2 ++ osu.Game.Tests/Visual/Menus/IntroTestScene.cs | 2 ++ osu.Game.Tests/Visual/Menus/TestSceneDisclaimer.cs | 2 ++ osu.Game.Tests/Visual/Menus/TestSceneIntroCircles.cs | 2 ++ osu.Game.Tests/Visual/Menus/TestSceneIntroTriangles.cs | 2 ++ osu.Game.Tests/Visual/Menus/TestSceneIntroWelcome.cs | 2 ++ osu.Game.Tests/Visual/Menus/TestSceneLoader.cs | 2 ++ osu.Game.Tests/Visual/Menus/TestSceneLoginPanel.cs | 2 ++ osu.Game.Tests/Visual/Menus/TestSceneMusicActionHandling.cs | 2 ++ osu.Game.Tests/Visual/Menus/TestSceneSideOverlays.cs | 2 ++ osu.Game.Tests/Visual/Menus/TestSceneSongTicker.cs | 2 ++ osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs | 2 ++ osu.Game.Tests/Visual/Menus/TestSceneToolbarClock.cs | 2 ++ osu.Game.Tests/Visual/Mods/TestSceneModFailCondition.cs | 2 ++ .../Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs | 2 ++ osu.Game.Tests/Visual/Multiplayer/QueueModeTestScene.cs | 2 ++ .../Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs | 2 -- .../Multiplayer/TestSceneCreateMultiplayerMatchButton.cs | 2 ++ .../Visual/Multiplayer/TestSceneDrawableLoungeRoom.cs | 2 ++ osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs | 2 ++ .../Multiplayer/TestSceneDrawableRoomParticipantsList.cs | 2 ++ .../Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs | 2 ++ .../Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs | 2 ++ .../Visual/Multiplayer/TestSceneGameplayChatDisplay.cs | 2 ++ .../Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs | 2 ++ .../Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs | 2 ++ .../Visual/Multiplayer/TestSceneMatchBeatmapDetailArea.cs | 2 ++ .../Visual/Multiplayer/TestSceneMatchLeaderboard.cs | 2 ++ .../Visual/Multiplayer/TestSceneMatchStartControl.cs | 2 ++ osu.Game.Tests/Visual/Multiplayer/TestSceneMultiHeader.cs | 2 ++ .../Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs | 2 ++ .../Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs | 2 ++ osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs | 2 ++ .../Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs | 2 ++ .../TestSceneMultiplayerGameplayLeaderboardTeams.cs | 2 ++ .../Visual/Multiplayer/TestSceneMultiplayerLoungeSubScreen.cs | 2 ++ .../Visual/Multiplayer/TestSceneMultiplayerMatchFooter.cs | 2 ++ .../Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs | 2 ++ .../Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs | 2 ++ .../Multiplayer/TestSceneMultiplayerParticipantsList.cs | 2 ++ .../Visual/Multiplayer/TestSceneMultiplayerPlayer.cs | 2 ++ .../Visual/Multiplayer/TestSceneMultiplayerPlaylist.cs | 2 ++ .../Visual/Multiplayer/TestSceneMultiplayerQueueList.cs | 2 ++ .../Visual/Multiplayer/TestSceneMultiplayerResults.cs | 2 ++ .../Visual/Multiplayer/TestSceneMultiplayerSpectateButton.cs | 2 ++ .../Multiplayer/TestSceneMultiplayerSpectatorPlayerGrid.cs | 2 ++ .../Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs | 2 ++ .../Multiplayer/TestScenePlaylistsRoomSettingsPlaylist.cs | 2 ++ .../Visual/Multiplayer/TestScenePlaylistsSongSelect.cs | 2 ++ osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs | 2 ++ .../Visual/Multiplayer/TestSceneStarRatingRangeDisplay.cs | 2 ++ osu.Game.Tests/Visual/Multiplayer/TestSceneTeamVersus.cs | 2 ++ osu.Game.Tests/Visual/Navigation/TestEFToRealmMigration.cs | 2 ++ .../Visual/Navigation/TestSceneButtonSystemNavigation.cs | 2 ++ .../Navigation/TestSceneChangeAndUseGameplayBindings.cs | 2 ++ osu.Game.Tests/Visual/Navigation/TestSceneEditDefaultSkin.cs | 2 ++ osu.Game.Tests/Visual/Navigation/TestSceneFirstRunGame.cs | 2 ++ .../Visual/Navigation/TestSceneMouseWheelVolumeAdjust.cs | 2 ++ osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs | 2 ++ .../Visual/Navigation/TestScenePerformFromScreen.cs | 2 ++ osu.Game.Tests/Visual/Navigation/TestScenePresentBeatmap.cs | 2 ++ osu.Game.Tests/Visual/Navigation/TestScenePresentScore.cs | 2 ++ osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs | 2 ++ .../Visual/Navigation/TestSceneSkinEditorNavigation.cs | 2 ++ .../Visual/Navigation/TestSceneStartupBeatmapDisplay.cs | 2 ++ .../Visual/Navigation/TestSceneStartupBeatmapSetDisplay.cs | 2 ++ osu.Game.Tests/Visual/Navigation/TestSceneStartupImport.cs | 2 ++ osu.Game.Tests/Visual/Navigation/TestSceneStartupRuleset.cs | 2 ++ osu.Game.Tests/Visual/Navigation/TestSettingsMigration.cs | 2 ++ .../Visual/Online/TestSceneAccountCreationOverlay.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneBeatmapAvailability.cs | 2 ++ .../Visual/Online/TestSceneBeatmapDownloadButton.cs | 2 ++ .../Visual/Online/TestSceneBeatmapListingOverlay.cs | 2 ++ .../Visual/Online/TestSceneBeatmapRulesetSelector.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs | 2 ++ .../Visual/Online/TestSceneBeatmapSetOverlayDetails.cs | 2 ++ .../Visual/Online/TestSceneBeatmapSetOverlaySuccessRate.cs | 2 ++ .../Visual/Online/TestSceneBundledBeatmapDownloader.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs | 2 ++ .../Visual/Online/TestSceneChangelogSupporterPromo.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneChannelList.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneChannelListing.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneChatLineTruncation.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneChatLink.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneChatTextBox.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs | 2 ++ .../Visual/Online/TestSceneCurrentlyPlayingDisplay.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneDashboardOverlay.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneDrawableComment.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneExternalLinkButton.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneFavouriteButton.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneFullscreenOverlay.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneGraph.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneHomeNewsPanel.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneKudosuHistory.cs | 2 ++ .../Visual/Online/TestSceneLeaderboardModSelector.cs | 2 ++ .../Visual/Online/TestSceneLeaderboardScopeSelector.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneNewsCard.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneNewsHeader.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneNewsOverlay.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneNewsSidebar.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneNowPlayingCommand.cs | 2 ++ .../Visual/Online/TestSceneOfflineCommentsContainer.cs | 2 ++ .../Visual/Online/TestSceneOnlineBeatmapListingOverlay.cs | 2 ++ .../Visual/Online/TestSceneOnlineBeatmapSetOverlay.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneOnlineViewContainer.cs | 2 ++ .../Visual/Online/TestScenePlayHistorySubsection.cs | 2 ++ .../Visual/Online/TestSceneProfileRulesetSelector.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs | 2 ++ .../Visual/Online/TestSceneRankingsCountryFilter.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs | 2 ++ .../Visual/Online/TestSceneRankingsSpotlightSelector.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneScoreboardTime.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneSpotlightsLayout.cs | 2 ++ .../Visual/Online/TestSceneStandAloneChatDisplay.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneTotalCommentsCounter.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneUserHistoryGraph.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs | 2 ++ .../Visual/Online/TestSceneUserProfilePreviousUsernames.cs | 2 ++ .../Visual/Online/TestSceneUserProfileRecentSection.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneUserRanks.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneVotePill.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneWikiHeader.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneWikiMainPage.cs | 2 ++ .../Visual/Online/TestSceneWikiMarkdownContainer.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneWikiOverlay.cs | 2 ++ osu.Game.Tests/Visual/Online/TestSceneWikiSidebar.cs | 2 ++ .../Visual/Playlists/TestScenePlaylistsLoungeSubScreen.cs | 2 ++ .../Playlists/TestScenePlaylistsMatchSettingsOverlay.cs | 2 ++ .../Visual/Playlists/TestScenePlaylistsParticipantsList.cs | 2 ++ .../Visual/Playlists/TestScenePlaylistsResultsScreen.cs | 2 ++ .../Visual/Playlists/TestScenePlaylistsRoomCreation.cs | 2 ++ osu.Game.Tests/Visual/Playlists/TestScenePlaylistsScreen.cs | 2 ++ osu.Game.Tests/Visual/Ranking/TestSceneAccuracyCircle.cs | 2 ++ .../Visual/Ranking/TestSceneContractedPanelMiddleContent.cs | 2 ++ .../Visual/Ranking/TestSceneExpandedPanelMiddleContent.cs | 2 ++ .../Visual/Ranking/TestSceneExpandedPanelTopContent.cs | 2 ++ .../Ranking/TestSceneHitEventTimingDistributionGraph.cs | 2 ++ osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs | 2 ++ osu.Game.Tests/Visual/Ranking/TestSceneScorePanel.cs | 2 ++ osu.Game.Tests/Visual/Ranking/TestSceneScorePanelList.cs | 2 ++ .../Visual/Ranking/TestSceneSimpleStatisticTable.cs | 2 ++ osu.Game.Tests/Visual/Ranking/TestSceneStatisticsPanel.cs | 2 ++ osu.Game.Tests/Visual/Settings/TestSceneDirectorySelector.cs | 2 ++ osu.Game.Tests/Visual/Settings/TestSceneFileSelector.cs | 2 ++ osu.Game.Tests/Visual/Settings/TestSceneKeyBindingPanel.cs | 2 ++ .../Visual/Settings/TestSceneLatencyCertifierScreen.cs | 2 -- osu.Game.Tests/Visual/Settings/TestSceneMigrationScreens.cs | 2 ++ .../Visual/Settings/TestSceneRestoreDefaultValueButton.cs | 2 ++ osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs | 2 ++ osu.Game.Tests/Visual/Settings/TestSceneSettingsNumberBox.cs | 2 ++ osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs | 2 ++ osu.Game.Tests/Visual/Settings/TestSceneSettingsSource.cs | 2 ++ osu.Game.Tests/Visual/Settings/TestSceneTabletSettings.cs | 2 ++ osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs | 2 ++ osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs | 2 ++ osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs | 2 ++ osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs | 2 ++ .../Visual/SongSelect/TestSceneBeatmapLeaderboard.cs | 2 ++ .../Visual/SongSelect/TestSceneBeatmapMetadataDisplay.cs | 2 ++ .../Visual/SongSelect/TestSceneBeatmapOptionsOverlay.cs | 2 ++ .../Visual/SongSelect/TestSceneBeatmapRecommendations.cs | 2 ++ osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs | 2 ++ osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs | 2 ++ osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectFooter.cs | 2 ++ osu.Game.Tests/Visual/SongSelect/TestSceneTopLocalRank.cs | 2 ++ .../Visual/SongSelect/TestSceneUserTopScoreContainer.cs | 2 ++ osu.Game.Tests/Visual/TestMultiplayerComponents.cs | 2 ++ osu.Game.Tests/Visual/TestSceneOsuScreenStack.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs | 2 ++ .../Visual/UserInterface/TestSceneBeatSyncedContainer.cs | 2 ++ .../TestSceneBeatmapListingCardSizeTabControl.cs | 2 ++ .../UserInterface/TestSceneBeatmapListingSearchControl.cs | 2 ++ .../UserInterface/TestSceneBeatmapListingSortTabControl.cs | 2 ++ .../Visual/UserInterface/TestSceneBeatmapSearchFilter.cs | 2 ++ .../Visual/UserInterface/TestSceneBreadcrumbControl.cs | 2 ++ .../Visual/UserInterface/TestSceneBreadcrumbControlHeader.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneColourPicker.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneCommentEditor.cs | 2 ++ .../Visual/UserInterface/TestSceneCommentRepliesButton.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneContextMenu.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs | 2 ++ .../Visual/UserInterface/TestSceneDashboardBeatmapListing.cs | 2 ++ .../Visual/UserInterface/TestSceneDeleteLocalScore.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs | 2 ++ .../UserInterface/TestSceneDifficultyMultiplierDisplay.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneDrawableDate.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneEditorSidebar.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs | 2 ++ .../Visual/UserInterface/TestSceneExpandingContainer.cs | 2 ++ .../Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs | 2 ++ .../UserInterface/TestSceneFirstRunScreenBundledBeatmaps.cs | 2 ++ .../UserInterface/TestSceneFirstRunScreenImportFromStable.cs | 2 ++ .../Visual/UserInterface/TestSceneFirstRunScreenUIScale.cs | 2 ++ .../Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs | 2 ++ .../Visual/UserInterface/TestSceneFooterButtonMods.cs | 2 ++ .../UserInterface/TestSceneFriendsOnlineStatusControl.cs | 2 ++ .../Visual/UserInterface/TestSceneHoldToConfirmOverlay.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneIconButton.cs | 2 ++ .../Visual/UserInterface/TestSceneLabelledColourPalette.cs | 2 ++ .../Visual/UserInterface/TestSceneLabelledDrawable.cs | 2 ++ .../Visual/UserInterface/TestSceneLabelledDropdown.cs | 2 ++ .../Visual/UserInterface/TestSceneLabelledSliderBar.cs | 2 ++ .../Visual/UserInterface/TestSceneLabelledSwitchButton.cs | 2 ++ .../Visual/UserInterface/TestSceneLabelledTextBox.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneLoadingLayer.cs | 2 ++ .../Visual/UserInterface/TestSceneLoadingSpinner.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneLogoAnimation.cs | 2 ++ .../Visual/UserInterface/TestSceneLogoTrackingContainer.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs | 2 -- .../UserInterface/TestSceneModDifficultyAdjustSettings.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneModDisplay.cs | 2 ++ .../Visual/UserInterface/TestSceneModFlowDisplay.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneModIcon.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneModPanel.cs | 2 ++ .../Visual/UserInterface/TestSceneModSelectOverlay.cs | 2 ++ .../Visual/UserInterface/TestSceneModSettingsArea.cs | 2 ++ .../Visual/UserInterface/TestSceneModSwitchSmall.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneModSwitchTiny.cs | 2 ++ .../Visual/UserInterface/TestSceneNotificationOverlay.cs | 2 ++ .../Visual/UserInterface/TestSceneNowPlayingOverlay.cs | 2 ++ .../Visual/UserInterface/TestSceneOnScreenDisplay.cs | 2 ++ .../Visual/UserInterface/TestSceneOsuAnimatedButton.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneOsuButton.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneOsuDropdown.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneOsuFont.cs | 2 ++ .../Visual/UserInterface/TestSceneOsuHoverContainer.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneOsuIcon.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneOsuLogo.cs | 2 ++ .../Visual/UserInterface/TestSceneOsuMarkdownContainer.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneOsuMenu.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneOsuPopover.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneOsuTextBox.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs | 2 ++ .../Visual/UserInterface/TestSceneOverlayHeaderBackground.cs | 2 ++ .../Visual/UserInterface/TestSceneOverlayRulesetSelector.cs | 2 ++ .../Visual/UserInterface/TestSceneOverlayScrollContainer.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestScenePageSelector.cs | 2 ++ .../Visual/UserInterface/TestSceneParallaxContainer.cs | 2 ++ .../Visual/UserInterface/TestScenePlaylistOverlay.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestScenePopupDialog.cs | 2 ++ .../Visual/UserInterface/TestSceneProfileSubsectionHeader.cs | 2 ++ .../Visual/UserInterface/TestSceneRankingsSortTabControl.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs | 2 ++ .../Visual/UserInterface/TestSceneSafeAreaHandling.cs | 2 ++ .../Visual/UserInterface/TestSceneScalingContainer.cs | 2 ++ .../Visual/UserInterface/TestSceneScreenBreadcrumbControl.cs | 2 ++ .../Visual/UserInterface/TestSceneSectionsContainer.cs | 2 ++ .../Visual/UserInterface/TestSceneSettingsCheckbox.cs | 2 ++ .../Visual/UserInterface/TestSceneSettingsToolboxGroup.cs | 2 ++ .../Visual/UserInterface/TestSceneShearedButtons.cs | 2 ++ .../Visual/UserInterface/TestSceneShearedOverlayContainer.cs | 2 ++ .../Visual/UserInterface/TestSceneShearedOverlayHeader.cs | 2 ++ .../Visual/UserInterface/TestSceneShearedSearchTextBox.cs | 2 ++ .../Visual/UserInterface/TestSceneStarRatingDisplay.cs | 2 ++ .../Visual/UserInterface/TestSceneStatefulMenuItem.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneSwitchButton.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneTabControl.cs | 2 ++ .../Visual/UserInterface/TestSceneToggleMenuItem.cs | 2 ++ .../Visual/UserInterface/TestSceneToolbarRulesetSelector.cs | 2 ++ .../Visual/UserInterface/TestSceneTwoLayerButton.cs | 2 ++ .../TestSceneUpdateableBeatmapBackgroundSprite.cs | 2 ++ .../UserInterface/TestSceneUpdateableBeatmapSetCover.cs | 2 ++ .../Visual/UserInterface/TestSceneUserListToolbar.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneVolumeOverlay.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneVolumePieces.cs | 2 ++ osu.Game.Tests/Visual/UserInterface/TestSceneWaveContainer.cs | 2 ++ .../Visual/UserInterface/ThemeComparisonTestScene.cs | 2 ++ osu.Game.Tests/WaveformTestBeatmap.cs | 2 ++ osu.Game.Tournament.Tests/Components/TestSceneDateTextBox.cs | 2 ++ .../Components/TestSceneDrawableTournamentMatch.cs | 2 ++ .../Components/TestSceneDrawableTournamentTeam.cs | 2 ++ osu.Game.Tournament.Tests/Components/TestSceneMatchHeader.cs | 2 ++ .../Components/TestSceneMatchScoreDisplay.cs | 2 ++ osu.Game.Tournament.Tests/Components/TestSceneRoundDisplay.cs | 2 ++ osu.Game.Tournament.Tests/Components/TestSceneSongBar.cs | 2 ++ .../Components/TestSceneTournamentBeatmapPanel.cs | 2 ++ .../Components/TestSceneTournamentMatchChatDisplay.cs | 2 ++ .../Components/TestSceneTournamentModDisplay.cs | 2 ++ .../NonVisual/CustomTourneyDirectoryTest.cs | 2 ++ osu.Game.Tournament.Tests/NonVisual/DataLoadTest.cs | 2 ++ osu.Game.Tournament.Tests/NonVisual/IPCLocationTest.cs | 2 ++ .../NonVisual/LadderInfoSerialisationTest.cs | 2 ++ osu.Game.Tournament.Tests/NonVisual/TournamentHostTest.cs | 2 ++ osu.Game.Tournament.Tests/Screens/TestSceneDrawingsScreen.cs | 2 ++ osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs | 2 ++ .../Screens/TestSceneLadderEditorScreen.cs | 2 ++ osu.Game.Tournament.Tests/Screens/TestSceneLadderScreen.cs | 2 ++ osu.Game.Tournament.Tests/Screens/TestSceneMapPoolScreen.cs | 2 ++ .../Screens/TestSceneRoundEditorScreen.cs | 2 ++ osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs | 2 ++ .../Screens/TestSceneSeedingEditorScreen.cs | 2 ++ osu.Game.Tournament.Tests/Screens/TestSceneSeedingScreen.cs | 2 ++ osu.Game.Tournament.Tests/Screens/TestSceneSetupScreen.cs | 2 ++ osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs | 2 ++ .../Screens/TestSceneStablePathSelectScreen.cs | 2 ++ .../Screens/TestSceneTeamEditorScreen.cs | 2 ++ osu.Game.Tournament.Tests/Screens/TestSceneTeamIntroScreen.cs | 2 ++ osu.Game.Tournament.Tests/Screens/TestSceneTeamWinScreen.cs | 2 ++ osu.Game.Tournament.Tests/TestSceneTournamentSceneManager.cs | 2 ++ osu.Game.Tournament.Tests/TournamentTestBrowser.cs | 2 ++ osu.Game.Tournament.Tests/TournamentTestRunner.cs | 2 ++ osu.Game.Tournament.Tests/TournamentTestScene.cs | 2 ++ osu.Game.Tournament/Components/ControlPanel.cs | 2 ++ osu.Game.Tournament/Components/DateTextBox.cs | 2 ++ osu.Game.Tournament/Components/DrawableTeamFlag.cs | 2 ++ osu.Game.Tournament/Components/DrawableTeamHeader.cs | 2 ++ osu.Game.Tournament/Components/DrawableTeamTitle.cs | 2 ++ osu.Game.Tournament/Components/DrawableTeamTitleWithHeader.cs | 2 ++ osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs | 2 ++ .../Components/DrawableTournamentHeaderLogo.cs | 2 ++ .../Components/DrawableTournamentHeaderText.cs | 2 ++ osu.Game.Tournament/Components/DrawableTournamentTeam.cs | 2 ++ osu.Game.Tournament/Components/IPCErrorDialog.cs | 2 ++ osu.Game.Tournament/Components/RoundDisplay.cs | 2 ++ osu.Game.Tournament/Components/SongBar.cs | 2 ++ osu.Game.Tournament/Components/TournamentBeatmapPanel.cs | 2 ++ osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs | 2 ++ osu.Game.Tournament/Components/TournamentModIcon.cs | 2 ++ .../Components/TournamentSpriteTextWithBackground.cs | 2 ++ osu.Game.Tournament/Components/TourneyVideo.cs | 2 ++ osu.Game.Tournament/Configuration/TournamentStorageManager.cs | 2 ++ osu.Game.Tournament/IO/TournamentStorage.cs | 2 ++ osu.Game.Tournament/IO/TournamentVideoResourceStore.cs | 2 ++ osu.Game.Tournament/IPC/FileBasedIPC.cs | 2 ++ osu.Game.Tournament/IPC/MatchIPCInfo.cs | 2 ++ osu.Game.Tournament/IPC/TourneyState.cs | 2 ++ osu.Game.Tournament/JsonPointConverter.cs | 2 ++ osu.Game.Tournament/Models/BeatmapChoice.cs | 2 ++ osu.Game.Tournament/Models/LadderEditorInfo.cs | 2 ++ osu.Game.Tournament/Models/LadderInfo.cs | 2 ++ osu.Game.Tournament/Models/RoundBeatmap.cs | 2 ++ osu.Game.Tournament/Models/SeedingBeatmap.cs | 2 ++ osu.Game.Tournament/Models/SeedingResult.cs | 2 ++ osu.Game.Tournament/Models/StableInfo.cs | 2 ++ osu.Game.Tournament/Models/TournamentMatch.cs | 2 ++ osu.Game.Tournament/Models/TournamentProgression.cs | 2 ++ osu.Game.Tournament/Models/TournamentRound.cs | 2 ++ osu.Game.Tournament/Models/TournamentTeam.cs | 2 ++ osu.Game.Tournament/Properties/AssemblyInfo.cs | 2 ++ osu.Game.Tournament/Screens/BeatmapInfoScreen.cs | 2 ++ .../Screens/Drawings/Components/DrawingsConfigManager.cs | 2 ++ osu.Game.Tournament/Screens/Drawings/Components/Group.cs | 2 ++ .../Screens/Drawings/Components/GroupContainer.cs | 2 ++ osu.Game.Tournament/Screens/Drawings/Components/GroupTeam.cs | 2 ++ osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs | 2 ++ .../Screens/Drawings/Components/ScrollingTeamContainer.cs | 2 ++ .../Screens/Drawings/Components/StorageBackedTeamList.cs | 2 ++ .../Screens/Drawings/Components/VisualiserContainer.cs | 2 ++ osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs | 2 ++ osu.Game.Tournament/Screens/Editors/IModelBacked.cs | 2 ++ osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs | 2 ++ osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs | 2 ++ osu.Game.Tournament/Screens/Editors/SeedingEditorScreen.cs | 2 ++ osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs | 2 ++ osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs | 2 ++ .../Screens/Gameplay/Components/MatchHeader.cs | 2 ++ .../Screens/Gameplay/Components/MatchRoundDisplay.cs | 2 ++ .../Screens/Gameplay/Components/TeamDisplay.cs | 2 ++ osu.Game.Tournament/Screens/Gameplay/Components/TeamScore.cs | 2 ++ .../Screens/Gameplay/Components/TeamScoreDisplay.cs | 2 ++ .../Gameplay/Components/TournamentMatchScoreDisplay.cs | 2 ++ osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs | 2 ++ osu.Game.Tournament/Screens/IProvideVideo.cs | 2 ++ .../Screens/Ladder/Components/ConditionalTournamentMatch.cs | 2 ++ .../Screens/Ladder/Components/DrawableMatchTeam.cs | 2 ++ .../Screens/Ladder/Components/DrawableTournamentMatch.cs | 2 ++ .../Screens/Ladder/Components/DrawableTournamentRound.cs | 2 ++ .../Screens/Ladder/Components/LadderEditorSettings.cs | 2 ++ .../Screens/Ladder/Components/ProgressionPath.cs | 2 ++ .../Screens/Ladder/Components/SettingsTeamDropdown.cs | 2 ++ osu.Game.Tournament/Screens/Ladder/LadderDragContainer.cs | 2 ++ osu.Game.Tournament/Screens/Ladder/LadderScreen.cs | 2 ++ osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs | 2 ++ osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs | 2 ++ osu.Game.Tournament/Screens/Setup/ActionableInfo.cs | 2 ++ osu.Game.Tournament/Screens/Setup/ResolutionSelector.cs | 2 ++ osu.Game.Tournament/Screens/Setup/SetupScreen.cs | 2 ++ osu.Game.Tournament/Screens/Setup/StablePathSelectScreen.cs | 2 ++ osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs | 2 ++ osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs | 2 ++ osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs | 2 ++ osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs | 2 ++ osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs | 2 ++ osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs | 2 ++ osu.Game.Tournament/Screens/TournamentMatchScreen.cs | 2 ++ osu.Game.Tournament/Screens/TournamentScreen.cs | 2 ++ osu.Game.Tournament/TournamentGame.cs | 2 ++ osu.Game.Tournament/TournamentGameBase.cs | 2 ++ osu.Game.Tournament/TournamentSceneManager.cs | 2 ++ osu.Game.Tournament/TournamentSpriteText.cs | 2 ++ osu.Game.Tournament/TourneyButton.cs | 2 ++ osu.Game.Tournament/WarningBox.cs | 2 ++ osu.Game/Audio/Effects/AudioFilter.cs | 2 ++ osu.Game/Audio/Effects/ITransformableFilter.cs | 2 ++ osu.Game/Audio/HitSampleInfo.cs | 2 -- osu.Game/Audio/IPreviewTrackOwner.cs | 2 ++ osu.Game/Audio/ISampleInfo.cs | 2 ++ osu.Game/Audio/ISamplePlaybackDisabler.cs | 2 ++ osu.Game/Audio/PreviewTrack.cs | 2 ++ osu.Game/Audio/PreviewTrackManager.cs | 2 ++ osu.Game/Audio/SampleInfo.cs | 2 ++ osu.Game/Beatmaps/APIFailTimes.cs | 2 ++ osu.Game/Beatmaps/Beatmap.cs | 2 ++ osu.Game/Beatmaps/BeatmapConverter.cs | 2 ++ osu.Game/Beatmaps/BeatmapDifficulty.cs | 2 -- osu.Game/Beatmaps/BeatmapDifficultyCache.cs | 2 ++ osu.Game/Beatmaps/BeatmapImporter.cs | 2 -- osu.Game/Beatmaps/BeatmapInfo.cs | 2 -- osu.Game/Beatmaps/BeatmapInfoExtensions.cs | 2 ++ osu.Game/Beatmaps/BeatmapManager.cs | 2 -- osu.Game/Beatmaps/BeatmapMetadata.cs | 2 -- osu.Game/Beatmaps/BeatmapMetadataInfoExtensions.cs | 2 ++ osu.Game/Beatmaps/BeatmapModelDownloader.cs | 2 ++ osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs | 2 ++ osu.Game/Beatmaps/BeatmapOnlineStatus.cs | 2 ++ osu.Game/Beatmaps/BeatmapProcessor.cs | 2 ++ osu.Game/Beatmaps/BeatmapSetFileInfo.cs | 2 ++ osu.Game/Beatmaps/BeatmapSetHypeStatus.cs | 2 ++ osu.Game/Beatmaps/BeatmapSetInfo.cs | 2 -- osu.Game/Beatmaps/BeatmapSetNominationStatus.cs | 2 ++ osu.Game/Beatmaps/BeatmapSetOnlineAvailability.cs | 2 ++ osu.Game/Beatmaps/BeatmapSetOnlineCovers.cs | 2 ++ osu.Game/Beatmaps/BeatmapSetOnlineGenre.cs | 2 ++ osu.Game/Beatmaps/BeatmapSetOnlineLanguage.cs | 2 ++ osu.Game/Beatmaps/BeatmapStatistic.cs | 2 ++ osu.Game/Beatmaps/BeatmapStatisticIcon.cs | 2 ++ osu.Game/Beatmaps/BeatmapUserSettings.cs | 1 - osu.Game/Beatmaps/ControlPoints/ControlPoint.cs | 2 ++ osu.Game/Beatmaps/ControlPoints/ControlPointGroup.cs | 2 ++ osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 2 ++ osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs | 2 ++ osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs | 2 ++ osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs | 2 ++ osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs | 2 -- osu.Game/Beatmaps/CountdownType.cs | 2 ++ osu.Game/Beatmaps/DifficultyRating.cs | 2 ++ osu.Game/Beatmaps/DifficultyRecommender.cs | 2 ++ osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs | 2 ++ osu.Game/Beatmaps/Drawables/BeatmapDownloadButton.cs | 2 ++ osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | 2 -- osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs | 2 ++ osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs | 2 -- osu.Game/Beatmaps/Drawables/Cards/BeatmapCardContent.cs | 2 -- .../Beatmaps/Drawables/Cards/BeatmapCardContentBackground.cs | 2 -- .../Beatmaps/Drawables/Cards/BeatmapCardDifficultyList.cs | 2 ++ .../Drawables/Cards/BeatmapCardDownloadProgressBar.cs | 2 ++ osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs | 2 -- osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtraInfoRow.cs | 2 -- osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs | 2 -- osu.Game/Beatmaps/Drawables/Cards/BeatmapCardSize.cs | 2 ++ osu.Game/Beatmaps/Drawables/Cards/BeatmapCardThumbnail.cs | 2 ++ osu.Game/Beatmaps/Drawables/Cards/BeatmapSetFavouriteState.cs | 2 ++ .../Beatmaps/Drawables/Cards/Buttons/BeatmapCardIconButton.cs | 2 ++ osu.Game/Beatmaps/Drawables/Cards/Buttons/DownloadButton.cs | 2 -- osu.Game/Beatmaps/Drawables/Cards/Buttons/FavouriteButton.cs | 2 ++ .../Beatmaps/Drawables/Cards/Buttons/GoToBeatmapButton.cs | 2 -- osu.Game/Beatmaps/Drawables/Cards/Buttons/PlayButton.cs | 2 -- .../Beatmaps/Drawables/Cards/CollapsibleButtonContainer.cs | 2 -- .../Drawables/Cards/ExpandedContentScrollContainer.cs | 2 ++ osu.Game/Beatmaps/Drawables/Cards/HoverHandlingContainer.cs | 2 -- osu.Game/Beatmaps/Drawables/Cards/IconPill.cs | 2 ++ .../Drawables/Cards/Statistics/BeatmapCardDateStatistic.cs | 2 -- .../Drawables/Cards/Statistics/BeatmapCardStatistic.cs | 2 ++ .../Drawables/Cards/Statistics/FavouritesStatistic.cs | 2 ++ .../Beatmaps/Drawables/Cards/Statistics/HypesStatistic.cs | 2 -- .../Drawables/Cards/Statistics/NominationsStatistic.cs | 2 -- .../Beatmaps/Drawables/Cards/Statistics/PlayCountStatistic.cs | 2 ++ osu.Game/Beatmaps/Drawables/Cards/StoryboardIconPill.cs | 2 ++ osu.Game/Beatmaps/Drawables/Cards/VideoIconPill.cs | 2 ++ osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 2 ++ osu.Game/Beatmaps/Drawables/DifficultyIconTooltip.cs | 2 ++ osu.Game/Beatmaps/Drawables/DifficultySpectrumDisplay.cs | 2 ++ osu.Game/Beatmaps/Drawables/DownloadProgressBar.cs | 2 ++ osu.Game/Beatmaps/Drawables/GroupedDifficultyIcon.cs | 2 ++ osu.Game/Beatmaps/Drawables/OnlineBeatmapSetCover.cs | 2 ++ osu.Game/Beatmaps/Drawables/StarRatingDisplay.cs | 2 ++ .../Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs | 2 ++ .../Beatmaps/Drawables/UpdateableOnlineBeatmapSetCover.cs | 2 ++ osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 2 ++ osu.Game/Beatmaps/EFBeatmapDifficulty.cs | 2 ++ osu.Game/Beatmaps/EFBeatmapInfo.cs | 2 ++ osu.Game/Beatmaps/EFBeatmapMetadata.cs | 2 -- osu.Game/Beatmaps/EFBeatmapSetInfo.cs | 2 ++ osu.Game/Beatmaps/FlatFileWorkingBeatmap.cs | 2 ++ osu.Game/Beatmaps/Formats/Decoder.cs | 2 ++ osu.Game/Beatmaps/Formats/IHasComboColours.cs | 2 ++ osu.Game/Beatmaps/Formats/IHasCustomColours.cs | 2 ++ osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs | 2 ++ osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 2 ++ osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs | 2 ++ osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 ++ .../Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs | 2 ++ osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs | 2 ++ osu.Game/Beatmaps/Formats/Parsing.cs | 2 ++ osu.Game/Beatmaps/IBeatSyncProvider.cs | 2 -- osu.Game/Beatmaps/IBeatmap.cs | 2 ++ osu.Game/Beatmaps/IBeatmapConverter.cs | 2 ++ osu.Game/Beatmaps/IBeatmapDifficultyInfo.cs | 2 -- osu.Game/Beatmaps/IBeatmapInfo.cs | 2 -- osu.Game/Beatmaps/IBeatmapMetadataInfo.cs | 2 -- osu.Game/Beatmaps/IBeatmapOnlineInfo.cs | 2 -- osu.Game/Beatmaps/IBeatmapProcessor.cs | 2 ++ osu.Game/Beatmaps/IBeatmapResourceProvider.cs | 2 ++ osu.Game/Beatmaps/IBeatmapSetInfo.cs | 2 -- osu.Game/Beatmaps/IBeatmapSetOnlineInfo.cs | 2 -- osu.Game/Beatmaps/IWorkingBeatmap.cs | 2 ++ osu.Game/Beatmaps/IWorkingBeatmapCache.cs | 2 ++ osu.Game/Beatmaps/Legacy/LegacyControlPointInfo.cs | 2 ++ osu.Game/Beatmaps/Legacy/LegacyEffectFlags.cs | 2 ++ osu.Game/Beatmaps/Legacy/LegacyEventType.cs | 2 ++ osu.Game/Beatmaps/Legacy/LegacyHitObjectType.cs | 2 ++ osu.Game/Beatmaps/Legacy/LegacyHitSoundType.cs | 2 ++ osu.Game/Beatmaps/Legacy/LegacyMods.cs | 2 ++ osu.Game/Beatmaps/Legacy/LegacyOrigins.cs | 2 ++ osu.Game/Beatmaps/Legacy/LegacySampleBank.cs | 2 ++ osu.Game/Beatmaps/Legacy/LegacyStoryLayer.cs | 2 ++ osu.Game/Beatmaps/MetadataUtils.cs | 2 -- osu.Game/Beatmaps/StarDifficulty.cs | 2 ++ osu.Game/Beatmaps/Timing/BreakPeriod.cs | 2 ++ osu.Game/Beatmaps/Timing/TimeSignature.cs | 2 ++ osu.Game/Beatmaps/Timing/TimeSignatures.cs | 2 ++ osu.Game/Beatmaps/WorkingBeatmap.cs | 2 ++ osu.Game/Beatmaps/WorkingBeatmapCache.cs | 2 ++ osu.Game/Collections/BeatmapCollection.cs | 2 ++ osu.Game/Collections/CollectionFilterDropdown.cs | 2 ++ osu.Game/Collections/CollectionFilterMenuItem.cs | 2 ++ osu.Game/Collections/CollectionManager.cs | 2 ++ osu.Game/Collections/DeleteCollectionDialog.cs | 2 ++ osu.Game/Collections/DrawableCollectionList.cs | 2 ++ osu.Game/Collections/DrawableCollectionListItem.cs | 2 ++ osu.Game/Collections/ManageCollectionsDialog.cs | 2 ++ osu.Game/Configuration/BackgroundSource.cs | 2 ++ osu.Game/Configuration/DatabasedSetting.cs | 2 ++ osu.Game/Configuration/DevelopmentOsuConfigManager.cs | 2 ++ osu.Game/Configuration/DiscordRichPresenceMode.cs | 2 ++ osu.Game/Configuration/HUDVisibilityMode.cs | 2 ++ osu.Game/Configuration/InMemoryConfigManager.cs | 2 ++ osu.Game/Configuration/IntroSequence.cs | 2 ++ osu.Game/Configuration/ModSettingChangeTracker.cs | 2 ++ osu.Game/Configuration/OsuConfigManager.cs | 2 ++ osu.Game/Configuration/RandomSelectAlgorithm.cs | 2 ++ osu.Game/Configuration/RealmRulesetSetting.cs | 2 -- osu.Game/Configuration/ReleaseStream.cs | 2 ++ osu.Game/Configuration/ScalingMode.cs | 2 ++ osu.Game/Configuration/ScreenshotFormat.cs | 2 ++ osu.Game/Configuration/ScrollVisualisationMethod.cs | 2 ++ osu.Game/Configuration/SeasonalBackgroundMode.cs | 2 ++ osu.Game/Configuration/SessionStatics.cs | 2 ++ osu.Game/Configuration/SettingSourceAttribute.cs | 2 -- osu.Game/Configuration/SettingsStore.cs | 2 ++ osu.Game/Configuration/StorageConfigManager.cs | 2 ++ osu.Game/Configuration/ToolbarClockDisplayMode.cs | 2 ++ osu.Game/Database/BeatmapLookupCache.cs | 2 ++ osu.Game/Database/DatabaseContextFactory.cs | 2 ++ osu.Game/Database/DatabaseWriteUsage.cs | 2 ++ osu.Game/Database/EFToRealmMigrator.cs | 2 -- osu.Game/Database/EmptyRealmSet.cs | 2 -- osu.Game/Database/ICanAcceptFiles.cs | 2 ++ osu.Game/Database/IDatabaseContextFactory.cs | 2 ++ osu.Game/Database/IHasFiles.cs | 2 ++ osu.Game/Database/IHasGuidPrimaryKey.cs | 2 ++ osu.Game/Database/IHasNamedFiles.cs | 2 ++ osu.Game/Database/IHasOnlineID.cs | 2 -- osu.Game/Database/IHasPrimaryKey.cs | 2 ++ osu.Game/Database/IHasRealmFiles.cs | 2 -- osu.Game/Database/IModelDownloader.cs | 2 ++ osu.Game/Database/IModelFileManager.cs | 2 ++ osu.Game/Database/IModelImporter.cs | 2 -- osu.Game/Database/IModelManager.cs | 2 ++ osu.Game/Database/INamedFile.cs | 2 -- osu.Game/Database/INamedFileInfo.cs | 2 ++ osu.Game/Database/INamedFileUsage.cs | 2 -- osu.Game/Database/IPostImports.cs | 2 -- osu.Game/Database/IPostNotifications.cs | 2 ++ osu.Game/Database/ISoftDelete.cs | 2 ++ osu.Game/Database/ImportProgressNotification.cs | 2 ++ osu.Game/Database/ImportTask.cs | 2 -- osu.Game/Database/LegacyBeatmapExporter.cs | 2 ++ osu.Game/Database/LegacyBeatmapImporter.cs | 2 ++ osu.Game/Database/LegacyExporter.cs | 2 ++ osu.Game/Database/LegacyImportManager.cs | 2 ++ osu.Game/Database/LegacyModelImporter.cs | 2 ++ osu.Game/Database/LegacyScoreExporter.cs | 2 ++ osu.Game/Database/LegacyScoreImporter.cs | 2 ++ osu.Game/Database/LegacySkinExporter.cs | 2 ++ osu.Game/Database/LegacySkinImporter.cs | 2 ++ osu.Game/Database/Live.cs | 2 -- osu.Game/Database/MemoryCachingComponent.cs | 2 ++ osu.Game/Database/ModelDownloader.cs | 2 ++ osu.Game/Database/ModelManager.cs | 2 -- osu.Game/Database/OnlineLookupCache.cs | 2 ++ osu.Game/Database/OsuDbContext.cs | 2 ++ osu.Game/Database/RealmAccess.cs | 2 -- osu.Game/Database/RealmArchiveModelImporter.cs | 2 -- osu.Game/Database/RealmExtensions.cs | 2 -- osu.Game/Database/RealmFileStore.cs | 2 -- osu.Game/Database/RealmLive.cs | 2 -- osu.Game/Database/RealmLiveUnmanaged.cs | 2 -- osu.Game/Database/RealmObjectExtensions.cs | 2 -- osu.Game/Database/UserLookupCache.cs | 2 ++ osu.Game/Extensions/CollectionExtensions.cs | 2 ++ osu.Game/Extensions/DrawableExtensions.cs | 2 ++ osu.Game/Extensions/LanguageExtensions.cs | 2 ++ osu.Game/Extensions/ModelExtensions.cs | 2 -- osu.Game/Extensions/TaskExtensions.cs | 2 -- osu.Game/Extensions/TimeDisplayExtensions.cs | 2 ++ osu.Game/Extensions/TypeExtensions.cs | 2 ++ osu.Game/Extensions/WebRequestExtensions.cs | 2 ++ osu.Game/Graphics/Backgrounds/Background.cs | 2 ++ osu.Game/Graphics/Backgrounds/BeatmapBackground.cs | 2 ++ .../Graphics/Backgrounds/BeatmapBackgroundWithStoryboard.cs | 2 -- osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs | 2 ++ osu.Game/Graphics/Backgrounds/SkinBackground.cs | 2 ++ osu.Game/Graphics/Backgrounds/Triangles.cs | 2 ++ osu.Game/Graphics/Containers/BeatSyncedContainer.cs | 2 ++ osu.Game/Graphics/Containers/ConstrainedIconContainer.cs | 2 ++ osu.Game/Graphics/Containers/ExpandingButtonContainer.cs | 2 ++ osu.Game/Graphics/Containers/ExpandingContainer.cs | 2 ++ osu.Game/Graphics/Containers/HoldToConfirmContainer.cs | 2 ++ osu.Game/Graphics/Containers/IExpandable.cs | 2 ++ osu.Game/Graphics/Containers/IExpandingContainer.cs | 2 ++ osu.Game/Graphics/Containers/LinkFlowContainer.cs | 2 ++ osu.Game/Graphics/Containers/LogoTrackingContainer.cs | 2 ++ osu.Game/Graphics/Containers/Markdown/OsuMarkdownContainer.cs | 2 ++ .../Containers/Markdown/OsuMarkdownFencedCodeBlock.cs | 2 ++ osu.Game/Graphics/Containers/Markdown/OsuMarkdownHeading.cs | 2 ++ osu.Game/Graphics/Containers/Markdown/OsuMarkdownImage.cs | 2 ++ osu.Game/Graphics/Containers/Markdown/OsuMarkdownLinkText.cs | 2 ++ osu.Game/Graphics/Containers/Markdown/OsuMarkdownListItem.cs | 2 ++ .../Containers/Markdown/OsuMarkdownOrderedListItem.cs | 2 ++ .../Graphics/Containers/Markdown/OsuMarkdownQuoteBlock.cs | 2 ++ osu.Game/Graphics/Containers/Markdown/OsuMarkdownSeparator.cs | 2 ++ osu.Game/Graphics/Containers/Markdown/OsuMarkdownTable.cs | 2 ++ osu.Game/Graphics/Containers/Markdown/OsuMarkdownTableCell.cs | 2 ++ .../Containers/Markdown/OsuMarkdownTextFlowContainer.cs | 2 ++ .../Containers/Markdown/OsuMarkdownUnorderedListItem.cs | 2 ++ osu.Game/Graphics/Containers/OsuClickableContainer.cs | 2 ++ osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs | 2 ++ osu.Game/Graphics/Containers/OsuHoverContainer.cs | 2 ++ osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs | 2 ++ osu.Game/Graphics/Containers/OsuRearrangeableListItem.cs | 2 ++ osu.Game/Graphics/Containers/OsuScrollContainer.cs | 2 -- osu.Game/Graphics/Containers/OsuTextFlowContainer.cs | 2 ++ osu.Game/Graphics/Containers/ParallaxContainer.cs | 2 ++ .../Graphics/Containers/ReverseChildIDFillFlowContainer.cs | 2 ++ osu.Game/Graphics/Containers/ScalingContainer.cs | 2 ++ osu.Game/Graphics/Containers/SectionsContainer.cs | 2 ++ .../Graphics/Containers/SelectionCycleFillFlowContainer.cs | 2 ++ osu.Game/Graphics/Containers/ShakeContainer.cs | 2 ++ osu.Game/Graphics/Containers/UserDimContainer.cs | 2 ++ osu.Game/Graphics/Containers/UserTrackingScrollContainer.cs | 2 ++ osu.Game/Graphics/Containers/WaveContainer.cs | 2 ++ osu.Game/Graphics/Cursor/IProvideCursor.cs | 2 ++ osu.Game/Graphics/Cursor/MenuCursor.cs | 2 ++ osu.Game/Graphics/Cursor/MenuCursorContainer.cs | 2 ++ osu.Game/Graphics/Cursor/OsuContextMenuContainer.cs | 2 ++ osu.Game/Graphics/Cursor/OsuTooltipContainer.cs | 2 ++ osu.Game/Graphics/DateTooltip.cs | 2 ++ osu.Game/Graphics/DrawableDate.cs | 2 ++ osu.Game/Graphics/ErrorTextFlowContainer.cs | 2 ++ osu.Game/Graphics/IHasAccentColour.cs | 2 ++ osu.Game/Graphics/InputBlockingContainer.cs | 1 - osu.Game/Graphics/OpenGL/Vertices/PositionAndColourVertex.cs | 2 ++ osu.Game/Graphics/OsuColour.cs | 2 ++ osu.Game/Graphics/OsuFont.cs | 2 ++ osu.Game/Graphics/OsuIcon.cs | 2 ++ osu.Game/Graphics/ParticleExplosion.cs | 2 ++ osu.Game/Graphics/ParticleSpewer.cs | 2 ++ osu.Game/Graphics/ScreenshotManager.cs | 2 ++ osu.Game/Graphics/Sprites/GlowingSpriteText.cs | 2 ++ osu.Game/Graphics/Sprites/LogoAnimation.cs | 2 ++ osu.Game/Graphics/Sprites/OsuSpriteText.cs | 2 ++ osu.Game/Graphics/UserInterface/BackButton.cs | 2 ++ osu.Game/Graphics/UserInterface/Bar.cs | 2 ++ osu.Game/Graphics/UserInterface/BarGraph.cs | 2 ++ osu.Game/Graphics/UserInterface/BasicSearchTextBox.cs | 4 +++- osu.Game/Graphics/UserInterface/BreadcrumbControl.cs | 2 ++ osu.Game/Graphics/UserInterface/CommaSeparatedScoreCounter.cs | 2 ++ osu.Game/Graphics/UserInterface/DangerousTriangleButton.cs | 2 ++ osu.Game/Graphics/UserInterface/DialogButton.cs | 2 ++ osu.Game/Graphics/UserInterface/DownloadButton.cs | 2 ++ osu.Game/Graphics/UserInterface/DrawableOsuMenuItem.cs | 2 ++ osu.Game/Graphics/UserInterface/DrawableStatefulMenuItem.cs | 2 ++ osu.Game/Graphics/UserInterface/ExpandableSlider.cs | 2 ++ osu.Game/Graphics/UserInterface/ExpandingBar.cs | 2 ++ osu.Game/Graphics/UserInterface/ExternalLinkButton.cs | 2 ++ osu.Game/Graphics/UserInterface/FocusedTextBox.cs | 2 -- osu.Game/Graphics/UserInterface/GradientLineTabControl.cs | 2 ++ osu.Game/Graphics/UserInterface/GrayButton.cs | 2 ++ osu.Game/Graphics/UserInterface/HoverClickSounds.cs | 2 ++ .../Graphics/UserInterface/HoverSampleDebounceComponent.cs | 2 ++ osu.Game/Graphics/UserInterface/HoverSampleSet.cs | 2 ++ osu.Game/Graphics/UserInterface/HoverSounds.cs | 2 ++ osu.Game/Graphics/UserInterface/IconButton.cs | 2 ++ osu.Game/Graphics/UserInterface/LineGraph.cs | 2 ++ osu.Game/Graphics/UserInterface/LoadingButton.cs | 2 ++ osu.Game/Graphics/UserInterface/LoadingLayer.cs | 2 ++ osu.Game/Graphics/UserInterface/LoadingSpinner.cs | 2 ++ osu.Game/Graphics/UserInterface/MenuItemType.cs | 2 ++ osu.Game/Graphics/UserInterface/Nub.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuButton.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuContextMenu.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuContextMenuSamples.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuDropdown.cs | 2 -- osu.Game/Graphics/UserInterface/OsuEnumDropdown.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuMenu.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuMenuItem.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuNumberBox.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuTabDropdown.cs | 2 ++ osu.Game/Graphics/UserInterface/OsuTextBox.cs | 2 -- osu.Game/Graphics/UserInterface/PageSelector/PageEllipsis.cs | 2 ++ osu.Game/Graphics/UserInterface/PageSelector/PageSelector.cs | 2 ++ .../Graphics/UserInterface/PageSelector/PageSelectorButton.cs | 2 ++ .../UserInterface/PageSelector/PageSelectorPageButton.cs | 2 ++ .../UserInterface/PageSelector/PageSelectorPrevNextButton.cs | 2 ++ osu.Game/Graphics/UserInterface/PageTabControl.cs | 2 ++ osu.Game/Graphics/UserInterface/PercentageCounter.cs | 2 ++ osu.Game/Graphics/UserInterface/ProgressBar.cs | 2 ++ osu.Game/Graphics/UserInterface/RollingCounter.cs | 2 ++ osu.Game/Graphics/UserInterface/ScoreCounter.cs | 2 ++ osu.Game/Graphics/UserInterface/ScreenBreadcrumbControl.cs | 2 ++ osu.Game/Graphics/UserInterface/SearchTextBox.cs | 2 ++ osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs | 2 ++ osu.Game/Graphics/UserInterface/SelectionState.cs | 2 ++ osu.Game/Graphics/UserInterface/ShearedButton.cs | 1 - osu.Game/Graphics/UserInterface/ShearedOverlayHeader.cs | 2 -- osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs | 2 ++ osu.Game/Graphics/UserInterface/ShearedToggleButton.cs | 2 -- osu.Game/Graphics/UserInterface/ShowMoreButton.cs | 2 ++ osu.Game/Graphics/UserInterface/SlimEnumDropdown.cs | 2 ++ osu.Game/Graphics/UserInterface/StarCounter.cs | 2 ++ osu.Game/Graphics/UserInterface/StatefulMenuItem.cs | 2 ++ osu.Game/Graphics/UserInterface/TernaryState.cs | 2 ++ osu.Game/Graphics/UserInterface/TernaryStateMenuItem.cs | 2 ++ osu.Game/Graphics/UserInterface/TernaryStateRadioMenuItem.cs | 2 ++ osu.Game/Graphics/UserInterface/TernaryStateToggleMenuItem.cs | 2 ++ osu.Game/Graphics/UserInterface/TimeSlider.cs | 2 ++ osu.Game/Graphics/UserInterface/ToggleMenuItem.cs | 2 ++ osu.Game/Graphics/UserInterface/TriangleButton.cs | 2 ++ osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/ColourDisplay.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/ColourPalette.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/LabelledColourPalette.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/LabelledDrawable.cs | 2 -- osu.Game/Graphics/UserInterfaceV2/LabelledDropdown.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/LabelledEnumDropdown.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/LabelledNumberBox.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/LabelledSliderBar.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/LabelledSwitchButton.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/LabelledTextBox.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/OsuColourPicker.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelector.cs | 2 ++ .../UserInterfaceV2/OsuDirectorySelectorBreadcrumbDisplay.cs | 2 ++ .../Graphics/UserInterfaceV2/OsuDirectorySelectorDirectory.cs | 2 ++ .../UserInterfaceV2/OsuDirectorySelectorParentDirectory.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/OsuFileSelector.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/OsuHSVColourPicker.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/OsuHexColourPicker.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs | 2 ++ osu.Game/Graphics/UserInterfaceV2/SwitchButton.cs | 2 -- osu.Game/IO/Archives/ArchiveReader.cs | 2 ++ osu.Game/IO/Archives/LegacyByteArrayReader.cs | 2 ++ osu.Game/IO/Archives/LegacyDirectoryArchiveReader.cs | 2 ++ osu.Game/IO/Archives/LegacyFileArchiveReader.cs | 2 ++ osu.Game/IO/Archives/ZipArchiveReader.cs | 2 ++ osu.Game/IO/FileAbstraction/StreamFileAbstraction.cs | 2 ++ osu.Game/IO/FileInfo.cs | 2 ++ osu.Game/IO/IFileInfo.cs | 2 -- osu.Game/IO/IStorageResourceProvider.cs | 2 ++ osu.Game/IO/Legacy/ILegacySerializable.cs | 2 ++ osu.Game/IO/Legacy/SerializationReader.cs | 2 ++ osu.Game/IO/Legacy/SerializationWriter.cs | 2 ++ osu.Game/IO/LineBufferedReader.cs | 2 ++ osu.Game/IO/MigratableStorage.cs | 2 ++ osu.Game/IO/OsuStorage.cs | 2 ++ .../Serialization/Converters/SnakeCaseStringEnumConverter.cs | 2 ++ osu.Game/IO/Serialization/Converters/TypedListConverter.cs | 2 ++ osu.Game/IO/Serialization/JsonSerializableExtensions.cs | 2 ++ osu.Game/IO/Serialization/SnakeCaseKeyContractResolver.cs | 2 ++ osu.Game/IO/StableStorage.cs | 2 ++ osu.Game/IO/WrappedStorage.cs | 2 ++ osu.Game/IPC/ArchiveImportIPCChannel.cs | 2 ++ osu.Game/Input/Bindings/DatabasedKeyBindingContainer.cs | 2 ++ osu.Game/Input/Bindings/GlobalActionContainer.cs | 2 ++ osu.Game/Input/Bindings/RealmKeyBinding.cs | 2 -- osu.Game/Input/ConfineMouseTracker.cs | 2 ++ osu.Game/Input/GameIdleTracker.cs | 2 ++ osu.Game/Input/Handlers/ReplayInputHandler.cs | 2 ++ osu.Game/Input/IdleTracker.cs | 2 ++ osu.Game/Input/OsuConfineMouseMode.cs | 2 ++ osu.Game/Input/OsuUserInputManager.cs | 2 ++ osu.Game/Input/RealmKeyBindingStore.cs | 2 -- osu.Game/Localisation/AudioSettingsStrings.cs | 2 ++ osu.Game/Localisation/BeatmapOffsetControlStrings.cs | 2 ++ osu.Game/Localisation/BindingSettingsStrings.cs | 2 ++ osu.Game/Localisation/ButtonSystemStrings.cs | 2 ++ osu.Game/Localisation/ChatStrings.cs | 2 ++ osu.Game/Localisation/CommonStrings.cs | 4 +++- osu.Game/Localisation/DebugLocalisationStore.cs | 2 ++ osu.Game/Localisation/DebugSettingsStrings.cs | 2 ++ osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs | 4 +++- .../FirstRunOverlayImportFromStableScreenStrings.cs | 2 ++ osu.Game/Localisation/FirstRunSetupBeatmapScreenStrings.cs | 2 ++ osu.Game/Localisation/FirstRunSetupOverlayStrings.cs | 2 ++ osu.Game/Localisation/GameplaySettingsStrings.cs | 2 ++ osu.Game/Localisation/GeneralSettingsStrings.cs | 2 ++ osu.Game/Localisation/GlobalActionKeyBindingStrings.cs | 2 ++ osu.Game/Localisation/GraphicsSettingsStrings.cs | 2 ++ osu.Game/Localisation/InputSettingsStrings.cs | 2 ++ osu.Game/Localisation/JoystickSettingsStrings.cs | 2 ++ osu.Game/Localisation/Language.cs | 2 ++ osu.Game/Localisation/LayoutSettingsStrings.cs | 2 ++ osu.Game/Localisation/LeaderboardStrings.cs | 2 ++ osu.Game/Localisation/MaintenanceSettingsStrings.cs | 2 ++ osu.Game/Localisation/ModSelectOverlayStrings.cs | 2 ++ osu.Game/Localisation/MouseSettingsStrings.cs | 2 ++ osu.Game/Localisation/MultiplayerTeamResultsScreenStrings.cs | 4 +++- osu.Game/Localisation/NamedOverlayComponentStrings.cs | 2 ++ osu.Game/Localisation/NotificationsStrings.cs | 2 ++ osu.Game/Localisation/NowPlayingStrings.cs | 2 ++ osu.Game/Localisation/OnlineSettingsStrings.cs | 2 ++ osu.Game/Localisation/ResourceManagerLocalisationStore.cs | 2 ++ osu.Game/Localisation/RulesetSettingsStrings.cs | 2 ++ osu.Game/Localisation/SettingsStrings.cs | 2 ++ osu.Game/Localisation/SkinSettingsStrings.cs | 2 ++ osu.Game/Localisation/TabletSettingsStrings.cs | 4 +++- osu.Game/Localisation/ToastStrings.cs | 2 ++ osu.Game/Localisation/UserInterfaceStrings.cs | 2 ++ osu.Game/Migrations/20171019041408_InitialCreate.Designer.cs | 2 ++ osu.Game/Migrations/20171019041408_InitialCreate.cs | 2 ++ .../20171025071459_AddMissingIndexRules.Designer.cs | 2 ++ osu.Game/Migrations/20171025071459_AddMissingIndexRules.cs | 2 ++ ...71119065731_AddBeatmapOnlineIDUniqueConstraint.Designer.cs | 2 ++ .../20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs | 2 ++ .../20171209034410_AddRulesetInfoShortName.Designer.cs | 2 ++ osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs | 2 ++ osu.Game/Migrations/20180125143340_Settings.Designer.cs | 2 ++ osu.Game/Migrations/20180125143340_Settings.cs | 2 ++ osu.Game/Migrations/20180131154205_AddMuteBinding.cs | 2 ++ osu.Game/Migrations/20180219060912_AddSkins.Designer.cs | 2 ++ osu.Game/Migrations/20180219060912_AddSkins.cs | 2 ++ .../20180529055154_RemoveUniqueHashConstraints.Designer.cs | 2 ++ .../Migrations/20180529055154_RemoveUniqueHashConstraints.cs | 2 ++ .../20180621044111_UpdateTaikoDefaultBindings.Designer.cs | 2 ++ .../Migrations/20180621044111_UpdateTaikoDefaultBindings.cs | 2 ++ .../20180628011956_RemoveNegativeSetIDs.Designer.cs | 2 ++ osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs | 2 ++ osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs | 2 ++ osu.Game/Migrations/20180913080842_AddRankStatus.cs | 2 ++ .../Migrations/20181007180454_StandardizePaths.Designer.cs | 2 ++ osu.Game/Migrations/20181007180454_StandardizePaths.cs | 2 ++ .../Migrations/20181128100659_AddSkinInfoHash.Designer.cs | 2 ++ osu.Game/Migrations/20181128100659_AddSkinInfoHash.cs | 2 ++ .../Migrations/20181130113755_AddScoreInfoTables.Designer.cs | 2 ++ osu.Game/Migrations/20181130113755_AddScoreInfoTables.cs | 2 ++ .../Migrations/20190225062029_AddUserIDColumn.Designer.cs | 2 ++ osu.Game/Migrations/20190225062029_AddUserIDColumn.cs | 2 ++ osu.Game/Migrations/20190525060824_SkinSettings.Designer.cs | 2 ++ osu.Game/Migrations/20190525060824_SkinSettings.cs | 2 ++ .../20190605091246_AddDateAddedColumnToBeatmapSet.Designer.cs | 2 ++ .../20190605091246_AddDateAddedColumnToBeatmapSet.cs | 2 ++ .../20190708070844_AddBPMAndLengthColumns.Designer.cs | 2 ++ osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs | 2 ++ .../Migrations/20190913104727_AddBeatmapVideo.Designer.cs | 2 ++ osu.Game/Migrations/20190913104727_AddBeatmapVideo.cs | 2 ++ .../20200302094919_RefreshVolumeBindings.Designer.cs | 2 ++ osu.Game/Migrations/20200302094919_RefreshVolumeBindings.cs | 2 ++ .../Migrations/20201019224408_AddEpilepsyWarning.Designer.cs | 2 ++ osu.Game/Migrations/20201019224408_AddEpilepsyWarning.cs | 2 ++ .../20210412045700_RefreshVolumeBindingsAgain.Designer.cs | 2 ++ .../Migrations/20210412045700_RefreshVolumeBindingsAgain.cs | 2 ++ .../20210511060743_AddSkinInstantiationInfo.Designer.cs | 2 ++ .../Migrations/20210511060743_AddSkinInstantiationInfo.cs | 2 ++ .../20210514062639_AddAuthorIdToBeatmapMetadata.Designer.cs | 2 ++ .../Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.cs | 2 ++ .../20210824185035_AddCountdownSettings.Designer.cs | 2 ++ osu.Game/Migrations/20210824185035_AddCountdownSettings.cs | 2 ++ .../20210912144011_AddSamplesMatchPlaybackRate.Designer.cs | 2 ++ .../Migrations/20210912144011_AddSamplesMatchPlaybackRate.cs | 2 ++ osu.Game/Migrations/20211020081609_ResetSkinHashes.cs | 2 ++ osu.Game/Migrations/OsuDbContextModelSnapshot.cs | 2 ++ osu.Game/Models/RealmFile.cs | 2 -- osu.Game/Models/RealmNamedFileUsage.cs | 2 -- osu.Game/Models/RealmUser.cs | 2 ++ osu.Game/Online/API/APIAccess.cs | 2 ++ osu.Game/Online/API/APIDownloadRequest.cs | 2 ++ osu.Game/Online/API/APIException.cs | 2 ++ osu.Game/Online/API/APIMessagesRequest.cs | 2 ++ osu.Game/Online/API/APIMod.cs | 2 ++ osu.Game/Online/API/APIRequest.cs | 2 ++ osu.Game/Online/API/APIRequestCompletionState.cs | 2 ++ osu.Game/Online/API/ArchiveDownloadRequest.cs | 2 ++ osu.Game/Online/API/DummyAPIAccess.cs | 2 ++ osu.Game/Online/API/IAPIProvider.cs | 2 -- osu.Game/Online/API/ModSettingsDictionaryFormatter.cs | 2 ++ osu.Game/Online/API/OAuth.cs | 2 ++ osu.Game/Online/API/OAuthToken.cs | 2 ++ osu.Game/Online/API/OsuJsonWebRequest.cs | 2 ++ osu.Game/Online/API/OsuWebRequest.cs | 2 ++ osu.Game/Online/API/RegistrationRequest.cs | 2 ++ osu.Game/Online/API/Requests/CommentVoteRequest.cs | 2 ++ osu.Game/Online/API/Requests/CreateChannelRequest.cs | 2 ++ .../Online/API/Requests/CreateNewPrivateMessageRequest.cs | 2 ++ .../Online/API/Requests/CreateNewPrivateMessageResponse.cs | 2 ++ osu.Game/Online/API/Requests/Cursor.cs | 2 ++ osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs | 2 ++ osu.Game/Online/API/Requests/DownloadReplayRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetBeatmapRequest.cs | 2 -- osu.Game/Online/API/Requests/GetBeatmapSetRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetBeatmapsRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetBeatmapsResponse.cs | 2 ++ osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetChangelogRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetCommentsRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetCountriesResponse.cs | 2 ++ osu.Game/Online/API/Requests/GetCountryRankingsRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetFriendsRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetMessagesRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetNewsRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetNewsResponse.cs | 2 ++ osu.Game/Online/API/Requests/GetRankingsRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetScoresRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetSeasonalBackgroundsRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetSpotlightRankingsRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetSpotlightRankingsResponse.cs | 2 ++ osu.Game/Online/API/Requests/GetSpotlightsRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetTopUsersRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetTopUsersResponse.cs | 2 ++ osu.Game/Online/API/Requests/GetUpdatesRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetUpdatesResponse.cs | 2 ++ osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs | 2 ++ .../Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetUserRankingsRequest.cs | 2 ++ .../Online/API/Requests/GetUserRecentActivitiesRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetUserRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetUserScoresRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetUsersRequest.cs | 2 ++ osu.Game/Online/API/Requests/GetUsersResponse.cs | 2 ++ osu.Game/Online/API/Requests/GetWikiRequest.cs | 2 ++ osu.Game/Online/API/Requests/JoinChannelRequest.cs | 2 ++ osu.Game/Online/API/Requests/LeaveChannelRequest.cs | 2 ++ osu.Game/Online/API/Requests/ListChannelsRequest.cs | 2 ++ osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs | 2 ++ osu.Game/Online/API/Requests/PaginatedAPIRequest.cs | 2 ++ osu.Game/Online/API/Requests/PaginationParameters.cs | 2 ++ osu.Game/Online/API/Requests/PostBeatmapFavouriteRequest.cs | 2 ++ osu.Game/Online/API/Requests/PostMessageRequest.cs | 2 ++ osu.Game/Online/API/Requests/ResponseWithCursor.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIBeatmap.cs | 2 -- osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs | 2 -- osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIChangelogUser.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIChatChannel.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIKudosuHistory.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APINewsPost.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APINewsSidebar.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIPlayStyle.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIRankHistory.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIRecentActivity.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIScore.cs | 2 ++ .../Online/API/Requests/Responses/APIScoreWithPosition.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIScoresCollection.cs | 2 ++ .../Online/API/Requests/Responses/APISeasonalBackgrounds.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APISpotlight.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIUser.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIUserAchievement.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIUserContainer.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIUserHistoryCount.cs | 2 ++ .../Online/API/Requests/Responses/APIUserMostPlayedBeatmap.cs | 2 ++ .../Online/API/Requests/Responses/APIUserScoreAggregate.cs | 2 ++ osu.Game/Online/API/Requests/Responses/APIWikiPage.cs | 2 ++ osu.Game/Online/API/Requests/Responses/Comment.cs | 2 ++ osu.Game/Online/API/Requests/Responses/CommentBundle.cs | 2 ++ osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs | 2 ++ osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs | 2 ++ osu.Game/Online/BeatmapDownloadTracker.cs | 2 -- osu.Game/Online/Chat/Channel.cs | 2 ++ osu.Game/Online/Chat/ChannelManager.cs | 2 ++ osu.Game/Online/Chat/ChannelType.cs | 2 ++ osu.Game/Online/Chat/DrawableLinkCompiler.cs | 2 ++ osu.Game/Online/Chat/ErrorMessage.cs | 2 ++ osu.Game/Online/Chat/ExternalLinkOpener.cs | 2 ++ osu.Game/Online/Chat/IChannelPostTarget.cs | 2 ++ osu.Game/Online/Chat/InfoMessage.cs | 2 ++ osu.Game/Online/Chat/LocalEchoMessage.cs | 2 ++ osu.Game/Online/Chat/LocalMessage.cs | 2 ++ osu.Game/Online/Chat/Message.cs | 2 ++ osu.Game/Online/Chat/MessageFormatter.cs | 2 -- osu.Game/Online/Chat/MessageNotifier.cs | 2 ++ osu.Game/Online/Chat/NowPlayingCommand.cs | 2 ++ osu.Game/Online/Chat/StandAloneChatDisplay.cs | 2 ++ osu.Game/Online/DevelopmentEndpointConfiguration.cs | 2 ++ osu.Game/Online/DownloadState.cs | 2 ++ osu.Game/Online/DownloadTracker.cs | 2 -- osu.Game/Online/EndpointConfiguration.cs | 2 ++ osu.Game/Online/HubClientConnector.cs | 2 -- osu.Game/Online/IHubClientConnector.cs | 2 -- osu.Game/Online/Leaderboards/DrawableRank.cs | 2 ++ osu.Game/Online/Leaderboards/Leaderboard.cs | 2 ++ osu.Game/Online/Leaderboards/LeaderboardScore.cs | 2 ++ osu.Game/Online/Leaderboards/LeaderboardScoreTooltip.cs | 2 -- osu.Game/Online/Leaderboards/LeaderboardState.cs | 2 ++ osu.Game/Online/Leaderboards/UpdateableRank.cs | 2 ++ osu.Game/Online/Leaderboards/UserTopScoreContainer.cs | 2 ++ .../Online/Multiplayer/Countdown/CountdownChangedEvent.cs | 2 -- .../Multiplayer/Countdown/StartMatchCountdownRequest.cs | 2 -- osu.Game/Online/Multiplayer/Countdown/StopCountdownRequest.cs | 2 -- osu.Game/Online/Multiplayer/ForceGameplayStartCountdown.cs | 2 ++ osu.Game/Online/Multiplayer/IMultiplayerClient.cs | 2 ++ osu.Game/Online/Multiplayer/IMultiplayerLoungeServer.cs | 2 ++ osu.Game/Online/Multiplayer/IMultiplayerRoomServer.cs | 2 ++ osu.Game/Online/Multiplayer/IMultiplayerServer.cs | 2 ++ osu.Game/Online/Multiplayer/InvalidPasswordException.cs | 2 ++ osu.Game/Online/Multiplayer/InvalidStateChangeException.cs | 2 ++ osu.Game/Online/Multiplayer/InvalidStateException.cs | 2 ++ osu.Game/Online/Multiplayer/MatchRoomState.cs | 2 -- osu.Game/Online/Multiplayer/MatchServerEvent.cs | 2 -- osu.Game/Online/Multiplayer/MatchStartCountdown.cs | 2 -- .../Multiplayer/MatchTypes/TeamVersus/ChangeTeamRequest.cs | 2 -- .../Multiplayer/MatchTypes/TeamVersus/MultiplayerTeam.cs | 2 -- .../Multiplayer/MatchTypes/TeamVersus/TeamVersusRoomState.cs | 2 -- .../Multiplayer/MatchTypes/TeamVersus/TeamVersusUserState.cs | 2 -- osu.Game/Online/Multiplayer/MatchUserRequest.cs | 2 ++ osu.Game/Online/Multiplayer/MatchUserState.cs | 2 -- osu.Game/Online/Multiplayer/MultiplayerClient.cs | 2 -- osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs | 2 -- osu.Game/Online/Multiplayer/MultiplayerCountdown.cs | 2 -- osu.Game/Online/Multiplayer/MultiplayerRoom.cs | 2 -- osu.Game/Online/Multiplayer/MultiplayerRoomSettings.cs | 2 -- osu.Game/Online/Multiplayer/MultiplayerRoomState.cs | 2 -- osu.Game/Online/Multiplayer/MultiplayerRoomUser.cs | 2 -- osu.Game/Online/Multiplayer/MultiplayerUserState.cs | 2 ++ osu.Game/Online/Multiplayer/NotHostException.cs | 2 ++ osu.Game/Online/Multiplayer/NotJoinedRoomException.cs | 2 ++ osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs | 2 -- osu.Game/Online/Multiplayer/QueueMode.cs | 2 ++ osu.Game/Online/OnlineViewContainer.cs | 2 ++ osu.Game/Online/Placeholders/ClickablePlaceholder.cs | 2 ++ osu.Game/Online/Placeholders/LoginPlaceholder.cs | 2 ++ osu.Game/Online/Placeholders/MessagePlaceholder.cs | 2 ++ osu.Game/Online/Placeholders/Placeholder.cs | 2 ++ osu.Game/Online/PollingComponent.cs | 2 ++ osu.Game/Online/ProductionEndpointConfiguration.cs | 2 ++ osu.Game/Online/Rooms/APICreatedRoom.cs | 2 ++ osu.Game/Online/Rooms/APILeaderboard.cs | 2 ++ osu.Game/Online/Rooms/APIScoreToken.cs | 2 ++ osu.Game/Online/Rooms/BeatmapAvailability.cs | 2 ++ osu.Game/Online/Rooms/CreateRoomRequest.cs | 2 ++ osu.Game/Online/Rooms/CreateRoomScoreRequest.cs | 2 ++ osu.Game/Online/Rooms/GetRoomLeaderboardRequest.cs | 2 ++ osu.Game/Online/Rooms/GetRoomRequest.cs | 2 ++ osu.Game/Online/Rooms/GetRoomsRequest.cs | 2 ++ osu.Game/Online/Rooms/IndexPlaylistScoresRequest.cs | 2 ++ osu.Game/Online/Rooms/IndexScoresParams.cs | 2 ++ osu.Game/Online/Rooms/IndexedMultiplayerScores.cs | 2 ++ osu.Game/Online/Rooms/ItemAttemptsCount.cs | 2 ++ osu.Game/Online/Rooms/JoinRoomRequest.cs | 2 ++ osu.Game/Online/Rooms/MatchType.cs | 2 ++ osu.Game/Online/Rooms/MultiplayerPlaylistItem.cs | 2 -- osu.Game/Online/Rooms/MultiplayerScore.cs | 2 ++ osu.Game/Online/Rooms/MultiplayerScores.cs | 2 ++ osu.Game/Online/Rooms/MultiplayerScoresAround.cs | 2 ++ osu.Game/Online/Rooms/OnlinePlayBeatmapAvailabilityTracker.cs | 2 ++ osu.Game/Online/Rooms/PartRoomRequest.cs | 2 ++ osu.Game/Online/Rooms/PlaylistAggregateScore.cs | 2 ++ osu.Game/Online/Rooms/PlaylistExtensions.cs | 2 -- osu.Game/Online/Rooms/PlaylistItem.cs | 2 -- osu.Game/Online/Rooms/Room.cs | 2 ++ osu.Game/Online/Rooms/RoomAvailability.cs | 2 ++ osu.Game/Online/Rooms/RoomCategory.cs | 2 ++ osu.Game/Online/Rooms/RoomStatus.cs | 2 ++ osu.Game/Online/Rooms/RoomStatuses/RoomStatusEnded.cs | 2 ++ osu.Game/Online/Rooms/RoomStatuses/RoomStatusOpen.cs | 2 ++ osu.Game/Online/Rooms/RoomStatuses/RoomStatusPlaying.cs | 2 ++ osu.Game/Online/Rooms/ShowPlaylistUserScoreRequest.cs | 2 ++ osu.Game/Online/Rooms/SubmitRoomScoreRequest.cs | 2 ++ osu.Game/Online/Rooms/SubmitScoreRequest.cs | 2 ++ osu.Game/Online/ScoreDownloadTracker.cs | 2 -- osu.Game/Online/SignalRDerivedTypeWorkaroundJsonConverter.cs | 1 - osu.Game/Online/SignalRUnionWorkaroundResolver.cs | 2 ++ osu.Game/Online/SignalRWorkaroundTypes.cs | 2 ++ osu.Game/Online/Solo/CreateSoloScoreRequest.cs | 2 ++ osu.Game/Online/Solo/SubmitSoloScoreRequest.cs | 2 ++ osu.Game/Online/Solo/SubmittableScore.cs | 2 ++ osu.Game/Online/Spectator/FrameDataBundle.cs | 2 -- osu.Game/Online/Spectator/FrameHeader.cs | 2 -- osu.Game/Online/Spectator/ISpectatorClient.cs | 2 ++ osu.Game/Online/Spectator/ISpectatorServer.cs | 2 ++ osu.Game/Online/Spectator/OnlineSpectatorClient.cs | 2 -- osu.Game/Online/Spectator/SpectatedUserState.cs | 2 ++ osu.Game/Online/Spectator/SpectatorClient.cs | 2 -- osu.Game/Online/Spectator/SpectatorScoreProcessor.cs | 2 -- osu.Game/Online/Spectator/SpectatorState.cs | 2 ++ osu.Game/OsuGame.cs | 2 ++ osu.Game/OsuGameBase.cs | 2 ++ osu.Game/OsuGameBase_Importing.cs | 2 ++ .../Overlays/AccountCreation/AccountCreationBackground.cs | 2 ++ osu.Game/Overlays/AccountCreation/AccountCreationScreen.cs | 2 ++ osu.Game/Overlays/AccountCreation/ScreenEntry.cs | 2 ++ osu.Game/Overlays/AccountCreation/ScreenWarning.cs | 2 ++ osu.Game/Overlays/AccountCreation/ScreenWelcome.cs | 2 ++ osu.Game/Overlays/AccountCreationOverlay.cs | 2 ++ .../BeatmapListing/BeatmapListingCardSizeTabControl.cs | 2 ++ .../Overlays/BeatmapListing/BeatmapListingFilterControl.cs | 2 ++ osu.Game/Overlays/BeatmapListing/BeatmapListingHeader.cs | 2 ++ .../Overlays/BeatmapListing/BeatmapListingSearchControl.cs | 2 ++ .../Overlays/BeatmapListing/BeatmapListingSortTabControl.cs | 2 ++ osu.Game/Overlays/BeatmapListing/BeatmapSearchFilterRow.cs | 2 ++ .../Overlays/BeatmapListing/BeatmapSearchGeneralFilterRow.cs | 2 ++ .../BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs | 2 ++ .../Overlays/BeatmapListing/BeatmapSearchRulesetFilterRow.cs | 2 ++ .../Overlays/BeatmapListing/BeatmapSearchScoreFilterRow.cs | 2 ++ osu.Game/Overlays/BeatmapListing/FilterTabItem.cs | 2 ++ osu.Game/Overlays/BeatmapListing/SearchCategory.cs | 2 ++ osu.Game/Overlays/BeatmapListing/SearchExplicit.cs | 2 ++ osu.Game/Overlays/BeatmapListing/SearchExtra.cs | 2 ++ osu.Game/Overlays/BeatmapListing/SearchGeneral.cs | 2 ++ osu.Game/Overlays/BeatmapListing/SearchGenre.cs | 2 ++ osu.Game/Overlays/BeatmapListing/SearchLanguage.cs | 2 ++ osu.Game/Overlays/BeatmapListing/SearchPlayed.cs | 2 ++ osu.Game/Overlays/BeatmapListing/SortCriteria.cs | 2 ++ osu.Game/Overlays/BeatmapListingOverlay.cs | 2 ++ osu.Game/Overlays/BeatmapSet/AuthorInfo.cs | 2 ++ osu.Game/Overlays/BeatmapSet/BasicStats.cs | 2 ++ osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs | 2 ++ osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs | 2 -- osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs | 2 ++ osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs | 2 ++ osu.Game/Overlays/BeatmapSet/BeatmapRulesetTabItem.cs | 2 ++ osu.Game/Overlays/BeatmapSet/BeatmapSetHeader.cs | 2 ++ osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs | 2 ++ osu.Game/Overlays/BeatmapSet/BeatmapSetLayoutSection.cs | 2 ++ osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs | 2 ++ osu.Game/Overlays/BeatmapSet/Buttons/HeaderButton.cs | 2 ++ osu.Game/Overlays/BeatmapSet/Buttons/HeaderDownloadButton.cs | 2 ++ osu.Game/Overlays/BeatmapSet/Buttons/PlayButton.cs | 2 ++ osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs | 2 ++ osu.Game/Overlays/BeatmapSet/Details.cs | 2 ++ osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapBadge.cs | 2 -- osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs | 2 -- osu.Game/Overlays/BeatmapSet/Info.cs | 2 ++ osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs | 2 ++ osu.Game/Overlays/BeatmapSet/LeaderboardScopeSelector.cs | 2 ++ osu.Game/Overlays/BeatmapSet/MetadataSection.cs | 2 ++ osu.Game/Overlays/BeatmapSet/MetadataType.cs | 2 ++ osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs | 2 ++ osu.Game/Overlays/BeatmapSet/Scores/NoScoresPlaceholder.cs | 2 ++ .../Overlays/BeatmapSet/Scores/NotSupporterPlaceholder.cs | 2 ++ osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs | 2 ++ .../Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs | 2 ++ osu.Game/Overlays/BeatmapSet/Scores/ScoreboardTime.cs | 2 ++ osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs | 2 ++ .../Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs | 2 ++ osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs | 2 ++ osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs | 2 -- osu.Game/Overlays/BeatmapSet/SuccessRate.cs | 2 ++ osu.Game/Overlays/BeatmapSetOverlay.cs | 2 ++ osu.Game/Overlays/BreadcrumbControlOverlayHeader.cs | 2 ++ osu.Game/Overlays/Changelog/ChangelogBuild.cs | 2 ++ osu.Game/Overlays/Changelog/ChangelogContent.cs | 2 ++ osu.Game/Overlays/Changelog/ChangelogEntry.cs | 2 ++ osu.Game/Overlays/Changelog/ChangelogHeader.cs | 2 ++ osu.Game/Overlays/Changelog/ChangelogListing.cs | 2 ++ osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs | 2 ++ osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs | 2 ++ osu.Game/Overlays/Changelog/ChangelogUpdateStreamControl.cs | 2 ++ osu.Game/Overlays/Changelog/ChangelogUpdateStreamItem.cs | 2 ++ osu.Game/Overlays/ChangelogOverlay.cs | 2 ++ osu.Game/Overlays/Chat/ChannelList/ChannelList.cs | 2 -- osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs | 2 -- .../Overlays/Chat/ChannelList/ChannelListItemCloseButton.cs | 2 -- .../Overlays/Chat/ChannelList/ChannelListItemMentionPill.cs | 2 -- osu.Game/Overlays/Chat/ChannelScrollContainer.cs | 2 ++ osu.Game/Overlays/Chat/ChatLine.cs | 2 -- osu.Game/Overlays/Chat/ChatOverlayTopBar.cs | 2 -- osu.Game/Overlays/Chat/ChatTextBar.cs | 2 -- osu.Game/Overlays/Chat/ChatTextBox.cs | 2 -- osu.Game/Overlays/Chat/DaySeparator.cs | 2 -- osu.Game/Overlays/Chat/DrawableChannel.cs | 2 ++ osu.Game/Overlays/Chat/ExternalLinkDialog.cs | 2 ++ osu.Game/Overlays/Chat/Listing/ChannelListing.cs | 2 -- osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs | 2 -- osu.Game/Overlays/ChatOverlay.cs | 2 -- osu.Game/Overlays/Comments/Buttons/ChevronButton.cs | 2 ++ osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs | 2 ++ osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs | 2 ++ osu.Game/Overlays/Comments/Buttons/ShowMoreRepliesButton.cs | 2 ++ osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs | 2 ++ osu.Game/Overlays/Comments/CancellableCommentEditor.cs | 2 ++ osu.Game/Overlays/Comments/CommentEditor.cs | 2 ++ osu.Game/Overlays/Comments/CommentMarkdownContainer.cs | 2 ++ osu.Game/Overlays/Comments/CommentsContainer.cs | 2 ++ osu.Game/Overlays/Comments/CommentsHeader.cs | 2 ++ osu.Game/Overlays/Comments/CommentsShowMoreButton.cs | 2 ++ osu.Game/Overlays/Comments/DeletedCommentsCounter.cs | 2 ++ osu.Game/Overlays/Comments/DrawableComment.cs | 2 ++ osu.Game/Overlays/Comments/HeaderButton.cs | 2 ++ osu.Game/Overlays/Comments/TotalCommentsCounter.cs | 2 ++ osu.Game/Overlays/Comments/VotePill.cs | 2 ++ osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs | 2 ++ osu.Game/Overlays/Dashboard/DashboardOverlayHeader.cs | 2 ++ osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs | 2 ++ .../Overlays/Dashboard/Friends/FriendOnlineStreamControl.cs | 2 ++ osu.Game/Overlays/Dashboard/Friends/FriendStream.cs | 2 ++ .../Overlays/Dashboard/Friends/FriendsOnlineStatusItem.cs | 2 ++ osu.Game/Overlays/Dashboard/Friends/OnlineStatus.cs | 2 ++ osu.Game/Overlays/Dashboard/Friends/UserListToolbar.cs | 2 ++ osu.Game/Overlays/Dashboard/Friends/UserSortTabControl.cs | 2 ++ osu.Game/Overlays/Dashboard/Home/DashboardBeatmapListing.cs | 2 ++ osu.Game/Overlays/Dashboard/Home/DashboardBeatmapPanel.cs | 2 ++ osu.Game/Overlays/Dashboard/Home/DashboardNewBeatmapPanel.cs | 2 ++ .../Overlays/Dashboard/Home/DashboardPopularBeatmapPanel.cs | 2 ++ osu.Game/Overlays/Dashboard/Home/DrawableBeatmapList.cs | 2 ++ osu.Game/Overlays/Dashboard/Home/DrawableNewBeatmapList.cs | 2 ++ .../Overlays/Dashboard/Home/DrawablePopularBeatmapList.cs | 2 ++ osu.Game/Overlays/Dashboard/Home/HomePanel.cs | 2 ++ .../Overlays/Dashboard/Home/News/FeaturedNewsItemPanel.cs | 2 ++ osu.Game/Overlays/Dashboard/Home/News/NewsGroupItem.cs | 2 ++ osu.Game/Overlays/Dashboard/Home/News/NewsItemGroupPanel.cs | 2 ++ osu.Game/Overlays/Dashboard/Home/News/NewsTitleLink.cs | 2 ++ osu.Game/Overlays/Dashboard/Home/News/ShowMoreNewsPanel.cs | 2 ++ osu.Game/Overlays/DashboardOverlay.cs | 2 ++ osu.Game/Overlays/Dialog/ConfirmDialog.cs | 2 ++ osu.Game/Overlays/Dialog/PopupDialog.cs | 2 ++ osu.Game/Overlays/Dialog/PopupDialogButton.cs | 2 ++ osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs | 2 ++ osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs | 2 ++ osu.Game/Overlays/Dialog/PopupDialogOkButton.cs | 2 ++ osu.Game/Overlays/DialogOverlay.cs | 2 ++ osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs | 2 ++ osu.Game/Overlays/FirstRunSetup/ProgressRoundedButton.cs | 1 - osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs | 2 -- osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs | 2 ++ osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs | 2 -- osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs | 2 ++ osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs | 2 ++ osu.Game/Overlays/FirstRunSetupOverlay.cs | 2 -- osu.Game/Overlays/FullscreenOverlay.cs | 2 ++ osu.Game/Overlays/HoldToConfirmOverlay.cs | 2 ++ osu.Game/Overlays/IDialogOverlay.cs | 2 -- osu.Game/Overlays/INamedOverlayComponent.cs | 2 ++ osu.Game/Overlays/INotificationOverlay.cs | 2 ++ osu.Game/Overlays/IOverlayManager.cs | 2 ++ osu.Game/Overlays/Login/LoginForm.cs | 2 ++ osu.Game/Overlays/Login/LoginPanel.cs | 2 ++ osu.Game/Overlays/Login/UserAction.cs | 4 +++- osu.Game/Overlays/Login/UserDropdown.cs | 2 ++ osu.Game/Overlays/LoginOverlay.cs | 2 ++ osu.Game/Overlays/MedalOverlay.cs | 2 ++ osu.Game/Overlays/MedalSplash/DrawableMedal.cs | 2 ++ osu.Game/Overlays/Mods/DeselectAllModsButton.cs | 2 ++ osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs | 2 ++ osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs | 2 ++ osu.Game/Overlays/Mods/IncompatibilityDisplayingTooltip.cs | 2 ++ osu.Game/Overlays/Mods/ModButtonTooltip.cs | 2 ++ osu.Game/Overlays/Mods/ModColumn.cs | 2 -- osu.Game/Overlays/Mods/ModPanel.cs | 2 -- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 -- osu.Game/Overlays/Mods/ModSettingsArea.cs | 2 ++ osu.Game/Overlays/Mods/ModState.cs | 2 ++ osu.Game/Overlays/Mods/SelectAllModsButton.cs | 2 ++ osu.Game/Overlays/Mods/ShearedOverlayContainer.cs | 2 ++ osu.Game/Overlays/Mods/UserModSelectOverlay.cs | 2 ++ osu.Game/Overlays/Music/CollectionDropdown.cs | 2 ++ osu.Game/Overlays/Music/FilterControl.cs | 2 ++ osu.Game/Overlays/Music/FilterCriteria.cs | 2 ++ osu.Game/Overlays/Music/MusicKeyBindingHandler.cs | 2 ++ osu.Game/Overlays/Music/Playlist.cs | 2 ++ osu.Game/Overlays/Music/PlaylistItem.cs | 2 ++ osu.Game/Overlays/Music/PlaylistOverlay.cs | 2 ++ osu.Game/Overlays/MusicController.cs | 2 ++ osu.Game/Overlays/News/Displays/ArticleListing.cs | 2 ++ osu.Game/Overlays/News/NewsCard.cs | 2 ++ osu.Game/Overlays/News/NewsHeader.cs | 2 ++ osu.Game/Overlays/News/NewsPostBackground.cs | 2 ++ osu.Game/Overlays/News/Sidebar/MonthSection.cs | 2 ++ osu.Game/Overlays/News/Sidebar/NewsSidebar.cs | 2 ++ osu.Game/Overlays/News/Sidebar/YearsPanel.cs | 2 ++ osu.Game/Overlays/NewsOverlay.cs | 2 ++ osu.Game/Overlays/NotificationOverlay.cs | 2 -- osu.Game/Overlays/Notifications/IHasCompletionTarget.cs | 2 ++ osu.Game/Overlays/Notifications/Notification.cs | 2 ++ osu.Game/Overlays/Notifications/NotificationSection.cs | 2 ++ .../Overlays/Notifications/ProgressCompletionNotification.cs | 2 ++ osu.Game/Overlays/Notifications/ProgressNotification.cs | 2 ++ osu.Game/Overlays/Notifications/SimpleErrorNotification.cs | 2 ++ osu.Game/Overlays/Notifications/SimpleNotification.cs | 2 ++ osu.Game/Overlays/NowPlayingOverlay.cs | 2 ++ osu.Game/Overlays/OSD/Toast.cs | 2 ++ osu.Game/Overlays/OSD/TrackedSettingToast.cs | 2 ++ osu.Game/Overlays/OnScreenDisplay.cs | 2 ++ osu.Game/Overlays/OnlineOverlay.cs | 2 ++ osu.Game/Overlays/OverlayActivation.cs | 2 ++ osu.Game/Overlays/OverlayColourProvider.cs | 2 ++ osu.Game/Overlays/OverlayHeader.cs | 2 ++ osu.Game/Overlays/OverlayHeaderBackground.cs | 2 ++ osu.Game/Overlays/OverlayPanelDisplayStyleControl.cs | 2 ++ osu.Game/Overlays/OverlayRulesetSelector.cs | 2 ++ osu.Game/Overlays/OverlayRulesetTabItem.cs | 2 ++ osu.Game/Overlays/OverlayScrollContainer.cs | 2 ++ osu.Game/Overlays/OverlaySidebar.cs | 2 ++ osu.Game/Overlays/OverlaySortTabControl.cs | 2 ++ osu.Game/Overlays/OverlayStreamControl.cs | 2 ++ osu.Game/Overlays/OverlayStreamItem.cs | 2 ++ osu.Game/Overlays/OverlayTabControl.cs | 2 ++ osu.Game/Overlays/OverlayTitle.cs | 2 ++ osu.Game/Overlays/OverlayView.cs | 2 ++ osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs | 2 ++ osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs | 2 ++ osu.Game/Overlays/Profile/Header/Components/DrawableBadge.cs | 2 ++ .../Overlays/Profile/Header/Components/ExpandDetailsButton.cs | 2 ++ .../Overlays/Profile/Header/Components/FollowersButton.cs | 2 ++ osu.Game/Overlays/Profile/Header/Components/LevelBadge.cs | 2 ++ .../Overlays/Profile/Header/Components/LevelProgressBar.cs | 2 ++ .../Profile/Header/Components/MappingSubscribersButton.cs | 2 ++ .../Overlays/Profile/Header/Components/MessageUserButton.cs | 2 ++ .../Profile/Header/Components/OverlinedInfoContainer.cs | 2 ++ .../Profile/Header/Components/OverlinedTotalPlayTime.cs | 2 ++ .../Overlays/Profile/Header/Components/PreviousUsernames.cs | 2 ++ .../Overlays/Profile/Header/Components/ProfileHeaderButton.cs | 2 ++ .../Header/Components/ProfileHeaderStatisticsButton.cs | 2 ++ .../Profile/Header/Components/ProfileRulesetSelector.cs | 2 ++ .../Profile/Header/Components/ProfileRulesetTabItem.cs | 2 ++ osu.Game/Overlays/Profile/Header/Components/RankGraph.cs | 2 ++ osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs | 2 ++ osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs | 2 ++ osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs | 2 ++ osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs | 2 ++ osu.Game/Overlays/Profile/ProfileHeader.cs | 2 ++ osu.Game/Overlays/Profile/ProfileSection.cs | 2 ++ osu.Game/Overlays/Profile/Sections/AboutSection.cs | 2 ++ .../Overlays/Profile/Sections/BeatmapMetadataContainer.cs | 2 ++ .../Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs | 2 ++ osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs | 2 ++ osu.Game/Overlays/Profile/Sections/CounterPill.cs | 2 ++ .../Profile/Sections/Historical/ChartProfileSubsection.cs | 2 ++ .../Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs | 2 ++ .../Historical/PaginatedMostPlayedBeatmapContainer.cs | 2 ++ .../Profile/Sections/Historical/PlayHistorySubsection.cs | 2 ++ .../Overlays/Profile/Sections/Historical/ProfileLineChart.cs | 2 ++ .../Overlays/Profile/Sections/Historical/ReplaysSubsection.cs | 2 ++ .../Overlays/Profile/Sections/Historical/UserHistoryGraph.cs | 2 ++ osu.Game/Overlays/Profile/Sections/HistoricalSection.cs | 2 ++ .../Profile/Sections/Kudosu/DrawableKudosuHistoryItem.cs | 2 ++ osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs | 2 ++ .../Sections/Kudosu/PaginatedKudosuHistoryContainer.cs | 2 ++ osu.Game/Overlays/Profile/Sections/KudosuSection.cs | 2 ++ osu.Game/Overlays/Profile/Sections/MedalsSection.cs | 2 ++ .../Overlays/Profile/Sections/PaginatedProfileSubsection.cs | 2 ++ osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs | 2 ++ osu.Game/Overlays/Profile/Sections/ProfileSubsection.cs | 2 ++ osu.Game/Overlays/Profile/Sections/ProfileSubsectionHeader.cs | 2 ++ .../Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs | 2 ++ .../Profile/Sections/Ranks/DrawableProfileWeightedScore.cs | 2 ++ .../Profile/Sections/Ranks/PaginatedScoreContainer.cs | 2 ++ osu.Game/Overlays/Profile/Sections/RanksSection.cs | 2 ++ .../Profile/Sections/Recent/DrawableRecentActivity.cs | 2 ++ osu.Game/Overlays/Profile/Sections/Recent/MedalIcon.cs | 2 ++ .../Sections/Recent/PaginatedRecentActivityContainer.cs | 2 ++ osu.Game/Overlays/Profile/Sections/RecentSection.cs | 2 ++ osu.Game/Overlays/Profile/UserGraph.cs | 2 ++ osu.Game/Overlays/Rankings/CountryFilter.cs | 2 ++ osu.Game/Overlays/Rankings/CountryPill.cs | 2 ++ osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs | 2 ++ osu.Game/Overlays/Rankings/RankingsScope.cs | 2 ++ osu.Game/Overlays/Rankings/RankingsSortTabControl.cs | 2 ++ osu.Game/Overlays/Rankings/SpotlightSelector.cs | 2 ++ osu.Game/Overlays/Rankings/SpotlightsLayout.cs | 2 ++ osu.Game/Overlays/Rankings/Tables/CountriesTable.cs | 2 ++ osu.Game/Overlays/Rankings/Tables/PerformanceTable.cs | 2 ++ osu.Game/Overlays/Rankings/Tables/RankingsTable.cs | 2 ++ osu.Game/Overlays/Rankings/Tables/ScoresTable.cs | 2 ++ osu.Game/Overlays/Rankings/Tables/TableRowBackground.cs | 2 ++ osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs | 2 ++ osu.Game/Overlays/RankingsOverlay.cs | 2 ++ osu.Game/Overlays/RestoreDefaultValueButton.cs | 2 ++ osu.Game/Overlays/Settings/DangerousSettingsButton.cs | 2 ++ osu.Game/Overlays/Settings/ISettingsItem.cs | 2 ++ osu.Game/Overlays/Settings/OutlinedTextBox.cs | 2 ++ osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs | 2 ++ .../Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/AudioSection.cs | 2 ++ osu.Game/Overlays/Settings/Sections/DebugSection.cs | 2 ++ .../Settings/Sections/DebugSettings/GeneralSettings.cs | 2 ++ .../Settings/Sections/DebugSettings/MemorySettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs | 2 ++ .../Overlays/Settings/Sections/Gameplay/BackgroundSettings.cs | 2 ++ .../Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs | 2 ++ .../Overlays/Settings/Sections/Gameplay/GeneralSettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/GameplaySection.cs | 2 ++ .../Overlays/Settings/Sections/General/LanguageSettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/GeneralSection.cs | 2 ++ .../Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 2 ++ .../Overlays/Settings/Sections/Graphics/RendererSettings.cs | 2 ++ .../Overlays/Settings/Sections/Graphics/ScreenshotSettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/Graphics/VideoSettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/GraphicsSection.cs | 2 ++ osu.Game/Overlays/Settings/Sections/Input/BindingSettings.cs | 2 ++ .../Settings/Sections/Input/GlobalKeyBindingsSection.cs | 2 ++ osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/Input/KeyBindingPanel.cs | 2 ++ osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs | 2 ++ .../Overlays/Settings/Sections/Input/KeyBindingsSubsection.cs | 2 ++ osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs | 2 ++ .../Overlays/Settings/Sections/Input/RotationPresetButtons.cs | 2 ++ .../Settings/Sections/Input/RulesetBindingsSection.cs | 2 ++ .../Overlays/Settings/Sections/Input/TabletAreaSelection.cs | 2 ++ osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs | 2 ++ .../Settings/Sections/Input/VariantBindingsSubsection.cs | 2 ++ osu.Game/Overlays/Settings/Sections/InputSection.cs | 2 ++ .../Settings/Sections/Maintenance/DirectorySelectScreen.cs | 2 ++ .../Overlays/Settings/Sections/Maintenance/GeneralSettings.cs | 2 ++ .../Sections/Maintenance/MassDeleteConfirmationDialog.cs | 2 ++ .../Sections/Maintenance/MassVideoDeleteConfirmationDialog.cs | 2 ++ .../Settings/Sections/Maintenance/MigrationRunScreen.cs | 2 ++ .../Settings/Sections/Maintenance/MigrationSelectScreen.cs | 2 ++ .../Sections/Maintenance/StableDirectoryLocationDialog.cs | 2 ++ .../Sections/Maintenance/StableDirectorySelectScreen.cs | 2 ++ osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs | 2 ++ .../Settings/Sections/Online/AlertsAndPrivacySettings.cs | 2 ++ .../Overlays/Settings/Sections/Online/IntegrationSettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/OnlineSection.cs | 2 ++ osu.Game/Overlays/Settings/Sections/RulesetSection.cs | 2 ++ osu.Game/Overlays/Settings/Sections/SizeSlider.cs | 2 ++ osu.Game/Overlays/Settings/Sections/SkinSection.cs | 2 ++ .../Settings/Sections/UserInterface/GeneralSettings.cs | 2 ++ .../Settings/Sections/UserInterface/MainMenuSettings.cs | 2 ++ .../Settings/Sections/UserInterface/SongSelectSettings.cs | 2 ++ osu.Game/Overlays/Settings/Sections/UserInterfaceSection.cs | 2 ++ osu.Game/Overlays/Settings/SettingsButton.cs | 2 ++ osu.Game/Overlays/Settings/SettingsCheckbox.cs | 2 ++ osu.Game/Overlays/Settings/SettingsDropdown.cs | 2 ++ osu.Game/Overlays/Settings/SettingsEnumDropdown.cs | 2 ++ osu.Game/Overlays/Settings/SettingsFooter.cs | 2 ++ osu.Game/Overlays/Settings/SettingsHeader.cs | 2 ++ osu.Game/Overlays/Settings/SettingsItem.cs | 2 ++ osu.Game/Overlays/Settings/SettingsNumberBox.cs | 2 ++ osu.Game/Overlays/Settings/SettingsSection.cs | 2 ++ osu.Game/Overlays/Settings/SettingsSidebar.cs | 2 ++ osu.Game/Overlays/Settings/SettingsSlider.cs | 2 ++ osu.Game/Overlays/Settings/SettingsSubsection.cs | 2 ++ osu.Game/Overlays/Settings/SettingsTextBox.cs | 2 ++ osu.Game/Overlays/Settings/SidebarButton.cs | 2 ++ osu.Game/Overlays/Settings/SidebarIconButton.cs | 2 ++ osu.Game/Overlays/SettingsOverlay.cs | 2 ++ osu.Game/Overlays/SettingsPanel.cs | 2 ++ osu.Game/Overlays/SettingsSubPanel.cs | 2 ++ osu.Game/Overlays/SettingsToolboxGroup.cs | 2 ++ osu.Game/Overlays/SortDirection.cs | 2 ++ osu.Game/Overlays/TabControlOverlayHeader.cs | 2 ++ osu.Game/Overlays/TabbableOnlineOverlay.cs | 2 ++ osu.Game/Overlays/Toolbar/AnalogClockDisplay.cs | 2 ++ osu.Game/Overlays/Toolbar/ClockDisplay.cs | 2 ++ osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs | 2 ++ osu.Game/Overlays/Toolbar/Toolbar.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarBeatmapListingButton.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarButton.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarChatButton.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarClock.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarNewsButton.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarRankingsButton.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarUserButton.cs | 2 ++ osu.Game/Overlays/Toolbar/ToolbarWikiButton.cs | 2 ++ osu.Game/Overlays/UserProfileOverlay.cs | 2 ++ osu.Game/Overlays/VersionManager.cs | 2 ++ osu.Game/Overlays/Volume/MuteButton.cs | 2 ++ osu.Game/Overlays/Volume/VolumeControlReceptor.cs | 2 ++ osu.Game/Overlays/Volume/VolumeMeter.cs | 2 ++ osu.Game/Overlays/VolumeOverlay.cs | 2 ++ osu.Game/Overlays/WaveOverlayContainer.cs | 2 ++ osu.Game/Overlays/Wiki/Markdown/WikiMarkdownContainer.cs | 2 ++ osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImage.cs | 2 ++ osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImageBlock.cs | 2 ++ osu.Game/Overlays/Wiki/Markdown/WikiNoticeContainer.cs | 2 ++ osu.Game/Overlays/Wiki/WikiArticlePage.cs | 2 ++ osu.Game/Overlays/Wiki/WikiHeader.cs | 2 ++ osu.Game/Overlays/Wiki/WikiMainPage.cs | 2 ++ osu.Game/Overlays/Wiki/WikiPanelContainer.cs | 2 ++ osu.Game/Overlays/Wiki/WikiSidebar.cs | 2 ++ osu.Game/Overlays/Wiki/WikiTableOfContents.cs | 2 ++ osu.Game/Overlays/WikiOverlay.cs | 2 ++ osu.Game/PerformFromMenuRunner.cs | 2 ++ osu.Game/Performance/HighPerformanceSession.cs | 2 ++ osu.Game/Properties/AssemblyInfo.cs | 2 ++ osu.Game/Replays/Legacy/LegacyReplayFrame.cs | 2 ++ osu.Game/Replays/Legacy/ReplayButtonState.cs | 2 ++ osu.Game/Replays/Replay.cs | 2 ++ osu.Game/Rulesets/AssemblyRulesetStore.cs | 2 -- osu.Game/Rulesets/Configuration/IRulesetConfigManager.cs | 2 ++ osu.Game/Rulesets/Configuration/RulesetConfigManager.cs | 2 ++ osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs | 2 ++ osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs | 2 ++ osu.Game/Rulesets/Difficulty/PerformanceAttributes.cs | 2 ++ osu.Game/Rulesets/Difficulty/PerformanceBreakdown.cs | 2 ++ .../Rulesets/Difficulty/PerformanceBreakdownCalculator.cs | 2 ++ osu.Game/Rulesets/Difficulty/PerformanceCalculator.cs | 2 ++ osu.Game/Rulesets/Difficulty/PerformanceDisplayAttribute.cs | 2 ++ .../Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs | 2 ++ osu.Game/Rulesets/Difficulty/Skills/Skill.cs | 2 ++ osu.Game/Rulesets/Difficulty/Skills/StrainDecaySkill.cs | 2 ++ osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs | 2 ++ osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs | 2 ++ osu.Game/Rulesets/Difficulty/Utils/LimitedCapacityQueue.cs | 2 ++ osu.Game/Rulesets/Difficulty/Utils/ReverseQueue.cs | 2 ++ osu.Game/Rulesets/EFRulesetInfo.cs | 2 ++ osu.Game/Rulesets/Edit/BeatmapVerifier.cs | 2 ++ osu.Game/Rulesets/Edit/BeatmapVerifierContext.cs | 2 -- osu.Game/Rulesets/Edit/Checks/CheckAudioInVideo.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/CheckAudioPresence.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/CheckAudioQuality.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/CheckBackgroundPresence.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/CheckBackgroundQuality.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/CheckConcurrentObjects.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/CheckFewHitsounds.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/CheckFilePresence.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/CheckMutedObjects.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/CheckTooShortAudioFiles.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/CheckUnsnappedObjects.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/CheckZeroByteFiles.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/CheckZeroLengthObjects.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/Components/CheckCategory.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/Components/CheckMetadata.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/Components/ICheck.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/Components/Issue.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/Components/IssueTemplate.cs | 2 ++ osu.Game/Rulesets/Edit/Checks/Components/IssueType.cs | 2 ++ osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs | 2 ++ osu.Game/Rulesets/Edit/DrawableEditorRulesetWrapper.cs | 2 ++ osu.Game/Rulesets/Edit/EditorToolboxGroup.cs | 2 ++ osu.Game/Rulesets/Edit/ExpandingToolboxContainer.cs | 2 ++ osu.Game/Rulesets/Edit/HitObjectComposer.cs | 2 ++ osu.Game/Rulesets/Edit/HitObjectSelectionBlueprint.cs | 2 ++ osu.Game/Rulesets/Edit/IBeatSnapProvider.cs | 2 ++ osu.Game/Rulesets/Edit/IBeatmapVerifier.cs | 2 ++ osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs | 2 ++ osu.Game/Rulesets/Edit/IPositionSnapProvider.cs | 2 ++ osu.Game/Rulesets/Edit/PlacementBlueprint.cs | 2 ++ osu.Game/Rulesets/Edit/SelectionBlueprint.cs | 2 ++ osu.Game/Rulesets/Edit/SnapResult.cs | 2 ++ osu.Game/Rulesets/Edit/SnapType.cs | 2 ++ osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs | 2 ++ osu.Game/Rulesets/Edit/Tools/SelectTool.cs | 2 ++ osu.Game/Rulesets/Filter/IRulesetFilterCriteria.cs | 2 ++ osu.Game/Rulesets/ILegacyRuleset.cs | 2 ++ osu.Game/Rulesets/IRulesetConfigCache.cs | 2 -- osu.Game/Rulesets/IRulesetInfo.cs | 2 -- osu.Game/Rulesets/IRulesetStore.cs | 2 -- osu.Game/Rulesets/Judgements/DefaultJudgementPiece.cs | 2 ++ osu.Game/Rulesets/Judgements/DrawableJudgement.cs | 2 ++ osu.Game/Rulesets/Judgements/IAnimatableJudgement.cs | 2 ++ osu.Game/Rulesets/Judgements/IgnoreJudgement.cs | 2 ++ osu.Game/Rulesets/Judgements/Judgement.cs | 2 ++ osu.Game/Rulesets/Judgements/JudgementResult.cs | 2 ++ osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs | 2 ++ osu.Game/Rulesets/Mods/DifficultyBindable.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableAfterBeatmapConversion.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableFailOverride.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableMod.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToAudio.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToBeatmapConverter.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToBeatmapProcessor.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToDifficulty.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToDrawableHitObjects.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToDrawableRuleset.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToHUD.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToHealthProcessor.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToHitObject.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToPlayer.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToRate.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToSample.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToScoreProcessor.cs | 2 ++ osu.Game/Rulesets/Mods/IApplicableToTrack.cs | 2 ++ osu.Game/Rulesets/Mods/ICreateReplay.cs | 2 ++ osu.Game/Rulesets/Mods/ICreateReplayData.cs | 2 ++ osu.Game/Rulesets/Mods/IHasSeed.cs | 2 ++ osu.Game/Rulesets/Mods/IMod.cs | 2 ++ osu.Game/Rulesets/Mods/IReadFromConfig.cs | 2 ++ osu.Game/Rulesets/Mods/IUpdatableByPlayfield.cs | 2 ++ osu.Game/Rulesets/Mods/MetronomeBeat.cs | 2 ++ osu.Game/Rulesets/Mods/Mod.cs | 2 ++ osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs | 2 ++ osu.Game/Rulesets/Mods/ModAutoplay.cs | 2 ++ osu.Game/Rulesets/Mods/ModBarrelRoll.cs | 2 ++ osu.Game/Rulesets/Mods/ModBlockFail.cs | 2 ++ osu.Game/Rulesets/Mods/ModCinema.cs | 2 ++ osu.Game/Rulesets/Mods/ModClassic.cs | 2 ++ osu.Game/Rulesets/Mods/ModDaycore.cs | 2 ++ osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs | 2 ++ osu.Game/Rulesets/Mods/ModDoubleTime.cs | 2 ++ osu.Game/Rulesets/Mods/ModEasy.cs | 2 ++ osu.Game/Rulesets/Mods/ModEasyWithExtraLives.cs | 2 ++ osu.Game/Rulesets/Mods/ModExtensions.cs | 2 ++ osu.Game/Rulesets/Mods/ModFailCondition.cs | 2 ++ osu.Game/Rulesets/Mods/ModFlashlight.cs | 2 ++ osu.Game/Rulesets/Mods/ModHalfTime.cs | 2 ++ osu.Game/Rulesets/Mods/ModHardRock.cs | 2 ++ osu.Game/Rulesets/Mods/ModHidden.cs | 2 ++ osu.Game/Rulesets/Mods/ModMirror.cs | 2 ++ osu.Game/Rulesets/Mods/ModMuted.cs | 2 ++ osu.Game/Rulesets/Mods/ModNightcore.cs | 2 ++ osu.Game/Rulesets/Mods/ModNoFail.cs | 2 ++ osu.Game/Rulesets/Mods/ModNoMod.cs | 2 ++ osu.Game/Rulesets/Mods/ModNoScope.cs | 2 ++ osu.Game/Rulesets/Mods/ModPerfect.cs | 2 ++ osu.Game/Rulesets/Mods/ModRandom.cs | 2 ++ osu.Game/Rulesets/Mods/ModRateAdjust.cs | 2 ++ osu.Game/Rulesets/Mods/ModRelax.cs | 2 ++ osu.Game/Rulesets/Mods/ModSuddenDeath.cs | 2 ++ osu.Game/Rulesets/Mods/ModTimeRamp.cs | 2 ++ osu.Game/Rulesets/Mods/ModType.cs | 2 ++ osu.Game/Rulesets/Mods/ModWindDown.cs | 2 ++ osu.Game/Rulesets/Mods/ModWindUp.cs | 2 ++ osu.Game/Rulesets/Mods/ModWithVisibilityAdjustment.cs | 2 ++ osu.Game/Rulesets/Mods/MultiMod.cs | 2 ++ osu.Game/Rulesets/Mods/UnknownMod.cs | 2 ++ osu.Game/Rulesets/Objects/BarLineGenerator.cs | 2 ++ osu.Game/Rulesets/Objects/Drawables/ArmedState.cs | 2 ++ osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 2 ++ osu.Game/Rulesets/Objects/HitObject.cs | 2 ++ osu.Game/Rulesets/Objects/HitObjectLifetimeEntry.cs | 2 ++ osu.Game/Rulesets/Objects/HitObjectParser.cs | 2 ++ osu.Game/Rulesets/Objects/IBarLine.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHit.cs | 2 ++ .../Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSlider.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/ConvertHitObject.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs | 2 ++ .../Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHold.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSpinner.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs | 2 ++ .../Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs | 2 ++ .../Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSpinner.cs | 2 ++ osu.Game/Rulesets/Objects/PathControlPoint.cs | 2 ++ .../Rulesets/Objects/Pooling/PoolableDrawableWithLifetime.cs | 2 -- .../Objects/Pooling/PooledDrawableWithLifetimeContainer.cs | 2 -- osu.Game/Rulesets/Objects/SliderEventGenerator.cs | 2 ++ osu.Game/Rulesets/Objects/SliderPath.cs | 2 ++ osu.Game/Rulesets/Objects/SliderPathExtensions.cs | 2 -- osu.Game/Rulesets/Objects/SyntheticHitObjectEntry.cs | 2 ++ osu.Game/Rulesets/Objects/Types/IHasColumn.cs | 2 ++ osu.Game/Rulesets/Objects/Types/IHasCombo.cs | 2 ++ osu.Game/Rulesets/Objects/Types/IHasComboInformation.cs | 2 ++ osu.Game/Rulesets/Objects/Types/IHasDisplayColour.cs | 2 ++ osu.Game/Rulesets/Objects/Types/IHasDistance.cs | 2 ++ osu.Game/Rulesets/Objects/Types/IHasDuration.cs | 2 ++ osu.Game/Rulesets/Objects/Types/IHasHold.cs | 2 ++ osu.Game/Rulesets/Objects/Types/IHasLegacyLastTickOffset.cs | 2 ++ osu.Game/Rulesets/Objects/Types/IHasPath.cs | 2 ++ osu.Game/Rulesets/Objects/Types/IHasPathWithRepeats.cs | 2 ++ osu.Game/Rulesets/Objects/Types/IHasPosition.cs | 2 ++ osu.Game/Rulesets/Objects/Types/IHasRepeats.cs | 2 ++ osu.Game/Rulesets/Objects/Types/IHasXPosition.cs | 2 ++ osu.Game/Rulesets/Objects/Types/IHasYPosition.cs | 2 ++ osu.Game/Rulesets/Objects/Types/PathType.cs | 2 ++ osu.Game/Rulesets/RealmRulesetStore.cs | 2 -- osu.Game/Rulesets/Replays/AutoGenerator.cs | 2 ++ osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs | 2 -- osu.Game/Rulesets/Replays/ReplayFrame.cs | 2 -- osu.Game/Rulesets/Replays/Types/IConvertibleReplayFrame.cs | 2 ++ osu.Game/Rulesets/Ruleset.cs | 2 ++ osu.Game/Rulesets/RulesetConfigCache.cs | 2 ++ osu.Game/Rulesets/RulesetInfo.cs | 2 -- osu.Game/Rulesets/RulesetLoadException.cs | 2 ++ osu.Game/Rulesets/RulesetSelector.cs | 2 ++ osu.Game/Rulesets/RulesetStore.cs | 2 -- osu.Game/Rulesets/Scoring/AccumulatingHealthProcessor.cs | 2 ++ osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs | 2 ++ osu.Game/Rulesets/Scoring/HealthProcessor.cs | 2 -- osu.Game/Rulesets/Scoring/HitEvent.cs | 2 ++ osu.Game/Rulesets/Scoring/HitEventExtensions.cs | 2 ++ osu.Game/Rulesets/Scoring/HitResult.cs | 2 ++ osu.Game/Rulesets/Scoring/HitWindows.cs | 2 ++ osu.Game/Rulesets/Scoring/JudgementProcessor.cs | 2 -- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 2 -- osu.Game/Rulesets/Timing/MultiplierControlPoint.cs | 2 ++ osu.Game/Rulesets/UI/DrawableRuleset.cs | 2 ++ osu.Game/Rulesets/UI/DrawableRulesetDependencies.cs | 2 ++ osu.Game/Rulesets/UI/FrameStabilityContainer.cs | 2 ++ osu.Game/Rulesets/UI/GameplayCursorContainer.cs | 2 ++ osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs | 2 ++ osu.Game/Rulesets/UI/HitObjectContainer.cs | 2 ++ osu.Game/Rulesets/UI/IFrameStableClock.cs | 2 ++ osu.Game/Rulesets/UI/IHitObjectContainer.cs | 2 ++ osu.Game/Rulesets/UI/IPooledHitObjectProvider.cs | 2 ++ osu.Game/Rulesets/UI/JudgementContainer.cs | 2 ++ osu.Game/Rulesets/UI/ModIcon.cs | 2 ++ osu.Game/Rulesets/UI/ModSwitchSmall.cs | 2 -- osu.Game/Rulesets/UI/ModSwitchTiny.cs | 2 -- osu.Game/Rulesets/UI/Playfield.cs | 2 ++ osu.Game/Rulesets/UI/PlayfieldAdjustmentContainer.cs | 2 ++ osu.Game/Rulesets/UI/PlayfieldBorder.cs | 2 ++ osu.Game/Rulesets/UI/PlayfieldBorderStyle.cs | 2 ++ osu.Game/Rulesets/UI/ReplayRecorder.cs | 2 ++ osu.Game/Rulesets/UI/RulesetInputManager.cs | 2 ++ .../UI/Scrolling/Algorithms/ConstantScrollAlgorithm.cs | 2 ++ osu.Game/Rulesets/UI/Scrolling/Algorithms/IScrollAlgorithm.cs | 2 ++ .../UI/Scrolling/Algorithms/OverlappingScrollAlgorithm.cs | 2 ++ .../UI/Scrolling/Algorithms/SequentialScrollAlgorithm.cs | 2 ++ osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs | 2 ++ osu.Game/Rulesets/UI/Scrolling/IScrollingInfo.cs | 2 ++ osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs | 2 ++ osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs | 2 ++ osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs | 2 ++ osu.Game/Scoring/EFScoreInfo.cs | 2 ++ osu.Game/Scoring/HitResultDisplayStatistic.cs | 2 ++ osu.Game/Scoring/IScoreInfo.cs | 2 ++ osu.Game/Scoring/Legacy/DatabasedLegacyScoreDecoder.cs | 2 ++ osu.Game/Scoring/Legacy/LegacyScoreDecoder.cs | 2 ++ osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs | 2 -- osu.Game/Scoring/Legacy/ScoreInfoExtensions.cs | 2 ++ osu.Game/Scoring/LegacyDatabasedScore.cs | 2 ++ osu.Game/Scoring/Score.cs | 2 ++ osu.Game/Scoring/ScoreFileInfo.cs | 2 ++ osu.Game/Scoring/ScoreImporter.cs | 2 -- osu.Game/Scoring/ScoreInfo.cs | 2 -- osu.Game/Scoring/ScoreInfoExtensions.cs | 2 ++ osu.Game/Scoring/ScoreManager.cs | 2 ++ osu.Game/Scoring/ScoreModelDownloader.cs | 2 ++ osu.Game/Scoring/ScorePerformanceCache.cs | 2 ++ osu.Game/Scoring/ScoreRank.cs | 2 ++ osu.Game/Scoring/ScoringValues.cs | 2 ++ osu.Game/Screens/BackgroundScreen.cs | 2 ++ osu.Game/Screens/BackgroundScreenStack.cs | 2 ++ osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 2 ++ osu.Game/Screens/Backgrounds/BackgroundScreenBlack.cs | 2 ++ osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs | 2 ++ osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs | 2 ++ osu.Game/Screens/Edit/BindableBeatDivisor.cs | 2 ++ osu.Game/Screens/Edit/BottomBar.cs | 2 ++ osu.Game/Screens/Edit/ClipboardContent.cs | 2 ++ osu.Game/Screens/Edit/Components/BottomBarContainer.cs | 2 ++ osu.Game/Screens/Edit/Components/CircularButton.cs | 2 ++ osu.Game/Screens/Edit/Components/EditorSidebar.cs | 2 ++ osu.Game/Screens/Edit/Components/EditorSidebarSection.cs | 2 ++ osu.Game/Screens/Edit/Components/Menus/DifficultyMenuItem.cs | 2 ++ osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs | 2 ++ osu.Game/Screens/Edit/Components/Menus/EditorMenuItem.cs | 2 ++ .../Screens/Edit/Components/Menus/EditorMenuItemSpacer.cs | 2 ++ .../Edit/Components/Menus/EditorScreenSwitcherControl.cs | 2 ++ osu.Game/Screens/Edit/Components/PlaybackControl.cs | 2 ++ .../Screens/Edit/Components/RadioButtons/EditorRadioButton.cs | 2 ++ .../Components/RadioButtons/EditorRadioButtonCollection.cs | 2 ++ osu.Game/Screens/Edit/Components/RadioButtons/RadioButton.cs | 2 ++ .../Edit/Components/TernaryButtons/DrawableTernaryButton.cs | 2 ++ .../Screens/Edit/Components/TernaryButtons/TernaryButton.cs | 2 ++ osu.Game/Screens/Edit/Components/TimeInfoContainer.cs | 2 ++ .../Edit/Components/Timelines/Summary/Parts/BookmarkPart.cs | 2 ++ .../Edit/Components/Timelines/Summary/Parts/BreakPart.cs | 2 ++ .../Components/Timelines/Summary/Parts/ControlPointPart.cs | 2 ++ .../Timelines/Summary/Parts/ControlPointVisualisation.cs | 2 ++ .../Timelines/Summary/Parts/EffectPointVisualisation.cs | 2 ++ .../Components/Timelines/Summary/Parts/GroupVisualisation.cs | 2 ++ .../Timelines/Summary/Parts/IControlPointVisualisation.cs | 2 ++ .../Edit/Components/Timelines/Summary/Parts/MarkerPart.cs | 2 ++ .../Edit/Components/Timelines/Summary/Parts/TimelinePart.cs | 2 ++ .../Edit/Components/Timelines/Summary/SummaryTimeline.cs | 2 ++ .../Edit/Components/Timelines/Summary/TestGameplayButton.cs | 2 ++ .../Timelines/Summary/Visualisations/DurationVisualisation.cs | 2 ++ .../Timelines/Summary/Visualisations/PointVisualisation.cs | 2 ++ .../Screens/Edit/Compose/Components/BeatDivisorControl.cs | 2 ++ .../Edit/Compose/Components/BeatDivisorPresetCollection.cs | 2 ++ osu.Game/Screens/Edit/Compose/Components/BeatDivisorType.cs | 2 ++ .../Screens/Edit/Compose/Components/BlueprintContainer.cs | 2 ++ .../Edit/Compose/Components/CircularDistanceSnapGrid.cs | 2 ++ .../Edit/Compose/Components/ComposeBlueprintContainer.cs | 2 ++ osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs | 2 ++ osu.Game/Screens/Edit/Compose/Components/DragBox.cs | 2 ++ .../Edit/Compose/Components/EditorBlueprintContainer.cs | 2 ++ .../Screens/Edit/Compose/Components/EditorSelectionHandler.cs | 2 ++ .../Compose/Components/HitObjectOrderedSelectionContainer.cs | 2 ++ .../Screens/Edit/Compose/Components/MoveSelectionEvent.cs | 2 ++ .../Edit/Compose/Components/RectangularPositionSnapGrid.cs | 2 ++ osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs | 2 ++ .../Screens/Edit/Compose/Components/SelectionBoxButton.cs | 2 ++ .../Screens/Edit/Compose/Components/SelectionBoxControl.cs | 2 ++ .../Screens/Edit/Compose/Components/SelectionBoxDragHandle.cs | 2 ++ .../Compose/Components/SelectionBoxDragHandleContainer.cs | 2 ++ .../Edit/Compose/Components/SelectionBoxRotationHandle.cs | 2 ++ .../Edit/Compose/Components/SelectionBoxScaleHandle.cs | 2 ++ osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs | 2 ++ .../Screens/Edit/Compose/Components/Timeline/CentreMarker.cs | 2 ++ .../Edit/Compose/Components/Timeline/DifficultyPointPiece.cs | 2 ++ .../Edit/Compose/Components/Timeline/HitObjectPointPiece.cs | 2 ++ .../Edit/Compose/Components/Timeline/SamplePointPiece.cs | 2 -- osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs | 2 ++ .../Screens/Edit/Compose/Components/Timeline/TimelineArea.cs | 2 ++ .../Compose/Components/Timeline/TimelineBlueprintContainer.cs | 2 ++ .../Edit/Compose/Components/Timeline/TimelineButton.cs | 2 ++ .../Components/Timeline/TimelineControlPointDisplay.cs | 2 ++ .../Compose/Components/Timeline/TimelineControlPointGroup.cs | 2 ++ .../Edit/Compose/Components/Timeline/TimelineDragBox.cs | 2 ++ .../Compose/Components/Timeline/TimelineHitObjectBlueprint.cs | 2 ++ .../Compose/Components/Timeline/TimelineSelectionHandler.cs | 2 ++ .../Edit/Compose/Components/Timeline/TimelineTickDisplay.cs | 2 ++ .../Edit/Compose/Components/Timeline/TimingPointPiece.cs | 2 ++ .../Screens/Edit/Compose/Components/Timeline/TopPointPiece.cs | 2 ++ .../Compose/Components/Timeline/ZoomableScrollContainer.cs | 2 ++ osu.Game/Screens/Edit/Compose/ComposeScreen.cs | 2 ++ osu.Game/Screens/Edit/Compose/HitObjectUsageEventBuffer.cs | 2 ++ osu.Game/Screens/Edit/Compose/IPlacementHandler.cs | 2 ++ osu.Game/Screens/Edit/CreateNewDifficultyDialog.cs | 2 ++ osu.Game/Screens/Edit/Design/DesignScreen.cs | 2 ++ osu.Game/Screens/Edit/Editor.cs | 2 ++ osu.Game/Screens/Edit/EditorBeatmap.cs | 2 ++ osu.Game/Screens/Edit/EditorBeatmapSkin.cs | 2 ++ osu.Game/Screens/Edit/EditorChangeHandler.cs | 2 ++ osu.Game/Screens/Edit/EditorClipboard.cs | 2 ++ osu.Game/Screens/Edit/EditorClock.cs | 2 ++ osu.Game/Screens/Edit/EditorLoader.cs | 2 ++ osu.Game/Screens/Edit/EditorRoundedScreenSettings.cs | 2 ++ osu.Game/Screens/Edit/EditorRoundedScreenSettingsSection.cs | 2 ++ osu.Game/Screens/Edit/EditorScreen.cs | 2 ++ osu.Game/Screens/Edit/EditorScreenMode.cs | 2 ++ osu.Game/Screens/Edit/EditorScreenWithTimeline.cs | 2 ++ osu.Game/Screens/Edit/EditorSkinProvidingContainer.cs | 2 -- osu.Game/Screens/Edit/EditorState.cs | 2 -- osu.Game/Screens/Edit/EditorTable.cs | 2 ++ osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs | 2 ++ osu.Game/Screens/Edit/GameplayTest/EditorPlayerLoader.cs | 2 ++ .../Screens/Edit/GameplayTest/SaveBeforeGameplayTestDialog.cs | 2 ++ osu.Game/Screens/Edit/HitAnimationsMenuItem.cs | 2 ++ osu.Game/Screens/Edit/IEditorChangeHandler.cs | 2 ++ osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs | 2 ++ osu.Game/Screens/Edit/PromptForSaveDialog.cs | 2 ++ osu.Game/Screens/Edit/Setup/ColoursSection.cs | 2 ++ osu.Game/Screens/Edit/Setup/DesignSection.cs | 2 ++ osu.Game/Screens/Edit/Setup/DifficultySection.cs | 2 ++ osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs | 2 -- osu.Game/Screens/Edit/Setup/LabelledRomanisedTextBox.cs | 2 ++ osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs | 2 ++ osu.Game/Screens/Edit/Setup/MetadataSection.cs | 2 ++ osu.Game/Screens/Edit/Setup/ResourcesSection.cs | 2 ++ osu.Game/Screens/Edit/Setup/RulesetSetupSection.cs | 2 ++ osu.Game/Screens/Edit/Setup/SetupScreen.cs | 2 ++ osu.Game/Screens/Edit/Setup/SetupScreenHeader.cs | 2 ++ osu.Game/Screens/Edit/Setup/SetupScreenHeaderBackground.cs | 2 ++ osu.Game/Screens/Edit/Setup/SetupSection.cs | 2 ++ osu.Game/Screens/Edit/Timing/ControlPointSettings.cs | 2 ++ osu.Game/Screens/Edit/Timing/ControlPointTable.cs | 2 ++ osu.Game/Screens/Edit/Timing/EffectSection.cs | 2 ++ osu.Game/Screens/Edit/Timing/GroupSection.cs | 2 ++ .../Edit/Timing/IndeterminateSliderWithTextBoxInput.cs | 2 ++ osu.Game/Screens/Edit/Timing/LabelledTimeSignature.cs | 2 ++ osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 2 ++ osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs | 2 ++ osu.Game/Screens/Edit/Timing/RowAttribute.cs | 2 ++ .../Screens/Edit/Timing/RowAttributes/AttributeProgressBar.cs | 2 ++ osu.Game/Screens/Edit/Timing/RowAttributes/AttributeText.cs | 2 ++ .../Edit/Timing/RowAttributes/DifficultyRowAttribute.cs | 2 ++ .../Screens/Edit/Timing/RowAttributes/EffectRowAttribute.cs | 2 ++ .../Screens/Edit/Timing/RowAttributes/SampleRowAttribute.cs | 2 ++ .../Screens/Edit/Timing/RowAttributes/TimingRowAttribute.cs | 2 ++ osu.Game/Screens/Edit/Timing/Section.cs | 2 ++ osu.Game/Screens/Edit/Timing/SliderWithTextBoxInput.cs | 2 ++ osu.Game/Screens/Edit/Timing/TapButton.cs | 2 -- osu.Game/Screens/Edit/Timing/TapTimingControl.cs | 2 -- osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs | 2 ++ osu.Game/Screens/Edit/Timing/TimingScreen.cs | 2 ++ osu.Game/Screens/Edit/Timing/TimingSection.cs | 2 ++ osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs | 2 -- osu.Game/Screens/Edit/TransactionalCommitComponent.cs | 2 ++ osu.Game/Screens/Edit/Verify/InterpretationSection.cs | 2 ++ osu.Game/Screens/Edit/Verify/IssueList.cs | 2 ++ osu.Game/Screens/Edit/Verify/IssueSettings.cs | 2 ++ osu.Game/Screens/Edit/Verify/IssueTable.cs | 2 ++ osu.Game/Screens/Edit/Verify/VerifyScreen.cs | 2 ++ osu.Game/Screens/Edit/Verify/VisibilitySection.cs | 2 ++ osu.Game/Screens/Edit/WaveformOpacityMenuItem.cs | 2 ++ osu.Game/Screens/IHandlePresentBeatmap.cs | 2 ++ osu.Game/Screens/IHasSubScreenStack.cs | 2 ++ osu.Game/Screens/IOsuScreen.cs | 2 ++ osu.Game/Screens/IPerformFromScreenRunner.cs | 2 ++ osu.Game/Screens/Import/FileImportScreen.cs | 2 ++ osu.Game/Screens/Loader.cs | 2 ++ osu.Game/Screens/Menu/ButtonArea.cs | 2 ++ osu.Game/Screens/Menu/ButtonSystem.cs | 2 ++ osu.Game/Screens/Menu/ConfirmExitDialog.cs | 2 ++ osu.Game/Screens/Menu/Disclaimer.cs | 2 ++ osu.Game/Screens/Menu/ExitConfirmOverlay.cs | 2 ++ osu.Game/Screens/Menu/FlowContainerWithOrigin.cs | 2 ++ osu.Game/Screens/Menu/IntroCircles.cs | 2 ++ osu.Game/Screens/Menu/IntroScreen.cs | 2 ++ osu.Game/Screens/Menu/IntroSequence.cs | 2 ++ osu.Game/Screens/Menu/IntroTriangles.cs | 2 ++ osu.Game/Screens/Menu/IntroWelcome.cs | 2 ++ osu.Game/Screens/Menu/LogoVisualisation.cs | 2 ++ osu.Game/Screens/Menu/MainMenu.cs | 2 ++ osu.Game/Screens/Menu/MainMenuButton.cs | 2 ++ osu.Game/Screens/Menu/MenuLogoVisualisation.cs | 2 ++ osu.Game/Screens/Menu/MenuSideFlashes.cs | 2 ++ osu.Game/Screens/Menu/OsuLogo.cs | 2 ++ osu.Game/Screens/Menu/SongTicker.cs | 2 ++ osu.Game/Screens/Menu/StorageErrorDialog.cs | 2 ++ .../OnlinePlay/Components/BeatmapDetailAreaPlaylistTabItem.cs | 2 ++ osu.Game/Screens/OnlinePlay/Components/BeatmapTitle.cs | 2 ++ .../Screens/OnlinePlay/Components/DisableableTabControl.cs | 2 ++ osu.Game/Screens/OnlinePlay/Components/DrawableGameType.cs | 2 ++ .../Screens/OnlinePlay/Components/ListingPollingComponent.cs | 2 ++ .../Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs | 2 ++ osu.Game/Screens/OnlinePlay/Components/ModeTypeInfo.cs | 2 ++ .../OnlinePlay/Components/OnlinePlayBackgroundScreen.cs | 2 -- .../OnlinePlay/Components/OnlinePlayBackgroundSprite.cs | 2 ++ osu.Game/Screens/OnlinePlay/Components/OverlinedHeader.cs | 2 ++ .../Screens/OnlinePlay/Components/OverlinedPlaylistHeader.cs | 2 ++ .../Screens/OnlinePlay/Components/ParticipantCountDisplay.cs | 2 ++ osu.Game/Screens/OnlinePlay/Components/ParticipantsDisplay.cs | 2 ++ osu.Game/Screens/OnlinePlay/Components/ParticipantsList.cs | 2 ++ .../Screens/OnlinePlay/Components/PlaylistItemBackground.cs | 2 -- osu.Game/Screens/OnlinePlay/Components/ReadyButton.cs | 2 ++ osu.Game/Screens/OnlinePlay/Components/RoomLocalUserInfo.cs | 2 ++ osu.Game/Screens/OnlinePlay/Components/RoomManager.cs | 2 ++ .../Screens/OnlinePlay/Components/RoomPollingComponent.cs | 2 ++ .../OnlinePlay/Components/SelectionPollingComponent.cs | 2 ++ .../Screens/OnlinePlay/Components/StarRatingRangeDisplay.cs | 2 ++ .../Screens/OnlinePlay/Components/StatusColouredContainer.cs | 2 ++ osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs | 2 ++ osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs | 2 ++ osu.Game/Screens/OnlinePlay/FooterButtonFreeMods.cs | 2 ++ osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs | 2 ++ osu.Game/Screens/OnlinePlay/Header.cs | 2 ++ osu.Game/Screens/OnlinePlay/IOnlinePlaySubScreen.cs | 2 ++ osu.Game/Screens/OnlinePlay/IRoomManager.cs | 2 -- osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs | 2 ++ .../Lounge/Components/DrawableRoomParticipantsList.cs | 2 ++ osu.Game/Screens/OnlinePlay/Lounge/Components/EndDateInfo.cs | 2 ++ .../Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs | 2 ++ .../Screens/OnlinePlay/Lounge/Components/MatchTypePill.cs | 2 ++ .../Screens/OnlinePlay/Lounge/Components/PillContainer.cs | 2 ++ .../Screens/OnlinePlay/Lounge/Components/PlaylistCountPill.cs | 2 ++ .../Screens/OnlinePlay/Lounge/Components/QueueModePill.cs | 2 ++ .../Screens/OnlinePlay/Lounge/Components/RankRangePill.cs | 2 ++ .../OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs | 2 ++ .../Screens/OnlinePlay/Lounge/Components/RoomStatusFilter.cs | 2 ++ .../Screens/OnlinePlay/Lounge/Components/RoomStatusPill.cs | 2 ++ .../Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs | 2 ++ osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs | 2 ++ osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs | 2 -- osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs | 2 ++ .../Screens/OnlinePlay/Match/Components/CreateRoomButton.cs | 2 ++ .../Screens/OnlinePlay/Match/Components/MatchChatDisplay.cs | 2 ++ .../Screens/OnlinePlay/Match/Components/MatchLeaderboard.cs | 2 ++ .../OnlinePlay/Match/Components/MatchLeaderboardScore.cs | 2 ++ .../Screens/OnlinePlay/Match/Components/MatchTypePicker.cs | 2 ++ .../OnlinePlay/Match/Components/PurpleTriangleButton.cs | 2 ++ .../OnlinePlay/Match/Components/RoomAvailabilityPicker.cs | 2 ++ .../OnlinePlay/Match/Components/RoomSettingsOverlay.cs | 2 ++ osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs | 2 ++ osu.Game/Screens/OnlinePlay/Match/RoomBackgroundScreen.cs | 2 ++ osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs | 2 ++ .../OnlinePlay/Multiplayer/CreateMultiplayerMatchButton.cs | 2 ++ .../Screens/OnlinePlay/Multiplayer/GameplayChatDisplay.cs | 2 ++ .../OnlinePlay/Multiplayer/GameplayMatchScoreDisplay.cs | 2 ++ .../Screens/OnlinePlay/Multiplayer/Match/MatchStartControl.cs | 2 ++ .../Multiplayer/Match/MultiplayerCountdownButton.cs | 2 ++ .../OnlinePlay/Multiplayer/Match/MultiplayerMatchFooter.cs | 2 ++ .../Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs | 2 ++ .../OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs | 2 ++ .../OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs | 2 ++ .../Multiplayer/Match/Playlist/MultiplayerHistoryList.cs | 2 ++ .../Multiplayer/Match/Playlist/MultiplayerPlaylist.cs | 2 ++ .../Match/Playlist/MultiplayerPlaylistDisplayMode.cs | 2 ++ .../Match/Playlist/MultiplayerPlaylistTabControl.cs | 2 ++ .../Multiplayer/Match/Playlist/MultiplayerQueueList.cs | 2 ++ osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs | 2 ++ .../OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs | 2 ++ .../OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs | 2 ++ .../OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs | 2 ++ osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs | 2 ++ .../Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs | 2 ++ .../OnlinePlay/Multiplayer/MultiplayerResultsScreen.cs | 2 ++ .../OnlinePlay/Multiplayer/MultiplayerRoomComposite.cs | 2 ++ .../Screens/OnlinePlay/Multiplayer/MultiplayerRoomManager.cs | 2 ++ .../Screens/OnlinePlay/Multiplayer/MultiplayerRoomSounds.cs | 2 ++ .../OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs | 2 ++ .../OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs | 2 ++ .../OnlinePlay/Multiplayer/Participants/ParticipantsList.cs | 2 ++ .../Multiplayer/Participants/ParticipantsListHeader.cs | 2 ++ .../OnlinePlay/Multiplayer/Participants/StateDisplay.cs | 2 ++ .../OnlinePlay/Multiplayer/Participants/TeamDisplay.cs | 2 ++ .../Multiplayer/Spectate/CatchUpSpectatorPlayerClock.cs | 2 -- .../OnlinePlay/Multiplayer/Spectate/CatchUpSyncManager.cs | 2 ++ .../OnlinePlay/Multiplayer/Spectate/ISpectatorPlayerClock.cs | 2 ++ .../Screens/OnlinePlay/Multiplayer/Spectate/ISyncManager.cs | 2 ++ .../OnlinePlay/Multiplayer/Spectate/MasterClockState.cs | 2 ++ .../Multiplayer/Spectate/MultiSpectatorLeaderboard.cs | 2 ++ .../OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayer.cs | 2 ++ .../Multiplayer/Spectate/MultiSpectatorPlayerLoader.cs | 2 ++ .../OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs | 2 ++ .../Screens/OnlinePlay/Multiplayer/Spectate/PlayerArea.cs | 2 ++ .../Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid.cs | 2 ++ .../OnlinePlay/Multiplayer/Spectate/PlayerGrid_Cell.cs | 2 ++ .../OnlinePlay/Multiplayer/Spectate/PlayerGrid_Facade.cs | 2 ++ osu.Game/Screens/OnlinePlay/OngoingOperationTracker.cs | 2 ++ osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs | 2 ++ osu.Game/Screens/OnlinePlay/OnlinePlayScreen.cs | 2 ++ osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs | 2 ++ osu.Game/Screens/OnlinePlay/OnlinePlaySubScreen.cs | 2 ++ osu.Game/Screens/OnlinePlay/OnlinePlaySubScreenStack.cs | 2 ++ .../Screens/OnlinePlay/Playlists/CreatePlaylistsRoomButton.cs | 2 ++ osu.Game/Screens/OnlinePlay/Playlists/Playlists.cs | 2 ++ .../Screens/OnlinePlay/Playlists/PlaylistsLoungeSubScreen.cs | 2 ++ osu.Game/Screens/OnlinePlay/Playlists/PlaylistsPlayer.cs | 2 ++ osu.Game/Screens/OnlinePlay/Playlists/PlaylistsReadyButton.cs | 2 ++ .../Screens/OnlinePlay/Playlists/PlaylistsResultsScreen.cs | 2 ++ osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomFooter.cs | 2 ++ .../OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs | 2 ++ .../OnlinePlay/Playlists/PlaylistsRoomSettingsPlaylist.cs | 2 ++ .../Screens/OnlinePlay/Playlists/PlaylistsRoomSubScreen.cs | 2 ++ osu.Game/Screens/OnlinePlay/Playlists/PlaylistsSongSelect.cs | 2 ++ osu.Game/Screens/OsuScreen.cs | 2 ++ osu.Game/Screens/OsuScreenDependencies.cs | 2 ++ osu.Game/Screens/OsuScreenStack.cs | 2 ++ osu.Game/Screens/Play/BeatmapMetadataDisplay.cs | 2 ++ osu.Game/Screens/Play/Break/BlurredIcon.cs | 2 ++ osu.Game/Screens/Play/Break/BreakArrows.cs | 2 ++ osu.Game/Screens/Play/Break/BreakInfo.cs | 2 ++ osu.Game/Screens/Play/Break/BreakInfoLine.cs | 2 ++ osu.Game/Screens/Play/Break/GlowIcon.cs | 2 ++ osu.Game/Screens/Play/Break/LetterboxOverlay.cs | 2 ++ osu.Game/Screens/Play/Break/RemainingTimeCounter.cs | 2 ++ osu.Game/Screens/Play/BreakOverlay.cs | 2 ++ osu.Game/Screens/Play/BreakTracker.cs | 2 ++ osu.Game/Screens/Play/ComboEffects.cs | 2 ++ osu.Game/Screens/Play/DimmableStoryboard.cs | 2 ++ osu.Game/Screens/Play/EpilepsyWarning.cs | 2 ++ osu.Game/Screens/Play/FailAnimation.cs | 2 ++ osu.Game/Screens/Play/FailOverlay.cs | 2 ++ osu.Game/Screens/Play/GameplayClock.cs | 2 ++ osu.Game/Screens/Play/GameplayClockContainer.cs | 2 ++ osu.Game/Screens/Play/GameplayMenuOverlay.cs | 2 ++ osu.Game/Screens/Play/GameplayState.cs | 2 -- osu.Game/Screens/Play/HUD/DefaultAccuracyCounter.cs | 2 ++ osu.Game/Screens/Play/HUD/DefaultComboCounter.cs | 2 ++ osu.Game/Screens/Play/HUD/DefaultHealthDisplay.cs | 2 ++ osu.Game/Screens/Play/HUD/DefaultScoreCounter.cs | 2 ++ osu.Game/Screens/Play/HUD/FailingLayer.cs | 2 ++ osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs | 2 ++ osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs | 2 ++ osu.Game/Screens/Play/HUD/GameplayLeaderboardScore.cs | 2 ++ osu.Game/Screens/Play/HUD/GameplayScoreCounter.cs | 2 ++ osu.Game/Screens/Play/HUD/HealthDisplay.cs | 2 ++ osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs | 2 ++ .../Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs | 2 ++ osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs | 2 ++ osu.Game/Screens/Play/HUD/HoldForMenuButton.cs | 2 ++ osu.Game/Screens/Play/HUD/ILeaderboardScore.cs | 2 ++ osu.Game/Screens/Play/HUD/LegacyComboCounter.cs | 2 ++ osu.Game/Screens/Play/HUD/MatchScoreDisplay.cs | 2 ++ osu.Game/Screens/Play/HUD/ModDisplay.cs | 2 ++ osu.Game/Screens/Play/HUD/ModFlowDisplay.cs | 2 ++ osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs | 2 ++ osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs | 2 ++ osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs | 2 ++ osu.Game/Screens/Play/HUD/SkinnableInfo.cs | 2 ++ osu.Game/Screens/Play/HUD/UnstableRateCounter.cs | 2 ++ osu.Game/Screens/Play/HUDOverlay.cs | 2 ++ osu.Game/Screens/Play/HotkeyExitOverlay.cs | 2 ++ osu.Game/Screens/Play/HotkeyRetryOverlay.cs | 2 ++ osu.Game/Screens/Play/ILocalUserPlayInfo.cs | 2 ++ osu.Game/Screens/Play/KeyCounter.cs | 2 ++ osu.Game/Screens/Play/KeyCounterAction.cs | 2 ++ osu.Game/Screens/Play/KeyCounterDisplay.cs | 2 ++ osu.Game/Screens/Play/KeyCounterKeyboard.cs | 2 ++ osu.Game/Screens/Play/KeyCounterMouse.cs | 2 ++ osu.Game/Screens/Play/KeyCounterState.cs | 2 ++ osu.Game/Screens/Play/MasterGameplayClockContainer.cs | 2 ++ osu.Game/Screens/Play/PauseOverlay.cs | 2 ++ osu.Game/Screens/Play/Player.cs | 2 ++ osu.Game/Screens/Play/PlayerConfiguration.cs | 2 ++ osu.Game/Screens/Play/PlayerLoader.cs | 2 -- osu.Game/Screens/Play/PlayerSettings/AudioSettings.cs | 2 ++ osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs | 2 -- osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs | 2 ++ osu.Game/Screens/Play/PlayerSettings/InputSettings.cs | 2 ++ osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs | 2 ++ osu.Game/Screens/Play/PlayerSettings/PlayerCheckbox.cs | 2 ++ osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs | 2 ++ osu.Game/Screens/Play/PlayerSettings/PlayerSliderBar.cs | 2 ++ osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs | 2 ++ osu.Game/Screens/Play/ReplayPlayer.cs | 2 ++ osu.Game/Screens/Play/ReplayPlayerLoader.cs | 2 ++ osu.Game/Screens/Play/ResumeOverlay.cs | 2 ++ osu.Game/Screens/Play/RoomSubmittingPlayer.cs | 2 ++ osu.Game/Screens/Play/ScreenSuspensionHandler.cs | 2 ++ osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 2 ++ osu.Game/Screens/Play/SkipOverlay.cs | 2 ++ osu.Game/Screens/Play/SoloPlayer.cs | 2 ++ osu.Game/Screens/Play/SoloSpectator.cs | 2 ++ osu.Game/Screens/Play/SoloSpectatorPlayer.cs | 2 ++ osu.Game/Screens/Play/SongProgress.cs | 2 ++ osu.Game/Screens/Play/SongProgressBar.cs | 2 ++ osu.Game/Screens/Play/SongProgressGraph.cs | 2 ++ osu.Game/Screens/Play/SongProgressInfo.cs | 2 ++ osu.Game/Screens/Play/SpectatorPlayer.cs | 2 ++ osu.Game/Screens/Play/SpectatorPlayerLoader.cs | 2 ++ osu.Game/Screens/Play/SpectatorResultsScreen.cs | 2 ++ osu.Game/Screens/Play/SquareGraph.cs | 2 ++ osu.Game/Screens/Play/SubmittingPlayer.cs | 2 ++ osu.Game/Screens/Ranking/AspectContainer.cs | 2 ++ .../Ranking/Contracted/ContractedPanelMiddleContent.cs | 2 ++ .../Screens/Ranking/Contracted/ContractedPanelTopContent.cs | 2 ++ osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs | 2 ++ osu.Game/Screens/Ranking/Expanded/Accuracy/RankBadge.cs | 2 ++ osu.Game/Screens/Ranking/Expanded/Accuracy/RankNotch.cs | 2 ++ osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs | 2 ++ .../Ranking/Expanded/Accuracy/SmoothCircularProgress.cs | 2 ++ .../Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs | 2 ++ osu.Game/Screens/Ranking/Expanded/ExpandedPanelTopContent.cs | 2 ++ .../Screens/Ranking/Expanded/Statistics/AccuracyStatistic.cs | 2 ++ .../Screens/Ranking/Expanded/Statistics/ComboStatistic.cs | 2 ++ .../Screens/Ranking/Expanded/Statistics/CounterStatistic.cs | 2 ++ .../Screens/Ranking/Expanded/Statistics/HitResultStatistic.cs | 2 ++ .../Ranking/Expanded/Statistics/PerformanceStatistic.cs | 2 ++ .../Screens/Ranking/Expanded/Statistics/StatisticCounter.cs | 2 ++ .../Screens/Ranking/Expanded/Statistics/StatisticDisplay.cs | 2 ++ osu.Game/Screens/Ranking/Expanded/TotalScoreCounter.cs | 2 ++ osu.Game/Screens/Ranking/PanelState.cs | 2 ++ osu.Game/Screens/Ranking/ReplayDownloadButton.cs | 2 ++ osu.Game/Screens/Ranking/ResultsScreen.cs | 2 ++ osu.Game/Screens/Ranking/RetryButton.cs | 2 ++ osu.Game/Screens/Ranking/ScorePanel.cs | 2 ++ osu.Game/Screens/Ranking/ScorePanelList.cs | 2 ++ osu.Game/Screens/Ranking/ScorePanelTrackingContainer.cs | 2 ++ osu.Game/Screens/Ranking/SoloResultsScreen.cs | 2 ++ osu.Game/Screens/Ranking/Statistics/AverageHitError.cs | 2 ++ .../Ranking/Statistics/HitEventTimingDistributionGraph.cs | 2 ++ .../Screens/Ranking/Statistics/PerformanceBreakdownChart.cs | 2 ++ osu.Game/Screens/Ranking/Statistics/SimpleStatisticItem.cs | 2 ++ osu.Game/Screens/Ranking/Statistics/SimpleStatisticTable.cs | 2 ++ osu.Game/Screens/Ranking/Statistics/StatisticContainer.cs | 2 ++ osu.Game/Screens/Ranking/Statistics/StatisticItem.cs | 2 ++ osu.Game/Screens/Ranking/Statistics/StatisticRow.cs | 2 ++ osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs | 2 ++ osu.Game/Screens/Ranking/Statistics/UnstableRate.cs | 2 ++ osu.Game/Screens/ScorePresentType.cs | 2 ++ osu.Game/Screens/ScreenWhiteBox.cs | 2 ++ osu.Game/Screens/Select/BeatmapCarousel.cs | 2 ++ osu.Game/Screens/Select/BeatmapClearScoresDialog.cs | 2 ++ osu.Game/Screens/Select/BeatmapDeleteDialog.cs | 2 ++ osu.Game/Screens/Select/BeatmapDetailArea.cs | 2 ++ osu.Game/Screens/Select/BeatmapDetailAreaDetailTabItem.cs | 2 ++ .../Screens/Select/BeatmapDetailAreaLeaderboardTabItem.cs | 2 ++ osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs | 2 ++ osu.Game/Screens/Select/BeatmapDetailAreaTabItem.cs | 2 ++ osu.Game/Screens/Select/BeatmapDetails.cs | 2 ++ osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 ++ osu.Game/Screens/Select/BeatmapInfoWedgeBackground.cs | 2 ++ osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs | 2 ++ osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs | 2 ++ osu.Game/Screens/Select/Carousel/CarouselGroup.cs | 2 -- osu.Game/Screens/Select/Carousel/CarouselGroupEagerSelect.cs | 2 ++ osu.Game/Screens/Select/Carousel/CarouselHeader.cs | 2 ++ osu.Game/Screens/Select/Carousel/CarouselItem.cs | 2 ++ osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs | 2 ++ .../Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs | 2 ++ osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs | 2 ++ osu.Game/Screens/Select/Carousel/FilterableDifficultyIcon.cs | 2 ++ .../Select/Carousel/FilterableGroupedDifficultyIcon.cs | 2 ++ osu.Game/Screens/Select/Carousel/SetPanelBackground.cs | 2 ++ osu.Game/Screens/Select/Carousel/SetPanelContent.cs | 2 ++ osu.Game/Screens/Select/Carousel/TopLocalRank.cs | 2 ++ osu.Game/Screens/Select/Details/AdvancedStats.cs | 2 ++ osu.Game/Screens/Select/Details/FailRetryGraph.cs | 2 ++ osu.Game/Screens/Select/Details/UserRatings.cs | 2 ++ osu.Game/Screens/Select/Filter/GroupMode.cs | 2 ++ osu.Game/Screens/Select/Filter/Operator.cs | 2 ++ osu.Game/Screens/Select/Filter/SortMode.cs | 2 ++ osu.Game/Screens/Select/FilterControl.cs | 2 ++ osu.Game/Screens/Select/FilterCriteria.cs | 2 ++ osu.Game/Screens/Select/FilterQueryParser.cs | 2 ++ osu.Game/Screens/Select/Footer.cs | 2 ++ osu.Game/Screens/Select/FooterButton.cs | 2 ++ osu.Game/Screens/Select/FooterButtonMods.cs | 2 ++ osu.Game/Screens/Select/FooterButtonOptions.cs | 2 ++ osu.Game/Screens/Select/FooterButtonRandom.cs | 2 ++ osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs | 2 ++ .../Screens/Select/Leaderboards/BeatmapLeaderboardScope.cs | 2 ++ osu.Game/Screens/Select/LocalScoreDeleteDialog.cs | 2 ++ osu.Game/Screens/Select/NoResultsPlaceholder.cs | 2 -- osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs | 2 ++ osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs | 2 ++ osu.Game/Screens/Select/PlayBeatmapDetailArea.cs | 2 ++ osu.Game/Screens/Select/PlaySongSelect.cs | 2 ++ osu.Game/Screens/Select/SkinDeleteDialog.cs | 2 ++ osu.Game/Screens/Select/SongSelect.cs | 2 ++ osu.Game/Screens/Select/WedgeBackground.cs | 2 ++ osu.Game/Screens/Spectate/SpectatorGameplayState.cs | 2 ++ osu.Game/Screens/Spectate/SpectatorScreen.cs | 2 ++ osu.Game/Screens/StartupScreen.cs | 2 ++ osu.Game/Screens/Utility/ButtonWithKeyBind.cs | 1 - osu.Game/Screens/Utility/CircleGameplay.cs | 2 -- osu.Game/Screens/Utility/LatencyArea.cs | 2 -- osu.Game/Screens/Utility/LatencyCertifierScreen.cs | 2 -- osu.Game/Screens/Utility/LatencyVisualMode.cs | 1 - .../Utility/SampleComponents/LatencyCursorContainer.cs | 1 - .../Screens/Utility/SampleComponents/LatencyMovableBox.cs | 2 -- .../Utility/SampleComponents/LatencySampleComponent.cs | 2 -- osu.Game/Screens/Utility/ScrollingGameplay.cs | 1 - osu.Game/Skinning/BeatmapSkinProvidingContainer.cs | 2 ++ osu.Game/Skinning/Components/BigBlackBox.cs | 2 ++ osu.Game/Skinning/DefaultLegacySkin.cs | 2 ++ osu.Game/Skinning/DefaultSkin.cs | 2 ++ osu.Game/Skinning/EFSkinInfo.cs | 2 ++ osu.Game/Skinning/Editor/SkinBlueprint.cs | 2 ++ osu.Game/Skinning/Editor/SkinBlueprintContainer.cs | 2 ++ osu.Game/Skinning/Editor/SkinComponentToolbox.cs | 2 ++ osu.Game/Skinning/Editor/SkinEditor.cs | 2 ++ osu.Game/Skinning/Editor/SkinEditorOverlay.cs | 2 ++ osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs | 2 ++ osu.Game/Skinning/Editor/SkinSelectionHandler.cs | 2 ++ osu.Game/Skinning/Editor/SkinSettingsToolbox.cs | 2 ++ osu.Game/Skinning/GameplaySkinComponent.cs | 2 ++ osu.Game/Skinning/GlobalSkinColours.cs | 2 ++ osu.Game/Skinning/HUDSkinComponents.cs | 2 ++ osu.Game/Skinning/IAnimationTimeReference.cs | 2 ++ osu.Game/Skinning/IPooledSampleProvider.cs | 2 ++ osu.Game/Skinning/ISkin.cs | 2 -- osu.Game/Skinning/ISkinComponent.cs | 2 ++ osu.Game/Skinning/ISkinSource.cs | 2 ++ osu.Game/Skinning/ISkinnableDrawable.cs | 2 ++ osu.Game/Skinning/ISkinnableTarget.cs | 2 ++ osu.Game/Skinning/LegacyAccuracyCounter.cs | 2 ++ osu.Game/Skinning/LegacyBeatmapSkin.cs | 2 -- osu.Game/Skinning/LegacyColourCompatibility.cs | 2 ++ osu.Game/Skinning/LegacyFont.cs | 2 ++ osu.Game/Skinning/LegacyHealthDisplay.cs | 2 ++ osu.Game/Skinning/LegacyJudgementPieceNew.cs | 2 ++ osu.Game/Skinning/LegacyJudgementPieceOld.cs | 2 ++ osu.Game/Skinning/LegacyManiaSkinConfiguration.cs | 2 ++ osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs | 2 ++ osu.Game/Skinning/LegacyManiaSkinDecoder.cs | 2 ++ osu.Game/Skinning/LegacyRollingCounter.cs | 2 ++ osu.Game/Skinning/LegacyScoreCounter.cs | 2 ++ osu.Game/Skinning/LegacySkin.cs | 2 -- osu.Game/Skinning/LegacySkinDecoder.cs | 2 ++ osu.Game/Skinning/LegacySkinExtensions.cs | 2 -- osu.Game/Skinning/LegacySkinTransformer.cs | 2 ++ osu.Game/Skinning/LegacySpriteText.cs | 2 ++ osu.Game/Skinning/PausableSkinnableSound.cs | 2 ++ osu.Game/Skinning/PoolableSkinnableSample.cs | 2 ++ osu.Game/Skinning/RealmBackedResourceStore.cs | 2 -- osu.Game/Skinning/ResourceStoreBackedSkin.cs | 2 -- osu.Game/Skinning/RulesetSkinProvidingContainer.cs | 2 ++ osu.Game/Skinning/Skin.cs | 2 -- osu.Game/Skinning/SkinComboColourLookup.cs | 2 ++ osu.Game/Skinning/SkinConfigManager.cs | 2 ++ osu.Game/Skinning/SkinConfiguration.cs | 2 ++ osu.Game/Skinning/SkinCustomColourLookup.cs | 2 ++ osu.Game/Skinning/SkinFileInfo.cs | 2 ++ osu.Game/Skinning/SkinImporter.cs | 2 -- osu.Game/Skinning/SkinInfo.cs | 2 -- osu.Game/Skinning/SkinManager.cs | 2 ++ osu.Game/Skinning/SkinProvidingContainer.cs | 2 ++ osu.Game/Skinning/SkinReloadableDrawable.cs | 2 ++ osu.Game/Skinning/SkinUtils.cs | 2 ++ osu.Game/Skinning/SkinnableDrawable.cs | 2 ++ osu.Game/Skinning/SkinnableSound.cs | 2 ++ osu.Game/Skinning/SkinnableSprite.cs | 2 ++ osu.Game/Skinning/SkinnableSpriteText.cs | 2 ++ osu.Game/Skinning/SkinnableTarget.cs | 2 ++ osu.Game/Skinning/SkinnableTargetComponent.cs | 2 ++ osu.Game/Skinning/SkinnableTargetComponentsContainer.cs | 2 ++ osu.Game/Skinning/SkinnableTargetContainer.cs | 2 ++ osu.Game/Skinning/UnsupportedSkinComponentException.cs | 2 ++ osu.Game/Storyboards/CommandLoop.cs | 2 ++ osu.Game/Storyboards/CommandTimeline.cs | 2 ++ osu.Game/Storyboards/CommandTimelineGroup.cs | 2 ++ osu.Game/Storyboards/CommandTrigger.cs | 2 ++ osu.Game/Storyboards/Drawables/DrawableStoryboard.cs | 2 ++ osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs | 2 ++ osu.Game/Storyboards/Drawables/DrawableStoryboardLayer.cs | 2 ++ osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs | 2 ++ osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs | 2 ++ osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs | 2 ++ osu.Game/Storyboards/Drawables/DrawablesExtensions.cs | 2 ++ osu.Game/Storyboards/Drawables/IFlippable.cs | 2 ++ osu.Game/Storyboards/Drawables/IVectorScalable.cs | 2 ++ osu.Game/Storyboards/IStoryboardElement.cs | 2 ++ osu.Game/Storyboards/IStoryboardElementWithDuration.cs | 2 ++ osu.Game/Storyboards/Storyboard.cs | 2 ++ osu.Game/Storyboards/StoryboardAnimation.cs | 2 ++ osu.Game/Storyboards/StoryboardExtensions.cs | 2 ++ osu.Game/Storyboards/StoryboardLayer.cs | 2 ++ osu.Game/Storyboards/StoryboardSample.cs | 2 ++ osu.Game/Storyboards/StoryboardSprite.cs | 2 ++ osu.Game/Storyboards/StoryboardVideo.cs | 2 ++ osu.Game/Storyboards/StoryboardVideoLayer.cs | 2 ++ osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs | 2 ++ osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs | 2 ++ osu.Game/Tests/Beatmaps/HitObjectSampleTest.cs | 2 ++ osu.Game/Tests/Beatmaps/LegacyBeatmapSkinColourTest.cs | 2 ++ osu.Game/Tests/Beatmaps/LegacyModConversionTest.cs | 2 ++ osu.Game/Tests/Beatmaps/TestBeatmap.cs | 2 ++ osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs | 2 ++ osu.Game/Tests/CleanRunHeadlessGameHost.cs | 2 ++ osu.Game/Tests/Gameplay/TestGameplayState.cs | 2 -- osu.Game/Tests/OsuTestBrowser.cs | 2 ++ osu.Game/Tests/Rulesets/TestRulesetConfigCache.cs | 2 ++ osu.Game/Tests/Visual/DependencyProvidingContainer.cs | 2 ++ osu.Game/Tests/Visual/EditorClockTestScene.cs | 2 ++ osu.Game/Tests/Visual/EditorSavingTestScene.cs | 2 ++ osu.Game/Tests/Visual/EditorTestScene.cs | 2 ++ osu.Game/Tests/Visual/LegacySkinPlayerTestScene.cs | 2 ++ osu.Game/Tests/Visual/ModPerfectTestScene.cs | 2 ++ osu.Game/Tests/Visual/ModTestScene.cs | 2 ++ .../Visual/Multiplayer/IMultiplayerTestSceneDependencies.cs | 2 ++ osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs | 2 ++ .../Visual/Multiplayer/MultiplayerTestSceneDependencies.cs | 2 ++ osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs | 2 -- .../Tests/Visual/Multiplayer/TestMultiplayerRoomManager.cs | 2 ++ .../Visual/OnlinePlay/IOnlinePlayTestSceneDependencies.cs | 2 ++ osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs | 2 ++ .../Visual/OnlinePlay/OnlinePlayTestSceneDependencies.cs | 2 ++ osu.Game/Tests/Visual/OnlinePlay/TestRoomManager.cs | 2 ++ osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs | 2 ++ osu.Game/Tests/Visual/OsuGameTestScene.cs | 2 ++ osu.Game/Tests/Visual/OsuGridTestScene.cs | 2 ++ osu.Game/Tests/Visual/OsuManualInputManagerTestScene.cs | 2 ++ osu.Game/Tests/Visual/OsuTestScene.cs | 2 ++ osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs | 2 ++ osu.Game/Tests/Visual/PlayerTestScene.cs | 2 ++ osu.Game/Tests/Visual/RateAdjustedBeatmapTestScene.cs | 2 ++ osu.Game/Tests/Visual/ScreenTestScene.cs | 2 ++ osu.Game/Tests/Visual/ScrollingTestContainer.cs | 2 ++ osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs | 2 ++ osu.Game/Tests/Visual/SkinnableTestScene.cs | 2 ++ osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs | 2 -- osu.Game/Tests/Visual/TestPlayer.cs | 2 ++ osu.Game/Tests/Visual/TestReplayPlayer.cs | 2 ++ osu.Game/Tests/Visual/TestUserLookupCache.cs | 2 ++ osu.Game/Tests/VisualTestRunner.cs | 2 ++ osu.Game/Updater/GitHubAsset.cs | 2 ++ osu.Game/Updater/GitHubRelease.cs | 2 ++ osu.Game/Updater/NoActionUpdateManager.cs | 2 ++ osu.Game/Updater/SimpleUpdateManager.cs | 2 ++ osu.Game/Updater/UpdateManager.cs | 2 ++ osu.Game/Users/Badge.cs | 2 ++ osu.Game/Users/Country.cs | 2 ++ osu.Game/Users/CountryStatistics.cs | 2 ++ osu.Game/Users/Drawables/ClickableAvatar.cs | 2 ++ osu.Game/Users/Drawables/DrawableAvatar.cs | 2 ++ osu.Game/Users/Drawables/DrawableFlag.cs | 2 ++ osu.Game/Users/Drawables/UpdateableAvatar.cs | 2 ++ osu.Game/Users/Drawables/UpdateableFlag.cs | 2 ++ osu.Game/Users/ExtendedUserPanel.cs | 2 ++ osu.Game/Users/IUser.cs | 2 -- osu.Game/Users/Medal.cs | 2 ++ osu.Game/Users/UserActivity.cs | 2 ++ osu.Game/Users/UserBrickPanel.cs | 2 ++ osu.Game/Users/UserCoverBackground.cs | 2 ++ osu.Game/Users/UserGridPanel.cs | 2 ++ osu.Game/Users/UserListPanel.cs | 2 ++ osu.Game/Users/UserPanel.cs | 2 ++ osu.Game/Users/UserStatistics.cs | 2 ++ osu.Game/Users/UserStatus.cs | 2 ++ osu.Game/Utils/BatteryInfo.cs | 2 ++ osu.Game/Utils/ColourUtils.cs | 2 ++ osu.Game/Utils/FormatUtils.cs | 2 ++ osu.Game/Utils/HumanizerUtils.cs | 2 ++ osu.Game/Utils/IDeepCloneable.cs | 2 ++ osu.Game/Utils/LegacyRandom.cs | 2 ++ osu.Game/Utils/LegacyUtils.cs | 2 ++ osu.Game/Utils/ModUtils.cs | 2 -- osu.Game/Utils/NamingUtils.cs | 2 ++ osu.Game/Utils/Optional.cs | 2 -- osu.Game/Utils/PeriodTracker.cs | 2 ++ osu.Game/Utils/SentryLogger.cs | 2 -- osu.Game/Utils/StatelessRNG.cs | 2 ++ osu.Game/Utils/TaskChain.cs | 2 -- osu.Game/Utils/ZipUtils.cs | 2 ++ osu.iOS/AppDelegate.cs | 2 ++ osu.iOS/Application.cs | 2 ++ osu.iOS/OsuGameIOS.cs | 2 ++ 3500 files changed, 6556 insertions(+), 447 deletions(-) diff --git a/osu.Android/GameplayScreenRotationLocker.cs b/osu.Android/GameplayScreenRotationLocker.cs index 2e83f784d3..9e849bdc7c 100644 --- a/osu.Android/GameplayScreenRotationLocker.cs +++ b/osu.Android/GameplayScreenRotationLocker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Android.Content.PM; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Android/OsuGameActivity.cs b/osu.Android/OsuGameActivity.cs index eebd079f68..be40db7508 100644 --- a/osu.Android/OsuGameActivity.cs +++ b/osu.Android/OsuGameActivity.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Android/OsuGameAndroid.cs b/osu.Android/OsuGameAndroid.cs index 050bf2b787..1edb867e05 100644 --- a/osu.Android/OsuGameAndroid.cs +++ b/osu.Android/OsuGameAndroid.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Android.App; using Android.OS; diff --git a/osu.Android/Properties/AssemblyInfo.cs b/osu.Android/Properties/AssemblyInfo.cs index c0ba324d6e..f65b1b239f 100644 --- a/osu.Android/Properties/AssemblyInfo.cs +++ b/osu.Android/Properties/AssemblyInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Android; using Android.App; diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index 43acac4f3e..f2531c1cae 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Text; using DiscordRPC; diff --git a/osu.Desktop/LegacyIpc/LegacyIpcDifficultyCalculationRequest.cs b/osu.Desktop/LegacyIpc/LegacyIpcDifficultyCalculationRequest.cs index d6ef390a8f..7b0bd69363 100644 --- a/osu.Desktop/LegacyIpc/LegacyIpcDifficultyCalculationRequest.cs +++ b/osu.Desktop/LegacyIpc/LegacyIpcDifficultyCalculationRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Desktop.LegacyIpc { /// diff --git a/osu.Desktop/LegacyIpc/LegacyIpcDifficultyCalculationResponse.cs b/osu.Desktop/LegacyIpc/LegacyIpcDifficultyCalculationResponse.cs index 7b9fae5797..6d36cbc4b6 100644 --- a/osu.Desktop/LegacyIpc/LegacyIpcDifficultyCalculationResponse.cs +++ b/osu.Desktop/LegacyIpc/LegacyIpcDifficultyCalculationResponse.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Desktop.LegacyIpc { /// diff --git a/osu.Desktop/LegacyIpc/LegacyIpcMessage.cs b/osu.Desktop/LegacyIpc/LegacyIpcMessage.cs index 0fa60e2068..4df477191d 100644 --- a/osu.Desktop/LegacyIpc/LegacyIpcMessage.cs +++ b/osu.Desktop/LegacyIpc/LegacyIpcMessage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Platform; using Newtonsoft.Json.Linq; diff --git a/osu.Desktop/LegacyIpc/LegacyTcpIpcProvider.cs b/osu.Desktop/LegacyIpc/LegacyTcpIpcProvider.cs index 10761bc315..5d950eef55 100644 --- a/osu.Desktop/LegacyIpc/LegacyTcpIpcProvider.cs +++ b/osu.Desktop/LegacyIpc/LegacyTcpIpcProvider.cs @@ -15,8 +15,6 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Taiko; -#nullable enable - namespace osu.Desktop.LegacyIpc { /// diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index be8159a7cc..6713136343 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index f95348aa3f..4ba9cc6a90 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Runtime.Versioning; diff --git a/osu.Desktop/Security/ElevatedPrivilegesChecker.cs b/osu.Desktop/Security/ElevatedPrivilegesChecker.cs index ba37a14442..f0d95ba194 100644 --- a/osu.Desktop/Security/ElevatedPrivilegesChecker.cs +++ b/osu.Desktop/Security/ElevatedPrivilegesChecker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Security.Principal; using osu.Framework; diff --git a/osu.Desktop/Updater/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs index c09cce1235..59bc2dabb2 100644 --- a/osu.Desktop/Updater/SquirrelUpdateManager.cs +++ b/osu.Desktop/Updater/SquirrelUpdateManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Runtime.Versioning; using System.Threading.Tasks; diff --git a/osu.Desktop/Windows/GameplayWinKeyBlocker.cs b/osu.Desktop/Windows/GameplayWinKeyBlocker.cs index 4acaf61cea..0cb4ba9c04 100644 --- a/osu.Desktop/Windows/GameplayWinKeyBlocker.cs +++ b/osu.Desktop/Windows/GameplayWinKeyBlocker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Desktop/Windows/WindowsKey.cs b/osu.Desktop/Windows/WindowsKey.cs index fdca2028d3..c69cce6200 100644 --- a/osu.Desktop/Windows/WindowsKey.cs +++ b/osu.Desktop/Windows/WindowsKey.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Runtime.InteropServices; diff --git a/osu.Game.Benchmarks/BenchmarkBeatmapParsing.cs b/osu.Game.Benchmarks/BenchmarkBeatmapParsing.cs index 1d207d04c7..07ffda4030 100644 --- a/osu.Game.Benchmarks/BenchmarkBeatmapParsing.cs +++ b/osu.Game.Benchmarks/BenchmarkBeatmapParsing.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using BenchmarkDotNet.Attributes; using osu.Framework.IO.Stores; diff --git a/osu.Game.Benchmarks/BenchmarkMod.cs b/osu.Game.Benchmarks/BenchmarkMod.cs index c5375e9f09..a1d92d9a67 100644 --- a/osu.Game.Benchmarks/BenchmarkMod.cs +++ b/osu.Game.Benchmarks/BenchmarkMod.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using BenchmarkDotNet.Attributes; using osu.Game.Rulesets.Osu.Mods; diff --git a/osu.Game.Benchmarks/BenchmarkRealmReads.cs b/osu.Game.Benchmarks/BenchmarkRealmReads.cs index 615e2e964d..bdc24315bf 100644 --- a/osu.Game.Benchmarks/BenchmarkRealmReads.cs +++ b/osu.Game.Benchmarks/BenchmarkRealmReads.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using System.Threading; using BenchmarkDotNet.Attributes; diff --git a/osu.Game.Benchmarks/BenchmarkRuleset.cs b/osu.Game.Benchmarks/BenchmarkRuleset.cs index 2835ec9499..de8cb13773 100644 --- a/osu.Game.Benchmarks/BenchmarkRuleset.cs +++ b/osu.Game.Benchmarks/BenchmarkRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Engines; using osu.Game.Online.API; diff --git a/osu.Game.Benchmarks/BenchmarkTest.cs b/osu.Game.Benchmarks/BenchmarkTest.cs index 34f5edd084..140696e4a4 100644 --- a/osu.Game.Benchmarks/BenchmarkTest.cs +++ b/osu.Game.Benchmarks/BenchmarkTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Running; using NUnit.Framework; diff --git a/osu.Game.Benchmarks/Program.cs b/osu.Game.Benchmarks/Program.cs index 439ced53ab..603d8aa1b9 100644 --- a/osu.Game.Benchmarks/Program.cs +++ b/osu.Game.Benchmarks/Program.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using BenchmarkDotNet.Configs; using BenchmarkDotNet.Running; diff --git a/osu.Game.Rulesets.Catch.Tests.Android/MainActivity.cs b/osu.Game.Rulesets.Catch.Tests.Android/MainActivity.cs index d8b729576d..64c71c9ecd 100644 --- a/osu.Game.Rulesets.Catch.Tests.Android/MainActivity.cs +++ b/osu.Game.Rulesets.Catch.Tests.Android/MainActivity.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Android.App; using osu.Framework.Android; using osu.Game.Tests; diff --git a/osu.Game.Rulesets.Catch.Tests.iOS/AppDelegate.cs b/osu.Game.Rulesets.Catch.Tests.iOS/AppDelegate.cs index 39fe3dac25..64ff3f7151 100644 --- a/osu.Game.Rulesets.Catch.Tests.iOS/AppDelegate.cs +++ b/osu.Game.Rulesets.Catch.Tests.iOS/AppDelegate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Foundation; using osu.Framework.iOS; using osu.Game.Tests; diff --git a/osu.Game.Rulesets.Catch.Tests.iOS/Application.cs b/osu.Game.Rulesets.Catch.Tests.iOS/Application.cs index e44868e133..71d943ece1 100644 --- a/osu.Game.Rulesets.Catch.Tests.iOS/Application.cs +++ b/osu.Game.Rulesets.Catch.Tests.iOS/Application.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.iOS; using UIKit; diff --git a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs index baca8166d1..b6cb351c1e 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs index 48d46636df..cf030f6e13 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Difficulty; diff --git a/osu.Game.Rulesets.Catch.Tests/CatchLegacyModConversionTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchLegacyModConversionTest.cs index eae07daa3d..c65c9df9f9 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchLegacyModConversionTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchLegacyModConversionTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Game.Beatmaps.Legacy; diff --git a/osu.Game.Rulesets.Catch.Tests/CatchSkinColourDecodingTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchSkinColourDecodingTest.cs index bb3a724b91..f30b216d8d 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchSkinColourDecodingTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchSkinColourDecodingTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.IO.Stores; using osu.Game.Rulesets.Catch.Skinning; diff --git a/osu.Game.Rulesets.Catch.Tests/CatchSkinnableTestScene.cs b/osu.Game.Rulesets.Catch.Tests/CatchSkinnableTestScene.cs index 378772fea3..be6622f06e 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchSkinnableTestScene.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchSkinnableTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Catch.Tests diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/CatchEditorTestSceneContainer.cs b/osu.Game.Rulesets.Catch.Tests/Editor/CatchEditorTestSceneContainer.cs index 158c8edba5..78f56b4937 100644 --- a/osu.Game.Rulesets.Catch.Tests/Editor/CatchEditorTestSceneContainer.cs +++ b/osu.Game.Rulesets.Catch.Tests/Editor/CatchEditorTestSceneContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/CatchPlacementBlueprintTestScene.cs b/osu.Game.Rulesets.Catch.Tests/Editor/CatchPlacementBlueprintTestScene.cs index 1d30ae34cd..9060fa5aa0 100644 --- a/osu.Game.Rulesets.Catch.Tests/Editor/CatchPlacementBlueprintTestScene.cs +++ b/osu.Game.Rulesets.Catch.Tests/Editor/CatchPlacementBlueprintTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/CatchSelectionBlueprintTestScene.cs b/osu.Game.Rulesets.Catch.Tests/Editor/CatchSelectionBlueprintTestScene.cs index 88fd3b36ba..ea17fa400c 100644 --- a/osu.Game.Rulesets.Catch.Tests/Editor/CatchSelectionBlueprintTestScene.cs +++ b/osu.Game.Rulesets.Catch.Tests/Editor/CatchSelectionBlueprintTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/Checks/TestCheckBananaShowerGap.cs b/osu.Game.Rulesets.Catch.Tests/Editor/Checks/TestCheckBananaShowerGap.cs index 055c8429d7..16361d12c6 100644 --- a/osu.Game.Rulesets.Catch.Tests/Editor/Checks/TestCheckBananaShowerGap.cs +++ b/osu.Game.Rulesets.Catch.Tests/Editor/Checks/TestCheckBananaShowerGap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneBananaShowerPlacementBlueprint.cs b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneBananaShowerPlacementBlueprint.cs index fec253924f..d08acc90cd 100644 --- a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneBananaShowerPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneBananaShowerPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneCatchDistanceSnapGrid.cs b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneCatchDistanceSnapGrid.cs index 2be0b7e9b2..405bab971c 100644 --- a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneCatchDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneCatchDistanceSnapGrid.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneEditor.cs b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneEditor.cs index 161c685043..9ecfd5f5c5 100644 --- a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneEditor.cs +++ b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneEditor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneFruitPlacementBlueprint.cs b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneFruitPlacementBlueprint.cs index 4b1c45ae2f..94574b564d 100644 --- a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneFruitPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneFruitPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Utils; diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamPlacementBlueprint.cs b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamPlacementBlueprint.cs index b1adc4901c..691ebc7efc 100644 --- a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamSelectionBlueprint.cs b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamSelectionBlueprint.cs index 22a839d847..8635a88d79 100644 --- a/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Catch.Tests/Editor/TestSceneJuiceStreamSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Catch.Tests/JuiceStreamPathTest.cs b/osu.Game.Rulesets.Catch.Tests/JuiceStreamPathTest.cs index 5248d5a96a..54d26a0f3d 100644 --- a/osu.Game.Rulesets.Catch.Tests/JuiceStreamPathTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/JuiceStreamPathTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Catch.Tests/Mods/CatchModMirrorTest.cs b/osu.Game.Rulesets.Catch.Tests/Mods/CatchModMirrorTest.cs index fbbfee6b60..19321a48b9 100644 --- a/osu.Game.Rulesets.Catch.Tests/Mods/CatchModMirrorTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/Mods/CatchModMirrorTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Utils; diff --git a/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModNoScope.cs b/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModNoScope.cs index bbe543e73e..ffc5734f01 100644 --- a/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModNoScope.cs +++ b/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModNoScope.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Utils; diff --git a/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModPerfect.cs b/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModPerfect.cs index 3e06e78dba..886822f9a5 100644 --- a/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModPerfect.cs +++ b/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModPerfect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Catch.Mods; using osu.Game.Rulesets.Catch.Objects; diff --git a/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs b/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs index c01aff0aa0..3209be12d5 100644 --- a/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs +++ b/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs index 1014158fc1..202228c9e7 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Audio; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneBananaShower.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneBananaShower.cs index 96ac5c4bf2..0ddc58eb25 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneBananaShower.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneBananaShower.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs index 09362929d2..7e1c39f6a8 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayer.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayer.cs index 31d0831fae..16942f3f35 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayer.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayerLegacySkin.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayerLegacySkin.cs index b7cd6737b1..731cb4e135 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayerLegacySkin.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayerLegacySkin.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Extensions.IEnumerableExtensions; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchReplay.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchReplay.cs index a10371b0f7..6e12dacf29 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchReplay.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchReplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchSkinConfiguration.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchSkinConfiguration.cs index 8ae2bcca0e..6ecbf58a52 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchSkinConfiguration.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchSkinConfiguration.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs index 0a4ef49e19..1405e0018d 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs index 4f527e9a0f..956d0e0c14 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs index 7cae9b18b9..150c1f8406 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneComboCounter.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneComboCounter.cs index b720ab1e97..7f513728af 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneComboCounter.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneComboCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs index 4b8fede369..94c870a444 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjectsHidden.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjectsHidden.cs index 62fe5dca2c..868f498e8c 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjectsHidden.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjectsHidden.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Catch.Mods; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneFruitObjects.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneFruitObjects.cs index 12b98dc93c..7d72633e34 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneFruitObjects.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneFruitObjects.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneFruitRandomness.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneFruitRandomness.cs index c888dc0a65..c7d130b440 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneFruitRandomness.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneFruitRandomness.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects.Drawables; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneFruitVisualChange.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneFruitVisualChange.cs index 9446e864a1..f7abd8d519 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneFruitVisualChange.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneFruitVisualChange.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects.Drawables; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs index a5b44dc605..655edf7e08 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDashColouring.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDashColouring.cs index 14a4d02396..cf49b7fe12 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDashColouring.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDashColouring.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs index 4601234669..81589459c4 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneLegacyBeatmapSkin.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneLegacyBeatmapSkin.cs index bc3daca16f..786353bb00 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneLegacyBeatmapSkin.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneLegacyBeatmapSkin.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs index f009c10a9c..ac39b91f00 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index 7774a7da09..9f5d007114 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; using System.Collections.Generic; diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs index ab61b14ac4..835f7c2d27 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Catch/CatchInputManager.cs b/osu.Game.Rulesets.Catch/CatchInputManager.cs index 021d7a7efe..86f35c8cee 100644 --- a/osu.Game.Rulesets.Catch/CatchInputManager.cs +++ b/osu.Game.Rulesets.Catch/CatchInputManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Input.Bindings; using osu.Game.Rulesets.UI; diff --git a/osu.Game.Rulesets.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs index 80b9436b2c..f832d99807 100644 --- a/osu.Game.Rulesets.Catch/CatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Rulesets.Catch.Mods; diff --git a/osu.Game.Rulesets.Catch/CatchSkinComponent.cs b/osu.Game.Rulesets.Catch/CatchSkinComponent.cs index 8bf53e53e3..0fcdd34ca3 100644 --- a/osu.Game.Rulesets.Catch/CatchSkinComponent.cs +++ b/osu.Game.Rulesets.Catch/CatchSkinComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Skinning; namespace osu.Game.Rulesets.Catch diff --git a/osu.Game.Rulesets.Catch/CatchSkinComponents.cs b/osu.Game.Rulesets.Catch/CatchSkinComponents.cs index 371e901c69..7587de5803 100644 --- a/osu.Game.Rulesets.Catch/CatchSkinComponents.cs +++ b/osu.Game.Rulesets.Catch/CatchSkinComponents.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Catch { public enum CatchSkinComponents diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs index 8e069d7d16..9951d736c3 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Rulesets.Difficulty; diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index 8140ea6eaa..b64d860417 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchPerformanceAttributes.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchPerformanceAttributes.cs index 1335fc2d23..ccdfd30200 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchPerformanceAttributes.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchPerformanceAttributes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Difficulty; namespace osu.Game.Rulesets.Catch.Difficulty diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchPerformanceCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchPerformanceCalculator.cs index b30b85be2d..2a07b8019e 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchPerformanceCalculator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs index 3bcfce3a56..c44480776f 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Game.Rulesets.Catch.Objects; diff --git a/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs b/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs index cfb3fe40be..827c28f7de 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Rulesets.Catch.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Preprocessing; diff --git a/osu.Game.Rulesets.Catch/Edit/BananaShowerCompositionTool.cs b/osu.Game.Rulesets.Catch/Edit/BananaShowerCompositionTool.cs index 31075db7d1..e64a51f03a 100644 --- a/osu.Game.Rulesets.Catch/Edit/BananaShowerCompositionTool.cs +++ b/osu.Game.Rulesets.Catch/Edit/BananaShowerCompositionTool.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Edit.Blueprints; diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs index 039008f901..86fdf09a72 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Input.Events; using osu.Game.Rulesets.Catch.Edit.Blueprints.Components; diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerSelectionBlueprint.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerSelectionBlueprint.cs index 9132b1a9e8..7e4aca180c 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/BananaShowerSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Catch.Objects; namespace osu.Game.Rulesets.Catch.Edit.Blueprints diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/CatchPlacementBlueprint.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/CatchPlacementBlueprint.cs index 5a32d241ad..8a1ced7eea 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/CatchPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/CatchPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/CatchSelectionBlueprint.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/CatchSelectionBlueprint.cs index 7e566c810c..e7c04cd132 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/CatchSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/CatchSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs index e038562b4b..44d14ec330 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/EditablePath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/FruitOutline.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/FruitOutline.cs index 0c03068e26..86006a99fc 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/FruitOutline.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/FruitOutline.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/NestedOutlineContainer.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/NestedOutlineContainer.cs index cf916b27a4..431ba331ac 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/NestedOutlineContainer.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/NestedOutlineContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/PlacementEditablePath.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/PlacementEditablePath.cs index 511aec5e5d..27df064be4 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/PlacementEditablePath.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/PlacementEditablePath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Rulesets.Catch.Objects; using osuTK; diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/ScrollingPath.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/ScrollingPath.cs index cfaca2f9a4..3a62b07816 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/ScrollingPath.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/ScrollingPath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/SelectionEditablePath.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/SelectionEditablePath.cs index b4c353313c..4576e9f8ee 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/SelectionEditablePath.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/SelectionEditablePath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/TimeSpanOutline.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/TimeSpanOutline.cs index 65dfce0493..2586a81ef5 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/TimeSpanOutline.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/TimeSpanOutline.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/VertexPiece.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/VertexPiece.cs index 5ef86b6074..236d27753a 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/VertexPiece.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/VertexPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/VertexState.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/VertexState.cs index 3f240c7944..1ddffc10a5 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/VertexState.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/Components/VertexState.cs @@ -3,8 +3,6 @@ using osu.Game.Rulesets.Catch.Objects; -#nullable enable - namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components { /// diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/FruitPlacementBlueprint.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/FruitPlacementBlueprint.cs index e169e3b75c..686840ae55 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/FruitPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/FruitPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Input.Events; using osu.Game.Rulesets.Catch.Edit.Blueprints.Components; using osu.Game.Rulesets.Catch.Objects; diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/FruitSelectionBlueprint.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/FruitSelectionBlueprint.cs index 150297badb..b5a25dbf62 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/FruitSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/FruitSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Catch.Edit.Blueprints.Components; using osu.Game.Rulesets.Catch.Objects; diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamPlacementBlueprint.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamPlacementBlueprint.cs index b5dcb62543..fcdd055b56 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Input; using osu.Framework.Input.Events; diff --git a/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamSelectionBlueprint.cs b/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamSelectionBlueprint.cs index 12054a1d16..fc2b5e08fe 100644 --- a/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Catch/Edit/CatchBeatmapVerifier.cs b/osu.Game.Rulesets.Catch/Edit/CatchBeatmapVerifier.cs index c7a41a4e22..6570a19a92 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchBeatmapVerifier.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchBeatmapVerifier.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Rulesets.Catch.Edit.Checks; diff --git a/osu.Game.Rulesets.Catch/Edit/CatchBlueprintContainer.cs b/osu.Game.Rulesets.Catch/Edit/CatchBlueprintContainer.cs index 7f2782a474..58f493b4b8 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchBlueprintContainer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchBlueprintContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Catch.Edit.Blueprints; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Catch/Edit/CatchDistanceSnapGrid.cs b/osu.Game.Rulesets.Catch/Edit/CatchDistanceSnapGrid.cs index 9a78c7ff86..718c76abfc 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchDistanceSnapGrid.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Catch/Edit/CatchEditorPlayfield.cs b/osu.Game.Rulesets.Catch/Edit/CatchEditorPlayfield.cs index 046ba0ebce..b9a875fe8a 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchEditorPlayfield.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchEditorPlayfield.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.UI; diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs index 6f59b3e543..01156ab021 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectUtils.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectUtils.cs index b059926668..4390234b59 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectUtils.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectUtils.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Rulesets.Catch.Objects; diff --git a/osu.Game.Rulesets.Catch/Edit/CatchSelectionHandler.cs b/osu.Game.Rulesets.Catch/Edit/CatchSelectionHandler.cs index dd5835b4ed..319cb1bfc9 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchSelectionHandler.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchSelectionHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Catch/Edit/Checks/CheckBananaShowerGap.cs b/osu.Game.Rulesets.Catch/Edit/Checks/CheckBananaShowerGap.cs index 4b2933c0e1..00fd74c9a8 100644 --- a/osu.Game.Rulesets.Catch/Edit/Checks/CheckBananaShowerGap.cs +++ b/osu.Game.Rulesets.Catch/Edit/Checks/CheckBananaShowerGap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Catch/Edit/DrawableCatchEditorRuleset.cs b/osu.Game.Rulesets.Catch/Edit/DrawableCatchEditorRuleset.cs index 9a7528d90c..c81afafae5 100644 --- a/osu.Game.Rulesets.Catch/Edit/DrawableCatchEditorRuleset.cs +++ b/osu.Game.Rulesets.Catch/Edit/DrawableCatchEditorRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.UI; diff --git a/osu.Game.Rulesets.Catch/Edit/FruitCompositionTool.cs b/osu.Game.Rulesets.Catch/Edit/FruitCompositionTool.cs index f776fe39c1..5c13692b51 100644 --- a/osu.Game.Rulesets.Catch/Edit/FruitCompositionTool.cs +++ b/osu.Game.Rulesets.Catch/Edit/FruitCompositionTool.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Edit.Blueprints; diff --git a/osu.Game.Rulesets.Catch/Edit/JuiceStreamCompositionTool.cs b/osu.Game.Rulesets.Catch/Edit/JuiceStreamCompositionTool.cs index cb66e2952e..85cf89f700 100644 --- a/osu.Game.Rulesets.Catch/Edit/JuiceStreamCompositionTool.cs +++ b/osu.Game.Rulesets.Catch/Edit/JuiceStreamCompositionTool.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Edit.Blueprints; diff --git a/osu.Game.Rulesets.Catch/Edit/PositionRange.cs b/osu.Game.Rulesets.Catch/Edit/PositionRange.cs index e61603e5e6..482295a357 100644 --- a/osu.Game.Rulesets.Catch/Edit/PositionRange.cs +++ b/osu.Game.Rulesets.Catch/Edit/PositionRange.cs @@ -3,8 +3,6 @@ using System; -#nullable enable - namespace osu.Game.Rulesets.Catch.Edit { /// diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs index b919102215..15f6e4a64d 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs index 8fd7b93e4c..90aa6f41a1 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Judgements diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs index ccafe0abc4..e5d6429660 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchJudgementResult.cs b/osu.Game.Rulesets.Catch/Judgements/CatchJudgementResult.cs index c09355d59c..6cc79f9619 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchJudgementResult.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchJudgementResult.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Judgements; diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs index d957d4171b..c9052e3c39 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Judgements diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModAutoplay.cs b/osu.Game.Rulesets.Catch/Mods/CatchModAutoplay.cs index 50e48101d3..c5ca595fd6 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModAutoplay.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModAutoplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Replays; diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModCinema.cs b/osu.Game.Rulesets.Catch/Mods/CatchModCinema.cs index 7eda6b37d3..10a0809e05 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModCinema.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModCinema.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModClassic.cs b/osu.Game.Rulesets.Catch/Mods/CatchModClassic.cs index 9624e84018..904656993e 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModClassic.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModClassic.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Catch.Mods diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModDaycore.cs b/osu.Game.Rulesets.Catch/Mods/CatchModDaycore.cs index cae19e9468..8d4b57c244 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModDaycore.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModDaycore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Catch.Mods diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModDifficultyAdjust.cs b/osu.Game.Rulesets.Catch/Mods/CatchModDifficultyAdjust.cs index e59a0a0431..6927d7953f 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModDifficultyAdjust.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModDifficultyAdjust.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Bindables; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModDoubleTime.cs b/osu.Game.Rulesets.Catch/Mods/CatchModDoubleTime.cs index 178909387f..4db0a53005 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModDoubleTime.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModDoubleTime.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Catch.Mods diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModEasy.cs b/osu.Game.Rulesets.Catch/Mods/CatchModEasy.cs index 16ef56d845..bea9b094fa 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModEasy.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModEasy.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Catch.Mods diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs index d576ea3df8..e05932ca03 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Configuration; diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFloatingFruits.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFloatingFruits.cs index 63203dd57c..1fe892c9b5 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFloatingFruits.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFloatingFruits.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Game.Rulesets.Catch.Objects; diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModHalfTime.cs b/osu.Game.Rulesets.Catch/Mods/CatchModHalfTime.cs index ce06b841aa..0c7886be10 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModHalfTime.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModHalfTime.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Catch.Mods diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs b/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs index 68b6ce96a3..7db9bf2dfd 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Beatmaps; diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModHidden.cs b/osu.Game.Rulesets.Catch/Mods/CatchModHidden.cs index 4b6f79df88..c02eedf936 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModHidden.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModHidden.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Graphics; using osu.Game.Rulesets.Catch.Objects; diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModMirror.cs b/osu.Game.Rulesets.Catch/Mods/CatchModMirror.cs index a97e940a64..89fc40356d 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModMirror.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModMirror.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Beatmaps; diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModMuted.cs b/osu.Game.Rulesets.Catch/Mods/CatchModMuted.cs index 6d2565440a..6b28d1a127 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModMuted.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModMuted.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModNightcore.cs b/osu.Game.Rulesets.Catch/Mods/CatchModNightcore.cs index c07087efaf..365d987794 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModNightcore.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModNightcore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModNoFail.cs b/osu.Game.Rulesets.Catch/Mods/CatchModNoFail.cs index 3c02646e99..89e7e4bcd6 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModNoFail.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModNoFail.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Catch.Mods diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModNoScope.cs b/osu.Game.Rulesets.Catch/Mods/CatchModNoScope.cs index a24a6227fe..385d4c50c0 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModNoScope.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModNoScope.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModPerfect.cs b/osu.Game.Rulesets.Catch/Mods/CatchModPerfect.cs index fb92399102..0a74ee4fbb 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModPerfect.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModPerfect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Catch.Mods diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModRelax.cs b/osu.Game.Rulesets.Catch/Mods/CatchModRelax.cs index d0a94767d1..f4d6fb9ab3 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModRelax.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModRelax.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Input; using osu.Framework.Input.Bindings; diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModSuddenDeath.cs b/osu.Game.Rulesets.Catch/Mods/CatchModSuddenDeath.cs index 68e01391ce..d98829137c 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModSuddenDeath.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModSuddenDeath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Catch.Mods diff --git a/osu.Game.Rulesets.Catch/Objects/Banana.cs b/osu.Game.Rulesets.Catch/Objects/Banana.cs index e5a36d08db..af03c9acab 100644 --- a/osu.Game.Rulesets.Catch/Objects/Banana.cs +++ b/osu.Game.Rulesets.Catch/Objects/Banana.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using osu.Game.Audio; diff --git a/osu.Game.Rulesets.Catch/Objects/BananaShower.cs b/osu.Game.Rulesets.Catch/Objects/BananaShower.cs index b45f95a8e6..e5541e49c1 100644 --- a/osu.Game.Rulesets.Catch/Objects/BananaShower.cs +++ b/osu.Game.Rulesets.Catch/Objects/BananaShower.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Types; diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index ee10cf9711..f5a3426305 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; using osu.Framework.Bindables; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtBanana.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtBanana.cs index 8a91f82437..31a27b6047 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtBanana.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtBanana.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Catch.Skinning.Default; namespace osu.Game.Rulesets.Catch.Objects.Drawables diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtDroplet.cs index 4a3397feff..6d5dd0ed25 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtDroplet.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Catch.Skinning.Default; namespace osu.Game.Rulesets.Catch.Objects.Drawables diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtFruit.cs index 7c88090a20..89757748ab 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtFruit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Catch.Skinning.Default; namespace osu.Game.Rulesets.Catch.Objects.Drawables diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtObject.cs index d8bce9bb6d..fd0ffbd032 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/CaughtObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableBanana.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableBanana.cs index c1b41a7afc..b46a452bd0 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableBanana.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableBanana.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableBananaShower.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableBananaShower.cs index 9b2f95e221..f061f206ff 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableBananaShower.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableBananaShower.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs index 0c065948ef..23264edf3d 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableDroplet.cs index 2dce9507a5..d367ad0a00 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableDroplet.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs index 0af7ee6c30..ce4c7e5aff 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableJuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableJuiceStream.cs index a496a35842..12a44c909e 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableJuiceStream.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableJuiceStream.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs index 27cd7ed2bc..5de372852b 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableTinyDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableTinyDroplet.cs index 8f5a04dfda..8c48b62c7e 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableTinyDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableTinyDroplet.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; namespace osu.Game.Rulesets.Catch.Objects.Drawables diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/IHasCatchObjectState.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/IHasCatchObjectState.cs index be0ee2821e..93c80b09db 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/IHasCatchObjectState.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/IHasCatchObjectState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osuTK; using osuTK.Graphics; diff --git a/osu.Game.Rulesets.Catch/Objects/Droplet.cs b/osu.Game.Rulesets.Catch/Objects/Droplet.cs index 9c1004a04b..ecaa4bfaf4 100644 --- a/osu.Game.Rulesets.Catch/Objects/Droplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Droplet.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Judgements; diff --git a/osu.Game.Rulesets.Catch/Objects/Fruit.cs b/osu.Game.Rulesets.Catch/Objects/Fruit.cs index 4818fe2cad..bdf8b3f28d 100644 --- a/osu.Game.Rulesets.Catch/Objects/Fruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Fruit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Judgements; diff --git a/osu.Game.Rulesets.Catch/Objects/FruitVisualRepresentation.cs b/osu.Game.Rulesets.Catch/Objects/FruitVisualRepresentation.cs index 7ec7050245..e5d013dafc 100644 --- a/osu.Game.Rulesets.Catch/Objects/FruitVisualRepresentation.cs +++ b/osu.Game.Rulesets.Catch/Objects/FruitVisualRepresentation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Catch.Objects { public enum FruitVisualRepresentation diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs index d34452cdbb..311e15116e 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStreamPath.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStreamPath.cs index 61f4c580ae..0633151ddd 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStreamPath.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStreamPath.cs @@ -9,8 +9,6 @@ using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using osuTK; -#nullable enable - namespace osu.Game.Rulesets.Catch.Objects { /// diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStreamPathVertex.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStreamPathVertex.cs index afef2e637f..96ed82bca3 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStreamPathVertex.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStreamPathVertex.cs @@ -3,8 +3,6 @@ using System; -#nullable enable - namespace osu.Game.Rulesets.Catch.Objects { /// diff --git a/osu.Game.Rulesets.Catch/Objects/PalpableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/PalpableCatchHitObject.cs index 4001a4ea76..1ededa1438 100644 --- a/osu.Game.Rulesets.Catch/Objects/PalpableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/PalpableCatchHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; using osu.Framework.Bindables; using osu.Game.Rulesets.Objects.Types; diff --git a/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs b/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs index 1bf160b5a6..6bd5f0ac2a 100644 --- a/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Judgements; diff --git a/osu.Game.Rulesets.Catch/Properties/AssemblyInfo.cs b/osu.Game.Rulesets.Catch/Properties/AssemblyInfo.cs index 26f20b223a..6c7f0478a7 100644 --- a/osu.Game.Rulesets.Catch/Properties/AssemblyInfo.cs +++ b/osu.Game.Rulesets.Catch/Properties/AssemblyInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Runtime.CompilerServices; // We publish our internal attributes to other sub-projects of the framework. diff --git a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs index 7c84cb24f3..86c249a7c1 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Utils; diff --git a/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs b/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs index b6af88a771..64a573149f 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Input.StateChanges; diff --git a/osu.Game.Rulesets.Catch/Replays/CatchReplayFrame.cs b/osu.Game.Rulesets.Catch/Replays/CatchReplayFrame.cs index 1a80adb584..5cf03e4706 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchReplayFrame.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchReplayFrame.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Replays.Legacy; diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index 51b1ccaaba..ba3d529212 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Scoring diff --git a/osu.Game.Rulesets.Catch/Skinning/CatchSkinColour.cs b/osu.Game.Rulesets.Catch/Skinning/CatchSkinColour.cs index 4506111498..d038ccb31c 100644 --- a/osu.Game.Rulesets.Catch/Skinning/CatchSkinColour.cs +++ b/osu.Game.Rulesets.Catch/Skinning/CatchSkinColour.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Catch.Skinning { public enum CatchSkinColour diff --git a/osu.Game.Rulesets.Catch/Skinning/CatchSkinConfiguration.cs b/osu.Game.Rulesets.Catch/Skinning/CatchSkinConfiguration.cs index ea8d742b1a..65d6acd88d 100644 --- a/osu.Game.Rulesets.Catch/Skinning/CatchSkinConfiguration.cs +++ b/osu.Game.Rulesets.Catch/Skinning/CatchSkinConfiguration.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Catch.Skinning { public enum CatchSkinConfiguration diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/BananaPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Default/BananaPiece.cs index 8da18a668a..27252594af 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/BananaPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/BananaPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; namespace osu.Game.Rulesets.Catch.Skinning.Default diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/BananaPulpFormation.cs b/osu.Game.Rulesets.Catch/Skinning/Default/BananaPulpFormation.cs index ee1cc68f7d..ffeed80615 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/BananaPulpFormation.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/BananaPulpFormation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; namespace osu.Game.Rulesets.Catch.Skinning.Default diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/BorderPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Default/BorderPiece.cs index 8d8ee49af7..60a13bee59 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/BorderPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/BorderPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Catch.Objects; diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs index 2db3bae034..6cc5220699 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/DefaultCatcher.cs b/osu.Game.Rulesets.Catch/Skinning/Default/DefaultCatcher.cs index e423f21b98..4148fed11c 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/DefaultCatcher.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/DefaultCatcher.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/DefaultHitExplosion.cs b/osu.Game.Rulesets.Catch/Skinning/Default/DefaultHitExplosion.cs index f6b3c3d665..7ea99b3ed9 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/DefaultHitExplosion.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/DefaultHitExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/DropletPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Default/DropletPiece.cs index 8b1052dfe2..6b7f25eed1 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/DropletPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/DropletPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Rulesets.Catch.Objects; using osuTK; diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/FruitPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Default/FruitPiece.cs index cfe0df0c97..8fb5c8f84a 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/FruitPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/FruitPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Rulesets.Catch.Objects; diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/FruitPulpFormation.cs b/osu.Game.Rulesets.Catch/Skinning/Default/FruitPulpFormation.cs index f097361d2a..db51195f11 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/FruitPulpFormation.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/FruitPulpFormation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Rulesets.Catch.Objects; using osuTK; diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/HyperBorderPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Default/HyperBorderPiece.cs index c8895f32f4..42b0b85495 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/HyperBorderPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/HyperBorderPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Rulesets.Catch.UI; diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/HyperDropletBorderPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Default/HyperDropletBorderPiece.cs index 53a487b97f..29cb339625 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/HyperDropletBorderPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/HyperDropletBorderPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Catch.Skinning.Default { public class HyperDropletBorderPiece : HyperBorderPiece diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/Pulp.cs b/osu.Game.Rulesets.Catch/Skinning/Default/Pulp.cs index 96c6233b41..8ea54617d9 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/Pulp.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/Pulp.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/PulpFormation.cs b/osu.Game.Rulesets.Catch/Skinning/Default/PulpFormation.cs index 8753aa4077..aa5ef5fb66 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/PulpFormation.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/PulpFormation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Catch/Skinning/Legacy/CatchLegacySkinTransformer.cs b/osu.Game.Rulesets.Catch/Skinning/Legacy/CatchLegacySkinTransformer.cs index 04b522b404..c5e5e59dd2 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Legacy/CatchLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Legacy/CatchLegacySkinTransformer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyBananaPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyBananaPiece.cs index 5bd5b0d4bb..9f64a2129e 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyBananaPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyBananaPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Textures; namespace osu.Game.Rulesets.Catch.Skinning.Legacy diff --git a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatchComboCounter.cs b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatchComboCounter.cs index b4d29988d9..b2dd29841b 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatchComboCounter.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatchComboCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Catch.UI; diff --git a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatchHitObjectPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatchHitObjectPiece.cs index f78724615a..5a5288105d 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatchHitObjectPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatchHitObjectPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherNew.cs b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherNew.cs index 9df87c92ea..93d79f00d3 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherNew.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherNew.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherOld.cs b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherOld.cs index 3e679171b2..736e9cfddf 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherOld.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherOld.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyDropletPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyDropletPiece.cs index 2c5cbe1e41..f99cedab3f 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyDropletPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyDropletPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Textures; using osuTK; diff --git a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyFruitPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyFruitPiece.cs index f002bab219..125a96a446 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyFruitPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyFruitPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Catch.Objects; namespace osu.Game.Rulesets.Catch.Skinning.Legacy diff --git a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyHitExplosion.cs b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyHitExplosion.cs index c262b0a4ac..0630de9156 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyHitExplosion.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyHitExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Catch/UI/CatchComboDisplay.cs b/osu.Game.Rulesets.Catch/UI/CatchComboDisplay.cs index ad344ff2dd..e9c289e46a 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchComboDisplay.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchComboDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Game.Rulesets.Catch.Objects.Drawables; using osu.Game.Rulesets.Judgements; diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index df32d917ce..dad22fbe69 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfieldAdjustmentContainer.cs index efc1b24ed5..82b85f54e4 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfieldAdjustmentContainer.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfieldAdjustmentContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.UI; diff --git a/osu.Game.Rulesets.Catch/UI/CatchReplayRecorder.cs b/osu.Game.Rulesets.Catch/UI/CatchReplayRecorder.cs index a7879846df..c118c14e3f 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchReplayRecorder.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchReplayRecorder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Catch.Replays; using osu.Game.Rulesets.Replays; diff --git a/osu.Game.Rulesets.Catch/UI/Catcher.cs b/osu.Game.Rulesets.Catch/UI/Catcher.cs index 04708c8796..6a3ec336d1 100644 --- a/osu.Game.Rulesets.Catch/UI/Catcher.cs +++ b/osu.Game.Rulesets.Catch/UI/Catcher.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Catch/UI/CatcherAnimationState.cs b/osu.Game.Rulesets.Catch/UI/CatcherAnimationState.cs index 566e9d1911..82591eb47f 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherAnimationState.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherAnimationState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Catch.UI { public enum CatcherAnimationState diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 37002d1051..a0279b5c83 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Catch/UI/CatcherTrail.cs b/osu.Game.Rulesets.Catch/UI/CatcherTrail.cs index 6d2ac7e488..afaa037574 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherTrail.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherTrail.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Timing; using osu.Game.Rulesets.Objects.Pooling; diff --git a/osu.Game.Rulesets.Catch/UI/CatcherTrailAnimation.cs b/osu.Game.Rulesets.Catch/UI/CatcherTrailAnimation.cs index 0a5281cd10..02bc5be863 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherTrailAnimation.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherTrailAnimation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Catch.UI { public enum CatcherTrailAnimation diff --git a/osu.Game.Rulesets.Catch/UI/CatcherTrailDisplay.cs b/osu.Game.Rulesets.Catch/UI/CatcherTrailDisplay.cs index 0f2530e56a..6ab6a59293 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherTrailDisplay.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherTrailDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Catch/UI/CatcherTrailEntry.cs b/osu.Game.Rulesets.Catch/UI/CatcherTrailEntry.cs index 3a40ab26cc..78d6979b78 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherTrailEntry.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherTrailEntry.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Performance; using osuTK; diff --git a/osu.Game.Rulesets.Catch/UI/Direction.cs b/osu.Game.Rulesets.Catch/UI/Direction.cs index 65f064b7fb..15e4aed86b 100644 --- a/osu.Game.Rulesets.Catch/UI/Direction.cs +++ b/osu.Game.Rulesets.Catch/UI/Direction.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Catch.UI { public enum Direction diff --git a/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs b/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs index a8ec9f1d2f..b6cea92173 100644 --- a/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Input; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Catch/UI/DroppedObjectContainer.cs b/osu.Game.Rulesets.Catch/UI/DroppedObjectContainer.cs index b44b0caae4..1e4da479d2 100644 --- a/osu.Game.Rulesets.Catch/UI/DroppedObjectContainer.cs +++ b/osu.Game.Rulesets.Catch/UI/DroppedObjectContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Catch.Objects.Drawables; diff --git a/osu.Game.Rulesets.Catch/UI/HitExplosion.cs b/osu.Game.Rulesets.Catch/UI/HitExplosion.cs index 955b1e6edb..1ea188d463 100644 --- a/osu.Game.Rulesets.Catch/UI/HitExplosion.cs +++ b/osu.Game.Rulesets.Catch/UI/HitExplosion.cs @@ -6,8 +6,6 @@ using osu.Game.Rulesets.Catch.Skinning.Default; using osu.Game.Rulesets.Objects.Pooling; using osu.Game.Skinning; -#nullable enable - namespace osu.Game.Rulesets.Catch.UI { public class HitExplosion : PoolableDrawableWithLifetime diff --git a/osu.Game.Rulesets.Catch/UI/HitExplosionContainer.cs b/osu.Game.Rulesets.Catch/UI/HitExplosionContainer.cs index 6df13e52ef..2004c971ad 100644 --- a/osu.Game.Rulesets.Catch/UI/HitExplosionContainer.cs +++ b/osu.Game.Rulesets.Catch/UI/HitExplosionContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Pooling; using osu.Game.Rulesets.Objects.Pooling; diff --git a/osu.Game.Rulesets.Catch/UI/HitExplosionEntry.cs b/osu.Game.Rulesets.Catch/UI/HitExplosionEntry.cs index 88871c77f6..f265da149a 100644 --- a/osu.Game.Rulesets.Catch/UI/HitExplosionEntry.cs +++ b/osu.Game.Rulesets.Catch/UI/HitExplosionEntry.cs @@ -6,8 +6,6 @@ using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Judgements; using osuTK.Graphics; -#nullable enable - namespace osu.Game.Rulesets.Catch.UI { public class HitExplosionEntry : LifetimeEntry diff --git a/osu.Game.Rulesets.Catch/UI/ICatchComboCounter.cs b/osu.Game.Rulesets.Catch/UI/ICatchComboCounter.cs index cfb6879067..5d027edbaa 100644 --- a/osu.Game.Rulesets.Catch/UI/ICatchComboCounter.cs +++ b/osu.Game.Rulesets.Catch/UI/ICatchComboCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osuTK.Graphics; diff --git a/osu.Game.Rulesets.Catch/UI/IHitExplosion.cs b/osu.Game.Rulesets.Catch/UI/IHitExplosion.cs index c744c00d9a..4a9d7e8ac0 100644 --- a/osu.Game.Rulesets.Catch/UI/IHitExplosion.cs +++ b/osu.Game.Rulesets.Catch/UI/IHitExplosion.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - namespace osu.Game.Rulesets.Catch.UI { /// diff --git a/osu.Game.Rulesets.Catch/UI/SkinnableCatcher.cs b/osu.Game.Rulesets.Catch/UI/SkinnableCatcher.cs index 8d707a4beb..25bbc814bf 100644 --- a/osu.Game.Rulesets.Catch/UI/SkinnableCatcher.cs +++ b/osu.Game.Rulesets.Catch/UI/SkinnableCatcher.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Mania.Tests.Android/MainActivity.cs b/osu.Game.Rulesets.Mania.Tests.Android/MainActivity.cs index 518071fd49..789fc9e22d 100644 --- a/osu.Game.Rulesets.Mania.Tests.Android/MainActivity.cs +++ b/osu.Game.Rulesets.Mania.Tests.Android/MainActivity.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Android.App; using osu.Framework.Android; using osu.Game.Tests; diff --git a/osu.Game.Rulesets.Mania.Tests.iOS/AppDelegate.cs b/osu.Game.Rulesets.Mania.Tests.iOS/AppDelegate.cs index 9cd1e47023..a528634f3b 100644 --- a/osu.Game.Rulesets.Mania.Tests.iOS/AppDelegate.cs +++ b/osu.Game.Rulesets.Mania.Tests.iOS/AppDelegate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Foundation; using osu.Framework.iOS; using osu.Game.Tests; diff --git a/osu.Game.Rulesets.Mania.Tests.iOS/Application.cs b/osu.Game.Rulesets.Mania.Tests.iOS/Application.cs index ec3db17e97..2d1015387a 100644 --- a/osu.Game.Rulesets.Mania.Tests.iOS/Application.cs +++ b/osu.Game.Rulesets.Mania.Tests.iOS/Application.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.iOS; using UIKit; diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/ManiaPlacementBlueprintTestScene.cs b/osu.Game.Rulesets.Mania.Tests/Editor/ManiaPlacementBlueprintTestScene.cs index 94f385bbf1..6e6e83f9cf 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/ManiaPlacementBlueprintTestScene.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/ManiaPlacementBlueprintTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/ManiaSelectionBlueprintTestScene.cs b/osu.Game.Rulesets.Mania.Tests/Editor/ManiaSelectionBlueprintTestScene.cs index 124e1a35f9..679a15e8cb 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/ManiaSelectionBlueprintTestScene.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/ManiaSelectionBlueprintTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneEditor.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneEditor.cs index 5300747633..99850f33b8 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneEditor.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneEditor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNotePlacementBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNotePlacementBlueprint.cs index 87c74a12cf..ddec1f3432 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNotePlacementBlueprint.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNotePlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Edit.Blueprints; using osu.Game.Rulesets.Mania.Objects; diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNoteSelectionBlueprint.cs index 9953b8e3c0..b70d4e4fa6 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNoteSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Mania.Edit.Blueprints; diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs index 6130a80bb4..ec96205067 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaComposeScreen.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaComposeScreen.cs index 746bdae02e..15b38b39ba 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaComposeScreen.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaComposeScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaHitObjectComposer.cs index 9788dfe844..4ad27348fc 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaHitObjectComposer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNotePlacementBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNotePlacementBlueprint.cs index a162c5ec44..28c002eef8 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNotePlacementBlueprint.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNotePlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Extensions.IEnumerableExtensions; diff --git a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNoteSelectionBlueprint.cs index 3586eecc44..f61d416e3b 100644 --- a/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNoteSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Mania.Edit.Blueprints; diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs index 837474ad9e..ef6dca620a 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapSampleConversionTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapSampleConversionTest.cs index 9c690f360a..51f35d3c3d 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapSampleConversionTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapSampleConversionTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaColumnTypeTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaColumnTypeTest.cs index 66fe6d8cc5..e53deb5269 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaColumnTypeTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaColumnTypeTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Mania.Beatmaps; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs index a5bd126782..9e4db1f1c9 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaInputTestScene.cs b/osu.Game.Rulesets.Mania.Tests/ManiaInputTestScene.cs index 9049bb3a82..eb380c07a6 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaInputTestScene.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaInputTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Bindings; diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaLegacyModConversionTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaLegacyModConversionTest.cs index a28c188051..accae29ffe 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaLegacyModConversionTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaLegacyModConversionTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Game.Beatmaps.Legacy; diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaLegacyReplayTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaLegacyReplayTest.cs index 40bb83aece..b64006316e 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaLegacyReplayTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaLegacyReplayTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Replays; diff --git a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModConstantSpeed.cs b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModConstantSpeed.cs index 60363aaeef..538c8b13d1 100644 --- a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModConstantSpeed.cs +++ b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModConstantSpeed.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModHoldOff.cs b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModHoldOff.cs index 7970d5b594..4222be0359 100644 --- a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModHoldOff.cs +++ b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModHoldOff.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModInvert.cs b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModInvert.cs index f2cc254e38..4c97f65b07 100644 --- a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModInvert.cs +++ b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModInvert.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Mania.Mods; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs index 2e3b21aed7..9612543483 100644 --- a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs +++ b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Mania.Mods; using osu.Game.Rulesets.Mania.Objects; diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/ColumnTestContainer.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/ColumnTestContainer.cs index 8ba58e3af3..1a3513d46c 100644 --- a/osu.Game.Rulesets.Mania.Tests/Skinning/ColumnTestContainer.cs +++ b/osu.Game.Rulesets.Mania.Tests/Skinning/ColumnTestContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/ManiaHitObjectTestScene.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/ManiaHitObjectTestScene.cs index 68cf3b67df..fd82041ad8 100644 --- a/osu.Game.Rulesets.Mania.Tests/Skinning/ManiaHitObjectTestScene.cs +++ b/osu.Game.Rulesets.Mania.Tests/Skinning/ManiaHitObjectTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/ManiaSkinnableTestScene.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/ManiaSkinnableTestScene.cs index ddfd057cd8..9f235689b4 100644 --- a/osu.Game.Rulesets.Mania.Tests/Skinning/ManiaSkinnableTestScene.cs +++ b/osu.Game.Rulesets.Mania.Tests/Skinning/ManiaSkinnableTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneColumnBackground.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneColumnBackground.cs index 106b2d188d..cd26e2a9de 100644 --- a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneColumnBackground.cs +++ b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneColumnBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneColumnHitObjectArea.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneColumnHitObjectArea.cs index 8034341d15..1fb9d448a9 100644 --- a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneColumnHitObjectArea.cs +++ b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneColumnHitObjectArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneDrawableJudgement.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneDrawableJudgement.cs index d033676ec7..8b12d37fe9 100644 --- a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneDrawableJudgement.cs +++ b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneDrawableJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Extensions; diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneHitExplosion.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneHitExplosion.cs index 9e6e0a7776..744721f1a3 100644 --- a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneHitExplosion.cs +++ b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneHitExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneHoldNote.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneHoldNote.cs index e88ff8e2ac..0947ddfeb0 100644 --- a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneHoldNote.cs +++ b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneHoldNote.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneKeyArea.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneKeyArea.cs index 7564bd84ad..bbbd7edb7b 100644 --- a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneKeyArea.cs +++ b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneKeyArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneNote.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneNote.cs index bc3bdf0bcb..85995e6994 100644 --- a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneNote.cs +++ b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneNote.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Mania.Objects; diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/TestScenePlayfield.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/TestScenePlayfield.cs index c7dc5fc8b5..62dadbc3dd 100644 --- a/osu.Game.Rulesets.Mania.Tests/Skinning/TestScenePlayfield.cs +++ b/osu.Game.Rulesets.Mania.Tests/Skinning/TestScenePlayfield.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneStage.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneStage.cs index 7804261906..f3f1b9416f 100644 --- a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneStage.cs +++ b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneStage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.UI; diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneStageBackground.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneStageBackground.cs index 410a43fc73..687b3a747d 100644 --- a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneStageBackground.cs +++ b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneStageBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Rulesets.Mania.Beatmaps; diff --git a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneStageForeground.cs b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneStageForeground.cs index 27e97152bc..6cbc172755 100644 --- a/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneStageForeground.cs +++ b/osu.Game.Rulesets.Mania.Tests/Skinning/TestSceneStageForeground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Rulesets.Mania.Beatmaps; diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneAutoGeneration.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneAutoGeneration.cs index cffec3dfd5..21ec85bbe6 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestSceneAutoGeneration.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestSceneAutoGeneration.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneColumn.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneColumn.cs index d9b1ad22fa..2922d18713 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestSceneColumn.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestSceneColumn.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneDrawableManiaHitObject.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneDrawableManiaHitObject.cs index 92c95b8fde..223f8dae44 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestSceneDrawableManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestSceneDrawableManiaHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Input.Events; diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs index f973cb5ed3..8f776ff507 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneManiaHitObjectSamples.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneManiaHitObjectSamples.cs index ea57e51d1c..00f0fcefd9 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestSceneManiaHitObjectSamples.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestSceneManiaHitObjectSamples.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Reflection; using NUnit.Framework; using osu.Framework.IO.Stores; diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneManiaPlayer.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneManiaPlayer.cs index a399b90585..9abedc22f9 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestSceneManiaPlayer.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestSceneManiaPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Mania.Tests diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneNotes.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneNotes.cs index 706268e478..df831d8c9f 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestSceneNotes.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestSceneNotes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneOutOfOrderHits.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneOutOfOrderHits.cs index 89e13acad6..a563dc3106 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestSceneOutOfOrderHits.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestSceneOutOfOrderHits.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Mania.Tests/TestScenePlayfieldCoveringContainer.cs b/osu.Game.Rulesets.Mania.Tests/TestScenePlayfieldCoveringContainer.cs index 8698ba3abd..64e7eafb1b 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestScenePlayfieldCoveringContainer.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestScenePlayfieldCoveringContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneStage.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneStage.cs index 7376a90f17..cf8947c1ed 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestSceneStage.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestSceneStage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneTimingBasedNoteColouring.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneTimingBasedNoteColouring.cs index 4c688520ef..e84d02775a 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestSceneTimingBasedNoteColouring.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestSceneTimingBasedNoteColouring.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ColumnType.cs b/osu.Game.Rulesets.Mania/Beatmaps/ColumnType.cs index 8f904530bc..0114987e3c 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ColumnType.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ColumnType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mania.Beatmaps { public enum ColumnType diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs index 0058f6f884..4879ce6748 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 207c6907c8..2b4f497785 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mania.Objects; using System; using System.Linq; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index dafe65f415..2bdd0e16ad 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index 2265d3d347..630fdf7ae2 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index 41d4c9322b..912cac4fe4 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs index d5689c047a..308238d87a 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternType.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternType.cs index e4a28167ec..bf54dc3179 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternType.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Pattern.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Pattern.cs index 828f2ec393..4b3902657f 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Pattern.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Pattern.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Rulesets.Mania.Objects; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs index 71b3f6ecf2..b2e89c3410 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/StageDefinition.cs b/osu.Game.Rulesets.Mania/Beatmaps/StageDefinition.cs index 3052fc7d34..54e2d4686f 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/StageDefinition.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/StageDefinition.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Rulesets.Mania.UI; diff --git a/osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs b/osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs index 8e09a01469..35ad21442e 100644 --- a/osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs +++ b/osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Configuration.Tracking; using osu.Game.Configuration; diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs index c35a3dcdc2..8a5161be79 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Rulesets.Difficulty; diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs index e90feaf4b4..8002410f70 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceAttributes.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceAttributes.cs index 17c864a268..f5abb465c4 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceAttributes.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceAttributes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Rulesets.Difficulty; diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs index b347cc9ae2..eb58eb7f21 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs b/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs index 1c4204145b..df95654319 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Mania.Objects; diff --git a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs index 626f1bebbd..c2e532430c 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Utils; using osu.Game.Rulesets.Difficulty.Preprocessing; diff --git a/osu.Game.Rulesets.Mania/DualStageVariantGenerator.cs b/osu.Game.Rulesets.Mania/DualStageVariantGenerator.cs index 8d39e08b26..262247e244 100644 --- a/osu.Game.Rulesets.Mania/DualStageVariantGenerator.cs +++ b/osu.Game.Rulesets.Mania/DualStageVariantGenerator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Input.Bindings; diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditBodyPiece.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditBodyPiece.cs index f5067ea366..52995b73f4 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditBodyPiece.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditBodyPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics; diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs index 9c9273de3a..23475ef924 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs index 093a8da24f..7c720b30aa 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs index 35889aea0c..f76f170af0 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs index 7a99565e8a..7c7c802111 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs index 955336db57..5aa3b44f0d 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/NotePlacementBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/NotePlacementBlueprint.cs index 3db89c8ae6..e3cb830b80 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/NotePlacementBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/NotePlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs index e7a03905d2..929fdc29e0 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Rulesets.Mania.Edit.Blueprints.Components; using osu.Game.Rulesets.Mania.Objects; diff --git a/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs b/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs index b0af8c503b..a3a9591964 100644 --- a/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs +++ b/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Graphics; using osuTK; diff --git a/osu.Game.Rulesets.Mania/Edit/HoldNoteCompositionTool.cs b/osu.Game.Rulesets.Mania/Edit/HoldNoteCompositionTool.cs index a5f10ed436..960a08eeeb 100644 --- a/osu.Game.Rulesets.Mania/Edit/HoldNoteCompositionTool.cs +++ b/osu.Game.Rulesets.Mania/Edit/HoldNoteCompositionTool.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaBeatSnapGrid.cs b/osu.Game.Rulesets.Mania/Edit/ManiaBeatSnapGrid.cs index 1aa20f4737..b0019d8b6e 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaBeatSnapGrid.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaBeatSnapGrid.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaBlueprintContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaBlueprintContainer.cs index c5a109a6d1..ad75afff8e 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaBlueprintContainer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaBlueprintContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Edit.Blueprints; using osu.Game.Rulesets.Mania.Objects; diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditorPlayfield.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditorPlayfield.cs index 186d50716e..6683ab6bdc 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditorPlayfield.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditorPlayfield.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.UI; using System.Collections.Generic; diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index c389e1bced..3585fd4e8c 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaSelectionHandler.cs b/osu.Game.Rulesets.Mania/Edit/ManiaSelectionHandler.cs index 9fe1eb7932..7b9742a706 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaSelectionHandler.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaSelectionHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Mania/Edit/NoteCompositionTool.cs b/osu.Game.Rulesets.Mania/Edit/NoteCompositionTool.cs index 9f54152596..179f920c2f 100644 --- a/osu.Game.Rulesets.Mania/Edit/NoteCompositionTool.cs +++ b/osu.Game.Rulesets.Mania/Edit/NoteCompositionTool.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Mania/Edit/Setup/ManiaSetupSection.cs b/osu.Game.Rulesets.Mania/Edit/Setup/ManiaSetupSection.cs index a206aafb8a..b602a67baa 100644 --- a/osu.Game.Rulesets.Mania/Edit/Setup/ManiaSetupSection.cs +++ b/osu.Game.Rulesets.Mania/Edit/Setup/ManiaSetupSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterfaceV2; diff --git a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs index ee6cbbc828..4b94198c4d 100644 --- a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mania.Judgements diff --git a/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs index d28b7bdf58..32f9689d7e 100644 --- a/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs b/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs index c8832dfdfb..58aef4dbf8 100644 --- a/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs +++ b/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Rulesets.Filter; using osu.Game.Rulesets.Mania.Beatmaps; diff --git a/osu.Game.Rulesets.Mania/ManiaInputManager.cs b/osu.Game.Rulesets.Mania/ManiaInputManager.cs index 14ca27a11a..e8e90d198a 100644 --- a/osu.Game.Rulesets.Mania/ManiaInputManager.cs +++ b/osu.Game.Rulesets.Mania/ManiaInputManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Allocation; using osu.Framework.Input.Bindings; diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index bd6a67bf67..98a492450e 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Mods; diff --git a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs index bd3b8c3b10..43d4aa77a2 100644 --- a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs +++ b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game.Rulesets.Mania/ManiaSkinComponent.cs b/osu.Game.Rulesets.Mania/ManiaSkinComponent.cs index 9aebf51576..b709f85523 100644 --- a/osu.Game.Rulesets.Mania/ManiaSkinComponent.cs +++ b/osu.Game.Rulesets.Mania/ManiaSkinComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.UI; using osu.Game.Skinning; diff --git a/osu.Game.Rulesets.Mania/MathUtils/LegacySortHelper.cs b/osu.Game.Rulesets.Mania/MathUtils/LegacySortHelper.cs index 5c595323c3..1a67117c03 100644 --- a/osu.Game.Rulesets.Mania/MathUtils/LegacySortHelper.cs +++ b/osu.Game.Rulesets.Mania/MathUtils/LegacySortHelper.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.Contracts; diff --git a/osu.Game.Rulesets.Mania/Mods/IPlayfieldTypeMod.cs b/osu.Game.Rulesets.Mania/Mods/IPlayfieldTypeMod.cs index 410386c9d5..0bae893810 100644 --- a/osu.Game.Rulesets.Mania/Mods/IPlayfieldTypeMod.cs +++ b/osu.Game.Rulesets.Mania/Mods/IPlayfieldTypeMod.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Mods diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs b/osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs index 050b302bd8..8f8b7cb091 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModAutoplay.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModAutoplay.cs index d444c9b634..f9c51bf6a2 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModAutoplay.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModAutoplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModCinema.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModCinema.cs index f0db742eac..8d54923e7b 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModCinema.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModCinema.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModClassic.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModClassic.cs index 073dda9de8..603d096ed7 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModClassic.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModClassic.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Mods diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModConstantSpeed.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModConstantSpeed.cs index 614ef76a3b..20dfc14f09 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModConstantSpeed.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModConstantSpeed.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; using osu.Game.Rulesets.Mania.Objects; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModDaycore.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModDaycore.cs index bec0a6a1d3..b166f3ebc3 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModDaycore.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModDaycore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Mods diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModDifficultyAdjust.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModDifficultyAdjust.cs index 0817f8f9fc..d053e64315 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModDifficultyAdjust.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModDifficultyAdjust.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Mods diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModDoubleTime.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModDoubleTime.cs index a302f95966..66627e6ed3 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModDoubleTime.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModDoubleTime.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Mods diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs index c78bf72979..f25a77278b 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModEasy.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModEasy.cs index 4093aeb2a7..ff236d33bf 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModEasy.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModEasy.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Mods diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFadeIn.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFadeIn.cs index f80c9e1f7c..ddbd7c5d6a 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFadeIn.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFadeIn.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Game.Rulesets.Mania.UI; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs index 8ef5bfd94c..58005df561 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModHalfTime.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModHalfTime.cs index 014954dd60..87c81c2866 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModHalfTime.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModHalfTime.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Mods diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModHardRock.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModHardRock.cs index d9de06a811..380edca515 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModHardRock.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModHardRock.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Mods diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModHidden.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModHidden.cs index e3ac624a6e..698555ddc4 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModHidden.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModHidden.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Game.Rulesets.Mania.UI; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs index a65938184c..8c4fd0a8fc 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModInvert.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModInvert.cs index 4cbdaee323..f202b859b1 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModInvert.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModInvert.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModKey1.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModKey1.cs index 948979505c..9ce4fb6a48 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModKey1.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModKey1.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mania.Mods { public class ManiaModKey1 : ManiaKeyMod diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModKey10.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModKey10.cs index 684370fc3d..f378ce3435 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModKey10.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModKey10.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mania.Mods { public class ManiaModKey10 : ManiaKeyMod diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModKey2.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModKey2.cs index de91902ca8..5812df80f5 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModKey2.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModKey2.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mania.Mods { public class ManiaModKey2 : ManiaKeyMod diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModKey3.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModKey3.cs index 8575a96bde..4116ed5ceb 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModKey3.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModKey3.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mania.Mods { public class ManiaModKey3 : ManiaKeyMod diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModKey4.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModKey4.cs index 54ea3afa07..9879fec686 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModKey4.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModKey4.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mania.Mods { public class ManiaModKey4 : ManiaKeyMod diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModKey5.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModKey5.cs index e9a9bba5bd..646386b0d8 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModKey5.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModKey5.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mania.Mods { public class ManiaModKey5 : ManiaKeyMod diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModKey6.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModKey6.cs index b9606d1cb5..56af9ed589 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModKey6.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModKey6.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mania.Mods { public class ManiaModKey6 : ManiaKeyMod diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModKey7.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModKey7.cs index b80d794085..a0a7116ed7 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModKey7.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModKey7.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mania.Mods { public class ManiaModKey7 : ManiaKeyMod diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModKey8.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModKey8.cs index 3462d634a4..fc8ecdb9ea 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModKey8.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModKey8.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mania.Mods { public class ManiaModKey8 : ManiaKeyMod diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModKey9.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModKey9.cs index 83c505c048..c495a6c82f 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModKey9.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModKey9.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mania.Mods { public class ManiaModKey9 : ManiaKeyMod diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs index 9c3744ea98..6e56981fc8 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.IEnumerableExtensions; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModMuted.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModMuted.cs index 33ebcf303a..076f634968 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModMuted.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModMuted.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModNightcore.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModNightcore.cs index 4cc712060c..9ae664e1f6 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModNightcore.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModNightcore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModNoFail.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModNoFail.cs index e8988be548..487f32dc26 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModNoFail.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModNoFail.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Mods diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs index 2e22e23dbd..2789a2a06e 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Mods diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModPlayfieldCover.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModPlayfieldCover.cs index 3c24e91d54..5da29e5a1d 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModPlayfieldCover.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModPlayfieldCover.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs index f5d1a34d73..c7c7a6003e 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModSuddenDeath.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModSuddenDeath.cs index ecc343ecaa..17759d718e 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModSuddenDeath.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModSuddenDeath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Mods diff --git a/osu.Game.Rulesets.Mania/Objects/BarLine.cs b/osu.Game.Rulesets.Mania/Objects/BarLine.cs index 09a746042b..3f04a4fafe 100644 --- a/osu.Game.Rulesets.Mania/Objects/BarLine.cs +++ b/osu.Game.Rulesets.Mania/Objects/BarLine.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs index 074cbf6bd6..0e2d6bce21 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osuTK; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index 4e9781f336..19792086a7 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteHead.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteHead.cs index 6722ad8ab8..d374e935ec 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteHead.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteHead.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Game.Rulesets.Objects.Drawables; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTail.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTail.cs index 803685363c..a7bdcd047e 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTail.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTail.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using osu.Framework.Graphics; using osu.Framework.Input.Events; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs index cffa79322e..daec5ddbe7 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs index 9ac223a0d7..bcc10ab7bc 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index 51727908c9..3c8b1b53b7 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Mania/Objects/HeadNote.cs b/osu.Game.Rulesets.Mania/Objects/HeadNote.cs index e69cc62aed..fb5c7b4ddd 100644 --- a/osu.Game.Rulesets.Mania/Objects/HeadNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HeadNote.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mania.Objects { public class HeadNote : Note diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index db0d3e2c5a..22fab15c1b 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Threading; using osu.Game.Audio; diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs index ac6697a6dc..9117c60dcd 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs index 6289744df1..0efaeac026 100644 --- a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Rulesets.Mania.Scoring; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Rulesets.Mania/Objects/Note.cs b/osu.Game.Rulesets.Mania/Objects/Note.cs index 0035960c63..578b46a7aa 100644 --- a/osu.Game.Rulesets.Mania/Objects/Note.cs +++ b/osu.Game.Rulesets.Mania/Objects/Note.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Judgements; diff --git a/osu.Game.Rulesets.Mania/Objects/TailNote.cs b/osu.Game.Rulesets.Mania/Objects/TailNote.cs index 5a30fd6a12..cda8e2fa31 100644 --- a/osu.Game.Rulesets.Mania/Objects/TailNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/TailNote.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Judgements; diff --git a/osu.Game.Rulesets.Mania/Properties/AssemblyInfo.cs b/osu.Game.Rulesets.Mania/Properties/AssemblyInfo.cs index ca1f7036c7..1bc20f7ef3 100644 --- a/osu.Game.Rulesets.Mania/Properties/AssemblyInfo.cs +++ b/osu.Game.Rulesets.Mania/Properties/AssemblyInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Runtime.CompilerServices; // We publish our internal attributes to other sub-projects of the framework. diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs index efe144ac03..3814ad84f1 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Rulesets.Mania.Beatmaps; diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs b/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs index aa164f95da..c786e1db61 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Input.StateChanges; diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs index dbab54d1d0..66edc87992 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaHealthProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaHealthProcessor.cs index 57c2ba9c6d..3f0491e53f 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaHealthProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaHealthProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaHitWindows.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaHitWindows.cs index 289f8a00ef..c46a1b5ab6 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaHitWindows.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaHitWindows.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mania.Scoring diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 02d62a090b..dbf3d02955 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mania.Scoring diff --git a/osu.Game.Rulesets.Mania/SingleStageVariantGenerator.cs b/osu.Game.Rulesets.Mania/SingleStageVariantGenerator.cs index 2069329d9a..765fd11dd5 100644 --- a/osu.Game.Rulesets.Mania/SingleStageVariantGenerator.cs +++ b/osu.Game.Rulesets.Mania/SingleStageVariantGenerator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Input.Bindings; diff --git a/osu.Game.Rulesets.Mania/Skinning/Default/DefaultBodyPiece.cs b/osu.Game.Rulesets.Mania/Skinning/Default/DefaultBodyPiece.cs index 7138421b91..7476af3c3c 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Default/DefaultBodyPiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Default/DefaultBodyPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Mania/Skinning/Default/DefaultNotePiece.cs b/osu.Game.Rulesets.Mania/Skinning/Default/DefaultNotePiece.cs index c9c3cff799..72bb05de49 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Default/DefaultNotePiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Default/DefaultNotePiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Mania/Skinning/Default/IHoldNoteBody.cs b/osu.Game.Rulesets.Mania/Skinning/Default/IHoldNoteBody.cs index 1f290f1f1c..9168a96b95 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Default/IHoldNoteBody.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Default/IHoldNoteBody.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mania.Skinning.Default { /// diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/HitTargetInsetContainer.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/HitTargetInsetContainer.cs index 3c89e2c04a..362a265789 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/HitTargetInsetContainer.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/HitTargetInsetContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyBodyPiece.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyBodyPiece.cs index 31db08ce2f..4e6493ba18 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyBodyPiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyBodyPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyColumnBackground.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyColumnBackground.cs index 54ddcbd5fe..f35cedab08 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyColumnBackground.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyColumnBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHitExplosion.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHitExplosion.cs index e4d466dca5..278cf0707c 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHitExplosion.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHitExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHitTarget.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHitTarget.cs index 490a03d11a..611dac30b3 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHitTarget.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHitTarget.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteHeadPiece.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteHeadPiece.cs index 1e75533442..a653e2ce36 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteHeadPiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteHeadPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Skinning; diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteTailPiece.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteTailPiece.cs index e6d4291d79..7511b008f0 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteTailPiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteTailPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Rulesets.UI.Scrolling; diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyKeyArea.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyKeyArea.cs index 9c339345c4..dfd5af89c1 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyKeyArea.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyKeyArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaColumnElement.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaColumnElement.cs index eb5514ba43..ab953ccfb9 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaColumnElement.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaColumnElement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs index 5d662c18d3..d09a73a693 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Animations; diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs index 321a87f8b1..f185c8b99d 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyStageBackground.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyStageBackground.cs index fdacc75c92..740ccbfe27 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyStageBackground.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyStageBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyStageForeground.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyStageForeground.cs index 4e1952a670..f7c611d551 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyStageForeground.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyStageForeground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/ManiaLegacySkinTransformer.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/ManiaLegacySkinTransformer.cs index 315b4444c2..dd5baa8150 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/ManiaLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/ManiaLegacySkinTransformer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game.Rulesets.Mania/Skinning/ManiaSkinConfigExtensions.cs b/osu.Game.Rulesets.Mania/Skinning/ManiaSkinConfigExtensions.cs index 2e17a6bef1..4d0c321116 100644 --- a/osu.Game.Rulesets.Mania/Skinning/ManiaSkinConfigExtensions.cs +++ b/osu.Game.Rulesets.Mania/Skinning/ManiaSkinConfigExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Skinning; diff --git a/osu.Game.Rulesets.Mania/Skinning/ManiaSkinConfigurationLookup.cs b/osu.Game.Rulesets.Mania/Skinning/ManiaSkinConfigurationLookup.cs index f07a5518b7..e9005a3da0 100644 --- a/osu.Game.Rulesets.Mania/Skinning/ManiaSkinConfigurationLookup.cs +++ b/osu.Game.Rulesets.Mania/Skinning/ManiaSkinConfigurationLookup.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mania.UI; using osu.Game.Skinning; diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index a04f5ef98e..deb1b155b5 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Mania/UI/ColumnFlow.cs b/osu.Game.Rulesets.Mania/UI/ColumnFlow.cs index aef82d4c08..871ec9f1a3 100644 --- a/osu.Game.Rulesets.Mania/UI/ColumnFlow.cs +++ b/osu.Game.Rulesets.Mania/UI/ColumnFlow.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs index 77ddc6fbbf..5bd2d3ab48 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs index 51c138f5e1..b26b62f8a5 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.UI; diff --git a/osu.Game.Rulesets.Mania/UI/Components/DefaultColumnBackground.cs b/osu.Game.Rulesets.Mania/UI/Components/DefaultColumnBackground.cs index 807f6a77d9..39d17db6be 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/DefaultColumnBackground.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/DefaultColumnBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game.Rulesets.Mania/UI/Components/DefaultHitTarget.cs b/osu.Game.Rulesets.Mania/UI/Components/DefaultHitTarget.cs index ec6c377a2e..53fa86125f 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/DefaultHitTarget.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/DefaultHitTarget.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game.Rulesets.Mania/UI/Components/DefaultKeyArea.cs b/osu.Game.Rulesets.Mania/UI/Components/DefaultKeyArea.cs index 15018b464f..5a0fab2ff4 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/DefaultKeyArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/DefaultKeyArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game.Rulesets.Mania/UI/Components/DefaultStageBackground.cs b/osu.Game.Rulesets.Mania/UI/Components/DefaultStageBackground.cs index f5b542d085..20d80580bf 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/DefaultStageBackground.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/DefaultStageBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Mania/UI/Components/HitObjectArea.cs b/osu.Game.Rulesets.Mania/UI/Components/HitObjectArea.cs index b75b586ecf..7f4b8eacde 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/HitObjectArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/HitObjectArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Mania/UI/DefaultHitExplosion.cs b/osu.Game.Rulesets.Mania/UI/DefaultHitExplosion.cs index 562d7b04c4..e83cd10d2d 100644 --- a/osu.Game.Rulesets.Mania/UI/DefaultHitExplosion.cs +++ b/osu.Game.Rulesets.Mania/UI/DefaultHitExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs index 8581f016b1..923fc6863c 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs index 28e970f397..ea3b438ec8 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Mania/UI/IHitExplosion.cs b/osu.Game.Rulesets.Mania/UI/IHitExplosion.cs index 3252dcc276..74ddceeeef 100644 --- a/osu.Game.Rulesets.Mania/UI/IHitExplosion.cs +++ b/osu.Game.Rulesets.Mania/UI/IHitExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; namespace osu.Game.Rulesets.Mania.UI diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 4cd6624ac6..99b36bd366 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System; diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfieldAdjustmentContainer.cs index 30e0aafb7d..8020fcb3cc 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfieldAdjustmentContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfieldAdjustmentContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Rulesets.UI; diff --git a/osu.Game.Rulesets.Mania/UI/ManiaReplayRecorder.cs b/osu.Game.Rulesets.Mania/UI/ManiaReplayRecorder.cs index b502d1f9e5..87d6c25ac2 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaReplayRecorder.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaReplayRecorder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Mania.Replays; using osu.Game.Rulesets.Replays; diff --git a/osu.Game.Rulesets.Mania/UI/ManiaScrollingDirection.cs b/osu.Game.Rulesets.Mania/UI/ManiaScrollingDirection.cs index 98165fedeb..44fe4b1b30 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaScrollingDirection.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaScrollingDirection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.UI.Scrolling; namespace osu.Game.Rulesets.Mania.UI diff --git a/osu.Game.Rulesets.Mania/UI/OrderedHitPolicy.cs b/osu.Game.Rulesets.Mania/UI/OrderedHitPolicy.cs index 961858b62b..c39e21bace 100644 --- a/osu.Game.Rulesets.Mania/UI/OrderedHitPolicy.cs +++ b/osu.Game.Rulesets.Mania/UI/OrderedHitPolicy.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Game.Rulesets.Mania.Objects.Drawables; diff --git a/osu.Game.Rulesets.Mania/UI/PlayfieldCoveringWrapper.cs b/osu.Game.Rulesets.Mania/UI/PlayfieldCoveringWrapper.cs index 15d216e8c5..d397e7cc18 100644 --- a/osu.Game.Rulesets.Mania/UI/PlayfieldCoveringWrapper.cs +++ b/osu.Game.Rulesets.Mania/UI/PlayfieldCoveringWrapper.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game.Rulesets.Mania/UI/PoolableHitExplosion.cs b/osu.Game.Rulesets.Mania/UI/PoolableHitExplosion.cs index 9f4963b022..28509d1f4e 100644 --- a/osu.Game.Rulesets.Mania/UI/PoolableHitExplosion.cs +++ b/osu.Game.Rulesets.Mania/UI/PoolableHitExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Pooling; diff --git a/osu.Game.Rulesets.Mania/UI/Stage.cs b/osu.Game.Rulesets.Mania/UI/Stage.cs index 94910bb410..c578bbb703 100644 --- a/osu.Game.Rulesets.Mania/UI/Stage.cs +++ b/osu.Game.Rulesets.Mania/UI/Stage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Mania/VariantMappingGenerator.cs b/osu.Game.Rulesets.Mania/VariantMappingGenerator.cs index 878d1088a6..2742ee087b 100644 --- a/osu.Game.Rulesets.Mania/VariantMappingGenerator.cs +++ b/osu.Game.Rulesets.Mania/VariantMappingGenerator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Input.Bindings; diff --git a/osu.Game.Rulesets.Osu.Tests.Android/MainActivity.cs b/osu.Game.Rulesets.Osu.Tests.Android/MainActivity.cs index 46c60f06a5..9b4226d5b6 100644 --- a/osu.Game.Rulesets.Osu.Tests.Android/MainActivity.cs +++ b/osu.Game.Rulesets.Osu.Tests.Android/MainActivity.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Android.App; using osu.Framework.Android; using osu.Game.Tests; diff --git a/osu.Game.Rulesets.Osu.Tests.iOS/AppDelegate.cs b/osu.Game.Rulesets.Osu.Tests.iOS/AppDelegate.cs index 01e635f09c..fa40a8536e 100644 --- a/osu.Game.Rulesets.Osu.Tests.iOS/AppDelegate.cs +++ b/osu.Game.Rulesets.Osu.Tests.iOS/AppDelegate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Foundation; using osu.Framework.iOS; using osu.Game.Tests; diff --git a/osu.Game.Rulesets.Osu.Tests.iOS/Application.cs b/osu.Game.Rulesets.Osu.Tests.iOS/Application.cs index be38a883d7..ad23f3ee33 100644 --- a/osu.Game.Rulesets.Osu.Tests.iOS/Application.cs +++ b/osu.Game.Rulesets.Osu.Tests.iOS/Application.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.iOS; using UIKit; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckLowDiffOverlapsTest.cs b/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckLowDiffOverlapsTest.cs index fd17d11d10..7a361b0821 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckLowDiffOverlapsTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckLowDiffOverlapsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using Moq; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckOffscreenObjectsTest.cs b/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckOffscreenObjectsTest.cs index a6873c6de9..a778b76c67 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckOffscreenObjectsTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckOffscreenObjectsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckTimeDistanceEqualityTest.cs b/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckTimeDistanceEqualityTest.cs index 49a6fd12fa..4e8be75779 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckTimeDistanceEqualityTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckTimeDistanceEqualityTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using Moq; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckTooShortSlidersTest.cs b/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckTooShortSlidersTest.cs index 2eab5a4ce6..39a9d5e798 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckTooShortSlidersTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckTooShortSlidersTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckTooShortSpinnersTest.cs b/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckTooShortSpinnersTest.cs index 1f3d4297f1..d044ae732a 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckTooShortSpinnersTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/Checks/CheckTooShortSpinnersTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCirclePlacementBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCirclePlacementBlueprint.cs index 7bccec6c97..4d84d3e79f 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCirclePlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCirclePlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCircleSelectionBlueprint.cs index 315493318d..fde62c7a53 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCircleSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCircleSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectBeatSnap.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectBeatSnap.cs index a652fb32f4..a8829ef88c 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectBeatSnap.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectBeatSnap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs index 7bdf131e0d..6e8c7ff2bd 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs index c50aec40a5..e54ce45ccc 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditor.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditor.cs index e1ca3ddd61..859290dbec 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditor.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditorGrids.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditorGrids.cs index 47b2d3a098..1e73885540 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditorGrids.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditorGrids.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditorSelectInvalidPath.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditorSelectInvalidPath.cs index d0348c1b6b..536739bd48 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditorSelectInvalidPath.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditorSelectInvalidPath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestScenePathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestScenePathControlPointVisualiser.cs index 5a1aa42ed1..f196353f87 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestScenePathControlPointVisualiser.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestScenePathControlPointVisualiser.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderControlPointPiece.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderControlPointPiece.cs index e7bcd2cadc..a177079b8c 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderControlPointPiece.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderControlPointPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using Humanizer; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderLengthValidity.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderLengthValidity.cs index ce529f2a88..31b593e816 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderLengthValidity.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderLengthValidity.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderPlacementBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderPlacementBlueprint.cs index e724015905..5c3c537541 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Utils; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSelectionBlueprint.cs index cc43eb3852..f84204f01c 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Utils; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs index b43b2b1461..a72f2031c9 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Input.Events; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderStreamConversion.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderStreamConversion.cs index 70a9c03e65..51871dd9e5 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderStreamConversion.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderStreamConversion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Utils; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderVelocityAdjust.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderVelocityAdjust.cs index 4750c97566..3d9fe37e0f 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderVelocityAdjust.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderVelocityAdjust.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerPlacementBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerPlacementBlueprint.cs index fa6c660b01..53ef675cb3 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerSelectionBlueprint.cs index 5007841805..a1b946dd4c 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSliderScaling.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSliderScaling.cs index e29a67c770..efe195d872 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSliderScaling.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSliderScaling.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs b/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs index d8c10b814d..2c4310202e 100644 --- a/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/OsuModTestScene.cs b/osu.Game.Rulesets.Osu.Tests/Mods/OsuModTestScene.cs index d3cb3bcf59..4f005a0c70 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/OsuModTestScene.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/OsuModTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Osu.Tests.Mods diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAlternate.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAlternate.cs index 5e46498aca..3d59e4fb51 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAlternate.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAlternate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAutoplay.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAutoplay.cs index 37f1a846ad..378b71ccf7 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAutoplay.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAutoplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModDifficultyAdjust.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModDifficultyAdjust.cs index 9d06ff5801..80dc83d7dc 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModDifficultyAdjust.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModDifficultyAdjust.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModDoubleTime.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModDoubleTime.cs index 335ef31019..e1bed5153b 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModDoubleTime.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModDoubleTime.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Utils; using osu.Game.Rulesets.Osu.Mods; diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModHidden.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModHidden.cs index 71b575abe2..5ed25baca3 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModHidden.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModHidden.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs index 9b49e60363..1f1db04c24 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMagnetised.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Osu.Mods; diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMuted.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMuted.cs index e08d66fa31..99c9036ac0 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMuted.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModMuted.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModNoScope.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModNoScope.cs index 44404ca245..47e7ad320c 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModNoScope.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModNoScope.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModPerfect.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModPerfect.cs index 985baa8cf5..b7669624ff 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModPerfect.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModPerfect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSpunOut.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSpunOut.cs index a8953c1a6f..fe8bba3ed8 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSpunOut.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSpunOut.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs index 4c11efcc7c..bee46da1ba 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs index df577ea8d3..bb593c2fb3 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; diff --git a/osu.Game.Rulesets.Osu.Tests/OsuLegacyModConversionTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuLegacyModConversionTest.cs index 51da5b85cd..db9872b152 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuLegacyModConversionTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuLegacyModConversionTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Game.Beatmaps.Legacy; diff --git a/osu.Game.Rulesets.Osu.Tests/OsuSkinnableTestScene.cs b/osu.Game.Rulesets.Osu.Tests/OsuSkinnableTestScene.cs index 233aaf2ed9..415e4ebedd 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuSkinnableTestScene.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuSkinnableTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Osu.Tests/StackingTest.cs b/osu.Game.Rulesets.Osu.Tests/StackingTest.cs index 871afdb09d..a2ab7b564c 100644 --- a/osu.Game.Rulesets.Osu.Tests/StackingTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/StackingTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game.Rulesets.Osu.Tests/TestPlayfieldBorder.cs b/osu.Game.Rulesets.Osu.Tests/TestPlayfieldBorder.cs index 23d9d265be..106a7f499f 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestPlayfieldBorder.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestPlayfieldBorder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneAccuracyHeatmap.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneAccuracyHeatmap.cs index 79150a1941..805f4e6567 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneAccuracyHeatmap.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneAccuracyHeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneCursorParticles.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneCursorParticles.cs index bd39dead34..b5d1c4854c 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneCursorParticles.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneCursorParticles.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneCursorTrail.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneCursorTrail.cs index 211b0e8145..c8d2d07be5 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneCursorTrail.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneCursorTrail.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneDrawableJudgement.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneDrawableJudgement.cs index 7821ae9cf0..cfa1841fb7 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneDrawableJudgement.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneDrawableJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneFollowPoints.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneFollowPoints.cs index fe67b63252..305678bb62 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneFollowPoints.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneFollowPoints.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs index 496d495b43..2edacee9ac 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircle.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircle.cs index f6e8a771ed..cc69054e23 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircle.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleApplication.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleApplication.cs index 8b3fead366..0bc65ac8e6 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleApplication.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleApplication.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Timing; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleArea.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleArea.cs index 07bbd6379a..0cf2ec6b7e 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleArea.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleComboChange.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleComboChange.cs index ff600172d2..85951a95a2 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleComboChange.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleComboChange.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleHidden.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleHidden.cs index 45125204b6..a469f3dd99 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleHidden.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleHidden.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Osu.Mods; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleKiai.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleKiai.cs index 2bce8fa7f2..e694871408 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleKiai.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleKiai.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLongCombo.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLongCombo.cs index 4e17c4c363..bcf2449e32 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLongCombo.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLongCombo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs index 8b51225e98..1767d25e77 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneMissHitWindowJudgements.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneMissHitWindowJudgements.cs index a9325f98f7..0c6afe6c3d 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneMissHitWindowJudgements.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneMissHitWindowJudgements.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneNoSpinnerStacking.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneNoSpinnerStacking.cs index 5e92bac986..9e524a1608 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneNoSpinnerStacking.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneNoSpinnerStacking.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneObjectOrderedHitPolicy.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneObjectOrderedHitPolicy.cs index d31e7a31f5..1665c40b40 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneObjectOrderedHitPolicy.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneObjectOrderedHitPolicy.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuFlashlight.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuFlashlight.cs index 19736a7709..e0d1646cb0 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuFlashlight.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuFlashlight.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuHitObjectSamples.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuHitObjectSamples.cs index e8d98ce3b8..3bc55278d9 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuHitObjectSamples.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuHitObjectSamples.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Reflection; using NUnit.Framework; using osu.Framework.IO.Stores; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuPlayer.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuPlayer.cs index f5b28b36c0..6f378fc8b4 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuPlayer.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneResumeOverlay.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneResumeOverlay.cs index a7967c407a..e0d33c0e09 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneResumeOverlay.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneResumeOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneShaking.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneShaking.cs index 43900c9a5c..dd767bf5e0 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneShaking.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneShaking.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Diagnostics; using osu.Framework.Threading; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSkinFallbacks.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSkinFallbacks.cs index 0f362851a9..dd110662b2 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSkinFallbacks.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSkinFallbacks.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSlider.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSlider.cs index 03b4254eed..a9ee276a9e 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSlider.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSlider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Graphics; using osu.Game.Audio; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderApplication.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderApplication.cs index a40ae611d8..2981f1164d 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderApplication.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderApplication.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderComboChange.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderComboChange.cs index 13ced3019e..b48789a709 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderComboChange.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderComboChange.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderHidden.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderHidden.cs index b2bd727c6a..f70bdf8aa2 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderHidden.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderHidden.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Osu.Mods; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs index 2368cc7365..e3cf5e9b05 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs index a3aa84d0e7..be2e9c7cb5 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs index 2dea9837f3..8dc8f82b86 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerApplication.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerApplication.cs index 8c97c02049..14fa77245a 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerApplication.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerApplication.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Timing; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerHidden.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerHidden.cs index 91b6a05fe3..b7bc36722a 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerHidden.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerHidden.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Osu.Mods; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs index de795241bf..d1796f2231 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneStartTimeOrderedHitPolicy.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneStartTimeOrderedHitPolicy.cs index 53fa3624b8..96b26403e1 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneStartTimeOrderedHitPolicy.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneStartTimeOrderedHitPolicy.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs index a5282877ee..df146a9511 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs index d82186fb52..e9518895be 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs index f51f04bf87..da66669550 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs index 9589fd576f..b8ad61e6dd 100644 --- a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs +++ b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Configuration; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.UI; diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs index 6906c8af86..0694746cbf 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/AimEvaluator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs index 619560f0b3..3b0826394c 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/FlashlightEvaluator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs index 345789b99d..3ffd45b588 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs index 85203dd157..4b1e12d5c6 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Utils; using osu.Game.Rulesets.Difficulty.Preprocessing; diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs index 3deed4ea3d..19217015c1 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 0fa69c180a..3b5aaa8116 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceAttributes.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceAttributes.cs index 0aeaf7669f..efb3ade220 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceAttributes.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceAttributes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Rulesets.Difficulty; diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs index d046be9ccb..548a2b8f8a 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 20921dd282..c8646ec456 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Game.Rulesets.Difficulty.Preprocessing; diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index df6a5e3d00..9b1fbf9a2e 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 590ab6ea61..14d13ec785 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Game.Rulesets.Difficulty.Preprocessing; diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/OsuStrainSkill.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/OsuStrainSkill.cs index dcd2c7d321..94b5727e3f 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/OsuStrainSkill.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/OsuStrainSkill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Game.Rulesets.Difficulty.Skills; diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index 055e1cb66e..695bb2f8d0 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/BlueprintPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/BlueprintPiece.cs index b9c77d3f56..55b7efc8af 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/BlueprintPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/BlueprintPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs index ad4be2017e..71cdbc276e 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCircleOverlapMarker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs index 0cfc67cedb..984fbb83a8 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs index c45a04053f..ff4f61986f 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs index 3f9cfe21d4..73756d9326 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs index 2d0c6fe81d..422287918e 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointConnectionPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointConnectionPiece.cs index d66c9ea4bf..0b9ccc5c37 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointConnectionPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointConnectionPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs index 09759aa118..92d83d900e 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs index e71bde7357..0506e8ab8a 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs index 6e22c35ab3..bb967a0a76 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Game.Graphics; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs index d31d2aed97..d48d43d532 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs index 501589987d..139bfe7dd3 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPosition.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPosition.cs index 616bb17e05..92071d4a57 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPosition.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPosition.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders { public enum SliderPosition diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs index a019f2fb64..bd11cc826f 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs index 92961b40bc..28690ee0b7 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs index cc4ed0eccf..97d53d8e95 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Input.Events; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs index ee573d1a01..5240c0bfeb 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components; using osu.Game.Rulesets.Osu.Objects; using osuTK; diff --git a/osu.Game.Rulesets.Osu/Edit/Checks/CheckLowDiffOverlaps.cs b/osu.Game.Rulesets.Osu/Edit/Checks/CheckLowDiffOverlaps.cs index 084a3e5ea1..57e6a6ad1d 100644 --- a/osu.Game.Rulesets.Osu/Edit/Checks/CheckLowDiffOverlaps.cs +++ b/osu.Game.Rulesets.Osu/Edit/Checks/CheckLowDiffOverlaps.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Osu/Edit/Checks/CheckOffscreenObjects.cs b/osu.Game.Rulesets.Osu/Edit/Checks/CheckOffscreenObjects.cs index a342c2a821..af3521c35c 100644 --- a/osu.Game.Rulesets.Osu/Edit/Checks/CheckOffscreenObjects.cs +++ b/osu.Game.Rulesets.Osu/Edit/Checks/CheckOffscreenObjects.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Checks.Components; diff --git a/osu.Game.Rulesets.Osu/Edit/Checks/CheckTimeDistanceEquality.cs b/osu.Game.Rulesets.Osu/Edit/Checks/CheckTimeDistanceEquality.cs index 585bd35bd9..753ddba710 100644 --- a/osu.Game.Rulesets.Osu/Edit/Checks/CheckTimeDistanceEquality.cs +++ b/osu.Game.Rulesets.Osu/Edit/Checks/CheckTimeDistanceEquality.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/Edit/Checks/CheckTooShortSliders.cs b/osu.Game.Rulesets.Osu/Edit/Checks/CheckTooShortSliders.cs index 159498c479..75eeb91918 100644 --- a/osu.Game.Rulesets.Osu/Edit/Checks/CheckTooShortSliders.cs +++ b/osu.Game.Rulesets.Osu/Edit/Checks/CheckTooShortSliders.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Osu/Edit/Checks/CheckTooShortSpinners.cs b/osu.Game.Rulesets.Osu/Edit/Checks/CheckTooShortSpinners.cs index f0aade1b7f..6b4dc01ab1 100644 --- a/osu.Game.Rulesets.Osu/Edit/Checks/CheckTooShortSpinners.cs +++ b/osu.Game.Rulesets.Osu/Edit/Checks/CheckTooShortSpinners.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Checks.Components; diff --git a/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs index 516b34d807..a5f7707cb3 100644 --- a/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs +++ b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs index 5f7c8b77b0..69187875d7 100644 --- a/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Osu/Edit/OsuBeatmapVerifier.cs b/osu.Game.Rulesets.Osu/Edit/OsuBeatmapVerifier.cs index 221723e4cd..2c67f0bf97 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuBeatmapVerifier.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuBeatmapVerifier.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Osu/Edit/OsuBlueprintContainer.cs b/osu.Game.Rulesets.Osu/Edit/OsuBlueprintContainer.cs index dc8c3d6107..c0fb0ae7db 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuBlueprintContainer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuBlueprintContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles; diff --git a/osu.Game.Rulesets.Osu/Edit/OsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu/Edit/OsuDistanceSnapGrid.cs index b11929c1e8..23bf67ff29 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuDistanceSnapGrid.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index b0d6170190..066a114f66 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/Edit/OsuRectangularPositionSnapGrid.cs b/osu.Game.Rulesets.Osu/Edit/OsuRectangularPositionSnapGrid.cs index d1c81b51bc..35dad1a4fb 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuRectangularPositionSnapGrid.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuRectangularPositionSnapGrid.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Input.Bindings; diff --git a/osu.Game.Rulesets.Osu/Edit/OsuSelectionHandler.cs b/osu.Game.Rulesets.Osu/Edit/OsuSelectionHandler.cs index 70c60ab635..4a6d94f303 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuSelectionHandler.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuSelectionHandler.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Osu/Edit/Setup/OsuSetupSection.cs b/osu.Game.Rulesets.Osu/Edit/Setup/OsuSetupSection.cs index 8cb778a2e1..d8471aca1a 100644 --- a/osu.Game.Rulesets.Osu/Edit/Setup/OsuSetupSection.cs +++ b/osu.Game.Rulesets.Osu/Edit/Setup/OsuSetupSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Graphics.UserInterfaceV2; diff --git a/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs index 596224e5c6..0a3fc176ad 100644 --- a/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs index c5e90da3bd..3c0cf34010 100644 --- a/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Osu/Judgements/ComboResult.cs b/osu.Game.Rulesets.Osu/Judgements/ComboResult.cs index ad292b0439..9762c676c5 100644 --- a/osu.Game.Rulesets.Osu/Judgements/ComboResult.cs +++ b/osu.Game.Rulesets.Osu/Judgements/ComboResult.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Rulesets.Osu.Judgements diff --git a/osu.Game.Rulesets.Osu/Judgements/OsuHitCircleJudgementResult.cs b/osu.Game.Rulesets.Osu/Judgements/OsuHitCircleJudgementResult.cs index 9b33e746b3..5f9faaceb2 100644 --- a/osu.Game.Rulesets.Osu/Judgements/OsuHitCircleJudgementResult.cs +++ b/osu.Game.Rulesets.Osu/Judgements/OsuHitCircleJudgementResult.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu/Judgements/OsuIgnoreJudgement.cs b/osu.Game.Rulesets.Osu/Judgements/OsuIgnoreJudgement.cs index 1999785efe..1bdb74cd3b 100644 --- a/osu.Game.Rulesets.Osu/Judgements/OsuIgnoreJudgement.cs +++ b/osu.Game.Rulesets.Osu/Judgements/OsuIgnoreJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Judgements diff --git a/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs b/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs index 1a88e2a8b2..a5503d3273 100644 --- a/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs +++ b/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Osu/Judgements/OsuJudgementResult.cs b/osu.Game.Rulesets.Osu/Judgements/OsuJudgementResult.cs index 15444b847b..50d73fa19d 100644 --- a/osu.Game.Rulesets.Osu/Judgements/OsuJudgementResult.cs +++ b/osu.Game.Rulesets.Osu/Judgements/OsuJudgementResult.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Rulesets.Osu/Judgements/OsuSpinnerJudgementResult.cs b/osu.Game.Rulesets.Osu/Judgements/OsuSpinnerJudgementResult.cs index 9f77175398..4229c87b58 100644 --- a/osu.Game.Rulesets.Osu/Judgements/OsuSpinnerJudgementResult.cs +++ b/osu.Game.Rulesets.Osu/Judgements/OsuSpinnerJudgementResult.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu/Judgements/SliderTickJudgement.cs b/osu.Game.Rulesets.Osu/Judgements/SliderTickJudgement.cs index a088696784..270c1f31fb 100644 --- a/osu.Game.Rulesets.Osu/Judgements/SliderTickJudgement.cs +++ b/osu.Game.Rulesets.Osu/Judgements/SliderTickJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Judgements diff --git a/osu.Game.Rulesets.Osu/Mods/IHidesApproachCircles.cs b/osu.Game.Rulesets.Osu/Mods/IHidesApproachCircles.cs index 4a3b187e83..affc0bae6a 100644 --- a/osu.Game.Rulesets.Osu/Mods/IHidesApproachCircles.cs +++ b/osu.Game.Rulesets.Osu/Mods/IHidesApproachCircles.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Osu.Mods { /// diff --git a/osu.Game.Rulesets.Osu/Mods/IRequiresApproachCircles.cs b/osu.Game.Rulesets.Osu/Mods/IRequiresApproachCircles.cs index 1458abfe05..a108f5fd14 100644 --- a/osu.Game.Rulesets.Osu/Mods/IRequiresApproachCircles.cs +++ b/osu.Game.Rulesets.Osu/Mods/IRequiresApproachCircles.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Osu.Mods { /// diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs index 0832cfb545..622d2df432 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs b/osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs index 8b323eefa6..3d4a26b3ff 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs index aaf455e95f..4c9418726c 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs index 507b3588bd..d562c37541 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModBarrelRoll.cs b/osu.Game.Rulesets.Osu/Mods/OsuModBarrelRoll.cs index 9e71f657ce..71bdd98457 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModBarrelRoll.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModBarrelRoll.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs index 7567c96b50..199c735787 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs b/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs index 99d7535957..656cf95e77 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs b/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs index 76ff361ce3..8a15d730cd 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModDaycore.cs b/osu.Game.Rulesets.Osu/Mods/OsuModDaycore.cs index 371dfe6a1a..c4cc0b4f48 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModDaycore.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModDaycore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Osu.Mods diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModDeflate.cs b/osu.Game.Rulesets.Osu/Mods/OsuModDeflate.cs index ee6a7815e2..e95e61312e 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModDeflate.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModDeflate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs b/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs index 3a6b232f9f..be159523b7 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Game.Beatmaps; using osu.Game.Configuration; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModDoubleTime.cs b/osu.Game.Rulesets.Osu/Mods/OsuModDoubleTime.cs index 933c6cde1c..2d19305509 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModDoubleTime.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModDoubleTime.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Osu.Mods diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModEasy.cs b/osu.Game.Rulesets.Osu/Mods/OsuModEasy.cs index 06b5b6cfb8..90b22e8d9c 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModEasy.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModEasy.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Osu.Mods diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index 44d72fae61..c082805a0e 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs index 182d6eeb4b..34840de983 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModHalfTime.cs b/osu.Game.Rulesets.Osu/Mods/OsuModHalfTime.cs index 4769e7660b..54c5c56ca6 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModHalfTime.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModHalfTime.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Osu.Mods diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs b/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs index 007820b016..fdddfed4d5 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs index fc04e4d091..f9422e1ff9 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs b/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs index ca6e9cfb1d..cee40866b1 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModMirror.cs b/osu.Game.Rulesets.Osu/Mods/OsuModMirror.cs index 3faca0b01f..1d822a2d4c 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModMirror.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModMirror.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Game.Configuration; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModMuted.cs b/osu.Game.Rulesets.Osu/Mods/OsuModMuted.cs index 5e3ee37b61..1d4650a379 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModMuted.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModMuted.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModNightcore.cs b/osu.Game.Rulesets.Osu/Mods/OsuModNightcore.cs index 7780e23a26..e9be56fcc5 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModNightcore.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModNightcore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModNoFail.cs b/osu.Game.Rulesets.Osu/Mods/OsuModNoFail.cs index 9f707a5aa6..c20fcf0b1b 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModNoFail.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModNoFail.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModNoScope.cs b/osu.Game.Rulesets.Osu/Mods/OsuModNoScope.cs index 8e377ea632..fe415cb967 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModNoScope.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModNoScope.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModObjectScaleTween.cs b/osu.Game.Rulesets.Osu/Mods/OsuModObjectScaleTween.cs index 70c075276f..d96724929f 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModObjectScaleTween.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModObjectScaleTween.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModPerfect.cs b/osu.Game.Rulesets.Osu/Mods/OsuModPerfect.cs index da462eb6e8..c5795177d0 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModPerfect.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModPerfect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Osu.Mods diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs index 79ff222a89..4f83154728 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Linq; using osu.Framework.Utils; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index 5f37c6a0ae..2cf8c278ca 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModSpinIn.cs b/osu.Game.Rulesets.Osu/Mods/OsuModSpinIn.cs index 95e7d13ee7..16e7780af0 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModSpinIn.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModSpinIn.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs b/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs index d9ab749ad3..61028a1ee8 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs b/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs index 0b34ab28a3..565ff415be 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using System.Threading; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModSuddenDeath.cs b/osu.Game.Rulesets.Osu/Mods/OsuModSuddenDeath.cs index 429fe30fc5..4eb7659152 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModSuddenDeath.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModSuddenDeath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs index c58c624f5c..4589a8eca1 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTouchDevice.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTouchDevice.cs index 7276cc753c..f8c1e1639d 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTouchDevice.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTouchDevice.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Osu.Mods diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTraceable.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTraceable.cs index 07ce009cf8..6e5dd45a7a 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTraceable.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTraceable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 45ce4d555a..51994a3e1a 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index 693a5bee0b..3fba2cefd2 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs index b989500066..36d8ba0189 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osuTK; using osuTK.Graphics; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointConnection.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointConnection.cs index e88d09e6d9..0306c99fd5 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointConnection.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointConnection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Pooling; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointLifetimeEntry.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointLifetimeEntry.cs index ad656d2085..cbec5efda7 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointLifetimeEntry.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointLifetimeEntry.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Diagnostics; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index 011e9fa85d..4949abccab 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index f05aea0df4..23e5cb0ad7 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index fa2d2ba38c..360b28f69f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs index e4df41a4fe..e137a503a5 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Configuration; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index c48ab998ba..9e3b762690 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs index 2b026e6840..70b1bd225f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderRepeat.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderRepeat.cs index 673211ac6c..1bddc603ac 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderRepeat.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderRepeat.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs index 64964ed396..df3a12fe33 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index c7bfdb02fb..3ffbe68b98 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index fa095edafa..53f4d21975 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerBonusTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerBonusTick.cs index ffeb14b0a8..841f74b751 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerBonusTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerBonusTick.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSpinnerBonusTick : DrawableSpinnerTick diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs index 39239c8233..6a15463a32 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; namespace osu.Game.Rulesets.Osu.Objects.Drawables diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/IRequireTracking.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/IRequireTracking.cs index b1815b23c9..55de5a0e8d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/IRequireTracking.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/IRequireTracking.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Osu.Objects.Drawables { public interface IRequireTracking diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/ITrackSnaking.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/ITrackSnaking.cs index cae2a7c36d..9e8035a1ee 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/ITrackSnaking.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/ITrackSnaking.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; namespace osu.Game.Rulesets.Osu.Objects.Drawables diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/SkinnableLighting.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/SkinnableLighting.cs index c72080c9e5..4af4767a3e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/SkinnableLighting.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/SkinnableLighting.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Skinning; diff --git a/osu.Game.Rulesets.Osu/Objects/HitCircle.cs b/osu.Game.Rulesets.Osu/Objects/HitCircle.cs index d652db0fd4..5f43e57ed8 100644 --- a/osu.Game.Rulesets.Osu/Objects/HitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/HitCircle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Judgements; diff --git a/osu.Game.Rulesets.Osu/Objects/ISliderProgress.cs b/osu.Game.Rulesets.Osu/Objects/ISliderProgress.cs index 7594f7c2e0..eddd251bda 100644 --- a/osu.Game.Rulesets.Osu/Objects/ISliderProgress.cs +++ b/osu.Game.Rulesets.Osu/Objects/ISliderProgress.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Osu.Objects { public interface ISliderProgress diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index 8b7de9e109..387342b4a9 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index a698311bf7..dcb47347ef 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; diff --git a/osu.Game.Rulesets.Osu/Objects/SliderEndCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderEndCircle.cs index f893559548..35bec92354 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderEndCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderEndCircle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Osu/Objects/SliderHeadCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderHeadCircle.cs index 5672283230..2a84b04030 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderHeadCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderHeadCircle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Judgements; diff --git a/osu.Game.Rulesets.Osu/Objects/SliderRepeat.cs b/osu.Game.Rulesets.Osu/Objects/SliderRepeat.cs index cca86361c2..7b9316f8ac 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderRepeat.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderRepeat.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs index f9450062f4..87c8117b6b 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Judgements; diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs index e7e64954e9..569e9b7c1c 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Judgements; diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index 1a130e96b3..0e1fe56cea 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/Objects/SpinnerBonusTick.cs b/osu.Game.Rulesets.Osu/Objects/SpinnerBonusTick.cs index 2c443cb96b..81cdf5755b 100644 --- a/osu.Game.Rulesets.Osu/Objects/SpinnerBonusTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SpinnerBonusTick.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Audio; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs index d715b9a428..650d02c675 100644 --- a/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Osu/OsuInputManager.cs b/osu.Game.Rulesets.Osu/OsuInputManager.cs index 5c6b907e42..12256e93d0 100644 --- a/osu.Game.Rulesets.Osu/OsuInputManager.cs +++ b/osu.Game.Rulesets.Osu/OsuInputManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.ComponentModel; using osu.Framework.Input; diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 207e7a4ab0..8b9dc71a8b 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Osu/OsuSkinComponent.cs b/osu.Game.Rulesets.Osu/OsuSkinComponent.cs index 1d223f231b..82c4005c5e 100644 --- a/osu.Game.Rulesets.Osu/OsuSkinComponent.cs +++ b/osu.Game.Rulesets.Osu/OsuSkinComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu diff --git a/osu.Game.Rulesets.Osu/OsuSkinComponents.cs b/osu.Game.Rulesets.Osu/OsuSkinComponents.cs index 71657ed532..fcf079b6aa 100644 --- a/osu.Game.Rulesets.Osu/OsuSkinComponents.cs +++ b/osu.Game.Rulesets.Osu/OsuSkinComponents.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Osu { public enum OsuSkinComponents diff --git a/osu.Game.Rulesets.Osu/Properties/AssemblyInfo.cs b/osu.Game.Rulesets.Osu/Properties/AssemblyInfo.cs index c842874635..7fffb1871f 100644 --- a/osu.Game.Rulesets.Osu/Properties/AssemblyInfo.cs +++ b/osu.Game.Rulesets.Osu/Properties/AssemblyInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Runtime.CompilerServices; // We publish our internal attributes to other sub-projects of the framework. diff --git a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs index e231550e3e..27029afece 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osu.Framework.Utils; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs b/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs index 1cb3208c30..b41d123380 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osu.Game.Beatmaps; using System; diff --git a/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs b/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs index ea36ecc399..8857bfa32d 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Input.StateChanges; diff --git a/osu.Game.Rulesets.Osu/Replays/OsuReplayFrame.cs b/osu.Game.Rulesets.Osu/Replays/OsuReplayFrame.cs index 3db81d70da..019d8035ed 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuReplayFrame.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuReplayFrame.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Replays.Legacy; diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuHitWindows.cs b/osu.Game.Rulesets.Osu/Scoring/OsuHitWindows.cs index dafe63a6d1..05fbac625e 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuHitWindows.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuHitWindows.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Scoring diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index ab0c0850dc..7a71ef6c65 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Judgements; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/CirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Default/CirclePiece.cs index cb68d4b7a7..40e9f69963 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/CirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/CirclePiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultApproachCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultApproachCircle.cs index a522367fe6..251fd8d948 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultApproachCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultApproachCircle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinner.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinner.cs index df33bf52be..a215b3b1f0 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinner.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinnerDisc.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinnerDisc.cs index 4ea0831627..ab14f939d4 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinnerDisc.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DrawableSliderPath.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DrawableSliderPath.cs index db077f009d..94f93807d4 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/DrawableSliderPath.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DrawableSliderPath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Lines; using osuTK.Graphics; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/ExplodePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Default/ExplodePiece.cs index 510ed225a8..6ee8a12132 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/ExplodePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/ExplodePiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/FlashPiece.cs b/osu.Game.Rulesets.Osu/Skinning/Default/FlashPiece.cs index 06ee64d8b3..98a8b39f6f 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/FlashPiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/FlashPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/GlowPiece.cs b/osu.Game.Rulesets.Osu/Skinning/Default/GlowPiece.cs index f5e01b802e..2360bc2238 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/GlowPiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/GlowPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/IHasMainCirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Default/IHasMainCirclePiece.cs index 8bb7629542..0ba7998d43 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/IHasMainCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/IHasMainCirclePiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Skinning.Default diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/KiaiFlash.cs b/osu.Game.Rulesets.Osu/Skinning/Default/KiaiFlash.cs index 506f679836..a1cfd170a6 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/KiaiFlash.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/KiaiFlash.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Audio.Track; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/MainCirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Default/MainCirclePiece.cs index d7ebe9333d..4acc406ae1 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/MainCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/MainCirclePiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/ManualSliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Default/ManualSliderBody.cs index d73c94eb9b..8d8d9e0d94 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/ManualSliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/ManualSliderBody.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osuTK; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/NumberPiece.cs b/osu.Game.Rulesets.Osu/Skinning/Default/NumberPiece.cs index 43d8d1e27f..f6759c1093 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/NumberPiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/NumberPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/PlaySliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Default/PlaySliderBody.cs index 8602ebc88b..83f7bb8904 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/PlaySliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/PlaySliderBody.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Rulesets.Objects.Drawables; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/ReverseArrowPiece.cs b/osu.Game.Rulesets.Osu/Skinning/Default/ReverseArrowPiece.cs index 0009ffc586..8f682d02f6 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/ReverseArrowPiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/ReverseArrowPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio.Track; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/RingPiece.cs b/osu.Game.Rulesets.Osu/Skinning/Default/RingPiece.cs index 7f10a7bf56..b941a86171 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/RingPiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/RingPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs index 710967b741..d2ea8f1660 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/SliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Default/SliderBody.cs index 7e6df759f8..9841cc7cdf 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/SliderBody.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/SnakingSliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Default/SnakingSliderBody.cs index 42d3840158..86dd5f5c74 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/SnakingSliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/SnakingSliderBody.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerBackgroundLayer.cs b/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerBackgroundLayer.cs index a1184a15cd..a9b7ddf86f 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerBackgroundLayer.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerBackgroundLayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerCentreLayer.cs b/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerCentreLayer.cs index 67b5ed5410..ef7b4c2c96 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerCentreLayer.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerCentreLayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerFill.cs b/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerFill.cs index f574ae589e..b7ec9e9799 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerFill.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerFill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerRotationTracker.cs b/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerRotationTracker.cs index 4313e99b13..f9ed8b8721 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerRotationTracker.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerRotationTracker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerSpmCalculator.cs b/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerSpmCalculator.cs index a5205bbb8c..df72223214 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerSpmCalculator.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerSpmCalculator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerTicks.cs b/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerTicks.cs index e518ae1da8..b66cbe41b6 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerTicks.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerTicks.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/TrianglesPiece.cs b/osu.Game.Rulesets.Osu/Skinning/Default/TrianglesPiece.cs index fa23c60d57..7399ddbd1b 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/TrianglesPiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/TrianglesPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Graphics.Backgrounds; namespace osu.Game.Rulesets.Osu.Skinning.Default diff --git a/osu.Game.Rulesets.Osu/Skinning/IHasApproachCircle.cs b/osu.Game.Rulesets.Osu/Skinning/IHasApproachCircle.cs index 7fbc5b144b..8ebab97503 100644 --- a/osu.Game.Rulesets.Osu/Skinning/IHasApproachCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/IHasApproachCircle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; namespace osu.Game.Rulesets.Osu.Skinning diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/KiaiFlashingDrawable.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/KiaiFlashingDrawable.cs index 4ee28d05b5..152ed5c3d9 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/KiaiFlashingDrawable.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/KiaiFlashingDrawable.cs @@ -7,8 +7,6 @@ using osu.Framework.Graphics; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics.Containers; -#nullable enable - namespace osu.Game.Rulesets.Osu.Skinning.Legacy { internal class KiaiFlashingDrawable : BeatSyncedContainer diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyApproachCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyApproachCircle.cs index 6a2cb871b1..03406d37ff 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyApproachCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyApproachCircle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursor.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursor.cs index b2ffc171be..4465f9c266 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursor.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Rulesets.Osu.UI.Cursor; diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorParticles.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorParticles.cs index b511444c44..ee75b8a857 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorParticles.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorParticles.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs index 75d847d54d..e62754c6ce 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs index dd6226e19b..1b2ab82044 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyMainCirclePiece.cs @@ -16,8 +16,6 @@ using osu.Game.Skinning; using osuTK; using osuTK.Graphics; -#nullable enable - namespace osu.Game.Rulesets.Osu.Skinning.Legacy { public class LegacyMainCirclePiece : CompositeDrawable diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyNewStyleSpinner.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyNewStyleSpinner.cs index a58f62736b..e4ca0d2ea8 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyNewStyleSpinner.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyNewStyleSpinner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyOldStyleSpinner.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyOldStyleSpinner.cs index ea122d47bb..a5a765fc02 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyOldStyleSpinner.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyOldStyleSpinner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyReverseArrow.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyReverseArrow.cs index 7a071b5a03..ff384ee7fc 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyReverseArrow.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyReverseArrow.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs index e4e1483665..07e60c82d0 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs index 29a0745193..dbfec14eb2 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderHeadHitCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderHeadHitCircle.cs index 7de2b8c7fa..ab39d7c6ef 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderHeadHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderHeadHitCircle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySpinner.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySpinner.cs index 93aba608e6..004222ad7a 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySpinner.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySpinner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs index 572185e6e1..e7d28a9bd7 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Skinning/NonPlayfieldSprite.cs b/osu.Game.Rulesets.Osu/Skinning/NonPlayfieldSprite.cs index 55257106e2..0b45c770ba 100644 --- a/osu.Game.Rulesets.Osu/Skinning/NonPlayfieldSprite.cs +++ b/osu.Game.Rulesets.Osu/Skinning/NonPlayfieldSprite.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Rulesets.UI; diff --git a/osu.Game.Rulesets.Osu/Skinning/OsuSkinColour.cs b/osu.Game.Rulesets.Osu/Skinning/OsuSkinColour.cs index 24f9217a5f..5d8a2ff606 100644 --- a/osu.Game.Rulesets.Osu/Skinning/OsuSkinColour.cs +++ b/osu.Game.Rulesets.Osu/Skinning/OsuSkinColour.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Osu.Skinning { public enum OsuSkinColour diff --git a/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs b/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs index 7b9cf8e1d1..306a1e38b9 100644 --- a/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs +++ b/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Osu.Skinning { public enum OsuSkinConfiguration diff --git a/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs b/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs index 6c76da7925..acf32da73f 100644 --- a/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs +++ b/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/UI/AnyOrderHitPolicy.cs b/osu.Game.Rulesets.Osu/UI/AnyOrderHitPolicy.cs index b4de91562b..afa54c2dfb 100644 --- a/osu.Game.Rulesets.Osu/UI/AnyOrderHitPolicy.cs +++ b/osu.Game.Rulesets.Osu/UI/AnyOrderHitPolicy.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 62cab4d6d7..c1d518a843 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Runtime.InteropServices; diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs index 0e7d7cdcf3..15ef7e538b 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs index b60ea5da21..533db3ddfe 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorSprite.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorSprite.cs index 573c408a78..03ef79a262 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorSprite.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorSprite.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs b/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs index df3f7c64e4..5f430dc921 100644 --- a/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Osu/UI/IHitPolicy.cs b/osu.Game.Rulesets.Osu/UI/IHitPolicy.cs index 5d8ea035a7..0dac3307c2 100644 --- a/osu.Game.Rulesets.Osu/UI/IHitPolicy.cs +++ b/osu.Game.Rulesets.Osu/UI/IHitPolicy.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; diff --git a/osu.Game.Rulesets.Osu/UI/ObjectOrderedHitPolicy.cs b/osu.Game.Rulesets.Osu/UI/ObjectOrderedHitPolicy.cs index 83f205deac..fba225d464 100644 --- a/osu.Game.Rulesets.Osu/UI/ObjectOrderedHitPolicy.cs +++ b/osu.Game.Rulesets.Osu/UI/ObjectOrderedHitPolicy.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index bc1e80cd12..ad27428010 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs index 0d1a5a8304..80f4eb3000 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.UI; diff --git a/osu.Game.Rulesets.Osu/UI/OsuReplayRecorder.cs b/osu.Game.Rulesets.Osu/UI/OsuReplayRecorder.cs index 1304dfe416..5964a9b9b6 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuReplayRecorder.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuReplayRecorder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Osu.Replays; using osu.Game.Rulesets.Replays; diff --git a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs index 4d4340936d..fc3f89a836 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs index a638019e69..eff4b30362 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game.Rulesets.Osu/UI/StartTimeOrderedHitPolicy.cs b/osu.Game.Rulesets.Osu/UI/StartTimeOrderedHitPolicy.cs index 0173156246..edc3ba0818 100644 --- a/osu.Game.Rulesets.Osu/UI/StartTimeOrderedHitPolicy.cs +++ b/osu.Game.Rulesets.Osu/UI/StartTimeOrderedHitPolicy.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs index 266f7d1251..5e827d4782 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs index a77d1f8b0f..c413226e63 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs @@ -10,8 +10,6 @@ using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.UI; using osuTK; -#nullable enable - namespace osu.Game.Rulesets.Osu.Utils { public static partial class OsuHitObjectGenerationUtils diff --git a/osu.Game.Rulesets.Taiko.Tests.Android/MainActivity.cs b/osu.Game.Rulesets.Taiko.Tests.Android/MainActivity.cs index e4f4bbfd53..a55b461876 100644 --- a/osu.Game.Rulesets.Taiko.Tests.Android/MainActivity.cs +++ b/osu.Game.Rulesets.Taiko.Tests.Android/MainActivity.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Android.App; using osu.Framework.Android; using osu.Game.Tests; diff --git a/osu.Game.Rulesets.Taiko.Tests.iOS/AppDelegate.cs b/osu.Game.Rulesets.Taiko.Tests.iOS/AppDelegate.cs index 567220f316..385ba48707 100644 --- a/osu.Game.Rulesets.Taiko.Tests.iOS/AppDelegate.cs +++ b/osu.Game.Rulesets.Taiko.Tests.iOS/AppDelegate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Foundation; using osu.Framework.iOS; using osu.Game.Tests; diff --git a/osu.Game.Rulesets.Taiko.Tests.iOS/Application.cs b/osu.Game.Rulesets.Taiko.Tests.iOS/Application.cs index 9fde65a074..1ebbd61a94 100644 --- a/osu.Game.Rulesets.Taiko.Tests.iOS/Application.cs +++ b/osu.Game.Rulesets.Taiko.Tests.iOS/Application.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.iOS; using UIKit; diff --git a/osu.Game.Rulesets.Taiko.Tests/DrawableTaikoRulesetTestScene.cs b/osu.Game.Rulesets.Taiko.Tests/DrawableTaikoRulesetTestScene.cs index f5e7304c12..a9b7e04caf 100644 --- a/osu.Game.Rulesets.Taiko.Tests/DrawableTaikoRulesetTestScene.cs +++ b/osu.Game.Rulesets.Taiko.Tests/DrawableTaikoRulesetTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko.Tests/DrawableTestHit.cs b/osu.Game.Rulesets.Taiko.Tests/DrawableTestHit.cs index 6d4cac0ebe..6a585b840d 100644 --- a/osu.Game.Rulesets.Taiko.Tests/DrawableTestHit.cs +++ b/osu.Game.Rulesets.Taiko.Tests/DrawableTestHit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game.Rulesets.Taiko.Tests/DrawableTestStrongHit.cs b/osu.Game.Rulesets.Taiko.Tests/DrawableTestStrongHit.cs index ea877c9e17..7355e1dbca 100644 --- a/osu.Game.Rulesets.Taiko.Tests/DrawableTestStrongHit.cs +++ b/osu.Game.Rulesets.Taiko.Tests/DrawableTestStrongHit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Input.Events; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneEditor.cs b/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneEditor.cs index e3c1613bd9..5915b9fdfa 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneEditor.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneEditor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneTaikoEditorSaving.cs b/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneTaikoEditorSaving.cs index 33c2ba532e..06c06f6e28 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneTaikoEditorSaving.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneTaikoEditorSaving.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Utils; using osu.Game.Rulesets.Taiko.Beatmaps; diff --git a/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneTaikoHitObjectComposer.cs b/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneTaikoHitObjectComposer.cs index 55eb2fa66b..16f17f4131 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneTaikoHitObjectComposer.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneTaikoHitObjectComposer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs b/osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs index ac01508081..09a6a2f16c 100644 --- a/osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs +++ b/osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Testing; diff --git a/osu.Game.Rulesets.Taiko.Tests/Mods/TaikoModTestScene.cs b/osu.Game.Rulesets.Taiko.Tests/Mods/TaikoModTestScene.cs index 3090facf8c..ca2f8102b7 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Mods/TaikoModTestScene.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Mods/TaikoModTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Taiko.Tests.Mods diff --git a/osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModHidden.cs b/osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModHidden.cs index 7abbb9d186..0b28bfee2e 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModHidden.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Game.Rulesets.Taiko.Mods; diff --git a/osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModPerfect.cs b/osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModPerfect.cs index a83cc16413..917462c128 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModPerfect.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModPerfect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Taiko.Mods; diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TaikoSkinnableTestScene.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TaikoSkinnableTestScene.cs index 69250a14e1..82be26b422 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TaikoSkinnableTestScene.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TaikoSkinnableTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Taiko.Tests.Skinning diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableBarLine.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableBarLine.cs index 16c4148d15..ad6f08dbd4 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableBarLine.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableBarLine.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableDrumRoll.cs index 26a4e85fe5..2d27e0e40e 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableDrumRoll.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableHit.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableHit.cs index c4ee68206c..d5a97f8f88 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableHit.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableHit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs index 920a7cd1a1..1bf6c0560a 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using Humanizer; diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneHitExplosion.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneHitExplosion.cs index 1cba6c9008..f87e0355ad 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneHitExplosion.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneHitExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneInputDrum.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneInputDrum.cs index 24db046748..ca3e12cfd5 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneInputDrum.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneInputDrum.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneKiaiHitExplosion.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneKiaiHitExplosion.cs index 419e100296..e1a3c736fe 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneKiaiHitExplosion.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneKiaiHitExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneTaikoPlayfield.cs index 6f2fcd08f1..52d24b567f 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneTaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneTaikoPlayfield.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneTaikoScroller.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneTaikoScroller.cs index 9882c7bc90..954b4be7f3 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneTaikoScroller.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneTaikoScroller.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Testing; using osu.Framework.Timing; diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs index b3f6a733d3..796f5721bb 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using NUnit.Framework; diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs index 51332a1ece..579b461624 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoLegacyModConversionTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoLegacyModConversionTest.cs index a039e84106..3553cb27dc 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TaikoLegacyModConversionTest.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoLegacyModConversionTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Game.Beatmaps.Legacy; diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneBarLineApplication.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneBarLineApplication.cs index f33c738b04..867ee13bea 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneBarLineApplication.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneBarLineApplication.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects.Drawables; diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumRollApplication.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumRollApplication.cs index c389a05566..eceeaf5083 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumRollApplication.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumRollApplication.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects.Drawables; diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumRollJudgements.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumRollJudgements.cs index 060c3c9443..82dfaecaa4 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumRollJudgements.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumRollJudgements.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneFlyingHits.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneFlyingHits.cs index 5c7e3954e8..c787683620 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneFlyingHits.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneFlyingHits.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneHitApplication.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneHitApplication.cs index c2f251fcb6..b337519c85 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneHitApplication.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneHitApplication.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects.Drawables; diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneHits.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneHits.cs index 87c936d386..5350a81f55 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneHits.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneHits.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneSampleOutput.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneSampleOutput.cs index e5c9358c26..e6c28a532a 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneSampleOutput.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneSampleOutput.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Testing; diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneSwellJudgements.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneSwellJudgements.cs index 75049b7467..bd546b16f2 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneSwellJudgements.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneSwellJudgements.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoHitObjectSamples.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoHitObjectSamples.cs index 221d715a35..674ac5670f 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoHitObjectSamples.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoHitObjectSamples.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Reflection; using NUnit.Framework; using osu.Framework.IO.Stores; diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayer.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayer.cs index cd7511241a..5e984b19f8 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayer.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Taiko.Tests diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs index eec88d7bf8..51772df4a7 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs index 41fe63a553..6ff5cdf7e5 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index b1d8575de4..524565a863 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs index d9049c45ea..4c7b140832 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObjectRhythm.cs b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObjectRhythm.cs index ea6a224094..526d20e7d7 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObjectRhythm.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObjectRhythm.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing { /// diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Colour.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Colour.cs index 0c17ca66b9..3727c0e4b7 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Colour.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Colour.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Skills; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs index 46b24af903..4a2b97a4cb 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Rhythm.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Skills; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/SingleKeyStamina.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/SingleKeyStamina.cs index cabfd231d8..c2e1dd4f82 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/SingleKeyStamina.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/SingleKeyStamina.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Skills; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs index 61bcbfa59d..67b628a814 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Stamina.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Skills; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs index 3dc5438072..6c617a22a4 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Rulesets.Difficulty; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index ce5b1d2236..228856cbe9 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceAttributes.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceAttributes.cs index fa5c0202dd..68d0038b24 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceAttributes.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceAttributes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Rulesets.Difficulty; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs index 8d99fd3b87..a9cde62f44 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Taiko/Edit/Blueprints/DrumRollPlacementBlueprint.cs b/osu.Game.Rulesets.Taiko/Edit/Blueprints/DrumRollPlacementBlueprint.cs index eb07ce7635..dfbcd1cce3 100644 --- a/osu.Game.Rulesets.Taiko/Edit/Blueprints/DrumRollPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Taiko/Edit/Blueprints/DrumRollPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Taiko.Objects; namespace osu.Game.Rulesets.Taiko.Edit.Blueprints diff --git a/osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPiece.cs b/osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPiece.cs index b02e3aa9ba..86f32ca17c 100644 --- a/osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPiece.cs +++ b/osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPlacementBlueprint.cs b/osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPlacementBlueprint.cs index 0d0fd136a7..df1450bf77 100644 --- a/osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Taiko.Objects; diff --git a/osu.Game.Rulesets.Taiko/Edit/Blueprints/LengthPiece.cs b/osu.Game.Rulesets.Taiko/Edit/Blueprints/LengthPiece.cs index 6b651fd739..e201d58f7a 100644 --- a/osu.Game.Rulesets.Taiko/Edit/Blueprints/LengthPiece.cs +++ b/osu.Game.Rulesets.Taiko/Edit/Blueprints/LengthPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game.Rulesets.Taiko/Edit/Blueprints/SwellPlacementBlueprint.cs b/osu.Game.Rulesets.Taiko/Edit/Blueprints/SwellPlacementBlueprint.cs index 95fa82a0f2..1d08af47d3 100644 --- a/osu.Game.Rulesets.Taiko/Edit/Blueprints/SwellPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Taiko/Edit/Blueprints/SwellPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Taiko.Objects; namespace osu.Game.Rulesets.Taiko.Edit.Blueprints diff --git a/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSelectionBlueprint.cs b/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSelectionBlueprint.cs index 01b90c4bca..4c67a37417 100644 --- a/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSpanPlacementBlueprint.cs b/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSpanPlacementBlueprint.cs index 59249e6bf4..e49043e58e 100644 --- a/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSpanPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSpanPlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Input.Events; diff --git a/osu.Game.Rulesets.Taiko/Edit/DrumRollCompositionTool.cs b/osu.Game.Rulesets.Taiko/Edit/DrumRollCompositionTool.cs index 587a4efecb..acb17fc455 100644 --- a/osu.Game.Rulesets.Taiko/Edit/DrumRollCompositionTool.cs +++ b/osu.Game.Rulesets.Taiko/Edit/DrumRollCompositionTool.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Taiko/Edit/HitCompositionTool.cs b/osu.Game.Rulesets.Taiko/Edit/HitCompositionTool.cs index 3e97b4e322..e52dae4b0c 100644 --- a/osu.Game.Rulesets.Taiko/Edit/HitCompositionTool.cs +++ b/osu.Game.Rulesets.Taiko/Edit/HitCompositionTool.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Taiko/Edit/SwellCompositionTool.cs b/osu.Game.Rulesets.Taiko/Edit/SwellCompositionTool.cs index 918afde1dd..dd0ff61c10 100644 --- a/osu.Game.Rulesets.Taiko/Edit/SwellCompositionTool.cs +++ b/osu.Game.Rulesets.Taiko/Edit/SwellCompositionTool.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; diff --git a/osu.Game.Rulesets.Taiko/Edit/TaikoBlueprintContainer.cs b/osu.Game.Rulesets.Taiko/Edit/TaikoBlueprintContainer.cs index a465638779..6107c8009a 100644 --- a/osu.Game.Rulesets.Taiko/Edit/TaikoBlueprintContainer.cs +++ b/osu.Game.Rulesets.Taiko/Edit/TaikoBlueprintContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Taiko.Edit.Blueprints; diff --git a/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs b/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs index 161799c980..1c1a5c325f 100644 --- a/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs +++ b/osu.Game.Rulesets.Taiko/Edit/TaikoHitObjectComposer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; diff --git a/osu.Game.Rulesets.Taiko/Edit/TaikoSelectionHandler.cs b/osu.Game.Rulesets.Taiko/Edit/TaikoSelectionHandler.cs index ab3b729307..80e4e8f406 100644 --- a/osu.Game.Rulesets.Taiko/Edit/TaikoSelectionHandler.cs +++ b/osu.Game.Rulesets.Taiko/Edit/TaikoSelectionHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollJudgement.cs index 0d91002f4b..be128d85b5 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Taiko.Judgements diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs index 647ad7853d..5f2587a5d5 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Taiko.Judgements diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs index e272c1a4ef..f8e3303752 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongJudgement.cs index 06495ad9f4..f2397aba22 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Taiko.Judgements diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoSwellJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoSwellJudgement.cs index 4d61efd3ee..b2ac0b7f03 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoSwellJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoSwellJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Taiko.Judgements diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModAutoplay.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModAutoplay.cs index 4b74b4991e..6c01bae027 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModAutoplay.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModAutoplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModCinema.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModCinema.cs index fee0cb2744..d1c192f7fa 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModCinema.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModCinema.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModClassic.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModClassic.cs index 5a6f57bc36..6d1a18bb78 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModClassic.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModClassic.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.UI; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModDaycore.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModDaycore.cs index 84aa5e6bba..873aa7f992 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModDaycore.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModDaycore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Taiko.Mods diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModDifficultyAdjust.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModDifficultyAdjust.cs index 99a064d35f..564d023c5a 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModDifficultyAdjust.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModDifficultyAdjust.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Game.Beatmaps; using osu.Game.Configuration; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModDoubleTime.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModDoubleTime.cs index bc38213acc..01f1632ae2 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModDoubleTime.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModDoubleTime.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Taiko.Mods diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModEasy.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModEasy.cs index ad6fdf59e2..a37e1c6f5c 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModEasy.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModEasy.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index beec785fe8..2f9cccfe86 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Layout; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHalfTime.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHalfTime.cs index 68d6305fbf..ddfc2d1174 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHalfTime.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHalfTime.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Taiko.Mods diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHardRock.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHardRock.cs index 8437dfe52e..7fcd925c04 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHardRock.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHardRock.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index 7f565cb82d..69eace4302 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModMuted.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModMuted.cs index 0f1e0b2885..874e15406d 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModMuted.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModMuted.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Taiko.Objects; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModNightcore.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModNightcore.cs index 5377eb1072..f2a57ecf88 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModNightcore.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModNightcore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Taiko.Objects; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModNoFail.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModNoFail.cs index bf1006f1aa..57ecf0224f 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModNoFail.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModNoFail.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Taiko.Mods diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModPerfect.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModPerfect.cs index b107b14a03..c65dba243b 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModPerfect.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModPerfect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Taiko.Mods diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModRandom.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModRandom.cs index 307a37bf2e..f58f59aaf2 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModRandom.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModRandom.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Utils; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModRelax.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModRelax.cs index 7be70d9ac3..a3a644ab99 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModRelax.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModRelax.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Taiko.Mods diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModSuddenDeath.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModSuddenDeath.cs index 7a0f6c7cd1..037e376ad2 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModSuddenDeath.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModSuddenDeath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Taiko.Mods diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModSwap.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModSwap.cs index 3cb337c41d..c9cba59760 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModSwap.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModSwap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Taiko/Objects/BarLine.cs b/osu.Game.Rulesets.Taiko/Objects/BarLine.cs index bbfc02f975..382035119e 100644 --- a/osu.Game.Rulesets.Taiko/Objects/BarLine.cs +++ b/osu.Game.Rulesets.Taiko/Objects/BarLine.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs index d653f01db6..e4806c4a12 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs index b84db513f7..04ed6d0b87 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index e24923e482..705a0a8047 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableFlyingHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableFlyingHit.cs index 3253c1ce5a..5ce72028e0 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableFlyingHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableFlyingHit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 863672b3fa..484f125a09 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongNestedHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongNestedHit.cs index 9c22e34387..01ee91a5c7 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongNestedHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongNestedHit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Game.Rulesets.Taiko.Judgements; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 77243218ce..2451c79772 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs index d4ea9ed29f..b2a54176fb 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Graphics; using osu.Framework.Input.Events; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index eb64ba72f2..9bbd3670fa 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoStrongableHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoStrongableHitObject.cs index 70d4371e99..4b58cc60e6 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoStrongableHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoStrongableHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs index 0e93ad7e73..e1619e2857 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Types; using System; using System.Threading; diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs index 9d0336441e..433fdab908 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Taiko.Judgements; diff --git a/osu.Game.Rulesets.Taiko/Objects/Hit.cs b/osu.Game.Rulesets.Taiko/Objects/Hit.cs index 2038da9344..8bc0dc6df0 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Hit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Hit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game.Rulesets.Taiko/Objects/HitType.cs b/osu.Game.Rulesets.Taiko/Objects/HitType.cs index 17b3fdbd04..eae7fa683a 100644 --- a/osu.Game.Rulesets.Taiko/Objects/HitType.cs +++ b/osu.Game.Rulesets.Taiko/Objects/HitType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Taiko.Objects { /// diff --git a/osu.Game.Rulesets.Taiko/Objects/IgnoreHit.cs b/osu.Game.Rulesets.Taiko/Objects/IgnoreHit.cs index 302f940ef4..18f47b7cff 100644 --- a/osu.Game.Rulesets.Taiko/Objects/IgnoreHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/IgnoreHit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; namespace osu.Game.Rulesets.Taiko.Objects diff --git a/osu.Game.Rulesets.Taiko/Objects/StrongNestedHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/StrongNestedHitObject.cs index 3b427e48c5..628c41d878 100644 --- a/osu.Game.Rulesets.Taiko/Objects/StrongNestedHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/StrongNestedHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Taiko.Judgements; diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs index eeae6e79f8..cb91c46b4d 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Judgements; diff --git a/osu.Game.Rulesets.Taiko/Objects/SwellTick.cs b/osu.Game.Rulesets.Taiko/Objects/SwellTick.cs index bdc0478195..43830cb528 100644 --- a/osu.Game.Rulesets.Taiko/Objects/SwellTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/SwellTick.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs index 1a1fde1990..3aba5c571b 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoStrongableHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoStrongableHitObject.cs index 6e0f6a3109..b7bdd98d2a 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoStrongableHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoStrongableHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using System.Threading; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Taiko/Properties/AssemblyInfo.cs b/osu.Game.Rulesets.Taiko/Properties/AssemblyInfo.cs index ca7d04876e..5b66e18a6d 100644 --- a/osu.Game.Rulesets.Taiko/Properties/AssemblyInfo.cs +++ b/osu.Game.Rulesets.Taiko/Properties/AssemblyInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Runtime.CompilerServices; // We publish our internal attributes to other sub-projects of the framework. diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs index 5fd281f9fa..f7f72df023 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs index 2f9b6c7f60..0090409443 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Replays; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoReplayFrame.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoReplayFrame.cs index d2a7329a28..d8f88785db 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoReplayFrame.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoReplayFrame.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Replays.Legacy; diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoHealthProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoHealthProcessor.cs index 0d6ce44255..a663817aa8 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoHealthProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoHealthProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoHitWindows.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoHitWindows.cs index cf806c0c97..896af24772 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoHitWindows.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoHitWindows.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Taiko.Scoring diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index bacc22714e..3b0bb952dd 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Taiko.Scoring diff --git a/osu.Game.Rulesets.Taiko/Skinning/Default/CentreHitCirclePiece.cs b/osu.Game.Rulesets.Taiko/Skinning/Default/CentreHitCirclePiece.cs index 25f895708f..b91d5cfe8d 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Default/CentreHitCirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Default/CentreHitCirclePiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Taiko/Skinning/Default/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Skinning/Default/CirclePiece.cs index f2452ad88c..a7ab1bcd4a 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Default/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Default/CirclePiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Audio.Track; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko/Skinning/Default/ElongatedCirclePiece.cs b/osu.Game.Rulesets.Taiko/Skinning/Default/ElongatedCirclePiece.cs index 210841bca0..ba2679fe97 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Default/ElongatedCirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Default/ElongatedCirclePiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics; diff --git a/osu.Game.Rulesets.Taiko/Skinning/Default/RimHitCirclePiece.cs b/osu.Game.Rulesets.Taiko/Skinning/Default/RimHitCirclePiece.cs index c6165495d8..63269f1267 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Default/RimHitCirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Default/RimHitCirclePiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Taiko/Skinning/Default/SwellSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Skinning/Default/SwellSymbolPiece.cs index 2f59cac3ff..d19dc4c887 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Default/SwellSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Default/SwellSymbolPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Taiko/Skinning/Default/TickPiece.cs b/osu.Game.Rulesets.Taiko/Skinning/Default/TickPiece.cs index 09c8243aac..7d3268f777 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Default/TickPiece.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Default/TickPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyBarLine.cs b/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyBarLine.cs index 2b528ae8ce..97e0a340dd 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyBarLine.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyBarLine.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyCirclePiece.cs b/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyCirclePiece.cs index 2b6c14ca63..7f813e7b27 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyCirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyCirclePiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Animations; diff --git a/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyDrumRoll.cs b/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyDrumRoll.cs index ea6f813be8..80f139a66b 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyDrumRoll.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyHit.cs b/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyHit.cs index d93317f0e2..b4277f86bb 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyHit.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyHit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Skinning; using osuTK.Graphics; diff --git a/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyHitExplosion.cs b/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyHitExplosion.cs index 21bd35ad22..87ed2e2e60 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyHitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyHitExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyInputDrum.cs b/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyInputDrum.cs index 43c5c07f80..f18d8f0537 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyInputDrum.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyInputDrum.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyTaikoScroller.cs b/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyTaikoScroller.cs index fa49242675..bd4a2f8935 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyTaikoScroller.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyTaikoScroller.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacyHitTarget.cs b/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacyHitTarget.cs index c4657fcc49..a48cdf47f6 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacyHitTarget.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacyHitTarget.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacyPlayfieldBackgroundRight.cs b/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacyPlayfieldBackgroundRight.cs index 02756d57a4..f425a410a4 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacyPlayfieldBackgroundRight.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacyPlayfieldBackgroundRight.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio.Track; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacySkinTransformer.cs b/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacySkinTransformer.cs index af5921b0fb..888271f32d 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacySkinTransformer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Audio.Sample; diff --git a/osu.Game.Rulesets.Taiko/TaikoInputManager.cs b/osu.Game.Rulesets.Taiko/TaikoInputManager.cs index 058bec5111..1eab133725 100644 --- a/osu.Game.Rulesets.Taiko/TaikoInputManager.cs +++ b/osu.Game.Rulesets.Taiko/TaikoInputManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Input.Bindings; using osu.Game.Rulesets.UI; diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index 615fbf093f..223e268d7f 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Taiko/TaikoSkinComponent.cs b/osu.Game.Rulesets.Taiko/TaikoSkinComponent.cs index e6e4bc0dd7..676a3d4bc3 100644 --- a/osu.Game.Rulesets.Taiko/TaikoSkinComponent.cs +++ b/osu.Game.Rulesets.Taiko/TaikoSkinComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Skinning; namespace osu.Game.Rulesets.Taiko diff --git a/osu.Game.Rulesets.Taiko/TaikoSkinComponents.cs b/osu.Game.Rulesets.Taiko/TaikoSkinComponents.cs index bf48898dd2..d231dc7e4f 100644 --- a/osu.Game.Rulesets.Taiko/TaikoSkinComponents.cs +++ b/osu.Game.Rulesets.Taiko/TaikoSkinComponents.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Taiko { public enum TaikoSkinComponents diff --git a/osu.Game.Rulesets.Taiko/UI/BarLinePlayfield.cs b/osu.Game.Rulesets.Taiko/UI/BarLinePlayfield.cs index cb878e8ea0..071808a044 100644 --- a/osu.Game.Rulesets.Taiko/UI/BarLinePlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/BarLinePlayfield.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects.Drawables; diff --git a/osu.Game.Rulesets.Taiko/UI/DefaultHitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/DefaultHitExplosion.cs index 91e844187a..687c8f788f 100644 --- a/osu.Game.Rulesets.Taiko/UI/DefaultHitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/DefaultHitExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko/UI/DefaultKiaiHitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/DefaultKiaiHitExplosion.cs index 7ce8b016d5..e91475d87b 100644 --- a/osu.Game.Rulesets.Taiko/UI/DefaultKiaiHitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/DefaultKiaiHitExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs index 876fa207bf..264e4db54e 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoMascot.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoMascot.cs index 7ba2618a63..8bedca19d8 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoMascot.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoMascot.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Audio.Track; diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs index 2efc4176f5..b4ea158320 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Taiko/UI/DrumRollHitContainer.cs b/osu.Game.Rulesets.Taiko/UI/DrumRollHitContainer.cs index ae37840825..e0d5a3c680 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumRollHitContainer.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumRollHitContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Taiko.Objects.Drawables; using osu.Game.Rulesets.UI.Scrolling; diff --git a/osu.Game.Rulesets.Taiko/UI/DrumSampleTriggerSource.cs b/osu.Game.Rulesets.Taiko/UI/DrumSampleTriggerSource.cs index 3279d128d3..ef5bd1d7f0 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumSampleTriggerSource.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumSampleTriggerSource.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Audio; using osu.Game.Rulesets.Taiko.Objects; diff --git a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs index 8f5e9e54ab..046b3a6fd0 100644 --- a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osuTK; diff --git a/osu.Game.Rulesets.Taiko/UI/HitExplosionPool.cs b/osu.Game.Rulesets.Taiko/UI/HitExplosionPool.cs index badf34554c..8707f7e840 100644 --- a/osu.Game.Rulesets.Taiko/UI/HitExplosionPool.cs +++ b/osu.Game.Rulesets.Taiko/UI/HitExplosionPool.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Pooling; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Taiko/UI/IAnimatableHitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/IAnimatableHitExplosion.cs index cf0f5f9fb6..6a9d43a0ab 100644 --- a/osu.Game.Rulesets.Taiko/UI/IAnimatableHitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/IAnimatableHitExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Taiko.UI diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index 16be20f7f3..55e920ece2 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs index 20900a9352..319d8979ae 100644 --- a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Taiko/UI/PlayfieldBackgroundLeft.cs b/osu.Game.Rulesets.Taiko/UI/PlayfieldBackgroundLeft.cs index 2a8890a95d..db1094e100 100644 --- a/osu.Game.Rulesets.Taiko/UI/PlayfieldBackgroundLeft.cs +++ b/osu.Game.Rulesets.Taiko/UI/PlayfieldBackgroundLeft.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko/UI/PlayfieldBackgroundRight.cs b/osu.Game.Rulesets.Taiko/UI/PlayfieldBackgroundRight.cs index 44bfdacf37..43252e2e77 100644 --- a/osu.Game.Rulesets.Taiko/UI/PlayfieldBackgroundRight.cs +++ b/osu.Game.Rulesets.Taiko/UI/PlayfieldBackgroundRight.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoHitTarget.cs b/osu.Game.Rulesets.Taiko/UI/TaikoHitTarget.cs index 6401c6d09f..f48ed2c941 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoHitTarget.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoHitTarget.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osuTK.Graphics; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs b/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs index c496c05236..bacd9b41f8 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Audio.Track; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimationState.cs b/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimationState.cs index 02bf245b7b..717f0d725a 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimationState.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimationState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Taiko.UI { public enum TaikoMascotAnimationState diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 2dd332fc13..4e0c8029fb 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfieldAdjustmentContainer.cs index 9cf530e903..8e99a82b1b 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfieldAdjustmentContainer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfieldAdjustmentContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoReplayRecorder.cs b/osu.Game.Rulesets.Taiko/UI/TaikoReplayRecorder.cs index e6391d1386..a76adc495d 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoReplayRecorder.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoReplayRecorder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Taiko.Replays; diff --git a/osu.Game.Tests.Android/MainActivity.cs b/osu.Game.Tests.Android/MainActivity.cs index dbe74a10da..6c4f9bac58 100644 --- a/osu.Game.Tests.Android/MainActivity.cs +++ b/osu.Game.Tests.Android/MainActivity.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Android.App; using osu.Framework.Android; diff --git a/osu.Game.Tests.iOS/AppDelegate.cs b/osu.Game.Tests.iOS/AppDelegate.cs index 1e703e0c0a..b13027459f 100644 --- a/osu.Game.Tests.iOS/AppDelegate.cs +++ b/osu.Game.Tests.iOS/AppDelegate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Foundation; using osu.Framework.iOS; diff --git a/osu.Game.Tests.iOS/Application.cs b/osu.Game.Tests.iOS/Application.cs index 585b495c96..cf36fea139 100644 --- a/osu.Game.Tests.iOS/Application.cs +++ b/osu.Game.Tests.iOS/Application.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.iOS; using UIKit; diff --git a/osu.Game.Tests/Audio/SampleInfoEqualityTest.cs b/osu.Game.Tests/Audio/SampleInfoEqualityTest.cs index 149096608f..d05eb7994b 100644 --- a/osu.Game.Tests/Audio/SampleInfoEqualityTest.cs +++ b/osu.Game.Tests/Audio/SampleInfoEqualityTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Audio; diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index e2d9910b82..9acd3a6cab 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapEncoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapEncoderTest.cs index 0d436c1ef7..09130ac57d 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapEncoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapEncoderTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections; using System.Collections.Generic; diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyDecoderTest.cs index 4334c4d7a2..c1c9e0d118 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyDecoderTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Game.Beatmaps.Formats; diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyScoreDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyScoreDecoderTest.cs index 1474f2d277..aa6fc1f309 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyScoreDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyScoreDecoderTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Globalization; using System.IO; diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyStoryboardDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyStoryboardDecoderTest.cs index 560e2ef894..57dded8ee4 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyStoryboardDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyStoryboardDecoderTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osuTK; diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs index 2eb75259d9..3764467047 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using System.Linq; using DeepEqual.Syntax; diff --git a/osu.Game.Tests/Beatmaps/Formats/ParsingTest.cs b/osu.Game.Tests/Beatmaps/Formats/ParsingTest.cs index 669acc3202..f3673b0e7f 100644 --- a/osu.Game.Tests/Beatmaps/Formats/ParsingTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/ParsingTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; using NUnit.Framework; diff --git a/osu.Game.Tests/Beatmaps/IO/BeatmapImportHelper.cs b/osu.Game.Tests/Beatmaps/IO/BeatmapImportHelper.cs index 9e440c6bce..055832d753 100644 --- a/osu.Game.Tests/Beatmaps/IO/BeatmapImportHelper.cs +++ b/osu.Game.Tests/Beatmaps/IO/BeatmapImportHelper.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.IO; diff --git a/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs index 5e37f01c81..8f20fd7a68 100644 --- a/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Text; diff --git a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs index 810ea5dbd0..04eb9a3fa2 100644 --- a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Beatmaps/SliderEventGenerationTest.cs b/osu.Game.Tests/Beatmaps/SliderEventGenerationTest.cs index 9fba0f1668..d30ab3dea1 100644 --- a/osu.Game.Tests/Beatmaps/SliderEventGenerationTest.cs +++ b/osu.Game.Tests/Beatmaps/SliderEventGenerationTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Tests/Beatmaps/TestSceneBeatmapDifficultyCache.cs b/osu.Game.Tests/Beatmaps/TestSceneBeatmapDifficultyCache.cs index f3456cf8e4..f87e5711a6 100644 --- a/osu.Game.Tests/Beatmaps/TestSceneBeatmapDifficultyCache.cs +++ b/osu.Game.Tests/Beatmaps/TestSceneBeatmapDifficultyCache.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using System.Threading; diff --git a/osu.Game.Tests/Beatmaps/TestSceneEditorBeatmap.cs b/osu.Game.Tests/Beatmaps/TestSceneEditorBeatmap.cs index 153788c2cf..81d0e6f3ef 100644 --- a/osu.Game.Tests/Beatmaps/TestSceneEditorBeatmap.cs +++ b/osu.Game.Tests/Beatmaps/TestSceneEditorBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Beatmaps/ToStringFormattingTest.cs b/osu.Game.Tests/Beatmaps/ToStringFormattingTest.cs index 10cac4ed9d..b4a205b478 100644 --- a/osu.Game.Tests/Beatmaps/ToStringFormattingTest.cs +++ b/osu.Game.Tests/Beatmaps/ToStringFormattingTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Models; diff --git a/osu.Game.Tests/Beatmaps/WorkingBeatmapTest.cs b/osu.Game.Tests/Beatmaps/WorkingBeatmapTest.cs index 5f70f08413..f4b1028c0e 100644 --- a/osu.Game.Tests/Beatmaps/WorkingBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/WorkingBeatmapTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Threading; diff --git a/osu.Game.Tests/Chat/MessageFormatterTests.cs b/osu.Game.Tests/Chat/MessageFormatterTests.cs index cea4d510c1..ebfa9bd8b7 100644 --- a/osu.Game.Tests/Chat/MessageFormatterTests.cs +++ b/osu.Game.Tests/Chat/MessageFormatterTests.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Online.Chat; diff --git a/osu.Game.Tests/Chat/TestSceneChannelManager.cs b/osu.Game.Tests/Chat/TestSceneChannelManager.cs index 2bb6459f20..e7eb06c795 100644 --- a/osu.Game.Tests/Chat/TestSceneChannelManager.cs +++ b/osu.Game.Tests/Chat/TestSceneChannelManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs b/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs index 41bc075803..7f466925a4 100644 --- a/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs +++ b/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Text; diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index 53d13f0d4e..f9cd75d8c3 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game.Tests/Database/FileStoreTests.cs b/osu.Game.Tests/Database/FileStoreTests.cs index 13af05bbbb..ab9b761b8f 100644 --- a/osu.Game.Tests/Database/FileStoreTests.cs +++ b/osu.Game.Tests/Database/FileStoreTests.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Diagnostics; using System.IO; using System.Linq; diff --git a/osu.Game.Tests/Database/GeneralUsageTests.cs b/osu.Game.Tests/Database/GeneralUsageTests.cs index 8262ef18d4..d10ab2ad2b 100644 --- a/osu.Game.Tests/Database/GeneralUsageTests.cs +++ b/osu.Game.Tests/Database/GeneralUsageTests.cs @@ -8,8 +8,6 @@ using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Database; -#nullable enable - namespace osu.Game.Tests.Database { [TestFixture] diff --git a/osu.Game.Tests/Database/LegacyBeatmapImporterTest.cs b/osu.Game.Tests/Database/LegacyBeatmapImporterTest.cs index 2af46374fe..1df3d336ee 100644 --- a/osu.Game.Tests/Database/LegacyBeatmapImporterTest.cs +++ b/osu.Game.Tests/Database/LegacyBeatmapImporterTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/osu.Game.Tests/Database/RealmLiveTests.cs b/osu.Game.Tests/Database/RealmLiveTests.cs index 4bc1f5078a..416216062e 100644 --- a/osu.Game.Tests/Database/RealmLiveTests.cs +++ b/osu.Game.Tests/Database/RealmLiveTests.cs @@ -12,8 +12,6 @@ using osu.Game.Beatmaps; using osu.Game.Database; using Realms; -#nullable enable - namespace osu.Game.Tests.Database { public class RealmLiveTests : RealmTest diff --git a/osu.Game.Tests/Database/RealmSubscriptionRegistrationTests.cs b/osu.Game.Tests/Database/RealmSubscriptionRegistrationTests.cs index d99bcc092d..b8ce036da1 100644 --- a/osu.Game.Tests/Database/RealmSubscriptionRegistrationTests.cs +++ b/osu.Game.Tests/Database/RealmSubscriptionRegistrationTests.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Database/RealmTest.cs b/osu.Game.Tests/Database/RealmTest.cs index 16072888b9..d6b3c1ff44 100644 --- a/osu.Game.Tests/Database/RealmTest.cs +++ b/osu.Game.Tests/Database/RealmTest.cs @@ -15,8 +15,6 @@ using osu.Game.IO; using osu.Game.Models; using osu.Game.Rulesets; -#nullable enable - namespace osu.Game.Tests.Database { [TestFixture] diff --git a/osu.Game.Tests/Database/RulesetStoreTests.cs b/osu.Game.Tests/Database/RulesetStoreTests.cs index f48b5cba11..795e90f543 100644 --- a/osu.Game.Tests/Database/RulesetStoreTests.cs +++ b/osu.Game.Tests/Database/RulesetStoreTests.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Game.Rulesets; diff --git a/osu.Game.Tests/Database/TestRealmKeyBindingStore.cs b/osu.Game.Tests/Database/TestRealmKeyBindingStore.cs index 891801865f..362b37124d 100644 --- a/osu.Game.Tests/Database/TestRealmKeyBindingStore.cs +++ b/osu.Game.Tests/Database/TestRealmKeyBindingStore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs b/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs index 614b9b4ac1..947e884494 100644 --- a/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using System.Linq; using Moq; diff --git a/osu.Game.Tests/Editing/Checks/CheckAudioQualityTest.cs b/osu.Game.Tests/Editing/Checks/CheckAudioQualityTest.cs index e22dfa5f8b..9fdd49823e 100644 --- a/osu.Game.Tests/Editing/Checks/CheckAudioQualityTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckAudioQualityTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using Moq; using NUnit.Framework; diff --git a/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs b/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs index bb560054a3..af5588f509 100644 --- a/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game.Tests/Editing/Checks/CheckConcurrentObjectsTest.cs b/osu.Game.Tests/Editing/Checks/CheckConcurrentObjectsTest.cs index 5adb91a22e..9c1dd2c1e8 100644 --- a/osu.Game.Tests/Editing/Checks/CheckConcurrentObjectsTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckConcurrentObjectsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using Moq; diff --git a/osu.Game.Tests/Editing/Checks/CheckFewHitsoundsTest.cs b/osu.Game.Tests/Editing/Checks/CheckFewHitsoundsTest.cs index cf5b3a42a4..82bb2e59c9 100644 --- a/osu.Game.Tests/Editing/Checks/CheckFewHitsoundsTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckFewHitsoundsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Editing/Checks/CheckFilePresenceTest.cs b/osu.Game.Tests/Editing/Checks/CheckFilePresenceTest.cs index 01baaadc7d..2f18720a5b 100644 --- a/osu.Game.Tests/Editing/Checks/CheckFilePresenceTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckFilePresenceTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Game.Beatmaps; diff --git a/osu.Game.Tests/Editing/Checks/CheckMutedObjectsTest.cs b/osu.Game.Tests/Editing/Checks/CheckMutedObjectsTest.cs index 91d9a8753c..622386405a 100644 --- a/osu.Game.Tests/Editing/Checks/CheckMutedObjectsTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckMutedObjectsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Editing/Checks/CheckTestHelpers.cs b/osu.Game.Tests/Editing/Checks/CheckTestHelpers.cs index 9067714ff9..405738cd55 100644 --- a/osu.Game.Tests/Editing/Checks/CheckTestHelpers.cs +++ b/osu.Game.Tests/Editing/Checks/CheckTestHelpers.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Models; namespace osu.Game.Tests.Editing.Checks diff --git a/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs b/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs index 53c85defae..7d33b92dbe 100644 --- a/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using System.IO; using System.Linq; diff --git a/osu.Game.Tests/Editing/Checks/CheckUnsnappedObjectsTest.cs b/osu.Game.Tests/Editing/Checks/CheckUnsnappedObjectsTest.cs index 882baba8fa..f647bf8d8e 100644 --- a/osu.Game.Tests/Editing/Checks/CheckUnsnappedObjectsTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckUnsnappedObjectsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using Moq; diff --git a/osu.Game.Tests/Editing/Checks/CheckZeroByteFilesTest.cs b/osu.Game.Tests/Editing/Checks/CheckZeroByteFilesTest.cs index 79d00e6a60..793cc70a3f 100644 --- a/osu.Game.Tests/Editing/Checks/CheckZeroByteFilesTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckZeroByteFilesTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using System.Linq; using Moq; diff --git a/osu.Game.Tests/Editing/Checks/CheckZeroLengthObjectsTest.cs b/osu.Game.Tests/Editing/Checks/CheckZeroLengthObjectsTest.cs index 93b20cd166..1c1965ab56 100644 --- a/osu.Game.Tests/Editing/Checks/CheckZeroLengthObjectsTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckZeroLengthObjectsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using Moq; diff --git a/osu.Game.Tests/Editing/Checks/MockNestableHitObject.cs b/osu.Game.Tests/Editing/Checks/MockNestableHitObject.cs index 29938839d3..6c0306d63d 100644 --- a/osu.Game.Tests/Editing/Checks/MockNestableHitObject.cs +++ b/osu.Game.Tests/Editing/Checks/MockNestableHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Threading; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Tests/Editing/EditorChangeHandlerTest.cs b/osu.Game.Tests/Editing/EditorChangeHandlerTest.cs index 2d61948a2a..e1accd5b5f 100644 --- a/osu.Game.Tests/Editing/EditorChangeHandlerTest.cs +++ b/osu.Game.Tests/Editing/EditorChangeHandlerTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Beatmaps; diff --git a/osu.Game.Tests/Editing/LegacyEditorBeatmapPatcherTest.cs b/osu.Game.Tests/Editing/LegacyEditorBeatmapPatcherTest.cs index 44a908b756..5af0366e6e 100644 --- a/osu.Game.Tests/Editing/LegacyEditorBeatmapPatcherTest.cs +++ b/osu.Game.Tests/Editing/LegacyEditorBeatmapPatcherTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using System.Text; using NUnit.Framework; diff --git a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs index 82fc7a208b..c2df9e5e09 100644 --- a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs +++ b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Editing/TestSceneHitObjectContainerEventBuffer.cs b/osu.Game.Tests/Editing/TestSceneHitObjectContainerEventBuffer.cs index 592971dbaf..c3e171684c 100644 --- a/osu.Game.Tests/Editing/TestSceneHitObjectContainerEventBuffer.cs +++ b/osu.Game.Tests/Editing/TestSceneHitObjectContainerEventBuffer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Editing/TransactionalCommitComponentTest.cs b/osu.Game.Tests/Editing/TransactionalCommitComponentTest.cs index 4ce9115ec4..3d7286c396 100644 --- a/osu.Game.Tests/Editing/TransactionalCommitComponentTest.cs +++ b/osu.Game.Tests/Editing/TransactionalCommitComponentTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Game.Screens.Edit; diff --git a/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs b/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs index a354464a8e..f9c4985219 100644 --- a/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs +++ b/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Gameplay/TestSceneDrawableHitObject.cs b/osu.Game.Tests/Gameplay/TestSceneDrawableHitObject.cs index 58f4c4c8db..91e33b759c 100644 --- a/osu.Game.Tests/Gameplay/TestSceneDrawableHitObject.cs +++ b/osu.Game.Tests/Gameplay/TestSceneDrawableHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Testing; diff --git a/osu.Game.Tests/Gameplay/TestSceneHitObjectAccentColour.cs b/osu.Game.Tests/Gameplay/TestSceneHitObjectAccentColour.cs index 5553c67141..1e10fbb2bc 100644 --- a/osu.Game.Tests/Gameplay/TestSceneHitObjectAccentColour.cs +++ b/osu.Game.Tests/Gameplay/TestSceneHitObjectAccentColour.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using NUnit.Framework; diff --git a/osu.Game.Tests/Gameplay/TestSceneHitObjectContainer.cs b/osu.Game.Tests/Gameplay/TestSceneHitObjectContainer.cs index f2bfccb6de..79e64ba2a2 100644 --- a/osu.Game.Tests/Gameplay/TestSceneHitObjectContainer.cs +++ b/osu.Game.Tests/Gameplay/TestSceneHitObjectContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Tests/Gameplay/TestSceneHitObjectSamples.cs b/osu.Game.Tests/Gameplay/TestSceneHitObjectSamples.cs index 153d5b8e36..e25d08f98c 100644 --- a/osu.Game.Tests/Gameplay/TestSceneHitObjectSamples.cs +++ b/osu.Game.Tests/Gameplay/TestSceneHitObjectSamples.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.IO.Stores; using osu.Game.Rulesets; diff --git a/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs b/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs index 5c04ac88a7..ced397921c 100644 --- a/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs +++ b/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game.Tests/Gameplay/TestSceneProxyContainer.cs b/osu.Game.Tests/Gameplay/TestSceneProxyContainer.cs index 1264d575a4..1893e43f43 100644 --- a/osu.Game.Tests/Gameplay/TestSceneProxyContainer.cs +++ b/osu.Game.Tests/Gameplay/TestSceneProxyContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Gameplay/TestSceneScoreProcessor.cs b/osu.Game.Tests/Gameplay/TestSceneScoreProcessor.cs index 97be1dcfaa..9e1d786d87 100644 --- a/osu.Game.Tests/Gameplay/TestSceneScoreProcessor.cs +++ b/osu.Game.Tests/Gameplay/TestSceneScoreProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using NUnit.Framework; diff --git a/osu.Game.Tests/Gameplay/TestSceneStoryboardSamples.cs b/osu.Game.Tests/Gameplay/TestSceneStoryboardSamples.cs index e0a497cf24..a9c6bacc65 100644 --- a/osu.Game.Tests/Gameplay/TestSceneStoryboardSamples.cs +++ b/osu.Game.Tests/Gameplay/TestSceneStoryboardSamples.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.IO; using System.Threading; diff --git a/osu.Game.Tests/ImportTest.cs b/osu.Game.Tests/ImportTest.cs index a658a0eaeb..32b6dc649c 100644 --- a/osu.Game.Tests/ImportTest.cs +++ b/osu.Game.Tests/ImportTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading; using System.Threading.Tasks; diff --git a/osu.Game.Tests/Input/ConfineMouseTrackerTest.cs b/osu.Game.Tests/Input/ConfineMouseTrackerTest.cs index 28937b2120..a91d4553de 100644 --- a/osu.Game.Tests/Input/ConfineMouseTrackerTest.cs +++ b/osu.Game.Tests/Input/ConfineMouseTrackerTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Configuration; diff --git a/osu.Game.Tests/Localisation/BeatmapMetadataRomanisationTest.cs b/osu.Game.Tests/Localisation/BeatmapMetadataRomanisationTest.cs index 9926acf772..d01eaca714 100644 --- a/osu.Game.Tests/Localisation/BeatmapMetadataRomanisationTest.cs +++ b/osu.Game.Tests/Localisation/BeatmapMetadataRomanisationTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; diff --git a/osu.Game.Tests/Models/DisplayStringTest.cs b/osu.Game.Tests/Models/DisplayStringTest.cs index 2d0bda88e4..d585a0eb9f 100644 --- a/osu.Game.Tests/Models/DisplayStringTest.cs +++ b/osu.Game.Tests/Models/DisplayStringTest.cs @@ -10,8 +10,6 @@ using osu.Game.Rulesets; using osu.Game.Scoring; using osu.Game.Users; -#nullable enable - namespace osu.Game.Tests.Models { [TestFixture] diff --git a/osu.Game.Tests/Mods/ModDifficultyAdjustTest.cs b/osu.Game.Tests/Mods/ModDifficultyAdjustTest.cs index 85b4688eb9..a6f68b2836 100644 --- a/osu.Game.Tests/Mods/ModDifficultyAdjustTest.cs +++ b/osu.Game.Tests/Mods/ModDifficultyAdjustTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Game.Beatmaps; diff --git a/osu.Game.Tests/Mods/ModSettingsEqualityComparison.cs b/osu.Game.Tests/Mods/ModSettingsEqualityComparison.cs index cd6879cf01..e94ee40acd 100644 --- a/osu.Game.Tests/Mods/ModSettingsEqualityComparison.cs +++ b/osu.Game.Tests/Mods/ModSettingsEqualityComparison.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Online.API; using osu.Game.Rulesets.Osu; diff --git a/osu.Game.Tests/Mods/ModSettingsTest.cs b/osu.Game.Tests/Mods/ModSettingsTest.cs index b9ea1f2567..607b585d33 100644 --- a/osu.Game.Tests/Mods/ModSettingsTest.cs +++ b/osu.Game.Tests/Mods/ModSettingsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Mods; diff --git a/osu.Game.Tests/Mods/ModUtilsTest.cs b/osu.Game.Tests/Mods/ModUtilsTest.cs index 6c9dddf51f..22be1a3f01 100644 --- a/osu.Game.Tests/Mods/ModUtilsTest.cs +++ b/osu.Game.Tests/Mods/ModUtilsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using Moq; diff --git a/osu.Game.Tests/Mods/MultiModIncompatibilityTest.cs b/osu.Game.Tests/Mods/MultiModIncompatibilityTest.cs index 312b939315..3c69adcb59 100644 --- a/osu.Game.Tests/Mods/MultiModIncompatibilityTest.cs +++ b/osu.Game.Tests/Mods/MultiModIncompatibilityTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Mods/SettingsSourceAttributeTest.cs b/osu.Game.Tests/Mods/SettingsSourceAttributeTest.cs index dd105787fa..f608d020d4 100644 --- a/osu.Game.Tests/Mods/SettingsSourceAttributeTest.cs +++ b/osu.Game.Tests/Mods/SettingsSourceAttributeTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Mods/TestCustomisableModRuleset.cs b/osu.Game.Tests/Mods/TestCustomisableModRuleset.cs index 3992d9abe6..08007503c6 100644 --- a/osu.Game.Tests/Mods/TestCustomisableModRuleset.cs +++ b/osu.Game.Tests/Mods/TestCustomisableModRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/NonVisual/BarLineGeneratorTest.cs b/osu.Game.Tests/NonVisual/BarLineGeneratorTest.cs index 6ae8231deb..e7827a7398 100644 --- a/osu.Game.Tests/NonVisual/BarLineGeneratorTest.cs +++ b/osu.Game.Tests/NonVisual/BarLineGeneratorTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Utils; diff --git a/osu.Game.Tests/NonVisual/BeatmapSetInfoEqualityTest.cs b/osu.Game.Tests/NonVisual/BeatmapSetInfoEqualityTest.cs index 1b6049fcb7..de23b012c1 100644 --- a/osu.Game.Tests/NonVisual/BeatmapSetInfoEqualityTest.cs +++ b/osu.Game.Tests/NonVisual/BeatmapSetInfoEqualityTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Game.Beatmaps; diff --git a/osu.Game.Tests/NonVisual/ClosestBeatDivisorTest.cs b/osu.Game.Tests/NonVisual/ClosestBeatDivisorTest.cs index 08cd80dcfa..6f3fe875e3 100644 --- a/osu.Game.Tests/NonVisual/ClosestBeatDivisorTest.cs +++ b/osu.Game.Tests/NonVisual/ClosestBeatDivisorTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Game.Beatmaps; diff --git a/osu.Game.Tests/NonVisual/ControlPointInfoTest.cs b/osu.Game.Tests/NonVisual/ControlPointInfoTest.cs index cfda4f6422..554473cf77 100644 --- a/osu.Game.Tests/NonVisual/ControlPointInfoTest.cs +++ b/osu.Game.Tests/NonVisual/ControlPointInfoTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs b/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs index fd5691a9f4..7d5f0bcd0c 100644 --- a/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs +++ b/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs b/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs index ae8eec2629..8d1c266473 100644 --- a/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs +++ b/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs b/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs index 33204d33a7..2657468b03 100644 --- a/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs +++ b/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets; diff --git a/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs b/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs index 460f89528b..500f3159e2 100644 --- a/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs +++ b/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Game.Beatmaps; diff --git a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs index 8386a10ebb..a779fae510 100644 --- a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs +++ b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/osu.Game.Tests/NonVisual/FormatUtilsTest.cs b/osu.Game.Tests/NonVisual/FormatUtilsTest.cs index d69822cdc5..4d2fc53bc3 100644 --- a/osu.Game.Tests/NonVisual/FormatUtilsTest.cs +++ b/osu.Game.Tests/NonVisual/FormatUtilsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Utils; diff --git a/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs b/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs index 99d394b454..4a5bb6de46 100644 --- a/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs +++ b/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/NonVisual/GameplayClockTest.cs b/osu.Game.Tests/NonVisual/GameplayClockTest.cs index 3fd7c364b7..5b8aacd281 100644 --- a/osu.Game.Tests/NonVisual/GameplayClockTest.cs +++ b/osu.Game.Tests/NonVisual/GameplayClockTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/NonVisual/LimitedCapacityQueueTest.cs b/osu.Game.Tests/NonVisual/LimitedCapacityQueueTest.cs index e1eaf213d6..8cd26901c5 100644 --- a/osu.Game.Tests/NonVisual/LimitedCapacityQueueTest.cs +++ b/osu.Game.Tests/NonVisual/LimitedCapacityQueueTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Game.Rulesets.Difficulty.Utils; diff --git a/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs b/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs index 4adb7002a0..9c8b977ad9 100644 --- a/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs +++ b/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using Humanizer; using NUnit.Framework; diff --git a/osu.Game.Tests/NonVisual/OngoingOperationTrackerTest.cs b/osu.Game.Tests/NonVisual/OngoingOperationTrackerTest.cs index 10216c3339..03ca3a0a1a 100644 --- a/osu.Game.Tests/NonVisual/OngoingOperationTrackerTest.cs +++ b/osu.Game.Tests/NonVisual/OngoingOperationTrackerTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/NonVisual/PeriodTrackerTest.cs b/osu.Game.Tests/NonVisual/PeriodTrackerTest.cs index 62c7732b66..b589f7c9f1 100644 --- a/osu.Game.Tests/NonVisual/PeriodTrackerTest.cs +++ b/osu.Game.Tests/NonVisual/PeriodTrackerTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/NonVisual/Ranking/UnstableRateTest.cs b/osu.Game.Tests/NonVisual/Ranking/UnstableRateTest.cs index 103831822c..27c8270f0f 100644 --- a/osu.Game.Tests/NonVisual/Ranking/UnstableRateTest.cs +++ b/osu.Game.Tests/NonVisual/Ranking/UnstableRateTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/NonVisual/ReverseQueueTest.cs b/osu.Game.Tests/NonVisual/ReverseQueueTest.cs index 808c8d14f0..d0ad2e22a4 100644 --- a/osu.Game.Tests/NonVisual/ReverseQueueTest.cs +++ b/osu.Game.Tests/NonVisual/ReverseQueueTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Game.Rulesets.Difficulty.Utils; diff --git a/osu.Game.Tests/NonVisual/RulesetInfoOrderingTest.cs b/osu.Game.Tests/NonVisual/RulesetInfoOrderingTest.cs index ae999d08d5..8654abd49d 100644 --- a/osu.Game.Tests/NonVisual/RulesetInfoOrderingTest.cs +++ b/osu.Game.Tests/NonVisual/RulesetInfoOrderingTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Game.Rulesets; diff --git a/osu.Game.Tests/NonVisual/ScoreInfoTest.cs b/osu.Game.Tests/NonVisual/ScoreInfoTest.cs index 41b08a9e98..dcc4f91dba 100644 --- a/osu.Game.Tests/NonVisual/ScoreInfoTest.cs +++ b/osu.Game.Tests/NonVisual/ScoreInfoTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Online.API; using osu.Game.Rulesets.Mania; diff --git a/osu.Game.Tests/NonVisual/SessionStaticsTest.cs b/osu.Game.Tests/NonVisual/SessionStaticsTest.cs index cd02f15adf..5c8254b947 100644 --- a/osu.Game.Tests/NonVisual/SessionStaticsTest.cs +++ b/osu.Game.Tests/NonVisual/SessionStaticsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Game.Configuration; diff --git a/osu.Game.Tests/NonVisual/Skinning/LegacySkinAnimationTest.cs b/osu.Game.Tests/NonVisual/Skinning/LegacySkinAnimationTest.cs index 4209f188cc..e21a3e636f 100644 --- a/osu.Game.Tests/NonVisual/Skinning/LegacySkinAnimationTest.cs +++ b/osu.Game.Tests/NonVisual/Skinning/LegacySkinAnimationTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs b/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs index 76c49edf78..efab884d37 100644 --- a/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs +++ b/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game.Tests/NonVisual/TaskChainTest.cs b/osu.Game.Tests/NonVisual/TaskChainTest.cs index 3678279035..ad1a3fd63f 100644 --- a/osu.Game.Tests/NonVisual/TaskChainTest.cs +++ b/osu.Game.Tests/NonVisual/TaskChainTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading; using System.Threading.Tasks; using NUnit.Framework; diff --git a/osu.Game.Tests/NonVisual/TimeDisplayExtensionTest.cs b/osu.Game.Tests/NonVisual/TimeDisplayExtensionTest.cs index 97d7880def..861e342cdb 100644 --- a/osu.Game.Tests/NonVisual/TimeDisplayExtensionTest.cs +++ b/osu.Game.Tests/NonVisual/TimeDisplayExtensionTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Game.Extensions; diff --git a/osu.Game.Tests/Online/Chat/MessageNotifierTest.cs b/osu.Game.Tests/Online/Chat/MessageNotifierTest.cs index 855de9b656..13f1ed5c57 100644 --- a/osu.Game.Tests/Online/Chat/MessageNotifierTest.cs +++ b/osu.Game.Tests/Online/Chat/MessageNotifierTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Online.Chat; diff --git a/osu.Game.Tests/Online/TestAPIModJsonSerialization.cs b/osu.Game.Tests/Online/TestAPIModJsonSerialization.cs index 0622514783..185f85513b 100644 --- a/osu.Game.Tests/Online/TestAPIModJsonSerialization.cs +++ b/osu.Game.Tests/Online/TestAPIModJsonSerialization.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game.Tests/Online/TestAPIModMessagePackSerialization.cs b/osu.Game.Tests/Online/TestAPIModMessagePackSerialization.cs index 69e19826fd..a89d68bf15 100644 --- a/osu.Game.Tests/Online/TestAPIModMessagePackSerialization.cs +++ b/osu.Game.Tests/Online/TestAPIModMessagePackSerialization.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using MessagePack; using NUnit.Framework; diff --git a/osu.Game.Tests/Online/TestDummyAPIRequestHandling.cs b/osu.Game.Tests/Online/TestDummyAPIRequestHandling.cs index 91c6b6c008..61fdae0ca1 100644 --- a/osu.Game.Tests/Online/TestDummyAPIRequestHandling.cs +++ b/osu.Game.Tests/Online/TestDummyAPIRequestHandling.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Testing; using osu.Game.Online.API; diff --git a/osu.Game.Tests/Online/TestMultiplayerMessagePackSerialization.cs b/osu.Game.Tests/Online/TestMultiplayerMessagePackSerialization.cs index 81475f2fbe..aea579a82d 100644 --- a/osu.Game.Tests/Online/TestMultiplayerMessagePackSerialization.cs +++ b/osu.Game.Tests/Online/TestMultiplayerMessagePackSerialization.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using MessagePack; using NUnit.Framework; using osu.Game.Online; diff --git a/osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs b/osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs index ad9ea79646..d0176da0e9 100644 --- a/osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs +++ b/osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Testing; diff --git a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs index c26d7937ad..e502a71f34 100644 --- a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs +++ b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game.Tests/Online/TestSubmittableScoreJsonSerialization.cs b/osu.Game.Tests/Online/TestSubmittableScoreJsonSerialization.cs index 662660bce4..f0f6727393 100644 --- a/osu.Game.Tests/Online/TestSubmittableScoreJsonSerialization.cs +++ b/osu.Game.Tests/Online/TestSubmittableScoreJsonSerialization.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; using NUnit.Framework; using osu.Game.IO.Serialization; diff --git a/osu.Game.Tests/OnlinePlay/PlaylistExtensionsTest.cs b/osu.Game.Tests/OnlinePlay/PlaylistExtensionsTest.cs index 9e7ea02101..73ed2bb868 100644 --- a/osu.Game.Tests/OnlinePlay/PlaylistExtensionsTest.cs +++ b/osu.Game.Tests/OnlinePlay/PlaylistExtensionsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game.Tests/OnlinePlay/TestSceneCatchUpSyncManager.cs b/osu.Game.Tests/OnlinePlay/TestSceneCatchUpSyncManager.cs index 6851df3832..6c639ee539 100644 --- a/osu.Game.Tests/OnlinePlay/TestSceneCatchUpSyncManager.cs +++ b/osu.Game.Tests/OnlinePlay/TestSceneCatchUpSyncManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Resources/TestResources.cs b/osu.Game.Tests/Resources/TestResources.cs index 81b624f908..91d4eb70e8 100644 --- a/osu.Game.Tests/Resources/TestResources.cs +++ b/osu.Game.Tests/Resources/TestResources.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game.Tests/Rulesets/Mods/ModTimeRampTest.cs b/osu.Game.Tests/Rulesets/Mods/ModTimeRampTest.cs index 51163efd6a..2622db464f 100644 --- a/osu.Game.Tests/Rulesets/Mods/ModTimeRampTest.cs +++ b/osu.Game.Tests/Rulesets/Mods/ModTimeRampTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Audio.Track; using osu.Framework.Timing; diff --git a/osu.Game.Tests/Rulesets/Scoring/ScoreProcessorTest.cs b/osu.Game.Tests/Rulesets/Scoring/ScoreProcessorTest.cs index 7ecd509193..ff282fff62 100644 --- a/osu.Game.Tests/Rulesets/Scoring/ScoreProcessorTest.cs +++ b/osu.Game.Tests/Rulesets/Scoring/ScoreProcessorTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Rulesets/TestSceneDrawableRulesetDependencies.cs b/osu.Game.Tests/Rulesets/TestSceneDrawableRulesetDependencies.cs index 20439ac969..9f732be9e3 100644 --- a/osu.Game.Tests/Rulesets/TestSceneDrawableRulesetDependencies.cs +++ b/osu.Game.Tests/Rulesets/TestSceneDrawableRulesetDependencies.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game.Tests/Rulesets/TestSceneRulesetSkinProvidingContainer.cs b/osu.Game.Tests/Rulesets/TestSceneRulesetSkinProvidingContainer.cs index 28ad7ed6a7..f1ecd3b526 100644 --- a/osu.Game.Tests/Rulesets/TestSceneRulesetSkinProvidingContainer.cs +++ b/osu.Game.Tests/Rulesets/TestSceneRulesetSkinProvidingContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Scores/IO/ImportScoreTest.cs b/osu.Game.Tests/Scores/IO/ImportScoreTest.cs index 8de9f0a292..892ceea185 100644 --- a/osu.Game.Tests/Scores/IO/ImportScoreTest.cs +++ b/osu.Game.Tests/Scores/IO/ImportScoreTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game.Tests/Scores/IO/TestScoreEquality.cs b/osu.Game.Tests/Scores/IO/TestScoreEquality.cs index f898774ce6..d44fd786d7 100644 --- a/osu.Game.Tests/Scores/IO/TestScoreEquality.cs +++ b/osu.Game.Tests/Scores/IO/TestScoreEquality.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Game.Scoring; diff --git a/osu.Game.Tests/ScrollAlgorithms/ConstantScrollTest.cs b/osu.Game.Tests/ScrollAlgorithms/ConstantScrollTest.cs index a6e8622b6f..0994803d83 100644 --- a/osu.Game.Tests/ScrollAlgorithms/ConstantScrollTest.cs +++ b/osu.Game.Tests/ScrollAlgorithms/ConstantScrollTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets.UI.Scrolling.Algorithms; diff --git a/osu.Game.Tests/ScrollAlgorithms/OverlappingScrollTest.cs b/osu.Game.Tests/ScrollAlgorithms/OverlappingScrollTest.cs index 1429d22c1a..c1f647cb07 100644 --- a/osu.Game.Tests/ScrollAlgorithms/OverlappingScrollTest.cs +++ b/osu.Game.Tests/ScrollAlgorithms/OverlappingScrollTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Lists; using osu.Game.Rulesets.Timing; diff --git a/osu.Game.Tests/ScrollAlgorithms/SequentialScrollTest.cs b/osu.Game.Tests/ScrollAlgorithms/SequentialScrollTest.cs index bd578dcbc4..ca6ac63619 100644 --- a/osu.Game.Tests/ScrollAlgorithms/SequentialScrollTest.cs +++ b/osu.Game.Tests/ScrollAlgorithms/SequentialScrollTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Lists; using osu.Game.Rulesets.Timing; diff --git a/osu.Game.Tests/Skins/IO/ImportSkinTest.cs b/osu.Game.Tests/Skins/IO/ImportSkinTest.cs index dde8715764..4db88cbe82 100644 --- a/osu.Game.Tests/Skins/IO/ImportSkinTest.cs +++ b/osu.Game.Tests/Skins/IO/ImportSkinTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game.Tests/Skins/LegacyManiaSkinDecoderTest.cs b/osu.Game.Tests/Skins/LegacyManiaSkinDecoderTest.cs index e811979aed..6da335a9b7 100644 --- a/osu.Game.Tests/Skins/LegacyManiaSkinDecoderTest.cs +++ b/osu.Game.Tests/Skins/LegacyManiaSkinDecoderTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.IO; using osu.Game.Skinning; diff --git a/osu.Game.Tests/Skins/LegacySkinDecoderTest.cs b/osu.Game.Tests/Skins/LegacySkinDecoderTest.cs index cfc140ce39..419eb87b1a 100644 --- a/osu.Game.Tests/Skins/LegacySkinDecoderTest.cs +++ b/osu.Game.Tests/Skins/LegacySkinDecoderTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Game.IO; diff --git a/osu.Game.Tests/Skins/TestSceneBeatmapSkinLookupDisables.cs b/osu.Game.Tests/Skins/TestSceneBeatmapSkinLookupDisables.cs index 0c1981b35d..77ceef6402 100644 --- a/osu.Game.Tests/Skins/TestSceneBeatmapSkinLookupDisables.cs +++ b/osu.Game.Tests/Skins/TestSceneBeatmapSkinLookupDisables.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Skins/TestSceneBeatmapSkinResources.cs b/osu.Game.Tests/Skins/TestSceneBeatmapSkinResources.cs index fe0423dcfc..bd7e1f8ec5 100644 --- a/osu.Game.Tests/Skins/TestSceneBeatmapSkinResources.cs +++ b/osu.Game.Tests/Skins/TestSceneBeatmapSkinResources.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio.Track; diff --git a/osu.Game.Tests/Skins/TestSceneSkinConfigurationLookup.cs b/osu.Game.Tests/Skins/TestSceneSkinConfigurationLookup.cs index d68398236a..5452bfc939 100644 --- a/osu.Game.Tests/Skins/TestSceneSkinConfigurationLookup.cs +++ b/osu.Game.Tests/Skins/TestSceneSkinConfigurationLookup.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game.Tests/Skins/TestSceneSkinProvidingContainer.cs b/osu.Game.Tests/Skins/TestSceneSkinProvidingContainer.cs index ffb3d41d18..1229b63a90 100644 --- a/osu.Game.Tests/Skins/TestSceneSkinProvidingContainer.cs +++ b/osu.Game.Tests/Skins/TestSceneSkinProvidingContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Skins/TestSceneSkinResources.cs b/osu.Game.Tests/Skins/TestSceneSkinResources.cs index 0271198049..97588f4053 100644 --- a/osu.Game.Tests/Skins/TestSceneSkinResources.cs +++ b/osu.Game.Tests/Skins/TestSceneSkinResources.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Extensions; diff --git a/osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs b/osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs index 330d3dd2ae..79b44c109a 100644 --- a/osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs +++ b/osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using NUnit.Framework; diff --git a/osu.Game.Tests/Utils/NamingUtilsTest.cs b/osu.Game.Tests/Utils/NamingUtilsTest.cs index 62e688db90..2195933197 100644 --- a/osu.Game.Tests/Utils/NamingUtilsTest.cs +++ b/osu.Game.Tests/Utils/NamingUtilsTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Game.Utils; diff --git a/osu.Game.Tests/Visual/Audio/TestSceneAudioFilter.cs b/osu.Game.Tests/Visual/Audio/TestSceneAudioFilter.cs index 99be72e958..15903b2074 100644 --- a/osu.Game.Tests/Visual/Audio/TestSceneAudioFilter.cs +++ b/osu.Game.Tests/Visual/Audio/TestSceneAudioFilter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using ManagedBass.Fx; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenDefault.cs b/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenDefault.cs index 884e74346b..5aaaca2b2c 100644 --- a/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenDefault.cs +++ b/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenDefault.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Background/TestSceneSeasonalBackgroundLoader.cs b/osu.Game.Tests/Visual/Background/TestSceneSeasonalBackgroundLoader.cs index 0bd1263076..a44ab41d03 100644 --- a/osu.Game.Tests/Visual/Background/TestSceneSeasonalBackgroundLoader.cs +++ b/osu.Game.Tests/Visual/Background/TestSceneSeasonalBackgroundLoader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs b/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs index ef115ab66b..aaccea09d4 100644 --- a/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs +++ b/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Background/TestSceneUserDimContainer.cs b/osu.Game.Tests/Visual/Background/TestSceneUserDimContainer.cs index fede99f450..7cad6f504b 100644 --- a/osu.Game.Tests/Visual/Background/TestSceneUserDimContainer.cs +++ b/osu.Game.Tests/Visual/Background/TestSceneUserDimContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs index 6cb171974a..6bcc45d97e 100644 --- a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs +++ b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardDifficultyList.cs b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardDifficultyList.cs index e6fb4372ff..b609b06921 100644 --- a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardDifficultyList.cs +++ b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardDifficultyList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardDownloadButton.cs b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardDownloadButton.cs index 068d2bdcbd..3308ffe714 100644 --- a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardDownloadButton.cs +++ b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardDownloadButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardFavouriteButton.cs b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardFavouriteButton.cs index 77c9debef6..2fe2264348 100644 --- a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardFavouriteButton.cs +++ b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardFavouriteButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardThumbnail.cs b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardThumbnail.cs index a5b52f75f6..0af876bfe8 100644 --- a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardThumbnail.cs +++ b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCardThumbnail.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapSetOnlineStatusPill.cs b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapSetOnlineStatusPill.cs index 8132fe6ab8..ada521f7f6 100644 --- a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapSetOnlineStatusPill.cs +++ b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapSetOnlineStatusPill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Beatmaps/TestSceneDifficultySpectrumDisplay.cs b/osu.Game.Tests/Visual/Beatmaps/TestSceneDifficultySpectrumDisplay.cs index 4063fa1252..94b2d10fcf 100644 --- a/osu.Game.Tests/Visual/Beatmaps/TestSceneDifficultySpectrumDisplay.cs +++ b/osu.Game.Tests/Visual/Beatmaps/TestSceneDifficultySpectrumDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs b/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs index 602c7c84b8..3f30fa367c 100644 --- a/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs +++ b/osu.Game.Tests/Visual/Collections/TestSceneManageCollectionsDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Colours/TestSceneStarDifficultyColours.cs b/osu.Game.Tests/Visual/Colours/TestSceneStarDifficultyColours.cs index c345320e28..13d7a33600 100644 --- a/osu.Game.Tests/Visual/Colours/TestSceneStarDifficultyColours.cs +++ b/osu.Game.Tests/Visual/Colours/TestSceneStarDifficultyColours.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Components/TestSceneIdleTracker.cs b/osu.Game.Tests/Visual/Components/TestSceneIdleTracker.cs index 86a9d555a3..9dd75b6e5e 100644 --- a/osu.Game.Tests/Visual/Components/TestSceneIdleTracker.cs +++ b/osu.Game.Tests/Visual/Components/TestSceneIdleTracker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Components/TestScenePollingComponent.cs b/osu.Game.Tests/Visual/Components/TestScenePollingComponent.cs index cc8503589d..3c89267610 100644 --- a/osu.Game.Tests/Visual/Components/TestScenePollingComponent.cs +++ b/osu.Game.Tests/Visual/Components/TestScenePollingComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading.Tasks; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs b/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs index 82b6710a17..cb29475ba5 100644 --- a/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs +++ b/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs b/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs index 073a228224..ecd7732862 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneBeatDivisorControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneBlueprintOrdering.cs b/osu.Game.Tests/Visual/Editing/TestSceneBlueprintOrdering.cs index 5d8a6dabd7..796a3cf9fc 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneBlueprintOrdering.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneBlueprintOrdering.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs b/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs index fa15c00cd4..6b5d9af7af 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneComposeSelectBox.cs b/osu.Game.Tests/Visual/Editing/TestSceneComposeSelectBox.cs index 87dbb90138..52e44efb30 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneComposeSelectBox.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneComposeSelectBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs b/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs index 17ca9da8f8..31fc107892 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneDesignSection.cs b/osu.Game.Tests/Visual/Editing/TestSceneDesignSection.cs index 10917df075..1ecbc24d90 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneDesignSection.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneDesignSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; using System.Linq; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneDifficultySwitching.cs b/osu.Game.Tests/Visual/Editing/TestSceneDifficultySwitching.cs index 81cb286058..1f88fa8f35 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneDifficultySwitching.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneDifficultySwitching.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs index ef07c3e411..53b6db2277 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneDistanceSnapGrid.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs index b109234fec..92f07af7b1 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorChangeStates.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorChangeStates.cs index ab53f4fd93..109a49310a 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorChangeStates.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorChangeStates.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorClipboard.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorClipboard.cs index e41f8372b4..23e137865c 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorClipboard.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorClipboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs index 393d3886e7..3be6371f28 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorComposeRadioButtons.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorComposeRadioButtons.cs index 028509ccd4..56435c69a4 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorComposeRadioButtons.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorComposeRadioButtons.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorMenuBar.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorMenuBar.cs index ad6fc55a32..913155aafb 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorMenuBar.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorMenuBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSamplePlayback.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSamplePlayback.cs index 2abc8a8dec..43a3cb1342 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSamplePlayback.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSamplePlayback.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs index e75c7f25a3..cf1246ef07 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorScreenModes.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorScreenModes.cs index 2efd125f81..962260e1bd 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorScreenModes.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorScreenModes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeekSnapping.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeekSnapping.cs index 863f42520b..c8ca273db5 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeekSnapping.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeekSnapping.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs index da28387c4d..6f248f1247 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Utils; using osu.Game.Beatmaps; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSummaryTimeline.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSummaryTimeline.cs index da0c83bb11..3657878075 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSummaryTimeline.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSummaryTimeline.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorTestGameplay.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorTestGameplay.cs index 79ea866efe..a5d115331d 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorTestGameplay.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorTestGameplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs index c9d44fdab7..adb495f3d3 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectComposer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs index 7c05abc2cd..a429c6f58b 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using Humanizer; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs index 4501eea88e..6313842dfd 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSamplePointAdjustments.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using Humanizer; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneLabelledTimeSignature.cs b/osu.Game.Tests/Visual/Editing/TestSceneLabelledTimeSignature.cs index b34974dfc7..328e41ebea 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneLabelledTimeSignature.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneLabelledTimeSignature.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneMetadataSection.cs b/osu.Game.Tests/Visual/Editing/TestSceneMetadataSection.cs index 4ecfb0975b..d87bbd8a10 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneMetadataSection.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneMetadataSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Game.Beatmaps; diff --git a/osu.Game.Tests/Visual/Editing/TestScenePlaybackControl.cs b/osu.Game.Tests/Visual/Editing/TestScenePlaybackControl.cs index bf0a7876a9..78f650f0fa 100644 --- a/osu.Game.Tests/Visual/Editing/TestScenePlaybackControl.cs +++ b/osu.Game.Tests/Visual/Editing/TestScenePlaybackControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneRectangularPositionSnapGrid.cs b/osu.Game.Tests/Visual/Editing/TestSceneRectangularPositionSnapGrid.cs index 85a98eca47..7ad12c37bc 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneRectangularPositionSnapGrid.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneRectangularPositionSnapGrid.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneSetupScreen.cs b/osu.Game.Tests/Visual/Editing/TestSceneSetupScreen.cs index 2f6cf46b21..ddb458d570 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneSetupScreen.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneSetupScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTapButton.cs b/osu.Game.Tests/Visual/Editing/TestSceneTapButton.cs index d8141619ab..f36524290a 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTapButton.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTapButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs b/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs index a1218aa3e7..7d881bc259 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTapTimingControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTimelineBlueprintContainer.cs b/osu.Game.Tests/Visual/Editing/TestSceneTimelineBlueprintContainer.cs index 6b54bcb4f0..d2984728b0 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTimelineBlueprintContainer.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTimelineBlueprintContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Screens.Edit.Compose.Components.Timeline; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTimelineHitObjectBlueprint.cs b/osu.Game.Tests/Visual/Editing/TestSceneTimelineHitObjectBlueprint.cs index d55852ec43..603dbf4c67 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTimelineHitObjectBlueprint.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTimelineHitObjectBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTimelineSelection.cs b/osu.Game.Tests/Visual/Editing/TestSceneTimelineSelection.cs index 81ab4712ab..7e0981ce69 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTimelineSelection.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTimelineSelection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTimelineTickDisplay.cs b/osu.Game.Tests/Visual/Editing/TestSceneTimelineTickDisplay.cs index b78512e469..b02f0b09b4 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTimelineTickDisplay.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTimelineTickDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs b/osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs index d726bd004e..fd103ff70f 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Utils; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs b/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs index a358166477..e262bd756a 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneWaveform.cs b/osu.Game.Tests/Visual/Editing/TestSceneWaveform.cs index eb7e90f0a7..82b0d70cff 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneWaveform.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneWaveform.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs b/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs index 43e3404d98..9dc403814b 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game.Tests/Visual/Editing/TimelineTestScene.cs b/osu.Game.Tests/Visual/Editing/TimelineTestScene.cs index 93bfb288d2..437f06c47f 100644 --- a/osu.Game.Tests/Visual/Editing/TimelineTestScene.cs +++ b/osu.Game.Tests/Visual/Editing/TimelineTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Gameplay/OsuPlayerTestScene.cs b/osu.Game.Tests/Visual/Gameplay/OsuPlayerTestScene.cs index cbf8515567..f173170da5 100644 --- a/osu.Game.Tests/Visual/Gameplay/OsuPlayerTestScene.cs +++ b/osu.Game.Tests/Visual/Gameplay/OsuPlayerTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; diff --git a/osu.Game.Tests/Visual/Gameplay/SkinnableHUDComponentTestScene.cs b/osu.Game.Tests/Visual/Gameplay/SkinnableHUDComponentTestScene.cs index 6de9d7c478..3ecf560eb1 100644 --- a/osu.Game.Tests/Visual/Gameplay/SkinnableHUDComponentTestScene.cs +++ b/osu.Game.Tests/Visual/Gameplay/SkinnableHUDComponentTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Rulesets; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneAllRulesetPlayers.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneAllRulesetPlayers.cs index e10ef57a25..a8d7148bd2 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneAllRulesetPlayers.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneAllRulesetPlayers.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Game.Configuration; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs index 346a88a2d5..019bfe322e 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using System.Linq; using osu.Framework.Testing; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapOffsetControl.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapOffsetControl.cs index 8ca49837da..cfd282c404 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapOffsetControl.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapOffsetControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapSkinFallbacks.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapSkinFallbacks.cs index e9aa85f4ce..d4f3d0f390 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapSkinFallbacks.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapSkinFallbacks.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneBreakTracker.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneBreakTracker.cs index be17721b88..e31b325d54 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneBreakTracker.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneBreakTracker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneCompletionCancellation.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneCompletionCancellation.cs index 11bd701e19..6aedc64370 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneCompletionCancellation.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneCompletionCancellation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableScrollingRuleset.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableScrollingRuleset.cs index e1755b8fc3..f9a3695d65 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableScrollingRuleset.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableScrollingRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableStoryboardSprite.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableStoryboardSprite.cs index b2f4fa2738..ca7d7b42d8 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableStoryboardSprite.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableStoryboardSprite.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs index 83d7d769df..0b737f5110 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs index bf491db45a..90a4b536bb 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Game.Rulesets; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneFailingLayer.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneFailingLayer.cs index c335f7c99e..90e36ecae2 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneFailingLayer.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneFailingLayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneFrameStabilityContainer.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneFrameStabilityContainer.cs index ae0decaee1..97ffbfc796 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneFrameStabilityContainer.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneFrameStabilityContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs index 74212de210..663e398c01 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayMenuOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayMenuOverlay.cs index abd43e7427..f3a6302da0 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayMenuOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayMenuOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs index 814b41cdbc..0a32513834 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs index 815cc09448..f1084bca5f 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySampleTriggerSource.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySampleTriggerSource.cs index ac39395567..79e3cf000e 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySampleTriggerSource.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySampleTriggerSource.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Game.Audio; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs index 949f0f667b..dd0f965914 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs index cbf9760e21..70d7f6a28b 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneHoldForMenuButton.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneHoldForMenuButton.cs index ddb0872541..50fd1b2a51 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneHoldForMenuButton.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneHoldForMenuButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneKeyBindings.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneKeyBindings.cs index 70a43fafb5..c690203f82 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneKeyBindings.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneKeyBindings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneKeyCounter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneKeyCounter.cs index 87ab42fe60..bfda6f50cb 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneKeyCounter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneKeyCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs index b90bd93002..7f4276f819 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneMedalOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneMedalOverlay.cs index 0ada3cf05f..3fd36d509d 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneMedalOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneMedalOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Overlays; using osu.Game.Users; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneNightcoreBeatContainer.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneNightcoreBeatContainer.cs index 759e4fa4ec..966138c0b3 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneNightcoreBeatContainer.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneNightcoreBeatContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Game.Beatmaps.Timing; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneOverlayActivation.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneOverlayActivation.cs index b308f3d7d8..3e637f1870 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneOverlayActivation.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneOverlayActivation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Game.Overlays; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneParticleExplosion.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneParticleExplosion.cs index 82095cb809..bddf051871 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneParticleExplosion.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneParticleExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneParticleSpewer.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneParticleSpewer.cs index ce5cd629e0..26706d9465 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneParticleSpewer.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneParticleSpewer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs index ab5d766609..5bd0a29308 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePauseWhenInactive.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePauseWhenInactive.cs index 49c1163c6c..e1c755b90c 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePauseWhenInactive.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePauseWhenInactive.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePerformancePointsCounter.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePerformancePointsCounter.cs index aefe0db36a..a86e707400 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePerformancePointsCounter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePerformancePointsCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs index 950c755cc1..56588e4d4e 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs index 7c2f1c5bb2..ec0eea62d9 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Lists; using osu.Game.Beatmaps; diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs index 58b5df2612..e0c8989389 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using System.Threading; diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePoolingRuleset.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePoolingRuleset.cs index 911fffbe7f..1fa4885b7a 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePoolingRuleset.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePoolingRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplay.cs index 8622fe8f53..faa6a429c5 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.ComponentModel; using System.Linq; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs index e89350de1a..10a6b196b0 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayPlayer.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayPlayer.cs index fcd65eaff3..6319b91a38 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayPlayer.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs index 8362739d3b..54b2e66f2f 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneScrollingHitObjects.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneScrollingHitObjects.cs index 283fe594ea..8a4818d2f8 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneScrollingHitObjects.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneScrollingHitObjects.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs index 74ce9726e7..3bebf2b68b 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorComponentsList.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorComponentsList.cs index 5385a9983b..f88b4be3d8 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorComponentsList.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorComponentsList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorMultipleSkins.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorMultipleSkins.cs index 5f838b8813..3eb92b3e97 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorMultipleSkins.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorMultipleSkins.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableAccuracyCounter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableAccuracyCounter.cs index 9c713b4616..1288f2a9f1 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableAccuracyCounter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableAccuracyCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableComboCounter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableComboCounter.cs index f507172931..eacab6d34f 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableComboCounter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableComboCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableDrawable.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableDrawable.cs index 35130f3109..757a261de6 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableDrawable.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableDrawable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Globalization; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs index 5f2d9ee9e8..ee2827122d 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHealthDisplay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHealthDisplay.cs index 057798c922..2d6ad28b90 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHealthDisplay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHealthDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableScoreCounter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableScoreCounter.cs index a871e37ad4..1b3538cc21 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableScoreCounter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableScoreCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs index 31abcb6748..36b07043dc 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkipOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkipOverlay.cs index e08e03b789..e1fc65404d 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkipOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkipOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSliderPath.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSliderPath.cs index 9750838433..7044ddad37 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSliderPath.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSliderPath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSongProgress.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSongProgress.cs index 733e8f4290..07efb25b46 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSongProgress.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSongProgress.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs index b5cdd61ee5..a42e86933f 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorHost.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorHost.cs index 034519fbf8..c55e98c1a8 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorHost.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorHost.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Game.Online.API; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs index 2d2e05c4c9..1e517efef2 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneStarCounter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneStarCounter.cs index 717485bcc1..708a5e94de 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneStarCounter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneStarCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Utils; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboard.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboard.cs index 014ccb1652..30c2790fb4 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboard.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardSamplePlayback.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardSamplePlayback.cs index 909cab5e3d..079d459beb 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardSamplePlayback.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardSamplePlayback.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs index b87183cbc7..68d024e63f 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using System.Threading.Tasks; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneUnknownMod.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneUnknownMod.cs index c0f1112905..a31347589b 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneUnknownMod.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneUnknownMod.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneUnstableRateCounter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneUnstableRateCounter.cs index ca8ecd490d..60b8691bfb 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneUnstableRateCounter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneUnstableRateCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Menus/IntroTestScene.cs b/osu.Game.Tests/Visual/Menus/IntroTestScene.cs index c68cd39c65..66e3612113 100644 --- a/osu.Game.Tests/Visual/Menus/IntroTestScene.cs +++ b/osu.Game.Tests/Visual/Menus/IntroTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Menus/TestSceneDisclaimer.cs b/osu.Game.Tests/Visual/Menus/TestSceneDisclaimer.cs index db5891bd4e..57f16bbcce 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneDisclaimer.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneDisclaimer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game.Tests/Visual/Menus/TestSceneIntroCircles.cs b/osu.Game.Tests/Visual/Menus/TestSceneIntroCircles.cs index 7ad49b5dcd..85a3a51ddb 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneIntroCircles.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneIntroCircles.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Screens.Menu; diff --git a/osu.Game.Tests/Visual/Menus/TestSceneIntroTriangles.cs b/osu.Game.Tests/Visual/Menus/TestSceneIntroTriangles.cs index abe8936330..7ab04a22e5 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneIntroTriangles.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneIntroTriangles.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Screens.Menu; diff --git a/osu.Game.Tests/Visual/Menus/TestSceneIntroWelcome.cs b/osu.Game.Tests/Visual/Menus/TestSceneIntroWelcome.cs index 11cea25865..ae63022823 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneIntroWelcome.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneIntroWelcome.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Utils; using osu.Game.Screens.Menu; diff --git a/osu.Game.Tests/Visual/Menus/TestSceneLoader.cs b/osu.Game.Tests/Visual/Menus/TestSceneLoader.cs index c44363d9ea..1f2eb57b79 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneLoader.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneLoader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using System.Threading; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Menus/TestSceneLoginPanel.cs b/osu.Game.Tests/Visual/Menus/TestSceneLoginPanel.cs index 642cc68de5..dbe7b9cc74 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneLoginPanel.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneLoginPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Menus/TestSceneMusicActionHandling.cs b/osu.Game.Tests/Visual/Menus/TestSceneMusicActionHandling.cs index 10a82089b3..14b2593fa7 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneMusicActionHandling.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneMusicActionHandling.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Menus/TestSceneSideOverlays.cs b/osu.Game.Tests/Visual/Menus/TestSceneSideOverlays.cs index bbab6380ba..7a2b4d5ca5 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneSideOverlays.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneSideOverlays.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Menus/TestSceneSongTicker.cs b/osu.Game.Tests/Visual/Menus/TestSceneSongTicker.cs index 4b22af38c5..ba73361566 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneSongTicker.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneSongTicker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Overlays; diff --git a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs index 0b99c781ef..90e218675c 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using JetBrains.Annotations; using Moq; diff --git a/osu.Game.Tests/Visual/Menus/TestSceneToolbarClock.cs b/osu.Game.Tests/Visual/Menus/TestSceneToolbarClock.cs index 87d836687f..d96f80df40 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneToolbarClock.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneToolbarClock.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Mods/TestSceneModFailCondition.cs b/osu.Game.Tests/Visual/Mods/TestSceneModFailCondition.cs index af874cec91..91fa09b414 100644 --- a/osu.Game.Tests/Visual/Mods/TestSceneModFailCondition.cs +++ b/osu.Game.Tests/Visual/Mods/TestSceneModFailCondition.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs index a738debecc..43ca47778a 100644 --- a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs +++ b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/osu.Game.Tests/Visual/Multiplayer/QueueModeTestScene.cs b/osu.Game.Tests/Visual/Multiplayer/QueueModeTestScene.cs index bafc579134..074a92f5b0 100644 --- a/osu.Game.Tests/Visual/Multiplayer/QueueModeTestScene.cs +++ b/osu.Game.Tests/Visual/Multiplayer/QueueModeTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs index 0785315b26..86da9dc33d 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneCreateMultiplayerMatchButton.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneCreateMultiplayerMatchButton.cs index 0674fc7a39..317e410f37 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneCreateMultiplayerMatchButton.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneCreateMultiplayerMatchButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableLoungeRoom.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableLoungeRoom.cs index ea895a23d2..fc3079cba0 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableLoungeRoom.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableLoungeRoom.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using System.Threading; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs index 3172a68b81..23ef440a4d 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomParticipantsList.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomParticipantsList.cs index 60f47a01a9..0a59e0e858 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomParticipantsList.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomParticipantsList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs index e2b4b2870f..757dfff2b7 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs index a8471edbf8..457af3e4af 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneGameplayChatDisplay.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneGameplayChatDisplay.cs index c3487751b9..a08791ecff 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneGameplayChatDisplay.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneGameplayChatDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using Moq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs index c3ec7a5369..fe584fe3da 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs index 93cd281bc5..171f8eea52 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchBeatmapDetailArea.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchBeatmapDetailArea.cs index 6f43511e8a..8cdcdfdfdf 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchBeatmapDetailArea.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchBeatmapDetailArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Online.API; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchLeaderboard.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchLeaderboard.cs index 955710bd50..506d7541a7 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchLeaderboard.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchLeaderboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs index ff6c02c4e5..0cdc144b6a 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using Moq; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiHeader.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiHeader.cs index 2244dcfc56..70c6271d24 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiHeader.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Screens; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs index 60215dc8b3..80c356ec67 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs index c048722804..877c986d61 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs index 8e45d99eae..d464527976 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs index cbbd535cee..95fd449dd3 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs index c25884039f..93ccf3977b 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Graphics; using osu.Game.Online.Multiplayer; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerLoungeSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerLoungeSubScreen.cs index de3df754a2..1a3fefa603 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerLoungeSubScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerLoungeSubScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchFooter.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchFooter.cs index 111f51675d..a98030e1e3 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchFooter.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchFooter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs index eacd80925d..285258d7c0 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs index 7ae81c9800..bb7587ac56 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs index 8da077cd44..75e3da05d3 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs index e05580fed6..042a9297eb 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Screens; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlaylist.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlaylist.cs index 1231866b36..5ee385810b 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlaylist.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlaylist.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerQueueList.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerQueueList.cs index 117aaeba83..fcd6dd5bd2 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerQueueList.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerQueueList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerResults.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerResults.cs index cc08135939..a638702ceb 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerResults.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerResults.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Online.Rooms; using osu.Game.Rulesets.Osu; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectateButton.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectateButton.cs index 13917f4eb0..486da48449 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectateButton.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectateButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectatorPlayerGrid.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectatorPlayerGrid.cs index c0958c7fe8..089b4a020d 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectatorPlayerGrid.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectatorPlayerGrid.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs index 0237298fa1..56260941a8 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestScenePlaylistsRoomSettingsPlaylist.cs b/osu.Game.Tests/Visual/Multiplayer/TestScenePlaylistsRoomSettingsPlaylist.cs index 98dc243ab5..bbccdb0d17 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestScenePlaylistsRoomSettingsPlaylist.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestScenePlaylistsRoomSettingsPlaylist.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestScenePlaylistsSongSelect.cs b/osu.Game.Tests/Visual/Multiplayer/TestScenePlaylistsSongSelect.cs index f8d62c9840..88afe1ce7c 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestScenePlaylistsSongSelect.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestScenePlaylistsSongSelect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs index b0a977dcbb..cb80fb56df 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using Moq; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneStarRatingRangeDisplay.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneStarRatingRangeDisplay.cs index 5e4013b0f1..321e0c2c89 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneStarRatingRangeDisplay.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneStarRatingRangeDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Beatmaps; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneTeamVersus.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneTeamVersus.cs index 19e1f62fd5..2e39449f64 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneTeamVersus.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneTeamVersus.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Navigation/TestEFToRealmMigration.cs b/osu.Game.Tests/Visual/Navigation/TestEFToRealmMigration.cs index 2ea768b878..c3559589ed 100644 --- a/osu.Game.Tests/Visual/Navigation/TestEFToRealmMigration.cs +++ b/osu.Game.Tests/Visual/Navigation/TestEFToRealmMigration.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using System.Runtime.InteropServices; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneButtonSystemNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneButtonSystemNavigation.cs index 8c96ec699f..bff30b83f9 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneButtonSystemNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneButtonSystemNavigation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneChangeAndUseGameplayBindings.cs b/osu.Game.Tests/Visual/Navigation/TestSceneChangeAndUseGameplayBindings.cs index b7a74dcd27..5bd879de14 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneChangeAndUseGameplayBindings.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneChangeAndUseGameplayBindings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneEditDefaultSkin.cs b/osu.Game.Tests/Visual/Navigation/TestSceneEditDefaultSkin.cs index 06306ad197..4ca55e8744 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneEditDefaultSkin.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneEditDefaultSkin.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunGame.cs b/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunGame.cs index 18c6e84950..f4078676c9 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunGame.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneFirstRunGame.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics.Containers; using osu.Framework.Platform; diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneMouseWheelVolumeAdjust.cs b/osu.Game.Tests/Visual/Navigation/TestSceneMouseWheelVolumeAdjust.cs index 2662b3930c..2592936ab6 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneMouseWheelVolumeAdjust.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneMouseWheelVolumeAdjust.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Extensions; using osu.Game.Configuration; diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs b/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs index e4871f611e..cf62c73ad4 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs index 2ce914ba3d..d1b1ce5c4b 100644 --- a/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs +++ b/osu.Game.Tests/Visual/Navigation/TestScenePerformFromScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Navigation/TestScenePresentBeatmap.cs b/osu.Game.Tests/Visual/Navigation/TestScenePresentBeatmap.cs index 63226de750..6469962b08 100644 --- a/osu.Game.Tests/Visual/Navigation/TestScenePresentBeatmap.cs +++ b/osu.Game.Tests/Visual/Navigation/TestScenePresentBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Navigation/TestScenePresentScore.cs b/osu.Game.Tests/Visual/Navigation/TestScenePresentScore.cs index 6c32171b29..5e76fe1519 100644 --- a/osu.Game.Tests/Visual/Navigation/TestScenePresentScore.cs +++ b/osu.Game.Tests/Visual/Navigation/TestScenePresentScore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs index 51bb27f93e..a61352f954 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs index 68c44f49cc..78ab7947a7 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Extensions; diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneStartupBeatmapDisplay.cs b/osu.Game.Tests/Visual/Navigation/TestSceneStartupBeatmapDisplay.cs index 961b7dedc3..bd3dcb8597 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneStartupBeatmapDisplay.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneStartupBeatmapDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneStartupBeatmapSetDisplay.cs b/osu.Game.Tests/Visual/Navigation/TestSceneStartupBeatmapSetDisplay.cs index 1aa56896d3..1072508e33 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneStartupBeatmapSetDisplay.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneStartupBeatmapSetDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneStartupImport.cs b/osu.Game.Tests/Visual/Navigation/TestSceneStartupImport.cs index bd723eeed6..cd53bf3af5 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneStartupImport.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneStartupImport.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneStartupRuleset.cs b/osu.Game.Tests/Visual/Navigation/TestSceneStartupRuleset.cs index 85dd501fd3..1aadff7a20 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneStartupRuleset.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneStartupRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Development; using osu.Game.Configuration; diff --git a/osu.Game.Tests/Visual/Navigation/TestSettingsMigration.cs b/osu.Game.Tests/Visual/Navigation/TestSettingsMigration.cs index 7e3d8290be..f5c7ee2f19 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSettingsMigration.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSettingsMigration.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Utils; using osu.Game.Configuration; diff --git a/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs index 8f0da8d182..b9d800e6fd 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapAvailability.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapAvailability.cs index f94ae24a14..c78a36d2bd 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapAvailability.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapAvailability.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapDownloadButton.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapDownloadButton.cs index 8d8879490d..ba600332bb 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapDownloadButton.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapDownloadButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapListingOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapListingOverlay.cs index 5999125013..8ef120d252 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapListingOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapListingOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs index c550c9afda..b73028be5b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index c933e1a54e..416e8aebcc 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Game.Beatmaps; diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs index 629c413d85..31cebc2f0b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlaySuccessRate.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlaySuccessRate.cs index 82b34c50c2..26e1e49ca3 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlaySuccessRate.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlaySuccessRate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Online/TestSceneBundledBeatmapDownloader.cs b/osu.Game.Tests/Visual/Online/TestSceneBundledBeatmapDownloader.cs index 2af1c9a0f0..08c6914f83 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBundledBeatmapDownloader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBundledBeatmapDownloader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps.Drawables; diff --git a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs index 8f000afb91..4c39dc34d5 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Online/TestSceneChangelogSupporterPromo.cs b/osu.Game.Tests/Visual/Online/TestSceneChangelogSupporterPromo.cs index 22220a7d9c..018d40d1bc 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChangelogSupporterPromo.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChangelogSupporterPromo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs index 39a4f1a8a1..8e17c490b1 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChannelList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelListing.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelListing.cs index e521db1c9d..214c05e64d 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChannelListing.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChannelListing.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatLineTruncation.cs b/osu.Game.Tests/Visual/Online/TestSceneChatLineTruncation.cs index 444bd7e5fb..79dc17cfa6 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatLineTruncation.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatLineTruncation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs b/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs index 4d227af2cb..a537f0660c 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs index e3792c0780..1fb0195368 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using System.Collections.Generic; diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatTextBox.cs b/osu.Game.Tests/Visual/Online/TestSceneChatTextBox.cs index a241aa0517..5d28d553a0 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatTextBox.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs index 31e5a9b86c..a94b9e61c0 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs index 03eac5d85b..95b718041e 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Online/TestSceneCurrentlyPlayingDisplay.cs b/osu.Game.Tests/Visual/Online/TestSceneCurrentlyPlayingDisplay.cs index edee26c081..62f8f72929 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneCurrentlyPlayingDisplay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneCurrentlyPlayingDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using System.Threading; diff --git a/osu.Game.Tests/Visual/Online/TestSceneDashboardOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneDashboardOverlay.cs index 960d3fa248..074fea0604 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDashboardOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDashboardOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Overlays; diff --git a/osu.Game.Tests/Visual/Online/TestSceneDrawableComment.cs b/osu.Game.Tests/Visual/Online/TestSceneDrawableComment.cs index b26850feb2..cab0ffa3ba 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDrawableComment.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDrawableComment.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Online/TestSceneExternalLinkButton.cs b/osu.Game.Tests/Visual/Online/TestSceneExternalLinkButton.cs index 31bb276cd4..fdcde0f2a5 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneExternalLinkButton.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneExternalLinkButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Graphics.UserInterface; using osuTK; diff --git a/osu.Game.Tests/Visual/Online/TestSceneFavouriteButton.cs b/osu.Game.Tests/Visual/Online/TestSceneFavouriteButton.cs index 87458da578..3206640f9a 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneFavouriteButton.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneFavouriteButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Testing; diff --git a/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs b/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs index 471d361c4e..c5c61cdd72 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Online/TestSceneFullscreenOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneFullscreenOverlay.cs index dc468bb62d..b7e918207f 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneFullscreenOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneFullscreenOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game.Tests/Visual/Online/TestSceneGraph.cs b/osu.Game.Tests/Visual/Online/TestSceneGraph.cs index fa433571cf..2f3331b141 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneGraph.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneGraph.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs b/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs index 2639a6506c..afc20dedff 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Online/TestSceneHomeNewsPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneHomeNewsPanel.cs index a1251ca793..181b086b00 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneHomeNewsPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneHomeNewsPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game.Tests/Visual/Online/TestSceneKudosuHistory.cs b/osu.Game.Tests/Visual/Online/TestSceneKudosuHistory.cs index 8bf2ef34f2..7f0a00c474 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneKudosuHistory.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneKudosuHistory.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Overlays.Profile.Sections.Kudosu; using System.Collections.Generic; using System; diff --git a/osu.Game.Tests/Visual/Online/TestSceneLeaderboardModSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneLeaderboardModSelector.cs index aa442ded02..8ab8276b9c 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneLeaderboardModSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneLeaderboardModSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Overlays.BeatmapSet; using System.Collections.Specialized; using System.Linq; diff --git a/osu.Game.Tests/Visual/Online/TestSceneLeaderboardScopeSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneLeaderboardScopeSelector.cs index afa559280c..8c38027df3 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneLeaderboardScopeSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneLeaderboardScopeSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Overlays.BeatmapSet; using osu.Framework.Graphics; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs index c7ca3b4457..57514cdf37 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Diagnostics; using System.Linq; diff --git a/osu.Game.Tests/Visual/Online/TestSceneNewsCard.cs b/osu.Game.Tests/Visual/Online/TestSceneNewsCard.cs index 17675bfbc0..8d73165d99 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneNewsCard.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneNewsCard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Game.Overlays.News; diff --git a/osu.Game.Tests/Visual/Online/TestSceneNewsHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneNewsHeader.cs index 994c4fce53..cad045623b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneNewsHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneNewsHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Overlays.News; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Online/TestSceneNewsOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneNewsOverlay.cs index f94c018b27..3e5dd91b2c 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneNewsOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneNewsOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Online/TestSceneNewsSidebar.cs b/osu.Game.Tests/Visual/Online/TestSceneNewsSidebar.cs index 382d76676a..f28eaf5ad0 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneNewsSidebar.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneNewsSidebar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Online/TestSceneNowPlayingCommand.cs b/osu.Game.Tests/Visual/Online/TestSceneNowPlayingCommand.cs index b689b85490..2df9089a8a 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneNowPlayingCommand.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneNowPlayingCommand.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Online/TestSceneOfflineCommentsContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneOfflineCommentsContainer.cs index 0587e8884f..07ccfcec88 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneOfflineCommentsContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneOfflineCommentsContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Online/TestSceneOnlineBeatmapListingOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneOnlineBeatmapListingOverlay.cs index fe1701a554..388c0a9d60 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneOnlineBeatmapListingOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneOnlineBeatmapListingOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Overlays; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Online/TestSceneOnlineBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneOnlineBeatmapSetOverlay.cs index 4e88570ca0..0d9c47db7b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneOnlineBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneOnlineBeatmapSetOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Overlays; diff --git a/osu.Game.Tests/Visual/Online/TestSceneOnlineViewContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneOnlineViewContainer.cs index ec183adbbc..b4bac5ee7e 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneOnlineViewContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneOnlineViewContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Online/TestScenePlayHistorySubsection.cs b/osu.Game.Tests/Visual/Online/TestScenePlayHistorySubsection.cs index a96fde6c20..118da682a7 100644 --- a/osu.Game.Tests/Visual/Online/TestScenePlayHistorySubsection.cs +++ b/osu.Game.Tests/Visual/Online/TestScenePlayHistorySubsection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Overlays.Profile.Sections.Historical; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs index ae90872439..3068ba0185 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Overlays.Profile.Header.Components; using osu.Game.Rulesets.Catch; diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs b/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs index 61574a7f23..1b1a5c7c6a 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs index 458ba80712..e7d799222a 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Game.Overlays.Rankings; diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs index 677952681c..c8f08d70be 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Overlays; diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs index 027f17fff4..62dad7b458 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsSpotlightSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsSpotlightSelector.cs index d60222fa0b..5aafcf3f6b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsSpotlightSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsSpotlightSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs index 35e219f839..e357b0fffc 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Graphics.Containers; using osu.Game.Overlays.Rankings.Tables; diff --git a/osu.Game.Tests/Visual/Online/TestSceneScoreboardTime.cs b/osu.Game.Tests/Visual/Online/TestSceneScoreboardTime.cs index 7e33b5240c..8f03f240f7 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneScoreboardTime.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneScoreboardTime.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs index 8a304110dd..16a34e996f 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs b/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs index d7fa5a1f6d..32262c18a8 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Online/TestSceneSpotlightsLayout.cs b/osu.Game.Tests/Visual/Online/TestSceneSpotlightsLayout.cs index 266dcb013b..d7feade128 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneSpotlightsLayout.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneSpotlightsLayout.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs b/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs index 8d5eebd31f..292facab11 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Online.Chat; diff --git a/osu.Game.Tests/Visual/Online/TestSceneTotalCommentsCounter.cs b/osu.Game.Tests/Visual/Online/TestSceneTotalCommentsCounter.cs index f168ae5035..d4355d2f11 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneTotalCommentsCounter.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneTotalCommentsCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Bindables; using osu.Game.Overlays.Comments; diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserHistoryGraph.cs b/osu.Game.Tests/Visual/Online/TestSceneUserHistoryGraph.cs index 3f4a5cd420..42a8462604 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserHistoryGraph.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserHistoryGraph.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs index 6c3678b0d2..fff40b3c74 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs index dda9543159..1abe06ed76 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs index 78e2ceb45b..ad3215b1ef 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfilePreviousUsernames.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfilePreviousUsernames.cs index 30774689a2..4260fff02d 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfilePreviousUsernames.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfilePreviousUsernames.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileRecentSection.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileRecentSection.cs index 0973076c40..163f0e62df 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileRecentSection.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileRecentSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs index 7dfdca8276..fa28df3061 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserRanks.cs b/osu.Game.Tests/Visual/Online/TestSceneUserRanks.cs index b9272e7294..d517aaa105 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserRanks.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserRanks.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs b/osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs index e7b6a94642..32d427ba6d 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Online/TestSceneVotePill.cs b/osu.Game.Tests/Visual/Online/TestSceneVotePill.cs index a9fed7b302..fdc15af73d 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneVotePill.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneVotePill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Overlays.Comments; diff --git a/osu.Game.Tests/Visual/Online/TestSceneWikiHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneWikiHeader.cs index 27e989df76..99e301f3ba 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneWikiHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneWikiHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Online/TestSceneWikiMainPage.cs b/osu.Game.Tests/Visual/Online/TestSceneWikiMainPage.cs index 3a2bafb128..03b94aded7 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneWikiMainPage.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneWikiMainPage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Online/TestSceneWikiMarkdownContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneWikiMarkdownContainer.cs index af2e4fc91a..39432ee059 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneWikiMarkdownContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneWikiMarkdownContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using Markdig.Syntax.Inlines; diff --git a/osu.Game.Tests/Visual/Online/TestSceneWikiOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneWikiOverlay.cs index 3506d459ce..8889cb3e37 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneWikiOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneWikiOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Net; using NUnit.Framework; using osu.Game.Online.API; diff --git a/osu.Game.Tests/Visual/Online/TestSceneWikiSidebar.cs b/osu.Game.Tests/Visual/Online/TestSceneWikiSidebar.cs index 862b3667b1..33e3ee7023 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneWikiSidebar.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneWikiSidebar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Markdig.Parsers; using Markdig.Syntax; using Markdig.Syntax.Inlines; diff --git a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsLoungeSubScreen.cs b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsLoungeSubScreen.cs index 9ba0da1911..8ca37a241b 100644 --- a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsLoungeSubScreen.cs +++ b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsLoungeSubScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsMatchSettingsOverlay.cs b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsMatchSettingsOverlay.cs index 666e32d1d0..e6882081dd 100644 --- a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsMatchSettingsOverlay.cs +++ b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsMatchSettingsOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsParticipantsList.cs b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsParticipantsList.cs index 1288b9e765..5961ed74ad 100644 --- a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsParticipantsList.cs +++ b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsParticipantsList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs index c532e8bc05..a46e675370 100644 --- a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs +++ b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsRoomCreation.cs b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsRoomCreation.cs index 14f8c1d6d4..c0cd2d9157 100644 --- a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsRoomCreation.cs +++ b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsRoomCreation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsScreen.cs b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsScreen.cs index 63bd7c8068..af3d2d9d9a 100644 --- a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsScreen.cs +++ b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; namespace osu.Game.Tests.Visual.Playlists diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneAccuracyCircle.cs b/osu.Game.Tests/Visual/Ranking/TestSceneAccuracyCircle.cs index ac736086fd..3e2043cea5 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneAccuracyCircle.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneAccuracyCircle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneContractedPanelMiddleContent.cs b/osu.Game.Tests/Visual/Ranking/TestSceneContractedPanelMiddleContent.cs index 85306b9354..83242fe363 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneContractedPanelMiddleContent.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneContractedPanelMiddleContent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelMiddleContent.cs b/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelMiddleContent.cs index 2a31728f87..62e9adcf25 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelMiddleContent.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelMiddleContent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using JetBrains.Annotations; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelTopContent.cs b/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelTopContent.cs index a2fa142896..94f6fa8839 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelTopContent.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelTopContent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneHitEventTimingDistributionGraph.cs b/osu.Game.Tests/Visual/Ranking/TestSceneHitEventTimingDistributionGraph.cs index 7471b6acf2..44cb438a6b 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneHitEventTimingDistributionGraph.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneHitEventTimingDistributionGraph.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs b/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs index 2a5fc050d3..89d6206fd7 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneScorePanel.cs b/osu.Game.Tests/Visual/Ranking/TestSceneScorePanel.cs index 5dbeefd390..77fcd04fbd 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneScorePanel.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneScorePanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneScorePanelList.cs b/osu.Game.Tests/Visual/Ranking/TestSceneScorePanelList.cs index c65587d433..871224f3e4 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneScorePanelList.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneScorePanelList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneSimpleStatisticTable.cs b/osu.Game.Tests/Visual/Ranking/TestSceneSimpleStatisticTable.cs index 07a0bcc8d8..57a3907b6e 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneSimpleStatisticTable.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneSimpleStatisticTable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using Humanizer; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneStatisticsPanel.cs b/osu.Game.Tests/Visual/Ranking/TestSceneStatisticsPanel.cs index 1efe6d7380..8214c52edc 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneStatisticsPanel.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneStatisticsPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Threading; diff --git a/osu.Game.Tests/Visual/Settings/TestSceneDirectorySelector.cs b/osu.Game.Tests/Visual/Settings/TestSceneDirectorySelector.cs index 227bce0c60..4f05194e08 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneDirectorySelector.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneDirectorySelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterfaceV2; diff --git a/osu.Game.Tests/Visual/Settings/TestSceneFileSelector.cs b/osu.Game.Tests/Visual/Settings/TestSceneFileSelector.cs index 84a0fc6e4c..6f25012bfa 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneFileSelector.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneFileSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterfaceV2; diff --git a/osu.Game.Tests/Visual/Settings/TestSceneKeyBindingPanel.cs b/osu.Game.Tests/Visual/Settings/TestSceneKeyBindingPanel.cs index 1effe52608..d7d073e908 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneKeyBindingPanel.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneKeyBindingPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs index fe14935479..caffc54d47 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneLatencyCertifierScreen.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Tests/Visual/Settings/TestSceneMigrationScreens.cs b/osu.Game.Tests/Visual/Settings/TestSceneMigrationScreens.cs index ac0956502e..e32757c6f6 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneMigrationScreens.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneMigrationScreens.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using System.Threading; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/Settings/TestSceneRestoreDefaultValueButton.cs b/osu.Game.Tests/Visual/Settings/TestSceneRestoreDefaultValueButton.cs index 0c46fa439a..289969af3e 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneRestoreDefaultValueButton.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneRestoreDefaultValueButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs index 3e679a7905..b3d1966511 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsNumberBox.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsNumberBox.cs index 334a814688..53e1f0e0bf 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsNumberBox.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsNumberBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Testing; diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs index 97463b7466..abf65602f9 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsSource.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsSource.cs index ffaa038930..98de712703 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsSource.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsSource.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/Settings/TestSceneTabletSettings.cs b/osu.Game.Tests/Visual/Settings/TestSceneTabletSettings.cs index dc5b0e0d77..d1d3748c26 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneTabletSettings.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneTabletSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs index 8af70df48a..77670c38f3 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs index 540b820250..66b9fa990a 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs index bd15c40271..e33cfe280e 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs index ef04baefa2..6490fd822e 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs index 3b15ee9c45..1b9b59676b 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapMetadataDisplay.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapMetadataDisplay.cs index fb6d9a0b4b..27b485156c 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapMetadataDisplay.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapMetadataDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapOptionsOverlay.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapOptionsOverlay.cs index e9742acdde..5ad82f1ffd 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapOptionsOverlay.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapOptionsOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs index a78a8aa028..117515977e 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs index b42ce3ff87..6807180640 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 77f5bd83d6..9fcd470d17 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectFooter.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectFooter.cs index f27615eea5..cb78fbfe35 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectFooter.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectFooter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Screens.Select; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneTopLocalRank.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneTopLocalRank.cs index 7bef7c8fce..8f890b2383 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneTopLocalRank.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneTopLocalRank.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs index c71e54e9a8..16966e489a 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/TestMultiplayerComponents.cs b/osu.Game.Tests/Visual/TestMultiplayerComponents.cs index 4ab201ef46..0458f41358 100644 --- a/osu.Game.Tests/Visual/TestMultiplayerComponents.cs +++ b/osu.Game.Tests/Visual/TestMultiplayerComponents.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Screens; diff --git a/osu.Game.Tests/Visual/TestSceneOsuScreenStack.cs b/osu.Game.Tests/Visual/TestSceneOsuScreenStack.cs index 7729ad0ff3..7588546f42 100644 --- a/osu.Game.Tests/Visual/TestSceneOsuScreenStack.cs +++ b/osu.Game.Tests/Visual/TestSceneOsuScreenStack.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs index 2440911c11..9b84cf2a9e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs index 3cbb7daf51..27c107a2db 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingCardSizeTabControl.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingCardSizeTabControl.cs index e3d47f08c6..bc846d8bcb 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingCardSizeTabControl.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingCardSizeTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingSearchControl.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingSearchControl.cs index f17de75f5c..1107fad834 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingSearchControl.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingSearchControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using Humanizer; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingSortTabControl.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingSortTabControl.cs index 5364f0bef5..3247461fba 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingSortTabControl.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingSortTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapSearchFilter.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapSearchFilter.cs index 37b7b64615..ff1dce1a4e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapSearchFilter.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapSearchFilter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBreadcrumbControl.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBreadcrumbControl.cs index 3967b62c95..a387148c2c 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneBreadcrumbControl.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBreadcrumbControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBreadcrumbControlHeader.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBreadcrumbControlHeader.cs index 7bc75f1c44..8e2502dad1 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneBreadcrumbControlHeader.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBreadcrumbControlHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs index 1a879e2e70..cbd4c69180 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneColourPicker.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneColourPicker.cs index fa9179443d..eba0e8cfed 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneColourPicker.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneColourPicker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentEditor.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentEditor.cs index 920b437f57..fd4ec2f3dc 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentEditor.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentEditor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs index c2ac5179c9..115833b034 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Overlays.Comments.Buttons; using osu.Framework.Graphics; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneContextMenu.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneContextMenu.cs index 3b43f8485a..bd77c4725c 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneContextMenu.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneContextMenu.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs index 5b74852259..0fa7c5303c 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDashboardBeatmapListing.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDashboardBeatmapListing.cs index 17ac812eb0..2b6a93143f 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDashboardBeatmapListing.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDashboardBeatmapListing.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Game.Overlays.Dashboard.Home; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index 1350052ae6..31406af87a 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs index 54cdeaf956..a8e6142bab 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDialogOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDifficultyMultiplierDisplay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDifficultyMultiplierDisplay.cs index cd84f8b380..984276b27e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDifficultyMultiplierDisplay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDifficultyMultiplierDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDrawableDate.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDrawableDate.cs index 19097f33bb..59e85ae085 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDrawableDate.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDrawableDate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneEditorSidebar.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneEditorSidebar.cs index f2f475e063..ee07acef52 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneEditorSidebar.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneEditorSidebar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs index f92aae43d2..2d97513206 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs index 2bb6e58448..704185b117 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs index 9747b5cc53..8fa4f7ec0e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Screens; using osu.Game.Overlays; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBundledBeatmaps.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBundledBeatmaps.cs index 51065939f0..6cc4ac709b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBundledBeatmaps.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBundledBeatmaps.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Screens; using osu.Game.Overlays; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenImportFromStable.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenImportFromStable.cs index 081b240795..3c3d5933e4 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenImportFromStable.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenImportFromStable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading; using System.Threading.Tasks; using Moq; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenUIScale.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenUIScale.cs index 64ad4ff119..98ad77fbae 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenUIScale.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenUIScale.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Screens; using osu.Game.Overlays; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index d09efdc925..a3ae55670a 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFooterButtonMods.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFooterButtonMods.cs index 0631059d1a..a4b5faae26 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFooterButtonMods.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFooterButtonMods.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFriendsOnlineStatusControl.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFriendsOnlineStatusControl.cs index ea3cfbd497..ad5e498c8b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFriendsOnlineStatusControl.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFriendsOnlineStatusControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneHoldToConfirmOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneHoldToConfirmOverlay.cs index cea91d422e..235dbc1fcb 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneHoldToConfirmOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneHoldToConfirmOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneIconButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneIconButton.cs index c80b3e6297..35d250c7ac 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneIconButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneIconButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledColourPalette.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledColourPalette.cs index e1ea02ba67..d7a69616f3 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledColourPalette.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledColourPalette.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledDrawable.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledDrawable.cs index d5dda6f6cd..f717bb4dee 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledDrawable.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledDrawable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Extensions.IEnumerableExtensions; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledDropdown.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledDropdown.cs index a9aaefdf6c..cd14d6bde3 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledDropdown.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledDropdown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterfaceV2; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledSliderBar.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledSliderBar.cs index 1b7f65f9a0..8ccfe2ee9c 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledSliderBar.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledSliderBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledSwitchButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledSwitchButton.cs index 903f1242b4..03434ff0a1 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledSwitchButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledSwitchButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledTextBox.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledTextBox.cs index c11ba0aa59..3f93e60773 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledTextBox.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingLayer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingLayer.cs index d426723f0b..2fc6405b88 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingLayer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingLayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingSpinner.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingSpinner.cs index 47f5bdfe17..8c9b9186b1 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingSpinner.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingSpinner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLogoAnimation.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLogoAnimation.cs index 155d043bf9..b565cb359b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLogoAnimation.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLogoAnimation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs index b46d35a84d..558ea01a49 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs index 331509e10f..50817bf804 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModDifficultyAdjustSettings.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModDifficultyAdjustSettings.cs index 8e1f426f7b..72e503dc33 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModDifficultyAdjustSettings.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModDifficultyAdjustSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModDisplay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModDisplay.cs index b8f5ee5e86..c65d1f8c5e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModDisplay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModFlowDisplay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModFlowDisplay.cs index 10eab148de..c45ea3a40c 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModFlowDisplay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModFlowDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModIcon.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModIcon.cs index 513eb2fafc..0a0415789a 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModIcon.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModIcon.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Game.Rulesets.Osu; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModPanel.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModPanel.cs index f56d9c8a91..9c0b36073b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModPanel.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs index 9bb02c3e75..31061dc109 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSettingsArea.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSettingsArea.cs index ddc1c8c128..a9c3872643 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSettingsArea.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSettingsArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSwitchSmall.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSwitchSmall.cs index 447352b7a6..ff9cc09806 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSwitchSmall.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSwitchSmall.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSwitchTiny.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSwitchTiny.cs index dbde7ce425..ddb5845df8 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSwitchTiny.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSwitchTiny.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs index a2aa0499d2..cf069a9e34 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs index 475ab0c414..f7f35b8361 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOnScreenDisplay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOnScreenDisplay.cs index 544581082e..2d8d7a5de3 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOnScreenDisplay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOnScreenDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Configuration; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs index 2eb5a8014e..28599c740e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuButton.cs index 9d086cce5c..0e31a133ac 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuDropdown.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuDropdown.cs index cce0295413..2cda95bda4 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuDropdown.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuDropdown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuFont.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuFont.cs index eedafce271..f534fc0fac 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuFont.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuFont.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs index 396bec51b6..d4b15c06c5 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuIcon.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuIcon.cs index 0bc4ac12d6..1e1c3b3282 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuIcon.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuIcon.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using System.Reflection; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuLogo.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuLogo.cs index 8b91339479..e23a960a7e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuLogo.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuLogo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Screens.Menu; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuMarkdownContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuMarkdownContainer.cs index 82e26cb87d..cdccb817b9 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuMarkdownContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuMarkdownContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuMenu.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuMenu.cs index 387deea76c..5349a1b8a0 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuMenu.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuMenu.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuPopover.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuPopover.cs index 1848cf6a5e..6cc89a6df8 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuPopover.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuPopover.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuTextBox.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuTextBox.cs index 353f84c546..cc510f007b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuTextBox.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs index 2a76b8e265..a5493559d6 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Game.Overlays; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeaderBackground.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeaderBackground.cs index db414d23a0..11507e561f 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeaderBackground.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeaderBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Game.Overlays; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayRulesetSelector.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayRulesetSelector.cs index f4fa41a3b7..5a1ce9e791 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayRulesetSelector.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayRulesetSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Rulesets.Catch; using osu.Game.Rulesets.Mania; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayScrollContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayScrollContainer.cs index 7fa730e02b..7b3e82ff6d 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayScrollContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayScrollContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Game.Overlays; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestScenePageSelector.cs b/osu.Game.Tests/Visual/UserInterface/TestScenePageSelector.cs index c99ac52cb1..1907a56735 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestScenePageSelector.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestScenePageSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneParallaxContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneParallaxContainer.cs index 588b25c02d..6ab69f32ef 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneParallaxContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneParallaxContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Screens; using osu.Game.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/UserInterface/TestScenePlaylistOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestScenePlaylistOverlay.cs index 84a06d97df..4c35ec40b5 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestScenePlaylistOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestScenePlaylistOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/UserInterface/TestScenePopupDialog.cs b/osu.Game.Tests/Visual/UserInterface/TestScenePopupDialog.cs index b5f2544071..218677fd03 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestScenePopupDialog.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestScenePopupDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneProfileSubsectionHeader.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneProfileSubsectionHeader.cs index 4ce684d5af..9738ff33c3 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneProfileSubsectionHeader.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneProfileSubsectionHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Overlays.Profile.Sections; using osu.Framework.Testing; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneRankingsSortTabControl.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneRankingsSortTabControl.cs index 24bc0dbc97..a95ae190dd 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneRankingsSortTabControl.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneRankingsSortTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Overlays; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs index 454a71e6d2..2587960275 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneSafeAreaHandling.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneSafeAreaHandling.cs index 8b4e3f6d3a..2ba0fa36c3 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneSafeAreaHandling.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneSafeAreaHandling.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneScalingContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneScalingContainer.cs index 5d554719a5..67c47492b0 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneScalingContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneScalingContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneScreenBreadcrumbControl.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneScreenBreadcrumbControl.cs index 77a7d819a9..b3ee0af78b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneScreenBreadcrumbControl.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneScreenBreadcrumbControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneSectionsContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneSectionsContainer.cs index 1f3736bd9b..f71d797363 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneSectionsContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneSectionsContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsCheckbox.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsCheckbox.cs index fb04c5bad0..466c83b1ac 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsCheckbox.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsCheckbox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.cs index 8ef24e58a0..50e506f82b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneSettingsToolboxGroup.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs index 5a4eeef4d9..ba9e1c6366 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayContainer.cs index 4dd64c6536..c0fb315e03 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayHeader.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayHeader.cs index ef2b25cd92..09292ee92b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayHeader.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedOverlayHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedSearchTextBox.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedSearchTextBox.cs index e1dbf04133..78e06f7e32 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedSearchTextBox.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedSearchTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneStarRatingDisplay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneStarRatingDisplay.cs index 2806e6d347..1f65b6ec7f 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneStarRatingDisplay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneStarRatingDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneStatefulMenuItem.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneStatefulMenuItem.cs index 18ec631f37..11acb31fef 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneStatefulMenuItem.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneStatefulMenuItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Bindables; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneSwitchButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneSwitchButton.cs index 37fab75aee..4d90a11405 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneSwitchButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneSwitchButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneTabControl.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneTabControl.cs index a884741ff8..b868abcc45 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneTabControl.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneToggleMenuItem.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneToggleMenuItem.cs index 9fb8e747f3..92cfeef369 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneToggleMenuItem.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneToggleMenuItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs index cdfbb14cba..de67b85c7d 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Game.Overlays.Toolbar; using osu.Framework.Graphics; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneTwoLayerButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneTwoLayerButton.cs index 849577186d..a11efb69bd 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneTwoLayerButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneTwoLayerButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs index 7109a55e7e..32f47d77e1 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapSetCover.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapSetCover.cs index 7b6774a6b2..8176871481 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapSetCover.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapSetCover.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneUserListToolbar.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneUserListToolbar.cs index 8f7140ed7c..5e2e2ccff6 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneUserListToolbar.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneUserListToolbar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneVolumeOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneVolumeOverlay.cs index 64708c4858..b5b4542eac 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneVolumeOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneVolumeOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Overlays; using osu.Game.Overlays.Volume; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneVolumePieces.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneVolumePieces.cs index c8478c8eca..9ce71a5347 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneVolumePieces.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneVolumePieces.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Overlays.Volume; using osuTK; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneWaveContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneWaveContainer.cs index 5b130b9224..6a4934cf47 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneWaveContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneWaveContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game.Tests/Visual/UserInterface/ThemeComparisonTestScene.cs b/osu.Game.Tests/Visual/UserInterface/ThemeComparisonTestScene.cs index 7986f14d1d..8fb0fd84a1 100644 --- a/osu.Game.Tests/Visual/UserInterface/ThemeComparisonTestScene.cs +++ b/osu.Game.Tests/Visual/UserInterface/ThemeComparisonTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tests/WaveformTestBeatmap.cs b/osu.Game.Tests/WaveformTestBeatmap.cs index ab7bf7fb73..5e41392560 100644 --- a/osu.Game.Tests/WaveformTestBeatmap.cs +++ b/osu.Game.Tests/WaveformTestBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game.Tournament.Tests/Components/TestSceneDateTextBox.cs b/osu.Game.Tournament.Tests/Components/TestSceneDateTextBox.cs index 33165d385a..0e6e8f54bd 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneDateTextBox.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneDateTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Tests.Visual; using osu.Game.Tournament.Components; diff --git a/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentMatch.cs b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentMatch.cs index f98f55dfbc..66093b80a1 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentMatch.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentMatch.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Tournament.Models; diff --git a/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs index bb47683be1..9ade9965c5 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game.Tournament.Tests/Components/TestSceneMatchHeader.cs b/osu.Game.Tournament.Tests/Components/TestSceneMatchHeader.cs index b29e4964b6..55d58fef6e 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneMatchHeader.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneMatchHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; diff --git a/osu.Game.Tournament.Tests/Components/TestSceneMatchScoreDisplay.cs b/osu.Game.Tournament.Tests/Components/TestSceneMatchScoreDisplay.cs index 11b5cc7556..53301c34d4 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneMatchScoreDisplay.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneMatchScoreDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Utils; diff --git a/osu.Game.Tournament.Tests/Components/TestSceneRoundDisplay.cs b/osu.Game.Tournament.Tests/Components/TestSceneRoundDisplay.cs index 13bca7bea1..514a797068 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneRoundDisplay.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneRoundDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Tournament.Components; using osu.Game.Tournament.Models; diff --git a/osu.Game.Tournament.Tests/Components/TestSceneSongBar.cs b/osu.Game.Tournament.Tests/Components/TestSceneSongBar.cs index b6004c651b..f90269ae60 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneSongBar.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneSongBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament.Tests/Components/TestSceneTournamentBeatmapPanel.cs b/osu.Game.Tournament.Tests/Components/TestSceneTournamentBeatmapPanel.cs index b678f69b8f..1030aae903 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneTournamentBeatmapPanel.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneTournamentBeatmapPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Online.API; diff --git a/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs b/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs index 05989566c3..4a4def10b5 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament.Tests/Components/TestSceneTournamentModDisplay.cs b/osu.Game.Tournament.Tests/Components/TestSceneTournamentModDisplay.cs index 9feef36a02..fdd5578228 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneTournamentModDisplay.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneTournamentModDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tournament.Tests/NonVisual/CustomTourneyDirectoryTest.cs b/osu.Game.Tournament.Tests/NonVisual/CustomTourneyDirectoryTest.cs index 26fb03bed4..d314f40c30 100644 --- a/osu.Game.Tournament.Tests/NonVisual/CustomTourneyDirectoryTest.cs +++ b/osu.Game.Tournament.Tests/NonVisual/CustomTourneyDirectoryTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tournament.Tests/NonVisual/DataLoadTest.cs b/osu.Game.Tournament.Tests/NonVisual/DataLoadTest.cs index e5c539bbf1..ad776622be 100644 --- a/osu.Game.Tournament.Tests/NonVisual/DataLoadTest.cs +++ b/osu.Game.Tournament.Tests/NonVisual/DataLoadTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Threading.Tasks; diff --git a/osu.Game.Tournament.Tests/NonVisual/IPCLocationTest.cs b/osu.Game.Tournament.Tests/NonVisual/IPCLocationTest.cs index 80cc9be5c1..1bbbcc3661 100644 --- a/osu.Game.Tournament.Tests/NonVisual/IPCLocationTest.cs +++ b/osu.Game.Tournament.Tests/NonVisual/IPCLocationTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using System.Linq; using NUnit.Framework; diff --git a/osu.Game.Tournament.Tests/NonVisual/LadderInfoSerialisationTest.cs b/osu.Game.Tournament.Tests/NonVisual/LadderInfoSerialisationTest.cs index 8bdf909af3..f1e0966293 100644 --- a/osu.Game.Tournament.Tests/NonVisual/LadderInfoSerialisationTest.cs +++ b/osu.Game.Tournament.Tests/NonVisual/LadderInfoSerialisationTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; using NUnit.Framework; using osu.Game.Tournament.Models; diff --git a/osu.Game.Tournament.Tests/NonVisual/TournamentHostTest.cs b/osu.Game.Tournament.Tests/NonVisual/TournamentHostTest.cs index bf99f69b2a..8dc0946432 100644 --- a/osu.Game.Tournament.Tests/NonVisual/TournamentHostTest.cs +++ b/osu.Game.Tournament.Tests/NonVisual/TournamentHostTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading; using System.Threading.Tasks; diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneDrawingsScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneDrawingsScreen.cs index 0e38c777ba..e0c6aaf834 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneDrawingsScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneDrawingsScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs index 6879a71f1d..842324d03d 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneLadderEditorScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneLadderEditorScreen.cs index bceb3e6b74..7aade4fb82 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneLadderEditorScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneLadderEditorScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics.Cursor; diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneLadderScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneLadderScreen.cs index c4c100d506..1f817a1b22 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneLadderScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneLadderScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics.Cursor; diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneMapPoolScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneMapPoolScreen.cs index f732c5582b..e0f91cc359 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneMapPoolScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneMapPoolScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneRoundEditorScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneRoundEditorScreen.cs index 5c2b59df3a..656663ece7 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneRoundEditorScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneRoundEditorScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Tournament.Screens.Editors; namespace osu.Game.Tournament.Tests.Screens diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs index bd1bacd549..6061314796 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneSeedingEditorScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneSeedingEditorScreen.cs index 2722021216..94321e708f 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneSeedingEditorScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneSeedingEditorScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Tournament.Models; using osu.Game.Tournament.Screens.Editors; diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneSeedingScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneSeedingScreen.cs index a18e73e38f..2581ed4b7e 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneSeedingScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneSeedingScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneSetupScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneSetupScreen.cs index 70b260c84c..9070590b15 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneSetupScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneSetupScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Tournament.Screens.Setup; diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs index 8c43e25416..44e7c48887 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Tournament.Screens.Showcase; diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneStablePathSelectScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneStablePathSelectScreen.cs index b422227788..27e5c59600 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneStablePathSelectScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneStablePathSelectScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Tournament.Screens.Setup; namespace osu.Game.Tournament.Tests.Screens diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneTeamEditorScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneTeamEditorScreen.cs index fc6574ec8a..b38430ece5 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneTeamEditorScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneTeamEditorScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Tournament.Screens.Editors; namespace osu.Game.Tournament.Tests.Screens diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneTeamIntroScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneTeamIntroScreen.cs index e89aac73fa..fccc09c14e 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneTeamIntroScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneTeamIntroScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneTeamWinScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneTeamWinScreen.cs index d07cc4c431..3b48c2eee5 100644 --- a/osu.Game.Tournament.Tests/Screens/TestSceneTeamWinScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneTeamWinScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament.Tests/TestSceneTournamentSceneManager.cs b/osu.Game.Tournament.Tests/TestSceneTournamentSceneManager.cs index 53591da07b..e961a3c670 100644 --- a/osu.Game.Tournament.Tests/TestSceneTournamentSceneManager.cs +++ b/osu.Game.Tournament.Tests/TestSceneTournamentSceneManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; namespace osu.Game.Tournament.Tests diff --git a/osu.Game.Tournament.Tests/TournamentTestBrowser.cs b/osu.Game.Tournament.Tests/TournamentTestBrowser.cs index 50bdcd86c5..1adbe07709 100644 --- a/osu.Game.Tournament.Tests/TournamentTestBrowser.cs +++ b/osu.Game.Tournament.Tests/TournamentTestBrowser.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Testing; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; diff --git a/osu.Game.Tournament.Tests/TournamentTestRunner.cs b/osu.Game.Tournament.Tests/TournamentTestRunner.cs index 229ab41a1e..f95fcbf487 100644 --- a/osu.Game.Tournament.Tests/TournamentTestRunner.cs +++ b/osu.Game.Tournament.Tests/TournamentTestRunner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework; using osu.Framework.Platform; diff --git a/osu.Game.Tournament.Tests/TournamentTestScene.cs b/osu.Game.Tournament.Tests/TournamentTestScene.cs index 8c05b4e915..d631d028bb 100644 --- a/osu.Game.Tournament.Tests/TournamentTestScene.cs +++ b/osu.Game.Tournament.Tests/TournamentTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using System.Threading; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament/Components/ControlPanel.cs b/osu.Game.Tournament/Components/ControlPanel.cs index ef8c8767e0..f43d494d5a 100644 --- a/osu.Game.Tournament/Components/ControlPanel.cs +++ b/osu.Game.Tournament/Components/ControlPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game.Tournament/Components/DateTextBox.cs b/osu.Game.Tournament/Components/DateTextBox.cs index 2237e389d7..8eccb9e0e0 100644 --- a/osu.Game.Tournament/Components/DateTextBox.cs +++ b/osu.Game.Tournament/Components/DateTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game.Tournament/Components/DrawableTeamFlag.cs b/osu.Game.Tournament/Components/DrawableTeamFlag.cs index f8c2612d71..6e9c1120e4 100644 --- a/osu.Game.Tournament/Components/DrawableTeamFlag.cs +++ b/osu.Game.Tournament/Components/DrawableTeamFlag.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Components/DrawableTeamHeader.cs b/osu.Game.Tournament/Components/DrawableTeamHeader.cs index 3d9e8a6e00..ceaf8d5e6e 100644 --- a/osu.Game.Tournament/Components/DrawableTeamHeader.cs +++ b/osu.Game.Tournament/Components/DrawableTeamHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Tournament.Models; using osuTK; diff --git a/osu.Game.Tournament/Components/DrawableTeamTitle.cs b/osu.Game.Tournament/Components/DrawableTeamTitle.cs index 6732eb152f..b7e936026c 100644 --- a/osu.Game.Tournament/Components/DrawableTeamTitle.cs +++ b/osu.Game.Tournament/Components/DrawableTeamTitle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Components/DrawableTeamTitleWithHeader.cs b/osu.Game.Tournament/Components/DrawableTeamTitleWithHeader.cs index ceffe3d315..dbc9fa7f16 100644 --- a/osu.Game.Tournament/Components/DrawableTeamTitleWithHeader.cs +++ b/osu.Game.Tournament/Components/DrawableTeamTitleWithHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Tournament.Models; diff --git a/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs b/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs index 4d9afc23ac..21de2bb0eb 100644 --- a/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs +++ b/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tournament/Components/DrawableTournamentHeaderLogo.cs b/osu.Game.Tournament/Components/DrawableTournamentHeaderLogo.cs index 3f5ab42fd7..9f5b825e30 100644 --- a/osu.Game.Tournament/Components/DrawableTournamentHeaderLogo.cs +++ b/osu.Game.Tournament/Components/DrawableTournamentHeaderLogo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tournament/Components/DrawableTournamentHeaderText.cs b/osu.Game.Tournament/Components/DrawableTournamentHeaderText.cs index 99d914fed4..67eeee7de4 100644 --- a/osu.Game.Tournament/Components/DrawableTournamentHeaderText.cs +++ b/osu.Game.Tournament/Components/DrawableTournamentHeaderText.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tournament/Components/DrawableTournamentTeam.cs b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs index 367e447947..84cae92a39 100644 --- a/osu.Game.Tournament/Components/DrawableTournamentTeam.cs +++ b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Components/IPCErrorDialog.cs b/osu.Game.Tournament/Components/IPCErrorDialog.cs index dc039cd3bc..a32e01fb48 100644 --- a/osu.Game.Tournament/Components/IPCErrorDialog.cs +++ b/osu.Game.Tournament/Components/IPCErrorDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Sprites; using osu.Game.Overlays.Dialog; diff --git a/osu.Game.Tournament/Components/RoundDisplay.cs b/osu.Game.Tournament/Components/RoundDisplay.cs index c0002e6804..98ef09aa58 100644 --- a/osu.Game.Tournament/Components/RoundDisplay.cs +++ b/osu.Game.Tournament/Components/RoundDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index a45582a7c0..ecc655da99 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index b064d3dd79..6416abe8a9 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Specialized; using System.Linq; diff --git a/osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs b/osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs index c30250c86a..6a8e4aa951 100644 --- a/osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs +++ b/osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Components/TournamentModIcon.cs b/osu.Game.Tournament/Components/TournamentModIcon.cs index 57a0390ac2..6697a993c3 100644 --- a/osu.Game.Tournament/Components/TournamentModIcon.cs +++ b/osu.Game.Tournament/Components/TournamentModIcon.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tournament/Components/TournamentSpriteTextWithBackground.cs b/osu.Game.Tournament/Components/TournamentSpriteTextWithBackground.cs index d92b9eb605..0fc3646585 100644 --- a/osu.Game.Tournament/Components/TournamentSpriteTextWithBackground.cs +++ b/osu.Game.Tournament/Components/TournamentSpriteTextWithBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game.Tournament/Components/TourneyVideo.cs b/osu.Game.Tournament/Components/TourneyVideo.cs index 2709580385..c6bbb54f9a 100644 --- a/osu.Game.Tournament/Components/TourneyVideo.cs +++ b/osu.Game.Tournament/Components/TourneyVideo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game.Tournament/Configuration/TournamentStorageManager.cs b/osu.Game.Tournament/Configuration/TournamentStorageManager.cs index e3d0a9e75c..0b9a556296 100644 --- a/osu.Game.Tournament/Configuration/TournamentStorageManager.cs +++ b/osu.Game.Tournament/Configuration/TournamentStorageManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Configuration; using osu.Framework.Platform; diff --git a/osu.Game.Tournament/IO/TournamentStorage.cs b/osu.Game.Tournament/IO/TournamentStorage.cs index b4859d0c91..bd52b6dfed 100644 --- a/osu.Game.Tournament/IO/TournamentStorage.cs +++ b/osu.Game.Tournament/IO/TournamentStorage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.IO; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/IO/TournamentVideoResourceStore.cs b/osu.Game.Tournament/IO/TournamentVideoResourceStore.cs index 964d03220d..ba584f1d3e 100644 --- a/osu.Game.Tournament/IO/TournamentVideoResourceStore.cs +++ b/osu.Game.Tournament/IO/TournamentVideoResourceStore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.IO.Stores; using osu.Framework.Platform; diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index 5278d538d2..77af3e9b58 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game.Tournament/IPC/MatchIPCInfo.cs b/osu.Game.Tournament/IPC/MatchIPCInfo.cs index fa7079b824..ef1e36f871 100644 --- a/osu.Game.Tournament/IPC/MatchIPCInfo.cs +++ b/osu.Game.Tournament/IPC/MatchIPCInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps.Legacy; diff --git a/osu.Game.Tournament/IPC/TourneyState.cs b/osu.Game.Tournament/IPC/TourneyState.cs index ef1c612a53..2c7253dc10 100644 --- a/osu.Game.Tournament/IPC/TourneyState.cs +++ b/osu.Game.Tournament/IPC/TourneyState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Tournament.IPC { public enum TourneyState diff --git a/osu.Game.Tournament/JsonPointConverter.cs b/osu.Game.Tournament/JsonPointConverter.cs index 32bbe2dc18..db48c36c99 100644 --- a/osu.Game.Tournament/JsonPointConverter.cs +++ b/osu.Game.Tournament/JsonPointConverter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Drawing; diff --git a/osu.Game.Tournament/Models/BeatmapChoice.cs b/osu.Game.Tournament/Models/BeatmapChoice.cs index 384b349b24..ddd4597722 100644 --- a/osu.Game.Tournament/Models/BeatmapChoice.cs +++ b/osu.Game.Tournament/Models/BeatmapChoice.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Newtonsoft.Json; using Newtonsoft.Json.Converters; diff --git a/osu.Game.Tournament/Models/LadderEditorInfo.cs b/osu.Game.Tournament/Models/LadderEditorInfo.cs index 70fd115e25..84ebeff3db 100644 --- a/osu.Game.Tournament/Models/LadderEditorInfo.cs +++ b/osu.Game.Tournament/Models/LadderEditorInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; namespace osu.Game.Tournament.Models diff --git a/osu.Game.Tournament/Models/LadderInfo.cs b/osu.Game.Tournament/Models/LadderInfo.cs index 7794019437..0f73b60774 100644 --- a/osu.Game.Tournament/Models/LadderInfo.cs +++ b/osu.Game.Tournament/Models/LadderInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game.Tournament/Models/RoundBeatmap.cs b/osu.Game.Tournament/Models/RoundBeatmap.cs index 2fd79546f1..90e31ba352 100644 --- a/osu.Game.Tournament/Models/RoundBeatmap.cs +++ b/osu.Game.Tournament/Models/RoundBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game.Tournament/Models/SeedingBeatmap.cs b/osu.Game.Tournament/Models/SeedingBeatmap.cs index 26f3016ac8..c854488319 100644 --- a/osu.Game.Tournament/Models/SeedingBeatmap.cs +++ b/osu.Game.Tournament/Models/SeedingBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; using osu.Framework.Bindables; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game.Tournament/Models/SeedingResult.cs b/osu.Game.Tournament/Models/SeedingResult.cs index d37c967762..71e52b3324 100644 --- a/osu.Game.Tournament/Models/SeedingResult.cs +++ b/osu.Game.Tournament/Models/SeedingResult.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Models/StableInfo.cs b/osu.Game.Tournament/Models/StableInfo.cs index c835b11a4d..1ae80d4596 100644 --- a/osu.Game.Tournament/Models/StableInfo.cs +++ b/osu.Game.Tournament/Models/StableInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using Newtonsoft.Json; diff --git a/osu.Game.Tournament/Models/TournamentMatch.cs b/osu.Game.Tournament/Models/TournamentMatch.cs index bdfb1728f3..2f72dc9257 100644 --- a/osu.Game.Tournament/Models/TournamentMatch.cs +++ b/osu.Game.Tournament/Models/TournamentMatch.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/osu.Game.Tournament/Models/TournamentProgression.cs b/osu.Game.Tournament/Models/TournamentProgression.cs index 5575b4c29e..6c3ba1922a 100644 --- a/osu.Game.Tournament/Models/TournamentProgression.cs +++ b/osu.Game.Tournament/Models/TournamentProgression.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Tournament.Models diff --git a/osu.Game.Tournament/Models/TournamentRound.cs b/osu.Game.Tournament/Models/TournamentRound.cs index ab39605d07..480d6c37c3 100644 --- a/osu.Game.Tournament/Models/TournamentRound.cs +++ b/osu.Game.Tournament/Models/TournamentRound.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game.Tournament/Models/TournamentTeam.cs b/osu.Game.Tournament/Models/TournamentTeam.cs index 24dee3b372..051f1a6d80 100644 --- a/osu.Game.Tournament/Models/TournamentTeam.cs +++ b/osu.Game.Tournament/Models/TournamentTeam.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using Newtonsoft.Json; diff --git a/osu.Game.Tournament/Properties/AssemblyInfo.cs b/osu.Game.Tournament/Properties/AssemblyInfo.cs index 70e42bcafb..2eb8c3e1d6 100644 --- a/osu.Game.Tournament/Properties/AssemblyInfo.cs +++ b/osu.Game.Tournament/Properties/AssemblyInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Runtime.CompilerServices; // We publish our internal attributes to other sub-projects of the framework. diff --git a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs index 77b816d24c..296267a4bc 100644 --- a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs +++ b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/Screens/Drawings/Components/DrawingsConfigManager.cs b/osu.Game.Tournament/Screens/Drawings/Components/DrawingsConfigManager.cs index 1a2f5a1ff4..ac1d599851 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/DrawingsConfigManager.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/DrawingsConfigManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Configuration; using osu.Framework.Platform; diff --git a/osu.Game.Tournament/Screens/Drawings/Components/Group.cs b/osu.Game.Tournament/Screens/Drawings/Components/Group.cs index ece1c431e2..f50abd6e58 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/Group.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/Group.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/osu.Game.Tournament/Screens/Drawings/Components/GroupContainer.cs b/osu.Game.Tournament/Screens/Drawings/Components/GroupContainer.cs index b9a19090df..62b3c4e8ff 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/GroupContainer.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/GroupContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Tournament/Screens/Drawings/Components/GroupTeam.cs b/osu.Game.Tournament/Screens/Drawings/Components/GroupTeam.cs index cd252392ba..80bdad8b7b 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/GroupTeam.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/GroupTeam.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; diff --git a/osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs b/osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs index 09208818a9..7e0ac89c83 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Tournament.Models; diff --git a/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs b/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs index f1022a0402..52c611d323 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs b/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs index 5d035a4028..c230607343 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game.Tournament/Screens/Drawings/Components/VisualiserContainer.cs b/osu.Game.Tournament/Screens/Drawings/Components/VisualiserContainer.cs index f21f5c9460..15edbb76c1 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/VisualiserContainer.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/VisualiserContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index 53ac93afea..58ba3c1e8b 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game.Tournament/Screens/Editors/IModelBacked.cs b/osu.Game.Tournament/Screens/Editors/IModelBacked.cs index ed94bd7f45..ca59afa2cb 100644 --- a/osu.Game.Tournament/Screens/Editors/IModelBacked.cs +++ b/osu.Game.Tournament/Screens/Editors/IModelBacked.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Tournament.Screens.Editors { /// diff --git a/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs index ca46c3b050..6052bcdeb7 100644 --- a/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Drawing; using System.Linq; diff --git a/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs index 5c12d83d1c..214ae65289 100644 --- a/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Screens/Editors/SeedingEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/SeedingEditorScreen.cs index 5cdfe7dc08..1377c11225 100644 --- a/osu.Game.Tournament/Screens/Editors/SeedingEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/SeedingEditorScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs index 6adddb5204..005d8f36bb 100644 --- a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs index a5a2c5c15f..8af5bbe513 100644 --- a/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Specialized; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs index 8048425ce1..91a75bf86f 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchRoundDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchRoundDisplay.cs index 2f0e4b5e87..78206c6d47 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchRoundDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchRoundDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Tournament.Components; diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/TeamDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/TeamDisplay.cs index 33658115cc..bb187c9e67 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/TeamDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/TeamDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/TeamScore.cs b/osu.Game.Tournament/Screens/Gameplay/Components/TeamScore.cs index 36c78c5ac1..3fa06c16b4 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/TeamScore.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/TeamScore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/TeamScoreDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/TeamScoreDisplay.cs index da55ba53ea..ed11f097ed 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/TeamScoreDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/TeamScoreDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/TournamentMatchScoreDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/TournamentMatchScoreDisplay.cs index db15a46fc8..7454d22aa2 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/TournamentMatchScoreDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/TournamentMatchScoreDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index f900dd7eac..86b2c2a4e9 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/Screens/IProvideVideo.cs b/osu.Game.Tournament/Screens/IProvideVideo.cs index 61989d8448..aa67a5211f 100644 --- a/osu.Game.Tournament/Screens/IProvideVideo.cs +++ b/osu.Game.Tournament/Screens/IProvideVideo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Tournament.Screens { /// diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ConditionalTournamentMatch.cs b/osu.Game.Tournament/Screens/Ladder/Components/ConditionalTournamentMatch.cs index 16224a7fb4..04155fcb89 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/ConditionalTournamentMatch.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/ConditionalTournamentMatch.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Tournament.Models; namespace osu.Game.Tournament.Screens.Ladder.Components diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index ea453a53ca..c005e11efe 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentMatch.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentMatch.cs index 5729e779c4..5204edf3be 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentMatch.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentMatch.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Drawing; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs index cad0b827c0..ac196130d6 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index cf4466a2e3..f0eda5672a 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs index 960c4f41cc..c5f8c3bb51 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Lines; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/SettingsTeamDropdown.cs b/osu.Game.Tournament/Screens/Ladder/Components/SettingsTeamDropdown.cs index 6604e3a313..74424783c6 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/SettingsTeamDropdown.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/SettingsTeamDropdown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; diff --git a/osu.Game.Tournament/Screens/Ladder/LadderDragContainer.cs b/osu.Game.Tournament/Screens/Ladder/LadderDragContainer.cs index f98bfd087d..6fae44de35 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderDragContainer.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderDragContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index ad6e304c80..f274503894 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Specialized; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 3ae007f955..7ac4510ae5 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs index 84f38170ea..7a11e26794 100644 --- a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs +++ b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament/Screens/Setup/ActionableInfo.cs b/osu.Game.Tournament/Screens/Setup/ActionableInfo.cs index cfdf9c99ae..a9ac21284e 100644 --- a/osu.Game.Tournament/Screens/Setup/ActionableInfo.cs +++ b/osu.Game.Tournament/Screens/Setup/ActionableInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tournament/Screens/Setup/ResolutionSelector.cs b/osu.Game.Tournament/Screens/Setup/ResolutionSelector.cs index e53110651b..a387341d66 100644 --- a/osu.Game.Tournament/Screens/Setup/ResolutionSelector.cs +++ b/osu.Game.Tournament/Screens/Setup/ResolutionSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game.Tournament/Screens/Setup/SetupScreen.cs b/osu.Game.Tournament/Screens/Setup/SetupScreen.cs index f6d28c15e0..42eff3565f 100644 --- a/osu.Game.Tournament/Screens/Setup/SetupScreen.cs +++ b/osu.Game.Tournament/Screens/Setup/SetupScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Drawing; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Screens/Setup/StablePathSelectScreen.cs b/osu.Game.Tournament/Screens/Setup/StablePathSelectScreen.cs index fb9ca46c2d..fac488fcf5 100644 --- a/osu.Game.Tournament/Screens/Setup/StablePathSelectScreen.cs +++ b/osu.Game.Tournament/Screens/Setup/StablePathSelectScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs b/osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs index f0aa857769..fb33b3662a 100644 --- a/osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs +++ b/osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs index 32d458e191..082aa99b0e 100644 --- a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs +++ b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs b/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs index bd5aa2f5d9..07a632ec72 100644 --- a/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs +++ b/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs index 0003e213e7..b9559015d6 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index ef6f0b32ff..98dfaa7487 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs index 11db7bfad9..50207547cd 100644 --- a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs +++ b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/Screens/TournamentMatchScreen.cs b/osu.Game.Tournament/Screens/TournamentMatchScreen.cs index 5f00036653..585cdd09c1 100644 --- a/osu.Game.Tournament/Screens/TournamentMatchScreen.cs +++ b/osu.Game.Tournament/Screens/TournamentMatchScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Tournament.Models; diff --git a/osu.Game.Tournament/Screens/TournamentScreen.cs b/osu.Game.Tournament/Screens/TournamentScreen.cs index 5da7c7a5d2..b4641fa45d 100644 --- a/osu.Game.Tournament/Screens/TournamentScreen.cs +++ b/osu.Game.Tournament/Screens/TournamentScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index 7967f54b49..c2c6c271cb 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Drawing; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 6ae0312cce..2d6d5a01e4 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game.Tournament/TournamentSceneManager.cs b/osu.Game.Tournament/TournamentSceneManager.cs index 98338244e4..afbfc2d368 100644 --- a/osu.Game.Tournament/TournamentSceneManager.cs +++ b/osu.Game.Tournament/TournamentSceneManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament/TournamentSpriteText.cs b/osu.Game.Tournament/TournamentSpriteText.cs index e550dfbfae..166a8dfaf0 100644 --- a/osu.Game.Tournament/TournamentSpriteText.cs +++ b/osu.Game.Tournament/TournamentSpriteText.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game.Tournament/TourneyButton.cs b/osu.Game.Tournament/TourneyButton.cs index 12872d3197..f5a82771f5 100644 --- a/osu.Game.Tournament/TourneyButton.cs +++ b/osu.Game.Tournament/TourneyButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Graphics.UserInterface; namespace osu.Game.Tournament diff --git a/osu.Game.Tournament/WarningBox.cs b/osu.Game.Tournament/WarningBox.cs index 814482aea4..123e78113a 100644 --- a/osu.Game.Tournament/WarningBox.cs +++ b/osu.Game.Tournament/WarningBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Audio/Effects/AudioFilter.cs b/osu.Game/Audio/Effects/AudioFilter.cs index 9446967173..5c318eb957 100644 --- a/osu.Game/Audio/Effects/AudioFilter.cs +++ b/osu.Game/Audio/Effects/AudioFilter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using ManagedBass.Fx; using osu.Framework.Audio.Mixing; diff --git a/osu.Game/Audio/Effects/ITransformableFilter.cs b/osu.Game/Audio/Effects/ITransformableFilter.cs index fb6a924f68..02149b362c 100644 --- a/osu.Game/Audio/Effects/ITransformableFilter.cs +++ b/osu.Game/Audio/Effects/ITransformableFilter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; diff --git a/osu.Game/Audio/HitSampleInfo.cs b/osu.Game/Audio/HitSampleInfo.cs index 3d90dd0189..6aaf3d5cc2 100644 --- a/osu.Game/Audio/HitSampleInfo.cs +++ b/osu.Game/Audio/HitSampleInfo.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game/Audio/IPreviewTrackOwner.cs b/osu.Game/Audio/IPreviewTrackOwner.cs index 8ab93257a5..6a3acc2059 100644 --- a/osu.Game/Audio/IPreviewTrackOwner.cs +++ b/osu.Game/Audio/IPreviewTrackOwner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Audio { /// diff --git a/osu.Game/Audio/ISampleInfo.cs b/osu.Game/Audio/ISampleInfo.cs index 4f81d37e78..8f58415587 100644 --- a/osu.Game/Audio/ISampleInfo.cs +++ b/osu.Game/Audio/ISampleInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; namespace osu.Game.Audio diff --git a/osu.Game/Audio/ISamplePlaybackDisabler.cs b/osu.Game/Audio/ISamplePlaybackDisabler.cs index 4167316780..250e004b05 100644 --- a/osu.Game/Audio/ISamplePlaybackDisabler.cs +++ b/osu.Game/Audio/ISamplePlaybackDisabler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Skinning; diff --git a/osu.Game/Audio/PreviewTrack.cs b/osu.Game/Audio/PreviewTrack.cs index 5df656e1e0..8ff8cd5c54 100644 --- a/osu.Game/Audio/PreviewTrack.cs +++ b/osu.Game/Audio/PreviewTrack.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Audio.Track; diff --git a/osu.Game/Audio/PreviewTrackManager.cs b/osu.Game/Audio/PreviewTrackManager.cs index 6d56d152f1..d19fdbd94c 100644 --- a/osu.Game/Audio/PreviewTrackManager.cs +++ b/osu.Game/Audio/PreviewTrackManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 5d8240204e..54b380f23a 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections; using System.Collections.Generic; diff --git a/osu.Game/Beatmaps/APIFailTimes.cs b/osu.Game/Beatmaps/APIFailTimes.cs index 7218906b38..441d30d06b 100644 --- a/osu.Game/Beatmaps/APIFailTimes.cs +++ b/osu.Game/Beatmaps/APIFailTimes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Newtonsoft.Json; diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 2fa5a56042..c499bccb68 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Beatmaps.Timing; using osu.Game.Rulesets.Objects; diff --git a/osu.Game/Beatmaps/BeatmapConverter.cs b/osu.Game/Beatmaps/BeatmapConverter.cs index 627e54c803..4419791e43 100644 --- a/osu.Game/Beatmaps/BeatmapConverter.cs +++ b/osu.Game/Beatmaps/BeatmapConverter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Beatmaps/BeatmapDifficulty.cs b/osu.Game/Beatmaps/BeatmapDifficulty.cs index 7e0462f1e8..f4bc5e7b77 100644 --- a/osu.Game/Beatmaps/BeatmapDifficulty.cs +++ b/osu.Game/Beatmaps/BeatmapDifficulty.cs @@ -4,8 +4,6 @@ using osu.Framework.Testing; using Realms; -#nullable enable - namespace osu.Game.Beatmaps { [ExcludeFromDynamicCompile] diff --git a/osu.Game/Beatmaps/BeatmapDifficultyCache.cs b/osu.Game/Beatmaps/BeatmapDifficultyCache.cs index f102daeef5..69488277f1 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyCache.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyCache.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Beatmaps/BeatmapImporter.cs b/osu.Game/Beatmaps/BeatmapImporter.cs index 5e3aa434b8..e463492e2b 100644 --- a/osu.Game/Beatmaps/BeatmapImporter.cs +++ b/osu.Game/Beatmaps/BeatmapImporter.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 5925dd7064..346bf86818 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Beatmaps/BeatmapInfoExtensions.cs b/osu.Game/Beatmaps/BeatmapInfoExtensions.cs index eab66b9857..e7ff07fa5d 100644 --- a/osu.Game/Beatmaps/BeatmapInfoExtensions.cs +++ b/osu.Game/Beatmaps/BeatmapInfoExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Localisation; diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 192ef0d37d..1dd3f82426 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Beatmaps/BeatmapMetadata.cs b/osu.Game/Beatmaps/BeatmapMetadata.cs index 3a24c4808f..feb9d34f44 100644 --- a/osu.Game/Beatmaps/BeatmapMetadata.cs +++ b/osu.Game/Beatmaps/BeatmapMetadata.cs @@ -10,8 +10,6 @@ using osu.Game.Users; using osu.Game.Utils; using Realms; -#nullable enable - namespace osu.Game.Beatmaps { [ExcludeFromDynamicCompile] diff --git a/osu.Game/Beatmaps/BeatmapMetadataInfoExtensions.cs b/osu.Game/Beatmaps/BeatmapMetadataInfoExtensions.cs index 7e7d1babf0..738bdb0839 100644 --- a/osu.Game/Beatmaps/BeatmapMetadataInfoExtensions.cs +++ b/osu.Game/Beatmaps/BeatmapMetadataInfoExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Localisation; diff --git a/osu.Game/Beatmaps/BeatmapModelDownloader.cs b/osu.Game/Beatmaps/BeatmapModelDownloader.cs index d31730ca15..74d583fe7e 100644 --- a/osu.Game/Beatmaps/BeatmapModelDownloader.cs +++ b/osu.Game/Beatmaps/BeatmapModelDownloader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Database; using osu.Game.Online.API; using osu.Game.Online.API.Requests; diff --git a/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs b/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs index 44fa8092fb..a2eb76cafa 100644 --- a/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs +++ b/osu.Game/Beatmaps/BeatmapOnlineLookupQueue.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.IO; diff --git a/osu.Game/Beatmaps/BeatmapOnlineStatus.cs b/osu.Game/Beatmaps/BeatmapOnlineStatus.cs index 7ac25b7b75..ced85e0908 100644 --- a/osu.Game/Beatmaps/BeatmapOnlineStatus.cs +++ b/osu.Game/Beatmaps/BeatmapOnlineStatus.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index cdeaab06ed..8f3d0b7445 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Game.Rulesets.Objects.Types; diff --git a/osu.Game/Beatmaps/BeatmapSetFileInfo.cs b/osu.Game/Beatmaps/BeatmapSetFileInfo.cs index 3d41f59b3d..051366fb99 100644 --- a/osu.Game/Beatmaps/BeatmapSetFileInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetFileInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel.DataAnnotations; using osu.Game.Database; using osu.Game.IO; diff --git a/osu.Game/Beatmaps/BeatmapSetHypeStatus.cs b/osu.Game/Beatmaps/BeatmapSetHypeStatus.cs index 8a576e396a..b2d4cac210 100644 --- a/osu.Game/Beatmaps/BeatmapSetHypeStatus.cs +++ b/osu.Game/Beatmaps/BeatmapSetHypeStatus.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Beatmaps diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index 9a4207d5cf..96d95b1a12 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -12,8 +12,6 @@ using osu.Game.Extensions; using osu.Game.Models; using Realms; -#nullable enable - namespace osu.Game.Beatmaps { [ExcludeFromDynamicCompile] diff --git a/osu.Game/Beatmaps/BeatmapSetNominationStatus.cs b/osu.Game/Beatmaps/BeatmapSetNominationStatus.cs index 6a19616a97..cea0063814 100644 --- a/osu.Game/Beatmaps/BeatmapSetNominationStatus.cs +++ b/osu.Game/Beatmaps/BeatmapSetNominationStatus.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Beatmaps diff --git a/osu.Game/Beatmaps/BeatmapSetOnlineAvailability.cs b/osu.Game/Beatmaps/BeatmapSetOnlineAvailability.cs index 14a63f3279..12424b797c 100644 --- a/osu.Game/Beatmaps/BeatmapSetOnlineAvailability.cs +++ b/osu.Game/Beatmaps/BeatmapSetOnlineAvailability.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Beatmaps diff --git a/osu.Game/Beatmaps/BeatmapSetOnlineCovers.cs b/osu.Game/Beatmaps/BeatmapSetOnlineCovers.cs index aad31befa8..b76496b145 100644 --- a/osu.Game/Beatmaps/BeatmapSetOnlineCovers.cs +++ b/osu.Game/Beatmaps/BeatmapSetOnlineCovers.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Beatmaps diff --git a/osu.Game/Beatmaps/BeatmapSetOnlineGenre.cs b/osu.Game/Beatmaps/BeatmapSetOnlineGenre.cs index e727e2c37f..ad2e994d3e 100644 --- a/osu.Game/Beatmaps/BeatmapSetOnlineGenre.cs +++ b/osu.Game/Beatmaps/BeatmapSetOnlineGenre.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Beatmaps { public struct BeatmapSetOnlineGenre diff --git a/osu.Game/Beatmaps/BeatmapSetOnlineLanguage.cs b/osu.Game/Beatmaps/BeatmapSetOnlineLanguage.cs index 658e5a4005..c71c279086 100644 --- a/osu.Game/Beatmaps/BeatmapSetOnlineLanguage.cs +++ b/osu.Game/Beatmaps/BeatmapSetOnlineLanguage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Beatmaps { public struct BeatmapSetOnlineLanguage diff --git a/osu.Game/Beatmaps/BeatmapStatistic.cs b/osu.Game/Beatmaps/BeatmapStatistic.cs index 94ebb56a5c..13e0e4ad5e 100644 --- a/osu.Game/Beatmaps/BeatmapStatistic.cs +++ b/osu.Game/Beatmaps/BeatmapStatistic.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Beatmaps/BeatmapStatisticIcon.cs b/osu.Game/Beatmaps/BeatmapStatisticIcon.cs index 181fb540df..58d13a3172 100644 --- a/osu.Game/Beatmaps/BeatmapStatisticIcon.cs +++ b/osu.Game/Beatmaps/BeatmapStatisticIcon.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Humanizer; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Beatmaps/BeatmapUserSettings.cs b/osu.Game/Beatmaps/BeatmapUserSettings.cs index 5c71bf34b1..1d993e6d67 100644 --- a/osu.Game/Beatmaps/BeatmapUserSettings.cs +++ b/osu.Game/Beatmaps/BeatmapUserSettings.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable using Realms; namespace osu.Game.Beatmaps diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs index 4079a0cd5f..5f06e03509 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Newtonsoft.Json; using osu.Game.Graphics; diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointGroup.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointGroup.cs index cb73ce884e..9df38b01ee 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointGroup.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointGroup.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index af03d639be..eda7ef0bcc 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs index bf7ed8e6f5..8b3d755fb6 100644 --- a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Graphics; using osuTK.Graphics; diff --git a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs index 7f550a52fc..35425972da 100644 --- a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Graphics; using osuTK.Graphics; diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index fb489f73b1..bed499ef3f 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Audio; using osu.Game.Graphics; diff --git a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs index 3a7c8b2ec0..922439fcb8 100644 --- a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Bindables; using osu.Game.Beatmaps.Timing; using osu.Game.Graphics; diff --git a/osu.Game/Beatmaps/CountdownType.cs b/osu.Game/Beatmaps/CountdownType.cs index 73f85bf701..7fb3de74fb 100644 --- a/osu.Game/Beatmaps/CountdownType.cs +++ b/osu.Game/Beatmaps/CountdownType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Beatmaps diff --git a/osu.Game/Beatmaps/DifficultyRating.cs b/osu.Game/Beatmaps/DifficultyRating.cs index f0ee0ad705..478c0e36df 100644 --- a/osu.Game/Beatmaps/DifficultyRating.cs +++ b/osu.Game/Beatmaps/DifficultyRating.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Beatmaps { public enum DifficultyRating diff --git a/osu.Game/Beatmaps/DifficultyRecommender.cs b/osu.Game/Beatmaps/DifficultyRecommender.cs index 4629b20569..ed2d6cd3a8 100644 --- a/osu.Game/Beatmaps/DifficultyRecommender.cs +++ b/osu.Game/Beatmaps/DifficultyRecommender.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs index 916df429a4..4ba16839f5 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Beatmaps/Drawables/BeatmapDownloadButton.cs b/osu.Game/Beatmaps/Drawables/BeatmapDownloadButton.cs index 6ab92a2ba2..4dd3a56244 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapDownloadButton.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapDownloadButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index 19026638ba..88d4991c5d 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs index 5ebdee0b09..9b97df906b 100644 --- a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs +++ b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs index 08aaa8da42..b9e0a4e6cb 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardContent.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardContent.cs index 1aaa72f5f0..bfec391b1d 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardContent.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardContent.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardContentBackground.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardContentBackground.cs index 392f5d1bfa..64a28c5394 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardContentBackground.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardContentBackground.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardDifficultyList.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardDifficultyList.cs index eeb86f4702..9489116530 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardDifficultyList.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardDifficultyList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardDownloadProgressBar.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardDownloadProgressBar.cs index ffb4e0c540..d55622d7aa 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardDownloadProgressBar.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardDownloadProgressBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs index 7826d64296..4b9e5d9ae4 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtraInfoRow.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtraInfoRow.cs index 2d411ad344..7ba677e5dc 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtraInfoRow.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtraInfoRow.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs index c1ba521925..d9ce64879f 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardSize.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardSize.cs index 098265506d..1f6538a890 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardSize.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardSize.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Beatmaps.Drawables.Cards { /// diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardThumbnail.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardThumbnail.cs index f11a5916e1..55d3f0b969 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardThumbnail.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardThumbnail.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapSetFavouriteState.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapSetFavouriteState.cs index 82523cc865..8f8a47c199 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/BeatmapSetFavouriteState.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapSetFavouriteState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps.Drawables.Cards.Buttons; using osu.Game.Beatmaps.Drawables.Cards.Statistics; diff --git a/osu.Game/Beatmaps/Drawables/Cards/Buttons/BeatmapCardIconButton.cs b/osu.Game/Beatmaps/Drawables/Cards/Buttons/BeatmapCardIconButton.cs index e362e3abeb..c5b251cc2b 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/Buttons/BeatmapCardIconButton.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/Buttons/BeatmapCardIconButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Beatmaps/Drawables/Cards/Buttons/DownloadButton.cs b/osu.Game/Beatmaps/Drawables/Cards/Buttons/DownloadButton.cs index c94e335e8f..fdb43cb47e 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/Buttons/DownloadButton.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/Buttons/DownloadButton.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Beatmaps/Drawables/Cards/Buttons/FavouriteButton.cs b/osu.Game/Beatmaps/Drawables/Cards/Buttons/FavouriteButton.cs index 9fed2fde6f..78481ac27a 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/Buttons/FavouriteButton.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/Buttons/FavouriteButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Beatmaps/Drawables/Cards/Buttons/GoToBeatmapButton.cs b/osu.Game/Beatmaps/Drawables/Cards/Buttons/GoToBeatmapButton.cs index 9a6a3c01b7..127c5bd903 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/Buttons/GoToBeatmapButton.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/Buttons/GoToBeatmapButton.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Beatmaps/Drawables/Cards/Buttons/PlayButton.cs b/osu.Game/Beatmaps/Drawables/Cards/Buttons/PlayButton.cs index f7bab26666..18eab09465 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/Buttons/PlayButton.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/Buttons/PlayButton.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Beatmaps/Drawables/Cards/CollapsibleButtonContainer.cs b/osu.Game/Beatmaps/Drawables/Cards/CollapsibleButtonContainer.cs index 3a2cb80a8d..107c126eb5 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/CollapsibleButtonContainer.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/CollapsibleButtonContainer.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Beatmaps/Drawables/Cards/ExpandedContentScrollContainer.cs b/osu.Game/Beatmaps/Drawables/Cards/ExpandedContentScrollContainer.cs index adde72d1e8..a80a7998a5 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/ExpandedContentScrollContainer.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/ExpandedContentScrollContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Input.Events; diff --git a/osu.Game/Beatmaps/Drawables/Cards/HoverHandlingContainer.cs b/osu.Game/Beatmaps/Drawables/Cards/HoverHandlingContainer.cs index fe37616755..7d70f3c4cd 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/HoverHandlingContainer.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/HoverHandlingContainer.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; diff --git a/osu.Game/Beatmaps/Drawables/Cards/IconPill.cs b/osu.Game/Beatmaps/Drawables/Cards/IconPill.cs index 1b2c5d3ffc..aad71610a5 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/IconPill.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/IconPill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; diff --git a/osu.Game/Beatmaps/Drawables/Cards/Statistics/BeatmapCardDateStatistic.cs b/osu.Game/Beatmaps/Drawables/Cards/Statistics/BeatmapCardDateStatistic.cs index 9dbe5a9114..f6fc3070aa 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/Statistics/BeatmapCardDateStatistic.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/Statistics/BeatmapCardDateStatistic.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics.Cursor; diff --git a/osu.Game/Beatmaps/Drawables/Cards/Statistics/BeatmapCardStatistic.cs b/osu.Game/Beatmaps/Drawables/Cards/Statistics/BeatmapCardStatistic.cs index f46926284f..89a4687500 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/Statistics/BeatmapCardStatistic.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/Statistics/BeatmapCardStatistic.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Beatmaps/Drawables/Cards/Statistics/FavouritesStatistic.cs b/osu.Game/Beatmaps/Drawables/Cards/Statistics/FavouritesStatistic.cs index d924fd938b..cef1f630ed 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/Statistics/FavouritesStatistic.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/Statistics/FavouritesStatistic.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Humanizer; using osu.Framework.Bindables; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Beatmaps/Drawables/Cards/Statistics/HypesStatistic.cs b/osu.Game/Beatmaps/Drawables/Cards/Statistics/HypesStatistic.cs index 521d1a5f21..26b90ba0c0 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/Statistics/HypesStatistic.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/Statistics/HypesStatistic.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics.Sprites; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Beatmaps/Drawables/Cards/Statistics/NominationsStatistic.cs b/osu.Game/Beatmaps/Drawables/Cards/Statistics/NominationsStatistic.cs index 23bd6ef0a9..4f3605c138 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/Statistics/NominationsStatistic.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/Statistics/NominationsStatistic.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics.Sprites; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Beatmaps/Drawables/Cards/Statistics/PlayCountStatistic.cs b/osu.Game/Beatmaps/Drawables/Cards/Statistics/PlayCountStatistic.cs index d8f0c36bd9..f66d51de5d 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/Statistics/PlayCountStatistic.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/Statistics/PlayCountStatistic.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Humanizer; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Beatmaps/Drawables/Cards/StoryboardIconPill.cs b/osu.Game/Beatmaps/Drawables/Cards/StoryboardIconPill.cs index 2ebf9107f5..dcb2c3c760 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/StoryboardIconPill.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/StoryboardIconPill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Beatmaps/Drawables/Cards/VideoIconPill.cs b/osu.Game/Beatmaps/Drawables/Cards/VideoIconPill.cs index b81e18b0dd..9ca1e5c4c4 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/VideoIconPill.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/VideoIconPill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 82be0559a7..a1b0f04aae 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Threading; diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIconTooltip.cs b/osu.Game/Beatmaps/Drawables/DifficultyIconTooltip.cs index 5479644772..4732de6e79 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIconTooltip.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIconTooltip.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Beatmaps/Drawables/DifficultySpectrumDisplay.cs b/osu.Game/Beatmaps/Drawables/DifficultySpectrumDisplay.cs index 5b467d67e2..22ca0a9037 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultySpectrumDisplay.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultySpectrumDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Beatmaps/Drawables/DownloadProgressBar.cs b/osu.Game/Beatmaps/Drawables/DownloadProgressBar.cs index ad0ff876e8..50bd7ad48e 100644 --- a/osu.Game/Beatmaps/Drawables/DownloadProgressBar.cs +++ b/osu.Game/Beatmaps/Drawables/DownloadProgressBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Beatmaps/Drawables/GroupedDifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/GroupedDifficultyIcon.cs index 799a02579e..15ca4c60d4 100644 --- a/osu.Game/Beatmaps/Drawables/GroupedDifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/GroupedDifficultyIcon.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; diff --git a/osu.Game/Beatmaps/Drawables/OnlineBeatmapSetCover.cs b/osu.Game/Beatmaps/Drawables/OnlineBeatmapSetCover.cs index 0b19c27022..063990c89c 100644 --- a/osu.Game/Beatmaps/Drawables/OnlineBeatmapSetCover.cs +++ b/osu.Game/Beatmaps/Drawables/OnlineBeatmapSetCover.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Beatmaps/Drawables/StarRatingDisplay.cs b/osu.Game/Beatmaps/Drawables/StarRatingDisplay.cs index dde7680989..44bccd69d0 100644 --- a/osu.Game/Beatmaps/Drawables/StarRatingDisplay.cs +++ b/osu.Game/Beatmaps/Drawables/StarRatingDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs index 636c568bd0..f37771a74d 100644 --- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Beatmaps/Drawables/UpdateableOnlineBeatmapSetCover.cs b/osu.Game/Beatmaps/Drawables/UpdateableOnlineBeatmapSetCover.cs index 4a6a1b888e..236bb63e24 100644 --- a/osu.Game/Beatmaps/Drawables/UpdateableOnlineBeatmapSetCover.cs +++ b/osu.Game/Beatmaps/Drawables/UpdateableOnlineBeatmapSetCover.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 6e879d09d5..9610dbcc78 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/Beatmaps/EFBeatmapDifficulty.cs b/osu.Game/Beatmaps/EFBeatmapDifficulty.cs index 38371d3b38..8bcac24ca1 100644 --- a/osu.Game/Beatmaps/EFBeatmapDifficulty.cs +++ b/osu.Game/Beatmaps/EFBeatmapDifficulty.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.ComponentModel.DataAnnotations.Schema; using osu.Game.Database; diff --git a/osu.Game/Beatmaps/EFBeatmapInfo.cs b/osu.Game/Beatmaps/EFBeatmapInfo.cs index 740adfd1c7..34311448eb 100644 --- a/osu.Game/Beatmaps/EFBeatmapInfo.cs +++ b/osu.Game/Beatmaps/EFBeatmapInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; diff --git a/osu.Game/Beatmaps/EFBeatmapMetadata.cs b/osu.Game/Beatmaps/EFBeatmapMetadata.cs index 7c27863a7f..c0588f128c 100644 --- a/osu.Game/Beatmaps/EFBeatmapMetadata.cs +++ b/osu.Game/Beatmaps/EFBeatmapMetadata.cs @@ -10,8 +10,6 @@ using osu.Game.Database; using osu.Game.Online.API.Requests.Responses; using osu.Game.Users; -#nullable enable - namespace osu.Game.Beatmaps { [ExcludeFromDynamicCompile] diff --git a/osu.Game/Beatmaps/EFBeatmapSetInfo.cs b/osu.Game/Beatmaps/EFBeatmapSetInfo.cs index 12235abce0..1f41d3727c 100644 --- a/osu.Game/Beatmaps/EFBeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/EFBeatmapSetInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; diff --git a/osu.Game/Beatmaps/FlatFileWorkingBeatmap.cs b/osu.Game/Beatmaps/FlatFileWorkingBeatmap.cs index cd8aa31ead..02fcde5257 100644 --- a/osu.Game/Beatmaps/FlatFileWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/FlatFileWorkingBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using osu.Framework.Audio.Track; diff --git a/osu.Game/Beatmaps/Formats/Decoder.cs b/osu.Game/Beatmaps/Formats/Decoder.cs index c1537d7240..aad29f46fb 100644 --- a/osu.Game/Beatmaps/Formats/Decoder.cs +++ b/osu.Game/Beatmaps/Formats/Decoder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/Beatmaps/Formats/IHasComboColours.cs b/osu.Game/Beatmaps/Formats/IHasComboColours.cs index 853a590595..d5e96da246 100644 --- a/osu.Game/Beatmaps/Formats/IHasComboColours.cs +++ b/osu.Game/Beatmaps/Formats/IHasComboColours.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osuTK.Graphics; diff --git a/osu.Game/Beatmaps/Formats/IHasCustomColours.cs b/osu.Game/Beatmaps/Formats/IHasCustomColours.cs index dba3a37545..b651ef9515 100644 --- a/osu.Game/Beatmaps/Formats/IHasCustomColours.cs +++ b/osu.Game/Beatmaps/Formats/IHasCustomColours.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osuTK.Graphics; diff --git a/osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs index 0d5c48f64d..2f11c18993 100644 --- a/osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.IO; using osu.Game.IO.Serialization; diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 3a893a1238..89d3465ab6 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs index 3b4200e7a9..984e88d3a9 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Globalization; diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index ff13e61360..f2c5b494de 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Extensions; diff --git a/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs index 3420fcf260..bf69100361 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; namespace osu.Game.Beatmaps.Formats diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs index 90a96e2ac8..3021688aaf 100644 --- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/Beatmaps/Formats/Parsing.cs b/osu.Game/Beatmaps/Formats/Parsing.cs index 4d512fdeed..ce04f27020 100644 --- a/osu.Game/Beatmaps/Formats/Parsing.cs +++ b/osu.Game/Beatmaps/Formats/Parsing.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; diff --git a/osu.Game/Beatmaps/IBeatSyncProvider.cs b/osu.Game/Beatmaps/IBeatSyncProvider.cs index cc1cfc3cb5..362f02f2dd 100644 --- a/osu.Game/Beatmaps/IBeatSyncProvider.cs +++ b/osu.Game/Beatmaps/IBeatSyncProvider.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Audio.Track; using osu.Framework.Timing; diff --git a/osu.Game/Beatmaps/IBeatmap.cs b/osu.Game/Beatmaps/IBeatmap.cs index dec1ef4294..25b147c267 100644 --- a/osu.Game/Beatmaps/IBeatmap.cs +++ b/osu.Game/Beatmaps/IBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.Timing; diff --git a/osu.Game/Beatmaps/IBeatmapConverter.cs b/osu.Game/Beatmaps/IBeatmapConverter.cs index 2833af8ca2..f84188c5e2 100644 --- a/osu.Game/Beatmaps/IBeatmapConverter.cs +++ b/osu.Game/Beatmaps/IBeatmapConverter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Threading; diff --git a/osu.Game/Beatmaps/IBeatmapDifficultyInfo.cs b/osu.Game/Beatmaps/IBeatmapDifficultyInfo.cs index 339364d442..dad9bbbd0b 100644 --- a/osu.Game/Beatmaps/IBeatmapDifficultyInfo.cs +++ b/osu.Game/Beatmaps/IBeatmapDifficultyInfo.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - namespace osu.Game.Beatmaps { /// diff --git a/osu.Game/Beatmaps/IBeatmapInfo.cs b/osu.Game/Beatmaps/IBeatmapInfo.cs index ab096b8897..4f2c08f63d 100644 --- a/osu.Game/Beatmaps/IBeatmapInfo.cs +++ b/osu.Game/Beatmaps/IBeatmapInfo.cs @@ -5,8 +5,6 @@ using System; using osu.Game.Database; using osu.Game.Rulesets; -#nullable enable - namespace osu.Game.Beatmaps { /// diff --git a/osu.Game/Beatmaps/IBeatmapMetadataInfo.cs b/osu.Game/Beatmaps/IBeatmapMetadataInfo.cs index 61adc0ac34..9c96aba85b 100644 --- a/osu.Game/Beatmaps/IBeatmapMetadataInfo.cs +++ b/osu.Game/Beatmaps/IBeatmapMetadataInfo.cs @@ -4,8 +4,6 @@ using System; using osu.Game.Users; -#nullable enable - namespace osu.Game.Beatmaps { /// diff --git a/osu.Game/Beatmaps/IBeatmapOnlineInfo.cs b/osu.Game/Beatmaps/IBeatmapOnlineInfo.cs index 385646eeaa..160b7cf0ae 100644 --- a/osu.Game/Beatmaps/IBeatmapOnlineInfo.cs +++ b/osu.Game/Beatmaps/IBeatmapOnlineInfo.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - namespace osu.Game.Beatmaps { /// diff --git a/osu.Game/Beatmaps/IBeatmapProcessor.cs b/osu.Game/Beatmaps/IBeatmapProcessor.cs index 014dccf5e3..0a4a98c606 100644 --- a/osu.Game/Beatmaps/IBeatmapProcessor.cs +++ b/osu.Game/Beatmaps/IBeatmapProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; diff --git a/osu.Game/Beatmaps/IBeatmapResourceProvider.cs b/osu.Game/Beatmaps/IBeatmapResourceProvider.cs index dfea0c7a30..22ff7ce8c8 100644 --- a/osu.Game/Beatmaps/IBeatmapResourceProvider.cs +++ b/osu.Game/Beatmaps/IBeatmapResourceProvider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Audio.Track; using osu.Framework.Graphics.Textures; using osu.Game.IO; diff --git a/osu.Game/Beatmaps/IBeatmapSetInfo.cs b/osu.Game/Beatmaps/IBeatmapSetInfo.cs index 9755120457..2ecd16cb75 100644 --- a/osu.Game/Beatmaps/IBeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/IBeatmapSetInfo.cs @@ -5,8 +5,6 @@ using System; using System.Collections.Generic; using osu.Game.Database; -#nullable enable - namespace osu.Game.Beatmaps { /// diff --git a/osu.Game/Beatmaps/IBeatmapSetOnlineInfo.cs b/osu.Game/Beatmaps/IBeatmapSetOnlineInfo.cs index 33d8929008..3f50b4eaf3 100644 --- a/osu.Game/Beatmaps/IBeatmapSetOnlineInfo.cs +++ b/osu.Game/Beatmaps/IBeatmapSetOnlineInfo.cs @@ -3,8 +3,6 @@ using System; -#nullable enable - namespace osu.Game.Beatmaps { /// diff --git a/osu.Game/Beatmaps/IWorkingBeatmap.cs b/osu.Game/Beatmaps/IWorkingBeatmap.cs index 3e2868470a..2188bd6a2b 100644 --- a/osu.Game/Beatmaps/IWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/IWorkingBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.IO; using System.Threading; diff --git a/osu.Game/Beatmaps/IWorkingBeatmapCache.cs b/osu.Game/Beatmaps/IWorkingBeatmapCache.cs index 3eb33f10d6..ad9cac6957 100644 --- a/osu.Game/Beatmaps/IWorkingBeatmapCache.cs +++ b/osu.Game/Beatmaps/IWorkingBeatmapCache.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Beatmaps { public interface IWorkingBeatmapCache diff --git a/osu.Game/Beatmaps/Legacy/LegacyControlPointInfo.cs b/osu.Game/Beatmaps/Legacy/LegacyControlPointInfo.cs index 2b0a2e7a4d..19432f0c58 100644 --- a/osu.Game/Beatmaps/Legacy/LegacyControlPointInfo.cs +++ b/osu.Game/Beatmaps/Legacy/LegacyControlPointInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using JetBrains.Annotations; using Newtonsoft.Json; diff --git a/osu.Game/Beatmaps/Legacy/LegacyEffectFlags.cs b/osu.Game/Beatmaps/Legacy/LegacyEffectFlags.cs index 5bf80c34d7..b3717c81dc 100644 --- a/osu.Game/Beatmaps/Legacy/LegacyEffectFlags.cs +++ b/osu.Game/Beatmaps/Legacy/LegacyEffectFlags.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Beatmaps.Legacy diff --git a/osu.Game/Beatmaps/Legacy/LegacyEventType.cs b/osu.Game/Beatmaps/Legacy/LegacyEventType.cs index 32a7122978..42d21d14f6 100644 --- a/osu.Game/Beatmaps/Legacy/LegacyEventType.cs +++ b/osu.Game/Beatmaps/Legacy/LegacyEventType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Beatmaps.Legacy { internal enum LegacyEventType diff --git a/osu.Game/Beatmaps/Legacy/LegacyHitObjectType.cs b/osu.Game/Beatmaps/Legacy/LegacyHitObjectType.cs index ec9839b893..ec947c6dc2 100644 --- a/osu.Game/Beatmaps/Legacy/LegacyHitObjectType.cs +++ b/osu.Game/Beatmaps/Legacy/LegacyHitObjectType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Beatmaps.Legacy diff --git a/osu.Game/Beatmaps/Legacy/LegacyHitSoundType.cs b/osu.Game/Beatmaps/Legacy/LegacyHitSoundType.cs index d7743565f8..d1782ec862 100644 --- a/osu.Game/Beatmaps/Legacy/LegacyHitSoundType.cs +++ b/osu.Game/Beatmaps/Legacy/LegacyHitSoundType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Beatmaps.Legacy diff --git a/osu.Game/Beatmaps/Legacy/LegacyMods.cs b/osu.Game/Beatmaps/Legacy/LegacyMods.cs index 0e517ea3df..27b2e313ec 100644 --- a/osu.Game/Beatmaps/Legacy/LegacyMods.cs +++ b/osu.Game/Beatmaps/Legacy/LegacyMods.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Beatmaps.Legacy diff --git a/osu.Game/Beatmaps/Legacy/LegacyOrigins.cs b/osu.Game/Beatmaps/Legacy/LegacyOrigins.cs index 31f67d6dfd..62b0edc384 100644 --- a/osu.Game/Beatmaps/Legacy/LegacyOrigins.cs +++ b/osu.Game/Beatmaps/Legacy/LegacyOrigins.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Beatmaps.Legacy { internal enum LegacyOrigins diff --git a/osu.Game/Beatmaps/Legacy/LegacySampleBank.cs b/osu.Game/Beatmaps/Legacy/LegacySampleBank.cs index 8cac29cb87..f8a57c3ac9 100644 --- a/osu.Game/Beatmaps/Legacy/LegacySampleBank.cs +++ b/osu.Game/Beatmaps/Legacy/LegacySampleBank.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Beatmaps.Legacy { internal enum LegacySampleBank diff --git a/osu.Game/Beatmaps/Legacy/LegacyStoryLayer.cs b/osu.Game/Beatmaps/Legacy/LegacyStoryLayer.cs index ea23c49c4a..69d0c96b57 100644 --- a/osu.Game/Beatmaps/Legacy/LegacyStoryLayer.cs +++ b/osu.Game/Beatmaps/Legacy/LegacyStoryLayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Beatmaps.Legacy { internal enum LegacyStoryLayer diff --git a/osu.Game/Beatmaps/MetadataUtils.cs b/osu.Game/Beatmaps/MetadataUtils.cs index b27c59b4de..89c821c16c 100644 --- a/osu.Game/Beatmaps/MetadataUtils.cs +++ b/osu.Game/Beatmaps/MetadataUtils.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Linq; using System.Text; diff --git a/osu.Game/Beatmaps/StarDifficulty.cs b/osu.Game/Beatmaps/StarDifficulty.cs index f438b6f0bc..91bc3aacf6 100644 --- a/osu.Game/Beatmaps/StarDifficulty.cs +++ b/osu.Game/Beatmaps/StarDifficulty.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Game.Rulesets.Difficulty; diff --git a/osu.Game/Beatmaps/Timing/BreakPeriod.cs b/osu.Game/Beatmaps/Timing/BreakPeriod.cs index 4c90b16745..274b56a862 100644 --- a/osu.Game/Beatmaps/Timing/BreakPeriod.cs +++ b/osu.Game/Beatmaps/Timing/BreakPeriod.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Screens.Play; namespace osu.Game.Beatmaps.Timing diff --git a/osu.Game/Beatmaps/Timing/TimeSignature.cs b/osu.Game/Beatmaps/Timing/TimeSignature.cs index eebbcc34cd..7499a725dc 100644 --- a/osu.Game/Beatmaps/Timing/TimeSignature.cs +++ b/osu.Game/Beatmaps/Timing/TimeSignature.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Beatmaps.Timing diff --git a/osu.Game/Beatmaps/Timing/TimeSignatures.cs b/osu.Game/Beatmaps/Timing/TimeSignatures.cs index d783d3f9ec..95c971eebf 100644 --- a/osu.Game/Beatmaps/Timing/TimeSignatures.cs +++ b/osu.Game/Beatmaps/Timing/TimeSignatures.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.ComponentModel; diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 09072ec897..16464932e0 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Beatmaps/WorkingBeatmapCache.cs b/osu.Game/Beatmaps/WorkingBeatmapCache.cs index bc810ee35e..4495fb8318 100644 --- a/osu.Game/Beatmaps/WorkingBeatmapCache.cs +++ b/osu.Game/Beatmaps/WorkingBeatmapCache.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game/Collections/BeatmapCollection.cs b/osu.Game/Collections/BeatmapCollection.cs index cf95c74b46..23b2ef60dd 100644 --- a/osu.Game/Collections/BeatmapCollection.cs +++ b/osu.Game/Collections/BeatmapCollection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Game.Beatmaps; diff --git a/osu.Game/Collections/CollectionFilterDropdown.cs b/osu.Game/Collections/CollectionFilterDropdown.cs index 100074d186..46d90b930c 100644 --- a/osu.Game/Collections/CollectionFilterDropdown.cs +++ b/osu.Game/Collections/CollectionFilterDropdown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Specialized; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Collections/CollectionFilterMenuItem.cs b/osu.Game/Collections/CollectionFilterMenuItem.cs index 0617996872..031f05c0b4 100644 --- a/osu.Game/Collections/CollectionFilterMenuItem.cs +++ b/osu.Game/Collections/CollectionFilterMenuItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Bindables; diff --git a/osu.Game/Collections/CollectionManager.cs b/osu.Game/Collections/CollectionManager.cs index 104ec4beb2..c6e52a1b75 100644 --- a/osu.Game/Collections/CollectionManager.cs +++ b/osu.Game/Collections/CollectionManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/osu.Game/Collections/DeleteCollectionDialog.cs b/osu.Game/Collections/DeleteCollectionDialog.cs index e59adb14a6..1da2870913 100644 --- a/osu.Game/Collections/DeleteCollectionDialog.cs +++ b/osu.Game/Collections/DeleteCollectionDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Humanizer; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Collections/DrawableCollectionList.cs b/osu.Game/Collections/DrawableCollectionList.cs index 3c664a11d9..4fe5733c2f 100644 --- a/osu.Game/Collections/DrawableCollectionList.cs +++ b/osu.Game/Collections/DrawableCollectionList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Collections/DrawableCollectionListItem.cs b/osu.Game/Collections/DrawableCollectionListItem.cs index 5064041737..4596fc0e52 100644 --- a/osu.Game/Collections/DrawableCollectionListItem.cs +++ b/osu.Game/Collections/DrawableCollectionListItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Collections/ManageCollectionsDialog.cs b/osu.Game/Collections/ManageCollectionsDialog.cs index cb350bca33..a9d699bc9f 100644 --- a/osu.Game/Collections/ManageCollectionsDialog.cs +++ b/osu.Game/Collections/ManageCollectionsDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; diff --git a/osu.Game/Configuration/BackgroundSource.cs b/osu.Game/Configuration/BackgroundSource.cs index 18e0603860..b4a1fd78c3 100644 --- a/osu.Game/Configuration/BackgroundSource.cs +++ b/osu.Game/Configuration/BackgroundSource.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Configuration diff --git a/osu.Game/Configuration/DatabasedSetting.cs b/osu.Game/Configuration/DatabasedSetting.cs index 65d9f7799d..0c1b4021a1 100644 --- a/osu.Game/Configuration/DatabasedSetting.cs +++ b/osu.Game/Configuration/DatabasedSetting.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel.DataAnnotations.Schema; using osu.Game.Database; diff --git a/osu.Game/Configuration/DevelopmentOsuConfigManager.cs b/osu.Game/Configuration/DevelopmentOsuConfigManager.cs index ff19dd874c..dda30c1d00 100644 --- a/osu.Game/Configuration/DevelopmentOsuConfigManager.cs +++ b/osu.Game/Configuration/DevelopmentOsuConfigManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Platform; using osu.Framework.Testing; diff --git a/osu.Game/Configuration/DiscordRichPresenceMode.cs b/osu.Game/Configuration/DiscordRichPresenceMode.cs index 2e58e3554b..935619920a 100644 --- a/osu.Game/Configuration/DiscordRichPresenceMode.cs +++ b/osu.Game/Configuration/DiscordRichPresenceMode.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Configuration diff --git a/osu.Game/Configuration/HUDVisibilityMode.cs b/osu.Game/Configuration/HUDVisibilityMode.cs index 10f3f65355..ec54bfcb71 100644 --- a/osu.Game/Configuration/HUDVisibilityMode.cs +++ b/osu.Game/Configuration/HUDVisibilityMode.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Configuration diff --git a/osu.Game/Configuration/InMemoryConfigManager.cs b/osu.Game/Configuration/InMemoryConfigManager.cs index ccf697f680..d8879daa3f 100644 --- a/osu.Game/Configuration/InMemoryConfigManager.cs +++ b/osu.Game/Configuration/InMemoryConfigManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Configuration; diff --git a/osu.Game/Configuration/IntroSequence.cs b/osu.Game/Configuration/IntroSequence.cs index 5672c44bbe..8327ea2f57 100644 --- a/osu.Game/Configuration/IntroSequence.cs +++ b/osu.Game/Configuration/IntroSequence.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Configuration { public enum IntroSequence diff --git a/osu.Game/Configuration/ModSettingChangeTracker.cs b/osu.Game/Configuration/ModSettingChangeTracker.cs index e2ade7dc6a..0061746425 100644 --- a/osu.Game/Configuration/ModSettingChangeTracker.cs +++ b/osu.Game/Configuration/ModSettingChangeTracker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 20d555c16c..a0e1d9ddc4 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Configuration/RandomSelectAlgorithm.cs b/osu.Game/Configuration/RandomSelectAlgorithm.cs index b22f2ae485..9a02aaee60 100644 --- a/osu.Game/Configuration/RandomSelectAlgorithm.cs +++ b/osu.Game/Configuration/RandomSelectAlgorithm.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Configuration diff --git a/osu.Game/Configuration/RealmRulesetSetting.cs b/osu.Game/Configuration/RealmRulesetSetting.cs index 3fea35ee9d..2e8ccc6b0c 100644 --- a/osu.Game/Configuration/RealmRulesetSetting.cs +++ b/osu.Game/Configuration/RealmRulesetSetting.cs @@ -3,8 +3,6 @@ using Realms; -#nullable enable - namespace osu.Game.Configuration { [MapTo(@"RulesetSetting")] diff --git a/osu.Game/Configuration/ReleaseStream.cs b/osu.Game/Configuration/ReleaseStream.cs index ed0bee1dd8..9cdd91bfd0 100644 --- a/osu.Game/Configuration/ReleaseStream.cs +++ b/osu.Game/Configuration/ReleaseStream.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Configuration { public enum ReleaseStream diff --git a/osu.Game/Configuration/ScalingMode.cs b/osu.Game/Configuration/ScalingMode.cs index 0bcc908f71..25c3692a1a 100644 --- a/osu.Game/Configuration/ScalingMode.cs +++ b/osu.Game/Configuration/ScalingMode.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Configuration diff --git a/osu.Game/Configuration/ScreenshotFormat.cs b/osu.Game/Configuration/ScreenshotFormat.cs index 6d4c96bfa9..57c08538b8 100644 --- a/osu.Game/Configuration/ScreenshotFormat.cs +++ b/osu.Game/Configuration/ScreenshotFormat.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Configuration diff --git a/osu.Game/Configuration/ScrollVisualisationMethod.cs b/osu.Game/Configuration/ScrollVisualisationMethod.cs index 5f48fe8bfd..111bb95e67 100644 --- a/osu.Game/Configuration/ScrollVisualisationMethod.cs +++ b/osu.Game/Configuration/ScrollVisualisationMethod.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Configuration diff --git a/osu.Game/Configuration/SeasonalBackgroundMode.cs b/osu.Game/Configuration/SeasonalBackgroundMode.cs index 6ef835ce5f..909798fe97 100644 --- a/osu.Game/Configuration/SeasonalBackgroundMode.cs +++ b/osu.Game/Configuration/SeasonalBackgroundMode.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Configuration { public enum SeasonalBackgroundMode diff --git a/osu.Game/Configuration/SessionStatics.cs b/osu.Game/Configuration/SessionStatics.cs index 837ee7e634..12a30a0c84 100644 --- a/osu.Game/Configuration/SessionStatics.cs +++ b/osu.Game/Configuration/SessionStatics.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; diff --git a/osu.Game/Configuration/SettingSourceAttribute.cs b/osu.Game/Configuration/SettingSourceAttribute.cs index 89f0e73f4f..21e67363c3 100644 --- a/osu.Game/Configuration/SettingSourceAttribute.cs +++ b/osu.Game/Configuration/SettingSourceAttribute.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Concurrent; using System.Collections.Generic; diff --git a/osu.Game/Configuration/SettingsStore.cs b/osu.Game/Configuration/SettingsStore.cs index e5d2d572c8..fda7193fea 100644 --- a/osu.Game/Configuration/SettingsStore.cs +++ b/osu.Game/Configuration/SettingsStore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Database; namespace osu.Game.Configuration diff --git a/osu.Game/Configuration/StorageConfigManager.cs b/osu.Game/Configuration/StorageConfigManager.cs index 90ea42b638..c8781918e1 100644 --- a/osu.Game/Configuration/StorageConfigManager.cs +++ b/osu.Game/Configuration/StorageConfigManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Configuration; using osu.Framework.Platform; diff --git a/osu.Game/Configuration/ToolbarClockDisplayMode.cs b/osu.Game/Configuration/ToolbarClockDisplayMode.cs index 2f42f7a9b5..682e221ef8 100644 --- a/osu.Game/Configuration/ToolbarClockDisplayMode.cs +++ b/osu.Game/Configuration/ToolbarClockDisplayMode.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Configuration { public enum ToolbarClockDisplayMode diff --git a/osu.Game/Database/BeatmapLookupCache.cs b/osu.Game/Database/BeatmapLookupCache.cs index 06edc3e2da..53cb7d72fc 100644 --- a/osu.Game/Database/BeatmapLookupCache.cs +++ b/osu.Game/Database/BeatmapLookupCache.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using System.Threading; diff --git a/osu.Game/Database/DatabaseContextFactory.cs b/osu.Game/Database/DatabaseContextFactory.cs index d222aec6b3..8af649fbfa 100644 --- a/osu.Game/Database/DatabaseContextFactory.cs +++ b/osu.Game/Database/DatabaseContextFactory.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game/Database/DatabaseWriteUsage.cs b/osu.Game/Database/DatabaseWriteUsage.cs index 84c39e3532..b5f25eae20 100644 --- a/osu.Game/Database/DatabaseWriteUsage.cs +++ b/osu.Game/Database/DatabaseWriteUsage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; diff --git a/osu.Game/Database/EFToRealmMigrator.cs b/osu.Game/Database/EFToRealmMigrator.cs index 2486071c01..896d111989 100644 --- a/osu.Game/Database/EFToRealmMigrator.cs +++ b/osu.Game/Database/EFToRealmMigrator.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.IO; using System.Linq; diff --git a/osu.Game/Database/EmptyRealmSet.cs b/osu.Game/Database/EmptyRealmSet.cs index b7f27ba035..7db946d79f 100644 --- a/osu.Game/Database/EmptyRealmSet.cs +++ b/osu.Game/Database/EmptyRealmSet.cs @@ -9,8 +9,6 @@ using System.ComponentModel; using Realms; using Realms.Schema; -#nullable enable - namespace osu.Game.Database { public class EmptyRealmSet : IRealmCollection diff --git a/osu.Game/Database/ICanAcceptFiles.cs b/osu.Game/Database/ICanAcceptFiles.cs index 3cec3b8a8e..3ce343249b 100644 --- a/osu.Game/Database/ICanAcceptFiles.cs +++ b/osu.Game/Database/ICanAcceptFiles.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Threading.Tasks; diff --git a/osu.Game/Database/IDatabaseContextFactory.cs b/osu.Game/Database/IDatabaseContextFactory.cs index 72b70a208f..bddabad586 100644 --- a/osu.Game/Database/IDatabaseContextFactory.cs +++ b/osu.Game/Database/IDatabaseContextFactory.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Database { public interface IDatabaseContextFactory diff --git a/osu.Game/Database/IHasFiles.cs b/osu.Game/Database/IHasFiles.cs index 3f6531832f..9f8ce05218 100644 --- a/osu.Game/Database/IHasFiles.cs +++ b/osu.Game/Database/IHasFiles.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using JetBrains.Annotations; diff --git a/osu.Game/Database/IHasGuidPrimaryKey.cs b/osu.Game/Database/IHasGuidPrimaryKey.cs index f52dc5c8ef..9cf7cf0683 100644 --- a/osu.Game/Database/IHasGuidPrimaryKey.cs +++ b/osu.Game/Database/IHasGuidPrimaryKey.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Newtonsoft.Json; using Realms; diff --git a/osu.Game/Database/IHasNamedFiles.cs b/osu.Game/Database/IHasNamedFiles.cs index 08906aaa08..3524eb4c99 100644 --- a/osu.Game/Database/IHasNamedFiles.cs +++ b/osu.Game/Database/IHasNamedFiles.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; namespace osu.Game.Database diff --git a/osu.Game/Database/IHasOnlineID.cs b/osu.Game/Database/IHasOnlineID.cs index 7a720989cd..e703ce58b8 100644 --- a/osu.Game/Database/IHasOnlineID.cs +++ b/osu.Game/Database/IHasOnlineID.cs @@ -3,8 +3,6 @@ using System; -#nullable enable - namespace osu.Game.Database { public interface IHasOnlineID diff --git a/osu.Game/Database/IHasPrimaryKey.cs b/osu.Game/Database/IHasPrimaryKey.cs index 51a49948fe..84709ccd26 100644 --- a/osu.Game/Database/IHasPrimaryKey.cs +++ b/osu.Game/Database/IHasPrimaryKey.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; diff --git a/osu.Game/Database/IHasRealmFiles.cs b/osu.Game/Database/IHasRealmFiles.cs index 024d9f2a89..2adfe73d1e 100644 --- a/osu.Game/Database/IHasRealmFiles.cs +++ b/osu.Game/Database/IHasRealmFiles.cs @@ -4,8 +4,6 @@ using System.Collections.Generic; using osu.Game.Models; -#nullable enable - namespace osu.Game.Database { /// diff --git a/osu.Game/Database/IModelDownloader.cs b/osu.Game/Database/IModelDownloader.cs index 81fba14244..6f30dd207e 100644 --- a/osu.Game/Database/IModelDownloader.cs +++ b/osu.Game/Database/IModelDownloader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Online.API; diff --git a/osu.Game/Database/IModelFileManager.cs b/osu.Game/Database/IModelFileManager.cs index 390be4a69d..c40b57f663 100644 --- a/osu.Game/Database/IModelFileManager.cs +++ b/osu.Game/Database/IModelFileManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; namespace osu.Game.Database diff --git a/osu.Game/Database/IModelImporter.cs b/osu.Game/Database/IModelImporter.cs index b59636e88d..bf9f2f9c75 100644 --- a/osu.Game/Database/IModelImporter.cs +++ b/osu.Game/Database/IModelImporter.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Collections.Generic; using System.Threading.Tasks; using osu.Game.Overlays.Notifications; diff --git a/osu.Game/Database/IModelManager.cs b/osu.Game/Database/IModelManager.cs index 187ac86a59..988178818d 100644 --- a/osu.Game/Database/IModelManager.cs +++ b/osu.Game/Database/IModelManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; namespace osu.Game.Database diff --git a/osu.Game/Database/INamedFile.cs b/osu.Game/Database/INamedFile.cs index 2bd45d4e42..5378d15a75 100644 --- a/osu.Game/Database/INamedFile.cs +++ b/osu.Game/Database/INamedFile.cs @@ -3,8 +3,6 @@ using osu.Game.Models; -#nullable enable - namespace osu.Game.Database { /// diff --git a/osu.Game/Database/INamedFileInfo.cs b/osu.Game/Database/INamedFileInfo.cs index d95f228440..9df4a0869c 100644 --- a/osu.Game/Database/INamedFileInfo.cs +++ b/osu.Game/Database/INamedFileInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.IO; namespace osu.Game.Database diff --git a/osu.Game/Database/INamedFileUsage.cs b/osu.Game/Database/INamedFileUsage.cs index e558ffe0fb..e2721f17bf 100644 --- a/osu.Game/Database/INamedFileUsage.cs +++ b/osu.Game/Database/INamedFileUsage.cs @@ -3,8 +3,6 @@ using osu.Game.IO; -#nullable enable - namespace osu.Game.Database { /// diff --git a/osu.Game/Database/IPostImports.cs b/osu.Game/Database/IPostImports.cs index 6f047098da..83a211f6e6 100644 --- a/osu.Game/Database/IPostImports.cs +++ b/osu.Game/Database/IPostImports.cs @@ -4,8 +4,6 @@ using System; using System.Collections.Generic; -#nullable enable - namespace osu.Game.Database { public interface IPostImports diff --git a/osu.Game/Database/IPostNotifications.cs b/osu.Game/Database/IPostNotifications.cs index d4fd64e79e..8bb2c54945 100644 --- a/osu.Game/Database/IPostNotifications.cs +++ b/osu.Game/Database/IPostNotifications.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Overlays.Notifications; diff --git a/osu.Game/Database/ISoftDelete.cs b/osu.Game/Database/ISoftDelete.cs index afa42c2002..b07c8db2de 100644 --- a/osu.Game/Database/ISoftDelete.cs +++ b/osu.Game/Database/ISoftDelete.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Database { /// diff --git a/osu.Game/Database/ImportProgressNotification.cs b/osu.Game/Database/ImportProgressNotification.cs index aaee3e117f..46f9936bc2 100644 --- a/osu.Game/Database/ImportProgressNotification.cs +++ b/osu.Game/Database/ImportProgressNotification.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Overlays.Notifications; namespace osu.Game.Database diff --git a/osu.Game/Database/ImportTask.cs b/osu.Game/Database/ImportTask.cs index e34b4c76a9..0643300fc5 100644 --- a/osu.Game/Database/ImportTask.cs +++ b/osu.Game/Database/ImportTask.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.IO; using osu.Framework.Extensions; using osu.Game.IO.Archives; diff --git a/osu.Game/Database/LegacyBeatmapExporter.cs b/osu.Game/Database/LegacyBeatmapExporter.cs index fb8ee8f5f5..d064b9ed58 100644 --- a/osu.Game/Database/LegacyBeatmapExporter.cs +++ b/osu.Game/Database/LegacyBeatmapExporter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Platform; using osu.Game.Beatmaps; diff --git a/osu.Game/Database/LegacyBeatmapImporter.cs b/osu.Game/Database/LegacyBeatmapImporter.cs index 3477312154..6805cb36b8 100644 --- a/osu.Game/Database/LegacyBeatmapImporter.cs +++ b/osu.Game/Database/LegacyBeatmapImporter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.IO.Stores; diff --git a/osu.Game/Database/LegacyExporter.cs b/osu.Game/Database/LegacyExporter.cs index 992d1854e7..d9fdc40abc 100644 --- a/osu.Game/Database/LegacyExporter.cs +++ b/osu.Game/Database/LegacyExporter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using osu.Framework.Platform; using osu.Game.Extensions; diff --git a/osu.Game/Database/LegacyImportManager.cs b/osu.Game/Database/LegacyImportManager.cs index af9db1b6ec..f40e0d33c2 100644 --- a/osu.Game/Database/LegacyImportManager.cs +++ b/osu.Game/Database/LegacyImportManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Threading; diff --git a/osu.Game/Database/LegacyModelImporter.cs b/osu.Game/Database/LegacyModelImporter.cs index 9b2a54dada..df354a856e 100644 --- a/osu.Game/Database/LegacyModelImporter.cs +++ b/osu.Game/Database/LegacyModelImporter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; diff --git a/osu.Game/Database/LegacyScoreExporter.cs b/osu.Game/Database/LegacyScoreExporter.cs index 336f50bc3d..6fa02b957d 100644 --- a/osu.Game/Database/LegacyScoreExporter.cs +++ b/osu.Game/Database/LegacyScoreExporter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using System.Linq; using osu.Framework.Platform; diff --git a/osu.Game/Database/LegacyScoreImporter.cs b/osu.Game/Database/LegacyScoreImporter.cs index 131b4ffb0e..f61241141e 100644 --- a/osu.Game/Database/LegacyScoreImporter.cs +++ b/osu.Game/Database/LegacyScoreImporter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/Database/LegacySkinExporter.cs b/osu.Game/Database/LegacySkinExporter.cs index 9432a1b5fc..1d5364fb8d 100644 --- a/osu.Game/Database/LegacySkinExporter.cs +++ b/osu.Game/Database/LegacySkinExporter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Platform; using osu.Game.Skinning; diff --git a/osu.Game/Database/LegacySkinImporter.cs b/osu.Game/Database/LegacySkinImporter.cs index 2f05ccae45..42b2f2e1d8 100644 --- a/osu.Game/Database/LegacySkinImporter.cs +++ b/osu.Game/Database/LegacySkinImporter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Skinning; namespace osu.Game.Database diff --git a/osu.Game/Database/Live.cs b/osu.Game/Database/Live.cs index 6256902e17..e9f99e1e44 100644 --- a/osu.Game/Database/Live.cs +++ b/osu.Game/Database/Live.cs @@ -3,8 +3,6 @@ using System; -#nullable enable - namespace osu.Game.Database { /// diff --git a/osu.Game/Database/MemoryCachingComponent.cs b/osu.Game/Database/MemoryCachingComponent.cs index a1a1279d71..6e6d928dcc 100644 --- a/osu.Game/Database/MemoryCachingComponent.cs +++ b/osu.Game/Database/MemoryCachingComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Concurrent; using System.Threading; using System.Threading.Tasks; diff --git a/osu.Game/Database/ModelDownloader.cs b/osu.Game/Database/ModelDownloader.cs index 2fa3357b06..76717fd46f 100644 --- a/osu.Game/Database/ModelDownloader.cs +++ b/osu.Game/Database/ModelDownloader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Database/ModelManager.cs b/osu.Game/Database/ModelManager.cs index 795647e94c..e0c3dccf57 100644 --- a/osu.Game/Database/ModelManager.cs +++ b/osu.Game/Database/ModelManager.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/Database/OnlineLookupCache.cs b/osu.Game/Database/OnlineLookupCache.cs index 506103a2c0..317c37bbfb 100644 --- a/osu.Game/Database/OnlineLookupCache.cs +++ b/osu.Game/Database/OnlineLookupCache.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Database/OsuDbContext.cs b/osu.Game/Database/OsuDbContext.cs index 79183b6f0e..118a8ee469 100644 --- a/osu.Game/Database/OsuDbContext.cs +++ b/osu.Game/Database/OsuDbContext.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index b144b70574..865a8b5021 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.ComponentModel; diff --git a/osu.Game/Database/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs index 32e71c5521..c5e04a8a0f 100644 --- a/osu.Game/Database/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/Database/RealmExtensions.cs b/osu.Game/Database/RealmExtensions.cs index 551b84f7b6..73e9f16d33 100644 --- a/osu.Game/Database/RealmExtensions.cs +++ b/osu.Game/Database/RealmExtensions.cs @@ -4,8 +4,6 @@ using System; using Realms; -#nullable enable - namespace osu.Game.Database { public static class RealmExtensions diff --git a/osu.Game/Database/RealmFileStore.cs b/osu.Game/Database/RealmFileStore.cs index 94f04ff0f3..ecb152c45c 100644 --- a/osu.Game/Database/RealmFileStore.cs +++ b/osu.Game/Database/RealmFileStore.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.IO; using System.Linq; diff --git a/osu.Game/Database/RealmLive.cs b/osu.Game/Database/RealmLive.cs index ecfececaa4..72de747807 100644 --- a/osu.Game/Database/RealmLive.cs +++ b/osu.Game/Database/RealmLive.cs @@ -7,8 +7,6 @@ using osu.Framework.Development; using osu.Framework.Statistics; using Realms; -#nullable enable - namespace osu.Game.Database { /// diff --git a/osu.Game/Database/RealmLiveUnmanaged.cs b/osu.Game/Database/RealmLiveUnmanaged.cs index 1080f3b8c7..5ab66cac7b 100644 --- a/osu.Game/Database/RealmLiveUnmanaged.cs +++ b/osu.Game/Database/RealmLiveUnmanaged.cs @@ -4,8 +4,6 @@ using System; using Realms; -#nullable enable - namespace osu.Game.Database { /// diff --git a/osu.Game/Database/RealmObjectExtensions.cs b/osu.Game/Database/RealmObjectExtensions.cs index 6dc18df9e0..25416c7fa2 100644 --- a/osu.Game/Database/RealmObjectExtensions.cs +++ b/osu.Game/Database/RealmObjectExtensions.cs @@ -14,8 +14,6 @@ using osu.Game.Rulesets; using osu.Game.Scoring; using Realms; -#nullable enable - namespace osu.Game.Database { public static class RealmObjectExtensions diff --git a/osu.Game/Database/UserLookupCache.cs b/osu.Game/Database/UserLookupCache.cs index 5fdd80892d..87f08d36ae 100644 --- a/osu.Game/Database/UserLookupCache.cs +++ b/osu.Game/Database/UserLookupCache.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using System.Threading; diff --git a/osu.Game/Extensions/CollectionExtensions.cs b/osu.Game/Extensions/CollectionExtensions.cs index 473dc4b8f4..c573d169f1 100644 --- a/osu.Game/Extensions/CollectionExtensions.cs +++ b/osu.Game/Extensions/CollectionExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; namespace osu.Game.Extensions diff --git a/osu.Game/Extensions/DrawableExtensions.cs b/osu.Game/Extensions/DrawableExtensions.cs index d1aba2bfe3..c2c00e342b 100644 --- a/osu.Game/Extensions/DrawableExtensions.cs +++ b/osu.Game/Extensions/DrawableExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Humanizer; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Extensions/LanguageExtensions.cs b/osu.Game/Extensions/LanguageExtensions.cs index b67e7fb6fc..3b1e9c7719 100644 --- a/osu.Game/Extensions/LanguageExtensions.cs +++ b/osu.Game/Extensions/LanguageExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; using osu.Game.Localisation; diff --git a/osu.Game/Extensions/ModelExtensions.cs b/osu.Game/Extensions/ModelExtensions.cs index 13c25e45c8..b10071bb45 100644 --- a/osu.Game/Extensions/ModelExtensions.cs +++ b/osu.Game/Extensions/ModelExtensions.cs @@ -11,8 +11,6 @@ using osu.Game.Rulesets; using osu.Game.Scoring; using osu.Game.Users; -#nullable enable - namespace osu.Game.Extensions { public static class ModelExtensions diff --git a/osu.Game/Extensions/TaskExtensions.cs b/osu.Game/Extensions/TaskExtensions.cs index 17f1a491f8..5165ae59b5 100644 --- a/osu.Game/Extensions/TaskExtensions.cs +++ b/osu.Game/Extensions/TaskExtensions.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Threading; using System.Threading.Tasks; diff --git a/osu.Game/Extensions/TimeDisplayExtensions.cs b/osu.Game/Extensions/TimeDisplayExtensions.cs index 98633958ee..94871233ed 100644 --- a/osu.Game/Extensions/TimeDisplayExtensions.cs +++ b/osu.Game/Extensions/TimeDisplayExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Humanizer; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Extensions/TypeExtensions.cs b/osu.Game/Extensions/TypeExtensions.cs index 2e93c81758..6f160b0479 100644 --- a/osu.Game/Extensions/TypeExtensions.cs +++ b/osu.Game/Extensions/TypeExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; diff --git a/osu.Game/Extensions/WebRequestExtensions.cs b/osu.Game/Extensions/WebRequestExtensions.cs index 50837a648d..79115c6023 100644 --- a/osu.Game/Extensions/WebRequestExtensions.cs +++ b/osu.Game/Extensions/WebRequestExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Globalization; using Newtonsoft.Json.Linq; using osu.Framework.IO.Network; diff --git a/osu.Game/Graphics/Backgrounds/Background.cs b/osu.Game/Graphics/Backgrounds/Background.cs index b09ec1d9b9..2dd96bcb09 100644 --- a/osu.Game/Graphics/Backgrounds/Background.cs +++ b/osu.Game/Graphics/Backgrounds/Background.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using osu.Framework.Allocation; diff --git a/osu.Game/Graphics/Backgrounds/BeatmapBackground.cs b/osu.Game/Graphics/Backgrounds/BeatmapBackground.cs index e0c15dd52a..543bfe2bac 100644 --- a/osu.Game/Graphics/Backgrounds/BeatmapBackground.cs +++ b/osu.Game/Graphics/Backgrounds/BeatmapBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps; diff --git a/osu.Game/Graphics/Backgrounds/BeatmapBackgroundWithStoryboard.cs b/osu.Game/Graphics/Backgrounds/BeatmapBackgroundWithStoryboard.cs index 7aed442800..0dcfa4e9aa 100644 --- a/osu.Game/Graphics/Backgrounds/BeatmapBackgroundWithStoryboard.cs +++ b/osu.Game/Graphics/Backgrounds/BeatmapBackgroundWithStoryboard.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs b/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs index f01a26a3a8..f2caf10e91 100644 --- a/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs +++ b/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Graphics/Backgrounds/SkinBackground.cs b/osu.Game/Graphics/Backgrounds/SkinBackground.cs index 9266e7b17b..e4bf3b94c5 100644 --- a/osu.Game/Graphics/Backgrounds/SkinBackground.cs +++ b/osu.Game/Graphics/Backgrounds/SkinBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Skinning; diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 450c93f37c..b83df45bd7 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Utils; using osuTK; diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index 953731244d..4146bbcc5e 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using osu.Framework.Allocation; diff --git a/osu.Game/Graphics/Containers/ConstrainedIconContainer.cs b/osu.Game/Graphics/Containers/ConstrainedIconContainer.cs index 9e1af1944c..f34a856707 100644 --- a/osu.Game/Graphics/Containers/ConstrainedIconContainer.cs +++ b/osu.Game/Graphics/Containers/ConstrainedIconContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/Containers/ExpandingButtonContainer.cs b/osu.Game/Graphics/Containers/ExpandingButtonContainer.cs index 859850e771..f66afb27c4 100644 --- a/osu.Game/Graphics/Containers/ExpandingButtonContainer.cs +++ b/osu.Game/Graphics/Containers/ExpandingButtonContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Graphics.Containers { /// diff --git a/osu.Game/Graphics/Containers/ExpandingContainer.cs b/osu.Game/Graphics/Containers/ExpandingContainer.cs index b50e008362..debc068220 100644 --- a/osu.Game/Graphics/Containers/ExpandingContainer.cs +++ b/osu.Game/Graphics/Containers/ExpandingContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs index 28afd082c3..7d38478b81 100644 --- a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs +++ b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Graphics/Containers/IExpandable.cs b/osu.Game/Graphics/Containers/IExpandable.cs index 593564a2f9..05d569775c 100644 --- a/osu.Game/Graphics/Containers/IExpandable.cs +++ b/osu.Game/Graphics/Containers/IExpandable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/Containers/IExpandingContainer.cs b/osu.Game/Graphics/Containers/IExpandingContainer.cs index eb186c96a8..dbd9274ae7 100644 --- a/osu.Game/Graphics/Containers/IExpandingContainer.cs +++ b/osu.Game/Graphics/Containers/IExpandingContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/Containers/LinkFlowContainer.cs b/osu.Game/Graphics/Containers/LinkFlowContainer.cs index 1d286d3487..a67e5ae66f 100644 --- a/osu.Game/Graphics/Containers/LinkFlowContainer.cs +++ b/osu.Game/Graphics/Containers/LinkFlowContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Online.Chat; using System; using System.Linq; diff --git a/osu.Game/Graphics/Containers/LogoTrackingContainer.cs b/osu.Game/Graphics/Containers/LogoTrackingContainer.cs index f89f3a5e76..bf8d70a200 100644 --- a/osu.Game/Graphics/Containers/LogoTrackingContainer.cs +++ b/osu.Game/Graphics/Containers/LogoTrackingContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownContainer.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownContainer.cs index 296c600771..aa156efee9 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownContainer.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Markdig; using Markdig.Extensions.AutoIdentifiers; using Markdig.Extensions.Tables; diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownFencedCodeBlock.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownFencedCodeBlock.cs index 0d67849060..fc7401046f 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownFencedCodeBlock.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownFencedCodeBlock.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Markdig.Syntax; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownHeading.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownHeading.cs index e4685a2935..0c70952222 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownHeading.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownHeading.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Markdig.Syntax; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers.Markdown; diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownImage.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownImage.cs index ce8a9c8f9f..9ad501fdff 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownImage.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownImage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Markdig.Syntax.Inlines; using osu.Framework.Graphics.Containers.Markdown; using osu.Framework.Graphics.Cursor; diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownLinkText.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownLinkText.cs index 82e556f653..dca9e3de6e 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownLinkText.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownLinkText.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Markdig.Syntax.Inlines; using osu.Framework.Allocation; diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownListItem.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownListItem.cs index 8c4c3e1da2..153c4f9f93 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownListItem.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownListItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownOrderedListItem.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownOrderedListItem.cs index 8fedb189b2..116a8e2872 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownOrderedListItem.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownOrderedListItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownQuoteBlock.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownQuoteBlock.cs index 9935c81537..3ef67df7a9 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownQuoteBlock.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownQuoteBlock.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Markdig.Syntax; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownSeparator.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownSeparator.cs index 28a87c9f21..abbc10a7e2 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownSeparator.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownSeparator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers.Markdown; diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTable.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTable.cs index e0a1ab1220..ee851045f9 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTable.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Markdig.Extensions.Tables; using osu.Framework.Graphics.Containers.Markdown; diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTableCell.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTableCell.cs index ac7d07e283..3863beb133 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTableCell.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTableCell.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Markdig.Extensions.Tables; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTextFlowContainer.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTextFlowContainer.cs index a7cd6b3905..db8abfb269 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTextFlowContainer.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownTextFlowContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Markdig.Syntax.Inlines; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownUnorderedListItem.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownUnorderedListItem.cs index 5d1e114781..f8e8571557 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownUnorderedListItem.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownUnorderedListItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Graphics/Containers/OsuClickableContainer.cs b/osu.Game/Graphics/Containers/OsuClickableContainer.cs index bf397e4251..61ec9dfc24 100644 --- a/osu.Game/Graphics/Containers/OsuClickableContainer.cs +++ b/osu.Game/Graphics/Containers/OsuClickableContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 512602d120..e8a0c0cd25 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index ac66fd658a..93205e0d03 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs b/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs index 1048fd094c..84d0d1eb32 100644 --- a/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs +++ b/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/Containers/OsuRearrangeableListItem.cs b/osu.Game/Graphics/Containers/OsuRearrangeableListItem.cs index d43c3a608b..e6183ea837 100644 --- a/osu.Game/Graphics/Containers/OsuRearrangeableListItem.cs +++ b/osu.Game/Graphics/Containers/OsuRearrangeableListItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs index 817b8409e6..7e5d5e53d3 100644 --- a/osu.Game/Graphics/Containers/OsuScrollContainer.cs +++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs b/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs index b8237832a3..5cdccee01d 100644 --- a/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs +++ b/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index b501e68ba1..f70abc16dd 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/Containers/ReverseChildIDFillFlowContainer.cs b/osu.Game/Graphics/Containers/ReverseChildIDFillFlowContainer.cs index 6360e41bef..db265d6d64 100644 --- a/osu.Game/Graphics/Containers/ReverseChildIDFillFlowContainer.cs +++ b/osu.Game/Graphics/Containers/ReverseChildIDFillFlowContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index 5c6e315225..5c8579a144 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 6ad538959e..c04a5add89 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Graphics/Containers/SelectionCycleFillFlowContainer.cs b/osu.Game/Graphics/Containers/SelectionCycleFillFlowContainer.cs index 4ddaa09be6..94505d2310 100644 --- a/osu.Game/Graphics/Containers/SelectionCycleFillFlowContainer.cs +++ b/osu.Game/Graphics/Containers/SelectionCycleFillFlowContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using osu.Framework; diff --git a/osu.Game/Graphics/Containers/ShakeContainer.cs b/osu.Game/Graphics/Containers/ShakeContainer.cs index 8a0ce287db..7b6fc22cc0 100644 --- a/osu.Game/Graphics/Containers/ShakeContainer.cs +++ b/osu.Game/Graphics/Containers/ShakeContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Game.Extensions; diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index 4e555ac1eb..d52fb7c60a 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Graphics/Containers/UserTrackingScrollContainer.cs b/osu.Game/Graphics/Containers/UserTrackingScrollContainer.cs index 44afaf77ea..2bb9d7261d 100644 --- a/osu.Game/Graphics/Containers/UserTrackingScrollContainer.cs +++ b/osu.Game/Graphics/Containers/UserTrackingScrollContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; namespace osu.Game.Graphics.Containers diff --git a/osu.Game/Graphics/Containers/WaveContainer.cs b/osu.Game/Graphics/Containers/WaveContainer.cs index 8b87ddaa20..ba85ef0aab 100644 --- a/osu.Game/Graphics/Containers/WaveContainer.cs +++ b/osu.Game/Graphics/Containers/WaveContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/Cursor/IProvideCursor.cs b/osu.Game/Graphics/Cursor/IProvideCursor.cs index 3a920ba976..9f01e5da6d 100644 --- a/osu.Game/Graphics/Cursor/IProvideCursor.cs +++ b/osu.Game/Graphics/Cursor/IProvideCursor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 03fad00e41..4544633318 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/Cursor/MenuCursorContainer.cs b/osu.Game/Graphics/Cursor/MenuCursorContainer.cs index 4c7f7957e9..746f1b5d5e 100644 --- a/osu.Game/Graphics/Cursor/MenuCursorContainer.cs +++ b/osu.Game/Graphics/Cursor/MenuCursorContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; diff --git a/osu.Game/Graphics/Cursor/OsuContextMenuContainer.cs b/osu.Game/Graphics/Cursor/OsuContextMenuContainer.cs index 171ad4ee65..fbaefe24b0 100644 --- a/osu.Game/Graphics/Cursor/OsuContextMenuContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuContextMenuContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs index 35d7b4e795..8bf4dfcd24 100644 --- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osuTK.Graphics; using osu.Framework.Allocation; diff --git a/osu.Game/Graphics/DateTooltip.cs b/osu.Game/Graphics/DateTooltip.cs index 2dca8719e9..77bf78b213 100644 --- a/osu.Game/Graphics/DateTooltip.cs +++ b/osu.Game/Graphics/DateTooltip.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index 567a39b4f4..0008d0fcaa 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/ErrorTextFlowContainer.cs b/osu.Game/Graphics/ErrorTextFlowContainer.cs index dafc363973..0d47245e8c 100644 --- a/osu.Game/Graphics/ErrorTextFlowContainer.cs +++ b/osu.Game/Graphics/ErrorTextFlowContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Graphics/IHasAccentColour.cs b/osu.Game/Graphics/IHasAccentColour.cs index af497da70f..fc722375ce 100644 --- a/osu.Game/Graphics/IHasAccentColour.cs +++ b/osu.Game/Graphics/IHasAccentColour.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; diff --git a/osu.Game/Graphics/InputBlockingContainer.cs b/osu.Game/Graphics/InputBlockingContainer.cs index d8387b1401..66caa57c1a 100644 --- a/osu.Game/Graphics/InputBlockingContainer.cs +++ b/osu.Game/Graphics/InputBlockingContainer.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; diff --git a/osu.Game/Graphics/OpenGL/Vertices/PositionAndColourVertex.cs b/osu.Game/Graphics/OpenGL/Vertices/PositionAndColourVertex.cs index 8714138322..a53b665857 100644 --- a/osu.Game/Graphics/OpenGL/Vertices/PositionAndColourVertex.cs +++ b/osu.Game/Graphics/OpenGL/Vertices/PositionAndColourVertex.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Runtime.InteropServices; using osu.Framework.Graphics.OpenGL.Vertices; diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index 7fd94b57f3..0e411876d3 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Beatmaps; diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index 9d4e97b88e..038ea0f5d7 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Sprites; namespace osu.Game.Graphics diff --git a/osu.Game/Graphics/OsuIcon.cs b/osu.Game/Graphics/OsuIcon.cs index e8267edab0..0a099f1fcc 100644 --- a/osu.Game/Graphics/OsuIcon.cs +++ b/osu.Game/Graphics/OsuIcon.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Sprites; namespace osu.Game.Graphics diff --git a/osu.Game/Graphics/ParticleExplosion.cs b/osu.Game/Graphics/ParticleExplosion.cs index ec1077eb81..c6f9c1343b 100644 --- a/osu.Game/Graphics/ParticleExplosion.cs +++ b/osu.Game/Graphics/ParticleExplosion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/ParticleSpewer.cs b/osu.Game/Graphics/ParticleSpewer.cs index 369a4b21c7..06c9882d72 100644 --- a/osu.Game/Graphics/ParticleSpewer.cs +++ b/osu.Game/Graphics/ParticleSpewer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Extensions.EnumExtensions; diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index 53f7d5791b..7147f89dd0 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading; using System.Threading.Tasks; diff --git a/osu.Game/Graphics/Sprites/GlowingSpriteText.cs b/osu.Game/Graphics/Sprites/GlowingSpriteText.cs index 9c43383a29..dca6b7158b 100644 --- a/osu.Game/Graphics/Sprites/GlowingSpriteText.cs +++ b/osu.Game/Graphics/Sprites/GlowingSpriteText.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game/Graphics/Sprites/LogoAnimation.cs b/osu.Game/Graphics/Sprites/LogoAnimation.cs index 36fcd39b54..13733bb3ad 100644 --- a/osu.Game/Graphics/Sprites/LogoAnimation.cs +++ b/osu.Game/Graphics/Sprites/LogoAnimation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/Sprites/OsuSpriteText.cs b/osu.Game/Graphics/Sprites/OsuSpriteText.cs index 76e46513ba..a46ed27b9b 100644 --- a/osu.Game/Graphics/Sprites/OsuSpriteText.cs +++ b/osu.Game/Graphics/Sprites/OsuSpriteText.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Sprites; namespace osu.Game.Graphics.Sprites diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index 2b59ee0282..d2ed71dfc6 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 0be928cf83..3c87b166ac 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osuTK; using osuTK.Graphics; diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 407bf6a923..00ed6c1c92 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/UserInterface/BasicSearchTextBox.cs b/osu.Game/Graphics/UserInterface/BasicSearchTextBox.cs index aa101d7e08..e0efa1d81c 100644 --- a/osu.Game/Graphics/UserInterface/BasicSearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/BasicSearchTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osuTK; @@ -23,4 +25,4 @@ namespace osu.Game.Graphics.UserInterface TextFlow.Padding = new MarginPadding { Right = 35 }; } } -} \ No newline at end of file +} diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index d06c227d4b..b6ae4d6dc5 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osuTK; using osu.Framework; diff --git a/osu.Game/Graphics/UserInterface/CommaSeparatedScoreCounter.cs b/osu.Game/Graphics/UserInterface/CommaSeparatedScoreCounter.cs index 4e1c612f09..bec78c68d3 100644 --- a/osu.Game/Graphics/UserInterface/CommaSeparatedScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/CommaSeparatedScoreCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Graphics/UserInterface/DangerousTriangleButton.cs b/osu.Game/Graphics/UserInterface/DangerousTriangleButton.cs index 89a4c28c8c..1414979531 100644 --- a/osu.Game/Graphics/UserInterface/DangerousTriangleButton.cs +++ b/osu.Game/Graphics/UserInterface/DangerousTriangleButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 69fbd744c9..52ad5c6b80 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Graphics/UserInterface/DownloadButton.cs b/osu.Game/Graphics/UserInterface/DownloadButton.cs index af270f30ae..dfbe6bd44d 100644 --- a/osu.Game/Graphics/UserInterface/DownloadButton.cs +++ b/osu.Game/Graphics/UserInterface/DownloadButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterface/DrawableOsuMenuItem.cs b/osu.Game/Graphics/UserInterface/DrawableOsuMenuItem.cs index 4ecc543ffd..b469c21ab0 100644 --- a/osu.Game/Graphics/UserInterface/DrawableOsuMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/DrawableOsuMenuItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterface/DrawableStatefulMenuItem.cs b/osu.Game/Graphics/UserInterface/DrawableStatefulMenuItem.cs index 3dc99f2dbe..5a7cf0d73e 100644 --- a/osu.Game/Graphics/UserInterface/DrawableStatefulMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/DrawableStatefulMenuItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Graphics/UserInterface/ExpandableSlider.cs b/osu.Game/Graphics/UserInterface/ExpandableSlider.cs index a05c0cfab0..92b0059157 100644 --- a/osu.Game/Graphics/UserInterface/ExpandableSlider.cs +++ b/osu.Game/Graphics/UserInterface/ExpandableSlider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Graphics/UserInterface/ExpandingBar.cs b/osu.Game/Graphics/UserInterface/ExpandingBar.cs index 60cb35b4c4..b2ffb4da7d 100644 --- a/osu.Game/Graphics/UserInterface/ExpandingBar.cs +++ b/osu.Game/Graphics/UserInterface/ExpandingBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osuTK; diff --git a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs index 1730e1478f..ae286f5092 100644 --- a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs +++ b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs index d3a76a0f1a..fce4221c87 100644 --- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osuTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Input.Events; diff --git a/osu.Game/Graphics/UserInterface/GradientLineTabControl.cs b/osu.Game/Graphics/UserInterface/GradientLineTabControl.cs index 1d67c4e033..e16f1ee897 100644 --- a/osu.Game/Graphics/UserInterface/GradientLineTabControl.cs +++ b/osu.Game/Graphics/UserInterface/GradientLineTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/UserInterface/GrayButton.cs b/osu.Game/Graphics/UserInterface/GrayButton.cs index 0a2c83d5a8..d95032bce6 100644 --- a/osu.Game/Graphics/UserInterface/GrayButton.cs +++ b/osu.Game/Graphics/UserInterface/GrayButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs index ba253a7c71..dab4390ede 100644 --- a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game/Graphics/UserInterface/HoverSampleDebounceComponent.cs b/osu.Game/Graphics/UserInterface/HoverSampleDebounceComponent.cs index 34ab7626c9..20715309a2 100644 --- a/osu.Game/Graphics/UserInterface/HoverSampleDebounceComponent.cs +++ b/osu.Game/Graphics/UserInterface/HoverSampleDebounceComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/UserInterface/HoverSampleSet.cs b/osu.Game/Graphics/UserInterface/HoverSampleSet.cs index 0bf44321dd..6358317e9d 100644 --- a/osu.Game/Graphics/UserInterface/HoverSampleSet.cs +++ b/osu.Game/Graphics/UserInterface/HoverSampleSet.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/HoverSounds.cs b/osu.Game/Graphics/UserInterface/HoverSounds.cs index 7db1efc75f..dd03e83ab1 100644 --- a/osu.Game/Graphics/UserInterface/HoverSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverSounds.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; diff --git a/osu.Game/Graphics/UserInterface/IconButton.cs b/osu.Game/Graphics/UserInterface/IconButton.cs index 858f517985..e0b5999c4d 100644 --- a/osu.Game/Graphics/UserInterface/IconButton.cs +++ b/osu.Game/Graphics/UserInterface/IconButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osuTK.Graphics; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index 70db26c817..fe634390a2 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Graphics/UserInterface/LoadingButton.cs b/osu.Game/Graphics/UserInterface/LoadingButton.cs index a75cf0639c..8be50a4b43 100644 --- a/osu.Game/Graphics/UserInterface/LoadingButton.cs +++ b/osu.Game/Graphics/UserInterface/LoadingButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/UserInterface/LoadingLayer.cs b/osu.Game/Graphics/UserInterface/LoadingLayer.cs index 47ba5fce4d..407823fc2a 100644 --- a/osu.Game/Graphics/UserInterface/LoadingLayer.cs +++ b/osu.Game/Graphics/UserInterface/LoadingLayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterface/LoadingSpinner.cs b/osu.Game/Graphics/UserInterface/LoadingSpinner.cs index 8174c4d5fe..864dd0a65e 100644 --- a/osu.Game/Graphics/UserInterface/LoadingSpinner.cs +++ b/osu.Game/Graphics/UserInterface/LoadingSpinner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Graphics/UserInterface/MenuItemType.cs b/osu.Game/Graphics/UserInterface/MenuItemType.cs index 0269f2cb57..1eb45d6b1c 100644 --- a/osu.Game/Graphics/UserInterface/MenuItemType.cs +++ b/osu.Game/Graphics/UserInterface/MenuItemType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Graphics.UserInterface { public enum MenuItemType diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index 8f0fed580f..249fa2fbb2 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osuTK; diff --git a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs index 13b42c0f13..f720678a93 100644 --- a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 08514d94c3..291ff644fd 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index da511d8212..bbd8f8ecea 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; diff --git a/osu.Game/Graphics/UserInterface/OsuContextMenu.cs b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs index e0946fd9e1..cc5ce8f46d 100644 --- a/osu.Game/Graphics/UserInterface/OsuContextMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Graphics/UserInterface/OsuContextMenuSamples.cs b/osu.Game/Graphics/UserInterface/OsuContextMenuSamples.cs index 921fef7951..c329974e28 100644 --- a/osu.Game/Graphics/UserInterface/OsuContextMenuSamples.cs +++ b/osu.Game/Graphics/UserInterface/OsuContextMenuSamples.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 23e05c7ccc..ce2a690e92 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Linq; using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game/Graphics/UserInterface/OsuEnumDropdown.cs b/osu.Game/Graphics/UserInterface/OsuEnumDropdown.cs index 528d7d60f8..3d4a8cf359 100644 --- a/osu.Game/Graphics/UserInterface/OsuEnumDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuEnumDropdown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index a16adcbd57..a11bffd05d 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; diff --git a/osu.Game/Graphics/UserInterface/OsuMenuItem.cs b/osu.Game/Graphics/UserInterface/OsuMenuItem.cs index 1da60415ba..9d65d6b8b9 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenuItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.UserInterface; using osu.Framework.Localisation; diff --git a/osu.Game/Graphics/UserInterface/OsuNumberBox.cs b/osu.Game/Graphics/UserInterface/OsuNumberBox.cs index 8a3b77d3c2..93d47792c8 100644 --- a/osu.Game/Graphics/UserInterface/OsuNumberBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuNumberBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs index b276159558..305b1b6687 100644 --- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osuTK.Graphics; using osuTK.Input; diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 21c8dfcfa4..3356153e17 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; using JetBrains.Annotations; diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 3572ea5c31..3cfe401bb9 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osuTK; diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs index c6121dcd17..6e6296c24b 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osuTK.Graphics; using osu.Framework.Allocation; diff --git a/osu.Game/Graphics/UserInterface/OsuTabDropdown.cs b/osu.Game/Graphics/UserInterface/OsuTabDropdown.cs index b7e25ae4e7..d9d9a21401 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabDropdown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osuTK.Graphics; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs index 6db3068d84..1650d2b274 100644 --- a/osu.Game/Graphics/UserInterface/OsuTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Linq; using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game/Graphics/UserInterface/PageSelector/PageEllipsis.cs b/osu.Game/Graphics/UserInterface/PageSelector/PageEllipsis.cs index d73d9f5824..b750abcd2b 100644 --- a/osu.Game/Graphics/UserInterface/PageSelector/PageEllipsis.cs +++ b/osu.Game/Graphics/UserInterface/PageSelector/PageEllipsis.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/UserInterface/PageSelector/PageSelector.cs b/osu.Game/Graphics/UserInterface/PageSelector/PageSelector.cs index 5c6d087279..7c5d38b91b 100644 --- a/osu.Game/Graphics/UserInterface/PageSelector/PageSelector.cs +++ b/osu.Game/Graphics/UserInterface/PageSelector/PageSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorButton.cs b/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorButton.cs index a2c6e8532b..adeae4fc8d 100644 --- a/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorButton.cs +++ b/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Framework.Allocation; diff --git a/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorPageButton.cs b/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorPageButton.cs index 247a003492..7696087195 100644 --- a/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorPageButton.cs +++ b/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorPageButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Bindables; using osu.Framework.Allocation; diff --git a/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorPrevNextButton.cs b/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorPrevNextButton.cs index 889917c397..a96cc892d4 100644 --- a/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorPrevNextButton.cs +++ b/osu.Game/Graphics/UserInterface/PageSelector/PageSelectorPrevNextButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs index a218c7bf52..13654fac85 100644 --- a/osu.Game/Graphics/UserInterface/PageTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osuTK; using osuTK.Graphics; diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index 0ebf2849fe..e5b0f0cbee 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Graphics/UserInterface/ProgressBar.cs b/osu.Game/Graphics/UserInterface/ProgressBar.cs index 50367e600e..774704223b 100644 --- a/osu.Game/Graphics/UserInterface/ProgressBar.cs +++ b/osu.Game/Graphics/UserInterface/ProgressBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 16555075d1..2f8c8414e2 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index 25f19aa0a9..e46e2b31ac 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterface/ScreenBreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/ScreenBreadcrumbControl.cs index d7bd7d7e01..edd705ca00 100644 --- a/osu.Game/Graphics/UserInterface/ScreenBreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/ScreenBreadcrumbControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index cc0bc2dc46..2c2597f149 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Input; using osu.Framework.Input.Events; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs b/osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs index 0b76ff658f..f64f455f6b 100644 --- a/osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SeekLimitedSearchTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Graphics.UserInterface { /// diff --git a/osu.Game/Graphics/UserInterface/SelectionState.cs b/osu.Game/Graphics/UserInterface/SelectionState.cs index c85b2ad3ab..edabf0547b 100644 --- a/osu.Game/Graphics/UserInterface/SelectionState.cs +++ b/osu.Game/Graphics/UserInterface/SelectionState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Graphics.UserInterface { public enum SelectionState diff --git a/osu.Game/Graphics/UserInterface/ShearedButton.cs b/osu.Game/Graphics/UserInterface/ShearedButton.cs index 66c6eedd0c..259c0646f3 100644 --- a/osu.Game/Graphics/UserInterface/ShearedButton.cs +++ b/osu.Game/Graphics/UserInterface/ShearedButton.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game/Graphics/UserInterface/ShearedOverlayHeader.cs b/osu.Game/Graphics/UserInterface/ShearedOverlayHeader.cs index 452a1dd394..deb2374e88 100644 --- a/osu.Game/Graphics/UserInterface/ShearedOverlayHeader.cs +++ b/osu.Game/Graphics/UserInterface/ShearedOverlayHeader.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs index 0c34a04a65..d7e027b3f9 100644 --- a/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/ShearedSearchTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs b/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs index ee59da7279..50682ddfe0 100644 --- a/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs +++ b/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game/Graphics/UserInterface/ShowMoreButton.cs b/osu.Game/Graphics/UserInterface/ShowMoreButton.cs index 05dda324d4..ed64a31412 100644 --- a/osu.Game/Graphics/UserInterface/ShowMoreButton.cs +++ b/osu.Game/Graphics/UserInterface/ShowMoreButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/UserInterface/SlimEnumDropdown.cs b/osu.Game/Graphics/UserInterface/SlimEnumDropdown.cs index c01ee1a059..534fcf76e5 100644 --- a/osu.Game/Graphics/UserInterface/SlimEnumDropdown.cs +++ b/osu.Game/Graphics/UserInterface/SlimEnumDropdown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index b66f371801..a8051a94d9 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/UserInterface/StatefulMenuItem.cs b/osu.Game/Graphics/UserInterface/StatefulMenuItem.cs index 0d7b36e51b..17266e876c 100644 --- a/osu.Game/Graphics/UserInterface/StatefulMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/StatefulMenuItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Graphics/UserInterface/TernaryState.cs b/osu.Game/Graphics/UserInterface/TernaryState.cs index d4de28044f..effbe624c3 100644 --- a/osu.Game/Graphics/UserInterface/TernaryState.cs +++ b/osu.Game/Graphics/UserInterface/TernaryState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Graphics.UserInterface { /// diff --git a/osu.Game/Graphics/UserInterface/TernaryStateMenuItem.cs b/osu.Game/Graphics/UserInterface/TernaryStateMenuItem.cs index 5c623150b7..d2b6ff2dba 100644 --- a/osu.Game/Graphics/UserInterface/TernaryStateMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/TernaryStateMenuItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Graphics/UserInterface/TernaryStateRadioMenuItem.cs b/osu.Game/Graphics/UserInterface/TernaryStateRadioMenuItem.cs index 46eda06294..133362d3e6 100644 --- a/osu.Game/Graphics/UserInterface/TernaryStateRadioMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/TernaryStateRadioMenuItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/TernaryStateToggleMenuItem.cs b/osu.Game/Graphics/UserInterface/TernaryStateToggleMenuItem.cs index ce951984fd..ec776f5cc4 100644 --- a/osu.Game/Graphics/UserInterface/TernaryStateToggleMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/TernaryStateToggleMenuItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/TimeSlider.cs b/osu.Game/Graphics/UserInterface/TimeSlider.cs index 82b02f1b48..d45c6614aa 100644 --- a/osu.Game/Graphics/UserInterface/TimeSlider.cs +++ b/osu.Game/Graphics/UserInterface/TimeSlider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/ToggleMenuItem.cs b/osu.Game/Graphics/UserInterface/ToggleMenuItem.cs index f9ff9859dd..9d1650c970 100644 --- a/osu.Game/Graphics/UserInterface/ToggleMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/ToggleMenuItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Graphics/UserInterface/TriangleButton.cs b/osu.Game/Graphics/UserInterface/TriangleButton.cs index 5ae6130039..60d1824e5a 100644 --- a/osu.Game/Graphics/UserInterface/TriangleButton.cs +++ b/osu.Game/Graphics/UserInterface/TriangleButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 1f5d29571d..144b51d3e8 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Graphics/UserInterfaceV2/ColourDisplay.cs b/osu.Game/Graphics/UserInterfaceV2/ColourDisplay.cs index cec319f28e..93852f19c4 100644 --- a/osu.Game/Graphics/UserInterfaceV2/ColourDisplay.cs +++ b/osu.Game/Graphics/UserInterfaceV2/ColourDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Graphics/UserInterfaceV2/ColourPalette.cs b/osu.Game/Graphics/UserInterfaceV2/ColourPalette.cs index a966f61b74..001ccc7f87 100644 --- a/osu.Game/Graphics/UserInterfaceV2/ColourPalette.cs +++ b/osu.Game/Graphics/UserInterfaceV2/ColourPalette.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/osu.Game/Graphics/UserInterfaceV2/LabelledColourPalette.cs b/osu.Game/Graphics/UserInterfaceV2/LabelledColourPalette.cs index 8970ef1115..7b9684e3ef 100644 --- a/osu.Game/Graphics/UserInterfaceV2/LabelledColourPalette.cs +++ b/osu.Game/Graphics/UserInterfaceV2/LabelledColourPalette.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs b/osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs index dd6a902989..977ef5d7bc 100644 --- a/osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs +++ b/osu.Game/Graphics/UserInterfaceV2/LabelledComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Graphics/UserInterfaceV2/LabelledDrawable.cs b/osu.Game/Graphics/UserInterfaceV2/LabelledDrawable.cs index 2353d9e0e8..8c98a3e0a7 100644 --- a/osu.Game/Graphics/UserInterfaceV2/LabelledDrawable.cs +++ b/osu.Game/Graphics/UserInterfaceV2/LabelledDrawable.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterfaceV2/LabelledDropdown.cs b/osu.Game/Graphics/UserInterfaceV2/LabelledDropdown.cs index 44f09f13eb..bfb009658d 100644 --- a/osu.Game/Graphics/UserInterfaceV2/LabelledDropdown.cs +++ b/osu.Game/Graphics/UserInterfaceV2/LabelledDropdown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Graphics/UserInterfaceV2/LabelledEnumDropdown.cs b/osu.Game/Graphics/UserInterfaceV2/LabelledEnumDropdown.cs index b818c394ae..594f132154 100644 --- a/osu.Game/Graphics/UserInterfaceV2/LabelledEnumDropdown.cs +++ b/osu.Game/Graphics/UserInterfaceV2/LabelledEnumDropdown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Graphics/UserInterfaceV2/LabelledNumberBox.cs b/osu.Game/Graphics/UserInterfaceV2/LabelledNumberBox.cs index ca247ab679..cb032698ef 100644 --- a/osu.Game/Graphics/UserInterfaceV2/LabelledNumberBox.cs +++ b/osu.Game/Graphics/UserInterfaceV2/LabelledNumberBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Graphics.UserInterface; namespace osu.Game.Graphics.UserInterfaceV2 diff --git a/osu.Game/Graphics/UserInterfaceV2/LabelledSliderBar.cs b/osu.Game/Graphics/UserInterfaceV2/LabelledSliderBar.cs index cba94e314b..50b6834f01 100644 --- a/osu.Game/Graphics/UserInterfaceV2/LabelledSliderBar.cs +++ b/osu.Game/Graphics/UserInterfaceV2/LabelledSliderBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Game.Overlays.Settings; diff --git a/osu.Game/Graphics/UserInterfaceV2/LabelledSwitchButton.cs b/osu.Game/Graphics/UserInterfaceV2/LabelledSwitchButton.cs index c374d80830..99a1a98d5b 100644 --- a/osu.Game/Graphics/UserInterfaceV2/LabelledSwitchButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/LabelledSwitchButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Graphics.UserInterfaceV2 { public class LabelledSwitchButton : LabelledComponent diff --git a/osu.Game/Graphics/UserInterfaceV2/LabelledTextBox.cs b/osu.Game/Graphics/UserInterfaceV2/LabelledTextBox.cs index 82b9fe559f..97bc845766 100644 --- a/osu.Game/Graphics/UserInterfaceV2/LabelledTextBox.cs +++ b/osu.Game/Graphics/UserInterfaceV2/LabelledTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/UserInterfaceV2/OsuColourPicker.cs b/osu.Game/Graphics/UserInterfaceV2/OsuColourPicker.cs index 5394e5d0aa..f4ae2f0fd7 100644 --- a/osu.Game/Graphics/UserInterfaceV2/OsuColourPicker.cs +++ b/osu.Game/Graphics/UserInterfaceV2/OsuColourPicker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.UserInterface; namespace osu.Game.Graphics.UserInterfaceV2 diff --git a/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelector.cs b/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelector.cs index 1ce4d97fdf..42e1073baf 100644 --- a/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelector.cs +++ b/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorBreadcrumbDisplay.cs b/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorBreadcrumbDisplay.cs index cb5ff242a1..0833c7eb8b 100644 --- a/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorBreadcrumbDisplay.cs +++ b/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorBreadcrumbDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorDirectory.cs b/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorDirectory.cs index 456bde6d1b..1896d7ee4d 100644 --- a/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorDirectory.cs +++ b/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorDirectory.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorParentDirectory.cs b/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorParentDirectory.cs index 481d811adb..7d2b28e803 100644 --- a/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorParentDirectory.cs +++ b/osu.Game/Graphics/UserInterfaceV2/OsuDirectorySelectorParentDirectory.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Graphics/UserInterfaceV2/OsuFileSelector.cs b/osu.Game/Graphics/UserInterfaceV2/OsuFileSelector.cs index 7c88e12dd3..3e8b7dc209 100644 --- a/osu.Game/Graphics/UserInterfaceV2/OsuFileSelector.cs +++ b/osu.Game/Graphics/UserInterfaceV2/OsuFileSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Graphics/UserInterfaceV2/OsuHSVColourPicker.cs b/osu.Game/Graphics/UserInterfaceV2/OsuHSVColourPicker.cs index 0189b30aad..1a8fa435cb 100644 --- a/osu.Game/Graphics/UserInterfaceV2/OsuHSVColourPicker.cs +++ b/osu.Game/Graphics/UserInterfaceV2/OsuHSVColourPicker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Graphics/UserInterfaceV2/OsuHexColourPicker.cs b/osu.Game/Graphics/UserInterfaceV2/OsuHexColourPicker.cs index 5368a800bc..12313791f0 100644 --- a/osu.Game/Graphics/UserInterfaceV2/OsuHexColourPicker.cs +++ b/osu.Game/Graphics/UserInterfaceV2/OsuHexColourPicker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs b/osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs index 085541b3ef..e468e14f45 100644 --- a/osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs +++ b/osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs index cb8c63371d..4477633da1 100644 --- a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterfaceV2/SwitchButton.cs b/osu.Game/Graphics/UserInterfaceV2/SwitchButton.cs index f483e67b27..b5c1c0a854 100644 --- a/osu.Game/Graphics/UserInterfaceV2/SwitchButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/SwitchButton.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; diff --git a/osu.Game/IO/Archives/ArchiveReader.cs b/osu.Game/IO/Archives/ArchiveReader.cs index dab70eaf70..91165261b0 100644 --- a/osu.Game/IO/Archives/ArchiveReader.cs +++ b/osu.Game/IO/Archives/ArchiveReader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.IO; using System.Threading; diff --git a/osu.Game/IO/Archives/LegacyByteArrayReader.cs b/osu.Game/IO/Archives/LegacyByteArrayReader.cs index ea8ff3bbe0..e58dbb48ce 100644 --- a/osu.Game/IO/Archives/LegacyByteArrayReader.cs +++ b/osu.Game/IO/Archives/LegacyByteArrayReader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.IO; diff --git a/osu.Game/IO/Archives/LegacyDirectoryArchiveReader.cs b/osu.Game/IO/Archives/LegacyDirectoryArchiveReader.cs index dfae58aed7..e26f6af081 100644 --- a/osu.Game/IO/Archives/LegacyDirectoryArchiveReader.cs +++ b/osu.Game/IO/Archives/LegacyDirectoryArchiveReader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/osu.Game/IO/Archives/LegacyFileArchiveReader.cs b/osu.Game/IO/Archives/LegacyFileArchiveReader.cs index 72e5a21079..aee1add2f6 100644 --- a/osu.Game/IO/Archives/LegacyFileArchiveReader.cs +++ b/osu.Game/IO/Archives/LegacyFileArchiveReader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.IO; diff --git a/osu.Game/IO/Archives/ZipArchiveReader.cs b/osu.Game/IO/Archives/ZipArchiveReader.cs index ae2b85da51..1fca8aa055 100644 --- a/osu.Game/IO/Archives/ZipArchiveReader.cs +++ b/osu.Game/IO/Archives/ZipArchiveReader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Buffers; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/IO/FileAbstraction/StreamFileAbstraction.cs b/osu.Game/IO/FileAbstraction/StreamFileAbstraction.cs index f5709b5158..8e6c3e5f3d 100644 --- a/osu.Game/IO/FileAbstraction/StreamFileAbstraction.cs +++ b/osu.Game/IO/FileAbstraction/StreamFileAbstraction.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; diff --git a/osu.Game/IO/FileInfo.cs b/osu.Game/IO/FileInfo.cs index 148afba40d..3d32e7fb6d 100644 --- a/osu.Game/IO/FileInfo.cs +++ b/osu.Game/IO/FileInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Database; namespace osu.Game.IO diff --git a/osu.Game/IO/IFileInfo.cs b/osu.Game/IO/IFileInfo.cs index 080d8e57f5..932ea31e25 100644 --- a/osu.Game/IO/IFileInfo.cs +++ b/osu.Game/IO/IFileInfo.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - namespace osu.Game.IO { /// diff --git a/osu.Game/IO/IStorageResourceProvider.cs b/osu.Game/IO/IStorageResourceProvider.cs index b381ac70b0..1cb6509cac 100644 --- a/osu.Game/IO/IStorageResourceProvider.cs +++ b/osu.Game/IO/IStorageResourceProvider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Audio; using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; diff --git a/osu.Game/IO/Legacy/ILegacySerializable.cs b/osu.Game/IO/Legacy/ILegacySerializable.cs index 0124ea756a..f21e67a34b 100644 --- a/osu.Game/IO/Legacy/ILegacySerializable.cs +++ b/osu.Game/IO/Legacy/ILegacySerializable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.IO.Legacy { public interface ILegacySerializable diff --git a/osu.Game/IO/Legacy/SerializationReader.cs b/osu.Game/IO/Legacy/SerializationReader.cs index 5423485c95..2d3d5bffd5 100644 --- a/osu.Game/IO/Legacy/SerializationReader.cs +++ b/osu.Game/IO/Legacy/SerializationReader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/IO/Legacy/SerializationWriter.cs b/osu.Game/IO/Legacy/SerializationWriter.cs index c9fff05bcc..10572a6478 100644 --- a/osu.Game/IO/Legacy/SerializationWriter.cs +++ b/osu.Game/IO/Legacy/SerializationWriter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/IO/LineBufferedReader.cs b/osu.Game/IO/LineBufferedReader.cs index a6b8c9492a..db435576bf 100644 --- a/osu.Game/IO/LineBufferedReader.cs +++ b/osu.Game/IO/LineBufferedReader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/IO/MigratableStorage.cs b/osu.Game/IO/MigratableStorage.cs index e478144294..30e74adca4 100644 --- a/osu.Game/IO/MigratableStorage.cs +++ b/osu.Game/IO/MigratableStorage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game/IO/OsuStorage.cs b/osu.Game/IO/OsuStorage.cs index c49365a9de..89bdd09f0d 100644 --- a/osu.Game/IO/OsuStorage.cs +++ b/osu.Game/IO/OsuStorage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/IO/Serialization/Converters/SnakeCaseStringEnumConverter.cs b/osu.Game/IO/Serialization/Converters/SnakeCaseStringEnumConverter.cs index 1d82a5bc87..65283d0d82 100644 --- a/osu.Game/IO/Serialization/Converters/SnakeCaseStringEnumConverter.cs +++ b/osu.Game/IO/Serialization/Converters/SnakeCaseStringEnumConverter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json.Converters; using Newtonsoft.Json.Serialization; diff --git a/osu.Game/IO/Serialization/Converters/TypedListConverter.cs b/osu.Game/IO/Serialization/Converters/TypedListConverter.cs index 715c83b07e..176e4e240d 100644 --- a/osu.Game/IO/Serialization/Converters/TypedListConverter.cs +++ b/osu.Game/IO/Serialization/Converters/TypedListConverter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game/IO/Serialization/JsonSerializableExtensions.cs b/osu.Game/IO/Serialization/JsonSerializableExtensions.cs index 68b2110ede..bdf42205d4 100644 --- a/osu.Game/IO/Serialization/JsonSerializableExtensions.cs +++ b/osu.Game/IO/Serialization/JsonSerializableExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Framework.IO.Serialization; diff --git a/osu.Game/IO/Serialization/SnakeCaseKeyContractResolver.cs b/osu.Game/IO/Serialization/SnakeCaseKeyContractResolver.cs index 68cb66d0dc..4808ac1384 100644 --- a/osu.Game/IO/Serialization/SnakeCaseKeyContractResolver.cs +++ b/osu.Game/IO/Serialization/SnakeCaseKeyContractResolver.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Humanizer; using Newtonsoft.Json.Serialization; diff --git a/osu.Game/IO/StableStorage.cs b/osu.Game/IO/StableStorage.cs index d4ff8fcdda..41c7495b42 100644 --- a/osu.Game/IO/StableStorage.cs +++ b/osu.Game/IO/StableStorage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game/IO/WrappedStorage.cs b/osu.Game/IO/WrappedStorage.cs index 7205ea3adb..95ff26db6a 100644 --- a/osu.Game/IO/WrappedStorage.cs +++ b/osu.Game/IO/WrappedStorage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/IPC/ArchiveImportIPCChannel.cs b/osu.Game/IPC/ArchiveImportIPCChannel.cs index f381aad39a..02b1f72700 100644 --- a/osu.Game/IPC/ArchiveImportIPCChannel.cs +++ b/osu.Game/IPC/ArchiveImportIPCChannel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using System.IO; using System.Linq; diff --git a/osu.Game/Input/Bindings/DatabasedKeyBindingContainer.cs b/osu.Game/Input/Bindings/DatabasedKeyBindingContainer.cs index ba129b93e5..974abc4036 100644 --- a/osu.Game/Input/Bindings/DatabasedKeyBindingContainer.cs +++ b/osu.Game/Input/Bindings/DatabasedKeyBindingContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index 3da5f3212e..21b49286ea 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; diff --git a/osu.Game/Input/Bindings/RealmKeyBinding.cs b/osu.Game/Input/Bindings/RealmKeyBinding.cs index c941319ddb..4af0357535 100644 --- a/osu.Game/Input/Bindings/RealmKeyBinding.cs +++ b/osu.Game/Input/Bindings/RealmKeyBinding.cs @@ -7,8 +7,6 @@ using osu.Framework.Input.Bindings; using osu.Game.Database; using Realms; -#nullable enable - namespace osu.Game.Input.Bindings { [MapTo(nameof(KeyBinding))] diff --git a/osu.Game/Input/ConfineMouseTracker.cs b/osu.Game/Input/ConfineMouseTracker.cs index d2bf953dbc..7e8ace5693 100644 --- a/osu.Game/Input/ConfineMouseTracker.cs +++ b/osu.Game/Input/ConfineMouseTracker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Configuration; diff --git a/osu.Game/Input/GameIdleTracker.cs b/osu.Game/Input/GameIdleTracker.cs index 260be7e5c9..d82cc25851 100644 --- a/osu.Game/Input/GameIdleTracker.cs +++ b/osu.Game/Input/GameIdleTracker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Input; namespace osu.Game.Input diff --git a/osu.Game/Input/Handlers/ReplayInputHandler.cs b/osu.Game/Input/Handlers/ReplayInputHandler.cs index 205a1ea1ac..712e0acb60 100644 --- a/osu.Game/Input/Handlers/ReplayInputHandler.cs +++ b/osu.Game/Input/Handlers/ReplayInputHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Input/IdleTracker.cs b/osu.Game/Input/IdleTracker.cs index e2f13309cf..279cfb5a4e 100644 --- a/osu.Game/Input/IdleTracker.cs +++ b/osu.Game/Input/IdleTracker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Input/OsuConfineMouseMode.cs b/osu.Game/Input/OsuConfineMouseMode.cs index a4a1c9eb46..2a93ac1cd6 100644 --- a/osu.Game/Input/OsuConfineMouseMode.cs +++ b/osu.Game/Input/OsuConfineMouseMode.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Input; diff --git a/osu.Game/Input/OsuUserInputManager.cs b/osu.Game/Input/OsuUserInputManager.cs index 621f1e1fc9..7a9002a004 100644 --- a/osu.Game/Input/OsuUserInputManager.cs +++ b/osu.Game/Input/OsuUserInputManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Input; using osuTK.Input; diff --git a/osu.Game/Input/RealmKeyBindingStore.cs b/osu.Game/Input/RealmKeyBindingStore.cs index 20971ffca5..10ad731037 100644 --- a/osu.Game/Input/RealmKeyBindingStore.cs +++ b/osu.Game/Input/RealmKeyBindingStore.cs @@ -10,8 +10,6 @@ using osu.Game.Input.Bindings; using osu.Game.Rulesets; using Realms; -#nullable enable - namespace osu.Game.Input { public class RealmKeyBindingStore diff --git a/osu.Game/Localisation/AudioSettingsStrings.cs b/osu.Game/Localisation/AudioSettingsStrings.cs index 0f0f560df9..0dc95da2f4 100644 --- a/osu.Game/Localisation/AudioSettingsStrings.cs +++ b/osu.Game/Localisation/AudioSettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/BeatmapOffsetControlStrings.cs b/osu.Game/Localisation/BeatmapOffsetControlStrings.cs index 632a1ad0ea..417cf335e0 100644 --- a/osu.Game/Localisation/BeatmapOffsetControlStrings.cs +++ b/osu.Game/Localisation/BeatmapOffsetControlStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/BindingSettingsStrings.cs b/osu.Game/Localisation/BindingSettingsStrings.cs index ad4a650a1f..39b5ac0d21 100644 --- a/osu.Game/Localisation/BindingSettingsStrings.cs +++ b/osu.Game/Localisation/BindingSettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/ButtonSystemStrings.cs b/osu.Game/Localisation/ButtonSystemStrings.cs index ba4abf63a6..c71a99711b 100644 --- a/osu.Game/Localisation/ButtonSystemStrings.cs +++ b/osu.Game/Localisation/ButtonSystemStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/ChatStrings.cs b/osu.Game/Localisation/ChatStrings.cs index 7bd284a94e..b07ed18f7b 100644 --- a/osu.Game/Localisation/ChatStrings.cs +++ b/osu.Game/Localisation/ChatStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/CommonStrings.cs b/osu.Game/Localisation/CommonStrings.cs index 1fd677034d..39dc7cf518 100644 --- a/osu.Game/Localisation/CommonStrings.cs +++ b/osu.Game/Localisation/CommonStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation @@ -91,4 +93,4 @@ namespace osu.Game.Localisation private static string getKey(string key) => $@"{prefix}:{key}"; } -} \ No newline at end of file +} diff --git a/osu.Game/Localisation/DebugLocalisationStore.cs b/osu.Game/Localisation/DebugLocalisationStore.cs index 2b114b1bd8..83ae4581a8 100644 --- a/osu.Game/Localisation/DebugLocalisationStore.cs +++ b/osu.Game/Localisation/DebugLocalisationStore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Globalization; diff --git a/osu.Game/Localisation/DebugSettingsStrings.cs b/osu.Game/Localisation/DebugSettingsStrings.cs index 74b2c8d892..e6de4ddee9 100644 --- a/osu.Game/Localisation/DebugSettingsStrings.cs +++ b/osu.Game/Localisation/DebugSettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs b/osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs index c281d90190..4bcbdcff7b 100644 --- a/osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs +++ b/osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation @@ -16,4 +18,4 @@ namespace osu.Game.Localisation private static string getKey(string key) => $@"{prefix}:{key}"; } -} \ No newline at end of file +} diff --git a/osu.Game/Localisation/FirstRunOverlayImportFromStableScreenStrings.cs b/osu.Game/Localisation/FirstRunOverlayImportFromStableScreenStrings.cs index deac7d8628..38f5860cc5 100644 --- a/osu.Game/Localisation/FirstRunOverlayImportFromStableScreenStrings.cs +++ b/osu.Game/Localisation/FirstRunOverlayImportFromStableScreenStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/FirstRunSetupBeatmapScreenStrings.cs b/osu.Game/Localisation/FirstRunSetupBeatmapScreenStrings.cs index 3a7fe4bb12..331a8c6764 100644 --- a/osu.Game/Localisation/FirstRunSetupBeatmapScreenStrings.cs +++ b/osu.Game/Localisation/FirstRunSetupBeatmapScreenStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs index 91b427e2ca..0c73d7a85b 100644 --- a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs +++ b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/GameplaySettingsStrings.cs b/osu.Game/Localisation/GameplaySettingsStrings.cs index 8a0f773551..1719b7d6e8 100644 --- a/osu.Game/Localisation/GameplaySettingsStrings.cs +++ b/osu.Game/Localisation/GameplaySettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/GeneralSettingsStrings.cs b/osu.Game/Localisation/GeneralSettingsStrings.cs index 2aa91f5245..8cf26a930d 100644 --- a/osu.Game/Localisation/GeneralSettingsStrings.cs +++ b/osu.Game/Localisation/GeneralSettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs index 82d03dbb5b..d45fba6f17 100644 --- a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs +++ b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/GraphicsSettingsStrings.cs b/osu.Game/Localisation/GraphicsSettingsStrings.cs index 38355d9041..a73d67067e 100644 --- a/osu.Game/Localisation/GraphicsSettingsStrings.cs +++ b/osu.Game/Localisation/GraphicsSettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/InputSettingsStrings.cs b/osu.Game/Localisation/InputSettingsStrings.cs index e46b4cecf3..a16dcd998a 100644 --- a/osu.Game/Localisation/InputSettingsStrings.cs +++ b/osu.Game/Localisation/InputSettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/JoystickSettingsStrings.cs b/osu.Game/Localisation/JoystickSettingsStrings.cs index 976ec1adde..efda1afd48 100644 --- a/osu.Game/Localisation/JoystickSettingsStrings.cs +++ b/osu.Game/Localisation/JoystickSettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/Language.cs b/osu.Game/Localisation/Language.cs index c13a1a10cb..f9094b9540 100644 --- a/osu.Game/Localisation/Language.cs +++ b/osu.Game/Localisation/Language.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/LayoutSettingsStrings.cs b/osu.Game/Localisation/LayoutSettingsStrings.cs index b4326b8e39..1a0b015050 100644 --- a/osu.Game/Localisation/LayoutSettingsStrings.cs +++ b/osu.Game/Localisation/LayoutSettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/LeaderboardStrings.cs b/osu.Game/Localisation/LeaderboardStrings.cs index 8e53f8e88c..14bc5b7af4 100644 --- a/osu.Game/Localisation/LeaderboardStrings.cs +++ b/osu.Game/Localisation/LeaderboardStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/MaintenanceSettingsStrings.cs b/osu.Game/Localisation/MaintenanceSettingsStrings.cs index 7a04bcd1ca..4cb514feb0 100644 --- a/osu.Game/Localisation/MaintenanceSettingsStrings.cs +++ b/osu.Game/Localisation/MaintenanceSettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/ModSelectOverlayStrings.cs b/osu.Game/Localisation/ModSelectOverlayStrings.cs index e9af7147e3..3d99075922 100644 --- a/osu.Game/Localisation/ModSelectOverlayStrings.cs +++ b/osu.Game/Localisation/ModSelectOverlayStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/MouseSettingsStrings.cs b/osu.Game/Localisation/MouseSettingsStrings.cs index fd7225ad2e..563d6f7637 100644 --- a/osu.Game/Localisation/MouseSettingsStrings.cs +++ b/osu.Game/Localisation/MouseSettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/MultiplayerTeamResultsScreenStrings.cs b/osu.Game/Localisation/MultiplayerTeamResultsScreenStrings.cs index 111c068bbd..956d5195e7 100644 --- a/osu.Game/Localisation/MultiplayerTeamResultsScreenStrings.cs +++ b/osu.Game/Localisation/MultiplayerTeamResultsScreenStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation @@ -21,4 +23,4 @@ namespace osu.Game.Localisation private static string getKey(string key) => $@"{prefix}:{key}"; } -} \ No newline at end of file +} diff --git a/osu.Game/Localisation/NamedOverlayComponentStrings.cs b/osu.Game/Localisation/NamedOverlayComponentStrings.cs index 475bea2a4a..f6a50460dc 100644 --- a/osu.Game/Localisation/NamedOverlayComponentStrings.cs +++ b/osu.Game/Localisation/NamedOverlayComponentStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/NotificationsStrings.cs b/osu.Game/Localisation/NotificationsStrings.cs index 382e0d81f4..c60e5d3415 100644 --- a/osu.Game/Localisation/NotificationsStrings.cs +++ b/osu.Game/Localisation/NotificationsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/NowPlayingStrings.cs b/osu.Game/Localisation/NowPlayingStrings.cs index f334637338..75d9b28ea6 100644 --- a/osu.Game/Localisation/NowPlayingStrings.cs +++ b/osu.Game/Localisation/NowPlayingStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/OnlineSettingsStrings.cs b/osu.Game/Localisation/OnlineSettingsStrings.cs index 6862f4ac2c..ebb21afeb7 100644 --- a/osu.Game/Localisation/OnlineSettingsStrings.cs +++ b/osu.Game/Localisation/OnlineSettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/ResourceManagerLocalisationStore.cs b/osu.Game/Localisation/ResourceManagerLocalisationStore.cs index 0fb85e4a19..d2ff783413 100644 --- a/osu.Game/Localisation/ResourceManagerLocalisationStore.cs +++ b/osu.Game/Localisation/ResourceManagerLocalisationStore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Globalization; diff --git a/osu.Game/Localisation/RulesetSettingsStrings.cs b/osu.Game/Localisation/RulesetSettingsStrings.cs index a356c9e20b..08901a641e 100644 --- a/osu.Game/Localisation/RulesetSettingsStrings.cs +++ b/osu.Game/Localisation/RulesetSettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/SettingsStrings.cs b/osu.Game/Localisation/SettingsStrings.cs index aa2e2740eb..5dcab39e10 100644 --- a/osu.Game/Localisation/SettingsStrings.cs +++ b/osu.Game/Localisation/SettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/SkinSettingsStrings.cs b/osu.Game/Localisation/SkinSettingsStrings.cs index 81035c5a5e..42b72fdbb8 100644 --- a/osu.Game/Localisation/SkinSettingsStrings.cs +++ b/osu.Game/Localisation/SkinSettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/TabletSettingsStrings.cs b/osu.Game/Localisation/TabletSettingsStrings.cs index 5bdca09e4a..8d2bc21652 100644 --- a/osu.Game/Localisation/TabletSettingsStrings.cs +++ b/osu.Game/Localisation/TabletSettingsStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation @@ -56,4 +58,4 @@ namespace osu.Game.Localisation private static string getKey(string key) => $@"{prefix}:{key}"; } -} \ No newline at end of file +} diff --git a/osu.Game/Localisation/ToastStrings.cs b/osu.Game/Localisation/ToastStrings.cs index 52e75425bf..00a0031293 100644 --- a/osu.Game/Localisation/ToastStrings.cs +++ b/osu.Game/Localisation/ToastStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/UserInterfaceStrings.cs b/osu.Game/Localisation/UserInterfaceStrings.cs index 4be403edb4..4e7af99ce9 100644 --- a/osu.Game/Localisation/UserInterfaceStrings.cs +++ b/osu.Game/Localisation/UserInterfaceStrings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Migrations/20171019041408_InitialCreate.Designer.cs b/osu.Game/Migrations/20171019041408_InitialCreate.Designer.cs index c751530bf4..7104245d9e 100644 --- a/osu.Game/Migrations/20171019041408_InitialCreate.Designer.cs +++ b/osu.Game/Migrations/20171019041408_InitialCreate.Designer.cs @@ -1,5 +1,7 @@ // using Microsoft.EntityFrameworkCore; + +#nullable disable using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20171019041408_InitialCreate.cs b/osu.Game/Migrations/20171019041408_InitialCreate.cs index 08ab64fd08..f1c7c94638 100644 --- a/osu.Game/Migrations/20171019041408_InitialCreate.cs +++ b/osu.Game/Migrations/20171019041408_InitialCreate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20171025071459_AddMissingIndexRules.Designer.cs b/osu.Game/Migrations/20171025071459_AddMissingIndexRules.Designer.cs index 4cd234f2ef..b464c15ce2 100644 --- a/osu.Game/Migrations/20171025071459_AddMissingIndexRules.Designer.cs +++ b/osu.Game/Migrations/20171025071459_AddMissingIndexRules.Designer.cs @@ -1,5 +1,7 @@ // using Microsoft.EntityFrameworkCore; + +#nullable disable using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20171025071459_AddMissingIndexRules.cs b/osu.Game/Migrations/20171025071459_AddMissingIndexRules.cs index 4ec3952941..1d0164a1d9 100644 --- a/osu.Game/Migrations/20171025071459_AddMissingIndexRules.cs +++ b/osu.Game/Migrations/20171025071459_AddMissingIndexRules.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.Designer.cs b/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.Designer.cs index 006acf12cd..53e8b887d8 100644 --- a/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.Designer.cs +++ b/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.Designer.cs @@ -1,5 +1,7 @@ // using Microsoft.EntityFrameworkCore; + +#nullable disable using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs b/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs index 6aba12f86f..765a6a5b58 100644 --- a/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs +++ b/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.Designer.cs b/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.Designer.cs index fc2496bc24..4da20141bc 100644 --- a/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.Designer.cs +++ b/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.Designer.cs @@ -1,5 +1,7 @@ // using Microsoft.EntityFrameworkCore; + +#nullable disable using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs b/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs index 5688455f79..3379efa68e 100644 --- a/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs +++ b/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20180125143340_Settings.Designer.cs b/osu.Game/Migrations/20180125143340_Settings.Designer.cs index 4bb599eec1..68054d6404 100644 --- a/osu.Game/Migrations/20180125143340_Settings.Designer.cs +++ b/osu.Game/Migrations/20180125143340_Settings.Designer.cs @@ -1,5 +1,7 @@ // using Microsoft.EntityFrameworkCore; + +#nullable disable using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20180125143340_Settings.cs b/osu.Game/Migrations/20180125143340_Settings.cs index 1feb37531f..8f7d0a6ed3 100644 --- a/osu.Game/Migrations/20180125143340_Settings.cs +++ b/osu.Game/Migrations/20180125143340_Settings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20180131154205_AddMuteBinding.cs b/osu.Game/Migrations/20180131154205_AddMuteBinding.cs index 8646d1d76b..3e97e78e61 100644 --- a/osu.Game/Migrations/20180131154205_AddMuteBinding.cs +++ b/osu.Game/Migrations/20180131154205_AddMuteBinding.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Infrastructure; using osu.Game.Database; diff --git a/osu.Game/Migrations/20180219060912_AddSkins.Designer.cs b/osu.Game/Migrations/20180219060912_AddSkins.Designer.cs index cdc4ef2e66..7d95a702b8 100644 --- a/osu.Game/Migrations/20180219060912_AddSkins.Designer.cs +++ b/osu.Game/Migrations/20180219060912_AddSkins.Designer.cs @@ -1,5 +1,7 @@ // using Microsoft.EntityFrameworkCore; + +#nullable disable using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20180219060912_AddSkins.cs b/osu.Game/Migrations/20180219060912_AddSkins.cs index 319748bed6..df9d267a14 100644 --- a/osu.Game/Migrations/20180219060912_AddSkins.cs +++ b/osu.Game/Migrations/20180219060912_AddSkins.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.Designer.cs b/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.Designer.cs index f28408bfb3..7e490c7833 100644 --- a/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.Designer.cs +++ b/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.Designer.cs @@ -1,5 +1,7 @@ // using Microsoft.EntityFrameworkCore; + +#nullable disable using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs b/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs index 91eabe8868..62c341b0c6 100644 --- a/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs +++ b/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.Designer.cs b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.Designer.cs index aaa11e88b6..a103cdad20 100644 --- a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.Designer.cs +++ b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs index d888ccd5a2..b08fa7a899 100644 --- a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs +++ b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.Designer.cs b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.Designer.cs index 7eeacd56d7..5b1734554a 100644 --- a/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.Designer.cs +++ b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs index fdea636ac6..4ba0a4d0e6 100644 --- a/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs +++ b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs b/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs index 5ab43da046..ceef5b6948 100644 --- a/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs +++ b/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20180913080842_AddRankStatus.cs b/osu.Game/Migrations/20180913080842_AddRankStatus.cs index bb147dff84..ec82925b03 100644 --- a/osu.Game/Migrations/20180913080842_AddRankStatus.cs +++ b/osu.Game/Migrations/20180913080842_AddRankStatus.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20181007180454_StandardizePaths.Designer.cs b/osu.Game/Migrations/20181007180454_StandardizePaths.Designer.cs index b387a45ecf..d1185ef186 100644 --- a/osu.Game/Migrations/20181007180454_StandardizePaths.Designer.cs +++ b/osu.Game/Migrations/20181007180454_StandardizePaths.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20181007180454_StandardizePaths.cs b/osu.Game/Migrations/20181007180454_StandardizePaths.cs index 30f27043a0..f9323c0b9b 100644 --- a/osu.Game/Migrations/20181007180454_StandardizePaths.cs +++ b/osu.Game/Migrations/20181007180454_StandardizePaths.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20181128100659_AddSkinInfoHash.Designer.cs b/osu.Game/Migrations/20181128100659_AddSkinInfoHash.Designer.cs index 120674671a..0797090c7b 100644 --- a/osu.Game/Migrations/20181128100659_AddSkinInfoHash.Designer.cs +++ b/osu.Game/Migrations/20181128100659_AddSkinInfoHash.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20181128100659_AddSkinInfoHash.cs b/osu.Game/Migrations/20181128100659_AddSkinInfoHash.cs index ee825a1e9c..43689f2a3c 100644 --- a/osu.Game/Migrations/20181128100659_AddSkinInfoHash.cs +++ b/osu.Game/Migrations/20181128100659_AddSkinInfoHash.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20181130113755_AddScoreInfoTables.Designer.cs b/osu.Game/Migrations/20181130113755_AddScoreInfoTables.Designer.cs index eee53182ce..3b70ad8d45 100644 --- a/osu.Game/Migrations/20181130113755_AddScoreInfoTables.Designer.cs +++ b/osu.Game/Migrations/20181130113755_AddScoreInfoTables.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20181130113755_AddScoreInfoTables.cs b/osu.Game/Migrations/20181130113755_AddScoreInfoTables.cs index 58980132f3..f52edacc7f 100644 --- a/osu.Game/Migrations/20181130113755_AddScoreInfoTables.cs +++ b/osu.Game/Migrations/20181130113755_AddScoreInfoTables.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20190225062029_AddUserIDColumn.Designer.cs b/osu.Game/Migrations/20190225062029_AddUserIDColumn.Designer.cs index 8e1e3a59f3..51b63bd9eb 100644 --- a/osu.Game/Migrations/20190225062029_AddUserIDColumn.Designer.cs +++ b/osu.Game/Migrations/20190225062029_AddUserIDColumn.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20190225062029_AddUserIDColumn.cs b/osu.Game/Migrations/20190225062029_AddUserIDColumn.cs index f2eef600dc..00d807d5c4 100644 --- a/osu.Game/Migrations/20190225062029_AddUserIDColumn.cs +++ b/osu.Game/Migrations/20190225062029_AddUserIDColumn.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20190525060824_SkinSettings.Designer.cs b/osu.Game/Migrations/20190525060824_SkinSettings.Designer.cs index 348c42adb9..9d6515e5c6 100644 --- a/osu.Game/Migrations/20190525060824_SkinSettings.Designer.cs +++ b/osu.Game/Migrations/20190525060824_SkinSettings.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20190525060824_SkinSettings.cs b/osu.Game/Migrations/20190525060824_SkinSettings.cs index 7779b55bb7..463d4fe1ad 100644 --- a/osu.Game/Migrations/20190525060824_SkinSettings.cs +++ b/osu.Game/Migrations/20190525060824_SkinSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.Designer.cs b/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.Designer.cs index 9477369aa0..1bc2e76ae5 100644 --- a/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.Designer.cs +++ b/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs b/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs index 0620a0624f..61925a4cb4 100644 --- a/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs +++ b/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.Designer.cs b/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.Designer.cs index c5fcc16f84..c51b8739bc 100644 --- a/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.Designer.cs +++ b/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs b/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs index f8ce354aa1..19a2464157 100644 --- a/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs +++ b/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20190913104727_AddBeatmapVideo.Designer.cs b/osu.Game/Migrations/20190913104727_AddBeatmapVideo.Designer.cs index 826233a2b0..95583e7587 100644 --- a/osu.Game/Migrations/20190913104727_AddBeatmapVideo.Designer.cs +++ b/osu.Game/Migrations/20190913104727_AddBeatmapVideo.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20190913104727_AddBeatmapVideo.cs b/osu.Game/Migrations/20190913104727_AddBeatmapVideo.cs index af82b4db20..c1208e0bf1 100644 --- a/osu.Game/Migrations/20190913104727_AddBeatmapVideo.cs +++ b/osu.Game/Migrations/20190913104727_AddBeatmapVideo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.Designer.cs b/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.Designer.cs index 22316b0380..3c7de0602b 100644 --- a/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.Designer.cs +++ b/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.cs b/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.cs index 3d2ddbf6fc..73cfb1725b 100644 --- a/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.cs +++ b/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.Designer.cs b/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.Designer.cs index 1c05de832e..24acc3195f 100644 --- a/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.Designer.cs +++ b/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.cs b/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.cs index 58a35a7bf3..eaca8785f9 100644 --- a/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.cs +++ b/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.Designer.cs b/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.Designer.cs index 2c100d39b9..704af354c9 100644 --- a/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.Designer.cs +++ b/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.cs b/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.cs index 4d3941dd20..7772c0e86b 100644 --- a/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.cs +++ b/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.Designer.cs b/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.Designer.cs index b808c648da..097bd6a244 100644 --- a/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.Designer.cs +++ b/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.cs b/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.cs index 887635fa85..1cc9ab6120 100644 --- a/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.cs +++ b/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.Designer.cs b/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.Designer.cs index 89bab3a0fa..ca9502422b 100644 --- a/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.Designer.cs +++ b/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.cs b/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.cs index 7b579e27b9..82c5b27769 100644 --- a/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.cs +++ b/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20210824185035_AddCountdownSettings.Designer.cs b/osu.Game/Migrations/20210824185035_AddCountdownSettings.Designer.cs index afeb42130d..2a4e370649 100644 --- a/osu.Game/Migrations/20210824185035_AddCountdownSettings.Designer.cs +++ b/osu.Game/Migrations/20210824185035_AddCountdownSettings.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20210824185035_AddCountdownSettings.cs b/osu.Game/Migrations/20210824185035_AddCountdownSettings.cs index d1b09e2c1d..dd6fa23387 100644 --- a/osu.Game/Migrations/20210824185035_AddCountdownSettings.cs +++ b/osu.Game/Migrations/20210824185035_AddCountdownSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.Designer.cs b/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.Designer.cs index 6e53d7fae0..9e09f2c69e 100644 --- a/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.Designer.cs +++ b/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.Designer.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.cs b/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.cs index f6fc1f4420..0598a41f09 100644 --- a/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.cs +++ b/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20211020081609_ResetSkinHashes.cs b/osu.Game/Migrations/20211020081609_ResetSkinHashes.cs index 6d53c019ec..0f7a2a5702 100644 --- a/osu.Game/Migrations/20211020081609_ResetSkinHashes.cs +++ b/osu.Game/Migrations/20211020081609_ResetSkinHashes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using osu.Game.Database; diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index 036c26cb0a..7e38889fa6 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -1,5 +1,7 @@ // using System; + +#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; diff --git a/osu.Game/Models/RealmFile.cs b/osu.Game/Models/RealmFile.cs index 9e8da7cdc4..f96b717937 100644 --- a/osu.Game/Models/RealmFile.cs +++ b/osu.Game/Models/RealmFile.cs @@ -5,8 +5,6 @@ using osu.Framework.Testing; using osu.Game.IO; using Realms; -#nullable enable - namespace osu.Game.Models { [ExcludeFromDynamicCompile] diff --git a/osu.Game/Models/RealmNamedFileUsage.cs b/osu.Game/Models/RealmNamedFileUsage.cs index 17e32510a8..0f6f439d73 100644 --- a/osu.Game/Models/RealmNamedFileUsage.cs +++ b/osu.Game/Models/RealmNamedFileUsage.cs @@ -7,8 +7,6 @@ using osu.Game.Database; using osu.Game.IO; using Realms; -#nullable enable - namespace osu.Game.Models { [ExcludeFromDynamicCompile] diff --git a/osu.Game/Models/RealmUser.cs b/osu.Game/Models/RealmUser.cs index 18c849cf0a..58fd7ff2a3 100644 --- a/osu.Game/Models/RealmUser.cs +++ b/osu.Game/Models/RealmUser.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Database; using osu.Game.Users; diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 62ddd49881..088dc56701 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Online/API/APIDownloadRequest.cs b/osu.Game/Online/API/APIDownloadRequest.cs index 11753e05ba..c48372278a 100644 --- a/osu.Game/Online/API/APIDownloadRequest.cs +++ b/osu.Game/Online/API/APIDownloadRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using osu.Framework.IO.Network; diff --git a/osu.Game/Online/API/APIException.cs b/osu.Game/Online/API/APIException.cs index 54d68d8f0d..21a9c761c7 100644 --- a/osu.Game/Online/API/APIException.cs +++ b/osu.Game/Online/API/APIException.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Online.API diff --git a/osu.Game/Online/API/APIMessagesRequest.cs b/osu.Game/Online/API/APIMessagesRequest.cs index 3ad6b1d7c8..5bb3e29621 100644 --- a/osu.Game/Online/API/APIMessagesRequest.cs +++ b/osu.Game/Online/API/APIMessagesRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.IO.Network; using osu.Game.Online.Chat; diff --git a/osu.Game/Online/API/APIMod.cs b/osu.Game/Online/API/APIMod.cs index 524f7b7108..dc1db08174 100644 --- a/osu.Game/Online/API/APIMod.cs +++ b/osu.Game/Online/API/APIMod.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Online/API/APIRequest.cs b/osu.Game/Online/API/APIRequest.cs index 451ea117d5..dc6a3fe3d5 100644 --- a/osu.Game/Online/API/APIRequest.cs +++ b/osu.Game/Online/API/APIRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; using JetBrains.Annotations; diff --git a/osu.Game/Online/API/APIRequestCompletionState.cs b/osu.Game/Online/API/APIRequestCompletionState.cs index 84c9974dd8..52eb669a7d 100644 --- a/osu.Game/Online/API/APIRequestCompletionState.cs +++ b/osu.Game/Online/API/APIRequestCompletionState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Online.API { public enum APIRequestCompletionState diff --git a/osu.Game/Online/API/ArchiveDownloadRequest.cs b/osu.Game/Online/API/ArchiveDownloadRequest.cs index 0bf238109e..ff96b39e08 100644 --- a/osu.Game/Online/API/ArchiveDownloadRequest.cs +++ b/osu.Game/Online/API/ArchiveDownloadRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Online.API diff --git a/osu.Game/Online/API/DummyAPIAccess.cs b/osu.Game/Online/API/DummyAPIAccess.cs index d3707d977c..245760a00a 100644 --- a/osu.Game/Online/API/DummyAPIAccess.cs +++ b/osu.Game/Online/API/DummyAPIAccess.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading; using System.Threading.Tasks; diff --git a/osu.Game/Online/API/IAPIProvider.cs b/osu.Game/Online/API/IAPIProvider.cs index 470d46cd7f..812aa7f09f 100644 --- a/osu.Game/Online/API/IAPIProvider.cs +++ b/osu.Game/Online/API/IAPIProvider.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Threading.Tasks; using osu.Framework.Bindables; diff --git a/osu.Game/Online/API/ModSettingsDictionaryFormatter.cs b/osu.Game/Online/API/ModSettingsDictionaryFormatter.cs index a7c63c17f9..df64984c7a 100644 --- a/osu.Game/Online/API/ModSettingsDictionaryFormatter.cs +++ b/osu.Game/Online/API/ModSettingsDictionaryFormatter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Buffers; using System.Collections.Generic; using System.Text; diff --git a/osu.Game/Online/API/OAuth.cs b/osu.Game/Online/API/OAuth.cs index 1feb3076d1..58306c1938 100644 --- a/osu.Game/Online/API/OAuth.cs +++ b/osu.Game/Online/API/OAuth.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Net.Http; diff --git a/osu.Game/Online/API/OAuthToken.cs b/osu.Game/Online/API/OAuthToken.cs index f103d0917d..63c88b875b 100644 --- a/osu.Game/Online/API/OAuthToken.cs +++ b/osu.Game/Online/API/OAuthToken.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; using Newtonsoft.Json; diff --git a/osu.Game/Online/API/OsuJsonWebRequest.cs b/osu.Game/Online/API/OsuJsonWebRequest.cs index 4a45a8b261..2d402edd3f 100644 --- a/osu.Game/Online/API/OsuJsonWebRequest.cs +++ b/osu.Game/Online/API/OsuJsonWebRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.IO.Network; namespace osu.Game.Online.API diff --git a/osu.Game/Online/API/OsuWebRequest.cs b/osu.Game/Online/API/OsuWebRequest.cs index 1d27899473..9a7cf45a2f 100644 --- a/osu.Game/Online/API/OsuWebRequest.cs +++ b/osu.Game/Online/API/OsuWebRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.IO.Network; namespace osu.Game.Online.API diff --git a/osu.Game/Online/API/RegistrationRequest.cs b/osu.Game/Online/API/RegistrationRequest.cs index f650e5c93b..6dc867481a 100644 --- a/osu.Game/Online/API/RegistrationRequest.cs +++ b/osu.Game/Online/API/RegistrationRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Online.API diff --git a/osu.Game/Online/API/Requests/CommentVoteRequest.cs b/osu.Game/Online/API/Requests/CommentVoteRequest.cs index 06a3b1126e..a835b0365c 100644 --- a/osu.Game/Online/API/Requests/CommentVoteRequest.cs +++ b/osu.Game/Online/API/Requests/CommentVoteRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.IO.Network; using osu.Game.Online.API.Requests.Responses; using System.Net.Http; diff --git a/osu.Game/Online/API/Requests/CreateChannelRequest.cs b/osu.Game/Online/API/Requests/CreateChannelRequest.cs index 041ad26267..130210b1c3 100644 --- a/osu.Game/Online/API/Requests/CreateChannelRequest.cs +++ b/osu.Game/Online/API/Requests/CreateChannelRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using System.Net.Http; using osu.Framework.IO.Network; diff --git a/osu.Game/Online/API/Requests/CreateNewPrivateMessageRequest.cs b/osu.Game/Online/API/Requests/CreateNewPrivateMessageRequest.cs index e5761149e7..dea94bfce2 100644 --- a/osu.Game/Online/API/Requests/CreateNewPrivateMessageRequest.cs +++ b/osu.Game/Online/API/Requests/CreateNewPrivateMessageRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Net.Http; using osu.Framework.IO.Network; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/CreateNewPrivateMessageResponse.cs b/osu.Game/Online/API/Requests/CreateNewPrivateMessageResponse.cs index f749b27114..1af61770df 100644 --- a/osu.Game/Online/API/Requests/CreateNewPrivateMessageResponse.cs +++ b/osu.Game/Online/API/Requests/CreateNewPrivateMessageResponse.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; using osu.Game.Online.Chat; diff --git a/osu.Game/Online/API/Requests/Cursor.cs b/osu.Game/Online/API/Requests/Cursor.cs index 3de8db770c..c7bb119bd8 100644 --- a/osu.Game/Online/API/Requests/Cursor.cs +++ b/osu.Game/Online/API/Requests/Cursor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using JetBrains.Annotations; using Newtonsoft.Json; diff --git a/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs b/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs index 5254dc3cf8..f190b6e821 100644 --- a/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs +++ b/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.IO.Network; using osu.Game.Beatmaps; diff --git a/osu.Game/Online/API/Requests/DownloadReplayRequest.cs b/osu.Game/Online/API/Requests/DownloadReplayRequest.cs index 77174f0bb5..5635c4728e 100644 --- a/osu.Game/Online/API/Requests/DownloadReplayRequest.cs +++ b/osu.Game/Online/API/Requests/DownloadReplayRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Scoring; namespace osu.Game.Online.API.Requests diff --git a/osu.Game/Online/API/Requests/GetBeatmapRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapRequest.cs index 671f543422..efecc0fc25 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapRequest.cs @@ -5,8 +5,6 @@ using osu.Framework.IO.Network; using osu.Game.Beatmaps; using osu.Game.Online.API.Requests.Responses; -#nullable enable - namespace osu.Game.Online.API.Requests { public class GetBeatmapRequest : APIRequest diff --git a/osu.Game/Online/API/Requests/GetBeatmapSetRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapSetRequest.cs index 158ae03b8d..f3690c934d 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapSetRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapSetRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests diff --git a/osu.Game/Online/API/Requests/GetBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapsRequest.cs index 22af022659..e118d1bddc 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapsRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; diff --git a/osu.Game/Online/API/Requests/GetBeatmapsResponse.cs b/osu.Game/Online/API/Requests/GetBeatmapsResponse.cs index c450c3269c..c91aa5002c 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapsResponse.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapsResponse.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs index baa15c70c4..2d2d241b86 100644 --- a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests diff --git a/osu.Game/Online/API/Requests/GetChangelogRequest.cs b/osu.Game/Online/API/Requests/GetChangelogRequest.cs index 97799ff66a..82ed42615f 100644 --- a/osu.Game/Online/API/Requests/GetChangelogRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests diff --git a/osu.Game/Online/API/Requests/GetCommentsRequest.cs b/osu.Game/Online/API/Requests/GetCommentsRequest.cs index 24dae4adf1..c63c574124 100644 --- a/osu.Game/Online/API/Requests/GetCommentsRequest.cs +++ b/osu.Game/Online/API/Requests/GetCommentsRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.IO.Network; using Humanizer; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/GetCountriesResponse.cs b/osu.Game/Online/API/Requests/GetCountriesResponse.cs index 6624344b44..117993b98c 100644 --- a/osu.Game/Online/API/Requests/GetCountriesResponse.cs +++ b/osu.Game/Online/API/Requests/GetCountriesResponse.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Users; diff --git a/osu.Game/Online/API/Requests/GetCountryRankingsRequest.cs b/osu.Game/Online/API/Requests/GetCountryRankingsRequest.cs index d8a1198627..9d037ab116 100644 --- a/osu.Game/Online/API/Requests/GetCountryRankingsRequest.cs +++ b/osu.Game/Online/API/Requests/GetCountryRankingsRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets; namespace osu.Game.Online.API.Requests diff --git a/osu.Game/Online/API/Requests/GetFriendsRequest.cs b/osu.Game/Online/API/Requests/GetFriendsRequest.cs index 63a221d91a..640ddcbb9e 100644 --- a/osu.Game/Online/API/Requests/GetFriendsRequest.cs +++ b/osu.Game/Online/API/Requests/GetFriendsRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/GetMessagesRequest.cs b/osu.Game/Online/API/Requests/GetMessagesRequest.cs index 651f8a06c5..2f9879c63f 100644 --- a/osu.Game/Online/API/Requests/GetMessagesRequest.cs +++ b/osu.Game/Online/API/Requests/GetMessagesRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Online.Chat; diff --git a/osu.Game/Online/API/Requests/GetNewsRequest.cs b/osu.Game/Online/API/Requests/GetNewsRequest.cs index 992ccc6d59..e1c9eefe30 100644 --- a/osu.Game/Online/API/Requests/GetNewsRequest.cs +++ b/osu.Game/Online/API/Requests/GetNewsRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.IO.Network; using osu.Game.Extensions; diff --git a/osu.Game/Online/API/Requests/GetNewsResponse.cs b/osu.Game/Online/API/Requests/GetNewsResponse.cs index 98f76d105c..b62d83557e 100644 --- a/osu.Game/Online/API/Requests/GetNewsResponse.cs +++ b/osu.Game/Online/API/Requests/GetNewsResponse.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/GetRankingsRequest.cs b/osu.Game/Online/API/Requests/GetRankingsRequest.cs index ddc3298ca7..f42da69dcc 100644 --- a/osu.Game/Online/API/Requests/GetRankingsRequest.cs +++ b/osu.Game/Online/API/Requests/GetRankingsRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.IO.Network; using osu.Game.Rulesets; diff --git a/osu.Game/Online/API/Requests/GetScoresRequest.cs b/osu.Game/Online/API/Requests/GetScoresRequest.cs index 8e447390e6..a6cd9a52c7 100644 --- a/osu.Game/Online/API/Requests/GetScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetScoresRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Beatmaps; using osu.Game.Rulesets; diff --git a/osu.Game/Online/API/Requests/GetSeasonalBackgroundsRequest.cs b/osu.Game/Online/API/Requests/GetSeasonalBackgroundsRequest.cs index 941b47244a..0ecce90749 100644 --- a/osu.Game/Online/API/Requests/GetSeasonalBackgroundsRequest.cs +++ b/osu.Game/Online/API/Requests/GetSeasonalBackgroundsRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests diff --git a/osu.Game/Online/API/Requests/GetSpotlightRankingsRequest.cs b/osu.Game/Online/API/Requests/GetSpotlightRankingsRequest.cs index 20856c2768..75b0cf8027 100644 --- a/osu.Game/Online/API/Requests/GetSpotlightRankingsRequest.cs +++ b/osu.Game/Online/API/Requests/GetSpotlightRankingsRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.IO.Network; using osu.Game.Overlays.Rankings; using osu.Game.Rulesets; diff --git a/osu.Game/Online/API/Requests/GetSpotlightRankingsResponse.cs b/osu.Game/Online/API/Requests/GetSpotlightRankingsResponse.cs index 2259314a9f..5bc7bd5e08 100644 --- a/osu.Game/Online/API/Requests/GetSpotlightRankingsResponse.cs +++ b/osu.Game/Online/API/Requests/GetSpotlightRankingsResponse.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/GetSpotlightsRequest.cs b/osu.Game/Online/API/Requests/GetSpotlightsRequest.cs index 6fafb3933c..93a63afcaa 100644 --- a/osu.Game/Online/API/Requests/GetSpotlightsRequest.cs +++ b/osu.Game/Online/API/Requests/GetSpotlightsRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/GetTopUsersRequest.cs b/osu.Game/Online/API/Requests/GetTopUsersRequest.cs index dbbd2119db..7f05cd5eab 100644 --- a/osu.Game/Online/API/Requests/GetTopUsersRequest.cs +++ b/osu.Game/Online/API/Requests/GetTopUsersRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Online.API.Requests { public class GetTopUsersRequest : APIRequest diff --git a/osu.Game/Online/API/Requests/GetTopUsersResponse.cs b/osu.Game/Online/API/Requests/GetTopUsersResponse.cs index b37b8b3499..6e0e8f11ae 100644 --- a/osu.Game/Online/API/Requests/GetTopUsersResponse.cs +++ b/osu.Game/Online/API/Requests/GetTopUsersResponse.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Users; diff --git a/osu.Game/Online/API/Requests/GetUpdatesRequest.cs b/osu.Game/Online/API/Requests/GetUpdatesRequest.cs index 488bb8bbf4..ce2689d262 100644 --- a/osu.Game/Online/API/Requests/GetUpdatesRequest.cs +++ b/osu.Game/Online/API/Requests/GetUpdatesRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.IO.Network; using osu.Game.Online.Chat; diff --git a/osu.Game/Online/API/Requests/GetUpdatesResponse.cs b/osu.Game/Online/API/Requests/GetUpdatesResponse.cs index 4ac806bedc..61f6a8664d 100644 --- a/osu.Game/Online/API/Requests/GetUpdatesResponse.cs +++ b/osu.Game/Online/API/Requests/GetUpdatesResponse.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Online.Chat; diff --git a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs index 205fdc9f2b..3ec60cd06c 100644 --- a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Humanizer; using System.Collections.Generic; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs b/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs index 67d3ad26b0..3d0ee23080 100644 --- a/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserKudosuHistoryRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs index bef3df42fb..e5e65415f7 100644 --- a/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserMostPlayedBeatmapsRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs b/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs index bccc3bc0c3..ab0cc3a56d 100644 --- a/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.IO.Network; using osu.Game.Rulesets; diff --git a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs index 79f0549d4a..82cf0a508a 100644 --- a/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/GetUserRequest.cs b/osu.Game/Online/API/Requests/GetUserRequest.cs index 28da5222f9..ab45e8e48f 100644 --- a/osu.Game/Online/API/Requests/GetUserRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; diff --git a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs index 7250929f11..9bd78b7be1 100644 --- a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.IO.Network; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/GetUsersRequest.cs b/osu.Game/Online/API/Requests/GetUsersRequest.cs index 969d7fdba3..bbaf241384 100644 --- a/osu.Game/Online/API/Requests/GetUsersRequest.cs +++ b/osu.Game/Online/API/Requests/GetUsersRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Online.API.Requests diff --git a/osu.Game/Online/API/Requests/GetUsersResponse.cs b/osu.Game/Online/API/Requests/GetUsersResponse.cs index 022050de5c..b49bef589a 100644 --- a/osu.Game/Online/API/Requests/GetUsersResponse.cs +++ b/osu.Game/Online/API/Requests/GetUsersResponse.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/GetWikiRequest.cs b/osu.Game/Online/API/Requests/GetWikiRequest.cs index 09571ab0a8..e0f967ec15 100644 --- a/osu.Game/Online/API/Requests/GetWikiRequest.cs +++ b/osu.Game/Online/API/Requests/GetWikiRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Extensions; using osu.Game.Localisation; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/JoinChannelRequest.cs b/osu.Game/Online/API/Requests/JoinChannelRequest.cs index 33eab7e355..30b8fafd57 100644 --- a/osu.Game/Online/API/Requests/JoinChannelRequest.cs +++ b/osu.Game/Online/API/Requests/JoinChannelRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Net.Http; using osu.Framework.IO.Network; using osu.Game.Online.Chat; diff --git a/osu.Game/Online/API/Requests/LeaveChannelRequest.cs b/osu.Game/Online/API/Requests/LeaveChannelRequest.cs index 7dfc9a0aed..4e77055e67 100644 --- a/osu.Game/Online/API/Requests/LeaveChannelRequest.cs +++ b/osu.Game/Online/API/Requests/LeaveChannelRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Net.Http; using osu.Framework.IO.Network; using osu.Game.Online.Chat; diff --git a/osu.Game/Online/API/Requests/ListChannelsRequest.cs b/osu.Game/Online/API/Requests/ListChannelsRequest.cs index 9660695c14..6f8fb427dc 100644 --- a/osu.Game/Online/API/Requests/ListChannelsRequest.cs +++ b/osu.Game/Online/API/Requests/ListChannelsRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Online.Chat; diff --git a/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs b/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs index b24669e6d5..afdc8a47f4 100644 --- a/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs +++ b/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Net.Http; using osu.Framework.IO.Network; using osu.Game.Online.Chat; diff --git a/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs b/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs index 3d719de958..4af1f58180 100644 --- a/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs +++ b/osu.Game/Online/API/Requests/PaginatedAPIRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Globalization; using osu.Framework.IO.Network; diff --git a/osu.Game/Online/API/Requests/PaginationParameters.cs b/osu.Game/Online/API/Requests/PaginationParameters.cs index 3593a4fe83..6dacb009bd 100644 --- a/osu.Game/Online/API/Requests/PaginationParameters.cs +++ b/osu.Game/Online/API/Requests/PaginationParameters.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Online.API.Requests { /// diff --git a/osu.Game/Online/API/Requests/PostBeatmapFavouriteRequest.cs b/osu.Game/Online/API/Requests/PostBeatmapFavouriteRequest.cs index 9fdc3382aa..1438c9c436 100644 --- a/osu.Game/Online/API/Requests/PostBeatmapFavouriteRequest.cs +++ b/osu.Game/Online/API/Requests/PostBeatmapFavouriteRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.IO.Network; using System.Net.Http; diff --git a/osu.Game/Online/API/Requests/PostMessageRequest.cs b/osu.Game/Online/API/Requests/PostMessageRequest.cs index 5d508a4cdf..7b20bd9ad5 100644 --- a/osu.Game/Online/API/Requests/PostMessageRequest.cs +++ b/osu.Game/Online/API/Requests/PostMessageRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Net.Http; using osu.Framework.IO.Network; using osu.Game.Online.Chat; diff --git a/osu.Game/Online/API/Requests/ResponseWithCursor.cs b/osu.Game/Online/API/Requests/ResponseWithCursor.cs index d52e999722..66e8094442 100644 --- a/osu.Game/Online/API/Requests/ResponseWithCursor.cs +++ b/osu.Game/Online/API/Requests/ResponseWithCursor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Online.API.Requests diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs index f5795141c5..258708de2b 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs @@ -7,8 +7,6 @@ using osu.Game.Beatmaps; using osu.Game.Extensions; using osu.Game.Rulesets; -#nullable enable - namespace osu.Game.Online.API.Requests.Responses { public class APIBeatmap : IBeatmapInfo, IBeatmapOnlineInfo diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs index 79c65fa79e..238f41e53d 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs @@ -9,8 +9,6 @@ using osu.Game.Database; using osu.Game.Extensions; using osu.Game.Models; -#nullable enable - namespace osu.Game.Online.API.Requests.Responses { public class APIBeatmapSet : IBeatmapSetOnlineInfo, IBeatmapSetInfo diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs index 56005e15f8..38c727396a 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs index 1ff7523ba6..2355de8f3c 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Newtonsoft.Json; diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs index 778e8754fe..0728fc1c7e 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogUser.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogUser.cs index 024e1ce048..071f9f8517 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogUser.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogUser.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Online.API.Requests.Responses diff --git a/osu.Game/Online/API/Requests/Responses/APIChatChannel.cs b/osu.Game/Online/API/Requests/Responses/APIChatChannel.cs index fc3b2a8e31..a04dc89986 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChatChannel.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChatChannel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Online.Chat; diff --git a/osu.Game/Online/API/Requests/Responses/APIKudosuHistory.cs b/osu.Game/Online/API/Requests/Responses/APIKudosuHistory.cs index d596ddc560..583def8eda 100644 --- a/osu.Game/Online/API/Requests/Responses/APIKudosuHistory.cs +++ b/osu.Game/Online/API/Requests/Responses/APIKudosuHistory.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using Newtonsoft.Json; diff --git a/osu.Game/Online/API/Requests/Responses/APINewsPost.cs b/osu.Game/Online/API/Requests/Responses/APINewsPost.cs index ced08f0bf2..ff12a83af2 100644 --- a/osu.Game/Online/API/Requests/Responses/APINewsPost.cs +++ b/osu.Game/Online/API/Requests/Responses/APINewsPost.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; using System; using System.Net; diff --git a/osu.Game/Online/API/Requests/Responses/APINewsSidebar.cs b/osu.Game/Online/API/Requests/Responses/APINewsSidebar.cs index b8d6469a1d..a94dfbd923 100644 --- a/osu.Game/Online/API/Requests/Responses/APINewsSidebar.cs +++ b/osu.Game/Online/API/Requests/Responses/APINewsSidebar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; using System.Collections.Generic; diff --git a/osu.Game/Online/API/Requests/Responses/APIPlayStyle.cs b/osu.Game/Online/API/Requests/Responses/APIPlayStyle.cs index a9d66f3d6a..4a877f392a 100644 --- a/osu.Game/Online/API/Requests/Responses/APIPlayStyle.cs +++ b/osu.Game/Online/API/Requests/Responses/APIPlayStyle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Online/API/Requests/Responses/APIRankHistory.cs b/osu.Game/Online/API/Requests/Responses/APIRankHistory.cs index 064badcccb..b3af2e1a3e 100644 --- a/osu.Game/Online/API/Requests/Responses/APIRankHistory.cs +++ b/osu.Game/Online/API/Requests/Responses/APIRankHistory.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Online.API.Requests.Responses diff --git a/osu.Game/Online/API/Requests/Responses/APIRecentActivity.cs b/osu.Game/Online/API/Requests/Responses/APIRecentActivity.cs index 8695d09570..8fefe4d9c2 100644 --- a/osu.Game/Online/API/Requests/Responses/APIRecentActivity.cs +++ b/osu.Game/Online/API/Requests/Responses/APIRecentActivity.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Humanizer; using Newtonsoft.Json; diff --git a/osu.Game/Online/API/Requests/Responses/APIScore.cs b/osu.Game/Online/API/Requests/Responses/APIScore.cs index d8f4ba835d..1b56362aec 100644 --- a/osu.Game/Online/API/Requests/Responses/APIScore.cs +++ b/osu.Game/Online/API/Requests/Responses/APIScore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Online/API/Requests/Responses/APIScoreWithPosition.cs b/osu.Game/Online/API/Requests/Responses/APIScoreWithPosition.cs index d3c9ba0c7e..8bd54f889d 100644 --- a/osu.Game/Online/API/Requests/Responses/APIScoreWithPosition.cs +++ b/osu.Game/Online/API/Requests/Responses/APIScoreWithPosition.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; using osu.Game.Beatmaps; using osu.Game.Rulesets; diff --git a/osu.Game/Online/API/Requests/Responses/APIScoresCollection.cs b/osu.Game/Online/API/Requests/Responses/APIScoresCollection.cs index 283ebf2411..9c8a38c63a 100644 --- a/osu.Game/Online/API/Requests/Responses/APIScoresCollection.cs +++ b/osu.Game/Online/API/Requests/Responses/APIScoresCollection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game/Online/API/Requests/Responses/APISeasonalBackgrounds.cs b/osu.Game/Online/API/Requests/Responses/APISeasonalBackgrounds.cs index 8e395f7397..c70dcc0e0b 100644 --- a/osu.Game/Online/API/Requests/Responses/APISeasonalBackgrounds.cs +++ b/osu.Game/Online/API/Requests/Responses/APISeasonalBackgrounds.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game/Online/API/Requests/Responses/APISpotlight.cs b/osu.Game/Online/API/Requests/Responses/APISpotlight.cs index 4f63ebe3df..6eb51a0fb3 100644 --- a/osu.Game/Online/API/Requests/Responses/APISpotlight.cs +++ b/osu.Game/Online/API/Requests/Responses/APISpotlight.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Newtonsoft.Json; diff --git a/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs index 5af7d6a01c..76d1941d9d 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game/Online/API/Requests/Responses/APIUser.cs b/osu.Game/Online/API/Requests/Responses/APIUser.cs index 41f486c709..63aaa9b90e 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUser.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUser.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Online/API/Requests/Responses/APIUserAchievement.cs b/osu.Game/Online/API/Requests/Responses/APIUserAchievement.cs index cfba9118c2..65001dd6cf 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUserAchievement.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUserAchievement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Newtonsoft.Json; diff --git a/osu.Game/Online/API/Requests/Responses/APIUserContainer.cs b/osu.Game/Online/API/Requests/Responses/APIUserContainer.cs index 9eb4a2a4e3..b2d544c71f 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUserContainer.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUserContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Online.API.Requests.Responses diff --git a/osu.Game/Online/API/Requests/Responses/APIUserHistoryCount.cs b/osu.Game/Online/API/Requests/Responses/APIUserHistoryCount.cs index 1226c88c08..6eb3c8b8a4 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUserHistoryCount.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUserHistoryCount.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Newtonsoft.Json; diff --git a/osu.Game/Online/API/Requests/Responses/APIUserMostPlayedBeatmap.cs b/osu.Game/Online/API/Requests/Responses/APIUserMostPlayedBeatmap.cs index 19c581bf95..6d5fd59f9c 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUserMostPlayedBeatmap.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUserMostPlayedBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Online.API.Requests.Responses diff --git a/osu.Game/Online/API/Requests/Responses/APIUserScoreAggregate.cs b/osu.Game/Online/API/Requests/Responses/APIUserScoreAggregate.cs index a298a8625a..30433ab8cd 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUserScoreAggregate.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUserScoreAggregate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Newtonsoft.Json; using osu.Game.Rulesets.Mods; diff --git a/osu.Game/Online/API/Requests/Responses/APIWikiPage.cs b/osu.Game/Online/API/Requests/Responses/APIWikiPage.cs index 957396b17a..ea2457bf1b 100644 --- a/osu.Game/Online/API/Requests/Responses/APIWikiPage.cs +++ b/osu.Game/Online/API/Requests/Responses/APIWikiPage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs index 13379a40a6..500c0566e6 100644 --- a/osu.Game/Online/API/Requests/Responses/Comment.cs +++ b/osu.Game/Online/API/Requests/Responses/Comment.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; using System; diff --git a/osu.Game/Online/API/Requests/Responses/CommentBundle.cs b/osu.Game/Online/API/Requests/Responses/CommentBundle.cs index 8436381090..ae8b850723 100644 --- a/osu.Game/Online/API/Requests/Responses/CommentBundle.cs +++ b/osu.Game/Online/API/Requests/Responses/CommentBundle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs index 736024b08b..73f6fce4f9 100644 --- a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using Humanizer; diff --git a/osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs b/osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs index 3c4fb11ed1..abc30e18ea 100644 --- a/osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs +++ b/osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/BeatmapDownloadTracker.cs b/osu.Game/Online/BeatmapDownloadTracker.cs index 9f795f007a..1e3add6201 100644 --- a/osu.Game/Online/BeatmapDownloadTracker.cs +++ b/osu.Game/Online/BeatmapDownloadTracker.cs @@ -8,8 +8,6 @@ using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Online.API; -#nullable enable - namespace osu.Game.Online { public class BeatmapDownloadTracker : DownloadTracker diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index a37d3084f0..f51ea3e8d6 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index c96e7c4cd3..4c762d002d 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Online/Chat/ChannelType.cs b/osu.Game/Online/Chat/ChannelType.cs index bd628e90c4..a864e20830 100644 --- a/osu.Game/Online/Chat/ChannelType.cs +++ b/osu.Game/Online/Chat/ChannelType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Online.Chat { public enum ChannelType diff --git a/osu.Game/Online/Chat/DrawableLinkCompiler.cs b/osu.Game/Online/Chat/DrawableLinkCompiler.cs index 3b0d049528..44e66c1a69 100644 --- a/osu.Game/Online/Chat/DrawableLinkCompiler.cs +++ b/osu.Game/Online/Chat/DrawableLinkCompiler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Online/Chat/ErrorMessage.cs b/osu.Game/Online/Chat/ErrorMessage.cs index 87a65fb3f1..9cd91a0927 100644 --- a/osu.Game/Online/Chat/ErrorMessage.cs +++ b/osu.Game/Online/Chat/ErrorMessage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Online.Chat { public class ErrorMessage : InfoMessage diff --git a/osu.Game/Online/Chat/ExternalLinkOpener.cs b/osu.Game/Online/Chat/ExternalLinkOpener.cs index 20d8459132..e557b9933e 100644 --- a/osu.Game/Online/Chat/ExternalLinkOpener.cs +++ b/osu.Game/Online/Chat/ExternalLinkOpener.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Online/Chat/IChannelPostTarget.cs b/osu.Game/Online/Chat/IChannelPostTarget.cs index 5697e918f0..bd8648189a 100644 --- a/osu.Game/Online/Chat/IChannelPostTarget.cs +++ b/osu.Game/Online/Chat/IChannelPostTarget.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; namespace osu.Game.Online.Chat diff --git a/osu.Game/Online/Chat/InfoMessage.cs b/osu.Game/Online/Chat/InfoMessage.cs index e97245df45..d98c67de34 100644 --- a/osu.Game/Online/Chat/InfoMessage.cs +++ b/osu.Game/Online/Chat/InfoMessage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/Chat/LocalEchoMessage.cs b/osu.Game/Online/Chat/LocalEchoMessage.cs index 8a39515575..b226fe6cad 100644 --- a/osu.Game/Online/Chat/LocalEchoMessage.cs +++ b/osu.Game/Online/Chat/LocalEchoMessage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Online.Chat { public class LocalEchoMessage : LocalMessage diff --git a/osu.Game/Online/Chat/LocalMessage.cs b/osu.Game/Online/Chat/LocalMessage.cs index 027edbcca5..5736f5cabf 100644 --- a/osu.Game/Online/Chat/LocalMessage.cs +++ b/osu.Game/Online/Chat/LocalMessage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Online.Chat { /// diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index ad004e2881..86562341eb 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game/Online/Chat/MessageFormatter.cs b/osu.Game/Online/Chat/MessageFormatter.cs index b18daea453..7a040d9446 100644 --- a/osu.Game/Online/Chat/MessageFormatter.cs +++ b/osu.Game/Online/Chat/MessageFormatter.cs @@ -6,8 +6,6 @@ using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; -#nullable enable - namespace osu.Game.Online.Chat { public static class MessageFormatter diff --git a/osu.Game/Online/Chat/MessageNotifier.cs b/osu.Game/Online/Chat/MessageNotifier.cs index fbc5ef79ef..3fc6a008e8 100644 --- a/osu.Game/Online/Chat/MessageNotifier.cs +++ b/osu.Game/Online/Chat/MessageNotifier.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; diff --git a/osu.Game/Online/Chat/NowPlayingCommand.cs b/osu.Game/Online/Chat/NowPlayingCommand.cs index 2bf35d7973..6a25ceb919 100644 --- a/osu.Game/Online/Chat/NowPlayingCommand.cs +++ b/osu.Game/Online/Chat/NowPlayingCommand.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Online/Chat/StandAloneChatDisplay.cs b/osu.Game/Online/Chat/StandAloneChatDisplay.cs index bbfffea6fd..76fcb80eb4 100644 --- a/osu.Game/Online/Chat/StandAloneChatDisplay.cs +++ b/osu.Game/Online/Chat/StandAloneChatDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Online/DevelopmentEndpointConfiguration.cs b/osu.Game/Online/DevelopmentEndpointConfiguration.cs index 69531dbe1b..83fd02512b 100644 --- a/osu.Game/Online/DevelopmentEndpointConfiguration.cs +++ b/osu.Game/Online/DevelopmentEndpointConfiguration.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Online { public class DevelopmentEndpointConfiguration : EndpointConfiguration diff --git a/osu.Game/Online/DownloadState.cs b/osu.Game/Online/DownloadState.cs index a58c40d16a..3d389d45f9 100644 --- a/osu.Game/Online/DownloadState.cs +++ b/osu.Game/Online/DownloadState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Online { public enum DownloadState diff --git a/osu.Game/Online/DownloadTracker.cs b/osu.Game/Online/DownloadTracker.cs index 357c64b6a3..85af9abb33 100644 --- a/osu.Game/Online/DownloadTracker.cs +++ b/osu.Game/Online/DownloadTracker.cs @@ -4,8 +4,6 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; -#nullable enable - namespace osu.Game.Online { public abstract class DownloadTracker : Component diff --git a/osu.Game/Online/EndpointConfiguration.cs b/osu.Game/Online/EndpointConfiguration.cs index e347d3c653..af4e88a05c 100644 --- a/osu.Game/Online/EndpointConfiguration.cs +++ b/osu.Game/Online/EndpointConfiguration.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Online { /// diff --git a/osu.Game/Online/HubClientConnector.cs b/osu.Game/Online/HubClientConnector.cs index 261724e315..f9000c01ef 100644 --- a/osu.Game/Online/HubClientConnector.cs +++ b/osu.Game/Online/HubClientConnector.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Net; diff --git a/osu.Game/Online/IHubClientConnector.cs b/osu.Game/Online/IHubClientConnector.cs index b168e4669f..2afab9091b 100644 --- a/osu.Game/Online/IHubClientConnector.cs +++ b/osu.Game/Online/IHubClientConnector.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using Microsoft.AspNetCore.SignalR.Client; using osu.Framework.Bindables; diff --git a/osu.Game/Online/Leaderboards/DrawableRank.cs b/osu.Game/Online/Leaderboards/DrawableRank.cs index 4d41230799..35bdc4e31f 100644 --- a/osu.Game/Online/Leaderboards/DrawableRank.cs +++ b/osu.Game/Online/Leaderboards/DrawableRank.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Online/Leaderboards/Leaderboard.cs b/osu.Game/Online/Leaderboards/Leaderboard.cs index c94a6d3361..58b1ea62aa 100644 --- a/osu.Game/Online/Leaderboards/Leaderboard.cs +++ b/osu.Game/Online/Leaderboards/Leaderboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index 93a42bffb0..e32bc63aa1 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Online/Leaderboards/LeaderboardScoreTooltip.cs b/osu.Game/Online/Leaderboards/LeaderboardScoreTooltip.cs index c26e9e6802..53a4719050 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScoreTooltip.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScoreTooltip.cs @@ -14,8 +14,6 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; -#nullable enable - namespace osu.Game.Online.Leaderboards { public class LeaderboardScoreTooltip : VisibilityContainer, ITooltip diff --git a/osu.Game/Online/Leaderboards/LeaderboardState.cs b/osu.Game/Online/Leaderboards/LeaderboardState.cs index 6b07500a98..abc0ef4f19 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardState.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Online.Leaderboards { public enum LeaderboardState diff --git a/osu.Game/Online/Leaderboards/UpdateableRank.cs b/osu.Game/Online/Leaderboards/UpdateableRank.cs index 8f74fd84fe..e4f5f72886 100644 --- a/osu.Game/Online/Leaderboards/UpdateableRank.cs +++ b/osu.Game/Online/Leaderboards/UpdateableRank.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Scoring; diff --git a/osu.Game/Online/Leaderboards/UserTopScoreContainer.cs b/osu.Game/Online/Leaderboards/UserTopScoreContainer.cs index 3db497bd6a..df8717fe6d 100644 --- a/osu.Game/Online/Leaderboards/UserTopScoreContainer.cs +++ b/osu.Game/Online/Leaderboards/UserTopScoreContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading; using osu.Framework.Bindables; diff --git a/osu.Game/Online/Multiplayer/Countdown/CountdownChangedEvent.cs b/osu.Game/Online/Multiplayer/Countdown/CountdownChangedEvent.cs index b067f3b235..649e3c8389 100644 --- a/osu.Game/Online/Multiplayer/Countdown/CountdownChangedEvent.cs +++ b/osu.Game/Online/Multiplayer/Countdown/CountdownChangedEvent.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using MessagePack; namespace osu.Game.Online.Multiplayer.Countdown diff --git a/osu.Game/Online/Multiplayer/Countdown/StartMatchCountdownRequest.cs b/osu.Game/Online/Multiplayer/Countdown/StartMatchCountdownRequest.cs index 08eab26090..d0de69d3f4 100644 --- a/osu.Game/Online/Multiplayer/Countdown/StartMatchCountdownRequest.cs +++ b/osu.Game/Online/Multiplayer/Countdown/StartMatchCountdownRequest.cs @@ -4,8 +4,6 @@ using System; using MessagePack; -#nullable enable - namespace osu.Game.Online.Multiplayer.Countdown { /// diff --git a/osu.Game/Online/Multiplayer/Countdown/StopCountdownRequest.cs b/osu.Game/Online/Multiplayer/Countdown/StopCountdownRequest.cs index 20a0e32734..bd0c381c0b 100644 --- a/osu.Game/Online/Multiplayer/Countdown/StopCountdownRequest.cs +++ b/osu.Game/Online/Multiplayer/Countdown/StopCountdownRequest.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using MessagePack; namespace osu.Game.Online.Multiplayer.Countdown diff --git a/osu.Game/Online/Multiplayer/ForceGameplayStartCountdown.cs b/osu.Game/Online/Multiplayer/ForceGameplayStartCountdown.cs index 4ec5019a07..7f5c0f0a05 100644 --- a/osu.Game/Online/Multiplayer/ForceGameplayStartCountdown.cs +++ b/osu.Game/Online/Multiplayer/ForceGameplayStartCountdown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using MessagePack; namespace osu.Game.Online.Multiplayer diff --git a/osu.Game/Online/Multiplayer/IMultiplayerClient.cs b/osu.Game/Online/Multiplayer/IMultiplayerClient.cs index 2f454ea835..995bac1af5 100644 --- a/osu.Game/Online/Multiplayer/IMultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/IMultiplayerClient.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Threading.Tasks; using osu.Game.Online.API; diff --git a/osu.Game/Online/Multiplayer/IMultiplayerLoungeServer.cs b/osu.Game/Online/Multiplayer/IMultiplayerLoungeServer.cs index 0a618c8f5c..68bf3cfaec 100644 --- a/osu.Game/Online/Multiplayer/IMultiplayerLoungeServer.cs +++ b/osu.Game/Online/Multiplayer/IMultiplayerLoungeServer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading.Tasks; namespace osu.Game.Online.Multiplayer diff --git a/osu.Game/Online/Multiplayer/IMultiplayerRoomServer.cs b/osu.Game/Online/Multiplayer/IMultiplayerRoomServer.cs index 073d512f90..a2608f1564 100644 --- a/osu.Game/Online/Multiplayer/IMultiplayerRoomServer.cs +++ b/osu.Game/Online/Multiplayer/IMultiplayerRoomServer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Threading.Tasks; using osu.Game.Online.API; diff --git a/osu.Game/Online/Multiplayer/IMultiplayerServer.cs b/osu.Game/Online/Multiplayer/IMultiplayerServer.cs index d3a070af6d..cc7a474ce7 100644 --- a/osu.Game/Online/Multiplayer/IMultiplayerServer.cs +++ b/osu.Game/Online/Multiplayer/IMultiplayerServer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Online.Multiplayer { /// diff --git a/osu.Game/Online/Multiplayer/InvalidPasswordException.cs b/osu.Game/Online/Multiplayer/InvalidPasswordException.cs index 0441aea287..305c41e69b 100644 --- a/osu.Game/Online/Multiplayer/InvalidPasswordException.cs +++ b/osu.Game/Online/Multiplayer/InvalidPasswordException.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Runtime.Serialization; using Microsoft.AspNetCore.SignalR; diff --git a/osu.Game/Online/Multiplayer/InvalidStateChangeException.cs b/osu.Game/Online/Multiplayer/InvalidStateChangeException.cs index 69b6d4bc13..ab513e71ee 100644 --- a/osu.Game/Online/Multiplayer/InvalidStateChangeException.cs +++ b/osu.Game/Online/Multiplayer/InvalidStateChangeException.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Runtime.Serialization; using Microsoft.AspNetCore.SignalR; diff --git a/osu.Game/Online/Multiplayer/InvalidStateException.cs b/osu.Game/Online/Multiplayer/InvalidStateException.cs index 77a3533dd3..ba3b84ffe4 100644 --- a/osu.Game/Online/Multiplayer/InvalidStateException.cs +++ b/osu.Game/Online/Multiplayer/InvalidStateException.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Runtime.Serialization; using Microsoft.AspNetCore.SignalR; diff --git a/osu.Game/Online/Multiplayer/MatchRoomState.cs b/osu.Game/Online/Multiplayer/MatchRoomState.cs index 30d948f878..cae3aaf7d0 100644 --- a/osu.Game/Online/Multiplayer/MatchRoomState.cs +++ b/osu.Game/Online/Multiplayer/MatchRoomState.cs @@ -5,8 +5,6 @@ using System; using MessagePack; using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus; -#nullable enable - namespace osu.Game.Online.Multiplayer { /// diff --git a/osu.Game/Online/Multiplayer/MatchServerEvent.cs b/osu.Game/Online/Multiplayer/MatchServerEvent.cs index 4ce55e424d..20bf9e5141 100644 --- a/osu.Game/Online/Multiplayer/MatchServerEvent.cs +++ b/osu.Game/Online/Multiplayer/MatchServerEvent.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using MessagePack; using osu.Game.Online.Multiplayer.Countdown; diff --git a/osu.Game/Online/Multiplayer/MatchStartCountdown.cs b/osu.Game/Online/Multiplayer/MatchStartCountdown.cs index 6c1cdd97d3..5d3365c947 100644 --- a/osu.Game/Online/Multiplayer/MatchStartCountdown.cs +++ b/osu.Game/Online/Multiplayer/MatchStartCountdown.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using MessagePack; namespace osu.Game.Online.Multiplayer diff --git a/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/ChangeTeamRequest.cs b/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/ChangeTeamRequest.cs index a26a2b3fc2..4e425490ec 100644 --- a/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/ChangeTeamRequest.cs +++ b/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/ChangeTeamRequest.cs @@ -3,8 +3,6 @@ using MessagePack; -#nullable enable - namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus { [MessagePackObject] diff --git a/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/MultiplayerTeam.cs b/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/MultiplayerTeam.cs index f952dbc1b5..4ecdfb882f 100644 --- a/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/MultiplayerTeam.cs +++ b/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/MultiplayerTeam.cs @@ -4,8 +4,6 @@ using System; using MessagePack; -#nullable enable - namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus { [Serializable] diff --git a/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/TeamVersusRoomState.cs b/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/TeamVersusRoomState.cs index 91d1aa43d4..3758429643 100644 --- a/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/TeamVersusRoomState.cs +++ b/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/TeamVersusRoomState.cs @@ -4,8 +4,6 @@ using System.Collections.Generic; using MessagePack; -#nullable enable - namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus { [MessagePackObject] diff --git a/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/TeamVersusUserState.cs b/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/TeamVersusUserState.cs index 96a4e2ea99..ac3b9724cc 100644 --- a/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/TeamVersusUserState.cs +++ b/osu.Game/Online/Multiplayer/MatchTypes/TeamVersus/TeamVersusUserState.cs @@ -3,8 +3,6 @@ using MessagePack; -#nullable enable - namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus { public class TeamVersusUserState : MatchUserState diff --git a/osu.Game/Online/Multiplayer/MatchUserRequest.cs b/osu.Game/Online/Multiplayer/MatchUserRequest.cs index 888b55e428..7fc1790434 100644 --- a/osu.Game/Online/Multiplayer/MatchUserRequest.cs +++ b/osu.Game/Online/Multiplayer/MatchUserRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using MessagePack; using osu.Game.Online.Multiplayer.Countdown; diff --git a/osu.Game/Online/Multiplayer/MatchUserState.cs b/osu.Game/Online/Multiplayer/MatchUserState.cs index 665b64a8b4..92e8c501ed 100644 --- a/osu.Game/Online/Multiplayer/MatchUserState.cs +++ b/osu.Game/Online/Multiplayer/MatchUserState.cs @@ -5,8 +5,6 @@ using System; using MessagePack; using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus; -#nullable enable - namespace osu.Game.Online.Multiplayer { /// diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index c95f3fa579..22f474ed42 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs b/osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs index cda313bd0a..2083aa4e28 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClientExtensions.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Diagnostics; using System.Threading.Tasks; diff --git a/osu.Game/Online/Multiplayer/MultiplayerCountdown.cs b/osu.Game/Online/Multiplayer/MultiplayerCountdown.cs index dbf2ab667b..621f9236fd 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerCountdown.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerCountdown.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using MessagePack; using osu.Game.Online.Multiplayer.Countdown; diff --git a/osu.Game/Online/Multiplayer/MultiplayerRoom.cs b/osu.Game/Online/Multiplayer/MultiplayerRoom.cs index e215498ff9..fb05c03256 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerRoom.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerRoom.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using MessagePack; diff --git a/osu.Game/Online/Multiplayer/MultiplayerRoomSettings.cs b/osu.Game/Online/Multiplayer/MultiplayerRoomSettings.cs index 5c086066e6..356acb427c 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerRoomSettings.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerRoomSettings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using MessagePack; using osu.Game.Online.Rooms; diff --git a/osu.Game/Online/Multiplayer/MultiplayerRoomState.cs b/osu.Game/Online/Multiplayer/MultiplayerRoomState.cs index 48f25d7ca2..8e28d958a7 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerRoomState.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerRoomState.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - namespace osu.Game.Online.Multiplayer { /// diff --git a/osu.Game/Online/Multiplayer/MultiplayerRoomUser.cs b/osu.Game/Online/Multiplayer/MultiplayerRoomUser.cs index 50e539e8a6..681a839b89 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerRoomUser.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerRoomUser.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Online/Multiplayer/MultiplayerUserState.cs b/osu.Game/Online/Multiplayer/MultiplayerUserState.cs index d1369a7970..0f7dc6b8cd 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerUserState.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerUserState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Online.Multiplayer { public enum MultiplayerUserState diff --git a/osu.Game/Online/Multiplayer/NotHostException.cs b/osu.Game/Online/Multiplayer/NotHostException.cs index 051cde45a0..9f789f1e81 100644 --- a/osu.Game/Online/Multiplayer/NotHostException.cs +++ b/osu.Game/Online/Multiplayer/NotHostException.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Runtime.Serialization; using Microsoft.AspNetCore.SignalR; diff --git a/osu.Game/Online/Multiplayer/NotJoinedRoomException.cs b/osu.Game/Online/Multiplayer/NotJoinedRoomException.cs index 0e9902f002..c749e4615a 100644 --- a/osu.Game/Online/Multiplayer/NotJoinedRoomException.cs +++ b/osu.Game/Online/Multiplayer/NotJoinedRoomException.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Runtime.Serialization; using Microsoft.AspNetCore.SignalR; diff --git a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs index a3423d4189..c061398209 100644 --- a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Online/Multiplayer/QueueMode.cs b/osu.Game/Online/Multiplayer/QueueMode.cs index 3d113c028e..a7bc4ae00a 100644 --- a/osu.Game/Online/Multiplayer/QueueMode.cs +++ b/osu.Game/Online/Multiplayer/QueueMode.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Online.Multiplayer diff --git a/osu.Game/Online/OnlineViewContainer.cs b/osu.Game/Online/OnlineViewContainer.cs index 4955aa9058..7af1ac9d5d 100644 --- a/osu.Game/Online/OnlineViewContainer.cs +++ b/osu.Game/Online/OnlineViewContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Online/Placeholders/ClickablePlaceholder.cs b/osu.Game/Online/Placeholders/ClickablePlaceholder.cs index 054a4a3c39..7f9e16399e 100644 --- a/osu.Game/Online/Placeholders/ClickablePlaceholder.cs +++ b/osu.Game/Online/Placeholders/ClickablePlaceholder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; diff --git a/osu.Game/Online/Placeholders/LoginPlaceholder.cs b/osu.Game/Online/Placeholders/LoginPlaceholder.cs index d03b3d8ffc..6a4065208e 100644 --- a/osu.Game/Online/Placeholders/LoginPlaceholder.cs +++ b/osu.Game/Online/Placeholders/LoginPlaceholder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; diff --git a/osu.Game/Online/Placeholders/MessagePlaceholder.cs b/osu.Game/Online/Placeholders/MessagePlaceholder.cs index 1676ba6cf2..451a4cba85 100644 --- a/osu.Game/Online/Placeholders/MessagePlaceholder.cs +++ b/osu.Game/Online/Placeholders/MessagePlaceholder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; diff --git a/osu.Game/Online/Placeholders/Placeholder.cs b/osu.Game/Online/Placeholders/Placeholder.cs index f58282bbd9..3a05ce1365 100644 --- a/osu.Game/Online/Placeholders/Placeholder.cs +++ b/osu.Game/Online/Placeholders/Placeholder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Online/PollingComponent.cs b/osu.Game/Online/PollingComponent.cs index 5eddb3b49d..d54b8ca75d 100644 --- a/osu.Game/Online/PollingComponent.cs +++ b/osu.Game/Online/PollingComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Threading.Tasks; diff --git a/osu.Game/Online/ProductionEndpointConfiguration.cs b/osu.Game/Online/ProductionEndpointConfiguration.cs index c6ddc03564..f431beac1c 100644 --- a/osu.Game/Online/ProductionEndpointConfiguration.cs +++ b/osu.Game/Online/ProductionEndpointConfiguration.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Online { public class ProductionEndpointConfiguration : EndpointConfiguration diff --git a/osu.Game/Online/Rooms/APICreatedRoom.cs b/osu.Game/Online/Rooms/APICreatedRoom.cs index d1062b2306..ca1179efeb 100644 --- a/osu.Game/Online/Rooms/APICreatedRoom.cs +++ b/osu.Game/Online/Rooms/APICreatedRoom.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Online.Rooms diff --git a/osu.Game/Online/Rooms/APILeaderboard.cs b/osu.Game/Online/Rooms/APILeaderboard.cs index c487123906..170cf3684b 100644 --- a/osu.Game/Online/Rooms/APILeaderboard.cs +++ b/osu.Game/Online/Rooms/APILeaderboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/Rooms/APIScoreToken.cs b/osu.Game/Online/Rooms/APIScoreToken.cs index 6b559876de..58a633f3cf 100644 --- a/osu.Game/Online/Rooms/APIScoreToken.cs +++ b/osu.Game/Online/Rooms/APIScoreToken.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Online.Rooms diff --git a/osu.Game/Online/Rooms/BeatmapAvailability.cs b/osu.Game/Online/Rooms/BeatmapAvailability.cs index a83327aad5..f2b981c075 100644 --- a/osu.Game/Online/Rooms/BeatmapAvailability.cs +++ b/osu.Game/Online/Rooms/BeatmapAvailability.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using MessagePack; using Newtonsoft.Json; diff --git a/osu.Game/Online/Rooms/CreateRoomRequest.cs b/osu.Game/Online/Rooms/CreateRoomRequest.cs index f058eb9ba8..b22780490b 100644 --- a/osu.Game/Online/Rooms/CreateRoomRequest.cs +++ b/osu.Game/Online/Rooms/CreateRoomRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Net.Http; using Newtonsoft.Json; using osu.Framework.IO.Network; diff --git a/osu.Game/Online/Rooms/CreateRoomScoreRequest.cs b/osu.Game/Online/Rooms/CreateRoomScoreRequest.cs index d4303e77df..65731b2b68 100644 --- a/osu.Game/Online/Rooms/CreateRoomScoreRequest.cs +++ b/osu.Game/Online/Rooms/CreateRoomScoreRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Net.Http; using osu.Framework.IO.Network; using osu.Game.Online.API; diff --git a/osu.Game/Online/Rooms/GetRoomLeaderboardRequest.cs b/osu.Game/Online/Rooms/GetRoomLeaderboardRequest.cs index 67e2a2b27f..6b5ed2d024 100644 --- a/osu.Game/Online/Rooms/GetRoomLeaderboardRequest.cs +++ b/osu.Game/Online/Rooms/GetRoomLeaderboardRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Online.API; namespace osu.Game.Online.Rooms diff --git a/osu.Game/Online/Rooms/GetRoomRequest.cs b/osu.Game/Online/Rooms/GetRoomRequest.cs index 853873901e..237d427509 100644 --- a/osu.Game/Online/Rooms/GetRoomRequest.cs +++ b/osu.Game/Online/Rooms/GetRoomRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Online.API; namespace osu.Game.Online.Rooms diff --git a/osu.Game/Online/Rooms/GetRoomsRequest.cs b/osu.Game/Online/Rooms/GetRoomsRequest.cs index e45365797a..5ae9d58189 100644 --- a/osu.Game/Online/Rooms/GetRoomsRequest.cs +++ b/osu.Game/Online/Rooms/GetRoomsRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Humanizer; using osu.Framework.IO.Network; diff --git a/osu.Game/Online/Rooms/IndexPlaylistScoresRequest.cs b/osu.Game/Online/Rooms/IndexPlaylistScoresRequest.cs index bd9f254e1a..1e50155623 100644 --- a/osu.Game/Online/Rooms/IndexPlaylistScoresRequest.cs +++ b/osu.Game/Online/Rooms/IndexPlaylistScoresRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using JetBrains.Annotations; using osu.Framework.IO.Network; diff --git a/osu.Game/Online/Rooms/IndexScoresParams.cs b/osu.Game/Online/Rooms/IndexScoresParams.cs index 3df8c8e753..253caa13a1 100644 --- a/osu.Game/Online/Rooms/IndexScoresParams.cs +++ b/osu.Game/Online/Rooms/IndexScoresParams.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using JetBrains.Annotations; using Newtonsoft.Json; diff --git a/osu.Game/Online/Rooms/IndexedMultiplayerScores.cs b/osu.Game/Online/Rooms/IndexedMultiplayerScores.cs index 2008d1aa52..459602f1b4 100644 --- a/osu.Game/Online/Rooms/IndexedMultiplayerScores.cs +++ b/osu.Game/Online/Rooms/IndexedMultiplayerScores.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using Newtonsoft.Json; diff --git a/osu.Game/Online/Rooms/ItemAttemptsCount.cs b/osu.Game/Online/Rooms/ItemAttemptsCount.cs index 298603d778..71f50b9898 100644 --- a/osu.Game/Online/Rooms/ItemAttemptsCount.cs +++ b/osu.Game/Online/Rooms/ItemAttemptsCount.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Online.Rooms diff --git a/osu.Game/Online/Rooms/JoinRoomRequest.cs b/osu.Game/Online/Rooms/JoinRoomRequest.cs index 2a3480c992..0a687312e7 100644 --- a/osu.Game/Online/Rooms/JoinRoomRequest.cs +++ b/osu.Game/Online/Rooms/JoinRoomRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Net.Http; using osu.Framework.IO.Network; using osu.Game.Online.API; diff --git a/osu.Game/Online/Rooms/MatchType.cs b/osu.Game/Online/Rooms/MatchType.cs index 278f0693eb..fd2f583f83 100644 --- a/osu.Game/Online/Rooms/MatchType.cs +++ b/osu.Game/Online/Rooms/MatchType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Online/Rooms/MultiplayerPlaylistItem.cs b/osu.Game/Online/Rooms/MultiplayerPlaylistItem.cs index 388a02f798..c45f703b05 100644 --- a/osu.Game/Online/Rooms/MultiplayerPlaylistItem.cs +++ b/osu.Game/Online/Rooms/MultiplayerPlaylistItem.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Online/Rooms/MultiplayerScore.cs b/osu.Game/Online/Rooms/MultiplayerScore.cs index 85327be037..13f14bca5b 100644 --- a/osu.Game/Online/Rooms/MultiplayerScore.cs +++ b/osu.Game/Online/Rooms/MultiplayerScore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Online/Rooms/MultiplayerScores.cs b/osu.Game/Online/Rooms/MultiplayerScores.cs index 3f970b2f8e..4c13579b3e 100644 --- a/osu.Game/Online/Rooms/MultiplayerScores.cs +++ b/osu.Game/Online/Rooms/MultiplayerScores.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Online.API.Requests; diff --git a/osu.Game/Online/Rooms/MultiplayerScoresAround.cs b/osu.Game/Online/Rooms/MultiplayerScoresAround.cs index a99439312a..eca242bb0c 100644 --- a/osu.Game/Online/Rooms/MultiplayerScoresAround.cs +++ b/osu.Game/Online/Rooms/MultiplayerScoresAround.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using Newtonsoft.Json; diff --git a/osu.Game/Online/Rooms/OnlinePlayBeatmapAvailabilityTracker.cs b/osu.Game/Online/Rooms/OnlinePlayBeatmapAvailabilityTracker.cs index 4ca6d79b19..032215f5d3 100644 --- a/osu.Game/Online/Rooms/OnlinePlayBeatmapAvailabilityTracker.cs +++ b/osu.Game/Online/Rooms/OnlinePlayBeatmapAvailabilityTracker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Online/Rooms/PartRoomRequest.cs b/osu.Game/Online/Rooms/PartRoomRequest.cs index 2f036abc8c..da4e9a44c5 100644 --- a/osu.Game/Online/Rooms/PartRoomRequest.cs +++ b/osu.Game/Online/Rooms/PartRoomRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Net.Http; using osu.Framework.IO.Network; using osu.Game.Online.API; diff --git a/osu.Game/Online/Rooms/PlaylistAggregateScore.cs b/osu.Game/Online/Rooms/PlaylistAggregateScore.cs index 61e0951cd5..85e7b29a05 100644 --- a/osu.Game/Online/Rooms/PlaylistAggregateScore.cs +++ b/osu.Game/Online/Rooms/PlaylistAggregateScore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Online.Rooms diff --git a/osu.Game/Online/Rooms/PlaylistExtensions.cs b/osu.Game/Online/Rooms/PlaylistExtensions.cs index 34c93bd9e0..cd52a3c6e6 100644 --- a/osu.Game/Online/Rooms/PlaylistExtensions.cs +++ b/osu.Game/Online/Rooms/PlaylistExtensions.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Collections.Generic; using System.Linq; using Humanizer; diff --git a/osu.Game/Online/Rooms/PlaylistItem.cs b/osu.Game/Online/Rooms/PlaylistItem.cs index 12091bae88..a0711d9ded 100644 --- a/osu.Game/Online/Rooms/PlaylistItem.cs +++ b/osu.Game/Online/Rooms/PlaylistItem.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Online/Rooms/Room.cs b/osu.Game/Online/Rooms/Room.cs index 1933267efd..3a24fa02a8 100644 --- a/osu.Game/Online/Rooms/Room.cs +++ b/osu.Game/Online/Rooms/Room.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using Newtonsoft.Json; diff --git a/osu.Game/Online/Rooms/RoomAvailability.cs b/osu.Game/Online/Rooms/RoomAvailability.cs index 3aea0e5948..fada111826 100644 --- a/osu.Game/Online/Rooms/RoomAvailability.cs +++ b/osu.Game/Online/Rooms/RoomAvailability.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Online.Rooms diff --git a/osu.Game/Online/Rooms/RoomCategory.cs b/osu.Game/Online/Rooms/RoomCategory.cs index bca4d78359..ba17fb2121 100644 --- a/osu.Game/Online/Rooms/RoomCategory.cs +++ b/osu.Game/Online/Rooms/RoomCategory.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Online.Rooms diff --git a/osu.Game/Online/Rooms/RoomStatus.cs b/osu.Game/Online/Rooms/RoomStatus.cs index 87c5aa3fda..4b890b00b7 100644 --- a/osu.Game/Online/Rooms/RoomStatus.cs +++ b/osu.Game/Online/Rooms/RoomStatus.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Graphics; using osuTK.Graphics; diff --git a/osu.Game/Online/Rooms/RoomStatuses/RoomStatusEnded.cs b/osu.Game/Online/Rooms/RoomStatuses/RoomStatusEnded.cs index 01f3ae368b..9aa6424592 100644 --- a/osu.Game/Online/Rooms/RoomStatuses/RoomStatusEnded.cs +++ b/osu.Game/Online/Rooms/RoomStatuses/RoomStatusEnded.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Graphics; using osuTK.Graphics; diff --git a/osu.Game/Online/Rooms/RoomStatuses/RoomStatusOpen.cs b/osu.Game/Online/Rooms/RoomStatuses/RoomStatusOpen.cs index 686d4f4033..c37b93ea1b 100644 --- a/osu.Game/Online/Rooms/RoomStatuses/RoomStatusOpen.cs +++ b/osu.Game/Online/Rooms/RoomStatuses/RoomStatusOpen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Graphics; using osuTK.Graphics; diff --git a/osu.Game/Online/Rooms/RoomStatuses/RoomStatusPlaying.cs b/osu.Game/Online/Rooms/RoomStatuses/RoomStatusPlaying.cs index 83f1acf52a..9eb61a82ec 100644 --- a/osu.Game/Online/Rooms/RoomStatuses/RoomStatusPlaying.cs +++ b/osu.Game/Online/Rooms/RoomStatuses/RoomStatusPlaying.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Graphics; using osuTK.Graphics; diff --git a/osu.Game/Online/Rooms/ShowPlaylistUserScoreRequest.cs b/osu.Game/Online/Rooms/ShowPlaylistUserScoreRequest.cs index ba3e3c6349..affb2846a2 100644 --- a/osu.Game/Online/Rooms/ShowPlaylistUserScoreRequest.cs +++ b/osu.Game/Online/Rooms/ShowPlaylistUserScoreRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Online.API; namespace osu.Game.Online.Rooms diff --git a/osu.Game/Online/Rooms/SubmitRoomScoreRequest.cs b/osu.Game/Online/Rooms/SubmitRoomScoreRequest.cs index 39193be1af..f4cadc3fde 100644 --- a/osu.Game/Online/Rooms/SubmitRoomScoreRequest.cs +++ b/osu.Game/Online/Rooms/SubmitRoomScoreRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Scoring; namespace osu.Game.Online.Rooms diff --git a/osu.Game/Online/Rooms/SubmitScoreRequest.cs b/osu.Game/Online/Rooms/SubmitScoreRequest.cs index b263262d2b..d681938da5 100644 --- a/osu.Game/Online/Rooms/SubmitScoreRequest.cs +++ b/osu.Game/Online/Rooms/SubmitScoreRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Net.Http; using Newtonsoft.Json; using osu.Framework.IO.Network; diff --git a/osu.Game/Online/ScoreDownloadTracker.cs b/osu.Game/Online/ScoreDownloadTracker.cs index ed1c566dbe..cab6bd0722 100644 --- a/osu.Game/Online/ScoreDownloadTracker.cs +++ b/osu.Game/Online/ScoreDownloadTracker.cs @@ -9,8 +9,6 @@ using osu.Game.Extensions; using osu.Game.Online.API; using osu.Game.Scoring; -#nullable enable - namespace osu.Game.Online { public class ScoreDownloadTracker : DownloadTracker diff --git a/osu.Game/Online/SignalRDerivedTypeWorkaroundJsonConverter.cs b/osu.Game/Online/SignalRDerivedTypeWorkaroundJsonConverter.cs index ab04e046d3..a999cb47f8 100644 --- a/osu.Game/Online/SignalRDerivedTypeWorkaroundJsonConverter.cs +++ b/osu.Game/Online/SignalRDerivedTypeWorkaroundJsonConverter.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable using System; using System.Linq; using Newtonsoft.Json; diff --git a/osu.Game/Online/SignalRUnionWorkaroundResolver.cs b/osu.Game/Online/SignalRUnionWorkaroundResolver.cs index c96f93df78..e58cd83477 100644 --- a/osu.Game/Online/SignalRUnionWorkaroundResolver.cs +++ b/osu.Game/Online/SignalRUnionWorkaroundResolver.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Online/SignalRWorkaroundTypes.cs b/osu.Game/Online/SignalRWorkaroundTypes.cs index d1f0ba725f..29e01e13ae 100644 --- a/osu.Game/Online/SignalRWorkaroundTypes.cs +++ b/osu.Game/Online/SignalRWorkaroundTypes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Game.Online.Multiplayer; diff --git a/osu.Game/Online/Solo/CreateSoloScoreRequest.cs b/osu.Game/Online/Solo/CreateSoloScoreRequest.cs index 0d2bea1f2a..e4612b6659 100644 --- a/osu.Game/Online/Solo/CreateSoloScoreRequest.cs +++ b/osu.Game/Online/Solo/CreateSoloScoreRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Globalization; using System.Net.Http; using osu.Framework.IO.Network; diff --git a/osu.Game/Online/Solo/SubmitSoloScoreRequest.cs b/osu.Game/Online/Solo/SubmitSoloScoreRequest.cs index 77fd7b813b..f387e61901 100644 --- a/osu.Game/Online/Solo/SubmitSoloScoreRequest.cs +++ b/osu.Game/Online/Solo/SubmitSoloScoreRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Online.Rooms; using osu.Game.Scoring; diff --git a/osu.Game/Online/Solo/SubmittableScore.cs b/osu.Game/Online/Solo/SubmittableScore.cs index 9b6da1844a..31f0cb1dfb 100644 --- a/osu.Game/Online/Solo/SubmittableScore.cs +++ b/osu.Game/Online/Solo/SubmittableScore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using JetBrains.Annotations; diff --git a/osu.Game/Online/Spectator/FrameDataBundle.cs b/osu.Game/Online/Spectator/FrameDataBundle.cs index a4c4972989..97ae468875 100644 --- a/osu.Game/Online/Spectator/FrameDataBundle.cs +++ b/osu.Game/Online/Spectator/FrameDataBundle.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using MessagePack; diff --git a/osu.Game/Online/Spectator/FrameHeader.cs b/osu.Game/Online/Spectator/FrameHeader.cs index adfcbcd95a..b6dcd8aaa5 100644 --- a/osu.Game/Online/Spectator/FrameHeader.cs +++ b/osu.Game/Online/Spectator/FrameHeader.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using MessagePack; diff --git a/osu.Game/Online/Spectator/ISpectatorClient.cs b/osu.Game/Online/Spectator/ISpectatorClient.cs index 3acc9b2282..ccba280001 100644 --- a/osu.Game/Online/Spectator/ISpectatorClient.cs +++ b/osu.Game/Online/Spectator/ISpectatorClient.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading.Tasks; namespace osu.Game.Online.Spectator diff --git a/osu.Game/Online/Spectator/ISpectatorServer.cs b/osu.Game/Online/Spectator/ISpectatorServer.cs index af0196862a..25785f60a4 100644 --- a/osu.Game/Online/Spectator/ISpectatorServer.cs +++ b/osu.Game/Online/Spectator/ISpectatorServer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading.Tasks; namespace osu.Game.Online.Spectator diff --git a/osu.Game/Online/Spectator/OnlineSpectatorClient.cs b/osu.Game/Online/Spectator/OnlineSpectatorClient.cs index 0f77f723db..cd9f5233a2 100644 --- a/osu.Game/Online/Spectator/OnlineSpectatorClient.cs +++ b/osu.Game/Online/Spectator/OnlineSpectatorClient.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Diagnostics; using System.Threading.Tasks; using Microsoft.AspNetCore.SignalR; diff --git a/osu.Game/Online/Spectator/SpectatedUserState.cs b/osu.Game/Online/Spectator/SpectatedUserState.cs index 0f0a3068b8..edf0859a33 100644 --- a/osu.Game/Online/Spectator/SpectatedUserState.cs +++ b/osu.Game/Online/Spectator/SpectatedUserState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Online.Spectator { public enum SpectatedUserState diff --git a/osu.Game/Online/Spectator/SpectatorClient.cs b/osu.Game/Online/Spectator/SpectatorClient.cs index 9bf49364f3..4a43aa6c66 100644 --- a/osu.Game/Online/Spectator/SpectatorClient.cs +++ b/osu.Game/Online/Spectator/SpectatorClient.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs b/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs index a1e8715c8f..87f25874c5 100644 --- a/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs +++ b/osu.Game/Online/Spectator/SpectatorScoreProcessor.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Online/Spectator/SpectatorState.cs b/osu.Game/Online/Spectator/SpectatorState.cs index 64e5f8b3a1..766b274e63 100644 --- a/osu.Game/Online/Spectator/SpectatorState.cs +++ b/osu.Game/Online/Spectator/SpectatorState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 200f7613a1..3041761a6b 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 4a249e8b44..9908697bf1 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/OsuGameBase_Importing.cs b/osu.Game/OsuGameBase_Importing.cs index d712da3553..e34e48f21d 100644 --- a/osu.Game/OsuGameBase_Importing.cs +++ b/osu.Game/OsuGameBase_Importing.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/osu.Game/Overlays/AccountCreation/AccountCreationBackground.cs b/osu.Game/Overlays/AccountCreation/AccountCreationBackground.cs index 2e52ca74f3..2b372c18eb 100644 --- a/osu.Game/Overlays/AccountCreation/AccountCreationBackground.cs +++ b/osu.Game/Overlays/AccountCreation/AccountCreationBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/AccountCreation/AccountCreationScreen.cs b/osu.Game/Overlays/AccountCreation/AccountCreationScreen.cs index 6aef358b2e..299a41f45b 100644 --- a/osu.Game/Overlays/AccountCreation/AccountCreationScreen.cs +++ b/osu.Game/Overlays/AccountCreation/AccountCreationScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Screens; diff --git a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs index f4f958e4a4..2120f351a2 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using System.Threading.Tasks; diff --git a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs index 780a79f8f9..f8070788c2 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/AccountCreation/ScreenWelcome.cs b/osu.Game/Overlays/AccountCreation/ScreenWelcome.cs index f6ddb135ec..1936ad533a 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenWelcome.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenWelcome.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/AccountCreationOverlay.cs b/osu.Game/Overlays/AccountCreationOverlay.cs index a96aff2a5d..c51ed07c38 100644 --- a/osu.Game/Overlays/AccountCreationOverlay.cs +++ b/osu.Game/Overlays/AccountCreationOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapListingCardSizeTabControl.cs b/osu.Game/Overlays/BeatmapListing/BeatmapListingCardSizeTabControl.cs index 1f9a63e3b9..13da9d335c 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapListingCardSizeTabControl.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapListingCardSizeTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapListingFilterControl.cs b/osu.Game/Overlays/BeatmapListing/BeatmapListingFilterControl.cs index e4628e3723..4457705676 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapListingFilterControl.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapListingFilterControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapListingHeader.cs b/osu.Game/Overlays/BeatmapListing/BeatmapListingHeader.cs index 3568fe9e4f..ccab810612 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapListingHeader.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapListingHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapListingSearchControl.cs b/osu.Game/Overlays/BeatmapListing/BeatmapListingSearchControl.cs index eeaa31a013..86cf3b5588 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapListingSearchControl.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapListingSearchControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapListingSortTabControl.cs b/osu.Game/Overlays/BeatmapListing/BeatmapListingSortTabControl.cs index 4c77a736ac..454f381c60 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapListingSortTabControl.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapListingSortTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilterRow.cs b/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilterRow.cs index 4c831543fe..8ae39aeaca 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilterRow.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilterRow.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapSearchGeneralFilterRow.cs b/osu.Game/Overlays/BeatmapListing/BeatmapSearchGeneralFilterRow.cs index 51dad100c2..c01aa9a1c4 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapSearchGeneralFilterRow.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapSearchGeneralFilterRow.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs b/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs index 461a06a634..cca75e9548 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapSearchRulesetFilterRow.cs b/osu.Game/Overlays/BeatmapListing/BeatmapSearchRulesetFilterRow.cs index e2c84c537c..526c14511e 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapSearchRulesetFilterRow.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapSearchRulesetFilterRow.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapSearchScoreFilterRow.cs b/osu.Game/Overlays/BeatmapListing/BeatmapSearchScoreFilterRow.cs index b39934b56f..118ddfb060 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapSearchScoreFilterRow.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapSearchScoreFilterRow.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Extensions; diff --git a/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs b/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs index ff43170207..cc131ffc27 100644 --- a/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs +++ b/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Extensions; diff --git a/osu.Game/Overlays/BeatmapListing/SearchCategory.cs b/osu.Game/Overlays/BeatmapListing/SearchCategory.cs index b52df6234f..b3e12d00a6 100644 --- a/osu.Game/Overlays/BeatmapListing/SearchCategory.cs +++ b/osu.Game/Overlays/BeatmapListing/SearchCategory.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/BeatmapListing/SearchExplicit.cs b/osu.Game/Overlays/BeatmapListing/SearchExplicit.cs index 80482b32a0..10fea6d5b2 100644 --- a/osu.Game/Overlays/BeatmapListing/SearchExplicit.cs +++ b/osu.Game/Overlays/BeatmapListing/SearchExplicit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/BeatmapListing/SearchExtra.cs b/osu.Game/Overlays/BeatmapListing/SearchExtra.cs index e54632acd8..d307cd09eb 100644 --- a/osu.Game/Overlays/BeatmapListing/SearchExtra.cs +++ b/osu.Game/Overlays/BeatmapListing/SearchExtra.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/BeatmapListing/SearchGeneral.cs b/osu.Game/Overlays/BeatmapListing/SearchGeneral.cs index 34ff5b9840..ebcbef1ad9 100644 --- a/osu.Game/Overlays/BeatmapListing/SearchGeneral.cs +++ b/osu.Game/Overlays/BeatmapListing/SearchGeneral.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/BeatmapListing/SearchGenre.cs b/osu.Game/Overlays/BeatmapListing/SearchGenre.cs index 08855284cb..7746eb50d7 100644 --- a/osu.Game/Overlays/BeatmapListing/SearchGenre.cs +++ b/osu.Game/Overlays/BeatmapListing/SearchGenre.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/BeatmapListing/SearchLanguage.cs b/osu.Game/Overlays/BeatmapListing/SearchLanguage.cs index 7ffa0282b7..d52f923158 100644 --- a/osu.Game/Overlays/BeatmapListing/SearchLanguage.cs +++ b/osu.Game/Overlays/BeatmapListing/SearchLanguage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Framework.Utils; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/BeatmapListing/SearchPlayed.cs b/osu.Game/Overlays/BeatmapListing/SearchPlayed.cs index 3b04ac01ca..0c379b3825 100644 --- a/osu.Game/Overlays/BeatmapListing/SearchPlayed.cs +++ b/osu.Game/Overlays/BeatmapListing/SearchPlayed.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/BeatmapListing/SortCriteria.cs b/osu.Game/Overlays/BeatmapListing/SortCriteria.cs index 871b3c162b..ff6e62b274 100644 --- a/osu.Game/Overlays/BeatmapListing/SortCriteria.cs +++ b/osu.Game/Overlays/BeatmapListing/SortCriteria.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/BeatmapListingOverlay.cs b/osu.Game/Overlays/BeatmapListingOverlay.cs index 3476968ded..cfa53009ef 100644 --- a/osu.Game/Overlays/BeatmapListingOverlay.cs +++ b/osu.Game/Overlays/BeatmapListingOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using System.Threading; diff --git a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs index 9131f6f74c..2341997626 100644 --- a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs +++ b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/BeatmapSet/BasicStats.cs b/osu.Game/Overlays/BeatmapSet/BasicStats.cs index 8f848edf24..a8bbb9fe1c 100644 --- a/osu.Game/Overlays/BeatmapSet/BasicStats.cs +++ b/osu.Game/Overlays/BeatmapSet/BasicStats.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs b/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs index b6e768d632..d893ef80d8 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs b/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs index a75fc8e888..52fed99431 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs @@ -10,8 +10,6 @@ using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -#nullable enable - namespace osu.Game.Overlays.BeatmapSet { public abstract class BeatmapBadge : CompositeDrawable diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs index 031442814d..8d89bb3cc7 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework; diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs index 6564ca3d41..0f5eb18c4e 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics.UserInterface; using osu.Game.Rulesets; diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapRulesetTabItem.cs b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetTabItem.cs index e8cdc6913b..e9acca5bcd 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapRulesetTabItem.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetTabItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeader.cs b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeader.cs index 102cddfa92..02da7812d1 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeader.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs index e0fc7482f6..c9e97d5f2f 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapSetLayoutSection.cs b/osu.Game/Overlays/BeatmapSet/BeatmapSetLayoutSection.cs index e6d433f7bc..797b6716e7 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapSetLayoutSection.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapSetLayoutSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs index 28100e5fff..f7c8aa44ad 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/HeaderButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/HeaderButton.cs index 99b0b2ed3b..25d11bd6d7 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/HeaderButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/HeaderButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/HeaderDownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/HeaderDownloadButton.cs index 74417b0ac6..c2de96f245 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/HeaderDownloadButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/HeaderDownloadButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/PlayButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/PlayButton.cs index 63b7a0a062..e840d0e82c 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/PlayButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/PlayButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs index 751299161d..8fc8927c4b 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/BeatmapSet/Details.cs b/osu.Game/Overlays/BeatmapSet/Details.cs index dfc8d5e680..6db54db811 100644 --- a/osu.Game/Overlays/BeatmapSet/Details.cs +++ b/osu.Game/Overlays/BeatmapSet/Details.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapBadge.cs b/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapBadge.cs index 2a20d22b61..18dcfc0385 100644 --- a/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapBadge.cs +++ b/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapBadge.cs @@ -5,8 +5,6 @@ using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Resources.Localisation.Web; -#nullable enable - namespace osu.Game.Overlays.BeatmapSet { public class ExplicitContentBeatmapBadge : BeatmapBadge diff --git a/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs b/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs index 20ee11c7f6..a0ee0a18ec 100644 --- a/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs +++ b/osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs @@ -5,8 +5,6 @@ using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Resources.Localisation.Web; -#nullable enable - namespace osu.Game.Overlays.BeatmapSet { public class FeaturedArtistBeatmapBadge : BeatmapBadge diff --git a/osu.Game/Overlays/BeatmapSet/Info.cs b/osu.Game/Overlays/BeatmapSet/Info.cs index 3ef52d718d..666ceff6cb 100644 --- a/osu.Game/Overlays/BeatmapSet/Info.cs +++ b/osu.Game/Overlays/BeatmapSet/Info.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs b/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs index 25aed4c980..8311368da3 100644 --- a/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs +++ b/osu.Game/Overlays/BeatmapSet/LeaderboardModSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Game.Rulesets.Mods; diff --git a/osu.Game/Overlays/BeatmapSet/LeaderboardScopeSelector.cs b/osu.Game/Overlays/BeatmapSet/LeaderboardScopeSelector.cs index 607355b7bf..db7d04f597 100644 --- a/osu.Game/Overlays/BeatmapSet/LeaderboardScopeSelector.cs +++ b/osu.Game/Overlays/BeatmapSet/LeaderboardScopeSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Screens.Select.Leaderboards; using osu.Game.Graphics.UserInterface; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/BeatmapSet/MetadataSection.cs b/osu.Game/Overlays/BeatmapSet/MetadataSection.cs index f1b9f98528..c6bf94f507 100644 --- a/osu.Game/Overlays/BeatmapSet/MetadataSection.cs +++ b/osu.Game/Overlays/BeatmapSet/MetadataSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/BeatmapSet/MetadataType.cs b/osu.Game/Overlays/BeatmapSet/MetadataType.cs index f992dca0ef..924e020641 100644 --- a/osu.Game/Overlays/BeatmapSet/MetadataType.cs +++ b/osu.Game/Overlays/BeatmapSet/MetadataType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 0ae8a8bef5..06bf9e1d50 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/NoScoresPlaceholder.cs b/osu.Game/Overlays/BeatmapSet/Scores/NoScoresPlaceholder.cs index 82ca3e030f..47690bab1f 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/NoScoresPlaceholder.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/NoScoresPlaceholder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Screens.Select.Leaderboards; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/NotSupporterPlaceholder.cs b/osu.Game/Overlays/BeatmapSet/Scores/NotSupporterPlaceholder.cs index d1a0960a08..b83b4d6b26 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/NotSupporterPlaceholder.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/NotSupporterPlaceholder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 4b3407ba4c..b2e5be6601 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System.Collections.Generic; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs index b6079b36ab..c17bb70bc2 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreboardTime.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreboardTime.cs index 5018fb8c70..72aa221432 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreboardTime.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreboardTime.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Extensions; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index ebfb8f124b..2ea94bb412 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using System.Linq; using System.Threading; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs index f528f54cdf..3b5ab811ae 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreStatisticsSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs index 1c0fcf0e3c..f093c6b53f 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs b/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs index 9c5378a967..44b3acea5f 100644 --- a/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs +++ b/osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs @@ -5,8 +5,6 @@ using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Resources.Localisation.Web; -#nullable enable - namespace osu.Game.Overlays.BeatmapSet { public class SpotlightBeatmapBadge : BeatmapBadge diff --git a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs index fed3d7ddaa..cbcef9fcec 100644 --- a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs +++ b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index bd63c997df..823d0023cf 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/BreadcrumbControlOverlayHeader.cs b/osu.Game/Overlays/BreadcrumbControlOverlayHeader.cs index 0d383c374f..5b83f0e62e 100644 --- a/osu.Game/Overlays/BreadcrumbControlOverlayHeader.cs +++ b/osu.Game/Overlays/BreadcrumbControlOverlayHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Changelog/ChangelogBuild.cs b/osu.Game/Overlays/Changelog/ChangelogBuild.cs index c65eefdee4..575f1a398a 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBuild.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 49dd9bb835..1e49efb10e 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Overlays/Changelog/ChangelogEntry.cs b/osu.Game/Overlays/Changelog/ChangelogEntry.cs index da062ca617..fdeba3f304 100644 --- a/osu.Game/Overlays/Changelog/ChangelogEntry.cs +++ b/osu.Game/Overlays/Changelog/ChangelogEntry.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Net; using System.Text.RegularExpressions; diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 49a33ee5d6..6ce6b82c8f 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/Changelog/ChangelogListing.cs b/osu.Game/Overlays/Changelog/ChangelogListing.cs index 9b74a8da6d..e848f26587 100644 --- a/osu.Game/Overlays/Changelog/ChangelogListing.cs +++ b/osu.Game/Overlays/Changelog/ChangelogListing.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs index 93486274fc..e4f240f0e7 100644 --- a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using System.Threading; diff --git a/osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs b/osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs index e84eee15be..d84ed3c807 100644 --- a/osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs +++ b/osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/Changelog/ChangelogUpdateStreamControl.cs b/osu.Game/Overlays/Changelog/ChangelogUpdateStreamControl.cs index aa36a5c8fd..1db2d2f172 100644 --- a/osu.Game/Overlays/Changelog/ChangelogUpdateStreamControl.cs +++ b/osu.Game/Overlays/Changelog/ChangelogUpdateStreamControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Changelog diff --git a/osu.Game/Overlays/Changelog/ChangelogUpdateStreamItem.cs b/osu.Game/Overlays/Changelog/ChangelogUpdateStreamItem.cs index cb144defbf..974b283ccf 100644 --- a/osu.Game/Overlays/Changelog/ChangelogUpdateStreamItem.cs +++ b/osu.Game/Overlays/Changelog/ChangelogUpdateStreamItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Humanizer; using osu.Framework.Localisation; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index ab97ae950d..7e0d5e9432 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Threading; diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs index 47a2d234d1..b3814ca90c 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelList.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Linq; using System.Collections.Generic; diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs index 9ab0c2792a..c18e9e11fa 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListItemCloseButton.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListItemCloseButton.cs index 65b9c4a79b..46d70b2d67 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListItemCloseButton.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListItemCloseButton.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/Chat/ChannelList/ChannelListItemMentionPill.cs b/osu.Game/Overlays/Chat/ChannelList/ChannelListItemMentionPill.cs index 5018c8cd64..2ead841f58 100644 --- a/osu.Game/Overlays/Chat/ChannelList/ChannelListItemMentionPill.cs +++ b/osu.Game/Overlays/Chat/ChannelList/ChannelListItemMentionPill.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Chat/ChannelScrollContainer.cs b/osu.Game/Overlays/Chat/ChannelScrollContainer.cs index 139c091f03..dee7730e2c 100644 --- a/osu.Game/Overlays/Chat/ChannelScrollContainer.cs +++ b/osu.Game/Overlays/Chat/ChannelScrollContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index 56e39f212d..5961298485 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Linq; using System.Collections.Generic; diff --git a/osu.Game/Overlays/Chat/ChatOverlayTopBar.cs b/osu.Game/Overlays/Chat/ChatOverlayTopBar.cs index 79f22b51f7..ad9ae412da 100644 --- a/osu.Game/Overlays/Chat/ChatOverlayTopBar.cs +++ b/osu.Game/Overlays/Chat/ChatOverlayTopBar.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Chat/ChatTextBar.cs b/osu.Game/Overlays/Chat/ChatTextBar.cs index 5100959eeb..73314c2e44 100644 --- a/osu.Game/Overlays/Chat/ChatTextBar.cs +++ b/osu.Game/Overlays/Chat/ChatTextBar.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Chat/ChatTextBox.cs b/osu.Game/Overlays/Chat/ChatTextBox.cs index 1ee0e8445f..ae8816b009 100644 --- a/osu.Game/Overlays/Chat/ChatTextBox.cs +++ b/osu.Game/Overlays/Chat/ChatTextBox.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Bindables; using osu.Game.Graphics.UserInterface; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/Chat/DaySeparator.cs b/osu.Game/Overlays/Chat/DaySeparator.cs index 9ae35b0c38..c7961d1a39 100644 --- a/osu.Game/Overlays/Chat/DaySeparator.cs +++ b/osu.Game/Overlays/Chat/DaySeparator.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index c3a341bca4..c05f456a96 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Overlays/Chat/ExternalLinkDialog.cs b/osu.Game/Overlays/Chat/ExternalLinkDialog.cs index dbae091fb0..f0d39346e0 100644 --- a/osu.Game/Overlays/Chat/ExternalLinkDialog.cs +++ b/osu.Game/Overlays/Chat/ExternalLinkDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; using osu.Game.Overlays.Dialog; diff --git a/osu.Game/Overlays/Chat/Listing/ChannelListing.cs b/osu.Game/Overlays/Chat/Listing/ChannelListing.cs index 8a5bc18cbf..44255eb754 100644 --- a/osu.Game/Overlays/Chat/Listing/ChannelListing.cs +++ b/osu.Game/Overlays/Chat/Listing/ChannelListing.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs b/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs index 2a21d30a4a..ffeab3b380 100644 --- a/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs +++ b/osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index f04bf76c18..81a408598b 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; diff --git a/osu.Game/Overlays/Comments/Buttons/ChevronButton.cs b/osu.Game/Overlays/Comments/Buttons/ChevronButton.cs index 48f34e8f59..46a455cbb3 100644 --- a/osu.Game/Overlays/Comments/Buttons/ChevronButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/ChevronButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Graphics.Containers; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs index 2f7f16dd6f..d24a0cd27b 100644 --- a/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/CommentRepliesButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs index 4bb5b9d66d..42aca2f4a3 100644 --- a/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/LoadRepliesButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/Comments/Buttons/ShowMoreRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/ShowMoreRepliesButton.cs index 4908e29b7d..6f3841d52e 100644 --- a/osu.Game/Overlays/Comments/Buttons/ShowMoreRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/ShowMoreRepliesButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs index 04e7e25cc5..845a630d97 100644 --- a/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs +++ b/osu.Game/Overlays/Comments/Buttons/ShowRepliesButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Humanizer; using osu.Framework.Bindables; using osu.Framework.Input.Events; diff --git a/osu.Game/Overlays/Comments/CancellableCommentEditor.cs b/osu.Game/Overlays/Comments/CancellableCommentEditor.cs index 74c221bd82..853171ea4a 100644 --- a/osu.Game/Overlays/Comments/CancellableCommentEditor.cs +++ b/osu.Game/Overlays/Comments/CancellableCommentEditor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Comments/CommentEditor.cs b/osu.Game/Overlays/Comments/CommentEditor.cs index 3ff4cfad4a..2e8080ba43 100644 --- a/osu.Game/Overlays/Comments/CommentEditor.cs +++ b/osu.Game/Overlays/Comments/CommentEditor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Comments/CommentMarkdownContainer.cs b/osu.Game/Overlays/Comments/CommentMarkdownContainer.cs index 3971a61363..e94a1b0147 100644 --- a/osu.Game/Overlays/Comments/CommentMarkdownContainer.cs +++ b/osu.Game/Overlays/Comments/CommentMarkdownContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Markdig.Syntax; using Markdig.Syntax.Inlines; using osu.Framework.Graphics.Containers.Markdown; diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs index a28b13fc12..4ab6f4f88d 100644 --- a/osu.Game/Overlays/Comments/CommentsContainer.cs +++ b/osu.Game/Overlays/Comments/CommentsContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Game.Online.API; diff --git a/osu.Game/Overlays/Comments/CommentsHeader.cs b/osu.Game/Overlays/Comments/CommentsHeader.cs index e7d9e72dcc..5684841c37 100644 --- a/osu.Game/Overlays/Comments/CommentsHeader.cs +++ b/osu.Game/Overlays/Comments/CommentsHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; diff --git a/osu.Game/Overlays/Comments/CommentsShowMoreButton.cs b/osu.Game/Overlays/Comments/CommentsShowMoreButton.cs index b1ca39c3bf..84d1f67486 100644 --- a/osu.Game/Overlays/Comments/CommentsShowMoreButton.cs +++ b/osu.Game/Overlays/Comments/CommentsShowMoreButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Comments/DeletedCommentsCounter.cs b/osu.Game/Overlays/Comments/DeletedCommentsCounter.cs index 8c40d79f7a..2c7ed4f5b3 100644 --- a/osu.Game/Overlays/Comments/DeletedCommentsCounter.cs +++ b/osu.Game/Overlays/Comments/DeletedCommentsCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs index 3ec91c8e63..296320ec1b 100644 --- a/osu.Game/Overlays/Comments/DrawableComment.cs +++ b/osu.Game/Overlays/Comments/DrawableComment.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Comments/HeaderButton.cs b/osu.Game/Overlays/Comments/HeaderButton.cs index 65172aa57c..186b892c4d 100644 --- a/osu.Game/Overlays/Comments/HeaderButton.cs +++ b/osu.Game/Overlays/Comments/HeaderButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Comments/TotalCommentsCounter.cs b/osu.Game/Overlays/Comments/TotalCommentsCounter.cs index 221a745189..218d8383f6 100644 --- a/osu.Game/Overlays/Comments/TotalCommentsCounter.cs +++ b/osu.Game/Overlays/Comments/TotalCommentsCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Overlays/Comments/VotePill.cs b/osu.Game/Overlays/Comments/VotePill.cs index 093cdce66e..7a4b83cc48 100644 --- a/osu.Game/Overlays/Comments/VotePill.cs +++ b/osu.Game/Overlays/Comments/VotePill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index 23f67a06cb..aae4932c22 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; diff --git a/osu.Game/Overlays/Dashboard/DashboardOverlayHeader.cs b/osu.Game/Overlays/Dashboard/DashboardOverlayHeader.cs index 2c8db14950..370181a0cb 100644 --- a/osu.Game/Overlays/Dashboard/DashboardOverlayHeader.cs +++ b/osu.Game/Overlays/Dashboard/DashboardOverlayHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Localisation; using osu.Game.Localisation; diff --git a/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs b/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs index 765f037d70..bfeaf50b53 100644 --- a/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs +++ b/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using System.Threading; diff --git a/osu.Game/Overlays/Dashboard/Friends/FriendOnlineStreamControl.cs b/osu.Game/Overlays/Dashboard/Friends/FriendOnlineStreamControl.cs index 7275cdff7c..fc6158e747 100644 --- a/osu.Game/Overlays/Dashboard/Friends/FriendOnlineStreamControl.cs +++ b/osu.Game/Overlays/Dashboard/Friends/FriendOnlineStreamControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Overlays/Dashboard/Friends/FriendStream.cs b/osu.Game/Overlays/Dashboard/Friends/FriendStream.cs index 4abece9a8d..3bb42ec953 100644 --- a/osu.Game/Overlays/Dashboard/Friends/FriendStream.cs +++ b/osu.Game/Overlays/Dashboard/Friends/FriendStream.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Overlays.Dashboard.Friends { public class FriendStream diff --git a/osu.Game/Overlays/Dashboard/Friends/FriendsOnlineStatusItem.cs b/osu.Game/Overlays/Dashboard/Friends/FriendsOnlineStatusItem.cs index 11dcb93e6f..7e2ec3f442 100644 --- a/osu.Game/Overlays/Dashboard/Friends/FriendsOnlineStatusItem.cs +++ b/osu.Game/Overlays/Dashboard/Friends/FriendsOnlineStatusItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Extensions; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Dashboard/Friends/OnlineStatus.cs b/osu.Game/Overlays/Dashboard/Friends/OnlineStatus.cs index 853c94d8ae..21bc5b8203 100644 --- a/osu.Game/Overlays/Dashboard/Friends/OnlineStatus.cs +++ b/osu.Game/Overlays/Dashboard/Friends/OnlineStatus.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/Dashboard/Friends/UserListToolbar.cs b/osu.Game/Overlays/Dashboard/Friends/UserListToolbar.cs index fb4b938183..25ddb9e704 100644 --- a/osu.Game/Overlays/Dashboard/Friends/UserListToolbar.cs +++ b/osu.Game/Overlays/Dashboard/Friends/UserListToolbar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osuTK; diff --git a/osu.Game/Overlays/Dashboard/Friends/UserSortTabControl.cs b/osu.Game/Overlays/Dashboard/Friends/UserSortTabControl.cs index 7fee5f4668..466e36c1a9 100644 --- a/osu.Game/Overlays/Dashboard/Friends/UserSortTabControl.cs +++ b/osu.Game/Overlays/Dashboard/Friends/UserSortTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/Dashboard/Home/DashboardBeatmapListing.cs b/osu.Game/Overlays/Dashboard/Home/DashboardBeatmapListing.cs index c781aa0cfb..e9c7af3339 100644 --- a/osu.Game/Overlays/Dashboard/Home/DashboardBeatmapListing.cs +++ b/osu.Game/Overlays/Dashboard/Home/DashboardBeatmapListing.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Dashboard/Home/DashboardBeatmapPanel.cs b/osu.Game/Overlays/Dashboard/Home/DashboardBeatmapPanel.cs index 9276e6ce80..1e4ba2ef05 100644 --- a/osu.Game/Overlays/Dashboard/Home/DashboardBeatmapPanel.cs +++ b/osu.Game/Overlays/Dashboard/Home/DashboardBeatmapPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Dashboard/Home/DashboardNewBeatmapPanel.cs b/osu.Game/Overlays/Dashboard/Home/DashboardNewBeatmapPanel.cs index 249b355be3..258fd56dd7 100644 --- a/osu.Game/Overlays/Dashboard/Home/DashboardNewBeatmapPanel.cs +++ b/osu.Game/Overlays/Dashboard/Home/DashboardNewBeatmapPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Dashboard/Home/DashboardPopularBeatmapPanel.cs b/osu.Game/Overlays/Dashboard/Home/DashboardPopularBeatmapPanel.cs index 4e50cce890..743bd5440f 100644 --- a/osu.Game/Overlays/Dashboard/Home/DashboardPopularBeatmapPanel.cs +++ b/osu.Game/Overlays/Dashboard/Home/DashboardPopularBeatmapPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/Dashboard/Home/DrawableBeatmapList.cs b/osu.Game/Overlays/Dashboard/Home/DrawableBeatmapList.cs index 382bc00b1d..8f140facef 100644 --- a/osu.Game/Overlays/Dashboard/Home/DrawableBeatmapList.cs +++ b/osu.Game/Overlays/Dashboard/Home/DrawableBeatmapList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Dashboard/Home/DrawableNewBeatmapList.cs b/osu.Game/Overlays/Dashboard/Home/DrawableNewBeatmapList.cs index 331fff0aea..c6917b41fb 100644 --- a/osu.Game/Overlays/Dashboard/Home/DrawableNewBeatmapList.cs +++ b/osu.Game/Overlays/Dashboard/Home/DrawableNewBeatmapList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Localisation; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Overlays/Dashboard/Home/DrawablePopularBeatmapList.cs b/osu.Game/Overlays/Dashboard/Home/DrawablePopularBeatmapList.cs index 154813dea1..9ff12623e0 100644 --- a/osu.Game/Overlays/Dashboard/Home/DrawablePopularBeatmapList.cs +++ b/osu.Game/Overlays/Dashboard/Home/DrawablePopularBeatmapList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Localisation; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Overlays/Dashboard/Home/HomePanel.cs b/osu.Game/Overlays/Dashboard/Home/HomePanel.cs index ce053cd4ec..099e16cd55 100644 --- a/osu.Game/Overlays/Dashboard/Home/HomePanel.cs +++ b/osu.Game/Overlays/Dashboard/Home/HomePanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Dashboard/Home/News/FeaturedNewsItemPanel.cs b/osu.Game/Overlays/Dashboard/Home/News/FeaturedNewsItemPanel.cs index 0d166eb858..8f5c942b6e 100644 --- a/osu.Game/Overlays/Dashboard/Home/News/FeaturedNewsItemPanel.cs +++ b/osu.Game/Overlays/Dashboard/Home/News/FeaturedNewsItemPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Dashboard/Home/News/NewsGroupItem.cs b/osu.Game/Overlays/Dashboard/Home/News/NewsGroupItem.cs index 77cfbc90b0..9b66e5524b 100644 --- a/osu.Game/Overlays/Dashboard/Home/News/NewsGroupItem.cs +++ b/osu.Game/Overlays/Dashboard/Home/News/NewsGroupItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Dashboard/Home/News/NewsItemGroupPanel.cs b/osu.Game/Overlays/Dashboard/Home/News/NewsItemGroupPanel.cs index c1d5a87ef5..4456a292a5 100644 --- a/osu.Game/Overlays/Dashboard/Home/News/NewsItemGroupPanel.cs +++ b/osu.Game/Overlays/Dashboard/Home/News/NewsItemGroupPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Dashboard/Home/News/NewsTitleLink.cs b/osu.Game/Overlays/Dashboard/Home/News/NewsTitleLink.cs index d6a3a69fe0..e384c3e6e5 100644 --- a/osu.Game/Overlays/Dashboard/Home/News/NewsTitleLink.cs +++ b/osu.Game/Overlays/Dashboard/Home/News/NewsTitleLink.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Dashboard/Home/News/ShowMoreNewsPanel.cs b/osu.Game/Overlays/Dashboard/Home/News/ShowMoreNewsPanel.cs index f6e966957e..9b1d77a8c2 100644 --- a/osu.Game/Overlays/Dashboard/Home/News/ShowMoreNewsPanel.cs +++ b/osu.Game/Overlays/Dashboard/Home/News/ShowMoreNewsPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/DashboardOverlay.cs b/osu.Game/Overlays/DashboardOverlay.cs index 79d972bdcc..d919022dbb 100644 --- a/osu.Game/Overlays/DashboardOverlay.cs +++ b/osu.Game/Overlays/DashboardOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Overlays.Dashboard; using osu.Game.Overlays.Dashboard.Friends; diff --git a/osu.Game/Overlays/Dialog/ConfirmDialog.cs b/osu.Game/Overlays/Dialog/ConfirmDialog.cs index 58ce84e13a..8be865ee16 100644 --- a/osu.Game/Overlays/Dialog/ConfirmDialog.cs +++ b/osu.Game/Overlays/Dialog/ConfirmDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index 5959fe656c..864120cc49 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/Dialog/PopupDialogButton.cs b/osu.Game/Overlays/Dialog/PopupDialogButton.cs index 9ee1018651..e1cc31da82 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.Color4Extensions; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs b/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs index 186099ce23..f23a40b7ab 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs index d145a1c7da..bd7cb4ed33 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; diff --git a/osu.Game/Overlays/Dialog/PopupDialogOkButton.cs b/osu.Game/Overlays/Dialog/PopupDialogOkButton.cs index 1ac8dd0db6..3496627c89 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogOkButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogOkButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 5a69562e82..a07cf1608d 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Overlays.Dialog; diff --git a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs index b043f05bd8..cef1f1c869 100644 --- a/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs +++ b/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/FirstRunSetup/ProgressRoundedButton.cs b/osu.Game/Overlays/FirstRunSetup/ProgressRoundedButton.cs index ee2db1f3d4..95ebb256c4 100644 --- a/osu.Game/Overlays/FirstRunSetup/ProgressRoundedButton.cs +++ b/osu.Game/Overlays/FirstRunSetup/ProgressRoundedButton.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs index ddcee7c040..82f49e0aef 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs b/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs index 1a88e6a842..9573b4859f 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs index 62b517d982..43d68653ad 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs index f09a26a527..58bfced3ed 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs index 420d630857..20ff8f21c8 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index a5bece0832..8c9ca7e35b 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Overlays/FullscreenOverlay.cs b/osu.Game/Overlays/FullscreenOverlay.cs index 58c41c4a4b..63a9ebc750 100644 --- a/osu.Game/Overlays/FullscreenOverlay.cs +++ b/osu.Game/Overlays/FullscreenOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/HoldToConfirmOverlay.cs b/osu.Game/Overlays/HoldToConfirmOverlay.cs index cb6275bd7c..dd03206eab 100644 --- a/osu.Game/Overlays/HoldToConfirmOverlay.cs +++ b/osu.Game/Overlays/HoldToConfirmOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/IDialogOverlay.cs b/osu.Game/Overlays/IDialogOverlay.cs index 1c6a84cd64..6ddb71d5e3 100644 --- a/osu.Game/Overlays/IDialogOverlay.cs +++ b/osu.Game/Overlays/IDialogOverlay.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Game.Overlays.Dialog; diff --git a/osu.Game/Overlays/INamedOverlayComponent.cs b/osu.Game/Overlays/INamedOverlayComponent.cs index ca0aea041e..e9d01a55e3 100644 --- a/osu.Game/Overlays/INamedOverlayComponent.cs +++ b/osu.Game/Overlays/INamedOverlayComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; namespace osu.Game.Overlays diff --git a/osu.Game/Overlays/INotificationOverlay.cs b/osu.Game/Overlays/INotificationOverlay.cs index 1d8e33ea3a..b9ac466229 100644 --- a/osu.Game/Overlays/INotificationOverlay.cs +++ b/osu.Game/Overlays/INotificationOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Overlays.Notifications; diff --git a/osu.Game/Overlays/IOverlayManager.cs b/osu.Game/Overlays/IOverlayManager.cs index 940ee2d8db..0318b2b3a0 100644 --- a/osu.Game/Overlays/IOverlayManager.cs +++ b/osu.Game/Overlays/IOverlayManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Login/LoginForm.cs b/osu.Game/Overlays/Login/LoginForm.cs index 502f0cd22e..08522b2921 100644 --- a/osu.Game/Overlays/Login/LoginForm.cs +++ b/osu.Game/Overlays/Login/LoginForm.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Overlays/Login/LoginPanel.cs b/osu.Game/Overlays/Login/LoginPanel.cs index 481abd48ab..1d8926b991 100644 --- a/osu.Game/Overlays/Login/LoginPanel.cs +++ b/osu.Game/Overlays/Login/LoginPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Login/UserAction.cs b/osu.Game/Overlays/Login/UserAction.cs index d216670a28..7a18e38109 100644 --- a/osu.Game/Overlays/Login/UserAction.cs +++ b/osu.Game/Overlays/Login/UserAction.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; @@ -21,4 +23,4 @@ namespace osu.Game.Overlays.Login [Description(@"Sign out")] SignOut, } -} \ No newline at end of file +} diff --git a/osu.Game/Overlays/Login/UserDropdown.cs b/osu.Game/Overlays/Login/UserDropdown.cs index 5c3a41aec9..73ccfb3443 100644 --- a/osu.Game/Overlays/Login/UserDropdown.cs +++ b/osu.Game/Overlays/Login/UserDropdown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index 9b2d7ca1ee..2362b2ad88 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index e15625a4b3..9b856014f9 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osuTK.Graphics; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index 3cf7befb45..53e8452dd1 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework; using osuTK; diff --git a/osu.Game/Overlays/Mods/DeselectAllModsButton.cs b/osu.Game/Overlays/Mods/DeselectAllModsButton.cs index 8288d34c95..61fca9e091 100644 --- a/osu.Game/Overlays/Mods/DeselectAllModsButton.cs +++ b/osu.Game/Overlays/Mods/DeselectAllModsButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs b/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs index 4ccec0dd87..c8d55c213a 100644 --- a/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs +++ b/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs b/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs index 34c4458a21..a6f412c00a 100644 --- a/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs +++ b/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Mods/IncompatibilityDisplayingTooltip.cs b/osu.Game/Overlays/Mods/IncompatibilityDisplayingTooltip.cs index d8117c8f00..3f44e82d50 100644 --- a/osu.Game/Overlays/Mods/IncompatibilityDisplayingTooltip.cs +++ b/osu.Game/Overlays/Mods/IncompatibilityDisplayingTooltip.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Mods/ModButtonTooltip.cs b/osu.Game/Overlays/Mods/ModButtonTooltip.cs index 2f50e38a5a..e19f24103f 100644 --- a/osu.Game/Overlays/Mods/ModButtonTooltip.cs +++ b/osu.Game/Overlays/Mods/ModButtonTooltip.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 42f9daec4d..563e9a8d55 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Overlays/Mods/ModPanel.cs b/osu.Game/Overlays/Mods/ModPanel.cs index 358bdd3202..4d14a31189 100644 --- a/osu.Game/Overlays/Mods/ModPanel.cs +++ b/osu.Game/Overlays/Mods/ModPanel.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 4bad34d94f..ad02f079a5 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Overlays/Mods/ModSettingsArea.cs b/osu.Game/Overlays/Mods/ModSettingsArea.cs index f44e4bf07f..0932c2c832 100644 --- a/osu.Game/Overlays/Mods/ModSettingsArea.cs +++ b/osu.Game/Overlays/Mods/ModSettingsArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/Mods/ModState.cs b/osu.Game/Overlays/Mods/ModState.cs index 8fdd5db00b..79880b85a5 100644 --- a/osu.Game/Overlays/Mods/ModState.cs +++ b/osu.Game/Overlays/Mods/ModState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Rulesets.Mods; diff --git a/osu.Game/Overlays/Mods/SelectAllModsButton.cs b/osu.Game/Overlays/Mods/SelectAllModsButton.cs index f7078b2fa5..fc24e99c7e 100644 --- a/osu.Game/Overlays/Mods/SelectAllModsButton.cs +++ b/osu.Game/Overlays/Mods/SelectAllModsButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs index 92e88bfaaf..2585e44e05 100644 --- a/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs +++ b/osu.Game/Overlays/Mods/ShearedOverlayContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Mods/UserModSelectOverlay.cs b/osu.Game/Overlays/Mods/UserModSelectOverlay.cs index 7100446730..b8f4b8a196 100644 --- a/osu.Game/Overlays/Mods/UserModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/UserModSelectOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Overlays/Music/CollectionDropdown.cs b/osu.Game/Overlays/Music/CollectionDropdown.cs index 658eebe67b..c1ba16788e 100644 --- a/osu.Game/Overlays/Music/CollectionDropdown.cs +++ b/osu.Game/Overlays/Music/CollectionDropdown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osuTK.Graphics; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Music/FilterControl.cs b/osu.Game/Overlays/Music/FilterControl.cs index 46c66b4bae..eb12a62864 100644 --- a/osu.Game/Overlays/Music/FilterControl.cs +++ b/osu.Game/Overlays/Music/FilterControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Music/FilterCriteria.cs b/osu.Game/Overlays/Music/FilterCriteria.cs index f15edff4d0..f435c4e6e4 100644 --- a/osu.Game/Overlays/Music/FilterCriteria.cs +++ b/osu.Game/Overlays/Music/FilterCriteria.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Game.Collections; diff --git a/osu.Game/Overlays/Music/MusicKeyBindingHandler.cs b/osu.Game/Overlays/Music/MusicKeyBindingHandler.cs index 6b33c9200e..8df465e075 100644 --- a/osu.Game/Overlays/Music/MusicKeyBindingHandler.cs +++ b/osu.Game/Overlays/Music/MusicKeyBindingHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Overlays/Music/Playlist.cs b/osu.Game/Overlays/Music/Playlist.cs index ff8f3197f9..954c4de493 100644 --- a/osu.Game/Overlays/Music/Playlist.cs +++ b/osu.Game/Overlays/Music/Playlist.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 82599d3ec9..b30ae095b1 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index ce816f84f0..3c25fc0421 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index aa09ff6b97..bce7e9b797 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/News/Displays/ArticleListing.cs b/osu.Game/Overlays/News/Displays/ArticleListing.cs index dc3b17b323..8465ebf07c 100644 --- a/osu.Game/Overlays/News/Displays/ArticleListing.cs +++ b/osu.Game/Overlays/News/Displays/ArticleListing.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/News/NewsCard.cs b/osu.Game/Overlays/News/NewsCard.cs index 5ce0b9df9c..69094a0df7 100644 --- a/osu.Game/Overlays/News/NewsCard.cs +++ b/osu.Game/Overlays/News/NewsCard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/News/NewsHeader.cs b/osu.Game/Overlays/News/NewsHeader.cs index 35e3c7755d..d204dfcf2e 100644 --- a/osu.Game/Overlays/News/NewsHeader.cs +++ b/osu.Game/Overlays/News/NewsHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/News/NewsPostBackground.cs b/osu.Game/Overlays/News/NewsPostBackground.cs index 386ef7f669..bddca8f7ec 100644 --- a/osu.Game/Overlays/News/NewsPostBackground.cs +++ b/osu.Game/Overlays/News/NewsPostBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; diff --git a/osu.Game/Overlays/News/Sidebar/MonthSection.cs b/osu.Game/Overlays/News/Sidebar/MonthSection.cs index e2ce25660e..894f8d5667 100644 --- a/osu.Game/Overlays/News/Sidebar/MonthSection.cs +++ b/osu.Game/Overlays/News/Sidebar/MonthSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/News/Sidebar/NewsSidebar.cs b/osu.Game/Overlays/News/Sidebar/NewsSidebar.cs index 829fc5b3eb..884e15c03b 100644 --- a/osu.Game/Overlays/News/Sidebar/NewsSidebar.cs +++ b/osu.Game/Overlays/News/Sidebar/NewsSidebar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/News/Sidebar/YearsPanel.cs b/osu.Game/Overlays/News/Sidebar/YearsPanel.cs index 58c0f6ac82..915ed1817c 100644 --- a/osu.Game/Overlays/News/Sidebar/YearsPanel.cs +++ b/osu.Game/Overlays/News/Sidebar/YearsPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/NewsOverlay.cs b/osu.Game/Overlays/NewsOverlay.cs index 12e3f81ca1..87b7ebbe89 100644 --- a/osu.Game/Overlays/NewsOverlay.cs +++ b/osu.Game/Overlays/NewsOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index d83839fa2c..281077bcf6 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Linq; using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game/Overlays/Notifications/IHasCompletionTarget.cs b/osu.Game/Overlays/Notifications/IHasCompletionTarget.cs index 603f53cb53..e4aeb4d6ce 100644 --- a/osu.Game/Overlays/Notifications/IHasCompletionTarget.cs +++ b/osu.Game/Overlays/Notifications/IHasCompletionTarget.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Overlays.Notifications diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index ec6e9e09b3..64bf3693c8 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index a4851ab365..b7e21822fa 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs index 754f9bd600..cb9d54c14c 100644 --- a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index 4735fcb7c1..d76df5b1ed 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Notifications/SimpleErrorNotification.cs b/osu.Game/Overlays/Notifications/SimpleErrorNotification.cs index faab4ed472..ffefcb033f 100644 --- a/osu.Game/Overlays/Notifications/SimpleErrorNotification.cs +++ b/osu.Game/Overlays/Notifications/SimpleErrorNotification.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Sprites; namespace osu.Game.Overlays.Notifications diff --git a/osu.Game/Overlays/Notifications/SimpleNotification.cs b/osu.Game/Overlays/Notifications/SimpleNotification.cs index b9a1cc6d90..fc594902cf 100644 --- a/osu.Game/Overlays/Notifications/SimpleNotification.cs +++ b/osu.Game/Overlays/Notifications/SimpleNotification.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game/Overlays/NowPlayingOverlay.cs b/osu.Game/Overlays/NowPlayingOverlay.cs index 4617a91885..6eddc7da83 100644 --- a/osu.Game/Overlays/NowPlayingOverlay.cs +++ b/osu.Game/Overlays/NowPlayingOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading.Tasks; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/OSD/Toast.cs b/osu.Game/Overlays/OSD/Toast.cs index 12e30d8de2..a9fab0a23d 100644 --- a/osu.Game/Overlays/OSD/Toast.cs +++ b/osu.Game/Overlays/OSD/Toast.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/OSD/TrackedSettingToast.cs b/osu.Game/Overlays/OSD/TrackedSettingToast.cs index 9939ba024e..c66811a3e9 100644 --- a/osu.Game/Overlays/OSD/TrackedSettingToast.cs +++ b/osu.Game/Overlays/OSD/TrackedSettingToast.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 6b3696ced9..f2836885ce 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Configuration; diff --git a/osu.Game/Overlays/OnlineOverlay.cs b/osu.Game/Overlays/OnlineOverlay.cs index a610511398..424584fbcf 100644 --- a/osu.Game/Overlays/OnlineOverlay.cs +++ b/osu.Game/Overlays/OnlineOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/OverlayActivation.cs b/osu.Game/Overlays/OverlayActivation.cs index 68d7ee8ea9..354153734e 100644 --- a/osu.Game/Overlays/OverlayActivation.cs +++ b/osu.Game/Overlays/OverlayActivation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Overlays { public enum OverlayActivation diff --git a/osu.Game/Overlays/OverlayColourProvider.cs b/osu.Game/Overlays/OverlayColourProvider.cs index a4f6527024..d7581960f4 100644 --- a/osu.Game/Overlays/OverlayColourProvider.cs +++ b/osu.Game/Overlays/OverlayColourProvider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osuTK; using osuTK.Graphics; diff --git a/osu.Game/Overlays/OverlayHeader.cs b/osu.Game/Overlays/OverlayHeader.cs index fed1e57686..ed8e3849d4 100644 --- a/osu.Game/Overlays/OverlayHeader.cs +++ b/osu.Game/Overlays/OverlayHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/OverlayHeaderBackground.cs b/osu.Game/Overlays/OverlayHeaderBackground.cs index 2fef593285..c47f16272f 100644 --- a/osu.Game/Overlays/OverlayHeaderBackground.cs +++ b/osu.Game/Overlays/OverlayHeaderBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/OverlayPanelDisplayStyleControl.cs b/osu.Game/Overlays/OverlayPanelDisplayStyleControl.cs index d7a3b052ae..14a99cd5bb 100644 --- a/osu.Game/Overlays/OverlayPanelDisplayStyleControl.cs +++ b/osu.Game/Overlays/OverlayPanelDisplayStyleControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/OverlayRulesetSelector.cs b/osu.Game/Overlays/OverlayRulesetSelector.cs index 8c44157f78..a0efb197c2 100644 --- a/osu.Game/Overlays/OverlayRulesetSelector.cs +++ b/osu.Game/Overlays/OverlayRulesetSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Overlays/OverlayRulesetTabItem.cs b/osu.Game/Overlays/OverlayRulesetTabItem.cs index 1f11b98881..ba0b81a514 100644 --- a/osu.Game/Overlays/OverlayRulesetTabItem.cs +++ b/osu.Game/Overlays/OverlayRulesetTabItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Overlays/OverlayScrollContainer.cs b/osu.Game/Overlays/OverlayScrollContainer.cs index 7fe188eb04..95b27665f4 100644 --- a/osu.Game/Overlays/OverlayScrollContainer.cs +++ b/osu.Game/Overlays/OverlayScrollContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/OverlaySidebar.cs b/osu.Game/Overlays/OverlaySidebar.cs index 468b5b6eb3..62f3e1af13 100644 --- a/osu.Game/Overlays/OverlaySidebar.cs +++ b/osu.Game/Overlays/OverlaySidebar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/OverlaySortTabControl.cs b/osu.Game/Overlays/OverlaySortTabControl.cs index 5f5cfce344..f02d2b388f 100644 --- a/osu.Game/Overlays/OverlaySortTabControl.cs +++ b/osu.Game/Overlays/OverlaySortTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Overlays/OverlayStreamControl.cs b/osu.Game/Overlays/OverlayStreamControl.cs index 8b6aca6d5d..1bd244176e 100644 --- a/osu.Game/Overlays/OverlayStreamControl.cs +++ b/osu.Game/Overlays/OverlayStreamControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Input.Events; using System.Collections.Generic; diff --git a/osu.Game/Overlays/OverlayStreamItem.cs b/osu.Game/Overlays/OverlayStreamItem.cs index 56502ff70f..3e09956480 100644 --- a/osu.Game/Overlays/OverlayStreamItem.cs +++ b/osu.Game/Overlays/OverlayStreamItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Overlays/OverlayTabControl.cs b/osu.Game/Overlays/OverlayTabControl.cs index 578cd703c7..35e073a3a1 100644 --- a/osu.Game/Overlays/OverlayTabControl.cs +++ b/osu.Game/Overlays/OverlayTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Overlays/OverlayTitle.cs b/osu.Game/Overlays/OverlayTitle.cs index d92979e8d4..f2c42034a3 100644 --- a/osu.Game/Overlays/OverlayTitle.cs +++ b/osu.Game/Overlays/OverlayTitle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/OverlayView.cs b/osu.Game/Overlays/OverlayView.cs index c254cdf290..80df0c695f 100644 --- a/osu.Game/Overlays/OverlayView.cs +++ b/osu.Game/Overlays/OverlayView.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs index a70d57661b..dcc8b19021 100644 --- a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Humanizer; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs index 00a866f1f4..b07817de46 100644 --- a/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Overlays/Profile/Header/Components/DrawableBadge.cs b/osu.Game/Overlays/Profile/Header/Components/DrawableBadge.cs index 74f3ed846b..cf75818a0c 100644 --- a/osu.Game/Overlays/Profile/Header/Components/DrawableBadge.cs +++ b/osu.Game/Overlays/Profile/Header/Components/DrawableBadge.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs b/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs index 4cfdf5cc86..62b228c285 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; diff --git a/osu.Game/Overlays/Profile/Header/Components/FollowersButton.cs b/osu.Game/Overlays/Profile/Header/Components/FollowersButton.cs index 1b21bfc982..6fbfff1dd7 100644 --- a/osu.Game/Overlays/Profile/Header/Components/FollowersButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/FollowersButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/Profile/Header/Components/LevelBadge.cs b/osu.Game/Overlays/Profile/Header/Components/LevelBadge.cs index e1302788da..fdf7478834 100644 --- a/osu.Game/Overlays/Profile/Header/Components/LevelBadge.cs +++ b/osu.Game/Overlays/Profile/Header/Components/LevelBadge.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs b/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs index d8eb5b65ac..1ba391431f 100644 --- a/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs +++ b/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Overlays/Profile/Header/Components/MappingSubscribersButton.cs b/osu.Game/Overlays/Profile/Header/Components/MappingSubscribersButton.cs index 6d1024ff18..7bfc78cb2d 100644 --- a/osu.Game/Overlays/Profile/Header/Components/MappingSubscribersButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/MappingSubscribersButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs b/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs index e3dc5f818a..46cb811846 100644 --- a/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Profile/Header/Components/OverlinedInfoContainer.cs b/osu.Game/Overlays/Profile/Header/Components/OverlinedInfoContainer.cs index 5ef8482b47..7ac472ee00 100644 --- a/osu.Game/Overlays/Profile/Header/Components/OverlinedInfoContainer.cs +++ b/osu.Game/Overlays/Profile/Header/Components/OverlinedInfoContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Overlays/Profile/Header/Components/OverlinedTotalPlayTime.cs b/osu.Game/Overlays/Profile/Header/Components/OverlinedTotalPlayTime.cs index 1ead2cd2f5..9e5a0f5962 100644 --- a/osu.Game/Overlays/Profile/Header/Components/OverlinedTotalPlayTime.cs +++ b/osu.Game/Overlays/Profile/Header/Components/OverlinedTotalPlayTime.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Profile/Header/Components/PreviousUsernames.cs b/osu.Game/Overlays/Profile/Header/Components/PreviousUsernames.cs index 49744e885a..808c814928 100644 --- a/osu.Game/Overlays/Profile/Header/Components/PreviousUsernames.cs +++ b/osu.Game/Overlays/Profile/Header/Components/PreviousUsernames.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderButton.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderButton.cs index cea63574cf..5bdf9c19e1 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderStatisticsButton.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderStatisticsButton.cs index b098f9f840..3b3251fc4e 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderStatisticsButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderStatisticsButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs index 4d2290266c..3a47570cf7 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs index 4a44e285bf..d75fe1ae84 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs b/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs index d195babcbf..85fb5c4e5c 100644 --- a/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs b/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs index f450754c02..a05d8ba152 100644 --- a/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs +++ b/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs index 79e553062d..d65691f531 100644 --- a/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs index 922f3832e4..deb675df1d 100644 --- a/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index 3b76dc01ee..9c957e387a 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 44e0d9c37f..f84f829f7a 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Profile/ProfileSection.cs b/osu.Game/Overlays/Profile/ProfileSection.cs index fc6fce0d8e..67738943e8 100644 --- a/osu.Game/Overlays/Profile/ProfileSection.cs +++ b/osu.Game/Overlays/Profile/ProfileSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/Profile/Sections/AboutSection.cs b/osu.Game/Overlays/Profile/Sections/AboutSection.cs index d0d9362fd2..2b6ce732a2 100644 --- a/osu.Game/Overlays/Profile/Sections/AboutSection.cs +++ b/osu.Game/Overlays/Profile/Sections/AboutSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index 13465f3bf8..5d36537c3e 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index 8224cd5eb5..aaaed5ad0a 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs index 6b93c24a78..e3cff5da05 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Game.Online.API.Requests; using osu.Game.Overlays.Profile.Sections.Beatmaps; diff --git a/osu.Game/Overlays/Profile/Sections/CounterPill.cs b/osu.Game/Overlays/Profile/Sections/CounterPill.cs index bd6cb4d09b..e9b55f62ef 100644 --- a/osu.Game/Overlays/Profile/Sections/CounterPill.cs +++ b/osu.Game/Overlays/Profile/Sections/CounterPill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Overlays/Profile/Sections/Historical/ChartProfileSubsection.cs b/osu.Game/Overlays/Profile/Sections/Historical/ChartProfileSubsection.cs index 4edbdc31bd..f0819c4474 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/ChartProfileSubsection.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/ChartProfileSubsection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs index 3ed4bd9e50..70ab95b848 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs index 06de0f62dc..34c9892f06 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Profile/Sections/Historical/PlayHistorySubsection.cs b/osu.Game/Overlays/Profile/Sections/Historical/PlayHistorySubsection.cs index 51d704a6b0..73e39a2440 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/PlayHistorySubsection.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/PlayHistorySubsection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Localisation; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Overlays/Profile/Sections/Historical/ProfileLineChart.cs b/osu.Game/Overlays/Profile/Sections/Historical/ProfileLineChart.cs index c049bff7b2..78a28a39d2 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/ProfileLineChart.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/ProfileLineChart.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using JetBrains.Annotations; diff --git a/osu.Game/Overlays/Profile/Sections/Historical/ReplaysSubsection.cs b/osu.Game/Overlays/Profile/Sections/Historical/ReplaysSubsection.cs index 22312afdc9..89e8f51338 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/ReplaysSubsection.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/ReplaysSubsection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Localisation; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Overlays/Profile/Sections/Historical/UserHistoryGraph.cs b/osu.Game/Overlays/Profile/Sections/Historical/UserHistoryGraph.cs index f80167f9d3..48d75a4953 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/UserHistoryGraph.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/UserHistoryGraph.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/Profile/Sections/HistoricalSection.cs b/osu.Game/Overlays/Profile/Sections/HistoricalSection.cs index 203844b6b5..f1e1c44734 100644 --- a/osu.Game/Overlays/Profile/Sections/HistoricalSection.cs +++ b/osu.Game/Overlays/Profile/Sections/HistoricalSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Online.API.Requests; diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/DrawableKudosuHistoryItem.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/DrawableKudosuHistoryItem.cs index ce05beffd1..44f1af4b72 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/DrawableKudosuHistoryItem.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/DrawableKudosuHistoryItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 79a06ecdd4..bb9d48c473 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osuTK; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs index 9af854e6b9..34e6866d25 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Online.API.Requests; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Profile/Sections/KudosuSection.cs b/osu.Game/Overlays/Profile/Sections/KudosuSection.cs index 5b749c78a8..517b4d92cf 100644 --- a/osu.Game/Overlays/Profile/Sections/KudosuSection.cs +++ b/osu.Game/Overlays/Profile/Sections/KudosuSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Overlays.Profile.Sections.Kudosu; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Profile/Sections/MedalsSection.cs b/osu.Game/Overlays/Profile/Sections/MedalsSection.cs index cacdd44b61..a458bc4873 100644 --- a/osu.Game/Overlays/Profile/Sections/MedalsSection.cs +++ b/osu.Game/Overlays/Profile/Sections/MedalsSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs b/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs index 33bd155d71..8ed1dc3676 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using System.Threading; diff --git a/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs b/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs index afa6bd9f79..392e35ac05 100644 --- a/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Profile/Sections/ProfileSubsection.cs b/osu.Game/Overlays/Profile/Sections/ProfileSubsection.cs index fdf8cb19ff..8e43519a17 100644 --- a/osu.Game/Overlays/Profile/Sections/ProfileSubsection.cs +++ b/osu.Game/Overlays/Profile/Sections/ProfileSubsection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Profile/Sections/ProfileSubsectionHeader.cs b/osu.Game/Overlays/Profile/Sections/ProfileSubsectionHeader.cs index 408cb00770..f2770d81cd 100644 --- a/osu.Game/Overlays/Profile/Sections/ProfileSubsectionHeader.cs +++ b/osu.Game/Overlays/Profile/Sections/ProfileSubsectionHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs index 998f5d158e..54a262f6a6 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileWeightedScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileWeightedScore.cs index 78ae0a5634..f8f83883fc 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileWeightedScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileWeightedScore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index ef9f4b5ff3..15c7b8f042 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Game.Online.API.Requests; using System; diff --git a/osu.Game/Overlays/Profile/Sections/RanksSection.cs b/osu.Game/Overlays/Profile/Sections/RanksSection.cs index f48e33dc12..581b6e1139 100644 --- a/osu.Game/Overlays/Profile/Sections/RanksSection.cs +++ b/osu.Game/Overlays/Profile/Sections/RanksSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Overlays.Profile.Sections.Ranks; using osu.Game.Online.API.Requests; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Profile/Sections/Recent/DrawableRecentActivity.cs b/osu.Game/Overlays/Profile/Sections/Recent/DrawableRecentActivity.cs index 7a27c6e4e1..943c105008 100644 --- a/osu.Game/Overlays/Profile/Sections/Recent/DrawableRecentActivity.cs +++ b/osu.Game/Overlays/Profile/Sections/Recent/DrawableRecentActivity.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Profile/Sections/Recent/MedalIcon.cs b/osu.Game/Overlays/Profile/Sections/Recent/MedalIcon.cs index 0c1f8b2e92..e3072f3420 100644 --- a/osu.Game/Overlays/Profile/Sections/Recent/MedalIcon.cs +++ b/osu.Game/Overlays/Profile/Sections/Recent/MedalIcon.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs index 77008d5f34..2878e0e940 100644 --- a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Online.API.Requests; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Profile/Sections/RecentSection.cs b/osu.Game/Overlays/Profile/Sections/RecentSection.cs index 33d435aa1b..c20594f974 100644 --- a/osu.Game/Overlays/Profile/Sections/RecentSection.cs +++ b/osu.Game/Overlays/Profile/Sections/RecentSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Game.Overlays.Profile.Sections.Recent; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/Profile/UserGraph.cs b/osu.Game/Overlays/Profile/UserGraph.cs index 182221eea7..a8a4de68ff 100644 --- a/osu.Game/Overlays/Profile/UserGraph.cs +++ b/osu.Game/Overlays/Profile/UserGraph.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/Rankings/CountryFilter.cs b/osu.Game/Overlays/Rankings/CountryFilter.cs index 9950f36141..9ba2018522 100644 --- a/osu.Game/Overlays/Rankings/CountryFilter.cs +++ b/osu.Game/Overlays/Rankings/CountryFilter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Rankings/CountryPill.cs b/osu.Game/Overlays/Rankings/CountryPill.cs index 3878e2ea4e..90f8c85557 100644 --- a/osu.Game/Overlays/Rankings/CountryPill.cs +++ b/osu.Game/Overlays/Rankings/CountryPill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs b/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs index 417b33ddf6..9b0b75f663 100644 --- a/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs +++ b/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/Rankings/RankingsScope.cs b/osu.Game/Overlays/Rankings/RankingsScope.cs index e660c2898a..2644fee58b 100644 --- a/osu.Game/Overlays/Rankings/RankingsScope.cs +++ b/osu.Game/Overlays/Rankings/RankingsScope.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/Rankings/RankingsSortTabControl.cs b/osu.Game/Overlays/Rankings/RankingsSortTabControl.cs index f05795b2a2..905c0fae65 100644 --- a/osu.Game/Overlays/Rankings/RankingsSortTabControl.cs +++ b/osu.Game/Overlays/Rankings/RankingsSortTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Overlays/Rankings/SpotlightSelector.cs b/osu.Game/Overlays/Rankings/SpotlightSelector.cs index c05c160463..234b91de66 100644 --- a/osu.Game/Overlays/Rankings/SpotlightSelector.cs +++ b/osu.Game/Overlays/Rankings/SpotlightSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Rankings/SpotlightsLayout.cs b/osu.Game/Overlays/Rankings/SpotlightsLayout.cs index 7f5d096fe2..c23b9711dd 100644 --- a/osu.Game/Overlays/Rankings/SpotlightsLayout.cs +++ b/osu.Game/Overlays/Rankings/SpotlightsLayout.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using System.Threading; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs b/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs index a908380e95..53d10b3e53 100644 --- a/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System; diff --git a/osu.Game/Overlays/Rankings/Tables/PerformanceTable.cs b/osu.Game/Overlays/Rankings/Tables/PerformanceTable.cs index 6c85ec2753..a77546d83f 100644 --- a/osu.Game/Overlays/Rankings/Tables/PerformanceTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/PerformanceTable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs index 9658679067..56e318637a 100644 --- a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System.Collections.Generic; diff --git a/osu.Game/Overlays/Rankings/Tables/ScoresTable.cs b/osu.Game/Overlays/Rankings/Tables/ScoresTable.cs index 934da4501e..71c78baf3c 100644 --- a/osu.Game/Overlays/Rankings/Tables/ScoresTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/ScoresTable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Rankings/Tables/TableRowBackground.cs b/osu.Game/Overlays/Rankings/Tables/TableRowBackground.cs index b49fec65db..fd9f6da749 100644 --- a/osu.Game/Overlays/Rankings/Tables/TableRowBackground.cs +++ b/osu.Game/Overlays/Rankings/Tables/TableRowBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs b/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs index 5d150c9535..2edd1b21ba 100644 --- a/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Overlays/RankingsOverlay.cs b/osu.Game/Overlays/RankingsOverlay.cs index 80ce2e038d..a66b8cf2ba 100644 --- a/osu.Game/Overlays/RankingsOverlay.cs +++ b/osu.Game/Overlays/RankingsOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/RestoreDefaultValueButton.cs b/osu.Game/Overlays/RestoreDefaultValueButton.cs index afc4146199..a5da696f58 100644 --- a/osu.Game/Overlays/RestoreDefaultValueButton.cs +++ b/osu.Game/Overlays/RestoreDefaultValueButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/Settings/DangerousSettingsButton.cs b/osu.Game/Overlays/Settings/DangerousSettingsButton.cs index 4ca3ace8a1..bf7c9ccf2b 100644 --- a/osu.Game/Overlays/Settings/DangerousSettingsButton.cs +++ b/osu.Game/Overlays/Settings/DangerousSettingsButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Settings/ISettingsItem.cs b/osu.Game/Overlays/Settings/ISettingsItem.cs index 61191dcacf..509fc1ab0d 100644 --- a/osu.Game/Overlays/Settings/ISettingsItem.cs +++ b/osu.Game/Overlays/Settings/ISettingsItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Settings/OutlinedTextBox.cs b/osu.Game/Overlays/Settings/OutlinedTextBox.cs index 93eaf74b77..de7fe75060 100644 --- a/osu.Game/Overlays/Settings/OutlinedTextBox.cs +++ b/osu.Game/Overlays/Settings/OutlinedTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Input.Events; diff --git a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs index 3945a410ab..76e75a5b3c 100644 --- a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Configuration; using osu.Game.Rulesets; diff --git a/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs index 858d555f06..7cb9efa1b9 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs index eaacb9293f..d25e9490b7 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs index 00c1cb8f43..cea8fdd733 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Settings/Sections/AudioSection.cs b/osu.Game/Overlays/Settings/Sections/AudioSection.cs index 7ffa0bd415..70c74cd77c 100644 --- a/osu.Game/Overlays/Settings/Sections/AudioSection.cs +++ b/osu.Game/Overlays/Settings/Sections/AudioSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/DebugSection.cs b/osu.Game/Overlays/Settings/Sections/DebugSection.cs index 2e23d8a22a..a02e28d33a 100644 --- a/osu.Game/Overlays/Settings/Sections/DebugSection.cs +++ b/osu.Game/Overlays/Settings/Sections/DebugSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs index 2b845e9d6b..e79d27ad2a 100644 --- a/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Settings/Sections/DebugSettings/MemorySettings.cs b/osu.Game/Overlays/Settings/Sections/DebugSettings/MemorySettings.cs index f26326a220..77eede0e46 100644 --- a/osu.Game/Overlays/Settings/Sections/DebugSettings/MemorySettings.cs +++ b/osu.Game/Overlays/Settings/Sections/DebugSettings/MemorySettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading; using System.Threading.Tasks; diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs index e2e00813bd..d369c4470b 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/BackgroundSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/BackgroundSettings.cs index 94e0c5e494..cc224a4f7f 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/BackgroundSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/BackgroundSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs index aaa60ce81b..becb7aa80f 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/BeatmapSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index 5231ce1211..c16ee39191 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs index 0d31e70880..0893af7d3e 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs index 83ea655601..b5315d5268 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/InputSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs index ed88d80570..53f7f52212 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Settings/Sections/GameplaySection.cs b/osu.Game/Overlays/Settings/Sections/GameplaySection.cs index 120e2d908c..48e76bfeb7 100644 --- a/osu.Game/Overlays/Settings/Sections/GameplaySection.cs +++ b/osu.Game/Overlays/Settings/Sections/GameplaySection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs index cdce187a35..63f0dec953 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LanguageSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Configuration; diff --git a/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs b/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs index 5bc88b8692..b68a4fed48 100644 --- a/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading.Tasks; using osu.Framework; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Settings/Sections/GeneralSection.cs b/osu.Game/Overlays/Settings/Sections/GeneralSection.cs index ced3116728..59cbd8cd5a 100644 --- a/osu.Game/Overlays/Settings/Sections/GeneralSection.cs +++ b/osu.Game/Overlays/Settings/Sections/GeneralSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 05890ad882..2c8e809379 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Drawing; using System.Linq; diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs index 5ba8e724cf..2e15172e46 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/ScreenshotSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/ScreenshotSettings.cs index dbb9ddc1c1..7f88cc23d2 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/ScreenshotSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/ScreenshotSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/VideoSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/VideoSettings.cs index 921eab63ed..56d0a6421b 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/VideoSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/VideoSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Configuration; diff --git a/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs b/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs index 8cd3b841c2..e094e0e051 100644 --- a/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs +++ b/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/Input/BindingSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/BindingSettings.cs index 3227decc46..b92746a65a 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/BindingSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/BindingSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/Input/GlobalKeyBindingsSection.cs b/osu.Game/Overlays/Settings/Sections/Input/GlobalKeyBindingsSection.cs index 3350ff4eaa..a2e07065f1 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/GlobalKeyBindingsSection.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/GlobalKeyBindingsSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs index 60849cd6d4..34be846595 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/JoystickSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingPanel.cs b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingPanel.cs index 67f1bb8d3e..0830241f2b 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingPanel.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Input.Bindings; diff --git a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs index 7312748435..9ff47578e9 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingsSubsection.cs b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingsSubsection.cs index 297af35fb5..628fe08607 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingsSubsection.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingsSubsection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 1511d53b6b..303fb79d16 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Settings/Sections/Input/RotationPresetButtons.cs b/osu.Game/Overlays/Settings/Sections/Input/RotationPresetButtons.cs index dbdf600002..2172dc175e 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/RotationPresetButtons.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/RotationPresetButtons.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Settings/Sections/Input/RulesetBindingsSection.cs b/osu.Game/Overlays/Settings/Sections/Input/RulesetBindingsSection.cs index dae276c711..6f3127a377 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/RulesetBindingsSection.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/RulesetBindingsSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/Settings/Sections/Input/TabletAreaSelection.cs b/osu.Game/Overlays/Settings/Sections/Input/TabletAreaSelection.cs index 58abfab29c..cd6554e52d 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/TabletAreaSelection.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/TabletAreaSelection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs index 5d31c38ae7..271438ed14 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Settings/Sections/Input/VariantBindingsSubsection.cs b/osu.Game/Overlays/Settings/Sections/Input/VariantBindingsSubsection.cs index a0f069b3bb..23f91fba4b 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/VariantBindingsSubsection.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/VariantBindingsSubsection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Game.Rulesets; diff --git a/osu.Game/Overlays/Settings/Sections/InputSection.cs b/osu.Game/Overlays/Settings/Sections/InputSection.cs index d2c5d2fcf7..9a4a2ddb57 100644 --- a/osu.Game/Overlays/Settings/Sections/InputSection.cs +++ b/osu.Game/Overlays/Settings/Sections/InputSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs index c7fd248842..1c9a758c6f 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using System.IO; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs index 054de8dbd7..916c607c1c 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading.Tasks; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs index c481c80d82..526c096493 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/MassDeleteConfirmationDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; using osu.Game.Overlays.Dialog; diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/MassVideoDeleteConfirmationDialog.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/MassVideoDeleteConfirmationDialog.cs index fc8c9d497b..e3870bc76a 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/MassVideoDeleteConfirmationDialog.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/MassVideoDeleteConfirmationDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Overlays.Settings.Sections.Maintenance diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationRunScreen.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationRunScreen.cs index b7b797936e..d565576d09 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationRunScreen.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationRunScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using System.Threading.Tasks; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs index 3cb5521e51..7e6341cd1b 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectoryLocationDialog.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectoryLocationDialog.cs index b16fd9a5a1..8aff4520b5 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectoryLocationDialog.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectoryLocationDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectorySelectScreen.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectorySelectScreen.cs index 86934ae514..047d589689 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectorySelectScreen.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/StableDirectorySelectScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using System.Linq; using System.Threading.Tasks; diff --git a/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs b/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs index 9410a87848..cfe1961bc1 100644 --- a/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs +++ b/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs b/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs index 351a32c72e..529f1b5ee4 100644 --- a/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/Online/IntegrationSettings.cs b/osu.Game/Overlays/Settings/Sections/Online/IntegrationSettings.cs index 0207f2fd01..17228d6359 100644 --- a/osu.Game/Overlays/Settings/Sections/Online/IntegrationSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Online/IntegrationSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs b/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs index e864260cc6..ba707e2145 100644 --- a/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/OnlineSection.cs b/osu.Game/Overlays/Settings/Sections/OnlineSection.cs index 8b523b90b9..feb281f1b8 100644 --- a/osu.Game/Overlays/Settings/Sections/OnlineSection.cs +++ b/osu.Game/Overlays/Settings/Sections/OnlineSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/RulesetSection.cs b/osu.Game/Overlays/Settings/Sections/RulesetSection.cs index b9339d5299..2368459b4e 100644 --- a/osu.Game/Overlays/Settings/Sections/RulesetSection.cs +++ b/osu.Game/Overlays/Settings/Sections/RulesetSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Settings/Sections/SizeSlider.cs b/osu.Game/Overlays/Settings/Sections/SizeSlider.cs index c8a46162af..28b4cd6418 100644 --- a/osu.Game/Overlays/Settings/Sections/SizeSlider.cs +++ b/osu.Game/Overlays/Settings/Sections/SizeSlider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index b83600a16d..6494b59b09 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs index dd1b9cc2a0..85cfdb33d5 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs index fceffa09c5..7ca45bb6b8 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs index b91b5c5243..8cec7bbb30 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Settings/Sections/UserInterfaceSection.cs b/osu.Game/Overlays/Settings/Sections/UserInterfaceSection.cs index 6228c4c99a..b2711af612 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterfaceSection.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterfaceSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; diff --git a/osu.Game/Overlays/Settings/SettingsButton.cs b/osu.Game/Overlays/Settings/SettingsButton.cs index 9e4dc763ec..5f2a416f58 100644 --- a/osu.Game/Overlays/Settings/SettingsButton.cs +++ b/osu.Game/Overlays/Settings/SettingsButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Overlays/Settings/SettingsCheckbox.cs b/osu.Game/Overlays/Settings/SettingsCheckbox.cs index 8a8fed4d30..efe7fb6d9e 100644 --- a/osu.Game/Overlays/Settings/SettingsCheckbox.cs +++ b/osu.Game/Overlays/Settings/SettingsCheckbox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Settings/SettingsDropdown.cs b/osu.Game/Overlays/Settings/SettingsDropdown.cs index 3c10c084ab..347ef03b42 100644 --- a/osu.Game/Overlays/Settings/SettingsDropdown.cs +++ b/osu.Game/Overlays/Settings/SettingsDropdown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Settings/SettingsEnumDropdown.cs b/osu.Game/Overlays/Settings/SettingsEnumDropdown.cs index 199ba14b48..9408e4a9ce 100644 --- a/osu.Game/Overlays/Settings/SettingsEnumDropdown.cs +++ b/osu.Game/Overlays/Settings/SettingsEnumDropdown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Settings/SettingsFooter.cs b/osu.Game/Overlays/Settings/SettingsFooter.cs index 263f2f4829..2f182d537f 100644 --- a/osu.Game/Overlays/Settings/SettingsFooter.cs +++ b/osu.Game/Overlays/Settings/SettingsFooter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Development; diff --git a/osu.Game/Overlays/Settings/SettingsHeader.cs b/osu.Game/Overlays/Settings/SettingsHeader.cs index f9ee8df0bd..56360fc4a1 100644 --- a/osu.Game/Overlays/Settings/SettingsHeader.cs +++ b/osu.Game/Overlays/Settings/SettingsHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index ea076b77ac..c34964fa96 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/Settings/SettingsNumberBox.cs b/osu.Game/Overlays/Settings/SettingsNumberBox.cs index d931c53e73..4f98954289 100644 --- a/osu.Game/Overlays/Settings/SettingsNumberBox.cs +++ b/osu.Game/Overlays/Settings/SettingsNumberBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index da596e4d9d..dfdc850ed8 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Overlays/Settings/SettingsSidebar.cs b/osu.Game/Overlays/Settings/SettingsSidebar.cs index 4e6a1eb914..ca6bcae6e4 100644 --- a/osu.Game/Overlays/Settings/SettingsSidebar.cs +++ b/osu.Game/Overlays/Settings/SettingsSidebar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Overlays/Settings/SettingsSlider.cs b/osu.Game/Overlays/Settings/SettingsSlider.cs index b95b0af11c..43f007f201 100644 --- a/osu.Game/Overlays/Settings/SettingsSlider.cs +++ b/osu.Game/Overlays/Settings/SettingsSlider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Settings/SettingsSubsection.cs b/osu.Game/Overlays/Settings/SettingsSubsection.cs index 21391d5ccf..72788c55cd 100644 --- a/osu.Game/Overlays/Settings/SettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/SettingsSubsection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Settings/SettingsTextBox.cs b/osu.Game/Overlays/Settings/SettingsTextBox.cs index a724003183..4d0f4253eb 100644 --- a/osu.Game/Overlays/Settings/SettingsTextBox.cs +++ b/osu.Game/Overlays/Settings/SettingsTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Settings/SidebarButton.cs b/osu.Game/Overlays/Settings/SidebarButton.cs index 1a34143e1f..c6a4cbbcaa 100644 --- a/osu.Game/Overlays/Settings/SidebarButton.cs +++ b/osu.Game/Overlays/Settings/SidebarButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Input.Events; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Settings/SidebarIconButton.cs b/osu.Game/Overlays/Settings/SidebarIconButton.cs index 6f3d3d5d52..b32337eb2e 100644 --- a/osu.Game/Overlays/Settings/SidebarIconButton.cs +++ b/osu.Game/Overlays/Settings/SidebarIconButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 7cd8fc6d66..b28ac4ab8b 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/SettingsPanel.cs b/osu.Game/Overlays/SettingsPanel.cs index a5a6f9bce7..eb457032ea 100644 --- a/osu.Game/Overlays/SettingsPanel.cs +++ b/osu.Game/Overlays/SettingsPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/SettingsSubPanel.cs b/osu.Game/Overlays/SettingsSubPanel.cs index d55c609d3f..4548cdfb5d 100644 --- a/osu.Game/Overlays/SettingsSubPanel.cs +++ b/osu.Game/Overlays/SettingsSubPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/SettingsToolboxGroup.cs b/osu.Game/Overlays/SettingsToolboxGroup.cs index 077762c0d0..548d75c9a9 100644 --- a/osu.Game/Overlays/SettingsToolboxGroup.cs +++ b/osu.Game/Overlays/SettingsToolboxGroup.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Caching; using osu.Framework.Extensions.EnumExtensions; diff --git a/osu.Game/Overlays/SortDirection.cs b/osu.Game/Overlays/SortDirection.cs index 3af9614972..98ac31103f 100644 --- a/osu.Game/Overlays/SortDirection.cs +++ b/osu.Game/Overlays/SortDirection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Overlays { public enum SortDirection diff --git a/osu.Game/Overlays/TabControlOverlayHeader.cs b/osu.Game/Overlays/TabControlOverlayHeader.cs index 1b0bd658d9..4e32afb86f 100644 --- a/osu.Game/Overlays/TabControlOverlayHeader.cs +++ b/osu.Game/Overlays/TabControlOverlayHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/TabbableOnlineOverlay.cs b/osu.Game/Overlays/TabbableOnlineOverlay.cs index 9ceab12d3d..a99be4cc18 100644 --- a/osu.Game/Overlays/TabbableOnlineOverlay.cs +++ b/osu.Game/Overlays/TabbableOnlineOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Toolbar/AnalogClockDisplay.cs b/osu.Game/Overlays/Toolbar/AnalogClockDisplay.cs index 9228900e99..477991f599 100644 --- a/osu.Game/Overlays/Toolbar/AnalogClockDisplay.cs +++ b/osu.Game/Overlays/Toolbar/AnalogClockDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Toolbar/ClockDisplay.cs b/osu.Game/Overlays/Toolbar/ClockDisplay.cs index c1befbb198..0711341445 100644 --- a/osu.Game/Overlays/Toolbar/ClockDisplay.cs +++ b/osu.Game/Overlays/Toolbar/ClockDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs b/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs index ac6f563336..5592590fd9 100644 --- a/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs +++ b/osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 1e21e7e16c..82fa20aa9c 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Toolbar/ToolbarBeatmapListingButton.cs b/osu.Game/Overlays/Toolbar/ToolbarBeatmapListingButton.cs index bfe36a6a0f..a2de186488 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarBeatmapListingButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarBeatmapListingButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Input.Bindings; diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index b2b80f0e05..96d4da1112 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs b/osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs index 86bc73361a..5ce6387196 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs b/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs index 2d3b33e9bc..86f87deabd 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Input.Bindings; diff --git a/osu.Game/Overlays/Toolbar/ToolbarClock.cs b/osu.Game/Overlays/Toolbar/ToolbarClock.cs index 12529da07f..c5add6eee2 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarClock.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarClock.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs b/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs index 76fbd40d66..f170ec84ac 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Input.Bindings; diff --git a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs index 9590c1aa3b..bd56c60582 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Toolbar/ToolbarNewsButton.cs b/osu.Game/Overlays/Toolbar/ToolbarNewsButton.cs index 9b2573ad07..286cfa20f0 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarNewsButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarNewsButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs index 313a2bc3f4..265eb044e0 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs index 0dea71cc08..03c365e49e 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Toolbar/ToolbarRankingsButton.cs b/osu.Game/Overlays/Toolbar/ToolbarRankingsButton.cs index 312fc41aab..1bda6da419 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRankingsButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRankingsButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 6e5fbf6efb..1ca492f81a 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs index a70a0d8a71..31c6802fda 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.UserInterface; using osu.Game.Rulesets; diff --git a/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs b/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs index c53f4a55d9..c3d48bc60e 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Input.Bindings; diff --git a/osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs b/osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs index 1e00afc5fd..f8ee39d56e 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Input.Bindings; diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index d8ba07dc3b..a93ba17c5b 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Overlays/Toolbar/ToolbarWikiButton.cs b/osu.Game/Overlays/Toolbar/ToolbarWikiButton.cs index a521219b4f..5511902fa8 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarWikiButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarWikiButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 518a2bf9c8..c0ca63bbd9 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/VersionManager.cs b/osu.Game/Overlays/VersionManager.cs index fe6613fba2..a1cfdf4594 100644 --- a/osu.Game/Overlays/VersionManager.cs +++ b/osu.Game/Overlays/VersionManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Development; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Volume/MuteButton.cs b/osu.Game/Overlays/Volume/MuteButton.cs index e9d3b31207..744b2bafbd 100644 --- a/osu.Game/Overlays/Volume/MuteButton.cs +++ b/osu.Game/Overlays/Volume/MuteButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Volume/VolumeControlReceptor.cs b/osu.Game/Overlays/Volume/VolumeControlReceptor.cs index c601ce4130..f2b637c104 100644 --- a/osu.Game/Overlays/Volume/VolumeControlReceptor.cs +++ b/osu.Game/Overlays/Volume/VolumeControlReceptor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Containers; using osu.Framework.Input; diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index 24d9f785f2..e01890ddc2 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; using osu.Framework; diff --git a/osu.Game/Overlays/VolumeOverlay.cs b/osu.Game/Overlays/VolumeOverlay.cs index 46ea45491e..4cedd87eac 100644 --- a/osu.Game/Overlays/VolumeOverlay.cs +++ b/osu.Game/Overlays/VolumeOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index 52ae4dbdbb..faf2cca8cf 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownContainer.cs b/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownContainer.cs index 789ed457a4..7754c1d450 100644 --- a/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownContainer.cs +++ b/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using Markdig.Extensions.Yaml; using Markdig.Syntax; diff --git a/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImage.cs b/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImage.cs index 27d1fe9b2f..1c7a08930b 100644 --- a/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImage.cs +++ b/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Markdig.Syntax.Inlines; using osu.Game.Graphics.Containers.Markdown; diff --git a/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImageBlock.cs b/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImageBlock.cs index 501e00bc00..5ce3f179a4 100644 --- a/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImageBlock.cs +++ b/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImageBlock.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Markdig.Syntax.Inlines; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Wiki/Markdown/WikiNoticeContainer.cs b/osu.Game/Overlays/Wiki/Markdown/WikiNoticeContainer.cs index 11cab80a57..64d7e20d9b 100644 --- a/osu.Game/Overlays/Wiki/Markdown/WikiNoticeContainer.cs +++ b/osu.Game/Overlays/Wiki/Markdown/WikiNoticeContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Markdig.Extensions.Yaml; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Wiki/WikiArticlePage.cs b/osu.Game/Overlays/Wiki/WikiArticlePage.cs index 0061bff8ea..f4ba0a4d8d 100644 --- a/osu.Game/Overlays/Wiki/WikiArticlePage.cs +++ b/osu.Game/Overlays/Wiki/WikiArticlePage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Markdig.Syntax; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Wiki/WikiHeader.cs b/osu.Game/Overlays/Wiki/WikiHeader.cs index 3e81d2cffe..fc8df03892 100644 --- a/osu.Game/Overlays/Wiki/WikiHeader.cs +++ b/osu.Game/Overlays/Wiki/WikiHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Overlays/Wiki/WikiMainPage.cs b/osu.Game/Overlays/Wiki/WikiMainPage.cs index 9416ec77f1..67e4bdf2e5 100644 --- a/osu.Game/Overlays/Wiki/WikiMainPage.cs +++ b/osu.Game/Overlays/Wiki/WikiMainPage.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Overlays/Wiki/WikiPanelContainer.cs b/osu.Game/Overlays/Wiki/WikiPanelContainer.cs index 7e7e005586..552770f098 100644 --- a/osu.Game/Overlays/Wiki/WikiPanelContainer.cs +++ b/osu.Game/Overlays/Wiki/WikiPanelContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Markdig.Syntax; using osu.Framework.Allocation; diff --git a/osu.Game/Overlays/Wiki/WikiSidebar.cs b/osu.Game/Overlays/Wiki/WikiSidebar.cs index da96885fb5..78ce9c8a24 100644 --- a/osu.Game/Overlays/Wiki/WikiSidebar.cs +++ b/osu.Game/Overlays/Wiki/WikiSidebar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Markdig.Syntax; using Markdig.Syntax.Inlines; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Overlays/Wiki/WikiTableOfContents.cs b/osu.Game/Overlays/Wiki/WikiTableOfContents.cs index c0615dce1f..d60d728aca 100644 --- a/osu.Game/Overlays/Wiki/WikiTableOfContents.cs +++ b/osu.Game/Overlays/Wiki/WikiTableOfContents.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/WikiOverlay.cs b/osu.Game/Overlays/WikiOverlay.cs index 4015d8e196..3c5cb82a88 100644 --- a/osu.Game/Overlays/WikiOverlay.cs +++ b/osu.Game/Overlays/WikiOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using System.Threading; diff --git a/osu.Game/PerformFromMenuRunner.cs b/osu.Game/PerformFromMenuRunner.cs index ae9879fb5a..eae13fe5d0 100644 --- a/osu.Game/PerformFromMenuRunner.cs +++ b/osu.Game/PerformFromMenuRunner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Performance/HighPerformanceSession.cs b/osu.Game/Performance/HighPerformanceSession.cs index 3ef0e0bf93..dd5de03077 100644 --- a/osu.Game/Performance/HighPerformanceSession.cs +++ b/osu.Game/Performance/HighPerformanceSession.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Properties/AssemblyInfo.cs b/osu.Game/Properties/AssemblyInfo.cs index 1b77e45891..dde1af6461 100644 --- a/osu.Game/Properties/AssemblyInfo.cs +++ b/osu.Game/Properties/AssemblyInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Runtime.CompilerServices; // We publish our internal attributes to other sub-projects of the framework. diff --git a/osu.Game/Replays/Legacy/LegacyReplayFrame.cs b/osu.Game/Replays/Legacy/LegacyReplayFrame.cs index f6abf259e8..d0574d65ab 100644 --- a/osu.Game/Replays/Legacy/LegacyReplayFrame.cs +++ b/osu.Game/Replays/Legacy/LegacyReplayFrame.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using MessagePack; using Newtonsoft.Json; using osu.Framework.Extensions.EnumExtensions; diff --git a/osu.Game/Replays/Legacy/ReplayButtonState.cs b/osu.Game/Replays/Legacy/ReplayButtonState.cs index 4b02cf2cd5..7788918ba9 100644 --- a/osu.Game/Replays/Legacy/ReplayButtonState.cs +++ b/osu.Game/Replays/Legacy/ReplayButtonState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Replays.Legacy diff --git a/osu.Game/Replays/Replay.cs b/osu.Game/Replays/Replay.cs index 30e176b5c7..4903f8c47f 100644 --- a/osu.Game/Replays/Replay.cs +++ b/osu.Game/Replays/Replay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Rulesets.Replays; diff --git a/osu.Game/Rulesets/AssemblyRulesetStore.cs b/osu.Game/Rulesets/AssemblyRulesetStore.cs index 7313a77aa5..03554ef2db 100644 --- a/osu.Game/Rulesets/AssemblyRulesetStore.cs +++ b/osu.Game/Rulesets/AssemblyRulesetStore.cs @@ -7,8 +7,6 @@ using System.Linq; using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Platform; -#nullable enable - namespace osu.Game.Rulesets { /// diff --git a/osu.Game/Rulesets/Configuration/IRulesetConfigManager.cs b/osu.Game/Rulesets/Configuration/IRulesetConfigManager.cs index 5a3ad5e786..af315bfb28 100644 --- a/osu.Game/Rulesets/Configuration/IRulesetConfigManager.cs +++ b/osu.Game/Rulesets/Configuration/IRulesetConfigManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Configuration.Tracking; diff --git a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs index 30bb95ba72..6c56f3a912 100644 --- a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs +++ b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs b/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs index ec3d22b67a..e0844a5c8a 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index b030c0c560..9c58a53b97 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/Difficulty/PerformanceAttributes.cs b/osu.Game/Rulesets/Difficulty/PerformanceAttributes.cs index e8c4c71913..15b90e5147 100644 --- a/osu.Game/Rulesets/Difficulty/PerformanceAttributes.cs +++ b/osu.Game/Rulesets/Difficulty/PerformanceAttributes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game/Rulesets/Difficulty/PerformanceBreakdown.cs b/osu.Game/Rulesets/Difficulty/PerformanceBreakdown.cs index 273d8613c5..bd971db476 100644 --- a/osu.Game/Rulesets/Difficulty/PerformanceBreakdown.cs +++ b/osu.Game/Rulesets/Difficulty/PerformanceBreakdown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Difficulty { /// diff --git a/osu.Game/Rulesets/Difficulty/PerformanceBreakdownCalculator.cs b/osu.Game/Rulesets/Difficulty/PerformanceBreakdownCalculator.cs index 1e5dda253f..4465f1a328 100644 --- a/osu.Game/Rulesets/Difficulty/PerformanceBreakdownCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/PerformanceBreakdownCalculator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using System.Threading; diff --git a/osu.Game/Rulesets/Difficulty/PerformanceCalculator.cs b/osu.Game/Rulesets/Difficulty/PerformanceCalculator.cs index 4c55249661..38a35ddb3b 100644 --- a/osu.Game/Rulesets/Difficulty/PerformanceCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/PerformanceCalculator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Scoring; diff --git a/osu.Game/Rulesets/Difficulty/PerformanceDisplayAttribute.cs b/osu.Game/Rulesets/Difficulty/PerformanceDisplayAttribute.cs index 7958bc174e..76dfca3db7 100644 --- a/osu.Game/Rulesets/Difficulty/PerformanceDisplayAttribute.cs +++ b/osu.Game/Rulesets/Difficulty/PerformanceDisplayAttribute.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Difficulty { /// diff --git a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs index 5a2a40e241..9ce0906dea 100644 --- a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs +++ b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Rulesets.Objects; diff --git a/osu.Game/Rulesets/Difficulty/Skills/Skill.cs b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs index 770754f304..44abbaaf41 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/Skill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Mods; diff --git a/osu.Game/Rulesets/Difficulty/Skills/StrainDecaySkill.cs b/osu.Game/Rulesets/Difficulty/Skills/StrainDecaySkill.cs index 3f3d57938b..6abde64eb7 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/StrainDecaySkill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/StrainDecaySkill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Mods; diff --git a/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs b/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs index 0b327046b3..4beba22e05 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs b/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs index c07d1cd46e..a07827d50b 100644 --- a/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs +++ b/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Rulesets.Difficulty diff --git a/osu.Game/Rulesets/Difficulty/Utils/LimitedCapacityQueue.cs b/osu.Game/Rulesets/Difficulty/Utils/LimitedCapacityQueue.cs index bc0eb8af88..d20eb5e885 100644 --- a/osu.Game/Rulesets/Difficulty/Utils/LimitedCapacityQueue.cs +++ b/osu.Game/Rulesets/Difficulty/Utils/LimitedCapacityQueue.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections; using System.Collections.Generic; diff --git a/osu.Game/Rulesets/Difficulty/Utils/ReverseQueue.cs b/osu.Game/Rulesets/Difficulty/Utils/ReverseQueue.cs index 57db9df3ca..3dc2d133ba 100644 --- a/osu.Game/Rulesets/Difficulty/Utils/ReverseQueue.cs +++ b/osu.Game/Rulesets/Difficulty/Utils/ReverseQueue.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections; using System.Collections.Generic; diff --git a/osu.Game/Rulesets/EFRulesetInfo.cs b/osu.Game/Rulesets/EFRulesetInfo.cs index 4174aa773c..3c671496de 100644 --- a/osu.Game/Rulesets/EFRulesetInfo.cs +++ b/osu.Game/Rulesets/EFRulesetInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.ComponentModel.DataAnnotations.Schema; using System.Diagnostics.CodeAnalysis; diff --git a/osu.Game/Rulesets/Edit/BeatmapVerifier.cs b/osu.Game/Rulesets/Edit/BeatmapVerifier.cs index 6ed91e983a..a89a0e76a9 100644 --- a/osu.Game/Rulesets/Edit/BeatmapVerifier.cs +++ b/osu.Game/Rulesets/Edit/BeatmapVerifier.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Rulesets.Edit.Checks; diff --git a/osu.Game/Rulesets/Edit/BeatmapVerifierContext.cs b/osu.Game/Rulesets/Edit/BeatmapVerifierContext.cs index 6feee82bda..53bdf3140c 100644 --- a/osu.Game/Rulesets/Edit/BeatmapVerifierContext.cs +++ b/osu.Game/Rulesets/Edit/BeatmapVerifierContext.cs @@ -3,8 +3,6 @@ using osu.Game.Beatmaps; -#nullable enable - namespace osu.Game.Rulesets.Edit { /// diff --git a/osu.Game/Rulesets/Edit/Checks/CheckAudioInVideo.cs b/osu.Game/Rulesets/Edit/Checks/CheckAudioInVideo.cs index a285979fd2..93fb7b9ab8 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckAudioInVideo.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckAudioInVideo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.IO; using osu.Game.IO.FileAbstraction; diff --git a/osu.Game/Rulesets/Edit/Checks/CheckAudioPresence.cs b/osu.Game/Rulesets/Edit/Checks/CheckAudioPresence.cs index 94c48c300a..fa3e114c55 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckAudioPresence.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckAudioPresence.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit.Checks.Components; diff --git a/osu.Game/Rulesets/Edit/Checks/CheckAudioQuality.cs b/osu.Game/Rulesets/Edit/Checks/CheckAudioQuality.cs index ec2ff68aad..96254ba6fd 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckAudioQuality.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckAudioQuality.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Edit.Checks.Components; diff --git a/osu.Game/Rulesets/Edit/Checks/CheckBackgroundPresence.cs b/osu.Game/Rulesets/Edit/Checks/CheckBackgroundPresence.cs index 067800b409..96840fd344 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckBackgroundPresence.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckBackgroundPresence.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit.Checks.Components; diff --git a/osu.Game/Rulesets/Edit/Checks/CheckBackgroundQuality.cs b/osu.Game/Rulesets/Edit/Checks/CheckBackgroundQuality.cs index 1f65752fa6..b15a9f5331 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckBackgroundQuality.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckBackgroundQuality.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.IO; using osu.Game.Rulesets.Edit.Checks.Components; diff --git a/osu.Game/Rulesets/Edit/Checks/CheckConcurrentObjects.cs b/osu.Game/Rulesets/Edit/Checks/CheckConcurrentObjects.cs index ba5fbcf58d..02579b675d 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckConcurrentObjects.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckConcurrentObjects.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Edit.Checks.Components; using osu.Game.Rulesets.Objects; diff --git a/osu.Game/Rulesets/Edit/Checks/CheckFewHitsounds.cs b/osu.Game/Rulesets/Edit/Checks/CheckFewHitsounds.cs index 3358e81d5f..b25abb0cfc 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckFewHitsounds.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckFewHitsounds.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Game.Audio; diff --git a/osu.Game/Rulesets/Edit/Checks/CheckFilePresence.cs b/osu.Game/Rulesets/Edit/Checks/CheckFilePresence.cs index a1605a11d0..67d480c28c 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckFilePresence.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckFilePresence.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit.Checks.Components; diff --git a/osu.Game/Rulesets/Edit/Checks/CheckMutedObjects.cs b/osu.Game/Rulesets/Edit/Checks/CheckMutedObjects.cs index a4ff921b7e..cb6c4a9928 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckMutedObjects.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckMutedObjects.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/Edit/Checks/CheckTooShortAudioFiles.cs b/osu.Game/Rulesets/Edit/Checks/CheckTooShortAudioFiles.cs index 6015d0a1b2..a461f63d2d 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckTooShortAudioFiles.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckTooShortAudioFiles.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/osu.Game/Rulesets/Edit/Checks/CheckUnsnappedObjects.cs b/osu.Game/Rulesets/Edit/Checks/CheckUnsnappedObjects.cs index ded1bb54ca..a3c52cf547 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckUnsnappedObjects.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckUnsnappedObjects.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Game.Rulesets.Edit.Checks.Components; diff --git a/osu.Game/Rulesets/Edit/Checks/CheckZeroByteFiles.cs b/osu.Game/Rulesets/Edit/Checks/CheckZeroByteFiles.cs index 75cb08002f..987711188e 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckZeroByteFiles.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckZeroByteFiles.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.IO; using osu.Game.Extensions; diff --git a/osu.Game/Rulesets/Edit/Checks/CheckZeroLengthObjects.cs b/osu.Game/Rulesets/Edit/Checks/CheckZeroLengthObjects.cs index b9be94736b..3b30fab934 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckZeroLengthObjects.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckZeroLengthObjects.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Edit.Checks.Components; using osu.Game.Rulesets.Objects; diff --git a/osu.Game/Rulesets/Edit/Checks/Components/CheckCategory.cs b/osu.Game/Rulesets/Edit/Checks/Components/CheckCategory.cs index ae943cfda9..3e2150fe0b 100644 --- a/osu.Game/Rulesets/Edit/Checks/Components/CheckCategory.cs +++ b/osu.Game/Rulesets/Edit/Checks/Components/CheckCategory.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Edit.Checks.Components { /// diff --git a/osu.Game/Rulesets/Edit/Checks/Components/CheckMetadata.cs b/osu.Game/Rulesets/Edit/Checks/Components/CheckMetadata.cs index cebb2f5455..5c9021ba61 100644 --- a/osu.Game/Rulesets/Edit/Checks/Components/CheckMetadata.cs +++ b/osu.Game/Rulesets/Edit/Checks/Components/CheckMetadata.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Edit.Checks.Components { public class CheckMetadata diff --git a/osu.Game/Rulesets/Edit/Checks/Components/ICheck.cs b/osu.Game/Rulesets/Edit/Checks/Components/ICheck.cs index 141de55f1d..333ec0a810 100644 --- a/osu.Game/Rulesets/Edit/Checks/Components/ICheck.cs +++ b/osu.Game/Rulesets/Edit/Checks/Components/ICheck.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; namespace osu.Game.Rulesets.Edit.Checks.Components diff --git a/osu.Game/Rulesets/Edit/Checks/Components/Issue.cs b/osu.Game/Rulesets/Edit/Checks/Components/Issue.cs index 2bc9930e8f..b3f227f364 100644 --- a/osu.Game/Rulesets/Edit/Checks/Components/Issue.cs +++ b/osu.Game/Rulesets/Edit/Checks/Components/Issue.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/Edit/Checks/Components/IssueTemplate.cs b/osu.Game/Rulesets/Edit/Checks/Components/IssueTemplate.cs index 97df79ecd8..9101d83fa7 100644 --- a/osu.Game/Rulesets/Edit/Checks/Components/IssueTemplate.cs +++ b/osu.Game/Rulesets/Edit/Checks/Components/IssueTemplate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Humanizer; using osu.Framework.Graphics; using osuTK.Graphics; diff --git a/osu.Game/Rulesets/Edit/Checks/Components/IssueType.cs b/osu.Game/Rulesets/Edit/Checks/Components/IssueType.cs index 1f708209fe..a957cbc296 100644 --- a/osu.Game/Rulesets/Edit/Checks/Components/IssueType.cs +++ b/osu.Game/Rulesets/Edit/Checks/Components/IssueType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Edit.Checks.Components { /// diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index aaee15eae8..4726211666 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions; diff --git a/osu.Game/Rulesets/Edit/DrawableEditorRulesetWrapper.cs b/osu.Game/Rulesets/Edit/DrawableEditorRulesetWrapper.cs index 392a5db9da..9588a092a8 100644 --- a/osu.Game/Rulesets/Edit/DrawableEditorRulesetWrapper.cs +++ b/osu.Game/Rulesets/Edit/DrawableEditorRulesetWrapper.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Rulesets/Edit/EditorToolboxGroup.cs b/osu.Game/Rulesets/Edit/EditorToolboxGroup.cs index bde426f56a..7dcc90b16d 100644 --- a/osu.Game/Rulesets/Edit/EditorToolboxGroup.cs +++ b/osu.Game/Rulesets/Edit/EditorToolboxGroup.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Overlays; diff --git a/osu.Game/Rulesets/Edit/ExpandingToolboxContainer.cs b/osu.Game/Rulesets/Edit/ExpandingToolboxContainer.cs index c6cc09a16c..d3371d3543 100644 --- a/osu.Game/Rulesets/Edit/ExpandingToolboxContainer.cs +++ b/osu.Game/Rulesets/Edit/ExpandingToolboxContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index f6fdb228ce..37c66037eb 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/osu.Game/Rulesets/Edit/HitObjectSelectionBlueprint.cs b/osu.Game/Rulesets/Edit/HitObjectSelectionBlueprint.cs index 77dc55c6ef..c74fb83d58 100644 --- a/osu.Game/Rulesets/Edit/HitObjectSelectionBlueprint.cs +++ b/osu.Game/Rulesets/Edit/HitObjectSelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Primitives; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Objects; diff --git a/osu.Game/Rulesets/Edit/IBeatSnapProvider.cs b/osu.Game/Rulesets/Edit/IBeatSnapProvider.cs index 616f854cd7..dbad407b75 100644 --- a/osu.Game/Rulesets/Edit/IBeatSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IBeatSnapProvider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Edit { public interface IBeatSnapProvider diff --git a/osu.Game/Rulesets/Edit/IBeatmapVerifier.cs b/osu.Game/Rulesets/Edit/IBeatmapVerifier.cs index 06f0abedb0..826bffef5f 100644 --- a/osu.Game/Rulesets/Edit/IBeatmapVerifier.cs +++ b/osu.Game/Rulesets/Edit/IBeatmapVerifier.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Edit.Checks.Components; diff --git a/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs index b12e1437dc..5ad1cc78ff 100644 --- a/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IDistanceSnapProvider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Beatmaps; diff --git a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs index a6a6e39e23..ad129e068d 100644 --- a/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs +++ b/osu.Game/Rulesets/Edit/IPositionSnapProvider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osuTK; diff --git a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs index 0c0c5990d1..26dd6db016 100644 --- a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs +++ b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Rulesets/Edit/SelectionBlueprint.cs b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs index 5e5bc9036d..fc24b55d21 100644 --- a/osu.Game/Rulesets/Edit/SelectionBlueprint.cs +++ b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework; using osu.Framework.Graphics; diff --git a/osu.Game/Rulesets/Edit/SnapResult.cs b/osu.Game/Rulesets/Edit/SnapResult.cs index 31dd2b9496..9a1405b97c 100644 --- a/osu.Game/Rulesets/Edit/SnapResult.cs +++ b/osu.Game/Rulesets/Edit/SnapResult.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.UI; using osuTK; diff --git a/osu.Game/Rulesets/Edit/SnapType.cs b/osu.Game/Rulesets/Edit/SnapType.cs index 6761356331..6eb46457c8 100644 --- a/osu.Game/Rulesets/Edit/SnapType.cs +++ b/osu.Game/Rulesets/Edit/SnapType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Rulesets.Edit diff --git a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs index 0a01ac4320..707645edeb 100644 --- a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs +++ b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; namespace osu.Game.Rulesets.Edit.Tools diff --git a/osu.Game/Rulesets/Edit/Tools/SelectTool.cs b/osu.Game/Rulesets/Edit/Tools/SelectTool.cs index c050766b23..9640830a09 100644 --- a/osu.Game/Rulesets/Edit/Tools/SelectTool.cs +++ b/osu.Game/Rulesets/Edit/Tools/SelectTool.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Rulesets/Filter/IRulesetFilterCriteria.cs b/osu.Game/Rulesets/Filter/IRulesetFilterCriteria.cs index dd2ad2cbfa..fa44f81df3 100644 --- a/osu.Game/Rulesets/Filter/IRulesetFilterCriteria.cs +++ b/osu.Game/Rulesets/Filter/IRulesetFilterCriteria.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Filter; diff --git a/osu.Game/Rulesets/ILegacyRuleset.cs b/osu.Game/Rulesets/ILegacyRuleset.cs index f4b03baccd..a8cfed4866 100644 --- a/osu.Game/Rulesets/ILegacyRuleset.cs +++ b/osu.Game/Rulesets/ILegacyRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets { public interface ILegacyRuleset diff --git a/osu.Game/Rulesets/IRulesetConfigCache.cs b/osu.Game/Rulesets/IRulesetConfigCache.cs index b946b43905..3943a62e59 100644 --- a/osu.Game/Rulesets/IRulesetConfigCache.cs +++ b/osu.Game/Rulesets/IRulesetConfigCache.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Game.Rulesets.Configuration; namespace osu.Game.Rulesets diff --git a/osu.Game/Rulesets/IRulesetInfo.cs b/osu.Game/Rulesets/IRulesetInfo.cs index 60a02212fc..5af6ef07cf 100644 --- a/osu.Game/Rulesets/IRulesetInfo.cs +++ b/osu.Game/Rulesets/IRulesetInfo.cs @@ -4,8 +4,6 @@ using System; using osu.Game.Database; -#nullable enable - namespace osu.Game.Rulesets { /// diff --git a/osu.Game/Rulesets/IRulesetStore.cs b/osu.Game/Rulesets/IRulesetStore.cs index 08d907810b..f4895118e3 100644 --- a/osu.Game/Rulesets/IRulesetStore.cs +++ b/osu.Game/Rulesets/IRulesetStore.cs @@ -3,8 +3,6 @@ using System.Collections.Generic; -#nullable enable - namespace osu.Game.Rulesets { public interface IRulesetStore diff --git a/osu.Game/Rulesets/Judgements/DefaultJudgementPiece.cs b/osu.Game/Rulesets/Judgements/DefaultJudgementPiece.cs index 29b771a81d..c2b27d4ce8 100644 --- a/osu.Game/Rulesets/Judgements/DefaultJudgementPiece.cs +++ b/osu.Game/Rulesets/Judgements/DefaultJudgementPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index d25d46c6e2..0d8b8429d8 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using JetBrains.Annotations; diff --git a/osu.Game/Rulesets/Judgements/IAnimatableJudgement.cs b/osu.Game/Rulesets/Judgements/IAnimatableJudgement.cs index b38b83b534..2bc5a62983 100644 --- a/osu.Game/Rulesets/Judgements/IAnimatableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/IAnimatableJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Graphics; diff --git a/osu.Game/Rulesets/Judgements/IgnoreJudgement.cs b/osu.Game/Rulesets/Judgements/IgnoreJudgement.cs index d2a434058d..f08b43e72a 100644 --- a/osu.Game/Rulesets/Judgements/IgnoreJudgement.cs +++ b/osu.Game/Rulesets/Judgements/IgnoreJudgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Judgements diff --git a/osu.Game/Rulesets/Judgements/Judgement.cs b/osu.Game/Rulesets/Judgements/Judgement.cs index 99dce82ec2..770f656e8f 100644 --- a/osu.Game/Rulesets/Judgements/Judgement.cs +++ b/osu.Game/Rulesets/Judgements/Judgement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game/Rulesets/Judgements/JudgementResult.cs b/osu.Game/Rulesets/Judgements/JudgementResult.cs index e3b2501cdc..2685cb4e2a 100644 --- a/osu.Game/Rulesets/Judgements/JudgementResult.cs +++ b/osu.Game/Rulesets/Judgements/JudgementResult.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; diff --git a/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs b/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs index c8e7284f5d..9307e36b99 100644 --- a/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs +++ b/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Rulesets/Mods/DifficultyBindable.cs b/osu.Game/Rulesets/Mods/DifficultyBindable.cs index 6cfae0b085..eb5f97bcf7 100644 --- a/osu.Game/Rulesets/Mods/DifficultyBindable.cs +++ b/osu.Game/Rulesets/Mods/DifficultyBindable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Game.Beatmaps; diff --git a/osu.Game/Rulesets/Mods/IApplicableAfterBeatmapConversion.cs b/osu.Game/Rulesets/Mods/IApplicableAfterBeatmapConversion.cs index d45311675d..9286f682d1 100644 --- a/osu.Game/Rulesets/Mods/IApplicableAfterBeatmapConversion.cs +++ b/osu.Game/Rulesets/Mods/IApplicableAfterBeatmapConversion.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/IApplicableFailOverride.cs b/osu.Game/Rulesets/Mods/IApplicableFailOverride.cs index 8c99d739cb..d0b54f835b 100644 --- a/osu.Game/Rulesets/Mods/IApplicableFailOverride.cs +++ b/osu.Game/Rulesets/Mods/IApplicableFailOverride.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mods { /// diff --git a/osu.Game/Rulesets/Mods/IApplicableMod.cs b/osu.Game/Rulesets/Mods/IApplicableMod.cs index 8ca1a3f8a5..7675bd89ef 100644 --- a/osu.Game/Rulesets/Mods/IApplicableMod.cs +++ b/osu.Game/Rulesets/Mods/IApplicableMod.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mods { /// diff --git a/osu.Game/Rulesets/Mods/IApplicableToAudio.cs b/osu.Game/Rulesets/Mods/IApplicableToAudio.cs index 901da7af55..de76790aee 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToAudio.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToAudio.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mods { public interface IApplicableToAudio : IApplicableToTrack, IApplicableToSample diff --git a/osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs b/osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs index cff669bf53..278b4794c5 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/IApplicableToBeatmapConverter.cs b/osu.Game/Rulesets/Mods/IApplicableToBeatmapConverter.cs index 8cefb02904..a5ccea1873 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToBeatmapConverter.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToBeatmapConverter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/IApplicableToBeatmapProcessor.cs b/osu.Game/Rulesets/Mods/IApplicableToBeatmapProcessor.cs index e23a5d8d99..c653a674ef 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToBeatmapProcessor.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToBeatmapProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/IApplicableToDifficulty.cs b/osu.Game/Rulesets/Mods/IApplicableToDifficulty.cs index 42b520ab26..1447511de9 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToDifficulty.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToDifficulty.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs b/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs index c8a9ff2f9a..f559ed04d7 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObjects.cs b/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObjects.cs index 7f926dd8b8..8bf2c3810e 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObjects.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObjects.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Extensions.IEnumerableExtensions; diff --git a/osu.Game/Rulesets/Mods/IApplicableToDrawableRuleset.cs b/osu.Game/Rulesets/Mods/IApplicableToDrawableRuleset.cs index b012beb0c0..ace3af62a1 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToDrawableRuleset.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToDrawableRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI; diff --git a/osu.Game/Rulesets/Mods/IApplicableToHUD.cs b/osu.Game/Rulesets/Mods/IApplicableToHUD.cs index 4fb535a0b3..b5fe299b24 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToHUD.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToHUD.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Screens.Play; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/IApplicableToHealthProcessor.cs b/osu.Game/Rulesets/Mods/IApplicableToHealthProcessor.cs index 2676060efa..a58f8640fd 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToHealthProcessor.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToHealthProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/IApplicableToHitObject.cs b/osu.Game/Rulesets/Mods/IApplicableToHitObject.cs index f7f81c92c0..d9fa993393 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToHitObject.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/IApplicableToPlayer.cs b/osu.Game/Rulesets/Mods/IApplicableToPlayer.cs index bf78428470..c28935607f 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToPlayer.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Screens.Play; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/IApplicableToRate.cs b/osu.Game/Rulesets/Mods/IApplicableToRate.cs index f613867132..c66c8f49a1 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToRate.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToRate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mods { /// diff --git a/osu.Game/Rulesets/Mods/IApplicableToSample.cs b/osu.Game/Rulesets/Mods/IApplicableToSample.cs index efd88f2399..97ed0fbf7e 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToSample.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToSample.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Audio; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/IApplicableToScoreProcessor.cs b/osu.Game/Rulesets/Mods/IApplicableToScoreProcessor.cs index b93e50921f..24c1ac9afe 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToScoreProcessor.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToScoreProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; diff --git a/osu.Game/Rulesets/Mods/IApplicableToTrack.cs b/osu.Game/Rulesets/Mods/IApplicableToTrack.cs index deecd4bf1f..358ef71cc0 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToTrack.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToTrack.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Audio; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/ICreateReplay.cs b/osu.Game/Rulesets/Mods/ICreateReplay.cs index 1e5eeca92c..e77f4c49b9 100644 --- a/osu.Game/Rulesets/Mods/ICreateReplay.cs +++ b/osu.Game/Rulesets/Mods/ICreateReplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Game.Beatmaps; diff --git a/osu.Game/Rulesets/Mods/ICreateReplayData.cs b/osu.Game/Rulesets/Mods/ICreateReplayData.cs index 7d208e9000..6058380eb3 100644 --- a/osu.Game/Rulesets/Mods/ICreateReplayData.cs +++ b/osu.Game/Rulesets/Mods/ICreateReplayData.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Rulesets/Mods/IHasSeed.cs b/osu.Game/Rulesets/Mods/IHasSeed.cs index 001a9d214c..fd2161ac09 100644 --- a/osu.Game/Rulesets/Mods/IHasSeed.cs +++ b/osu.Game/Rulesets/Mods/IHasSeed.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/IMod.cs b/osu.Game/Rulesets/Mods/IMod.cs index 30fa1ea8cb..349cc7dd5a 100644 --- a/osu.Game/Rulesets/Mods/IMod.cs +++ b/osu.Game/Rulesets/Mods/IMod.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Rulesets/Mods/IReadFromConfig.cs b/osu.Game/Rulesets/Mods/IReadFromConfig.cs index d66fabce70..ee6fb6364f 100644 --- a/osu.Game/Rulesets/Mods/IReadFromConfig.cs +++ b/osu.Game/Rulesets/Mods/IReadFromConfig.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Configuration; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/IUpdatableByPlayfield.cs b/osu.Game/Rulesets/Mods/IUpdatableByPlayfield.cs index 7cf480a11b..3aad858af5 100644 --- a/osu.Game/Rulesets/Mods/IUpdatableByPlayfield.cs +++ b/osu.Game/Rulesets/Mods/IUpdatableByPlayfield.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/MetronomeBeat.cs b/osu.Game/Rulesets/Mods/MetronomeBeat.cs index 149af1e30a..b26052a37e 100644 --- a/osu.Game/Rulesets/Mods/MetronomeBeat.cs +++ b/osu.Game/Rulesets/Mods/MetronomeBeat.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Bindables; diff --git a/osu.Game/Rulesets/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs index af1550f8a9..17093e3033 100644 --- a/osu.Game/Rulesets/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs index fb291fe10f..2f5707562e 100644 --- a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs +++ b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/Mods/ModAutoplay.cs b/osu.Game/Rulesets/Mods/ModAutoplay.cs index 0ebe11b393..6d786fc8e2 100644 --- a/osu.Game/Rulesets/Mods/ModAutoplay.cs +++ b/osu.Game/Rulesets/Mods/ModAutoplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Rulesets/Mods/ModBarrelRoll.cs b/osu.Game/Rulesets/Mods/ModBarrelRoll.cs index bacb953f76..bd0f2bfe59 100644 --- a/osu.Game/Rulesets/Mods/ModBarrelRoll.cs +++ b/osu.Game/Rulesets/Mods/ModBarrelRoll.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Extensions; diff --git a/osu.Game/Rulesets/Mods/ModBlockFail.cs b/osu.Game/Rulesets/Mods/ModBlockFail.cs index 8a9b0cddc8..a6a8244480 100644 --- a/osu.Game/Rulesets/Mods/ModBlockFail.cs +++ b/osu.Game/Rulesets/Mods/ModBlockFail.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Configuration; using osu.Game.Screens.Play; diff --git a/osu.Game/Rulesets/Mods/ModCinema.cs b/osu.Game/Rulesets/Mods/ModCinema.cs index 99c4e71d1f..6e7bd6350e 100644 --- a/osu.Game/Rulesets/Mods/ModCinema.cs +++ b/osu.Game/Rulesets/Mods/ModCinema.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Rulesets/Mods/ModClassic.cs b/osu.Game/Rulesets/Mods/ModClassic.cs index 1159955e11..b4885ff16e 100644 --- a/osu.Game/Rulesets/Mods/ModClassic.cs +++ b/osu.Game/Rulesets/Mods/ModClassic.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Sprites; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/ModDaycore.cs b/osu.Game/Rulesets/Mods/ModDaycore.cs index 9e8e44229e..262aeb07ac 100644 --- a/osu.Game/Rulesets/Mods/ModDaycore.cs +++ b/osu.Game/Rulesets/Mods/ModDaycore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs b/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs index eefa1531c4..c0e2c75aca 100644 --- a/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs +++ b/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Rulesets/Mods/ModDoubleTime.cs b/osu.Game/Rulesets/Mods/ModDoubleTime.cs index 1c71f5d055..389d0db261 100644 --- a/osu.Game/Rulesets/Mods/ModDoubleTime.cs +++ b/osu.Game/Rulesets/Mods/ModDoubleTime.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; diff --git a/osu.Game/Rulesets/Mods/ModEasy.cs b/osu.Game/Rulesets/Mods/ModEasy.cs index 0f51e2a6d5..bc5988174b 100644 --- a/osu.Game/Rulesets/Mods/ModEasy.cs +++ b/osu.Game/Rulesets/Mods/ModEasy.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; diff --git a/osu.Game/Rulesets/Mods/ModEasyWithExtraLives.cs b/osu.Game/Rulesets/Mods/ModEasyWithExtraLives.cs index 2ac0f59d84..984892de51 100644 --- a/osu.Game/Rulesets/Mods/ModEasyWithExtraLives.cs +++ b/osu.Game/Rulesets/Mods/ModEasyWithExtraLives.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Humanizer; using osu.Framework.Bindables; using osu.Game.Beatmaps; diff --git a/osu.Game/Rulesets/Mods/ModExtensions.cs b/osu.Game/Rulesets/Mods/ModExtensions.cs index b22030414b..ad61404972 100644 --- a/osu.Game/Rulesets/Mods/ModExtensions.cs +++ b/osu.Game/Rulesets/Mods/ModExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Rulesets/Mods/ModFailCondition.cs b/osu.Game/Rulesets/Mods/ModFailCondition.cs index 4425ece513..e24746ebd9 100644 --- a/osu.Game/Rulesets/Mods/ModFailCondition.cs +++ b/osu.Game/Rulesets/Mods/ModFailCondition.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Game.Configuration; diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index b449f3f64d..649d5480bf 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Allocation; diff --git a/osu.Game/Rulesets/Mods/ModHalfTime.cs b/osu.Game/Rulesets/Mods/ModHalfTime.cs index 13d89e30d6..48fa7c13b4 100644 --- a/osu.Game/Rulesets/Mods/ModHalfTime.cs +++ b/osu.Game/Rulesets/Mods/ModHalfTime.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; diff --git a/osu.Game/Rulesets/Mods/ModHardRock.cs b/osu.Game/Rulesets/Mods/ModHardRock.cs index 0a5348a8cf..030520fccc 100644 --- a/osu.Game/Rulesets/Mods/ModHardRock.cs +++ b/osu.Game/Rulesets/Mods/ModHardRock.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; diff --git a/osu.Game/Rulesets/Mods/ModHidden.cs b/osu.Game/Rulesets/Mods/ModHidden.cs index 5a8226115f..35107762aa 100644 --- a/osu.Game/Rulesets/Mods/ModHidden.cs +++ b/osu.Game/Rulesets/Mods/ModHidden.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Graphics; using osu.Framework.Graphics.Sprites; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game/Rulesets/Mods/ModMirror.cs b/osu.Game/Rulesets/Mods/ModMirror.cs index 3c4b7d0c60..00a1d4a9c6 100644 --- a/osu.Game/Rulesets/Mods/ModMirror.cs +++ b/osu.Game/Rulesets/Mods/ModMirror.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mods { public abstract class ModMirror : Mod diff --git a/osu.Game/Rulesets/Mods/ModMuted.cs b/osu.Game/Rulesets/Mods/ModMuted.cs index 84341faab7..88e49f41b0 100644 --- a/osu.Game/Rulesets/Mods/ModMuted.cs +++ b/osu.Game/Rulesets/Mods/ModMuted.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Audio; using osu.Framework.Bindables; diff --git a/osu.Game/Rulesets/Mods/ModNightcore.cs b/osu.Game/Rulesets/Mods/ModNightcore.cs index 7997204450..7c2201cd98 100644 --- a/osu.Game/Rulesets/Mods/ModNightcore.cs +++ b/osu.Game/Rulesets/Mods/ModNightcore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; diff --git a/osu.Game/Rulesets/Mods/ModNoFail.cs b/osu.Game/Rulesets/Mods/ModNoFail.cs index 5ebae17228..27dbb53e6c 100644 --- a/osu.Game/Rulesets/Mods/ModNoFail.cs +++ b/osu.Game/Rulesets/Mods/ModNoFail.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; diff --git a/osu.Game/Rulesets/Mods/ModNoMod.cs b/osu.Game/Rulesets/Mods/ModNoMod.cs index 1009c5bc42..cc0b38cbc0 100644 --- a/osu.Game/Rulesets/Mods/ModNoMod.cs +++ b/osu.Game/Rulesets/Mods/ModNoMod.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Sprites; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Mods/ModNoScope.cs b/osu.Game/Rulesets/Mods/ModNoScope.cs index 7a935eb38f..c43ac33b3f 100644 --- a/osu.Game/Rulesets/Mods/ModNoScope.cs +++ b/osu.Game/Rulesets/Mods/ModNoScope.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Rulesets/Mods/ModPerfect.cs b/osu.Game/Rulesets/Mods/ModPerfect.cs index 9016a24f8d..b6daf54fa0 100644 --- a/osu.Game/Rulesets/Mods/ModPerfect.cs +++ b/osu.Game/Rulesets/Mods/ModPerfect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Rulesets/Mods/ModRandom.cs b/osu.Game/Rulesets/Mods/ModRandom.cs index 1f7742b075..6654bff04b 100644 --- a/osu.Game/Rulesets/Mods/ModRandom.cs +++ b/osu.Game/Rulesets/Mods/ModRandom.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; diff --git a/osu.Game/Rulesets/Mods/ModRateAdjust.cs b/osu.Game/Rulesets/Mods/ModRateAdjust.cs index 7b55ba4ad0..643280623c 100644 --- a/osu.Game/Rulesets/Mods/ModRateAdjust.cs +++ b/osu.Game/Rulesets/Mods/ModRateAdjust.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Audio; using osu.Framework.Bindables; diff --git a/osu.Game/Rulesets/Mods/ModRelax.cs b/osu.Game/Rulesets/Mods/ModRelax.cs index e5995ff180..4829d10ddb 100644 --- a/osu.Game/Rulesets/Mods/ModRelax.cs +++ b/osu.Game/Rulesets/Mods/ModRelax.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; diff --git a/osu.Game/Rulesets/Mods/ModSuddenDeath.cs b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs index c8b835f78a..48ab888a90 100644 --- a/osu.Game/Rulesets/Mods/ModSuddenDeath.cs +++ b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Rulesets/Mods/ModTimeRamp.cs b/osu.Game/Rulesets/Mods/ModTimeRamp.cs index 98abda872b..a1aad3a6b9 100644 --- a/osu.Game/Rulesets/Mods/ModTimeRamp.cs +++ b/osu.Game/Rulesets/Mods/ModTimeRamp.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Audio; diff --git a/osu.Game/Rulesets/Mods/ModType.cs b/osu.Game/Rulesets/Mods/ModType.cs index e3c82e42f5..5a405b7632 100644 --- a/osu.Game/Rulesets/Mods/ModType.cs +++ b/osu.Game/Rulesets/Mods/ModType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mods { public enum ModType diff --git a/osu.Game/Rulesets/Mods/ModWindDown.cs b/osu.Game/Rulesets/Mods/ModWindDown.cs index 08bd44f7bd..2150264a0c 100644 --- a/osu.Game/Rulesets/Mods/ModWindDown.cs +++ b/osu.Game/Rulesets/Mods/ModWindDown.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Rulesets/Mods/ModWindUp.cs b/osu.Game/Rulesets/Mods/ModWindUp.cs index df8f781148..d9ee561ef8 100644 --- a/osu.Game/Rulesets/Mods/ModWindUp.cs +++ b/osu.Game/Rulesets/Mods/ModWindUp.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Rulesets/Mods/ModWithVisibilityAdjustment.cs b/osu.Game/Rulesets/Mods/ModWithVisibilityAdjustment.cs index b58ee5ff36..d84695fff8 100644 --- a/osu.Game/Rulesets/Mods/ModWithVisibilityAdjustment.cs +++ b/osu.Game/Rulesets/Mods/ModWithVisibilityAdjustment.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Bindables; using osu.Game.Beatmaps; diff --git a/osu.Game/Rulesets/Mods/MultiMod.cs b/osu.Game/Rulesets/Mods/MultiMod.cs index 1c41c6b8b3..d62dc34d3b 100644 --- a/osu.Game/Rulesets/Mods/MultiMod.cs +++ b/osu.Game/Rulesets/Mods/MultiMod.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; diff --git a/osu.Game/Rulesets/Mods/UnknownMod.cs b/osu.Game/Rulesets/Mods/UnknownMod.cs index 72de0ad653..e058fba566 100644 --- a/osu.Game/Rulesets/Mods/UnknownMod.cs +++ b/osu.Game/Rulesets/Mods/UnknownMod.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Mods { public class UnknownMod : Mod diff --git a/osu.Game/Rulesets/Objects/BarLineGenerator.cs b/osu.Game/Rulesets/Objects/BarLineGenerator.cs index d71a499119..dec81d9bbd 100644 --- a/osu.Game/Rulesets/Objects/BarLineGenerator.cs +++ b/osu.Game/Rulesets/Objects/BarLineGenerator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/Objects/Drawables/ArmedState.cs b/osu.Game/Rulesets/Objects/Drawables/ArmedState.cs index b2d9f50602..4faf0920d1 100644 --- a/osu.Game/Rulesets/Objects/Drawables/ArmedState.cs +++ b/osu.Game/Rulesets/Objects/Drawables/ArmedState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Objects.Drawables { public enum ArmedState diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 2e573a7f85..39ccaa2e5d 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 57b897e5b5..30b8fe965a 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Collections.Immutable; diff --git a/osu.Game/Rulesets/Objects/HitObjectLifetimeEntry.cs b/osu.Game/Rulesets/Objects/HitObjectLifetimeEntry.cs index 096dad88bd..9af4cf3544 100644 --- a/osu.Game/Rulesets/Objects/HitObjectLifetimeEntry.cs +++ b/osu.Game/Rulesets/Objects/HitObjectLifetimeEntry.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics.Performance; using osu.Game.Rulesets.Judgements; diff --git a/osu.Game/Rulesets/Objects/HitObjectParser.cs b/osu.Game/Rulesets/Objects/HitObjectParser.cs index d3c29d90ce..9728a4393b 100644 --- a/osu.Game/Rulesets/Objects/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/HitObjectParser.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Objects { public abstract class HitObjectParser diff --git a/osu.Game/Rulesets/Objects/IBarLine.cs b/osu.Game/Rulesets/Objects/IBarLine.cs index 14df80e3b9..8cdead6776 100644 --- a/osu.Game/Rulesets/Objects/IBarLine.cs +++ b/osu.Game/Rulesets/Objects/IBarLine.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Objects { /// diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHit.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHit.cs index 12b4812824..9facfec96f 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Types; using osuTK; diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs index 2beb6bdbf2..4861e8b3f7 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osu.Game.Audio; using System.Collections.Generic; diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSlider.cs index fb1afed3b4..62726019bb 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSlider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Types; using osuTK; diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs index 014494ec54..cccb66d92b 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Objects.Legacy.Catch diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObject.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObject.cs index e3b0d8a498..d95f97624d 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObject.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObject.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs index 9ff92fcc75..bd2713a7d1 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs index 0b69817c13..639cacb128 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Objects.Legacy.Mania diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs index 386eb8d3ee..6f1968b41d 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osu.Game.Audio; using System.Collections.Generic; diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHold.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHold.cs index 2fa4766c1d..b6594d0206 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHold.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHold.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Objects.Legacy.Mania diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs index 84cde5fa95..330ebf72c7 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Objects.Legacy.Mania diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSpinner.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSpinner.cs index c05aaceb9c..dcbaf22c51 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSpinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSpinner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Objects.Legacy.Mania diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs index 069366bad3..33b390e3ba 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Types; using osuTK; diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs index cb98721be5..7a88a31bd5 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using System.Collections.Generic; using osu.Game.Audio; diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs index e947690668..2f8e9dd352 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Types; using osuTK; diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs index e9e5ca8c94..d49e9fe9db 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Types; using osuTK; diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs index cb5178ce48..980d37ccd5 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Objects.Legacy.Taiko { /// diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs index 1eafc4e68b..d62e8cd04c 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using System.Collections.Generic; using osu.Game.Audio; diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs index 821554f7ee..a391c8cb43 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Objects.Legacy.Taiko { /// diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSpinner.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSpinner.cs index 1d5ecb1ef3..ec8d7971ec 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSpinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSpinner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Objects.Legacy.Taiko diff --git a/osu.Game/Rulesets/Objects/PathControlPoint.cs b/osu.Game/Rulesets/Objects/PathControlPoint.cs index 53eb430fa3..ae9fa08085 100644 --- a/osu.Game/Rulesets/Objects/PathControlPoint.cs +++ b/osu.Game/Rulesets/Objects/PathControlPoint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Newtonsoft.Json; using osu.Game.Rulesets.Objects.Types; diff --git a/osu.Game/Rulesets/Objects/Pooling/PoolableDrawableWithLifetime.cs b/osu.Game/Rulesets/Objects/Pooling/PoolableDrawableWithLifetime.cs index 9c6097a048..8dc588da9e 100644 --- a/osu.Game/Rulesets/Objects/Pooling/PoolableDrawableWithLifetime.cs +++ b/osu.Game/Rulesets/Objects/Pooling/PoolableDrawableWithLifetime.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Diagnostics; using osu.Framework.Graphics; diff --git a/osu.Game/Rulesets/Objects/Pooling/PooledDrawableWithLifetimeContainer.cs b/osu.Game/Rulesets/Objects/Pooling/PooledDrawableWithLifetimeContainer.cs index d35933dba8..07a80895e6 100644 --- a/osu.Game/Rulesets/Objects/Pooling/PooledDrawableWithLifetimeContainer.cs +++ b/osu.Game/Rulesets/Objects/Pooling/PooledDrawableWithLifetimeContainer.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Collections.Generic; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Rulesets/Objects/SliderEventGenerator.cs b/osu.Game/Rulesets/Objects/SliderEventGenerator.cs index bae5a5e8d9..d32a7cb16d 100644 --- a/osu.Game/Rulesets/Objects/SliderEventGenerator.cs +++ b/osu.Game/Rulesets/Objects/SliderEventGenerator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/Objects/SliderPath.cs b/osu.Game/Rulesets/Objects/SliderPath.cs index e0c62fe359..2285715564 100644 --- a/osu.Game/Rulesets/Objects/SliderPath.cs +++ b/osu.Game/Rulesets/Objects/SliderPath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/osu.Game/Rulesets/Objects/SliderPathExtensions.cs b/osu.Game/Rulesets/Objects/SliderPathExtensions.cs index dd418a1b7b..92a3b570fb 100644 --- a/osu.Game/Rulesets/Objects/SliderPathExtensions.cs +++ b/osu.Game/Rulesets/Objects/SliderPathExtensions.cs @@ -6,8 +6,6 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects.Types; using osuTK; -#nullable enable - namespace osu.Game.Rulesets.Objects { public static class SliderPathExtensions diff --git a/osu.Game/Rulesets/Objects/SyntheticHitObjectEntry.cs b/osu.Game/Rulesets/Objects/SyntheticHitObjectEntry.cs index 76f9eaf25a..ee860e82e2 100644 --- a/osu.Game/Rulesets/Objects/SyntheticHitObjectEntry.cs +++ b/osu.Game/Rulesets/Objects/SyntheticHitObjectEntry.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Objects diff --git a/osu.Game/Rulesets/Objects/Types/IHasColumn.cs b/osu.Game/Rulesets/Objects/Types/IHasColumn.cs index dc07cfbb6a..3978a7e765 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasColumn.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasColumn.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Objects.Types { /// diff --git a/osu.Game/Rulesets/Objects/Types/IHasCombo.cs b/osu.Game/Rulesets/Objects/Types/IHasCombo.cs index d1a4683a1d..d02b97a3e4 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasCombo.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasCombo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Objects.Types { /// diff --git a/osu.Game/Rulesets/Objects/Types/IHasComboInformation.cs b/osu.Game/Rulesets/Objects/Types/IHasComboInformation.cs index 29a56fc625..b45ea989f3 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasComboInformation.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasComboInformation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Skinning; using osuTK.Graphics; diff --git a/osu.Game/Rulesets/Objects/Types/IHasDisplayColour.cs b/osu.Game/Rulesets/Objects/Types/IHasDisplayColour.cs index 8807b802d8..89ee5022bf 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasDisplayColour.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasDisplayColour.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osuTK.Graphics; diff --git a/osu.Game/Rulesets/Objects/Types/IHasDistance.cs b/osu.Game/Rulesets/Objects/Types/IHasDistance.cs index b497ca5da3..549abc046a 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasDistance.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasDistance.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Objects.Types { /// diff --git a/osu.Game/Rulesets/Objects/Types/IHasDuration.cs b/osu.Game/Rulesets/Objects/Types/IHasDuration.cs index ca734da5ad..06ed8eba76 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasDuration.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasDuration.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Objects.Types { /// diff --git a/osu.Game/Rulesets/Objects/Types/IHasHold.cs b/osu.Game/Rulesets/Objects/Types/IHasHold.cs index 469b8b7892..91b05dc3fd 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasHold.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasHold.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Objects.Types { /// diff --git a/osu.Game/Rulesets/Objects/Types/IHasLegacyLastTickOffset.cs b/osu.Game/Rulesets/Objects/Types/IHasLegacyLastTickOffset.cs index caf22c3023..dfc526383a 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasLegacyLastTickOffset.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasLegacyLastTickOffset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Objects.Types { /// diff --git a/osu.Game/Rulesets/Objects/Types/IHasPath.cs b/osu.Game/Rulesets/Objects/Types/IHasPath.cs index 567c24a4a2..46834a55dd 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasPath.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasPath.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Objects.Types { public interface IHasPath : IHasDistance diff --git a/osu.Game/Rulesets/Objects/Types/IHasPathWithRepeats.cs b/osu.Game/Rulesets/Objects/Types/IHasPathWithRepeats.cs index 279946b44e..536707e95f 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasPathWithRepeats.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasPathWithRepeats.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; namespace osu.Game.Rulesets.Objects.Types diff --git a/osu.Game/Rulesets/Objects/Types/IHasPosition.cs b/osu.Game/Rulesets/Objects/Types/IHasPosition.cs index 8948fe59a9..281f619ba5 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasPosition.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasPosition.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; namespace osu.Game.Rulesets.Objects.Types diff --git a/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs b/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs index 2a4215b960..821a6de520 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Audio; using System.Collections.Generic; diff --git a/osu.Game/Rulesets/Objects/Types/IHasXPosition.cs b/osu.Game/Rulesets/Objects/Types/IHasXPosition.cs index 7e55b21050..f688c783e1 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasXPosition.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasXPosition.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Objects.Types { /// diff --git a/osu.Game/Rulesets/Objects/Types/IHasYPosition.cs b/osu.Game/Rulesets/Objects/Types/IHasYPosition.cs index d2561b10a7..3c0cc595fb 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasYPosition.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasYPosition.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Objects.Types { /// diff --git a/osu.Game/Rulesets/Objects/Types/PathType.cs b/osu.Game/Rulesets/Objects/Types/PathType.cs index 923ce9eba4..266a3de6ec 100644 --- a/osu.Game/Rulesets/Objects/Types/PathType.cs +++ b/osu.Game/Rulesets/Objects/Types/PathType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Objects.Types { public enum PathType diff --git a/osu.Game/Rulesets/RealmRulesetStore.cs b/osu.Game/Rulesets/RealmRulesetStore.cs index f42bf06da4..62a7a13c07 100644 --- a/osu.Game/Rulesets/RealmRulesetStore.cs +++ b/osu.Game/Rulesets/RealmRulesetStore.cs @@ -9,8 +9,6 @@ using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Database; -#nullable enable - namespace osu.Game.Rulesets { public class RealmRulesetStore : RulesetStore diff --git a/osu.Game/Rulesets/Replays/AutoGenerator.cs b/osu.Game/Rulesets/Replays/AutoGenerator.cs index 83e85146d4..7fab84eba8 100644 --- a/osu.Game/Rulesets/Replays/AutoGenerator.cs +++ b/osu.Game/Rulesets/Replays/AutoGenerator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs index f889d15485..09a090483d 100644 --- a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs +++ b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/Replays/ReplayFrame.cs b/osu.Game/Rulesets/Replays/ReplayFrame.cs index 2b67b60d8f..433be6e4b7 100644 --- a/osu.Game/Rulesets/Replays/ReplayFrame.cs +++ b/osu.Game/Rulesets/Replays/ReplayFrame.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using MessagePack; using osu.Game.Online.Spectator; diff --git a/osu.Game/Rulesets/Replays/Types/IConvertibleReplayFrame.cs b/osu.Game/Rulesets/Replays/Types/IConvertibleReplayFrame.cs index d9aa615c6e..6753a23bca 100644 --- a/osu.Game/Rulesets/Replays/Types/IConvertibleReplayFrame.cs +++ b/osu.Game/Rulesets/Replays/Types/IConvertibleReplayFrame.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Replays.Legacy; diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index 9dec6984ea..8bde71dcd7 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Concurrent; using System.Collections.Generic; diff --git a/osu.Game/Rulesets/RulesetConfigCache.cs b/osu.Game/Rulesets/RulesetConfigCache.cs index c4f1933cd8..017214df61 100644 --- a/osu.Game/Rulesets/RulesetConfigCache.cs +++ b/osu.Game/Rulesets/RulesetConfigCache.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Graphics; diff --git a/osu.Game/Rulesets/RulesetInfo.cs b/osu.Game/Rulesets/RulesetInfo.cs index 88e3988431..b5e5fa1561 100644 --- a/osu.Game/Rulesets/RulesetInfo.cs +++ b/osu.Game/Rulesets/RulesetInfo.cs @@ -6,8 +6,6 @@ using JetBrains.Annotations; using osu.Framework.Testing; using Realms; -#nullable enable - namespace osu.Game.Rulesets { [ExcludeFromDynamicCompile] diff --git a/osu.Game/Rulesets/RulesetLoadException.cs b/osu.Game/Rulesets/RulesetLoadException.cs index 7c3a4bb75d..6fee8f446b 100644 --- a/osu.Game/Rulesets/RulesetLoadException.cs +++ b/osu.Game/Rulesets/RulesetLoadException.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Rulesets diff --git a/osu.Game/Rulesets/RulesetSelector.cs b/osu.Game/Rulesets/RulesetSelector.cs index 8e6ec556d2..35244eb86e 100644 --- a/osu.Game/Rulesets/RulesetSelector.cs +++ b/osu.Game/Rulesets/RulesetSelector.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.UserInterface; using osu.Framework.Allocation; diff --git a/osu.Game/Rulesets/RulesetStore.cs b/osu.Game/Rulesets/RulesetStore.cs index 6f88d97a58..6b3e43cc1c 100644 --- a/osu.Game/Rulesets/RulesetStore.cs +++ b/osu.Game/Rulesets/RulesetStore.cs @@ -10,8 +10,6 @@ using osu.Framework; using osu.Framework.Logging; using osu.Framework.Platform; -#nullable enable - namespace osu.Game.Rulesets { public abstract class RulesetStore : IDisposable, IRulesetStore diff --git a/osu.Game/Rulesets/Scoring/AccumulatingHealthProcessor.cs b/osu.Game/Rulesets/Scoring/AccumulatingHealthProcessor.cs index 5dfb5167f4..c6b9d227af 100644 --- a/osu.Game/Rulesets/Scoring/AccumulatingHealthProcessor.cs +++ b/osu.Game/Rulesets/Scoring/AccumulatingHealthProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.Scoring { /// diff --git a/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs b/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs index e7bb6d79f8..65af161393 100644 --- a/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs +++ b/osu.Game/Rulesets/Scoring/DrainingHealthProcessor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/Scoring/HealthProcessor.cs b/osu.Game/Rulesets/Scoring/HealthProcessor.cs index 0f51560476..0a1e6b729f 100644 --- a/osu.Game/Rulesets/Scoring/HealthProcessor.cs +++ b/osu.Game/Rulesets/Scoring/HealthProcessor.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using osu.Framework.Bindables; using osu.Framework.Utils; diff --git a/osu.Game/Rulesets/Scoring/HitEvent.cs b/osu.Game/Rulesets/Scoring/HitEvent.cs index 0ebbec62ba..cabbf40a7d 100644 --- a/osu.Game/Rulesets/Scoring/HitEvent.cs +++ b/osu.Game/Rulesets/Scoring/HitEvent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Game.Rulesets.Objects; using osuTK; diff --git a/osu.Game/Rulesets/Scoring/HitEventExtensions.cs b/osu.Game/Rulesets/Scoring/HitEventExtensions.cs index fea13cf4b6..2fde73d5a2 100644 --- a/osu.Game/Rulesets/Scoring/HitEventExtensions.cs +++ b/osu.Game/Rulesets/Scoring/HitEventExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/Scoring/HitResult.cs b/osu.Game/Rulesets/Scoring/HitResult.cs index 9f03c381ee..bfa256fc20 100644 --- a/osu.Game/Rulesets/Scoring/HitResult.cs +++ b/osu.Game/Rulesets/Scoring/HitResult.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.ComponentModel; using System.Diagnostics; diff --git a/osu.Game/Rulesets/Scoring/HitWindows.cs b/osu.Game/Rulesets/Scoring/HitWindows.cs index 2d008b58ba..99129fcf96 100644 --- a/osu.Game/Rulesets/Scoring/HitWindows.cs +++ b/osu.Game/Rulesets/Scoring/HitWindows.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Rulesets/Scoring/JudgementProcessor.cs b/osu.Game/Rulesets/Scoring/JudgementProcessor.cs index bfa67b8c45..12fe0056bb 100644 --- a/osu.Game/Rulesets/Scoring/JudgementProcessor.cs +++ b/osu.Game/Rulesets/Scoring/JudgementProcessor.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using osu.Framework.Bindables; using osu.Framework.Extensions.ObjectExtensions; diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index df094ddb7c..56bbe031e6 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Rulesets/Timing/MultiplierControlPoint.cs b/osu.Game/Rulesets/Timing/MultiplierControlPoint.cs index 23325bcd13..1e80bd165b 100644 --- a/osu.Game/Rulesets/Timing/MultiplierControlPoint.cs +++ b/osu.Game/Rulesets/Timing/MultiplierControlPoint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index be1105e7ff..95cb02c477 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/UI/DrawableRulesetDependencies.cs b/osu.Game/Rulesets/UI/DrawableRulesetDependencies.cs index 53996b6b84..6a7369a150 100644 --- a/osu.Game/Rulesets/UI/DrawableRulesetDependencies.cs +++ b/osu.Game/Rulesets/UI/DrawableRulesetDependencies.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/Rulesets/UI/FrameStabilityContainer.cs b/osu.Game/Rulesets/UI/FrameStabilityContainer.cs index f2dbb1a23f..dcd7141419 100644 --- a/osu.Game/Rulesets/UI/FrameStabilityContainer.cs +++ b/osu.Game/Rulesets/UI/FrameStabilityContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/UI/GameplayCursorContainer.cs b/osu.Game/Rulesets/UI/GameplayCursorContainer.cs index ae5f9c6111..3149b7f890 100644 --- a/osu.Game/Rulesets/UI/GameplayCursorContainer.cs +++ b/osu.Game/Rulesets/UI/GameplayCursorContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; diff --git a/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs b/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs index 6b5cdc4ddf..fd8fcfddab 100644 --- a/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs +++ b/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Graphics.Containers; using osu.Game.Audio; diff --git a/osu.Game/Rulesets/UI/HitObjectContainer.cs b/osu.Game/Rulesets/UI/HitObjectContainer.cs index fee77af0ba..589b585643 100644 --- a/osu.Game/Rulesets/UI/HitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/HitObjectContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/UI/IFrameStableClock.cs b/osu.Game/Rulesets/UI/IFrameStableClock.cs index 569ef5e06c..132605adaf 100644 --- a/osu.Game/Rulesets/UI/IFrameStableClock.cs +++ b/osu.Game/Rulesets/UI/IFrameStableClock.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Timing; diff --git a/osu.Game/Rulesets/UI/IHitObjectContainer.cs b/osu.Game/Rulesets/UI/IHitObjectContainer.cs index 4c784132e8..74fd7dee81 100644 --- a/osu.Game/Rulesets/UI/IHitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/IHitObjectContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Objects.Drawables; diff --git a/osu.Game/Rulesets/UI/IPooledHitObjectProvider.cs b/osu.Game/Rulesets/UI/IPooledHitObjectProvider.cs index 2d700076d6..b842e708b0 100644 --- a/osu.Game/Rulesets/UI/IPooledHitObjectProvider.cs +++ b/osu.Game/Rulesets/UI/IPooledHitObjectProvider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; diff --git a/osu.Game/Rulesets/UI/JudgementContainer.cs b/osu.Game/Rulesets/UI/JudgementContainer.cs index f1a68a0323..4336977aa8 100644 --- a/osu.Game/Rulesets/UI/JudgementContainer.cs +++ b/osu.Game/Rulesets/UI/JudgementContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Judgements; diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 79bada0490..0f21a497b0 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osuTK.Graphics; using osu.Framework.Allocation; diff --git a/osu.Game/Rulesets/UI/ModSwitchSmall.cs b/osu.Game/Rulesets/UI/ModSwitchSmall.cs index 676bbac95c..1b777f3e88 100644 --- a/osu.Game/Rulesets/UI/ModSwitchSmall.cs +++ b/osu.Game/Rulesets/UI/ModSwitchSmall.cs @@ -13,8 +13,6 @@ using osu.Game.Rulesets.Mods; using osuTK; using osuTK.Graphics; -#nullable enable - namespace osu.Game.Rulesets.UI { public class ModSwitchSmall : CompositeDrawable diff --git a/osu.Game/Rulesets/UI/ModSwitchTiny.cs b/osu.Game/Rulesets/UI/ModSwitchTiny.cs index b1d453f588..1bb0fe535f 100644 --- a/osu.Game/Rulesets/UI/ModSwitchTiny.cs +++ b/osu.Game/Rulesets/UI/ModSwitchTiny.cs @@ -14,8 +14,6 @@ using osu.Game.Rulesets.Mods; using osuTK; using osuTK.Graphics; -#nullable enable - namespace osu.Game.Rulesets.UI { public class ModSwitchTiny : CompositeDrawable diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index ea5ffb10c6..60d1555052 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Rulesets/UI/PlayfieldAdjustmentContainer.cs b/osu.Game/Rulesets/UI/PlayfieldAdjustmentContainer.cs index fff4a450e5..d0e79281a7 100644 --- a/osu.Game/Rulesets/UI/PlayfieldAdjustmentContainer.cs +++ b/osu.Game/Rulesets/UI/PlayfieldAdjustmentContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Rulesets/UI/PlayfieldBorder.cs b/osu.Game/Rulesets/UI/PlayfieldBorder.cs index 458b88c6db..a129760ef3 100644 --- a/osu.Game/Rulesets/UI/PlayfieldBorder.cs +++ b/osu.Game/Rulesets/UI/PlayfieldBorder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Rulesets/UI/PlayfieldBorderStyle.cs b/osu.Game/Rulesets/UI/PlayfieldBorderStyle.cs index 0a0aad884e..a4a483e930 100644 --- a/osu.Game/Rulesets/UI/PlayfieldBorderStyle.cs +++ b/osu.Game/Rulesets/UI/PlayfieldBorderStyle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.UI { public enum PlayfieldBorderStyle diff --git a/osu.Game/Rulesets/UI/ReplayRecorder.cs b/osu.Game/Rulesets/UI/ReplayRecorder.cs index dcd8f12028..b04807e475 100644 --- a/osu.Game/Rulesets/UI/ReplayRecorder.cs +++ b/osu.Game/Rulesets/UI/ReplayRecorder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index b5390eb6e2..f1ed23bb21 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Rulesets/UI/Scrolling/Algorithms/ConstantScrollAlgorithm.cs b/osu.Game/Rulesets/UI/Scrolling/Algorithms/ConstantScrollAlgorithm.cs index ab6e07f424..0bd8aa64c9 100644 --- a/osu.Game/Rulesets/UI/Scrolling/Algorithms/ConstantScrollAlgorithm.cs +++ b/osu.Game/Rulesets/UI/Scrolling/Algorithms/ConstantScrollAlgorithm.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.UI.Scrolling.Algorithms { public class ConstantScrollAlgorithm : IScrollAlgorithm diff --git a/osu.Game/Rulesets/UI/Scrolling/Algorithms/IScrollAlgorithm.cs b/osu.Game/Rulesets/UI/Scrolling/Algorithms/IScrollAlgorithm.cs index c394a05bcc..d2fb9e3531 100644 --- a/osu.Game/Rulesets/UI/Scrolling/Algorithms/IScrollAlgorithm.cs +++ b/osu.Game/Rulesets/UI/Scrolling/Algorithms/IScrollAlgorithm.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.UI.Scrolling.Algorithms { public interface IScrollAlgorithm diff --git a/osu.Game/Rulesets/UI/Scrolling/Algorithms/OverlappingScrollAlgorithm.cs b/osu.Game/Rulesets/UI/Scrolling/Algorithms/OverlappingScrollAlgorithm.cs index 7b827e0c63..d41117bce8 100644 --- a/osu.Game/Rulesets/UI/Scrolling/Algorithms/OverlappingScrollAlgorithm.cs +++ b/osu.Game/Rulesets/UI/Scrolling/Algorithms/OverlappingScrollAlgorithm.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Lists; using osu.Game.Rulesets.Timing; diff --git a/osu.Game/Rulesets/UI/Scrolling/Algorithms/SequentialScrollAlgorithm.cs b/osu.Game/Rulesets/UI/Scrolling/Algorithms/SequentialScrollAlgorithm.cs index 45d3b3bcd4..bfddc22573 100644 --- a/osu.Game/Rulesets/UI/Scrolling/Algorithms/SequentialScrollAlgorithm.cs +++ b/osu.Game/Rulesets/UI/Scrolling/Algorithms/SequentialScrollAlgorithm.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs b/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs index 926f2fd539..d8a8a6ccd8 100644 --- a/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs +++ b/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/UI/Scrolling/IScrollingInfo.cs b/osu.Game/Rulesets/UI/Scrolling/IScrollingInfo.cs index cd85932599..e00f0ffe5d 100644 --- a/osu.Game/Rulesets/UI/Scrolling/IScrollingInfo.cs +++ b/osu.Game/Rulesets/UI/Scrolling/IScrollingInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI.Scrolling.Algorithms; diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs index 81e1a6c916..58bb80accd 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Rulesets.UI.Scrolling { public enum ScrollingDirection diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs index 3b15bc2cdf..0ed3ca1e63 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Diagnostics; using osu.Framework.Allocation; diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index 782255733f..078f06b745 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Rulesets.Objects.Drawables; diff --git a/osu.Game/Scoring/EFScoreInfo.cs b/osu.Game/Scoring/EFScoreInfo.cs index 4161336cfc..8a5bbbf0da 100644 --- a/osu.Game/Scoring/EFScoreInfo.cs +++ b/osu.Game/Scoring/EFScoreInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; diff --git a/osu.Game/Scoring/HitResultDisplayStatistic.cs b/osu.Game/Scoring/HitResultDisplayStatistic.cs index d43d8bf0ba..4603ff053e 100644 --- a/osu.Game/Scoring/HitResultDisplayStatistic.cs +++ b/osu.Game/Scoring/HitResultDisplayStatistic.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Scoring diff --git a/osu.Game/Scoring/IScoreInfo.cs b/osu.Game/Scoring/IScoreInfo.cs index b4ad183cd3..289679a724 100644 --- a/osu.Game/Scoring/IScoreInfo.cs +++ b/osu.Game/Scoring/IScoreInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Beatmaps; using osu.Game.Database; diff --git a/osu.Game/Scoring/Legacy/DatabasedLegacyScoreDecoder.cs b/osu.Game/Scoring/Legacy/DatabasedLegacyScoreDecoder.cs index 03e13455f0..8908163646 100644 --- a/osu.Game/Scoring/Legacy/DatabasedLegacyScoreDecoder.cs +++ b/osu.Game/Scoring/Legacy/DatabasedLegacyScoreDecoder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Rulesets; diff --git a/osu.Game/Scoring/Legacy/LegacyScoreDecoder.cs b/osu.Game/Scoring/Legacy/LegacyScoreDecoder.cs index 754ace82c5..f64e730c06 100644 --- a/osu.Game/Scoring/Legacy/LegacyScoreDecoder.cs +++ b/osu.Game/Scoring/Legacy/LegacyScoreDecoder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs b/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs index ae9afbf32e..85cf463a13 100644 --- a/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs +++ b/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.IO; using System.Linq; diff --git a/osu.Game/Scoring/Legacy/ScoreInfoExtensions.cs b/osu.Game/Scoring/Legacy/ScoreInfoExtensions.cs index a11cd5fcbd..0219111e5c 100644 --- a/osu.Game/Scoring/Legacy/ScoreInfoExtensions.cs +++ b/osu.Game/Scoring/Legacy/ScoreInfoExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Scoring; namespace osu.Game.Scoring.Legacy diff --git a/osu.Game/Scoring/LegacyDatabasedScore.cs b/osu.Game/Scoring/LegacyDatabasedScore.cs index ac444c1bf3..de35cb5faf 100644 --- a/osu.Game/Scoring/LegacyDatabasedScore.cs +++ b/osu.Game/Scoring/LegacyDatabasedScore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.IO.Stores; diff --git a/osu.Game/Scoring/Score.cs b/osu.Game/Scoring/Score.cs index 83e4389dc8..06bc3edd37 100644 --- a/osu.Game/Scoring/Score.cs +++ b/osu.Game/Scoring/Score.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Replays; using osu.Game.Utils; diff --git a/osu.Game/Scoring/ScoreFileInfo.cs b/osu.Game/Scoring/ScoreFileInfo.cs index 8acc98eff6..6c3509bccd 100644 --- a/osu.Game/Scoring/ScoreFileInfo.cs +++ b/osu.Game/Scoring/ScoreFileInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel.DataAnnotations; using osu.Game.Database; using osu.Game.IO; diff --git a/osu.Game/Scoring/ScoreImporter.cs b/osu.Game/Scoring/ScoreImporter.cs index 7d1aa4b01d..f59ffc7c94 100644 --- a/osu.Game/Scoring/ScoreImporter.cs +++ b/osu.Game/Scoring/ScoreImporter.cs @@ -15,8 +15,6 @@ using osu.Game.Rulesets; using osu.Game.Scoring.Legacy; using Realms; -#nullable enable - namespace osu.Game.Scoring { public class ScoreImporter : RealmArchiveModelImporter diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index d7185a1677..cbe9615380 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -20,8 +20,6 @@ using osu.Game.Users; using osu.Game.Utils; using Realms; -#nullable enable - namespace osu.Game.Scoring { [ExcludeFromDynamicCompile] diff --git a/osu.Game/Scoring/ScoreInfoExtensions.cs b/osu.Game/Scoring/ScoreInfoExtensions.cs index 2279337fef..7979ca8aaa 100644 --- a/osu.Game/Scoring/ScoreInfoExtensions.cs +++ b/osu.Game/Scoring/ScoreInfoExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; namespace osu.Game.Scoring diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 4627ca414a..7ccf7a58b8 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Scoring/ScoreModelDownloader.cs b/osu.Game/Scoring/ScoreModelDownloader.cs index 514b7a57de..8625c6c5d0 100644 --- a/osu.Game/Scoring/ScoreModelDownloader.cs +++ b/osu.Game/Scoring/ScoreModelDownloader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Database; using osu.Game.Extensions; using osu.Game.Online.API; diff --git a/osu.Game/Scoring/ScorePerformanceCache.cs b/osu.Game/Scoring/ScorePerformanceCache.cs index e15d59e648..f51fb41497 100644 --- a/osu.Game/Scoring/ScorePerformanceCache.cs +++ b/osu.Game/Scoring/ScorePerformanceCache.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading; using System.Threading.Tasks; diff --git a/osu.Game/Scoring/ScoreRank.cs b/osu.Game/Scoring/ScoreRank.cs index 64f7da9ba3..9de8561b4a 100644 --- a/osu.Game/Scoring/ScoreRank.cs +++ b/osu.Game/Scoring/ScoreRank.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Scoring/ScoringValues.cs b/osu.Game/Scoring/ScoringValues.cs index d31cd7c68b..9bc4e6e12a 100644 --- a/osu.Game/Scoring/ScoringValues.cs +++ b/osu.Game/Scoring/ScoringValues.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using MessagePack; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; diff --git a/osu.Game/Screens/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index 6084ec4b01..8e1fd63040 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Screens; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/BackgroundScreenStack.cs b/osu.Game/Screens/BackgroundScreenStack.cs index 9f562a618e..bafd1ff348 100644 --- a/osu.Game/Screens/BackgroundScreenStack.cs +++ b/osu.Game/Screens/BackgroundScreenStack.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Screens; diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 65bc9cfaea..ca05c8af46 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBlack.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBlack.cs index d946fd41d9..4b0f262ab1 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBlack.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBlack.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Screens; diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs index 49c7934ed9..3dd72685e9 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Graphics.Backgrounds; namespace osu.Game.Screens.Backgrounds diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 452f033dcc..95bcb2ab29 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Edit/BindableBeatDivisor.cs b/osu.Game/Screens/Edit/BindableBeatDivisor.cs index 8f430dce77..a7faf961cf 100644 --- a/osu.Game/Screens/Edit/BindableBeatDivisor.cs +++ b/osu.Game/Screens/Edit/BindableBeatDivisor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Bindables; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Edit/BottomBar.cs b/osu.Game/Screens/Edit/BottomBar.cs index 62caaced89..444911cf2d 100644 --- a/osu.Game/Screens/Edit/BottomBar.cs +++ b/osu.Game/Screens/Edit/BottomBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/ClipboardContent.cs b/osu.Game/Screens/Edit/ClipboardContent.cs index 0348a7c15d..a39b24e7bb 100644 --- a/osu.Game/Screens/Edit/ClipboardContent.cs +++ b/osu.Game/Screens/Edit/ClipboardContent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; diff --git a/osu.Game/Screens/Edit/Components/BottomBarContainer.cs b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs index 3c63da3a4a..482a0bbe5f 100644 --- a/osu.Game/Screens/Edit/Components/BottomBarContainer.cs +++ b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio.Track; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Edit/Components/CircularButton.cs b/osu.Game/Screens/Edit/Components/CircularButton.cs index 40b5ac663a..74e4162102 100644 --- a/osu.Game/Screens/Edit/Components/CircularButton.cs +++ b/osu.Game/Screens/Edit/Components/CircularButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Graphics.UserInterface; using osuTK; diff --git a/osu.Game/Screens/Edit/Components/EditorSidebar.cs b/osu.Game/Screens/Edit/Components/EditorSidebar.cs index 4e9b1d5222..da15512cdc 100644 --- a/osu.Game/Screens/Edit/Components/EditorSidebar.cs +++ b/osu.Game/Screens/Edit/Components/EditorSidebar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Edit/Components/EditorSidebarSection.cs b/osu.Game/Screens/Edit/Components/EditorSidebarSection.cs index 3871720562..6782b2f357 100644 --- a/osu.Game/Screens/Edit/Components/EditorSidebarSection.cs +++ b/osu.Game/Screens/Edit/Components/EditorSidebarSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Edit/Components/Menus/DifficultyMenuItem.cs b/osu.Game/Screens/Edit/Components/Menus/DifficultyMenuItem.cs index f17fe4c3ce..ec1e621491 100644 --- a/osu.Game/Screens/Edit/Components/Menus/DifficultyMenuItem.cs +++ b/osu.Game/Screens/Edit/Components/Menus/DifficultyMenuItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; diff --git a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs index 20b8bba6da..8321fde171 100644 --- a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs +++ b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Screens/Edit/Components/Menus/EditorMenuItem.cs b/osu.Game/Screens/Edit/Components/Menus/EditorMenuItem.cs index 0a2c073dcd..1085f2c277 100644 --- a/osu.Game/Screens/Edit/Components/Menus/EditorMenuItem.cs +++ b/osu.Game/Screens/Edit/Components/Menus/EditorMenuItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Screens/Edit/Components/Menus/EditorMenuItemSpacer.cs b/osu.Game/Screens/Edit/Components/Menus/EditorMenuItemSpacer.cs index 4e75a92e19..6af3b99017 100644 --- a/osu.Game/Screens/Edit/Components/Menus/EditorMenuItemSpacer.cs +++ b/osu.Game/Screens/Edit/Components/Menus/EditorMenuItemSpacer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Screens.Edit.Components.Menus { public class EditorMenuItemSpacer : EditorMenuItem diff --git a/osu.Game/Screens/Edit/Components/Menus/EditorScreenSwitcherControl.cs b/osu.Game/Screens/Edit/Components/Menus/EditorScreenSwitcherControl.cs index 8b868a4649..0bba5a79ab 100644 --- a/osu.Game/Screens/Edit/Components/Menus/EditorScreenSwitcherControl.cs +++ b/osu.Game/Screens/Edit/Components/Menus/EditorScreenSwitcherControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index d1a999c2d1..30316cb12c 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osuTK; using osuTK.Graphics; diff --git a/osu.Game/Screens/Edit/Components/RadioButtons/EditorRadioButton.cs b/osu.Game/Screens/Edit/Components/RadioButtons/EditorRadioButton.cs index d66856ebd8..82e94dc862 100644 --- a/osu.Game/Screens/Edit/Components/RadioButtons/EditorRadioButton.cs +++ b/osu.Game/Screens/Edit/Components/RadioButtons/EditorRadioButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Screens/Edit/Components/RadioButtons/EditorRadioButtonCollection.cs b/osu.Game/Screens/Edit/Components/RadioButtons/EditorRadioButtonCollection.cs index 6a7b0c9ef7..b8d1cca061 100644 --- a/osu.Game/Screens/Edit/Components/RadioButtons/EditorRadioButtonCollection.cs +++ b/osu.Game/Screens/Edit/Components/RadioButtons/EditorRadioButtonCollection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Components/RadioButtons/RadioButton.cs b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButton.cs index ca79dd15d7..03745ce19d 100644 --- a/osu.Game/Screens/Edit/Components/RadioButtons/RadioButton.cs +++ b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Components/TernaryButtons/DrawableTernaryButton.cs b/osu.Game/Screens/Edit/Components/TernaryButtons/DrawableTernaryButton.cs index c43561eaa7..82a9db956a 100644 --- a/osu.Game/Screens/Edit/Components/TernaryButtons/DrawableTernaryButton.cs +++ b/osu.Game/Screens/Edit/Components/TernaryButtons/DrawableTernaryButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Components/TernaryButtons/TernaryButton.cs b/osu.Game/Screens/Edit/Components/TernaryButtons/TernaryButton.cs index 7f64695bde..8eb781c947 100644 --- a/osu.Game/Screens/Edit/Components/TernaryButtons/TernaryButton.cs +++ b/osu.Game/Screens/Edit/Components/TernaryButtons/TernaryButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs index bd5377e578..7051dd226c 100644 --- a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs +++ b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BookmarkPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BookmarkPart.cs index 8298cf4773..058aa83b97 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BookmarkPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BookmarkPart.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs index 3d535ec915..4dbec880dc 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Beatmaps.Timing; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs index f1edb7dc7e..4e2c018330 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Specialized; using System.Linq; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointVisualisation.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointVisualisation.cs index 41716f9c23..89c0309222 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointVisualisation.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointVisualisation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/EffectPointVisualisation.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/EffectPointVisualisation.cs index 7c14152b3d..b2007273e8 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/EffectPointVisualisation.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/EffectPointVisualisation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/GroupVisualisation.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/GroupVisualisation.cs index 88587399f2..cccb646ba4 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/GroupVisualisation.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/GroupVisualisation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/IControlPointVisualisation.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/IControlPointVisualisation.cs index c81f1828f7..b9e2a969a5 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/IControlPointVisualisation.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/IControlPointVisualisation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps.ControlPoints; namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs index d551333616..c00ebb32bc 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs index 5aba81aa7d..c1ae2ff8d1 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Audio.Track; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs index 1706c47c96..afaedee0a9 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/TestGameplayButton.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/TestGameplayButton.cs index 99cdc014aa..d38596b9be 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/TestGameplayButton.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/TestGameplayButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Visualisations/DurationVisualisation.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Visualisations/DurationVisualisation.cs index ec68bf9c00..88e40cb305 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Visualisations/DurationVisualisation.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Visualisations/DurationVisualisation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Visualisations/PointVisualisation.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Visualisations/PointVisualisation.cs index a4b6b0c392..b8e55c8db8 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Visualisations/PointVisualisation.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Visualisations/PointVisualisation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs index bf4d70baa6..6a94fce78a 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorPresetCollection.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorPresetCollection.cs index 4616669c6d..67b346fb64 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorPresetCollection.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorPresetCollection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorType.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorType.cs index 4a25144881..ebdb030e76 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorType.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Screens.Edit.Compose.Components { public enum BeatDivisorType diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index fbec80a63b..c7bf23865b 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index 771612fcf1..98079116cd 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs index 0be2cb4462..ba43704a5f 100644 --- a/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using Humanizer; diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index 1f64a50c02..69c7fc2775 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Edit/Compose/Components/DragBox.cs b/osu.Game/Screens/Edit/Compose/Components/DragBox.cs index ecbac82db0..838562719d 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DragBox.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DragBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Edit/Compose/Components/EditorBlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/EditorBlueprintContainer.cs index 22b211f257..6a4fe27f04 100644 --- a/osu.Game/Screens/Edit/Compose/Components/EditorBlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/EditorBlueprintContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs index 7f693996a4..1c9faadda1 100644 --- a/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs +++ b/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Edit/Compose/Components/HitObjectOrderedSelectionContainer.cs b/osu.Game/Screens/Edit/Compose/Components/HitObjectOrderedSelectionContainer.cs index 3fc26fa974..06af232111 100644 --- a/osu.Game/Screens/Edit/Compose/Components/HitObjectOrderedSelectionContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/HitObjectOrderedSelectionContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Edit/Compose/Components/MoveSelectionEvent.cs b/osu.Game/Screens/Edit/Compose/Components/MoveSelectionEvent.cs index 2b71bb2f16..46d948f8b6 100644 --- a/osu.Game/Screens/Edit/Compose/Components/MoveSelectionEvent.cs +++ b/osu.Game/Screens/Edit/Compose/Components/MoveSelectionEvent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Edit; using osuTK; diff --git a/osu.Game/Screens/Edit/Compose/Components/RectangularPositionSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/RectangularPositionSnapGrid.cs index f0d26c7b6a..64fb2ccaba 100644 --- a/osu.Game/Screens/Edit/Compose/Components/RectangularPositionSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/RectangularPositionSnapGrid.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs index cda986c7cd..2c4c220ad0 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxButton.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxButton.cs index 346bb2b508..3d6dacc95e 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxButton.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxControl.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxControl.cs index 8f22e67922..c4675685f6 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxDragHandle.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxDragHandle.cs index c37fefeed4..308d0cc893 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxDragHandle.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxDragHandle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Input.Events; diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxDragHandleContainer.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxDragHandleContainer.cs index 397158b9f6..5c7debf57e 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxDragHandleContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxDragHandleContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxRotationHandle.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxRotationHandle.cs index f13ed0456a..761cd118bf 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxRotationHandle.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxRotationHandle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxScaleHandle.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxScaleHandle.cs index 1f82f28380..bd1e2f4649 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxScaleHandle.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxScaleHandle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs index e5020afcde..96bd352cf9 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/CentreMarker.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/CentreMarker.cs index 8c8b38d9ea..6c545f8f78 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/CentreMarker.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/CentreMarker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/DifficultyPointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/DifficultyPointPiece.cs index eaaa663fe7..b028f67ba1 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/DifficultyPointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/DifficultyPointPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/HitObjectPointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/HitObjectPointPiece.cs index 6b62459c97..1091afe226 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/HitObjectPointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/HitObjectPointPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index 9abea73f6b..847c96b762 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index 89e9fb2404..37fc4b03b2 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Audio.Track; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs index 4cffebc57c..97dc04b9fa 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs index 1c0c2fb215..138e28fa06 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs index e0b21b2e22..0832dc02a9 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointDisplay.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointDisplay.cs index 8520567fa9..5d5681ea2b 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointDisplay.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Specialized; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointGroup.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointGroup.cs index 9610f6424c..4017a745e1 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointGroup.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointGroup.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineDragBox.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineDragBox.cs index 8aad8aa6dc..c026c169d6 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineDragBox.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineDragBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs index 33ea137d51..34abe81ae2 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineSelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineSelectionHandler.cs index da12ab521f..d91b95888b 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineSelectionHandler.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineSelectionHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs index 9904d91653..076ce224f0 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimingPointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimingPointPiece.cs index 2df4ef001c..cf62707839 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimingPointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimingPointPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TopPointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TopPointPiece.cs index 60a9e1ed66..28ae77c931 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TopPointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TopPointPiece.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs index bc6c66625c..80cdef38e9 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs index 2cde962b12..ef670c9fcf 100644 --- a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs +++ b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Edit/Compose/HitObjectUsageEventBuffer.cs b/osu.Game/Screens/Edit/Compose/HitObjectUsageEventBuffer.cs index 621c901fb9..3df5139924 100644 --- a/osu.Game/Screens/Edit/Compose/HitObjectUsageEventBuffer.cs +++ b/osu.Game/Screens/Edit/Compose/HitObjectUsageEventBuffer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Edit/Compose/IPlacementHandler.cs b/osu.Game/Screens/Edit/Compose/IPlacementHandler.cs index 59eb13cae5..46d9555e0c 100644 --- a/osu.Game/Screens/Edit/Compose/IPlacementHandler.cs +++ b/osu.Game/Screens/Edit/Compose/IPlacementHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Rulesets.Objects; diff --git a/osu.Game/Screens/Edit/CreateNewDifficultyDialog.cs b/osu.Game/Screens/Edit/CreateNewDifficultyDialog.cs index aa6ca280ee..36c4e397a7 100644 --- a/osu.Game/Screens/Edit/CreateNewDifficultyDialog.cs +++ b/osu.Game/Screens/Edit/CreateNewDifficultyDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics.Sprites; using osu.Game.Overlays.Dialog; diff --git a/osu.Game/Screens/Edit/Design/DesignScreen.cs b/osu.Game/Screens/Edit/Design/DesignScreen.cs index f15639733c..546a07f17d 100644 --- a/osu.Game/Screens/Edit/Design/DesignScreen.cs +++ b/osu.Game/Screens/Edit/Design/DesignScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Screens.Edit.Design { public class DesignScreen : EditorScreen diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 1fbc1b4bd6..d0d4c0ba1e 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Screens/Edit/EditorBeatmap.cs b/osu.Game/Screens/Edit/EditorBeatmap.cs index c9449f3259..fa3cb51473 100644 --- a/osu.Game/Screens/Edit/EditorBeatmap.cs +++ b/osu.Game/Screens/Edit/EditorBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections; using System.Collections.Generic; diff --git a/osu.Game/Screens/Edit/EditorBeatmapSkin.cs b/osu.Game/Screens/Edit/EditorBeatmapSkin.cs index f650ffa5a3..244fd5f1e9 100644 --- a/osu.Game/Screens/Edit/EditorBeatmapSkin.cs +++ b/osu.Game/Screens/Edit/EditorBeatmapSkin.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Audio.Sample; diff --git a/osu.Game/Screens/Edit/EditorChangeHandler.cs b/osu.Game/Screens/Edit/EditorChangeHandler.cs index 333c518d3a..1a93f3f101 100644 --- a/osu.Game/Screens/Edit/EditorChangeHandler.cs +++ b/osu.Game/Screens/Edit/EditorChangeHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/Screens/Edit/EditorClipboard.cs b/osu.Game/Screens/Edit/EditorClipboard.cs index f6f0c09e00..f749f4bad6 100644 --- a/osu.Game/Screens/Edit/EditorClipboard.cs +++ b/osu.Game/Screens/Edit/EditorClipboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; namespace osu.Game.Screens.Edit diff --git a/osu.Game/Screens/Edit/EditorClock.cs b/osu.Game/Screens/Edit/EditorClock.cs index 86e5729196..c7df36be77 100644 --- a/osu.Game/Screens/Edit/EditorClock.cs +++ b/osu.Game/Screens/Edit/EditorClock.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Audio.Track; diff --git a/osu.Game/Screens/Edit/EditorLoader.cs b/osu.Game/Screens/Edit/EditorLoader.cs index 0a2b8437fa..702e22a272 100644 --- a/osu.Game/Screens/Edit/EditorLoader.cs +++ b/osu.Game/Screens/Edit/EditorLoader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Edit/EditorRoundedScreenSettings.cs b/osu.Game/Screens/Edit/EditorRoundedScreenSettings.cs index 94a83a82aa..013971960b 100644 --- a/osu.Game/Screens/Edit/EditorRoundedScreenSettings.cs +++ b/osu.Game/Screens/Edit/EditorRoundedScreenSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/EditorRoundedScreenSettingsSection.cs b/osu.Game/Screens/Edit/EditorRoundedScreenSettingsSection.cs index 25d7dfbb4a..be1545cac8 100644 --- a/osu.Game/Screens/Edit/EditorRoundedScreenSettingsSection.cs +++ b/osu.Game/Screens/Edit/EditorRoundedScreenSettingsSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Edit/EditorScreen.cs b/osu.Game/Screens/Edit/EditorScreen.cs index 31c34edd7c..92709484ff 100644 --- a/osu.Game/Screens/Edit/EditorScreen.cs +++ b/osu.Game/Screens/Edit/EditorScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/EditorScreenMode.cs b/osu.Game/Screens/Edit/EditorScreenMode.cs index ecd39f9b57..81fcf23cdf 100644 --- a/osu.Game/Screens/Edit/EditorScreenMode.cs +++ b/osu.Game/Screens/Edit/EditorScreenMode.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Screens.Edit diff --git a/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs b/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs index 0b80af68f2..b3aafb9730 100644 --- a/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs +++ b/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/EditorSkinProvidingContainer.cs b/osu.Game/Screens/Edit/EditorSkinProvidingContainer.cs index 694d0253e0..d4387a0263 100644 --- a/osu.Game/Screens/Edit/EditorSkinProvidingContainer.cs +++ b/osu.Game/Screens/Edit/EditorSkinProvidingContainer.cs @@ -3,8 +3,6 @@ using osu.Game.Skinning; -#nullable enable - namespace osu.Game.Screens.Edit { /// diff --git a/osu.Game/Screens/Edit/EditorState.cs b/osu.Game/Screens/Edit/EditorState.cs index 4690074e3d..1751de4d3e 100644 --- a/osu.Game/Screens/Edit/EditorState.cs +++ b/osu.Game/Screens/Edit/EditorState.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - namespace osu.Game.Screens.Edit { /// diff --git a/osu.Game/Screens/Edit/EditorTable.cs b/osu.Game/Screens/Edit/EditorTable.cs index 26819dcfe7..8765dae384 100644 --- a/osu.Game/Screens/Edit/EditorTable.cs +++ b/osu.Game/Screens/Edit/EditorTable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs b/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs index f7e450b0e2..87e640badc 100644 --- a/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs +++ b/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Screens; using osu.Game.Beatmaps; diff --git a/osu.Game/Screens/Edit/GameplayTest/EditorPlayerLoader.cs b/osu.Game/Screens/Edit/GameplayTest/EditorPlayerLoader.cs index c16bb8677c..d3260f1e7d 100644 --- a/osu.Game/Screens/Edit/GameplayTest/EditorPlayerLoader.cs +++ b/osu.Game/Screens/Edit/GameplayTest/EditorPlayerLoader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Screens; diff --git a/osu.Game/Screens/Edit/GameplayTest/SaveBeforeGameplayTestDialog.cs b/osu.Game/Screens/Edit/GameplayTest/SaveBeforeGameplayTestDialog.cs index 9334c74706..37e1c99d98 100644 --- a/osu.Game/Screens/Edit/GameplayTest/SaveBeforeGameplayTestDialog.cs +++ b/osu.Game/Screens/Edit/GameplayTest/SaveBeforeGameplayTestDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; using osu.Game.Overlays.Dialog; diff --git a/osu.Game/Screens/Edit/HitAnimationsMenuItem.cs b/osu.Game/Screens/Edit/HitAnimationsMenuItem.cs index fb7ab39f7a..3e1e0c4cfe 100644 --- a/osu.Game/Screens/Edit/HitAnimationsMenuItem.cs +++ b/osu.Game/Screens/Edit/HitAnimationsMenuItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Bindables; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Screens/Edit/IEditorChangeHandler.cs b/osu.Game/Screens/Edit/IEditorChangeHandler.cs index 0283421b8c..e7abc1c43d 100644 --- a/osu.Game/Screens/Edit/IEditorChangeHandler.cs +++ b/osu.Game/Screens/Edit/IEditorChangeHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Rulesets.Objects; diff --git a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs index 3ed2a7efe2..4e3b6e0aee 100644 --- a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs +++ b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Screens/Edit/PromptForSaveDialog.cs b/osu.Game/Screens/Edit/PromptForSaveDialog.cs index 4f70491ade..59a697d91c 100644 --- a/osu.Game/Screens/Edit/PromptForSaveDialog.cs +++ b/osu.Game/Screens/Edit/PromptForSaveDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; using osu.Game.Overlays.Dialog; diff --git a/osu.Game/Screens/Edit/Setup/ColoursSection.cs b/osu.Game/Screens/Edit/Setup/ColoursSection.cs index 05d9855a24..621abf5580 100644 --- a/osu.Game/Screens/Edit/Setup/ColoursSection.cs +++ b/osu.Game/Screens/Edit/Setup/ColoursSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game/Screens/Edit/Setup/DesignSection.cs b/osu.Game/Screens/Edit/Setup/DesignSection.cs index d5d93db050..12a6843067 100644 --- a/osu.Game/Screens/Edit/Setup/DesignSection.cs +++ b/osu.Game/Screens/Edit/Setup/DesignSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; using System.Linq; diff --git a/osu.Game/Screens/Edit/Setup/DifficultySection.cs b/osu.Game/Screens/Edit/Setup/DifficultySection.cs index e799081115..5ce5d05d64 100644 --- a/osu.Game/Screens/Edit/Setup/DifficultySection.cs +++ b/osu.Game/Screens/Edit/Setup/DifficultySection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs b/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs index fd916894ea..c13026a891 100644 --- a/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/Screens/Edit/Setup/LabelledRomanisedTextBox.cs b/osu.Game/Screens/Edit/Setup/LabelledRomanisedTextBox.cs index c39b4d6f41..a9cf5357c8 100644 --- a/osu.Game/Screens/Edit/Setup/LabelledRomanisedTextBox.cs +++ b/osu.Game/Screens/Edit/Setup/LabelledRomanisedTextBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterfaceV2; diff --git a/osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs b/osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs index 799311dd2d..0eb74df575 100644 --- a/osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs +++ b/osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Setup/MetadataSection.cs b/osu.Game/Screens/Edit/Setup/MetadataSection.cs index 6262b4c18b..854dec2001 100644 --- a/osu.Game/Screens/Edit/Setup/MetadataSection.cs +++ b/osu.Game/Screens/Edit/Setup/MetadataSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs index 1e97218074..7c487d3bf8 100644 --- a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs +++ b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Edit/Setup/RulesetSetupSection.cs b/osu.Game/Screens/Edit/Setup/RulesetSetupSection.cs index 935842ff99..db0641feba 100644 --- a/osu.Game/Screens/Edit/Setup/RulesetSetupSection.cs +++ b/osu.Game/Screens/Edit/Setup/RulesetSetupSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osu.Game.Rulesets; diff --git a/osu.Game/Screens/Edit/Setup/SetupScreen.cs b/osu.Game/Screens/Edit/Setup/SetupScreen.cs index e0fc5f1aff..036202a503 100644 --- a/osu.Game/Screens/Edit/Setup/SetupScreen.cs +++ b/osu.Game/Screens/Edit/Setup/SetupScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Setup/SetupScreenHeader.cs b/osu.Game/Screens/Edit/Setup/SetupScreenHeader.cs index 2412f1c4ed..c531f1da90 100644 --- a/osu.Game/Screens/Edit/Setup/SetupScreenHeader.cs +++ b/osu.Game/Screens/Edit/Setup/SetupScreenHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Edit/Setup/SetupScreenHeaderBackground.cs b/osu.Game/Screens/Edit/Setup/SetupScreenHeaderBackground.cs index 17fb97d41f..5680d75f4e 100644 --- a/osu.Game/Screens/Edit/Setup/SetupScreenHeaderBackground.cs +++ b/osu.Game/Screens/Edit/Setup/SetupScreenHeaderBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Setup/SetupSection.cs b/osu.Game/Screens/Edit/Setup/SetupSection.cs index 02bb05d227..727a94a590 100644 --- a/osu.Game/Screens/Edit/Setup/SetupSection.cs +++ b/osu.Game/Screens/Edit/Setup/SetupSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs b/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs index 938c7f9cf0..1f95156aba 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs index 77d875b67f..88c738c1d2 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Edit/Timing/EffectSection.cs b/osu.Game/Screens/Edit/Timing/EffectSection.cs index c9f73411f1..f7e59a75f1 100644 --- a/osu.Game/Screens/Edit/Timing/EffectSection.cs +++ b/osu.Game/Screens/Edit/Timing/EffectSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Timing/GroupSection.cs b/osu.Game/Screens/Edit/Timing/GroupSection.cs index f613488aae..e78cd18024 100644 --- a/osu.Game/Screens/Edit/Timing/GroupSection.cs +++ b/osu.Game/Screens/Edit/Timing/GroupSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Edit/Timing/IndeterminateSliderWithTextBoxInput.cs b/osu.Game/Screens/Edit/Timing/IndeterminateSliderWithTextBoxInput.cs index 16a04982f5..ea6c6f31e4 100644 --- a/osu.Game/Screens/Edit/Timing/IndeterminateSliderWithTextBoxInput.cs +++ b/osu.Game/Screens/Edit/Timing/IndeterminateSliderWithTextBoxInput.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Edit/Timing/LabelledTimeSignature.cs b/osu.Game/Screens/Edit/Timing/LabelledTimeSignature.cs index 51b58bd3dc..d05777e793 100644 --- a/osu.Game/Screens/Edit/Timing/LabelledTimeSignature.cs +++ b/osu.Game/Screens/Edit/Timing/LabelledTimeSignature.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 2ecd66a05f..270d544dcf 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs b/osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs index 3b78402f8a..cd3ced53da 100644 --- a/osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs +++ b/osu.Game/Screens/Edit/Timing/RepeatingButtonBehaviour.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game/Screens/Edit/Timing/RowAttribute.cs b/osu.Game/Screens/Edit/Timing/RowAttribute.cs index 46bb62c9e0..e73a343583 100644 --- a/osu.Game/Screens/Edit/Timing/RowAttribute.cs +++ b/osu.Game/Screens/Edit/Timing/RowAttribute.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Edit/Timing/RowAttributes/AttributeProgressBar.cs b/osu.Game/Screens/Edit/Timing/RowAttributes/AttributeProgressBar.cs index 6f7e790489..a8d2172f58 100644 --- a/osu.Game/Screens/Edit/Timing/RowAttributes/AttributeProgressBar.cs +++ b/osu.Game/Screens/Edit/Timing/RowAttributes/AttributeProgressBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game/Screens/Edit/Timing/RowAttributes/AttributeText.cs b/osu.Game/Screens/Edit/Timing/RowAttributes/AttributeText.cs index d0a51f9faa..d65ef1799a 100644 --- a/osu.Game/Screens/Edit/Timing/RowAttributes/AttributeText.cs +++ b/osu.Game/Screens/Edit/Timing/RowAttributes/AttributeText.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game/Screens/Edit/Timing/RowAttributes/DifficultyRowAttribute.cs b/osu.Game/Screens/Edit/Timing/RowAttributes/DifficultyRowAttribute.cs index a8de476d67..17f8b01d07 100644 --- a/osu.Game/Screens/Edit/Timing/RowAttributes/DifficultyRowAttribute.cs +++ b/osu.Game/Screens/Edit/Timing/RowAttributes/DifficultyRowAttribute.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Timing/RowAttributes/EffectRowAttribute.cs b/osu.Game/Screens/Edit/Timing/RowAttributes/EffectRowAttribute.cs index 1b33fd62aa..ef682dd3ad 100644 --- a/osu.Game/Screens/Edit/Timing/RowAttributes/EffectRowAttribute.cs +++ b/osu.Game/Screens/Edit/Timing/RowAttributes/EffectRowAttribute.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Timing/RowAttributes/SampleRowAttribute.cs b/osu.Game/Screens/Edit/Timing/RowAttributes/SampleRowAttribute.cs index ac0797dba1..e06f6b7bfb 100644 --- a/osu.Game/Screens/Edit/Timing/RowAttributes/SampleRowAttribute.cs +++ b/osu.Game/Screens/Edit/Timing/RowAttributes/SampleRowAttribute.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Timing/RowAttributes/TimingRowAttribute.cs b/osu.Game/Screens/Edit/Timing/RowAttributes/TimingRowAttribute.cs index 8a07088545..0b498650d4 100644 --- a/osu.Game/Screens/Edit/Timing/RowAttributes/TimingRowAttribute.cs +++ b/osu.Game/Screens/Edit/Timing/RowAttributes/TimingRowAttribute.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions; diff --git a/osu.Game/Screens/Edit/Timing/Section.cs b/osu.Game/Screens/Edit/Timing/Section.cs index 17147c21f4..02789c0cbf 100644 --- a/osu.Game/Screens/Edit/Timing/Section.cs +++ b/osu.Game/Screens/Edit/Timing/Section.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Edit/Timing/SliderWithTextBoxInput.cs b/osu.Game/Screens/Edit/Timing/SliderWithTextBoxInput.cs index 9f036f0215..6a804c7e3e 100644 --- a/osu.Game/Screens/Edit/Timing/SliderWithTextBoxInput.cs +++ b/osu.Game/Screens/Edit/Timing/SliderWithTextBoxInput.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index a6227cbe27..151c3cea2e 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index 9b5574d3cb..53c92bac20 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs b/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs index 8aa0a88c3b..16dea328da 100644 --- a/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs +++ b/osu.Game/Screens/Edit/Timing/TimingAdjustButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index f498aa917e..60cb263a79 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Edit/Timing/TimingSection.cs b/osu.Game/Screens/Edit/Timing/TimingSection.cs index 1a97058d73..8413409d84 100644 --- a/osu.Game/Screens/Edit/Timing/TimingSection.cs +++ b/osu.Game/Screens/Edit/Timing/TimingSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index 0745187e43..67b7abb25b 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Edit/TransactionalCommitComponent.cs b/osu.Game/Screens/Edit/TransactionalCommitComponent.cs index 3d3539ee2f..78d052702a 100644 --- a/osu.Game/Screens/Edit/TransactionalCommitComponent.cs +++ b/osu.Game/Screens/Edit/TransactionalCommitComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Verify/InterpretationSection.cs b/osu.Game/Screens/Edit/Verify/InterpretationSection.cs index 9548f8aaa9..276c2a3ea9 100644 --- a/osu.Game/Screens/Edit/Verify/InterpretationSection.cs +++ b/osu.Game/Screens/Edit/Verify/InterpretationSection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps; diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs index 84b2609a61..7ce70b4b5f 100644 --- a/osu.Game/Screens/Edit/Verify/IssueList.cs +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Edit/Verify/IssueSettings.cs b/osu.Game/Screens/Edit/Verify/IssueSettings.cs index ae3ef7e0b0..70065f6f0d 100644 --- a/osu.Game/Screens/Edit/Verify/IssueSettings.cs +++ b/osu.Game/Screens/Edit/Verify/IssueSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Verify/IssueTable.cs b/osu.Game/Screens/Edit/Verify/IssueTable.cs index b38a62d838..f1a76dcbf5 100644 --- a/osu.Game/Screens/Edit/Verify/IssueTable.cs +++ b/osu.Game/Screens/Edit/Verify/IssueTable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs index 56e16bb746..d5b32760c9 100644 --- a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs +++ b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs index 0bdc8c0efd..fbf6982984 100644 --- a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs +++ b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Edit/WaveformOpacityMenuItem.cs b/osu.Game/Screens/Edit/WaveformOpacityMenuItem.cs index 7e095f526e..3d3f67e70e 100644 --- a/osu.Game/Screens/Edit/WaveformOpacityMenuItem.cs +++ b/osu.Game/Screens/Edit/WaveformOpacityMenuItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Bindables; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Screens/IHandlePresentBeatmap.cs b/osu.Game/Screens/IHandlePresentBeatmap.cs index 60801fb3eb..62cd2c3d3e 100644 --- a/osu.Game/Screens/IHandlePresentBeatmap.cs +++ b/osu.Game/Screens/IHandlePresentBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Rulesets; diff --git a/osu.Game/Screens/IHasSubScreenStack.cs b/osu.Game/Screens/IHasSubScreenStack.cs index c5e2015109..325702313b 100644 --- a/osu.Game/Screens/IHasSubScreenStack.cs +++ b/osu.Game/Screens/IHasSubScreenStack.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Screens; namespace osu.Game.Screens diff --git a/osu.Game/Screens/IOsuScreen.cs b/osu.Game/Screens/IOsuScreen.cs index 910a0c7d61..7d8657a3df 100644 --- a/osu.Game/Screens/IOsuScreen.cs +++ b/osu.Game/Screens/IOsuScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Screens; using osu.Game.Beatmaps; diff --git a/osu.Game/Screens/IPerformFromScreenRunner.cs b/osu.Game/Screens/IPerformFromScreenRunner.cs index 655bebdeb0..c12a52a784 100644 --- a/osu.Game/Screens/IPerformFromScreenRunner.cs +++ b/osu.Game/Screens/IPerformFromScreenRunner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Import/FileImportScreen.cs b/osu.Game/Screens/Import/FileImportScreen.cs index 32ce54aa29..e3d8de2dfd 100644 --- a/osu.Game/Screens/Import/FileImportScreen.cs +++ b/osu.Game/Screens/Import/FileImportScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using System.Linq; using System.Threading.Tasks; diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index 52e83c9e98..dbb1278d76 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Menu/ButtonArea.cs b/osu.Game/Screens/Menu/ButtonArea.cs index d59996a4eb..bf6e0cee83 100644 --- a/osu.Game/Screens/Menu/ButtonArea.cs +++ b/osu.Game/Screens/Menu/ButtonArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index b48aef330a..74be02728f 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Menu/ConfirmExitDialog.cs b/osu.Game/Screens/Menu/ConfirmExitDialog.cs index 6488a2fd63..734ff6b23f 100644 --- a/osu.Game/Screens/Menu/ConfirmExitDialog.cs +++ b/osu.Game/Screens/Menu/ConfirmExitDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; using osu.Game.Overlays.Dialog; diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 24412cd85e..b004b025d6 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Menu/ExitConfirmOverlay.cs b/osu.Game/Screens/Menu/ExitConfirmOverlay.cs index a90b83c5fe..f82a6c9736 100644 --- a/osu.Game/Screens/Menu/ExitConfirmOverlay.cs +++ b/osu.Game/Screens/Menu/ExitConfirmOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Input.Bindings; diff --git a/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs b/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs index 8310ab06eb..24a365ffd1 100644 --- a/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs +++ b/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osuTK; diff --git a/osu.Game/Screens/Menu/IntroCircles.cs b/osu.Game/Screens/Menu/IntroCircles.cs index 00e2de62f0..faa9a267ce 100644 --- a/osu.Game/Screens/Menu/IntroCircles.cs +++ b/osu.Game/Screens/Menu/IntroCircles.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs index c9b9bb344d..766b5bf2a4 100644 --- a/osu.Game/Screens/Menu/IntroScreen.cs +++ b/osu.Game/Screens/Menu/IntroScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Screens/Menu/IntroSequence.cs b/osu.Game/Screens/Menu/IntroSequence.cs index 3a5cd6857a..bc5aa83503 100644 --- a/osu.Game/Screens/Menu/IntroSequence.cs +++ b/osu.Game/Screens/Menu/IntroSequence.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osuTK; using osuTK.Graphics; diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index ba8314f103..d59a07a350 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using JetBrains.Annotations; diff --git a/osu.Game/Screens/Menu/IntroWelcome.cs b/osu.Game/Screens/Menu/IntroWelcome.cs index 9a6c949cad..031c8d7902 100644 --- a/osu.Game/Screens/Menu/IntroWelcome.cs +++ b/osu.Game/Screens/Menu/IntroWelcome.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osuTK; diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 34f1d46067..c66bd3639a 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osuTK.Graphics; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index bcd4baa818..6a74a6bd6e 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Menu/MainMenuButton.cs b/osu.Game/Screens/Menu/MainMenuButton.cs index c07ada9419..f2b57b185e 100644 --- a/osu.Game/Screens/Menu/MainMenuButton.cs +++ b/osu.Game/Screens/Menu/MainMenuButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Menu/MenuLogoVisualisation.cs b/osu.Game/Screens/Menu/MenuLogoVisualisation.cs index f461136022..4324f02c84 100644 --- a/osu.Game/Screens/Menu/MenuLogoVisualisation.cs +++ b/osu.Game/Screens/Menu/MenuLogoVisualisation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK.Graphics; using osu.Game.Skinning; using osu.Game.Online.API; diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index cd0c75c1a1..5214d87ee9 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index f5743c7d5a..ddeb544bc5 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game/Screens/Menu/SongTicker.cs b/osu.Game/Screens/Menu/SongTicker.cs index 237fe43168..6574c9a696 100644 --- a/osu.Game/Screens/Menu/SongTicker.cs +++ b/osu.Game/Screens/Menu/SongTicker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Menu/StorageErrorDialog.cs b/osu.Game/Screens/Menu/StorageErrorDialog.cs index f4c77d5d8f..28ef413179 100644 --- a/osu.Game/Screens/Menu/StorageErrorDialog.cs +++ b/osu.Game/Screens/Menu/StorageErrorDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Screens/OnlinePlay/Components/BeatmapDetailAreaPlaylistTabItem.cs b/osu.Game/Screens/OnlinePlay/Components/BeatmapDetailAreaPlaylistTabItem.cs index fb927411e6..7c48fc0871 100644 --- a/osu.Game/Screens/OnlinePlay/Components/BeatmapDetailAreaPlaylistTabItem.cs +++ b/osu.Game/Screens/OnlinePlay/Components/BeatmapDetailAreaPlaylistTabItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Screens.Select; namespace osu.Game.Screens.OnlinePlay.Components diff --git a/osu.Game/Screens/OnlinePlay/Components/BeatmapTitle.cs b/osu.Game/Screens/OnlinePlay/Components/BeatmapTitle.cs index 7cbe1a9017..1dc05def0f 100644 --- a/osu.Game/Screens/OnlinePlay/Components/BeatmapTitle.cs +++ b/osu.Game/Screens/OnlinePlay/Components/BeatmapTitle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/OnlinePlay/Components/DisableableTabControl.cs b/osu.Game/Screens/OnlinePlay/Components/DisableableTabControl.cs index 2b596da361..22839ab4d4 100644 --- a/osu.Game/Screens/OnlinePlay/Components/DisableableTabControl.cs +++ b/osu.Game/Screens/OnlinePlay/Components/DisableableTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; diff --git a/osu.Game/Screens/OnlinePlay/Components/DrawableGameType.cs b/osu.Game/Screens/OnlinePlay/Components/DrawableGameType.cs index f360a80599..c97e52c247 100644 --- a/osu.Game/Screens/OnlinePlay/Components/DrawableGameType.cs +++ b/osu.Game/Screens/OnlinePlay/Components/DrawableGameType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Screens/OnlinePlay/Components/ListingPollingComponent.cs b/osu.Game/Screens/OnlinePlay/Components/ListingPollingComponent.cs index 666d425f62..1ea84b60b9 100644 --- a/osu.Game/Screens/OnlinePlay/Components/ListingPollingComponent.cs +++ b/osu.Game/Screens/OnlinePlay/Components/ListingPollingComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs b/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs index 89842e933b..bed55e8a79 100644 --- a/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs +++ b/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Components/ModeTypeInfo.cs b/osu.Game/Screens/OnlinePlay/Components/ModeTypeInfo.cs index 8402619ebc..641776a9e8 100644 --- a/osu.Game/Screens/OnlinePlay/Components/ModeTypeInfo.cs +++ b/osu.Game/Screens/OnlinePlay/Components/ModeTypeInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundScreen.cs b/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundScreen.cs index 9e964de31e..8c65649cc6 100644 --- a/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundScreen.cs @@ -13,8 +13,6 @@ using osu.Game.Online.Rooms; using osuTK; using osuTK.Graphics; -#nullable enable - namespace osu.Game.Screens.OnlinePlay.Components { public abstract class OnlinePlayBackgroundScreen : BackgroundScreen diff --git a/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundSprite.cs b/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundSprite.cs index 2faa46e622..795f776496 100644 --- a/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundSprite.cs +++ b/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundSprite.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps.Drawables; diff --git a/osu.Game/Screens/OnlinePlay/Components/OverlinedHeader.cs b/osu.Game/Screens/OnlinePlay/Components/OverlinedHeader.cs index f667a3c1d2..b953136fdd 100644 --- a/osu.Game/Screens/OnlinePlay/Components/OverlinedHeader.cs +++ b/osu.Game/Screens/OnlinePlay/Components/OverlinedHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/OnlinePlay/Components/OverlinedPlaylistHeader.cs b/osu.Game/Screens/OnlinePlay/Components/OverlinedPlaylistHeader.cs index 45b822d20a..43ad5e97ec 100644 --- a/osu.Game/Screens/OnlinePlay/Components/OverlinedPlaylistHeader.cs +++ b/osu.Game/Screens/OnlinePlay/Components/OverlinedPlaylistHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Online.Rooms; namespace osu.Game.Screens.OnlinePlay.Components diff --git a/osu.Game/Screens/OnlinePlay/Components/ParticipantCountDisplay.cs b/osu.Game/Screens/OnlinePlay/Components/ParticipantCountDisplay.cs index 53821da8fd..71b33bf247 100644 --- a/osu.Game/Screens/OnlinePlay/Components/ParticipantCountDisplay.cs +++ b/osu.Game/Screens/OnlinePlay/Components/ParticipantCountDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/OnlinePlay/Components/ParticipantsDisplay.cs b/osu.Game/Screens/OnlinePlay/Components/ParticipantsDisplay.cs index c36d1a2e76..c66ae8b6d5 100644 --- a/osu.Game/Screens/OnlinePlay/Components/ParticipantsDisplay.cs +++ b/osu.Game/Screens/OnlinePlay/Components/ParticipantsDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/OnlinePlay/Components/ParticipantsList.cs b/osu.Game/Screens/OnlinePlay/Components/ParticipantsList.cs index 1d5552fa7d..d8515d2bd2 100644 --- a/osu.Game/Screens/OnlinePlay/Components/ParticipantsList.cs +++ b/osu.Game/Screens/OnlinePlay/Components/ParticipantsList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/OnlinePlay/Components/PlaylistItemBackground.cs b/osu.Game/Screens/OnlinePlay/Components/PlaylistItemBackground.cs index 7e31591389..d882b3d97f 100644 --- a/osu.Game/Screens/OnlinePlay/Components/PlaylistItemBackground.cs +++ b/osu.Game/Screens/OnlinePlay/Components/PlaylistItemBackground.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps; diff --git a/osu.Game/Screens/OnlinePlay/Components/ReadyButton.cs b/osu.Game/Screens/OnlinePlay/Components/ReadyButton.cs index cdaa39d2be..0871fc9a72 100644 --- a/osu.Game/Screens/OnlinePlay/Components/ReadyButton.cs +++ b/osu.Game/Screens/OnlinePlay/Components/ReadyButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Cursor; diff --git a/osu.Game/Screens/OnlinePlay/Components/RoomLocalUserInfo.cs b/osu.Game/Screens/OnlinePlay/Components/RoomLocalUserInfo.cs index 3bad6cb183..cc517ca080 100644 --- a/osu.Game/Screens/OnlinePlay/Components/RoomLocalUserInfo.cs +++ b/osu.Game/Screens/OnlinePlay/Components/RoomLocalUserInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/OnlinePlay/Components/RoomManager.cs b/osu.Game/Screens/OnlinePlay/Components/RoomManager.cs index 4242886e66..35dc251e4d 100644 --- a/osu.Game/Screens/OnlinePlay/Components/RoomManager.cs +++ b/osu.Game/Screens/OnlinePlay/Components/RoomManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Screens/OnlinePlay/Components/RoomPollingComponent.cs b/osu.Game/Screens/OnlinePlay/Components/RoomPollingComponent.cs index cd224a7347..039e1d92b7 100644 --- a/osu.Game/Screens/OnlinePlay/Components/RoomPollingComponent.cs +++ b/osu.Game/Screens/OnlinePlay/Components/RoomPollingComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Online; using osu.Game.Online.API; diff --git a/osu.Game/Screens/OnlinePlay/Components/SelectionPollingComponent.cs b/osu.Game/Screens/OnlinePlay/Components/SelectionPollingComponent.cs index e05bdf8c8e..3b8ba739d9 100644 --- a/osu.Game/Screens/OnlinePlay/Components/SelectionPollingComponent.cs +++ b/osu.Game/Screens/OnlinePlay/Components/SelectionPollingComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading.Tasks; using osu.Game.Online.Rooms; diff --git a/osu.Game/Screens/OnlinePlay/Components/StarRatingRangeDisplay.cs b/osu.Game/Screens/OnlinePlay/Components/StarRatingRangeDisplay.cs index 7425e46bd3..4cf785ce60 100644 --- a/osu.Game/Screens/OnlinePlay/Components/StarRatingRangeDisplay.cs +++ b/osu.Game/Screens/OnlinePlay/Components/StarRatingRangeDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Components/StatusColouredContainer.cs b/osu.Game/Screens/OnlinePlay/Components/StatusColouredContainer.cs index a7ea32ee7c..6122e7ec5e 100644 --- a/osu.Game/Screens/OnlinePlay/Components/StatusColouredContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Components/StatusColouredContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs index 2a72fc6eb1..489bf128e8 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs index 39853a5c45..53519b8b00 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/OnlinePlay/FooterButtonFreeMods.cs b/osu.Game/Screens/OnlinePlay/FooterButtonFreeMods.cs index 834e82fcfd..9e589b362b 100644 --- a/osu.Game/Screens/OnlinePlay/FooterButtonFreeMods.cs +++ b/osu.Game/Screens/OnlinePlay/FooterButtonFreeMods.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs index 7c9184cc0f..c27b78642a 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Overlays; using System.Collections.Generic; diff --git a/osu.Game/Screens/OnlinePlay/Header.cs b/osu.Game/Screens/OnlinePlay/Header.cs index 2d4b5cc527..06befe0971 100644 --- a/osu.Game/Screens/OnlinePlay/Header.cs +++ b/osu.Game/Screens/OnlinePlay/Header.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Humanizer; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/IOnlinePlaySubScreen.cs b/osu.Game/Screens/OnlinePlay/IOnlinePlaySubScreen.cs index a4762292a9..f32ead5a11 100644 --- a/osu.Game/Screens/OnlinePlay/IOnlinePlaySubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/IOnlinePlaySubScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Screens.OnlinePlay { public interface IOnlinePlaySubScreen : IOsuScreen diff --git a/osu.Game/Screens/OnlinePlay/IRoomManager.cs b/osu.Game/Screens/OnlinePlay/IRoomManager.cs index 6e1ffbda74..ed4fb7b15e 100644 --- a/osu.Game/Screens/OnlinePlay/IRoomManager.cs +++ b/osu.Game/Screens/OnlinePlay/IRoomManager.cs @@ -6,8 +6,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Online.Rooms; -#nullable enable - namespace osu.Game.Screens.OnlinePlay { [Cached(typeof(IRoomManager))] diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs index 772232f6b4..7e39a52c0a 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoom.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Threading; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoomParticipantsList.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoomParticipantsList.cs index 10bd534b89..995a0d3397 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoomParticipantsList.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoomParticipantsList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Specialized; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/EndDateInfo.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/EndDateInfo.cs index 3207d373db..d951b42854 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/EndDateInfo.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/EndDateInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs index 488af5d4de..67e805986a 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets; namespace osu.Game.Screens.OnlinePlay.Lounge.Components diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/MatchTypePill.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/MatchTypePill.cs index d104ede8f7..b2e527766a 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/MatchTypePill.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/MatchTypePill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/PillContainer.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/PillContainer.cs index 109851a16b..b17873b1c8 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/PillContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/PillContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/PlaylistCountPill.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/PlaylistCountPill.cs index a6bbcd548d..5bdd24221c 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/PlaylistCountPill.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/PlaylistCountPill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using Humanizer; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/QueueModePill.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/QueueModePill.cs index 7501f0237b..85177ee32c 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/QueueModePill.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/QueueModePill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RankRangePill.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RankRangePill.cs index 42fe0bfecd..fa531a0d14 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RankRangePill.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RankRangePill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs index 539af2ebaf..0f9bfb22e8 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomStatusFilter.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomStatusFilter.cs index 0c8dc8832b..463b883f11 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomStatusFilter.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomStatusFilter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Screens.OnlinePlay.Lounge.Components diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomStatusPill.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomStatusPill.cs index 1d43f2dc65..f37ec9d9d4 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomStatusPill.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomStatusPill.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs index 0fd9290880..2c3a2997cc 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs index 0015cf8bf9..9784e5aace 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs b/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs index 52a902f5da..d81fee24e0 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Bindables; using osu.Framework.Screens; using osu.Game.Online.Rooms; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs index b1c10f4a4a..f7f3c27ede 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Collections.Generic; diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/CreateRoomButton.cs b/osu.Game/Screens/OnlinePlay/Match/Components/CreateRoomButton.cs index 81e1cb2406..3d0c181d9d 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/CreateRoomButton.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/CreateRoomButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Input; using osu.Framework.Input.Bindings; diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/MatchChatDisplay.cs b/osu.Game/Screens/OnlinePlay/Match/Components/MatchChatDisplay.cs index 0396562959..880bba895a 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/MatchChatDisplay.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/MatchChatDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Online.Chat; diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboard.cs b/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboard.cs index b92c197f5a..64644be965 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboard.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboardScore.cs b/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboardScore.cs index 799983342b..5bd8f9e066 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboardScore.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/MatchLeaderboardScore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/MatchTypePicker.cs b/osu.Game/Screens/OnlinePlay/Match/Components/MatchTypePicker.cs index 216734e55e..91477879c6 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/MatchTypePicker.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/MatchTypePicker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/PurpleTriangleButton.cs b/osu.Game/Screens/OnlinePlay/Match/Components/PurpleTriangleButton.cs index 28e8961a9a..5c751f238f 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/PurpleTriangleButton.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/PurpleTriangleButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/RoomAvailabilityPicker.cs b/osu.Game/Screens/OnlinePlay/Match/Components/RoomAvailabilityPicker.cs index 677a5be0d9..408742d8e1 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/RoomAvailabilityPicker.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/RoomAvailabilityPicker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/RoomSettingsOverlay.cs b/osu.Game/Screens/OnlinePlay/Match/Components/RoomSettingsOverlay.cs index c15b5b443a..c295e9f85e 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/RoomSettingsOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/RoomSettingsOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs b/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs index 1828a072f8..7c444b9bbd 100644 --- a/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Match/RoomBackgroundScreen.cs b/osu.Game/Screens/OnlinePlay/Match/RoomBackgroundScreen.cs index 2e5f25370f..74c37b865c 100644 --- a/osu.Game/Screens/OnlinePlay/Match/RoomBackgroundScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Match/RoomBackgroundScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Components; diff --git a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs index a612b6a0e6..e7d31fbdde 100644 --- a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/CreateMultiplayerMatchButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/CreateMultiplayerMatchButton.cs index e80923ed47..fd535f979d 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/CreateMultiplayerMatchButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/CreateMultiplayerMatchButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Online.Multiplayer; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayChatDisplay.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayChatDisplay.cs index d08a63e21f..270f15a98d 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayChatDisplay.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayChatDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayMatchScoreDisplay.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayMatchScoreDisplay.cs index 20a88545c5..c7fb6a82d5 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayMatchScoreDisplay.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayMatchScoreDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Screens.Play.HUD; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MatchStartControl.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MatchStartControl.cs index d048676872..501c76f65b 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MatchStartControl.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MatchStartControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs index 1a51aebb76..14bf1a8375 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Humanizer; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchFooter.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchFooter.cs index a07c95bca8..c28bd4892a 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchFooter.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchFooter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs index a103d71120..3aa879dde0 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.ComponentModel; using System.Diagnostics; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs index 62310bcaac..20762b2f22 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs index d939fbf400..b5bb4a766f 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerHistoryList.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerHistoryList.cs index 32d355d149..3def73accb 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerHistoryList.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerHistoryList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylist.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylist.cs index 41f548a630..bc96bd61d7 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylist.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylist.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistDisplayMode.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistDisplayMode.cs index cc3dca6a34..1672f98637 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistDisplayMode.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistDisplayMode.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist { /// diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistTabControl.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistTabControl.cs index 583a05839f..9877c15f2f 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistTabControl.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerQueueList.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerQueueList.cs index d72ce5e960..04342788db 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerQueueList.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerQueueList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs index 53d081a108..03a2f00c0d 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Multiplayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Logging; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs index a05f248d3a..ae65e1d969 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs index 929c3ee321..495d3f94e1 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs index dc78cb10ef..869548c948 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs index 43b128b971..df0f94688b 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs index e9bf5339a9..f79af664d8 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayerLoader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading.Tasks; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerResultsScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerResultsScreen.cs index 140b3c45d8..d98b837883 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerResultsScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerResultsScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Online.Rooms; using osu.Game.Scoring; using osu.Game.Screens.OnlinePlay.Playlists; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomComposite.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomComposite.cs index f6f815a3cb..1f80c47d13 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomComposite.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomComposite.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Game.Online.Multiplayer; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomManager.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomManager.cs index 2d94b2328d..7e83d72c77 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomManager.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomSounds.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomSounds.cs index 49b5b7fed9..1aafcea20c 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomSounds.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomSounds.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs index 3f0f3e043c..6fbed03e44 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerTeamResultsScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs index 498a7d9972..f632951f41 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsList.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsList.cs index 14b930f115..cda86c74bf 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsList.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsListHeader.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsListHeader.cs index ef84c4b4fa..b0acda03df 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsListHeader.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsListHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Online.Multiplayer; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/StateDisplay.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/StateDisplay.cs index 658fc43e8d..9c05c19d1b 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/StateDisplay.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/StateDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/TeamDisplay.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/TeamDisplay.cs index aca2c6073a..5500d96eea 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/TeamDisplay.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/TeamDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSpectatorPlayerClock.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSpectatorPlayerClock.cs index 48d0b063ff..34388bf9b1 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSpectatorPlayerClock.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSpectatorPlayerClock.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using osu.Framework.Bindables; using osu.Framework.Timing; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSyncManager.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSyncManager.cs index b0fdeddd56..663025923c 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSyncManager.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/CatchUpSyncManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISpectatorPlayerClock.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISpectatorPlayerClock.cs index b2ecb105c2..194a3bdcc2 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISpectatorPlayerClock.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISpectatorPlayerClock.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Timing; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISyncManager.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISyncManager.cs index 3c644ccb78..577100d4ba 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISyncManager.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ISyncManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Timing; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MasterClockState.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MasterClockState.cs index 8982d1669d..92dbde9f08 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MasterClockState.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MasterClockState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate { public enum MasterClockState diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs index 4e9ab07e4c..c7af87a91d 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorLeaderboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Timing; using osu.Game.Online.Multiplayer; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayer.cs index 29afaf00d8..a0558f97a9 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayerLoader.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayerLoader.cs index 14bd8fa6dc..36a6487289 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayerLoader.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorPlayerLoader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs index d9c19cdfdd..e048c12686 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerArea.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerArea.cs index 4979bd906b..5bae4f9ea5 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerArea.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using JetBrains.Annotations; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid.cs index 6638d47dca..82d4cf5caf 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid_Cell.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid_Cell.cs index 2df05cb5ed..ee213f7be1 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid_Cell.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid_Cell.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid_Facade.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid_Facade.cs index 6b363c6040..f7b8d48d0a 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid_Facade.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid_Facade.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate diff --git a/osu.Game/Screens/OnlinePlay/OngoingOperationTracker.cs b/osu.Game/Screens/OnlinePlay/OngoingOperationTracker.cs index aabeafe460..c87cf32c73 100644 --- a/osu.Game/Screens/OnlinePlay/OngoingOperationTracker.cs +++ b/osu.Game/Screens/OnlinePlay/OngoingOperationTracker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs b/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs index 88354c8646..1d9ea5f77d 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlayScreen.cs b/osu.Game/Screens/OnlinePlay/OnlinePlayScreen.cs index ff4225e155..61ea7d68ee 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlayScreen.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlayScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs index fb18a33d66..1552811c74 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySubScreen.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySubScreen.cs index 07e0f60011..5c0a158c97 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySubScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Screens; diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySubScreenStack.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySubScreenStack.cs index 7f2a0980c1..ae6988f0d6 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySubScreenStack.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySubScreenStack.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Screens; namespace osu.Game.Screens.OnlinePlay diff --git a/osu.Game/Screens/OnlinePlay/Playlists/CreatePlaylistsRoomButton.cs b/osu.Game/Screens/OnlinePlay/Playlists/CreatePlaylistsRoomButton.cs index a9826a72eb..8cdae954ce 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/CreatePlaylistsRoomButton.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/CreatePlaylistsRoomButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Screens.OnlinePlay.Match.Components; diff --git a/osu.Game/Screens/OnlinePlay/Playlists/Playlists.cs b/osu.Game/Screens/OnlinePlay/Playlists/Playlists.cs index 1edeef77df..b84079b955 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/Playlists.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/Playlists.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Screens.OnlinePlay.Lounge; namespace osu.Game.Screens.OnlinePlay.Playlists diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsLoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsLoungeSubScreen.cs index b36e162e3d..0827e2031d 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsLoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsLoungeSubScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.ComponentModel; using System.Linq; diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsPlayer.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsPlayer.cs index 5cba8676c5..282c1db585 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsReadyButton.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsReadyButton.cs index 24f112ef0c..b8ab514721 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsReadyButton.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsReadyButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsResultsScreen.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsResultsScreen.cs index 1e6722d51e..53b38962ac 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsResultsScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsResultsScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomFooter.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomFooter.cs index 3eb1cde0a4..b1b400713f 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomFooter.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomFooter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs index 6674a37c3c..1e565e298e 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Specialized; using System.Linq; diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsPlaylist.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsPlaylist.cs index 2fe215eef2..80f38d0cd8 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsPlaylist.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsPlaylist.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSubScreen.cs index 338a9c856f..ff657e16fb 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSubScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsSongSelect.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsSongSelect.cs index 86591c1d6d..65a27a9261 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsSongSelect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Screens; using osu.Game.Online.API; diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 810aadffad..0678a90f71 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using JetBrains.Annotations; diff --git a/osu.Game/Screens/OsuScreenDependencies.cs b/osu.Game/Screens/OsuScreenDependencies.cs index 8d54829d49..66176685fd 100644 --- a/osu.Game/Screens/OsuScreenDependencies.cs +++ b/osu.Game/Screens/OsuScreenDependencies.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/OsuScreenStack.cs b/osu.Game/Screens/OsuScreenStack.cs index 18b16ba865..49f1255ec7 100644 --- a/osu.Game/Screens/OsuScreenStack.cs +++ b/osu.Game/Screens/OsuScreenStack.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Screens; diff --git a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs index e8021d4065..dca9401872 100644 --- a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs +++ b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Diagnostics; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Play/Break/BlurredIcon.cs b/osu.Game/Screens/Play/Break/BlurredIcon.cs index 1e974ec916..97eafa01fa 100644 --- a/osu.Game/Screens/Play/Break/BlurredIcon.cs +++ b/osu.Game/Screens/Play/Break/BlurredIcon.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Play/Break/BreakArrows.cs b/osu.Game/Screens/Play/Break/BreakArrows.cs index 4b96fa666a..f2feda4d76 100644 --- a/osu.Game/Screens/Play/Break/BreakArrows.cs +++ b/osu.Game/Screens/Play/Break/BreakArrows.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Screens/Play/Break/BreakInfo.cs b/osu.Game/Screens/Play/Break/BreakInfo.cs index ead41a826a..5aed8b7df1 100644 --- a/osu.Game/Screens/Play/Break/BreakInfo.cs +++ b/osu.Game/Screens/Play/Break/BreakInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Play/Break/BreakInfoLine.cs b/osu.Game/Screens/Play/Break/BreakInfoLine.cs index 4cae90e50f..690d7c7e63 100644 --- a/osu.Game/Screens/Play/Break/BreakInfoLine.cs +++ b/osu.Game/Screens/Play/Break/BreakInfoLine.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Play/Break/GlowIcon.cs b/osu.Game/Screens/Play/Break/GlowIcon.cs index 2810389619..9222e8f890 100644 --- a/osu.Game/Screens/Play/Break/GlowIcon.cs +++ b/osu.Game/Screens/Play/Break/GlowIcon.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Play/Break/LetterboxOverlay.cs b/osu.Game/Screens/Play/Break/LetterboxOverlay.cs index 2d7163b5fe..3eb58da469 100644 --- a/osu.Game/Screens/Play/Break/LetterboxOverlay.cs +++ b/osu.Game/Screens/Play/Break/LetterboxOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Play/Break/RemainingTimeCounter.cs b/osu.Game/Screens/Play/Break/RemainingTimeCounter.cs index 2f5e43aebf..4b84f7c69e 100644 --- a/osu.Game/Screens/Play/Break/RemainingTimeCounter.cs +++ b/osu.Game/Screens/Play/Break/RemainingTimeCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Screens/Play/BreakOverlay.cs b/osu.Game/Screens/Play/BreakOverlay.cs index 1665ee83ae..492c9c27ff 100644 --- a/osu.Game/Screens/Play/BreakOverlay.cs +++ b/osu.Game/Screens/Play/BreakOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Play/BreakTracker.cs b/osu.Game/Screens/Play/BreakTracker.cs index 8441b7657e..8679db01a0 100644 --- a/osu.Game/Screens/Play/BreakTracker.cs +++ b/osu.Game/Screens/Play/BreakTracker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Play/ComboEffects.cs b/osu.Game/Screens/Play/ComboEffects.cs index 5041d07e5d..77681401bb 100644 --- a/osu.Game/Screens/Play/ComboEffects.cs +++ b/osu.Game/Screens/Play/ComboEffects.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Play/DimmableStoryboard.cs b/osu.Game/Screens/Play/DimmableStoryboard.cs index 5a3ef1e9d3..ae43d3d70d 100644 --- a/osu.Game/Screens/Play/DimmableStoryboard.cs +++ b/osu.Game/Screens/Play/DimmableStoryboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Play/EpilepsyWarning.cs b/osu.Game/Screens/Play/EpilepsyWarning.cs index ccb2870d78..4f87853158 100644 --- a/osu.Game/Screens/Play/EpilepsyWarning.cs +++ b/osu.Game/Screens/Play/EpilepsyWarning.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Play/FailAnimation.cs b/osu.Game/Screens/Play/FailAnimation.cs index 17a3e5eb71..ca485aa8ea 100644 --- a/osu.Game/Screens/Play/FailAnimation.cs +++ b/osu.Game/Screens/Play/FailAnimation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Game.Rulesets.UI; diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index b67f45c4f2..1a31b0f462 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Graphics; using osuTK.Graphics; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Play/GameplayClock.cs b/osu.Game/Screens/Play/GameplayClock.cs index 54aa395f5f..e6248014c5 100644 --- a/osu.Game/Screens/Play/GameplayClock.cs +++ b/osu.Game/Screens/Play/GameplayClock.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index 721abc66f8..6403943a53 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index 9e3400b09d..99b9362700 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Play/GameplayState.cs b/osu.Game/Screens/Play/GameplayState.cs index 586cdcda51..9fb62106f3 100644 --- a/osu.Game/Screens/Play/GameplayState.cs +++ b/osu.Game/Screens/Play/GameplayState.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Play/HUD/DefaultAccuracyCounter.cs b/osu.Game/Screens/Play/HUD/DefaultAccuracyCounter.cs index 06b53e8426..018720510c 100644 --- a/osu.Game/Screens/Play/HUD/DefaultAccuracyCounter.cs +++ b/osu.Game/Screens/Play/HUD/DefaultAccuracyCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Skinning; diff --git a/osu.Game/Screens/Play/HUD/DefaultComboCounter.cs b/osu.Game/Screens/Play/HUD/DefaultComboCounter.cs index 52f86d2bc3..1f14811169 100644 --- a/osu.Game/Screens/Play/HUD/DefaultComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/DefaultComboCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Play/HUD/DefaultHealthDisplay.cs b/osu.Game/Screens/Play/HUD/DefaultHealthDisplay.cs index 4f93868a66..37e1d2fb84 100644 --- a/osu.Game/Screens/Play/HUD/DefaultHealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/DefaultHealthDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Screens/Play/HUD/DefaultScoreCounter.cs b/osu.Game/Screens/Play/HUD/DefaultScoreCounter.cs index 6af89404e0..4450ad53d8 100644 --- a/osu.Game/Screens/Play/HUD/DefaultScoreCounter.cs +++ b/osu.Game/Screens/Play/HUD/DefaultScoreCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Play/HUD/FailingLayer.cs b/osu.Game/Screens/Play/HUD/FailingLayer.cs index ceb81f6b8d..10c1d418ee 100644 --- a/osu.Game/Screens/Play/HUD/FailingLayer.cs +++ b/osu.Game/Screens/Play/HUD/FailingLayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs b/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs index 7a63084812..afb6749436 100644 --- a/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs +++ b/osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs b/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs index 638b2c395f..f21ce5e36a 100644 --- a/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs +++ b/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Screens/Play/HUD/GameplayLeaderboardScore.cs b/osu.Game/Screens/Play/HUD/GameplayLeaderboardScore.cs index 773ee4a036..0f007cd1cb 100644 --- a/osu.Game/Screens/Play/HUD/GameplayLeaderboardScore.cs +++ b/osu.Game/Screens/Play/HUD/GameplayLeaderboardScore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Play/HUD/GameplayScoreCounter.cs b/osu.Game/Screens/Play/HUD/GameplayScoreCounter.cs index e05eff5f3e..7a6292ccbf 100644 --- a/osu.Game/Screens/Play/HUD/GameplayScoreCounter.cs +++ b/osu.Game/Screens/Play/HUD/GameplayScoreCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Play/HUD/HealthDisplay.cs b/osu.Game/Screens/Play/HUD/HealthDisplay.cs index 94f1b99b37..569b37aea5 100644 --- a/osu.Game/Screens/Play/HUD/HealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/HealthDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs index dca50c07ad..747f4d4a8a 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs index 9948b968d1..335d956e39 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs index e7aaee9fa1..26befd659c 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index 2ba76d0896..aa9a2ab242 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Play/HUD/ILeaderboardScore.cs b/osu.Game/Screens/Play/HUD/ILeaderboardScore.cs index 83b6f6621b..20bf7045b8 100644 --- a/osu.Game/Screens/Play/HUD/ILeaderboardScore.cs +++ b/osu.Game/Screens/Play/HUD/ILeaderboardScore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; namespace osu.Game.Screens.Play.HUD diff --git a/osu.Game/Screens/Play/HUD/LegacyComboCounter.cs b/osu.Game/Screens/Play/HUD/LegacyComboCounter.cs index eaca623e39..6e36ffb54e 100644 --- a/osu.Game/Screens/Play/HUD/LegacyComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/LegacyComboCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Play/HUD/MatchScoreDisplay.cs b/osu.Game/Screens/Play/HUD/MatchScoreDisplay.cs index 2129000268..00dc586448 100644 --- a/osu.Game/Screens/Play/HUD/MatchScoreDisplay.cs +++ b/osu.Game/Screens/Play/HUD/MatchScoreDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index b4a3eb209a..0badc063ce 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Play/HUD/ModFlowDisplay.cs b/osu.Game/Screens/Play/HUD/ModFlowDisplay.cs index ff3ca6460f..86fece84fa 100644 --- a/osu.Game/Screens/Play/HUD/ModFlowDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModFlowDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs index 5ee6000cf0..ac58325060 100644 --- a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs +++ b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs b/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs index bdc98e53f9..97a120f9bd 100644 --- a/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs +++ b/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index 807b4989c7..5f6f040959 100644 --- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; diff --git a/osu.Game/Screens/Play/HUD/SkinnableInfo.cs b/osu.Game/Screens/Play/HUD/SkinnableInfo.cs index 1f659fd5bf..f045ab661e 100644 --- a/osu.Game/Screens/Play/HUD/SkinnableInfo.cs +++ b/osu.Game/Screens/Play/HUD/SkinnableInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Play/HUD/UnstableRateCounter.cs b/osu.Game/Screens/Play/HUD/UnstableRateCounter.cs index a71b661965..0ba88c549e 100644 --- a/osu.Game/Screens/Play/HUD/UnstableRateCounter.cs +++ b/osu.Game/Screens/Play/HUD/UnstableRateCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 89329bfc65..fe27e1fc24 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Play/HotkeyExitOverlay.cs b/osu.Game/Screens/Play/HotkeyExitOverlay.cs index 9fe7d17cc7..07595a43c4 100644 --- a/osu.Game/Screens/Play/HotkeyExitOverlay.cs +++ b/osu.Game/Screens/Play/HotkeyExitOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Input.Bindings; diff --git a/osu.Game/Screens/Play/HotkeyRetryOverlay.cs b/osu.Game/Screens/Play/HotkeyRetryOverlay.cs index 2812df8bbe..94c0f0a89d 100644 --- a/osu.Game/Screens/Play/HotkeyRetryOverlay.cs +++ b/osu.Game/Screens/Play/HotkeyRetryOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Input.Bindings; diff --git a/osu.Game/Screens/Play/ILocalUserPlayInfo.cs b/osu.Game/Screens/Play/ILocalUserPlayInfo.cs index 9a2259b12f..e4328b2c78 100644 --- a/osu.Game/Screens/Play/ILocalUserPlayInfo.cs +++ b/osu.Game/Screens/Play/ILocalUserPlayInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 98df73a5e6..1e5ada5295 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Play/KeyCounterAction.cs b/osu.Game/Screens/Play/KeyCounterAction.cs index 00eddcc776..f636796436 100644 --- a/osu.Game/Screens/Play/KeyCounterAction.cs +++ b/osu.Game/Screens/Play/KeyCounterAction.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; namespace osu.Game.Screens.Play diff --git a/osu.Game/Screens/Play/KeyCounterDisplay.cs b/osu.Game/Screens/Play/KeyCounterDisplay.cs index 66a44e5314..ef28632d76 100644 --- a/osu.Game/Screens/Play/KeyCounterDisplay.cs +++ b/osu.Game/Screens/Play/KeyCounterDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Play/KeyCounterKeyboard.cs b/osu.Game/Screens/Play/KeyCounterKeyboard.cs index 187dcc1264..1005de4ea4 100644 --- a/osu.Game/Screens/Play/KeyCounterKeyboard.cs +++ b/osu.Game/Screens/Play/KeyCounterKeyboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Input.Events; using osuTK.Input; diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index e55525c5e8..0dc2830665 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Input.Events; using osuTK.Input; using osuTK; diff --git a/osu.Game/Screens/Play/KeyCounterState.cs b/osu.Game/Screens/Play/KeyCounterState.cs index 0bceae9f85..45d027e5ec 100644 --- a/osu.Game/Screens/Play/KeyCounterState.cs +++ b/osu.Game/Screens/Play/KeyCounterState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Screens.Play { public class KeyCounterState diff --git a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs index d87d57ec49..0994a7d9bb 100644 --- a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs +++ b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index e0b7e5c941..cb98fefcfe 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 33a20ff190..4a8460ff46 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Linq; diff --git a/osu.Game/Screens/Play/PlayerConfiguration.cs b/osu.Game/Screens/Play/PlayerConfiguration.cs index 3aa424e5d5..d11825baee 100644 --- a/osu.Game/Screens/Play/PlayerConfiguration.cs +++ b/osu.Game/Screens/Play/PlayerConfiguration.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Screens.Play { public class PlayerConfiguration diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index f3b22c3355..5d7319c51f 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Diagnostics; using System.Threading.Tasks; diff --git a/osu.Game/Screens/Play/PlayerSettings/AudioSettings.cs b/osu.Game/Screens/Play/PlayerSettings/AudioSettings.cs index 90caf6f0f3..606b5c198c 100644 --- a/osu.Game/Screens/Play/PlayerSettings/AudioSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/AudioSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs b/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs index 1662ca399f..75da8e7b9d 100644 --- a/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs +++ b/osu.Game/Screens/Play/PlayerSettings/BeatmapOffsetControl.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs b/osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs index ac040774ee..afbd5caef3 100644 --- a/osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Configuration; diff --git a/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs index b1063966da..04cf79873c 100644 --- a/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Configuration; diff --git a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs index 16e29ac3c8..12646d656a 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerCheckbox.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerCheckbox.cs index 26887327cd..dc09676254 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerCheckbox.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerCheckbox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index 0bbe6902f4..6c6f62a8ac 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Input.Events; using osu.Game.Overlays; diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSliderBar.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSliderBar.cs index 3f1a5bc0ac..063056e83e 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSliderBar.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSliderBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs index a999b32cb4..e55af0bba7 100644 --- a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Configuration; diff --git a/osu.Game/Screens/Play/ReplayPlayer.cs b/osu.Game/Screens/Play/ReplayPlayer.cs index 617374b4fd..2a5e356df8 100644 --- a/osu.Game/Screens/Play/ReplayPlayer.cs +++ b/osu.Game/Screens/Play/ReplayPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Play/ReplayPlayerLoader.cs b/osu.Game/Screens/Play/ReplayPlayerLoader.cs index e78f700af2..a961f90d00 100644 --- a/osu.Game/Screens/Play/ReplayPlayerLoader.cs +++ b/osu.Game/Screens/Play/ReplayPlayerLoader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Screens; using osu.Game.Scoring; diff --git a/osu.Game/Screens/Play/ResumeOverlay.cs b/osu.Game/Screens/Play/ResumeOverlay.cs index 641d5358ba..2be1f93f80 100644 --- a/osu.Game/Screens/Play/ResumeOverlay.cs +++ b/osu.Game/Screens/Play/ResumeOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Play/RoomSubmittingPlayer.cs b/osu.Game/Screens/Play/RoomSubmittingPlayer.cs index fc96dfa965..3eb659664a 100644 --- a/osu.Game/Screens/Play/RoomSubmittingPlayer.cs +++ b/osu.Game/Screens/Play/RoomSubmittingPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using osu.Game.Online.API; using osu.Game.Online.Rooms; diff --git a/osu.Game/Screens/Play/ScreenSuspensionHandler.cs b/osu.Game/Screens/Play/ScreenSuspensionHandler.cs index 30ca15c311..59b92a1b97 100644 --- a/osu.Game/Screens/Play/ScreenSuspensionHandler.cs +++ b/osu.Game/Screens/Play/ScreenSuspensionHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 88dab88d42..7152fb7473 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Screens.Backgrounds; diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 84d5507dce..3e2cf9a756 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Play/SoloPlayer.cs b/osu.Game/Screens/Play/SoloPlayer.cs index a935ce49eb..b65602e7a8 100644 --- a/osu.Game/Screens/Play/SoloPlayer.cs +++ b/osu.Game/Screens/Play/SoloPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using osu.Game.Beatmaps; diff --git a/osu.Game/Screens/Play/SoloSpectator.cs b/osu.Game/Screens/Play/SoloSpectator.cs index 202527f308..7eaba40640 100644 --- a/osu.Game/Screens/Play/SoloSpectator.cs +++ b/osu.Game/Screens/Play/SoloSpectator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Play/SoloSpectatorPlayer.cs b/osu.Game/Screens/Play/SoloSpectatorPlayer.cs index 5b601083c2..5aa310750b 100644 --- a/osu.Game/Screens/Play/SoloSpectatorPlayer.cs +++ b/osu.Game/Screens/Play/SoloSpectatorPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Screens; using osu.Game.Online.Spectator; diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index b38dcb937d..d1510d10c2 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index 5052b32335..67923f4b6a 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osuTK; using osuTK.Graphics; diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index f96de149ba..c742df67ce 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Screens/Play/SongProgressInfo.cs b/osu.Game/Screens/Play/SongProgressInfo.cs index 7a458cdde0..40759c3a3b 100644 --- a/osu.Game/Screens/Play/SongProgressInfo.cs +++ b/osu.Game/Screens/Play/SongProgressInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Play/SpectatorPlayer.cs b/osu.Game/Screens/Play/SpectatorPlayer.cs index 09bec9b89f..d5aec055fc 100644 --- a/osu.Game/Screens/Play/SpectatorPlayer.cs +++ b/osu.Game/Screens/Play/SpectatorPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Screens; diff --git a/osu.Game/Screens/Play/SpectatorPlayerLoader.cs b/osu.Game/Screens/Play/SpectatorPlayerLoader.cs index 9ca5475ee4..6b664a4f96 100644 --- a/osu.Game/Screens/Play/SpectatorPlayerLoader.cs +++ b/osu.Game/Screens/Play/SpectatorPlayerLoader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Screens; using osu.Game.Scoring; diff --git a/osu.Game/Screens/Play/SpectatorResultsScreen.cs b/osu.Game/Screens/Play/SpectatorResultsScreen.cs index fd7af3af85..3d320bd294 100644 --- a/osu.Game/Screens/Play/SpectatorResultsScreen.cs +++ b/osu.Game/Screens/Play/SpectatorResultsScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Screens; using osu.Game.Online.Spectator; diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index a7d4454701..00d6ede3bf 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Play/SubmittingPlayer.cs b/osu.Game/Screens/Play/SubmittingPlayer.cs index b62dc1e5a6..1cc0d1853d 100644 --- a/osu.Game/Screens/Play/SubmittingPlayer.cs +++ b/osu.Game/Screens/Play/SubmittingPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using System.Threading.Tasks; diff --git a/osu.Game/Screens/Ranking/AspectContainer.cs b/osu.Game/Screens/Ranking/AspectContainer.cs index 84329d2a04..1c93d08474 100644 --- a/osu.Game/Screens/Ranking/AspectContainer.cs +++ b/osu.Game/Screens/Ranking/AspectContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Ranking/Contracted/ContractedPanelMiddleContent.cs b/osu.Game/Screens/Ranking/Contracted/ContractedPanelMiddleContent.cs index bb286f41c0..7b8b4ce608 100644 --- a/osu.Game/Screens/Ranking/Contracted/ContractedPanelMiddleContent.cs +++ b/osu.Game/Screens/Ranking/Contracted/ContractedPanelMiddleContent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Screens/Ranking/Contracted/ContractedPanelTopContent.cs b/osu.Game/Screens/Ranking/Contracted/ContractedPanelTopContent.cs index beff509dc6..74b2f4ef93 100644 --- a/osu.Game/Screens/Ranking/Contracted/ContractedPanelTopContent.cs +++ b/osu.Game/Screens/Ranking/Contracted/ContractedPanelTopContent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index b9248bd67e..a1879c5c9b 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/RankBadge.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/RankBadge.cs index d0b79aa4c7..80415dbbc2 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/RankBadge.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/RankBadge.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/RankNotch.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/RankNotch.cs index 894790b5b6..573833932f 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/RankNotch.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/RankNotch.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs index 5aea0184ee..2d9c1f9d07 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/SmoothCircularProgress.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/SmoothCircularProgress.cs index 106af31cae..b4f41e0f39 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/SmoothCircularProgress.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/SmoothCircularProgress.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs b/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs index b924fbd5df..5b8777d2a4 100644 --- a/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs +++ b/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Ranking/Expanded/ExpandedPanelTopContent.cs b/osu.Game/Screens/Ranking/Expanded/ExpandedPanelTopContent.cs index bf06bc2227..d2b2a842b8 100644 --- a/osu.Game/Screens/Ranking/Expanded/ExpandedPanelTopContent.cs +++ b/osu.Game/Screens/Ranking/Expanded/ExpandedPanelTopContent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/AccuracyStatistic.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/AccuracyStatistic.cs index 25a644d8d9..824156598c 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/AccuracyStatistic.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/AccuracyStatistic.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs index cb25736f6e..5d7b04743e 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/CounterStatistic.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/CounterStatistic.cs index b1c72173da..17a12a76a5 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/CounterStatistic.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/CounterStatistic.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Localisation; diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/HitResultStatistic.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/HitResultStatistic.cs index ada8dfabf0..c23a5e668d 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/HitResultStatistic.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/HitResultStatistic.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/PerformanceStatistic.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/PerformanceStatistic.cs index c681946a2f..332215e15d 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/PerformanceStatistic.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/PerformanceStatistic.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/StatisticCounter.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/StatisticCounter.cs index bbcfc43dc8..36d6d6fa7c 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/StatisticCounter.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/StatisticCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/StatisticDisplay.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/StatisticDisplay.cs index c034abc916..0d8dcda895 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/StatisticDisplay.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/StatisticDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Screens/Ranking/Expanded/TotalScoreCounter.cs b/osu.Game/Screens/Ranking/Expanded/TotalScoreCounter.cs index c54bca9e3a..0b06dedc44 100644 --- a/osu.Game/Screens/Ranking/Expanded/TotalScoreCounter.cs +++ b/osu.Game/Screens/Ranking/Expanded/TotalScoreCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Ranking/PanelState.cs b/osu.Game/Screens/Ranking/PanelState.cs index 94e2c7cef4..3af74fe0f3 100644 --- a/osu.Game/Screens/Ranking/PanelState.cs +++ b/osu.Game/Screens/Ranking/PanelState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Screens.Ranking { public enum PanelState diff --git a/osu.Game/Screens/Ranking/ReplayDownloadButton.cs b/osu.Game/Screens/Ranking/ReplayDownloadButton.cs index 0c9c909395..954a5159b9 100644 --- a/osu.Game/Screens/Ranking/ReplayDownloadButton.cs +++ b/osu.Game/Screens/Ranking/ReplayDownloadButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index 98514cd846..2f8868c06d 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Ranking/RetryButton.cs b/osu.Game/Screens/Ranking/RetryButton.cs index 59b69bc949..a0ddc98943 100644 --- a/osu.Game/Screens/Ranking/RetryButton.cs +++ b/osu.Game/Screens/Ranking/RetryButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Screens/Ranking/ScorePanel.cs b/osu.Game/Screens/Ranking/ScorePanel.cs index bc6eb9e366..babdd4b149 100644 --- a/osu.Game/Screens/Ranking/ScorePanel.cs +++ b/osu.Game/Screens/Ranking/ScorePanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Ranking/ScorePanelList.cs b/osu.Game/Screens/Ranking/ScorePanelList.cs index a5341242e2..4f9e61a4a1 100644 --- a/osu.Game/Screens/Ranking/ScorePanelList.cs +++ b/osu.Game/Screens/Ranking/ScorePanelList.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Screens/Ranking/ScorePanelTrackingContainer.cs b/osu.Game/Screens/Ranking/ScorePanelTrackingContainer.cs index c8010d1c32..e55c4530b4 100644 --- a/osu.Game/Screens/Ranking/ScorePanelTrackingContainer.cs +++ b/osu.Game/Screens/Ranking/ScorePanelTrackingContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Ranking/SoloResultsScreen.cs b/osu.Game/Screens/Ranking/SoloResultsScreen.cs index 2ec6c38287..4813cd65db 100644 --- a/osu.Game/Screens/Ranking/SoloResultsScreen.cs +++ b/osu.Game/Screens/Ranking/SoloResultsScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Ranking/Statistics/AverageHitError.cs b/osu.Game/Screens/Ranking/Statistics/AverageHitError.cs index d0e70251e7..a0a9c1c1e2 100644 --- a/osu.Game/Screens/Ranking/Statistics/AverageHitError.cs +++ b/osu.Game/Screens/Ranking/Statistics/AverageHitError.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game/Screens/Ranking/Statistics/HitEventTimingDistributionGraph.cs b/osu.Game/Screens/Ranking/Statistics/HitEventTimingDistributionGraph.cs index f7c9d36cc4..db69e270f6 100644 --- a/osu.Game/Screens/Ranking/Statistics/HitEventTimingDistributionGraph.cs +++ b/osu.Game/Screens/Ranking/Statistics/HitEventTimingDistributionGraph.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Ranking/Statistics/PerformanceBreakdownChart.cs b/osu.Game/Screens/Ranking/Statistics/PerformanceBreakdownChart.cs index 5b42554716..3462a85e1c 100644 --- a/osu.Game/Screens/Ranking/Statistics/PerformanceBreakdownChart.cs +++ b/osu.Game/Screens/Ranking/Statistics/PerformanceBreakdownChart.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Ranking/Statistics/SimpleStatisticItem.cs b/osu.Game/Screens/Ranking/Statistics/SimpleStatisticItem.cs index 6fe7e4eda8..ecff631c7e 100644 --- a/osu.Game/Screens/Ranking/Statistics/SimpleStatisticItem.cs +++ b/osu.Game/Screens/Ranking/Statistics/SimpleStatisticItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Ranking/Statistics/SimpleStatisticTable.cs b/osu.Game/Screens/Ranking/Statistics/SimpleStatisticTable.cs index 8b503cc04e..f1eb16ca80 100644 --- a/osu.Game/Screens/Ranking/Statistics/SimpleStatisticTable.cs +++ b/osu.Game/Screens/Ranking/Statistics/SimpleStatisticTable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Ranking/Statistics/StatisticContainer.cs b/osu.Game/Screens/Ranking/Statistics/StatisticContainer.cs index 79f813ef64..078ca97737 100644 --- a/osu.Game/Screens/Ranking/Statistics/StatisticContainer.cs +++ b/osu.Game/Screens/Ranking/Statistics/StatisticContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics.CodeAnalysis; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Ranking/Statistics/StatisticItem.cs b/osu.Game/Screens/Ranking/Statistics/StatisticItem.cs index b43fbbdeee..0e5cce59f8 100644 --- a/osu.Game/Screens/Ranking/Statistics/StatisticItem.cs +++ b/osu.Game/Screens/Ranking/Statistics/StatisticItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Ranking/Statistics/StatisticRow.cs b/osu.Game/Screens/Ranking/Statistics/StatisticRow.cs index e1ca9799a3..9f5f44918e 100644 --- a/osu.Game/Screens/Ranking/Statistics/StatisticRow.cs +++ b/osu.Game/Screens/Ranking/Statistics/StatisticRow.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; namespace osu.Game.Screens.Ranking.Statistics diff --git a/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs b/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs index 898bd69b2c..384f4c4d4f 100644 --- a/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs +++ b/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using System.Threading; diff --git a/osu.Game/Screens/Ranking/Statistics/UnstableRate.cs b/osu.Game/Screens/Ranking/Statistics/UnstableRate.cs index 0d23490f40..4ab085fa23 100644 --- a/osu.Game/Screens/Ranking/Statistics/UnstableRate.cs +++ b/osu.Game/Screens/Ranking/Statistics/UnstableRate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game/Screens/ScorePresentType.cs b/osu.Game/Screens/ScorePresentType.cs index 3216f92091..24105467f1 100644 --- a/osu.Game/Screens/ScorePresentType.cs +++ b/osu.Game/Screens/ScorePresentType.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Screens { public enum ScorePresentType diff --git a/osu.Game/Screens/ScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs index 3a9e7b8f18..550fda5480 100644 --- a/osu.Game/Screens/ScreenWhiteBox.cs +++ b/osu.Game/Screens/ScreenWhiteBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Screens; diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index e62b285966..87a1fb4ccb 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index 4a16be4a3a..84426d230b 100644 --- a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading.Tasks; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs index b156c2485b..e3b83d5780 100644 --- a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs +++ b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 72c2ba708b..dfcd43189b 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaDetailTabItem.cs b/osu.Game/Screens/Select/BeatmapDetailAreaDetailTabItem.cs index 7376cb4708..d6b076f30b 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaDetailTabItem.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaDetailTabItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Screens.Select { public class BeatmapDetailAreaDetailTabItem : BeatmapDetailAreaTabItem diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaLeaderboardTabItem.cs b/osu.Game/Screens/Select/BeatmapDetailAreaLeaderboardTabItem.cs index 066944e9d2..6efadc77b3 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaLeaderboardTabItem.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaLeaderboardTabItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Screens.Select diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index 0fd39db97c..3c0d621abe 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osuTK.Graphics; diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabItem.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabItem.cs index f28e5a7c22..7b7a93d6ee 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabItem.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Screens.Select diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 9ff1574fe4..fdc0d4efdd 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index d98238f518..3ee9a11b24 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Select/BeatmapInfoWedgeBackground.cs b/osu.Game/Screens/Select/BeatmapInfoWedgeBackground.cs index d9b8a20846..68f0c92097 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedgeBackground.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedgeBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs index c3f6b3ad83..c57cbcfba4 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Game.Beatmaps; diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs index fc4b6c27f3..36ec536780 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs index 6ebe314072..1cd9674b72 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs @@ -4,8 +4,6 @@ using System.Collections.Generic; using System.Linq; -#nullable enable - namespace osu.Game.Screens.Select.Carousel { /// diff --git a/osu.Game/Screens/Select/Carousel/CarouselGroupEagerSelect.cs b/osu.Game/Screens/Select/Carousel/CarouselGroupEagerSelect.cs index aac0e4ed82..4805c7e2a4 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselGroupEagerSelect.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselGroupEagerSelect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Select/Carousel/CarouselHeader.cs b/osu.Game/Screens/Select/Carousel/CarouselHeader.cs index ed3aea3445..5cde5f7d5a 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselHeader.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselHeader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; diff --git a/osu.Game/Screens/Select/Carousel/CarouselItem.cs b/osu.Game/Screens/Select/Carousel/CarouselItem.cs index 4bd477412d..a901f72dad 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselItem.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 065a29b53c..1bea689e7c 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 80f1231454..fc29f509ad 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs index 75bcdedec4..c92a0ac4ac 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Select/Carousel/FilterableDifficultyIcon.cs b/osu.Game/Screens/Select/Carousel/FilterableDifficultyIcon.cs index ce0cec837b..b0841caa47 100644 --- a/osu.Game/Screens/Select/Carousel/FilterableDifficultyIcon.cs +++ b/osu.Game/Screens/Select/Carousel/FilterableDifficultyIcon.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Events; diff --git a/osu.Game/Screens/Select/Carousel/FilterableGroupedDifficultyIcon.cs b/osu.Game/Screens/Select/Carousel/FilterableGroupedDifficultyIcon.cs index acffdd9f64..f883740fd7 100644 --- a/osu.Game/Screens/Select/Carousel/FilterableGroupedDifficultyIcon.cs +++ b/osu.Game/Screens/Select/Carousel/FilterableGroupedDifficultyIcon.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Select/Carousel/SetPanelBackground.cs b/osu.Game/Screens/Select/Carousel/SetPanelBackground.cs index 2a37969be1..2a435e084c 100644 --- a/osu.Game/Screens/Select/Carousel/SetPanelBackground.cs +++ b/osu.Game/Screens/Select/Carousel/SetPanelBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Select/Carousel/SetPanelContent.cs b/osu.Game/Screens/Select/Carousel/SetPanelContent.cs index a000cfd5fc..73a835d67f 100644 --- a/osu.Game/Screens/Select/Carousel/SetPanelContent.cs +++ b/osu.Game/Screens/Select/Carousel/SetPanelContent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Select/Carousel/TopLocalRank.cs b/osu.Game/Screens/Select/Carousel/TopLocalRank.cs index e1f9c1b508..a948e5b0bd 100644 --- a/osu.Game/Screens/Select/Carousel/TopLocalRank.cs +++ b/osu.Game/Screens/Select/Carousel/TopLocalRank.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index a6f2520472..59eb3fa607 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Screens/Select/Details/FailRetryGraph.cs b/osu.Game/Screens/Select/Details/FailRetryGraph.cs index 312c55b242..6fa6d50217 100644 --- a/osu.Game/Screens/Select/Details/FailRetryGraph.cs +++ b/osu.Game/Screens/Select/Details/FailRetryGraph.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Select/Details/UserRatings.cs b/osu.Game/Screens/Select/Details/UserRatings.cs index c2be3528fc..39cb9c3d15 100644 --- a/osu.Game/Screens/Select/Details/UserRatings.cs +++ b/osu.Game/Screens/Select/Details/UserRatings.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Screens/Select/Filter/GroupMode.cs b/osu.Game/Screens/Select/Filter/GroupMode.cs index d794c215a3..8e2b9271b0 100644 --- a/osu.Game/Screens/Select/Filter/GroupMode.cs +++ b/osu.Game/Screens/Select/Filter/GroupMode.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; namespace osu.Game.Screens.Select.Filter diff --git a/osu.Game/Screens/Select/Filter/Operator.cs b/osu.Game/Screens/Select/Filter/Operator.cs index 706daf631f..a6a53f0c3e 100644 --- a/osu.Game/Screens/Select/Filter/Operator.cs +++ b/osu.Game/Screens/Select/Filter/Operator.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Screens.Select.Filter { /// diff --git a/osu.Game/Screens/Select/Filter/SortMode.cs b/osu.Game/Screens/Select/Filter/SortMode.cs index 3dd3381059..48f774393e 100644 --- a/osu.Game/Screens/Select/Filter/SortMode.cs +++ b/osu.Game/Screens/Select/Filter/SortMode.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 65dde146bb..da764223a3 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Select/FilterCriteria.cs b/osu.Game/Screens/Select/FilterCriteria.cs index 1f6e99f0c6..c7e6e8496a 100644 --- a/osu.Game/Screens/Select/FilterCriteria.cs +++ b/osu.Game/Screens/Select/FilterCriteria.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Select/FilterQueryParser.cs b/osu.Game/Screens/Select/FilterQueryParser.cs index 94df8addb3..92f707ae3e 100644 --- a/osu.Game/Screens/Select/FilterQueryParser.cs +++ b/osu.Game/Screens/Select/FilterQueryParser.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; using System.Linq; diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index ee13ebda44..86fe76c0c6 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osuTK; diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 1587f43258..c251e94ef2 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osuTK; using osuTK.Graphics; diff --git a/osu.Game/Screens/Select/FooterButtonMods.cs b/osu.Game/Screens/Select/FooterButtonMods.cs index 5bbca5ca1a..2732b5baa8 100644 --- a/osu.Game/Screens/Select/FooterButtonMods.cs +++ b/osu.Game/Screens/Select/FooterButtonMods.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Screens.Play.HUD; diff --git a/osu.Game/Screens/Select/FooterButtonOptions.cs b/osu.Game/Screens/Select/FooterButtonOptions.cs index e549656785..764f56e79c 100644 --- a/osu.Game/Screens/Select/FooterButtonOptions.cs +++ b/osu.Game/Screens/Select/FooterButtonOptions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Select/FooterButtonRandom.cs b/osu.Game/Screens/Select/FooterButtonRandom.cs index f855b80f75..1f56915f62 100644 --- a/osu.Game/Screens/Select/FooterButtonRandom.cs +++ b/osu.Game/Screens/Select/FooterButtonRandom.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index 8d1654eb1d..f1f11518ee 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboardScope.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboardScope.cs index 5bcb4c27a7..b8840b124a 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboardScope.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboardScope.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel; using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; diff --git a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs index cb96e3f23e..3c05a1fa5a 100644 --- a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs +++ b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Game.Overlays.Dialog; using osu.Game.Scoring; diff --git a/osu.Game/Screens/Select/NoResultsPlaceholder.cs b/osu.Game/Screens/Select/NoResultsPlaceholder.cs index 28a0541a22..e1a8e3e060 100644 --- a/osu.Game/Screens/Select/NoResultsPlaceholder.cs +++ b/osu.Game/Screens/Select/NoResultsPlaceholder.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index df7dd47ef3..69800c4e86 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs index 1a8b69d859..8785dac0aa 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Select/PlayBeatmapDetailArea.cs b/osu.Game/Screens/Select/PlayBeatmapDetailArea.cs index 09f75b7658..4d3c844753 100644 --- a/osu.Game/Screens/Select/PlayBeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/PlayBeatmapDetailArea.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index ec8b2e029a..c24ca9a7cf 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Select/SkinDeleteDialog.cs b/osu.Game/Screens/Select/SkinDeleteDialog.cs index 4262118658..8defd6347a 100644 --- a/osu.Game/Screens/Select/SkinDeleteDialog.cs +++ b/osu.Game/Screens/Select/SkinDeleteDialog.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osu.Game.Skinning; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 3bfdc845ab..a17e7823a6 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; diff --git a/osu.Game/Screens/Select/WedgeBackground.cs b/osu.Game/Screens/Select/WedgeBackground.cs index f1337a8119..4a5b9d8911 100644 --- a/osu.Game/Screens/Select/WedgeBackground.cs +++ b/osu.Game/Screens/Select/WedgeBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Spectate/SpectatorGameplayState.cs b/osu.Game/Screens/Spectate/SpectatorGameplayState.cs index 6ca1ac9a0a..498363adef 100644 --- a/osu.Game/Screens/Spectate/SpectatorGameplayState.cs +++ b/osu.Game/Screens/Spectate/SpectatorGameplayState.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Rulesets; using osu.Game.Scoring; diff --git a/osu.Game/Screens/Spectate/SpectatorScreen.cs b/osu.Game/Screens/Spectate/SpectatorScreen.cs index 9eb374f0f7..0c1fe56eb6 100644 --- a/osu.Game/Screens/Spectate/SpectatorScreen.cs +++ b/osu.Game/Screens/Spectate/SpectatorScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Screens/StartupScreen.cs b/osu.Game/Screens/StartupScreen.cs index be217d6b1f..89761d80de 100644 --- a/osu.Game/Screens/StartupScreen.cs +++ b/osu.Game/Screens/StartupScreen.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Overlays; namespace osu.Game.Screens diff --git a/osu.Game/Screens/Utility/ButtonWithKeyBind.cs b/osu.Game/Screens/Utility/ButtonWithKeyBind.cs index ef87e0bca7..7df9a22ce4 100644 --- a/osu.Game/Screens/Utility/ButtonWithKeyBind.cs +++ b/osu.Game/Screens/Utility/ButtonWithKeyBind.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable using osu.Framework.Allocation; using osu.Framework.Input.Events; using osu.Framework.Localisation; diff --git a/osu.Game/Screens/Utility/CircleGameplay.cs b/osu.Game/Screens/Utility/CircleGameplay.cs index dd59721a65..1ee5567c43 100644 --- a/osu.Game/Screens/Utility/CircleGameplay.cs +++ b/osu.Game/Screens/Utility/CircleGameplay.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Utility/LatencyArea.cs b/osu.Game/Screens/Utility/LatencyArea.cs index 21688f0b0c..61a97d92b0 100644 --- a/osu.Game/Screens/Utility/LatencyArea.cs +++ b/osu.Game/Screens/Utility/LatencyArea.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 8210e6825a..8675078a5e 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Screens/Utility/LatencyVisualMode.cs b/osu.Game/Screens/Utility/LatencyVisualMode.cs index cc15f79be8..c4022d09b2 100644 --- a/osu.Game/Screens/Utility/LatencyVisualMode.cs +++ b/osu.Game/Screens/Utility/LatencyVisualMode.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable namespace osu.Game.Screens.Utility { public enum LatencyVisualMode diff --git a/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs b/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs index e4c2b504cb..40911684f8 100644 --- a/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs +++ b/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs b/osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs index a7da05fbb1..8b6841caf0 100644 --- a/osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs +++ b/osu.Game/Screens/Utility/SampleComponents/LatencyMovableBox.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; diff --git a/osu.Game/Screens/Utility/SampleComponents/LatencySampleComponent.cs b/osu.Game/Screens/Utility/SampleComponents/LatencySampleComponent.cs index c3233d5aa5..834865d237 100644 --- a/osu.Game/Screens/Utility/SampleComponents/LatencySampleComponent.cs +++ b/osu.Game/Screens/Utility/SampleComponents/LatencySampleComponent.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Utility/ScrollingGameplay.cs b/osu.Game/Screens/Utility/ScrollingGameplay.cs index a32fd3b37f..1f40514cd5 100644 --- a/osu.Game/Screens/Utility/ScrollingGameplay.cs +++ b/osu.Game/Screens/Utility/ScrollingGameplay.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable using System; using System.Collections.Generic; using osu.Framework.Allocation; diff --git a/osu.Game/Skinning/BeatmapSkinProvidingContainer.cs b/osu.Game/Skinning/BeatmapSkinProvidingContainer.cs index 2ba301deed..abc7b61036 100644 --- a/osu.Game/Skinning/BeatmapSkinProvidingContainer.cs +++ b/osu.Game/Skinning/BeatmapSkinProvidingContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Skinning/Components/BigBlackBox.cs b/osu.Game/Skinning/Components/BigBlackBox.cs index 373e6467e8..5bdee827ca 100644 --- a/osu.Game/Skinning/Components/BigBlackBox.cs +++ b/osu.Game/Skinning/Components/BigBlackBox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Skinning/DefaultLegacySkin.cs b/osu.Game/Skinning/DefaultLegacySkin.cs index f7b415e886..2ebcc98c53 100644 --- a/osu.Game/Skinning/DefaultLegacySkin.cs +++ b/osu.Game/Skinning/DefaultLegacySkin.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using JetBrains.Annotations; using osu.Framework.IO.Stores; diff --git a/osu.Game/Skinning/DefaultSkin.cs b/osu.Game/Skinning/DefaultSkin.cs index fb24084659..43b3cb0aa4 100644 --- a/osu.Game/Skinning/DefaultSkin.cs +++ b/osu.Game/Skinning/DefaultSkin.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Skinning/EFSkinInfo.cs b/osu.Game/Skinning/EFSkinInfo.cs index 50588563be..4204364c50 100644 --- a/osu.Game/Skinning/EFSkinInfo.cs +++ b/osu.Game/Skinning/EFSkinInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; diff --git a/osu.Game/Skinning/Editor/SkinBlueprint.cs b/osu.Game/Skinning/Editor/SkinBlueprint.cs index 1860c6006c..ecf1de89da 100644 --- a/osu.Game/Skinning/Editor/SkinBlueprint.cs +++ b/osu.Game/Skinning/Editor/SkinBlueprint.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Skinning/Editor/SkinBlueprintContainer.cs b/osu.Game/Skinning/Editor/SkinBlueprintContainer.cs index ebf3c9c319..46f5c1e67f 100644 --- a/osu.Game/Skinning/Editor/SkinBlueprintContainer.cs +++ b/osu.Game/Skinning/Editor/SkinBlueprintContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; diff --git a/osu.Game/Skinning/Editor/SkinComponentToolbox.cs b/osu.Game/Skinning/Editor/SkinComponentToolbox.cs index 756f229927..7de9cd5108 100644 --- a/osu.Game/Skinning/Editor/SkinComponentToolbox.cs +++ b/osu.Game/Skinning/Editor/SkinComponentToolbox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index 095763de18..f41cd63f2d 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs index a3110ced24..de33d49941 100644 --- a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs +++ b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Diagnostics; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs b/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs index dc5a8aefc0..4efbf58881 100644 --- a/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs +++ b/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs index 943425e099..2e2122f7c2 100644 --- a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs +++ b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Skinning/Editor/SkinSettingsToolbox.cs b/osu.Game/Skinning/Editor/SkinSettingsToolbox.cs index d2823ed0e4..3e19fc3afe 100644 --- a/osu.Game/Skinning/Editor/SkinSettingsToolbox.cs +++ b/osu.Game/Skinning/Editor/SkinSettingsToolbox.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Skinning/GameplaySkinComponent.cs b/osu.Game/Skinning/GameplaySkinComponent.cs index 80f6efc07a..cdd3638375 100644 --- a/osu.Game/Skinning/GameplaySkinComponent.cs +++ b/osu.Game/Skinning/GameplaySkinComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; namespace osu.Game.Skinning diff --git a/osu.Game/Skinning/GlobalSkinColours.cs b/osu.Game/Skinning/GlobalSkinColours.cs index f889371b98..e2b5799048 100644 --- a/osu.Game/Skinning/GlobalSkinColours.cs +++ b/osu.Game/Skinning/GlobalSkinColours.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Skinning { public enum GlobalSkinColours diff --git a/osu.Game/Skinning/HUDSkinComponents.cs b/osu.Game/Skinning/HUDSkinComponents.cs index ea39c98635..586882d790 100644 --- a/osu.Game/Skinning/HUDSkinComponents.cs +++ b/osu.Game/Skinning/HUDSkinComponents.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Skinning { public enum HUDSkinComponents diff --git a/osu.Game/Skinning/IAnimationTimeReference.cs b/osu.Game/Skinning/IAnimationTimeReference.cs index f627379a57..dcb9e9bbb9 100644 --- a/osu.Game/Skinning/IAnimationTimeReference.cs +++ b/osu.Game/Skinning/IAnimationTimeReference.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.OpenGL.Textures; diff --git a/osu.Game/Skinning/IPooledSampleProvider.cs b/osu.Game/Skinning/IPooledSampleProvider.cs index 40193d1a1a..46cd824e95 100644 --- a/osu.Game/Skinning/IPooledSampleProvider.cs +++ b/osu.Game/Skinning/IPooledSampleProvider.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Game.Audio; diff --git a/osu.Game/Skinning/ISkin.cs b/osu.Game/Skinning/ISkin.cs index 414a316dec..431fc1c0b8 100644 --- a/osu.Game/Skinning/ISkin.cs +++ b/osu.Game/Skinning/ISkin.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Skinning/ISkinComponent.cs b/osu.Game/Skinning/ISkinComponent.cs index 4bd9f21b6b..34922b98b6 100644 --- a/osu.Game/Skinning/ISkinComponent.cs +++ b/osu.Game/Skinning/ISkinComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Skinning { public interface ISkinComponent diff --git a/osu.Game/Skinning/ISkinSource.cs b/osu.Game/Skinning/ISkinSource.cs index a5ed0fc990..94940fd549 100644 --- a/osu.Game/Skinning/ISkinSource.cs +++ b/osu.Game/Skinning/ISkinSource.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using JetBrains.Annotations; diff --git a/osu.Game/Skinning/ISkinnableDrawable.cs b/osu.Game/Skinning/ISkinnableDrawable.cs index 3fc6a2fdd8..ca643af17a 100644 --- a/osu.Game/Skinning/ISkinnableDrawable.cs +++ b/osu.Game/Skinning/ISkinnableDrawable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Extensions.TypeExtensions; diff --git a/osu.Game/Skinning/ISkinnableTarget.cs b/osu.Game/Skinning/ISkinnableTarget.cs index 8d4f4dd0c3..17279ef178 100644 --- a/osu.Game/Skinning/ISkinnableTarget.cs +++ b/osu.Game/Skinning/ISkinnableTarget.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Skinning/LegacyAccuracyCounter.cs b/osu.Game/Skinning/LegacyAccuracyCounter.cs index bdcb85456a..ffb463faae 100644 --- a/osu.Game/Skinning/LegacyAccuracyCounter.cs +++ b/osu.Game/Skinning/LegacyAccuracyCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Screens.Play.HUD; diff --git a/osu.Game/Skinning/LegacyBeatmapSkin.cs b/osu.Game/Skinning/LegacyBeatmapSkin.cs index 70f5b35d00..43ae0a2252 100644 --- a/osu.Game/Skinning/LegacyBeatmapSkin.cs +++ b/osu.Game/Skinning/LegacyBeatmapSkin.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Extensions.ObjectExtensions; diff --git a/osu.Game/Skinning/LegacyColourCompatibility.cs b/osu.Game/Skinning/LegacyColourCompatibility.cs index 38e43432ce..0673d0a8d3 100644 --- a/osu.Game/Skinning/LegacyColourCompatibility.cs +++ b/osu.Game/Skinning/LegacyColourCompatibility.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osuTK.Graphics; diff --git a/osu.Game/Skinning/LegacyFont.cs b/osu.Game/Skinning/LegacyFont.cs index d1971cb84c..f738caf3f3 100644 --- a/osu.Game/Skinning/LegacyFont.cs +++ b/osu.Game/Skinning/LegacyFont.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Skinning { /// diff --git a/osu.Game/Skinning/LegacyHealthDisplay.cs b/osu.Game/Skinning/LegacyHealthDisplay.cs index b1cd1f86c0..236e9c355e 100644 --- a/osu.Game/Skinning/LegacyHealthDisplay.cs +++ b/osu.Game/Skinning/LegacyHealthDisplay.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Skinning/LegacyJudgementPieceNew.cs b/osu.Game/Skinning/LegacyJudgementPieceNew.cs index e76f251ce5..b87fc9acb5 100644 --- a/osu.Game/Skinning/LegacyJudgementPieceNew.cs +++ b/osu.Game/Skinning/LegacyJudgementPieceNew.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Animations; diff --git a/osu.Game/Skinning/LegacyJudgementPieceOld.cs b/osu.Game/Skinning/LegacyJudgementPieceOld.cs index 5d74ab9ae3..c47f46ed2b 100644 --- a/osu.Game/Skinning/LegacyJudgementPieceOld.cs +++ b/osu.Game/Skinning/LegacyJudgementPieceOld.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Animations; diff --git a/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs b/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs index 77d390875b..5ed2ddc73c 100644 --- a/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs +++ b/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs b/osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs index 9db6c8bf66..45454be4a5 100644 --- a/osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs +++ b/osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Skinning { public class LegacyManiaSkinConfigurationLookup diff --git a/osu.Game/Skinning/LegacyManiaSkinDecoder.cs b/osu.Game/Skinning/LegacyManiaSkinDecoder.cs index 7214c847a7..2aaf0ba18e 100644 --- a/osu.Game/Skinning/LegacyManiaSkinDecoder.cs +++ b/osu.Game/Skinning/LegacyManiaSkinDecoder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Skinning/LegacyRollingCounter.cs b/osu.Game/Skinning/LegacyRollingCounter.cs index b531ae1e6f..fd17b06a21 100644 --- a/osu.Game/Skinning/LegacyRollingCounter.cs +++ b/osu.Game/Skinning/LegacyRollingCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Skinning/LegacyScoreCounter.cs b/osu.Game/Skinning/LegacyScoreCounter.cs index 0c9a82074f..aee594454f 100644 --- a/osu.Game/Skinning/LegacyScoreCounter.cs +++ b/osu.Game/Skinning/LegacyScoreCounter.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Screens.Play.HUD; diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 9524d3f615..34219722a1 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Skinning/LegacySkinDecoder.cs b/osu.Game/Skinning/LegacySkinDecoder.cs index aac343d710..e5f87b3230 100644 --- a/osu.Game/Skinning/LegacySkinDecoder.cs +++ b/osu.Game/Skinning/LegacySkinDecoder.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Globalization; using osu.Game.Beatmaps.Formats; diff --git a/osu.Game/Skinning/LegacySkinExtensions.cs b/osu.Game/Skinning/LegacySkinExtensions.cs index 514a06a4ee..5a537dd57d 100644 --- a/osu.Game/Skinning/LegacySkinExtensions.cs +++ b/osu.Game/Skinning/LegacySkinExtensions.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Skinning/LegacySkinTransformer.cs b/osu.Game/Skinning/LegacySkinTransformer.cs index 34714b9dc5..da7da759fc 100644 --- a/osu.Game/Skinning/LegacySkinTransformer.cs +++ b/osu.Game/Skinning/LegacySkinTransformer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using JetBrains.Annotations; using osu.Framework.Audio.Sample; diff --git a/osu.Game/Skinning/LegacySpriteText.cs b/osu.Game/Skinning/LegacySpriteText.cs index 94383834fc..c5d65cb0c7 100644 --- a/osu.Game/Skinning/LegacySpriteText.cs +++ b/osu.Game/Skinning/LegacySpriteText.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Skinning/PausableSkinnableSound.cs b/osu.Game/Skinning/PausableSkinnableSound.cs index b34351d4e7..ebcaeaa3ff 100644 --- a/osu.Game/Skinning/PausableSkinnableSound.cs +++ b/osu.Game/Skinning/PausableSkinnableSound.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Skinning/PoolableSkinnableSample.cs b/osu.Game/Skinning/PoolableSkinnableSample.cs index 5db4f00b46..49bc71064c 100644 --- a/osu.Game/Skinning/PoolableSkinnableSample.cs +++ b/osu.Game/Skinning/PoolableSkinnableSample.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Skinning/RealmBackedResourceStore.cs b/osu.Game/Skinning/RealmBackedResourceStore.cs index 7fa24284ee..0cc90f1dcb 100644 --- a/osu.Game/Skinning/RealmBackedResourceStore.cs +++ b/osu.Game/Skinning/RealmBackedResourceStore.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Skinning/ResourceStoreBackedSkin.cs b/osu.Game/Skinning/ResourceStoreBackedSkin.cs index 48286bff59..597eef99d4 100644 --- a/osu.Game/Skinning/ResourceStoreBackedSkin.cs +++ b/osu.Game/Skinning/ResourceStoreBackedSkin.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using osu.Framework.Audio; using osu.Framework.Audio.Sample; diff --git a/osu.Game/Skinning/RulesetSkinProvidingContainer.cs b/osu.Game/Skinning/RulesetSkinProvidingContainer.cs index b884794739..937cf20bc6 100644 --- a/osu.Game/Skinning/RulesetSkinProvidingContainer.cs +++ b/osu.Game/Skinning/RulesetSkinProvidingContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Diagnostics; using System.Linq; diff --git a/osu.Game/Skinning/Skin.cs b/osu.Game/Skinning/Skin.cs index b9f9d3bd10..d6aa9cdaad 100644 --- a/osu.Game/Skinning/Skin.cs +++ b/osu.Game/Skinning/Skin.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Skinning/SkinComboColourLookup.cs b/osu.Game/Skinning/SkinComboColourLookup.cs index 33e35a96fb..2eb4af6289 100644 --- a/osu.Game/Skinning/SkinComboColourLookup.cs +++ b/osu.Game/Skinning/SkinComboColourLookup.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Skinning diff --git a/osu.Game/Skinning/SkinConfigManager.cs b/osu.Game/Skinning/SkinConfigManager.cs index 682138a2e9..8a34ab3db4 100644 --- a/osu.Game/Skinning/SkinConfigManager.cs +++ b/osu.Game/Skinning/SkinConfigManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Configuration; diff --git a/osu.Game/Skinning/SkinConfiguration.cs b/osu.Game/Skinning/SkinConfiguration.cs index f71f6811e8..0b1159f8fd 100644 --- a/osu.Game/Skinning/SkinConfiguration.cs +++ b/osu.Game/Skinning/SkinConfiguration.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Game.Beatmaps.Formats; using osuTK.Graphics; diff --git a/osu.Game/Skinning/SkinCustomColourLookup.cs b/osu.Game/Skinning/SkinCustomColourLookup.cs index b8e5ac9b53..319b071bf5 100644 --- a/osu.Game/Skinning/SkinCustomColourLookup.cs +++ b/osu.Game/Skinning/SkinCustomColourLookup.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Skinning { public class SkinCustomColourLookup diff --git a/osu.Game/Skinning/SkinFileInfo.cs b/osu.Game/Skinning/SkinFileInfo.cs index 4f1bf68e51..f3243d3f24 100644 --- a/osu.Game/Skinning/SkinFileInfo.cs +++ b/osu.Game/Skinning/SkinFileInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.ComponentModel.DataAnnotations; using osu.Game.Database; using osu.Game.IO; diff --git a/osu.Game/Skinning/SkinImporter.cs b/osu.Game/Skinning/SkinImporter.cs index 7b82655dca..1b5de9abb5 100644 --- a/osu.Game/Skinning/SkinImporter.cs +++ b/osu.Game/Skinning/SkinImporter.cs @@ -16,8 +16,6 @@ using osu.Game.IO; using osu.Game.IO.Archives; using Realms; -#nullable enable - namespace osu.Game.Skinning { public class SkinImporter : RealmArchiveModelImporter diff --git a/osu.Game/Skinning/SkinInfo.cs b/osu.Game/Skinning/SkinInfo.cs index a89725e466..bf3cf77257 100644 --- a/osu.Game/Skinning/SkinInfo.cs +++ b/osu.Game/Skinning/SkinInfo.cs @@ -12,8 +12,6 @@ using osu.Game.IO; using osu.Game.Models; using Realms; -#nullable enable - namespace osu.Game.Skinning { [ExcludeFromDynamicCompile] diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index 813ed3e066..be6528db3f 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Skinning/SkinProvidingContainer.cs b/osu.Game/Skinning/SkinProvidingContainer.cs index 24198254a3..d7399b0141 100644 --- a/osu.Game/Skinning/SkinProvidingContainer.cs +++ b/osu.Game/Skinning/SkinProvidingContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Skinning/SkinReloadableDrawable.cs b/osu.Game/Skinning/SkinReloadableDrawable.cs index dec546b82d..c6332fc4d2 100644 --- a/osu.Game/Skinning/SkinReloadableDrawable.cs +++ b/osu.Game/Skinning/SkinReloadableDrawable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics.Pooling; diff --git a/osu.Game/Skinning/SkinUtils.cs b/osu.Game/Skinning/SkinUtils.cs index e3bc5e28b8..8e01bd2853 100644 --- a/osu.Game/Skinning/SkinUtils.cs +++ b/osu.Game/Skinning/SkinUtils.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; namespace osu.Game.Skinning diff --git a/osu.Game/Skinning/SkinnableDrawable.cs b/osu.Game/Skinning/SkinnableDrawable.cs index 45409694b5..480d66c557 100644 --- a/osu.Game/Skinning/SkinnableDrawable.cs +++ b/osu.Game/Skinning/SkinnableDrawable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Caching; using osu.Framework.Graphics; diff --git a/osu.Game/Skinning/SkinnableSound.cs b/osu.Game/Skinning/SkinnableSound.cs index c9e55c09aa..c2696c56f3 100644 --- a/osu.Game/Skinning/SkinnableSound.cs +++ b/osu.Game/Skinning/SkinnableSound.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Skinning/SkinnableSprite.cs b/osu.Game/Skinning/SkinnableSprite.cs index 21b34fcd27..57beb6e803 100644 --- a/osu.Game/Skinning/SkinnableSprite.cs +++ b/osu.Game/Skinning/SkinnableSprite.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Skinning/SkinnableSpriteText.cs b/osu.Game/Skinning/SkinnableSpriteText.cs index 2bde3c4180..3e9462b83e 100644 --- a/osu.Game/Skinning/SkinnableSpriteText.cs +++ b/osu.Game/Skinning/SkinnableSpriteText.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; diff --git a/osu.Game/Skinning/SkinnableTarget.cs b/osu.Game/Skinning/SkinnableTarget.cs index 09de8a5d71..bca0d499f7 100644 --- a/osu.Game/Skinning/SkinnableTarget.cs +++ b/osu.Game/Skinning/SkinnableTarget.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Skinning { public enum SkinnableTarget diff --git a/osu.Game/Skinning/SkinnableTargetComponent.cs b/osu.Game/Skinning/SkinnableTargetComponent.cs index a17aafe6e7..51af1c23c9 100644 --- a/osu.Game/Skinning/SkinnableTargetComponent.cs +++ b/osu.Game/Skinning/SkinnableTargetComponent.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Skinning { public class SkinnableTargetComponent : ISkinComponent diff --git a/osu.Game/Skinning/SkinnableTargetComponentsContainer.cs b/osu.Game/Skinning/SkinnableTargetComponentsContainer.cs index 67114de948..dd7290a858 100644 --- a/osu.Game/Skinning/SkinnableTargetComponentsContainer.cs +++ b/osu.Game/Skinning/SkinnableTargetComponentsContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Newtonsoft.Json; using osu.Framework.Graphics; diff --git a/osu.Game/Skinning/SkinnableTargetContainer.cs b/osu.Game/Skinning/SkinnableTargetContainer.cs index 20c2fcc075..341a881789 100644 --- a/osu.Game/Skinning/SkinnableTargetContainer.cs +++ b/osu.Game/Skinning/SkinnableTargetContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using System.Threading; diff --git a/osu.Game/Skinning/UnsupportedSkinComponentException.cs b/osu.Game/Skinning/UnsupportedSkinComponentException.cs index 7f0dd51d5b..3713b7c200 100644 --- a/osu.Game/Skinning/UnsupportedSkinComponentException.cs +++ b/osu.Game/Skinning/UnsupportedSkinComponentException.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Skinning diff --git a/osu.Game/Storyboards/CommandLoop.cs b/osu.Game/Storyboards/CommandLoop.cs index 0713cb8670..0f26ed2c66 100644 --- a/osu.Game/Storyboards/CommandLoop.cs +++ b/osu.Game/Storyboards/CommandLoop.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; diff --git a/osu.Game/Storyboards/CommandTimeline.cs b/osu.Game/Storyboards/CommandTimeline.cs index 8ded3ee975..4d0da9597b 100644 --- a/osu.Game/Storyboards/CommandTimeline.cs +++ b/osu.Game/Storyboards/CommandTimeline.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using System; using System.Collections.Generic; diff --git a/osu.Game/Storyboards/CommandTimelineGroup.cs b/osu.Game/Storyboards/CommandTimelineGroup.cs index e7de135ce8..20232012f6 100644 --- a/osu.Game/Storyboards/CommandTimelineGroup.cs +++ b/osu.Game/Storyboards/CommandTimelineGroup.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osuTK; using osuTK.Graphics; diff --git a/osu.Game/Storyboards/CommandTrigger.cs b/osu.Game/Storyboards/CommandTrigger.cs index 011f345df2..50f3f0ef49 100644 --- a/osu.Game/Storyboards/CommandTrigger.cs +++ b/osu.Game/Storyboards/CommandTrigger.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Storyboards { public class CommandTrigger : CommandTimelineGroup diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs index 0a5d51f62e..be98ca9a46 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs index 8a14b8b183..9822f36620 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using osu.Framework.Allocation; diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardLayer.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardLayer.cs index 1085b52d65..13f116af24 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardLayer.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardLayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs index 4e3f72512c..2e7ca31fe9 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs index a6f2b8fcbd..28ed2e65e3 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs index 0625ddaffd..23b1004e74 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game/Storyboards/Drawables/DrawablesExtensions.cs b/osu.Game/Storyboards/Drawables/DrawablesExtensions.cs index bbc55a336d..779c8384c5 100644 --- a/osu.Game/Storyboards/Drawables/DrawablesExtensions.cs +++ b/osu.Game/Storyboards/Drawables/DrawablesExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; diff --git a/osu.Game/Storyboards/Drawables/IFlippable.cs b/osu.Game/Storyboards/Drawables/IFlippable.cs index 165b3d97cc..aceb5c041c 100644 --- a/osu.Game/Storyboards/Drawables/IFlippable.cs +++ b/osu.Game/Storyboards/Drawables/IFlippable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; diff --git a/osu.Game/Storyboards/Drawables/IVectorScalable.cs b/osu.Game/Storyboards/Drawables/IVectorScalable.cs index fcc407d460..3b43a35a90 100644 --- a/osu.Game/Storyboards/Drawables/IVectorScalable.cs +++ b/osu.Game/Storyboards/Drawables/IVectorScalable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; using osuTK; diff --git a/osu.Game/Storyboards/IStoryboardElement.cs b/osu.Game/Storyboards/IStoryboardElement.cs index 9a059991e6..7e83f8b692 100644 --- a/osu.Game/Storyboards/IStoryboardElement.cs +++ b/osu.Game/Storyboards/IStoryboardElement.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; namespace osu.Game.Storyboards diff --git a/osu.Game/Storyboards/IStoryboardElementWithDuration.cs b/osu.Game/Storyboards/IStoryboardElementWithDuration.cs index 55f163ee07..c8daeb3b3d 100644 --- a/osu.Game/Storyboards/IStoryboardElementWithDuration.cs +++ b/osu.Game/Storyboards/IStoryboardElementWithDuration.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Storyboards { /// diff --git a/osu.Game/Storyboards/Storyboard.cs b/osu.Game/Storyboards/Storyboard.cs index 1d21b5dce2..f30c3f7f94 100644 --- a/osu.Game/Storyboards/Storyboard.cs +++ b/osu.Game/Storyboards/Storyboard.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Storyboards/StoryboardAnimation.cs b/osu.Game/Storyboards/StoryboardAnimation.cs index 1a4b6bb923..16deac8e9e 100644 --- a/osu.Game/Storyboards/StoryboardAnimation.cs +++ b/osu.Game/Storyboards/StoryboardAnimation.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osu.Framework.Graphics; using osu.Game.Storyboards.Drawables; diff --git a/osu.Game/Storyboards/StoryboardExtensions.cs b/osu.Game/Storyboards/StoryboardExtensions.cs index 4e8251c9e7..e5cafc152b 100644 --- a/osu.Game/Storyboards/StoryboardExtensions.cs +++ b/osu.Game/Storyboards/StoryboardExtensions.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics; using osuTK; diff --git a/osu.Game/Storyboards/StoryboardLayer.cs b/osu.Game/Storyboards/StoryboardLayer.cs index fa9d4ebfea..2ab8d9fc2a 100644 --- a/osu.Game/Storyboards/StoryboardLayer.cs +++ b/osu.Game/Storyboards/StoryboardLayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Storyboards.Drawables; using System.Collections.Generic; diff --git a/osu.Game/Storyboards/StoryboardSample.cs b/osu.Game/Storyboards/StoryboardSample.cs index 5d6ce215f5..752d086993 100644 --- a/osu.Game/Storyboards/StoryboardSample.cs +++ b/osu.Game/Storyboards/StoryboardSample.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Graphics; using osu.Game.Audio; diff --git a/osu.Game/Storyboards/StoryboardSprite.cs b/osu.Game/Storyboards/StoryboardSprite.cs index ebd1a941a8..838dc618f2 100644 --- a/osu.Game/Storyboards/StoryboardSprite.cs +++ b/osu.Game/Storyboards/StoryboardSprite.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Storyboards/StoryboardVideo.cs b/osu.Game/Storyboards/StoryboardVideo.cs index 4652e45852..04ff941397 100644 --- a/osu.Game/Storyboards/StoryboardVideo.cs +++ b/osu.Game/Storyboards/StoryboardVideo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Storyboards.Drawables; diff --git a/osu.Game/Storyboards/StoryboardVideoLayer.cs b/osu.Game/Storyboards/StoryboardVideoLayer.cs index 2a01c2274a..339e70d677 100644 --- a/osu.Game/Storyboards/StoryboardVideoLayer.cs +++ b/osu.Game/Storyboards/StoryboardVideoLayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Game.Storyboards.Drawables; using osuTK; diff --git a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs index 8d622955b7..c5f6f58b86 100644 --- a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs +++ b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs b/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs index ed00c7959b..c7441f68bd 100644 --- a/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs +++ b/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using System.Reflection; diff --git a/osu.Game/Tests/Beatmaps/HitObjectSampleTest.cs b/osu.Game/Tests/Beatmaps/HitObjectSampleTest.cs index 4667a385b3..3ed3bb65c9 100644 --- a/osu.Game/Tests/Beatmaps/HitObjectSampleTest.cs +++ b/osu.Game/Tests/Beatmaps/HitObjectSampleTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Tests/Beatmaps/LegacyBeatmapSkinColourTest.cs b/osu.Game/Tests/Beatmaps/LegacyBeatmapSkinColourTest.cs index 597c5e9a2b..06600c4681 100644 --- a/osu.Game/Tests/Beatmaps/LegacyBeatmapSkinColourTest.cs +++ b/osu.Game/Tests/Beatmaps/LegacyBeatmapSkinColourTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Tests/Beatmaps/LegacyModConversionTest.cs b/osu.Game/Tests/Beatmaps/LegacyModConversionTest.cs index b7803f3420..921a039065 100644 --- a/osu.Game/Tests/Beatmaps/LegacyModConversionTest.cs +++ b/osu.Game/Tests/Beatmaps/LegacyModConversionTest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using NUnit.Framework; diff --git a/osu.Game/Tests/Beatmaps/TestBeatmap.cs b/osu.Game/Tests/Beatmaps/TestBeatmap.cs index ff670e1232..1aa99ceed9 100644 --- a/osu.Game/Tests/Beatmaps/TestBeatmap.cs +++ b/osu.Game/Tests/Beatmaps/TestBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Diagnostics; using System.IO; diff --git a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs index 19974701db..2306fd1c3e 100644 --- a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.IO; using osu.Framework.Audio; using osu.Framework.Audio.Track; diff --git a/osu.Game/Tests/CleanRunHeadlessGameHost.cs b/osu.Game/Tests/CleanRunHeadlessGameHost.cs index bdb171c528..d36168d3dd 100644 --- a/osu.Game/Tests/CleanRunHeadlessGameHost.cs +++ b/osu.Game/Tests/CleanRunHeadlessGameHost.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Runtime.CompilerServices; using osu.Framework; diff --git a/osu.Game/Tests/Gameplay/TestGameplayState.cs b/osu.Game/Tests/Gameplay/TestGameplayState.cs index f14f8c44ec..bb82335543 100644 --- a/osu.Game/Tests/Gameplay/TestGameplayState.cs +++ b/osu.Game/Tests/Gameplay/TestGameplayState.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Collections.Generic; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; diff --git a/osu.Game/Tests/OsuTestBrowser.cs b/osu.Game/Tests/OsuTestBrowser.cs index 71b0b02fa6..064fdeee94 100644 --- a/osu.Game/Tests/OsuTestBrowser.cs +++ b/osu.Game/Tests/OsuTestBrowser.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Platform; using osu.Framework.Screens; diff --git a/osu.Game/Tests/Rulesets/TestRulesetConfigCache.cs b/osu.Game/Tests/Rulesets/TestRulesetConfigCache.cs index 537bee6824..a80154c38e 100644 --- a/osu.Game/Tests/Rulesets/TestRulesetConfigCache.cs +++ b/osu.Game/Tests/Rulesets/TestRulesetConfigCache.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Concurrent; using osu.Game.Rulesets; using osu.Game.Rulesets.Configuration; diff --git a/osu.Game/Tests/Visual/DependencyProvidingContainer.cs b/osu.Game/Tests/Visual/DependencyProvidingContainer.cs index d1290fc5ac..8d9108f376 100644 --- a/osu.Game/Tests/Visual/DependencyProvidingContainer.cs +++ b/osu.Game/Tests/Visual/DependencyProvidingContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Tests/Visual/EditorClockTestScene.cs b/osu.Game/Tests/Visual/EditorClockTestScene.cs index 15e4fc4d8f..91284ae499 100644 --- a/osu.Game/Tests/Visual/EditorClockTestScene.cs +++ b/osu.Game/Tests/Visual/EditorClockTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; diff --git a/osu.Game/Tests/Visual/EditorSavingTestScene.cs b/osu.Game/Tests/Visual/EditorSavingTestScene.cs index cc39ead1de..3b7b6780b1 100644 --- a/osu.Game/Tests/Visual/EditorSavingTestScene.cs +++ b/osu.Game/Tests/Visual/EditorSavingTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Input; using osu.Framework.Testing; diff --git a/osu.Game/Tests/Visual/EditorTestScene.cs b/osu.Game/Tests/Visual/EditorTestScene.cs index d4a624f26a..3f5fee5768 100644 --- a/osu.Game/Tests/Visual/EditorTestScene.cs +++ b/osu.Game/Tests/Visual/EditorTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using JetBrains.Annotations; using osu.Framework.Allocation; diff --git a/osu.Game/Tests/Visual/LegacySkinPlayerTestScene.cs b/osu.Game/Tests/Visual/LegacySkinPlayerTestScene.cs index d74be70df8..f6b5d861be 100644 --- a/osu.Game/Tests/Visual/LegacySkinPlayerTestScene.cs +++ b/osu.Game/Tests/Visual/LegacySkinPlayerTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; diff --git a/osu.Game/Tests/Visual/ModPerfectTestScene.cs b/osu.Game/Tests/Visual/ModPerfectTestScene.cs index 93b38a149c..f1ad2656cd 100644 --- a/osu.Game/Tests/Visual/ModPerfectTestScene.cs +++ b/osu.Game/Tests/Visual/ModPerfectTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; diff --git a/osu.Game/Tests/Visual/ModTestScene.cs b/osu.Game/Tests/Visual/ModTestScene.cs index 2505864d59..28778f1ac3 100644 --- a/osu.Game/Tests/Visual/ModTestScene.cs +++ b/osu.Game/Tests/Visual/ModTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using JetBrains.Annotations; diff --git a/osu.Game/Tests/Visual/Multiplayer/IMultiplayerTestSceneDependencies.cs b/osu.Game/Tests/Visual/Multiplayer/IMultiplayerTestSceneDependencies.cs index 62d1c9ceca..0570c4e2f2 100644 --- a/osu.Game/Tests/Visual/Multiplayer/IMultiplayerTestSceneDependencies.cs +++ b/osu.Game/Tests/Visual/Multiplayer/IMultiplayerTestSceneDependencies.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Screens.OnlinePlay; using osu.Game.Tests.Visual.OnlinePlay; using osu.Game.Tests.Visual.Spectator; diff --git a/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs b/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs index a26c6f9be9..5ea98bdbb1 100644 --- a/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs +++ b/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using NUnit.Framework; using osu.Game.Online.Rooms; using osu.Game.Tests.Beatmaps; diff --git a/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestSceneDependencies.cs b/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestSceneDependencies.cs index 6b4e01b673..0f286475bd 100644 --- a/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestSceneDependencies.cs +++ b/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestSceneDependencies.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Online.Multiplayer; using osu.Game.Online.Spectator; using osu.Game.Screens.OnlinePlay; diff --git a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs index 725499d0e5..e5a1236abf 100644 --- a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs +++ b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerRoomManager.cs b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerRoomManager.cs index 296db3152d..b2283af9e7 100644 --- a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerRoomManager.cs +++ b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerRoomManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Tests/Visual/OnlinePlay/IOnlinePlayTestSceneDependencies.cs b/osu.Game/Tests/Visual/OnlinePlay/IOnlinePlayTestSceneDependencies.cs index c94e288e11..12d1846ece 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/IOnlinePlayTestSceneDependencies.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/IOnlinePlayTestSceneDependencies.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Bindables; using osu.Game.Database; using osu.Game.Online.Rooms; diff --git a/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs b/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs index df3974664e..282312c9c1 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Threading.Tasks; using NUnit.Framework; diff --git a/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestSceneDependencies.cs b/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestSceneDependencies.cs index 7c8bc2d535..35bdba0038 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestSceneDependencies.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestSceneDependencies.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Allocation; diff --git a/osu.Game/Tests/Visual/OnlinePlay/TestRoomManager.cs b/osu.Game/Tests/Visual/OnlinePlay/TestRoomManager.cs index 3de4e7afd9..f905eb26d3 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/TestRoomManager.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/TestRoomManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Game.Beatmaps; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs b/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs index 8fea77833e..e7c83ca1f9 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Tests/Visual/OsuGameTestScene.cs b/osu.Game/Tests/Visual/OsuGameTestScene.cs index 5995b30b60..df0bdb0a50 100644 --- a/osu.Game/Tests/Visual/OsuGameTestScene.cs +++ b/osu.Game/Tests/Visual/OsuGameTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using osu.Framework.Allocation; diff --git a/osu.Game/Tests/Visual/OsuGridTestScene.cs b/osu.Game/Tests/Visual/OsuGridTestScene.cs index 48f85be6ba..f9a609f663 100644 --- a/osu.Game/Tests/Visual/OsuGridTestScene.cs +++ b/osu.Game/Tests/Visual/OsuGridTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Tests/Visual/OsuManualInputManagerTestScene.cs b/osu.Game/Tests/Visual/OsuManualInputManagerTestScene.cs index 2deb8686cc..eccd2efa96 100644 --- a/osu.Game/Tests/Visual/OsuManualInputManagerTestScene.cs +++ b/osu.Game/Tests/Visual/OsuManualInputManagerTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Tests/Visual/OsuTestScene.cs b/osu.Game/Tests/Visual/OsuTestScene.cs index 1582bdfca4..c13cdff820 100644 --- a/osu.Game/Tests/Visual/OsuTestScene.cs +++ b/osu.Game/Tests/Visual/OsuTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs b/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs index b981a31bd1..797e8363c3 100644 --- a/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs +++ b/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Tests/Visual/PlayerTestScene.cs b/osu.Game/Tests/Visual/PlayerTestScene.cs index b34f7e2d5f..521fd8f21a 100644 --- a/osu.Game/Tests/Visual/PlayerTestScene.cs +++ b/osu.Game/Tests/Visual/PlayerTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game/Tests/Visual/RateAdjustedBeatmapTestScene.cs b/osu.Game/Tests/Visual/RateAdjustedBeatmapTestScene.cs index 1034f208a9..a4f768800c 100644 --- a/osu.Game/Tests/Visual/RateAdjustedBeatmapTestScene.cs +++ b/osu.Game/Tests/Visual/RateAdjustedBeatmapTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Tests.Visual { /// diff --git a/osu.Game/Tests/Visual/ScreenTestScene.cs b/osu.Game/Tests/Visual/ScreenTestScene.cs index 0fa2f3e786..9adf6458cd 100644 --- a/osu.Game/Tests/Visual/ScreenTestScene.cs +++ b/osu.Game/Tests/Visual/ScreenTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Tests/Visual/ScrollingTestContainer.cs b/osu.Game/Tests/Visual/ScrollingTestContainer.cs index 994f23577d..cf7fe6e45d 100644 --- a/osu.Game/Tests/Visual/ScrollingTestContainer.cs +++ b/osu.Game/Tests/Visual/ScrollingTestContainer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs b/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs index 5448783f6d..66d79cad1c 100644 --- a/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs +++ b/osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Tests/Visual/SkinnableTestScene.cs b/osu.Game/Tests/Visual/SkinnableTestScene.cs index 296ed80e37..2e5d0534f6 100644 --- a/osu.Game/Tests/Visual/SkinnableTestScene.cs +++ b/osu.Game/Tests/Visual/SkinnableTestScene.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Text.RegularExpressions; diff --git a/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs b/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs index ac7cb43e02..fc29c5aac5 100644 --- a/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs +++ b/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/osu.Game/Tests/Visual/TestPlayer.cs b/osu.Game/Tests/Visual/TestPlayer.cs index 66a956ca3d..e2ddd1734d 100644 --- a/osu.Game/Tests/Visual/TestPlayer.cs +++ b/osu.Game/Tests/Visual/TestPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Tests/Visual/TestReplayPlayer.cs b/osu.Game/Tests/Visual/TestReplayPlayer.cs index bacb2427b0..a33a6763af 100644 --- a/osu.Game/Tests/Visual/TestReplayPlayer.cs +++ b/osu.Game/Tests/Visual/TestReplayPlayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Linq; using osu.Framework.Bindables; diff --git a/osu.Game/Tests/Visual/TestUserLookupCache.cs b/osu.Game/Tests/Visual/TestUserLookupCache.cs index ce1bbd5f15..414166fdd8 100644 --- a/osu.Game/Tests/Visual/TestUserLookupCache.cs +++ b/osu.Game/Tests/Visual/TestUserLookupCache.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading; using System.Threading.Tasks; using osu.Game.Database; diff --git a/osu.Game/Tests/VisualTestRunner.cs b/osu.Game/Tests/VisualTestRunner.cs index 6aa75ec147..bd98482768 100644 --- a/osu.Game/Tests/VisualTestRunner.cs +++ b/osu.Game/Tests/VisualTestRunner.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework; using osu.Framework.Platform; diff --git a/osu.Game/Updater/GitHubAsset.cs b/osu.Game/Updater/GitHubAsset.cs index 4783161859..a5dfd9e1ac 100644 --- a/osu.Game/Updater/GitHubAsset.cs +++ b/osu.Game/Updater/GitHubAsset.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Updater diff --git a/osu.Game/Updater/GitHubRelease.cs b/osu.Game/Updater/GitHubRelease.cs index 363b2b628f..effabdbc04 100644 --- a/osu.Game/Updater/GitHubRelease.cs +++ b/osu.Game/Updater/GitHubRelease.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game/Updater/NoActionUpdateManager.cs b/osu.Game/Updater/NoActionUpdateManager.cs index 8f9c4c6f16..8a96cdb968 100644 --- a/osu.Game/Updater/NoActionUpdateManager.cs +++ b/osu.Game/Updater/NoActionUpdateManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; diff --git a/osu.Game/Updater/SimpleUpdateManager.cs b/osu.Game/Updater/SimpleUpdateManager.cs index c57a7c768e..fb5794d92e 100644 --- a/osu.Game/Updater/SimpleUpdateManager.cs +++ b/osu.Game/Updater/SimpleUpdateManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Linq; using System.Runtime.InteropServices; diff --git a/osu.Game/Updater/UpdateManager.cs b/osu.Game/Updater/UpdateManager.cs index c17d8304b9..d60f2e4a4b 100644 --- a/osu.Game/Updater/UpdateManager.cs +++ b/osu.Game/Updater/UpdateManager.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Users/Badge.cs b/osu.Game/Users/Badge.cs index 9d46a1992b..c191c25895 100644 --- a/osu.Game/Users/Badge.cs +++ b/osu.Game/Users/Badge.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Newtonsoft.Json; diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index a9fcd69286..b38600fa1b 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Newtonsoft.Json; diff --git a/osu.Game/Users/CountryStatistics.cs b/osu.Game/Users/CountryStatistics.cs index 000553c32b..e784630d56 100644 --- a/osu.Game/Users/CountryStatistics.cs +++ b/osu.Game/Users/CountryStatistics.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using Newtonsoft.Json; namespace osu.Game.Users diff --git a/osu.Game/Users/Drawables/ClickableAvatar.cs b/osu.Game/Users/Drawables/ClickableAvatar.cs index d85648c078..62e966c48f 100644 --- a/osu.Game/Users/Drawables/ClickableAvatar.cs +++ b/osu.Game/Users/Drawables/ClickableAvatar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Users/Drawables/DrawableAvatar.cs b/osu.Game/Users/Drawables/DrawableAvatar.cs index e6d7bb692d..483106d3f4 100644 --- a/osu.Game/Users/Drawables/DrawableAvatar.cs +++ b/osu.Game/Users/Drawables/DrawableAvatar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Users/Drawables/DrawableFlag.cs b/osu.Game/Users/Drawables/DrawableFlag.cs index aea40a01ae..e5ac8fa257 100644 --- a/osu.Game/Users/Drawables/DrawableFlag.cs +++ b/osu.Game/Users/Drawables/DrawableFlag.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics.Cursor; diff --git a/osu.Game/Users/Drawables/UpdateableAvatar.cs b/osu.Game/Users/Drawables/UpdateableAvatar.cs index 8ce6ce3460..dab3dc59f9 100644 --- a/osu.Game/Users/Drawables/UpdateableAvatar.cs +++ b/osu.Game/Users/Drawables/UpdateableAvatar.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; diff --git a/osu.Game/Users/Drawables/UpdateableFlag.cs b/osu.Game/Users/Drawables/UpdateableFlag.cs index d0ef760e59..fd59bf305d 100644 --- a/osu.Game/Users/Drawables/UpdateableFlag.cs +++ b/osu.Game/Users/Drawables/UpdateableFlag.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Users/ExtendedUserPanel.cs b/osu.Game/Users/ExtendedUserPanel.cs index 6733ff8b05..7d475c545a 100644 --- a/osu.Game/Users/ExtendedUserPanel.cs +++ b/osu.Game/Users/ExtendedUserPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Users/IUser.cs b/osu.Game/Users/IUser.cs index d9a352872f..7a233b5d8b 100644 --- a/osu.Game/Users/IUser.cs +++ b/osu.Game/Users/IUser.cs @@ -4,8 +4,6 @@ using System; using osu.Game.Database; -#nullable enable - namespace osu.Game.Users { public interface IUser : IHasOnlineID, IEquatable diff --git a/osu.Game/Users/Medal.cs b/osu.Game/Users/Medal.cs index 2e4f6de1d7..75718e714b 100644 --- a/osu.Game/Users/Medal.cs +++ b/osu.Game/Users/Medal.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Users { public class Medal diff --git a/osu.Game/Users/UserActivity.cs b/osu.Game/Users/UserActivity.cs index 2f945d6e1c..6de797ca3a 100644 --- a/osu.Game/Users/UserActivity.cs +++ b/osu.Game/Users/UserActivity.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Online.Rooms; diff --git a/osu.Game/Users/UserBrickPanel.cs b/osu.Game/Users/UserBrickPanel.cs index 3debdb6e72..a214b72795 100644 --- a/osu.Game/Users/UserBrickPanel.cs +++ b/osu.Game/Users/UserBrickPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Users/UserCoverBackground.cs b/osu.Game/Users/UserCoverBackground.cs index 3f1f838b27..c799bbb1ea 100644 --- a/osu.Game/Users/UserCoverBackground.cs +++ b/osu.Game/Users/UserCoverBackground.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Users/UserGridPanel.cs b/osu.Game/Users/UserGridPanel.cs index c37eeb1cbf..38d8f6fb33 100644 --- a/osu.Game/Users/UserGridPanel.cs +++ b/osu.Game/Users/UserGridPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Users/UserListPanel.cs b/osu.Game/Users/UserListPanel.cs index f06e412315..6d45481dbe 100644 --- a/osu.Game/Users/UserListPanel.cs +++ b/osu.Game/Users/UserListPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics.Colour; diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 40d70ca406..d150b38c45 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Users/UserStatistics.cs b/osu.Game/Users/UserStatistics.cs index f8d26fe421..918a1b6968 100644 --- a/osu.Game/Users/UserStatistics.cs +++ b/osu.Game/Users/UserStatistics.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Newtonsoft.Json; using osu.Framework.Localisation; diff --git a/osu.Game/Users/UserStatus.cs b/osu.Game/Users/UserStatus.cs index 7f275b3b2a..075463c1e0 100644 --- a/osu.Game/Users/UserStatus.cs +++ b/osu.Game/Users/UserStatus.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.Localisation; using osuTK.Graphics; using osu.Game.Graphics; diff --git a/osu.Game/Utils/BatteryInfo.cs b/osu.Game/Utils/BatteryInfo.cs index dd9b695e1f..be12671b84 100644 --- a/osu.Game/Utils/BatteryInfo.cs +++ b/osu.Game/Utils/BatteryInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Utils { /// diff --git a/osu.Game/Utils/ColourUtils.cs b/osu.Game/Utils/ColourUtils.cs index 515963971d..7e665fd9a7 100644 --- a/osu.Game/Utils/ColourUtils.cs +++ b/osu.Game/Utils/ColourUtils.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using osu.Framework.Utils; using osuTK.Graphics; diff --git a/osu.Game/Utils/FormatUtils.cs b/osu.Game/Utils/FormatUtils.cs index 799dc75ca9..07a1879267 100644 --- a/osu.Game/Utils/FormatUtils.cs +++ b/osu.Game/Utils/FormatUtils.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Humanizer; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Utils/HumanizerUtils.cs b/osu.Game/Utils/HumanizerUtils.cs index 5b7c3630d9..27d3317b80 100644 --- a/osu.Game/Utils/HumanizerUtils.cs +++ b/osu.Game/Utils/HumanizerUtils.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Globalization; using Humanizer; diff --git a/osu.Game/Utils/IDeepCloneable.cs b/osu.Game/Utils/IDeepCloneable.cs index 6877f346c4..a0a2548f6c 100644 --- a/osu.Game/Utils/IDeepCloneable.cs +++ b/osu.Game/Utils/IDeepCloneable.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + namespace osu.Game.Utils { /// A generic interface for a deeply cloneable type. diff --git a/osu.Game/Utils/LegacyRandom.cs b/osu.Game/Utils/LegacyRandom.cs index cf731aa91f..ace8f8f65c 100644 --- a/osu.Game/Utils/LegacyRandom.cs +++ b/osu.Game/Utils/LegacyRandom.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Utils; diff --git a/osu.Game/Utils/LegacyUtils.cs b/osu.Game/Utils/LegacyUtils.cs index 64306adf50..400d3b3865 100644 --- a/osu.Game/Utils/LegacyUtils.cs +++ b/osu.Game/Utils/LegacyUtils.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; diff --git a/osu.Game/Utils/ModUtils.cs b/osu.Game/Utils/ModUtils.cs index ea092a8ca3..edf9cc80da 100644 --- a/osu.Game/Utils/ModUtils.cs +++ b/osu.Game/Utils/ModUtils.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/osu.Game/Utils/NamingUtils.cs b/osu.Game/Utils/NamingUtils.cs index 482e3d0954..6b1be8885d 100644 --- a/osu.Game/Utils/NamingUtils.cs +++ b/osu.Game/Utils/NamingUtils.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Collections.Generic; using System.Text.RegularExpressions; diff --git a/osu.Game/Utils/Optional.cs b/osu.Game/Utils/Optional.cs index fdb7623be5..301767ba08 100644 --- a/osu.Game/Utils/Optional.cs +++ b/osu.Game/Utils/Optional.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - namespace osu.Game.Utils { /// diff --git a/osu.Game/Utils/PeriodTracker.cs b/osu.Game/Utils/PeriodTracker.cs index ba77702247..d8251f49ca 100644 --- a/osu.Game/Utils/PeriodTracker.cs +++ b/osu.Game/Utils/PeriodTracker.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Utils/SentryLogger.cs b/osu.Game/Utils/SentryLogger.cs index c12fd607b4..33dc548e9a 100644 --- a/osu.Game/Utils/SentryLogger.cs +++ b/osu.Game/Utils/SentryLogger.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Diagnostics; using System.IO; diff --git a/osu.Game/Utils/StatelessRNG.cs b/osu.Game/Utils/StatelessRNG.cs index 3db632fc42..548aaa887f 100644 --- a/osu.Game/Utils/StatelessRNG.cs +++ b/osu.Game/Utils/StatelessRNG.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; namespace osu.Game.Utils diff --git a/osu.Game/Utils/TaskChain.cs b/osu.Game/Utils/TaskChain.cs index df28faf9fb..7e7d26aa5d 100644 --- a/osu.Game/Utils/TaskChain.cs +++ b/osu.Game/Utils/TaskChain.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Threading; using System.Threading.Tasks; diff --git a/osu.Game/Utils/ZipUtils.cs b/osu.Game/Utils/ZipUtils.cs index eb2d2d3b80..d6ad3e132e 100644 --- a/osu.Game/Utils/ZipUtils.cs +++ b/osu.Game/Utils/ZipUtils.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using System.IO; using SharpCompress.Archives.Zip; diff --git a/osu.iOS/AppDelegate.cs b/osu.iOS/AppDelegate.cs index 14e3627752..1d29d59fff 100644 --- a/osu.iOS/AppDelegate.cs +++ b/osu.iOS/AppDelegate.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System.Threading.Tasks; using Foundation; using osu.Framework.iOS; diff --git a/osu.iOS/Application.cs b/osu.iOS/Application.cs index ffabdb4698..c5b2d0b451 100644 --- a/osu.iOS/Application.cs +++ b/osu.iOS/Application.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osu.Framework.iOS; using UIKit; diff --git a/osu.iOS/OsuGameIOS.cs b/osu.iOS/OsuGameIOS.cs index 9c1795e45e..053bce1618 100644 --- a/osu.iOS/OsuGameIOS.cs +++ b/osu.iOS/OsuGameIOS.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using Foundation; using osu.Framework.Graphics; From fd9902e8162526b93dd2e33bf148a1d104fe2acf Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 17 Jun 2022 16:38:35 +0900 Subject: [PATCH 1718/2328] Manual #nullable processing --- osu.Game.Tests/Rulesets/TestSceneBrokenRulesetHandling.cs | 2 -- osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Rulesets/TestSceneBrokenRulesetHandling.cs b/osu.Game.Tests/Rulesets/TestSceneBrokenRulesetHandling.cs index 243a93b4e5..ecc4b3ec63 100644 --- a/osu.Game.Tests/Rulesets/TestSceneBrokenRulesetHandling.cs +++ b/osu.Game.Tests/Rulesets/TestSceneBrokenRulesetHandling.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index d3d1196eae..b289299a63 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using osuTK; using osu.Game.Rulesets.Objects.Types; using System; From 11bd87045ef7f18bd7cb5cf88fbd327b15f65257 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 17 Jun 2022 16:49:53 +0900 Subject: [PATCH 1719/2328] Add automated commit to git-blame-ignore-revs --- .git-blame-ignore-revs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 8be6479043..39fa0f9f6c 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,2 +1,4 @@ # Normalize all the line endings 32a74f95a5c80a0ed18e693f13a47522099df5c3 +# Enabled NRT globally +f8830c6850128456266c82de83273204f8b74ac0 From 1f78a4fadd36ebfd1145ea162d6b47826cec664c Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Fri, 17 Jun 2022 16:56:09 +0900 Subject: [PATCH 1720/2328] New audio feedback for metronome --- .../Screens/Edit/Timing/MetronomeDisplay.cs | 39 +++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 2ecd66a05f..33325951e5 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -33,7 +33,9 @@ namespace osu.Game.Screens.Edit.Timing private IAdjustableClock metronomeClock; - private Sample clunk; + private Sample tick; + private Sample tickDownbeat; + private Sample latch; [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } @@ -43,7 +45,9 @@ namespace osu.Game.Screens.Edit.Timing [BackgroundDependencyLoader] private void load(AudioManager audio) { - clunk = audio.Samples.Get(@"Multiplayer/countdown-tick"); + tick = audio.Samples.Get(@"UI/metronome-tick"); + tickDownbeat = audio.Samples.Get(@"UI/metronome-tick-downbeat"); + latch = audio.Samples.Get(@"UI/metronome-latch"); const float taper = 25; const float swing_vertical_offset = -23; @@ -248,14 +252,27 @@ namespace osu.Game.Screens.Edit.Timing if (BeatSyncSource.Clock?.IsRunning != true && isSwinging) { swing.ClearTransforms(true); + stick.FadeColour(overlayColourProvider.Colour2, 1000, Easing.OutQuint); + isSwinging = false; + + // instantly latch if pendulum arm is close enough to center (to prevent awkward delayed playback of latch sound) + if (Precision.AlmostEquals(swing.Rotation, 0, 1)) + { + swing.RotateTo(0); + latch?.Play(); + return; + } using (swing.BeginDelayedSequence(350)) { swing.RotateTo(0, 1000, Easing.OutQuint); - stick.FadeColour(overlayColourProvider.Colour2, 1000, Easing.OutQuint); + swing.Delay(250).Schedule(() => + { + // prevent playing latch sound if metronome has started back up again + if (!isSwinging) + latch?.Play(); + }); } - - isSwinging = false; } } @@ -286,13 +303,13 @@ namespace osu.Game.Screens.Edit.Timing if (!EnableClicking) return; - var channel = clunk?.GetChannel(); + var channel = beatIndex % timingPoint.TimeSignature.Numerator == 0 ? tickDownbeat?.GetChannel() : tick?.GetChannel(); - if (channel != null) - { - channel.Frequency.Value = RNG.NextDouble(0.98f, 1.02f); - channel.Play(); - } + if (channel == null) + return; + + channel.Frequency.Value = RNG.NextDouble(0.98f, 1.02f); + channel.Play(); }); } } From e51babdb96f64cf1a75266d69a2814f8653c3175 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 Jun 2022 17:01:11 +0900 Subject: [PATCH 1721/2328] Change heart animation flow to be more correct --- osu.Game/Screens/Menu/Disclaimer.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 3482b171a3..17064e5abc 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -146,16 +146,17 @@ namespace osu.Game.Screens.Menu supportFlow.AddText(" to help support osu!'s development", formatSemiBold); } - heart = supportFlow.AddIcon(FontAwesome.Solid.Heart, t => + supportFlow.AddIcon(FontAwesome.Solid.Heart, t => { + heart = t; + t.Padding = new MarginPadding { Left = 5, Top = 3 }; t.Font = t.Font.With(size: 20); t.Origin = Anchor.Centre; t.Colour = colours.Pink; - }).Drawables.First(); - if (IsLoaded) - animateHeart(); + Schedule(animateHeart); + }); if (supportFlow.IsPresent) supportFlow.FadeInFromZero(500); @@ -214,8 +215,6 @@ namespace osu.Game.Screens.Menu foreach (var c in textFlow.Children) c.FadeTo(0.001f).Delay(delay += 20).FadeIn(500); - animateHeart(); - this .FadeInFromZero(500) .Then(5500) @@ -255,7 +254,7 @@ namespace osu.Game.Screens.Menu private void animateHeart() { - heart.FlashColour(Color4.White, 750, Easing.OutQuint).Loop(); + heart?.FlashColour(Color4.White, 750, Easing.OutQuint).Loop(); } } } From 869db5254019fcb924ac7bfb8578beb0e02bac20 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 17 Jun 2022 16:55:35 +0900 Subject: [PATCH 1722/2328] Tie loading layer to ongoing operation state --- .../Multiplayer/OnlineMultiplayerClient.cs | 8 +++--- .../Multiplayer/MultiplayerMatchSongSelect.cs | 26 +++++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs index a3423d4189..ae1ac5fa47 100644 --- a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs @@ -202,14 +202,16 @@ namespace osu.Game.Online.Multiplayer return connection.InvokeAsync(nameof(IMultiplayerServer.AddPlaylistItem), item); } - public override Task EditPlaylistItem(MultiplayerPlaylistItem item) + public override async Task EditPlaylistItem(MultiplayerPlaylistItem item) { if (!IsConnected.Value) - return Task.CompletedTask; + return; Debug.Assert(connection != null); - return connection.InvokeAsync(nameof(IMultiplayerServer.EditPlaylistItem), item); + await Task.Delay(10000); + + await connection.InvokeAsync(nameof(IMultiplayerServer.EditPlaylistItem), item); } public override Task RemovePlaylistItem(long playlistItemId) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs index b2355a9021..10479054e3 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs @@ -7,6 +7,7 @@ using System; using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; @@ -26,6 +27,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer [Resolved] private OngoingOperationTracker operationTracker { get; set; } = null!; + private readonly IBindable operationInProgress = new Bindable(); private readonly long? itemToEdit; private LoadingLayer loadingLayer = null!; @@ -59,16 +61,33 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer AddInternal(loadingLayer = new LoadingLayer(true)); } + protected override void LoadComplete() + { + base.LoadComplete(); + + operationInProgress.BindTo(operationTracker.InProgress); + operationInProgress.BindValueChanged(_ => updateLoadingLayer(), true); + } + + private void updateLoadingLayer() + { + if (operationInProgress.Value) + loadingLayer.Show(); + else + loadingLayer.Hide(); + } + protected override void SelectItem(PlaylistItem item) { + if (operationInProgress.Value) + return; + // If the client is already in a room, update via the client. // Otherwise, update the playlist directly in preparation for it to be submitted to the API on match creation. if (client.Room != null) { selectionOperation = operationTracker.BeginOperation(); - loadingLayer.Show(); - var multiplayerItem = new MultiplayerPlaylistItem { ID = itemToEdit ?? 0, @@ -87,8 +106,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer Schedule(() => { - loadingLayer.Hide(); - // If an error or server side trigger occurred this screen may have already exited by external means. if (this.IsCurrentScreen()) this.Exit(); @@ -99,7 +116,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer Schedule(() => { - loadingLayer.Hide(); Carousel.AllowSelection = true; }); }); From 1900480d51ed5cb47d5f9ac4355e5e055df7fcaf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 Jun 2022 17:06:06 +0900 Subject: [PATCH 1723/2328] Inline animation method --- osu.Game/Screens/Menu/Disclaimer.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 17064e5abc..7a6d845bf1 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -155,7 +155,7 @@ namespace osu.Game.Screens.Menu t.Origin = Anchor.Centre; t.Colour = colours.Pink; - Schedule(animateHeart); + Schedule(() => heart?.FlashColour(Color4.White, 750, Easing.OutQuint).Loop()); }); if (supportFlow.IsPresent) @@ -251,10 +251,5 @@ namespace osu.Game.Screens.Menu return tips[RNG.Next(0, tips.Length)]; } - - private void animateHeart() - { - heart?.FlashColour(Color4.White, 750, Easing.OutQuint).Loop(); - } } } From 42c97baa9787fbc3041891cd0176d1ddbb53e3e3 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 17 Jun 2022 17:55:58 +0900 Subject: [PATCH 1724/2328] Cache bust on more files --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8dd6ae8197..ef729a779f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: uses: actions/cache@v3 with: path: ${{ github.workspace }}/inspectcode - key: inspectcode-${{ hashFiles('.config/dotnet-tools.json', '.github/workflows/ci.yml', 'osu.sln*', '.editorconfig', '.globalconfig', 'CodeAnalysis/*') }} + key: inspectcode-${{ hashFiles('.config/dotnet-tools.json', '.github/workflows/ci.yml', 'osu.sln*', 'osu*.slnf', '.editorconfig', '.globalconfig', 'CodeAnalysis/*', '**/*.csproj', '**/*.props') }} - name: Dotnet code style run: dotnet build -c Debug -warnaserror osu.Desktop.slnf -p:EnforceCodeStyleInBuild=true From 48ffd6aeb5c131a120a9c82e889348ebf3d21dfb Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Fri, 17 Jun 2022 11:28:58 -0400 Subject: [PATCH 1725/2328] stop component transform when skineditor is hidden --- .../Skinning/Editor/SkinSelectionHandler.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs index 2e2122f7c2..2496d7c657 100644 --- a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs +++ b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs @@ -11,6 +11,7 @@ using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Graphics.Containers; using osu.Framework.Utils; using osu.Game.Extensions; using osu.Game.Graphics.UserInterface; @@ -25,8 +26,17 @@ namespace osu.Game.Skinning.Editor [Resolved] private SkinEditor skinEditor { get; set; } + /// + /// Whether the 's state allows selected blueprints to undergo transformations. + /// Used to prevent operations from being performed on unloaded blueprints. + /// + private bool allowHandling => skinEditor.State.Value == Visibility.Visible; + public override bool HandleRotation(float angle) { + if (!allowHandling) + return false; + if (SelectedBlueprints.Count == 1) { // for single items, rotate around the origin rather than the selection centre. @@ -53,6 +63,9 @@ namespace osu.Game.Skinning.Editor public override bool HandleScale(Vector2 scale, Anchor anchor) { + if (!allowHandling) + return false; + // convert scale to screen space scale = ToScreenSpace(scale) - ToScreenSpace(Vector2.Zero); @@ -130,6 +143,9 @@ namespace osu.Game.Skinning.Editor public override bool HandleFlip(Direction direction, bool flipOverOrigin) { + if (!allowHandling) + return false; + var selectionQuad = getSelectionQuad(); Vector2 scaleFactor = direction == Direction.Horizontal ? new Vector2(-1, 1) : new Vector2(1, -1); @@ -150,6 +166,9 @@ namespace osu.Game.Skinning.Editor public override bool HandleMovement(MoveSelectionEvent moveEvent) { + if (!allowHandling) + return false; + foreach (var c in SelectedBlueprints) { var item = c.Item; From 9fe763613868c01e6570bb425615446d7aeceb59 Mon Sep 17 00:00:00 2001 From: 63411 <62799417+molneya@users.noreply.github.com> Date: Fri, 17 Jun 2022 23:38:22 +0800 Subject: [PATCH 1726/2328] Use accuracy for pp calculation --- .../Difficulty/ManiaPerformanceCalculator.cs | 58 +++---------------- 1 file changed, 9 insertions(+), 49 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs index eb58eb7f21..02c118ae1f 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs @@ -15,15 +15,14 @@ namespace osu.Game.Rulesets.Mania.Difficulty { public class ManiaPerformanceCalculator : PerformanceCalculator { - // Score after being scaled by non-difficulty-increasing mods - private double scaledScore; - + private int countPerfect; private int countGreat; private int countGood; private int countOk; private int countMeh; private int countMiss; + private double scoreAccuracy; public ManiaPerformanceCalculator() : base(new ManiaRuleset()) @@ -34,23 +33,17 @@ namespace osu.Game.Rulesets.Mania.Difficulty { var maniaAttributes = (ManiaDifficultyAttributes)attributes; - scaledScore = score.TotalScore; countPerfect = score.Statistics.GetValueOrDefault(HitResult.Perfect); countGreat = score.Statistics.GetValueOrDefault(HitResult.Great); countGood = score.Statistics.GetValueOrDefault(HitResult.Good); countOk = score.Statistics.GetValueOrDefault(HitResult.Ok); countMeh = score.Statistics.GetValueOrDefault(HitResult.Meh); countMiss = score.Statistics.GetValueOrDefault(HitResult.Miss); - - if (maniaAttributes.ScoreMultiplier > 0) - { - // Scale score up, so it's comparable to other keymods - scaledScore *= 1.0 / maniaAttributes.ScoreMultiplier; - } + scoreAccuracy = customAccuracy; // Arbitrary initial value for scaling pp in order to standardize distributions across game modes. // The specific number has no intrinsic meaning and can be adjusted as needed. - double multiplier = 0.8; + double multiplier = 8.0; if (score.Mods.Any(m => m is ModNoFail)) multiplier *= 0.9; @@ -58,58 +51,25 @@ namespace osu.Game.Rulesets.Mania.Difficulty multiplier *= 0.5; double difficultyValue = computeDifficultyValue(maniaAttributes); - double accValue = computeAccuracyValue(difficultyValue, maniaAttributes); - double totalValue = - Math.Pow( - Math.Pow(difficultyValue, 1.1) + - Math.Pow(accValue, 1.1), 1.0 / 1.1 - ) * multiplier; + double totalValue = difficultyValue * multiplier; return new ManiaPerformanceAttributes { Difficulty = difficultyValue, - Accuracy = accValue, - ScaledScore = scaledScore, Total = totalValue }; } private double computeDifficultyValue(ManiaDifficultyAttributes attributes) { - double difficultyValue = Math.Pow(5 * Math.Max(1, attributes.StarRating / 0.2) - 4.0, 2.2) / 135.0; - - difficultyValue *= 1.0 + 0.1 * Math.Min(1.0, totalHits / 1500.0); - - if (scaledScore <= 500000) - difficultyValue = 0; - else if (scaledScore <= 600000) - difficultyValue *= (scaledScore - 500000) / 100000 * 0.3; - else if (scaledScore <= 700000) - difficultyValue *= 0.3 + (scaledScore - 600000) / 100000 * 0.25; - else if (scaledScore <= 800000) - difficultyValue *= 0.55 + (scaledScore - 700000) / 100000 * 0.20; - else if (scaledScore <= 900000) - difficultyValue *= 0.75 + (scaledScore - 800000) / 100000 * 0.15; - else - difficultyValue *= 0.90 + (scaledScore - 900000) / 100000 * 0.1; + double difficultyValue = Math.Pow(Math.Max(attributes.StarRating - 0.15, 0.05), 2.2) // Star rating to pp curve + * Math.Max(0, 5 * scoreAccuracy - 4) // Accuracy curve + * (1 + 0.1 * Math.Min(1, totalHits / 1500)); // Length bonus return difficultyValue; } - private double computeAccuracyValue(double difficultyValue, ManiaDifficultyAttributes attributes) - { - if (attributes.GreatHitWindow <= 0) - return 0; - - // Lots of arbitrary values from testing. - // Considering to use derivation from perfect accuracy in a probabilistic manner - assume normal distribution - double accuracyValue = Math.Max(0.0, 0.2 - (attributes.GreatHitWindow - 34) * 0.006667) - * difficultyValue - * Math.Pow(Math.Max(0.0, scaledScore - 960000) / 40000, 1.1); - - return accuracyValue; - } - private double totalHits => countPerfect + countOk + countGreat + countGood + countMeh + countMiss; + private double customAccuracy => (countPerfect * 320 + countGreat * 300 + countGood * 200 + countOk * 100 + countMeh * 50) / (totalHits * 320); } } From e238bcc6c635cb7efd04d790cb92cb540002e9da Mon Sep 17 00:00:00 2001 From: 63411 <62799417+molneya@users.noreply.github.com> Date: Fri, 17 Jun 2022 23:44:10 +0800 Subject: [PATCH 1727/2328] Remove unneeded attributes --- .../Difficulty/ManiaDifficultyAttributes.cs | 8 ------ .../Difficulty/ManiaDifficultyCalculator.cs | 28 ------------------- .../Difficulty/ManiaPerformanceAttributes.cs | 7 ----- 3 files changed, 43 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs index 8a5161be79..ffef8a50ad 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs @@ -20,12 +20,6 @@ namespace osu.Game.Rulesets.Mania.Difficulty [JsonProperty("great_hit_window")] public double GreatHitWindow { get; set; } - /// - /// The score multiplier applied via score-reducing mods. - /// - [JsonProperty("score_multiplier")] - public double ScoreMultiplier { get; set; } - public override IEnumerable<(int attributeId, object value)> ToDatabaseAttributes() { foreach (var v in base.ToDatabaseAttributes()) @@ -34,7 +28,6 @@ namespace osu.Game.Rulesets.Mania.Difficulty yield return (ATTRIB_ID_MAX_COMBO, MaxCombo); yield return (ATTRIB_ID_DIFFICULTY, StarRating); yield return (ATTRIB_ID_GREAT_HIT_WINDOW, GreatHitWindow); - yield return (ATTRIB_ID_SCORE_MULTIPLIER, ScoreMultiplier); } public override void FromDatabaseAttributes(IReadOnlyDictionary values) @@ -44,7 +37,6 @@ namespace osu.Game.Rulesets.Mania.Difficulty MaxCombo = (int)values[ATTRIB_ID_MAX_COMBO]; StarRating = values[ATTRIB_ID_DIFFICULTY]; GreatHitWindow = values[ATTRIB_ID_GREAT_HIT_WINDOW]; - ScoreMultiplier = values[ATTRIB_ID_SCORE_MULTIPLIER]; } } } diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs index 8002410f70..178094476f 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -53,7 +53,6 @@ namespace osu.Game.Rulesets.Mania.Difficulty // In osu-stable mania, rate-adjustment mods don't affect the hit window. // This is done the way it is to introduce fractional differences in order to match osu-stable for the time being. GreatHitWindow = Math.Ceiling((int)(getHitWindow300(mods) * clockRate) / clockRate), - ScoreMultiplier = getScoreMultiplier(mods), MaxCombo = beatmap.HitObjects.Sum(maxComboForObject) }; } @@ -147,32 +146,5 @@ namespace osu.Game.Rulesets.Mania.Difficulty return value; } } - - private double getScoreMultiplier(Mod[] mods) - { - double scoreMultiplier = 1; - - foreach (var m in mods) - { - switch (m) - { - case ManiaModNoFail _: - case ManiaModEasy _: - case ManiaModHalfTime _: - scoreMultiplier *= 0.5; - break; - } - } - - var maniaBeatmap = (ManiaBeatmap)Beatmap; - int diff = maniaBeatmap.TotalColumns - maniaBeatmap.OriginalTotalColumns; - - if (diff > 0) - scoreMultiplier *= 0.9; - else if (diff < 0) - scoreMultiplier *= 0.9 + 0.04 * diff; - - return scoreMultiplier; - } } } diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceAttributes.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceAttributes.cs index f5abb465c4..01474e6e00 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceAttributes.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceAttributes.cs @@ -14,19 +14,12 @@ namespace osu.Game.Rulesets.Mania.Difficulty [JsonProperty("difficulty")] public double Difficulty { get; set; } - [JsonProperty("accuracy")] - public double Accuracy { get; set; } - - [JsonProperty("scaled_score")] - public double ScaledScore { get; set; } - public override IEnumerable GetAttributesForDisplay() { foreach (var attribute in base.GetAttributesForDisplay()) yield return attribute; yield return new PerformanceDisplayAttribute(nameof(Difficulty), "Difficulty", Difficulty); - yield return new PerformanceDisplayAttribute(nameof(Accuracy), "Accuracy", Accuracy); } } } From 451d4154f02b80f89c14db5f3f101a1beee3a52e Mon Sep 17 00:00:00 2001 From: 63411 <62799417+molneya@users.noreply.github.com> Date: Sat, 18 Jun 2022 00:45:34 +0800 Subject: [PATCH 1728/2328] Fix code style --- osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs index 02c118ae1f..23a95fe866 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs @@ -15,7 +15,6 @@ namespace osu.Game.Rulesets.Mania.Difficulty { public class ManiaPerformanceCalculator : PerformanceCalculator { - private int countPerfect; private int countGreat; private int countGood; From f3793c880911c8049ab645c02e0e38607ec2f5b0 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 17 Jun 2022 21:02:18 +0300 Subject: [PATCH 1729/2328] Add lightweight `TournamentPlayer` model --- .../Models/TournamentPlayer.cs | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 osu.Game.Tournament/Models/TournamentPlayer.cs diff --git a/osu.Game.Tournament/Models/TournamentPlayer.cs b/osu.Game.Tournament/Models/TournamentPlayer.cs new file mode 100644 index 0000000000..6fd2f178e1 --- /dev/null +++ b/osu.Game.Tournament/Models/TournamentPlayer.cs @@ -0,0 +1,59 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Game.Database; +using osu.Game.Online.API.Requests.Responses; +using osu.Game.Users; + +namespace osu.Game.Tournament.Models +{ + /// + /// A tournament player, containing simple information about the player. + /// + [Serializable] + public class TournamentPlayer : IUser + { + public int Id { get; set; } + + public string Username { get; set; } = string.Empty; + + /// + /// The player's country. + /// + public Country? Country { get; set; } + + /// + /// The player's global rank, or null if not available. + /// + public int? Rank { get; set; } + + /// + /// A URL to the player's profile cover. + /// + public string CoverUrl { get; set; } = string.Empty; + + public APIUser ToUser() + { + var user = new APIUser + { + Id = Id, + Username = Username, + Country = Country, + CoverUrl = CoverUrl, + }; + + user.Statistics = new UserStatistics + { + User = user, + GlobalRank = Rank + }; + + return user; + } + + int IHasOnlineID.OnlineID => Id; + + bool IUser.IsBot => false; + } +} From b977ce79959fbda38114cc5da3e1703c95eba7e7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 17 Jun 2022 21:03:33 +0300 Subject: [PATCH 1730/2328] Replace tournament player storage type with lightweight model --- .../TestSceneDrawableTournamentTeam.cs | 15 ++++----- .../TestSceneTournamentMatchChatDisplay.cs | 14 ++++---- .../TournamentTestScene.cs | 22 ++++++------- .../Components/DrawableTeamWithPlayers.cs | 3 +- osu.Game.Tournament/Models/TournamentTeam.cs | 5 ++- .../Screens/Editors/TeamEditorScreen.cs | 33 +++++++++---------- .../Screens/TeamIntro/SeedingScreen.cs | 2 +- osu.Game.Tournament/TournamentGameBase.cs | 23 ++++++------- 8 files changed, 54 insertions(+), 63 deletions(-) diff --git a/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs index 9ade9965c5..3cf65b1990 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs @@ -5,7 +5,6 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Game.Online.API.Requests.Responses; using osu.Game.Tests.Visual; using osu.Game.Tournament.Components; using osu.Game.Tournament.Models; @@ -26,13 +25,13 @@ namespace osu.Game.Tournament.Tests.Components FullName = { Value = "Australia" }, Players = { - new APIUser { Username = "ASecretBox" }, - new APIUser { Username = "Dereban" }, - new APIUser { Username = "mReKk" }, - new APIUser { Username = "uyghti" }, - new APIUser { Username = "Parkes" }, - new APIUser { Username = "Shiroha" }, - new APIUser { Username = "Jordan The Bear" }, + new TournamentPlayer { Username = "ASecretBox" }, + new TournamentPlayer { Username = "Dereban" }, + new TournamentPlayer { Username = "mReKk" }, + new TournamentPlayer { Username = "uyghti" }, + new TournamentPlayer { Username = "Parkes" }, + new TournamentPlayer { Username = "Shiroha" }, + new TournamentPlayer { Username = "Jordan The Bear" }, } }; diff --git a/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs b/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs index 4a4def10b5..3eac240be5 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs @@ -27,13 +27,13 @@ namespace osu.Game.Tournament.Tests.Components Colour = "f2ca34" }; - private readonly APIUser redUser = new APIUser + private readonly TournamentPlayer redPlayer = new TournamentPlayer { Username = "BanchoBot", Id = 3, }; - private readonly APIUser blueUser = new APIUser + private readonly TournamentPlayer bluePlayer = new TournamentPlayer { Username = "Zallius", Id = 4, @@ -59,11 +59,11 @@ namespace osu.Game.Tournament.Tests.Components { Team1 = { - Value = new TournamentTeam { Players = new BindableList { redUser } } + Value = new TournamentTeam { Players = new BindableList { redPlayer } } }, Team2 = { - Value = new TournamentTeam { Players = new BindableList { blueUser } } + Value = new TournamentTeam { Players = new BindableList { bluePlayer } } } }; @@ -82,19 +82,19 @@ namespace osu.Game.Tournament.Tests.Components AddStep("message from team red", () => testChannel.AddNewMessages(new Message(nextMessageId()) { - Sender = redUser, + Sender = redPlayer.ToUser(), Content = "I am team red." })); AddStep("message from team red", () => testChannel.AddNewMessages(new Message(nextMessageId()) { - Sender = redUser, + Sender = redPlayer.ToUser(), Content = "I plan to win!" })); AddStep("message from team blue", () => testChannel.AddNewMessages(new Message(nextMessageId()) { - Sender = blueUser, + Sender = bluePlayer.ToUser(), Content = "Not on my watch. Prepare to eat saaaaaaaaaand. Lots and lots of saaaaaaand." })); diff --git a/osu.Game.Tournament.Tests/TournamentTestScene.cs b/osu.Game.Tournament.Tests/TournamentTestScene.cs index d631d028bb..47ab3023e4 100644 --- a/osu.Game.Tournament.Tests/TournamentTestScene.cs +++ b/osu.Game.Tournament.Tests/TournamentTestScene.cs @@ -15,8 +15,6 @@ using osu.Game.Tests.Visual; using osu.Game.Tournament.IO; using osu.Game.Tournament.IPC; using osu.Game.Tournament.Models; -using osu.Game.Users; -using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tournament.Tests { @@ -123,11 +121,11 @@ namespace osu.Game.Tournament.Tests }, Players = { - new APIUser { Username = "Hello", Statistics = new UserStatistics { GlobalRank = 12 } }, - new APIUser { Username = "Hello", Statistics = new UserStatistics { GlobalRank = 16 } }, - new APIUser { Username = "Hello", Statistics = new UserStatistics { GlobalRank = 20 } }, - new APIUser { Username = "Hello", Statistics = new UserStatistics { GlobalRank = 24 } }, - new APIUser { Username = "Hello", Statistics = new UserStatistics { GlobalRank = 30 } }, + new TournamentPlayer { Username = "Hello", Rank = 12 }, + new TournamentPlayer { Username = "Hello", Rank = 16 }, + new TournamentPlayer { Username = "Hello", Rank = 20 }, + new TournamentPlayer { Username = "Hello", Rank = 24 }, + new TournamentPlayer { Username = "Hello", Rank = 30 }, } } }, @@ -140,11 +138,11 @@ namespace osu.Game.Tournament.Tests FullName = { Value = "United States" }, Players = { - new APIUser { Username = "Hello" }, - new APIUser { Username = "Hello" }, - new APIUser { Username = "Hello" }, - new APIUser { Username = "Hello" }, - new APIUser { Username = "Hello" }, + new TournamentPlayer { Username = "Hello" }, + new TournamentPlayer { Username = "Hello" }, + new TournamentPlayer { Username = "Hello" }, + new TournamentPlayer { Username = "Hello" }, + new TournamentPlayer { Username = "Hello" }, } } }, diff --git a/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs b/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs index 21de2bb0eb..fd62c53741 100644 --- a/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs +++ b/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs @@ -7,7 +7,6 @@ using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; -using osu.Game.Online.API.Requests.Responses; using osu.Game.Tournament.Models; using osuTK; using osuTK.Graphics; @@ -56,7 +55,7 @@ namespace osu.Game.Tournament.Components }, }; - TournamentSpriteText createPlayerText(APIUser p) => + TournamentSpriteText createPlayerText(TournamentPlayer p) => new TournamentSpriteText { Text = p.Username, diff --git a/osu.Game.Tournament/Models/TournamentTeam.cs b/osu.Game.Tournament/Models/TournamentTeam.cs index 051f1a6d80..420b47da66 100644 --- a/osu.Game.Tournament/Models/TournamentTeam.cs +++ b/osu.Game.Tournament/Models/TournamentTeam.cs @@ -7,7 +7,6 @@ using System; using System.Linq; using Newtonsoft.Json; using osu.Framework.Bindables; -using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Tournament.Models { @@ -38,7 +37,7 @@ namespace osu.Game.Tournament.Models { get { - int[] ranks = Players.Select(p => p.Statistics?.GlobalRank) + int[] ranks = Players.Select(p => p.Rank) .Where(i => i.HasValue) .Select(i => i.Value) .ToArray(); @@ -59,7 +58,7 @@ namespace osu.Game.Tournament.Models }; [JsonProperty] - public BindableList Players { get; set; } = new BindableList(); + public BindableList Players { get; set; } = new BindableList(); public TournamentTeam() { diff --git a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs index 005d8f36bb..942f861770 100644 --- a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs @@ -15,7 +15,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Online.API; -using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Settings; using osu.Game.Tournament.Components; using osu.Game.Tournament.Models; @@ -202,14 +201,14 @@ namespace osu.Game.Tournament.Screens.Editors public void CreateNew() { - var user = new APIUser(); - team.Players.Add(user); - flow.Add(new PlayerRow(team, user)); + var player = new TournamentPlayer(); + team.Players.Add(player); + flow.Add(new PlayerRow(team, player)); } public class PlayerRow : CompositeDrawable { - private readonly APIUser user; + private readonly TournamentPlayer player; [Resolved] protected IAPIProvider API { get; private set; } @@ -217,13 +216,13 @@ namespace osu.Game.Tournament.Screens.Editors [Resolved] private TournamentGameBase game { get; set; } - private readonly Bindable userId = new Bindable(); + private readonly Bindable playerId = new Bindable(); private readonly Container drawableContainer; - public PlayerRow(TournamentTeam team, APIUser user) + public PlayerRow(TournamentTeam team, TournamentPlayer player) { - this.user = user; + this.player = player; Margin = new MarginPadding(10); @@ -254,7 +253,7 @@ namespace osu.Game.Tournament.Screens.Editors LabelText = "User ID", RelativeSizeAxes = Axes.None, Width = 200, - Current = userId, + Current = playerId, }, drawableContainer = new Container { @@ -272,7 +271,7 @@ namespace osu.Game.Tournament.Screens.Editors Action = () => { Expire(); - team.Players.Remove(user); + team.Players.Remove(player); }, } }; @@ -281,27 +280,27 @@ namespace osu.Game.Tournament.Screens.Editors [BackgroundDependencyLoader] private void load() { - userId.Value = user.Id; - userId.BindValueChanged(id => + playerId.Value = player.Id; + playerId.BindValueChanged(id => { - user.Id = id.NewValue ?? 0; + player.Id = id.NewValue ?? 0; if (id.NewValue != id.OldValue) - user.Username = string.Empty; + player.Username = string.Empty; - if (!string.IsNullOrEmpty(user.Username)) + if (!string.IsNullOrEmpty(player.Username)) { updatePanel(); return; } - game.PopulateUser(user, updatePanel, updatePanel); + game.PopulatePlayer(player, updatePanel, updatePanel); }, true); } private void updatePanel() { - drawableContainer.Child = new UserGridPanel(user) { Width = 300 }; + drawableContainer.Child = new UserGridPanel(player.ToUser()) { Width = 300 }; } } } diff --git a/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs index b9559015d6..df6e8e816e 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs @@ -257,7 +257,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro }; foreach (var p in team.Players) - fill.Add(new RowDisplay(p.Username, p.Statistics?.GlobalRank?.ToString("\\##,0") ?? "-")); + fill.Add(new RowDisplay(p.Username, p.Rank?.ToString("\\##,0") ?? "-")); } internal class RowDisplay : CompositeDrawable diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 2d6d5a01e4..3fa6bca0be 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -22,7 +22,6 @@ using osu.Game.Tournament.IO; using osu.Game.Tournament.IPC; using osu.Game.Tournament.Models; using osuTK.Input; -using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tournament { @@ -187,9 +186,7 @@ namespace osu.Game.Tournament { var playersRequiringPopulation = ladder.Teams .SelectMany(t => t.Players) - .Where(p => string.IsNullOrEmpty(p.Username) - || p.Statistics?.GlobalRank == null - || p.Statistics?.CountryRank == null).ToList(); + .Where(p => string.IsNullOrEmpty(p.Username) || p.Rank == null).ToList(); if (playersRequiringPopulation.Count == 0) return false; @@ -197,7 +194,7 @@ namespace osu.Game.Tournament for (int i = 0; i < playersRequiringPopulation.Count; i++) { var p = playersRequiringPopulation[i]; - PopulateUser(p, immediate: true); + PopulatePlayer(p, immediate: true); updateLoadProgressMessage($"Populating user stats ({i} / {playersRequiringPopulation.Count})"); } @@ -259,9 +256,9 @@ namespace osu.Game.Tournament private void updateLoadProgressMessage(string s) => Schedule(() => initialisationText.Text = s); - public void PopulateUser(APIUser user, Action success = null, Action failure = null, bool immediate = false) + public void PopulatePlayer(TournamentPlayer player, Action success = null, Action failure = null, bool immediate = false) { - var req = new GetUserRequest(user.Id, ladder.Ruleset.Value); + var req = new GetUserRequest(player.Id, ladder.Ruleset.Value); if (immediate) { @@ -273,7 +270,7 @@ namespace osu.Game.Tournament req.Success += res => { populate(); }; req.Failure += _ => { - user.Id = 1; + player.Id = 1; failure?.Invoke(); }; @@ -287,12 +284,12 @@ namespace osu.Game.Tournament if (res == null) return; - user.Id = res.Id; + player.Id = res.Id; - user.Username = res.Username; - user.Statistics = res.Statistics; - user.Country = res.Country; - user.Cover = res.Cover; + player.Username = res.Username; + player.CoverUrl = res.CoverUrl; + player.Country = res.Country; + player.Rank = res.Statistics?.GlobalRank; success?.Invoke(); } From c4d69405bfd5e38d348cabe89112489b14d51c5b Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Fri, 17 Jun 2022 21:18:16 +0100 Subject: [PATCH 1731/2328] Adjust speed ratio fraction to avoid division by 0 --- osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs index 3be4d621eb..7782aa90f3 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/SpeedEvaluator.cs @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators double currDeltaTime = Math.Max(1, osuCurrObj.DeltaTime); double nextDeltaTime = Math.Max(1, osuNextObj.DeltaTime); double deltaDifference = Math.Abs(nextDeltaTime - currDeltaTime); - double speedRatio = Math.Min(1, currDeltaTime / deltaDifference); + double speedRatio = currDeltaTime / Math.Max(currDeltaTime, deltaDifference); double windowRatio = Math.Pow(Math.Min(1, currDeltaTime / greatWindowFull), 2); doubletapness = Math.Pow(speedRatio, 1 - windowRatio); } From 200b23c6894b35d5a13b90c62f1ffc82c573be45 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 18 Jun 2022 01:30:54 +0300 Subject: [PATCH 1732/2328] Add lightweight `TournamentBeatmap` model --- .../Models/TournamentBeatmap.cs | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 osu.Game.Tournament/Models/TournamentBeatmap.cs diff --git a/osu.Game.Tournament/Models/TournamentBeatmap.cs b/osu.Game.Tournament/Models/TournamentBeatmap.cs new file mode 100644 index 0000000000..274fddc490 --- /dev/null +++ b/osu.Game.Tournament/Models/TournamentBeatmap.cs @@ -0,0 +1,99 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Extensions.ObjectExtensions; +using osu.Game.Beatmaps; +using osu.Game.Extensions; +using osu.Game.Online.API.Requests.Responses; +using osu.Game.Rulesets; + +namespace osu.Game.Tournament.Models +{ + public class TournamentBeatmap : IBeatmapInfo, IBeatmapSetOnlineInfo + { + public int OnlineID { get; set; } + + public string DifficultyName { get; set; } = string.Empty; + + public double BPM { get; set; } + + public double Length { get; set; } + + public double StarRating { get; set; } + + public IBeatmapMetadataInfo Metadata { get; set; } = new BeatmapMetadata(); + + public IBeatmapDifficultyInfo Difficulty { get; set; } = new BeatmapDifficulty(); + + public BeatmapSetOnlineCovers Covers { get; set; } + + public TournamentBeatmap() + { + } + + public TournamentBeatmap(APIBeatmap beatmap) + { + OnlineID = beatmap.OnlineID; + DifficultyName = beatmap.DifficultyName; + BPM = beatmap.BPM; + Length = beatmap.Length; + StarRating = beatmap.StarRating; + Metadata = beatmap.Metadata; + Difficulty = beatmap.Difficulty; + Covers = beatmap.BeatmapSet.AsNonNull().Covers; + } + + public bool Equals(IBeatmapInfo? other) => other is TournamentBeatmap b && this.MatchesOnlineID(b); + + #region IBeatmapInfo/IBeatmapSetOnlineInfo explicit implementation + + IBeatmapSetInfo IBeatmapInfo.BeatmapSet => throw new NotImplementedException(); + + string IBeatmapSetOnlineInfo.Preview => throw new NotImplementedException(); + + double IBeatmapSetOnlineInfo.BPM => throw new NotImplementedException(); + + int IBeatmapSetOnlineInfo.PlayCount => throw new NotImplementedException(); + + int IBeatmapSetOnlineInfo.FavouriteCount => throw new NotImplementedException(); + + bool IBeatmapSetOnlineInfo.HasFavourited => throw new NotImplementedException(); + + BeatmapSetOnlineAvailability IBeatmapSetOnlineInfo.Availability => throw new NotImplementedException(); + + BeatmapSetOnlineGenre IBeatmapSetOnlineInfo.Genre => throw new NotImplementedException(); + + BeatmapSetOnlineLanguage IBeatmapSetOnlineInfo.Language => throw new NotImplementedException(); + + int? IBeatmapSetOnlineInfo.TrackId => throw new NotImplementedException(); + + int[] IBeatmapSetOnlineInfo.Ratings => throw new NotImplementedException(); + + BeatmapSetHypeStatus IBeatmapSetOnlineInfo.HypeStatus => throw new NotImplementedException(); + + BeatmapSetNominationStatus IBeatmapSetOnlineInfo.NominationStatus => throw new NotImplementedException(); + + string IBeatmapInfo.Hash => throw new NotImplementedException(); + + string IBeatmapInfo.MD5Hash => throw new NotImplementedException(); + + IRulesetInfo IBeatmapInfo.Ruleset => throw new NotImplementedException(); + + DateTimeOffset IBeatmapSetOnlineInfo.Submitted => throw new NotImplementedException(); + + DateTimeOffset? IBeatmapSetOnlineInfo.Ranked => throw new NotImplementedException(); + + DateTimeOffset? IBeatmapSetOnlineInfo.LastUpdated => throw new NotImplementedException(); + + BeatmapOnlineStatus IBeatmapSetOnlineInfo.Status => throw new NotImplementedException(); + + bool IBeatmapSetOnlineInfo.HasExplicitContent => throw new NotImplementedException(); + + bool IBeatmapSetOnlineInfo.HasVideo => throw new NotImplementedException(); + + bool IBeatmapSetOnlineInfo.HasStoryboard => throw new NotImplementedException(); + + #endregion + } +} From 9f97d1a7db59e119adca33449f960794f1bed0a2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 18 Jun 2022 01:34:09 +0300 Subject: [PATCH 1733/2328] Replace tournament beatmap storage type with lightweight model --- osu.Game.Tournament.Tests/Components/TestSceneSongBar.cs | 2 +- .../Components/TestSceneTournamentBeatmapPanel.cs | 3 ++- .../Components/TestSceneTournamentModDisplay.cs | 3 ++- osu.Game.Tournament.Tests/TournamentTestScene.cs | 8 ++++---- osu.Game.Tournament/Components/SongBar.cs | 6 +++--- osu.Game.Tournament/Components/TournamentBeatmapPanel.cs | 7 +++---- osu.Game.Tournament/IPC/FileBasedIPC.cs | 2 +- osu.Game.Tournament/IPC/MatchIPCInfo.cs | 4 ++-- osu.Game.Tournament/Models/RoundBeatmap.cs | 3 +-- osu.Game.Tournament/Models/SeedingBeatmap.cs | 3 +-- osu.Game.Tournament/Screens/BeatmapInfoScreen.cs | 4 ++-- osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs | 2 +- .../Screens/Editors/SeedingEditorScreen.cs | 2 +- osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs | 3 +-- osu.Game.Tournament/TournamentGameBase.cs | 8 ++++---- 15 files changed, 29 insertions(+), 31 deletions(-) diff --git a/osu.Game.Tournament.Tests/Components/TestSceneSongBar.cs b/osu.Game.Tournament.Tests/Components/TestSceneSongBar.cs index f90269ae60..992baa48a3 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneSongBar.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneSongBar.cs @@ -42,7 +42,7 @@ namespace osu.Game.Tournament.Tests.Components beatmap.Length = 123456; beatmap.BPM = 133; - songBar.Beatmap = beatmap; + songBar.Beatmap = new TournamentBeatmap(beatmap); }); AddStep("set mods to HR", () => songBar.Mods = LegacyMods.HardRock); AddStep("set mods to DT", () => songBar.Mods = LegacyMods.DoubleTime); diff --git a/osu.Game.Tournament.Tests/Components/TestSceneTournamentBeatmapPanel.cs b/osu.Game.Tournament.Tests/Components/TestSceneTournamentBeatmapPanel.cs index 1030aae903..adfe048ce4 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneTournamentBeatmapPanel.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneTournamentBeatmapPanel.cs @@ -10,6 +10,7 @@ using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Tests.Visual; using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; namespace osu.Game.Tournament.Tests.Components { @@ -32,7 +33,7 @@ namespace osu.Game.Tournament.Tests.Components private void success(APIBeatmap beatmap) { - Add(new TournamentBeatmapPanel(beatmap) + Add(new TournamentBeatmapPanel(new TournamentBeatmap(beatmap)) { Anchor = Anchor.Centre, Origin = Anchor.Centre diff --git a/osu.Game.Tournament.Tests/Components/TestSceneTournamentModDisplay.cs b/osu.Game.Tournament.Tests/Components/TestSceneTournamentModDisplay.cs index fdd5578228..263617ddf7 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneTournamentModDisplay.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneTournamentModDisplay.cs @@ -11,6 +11,7 @@ using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; using osuTK; namespace osu.Game.Tournament.Tests.Components @@ -53,7 +54,7 @@ namespace osu.Game.Tournament.Tests.Components foreach (var mod in mods) { - fillFlow.Add(new TournamentBeatmapPanel(beatmap, mod.Acronym) + fillFlow.Add(new TournamentBeatmapPanel(new TournamentBeatmap(beatmap), mod.Acronym) { Anchor = Anchor.Centre, Origin = Anchor.Centre diff --git a/osu.Game.Tournament.Tests/TournamentTestScene.cs b/osu.Game.Tournament.Tests/TournamentTestScene.cs index d631d028bb..c30496812f 100644 --- a/osu.Game.Tournament.Tests/TournamentTestScene.cs +++ b/osu.Game.Tournament.Tests/TournamentTestScene.cs @@ -9,7 +9,7 @@ using osu.Framework.Allocation; using osu.Framework.Platform; using osu.Framework.Testing; using osu.Framework.Utils; -using osu.Game.Online.API.Requests.Responses; +using osu.Game.Beatmaps; using osu.Game.Rulesets; using osu.Game.Tests.Visual; using osu.Game.Tournament.IO; @@ -154,10 +154,10 @@ namespace osu.Game.Tournament.Tests } }; - public static APIBeatmap CreateSampleBeatmap() => - new APIBeatmap + public static TournamentBeatmap CreateSampleBeatmap() => + new TournamentBeatmap { - BeatmapSet = new APIBeatmapSet + Metadata = new BeatmapMetadata { Title = "Test Title", Artist = "Test Artist", diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index ecc655da99..a9056166be 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -14,9 +14,9 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.Legacy; using osu.Game.Extensions; using osu.Game.Graphics; -using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; using osu.Game.Screens.Menu; +using osu.Game.Tournament.Models; using osuTK; using osuTK.Graphics; @@ -24,14 +24,14 @@ namespace osu.Game.Tournament.Components { public class SongBar : CompositeDrawable { - private APIBeatmap beatmap; + private TournamentBeatmap beatmap; public const float HEIGHT = 145 / 2f; [Resolved] private IBindable ruleset { get; set; } - public APIBeatmap Beatmap + public TournamentBeatmap Beatmap { set { diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index 6416abe8a9..462743cc3d 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -14,7 +14,6 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; -using osu.Game.Online.API.Requests.Responses; using osu.Game.Tournament.Models; using osuTK.Graphics; @@ -22,7 +21,7 @@ namespace osu.Game.Tournament.Components { public class TournamentBeatmapPanel : CompositeDrawable { - public readonly APIBeatmap Beatmap; + public readonly TournamentBeatmap Beatmap; private readonly string mod; @@ -31,7 +30,7 @@ namespace osu.Game.Tournament.Components private readonly Bindable currentMatch = new Bindable(); private Box flash; - public TournamentBeatmapPanel(APIBeatmap beatmap, string mod = null) + public TournamentBeatmapPanel(TournamentBeatmap beatmap, string mod = null) { if (beatmap == null) throw new ArgumentNullException(nameof(beatmap)); @@ -61,7 +60,7 @@ namespace osu.Game.Tournament.Components { RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(0.5f), - OnlineInfo = Beatmap.BeatmapSet, + OnlineInfo = Beatmap, }, new FillFlowContainer { diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index 77af3e9b58..ad564c58c3 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -96,7 +96,7 @@ namespace osu.Game.Tournament.IPC else { beatmapLookupRequest = new GetBeatmapRequest(new APIBeatmap { OnlineID = beatmapId }); - beatmapLookupRequest.Success += b => Beatmap.Value = b; + beatmapLookupRequest.Success += b => Beatmap.Value = new TournamentBeatmap(b); API.Queue(beatmapLookupRequest); } } diff --git a/osu.Game.Tournament/IPC/MatchIPCInfo.cs b/osu.Game.Tournament/IPC/MatchIPCInfo.cs index ef1e36f871..f438923803 100644 --- a/osu.Game.Tournament/IPC/MatchIPCInfo.cs +++ b/osu.Game.Tournament/IPC/MatchIPCInfo.cs @@ -6,13 +6,13 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps.Legacy; -using osu.Game.Online.API.Requests.Responses; +using osu.Game.Tournament.Models; namespace osu.Game.Tournament.IPC { public class MatchIPCInfo : Component { - public Bindable Beatmap { get; } = new Bindable(); + public Bindable Beatmap { get; } = new Bindable(); public Bindable Mods { get; } = new Bindable(); public Bindable State { get; } = new Bindable(); public Bindable ChatChannel { get; } = new Bindable(); diff --git a/osu.Game.Tournament/Models/RoundBeatmap.cs b/osu.Game.Tournament/Models/RoundBeatmap.cs index 90e31ba352..65ef77e53d 100644 --- a/osu.Game.Tournament/Models/RoundBeatmap.cs +++ b/osu.Game.Tournament/Models/RoundBeatmap.cs @@ -4,7 +4,6 @@ #nullable disable using Newtonsoft.Json; -using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Tournament.Models { @@ -14,6 +13,6 @@ namespace osu.Game.Tournament.Models public string Mods; [JsonProperty("BeatmapInfo")] - public APIBeatmap Beatmap; + public TournamentBeatmap Beatmap; } } diff --git a/osu.Game.Tournament/Models/SeedingBeatmap.cs b/osu.Game.Tournament/Models/SeedingBeatmap.cs index c854488319..03beb7ca9a 100644 --- a/osu.Game.Tournament/Models/SeedingBeatmap.cs +++ b/osu.Game.Tournament/Models/SeedingBeatmap.cs @@ -5,7 +5,6 @@ using Newtonsoft.Json; using osu.Framework.Bindables; -using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Tournament.Models { @@ -14,7 +13,7 @@ namespace osu.Game.Tournament.Models public int ID; [JsonProperty("BeatmapInfo")] - public APIBeatmap Beatmap; + public TournamentBeatmap Beatmap; public long Score; diff --git a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs index 296267a4bc..763f576afe 100644 --- a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs +++ b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs @@ -7,9 +7,9 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps.Legacy; -using osu.Game.Online.API.Requests.Responses; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; +using osu.Game.Tournament.Models; namespace osu.Game.Tournament.Screens { @@ -39,7 +39,7 @@ namespace osu.Game.Tournament.Screens SongBar.Mods = mods.NewValue; } - private void beatmapChanged(ValueChangedEvent beatmap) + private void beatmapChanged(ValueChangedEvent beatmap) { SongBar.FadeInFromZero(300, Easing.OutQuint); SongBar.Beatmap = beatmap.NewValue; diff --git a/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs index 214ae65289..1b670f4b69 100644 --- a/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs @@ -239,7 +239,7 @@ namespace osu.Game.Tournament.Screens.Editors req.Success += res => { - Model.Beatmap = res; + Model.Beatmap = new TournamentBeatmap(res); updatePanel(); }; diff --git a/osu.Game.Tournament/Screens/Editors/SeedingEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/SeedingEditorScreen.cs index 1377c11225..1bc929604d 100644 --- a/osu.Game.Tournament/Screens/Editors/SeedingEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/SeedingEditorScreen.cs @@ -241,7 +241,7 @@ namespace osu.Game.Tournament.Screens.Editors req.Success += res => { - Model.Beatmap = res; + Model.Beatmap = new TournamentBeatmap(res); updatePanel(); }; diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 7ac4510ae5..5eb2142fae 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; using osu.Framework.Threading; using osu.Game.Graphics.UserInterface; -using osu.Game.Online.API.Requests.Responses; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; using osu.Game.Tournament.Models; @@ -107,7 +106,7 @@ namespace osu.Game.Tournament.Screens.MapPool ipc.Beatmap.BindValueChanged(beatmapChanged); } - private void beatmapChanged(ValueChangedEvent beatmap) + private void beatmapChanged(ValueChangedEvent beatmap) { if (CurrentMatch.Value == null || CurrentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) < 2) return; diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 2d6d5a01e4..eb04d098f7 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -211,7 +211,7 @@ namespace osu.Game.Tournament { var beatmapsRequiringPopulation = ladder.Rounds .SelectMany(r => r.Beatmaps) - .Where(b => string.IsNullOrEmpty(b.Beatmap?.BeatmapSet?.Title) && b.ID > 0).ToList(); + .Where(b => b.Beatmap?.OnlineID == 0 && b.ID > 0).ToList(); if (beatmapsRequiringPopulation.Count == 0) return false; @@ -222,7 +222,7 @@ namespace osu.Game.Tournament var req = new GetBeatmapRequest(new APIBeatmap { OnlineID = b.ID }); API.Perform(req); - b.Beatmap = req.Response ?? new APIBeatmap(); + b.Beatmap = new TournamentBeatmap(req.Response ?? new APIBeatmap()); updateLoadProgressMessage($"Populating round beatmaps ({i} / {beatmapsRequiringPopulation.Count})"); } @@ -238,7 +238,7 @@ namespace osu.Game.Tournament var beatmapsRequiringPopulation = ladder.Teams .SelectMany(r => r.SeedingResults) .SelectMany(r => r.Beatmaps) - .Where(b => string.IsNullOrEmpty(b.Beatmap?.BeatmapSet?.Title) && b.ID > 0).ToList(); + .Where(b => b.Beatmap?.OnlineID == 0 && b.ID > 0).ToList(); if (beatmapsRequiringPopulation.Count == 0) return false; @@ -249,7 +249,7 @@ namespace osu.Game.Tournament var req = new GetBeatmapRequest(new APIBeatmap { OnlineID = b.ID }); API.Perform(req); - b.Beatmap = req.Response ?? new APIBeatmap(); + b.Beatmap = new TournamentBeatmap(req.Response ?? new APIBeatmap()); updateLoadProgressMessage($"Populating seeding beatmaps ({i} / {beatmapsRequiringPopulation.Count})"); } From 60903be566c46aeb0481f2b10c1fd5096e8887ac Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 18 Jun 2022 01:46:37 +0300 Subject: [PATCH 1734/2328] Standardise naming for online ID Rather than continuing with `ID` or `Id`, this should follow the new standards and use `OnlineID` instead. Only updating this since it's a newly introduced class. --- .../Components/TestSceneTournamentMatchChatDisplay.cs | 4 ++-- osu.Game.Tournament/Models/TournamentPlayer.cs | 9 ++++----- osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs | 4 ++-- osu.Game.Tournament/TournamentGameBase.cs | 6 +++--- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs b/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs index 3eac240be5..a95ae4b8ba 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs @@ -30,13 +30,13 @@ namespace osu.Game.Tournament.Tests.Components private readonly TournamentPlayer redPlayer = new TournamentPlayer { Username = "BanchoBot", - Id = 3, + OnlineID = 3, }; private readonly TournamentPlayer bluePlayer = new TournamentPlayer { Username = "Zallius", - Id = 4, + OnlineID = 4, }; [Cached] diff --git a/osu.Game.Tournament/Models/TournamentPlayer.cs b/osu.Game.Tournament/Models/TournamentPlayer.cs index 6fd2f178e1..976936ab07 100644 --- a/osu.Game.Tournament/Models/TournamentPlayer.cs +++ b/osu.Game.Tournament/Models/TournamentPlayer.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; -using osu.Game.Database; +using Newtonsoft.Json; using osu.Game.Online.API.Requests.Responses; using osu.Game.Users; @@ -14,7 +14,8 @@ namespace osu.Game.Tournament.Models [Serializable] public class TournamentPlayer : IUser { - public int Id { get; set; } + [JsonProperty(@"id")] + public int OnlineID { get; set; } public string Username { get; set; } = string.Empty; @@ -37,7 +38,7 @@ namespace osu.Game.Tournament.Models { var user = new APIUser { - Id = Id, + Id = OnlineID, Username = Username, Country = Country, CoverUrl = CoverUrl, @@ -52,8 +53,6 @@ namespace osu.Game.Tournament.Models return user; } - int IHasOnlineID.OnlineID => Id; - bool IUser.IsBot => false; } } diff --git a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs index 942f861770..f29c45c949 100644 --- a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs @@ -280,10 +280,10 @@ namespace osu.Game.Tournament.Screens.Editors [BackgroundDependencyLoader] private void load() { - playerId.Value = player.Id; + playerId.Value = player.OnlineID; playerId.BindValueChanged(id => { - player.Id = id.NewValue ?? 0; + player.OnlineID = id.NewValue ?? 0; if (id.NewValue != id.OldValue) player.Username = string.Empty; diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 3fa6bca0be..f53e36a61e 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -258,7 +258,7 @@ namespace osu.Game.Tournament public void PopulatePlayer(TournamentPlayer player, Action success = null, Action failure = null, bool immediate = false) { - var req = new GetUserRequest(player.Id, ladder.Ruleset.Value); + var req = new GetUserRequest(player.OnlineID, ladder.Ruleset.Value); if (immediate) { @@ -270,7 +270,7 @@ namespace osu.Game.Tournament req.Success += res => { populate(); }; req.Failure += _ => { - player.Id = 1; + player.OnlineID = 1; failure?.Invoke(); }; @@ -284,7 +284,7 @@ namespace osu.Game.Tournament if (res == null) return; - player.Id = res.Id; + player.OnlineID = res.Id; player.Username = res.Username; player.CoverUrl = res.CoverUrl; From 4c47996130de73ed0d4f87be47c4e65c064111ed Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 18 Jun 2022 02:33:26 +0300 Subject: [PATCH 1735/2328] `TournamentPlayer` -> `TournamentUser` --- .../TestSceneDrawableTournamentTeam.cs | 14 ++++++------ .../TestSceneTournamentMatchChatDisplay.cs | 14 ++++++------ .../TournamentTestScene.cs | 20 ++++++++--------- .../Components/DrawableTeamWithPlayers.cs | 2 +- osu.Game.Tournament/Models/TournamentTeam.cs | 2 +- ...{TournamentPlayer.cs => TournamentUser.cs} | 6 ++--- .../Screens/Editors/TeamEditorScreen.cs | 22 +++++++++---------- osu.Game.Tournament/TournamentGameBase.cs | 16 +++++++------- 8 files changed, 48 insertions(+), 48 deletions(-) rename osu.Game.Tournament/Models/{TournamentPlayer.cs => TournamentUser.cs} (89%) diff --git a/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs index 3cf65b1990..4ea7e8008a 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs @@ -25,13 +25,13 @@ namespace osu.Game.Tournament.Tests.Components FullName = { Value = "Australia" }, Players = { - new TournamentPlayer { Username = "ASecretBox" }, - new TournamentPlayer { Username = "Dereban" }, - new TournamentPlayer { Username = "mReKk" }, - new TournamentPlayer { Username = "uyghti" }, - new TournamentPlayer { Username = "Parkes" }, - new TournamentPlayer { Username = "Shiroha" }, - new TournamentPlayer { Username = "Jordan The Bear" }, + new TournamentUser { Username = "ASecretBox" }, + new TournamentUser { Username = "Dereban" }, + new TournamentUser { Username = "mReKk" }, + new TournamentUser { Username = "uyghti" }, + new TournamentUser { Username = "Parkes" }, + new TournamentUser { Username = "Shiroha" }, + new TournamentUser { Username = "Jordan The Bear" }, } }; diff --git a/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs b/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs index a95ae4b8ba..eb8b0dfbe6 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs @@ -27,13 +27,13 @@ namespace osu.Game.Tournament.Tests.Components Colour = "f2ca34" }; - private readonly TournamentPlayer redPlayer = new TournamentPlayer + private readonly TournamentUser redUser = new TournamentUser { Username = "BanchoBot", OnlineID = 3, }; - private readonly TournamentPlayer bluePlayer = new TournamentPlayer + private readonly TournamentUser blueUser = new TournamentUser { Username = "Zallius", OnlineID = 4, @@ -59,11 +59,11 @@ namespace osu.Game.Tournament.Tests.Components { Team1 = { - Value = new TournamentTeam { Players = new BindableList { redPlayer } } + Value = new TournamentTeam { Players = new BindableList { redUser } } }, Team2 = { - Value = new TournamentTeam { Players = new BindableList { bluePlayer } } + Value = new TournamentTeam { Players = new BindableList { blueUser } } } }; @@ -82,19 +82,19 @@ namespace osu.Game.Tournament.Tests.Components AddStep("message from team red", () => testChannel.AddNewMessages(new Message(nextMessageId()) { - Sender = redPlayer.ToUser(), + Sender = redUser.ToAPIUser(), Content = "I am team red." })); AddStep("message from team red", () => testChannel.AddNewMessages(new Message(nextMessageId()) { - Sender = redPlayer.ToUser(), + Sender = redUser.ToAPIUser(), Content = "I plan to win!" })); AddStep("message from team blue", () => testChannel.AddNewMessages(new Message(nextMessageId()) { - Sender = bluePlayer.ToUser(), + Sender = blueUser.ToAPIUser(), Content = "Not on my watch. Prepare to eat saaaaaaaaaand. Lots and lots of saaaaaaand." })); diff --git a/osu.Game.Tournament.Tests/TournamentTestScene.cs b/osu.Game.Tournament.Tests/TournamentTestScene.cs index 47ab3023e4..ea7d6e7827 100644 --- a/osu.Game.Tournament.Tests/TournamentTestScene.cs +++ b/osu.Game.Tournament.Tests/TournamentTestScene.cs @@ -121,11 +121,11 @@ namespace osu.Game.Tournament.Tests }, Players = { - new TournamentPlayer { Username = "Hello", Rank = 12 }, - new TournamentPlayer { Username = "Hello", Rank = 16 }, - new TournamentPlayer { Username = "Hello", Rank = 20 }, - new TournamentPlayer { Username = "Hello", Rank = 24 }, - new TournamentPlayer { Username = "Hello", Rank = 30 }, + new TournamentUser { Username = "Hello", Rank = 12 }, + new TournamentUser { Username = "Hello", Rank = 16 }, + new TournamentUser { Username = "Hello", Rank = 20 }, + new TournamentUser { Username = "Hello", Rank = 24 }, + new TournamentUser { Username = "Hello", Rank = 30 }, } } }, @@ -138,11 +138,11 @@ namespace osu.Game.Tournament.Tests FullName = { Value = "United States" }, Players = { - new TournamentPlayer { Username = "Hello" }, - new TournamentPlayer { Username = "Hello" }, - new TournamentPlayer { Username = "Hello" }, - new TournamentPlayer { Username = "Hello" }, - new TournamentPlayer { Username = "Hello" }, + new TournamentUser { Username = "Hello" }, + new TournamentUser { Username = "Hello" }, + new TournamentUser { Username = "Hello" }, + new TournamentUser { Username = "Hello" }, + new TournamentUser { Username = "Hello" }, } } }, diff --git a/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs b/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs index fd62c53741..0bb35d534c 100644 --- a/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs +++ b/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs @@ -55,7 +55,7 @@ namespace osu.Game.Tournament.Components }, }; - TournamentSpriteText createPlayerText(TournamentPlayer p) => + TournamentSpriteText createPlayerText(TournamentUser p) => new TournamentSpriteText { Text = p.Username, diff --git a/osu.Game.Tournament/Models/TournamentTeam.cs b/osu.Game.Tournament/Models/TournamentTeam.cs index 420b47da66..9dbe23b4b3 100644 --- a/osu.Game.Tournament/Models/TournamentTeam.cs +++ b/osu.Game.Tournament/Models/TournamentTeam.cs @@ -58,7 +58,7 @@ namespace osu.Game.Tournament.Models }; [JsonProperty] - public BindableList Players { get; set; } = new BindableList(); + public BindableList Players { get; set; } = new BindableList(); public TournamentTeam() { diff --git a/osu.Game.Tournament/Models/TournamentPlayer.cs b/osu.Game.Tournament/Models/TournamentUser.cs similarity index 89% rename from osu.Game.Tournament/Models/TournamentPlayer.cs rename to osu.Game.Tournament/Models/TournamentUser.cs index 976936ab07..80e58538e5 100644 --- a/osu.Game.Tournament/Models/TournamentPlayer.cs +++ b/osu.Game.Tournament/Models/TournamentUser.cs @@ -9,10 +9,10 @@ using osu.Game.Users; namespace osu.Game.Tournament.Models { /// - /// A tournament player, containing simple information about the player. + /// A tournament player user, containing simple information about the player. /// [Serializable] - public class TournamentPlayer : IUser + public class TournamentUser : IUser { [JsonProperty(@"id")] public int OnlineID { get; set; } @@ -34,7 +34,7 @@ namespace osu.Game.Tournament.Models /// public string CoverUrl { get; set; } = string.Empty; - public APIUser ToUser() + public APIUser ToAPIUser() { var user = new APIUser { diff --git a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs index f29c45c949..11db37c8b7 100644 --- a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs @@ -201,14 +201,14 @@ namespace osu.Game.Tournament.Screens.Editors public void CreateNew() { - var player = new TournamentPlayer(); + var player = new TournamentUser(); team.Players.Add(player); flow.Add(new PlayerRow(team, player)); } public class PlayerRow : CompositeDrawable { - private readonly TournamentPlayer player; + private readonly TournamentUser user; [Resolved] protected IAPIProvider API { get; private set; } @@ -220,9 +220,9 @@ namespace osu.Game.Tournament.Screens.Editors private readonly Container drawableContainer; - public PlayerRow(TournamentTeam team, TournamentPlayer player) + public PlayerRow(TournamentTeam team, TournamentUser user) { - this.player = player; + this.user = user; Margin = new MarginPadding(10); @@ -271,7 +271,7 @@ namespace osu.Game.Tournament.Screens.Editors Action = () => { Expire(); - team.Players.Remove(player); + team.Players.Remove(user); }, } }; @@ -280,27 +280,27 @@ namespace osu.Game.Tournament.Screens.Editors [BackgroundDependencyLoader] private void load() { - playerId.Value = player.OnlineID; + playerId.Value = user.OnlineID; playerId.BindValueChanged(id => { - player.OnlineID = id.NewValue ?? 0; + user.OnlineID = id.NewValue ?? 0; if (id.NewValue != id.OldValue) - player.Username = string.Empty; + user.Username = string.Empty; - if (!string.IsNullOrEmpty(player.Username)) + if (!string.IsNullOrEmpty(user.Username)) { updatePanel(); return; } - game.PopulatePlayer(player, updatePanel, updatePanel); + game.PopulatePlayer(user, updatePanel, updatePanel); }, true); } private void updatePanel() { - drawableContainer.Child = new UserGridPanel(player.ToUser()) { Width = 300 }; + drawableContainer.Child = new UserGridPanel(user.ToAPIUser()) { Width = 300 }; } } } diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index f53e36a61e..a8d4abc5f4 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -256,9 +256,9 @@ namespace osu.Game.Tournament private void updateLoadProgressMessage(string s) => Schedule(() => initialisationText.Text = s); - public void PopulatePlayer(TournamentPlayer player, Action success = null, Action failure = null, bool immediate = false) + public void PopulatePlayer(TournamentUser user, Action success = null, Action failure = null, bool immediate = false) { - var req = new GetUserRequest(player.OnlineID, ladder.Ruleset.Value); + var req = new GetUserRequest(user.OnlineID, ladder.Ruleset.Value); if (immediate) { @@ -270,7 +270,7 @@ namespace osu.Game.Tournament req.Success += res => { populate(); }; req.Failure += _ => { - player.OnlineID = 1; + user.OnlineID = 1; failure?.Invoke(); }; @@ -284,12 +284,12 @@ namespace osu.Game.Tournament if (res == null) return; - player.OnlineID = res.Id; + user.OnlineID = res.Id; - player.Username = res.Username; - player.CoverUrl = res.CoverUrl; - player.Country = res.Country; - player.Rank = res.Statistics?.GlobalRank; + user.Username = res.Username; + user.CoverUrl = res.CoverUrl; + user.Country = res.Country; + user.Rank = res.Statistics?.GlobalRank; success?.Invoke(); } From 14cdb01fd8f90ce77ceedc45d412049457d3b6ce Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sat, 18 Jun 2022 08:49:48 +0900 Subject: [PATCH 1736/2328] Revert unintended change --- osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs index ae1ac5fa47..a3423d4189 100644 --- a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs @@ -202,16 +202,14 @@ namespace osu.Game.Online.Multiplayer return connection.InvokeAsync(nameof(IMultiplayerServer.AddPlaylistItem), item); } - public override async Task EditPlaylistItem(MultiplayerPlaylistItem item) + public override Task EditPlaylistItem(MultiplayerPlaylistItem item) { if (!IsConnected.Value) - return; + return Task.CompletedTask; Debug.Assert(connection != null); - await Task.Delay(10000); - - await connection.InvokeAsync(nameof(IMultiplayerServer.EditPlaylistItem), item); + return connection.InvokeAsync(nameof(IMultiplayerServer.EditPlaylistItem), item); } public override Task RemovePlaylistItem(long playlistItemId) From 8a1d11fefb58e51e27c98e1d31c6d785dfac263b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 18 Jun 2022 04:07:21 +0300 Subject: [PATCH 1737/2328] Cancel previous metronome sound playback on pause --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 270d544dcf..181f1ecb47 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -4,6 +4,7 @@ #nullable disable using System; +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -14,6 +15,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Threading; using osu.Framework.Timing; using osu.Framework.Utils; using osu.Game.Beatmaps.ControlPoints; @@ -37,6 +39,9 @@ namespace osu.Game.Screens.Edit.Timing private Sample clunk; + [CanBeNull] + private ScheduledDelegate clunkDelegate; + [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } @@ -258,6 +263,9 @@ namespace osu.Game.Screens.Edit.Timing } isSwinging = false; + + clunkDelegate?.Cancel(); + clunkDelegate = null; } } @@ -283,7 +291,7 @@ namespace osu.Game.Screens.Edit.Timing { stick.FlashColour(overlayColourProvider.Content1, beatLength, Easing.OutQuint); - Schedule(() => + clunkDelegate = Schedule(() => { if (!EnableClicking) return; From 204348f32777fda80630530017cdb1dc9e4935fe Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 18 Jun 2022 04:39:53 +0300 Subject: [PATCH 1738/2328] Fix metronome playing mistimed beat sounds on editor clock resume --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 181f1ecb47..670b7147b3 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -47,6 +47,11 @@ namespace osu.Game.Screens.Edit.Timing public bool EnableClicking { get; set; } = true; + public MetronomeDisplay() + { + AllowMistimedEventFiring = false; + } + [BackgroundDependencyLoader] private void load(AudioManager audio) { From 8ad96fd94baaf489233f88cad238f6044953a452 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 Jun 2022 10:55:24 +0900 Subject: [PATCH 1739/2328] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 8fcd7ef8c0..c82365d750 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index e9bf000109..d820be4bdc 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -37,7 +37,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index dd344b0cd0..a8c59d676d 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -62,7 +62,7 @@ - + From 361a87412bbfc9382e22853a2a659a6450dba677 Mon Sep 17 00:00:00 2001 From: 63411 <62799417+molneya@users.noreply.github.com> Date: Sat, 18 Jun 2022 12:20:47 +0800 Subject: [PATCH 1740/2328] Update comments --- .../Difficulty/ManiaPerformanceCalculator.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs index 23a95fe866..ed2654ceda 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs @@ -62,13 +62,17 @@ namespace osu.Game.Rulesets.Mania.Difficulty private double computeDifficultyValue(ManiaDifficultyAttributes attributes) { double difficultyValue = Math.Pow(Math.Max(attributes.StarRating - 0.15, 0.05), 2.2) // Star rating to pp curve - * Math.Max(0, 5 * scoreAccuracy - 4) // Accuracy curve - * (1 + 0.1 * Math.Min(1, totalHits / 1500)); // Length bonus + * Math.Max(0, 5 * scoreAccuracy - 4) // From 80% accuracy, 1/20th of total pp is awarded per additional 1% accuracy + * (1 + 0.1 * Math.Min(1, totalHits / 1500)); // Length bonus, capped at 1500 notes return difficultyValue; } private double totalHits => countPerfect + countOk + countGreat + countGood + countMeh + countMiss; + + /// + /// Accuracy used to weight judgements independently from the score's actual accuracy. + /// private double customAccuracy => (countPerfect * 320 + countGreat * 300 + countGood * 200 + countOk * 100 + countMeh * 50) / (totalHits * 320); } } From bd5037fcad4c94cd5511f4f3146d43f2f3b76c56 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 Jun 2022 13:49:57 +0900 Subject: [PATCH 1741/2328] Fix new hitobject placements not taking on the existing sample settings Similar to velocity / difficulty points, a user expectation is that volume and sample settings will be transferred to newly placed objects from the most recent one. Closes https://github.com/ppy/osu/issues/18742. --- osu.Game/Rulesets/Edit/PlacementBlueprint.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs index 26dd6db016..3e93e576ba 100644 --- a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs +++ b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs @@ -3,6 +3,7 @@ #nullable disable +using System.Linq; using System.Threading; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -73,6 +74,10 @@ namespace osu.Game.Rulesets.Edit /// Whether this call is committing a value for HitObject.StartTime and continuing with further adjustments. protected void BeginPlacement(bool commitStart = false) { + var nearestSampleControlPoint = beatmap.HitObjects.LastOrDefault(h => h.GetEndTime() < HitObject.StartTime)?.SampleControlPoint?.DeepClone() as SampleControlPoint; + + HitObject.SampleControlPoint = nearestSampleControlPoint ?? new SampleControlPoint(); + placementHandler.BeginPlacement(HitObject); if (commitStart) PlacementActive = PlacementState.Active; From 77e7e4ecb21a67ae685491507959f3e5491f499a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sat, 18 Jun 2022 14:28:25 +0900 Subject: [PATCH 1742/2328] Fix selection being blocked after early return --- .../Multiplayer/MultiplayerMatchSongSelect.cs | 6 ++++-- .../Screens/OnlinePlay/OnlinePlaySongSelect.cs | 14 +++++++++----- .../OnlinePlay/Playlists/PlaylistsSongSelect.cs | 3 ++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs index 1f27a831ca..0f589a8b35 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs @@ -75,10 +75,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer loadingLayer.Hide(); } - protected override void SelectItem(PlaylistItem item) + protected override bool SelectItem(PlaylistItem item) { if (operationInProgress.Value) - return; + return false; // If the client is already in a room, update via the client. // Otherwise, update the playlist directly in preparation for it to be submitted to the API on match creation. @@ -124,6 +124,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer Playlist.Add(item); this.Exit(); } + + return true; } protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea(); diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs index 1552811c74..f26480909e 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs @@ -118,8 +118,6 @@ namespace osu.Game.Screens.OnlinePlay protected sealed override bool OnStart() { - itemSelected = true; - var item = new PlaylistItem(Beatmap.Value.BeatmapInfo) { RulesetID = Ruleset.Value.OnlineID, @@ -127,15 +125,21 @@ namespace osu.Game.Screens.OnlinePlay AllowedMods = FreeMods.Value.Select(m => new APIMod(m)).ToArray() }; - SelectItem(item); - return true; + if (SelectItem(item)) + { + itemSelected = true; + return true; + } + + return false; } /// /// Invoked when the user has requested a selection of a beatmap. /// /// The resultant . This item has not yet been added to the 's. - protected abstract void SelectItem(PlaylistItem item); + /// true if a selection occurred. + protected abstract bool SelectItem(PlaylistItem item); public override bool OnBackButton() { diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsSongSelect.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsSongSelect.cs index 65a27a9261..73765fc661 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsSongSelect.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists CreateNewItem = createNewItem }; - protected override void SelectItem(PlaylistItem item) + protected override bool SelectItem(PlaylistItem item) { switch (Playlist.Count) { @@ -39,6 +39,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists } this.Exit(); + return true; } private void createNewItem() From 984634c5802c61ba0ece44e2597411d9e8fc2772 Mon Sep 17 00:00:00 2001 From: 63411 <62799417+molneya@users.noreply.github.com> Date: Sat, 18 Jun 2022 22:27:28 +0800 Subject: [PATCH 1743/2328] Adjust customAccuracy formula slightly --- .../Difficulty/ManiaPerformanceCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs index ed2654ceda..dea02adfbf 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs @@ -73,6 +73,6 @@ namespace osu.Game.Rulesets.Mania.Difficulty /// /// Accuracy used to weight judgements independently from the score's actual accuracy. /// - private double customAccuracy => (countPerfect * 320 + countGreat * 300 + countGood * 200 + countOk * 100 + countMeh * 50) / (totalHits * 320); + private double customAccuracy => Math.Max((countPerfect * 320 + countGreat * 300 + countGood * 200 + countOk * 100 + countMeh * 50 - countMiss * 100) / (totalHits * 320), 0); } } From 56abe54fe6331f88c014baf7e34128bc070e8cec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 Jun 2022 22:59:19 +0900 Subject: [PATCH 1744/2328] Redirect graceful exiting to standard exit flow Rather than doing a completely forced exit as we were, this will now follow a more standard flow with the ability for the user to abort along the way. This is more in line with how I wanted this to work. Note that this means a confirmation is now shown. It has been discussed in the past that this confirmation should only show when there's an ongoing action implies the user may want to cancel the exit. For now I think this is fine. Addresses https://github.com/ppy/osu/discussions/18399#discussioncomment-2811311 --- osu.Game/OsuGame.cs | 6 ++++++ osu.Game/OsuGameBase.cs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 3041761a6b..06ade5a3c9 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -637,6 +637,12 @@ namespace osu.Game Add(performFromMainMenuTask = new PerformFromMenuRunner(action, validScreens, () => ScreenStack.CurrentScreen)); } + public override void GracefullyExit() + { + // Using PerformFromScreen gives the user a chance to interrupt the exit process if needed. + PerformFromScreen(menu => menu.Exit()); + } + /// /// Wait for the game (and target component) to become loaded and then run an action. /// diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 9908697bf1..dc7513d3c8 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -419,7 +419,7 @@ namespace osu.Game /// Use to programatically exit the game as if the user was triggering via alt-f4. /// Will keep persisting until an exit occurs (exit may be blocked multiple times). /// - public void GracefullyExit() + public virtual void GracefullyExit() { if (!OnExiting()) Exit(); From a5e5172b916a1798f3b131731e48ff1b5a1a965e Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 18 Jun 2022 18:28:36 +0300 Subject: [PATCH 1745/2328] Fix `BlueprintContainer` eating input from skin editor buttons --- .../Screens/Edit/Compose/Components/BlueprintContainer.cs | 7 ------- .../Edit/Compose/Components/ComposeBlueprintContainer.cs | 6 ++++++ .../Screens/Edit/Compose/Components/SelectionHandler.cs | 4 +++- .../Components/Timeline/TimelineBlueprintContainer.cs | 6 ++++++ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index c7bf23865b..d38aac1173 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -108,13 +108,6 @@ namespace osu.Game.Screens.Edit.Compose.Components /// protected virtual bool AllowDeselectionDuringDrag => true; - /// - /// Positional input must be received outside the container's bounds, - /// in order to handle blueprints which are partially offscreen. - /// - /// - public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; - protected override bool OnMouseDown(MouseDownEvent e) { bool selectionPerformed = performMouseDownActions(e); diff --git a/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs index ba43704a5f..4c37d200bc 100644 --- a/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs @@ -39,6 +39,12 @@ namespace osu.Game.Screens.Edit.Compose.Components private PlacementBlueprint currentPlacement; private InputManager inputManager; + /// + /// Positional input must be received outside the container's bounds, + /// in order to handle composer blueprints which are partially offscreen. + /// + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; + public ComposeBlueprintContainer(HitObjectComposer composer) : base(composer) { diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs index 96bd352cf9..91af3fde16 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs @@ -21,6 +21,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets.Edit; +using osu.Game.Screens.Edit.Compose.Components.Timeline; using osuTK; using osuTK.Input; @@ -103,7 +104,8 @@ namespace osu.Game.Screens.Edit.Compose.Components /// Positional input must be received outside the container's bounds, /// in order to handle blueprints which are partially offscreen. /// - /// + /// + /// public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; /// diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs index 138e28fa06..742e16d5a9 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs @@ -35,6 +35,12 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline private Bindable placement; private SelectionBlueprint placementBlueprint; + /// + /// Positional input must be received outside the container's bounds, + /// in order to handle timeline blueprints which are stacked offscreen. + /// + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => timeline.ReceivePositionalInputAt(screenSpacePos); + public TimelineBlueprintContainer(HitObjectComposer composer) : base(composer) { From 47ce087694fc9c2d0fa3ec81442ed5a171b016f8 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 18 Jun 2022 18:32:02 +0300 Subject: [PATCH 1746/2328] Actually click the gameplay scene button than `TriggerClick` --- .../Visual/Navigation/TestSceneSkinEditorNavigation.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs index 78ab7947a7..7d9c08d3d2 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs @@ -148,7 +148,11 @@ namespace osu.Game.Tests.Visual.Navigation private void switchToGameplayScene() { - AddStep("Click gameplay scene button", () => skinEditor.ChildrenOfType().First(b => b.Text == "Gameplay").TriggerClick()); + AddStep("Click gameplay scene button", () => + { + InputManager.MoveMouseTo(skinEditor.ChildrenOfType().First(b => b.Text == "Gameplay")); + InputManager.Click(MouseButton.Left); + }); AddUntilStep("wait for player", () => { From b2663d9399fd5b9fd75fef0a4bdf13a33ae29632 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 19 Jun 2022 01:14:48 +0900 Subject: [PATCH 1747/2328] Update xmldoc to suggest that `GracefullyExit` may be overridden --- osu.Game/OsuGameBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index dc7513d3c8..4a9f74d195 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -417,7 +417,7 @@ namespace osu.Game /// /// Use to programatically exit the game as if the user was triggering via alt-f4. - /// Will keep persisting until an exit occurs (exit may be blocked multiple times). + /// By default, will keep persisting until an exit occurs (exit may be blocked multiple times). /// public virtual void GracefullyExit() { From 3902dc64f0fee5a49def28062b769ef370187d0e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 19 Jun 2022 01:34:58 +0900 Subject: [PATCH 1748/2328] Fix adjusting offset via button seeking to timing point's offset unexpectedly This was added with the intention of tracking the offset when already at the start (the most common case when you're using the tap timing wizard), but was also seeking when the user may be much further beyond or before it. Addresses https://github.com/ppy/osu/discussions/18741#discussioncomment-2975051. --- osu.Game/Screens/Edit/Timing/TapTimingControl.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs index 53c92bac20..abc73851e4 100644 --- a/osu.Game/Screens/Edit/Timing/TapTimingControl.cs +++ b/osu.Game/Screens/Edit/Timing/TapTimingControl.cs @@ -195,6 +195,8 @@ namespace osu.Game.Screens.Edit.Timing private void adjustOffset(double adjust) { + bool wasAtStart = editorClock.CurrentTimeAccurate == selectedGroup.Value.Time; + // VERY TEMPORARY var currentGroupItems = selectedGroup.Value.ControlPoints.ToArray(); @@ -208,7 +210,7 @@ namespace osu.Game.Screens.Edit.Timing // the control point might not necessarily exist yet, if currentGroupItems was empty. selectedGroup.Value = beatmap.ControlPointInfo.GroupAt(newOffset, true); - if (!editorClock.IsRunning) + if (!editorClock.IsRunning && wasAtStart) editorClock.Seek(newOffset); } From 50e40756c462318ddebb812fe317c57ec1a4de70 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 19 Jun 2022 12:34:14 +0900 Subject: [PATCH 1749/2328] Rename `GracefullyExit` to `AttemptExit` --- osu.Desktop/Updater/SquirrelUpdateManager.cs | 2 +- osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs | 2 +- osu.Game/OsuGame.cs | 2 +- osu.Game/OsuGameBase.cs | 5 +++-- .../Settings/Sections/Maintenance/MigrationSelectScreen.cs | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Desktop/Updater/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs index 59bc2dabb2..4e5f8d37b1 100644 --- a/osu.Desktop/Updater/SquirrelUpdateManager.cs +++ b/osu.Desktop/Updater/SquirrelUpdateManager.cs @@ -154,7 +154,7 @@ namespace osu.Desktop.Updater Activated = () => { updateManager.PrepareUpdateAsync() - .ContinueWith(_ => updateManager.Schedule(() => game?.GracefullyExit())); + .ContinueWith(_ => updateManager.Schedule(() => game?.AttemptExit())); return true; }; } diff --git a/osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs b/osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs index fb33b3662a..447d6f44ce 100644 --- a/osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs +++ b/osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs @@ -27,7 +27,7 @@ namespace osu.Game.Tournament.Screens.Setup dropdown.Items = storage.ListTournaments(); dropdown.Current.BindValueChanged(v => Button.Enabled.Value = v.NewValue != startupTournament, true); - Action = () => game.GracefullyExit(); + Action = () => game.AttemptExit(); folderButton.Action = () => storage.PresentExternally(); ButtonText = "Close osu!"; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 06ade5a3c9..97476358b1 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -637,7 +637,7 @@ namespace osu.Game Add(performFromMainMenuTask = new PerformFromMenuRunner(action, validScreens, () => ScreenStack.CurrentScreen)); } - public override void GracefullyExit() + public override void AttemptExit() { // Using PerformFromScreen gives the user a chance to interrupt the exit process if needed. PerformFromScreen(menu => menu.Exit()); diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 4a9f74d195..1385c06640 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -418,13 +418,14 @@ namespace osu.Game /// /// Use to programatically exit the game as if the user was triggering via alt-f4. /// By default, will keep persisting until an exit occurs (exit may be blocked multiple times). + /// May be interrupted (see 's override. /// - public virtual void GracefullyExit() + public virtual void AttemptExit() { if (!OnExiting()) Exit(); else - Scheduler.AddDelayed(GracefullyExit, 2000); + Scheduler.AddDelayed(AttemptExit, 2000); } public bool Migrate(string path) diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs index 7e6341cd1b..c51a4db71a 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs @@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance dialogOverlay.Push(new ConfirmDialog("To complete this operation, osu! will close. Please open it again to use the new data location.", () => { (storage as OsuStorage)?.ChangeDataPath(target.FullName); - game.GracefullyExit(); + game.AttemptExit(); }, () => { })); }, () => { })); From de61b9e4109e693b96041f2ba0add55fe4e09394 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Fri, 17 Jun 2022 22:03:04 -0700 Subject: [PATCH 1750/2328] Revert "Add automated commit to git-blame-ignore-revs" This reverts commit 11bd87045ef7f18bd7cb5cf88fbd327b15f65257. --- .git-blame-ignore-revs | 2 -- 1 file changed, 2 deletions(-) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 39fa0f9f6c..8be6479043 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,4 +1,2 @@ # Normalize all the line endings 32a74f95a5c80a0ed18e693f13a47522099df5c3 -# Enabled NRT globally -f8830c6850128456266c82de83273204f8b74ac0 From 6515b249ec92964ac2e6c7711f3d336daf3ecc69 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 19 Jun 2022 12:39:58 +0900 Subject: [PATCH 1751/2328] Change data migration to do an immediate exit, rather than attempted exit --- .../Settings/Sections/Maintenance/MigrationSelectScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs index c51a4db71a..0d32e33d87 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs @@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance dialogOverlay.Push(new ConfirmDialog("To complete this operation, osu! will close. Please open it again to use the new data location.", () => { (storage as OsuStorage)?.ChangeDataPath(target.FullName); - game.AttemptExit(); + game.Exit(); }, () => { })); }, () => { })); From 98d69c846c5e285e5f41984f0465325aec438699 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sun, 19 Jun 2022 17:12:19 +0900 Subject: [PATCH 1752/2328] Reset spectator speed at last frame --- osu.Game/Screens/Play/SpectatorPlayer.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osu.Game/Screens/Play/SpectatorPlayer.cs b/osu.Game/Screens/Play/SpectatorPlayer.cs index d5aec055fc..72a7d3c8a1 100644 --- a/osu.Game/Screens/Play/SpectatorPlayer.cs +++ b/osu.Game/Screens/Play/SpectatorPlayer.cs @@ -83,6 +83,18 @@ namespace osu.Game.Screens.Play SetGameplayStartTime(score.Replay.Frames[0].Time); } + protected override void Update() + { + base.Update(); + + if (HUDOverlay.PlayerSettingsOverlay.PlaybackSettings.UserPlaybackRate.Value > 1 + && score.Replay.Frames.Count > 0 + && DrawableRuleset.FrameStableClock.CurrentTime >= score.Replay.Frames[^1].Time) + { + HUDOverlay.PlayerSettingsOverlay.PlaybackSettings.UserPlaybackRate.Value = 1; + } + } + protected override Score CreateScore(IBeatmap beatmap) => score; protected override ResultsScreen CreateResults(ScoreInfo score) From 495d747da55eab3cbfcc8331ffe5f6e73c6e3618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 19 Jun 2022 13:42:45 +0200 Subject: [PATCH 1753/2328] Fix mismatching braces in comment --- osu.Game/OsuGameBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 1385c06640..f0f364314c 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -418,7 +418,7 @@ namespace osu.Game /// /// Use to programatically exit the game as if the user was triggering via alt-f4. /// By default, will keep persisting until an exit occurs (exit may be blocked multiple times). - /// May be interrupted (see 's override. + /// May be interrupted (see 's override). /// public virtual void AttemptExit() { From 9a6f4ef76d052bf11317df92284022cf8f74d42b Mon Sep 17 00:00:00 2001 From: cdwcgt Date: Sun, 19 Jun 2022 23:59:37 +0900 Subject: [PATCH 1754/2328] Save score button on failed screen --- osu.Game/Screens/Play/FailOverlay.cs | 3 +++ osu.Game/Screens/Play/Player.cs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 1a31b0f462..b09a7de631 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -3,6 +3,7 @@ #nullable disable +using System; using osu.Game.Graphics; using osuTK.Graphics; using osu.Framework.Allocation; @@ -11,12 +12,14 @@ namespace osu.Game.Screens.Play { public class FailOverlay : GameplayMenuOverlay { + public Action SaveReplay; public override string Header => "failed"; public override string Description => "you're dead, try again?"; [BackgroundDependencyLoader] private void load(OsuColour colours) { + AddButton("Save replay and Quit", colours.Blue, () => SaveReplay?.Invoke()); AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke()); AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke()); } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 4a8460ff46..c404510487 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -266,6 +266,7 @@ namespace osu.Game.Screens.Play }, FailOverlay = new FailOverlay { + SaveReplay = saveReplay, OnRetry = Restart, OnQuit = () => PerformExit(true), }, @@ -1043,6 +1044,21 @@ namespace osu.Game.Screens.Play return base.OnExiting(e); } + // Don't know if prepareScoreForResults useful + private async void saveReplay() + { + var scoreCopy = Score.DeepClone(); + try + { + await ImportScore(scoreCopy).ConfigureAwait(false); + } + catch (Exception ex) + { + Logger.Error(ex, @"Score import failed!"); + } + PerformExit(true); + } + /// /// Creates the player's . /// From def87ed7822031164bebbf3ef474286a3533c91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 19 Jun 2022 19:18:29 +0200 Subject: [PATCH 1755/2328] Add failing test for editor gameplay test using wrong ruleset --- .../Editing/TestSceneEditorNavigation.cs | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs new file mode 100644 index 0000000000..85b50a9b21 --- /dev/null +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs @@ -0,0 +1,57 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using NUnit.Framework; +using osu.Framework.Extensions; +using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Extensions.ObjectExtensions; +using osu.Framework.Testing; +using osu.Game.Beatmaps; +using osu.Game.Database; +using osu.Game.Rulesets.Mania; +using osu.Game.Rulesets.Osu; +using osu.Game.Screens.Edit; +using osu.Game.Screens.Edit.Components.Timelines.Summary; +using osu.Game.Screens.Edit.GameplayTest; +using osu.Game.Screens.Select; +using osu.Game.Tests.Resources; +using osuTK.Input; + +namespace osu.Game.Tests.Visual.Editing +{ + public class TestSceneEditorNavigation : OsuGameTestScene + { + [Test] + public void TestEditorGameplayTestAlwaysUsesOriginalRuleset() + { + BeatmapSetInfo beatmapSet = null!; + + AddStep("import test beatmap", () => Game.BeatmapManager.Import(TestResources.GetTestBeatmapForImport()).WaitSafely()); + AddStep("retrieve beatmap", () => beatmapSet = Game.BeatmapManager.QueryBeatmapSet(set => !set.Protected).AsNonNull().Value.Detach()); + + AddStep("present beatmap", () => Game.PresentBeatmap(beatmapSet)); + AddUntilStep("wait for song select", + () => Game.Beatmap.Value.BeatmapSetInfo.Equals(beatmapSet) + && Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect + && songSelect.IsLoaded); + AddStep("switch ruleset", () => Game.Ruleset.Value = new ManiaRuleset().RulesetInfo); + + AddStep("open editor", () => ((PlaySongSelect)Game.ScreenStack.CurrentScreen).Edit(beatmapSet.Beatmaps.First(beatmap => beatmap.Ruleset.OnlineID == 0))); + AddUntilStep("wait for editor open", () => Game.ScreenStack.CurrentScreen is Editor editor && editor.IsLoaded); + AddStep("test gameplay", () => + { + var testGameplayButton = this.ChildrenOfType().Single(); + InputManager.MoveMouseTo(testGameplayButton); + InputManager.Click(MouseButton.Left); + }); + + AddUntilStep("wait for player", () => Game.ScreenStack.CurrentScreen is EditorPlayer editorPlayer && editorPlayer.IsLoaded); + AddAssert("current ruleset is osu!", () => Game.Ruleset.Value.Equals(new OsuRuleset().RulesetInfo)); + + AddStep("exit to song select", () => Game.PerformFromScreen(_ => { }, typeof(PlaySongSelect).Yield())); + AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect); + AddAssert("previous ruleset restored", () => Game.Ruleset.Value.Equals(new ManiaRuleset().RulesetInfo)); + } + } +} From 93b3ede2a05f06a3b37ab9ce72249c1a232e0f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 19 Jun 2022 19:30:34 +0200 Subject: [PATCH 1756/2328] Always use beatmap ruleset in editor gameplay test mode Fixes cases where opening a convertible beatmap (so any osu! beatmap) with the game-global ruleset being set to anything but osu! would result in opening the editor gameplay test mode with the game-global ruleset rather than the beatmap's. --- osu.Game/Screens/Edit/EditorLoader.cs | 1 + osu.Game/Screens/Select/SongSelect.cs | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/EditorLoader.cs b/osu.Game/Screens/Edit/EditorLoader.cs index 702e22a272..4450367522 100644 --- a/osu.Game/Screens/Edit/EditorLoader.cs +++ b/osu.Game/Screens/Edit/EditorLoader.cs @@ -65,6 +65,7 @@ namespace osu.Game.Screens.Edit base.LoadComplete(); // will be restored via lease, see `DisallowExternalBeatmapRulesetChanges`. + Ruleset.Value = Beatmap.Value.BeatmapInfo.Ruleset; Mods.Value = Array.Empty(); } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index a17e7823a6..41fb55a856 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -786,7 +786,17 @@ namespace osu.Game.Screens.Select Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue); - decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue; + decoupledRuleset.ValueChanged += r => + { + bool wasDisabled = Ruleset.Disabled; + + // a sub-screen may have taken a lease on this decoupled ruleset bindable, + // which would indirectly propagate to the game-global bindable via the `DisabledChanged` callback below. + // to make sure changes sync without crashes, lift the disable for a short while to sync, and then restore the old value. + Ruleset.Disabled = false; + Ruleset.Value = r.NewValue; + Ruleset.Disabled = wasDisabled; + }; decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r; Beatmap.BindValueChanged(workingBeatmapChanged); From 3ab8158b923d5ae8581c39d9b67b93a804de65b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 19 Jun 2022 20:08:39 +0200 Subject: [PATCH 1757/2328] Do not try to set ruleset from beatmap if it's a dummy --- osu.Game/Screens/Edit/EditorLoader.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/EditorLoader.cs b/osu.Game/Screens/Edit/EditorLoader.cs index 4450367522..d6af990b52 100644 --- a/osu.Game/Screens/Edit/EditorLoader.cs +++ b/osu.Game/Screens/Edit/EditorLoader.cs @@ -65,7 +65,8 @@ namespace osu.Game.Screens.Edit base.LoadComplete(); // will be restored via lease, see `DisallowExternalBeatmapRulesetChanges`. - Ruleset.Value = Beatmap.Value.BeatmapInfo.Ruleset; + if (!(Beatmap.Value is DummyWorkingBeatmap)) + Ruleset.Value = Beatmap.Value.BeatmapInfo.Ruleset; Mods.Value = Array.Empty(); } From 36df1da57fda5cbfc8c44d97f24c7d4f0d7346f3 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Sun, 19 Jun 2022 14:26:02 -0400 Subject: [PATCH 1758/2328] Revert "stop component transform when skineditor is hidden" This reverts commit 48ffd6aeb5c131a120a9c82e889348ebf3d21dfb. --- .../Skinning/Editor/SkinSelectionHandler.cs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs index 2496d7c657..2e2122f7c2 100644 --- a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs +++ b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs @@ -11,7 +11,6 @@ using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Graphics.Containers; using osu.Framework.Utils; using osu.Game.Extensions; using osu.Game.Graphics.UserInterface; @@ -26,17 +25,8 @@ namespace osu.Game.Skinning.Editor [Resolved] private SkinEditor skinEditor { get; set; } - /// - /// Whether the 's state allows selected blueprints to undergo transformations. - /// Used to prevent operations from being performed on unloaded blueprints. - /// - private bool allowHandling => skinEditor.State.Value == Visibility.Visible; - public override bool HandleRotation(float angle) { - if (!allowHandling) - return false; - if (SelectedBlueprints.Count == 1) { // for single items, rotate around the origin rather than the selection centre. @@ -63,9 +53,6 @@ namespace osu.Game.Skinning.Editor public override bool HandleScale(Vector2 scale, Anchor anchor) { - if (!allowHandling) - return false; - // convert scale to screen space scale = ToScreenSpace(scale) - ToScreenSpace(Vector2.Zero); @@ -143,9 +130,6 @@ namespace osu.Game.Skinning.Editor public override bool HandleFlip(Direction direction, bool flipOverOrigin) { - if (!allowHandling) - return false; - var selectionQuad = getSelectionQuad(); Vector2 scaleFactor = direction == Direction.Horizontal ? new Vector2(-1, 1) : new Vector2(1, -1); @@ -166,9 +150,6 @@ namespace osu.Game.Skinning.Editor public override bool HandleMovement(MoveSelectionEvent moveEvent) { - if (!allowHandling) - return false; - foreach (var c in SelectedBlueprints) { var item = c.Item; From a5bc769243f3b0554805fa57855704a8da3b0ac1 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Sun, 19 Jun 2022 14:34:52 -0400 Subject: [PATCH 1759/2328] clear skineditor selected components on hide --- osu.Game/Skinning/Editor/SkinEditor.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index f41cd63f2d..7e9f1d0e8e 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -322,6 +322,12 @@ namespace osu.Game.Skinning.Editor protected override bool OnMouseDown(MouseDownEvent e) => true; + public override void Hide() + { + base.Hide(); + SelectedComponents.Clear(); + } + protected override void PopIn() { this From 2b0e82be4004c8c2ca894f1a6666de9adf754296 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Sun, 19 Jun 2022 14:35:05 -0400 Subject: [PATCH 1760/2328] add test coverage --- .../TestSceneSkinEditorNavigation.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs index 78ab7947a7..843d61ca3b 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs @@ -88,6 +88,31 @@ namespace osu.Game.Tests.Visual.Navigation AddAssert("value is less than default", () => hitErrorMeter.JudgementLineThickness.Value < hitErrorMeter.JudgementLineThickness.Default); } + [Test] + public void TestComponentsDeselectedOnSkinEditorHide() + { + advanceToSongSelect(); + openSkinEditor(); + switchToGameplayScene(); + AddStep("select all components", () => + { + InputManager.PressKey(Key.ControlLeft); + InputManager.Key(Key.A); + InputManager.ReleaseKey(Key.ControlLeft); + }); + + AddStep("toggle skin editor", () => + { + InputManager.PressKey(Key.ControlLeft); + InputManager.PressKey(Key.ShiftLeft); + InputManager.Key(Key.S); + InputManager.ReleaseKey(Key.ControlLeft); + InputManager.ReleaseKey(Key.ShiftLeft); + }); + + AddUntilStep("no components selected", () => skinEditor.SelectedComponents.Count == 0); + } + [Test] public void TestAutoplayCompatibleModsRetainedOnEnteringGameplay() { From 26b0815fc862557d4740c79e8fd967643f548a0c Mon Sep 17 00:00:00 2001 From: emu1337 Date: Mon, 20 Jun 2022 04:19:07 +0200 Subject: [PATCH 1761/2328] fixed casting the wrong skill --- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 97899d2db9..fab3fa8425 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier; double aimRatingNoSliders = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier; double speedRating = Math.Sqrt(skills[2].DifficultyValue()) * difficulty_multiplier; - double speedNotes = (skills[1] as Speed).RelevantNoteCount(); + double speedNotes = (skills[2] as Speed).RelevantNoteCount(); double flashlightRating = Math.Sqrt(skills[3].DifficultyValue()) * difficulty_multiplier; double sliderFactor = aimRating > 0 ? aimRatingNoSliders / aimRating : 1; From 5e594e4de0c714ae6855fbf843245c30b40c0ee5 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 20 Jun 2022 06:54:15 +0300 Subject: [PATCH 1762/2328] Work around macOS agent regression affecting iOS CI builds --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef729a779f..c728d89ed1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,6 +126,12 @@ jobs: with: dotnet-version: "6.0.x" + # macOS agents recently have empty NuGet config files, resulting in restore failures, + # see https://github.com/actions/virtual-environments/issues/5768 + # Add the global nuget package source manually for now. + - name: Setup NuGet.Config + run: echo '' > ~/.config/NuGet/NuGet.Config + # Contrary to seemingly any other msbuild, msbuild running on macOS/Mono # cannot accept .sln(f) files as arguments. # Build just the main game for now. From 243806e810de9304e914c9d1c63d1732cafbe15e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 13:29:43 +0900 Subject: [PATCH 1763/2328] Move common step of toggling skin editor to own method --- .../TestSceneSkinEditorNavigation.cs | 78 +++++++++++-------- 1 file changed, 47 insertions(+), 31 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs index 843d61ca3b..7185e5ce49 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs @@ -26,29 +26,6 @@ namespace osu.Game.Tests.Visual.Navigation private TestPlaySongSelect songSelect; private SkinEditor skinEditor => Game.ChildrenOfType().FirstOrDefault(); - private void advanceToSongSelect() - { - PushAndConfirm(() => songSelect = new TestPlaySongSelect()); - AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded); - - AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely()); - - AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault); - } - - private void openSkinEditor() - { - AddStep("open skin editor", () => - { - InputManager.PressKey(Key.ControlLeft); - InputManager.PressKey(Key.ShiftLeft); - InputManager.Key(Key.S); - InputManager.ReleaseKey(Key.ControlLeft); - InputManager.ReleaseKey(Key.ShiftLeft); - }); - AddUntilStep("skin editor loaded", () => skinEditor != null); - } - [Test] public void TestEditComponentDuringGameplay() { @@ -88,6 +65,24 @@ namespace osu.Game.Tests.Visual.Navigation AddAssert("value is less than default", () => hitErrorMeter.JudgementLineThickness.Value < hitErrorMeter.JudgementLineThickness.Default); } + [Test] + public void TestHideSkinEditorWhileDragging() + { + advanceToSongSelect(); + openSkinEditor(); + switchToGameplayScene(); + AddStep("select all components", () => + { + InputManager.PressKey(Key.ControlLeft); + InputManager.Key(Key.A); + InputManager.ReleaseKey(Key.ControlLeft); + }); + + toggleSkinEditor(); + + AddUntilStep("no components selected", () => skinEditor.SelectedComponents.Count == 0); + } + [Test] public void TestComponentsDeselectedOnSkinEditorHide() { @@ -101,14 +96,7 @@ namespace osu.Game.Tests.Visual.Navigation InputManager.ReleaseKey(Key.ControlLeft); }); - AddStep("toggle skin editor", () => - { - InputManager.PressKey(Key.ControlLeft); - InputManager.PressKey(Key.ShiftLeft); - InputManager.Key(Key.S); - InputManager.ReleaseKey(Key.ControlLeft); - InputManager.ReleaseKey(Key.ShiftLeft); - }); + toggleSkinEditor(); AddUntilStep("no components selected", () => skinEditor.SelectedComponents.Count == 0); } @@ -171,6 +159,34 @@ namespace osu.Game.Tests.Visual.Navigation AddUntilStep("mod overlay closed", () => songSelect.ModSelectOverlay.State.Value == Visibility.Hidden); } + private void advanceToSongSelect() + { + PushAndConfirm(() => songSelect = new TestPlaySongSelect()); + AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded); + + AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely()); + + AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault); + } + + private void openSkinEditor() + { + toggleSkinEditor(); + AddUntilStep("skin editor loaded", () => skinEditor != null); + } + + private void toggleSkinEditor() + { + AddStep("toggle skin editor", () => + { + InputManager.PressKey(Key.ControlLeft); + InputManager.PressKey(Key.ShiftLeft); + InputManager.Key(Key.S); + InputManager.ReleaseKey(Key.ControlLeft); + InputManager.ReleaseKey(Key.ShiftLeft); + }); + } + private void switchToGameplayScene() { AddStep("Click gameplay scene button", () => skinEditor.ChildrenOfType().First(b => b.Text == "Gameplay").TriggerClick()); From 329f1a08222c6ac9017025f484c771bc1c45d7aa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 13:45:50 +0900 Subject: [PATCH 1764/2328] Add test coverage of original fail case and improve test reliability and code quality --- .../TestSceneSkinEditorNavigation.cs | 47 +++++++++++++++---- .../Skinning/Editor/SkinComponentToolbox.cs | 2 +- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs index 7185e5ce49..0c99cf15eb 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs @@ -8,7 +8,9 @@ using NUnit.Framework; using osu.Framework.Extensions; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Screens; using osu.Framework.Testing; +using osu.Framework.Threading; using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Mods; @@ -16,6 +18,7 @@ using osu.Game.Screens.Play; using osu.Game.Screens.Play.HUD.HitErrorMeters; using osu.Game.Skinning.Editor; using osu.Game.Tests.Beatmaps.IO; +using osuTK; using osuTK.Input; using static osu.Game.Tests.Visual.Navigation.TestSceneScreenNavigation; @@ -66,11 +69,14 @@ namespace osu.Game.Tests.Visual.Navigation } [Test] - public void TestHideSkinEditorWhileDragging() + public void TestComponentsDeselectedOnSkinEditorHide() { advanceToSongSelect(); openSkinEditor(); switchToGameplayScene(); + + AddUntilStep("wait for components", () => skinEditor.ChildrenOfType().Any()); + AddStep("select all components", () => { InputManager.PressKey(Key.ControlLeft); @@ -78,27 +84,50 @@ namespace osu.Game.Tests.Visual.Navigation InputManager.ReleaseKey(Key.ControlLeft); }); + AddUntilStep("components selected", () => skinEditor.SelectedComponents.Count > 0); + toggleSkinEditor(); AddUntilStep("no components selected", () => skinEditor.SelectedComponents.Count == 0); } [Test] - public void TestComponentsDeselectedOnSkinEditorHide() + public void TestSwitchScreenWhileDraggingComponent() { + Vector2 firstBlueprintCentre = Vector2.Zero; + ScheduledDelegate movementDelegate = null; + advanceToSongSelect(); + openSkinEditor(); - switchToGameplayScene(); - AddStep("select all components", () => + + AddStep("add skinnable component", () => { - InputManager.PressKey(Key.ControlLeft); - InputManager.Key(Key.A); - InputManager.ReleaseKey(Key.ControlLeft); + skinEditor.ChildrenOfType().First().TriggerClick(); }); - toggleSkinEditor(); + AddUntilStep("newly added component selected", () => skinEditor.SelectedComponents.Count == 1); - AddUntilStep("no components selected", () => skinEditor.SelectedComponents.Count == 0); + AddStep("start drag", () => + { + firstBlueprintCentre = skinEditor.ChildrenOfType().First().ScreenSpaceDrawQuad.Centre; + + InputManager.MoveMouseTo(firstBlueprintCentre); + InputManager.PressButton(MouseButton.Left); + }); + + AddStep("start movement", () => movementDelegate = Scheduler.AddDelayed(() => { InputManager.MoveMouseTo(firstBlueprintCentre += new Vector2(1)); }, 10, true)); + + toggleSkinEditor(); + AddStep("exit song select", () => songSelect.Exit()); + + AddUntilStep("wait for blueprints removed", () => !skinEditor.ChildrenOfType().Any()); + + AddStep("stop drag", () => + { + InputManager.ReleaseButton(MouseButton.Left); + movementDelegate?.Cancel(); + }); } [Test] diff --git a/osu.Game/Skinning/Editor/SkinComponentToolbox.cs b/osu.Game/Skinning/Editor/SkinComponentToolbox.cs index 7de9cd5108..344a659627 100644 --- a/osu.Game/Skinning/Editor/SkinComponentToolbox.cs +++ b/osu.Game/Skinning/Editor/SkinComponentToolbox.cs @@ -88,7 +88,7 @@ namespace osu.Game.Skinning.Editor } } - private class ToolboxComponentButton : OsuButton + public class ToolboxComponentButton : OsuButton { protected override bool ShouldBeConsideredForInput(Drawable child) => false; From e4d0c7a0fb179ec5f8c56e1885811de7ec8525ce Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 13:59:20 +0900 Subject: [PATCH 1765/2328] Move beatmap import step to only be required when entering gameplay --- .../Visual/Navigation/TestSceneSkinEditorNavigation.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs index 0c99cf15eb..cc76e530c8 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs @@ -192,10 +192,6 @@ namespace osu.Game.Tests.Visual.Navigation { PushAndConfirm(() => songSelect = new TestPlaySongSelect()); AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded); - - AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely()); - - AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault); } private void openSkinEditor() @@ -218,6 +214,9 @@ namespace osu.Game.Tests.Visual.Navigation private void switchToGameplayScene() { + AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely()); + AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault); + AddStep("Click gameplay scene button", () => skinEditor.ChildrenOfType().First(b => b.Text == "Gameplay").TriggerClick()); AddUntilStep("wait for player", () => From a6c8a832aaf9d9fd4cda147eef6850d1daa8ff37 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 15:14:57 +0900 Subject: [PATCH 1766/2328] Remove `Import(ArchiveReader)` and redirect existing usages to `Import(ImportTask)` --- .../Database/BeatmapImporterTests.cs | 27 +++------- osu.Game.Tests/Skins/IO/ImportSkinTest.cs | 53 +++++++++---------- .../Skins/TestSceneBeatmapSkinResources.cs | 4 +- .../Skins/TestSceneSkinResources.cs | 4 +- osu.Game/Beatmaps/BeatmapManager.cs | 3 -- .../Database/RealmArchiveModelImporter.cs | 4 +- osu.Game/Screens/Menu/IntroScreen.cs | 3 +- osu.Game/Skinning/SkinManager.cs | 4 -- 8 files changed, 39 insertions(+), 63 deletions(-) diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index f9cd75d8c3..841622f0db 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -15,7 +15,6 @@ using osu.Framework.Logging; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Extensions; -using osu.Game.IO.Archives; using osu.Game.Models; using osu.Game.Overlays.Notifications; using osu.Game.Rulesets; @@ -39,10 +38,7 @@ namespace osu.Game.Tests.Database using (var importer = new BeatmapImporter(storage, realm)) using (new RealmRulesetStore(realm, storage)) { - Live? beatmapSet; - - using (var reader = new ZipArchiveReader(TestResources.GetTestBeatmapStream())) - beatmapSet = await importer.Import(reader); + var beatmapSet = await importer.Import(new ImportTask(TestResources.GetTestBeatmapStream(), "renatus.osz")); Assert.NotNull(beatmapSet); Debug.Assert(beatmapSet != null); @@ -83,10 +79,7 @@ namespace osu.Game.Tests.Database using (var importer = new BeatmapImporter(storage, realm)) using (new RealmRulesetStore(realm, storage)) { - Live? beatmapSet; - - using (var reader = new ZipArchiveReader(TestResources.GetTestBeatmapStream())) - beatmapSet = await importer.Import(reader); + var beatmapSet = await importer.Import(new ImportTask(TestResources.GetTestBeatmapStream(), "renatus.osz")); Assert.NotNull(beatmapSet); Debug.Assert(beatmapSet != null); @@ -146,11 +139,8 @@ namespace osu.Game.Tests.Database { Task.Run(async () => { - Live? beatmapSet; - - using (var reader = new ZipArchiveReader(TestResources.GetTestBeatmapStream())) - // ReSharper disable once AccessToDisposedClosure - beatmapSet = await importer.Import(reader); + // ReSharper disable once AccessToDisposedClosure + var beatmapSet = await importer.Import(new ImportTask(TestResources.GetTestBeatmapStream(), "renatus.osz")); Assert.NotNull(beatmapSet); Debug.Assert(beatmapSet != null); @@ -173,13 +163,8 @@ namespace osu.Game.Tests.Database using (var importer = new BeatmapImporter(storage, realm)) using (new RealmRulesetStore(realm, storage)) { - Live? imported; - - using (var reader = new ZipArchiveReader(TestResources.GetTestBeatmapStream())) - { - imported = await importer.Import(reader); - EnsureLoaded(realm.Realm); - } + var imported = await importer.Import(new ImportTask(TestResources.GetTestBeatmapStream(), "renatus.osz")); + EnsureLoaded(realm.Realm); Assert.AreEqual(1, realm.Realm.All().Count()); diff --git a/osu.Game.Tests/Skins/IO/ImportSkinTest.cs b/osu.Game.Tests/Skins/IO/ImportSkinTest.cs index 4db88cbe82..f3adb85006 100644 --- a/osu.Game.Tests/Skins/IO/ImportSkinTest.cs +++ b/osu.Game.Tests/Skins/IO/ImportSkinTest.cs @@ -15,7 +15,6 @@ using osu.Framework.Platform; using osu.Game.Database; using osu.Game.Extensions; using osu.Game.IO; -using osu.Game.IO.Archives; using osu.Game.Skinning; using SharpCompress.Archives.Zip; @@ -28,7 +27,7 @@ namespace osu.Game.Tests.Skins.IO [Test] public Task TestSingleImportDifferentFilename() => runSkinTest(async osu => { - var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("test skin", "skinner"), "skin.osk")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("test skin", "skinner"), "skin.osk")); // When the import filename doesn't match, it should be appended (and update the skin.ini). assertCorrectMetadata(import1, "test skin [skin]", "skinner", osu); @@ -37,7 +36,7 @@ namespace osu.Game.Tests.Skins.IO [Test] public Task TestSingleImportWeirdIniFileCase() => runSkinTest(async osu => { - var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("test skin", "skinner", iniFilename: "Skin.InI"), "skin.osk")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("test skin", "skinner", iniFilename: "Skin.InI"), "skin.osk")); // When the import filename doesn't match, it should be appended (and update the skin.ini). assertCorrectMetadata(import1, "test skin [skin]", "skinner", osu); @@ -46,7 +45,7 @@ namespace osu.Game.Tests.Skins.IO [Test] public Task TestSingleImportMissingSectionHeader() => runSkinTest(async osu => { - var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("test skin", "skinner", includeSectionHeader: false), "skin.osk")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("test skin", "skinner", includeSectionHeader: false), "skin.osk")); // When the import filename doesn't match, it should be appended (and update the skin.ini). assertCorrectMetadata(import1, "test skin [skin]", "skinner", osu); @@ -55,7 +54,7 @@ namespace osu.Game.Tests.Skins.IO [Test] public Task TestSingleImportMatchingFilename() => runSkinTest(async osu => { - var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("test skin", "skinner"), "test skin.osk")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("test skin", "skinner"), "test skin.osk")); // When the import filename matches it shouldn't be appended. assertCorrectMetadata(import1, "test skin", "skinner", osu); @@ -64,7 +63,7 @@ namespace osu.Game.Tests.Skins.IO [Test] public Task TestSingleImportNoIniFile() => runSkinTest(async osu => { - var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithNonIniFile(), "test skin.osk")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithNonIniFile(), "test skin.osk")); // When the import filename matches it shouldn't be appended. assertCorrectMetadata(import1, "test skin", "Unknown", osu); @@ -73,7 +72,7 @@ namespace osu.Game.Tests.Skins.IO [Test] public Task TestEmptyImportImportsWithFilename() => runSkinTest(async osu => { - var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createEmptyOsk(), "test skin.osk")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createEmptyOsk(), "test skin.osk")); // When the import filename matches it shouldn't be appended. assertCorrectMetadata(import1, "test skin", "Unknown", osu); @@ -86,8 +85,8 @@ namespace osu.Game.Tests.Skins.IO [Test] public Task TestImportTwiceWithSameMetadataAndFilename() => runSkinTest(async osu => { - var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("test skin", "skinner"), "skin.osk")); - var import2 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("test skin", "skinner"), "skin.osk")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("test skin", "skinner"), "skin.osk")); + var import2 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("test skin", "skinner"), "skin.osk")); assertImportedOnce(import1, import2); }); @@ -96,8 +95,8 @@ namespace osu.Game.Tests.Skins.IO public Task TestImportTwiceWithNoMetadataSameDownloadFilename() => runSkinTest(async osu => { // if a user downloads two skins that do have skin.ini files but don't have any creator metadata in the skin.ini, they should both import separately just for safety. - var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni(string.Empty, string.Empty), "download.osk")); - var import2 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni(string.Empty, string.Empty), "download.osk")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni(string.Empty, string.Empty), "download.osk")); + var import2 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni(string.Empty, string.Empty), "download.osk")); assertImportedOnce(import1, import2); }); @@ -105,10 +104,10 @@ namespace osu.Game.Tests.Skins.IO [Test] public Task TestImportUpperCasedOskArchive() => runSkinTest(async osu => { - var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("name 1", "author 1"), "name 1.OsK")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("name 1", "author 1"), "name 1.OsK")); assertCorrectMetadata(import1, "name 1", "author 1", osu); - var import2 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("name 1", "author 1"), "name 1.oSK")); + var import2 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("name 1", "author 1"), "name 1.oSK")); assertImportedOnce(import1, import2); }); @@ -118,7 +117,7 @@ namespace osu.Game.Tests.Skins.IO { MemoryStream exportStream = new MemoryStream(); - var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("name 1", "author 1"), "custom.osk")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("name 1", "author 1"), "custom.osk")); assertCorrectMetadata(import1, "name 1 [custom]", "author 1", osu); import1.PerformRead(s => @@ -128,7 +127,7 @@ namespace osu.Game.Tests.Skins.IO string exportFilename = import1.GetDisplayString(); - var import2 = await loadSkinIntoOsu(osu, new ZipArchiveReader(exportStream, $"{exportFilename}.osk")); + var import2 = await loadSkinIntoOsu(osu, new ImportTask(exportStream, $"{exportFilename}.osk")); assertCorrectMetadata(import2, "name 1 [custom]", "author 1", osu); assertImportedOnce(import1, import2); @@ -137,8 +136,8 @@ namespace osu.Game.Tests.Skins.IO [Test] public Task TestSameMetadataNameSameFolderName() => runSkinTest(async osu => { - var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("name 1", "author 1"), "my custom skin 1")); - var import2 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("name 1", "author 1"), "my custom skin 1")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("name 1", "author 1"), "my custom skin 1")); + var import2 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("name 1", "author 1"), "my custom skin 1")); assertImportedOnce(import1, import2); assertCorrectMetadata(import1, "name 1 [my custom skin 1]", "author 1", osu); @@ -151,8 +150,8 @@ namespace osu.Game.Tests.Skins.IO [Test] public Task TestImportTwiceWithSameMetadataButDifferentFilename() => runSkinTest(async osu => { - var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("test skin", "skinner"), "skin.osk")); - var import2 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("test skin", "skinner"), "skin2.osk")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("test skin", "skinner"), "skin.osk")); + var import2 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("test skin", "skinner"), "skin2.osk")); assertImportedBoth(import1, import2); }); @@ -161,8 +160,8 @@ namespace osu.Game.Tests.Skins.IO public Task TestImportTwiceWithNoMetadataDifferentDownloadFilename() => runSkinTest(async osu => { // if a user downloads two skins that do have skin.ini files but don't have any creator metadata in the skin.ini, they should both import separately just for safety. - var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni(string.Empty, string.Empty), "download.osk")); - var import2 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni(string.Empty, string.Empty), "download2.osk")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni(string.Empty, string.Empty), "download.osk")); + var import2 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni(string.Empty, string.Empty), "download2.osk")); assertImportedBoth(import1, import2); }); @@ -170,8 +169,8 @@ namespace osu.Game.Tests.Skins.IO [Test] public Task TestImportTwiceWithSameFilenameDifferentMetadata() => runSkinTest(async osu => { - var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("test skin v2", "skinner"), "skin.osk")); - var import2 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("test skin v2.1", "skinner"), "skin.osk")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("test skin v2", "skinner"), "skin.osk")); + var import2 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("test skin v2.1", "skinner"), "skin.osk")); assertImportedBoth(import1, import2); assertCorrectMetadata(import1, "test skin v2 [skin]", "skinner", osu); @@ -181,8 +180,8 @@ namespace osu.Game.Tests.Skins.IO [Test] public Task TestSameMetadataNameDifferentFolderName() => runSkinTest(async osu => { - var import1 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("name 1", "author 1"), "my custom skin 1")); - var import2 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOskWithIni("name 1", "author 1"), "my custom skin 2")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("name 1", "author 1"), "my custom skin 1")); + var import2 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("name 1", "author 1"), "my custom skin 2")); assertImportedBoth(import1, import2); assertCorrectMetadata(import1, "name 1 [my custom skin 1]", "author 1", osu); @@ -358,10 +357,10 @@ namespace osu.Game.Tests.Skins.IO } } - private async Task> loadSkinIntoOsu(OsuGameBase osu, ArchiveReader archive = null) + private async Task> loadSkinIntoOsu(OsuGameBase osu, ImportTask import = null) { var skinManager = osu.Dependencies.Get(); - return await skinManager.Import(archive); + return await skinManager.Import(import); } } } diff --git a/osu.Game.Tests/Skins/TestSceneBeatmapSkinResources.cs b/osu.Game.Tests/Skins/TestSceneBeatmapSkinResources.cs index bd7e1f8ec5..f4cea2c8cc 100644 --- a/osu.Game.Tests/Skins/TestSceneBeatmapSkinResources.cs +++ b/osu.Game.Tests/Skins/TestSceneBeatmapSkinResources.cs @@ -10,7 +10,7 @@ using osu.Framework.Extensions; using osu.Framework.Testing; using osu.Game.Audio; using osu.Game.Beatmaps; -using osu.Game.IO.Archives; +using osu.Game.Database; using osu.Game.Tests.Resources; using osu.Game.Tests.Visual; @@ -27,7 +27,7 @@ namespace osu.Game.Tests.Skins [BackgroundDependencyLoader] private void load() { - var imported = beatmaps.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-beatmap.osz"))).GetResultSafely(); + var imported = beatmaps.Import(new ImportTask(TestResources.OpenResource("Archives/ogg-beatmap.osz"), "ogg-beatmap.osz")).GetResultSafely(); imported?.PerformRead(s => { diff --git a/osu.Game.Tests/Skins/TestSceneSkinResources.cs b/osu.Game.Tests/Skins/TestSceneSkinResources.cs index 97588f4053..42c1eeb6d1 100644 --- a/osu.Game.Tests/Skins/TestSceneSkinResources.cs +++ b/osu.Game.Tests/Skins/TestSceneSkinResources.cs @@ -8,7 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Testing; using osu.Game.Audio; -using osu.Game.IO.Archives; +using osu.Game.Database; using osu.Game.Skinning; using osu.Game.Tests.Resources; using osu.Game.Tests.Visual; @@ -26,7 +26,7 @@ namespace osu.Game.Tests.Skins [BackgroundDependencyLoader] private void load() { - var imported = skins.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-skin.osk"))).GetResultSafely(); + var imported = skins.Import(new ImportTask(TestResources.OpenResource("Archives/ogg-skin.osk"), "ogg-skin.osk")).GetResultSafely(); skin = imported.PerformRead(skinInfo => skins.GetSkin(skinInfo)); } diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 1dd3f82426..91e1744258 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -409,9 +409,6 @@ namespace osu.Game.Beatmaps public Task?> Import(ImportTask task, bool batchImport = false, CancellationToken cancellationToken = default) => beatmapImporter.Import(task, batchImport, cancellationToken); - public Task?> Import(ArchiveReader archive, bool batchImport = false, CancellationToken cancellationToken = default) => - beatmapImporter.Import(archive, batchImport, cancellationToken); - public Live? Import(BeatmapSetInfo item, ArchiveReader? archive = null, CancellationToken cancellationToken = default) => beatmapImporter.Import(item, archive, false, cancellationToken); diff --git a/osu.Game/Database/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs index c5e04a8a0f..84decdb3ef 100644 --- a/osu.Game/Database/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -188,7 +188,7 @@ namespace osu.Game.Database Live? import; using (ArchiveReader reader = task.GetReader()) - import = await Import(reader, batchImport, cancellationToken).ConfigureAwait(false); + import = await importFromArchive(reader, batchImport, cancellationToken).ConfigureAwait(false); // We may or may not want to delete the file depending on where it is stored. // e.g. reconstructing/repairing database with items from default storage. @@ -213,7 +213,7 @@ namespace osu.Game.Database /// The archive to be imported. /// Whether this import is part of a larger batch. /// An optional cancellation token. - public async Task?> Import(ArchiveReader archive, bool batchImport = false, CancellationToken cancellationToken = default) + private async Task?> importFromArchive(ArchiveReader archive, bool batchImport = false, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs index 766b5bf2a4..c81195bbd3 100644 --- a/osu.Game/Screens/Menu/IntroScreen.cs +++ b/osu.Game/Screens/Menu/IntroScreen.cs @@ -19,7 +19,6 @@ using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Database; -using osu.Game.IO.Archives; using osu.Game.Online.API; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; @@ -141,7 +140,7 @@ namespace osu.Game.Screens.Menu { // if we detect that the theme track or beatmap is unavailable this is either first startup or things are in a bad state. // this could happen if a user has nuked their files store. for now, reimport to repair this. - var import = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream($"Tracks/{BeatmapFile}"), BeatmapFile)).GetResultSafely(); + var import = beatmaps.Import(new ImportTask(game.Resources.GetStream($"Tracks/{BeatmapFile}"), BeatmapFile)).GetResultSafely(); import?.PerformWrite(b => b.Protected = true); diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index be6528db3f..16a0d84263 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -24,7 +24,6 @@ using osu.Framework.Utils; using osu.Game.Audio; using osu.Game.Database; using osu.Game.IO; -using osu.Game.IO.Archives; using osu.Game.Overlays.Notifications; using osu.Game.Utils; @@ -275,9 +274,6 @@ namespace osu.Game.Skinning public Task> Import(ImportTask task, bool batchImport = false, CancellationToken cancellationToken = default) => skinImporter.Import(task, batchImport, cancellationToken); - public Task> Import(ArchiveReader archive, bool batchImport = false, CancellationToken cancellationToken = default) => - skinImporter.Import(archive, batchImport, cancellationToken); - #endregion public void Delete([CanBeNull] Expression> filter = null, bool silent = false) From 92f1a2958c1645dff914fc3f2b0e2a59d803da77 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 15:18:07 +0900 Subject: [PATCH 1767/2328] Rename `Import(TModel)` to `ImportModel` to differentiate from other import methods --- osu.Game.Tests/Database/BeatmapImporterTests.cs | 2 +- .../Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs | 4 ++-- osu.Game/Beatmaps/BeatmapManager.cs | 4 ++-- osu.Game/Database/RealmArchiveModelImporter.cs | 4 ++-- osu.Game/Scoring/ScoreManager.cs | 2 +- osu.Game/Skinning/SkinManager.cs | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index 841622f0db..d8856a2ca7 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -745,7 +745,7 @@ namespace osu.Game.Tests.Database } }; - var imported = importer.Import(toImport); + var imported = importer.ImportModel(toImport); realm.Run(r => r.Refresh()); diff --git a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs index e502a71f34..1d33a895eb 100644 --- a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs +++ b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs @@ -227,10 +227,10 @@ namespace osu.Game.Tests.Online this.testBeatmapManager = testBeatmapManager; } - public override Live Import(BeatmapSetInfo item, ArchiveReader archive = null, bool batchImport = false, CancellationToken cancellationToken = default) + public override Live ImportModel(BeatmapSetInfo item, ArchiveReader archive = null, bool batchImport = false, CancellationToken cancellationToken = default) { testBeatmapManager.AllowImport.Task.WaitSafely(); - return (testBeatmapManager.CurrentImport = base.Import(item, archive, batchImport, cancellationToken)); + return (testBeatmapManager.CurrentImport = base.ImportModel(item, archive, batchImport, cancellationToken)); } } } diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 91e1744258..06a8ad5188 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -101,7 +101,7 @@ namespace osu.Game.Beatmaps foreach (BeatmapInfo b in beatmapSet.Beatmaps) b.BeatmapSet = beatmapSet; - var imported = beatmapImporter.Import(beatmapSet); + var imported = beatmapImporter.ImportModel(beatmapSet); if (imported == null) throw new InvalidOperationException("Failed to import new beatmap"); @@ -410,7 +410,7 @@ namespace osu.Game.Beatmaps beatmapImporter.Import(task, batchImport, cancellationToken); public Live? Import(BeatmapSetInfo item, ArchiveReader? archive = null, CancellationToken cancellationToken = default) => - beatmapImporter.Import(item, archive, false, cancellationToken); + beatmapImporter.ImportModel(item, archive, false, cancellationToken); public IEnumerable HandledExtensions => beatmapImporter.HandledExtensions; diff --git a/osu.Game/Database/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs index 84decdb3ef..3d61345f34 100644 --- a/osu.Game/Database/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -236,7 +236,7 @@ namespace osu.Game.Database return null; } - var scheduledImport = Task.Factory.StartNew(() => Import(model, archive, batchImport, cancellationToken), + var scheduledImport = Task.Factory.StartNew(() => ImportModel(model, archive, batchImport, cancellationToken), cancellationToken, TaskCreationOptions.HideScheduler, batchImport ? import_scheduler_batch : import_scheduler); @@ -251,7 +251,7 @@ namespace osu.Game.Database /// An optional archive to use for model population. /// If true, imports will be skipped before they begin, given an existing model matches on hash and filenames. Should generally only be used for large batch imports, as it may defy user expectations when updating an existing model. /// An optional cancellation token. - public virtual Live? Import(TModel item, ArchiveReader? archive = null, bool batchImport = false, CancellationToken cancellationToken = default) => Realm.Run(realm => + public virtual Live? ImportModel(TModel item, ArchiveReader? archive = null, bool batchImport = false, CancellationToken cancellationToken = default) => Realm.Run(realm => { cancellationToken.ThrowIfCancellationRequested(); diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 7ccf7a58b8..44aafbec74 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -265,7 +265,7 @@ namespace osu.Game.Scoring public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => scoreImporter.Import(notification, tasks); public Live Import(ScoreInfo item, ArchiveReader archive = null, bool batchImport = false, CancellationToken cancellationToken = default) => - scoreImporter.Import(item, archive, batchImport, cancellationToken); + scoreImporter.ImportModel(item, archive, batchImport, cancellationToken); #region Implementation of IPresentImports diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index 16a0d84263..38eff2f0d6 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -167,7 +167,7 @@ namespace osu.Game.Skinning Name = NamingUtils.GetNextBestName(existingSkinNames, $@"{s.Name} (modified)") }; - var result = skinImporter.Import(skinInfo); + var result = skinImporter.ImportModel(skinInfo); if (result != null) { From dd93c7359e184f1bf630dacfd9dcfaf1b6f6ff7e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 15:25:43 +0900 Subject: [PATCH 1768/2328] Update xmldoc for `importFromArchive` method --- .../Database/RealmArchiveModelImporter.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/osu.Game/Database/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs index 3d61345f34..f3174b46b8 100644 --- a/osu.Game/Database/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -208,8 +208,11 @@ namespace osu.Game.Database } /// - /// Silently import an item from an . + /// Create and import a model based off the provided . /// + /// + /// This method also handled queueing the import task on a relevant import thread pool. + /// /// The archive to be imported. /// Whether this import is part of a larger batch. /// An optional cancellation token. @@ -225,6 +228,13 @@ namespace osu.Game.Database if (model == null) return null; + + var scheduledImport = Task.Factory.StartNew(() => ImportModel(model, archive, batchImport, cancellationToken), + cancellationToken, + TaskCreationOptions.HideScheduler, + batchImport ? import_scheduler_batch : import_scheduler); + + return await scheduledImport.ConfigureAwait(false); } catch (TaskCanceledException) { @@ -235,13 +245,6 @@ namespace osu.Game.Database LogForModel(model, @$"Model creation of {archive.Name} failed.", e); return null; } - - var scheduledImport = Task.Factory.StartNew(() => ImportModel(model, archive, batchImport, cancellationToken), - cancellationToken, - TaskCreationOptions.HideScheduler, - batchImport ? import_scheduler_batch : import_scheduler); - - return await scheduledImport.ConfigureAwait(false); } /// From 03ab6fc141ea1931bf877ca55fd5aeac4162cf3a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 20 Jun 2022 14:56:04 +0900 Subject: [PATCH 1769/2328] Implement IEquatable on ControlPoint --- .../Beatmaps/ControlPoints/ControlPoint.cs | 15 ++++++++-- .../ControlPoints/ControlPointGroup.cs | 26 +++++++++++++---- .../ControlPoints/DifficultyControlPoint.cs | 15 ++++++++-- .../ControlPoints/EffectControlPoint.cs | 17 +++++++++-- .../ControlPoints/SampleControlPoint.cs | 16 +++++++++-- .../ControlPoints/TimingControlPoint.cs | 14 +++++++++- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 28 ++++++++++++++++--- 7 files changed, 109 insertions(+), 22 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs index 5f06e03509..fd06c898ab 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using Newtonsoft.Json; using osu.Game.Graphics; @@ -11,7 +9,7 @@ using osuTK.Graphics; namespace osu.Game.Beatmaps.ControlPoints { - public abstract class ControlPoint : IComparable, IDeepCloneable + public abstract class ControlPoint : IComparable, IDeepCloneable, IEquatable { /// /// The time at which the control point takes effect. @@ -48,5 +46,16 @@ namespace osu.Game.Beatmaps.ControlPoints { Time = other.Time; } + + public sealed override bool Equals(object? obj) + => obj is ControlPoint otherControlPoint + && Equals(otherControlPoint); + + public virtual bool Equals(ControlPoint? other) + => other != null + && Time == other.Time; + + // ReSharper disable once NonReadonlyMemberInGetHashCode + public override int GetHashCode() => Time.GetHashCode(); } } diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointGroup.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointGroup.cs index 9df38b01ee..db479f0e5b 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointGroup.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointGroup.cs @@ -1,18 +1,16 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Linq; using osu.Framework.Bindables; namespace osu.Game.Beatmaps.ControlPoints { - public class ControlPointGroup : IComparable + public class ControlPointGroup : IComparable, IEquatable { - public event Action ItemAdded; - public event Action ItemRemoved; + public event Action? ItemAdded; + public event Action? ItemRemoved; /// /// The time at which the control point takes effect. @@ -48,5 +46,23 @@ namespace osu.Game.Beatmaps.ControlPoints controlPoints.Remove(point); ItemRemoved?.Invoke(point); } + + public sealed override bool Equals(object? obj) + => obj is ControlPointGroup otherGroup + && Equals(otherGroup); + + public virtual bool Equals(ControlPointGroup? other) + => other != null + && Time == other.Time + && ControlPoints.SequenceEqual(other.ControlPoints); + + public override int GetHashCode() + { + HashCode hashCode = new HashCode(); + hashCode.Add(Time); + foreach (var point in controlPoints) + hashCode.Add(point); + return hashCode.ToHashCode(); + } } } diff --git a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs index 8b3d755fb6..6f624d20c9 100644 --- a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs @@ -1,8 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - +using System; using osu.Framework.Bindables; using osu.Game.Graphics; using osuTK.Graphics; @@ -12,7 +11,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// Note that going forward, this control point type should always be assigned directly to HitObjects. /// - public class DifficultyControlPoint : ControlPoint + public class DifficultyControlPoint : ControlPoint, IEquatable { public static readonly DifficultyControlPoint DEFAULT = new DifficultyControlPoint { @@ -51,5 +50,15 @@ namespace osu.Game.Beatmaps.ControlPoints base.CopyFrom(other); } + + public override bool Equals(ControlPoint? other) + => other is DifficultyControlPoint otherDifficultyControlPoint + && Equals(otherDifficultyControlPoint); + + public bool Equals(DifficultyControlPoint? other) + => base.Equals(other) + && SliderVelocity == other.SliderVelocity; + + public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), SliderVelocity); } } diff --git a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs index 35425972da..365d024035 100644 --- a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs @@ -1,15 +1,14 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - +using System; using osu.Framework.Bindables; using osu.Game.Graphics; using osuTK.Graphics; namespace osu.Game.Beatmaps.ControlPoints { - public class EffectControlPoint : ControlPoint + public class EffectControlPoint : ControlPoint, IEquatable { public static readonly EffectControlPoint DEFAULT = new EffectControlPoint { @@ -83,5 +82,17 @@ namespace osu.Game.Beatmaps.ControlPoints base.CopyFrom(other); } + + public override bool Equals(ControlPoint? other) + => other is EffectControlPoint otherEffectControlPoint + && Equals(otherEffectControlPoint); + + public bool Equals(EffectControlPoint? other) + => base.Equals(other) + && OmitFirstBarLine == other.OmitFirstBarLine + && ScrollSpeed == other.ScrollSpeed + && KiaiMode == other.KiaiMode; + + public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), OmitFirstBarLine, ScrollSpeed, KiaiMode); } } diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index bed499ef3f..ab575dfeda 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -1,8 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - +using System; using osu.Framework.Bindables; using osu.Game.Audio; using osu.Game.Graphics; @@ -13,7 +12,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// Note that going forward, this control point type should always be assigned directly to HitObjects. /// - public class SampleControlPoint : ControlPoint + public class SampleControlPoint : ControlPoint, IEquatable { public const string DEFAULT_BANK = "normal"; @@ -85,5 +84,16 @@ namespace osu.Game.Beatmaps.ControlPoints base.CopyFrom(other); } + + public override bool Equals(ControlPoint? other) + => other is SampleControlPoint otherSampleControlPoint + && Equals(otherSampleControlPoint); + + public bool Equals(SampleControlPoint? other) + => base.Equals(other) + && SampleBank == other.SampleBank + && SampleVolume == other.SampleVolume; + + public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), SampleBank, SampleVolume); } } diff --git a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs index 922439fcb8..87ef4e86d5 100644 --- a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Bindables; using osu.Game.Beatmaps.Timing; using osu.Game.Graphics; @@ -8,7 +9,7 @@ using osuTK.Graphics; namespace osu.Game.Beatmaps.ControlPoints { - public class TimingControlPoint : ControlPoint + public class TimingControlPoint : ControlPoint, IEquatable { /// /// The time signature at this control point. @@ -77,5 +78,16 @@ namespace osu.Game.Beatmaps.ControlPoints base.CopyFrom(other); } + + public override bool Equals(ControlPoint? other) + => other is TimingControlPoint otherTimingControlPoint + && Equals(otherTimingControlPoint); + + public bool Equals(TimingControlPoint? other) + => base.Equals(other) + && TimeSignature.Equals(other.TimeSignature) + && BeatLength.Equals(other.BeatLength); + + public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), TimeSignature, BeatLength); } } diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 0865561854..cc6a9126bd 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; using osu.Framework.Extensions; @@ -162,7 +160,7 @@ namespace osu.Game.Beatmaps.Formats } [Obsolete("Do not use unless you're a legacy ruleset and 100% sure.")] - public class LegacyDifficultyControlPoint : DifficultyControlPoint + public class LegacyDifficultyControlPoint : DifficultyControlPoint, IEquatable { /// /// Legacy BPM multiplier that introduces floating-point errors for rulesets that depend on it. @@ -188,9 +186,20 @@ namespace osu.Game.Beatmaps.Formats BpmMultiplier = ((LegacyDifficultyControlPoint)other).BpmMultiplier; } + + public override bool Equals(ControlPoint? other) + => other is LegacyDifficultyControlPoint otherLegacyDifficultyControlPoint + && Equals(otherLegacyDifficultyControlPoint); + + public bool Equals(LegacyDifficultyControlPoint? other) + => base.Equals(other) + && BpmMultiplier == other.BpmMultiplier; + + // ReSharper disable once NonReadonlyMemberInGetHashCode + public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), BpmMultiplier); } - internal class LegacySampleControlPoint : SampleControlPoint + internal class LegacySampleControlPoint : SampleControlPoint, IEquatable { public int CustomSampleBank; @@ -215,6 +224,17 @@ namespace osu.Game.Beatmaps.Formats CustomSampleBank = ((LegacySampleControlPoint)other).CustomSampleBank; } + + public override bool Equals(ControlPoint? other) + => other is LegacySampleControlPoint otherLegacySampleControlPoint + && Equals(otherLegacySampleControlPoint); + + public bool Equals(LegacySampleControlPoint? other) + => base.Equals(other) + && CustomSampleBank == other.CustomSampleBank; + + // ReSharper disable once NonReadonlyMemberInGetHashCode + public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), CustomSampleBank); } } } From a922ea9b0163a805c5b2108ddecd22cb6d412c4a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 20 Jun 2022 15:28:36 +0900 Subject: [PATCH 1770/2328] Fix selection by directly comparing control points Previously, all control points would get replaced, which led to performance issues that was worked around in this PR. By comparing control points, we're able to get good performance without requiring the workaround. --- .../Edit/LegacyEditorBeatmapPatcher.cs | 28 +++++++++++++++---- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 8 ++---- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs index 6b18855396..01bc01bf5b 100644 --- a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs +++ b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs @@ -6,12 +6,14 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using DiffPlex; using DiffPlex.Model; using osu.Framework.Audio.Track; using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.Formats; using osu.Game.IO; using osu.Game.Skinning; @@ -50,14 +52,28 @@ namespace osu.Game.Screens.Edit if (removedIndices.Count == 0 && addedIndices.Count == 0) return; - // Due to conversion from legacy to non-legacy control points, it becomes difficult to diff control points correctly. - // So instead _all_ control points are reloaded if _any_ control point is changed. + ControlPointInfo newControlPoints = EditorBeatmap.ConvertControlPoints(getNewBeatmap().ControlPointInfo); - var newControlPoints = EditorBeatmap.ConvertControlPoints(getNewBeatmap().ControlPointInfo); + // Remove all groups from the current beatmap which don't have a corresponding equal group in the new beatmap. + foreach (var oldGroup in editorBeatmap.ControlPointInfo.Groups.ToArray()) + { + var newGroup = newControlPoints.GroupAt(oldGroup.Time); - editorBeatmap.ControlPointInfo.Clear(); - foreach (var point in newControlPoints.AllControlPoints) - editorBeatmap.ControlPointInfo.Add(point.Time, point); + if (!oldGroup.Equals(newGroup)) + editorBeatmap.ControlPointInfo.RemoveGroup(oldGroup); + } + + // Add all groups from the new beatmap which don't have a corresponding equal group in the old beatmap. + foreach (var newGroup in newControlPoints.Groups) + { + var oldGroup = editorBeatmap.ControlPointInfo.GroupAt(newGroup.Time); + + if (!newGroup.Equals(oldGroup)) + { + foreach (var point in newGroup.ControlPoints) + editorBeatmap.ControlPointInfo.Add(newGroup.Time, point); + } + } } private void processHitObjects(DiffResult result, Func getNewBeatmap) diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index 27b62f1104..60cb263a79 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -139,12 +139,8 @@ namespace osu.Game.Screens.Edit.Timing controlPointGroups.BindTo(Beatmap.ControlPointInfo.Groups); controlPointGroups.BindCollectionChanged((sender, args) => { - // This AddOnce() works around performance issues from the LegacyEditorBeatmapPatcher re-initialising all control points every undo & redo. - Scheduler.AddOnce(() => - { - table.ControlGroups = controlPointGroups; - changeHandler?.SaveState(); - }); + table.ControlGroups = controlPointGroups; + changeHandler?.SaveState(); }, true); } From 678b18dde68ab4d9ba874edfd6de73bc2b28c2e9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 15:29:56 +0900 Subject: [PATCH 1771/2328] Ensure any non-`MemoryStream` streams are closed as part of `ImportTask` --- osu.Game/Database/ImportTask.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Database/ImportTask.cs b/osu.Game/Database/ImportTask.cs index 0643300fc5..17ca691be3 100644 --- a/osu.Game/Database/ImportTask.cs +++ b/osu.Game/Database/ImportTask.cs @@ -62,6 +62,7 @@ namespace osu.Game.Database { // This isn't used in any current path. May need to reconsider for performance reasons (ie. if we don't expect the incoming stream to be copied out). memoryStream = new MemoryStream(stream.ReadAllBytesToArray()); + stream.Dispose(); } if (ZipUtils.IsZipArchive(memoryStream)) From 882e1c69e50bd53fe87df0525d3f5122517f10dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 15:36:44 +0900 Subject: [PATCH 1772/2328] Move nested task back outside try-catch to avoid double-error --- osu.Game/Database/RealmArchiveModelImporter.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Database/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs index f3174b46b8..e6956d3184 100644 --- a/osu.Game/Database/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -228,13 +228,6 @@ namespace osu.Game.Database if (model == null) return null; - - var scheduledImport = Task.Factory.StartNew(() => ImportModel(model, archive, batchImport, cancellationToken), - cancellationToken, - TaskCreationOptions.HideScheduler, - batchImport ? import_scheduler_batch : import_scheduler); - - return await scheduledImport.ConfigureAwait(false); } catch (TaskCanceledException) { @@ -245,6 +238,13 @@ namespace osu.Game.Database LogForModel(model, @$"Model creation of {archive.Name} failed.", e); return null; } + + var scheduledImport = Task.Factory.StartNew(() => ImportModel(model, archive, batchImport, cancellationToken), + cancellationToken, + TaskCreationOptions.HideScheduler, + batchImport ? import_scheduler_batch : import_scheduler); + + return await scheduledImport.ConfigureAwait(false); } /// From 4aa32038c3572fb648694a1f16302dea510a365e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 15:38:44 +0900 Subject: [PATCH 1773/2328] Add note about stream provided to `ImportTask` being disposed implicitly --- osu.Game/Database/ImportTask.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Database/ImportTask.cs b/osu.Game/Database/ImportTask.cs index 17ca691be3..e7f599d85f 100644 --- a/osu.Game/Database/ImportTask.cs +++ b/osu.Game/Database/ImportTask.cs @@ -33,7 +33,7 @@ namespace osu.Game.Database } /// - /// Construct a new import task from a stream. + /// Construct a new import task from a stream. The provided stream will be disposed after reading. /// public ImportTask(Stream stream, string filename) { From e82d948acc5d9ead0202f78707ff12d5069d08de Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 16:06:22 +0900 Subject: [PATCH 1774/2328] Add test coverage of import throwing when no valid `.osu` files are found --- .../Database/BeatmapImporterTests.cs | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index f9cd75d8c3..b018a26aec 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -291,6 +291,42 @@ namespace osu.Game.Tests.Database }); } + [Test] + public void TestImportDirectoryWithEmptyOsuFiles() + { + RunTestWithRealmAsync(async (realm, storage) => + { + using var importer = new BeatmapImporter(storage, realm); + using var store = new RealmRulesetStore(realm, storage); + + string? temp = TestResources.GetTestBeatmapForImport(); + + string extractedFolder = $"{temp}_extracted"; + Directory.CreateDirectory(extractedFolder); + + try + { + using (var zip = ZipArchive.Open(temp)) + zip.WriteToDirectory(extractedFolder); + + foreach (var file in new DirectoryInfo(extractedFolder).GetFiles("*.osu")) + { + using (file.Open(FileMode.Create)) + { + // empty file. + } + } + + var imported = await importer.Import(new ImportTask(extractedFolder)); + Assert.IsNull(imported); + } + finally + { + Directory.Delete(extractedFolder, true); + } + }); + } + [Test] public void TestImportThenImportWithReZip() { From d38defada461430817c8e99d21b49840ef769eb3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 16:07:10 +0900 Subject: [PATCH 1775/2328] Silence exception and provide more log output when import fails due to empty `.osu` files --- osu.Game/Beatmaps/BeatmapImporter.cs | 9 +++++++++ osu.Game/Beatmaps/Formats/Decoder.cs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapImporter.cs b/osu.Game/Beatmaps/BeatmapImporter.cs index e463492e2b..237088036c 100644 --- a/osu.Game/Beatmaps/BeatmapImporter.cs +++ b/osu.Game/Beatmaps/BeatmapImporter.cs @@ -177,8 +177,17 @@ namespace osu.Game.Beatmaps } Beatmap beatmap; + using (var stream = new LineBufferedReader(reader.GetStream(mapName))) + { + if (stream.PeekLine() == null) + { + Logger.Log($"No content found in first .osu file of beatmap archive ({reader.Name} / {mapName})", LoggingTarget.Database); + return null; + } + beatmap = Decoder.GetDecoder(stream).Decode(stream); + } return new BeatmapSetInfo { diff --git a/osu.Game/Beatmaps/Formats/Decoder.cs b/osu.Game/Beatmaps/Formats/Decoder.cs index aad29f46fb..ca1bcc97fd 100644 --- a/osu.Game/Beatmaps/Formats/Decoder.cs +++ b/osu.Game/Beatmaps/Formats/Decoder.cs @@ -74,7 +74,7 @@ namespace osu.Game.Beatmaps.Formats } if (line == null) - throw new IOException("Unknown file format (null)"); + throw new IOException("Unknown file format (no content)"); var decoder = typedDecoders.Where(d => line.StartsWith(d.Key, StringComparison.InvariantCulture)).Select(d => d.Value).FirstOrDefault(); From ca287d093621d3997e1f8abb1b1b60e33a026e94 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 20 Jun 2022 16:38:11 +0900 Subject: [PATCH 1776/2328] Fix group deselected when table is recreated --- osu.Game/Screens/Edit/EditorTable.cs | 5 ++--- osu.Game/Screens/Edit/Timing/ControlPointTable.cs | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/EditorTable.cs b/osu.Game/Screens/Edit/EditorTable.cs index 8765dae384..a290cce708 100644 --- a/osu.Game/Screens/Edit/EditorTable.cs +++ b/osu.Game/Screens/Edit/EditorTable.cs @@ -97,7 +97,7 @@ namespace osu.Game.Screens.Edit [BackgroundDependencyLoader] private void load(OverlayColourProvider colours) { - hoveredBackground.Colour = colourHover = colours.Background1; + colourHover = colours.Background1; colourSelected = colours.Colour3; } @@ -105,8 +105,7 @@ namespace osu.Game.Screens.Edit { base.LoadComplete(); - // Reduce flicker of rows when offset is being changed rapidly. - // Probably need to reconsider this. + updateState(); FinishTransforms(true); } diff --git a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs index 88c738c1d2..6d46b429f0 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs @@ -44,6 +44,7 @@ namespace osu.Game.Screens.Edit.Timing { BackgroundFlow.Add(new RowBackground(group) { + Selected = group.Equals(selectedGroup?.Value), Action = () => { selectedGroup.Value = group; From 16281f4a4831cebda36a6bf669ed59ab99408b40 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 20 Jun 2022 16:52:01 +0900 Subject: [PATCH 1777/2328] Properly annotate method to allow null --- osu.Game/Beatmaps/ControlPoints/ControlPoint.cs | 2 +- osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs | 2 +- osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs | 2 +- osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs | 2 +- osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs | 2 +- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs index fd06c898ab..b91d609849 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs @@ -28,7 +28,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// An existing control point to compare with. /// Whether this is redundant when placed alongside . - public abstract bool IsRedundant(ControlPoint existing); + public abstract bool IsRedundant(ControlPoint? existing); /// /// Create an unbound copy of this control point. diff --git a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs index 6f624d20c9..c199d1da59 100644 --- a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs @@ -40,7 +40,7 @@ namespace osu.Game.Beatmaps.ControlPoints set => SliderVelocityBindable.Value = value; } - public override bool IsRedundant(ControlPoint existing) + public override bool IsRedundant(ControlPoint? existing) => existing is DifficultyControlPoint existingDifficulty && SliderVelocity == existingDifficulty.SliderVelocity; diff --git a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs index 365d024035..ead07b4eaa 100644 --- a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs @@ -67,7 +67,7 @@ namespace osu.Game.Beatmaps.ControlPoints set => KiaiModeBindable.Value = value; } - public override bool IsRedundant(ControlPoint existing) + public override bool IsRedundant(ControlPoint? existing) => !OmitFirstBarLine && existing is EffectControlPoint existingEffect && KiaiMode == existingEffect.KiaiMode diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index ab575dfeda..78dec67937 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -72,7 +72,7 @@ namespace osu.Game.Beatmaps.ControlPoints public virtual HitSampleInfo ApplyTo(HitSampleInfo hitSampleInfo) => hitSampleInfo.With(newBank: hitSampleInfo.Bank ?? SampleBank, newVolume: hitSampleInfo.Volume > 0 ? hitSampleInfo.Volume : SampleVolume); - public override bool IsRedundant(ControlPoint existing) + public override bool IsRedundant(ControlPoint? existing) => existing is SampleControlPoint existingSample && SampleBank == existingSample.SampleBank && SampleVolume == existingSample.SampleVolume; diff --git a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs index 87ef4e86d5..23d4d10fd8 100644 --- a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs @@ -69,7 +69,7 @@ namespace osu.Game.Beatmaps.ControlPoints public double BPM => 60000 / BeatLength; // Timing points are never redundant as they can change the time signature. - public override bool IsRedundant(ControlPoint existing) => false; + public override bool IsRedundant(ControlPoint? existing) => false; public override void CopyFrom(ControlPoint other) { diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index cc6a9126bd..a5e6ac0a1c 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -213,7 +213,7 @@ namespace osu.Game.Beatmaps.Formats return baseInfo; } - public override bool IsRedundant(ControlPoint existing) + public override bool IsRedundant(ControlPoint? existing) => base.IsRedundant(existing) && existing is LegacySampleControlPoint existingSample && CustomSampleBank == existingSample.CustomSampleBank; From e0c82d11ab339009718b880c95697ef74ede594c Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 20 Jun 2022 16:53:03 +0900 Subject: [PATCH 1778/2328] Convert == usages to ReferenceEquals --- osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs | 2 +- osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs | 8 ++++---- .../Visual/UserInterface/TestSceneBeatSyncedContainer.cs | 4 ++-- osu.Game/Graphics/Containers/BeatSyncedContainer.cs | 2 +- osu.Game/Rulesets/Objects/HitObject.cs | 4 ++-- .../Timelines/Summary/Parts/ControlPointPart.cs | 2 +- .../Components/Timeline/TimelineControlPointDisplay.cs | 2 +- .../Components/Timeline/TimelineHitObjectBlueprint.cs | 6 +++--- osu.Game/Screens/Edit/EditorClock.cs | 2 +- osu.Game/Screens/Edit/Timing/ControlPointTable.cs | 3 ++- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 2 +- osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs | 2 +- 12 files changed, 20 insertions(+), 19 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs index 4589a8eca1..f03bcffdc8 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs @@ -374,7 +374,7 @@ namespace osu.Game.Rulesets.Osu.Mods int i = 0; double currentTime = timingPoint.Time; - while (!definitelyBigger(currentTime, mapEndTime) && controlPointInfo.TimingPointAt(currentTime) == timingPoint) + while (!definitelyBigger(currentTime, mapEndTime) && ReferenceEquals(controlPointInfo.TimingPointAt(currentTime), timingPoint)) { beats.Add(Math.Floor(currentTime)); i++; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs index cf1246ef07..e9bbf1e33d 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs @@ -117,8 +117,8 @@ namespace osu.Game.Tests.Visual.Editing // After placement these must be non-default as defaults are read-only. AddAssert("Placed object has non-default control points", () => - EditorBeatmap.HitObjects[0].SampleControlPoint != SampleControlPoint.DEFAULT && - EditorBeatmap.HitObjects[0].DifficultyControlPoint != DifficultyControlPoint.DEFAULT); + !ReferenceEquals(EditorBeatmap.HitObjects[0].SampleControlPoint, SampleControlPoint.DEFAULT) && + !ReferenceEquals(EditorBeatmap.HitObjects[0].DifficultyControlPoint, DifficultyControlPoint.DEFAULT)); ReloadEditorToSameBeatmap(); @@ -126,8 +126,8 @@ namespace osu.Game.Tests.Visual.Editing // After placement these must be non-default as defaults are read-only. AddAssert("Placed object still has non-default control points", () => - EditorBeatmap.HitObjects[0].SampleControlPoint != SampleControlPoint.DEFAULT && - EditorBeatmap.HitObjects[0].DifficultyControlPoint != DifficultyControlPoint.DEFAULT); + !ReferenceEquals(EditorBeatmap.HitObjects[0].SampleControlPoint, SampleControlPoint.DEFAULT) && + !ReferenceEquals(EditorBeatmap.HitObjects[0].DifficultyControlPoint, DifficultyControlPoint.DEFAULT)); } [Test] diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs index 27c107a2db..6cf66963a5 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs @@ -269,7 +269,7 @@ namespace osu.Game.Tests.Visual.UserInterface private TimingControlPoint getNextTimingPoint(TimingControlPoint current) { - if (timingPoints[^1] == current) + if (ReferenceEquals(timingPoints[^1], current)) return current; int index = timingPoints.IndexOf(current); // -1 means that this is a "default beat" @@ -281,7 +281,7 @@ namespace osu.Game.Tests.Visual.UserInterface { if (timingPoints.Count == 0) return 0; - if (timingPoints[^1] == current) + if (ReferenceEquals(timingPoints[^1], current)) { Debug.Assert(BeatSyncSource.Clock != null); diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index 4146bbcc5e..45a935d165 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -127,7 +127,7 @@ namespace osu.Game.Graphics.Containers TimeSinceLastBeat = beatLength - TimeUntilNextBeat; - if (timingPoint == lastTimingPoint && beatIndex == lastBeat) + if (ReferenceEquals(timingPoint, lastTimingPoint) && beatIndex == lastBeat) return; // as this event is sometimes used for sound triggers where `BeginDelayedSequence` has no effect, avoid firing it if too far away from the beat. diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 30b8fe965a..d20e0616e5 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -108,7 +108,7 @@ namespace osu.Game.Rulesets.Objects if (legacyInfo != null) DifficultyControlPoint = (DifficultyControlPoint)legacyInfo.DifficultyPointAt(StartTime).DeepClone(); - else if (DifficultyControlPoint == DifficultyControlPoint.DEFAULT) + else if (ReferenceEquals(DifficultyControlPoint, DifficultyControlPoint.DEFAULT)) DifficultyControlPoint = new DifficultyControlPoint(); DifficultyControlPoint.Time = StartTime; @@ -118,7 +118,7 @@ namespace osu.Game.Rulesets.Objects // This is done here after ApplyDefaultsToSelf as we may require custom defaults to be applied to have an accurate end time. if (legacyInfo != null) SampleControlPoint = (SampleControlPoint)legacyInfo.SamplePointAt(this.GetEndTime() + control_point_leniency).DeepClone(); - else if (SampleControlPoint == SampleControlPoint.DEFAULT) + else if (ReferenceEquals(SampleControlPoint, SampleControlPoint.DEFAULT)) SampleControlPoint = new SampleControlPoint(); SampleControlPoint.Time = this.GetEndTime() + control_point_leniency; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs index 4e2c018330..ee82ded39d 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs @@ -49,7 +49,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts case NotifyCollectionChangedAction.Remove: foreach (var group in args.OldItems.OfType()) { - var matching = Children.SingleOrDefault(gv => gv.Group == group); + var matching = Children.SingleOrDefault(gv => ReferenceEquals(gv.Group, group)); if (matching != null) matching.Expire(); diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointDisplay.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointDisplay.cs index 5d5681ea2b..544c3f8369 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointDisplay.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointDisplay.cs @@ -40,7 +40,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline case NotifyCollectionChangedAction.Remove: foreach (var group in args.OldItems.OfType()) { - var matching = Children.SingleOrDefault(gv => gv.Group == group); + var matching = Children.SingleOrDefault(gv => ReferenceEquals(gv.Group, group)); matching?.Expire(); } diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs index 34abe81ae2..32ebc9c3c1 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs @@ -205,7 +205,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline updateRepeats(repeats); } - if (difficultyControlPoint != Item.DifficultyControlPoint) + if (!ReferenceEquals(difficultyControlPoint, Item.DifficultyControlPoint)) { difficultyControlPoint = Item.DifficultyControlPoint; difficultyOverrideDisplay?.Expire(); @@ -220,7 +220,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline } } - if (sampleControlPoint != Item.SampleControlPoint) + if (!ReferenceEquals(sampleControlPoint, Item.SampleControlPoint)) { sampleControlPoint = Item.SampleControlPoint; sampleOverrideDisplay?.Expire(); @@ -393,7 +393,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline if (e.CurrentState.Keyboard.ShiftPressed) { - if (hitObject.DifficultyControlPoint == DifficultyControlPoint.DEFAULT) + if (ReferenceEquals(hitObject.DifficultyControlPoint, DifficultyControlPoint.DEFAULT)) hitObject.DifficultyControlPoint = new DifficultyControlPoint(); double newVelocity = hitObject.DifficultyControlPoint.SliderVelocity * (repeatHitObject.Duration / proposedDuration); diff --git a/osu.Game/Screens/Edit/EditorClock.cs b/osu.Game/Screens/Edit/EditorClock.cs index c7df36be77..c3b29afd30 100644 --- a/osu.Game/Screens/Edit/EditorClock.cs +++ b/osu.Game/Screens/Edit/EditorClock.cs @@ -141,7 +141,7 @@ namespace osu.Game.Screens.Edit seekTime = timingPoint.Time + closestBeat * seekAmount; } - if (seekTime < timingPoint.Time && timingPoint != ControlPointInfo.TimingPoints.First()) + if (seekTime < timingPoint.Time && !ReferenceEquals(timingPoint, ControlPointInfo.TimingPoints.First())) seekTime = timingPoint.Time; SeekSmoothlyTo(seekTime); diff --git a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs index 6d46b429f0..b6e3e91c98 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs @@ -65,7 +65,8 @@ namespace osu.Game.Screens.Edit.Timing selectedGroup.BindValueChanged(group => { // TODO: This should scroll the selected row into view. - foreach (var b in BackgroundFlow) b.Selected = b.Item == group.NewValue; + foreach (var b in BackgroundFlow) + b.Selected = ReferenceEquals(b.Item, group.NewValue); }, true); } diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index 60cb263a79..c33dcc6e91 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -222,7 +222,7 @@ namespace osu.Game.Screens.Edit.Timing // Try and create matching types from the currently selected control point. var selected = selectedGroup.Value; - if (selected != null && selected != group) + if (selected != null && !ReferenceEquals(selected, group)) { foreach (var controlPoint in selected.ControlPoints) { diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index 67b7abb25b..1cdcfdf167 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -128,7 +128,7 @@ namespace osu.Game.Screens.Edit.Timing double? offsetChange = newStartTime - selectedGroupStartTime; var nextGroup = editorBeatmap.ControlPointInfo.TimingPoints - .SkipWhile(g => g != tcp) + .SkipWhile(g => !ReferenceEquals(g, tcp)) .Skip(1) .FirstOrDefault(); From b0b3ea42ccf6330125d94da23ef26110f2a3a61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 20 Jun 2022 10:44:14 +0200 Subject: [PATCH 1779/2328] Remove null default value in `ImportSkinTest` helper method --- osu.Game.Tests/Skins/IO/ImportSkinTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Skins/IO/ImportSkinTest.cs b/osu.Game.Tests/Skins/IO/ImportSkinTest.cs index f3adb85006..8b7fcae1a9 100644 --- a/osu.Game.Tests/Skins/IO/ImportSkinTest.cs +++ b/osu.Game.Tests/Skins/IO/ImportSkinTest.cs @@ -357,7 +357,7 @@ namespace osu.Game.Tests.Skins.IO } } - private async Task> loadSkinIntoOsu(OsuGameBase osu, ImportTask import = null) + private async Task> loadSkinIntoOsu(OsuGameBase osu, ImportTask import) { var skinManager = osu.Dependencies.Get(); return await skinManager.Import(import); From ebcee21f6f50d640a00badab6013ea332d14338d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 17:52:42 +0900 Subject: [PATCH 1780/2328] Remove necessity to provide `BeatmapDifficultyCache` as a function to `ScoreManager` --- osu.Game/OsuGameBase.cs | 6 ++++-- osu.Game/Scoring/ScoreManager.cs | 12 +++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index f0f364314c..a09588516d 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -264,14 +264,16 @@ namespace osu.Game var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures); + dependencies.Cache(difficultyCache = new BeatmapDifficultyCache()); + // ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup() - dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, realm, Scheduler, () => difficultyCache, LocalConfig)); + dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, realm, Scheduler, difficultyCache, LocalConfig)); dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, realm, RulesetStore, API, Audio, Resources, Host, defaultBeatmap, performOnlineLookups: true)); dependencies.Cache(BeatmapDownloader = new BeatmapModelDownloader(BeatmapManager, API)); dependencies.Cache(ScoreDownloader = new ScoreModelDownloader(ScoreManager, API)); - dependencies.Cache(difficultyCache = new BeatmapDifficultyCache()); + // Add after all the above cache operations as it depends on them. AddInternal(difficultyCache); dependencies.Cache(userCache = new UserLookupCache()); diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 44aafbec74..027e25d3b3 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -27,16 +27,16 @@ namespace osu.Game.Scoring public class ScoreManager : ModelManager, IModelImporter { private readonly Scheduler scheduler; - private readonly Func difficulties; + private readonly BeatmapDifficultyCache difficultyCache; private readonly OsuConfigManager configManager; private readonly ScoreImporter scoreImporter; public ScoreManager(RulesetStore rulesets, Func beatmaps, Storage storage, RealmAccess realm, Scheduler scheduler, - Func difficulties = null, OsuConfigManager configManager = null) + BeatmapDifficultyCache difficultyCache = null, OsuConfigManager configManager = null) : base(storage, realm) { this.scheduler = scheduler; - this.difficulties = difficulties; + this.difficultyCache = difficultyCache; this.configManager = configManager; scoreImporter = new ScoreImporter(rulesets, beatmaps, storage, realm) @@ -65,8 +65,6 @@ namespace osu.Game.Scoring /// The given ordered by decreasing total score. public async Task OrderByTotalScoreAsync(ScoreInfo[] scores, CancellationToken cancellationToken = default) { - var difficultyCache = difficulties?.Invoke(); - if (difficultyCache != null) { // Compute difficulties asynchronously first to prevent blocking via the GetTotalScore() call below. @@ -168,11 +166,11 @@ namespace osu.Game.Scoring return score.BeatmapInfo.MaxCombo.Value; #pragma warning restore CS0618 - if (difficulties == null) + if (difficultyCache == null) return null; // We can compute the max combo locally after the async beatmap difficulty computation. - var difficulty = await difficulties().GetDifficultyAsync(score.BeatmapInfo, score.Ruleset, score.Mods, cancellationToken).ConfigureAwait(false); + var difficulty = await difficultyCache.GetDifficultyAsync(score.BeatmapInfo, score.Ruleset, score.Mods, cancellationToken).ConfigureAwait(false); return difficulty?.MaxCombo; } From dbae4c6f5a9f307bbb4aad65f4fa841b6523e097 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 18:21:37 +0900 Subject: [PATCH 1781/2328] `PostImport` -> `PresentImport` --- osu.Game/Beatmaps/BeatmapManager.cs | 4 ++-- osu.Game/Database/IPostImports.cs | 2 +- osu.Game/Database/RealmArchiveModelImporter.cs | 6 +++--- osu.Game/OsuGame.cs | 4 ++-- osu.Game/Scoring/ScoreManager.cs | 4 ++-- osu.Game/Skinning/SkinManager.cs | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 06a8ad5188..816808638f 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -454,9 +454,9 @@ namespace osu.Game.Beatmaps #region Implementation of IPostImports - public Action>>? PostImport + public Action>>? PresentImport { - set => beatmapImporter.PostImport = value; + set => beatmapImporter.PresentImport = value; } #endregion diff --git a/osu.Game/Database/IPostImports.cs b/osu.Game/Database/IPostImports.cs index 83a211f6e6..d8493d5e18 100644 --- a/osu.Game/Database/IPostImports.cs +++ b/osu.Game/Database/IPostImports.cs @@ -12,6 +12,6 @@ namespace osu.Game.Database /// /// Fired when the user requests to view the resulting import. /// - public Action>>? PostImport { set; } + public Action>>? PresentImport { set; } } } diff --git a/osu.Game/Database/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs index e6956d3184..6d5a10682f 100644 --- a/osu.Game/Database/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -65,7 +65,7 @@ namespace osu.Game.Database /// /// Fired when the user requests to view the resulting import. /// - public Action>>? PostImport { get; set; } + public Action>>? PresentImport { get; set; } /// /// Set an endpoint for notifications to be posted to. @@ -158,12 +158,12 @@ namespace osu.Game.Database ? $"Imported {imported.First().GetDisplayString()}!" : $"Imported {imported.Count} {HumanisedModelName}s!"; - if (imported.Count > 0 && PostImport != null) + if (imported.Count > 0 && PresentImport != null) { notification.CompletionText += " Click to view."; notification.CompletionClickAction = () => { - PostImport?.Invoke(imported); + PresentImport?.Invoke(imported); return true; }; } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 97476358b1..4732a991a2 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -711,13 +711,13 @@ namespace osu.Game SkinManager.PostNotification = n => Notifications.Post(n); BeatmapManager.PostNotification = n => Notifications.Post(n); - BeatmapManager.PostImport = items => PresentBeatmap(items.First().Value); + BeatmapManager.PresentImport = items => PresentBeatmap(items.First().Value); BeatmapDownloader.PostNotification = n => Notifications.Post(n); ScoreDownloader.PostNotification = n => Notifications.Post(n); ScoreManager.PostNotification = n => Notifications.Post(n); - ScoreManager.PostImport = items => PresentScore(items.First().Value); + ScoreManager.PresentImport = items => PresentScore(items.First().Value); // make config aware of how to lookup skins for on-screen display purposes. // if this becomes a more common thing, tracked settings should be reconsidered to allow local DI. diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 44aafbec74..139675711f 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -269,9 +269,9 @@ namespace osu.Game.Scoring #region Implementation of IPresentImports - public Action>> PostImport + public Action>> PresentImport { - set => scoreImporter.PostImport = value; + set => scoreImporter.PresentImport = value; } #endregion diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index 38eff2f0d6..dc0197e613 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -259,9 +259,9 @@ namespace osu.Game.Skinning #region Implementation of IModelImporter - public Action>> PostImport + public Action>> PresentImport { - set => skinImporter.PostImport = value; + set => skinImporter.PresentImport = value; } public Task Import(params string[] paths) => skinImporter.Import(paths); From 45c5013f09d5467d8087e7bd24661cf929aee91d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 18:38:02 +0900 Subject: [PATCH 1782/2328] Remove default value of `RealmArchiveModelImporter.HandledExtensions` Not used anywhere and probably not wanted ever. --- osu.Game/Database/RealmArchiveModelImporter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Database/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs index 6d5a10682f..584dda7264 100644 --- a/osu.Game/Database/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -56,7 +56,7 @@ namespace osu.Game.Database /// private static readonly ThreadedTaskScheduler import_scheduler_batch = new ThreadedTaskScheduler(import_queue_request_concurrency, nameof(RealmArchiveModelImporter)); - public virtual IEnumerable HandledExtensions => new[] { @".zip" }; + public abstract IEnumerable HandledExtensions { get; } protected readonly RealmFileStore Files; From e732c5a2d750ed0ae6687eb3277d0fc44f8c8578 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 18:38:37 +0900 Subject: [PATCH 1783/2328] Add `PostImport` method matching `PreImport` --- osu.Game/Database/RealmArchiveModelImporter.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game/Database/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs index 584dda7264..27bfaf05be 100644 --- a/osu.Game/Database/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -338,6 +338,8 @@ namespace osu.Game.Database transaction.Commit(); } + PostImport(item, realm); + LogForModel(item, @"Import successfully completed!"); } catch (Exception e) @@ -473,6 +475,15 @@ namespace osu.Game.Database { } + /// + /// Perform any final actions after the import has been committed to the database. + /// + /// The model prepared for import. + /// The current realm context. + protected virtual void PostImport(TModel model, Realm realm) + { + } + /// /// Check whether an existing model already exists for a new import item. /// From ba394f283111e19ff274bae8cc4cc93a0cd46110 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 18:53:48 +0900 Subject: [PATCH 1784/2328] Remove `IPostsImports` interface (and move to `IModelImporter`) --- osu.Game/Database/IModelImporter.cs | 8 +++++++- osu.Game/Database/IPostImports.cs | 17 ----------------- 2 files changed, 7 insertions(+), 18 deletions(-) delete mode 100644 osu.Game/Database/IPostImports.cs diff --git a/osu.Game/Database/IModelImporter.cs b/osu.Game/Database/IModelImporter.cs index bf9f2f9c75..26342cb5fe 100644 --- a/osu.Game/Database/IModelImporter.cs +++ b/osu.Game/Database/IModelImporter.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Threading.Tasks; using osu.Game.Overlays.Notifications; @@ -11,7 +12,7 @@ namespace osu.Game.Database /// A class which handles importing of associated models to the game store. /// /// The model type. - public interface IModelImporter : IPostNotifications, IPostImports, ICanAcceptFiles + public interface IModelImporter : IPostNotifications, ICanAcceptFiles where TModel : class, IHasGuidPrimaryKey { /// @@ -26,5 +27,10 @@ namespace osu.Game.Database /// A user displayable name for the model type associated with this manager. /// string HumanisedModelName => $"{typeof(TModel).Name.Replace(@"Info", "").ToLower()}"; + + /// + /// Fired when the user requests to view the resulting import. + /// + public Action>>? PresentImport { set; } } } diff --git a/osu.Game/Database/IPostImports.cs b/osu.Game/Database/IPostImports.cs deleted file mode 100644 index d8493d5e18..0000000000 --- a/osu.Game/Database/IPostImports.cs +++ /dev/null @@ -1,17 +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 System; -using System.Collections.Generic; - -namespace osu.Game.Database -{ - public interface IPostImports - where TModel : class, IHasGuidPrimaryKey - { - /// - /// Fired when the user requests to view the resulting import. - /// - public Action>>? PresentImport { set; } - } -} From 58d6fa46453a0787d11ee1fcf02ff26c99ffb9a1 Mon Sep 17 00:00:00 2001 From: 63411 <62799417+molneya@users.noreply.github.com> Date: Mon, 20 Jun 2022 19:55:26 +0800 Subject: [PATCH 1785/2328] Reduce NoFail pp multiplier --- .../Difficulty/ManiaPerformanceCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs index dea02adfbf..216dfe6c47 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty double multiplier = 8.0; if (score.Mods.Any(m => m is ModNoFail)) - multiplier *= 0.9; + multiplier *= 0.75; if (score.Mods.Any(m => m is ModEasy)) multiplier *= 0.5; From 5a5cc523ce78421a32cb18ec84bb9e0c75e12275 Mon Sep 17 00:00:00 2001 From: cdwcgt Date: Mon, 20 Jun 2022 23:43:33 +0800 Subject: [PATCH 1786/2328] Let F to -1 temporary --- osu.Game/Scoring/ScoreRank.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Scoring/ScoreRank.cs b/osu.Game/Scoring/ScoreRank.cs index 9de8561b4a..dc90e417cd 100644 --- a/osu.Game/Scoring/ScoreRank.cs +++ b/osu.Game/Scoring/ScoreRank.cs @@ -11,6 +11,11 @@ namespace osu.Game.Scoring { public enum ScoreRank { + // TODO: reconsider changing later on + [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.RankD))] + [Description(@"F")] + F = -1, + [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.RankD))] [Description(@"D")] D, From 43ead5820a9db5c1d2403398509f94d7017c4713 Mon Sep 17 00:00:00 2001 From: cdwcgt Date: Tue, 21 Jun 2022 00:54:50 +0900 Subject: [PATCH 1787/2328] deal with test --- osu.Game/Screens/Play/FailOverlay.cs | 2 +- osu.Game/Screens/Play/Player.cs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index b09a7de631..1b9d81d33b 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -19,9 +19,9 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader] private void load(OsuColour colours) { - AddButton("Save replay and Quit", colours.Blue, () => SaveReplay?.Invoke()); AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke()); AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke()); + AddButton("Save replay and Quit", colours.Blue, () => SaveReplay?.Invoke()); } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index c404510487..d38c10c071 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -1044,18 +1044,19 @@ namespace osu.Game.Screens.Play return base.OnExiting(e); } - // Don't know if prepareScoreForResults useful - private async void saveReplay() + private void saveReplay() { var scoreCopy = Score.DeepClone(); + try { - await ImportScore(scoreCopy).ConfigureAwait(false); + ImportScore(scoreCopy).ConfigureAwait(false); } catch (Exception ex) { Logger.Error(ex, @"Score import failed!"); } + PerformExit(true); } From 34f1c80b7c2dbe6125510f274b42f251be0fb8dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 20 Jun 2022 20:04:21 +0200 Subject: [PATCH 1788/2328] Add and use `ILinkHandler` interface --- .../Graphics/Containers/LinkFlowContainer.cs | 7 +++-- .../Markdown/OsuMarkdownLinkText.cs | 5 ++-- osu.Game/Online/ILinkHandler.cs | 30 +++++++++++++++++++ osu.Game/OsuGame.cs | 3 +- 4 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 osu.Game/Online/ILinkHandler.cs diff --git a/osu.Game/Graphics/Containers/LinkFlowContainer.cs b/osu.Game/Graphics/Containers/LinkFlowContainer.cs index a67e5ae66f..bf96695fd3 100644 --- a/osu.Game/Graphics/Containers/LinkFlowContainer.cs +++ b/osu.Game/Graphics/Containers/LinkFlowContainer.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Localisation; using osu.Framework.Platform; +using osu.Game.Online; using osu.Game.Users; namespace osu.Game.Graphics.Containers @@ -25,7 +26,7 @@ namespace osu.Game.Graphics.Containers } [Resolved(CanBeNull = true)] - private OsuGame game { get; set; } + private ILinkHandler linkHandler { get; set; } [Resolved] private GameHost host { get; set; } @@ -81,8 +82,8 @@ namespace osu.Game.Graphics.Containers { if (action != null) action(); - else if (game != null) - game.HandleLink(link); + else if (linkHandler != null) + linkHandler.HandleLink(link); // fallback to handle cases where OsuGame is not available, ie. tournament client. else if (link.Action == LinkAction.External) host.OpenUrlExternally(link.Argument.ToString()); diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownLinkText.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownLinkText.cs index dca9e3de6e..3a16eb0a0f 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownLinkText.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownLinkText.cs @@ -8,6 +8,7 @@ using Markdig.Syntax.Inlines; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers.Markdown; +using osu.Game.Online; using osu.Game.Online.Chat; using osu.Game.Overlays; @@ -16,7 +17,7 @@ namespace osu.Game.Graphics.Containers.Markdown public class OsuMarkdownLinkText : MarkdownLinkText { [Resolved(canBeNull: true)] - private OsuGame game { get; set; } + private ILinkHandler linkHandler { get; set; } private readonly string text; private readonly string title; @@ -51,7 +52,7 @@ namespace osu.Game.Graphics.Containers.Markdown }; } - protected override void OnLinkPressed() => game?.HandleLink(Url); + protected override void OnLinkPressed() => linkHandler?.HandleLink(Url); private class OsuMarkdownLinkCompiler : DrawableLinkCompiler { diff --git a/osu.Game/Online/ILinkHandler.cs b/osu.Game/Online/ILinkHandler.cs new file mode 100644 index 0000000000..1b8fad4bd9 --- /dev/null +++ b/osu.Game/Online/ILinkHandler.cs @@ -0,0 +1,30 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Game.Online.Chat; + +namespace osu.Game.Online +{ + /// + /// Handle an arbitrary URL. Displays via in-game overlays where possible. + /// Methods can be called from a non-thread-safe non-game-loaded state. + /// + [Cached] + public interface ILinkHandler + { + /// + /// Handle an arbitrary URL. Displays via in-game overlays where possible. + /// This can be called from a non-thread-safe non-game-loaded state. + /// + /// The URL to load. + void HandleLink(string url); + + /// + /// Handle a specific . + /// This can be called from a non-thread-safe non-game-loaded state. + /// + /// The link to load. + void HandleLink(LinkDetails link); + } +} diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4732a991a2..f51a18b36f 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -39,6 +39,7 @@ using osu.Game.Input; using osu.Game.Input.Bindings; using osu.Game.IO; using osu.Game.Localisation; +using osu.Game.Online; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Chat; using osu.Game.Overlays; @@ -69,7 +70,7 @@ namespace osu.Game /// The full osu! experience. Builds on top of to add menus and binding logic /// for initial components that are generally retrieved via DI. /// - public class OsuGame : OsuGameBase, IKeyBindingHandler, ILocalUserPlayInfo, IPerformFromScreenRunner, IOverlayManager + public class OsuGame : OsuGameBase, IKeyBindingHandler, ILocalUserPlayInfo, IPerformFromScreenRunner, IOverlayManager, ILinkHandler { /// /// The amount of global offset to apply when a left/right anchored overlay is displayed (ie. settings or notifications). From 92011124d146be3074b8a1df18e1b0a0f8f5cb35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 20 Jun 2022 20:08:36 +0200 Subject: [PATCH 1789/2328] Implement IPC channel for `osu://` scheme links --- osu.Game/IPC/OsuSchemeLinkIPCChannel.cs | 49 +++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 osu.Game/IPC/OsuSchemeLinkIPCChannel.cs diff --git a/osu.Game/IPC/OsuSchemeLinkIPCChannel.cs b/osu.Game/IPC/OsuSchemeLinkIPCChannel.cs new file mode 100644 index 0000000000..33318e329c --- /dev/null +++ b/osu.Game/IPC/OsuSchemeLinkIPCChannel.cs @@ -0,0 +1,49 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Diagnostics; +using System.Threading.Tasks; +using osu.Framework.Platform; +using osu.Game.Online; + +namespace osu.Game.IPC +{ + public class OsuSchemeLinkIPCChannel : IpcChannel + { + private readonly ILinkHandler? linkHandler; + + public OsuSchemeLinkIPCChannel(IIpcHost host, ILinkHandler? linkHandler = null) + : base(host) + { + this.linkHandler = linkHandler; + + MessageReceived += msg => + { + Debug.Assert(linkHandler != null); + linkHandler.HandleLink(msg.Link); + return null; + }; + } + + public async Task HandleLinkAsync(string url) + { + if (linkHandler == null) + { + await SendMessageAsync(new OsuSchemeLinkMessage(url)).ConfigureAwait(false); + return; + } + + linkHandler.HandleLink(url); + } + } + + public class OsuSchemeLinkMessage + { + public string Link { get; } + + public OsuSchemeLinkMessage(string link) + { + Link = link; + } + } +} From 330af7ec7460c0cc49ff7a13f7597c18459650f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 20 Jun 2022 21:21:16 +0200 Subject: [PATCH 1790/2328] Handle `osu://` scheme links via IPC in desktop game --- osu.Desktop/OsuGameDesktop.cs | 31 +++++++++++++-------- osu.Desktop/Program.cs | 42 ++++++++++++++++++++--------- osu.Game/IPC/IPCTimeoutException.cs | 15 +++++++++++ 3 files changed, 65 insertions(+), 23 deletions(-) create mode 100644 osu.Game/IPC/IPCTimeoutException.cs diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 6713136343..873be052d7 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; using System.Diagnostics; @@ -22,23 +20,26 @@ using osu.Game.Updater; using osu.Desktop.Windows; using osu.Framework.Threading; using osu.Game.IO; +using osu.Game.IPC; namespace osu.Desktop { internal class OsuGameDesktop : OsuGame { - public OsuGameDesktop(string[] args = null) + private OsuSchemeLinkIPCChannel? osuSchemeLinkIPCChannel; + + public OsuGameDesktop(string[]? args = null) : base(args) { } - public override StableStorage GetStorageForStableInstall() + public override StableStorage? GetStorageForStableInstall() { try { if (Host is DesktopGameHost desktopHost) { - string stablePath = getStableInstallPath(); + string? stablePath = getStableInstallPath(); if (!string.IsNullOrEmpty(stablePath)) return new StableStorage(stablePath, desktopHost); } @@ -51,11 +52,11 @@ namespace osu.Desktop return null; } - private string getStableInstallPath() + private string? getStableInstallPath() { static bool checkExists(string p) => Directory.Exists(Path.Combine(p, "Songs")) || File.Exists(Path.Combine(p, "osu!.cfg")); - string stableInstallPath; + string? stableInstallPath; if (OperatingSystem.IsWindows()) { @@ -83,15 +84,15 @@ namespace osu.Desktop } [SupportedOSPlatform("windows")] - private string getStableInstallPathFromRegistry() + private string? getStableInstallPathFromRegistry() { - using (RegistryKey key = Registry.ClassesRoot.OpenSubKey("osu")) + using (RegistryKey? key = Registry.ClassesRoot.OpenSubKey("osu")) return key?.OpenSubKey(@"shell\open\command")?.GetValue(string.Empty)?.ToString()?.Split('"')[1].Replace("osu!.exe", ""); } protected override UpdateManager CreateUpdateManager() { - string packageManaged = Environment.GetEnvironmentVariable("OSU_EXTERNAL_UPDATE_PROVIDER"); + string? packageManaged = Environment.GetEnvironmentVariable("OSU_EXTERNAL_UPDATE_PROVIDER"); if (!string.IsNullOrEmpty(packageManaged)) return new NoActionUpdateManager(); @@ -118,6 +119,8 @@ namespace osu.Desktop LoadComponentAsync(new GameplayWinKeyBlocker(), Add); LoadComponentAsync(new ElevatedPrivilegesChecker(), Add); + + osuSchemeLinkIPCChannel = new OsuSchemeLinkIPCChannel(Host, this); } public override void SetHost(GameHost host) @@ -135,7 +138,7 @@ namespace osu.Desktop } private readonly List importableFiles = new List(); - private ScheduledDelegate importSchedule; + private ScheduledDelegate? importSchedule; private void fileDrop(string[] filePaths) { @@ -168,5 +171,11 @@ namespace osu.Desktop Task.Factory.StartNew(() => Import(paths), TaskCreationOptions.LongRunning); } } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + osuSchemeLinkIPCChannel?.Dispose(); + } } } diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 4ba9cc6a90..7a5809e915 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -11,6 +11,7 @@ using osu.Framework; using osu.Framework.Development; using osu.Framework.Logging; using osu.Framework.Platform; +using osu.Game; using osu.Game.IPC; using osu.Game.Tournament; using Squirrel; @@ -65,19 +66,8 @@ namespace osu.Desktop { if (!host.IsPrimaryInstance) { - if (args.Length > 0 && args[0].Contains('.')) // easy way to check for a file import in args - { - var importer = new ArchiveImportIPCChannel(host); - - foreach (string file in args) - { - Console.WriteLine(@"Importing {0}", file); - if (!importer.ImportAsync(Path.GetFullPath(file, cwd)).Wait(3000)) - throw new TimeoutException(@"IPC took too long to send"); - } - + if (trySendIPCMessage(host, cwd, args)) return; - } // we want to allow multiple instances to be started when in debug. if (!DebugUtils.IsDebugBuild) @@ -108,6 +98,34 @@ namespace osu.Desktop } } + private static bool trySendIPCMessage(IIpcHost host, string cwd, string[] args) + { + if (args.Length == 1 && args[0].StartsWith(OsuGameBase.OSU_PROTOCOL, StringComparison.Ordinal)) + { + var osuSchemeLinkHandler = new OsuSchemeLinkIPCChannel(host); + if (!osuSchemeLinkHandler.HandleLinkAsync(args[0]).Wait(3000)) + throw new IPCTimeoutException(osuSchemeLinkHandler.GetType()); + + return true; + } + + if (args.Length > 0 && args[0].Contains('.')) // easy way to check for a file import in args + { + var importer = new ArchiveImportIPCChannel(host); + + foreach (string file in args) + { + Console.WriteLine(@"Importing {0}", file); + if (!importer.ImportAsync(Path.GetFullPath(file, cwd)).Wait(3000)) + throw new IPCTimeoutException(importer.GetType()); + } + + return true; + } + + return false; + } + [SupportedOSPlatform("windows")] private static void setupSquirrel() { diff --git a/osu.Game/IPC/IPCTimeoutException.cs b/osu.Game/IPC/IPCTimeoutException.cs new file mode 100644 index 0000000000..d820184468 --- /dev/null +++ b/osu.Game/IPC/IPCTimeoutException.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 System; + +namespace osu.Game.IPC +{ + public class IPCTimeoutException : TimeoutException + { + public IPCTimeoutException(Type channelType) + : base($@"IPC took too long to send message via channel {channelType}") + { + } + } +} From 21d60231b6eecb087d5d10873e80aaf208115c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 20 Jun 2022 22:10:25 +0200 Subject: [PATCH 1791/2328] Add limited test coverage of `osu://` scheme link IPC flow --- .../TestSceneInterProcessCommunication.cs | 86 +++++++++++++++++++ osu.Game/Tests/Visual/OsuGameTestScene.cs | 2 +- 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Tests/Visual/Navigation/TestSceneInterProcessCommunication.cs diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneInterProcessCommunication.cs b/osu.Game.Tests/Visual/Navigation/TestSceneInterProcessCommunication.cs new file mode 100644 index 0000000000..f5af077696 --- /dev/null +++ b/osu.Game.Tests/Visual/Navigation/TestSceneInterProcessCommunication.cs @@ -0,0 +1,86 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using NUnit.Framework; +using osu.Framework; +using osu.Framework.Allocation; +using osu.Framework.Extensions; +using osu.Framework.Graphics.Containers; +using osu.Framework.Platform; +using osu.Framework.Testing; +using osu.Game.IPC; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; +using osu.Game.Overlays; + +namespace osu.Game.Tests.Visual.Navigation +{ + [TestFixture] + [Ignore("This test cannot be run headless, as it requires the game host running the nested game to have IPC bound.")] + public class TestSceneInterProcessCommunication : OsuGameTestScene + { + private HeadlessGameHost ipcSenderHost = null!; + + private OsuSchemeLinkIPCChannel osuSchemeLinkIPCReceiver = null!; + private OsuSchemeLinkIPCChannel osuSchemeLinkIPCSender = null!; + + private const int requested_beatmap_set_id = 1; + + [Resolved] + private GameHost gameHost { get; set; } = null!; + + public override void SetUpSteps() + { + base.SetUpSteps(); + AddStep("set up request handling", () => + { + ((DummyAPIAccess)API).HandleRequest = request => + { + switch (request) + { + case GetBeatmapSetRequest gbr: + + var apiBeatmapSet = CreateAPIBeatmapSet(); + apiBeatmapSet.OnlineID = requested_beatmap_set_id; + apiBeatmapSet.Beatmaps = apiBeatmapSet.Beatmaps.Append(new APIBeatmap + { + DifficultyName = "Target difficulty", + OnlineID = 75, + }).ToArray(); + gbr.TriggerSuccess(apiBeatmapSet); + return true; + } + + return false; + }; + }); + AddStep("create IPC receiver channel", () => osuSchemeLinkIPCReceiver = new OsuSchemeLinkIPCChannel(gameHost, Game)); + AddStep("create IPC sender channel", () => + { + ipcSenderHost = new HeadlessGameHost(gameHost.Name, new HostOptions { BindIPC = true }); + osuSchemeLinkIPCSender = new OsuSchemeLinkIPCChannel(ipcSenderHost); + }); + } + + [Test] + public void TestOsuSchemeLinkIPCChannel() + { + AddStep("open beatmap via IPC", () => osuSchemeLinkIPCSender.HandleLinkAsync($@"osu://s/{requested_beatmap_set_id}").WaitSafely()); + AddUntilStep("beatmap overlay displayed", () => Game.ChildrenOfType().FirstOrDefault()?.State.Value == Visibility.Visible); + AddUntilStep("beatmap overlay showing content", () => Game.ChildrenOfType().FirstOrDefault()?.Header.BeatmapSet.Value.OnlineID == requested_beatmap_set_id); + } + + public override void TearDownSteps() + { + AddStep("dispose IPC receiver", () => osuSchemeLinkIPCReceiver.Dispose()); + AddStep("dispose IPC sender", () => + { + osuSchemeLinkIPCReceiver.Dispose(); + ipcSenderHost.Dispose(); + }); + base.TearDownSteps(); + } + } +} diff --git a/osu.Game/Tests/Visual/OsuGameTestScene.cs b/osu.Game/Tests/Visual/OsuGameTestScene.cs index df0bdb0a50..b9f6183869 100644 --- a/osu.Game/Tests/Visual/OsuGameTestScene.cs +++ b/osu.Game/Tests/Visual/OsuGameTestScene.cs @@ -75,7 +75,7 @@ namespace osu.Game.Tests.Visual } [TearDownSteps] - public void TearDownSteps() + public virtual void TearDownSteps() { if (DebugUtils.IsNUnitRunning && Game != null) { From 345ae7bbc3ec287f60d5a38fb2202d674aad98b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 21 Jun 2022 00:46:52 +0200 Subject: [PATCH 1792/2328] Fix build errors after implicit NRT enable --- osu.Android/AndroidMouseSettings.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android/AndroidMouseSettings.cs b/osu.Android/AndroidMouseSettings.cs index 7dff929cd4..54b787fd17 100644 --- a/osu.Android/AndroidMouseSettings.cs +++ b/osu.Android/AndroidMouseSettings.cs @@ -20,11 +20,11 @@ namespace osu.Android protected override LocalisableString Header => MouseSettingsStrings.Mouse; - private Bindable handlerSensitivity; + private Bindable handlerSensitivity = null!; - private Bindable localSensitivity; + private Bindable localSensitivity = null!; - private Bindable relativeMode; + private Bindable relativeMode = null!; public AndroidMouseSettings(AndroidMouseHandler mouseHandler) { From 6a2646168334d55582a380860aaa6e61270e6f45 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 21 Jun 2022 12:05:28 +0900 Subject: [PATCH 1793/2328] Compare by reference in ControlPoint.Equals() --- osu.Game/Beatmaps/ControlPoints/ControlPoint.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs index b91d609849..56a432aec4 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs @@ -52,8 +52,12 @@ namespace osu.Game.Beatmaps.ControlPoints && Equals(otherControlPoint); public virtual bool Equals(ControlPoint? other) - => other != null - && Time == other.Time; + { + if (ReferenceEquals(other, null)) return false; + if (ReferenceEquals(other, this)) return true; + + return Time == other.Time; + } // ReSharper disable once NonReadonlyMemberInGetHashCode public override int GetHashCode() => Time.GetHashCode(); From 9763a583924d0a68d3c70e07a144d480f8bf9b01 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 21 Jun 2022 12:05:52 +0900 Subject: [PATCH 1794/2328] Change to use ReferenceEquals --- osu.Game/Screens/Edit/Timing/ControlPointTable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs index b6e3e91c98..b923957273 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs @@ -44,7 +44,7 @@ namespace osu.Game.Screens.Edit.Timing { BackgroundFlow.Add(new RowBackground(group) { - Selected = group.Equals(selectedGroup?.Value), + Selected = ReferenceEquals(group, selectedGroup?.Value), Action = () => { selectedGroup.Value = group; From 93ce6fc98149a28ecc45de1a6dfba7be38fc6ec7 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 21 Jun 2022 12:11:44 +0900 Subject: [PATCH 1795/2328] Remove redundant diff processing --- osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs index 01bc01bf5b..b4647c2b64 100644 --- a/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs +++ b/osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs @@ -41,17 +41,12 @@ namespace osu.Game.Screens.Edit editorBeatmap.BeginChange(); processHitObjects(result, () => newBeatmap ??= readBeatmap(newState)); - processTimingPoints(result, () => newBeatmap ??= readBeatmap(newState)); + processTimingPoints(() => newBeatmap ??= readBeatmap(newState)); editorBeatmap.EndChange(); } - private void processTimingPoints(DiffResult result, Func getNewBeatmap) + private void processTimingPoints(Func getNewBeatmap) { - findChangedIndices(result, LegacyDecoder.Section.TimingPoints, out var removedIndices, out var addedIndices); - - if (removedIndices.Count == 0 && addedIndices.Count == 0) - return; - ControlPointInfo newControlPoints = EditorBeatmap.ConvertControlPoints(getNewBeatmap().ControlPointInfo); // Remove all groups from the current beatmap which don't have a corresponding equal group in the new beatmap. From b3e5642dfdd7298bebfb51d0a9b17211c940d80c Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 21 Jun 2022 12:23:41 +0900 Subject: [PATCH 1796/2328] Use WaitingOnFrames instead --- osu.Game/Screens/Play/SpectatorPlayer.cs | 26 +++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/osu.Game/Screens/Play/SpectatorPlayer.cs b/osu.Game/Screens/Play/SpectatorPlayer.cs index 72a7d3c8a1..797787b194 100644 --- a/osu.Game/Screens/Play/SpectatorPlayer.cs +++ b/osu.Game/Screens/Play/SpectatorPlayer.cs @@ -45,6 +45,20 @@ namespace osu.Game.Screens.Play }); } + protected override void LoadComplete() + { + base.LoadComplete(); + + DrawableRuleset.FrameStableClock.WaitingOnFrames.BindValueChanged(waiting => + { + if (GameplayClockContainer is MasterGameplayClockContainer master) + { + if (master.UserPlaybackRate.Value > 1 && waiting.NewValue) + master.UserPlaybackRate.Value = 1; + } + }, true); + } + protected override void StartGameplay() { base.StartGameplay(); @@ -83,18 +97,6 @@ namespace osu.Game.Screens.Play SetGameplayStartTime(score.Replay.Frames[0].Time); } - protected override void Update() - { - base.Update(); - - if (HUDOverlay.PlayerSettingsOverlay.PlaybackSettings.UserPlaybackRate.Value > 1 - && score.Replay.Frames.Count > 0 - && DrawableRuleset.FrameStableClock.CurrentTime >= score.Replay.Frames[^1].Time) - { - HUDOverlay.PlayerSettingsOverlay.PlaybackSettings.UserPlaybackRate.Value = 1; - } - } - protected override Score CreateScore(IBeatmap beatmap) => score; protected override ResultsScreen CreateResults(ScoreInfo score) From 046b848bcd1c37a18b8ddf2141642a28668f5a6e Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 21 Jun 2022 12:53:06 +0900 Subject: [PATCH 1797/2328] Split group selection to separate method --- osu.Game/Screens/Edit/Timing/ControlPointTable.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs index b923957273..b5c162ab11 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs @@ -44,7 +44,6 @@ namespace osu.Game.Screens.Edit.Timing { BackgroundFlow.Add(new RowBackground(group) { - Selected = ReferenceEquals(group, selectedGroup?.Value), Action = () => { selectedGroup.Value = group; @@ -55,6 +54,8 @@ namespace osu.Game.Screens.Edit.Timing Columns = createHeaders(); Content = value.Select(createContent).ToArray().ToRectangular(); + + updateSelectedGroup(); } } @@ -65,11 +66,17 @@ namespace osu.Game.Screens.Edit.Timing selectedGroup.BindValueChanged(group => { // TODO: This should scroll the selected row into view. - foreach (var b in BackgroundFlow) - b.Selected = ReferenceEquals(b.Item, group.NewValue); + updateSelectedGroup(); }, true); } + private void updateSelectedGroup() + { + // TODO: This should scroll the selected row into view. + foreach (var b in BackgroundFlow) + b.Selected = ReferenceEquals(b.Item, selectedGroup?.Value); + } + private TableColumn[] createHeaders() { var columns = new List From c61e90d7685a9709a74ebcf077b99f66da09a6a3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jun 2022 13:07:50 +0900 Subject: [PATCH 1798/2328] Change editor seek-while-playing modifier to be BPM agnostic --- osu.Game/Screens/Edit/Editor.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index d0d4c0ba1e..7a9dae33b4 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -798,10 +798,11 @@ namespace osu.Game.Screens.Edit if (trackPlaying) { - // generally users are not looking to perform tiny seeks when the track is playing, - // so seeks should always be by one full beat, bypassing the beatDivisor. + // generally users are not looking to perform tiny seeks when the track is playing. // this multiplication undoes the division that will be applied in the underlying seek operation. - amount *= beatDivisor.Value; + // scale by BPM to keep the seek amount constant across all BPMs. + var timingPoint = editorBeatmap.ControlPointInfo.TimingPointAt(clock.CurrentTimeAccurate); + amount *= beatDivisor.Value * (timingPoint.BPM / 120); } if (direction < 1) From 10efb4bc6c0976866261c584aa10885162727bca Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jun 2022 14:08:30 +0900 Subject: [PATCH 1799/2328] Fix incorrect disposal in teardown steps --- .../Visual/Navigation/TestSceneInterProcessCommunication.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneInterProcessCommunication.cs b/osu.Game.Tests/Visual/Navigation/TestSceneInterProcessCommunication.cs index f5af077696..1c2b1fe37d 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneInterProcessCommunication.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneInterProcessCommunication.cs @@ -77,7 +77,7 @@ namespace osu.Game.Tests.Visual.Navigation AddStep("dispose IPC receiver", () => osuSchemeLinkIPCReceiver.Dispose()); AddStep("dispose IPC sender", () => { - osuSchemeLinkIPCReceiver.Dispose(); + osuSchemeLinkIPCSender.Dispose(); ipcSenderHost.Dispose(); }); base.TearDownSteps(); From 88f450e1d0b3e0beb982f74cb1fa4936694098fb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jun 2022 14:40:21 +0900 Subject: [PATCH 1800/2328] Remove accidental `nullable enable` spec --- .../Screens/Utility/SampleComponents/LatencyCursorContainer.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs b/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs index 656aa6a8b3..aaf837eb60 100644 --- a/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs +++ b/osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; From 42701757c340037116441a31b80c2aff9ff2a866 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jun 2022 14:52:57 +0900 Subject: [PATCH 1801/2328] Fix latch reset logic --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 33325951e5..cdfdc096d4 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Threading; using osu.Framework.Timing; using osu.Framework.Utils; using osu.Game.Beatmaps.ControlPoints; @@ -219,6 +220,8 @@ namespace osu.Game.Screens.Edit.Timing private readonly BindableInt interpolatedBpm = new BindableInt(); + private ScheduledDelegate latchDelegate; + protected override void LoadComplete() { base.LoadComplete(); @@ -266,12 +269,9 @@ namespace osu.Game.Screens.Edit.Timing using (swing.BeginDelayedSequence(350)) { swing.RotateTo(0, 1000, Easing.OutQuint); - swing.Delay(250).Schedule(() => - { - // prevent playing latch sound if metronome has started back up again - if (!isSwinging) - latch?.Play(); - }); + + using (swing.BeginDelayedSequence(250)) + latchDelegate = Schedule(() => latch?.Play()); } } } @@ -287,6 +287,9 @@ namespace osu.Game.Screens.Edit.Timing isSwinging = true; + latchDelegate?.Cancel(); + latchDelegate = null; + float currentAngle = swing.Rotation; float targetAngle = currentAngle > 0 ? -angle : angle; From 7b46d383186eb28e3bfd43cbfd2971fd37cb69a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jun 2022 15:02:43 +0900 Subject: [PATCH 1802/2328] Move colour fade back to where it was --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 5a6a478ca1..4aed7527af 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -266,7 +266,6 @@ namespace osu.Game.Screens.Edit.Timing if (BeatSyncSource.Clock?.IsRunning != true && isSwinging) { swing.ClearTransforms(true); - stick.FadeColour(overlayColourProvider.Colour2, 1000, Easing.OutQuint); isSwinging = false; @@ -284,6 +283,7 @@ namespace osu.Game.Screens.Edit.Timing using (swing.BeginDelayedSequence(350)) { swing.RotateTo(0, 1000, Easing.OutQuint); + stick.FadeColour(overlayColourProvider.Colour2, 1000, Easing.OutQuint); using (swing.BeginDelayedSequence(250)) latchDelegate = Schedule(() => latch?.Play()); From 16a9e1881503dbb10f8d4cf885c76ec1a46ef7b6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jun 2022 15:02:53 +0900 Subject: [PATCH 1803/2328] Adjust timing of latch to be more in sync with visuals --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 4aed7527af..62580ac527 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -280,12 +280,12 @@ namespace osu.Game.Screens.Edit.Timing return; } - using (swing.BeginDelayedSequence(350)) + using (BeginDelayedSequence(350)) { swing.RotateTo(0, 1000, Easing.OutQuint); stick.FadeColour(overlayColourProvider.Colour2, 1000, Easing.OutQuint); - using (swing.BeginDelayedSequence(250)) + using (BeginDelayedSequence(380)) latchDelegate = Schedule(() => latch?.Play()); } } From 82c4d855d493f6a36cba8b2c7436a1ecf92c059e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jun 2022 15:05:17 +0900 Subject: [PATCH 1804/2328] Rename sample variable to be easier to discern from other fields --- .../Screens/Edit/Timing/MetronomeDisplay.cs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 62580ac527..22a15a291e 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -37,12 +37,12 @@ namespace osu.Game.Screens.Edit.Timing private IAdjustableClock metronomeClock; - private Sample tick; - private Sample tickDownbeat; - private Sample latch; + private Sample sampleTick; + private Sample sampleTickDownbeat; + private Sample sampleLatch; [CanBeNull] - private ScheduledDelegate clunkDelegate; + private ScheduledDelegate tickPlaybackDelegate; [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } @@ -57,9 +57,9 @@ namespace osu.Game.Screens.Edit.Timing [BackgroundDependencyLoader] private void load(AudioManager audio) { - tick = audio.Samples.Get(@"UI/metronome-tick"); - tickDownbeat = audio.Samples.Get(@"UI/metronome-tick-downbeat"); - latch = audio.Samples.Get(@"UI/metronome-latch"); + sampleTick = audio.Samples.Get(@"UI/metronome-tick"); + sampleTickDownbeat = audio.Samples.Get(@"UI/metronome-tick-downbeat"); + sampleLatch = audio.Samples.Get(@"UI/metronome-latch"); const float taper = 25; const float swing_vertical_offset = -23; @@ -269,14 +269,14 @@ namespace osu.Game.Screens.Edit.Timing isSwinging = false; - clunkDelegate?.Cancel(); - clunkDelegate = null; + tickPlaybackDelegate?.Cancel(); + tickPlaybackDelegate = null; // instantly latch if pendulum arm is close enough to center (to prevent awkward delayed playback of latch sound) if (Precision.AlmostEquals(swing.Rotation, 0, 1)) { swing.RotateTo(0); - latch?.Play(); + sampleLatch?.Play(); return; } @@ -286,7 +286,7 @@ namespace osu.Game.Screens.Edit.Timing stick.FadeColour(overlayColourProvider.Colour2, 1000, Easing.OutQuint); using (BeginDelayedSequence(380)) - latchDelegate = Schedule(() => latch?.Play()); + latchDelegate = Schedule(() => sampleLatch?.Play()); } } } @@ -316,12 +316,12 @@ namespace osu.Game.Screens.Edit.Timing { stick.FlashColour(overlayColourProvider.Content1, beatLength, Easing.OutQuint); - clunkDelegate = Schedule(() => + tickPlaybackDelegate = Schedule(() => { if (!EnableClicking) return; - var channel = beatIndex % timingPoint.TimeSignature.Numerator == 0 ? tickDownbeat?.GetChannel() : tick?.GetChannel(); + var channel = beatIndex % timingPoint.TimeSignature.Numerator == 0 ? sampleTickDownbeat?.GetChannel() : sampleTick?.GetChannel(); if (channel == null) return; From a40ad6f784aa5b16722017176e2c221b226b4908 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jun 2022 15:07:35 +0900 Subject: [PATCH 1805/2328] Add slight transform when resetting arm from almost-zero --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 22a15a291e..37fc38404f 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -275,7 +275,7 @@ namespace osu.Game.Screens.Edit.Timing // instantly latch if pendulum arm is close enough to center (to prevent awkward delayed playback of latch sound) if (Precision.AlmostEquals(swing.Rotation, 0, 1)) { - swing.RotateTo(0); + swing.RotateTo(0, 60, Easing.OutQuint); sampleLatch?.Play(); return; } From 0f6f000188680ec7a375b3b244d7abe8557376ef Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Tue, 21 Jun 2022 09:13:44 +0100 Subject: [PATCH 1806/2328] Remove difficulty spike nerf --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 14d13ec785..71dbc026f2 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -28,6 +28,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private double skillMultiplier => 0.05; private double strainDecayBase => 0.15; protected override double DecayWeight => 1.0; + protected override int ReducedSectionCount => -1; private double currentStrain; From f74b4ac2771edbeee3eebae2148db8a0f8a18508 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jun 2022 17:15:25 +0900 Subject: [PATCH 1807/2328] Fix blocking overhead when calling `WriteAsync` --- osu.Game/Database/RealmAccess.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 865a8b5021..d02f8fe6b2 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -385,11 +385,22 @@ namespace osu.Game.Database /// Write changes to realm asynchronously, guaranteeing order of execution. /// /// The work to run. - public async Task WriteAsync(Action action) + public Task WriteAsync(Action action) { - total_writes_async.Value++; - using (var realm = getRealmInstance()) - await realm.WriteAsync(() => action(realm)); + // Regardless of calling Realm.GetInstance of Realm.GetInstanceAsync, there is a blocking overhead on retrieval. + // Adding a forced Task.Run resolves this. + + return Task.Run(async () => + { + total_writes_async.Value++; + + // Not attempting to use Realm.GetInstanceAsync as there's seemingly no benefit to us (for now) and it adds complexity due to locking + // concerns in getRealmInstance(). On a quick check, it looks to be more suited to cases where realm is connecting to an online sync + // server, which we don't use. May want to report upstream or revisit in the future. + using (var realm = getRealmInstance()) + // ReSharper disable once AccessToDisposedClosure (WriteAsync should be marked as [InstantHandle]). + await realm.WriteAsync(() => action(realm)); + }); } /// From 630bd244d5af115226bac1a25d3e245c193ea571 Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Tue, 21 Jun 2022 10:01:11 +0100 Subject: [PATCH 1808/2328] Inherit StrainSkill instead --- .../Difficulty/Skills/Flashlight.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index 71dbc026f2..f64c218c65 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -6,6 +6,7 @@ using System; using System.Linq; using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Difficulty.Skills; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Difficulty.Evaluators; using osu.Game.Rulesets.Osu.Mods; @@ -15,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills /// /// Represents the skill required to memorise and hit every object in a map with the Flashlight mod enabled. /// - public class Flashlight : OsuStrainSkill + public class Flashlight : StrainSkill { private readonly bool hasHiddenMod; @@ -27,8 +28,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private double skillMultiplier => 0.05; private double strainDecayBase => 0.15; - protected override double DecayWeight => 1.0; - protected override int ReducedSectionCount => -1; private double currentStrain; @@ -43,5 +42,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills return currentStrain; } + + public override double DifficultyValue() + { + double difficulty = GetCurrentStrainPeaks().Sum(); + + // 1.06 comes from the default DifficultyMultiplier field in OsuStrainSkill, + // and it's added here to keep values the same after Flashlight was converted from OsuStrainSkill. + return difficulty * 1.06; + } } } From 043aa82a3195a9724256332e82b90c6d139493e3 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 21 Jun 2022 18:09:00 +0900 Subject: [PATCH 1809/2328] Add test --- .../TestSceneSliderFollowCircleInput.cs | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 osu.Game.Rulesets.Osu.Tests/TestSceneSliderFollowCircleInput.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderFollowCircleInput.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderFollowCircleInput.cs new file mode 100644 index 0000000000..7a6e19575e --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderFollowCircleInput.cs @@ -0,0 +1,120 @@ +// 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.Linq; +using NUnit.Framework; +using osu.Framework.Screens; +using osu.Framework.Testing; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Replays; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Replays; +using osu.Game.Rulesets.Replays; +using osu.Game.Rulesets.Scoring; +using osu.Game.Scoring; +using osu.Game.Screens.Play; +using osu.Game.Tests.Visual; +using osuTK; + +namespace osu.Game.Rulesets.Osu.Tests +{ + [HeadlessTest] + public class TestSceneSliderFollowCircleInput : RateAdjustedBeatmapTestScene + { + private List? judgementResults; + private ScoreAccessibleReplayPlayer? currentPlayer; + + [Test] + public void TestMaximumDistanceTrackingWithoutMovement( + [Values(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)] + float circleSize, + [Values(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)] + double velocity) + { + const double time_slider_start = 1000; + + float circleRadius = OsuHitObject.OBJECT_RADIUS * (1.0f - 0.7f * (circleSize - 5) / 5) / 2; + float followCircleRadius = circleRadius * 1.2f; + + performTest(new Beatmap + { + HitObjects = + { + new Slider + { + StartTime = time_slider_start, + Position = new Vector2(0, 0), + DifficultyControlPoint = new DifficultyControlPoint { SliderVelocity = velocity }, + Path = new SliderPath(PathType.Linear, new[] + { + Vector2.Zero, + new Vector2(followCircleRadius, 0), + }, followCircleRadius), + }, + }, + BeatmapInfo = + { + Difficulty = new BeatmapDifficulty + { + CircleSize = circleSize, + SliderTickRate = 1 + }, + Ruleset = new OsuRuleset().RulesetInfo + }, + }, new List + { + new OsuReplayFrame { Position = new Vector2(-circleRadius + 1, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start }, + }); + + AddAssert("Tracking kept", assertMaxJudge); + } + + private bool assertMaxJudge() => judgementResults?.Any() == true && judgementResults.All(t => t.Type == t.Judgement.MaxResult); + + private void performTest(Beatmap beatmap, List frames) + { + AddStep("load player", () => + { + Beatmap.Value = CreateWorkingBeatmap(beatmap); + + var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } }); + + p.OnLoadComplete += _ => + { + p.ScoreProcessor.NewJudgement += result => + { + if (currentPlayer == p) judgementResults?.Add(result); + }; + }; + + LoadScreen(currentPlayer = p); + judgementResults = new List(); + }); + + AddUntilStep("Beatmap at 0", () => Beatmap.Value.Track.CurrentTime == 0); + AddUntilStep("Wait until player is loaded", () => currentPlayer.IsCurrentScreen()); + AddUntilStep("Wait for completion", () => currentPlayer?.ScoreProcessor.HasCompleted.Value == true); + } + + private class ScoreAccessibleReplayPlayer : ReplayPlayer + { + public new ScoreProcessor ScoreProcessor => base.ScoreProcessor; + + protected override bool PauseOnFocusLost => false; + + public ScoreAccessibleReplayPlayer(Score score) + : base(score, new PlayerConfiguration + { + AllowPause = false, + ShowResults = false, + }) + { + } + } + } +} From ede5ca31a1a40bda61922301f625997ca687ae48 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 21 Jun 2022 18:09:23 +0900 Subject: [PATCH 1810/2328] Always track final follow circle size --- osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs | 7 ------ .../Skinning/Default/SliderBall.cs | 25 ++++++++----------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs b/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs index 8a15d730cd..00009f4c3d 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs @@ -30,9 +30,6 @@ namespace osu.Game.Rulesets.Osu.Mods [SettingSource("Apply classic note lock", "Applies note lock to the full hit window.")] public Bindable ClassicNoteLock { get; } = new BindableBool(true); - [SettingSource("Use fixed slider follow circle hit area", "Makes the slider follow circle track its final size at all times.")] - public Bindable FixedFollowCircleHitArea { get; } = new BindableBool(true); - [SettingSource("Always play a slider's tail sample", "Always plays a slider's tail sample regardless of whether it was hit or not.")] public Bindable AlwaysPlayTailSample { get; } = new BindableBool(true); @@ -62,10 +59,6 @@ namespace osu.Game.Rulesets.Osu.Mods { switch (obj) { - case DrawableSlider slider: - slider.Ball.InputTracksVisualSize = !FixedFollowCircleHitArea.Value; - break; - case DrawableSliderHead head: head.TrackFollowCircle = !NoSliderHeadMovement.Value; break; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs index d2ea8f1660..389e9343e7 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs @@ -34,13 +34,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default set => ball.Colour = value; } - /// - /// Whether to track accurately to the visual size of this . - /// If false, tracking will be performed at the final scale at all times. - /// - public bool InputTracksVisualSize = true; - private readonly Drawable followCircle; + private readonly Drawable fullSizeFollowCircle; private readonly DrawableSlider drawableSlider; private readonly Drawable ball; @@ -62,6 +57,13 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default Alpha = 0, Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SliderFollowCircle), _ => new DefaultFollowCircle()), }, + fullSizeFollowCircle = new CircularContainer + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Masking = true + }, ball = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SliderBall), _ => new DefaultSliderBall()) { Anchor = Anchor.Centre, @@ -104,14 +106,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default tracking = value; - if (InputTracksVisualSize) - followCircle.ScaleTo(tracking ? 2.4f : 1f, 300, Easing.OutQuint); - else - { - // We need to always be tracking the final size, at both endpoints. For now, this is achieved by removing the scale duration. - followCircle.ScaleTo(tracking ? 2.4f : 1f); - } + fullSizeFollowCircle.Scale = new Vector2(tracking ? 2.4f : 1f); + followCircle.ScaleTo(tracking ? 2.4f : 1f, 300, Easing.OutQuint); followCircle.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint); } } @@ -170,7 +167,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default // in valid time range Time.Current >= drawableSlider.HitObject.StartTime && Time.Current < drawableSlider.HitObject.EndTime && // in valid position range - lastScreenSpaceMousePosition.HasValue && followCircle.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) && + lastScreenSpaceMousePosition.HasValue && fullSizeFollowCircle.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) && // valid action (actions?.Any(isValidTrackingAction) ?? false); From 2e3d8d7e5d347a45e6cf97476beb7444f82dd1fc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jun 2022 18:13:14 +0900 Subject: [PATCH 1811/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index c82365d750..caea787e22 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index d820be4bdc..652dc2740f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index a8c59d676d..0c3c38f9f0 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From a7de43ade6459fe63d85f75d40cb7ea08b7d7e81 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 21 Jun 2022 19:31:44 +0900 Subject: [PATCH 1812/2328] Add attribute ID --- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs | 2 ++ osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs index 72c9608697..b24ff54b8a 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs @@ -101,6 +101,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty yield return (ATTRIB_ID_FLASHLIGHT, FlashlightDifficulty); yield return (ATTRIB_ID_SLIDER_FACTOR, SliderFactor); + yield return (ATTRIB_ID_SPEED_NOTE_COUNT, SpeedNoteCount); } public override void FromDatabaseAttributes(IReadOnlyDictionary values) @@ -115,6 +116,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty StarRating = values[ATTRIB_ID_DIFFICULTY]; FlashlightDifficulty = values.GetValueOrDefault(ATTRIB_ID_FLASHLIGHT); SliderFactor = values[ATTRIB_ID_SLIDER_FACTOR]; + SpeedNoteCount = values[ATTRIB_ID_SPEED_NOTE_COUNT]; } #region Newtonsoft.Json implicit ShouldSerialize() methods diff --git a/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs b/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs index e0844a5c8a..90c8f94ed0 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs @@ -26,6 +26,7 @@ namespace osu.Game.Rulesets.Difficulty protected const int ATTRIB_ID_SCORE_MULTIPLIER = 15; protected const int ATTRIB_ID_FLASHLIGHT = 17; protected const int ATTRIB_ID_SLIDER_FACTOR = 19; + protected const int ATTRIB_ID_SPEED_NOTE_COUNT = 21; /// /// The mods which were applied to the beatmap. From 73124d2b1fb09523ac8b16ea1d86c6cd1ef3cb1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 21 Jun 2022 12:49:01 +0200 Subject: [PATCH 1813/2328] Encapsulate mod hotkey selection logic in strategy pattern --- .../UserInterface/TestSceneModColumn.cs | 2 +- .../Overlays/Mods/Input/IModHotkeyHandler.cs | 22 +++++++ .../Overlays/Mods/Input/ModHotkeyHandler.cs | 30 ++++++++++ .../Mods/Input/NoopModHotkeyHandler.cs | 17 ++++++ .../Mods/Input/SequentialModHotkeyHandler.cs | 58 +++++++++++++++++++ osu.Game/Overlays/Mods/ModColumn.cs | 21 +++---- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 13 ++--- .../Overlays/Mods/UserModSelectOverlay.cs | 10 +--- .../OnlinePlay/FreeModSelectOverlay.cs | 3 +- 9 files changed, 145 insertions(+), 31 deletions(-) create mode 100644 osu.Game/Overlays/Mods/Input/IModHotkeyHandler.cs create mode 100644 osu.Game/Overlays/Mods/Input/ModHotkeyHandler.cs create mode 100644 osu.Game/Overlays/Mods/Input/NoopModHotkeyHandler.cs create mode 100644 osu.Game/Overlays/Mods/Input/SequentialModHotkeyHandler.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs index 50817bf804..f98f39d445 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs @@ -139,7 +139,7 @@ namespace osu.Game.Tests.Visual.UserInterface { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(30), - Child = column = new ModColumn(ModType.DifficultyReduction, true, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }) + Child = column = new ModColumn(ModType.DifficultyReduction, true) { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Overlays/Mods/Input/IModHotkeyHandler.cs b/osu.Game/Overlays/Mods/Input/IModHotkeyHandler.cs new file mode 100644 index 0000000000..aec16ff764 --- /dev/null +++ b/osu.Game/Overlays/Mods/Input/IModHotkeyHandler.cs @@ -0,0 +1,22 @@ +// 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 osuTK.Input; + +namespace osu.Game.Overlays.Mods.Input +{ + /// + /// Encapsulates strategies of handling mod hotkeys on the . + /// + public interface IModHotkeyHandler + { + /// + /// Attempt to handle a press of the supplied as a selection of one of the mods in . + /// + /// The key that was pressed by the user. + /// The list of currently available mods. + /// Whether the was handled as a mod selection/deselection. + bool HandleHotkeyPressed(Key hotkey, IEnumerable availableMods); + } +} diff --git a/osu.Game/Overlays/Mods/Input/ModHotkeyHandler.cs b/osu.Game/Overlays/Mods/Input/ModHotkeyHandler.cs new file mode 100644 index 0000000000..22de557979 --- /dev/null +++ b/osu.Game/Overlays/Mods/Input/ModHotkeyHandler.cs @@ -0,0 +1,30 @@ +// 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.Rulesets.Mods; + +namespace osu.Game.Overlays.Mods.Input +{ + /// + /// Static factory class for s. + /// + public static class ModHotkeyHandler + { + /// + /// Creates an appropriate for the given . + /// + public static IModHotkeyHandler Create(ModType modType) + { + switch (modType) + { + case ModType.DifficultyReduction: + case ModType.DifficultyIncrease: + case ModType.Automation: + return SequentialModHotkeyHandler.Create(modType); + + default: + return new NoopModHotkeyHandler(); + } + } + } +} diff --git a/osu.Game/Overlays/Mods/Input/NoopModHotkeyHandler.cs b/osu.Game/Overlays/Mods/Input/NoopModHotkeyHandler.cs new file mode 100644 index 0000000000..81152226da --- /dev/null +++ b/osu.Game/Overlays/Mods/Input/NoopModHotkeyHandler.cs @@ -0,0 +1,17 @@ +// 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 osuTK.Input; + +namespace osu.Game.Overlays.Mods.Input +{ + /// + /// A no-op implementation of . + /// Used when a column is not handling any hotkeys at all. + /// + public class NoopModHotkeyHandler : IModHotkeyHandler + { + public bool HandleHotkeyPressed(Key hotkey, IEnumerable availableMods) => false; + } +} diff --git a/osu.Game/Overlays/Mods/Input/SequentialModHotkeyHandler.cs b/osu.Game/Overlays/Mods/Input/SequentialModHotkeyHandler.cs new file mode 100644 index 0000000000..45cfa60fff --- /dev/null +++ b/osu.Game/Overlays/Mods/Input/SequentialModHotkeyHandler.cs @@ -0,0 +1,58 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.Linq; +using osu.Game.Rulesets.Mods; +using osuTK.Input; + +namespace osu.Game.Overlays.Mods.Input +{ + /// + /// This implementation of receives a sequence of s, + /// and maps the sequence of keys onto the items it is provided in . + /// In this case, particular mods are not bound to particular keys, the hotkeys are a byproduct of mod ordering. + /// + public class SequentialModHotkeyHandler : IModHotkeyHandler + { + public static SequentialModHotkeyHandler Create(ModType modType) + { + switch (modType) + { + case ModType.DifficultyReduction: + return new SequentialModHotkeyHandler(new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }); + + case ModType.DifficultyIncrease: + return new SequentialModHotkeyHandler(new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }); + + case ModType.Automation: + return new SequentialModHotkeyHandler(new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }); + + default: + throw new ArgumentOutOfRangeException(nameof(modType), modType, $"Cannot create {nameof(SequentialModHotkeyHandler)} for provided mod type"); + } + } + + private readonly Key[] toggleKeys; + + private SequentialModHotkeyHandler(Key[] keys) + { + toggleKeys = keys; + } + + public bool HandleHotkeyPressed(Key hotkey, IEnumerable availableMods) + { + int index = Array.IndexOf(toggleKeys, hotkey); + if (index < 0) + return false; + + var modState = availableMods.ElementAtOrDefault(index); + if (modState == null || modState.Filtered.Value) + return false; + + modState.Active.Toggle(); + return true; + } + } +} diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 563e9a8d55..998437a0a0 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -21,10 +21,10 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; +using osu.Game.Overlays.Mods.Input; using osu.Game.Rulesets.Mods; using osuTK; using osuTK.Graphics; -using osuTK.Input; namespace osu.Game.Overlays.Mods { @@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Mods protected virtual ModPanel CreateModPanel(ModState mod) => new ModPanel(mod); - private readonly Key[]? toggleKeys; + private readonly IModHotkeyHandler hotkeyHandler; private readonly TextFlowContainer headerText; private readonly Box headerBackground; @@ -86,10 +86,10 @@ namespace osu.Game.Overlays.Mods private const float header_height = 42; - public ModColumn(ModType modType, bool allowBulkSelection, Key[]? toggleKeys = null) + public ModColumn(ModType modType, bool allowBulkSelection) { ModType = modType; - this.toggleKeys = toggleKeys; + hotkeyHandler = ModHotkeyHandler.Create(modType); Width = 320; RelativeSizeAxes = Axes.Y; @@ -425,17 +425,10 @@ namespace osu.Game.Overlays.Mods protected override bool OnKeyDown(KeyDownEvent e) { - if (e.ControlPressed || e.AltPressed || e.SuperPressed) return false; - if (toggleKeys == null) return false; + if (e.ControlPressed || e.AltPressed || e.SuperPressed || e.Repeat) + return false; - int index = Array.IndexOf(toggleKeys, e.Key); - if (index < 0) return false; - - var modState = availableMods.ElementAtOrDefault(index); - if (modState == null || modState.Filtered.Value) return false; - - modState.Active.Toggle(); - return true; + return hotkeyHandler.HandleHotkeyPressed(e.Key, availableMods); } #endregion diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index ad02f079a5..811db393d6 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -21,7 +21,6 @@ using osu.Game.Localisation; using osu.Game.Rulesets.Mods; using osu.Game.Utils; using osuTK; -using osuTK.Input; namespace osu.Game.Overlays.Mods { @@ -68,7 +67,7 @@ namespace osu.Game.Overlays.Mods /// protected virtual bool AllowCustomisation => true; - protected virtual ModColumn CreateModColumn(ModType modType, Key[]? toggleKeys = null) => new ModColumn(modType, false, toggleKeys); + protected virtual ModColumn CreateModColumn(ModType modType) => new ModColumn(modType, false); protected virtual IReadOnlyList ComputeNewModsFromSelection(IReadOnlyList oldSelection, IReadOnlyList newSelection) => newSelection; @@ -160,9 +159,9 @@ namespace osu.Game.Overlays.Mods Padding = new MarginPadding { Bottom = 10 }, Children = new[] { - createModColumnContent(ModType.DifficultyReduction, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }), - createModColumnContent(ModType.DifficultyIncrease, new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }), - createModColumnContent(ModType.Automation, new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }), + createModColumnContent(ModType.DifficultyReduction), + createModColumnContent(ModType.DifficultyIncrease), + createModColumnContent(ModType.Automation), createModColumnContent(ModType.Conversion), createModColumnContent(ModType.Fun) } @@ -264,9 +263,9 @@ namespace osu.Game.Overlays.Mods column.DeselectAll(); } - private ColumnDimContainer createModColumnContent(ModType modType, Key[]? toggleKeys = null) + private ColumnDimContainer createModColumnContent(ModType modType) { - var column = CreateModColumn(modType, toggleKeys).With(column => + var column = CreateModColumn(modType).With(column => { // spacing applied here rather than via `columnFlow.Spacing` to avoid uneven gaps when some of the columns are hidden. column.Margin = new MarginPadding { Right = 10 }; diff --git a/osu.Game/Overlays/Mods/UserModSelectOverlay.cs b/osu.Game/Overlays/Mods/UserModSelectOverlay.cs index b8f4b8a196..a292a50b72 100644 --- a/osu.Game/Overlays/Mods/UserModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/UserModSelectOverlay.cs @@ -1,14 +1,10 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using System.Linq; -using JetBrains.Annotations; using osu.Game.Rulesets.Mods; using osu.Game.Utils; -using osuTK.Input; namespace osu.Game.Overlays.Mods { @@ -19,7 +15,7 @@ namespace osu.Game.Overlays.Mods { } - protected override ModColumn CreateModColumn(ModType modType, Key[] toggleKeys = null) => new UserModColumn(modType, false, toggleKeys); + protected override ModColumn CreateModColumn(ModType modType) => new UserModColumn(modType, false); protected override IReadOnlyList ComputeNewModsFromSelection(IReadOnlyList oldSelection, IReadOnlyList newSelection) { @@ -44,8 +40,8 @@ namespace osu.Game.Overlays.Mods private class UserModColumn : ModColumn { - public UserModColumn(ModType modType, bool allowBulkSelection, [CanBeNull] Key[] toggleKeys = null) - : base(modType, allowBulkSelection, toggleKeys) + public UserModColumn(ModType modType, bool allowBulkSelection) + : base(modType, allowBulkSelection) { } diff --git a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs index c27b78642a..0f02692eda 100644 --- a/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; using osu.Game.Rulesets.Mods; -using osuTK.Input; namespace osu.Game.Screens.OnlinePlay { @@ -33,7 +32,7 @@ namespace osu.Game.Screens.OnlinePlay IsValidMod = _ => true; } - protected override ModColumn CreateModColumn(ModType modType, Key[] toggleKeys = null) => new ModColumn(modType, true, toggleKeys); + protected override ModColumn CreateModColumn(ModType modType) => new ModColumn(modType, true); protected override IEnumerable CreateFooterButtons() => base.CreateFooterButtons().Prepend( new SelectAllModsButton(this) From 816fd338cb8cd4143242053d415783ccee08e4fd Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 21 Jun 2022 19:57:27 +0900 Subject: [PATCH 1814/2328] Fix typo --- osu.Game/Database/RealmAccess.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index d02f8fe6b2..cf9109eb8b 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -387,7 +387,7 @@ namespace osu.Game.Database /// The work to run. public Task WriteAsync(Action action) { - // Regardless of calling Realm.GetInstance of Realm.GetInstanceAsync, there is a blocking overhead on retrieval. + // Regardless of calling Realm.GetInstance or Realm.GetInstanceAsync, there is a blocking overhead on retrieval. // Adding a forced Task.Run resolves this. return Task.Run(async () => From f2eb7e055166bcf08c5cf2cbeeeb280498a2275a Mon Sep 17 00:00:00 2001 From: cdwcgt Date: Tue, 21 Jun 2022 19:06:38 +0800 Subject: [PATCH 1815/2328] Use better design and fix some problem Let saveReplay async but still void Make failed score's rank = F --- osu.Game/Screens/Play/FailOverlay.cs | 42 ++++++++++++++++- osu.Game/Screens/Play/Player.cs | 13 +++--- .../Screens/Play/SaveFailedScoreButton.cs | 45 +++++++++++++++++++ 3 files changed, 92 insertions(+), 8 deletions(-) create mode 100644 osu.Game/Screens/Play/SaveFailedScoreButton.cs diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 1b9d81d33b..881791271b 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -5,8 +5,14 @@ using System; using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; +using osuTK; using osuTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; namespace osu.Game.Screens.Play { @@ -21,7 +27,41 @@ namespace osu.Game.Screens.Play { AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke()); AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke()); - AddButton("Save replay and Quit", colours.Blue, () => SaveReplay?.Invoke()); + // from #10339 maybe this is a better visual effect + Add(new Container + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + Height = TwoLayerButton.SIZE_EXTENDED.Y, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4Extensions.FromHex("#333") + }, + new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Y, + Spacing = new Vector2(5), + Padding = new MarginPadding(10), + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + new SaveFailedScoreButton() + { + OnSave = SaveReplay, + RelativeSizeAxes = Axes.Y, + Width = 300 + }, + } + } + } + }); } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index d38c10c071..8223ed1e3d 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -266,7 +266,7 @@ namespace osu.Game.Screens.Play }, FailOverlay = new FailOverlay { - SaveReplay = saveReplay, + SaveReplay = saveFailedReplay, OnRetry = Restart, OnQuit = () => PerformExit(true), }, @@ -1024,8 +1024,7 @@ namespace osu.Game.Screens.Play if (prepareScoreForDisplayTask == null) { Score.ScoreInfo.Passed = false; - // potentially should be ScoreRank.F instead? this is the best alternative for now. - Score.ScoreInfo.Rank = ScoreRank.D; + Score.ScoreInfo.Rank = ScoreRank.F; } // EndPlaying() is typically called from ReplayRecorder.Dispose(). Disposal is currently asynchronous. @@ -1044,20 +1043,20 @@ namespace osu.Game.Screens.Play return base.OnExiting(e); } - private void saveReplay() + private async void saveFailedReplay() { + Score.ScoreInfo.Passed = false; + Score.ScoreInfo.Rank = ScoreRank.F; var scoreCopy = Score.DeepClone(); try { - ImportScore(scoreCopy).ConfigureAwait(false); + await ImportScore(scoreCopy).ConfigureAwait(false); } catch (Exception ex) { Logger.Error(ex, @"Score import failed!"); } - - PerformExit(true); } /// diff --git a/osu.Game/Screens/Play/SaveFailedScoreButton.cs b/osu.Game/Screens/Play/SaveFailedScoreButton.cs new file mode 100644 index 0000000000..1c198421ab --- /dev/null +++ b/osu.Game/Screens/Play/SaveFailedScoreButton.cs @@ -0,0 +1,45 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Game.Graphics.UserInterface; +using osu.Game.Online; + +namespace osu.Game.Screens.Play +{ + public class SaveFailedScoreButton : DownloadButton + { + public Action? OnSave; + + [BackgroundDependencyLoader] + private void load() + { + State.BindValueChanged(updateTooltip, true); + Action = saveScore; + } + + private void saveScore() + { + if (State.Value != DownloadState.LocallyAvailable) + OnSave?.Invoke(); + + State.Value = DownloadState.LocallyAvailable; + } + + private void updateTooltip(ValueChangedEvent state) + { + switch (state.NewValue) + { + case DownloadState.LocallyAvailable: + TooltipText = @"Score saved"; + break; + + default: + TooltipText = @"Save score"; + break; + } + } + } +} From 5abd8a07d2ba2dcea0ab6e0c80b8cca8cc714a7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 21 Jun 2022 13:03:46 +0200 Subject: [PATCH 1816/2328] Add setting for changing mod select hotkey style --- osu.Game/Configuration/OsuConfigManager.cs | 3 +++ osu.Game/Localisation/UserInterfaceStrings.cs | 5 ++++ .../Mods/Input/ModSelectHotkeyStyle.cs | 27 +++++++++++++++++++ .../UserInterface/SongSelectSettings.cs | 7 +++++ 4 files changed, 42 insertions(+) create mode 100644 osu.Game/Overlays/Mods/Input/ModSelectHotkeyStyle.cs diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index a0e1d9ddc4..713166a9a0 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -20,6 +20,7 @@ using osu.Game.Input; using osu.Game.Input.Bindings; using osu.Game.Localisation; using osu.Game.Overlays; +using osu.Game.Overlays.Mods.Input; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Filter; @@ -47,6 +48,7 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.SongSelectSortingMode, SortMode.Title); SetDefault(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation); + SetDefault(OsuSetting.ModSelectHotkeyStyle, ModSelectHotkeyStyle.Sequential); SetDefault(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2f, 1f); @@ -324,6 +326,7 @@ namespace osu.Game.Configuration SongSelectGroupingMode, SongSelectSortingMode, RandomSelectAlgorithm, + ModSelectHotkeyStyle, ShowFpsDisplay, ChatDisplayHeight, BeatmapListingCardSize, diff --git a/osu.Game/Localisation/UserInterfaceStrings.cs b/osu.Game/Localisation/UserInterfaceStrings.cs index 4e7af99ce9..a007f760d8 100644 --- a/osu.Game/Localisation/UserInterfaceStrings.cs +++ b/osu.Game/Localisation/UserInterfaceStrings.cs @@ -106,6 +106,11 @@ namespace osu.Game.Localisation /// public static LocalisableString RandomSelectionAlgorithm => new TranslatableString(getKey(@"random_selection_algorithm"), @"Random selection algorithm"); + /// + /// "Mod select hotkey style" + /// + public static LocalisableString ModSelectHotkeyStyle => new TranslatableString(getKey(@"mod_select_hotkey_style"), @"Mod select hotkey style"); + /// /// "no limit" /// diff --git a/osu.Game/Overlays/Mods/Input/ModSelectHotkeyStyle.cs b/osu.Game/Overlays/Mods/Input/ModSelectHotkeyStyle.cs new file mode 100644 index 0000000000..6375b37f8b --- /dev/null +++ b/osu.Game/Overlays/Mods/Input/ModSelectHotkeyStyle.cs @@ -0,0 +1,27 @@ +// 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.Rulesets.Mods; + +namespace osu.Game.Overlays.Mods.Input +{ + /// + /// The style of hotkey handling to use on the mod select screen. + /// + public enum ModSelectHotkeyStyle + { + /// + /// Each letter row on the keyboard controls one of the three first s. + /// Individual letters in a row trigger the mods in a sequential fashion. + /// Uses . + /// + Sequential, + + /// + /// Matches keybindings from stable 1:1. + /// One keybinding can toggle between what used to be s on stable, + /// and some mods in a column may not have any hotkeys at all. + /// + Classic + } +} diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs index 8cec7bbb30..507e116723 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs @@ -11,6 +11,7 @@ using osu.Framework.Localisation; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; +using osu.Game.Overlays.Mods.Input; namespace osu.Game.Overlays.Settings.Sections.UserInterface { @@ -61,6 +62,12 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface { LabelText = UserInterfaceStrings.RandomSelectionAlgorithm, Current = config.GetBindable(OsuSetting.RandomSelectAlgorithm), + }, + new SettingsEnumDropdown + { + LabelText = UserInterfaceStrings.ModSelectHotkeyStyle, + Current = config.GetBindable(OsuSetting.ModSelectHotkeyStyle), + ClassicDefault = ModSelectHotkeyStyle.Classic } }; } From 658f5341c7b6b8717ac82fb5dea1a17129b6ebad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 21 Jun 2022 13:10:22 +0200 Subject: [PATCH 1817/2328] Set up flow for switching between hotkey styles --- .../Visual/UserInterface/TestSceneModColumn.cs | 9 ++++++++- .../Mods/Input/ClassicModHotkeyHandler.cs | 16 ++++++++++++++++ osu.Game/Overlays/Mods/Input/ModHotkeyHandler.cs | 6 ++++-- osu.Game/Overlays/Mods/ModColumn.cs | 10 +++++++--- 4 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs index f98f39d445..d992f1aa05 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs @@ -9,9 +9,11 @@ using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; +using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; using osu.Game.Overlays.Mods; +using osu.Game.Overlays.Mods.Input; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; using osu.Game.Utils; @@ -25,6 +27,9 @@ namespace osu.Game.Tests.Visual.UserInterface [Cached] private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); + [Resolved] + private OsuConfigManager configManager { get; set; } = null!; + [TestCase(ModType.DifficultyReduction)] [TestCase(ModType.DifficultyIncrease)] [TestCase(ModType.Conversion)] @@ -132,8 +137,10 @@ namespace osu.Game.Tests.Visual.UserInterface } [Test] - public void TestKeyboardSelection() + public void TestSequentialKeyboardSelection() { + AddStep("set sequential hotkey mode", () => configManager.SetValue(OsuSetting.ModSelectHotkeyStyle, ModSelectHotkeyStyle.Sequential)); + ModColumn column = null!; AddStep("create content", () => Child = new Container { diff --git a/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs b/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs new file mode 100644 index 0000000000..1dd732b79c --- /dev/null +++ b/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs @@ -0,0 +1,16 @@ +// 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 osuTK.Input; + +namespace osu.Game.Overlays.Mods.Input +{ + /// + /// Uses bindings from stable 1:1. + /// + public class ClassicModHotkeyHandler : IModHotkeyHandler + { + public bool HandleHotkeyPressed(Key hotkey, IEnumerable availableMods) => false; // TODO + } +} diff --git a/osu.Game/Overlays/Mods/Input/ModHotkeyHandler.cs b/osu.Game/Overlays/Mods/Input/ModHotkeyHandler.cs index 22de557979..5c46b2065f 100644 --- a/osu.Game/Overlays/Mods/Input/ModHotkeyHandler.cs +++ b/osu.Game/Overlays/Mods/Input/ModHotkeyHandler.cs @@ -13,14 +13,16 @@ namespace osu.Game.Overlays.Mods.Input /// /// Creates an appropriate for the given . /// - public static IModHotkeyHandler Create(ModType modType) + public static IModHotkeyHandler Create(ModType modType, ModSelectHotkeyStyle style) { switch (modType) { case ModType.DifficultyReduction: case ModType.DifficultyIncrease: case ModType.Automation: - return SequentialModHotkeyHandler.Create(modType); + return style == ModSelectHotkeyStyle.Sequential + ? (IModHotkeyHandler)SequentialModHotkeyHandler.Create(modType) + : new ClassicModHotkeyHandler(); default: return new NoopModHotkeyHandler(); diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 998437a0a0..cf3d354d47 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -17,6 +17,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; +using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -70,7 +71,8 @@ namespace osu.Game.Overlays.Mods protected virtual ModPanel CreateModPanel(ModState mod) => new ModPanel(mod); - private readonly IModHotkeyHandler hotkeyHandler; + private Bindable hotkeyStyle = null!; + private IModHotkeyHandler hotkeyHandler = null!; private readonly TextFlowContainer headerText; private readonly Box headerBackground; @@ -89,7 +91,6 @@ namespace osu.Game.Overlays.Mods public ModColumn(ModType modType, bool allowBulkSelection) { ModType = modType; - hotkeyHandler = ModHotkeyHandler.Create(modType); Width = 320; RelativeSizeAxes = Axes.Y; @@ -231,7 +232,7 @@ namespace osu.Game.Overlays.Mods } [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider, OsuColour colours) + private void load(OverlayColourProvider colourProvider, OsuColour colours, OsuConfigManager configManager) { headerBackground.Colour = accentColour = colours.ForModType(ModType); @@ -243,6 +244,8 @@ namespace osu.Game.Overlays.Mods contentContainer.BorderColour = ColourInfo.GradientVertical(colourProvider.Background4, colourProvider.Background3); contentBackground.Colour = colourProvider.Background4; + + hotkeyStyle = configManager.GetBindable(OsuSetting.ModSelectHotkeyStyle); } protected override void LoadComplete() @@ -250,6 +253,7 @@ namespace osu.Game.Overlays.Mods base.LoadComplete(); toggleAllCheckbox?.Current.BindValueChanged(_ => updateToggleAllText(), true); + hotkeyStyle.BindValueChanged(val => hotkeyHandler = ModHotkeyHandler.Create(ModType, val.NewValue), true); asyncLoadPanels(); } From 143c8e8da679b156868c40d7b72ffca2b011977b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 21 Jun 2022 13:33:33 +0200 Subject: [PATCH 1818/2328] Add test scene for desired classic selection behaviour --- .../UserInterface/TestSceneModColumn.cs | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs index d992f1aa05..25e99ac24b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs @@ -178,6 +178,56 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("clear filter", () => setFilter(null)); } + [Test] + public void TestClassicKeyboardSelection() + { + AddStep("set classic hotkey mode", () => configManager.SetValue(OsuSetting.ModSelectHotkeyStyle, ModSelectHotkeyStyle.Classic)); + + ModColumn column = null!; + AddStep("create content", () => Child = new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(30), + Child = column = new ModColumn(ModType.DifficultyIncrease, true) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AvailableMods = getExampleModsFor(ModType.DifficultyIncrease) + } + }); + + AddUntilStep("wait for panel load", () => column.IsLoaded && column.ItemsLoaded); + + AddStep("press A", () => InputManager.Key(Key.A)); + AddAssert("HR panel selected", () => this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "HR").Active.Value); + + AddStep("press A again", () => InputManager.Key(Key.A)); + AddAssert("HR panel deselected", () => !this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "HR").Active.Value); + + AddStep("press D", () => InputManager.Key(Key.D)); + AddAssert("DT panel selected", () => this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "DT").Active.Value); + + AddStep("press D again", () => InputManager.Key(Key.D)); + AddAssert("DT panel deselected", () => !this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "DT").Active.Value); + AddAssert("NC panel selected", () => this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "NC").Active.Value); + + AddStep("press D again", () => InputManager.Key(Key.D)); + AddAssert("DT panel deselected", () => !this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "DT").Active.Value); + AddAssert("NC panel deselected", () => !this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "NC").Active.Value); + + AddStep("press Shift-D", () => + { + InputManager.PressKey(Key.ShiftLeft); + InputManager.Key(Key.D); + InputManager.ReleaseKey(Key.ShiftLeft); + }); + AddAssert("DT panel deselected", () => !this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "DT").Active.Value); + AddAssert("NC panel selected", () => this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "NC").Active.Value); + + AddStep("press J", () => InputManager.Key(Key.J)); + AddAssert("no change", () => this.ChildrenOfType().Single(panel => panel.Active.Value).Mod.Acronym == "NC"); + } + private void setFilter(Func? filter) { foreach (var modState in this.ChildrenOfType().Single().AvailableMods) From 234120ff43ec16c09f394067b8e7c5d67330135b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 21 Jun 2022 13:37:17 +0200 Subject: [PATCH 1819/2328] Forward entire event to `IModHotkeyHandler` Required for shift handling in the classic implementation. --- .../Overlays/Mods/Input/ClassicModHotkeyHandler.cs | 4 ++-- osu.Game/Overlays/Mods/Input/IModHotkeyHandler.cs | 10 +++++----- osu.Game/Overlays/Mods/Input/NoopModHotkeyHandler.cs | 4 ++-- .../Overlays/Mods/Input/SequentialModHotkeyHandler.cs | 5 +++-- osu.Game/Overlays/Mods/ModColumn.cs | 2 +- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs b/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs index 1dd732b79c..e22ad13451 100644 --- a/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs +++ b/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using osuTK.Input; +using osu.Framework.Input.Events; namespace osu.Game.Overlays.Mods.Input { @@ -11,6 +11,6 @@ namespace osu.Game.Overlays.Mods.Input /// public class ClassicModHotkeyHandler : IModHotkeyHandler { - public bool HandleHotkeyPressed(Key hotkey, IEnumerable availableMods) => false; // TODO + public bool HandleHotkeyPressed(KeyDownEvent e, IEnumerable availableMods) => false; // TODO } } diff --git a/osu.Game/Overlays/Mods/Input/IModHotkeyHandler.cs b/osu.Game/Overlays/Mods/Input/IModHotkeyHandler.cs index aec16ff764..d2cc0e84d2 100644 --- a/osu.Game/Overlays/Mods/Input/IModHotkeyHandler.cs +++ b/osu.Game/Overlays/Mods/Input/IModHotkeyHandler.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using osuTK.Input; +using osu.Framework.Input.Events; namespace osu.Game.Overlays.Mods.Input { @@ -12,11 +12,11 @@ namespace osu.Game.Overlays.Mods.Input public interface IModHotkeyHandler { /// - /// Attempt to handle a press of the supplied as a selection of one of the mods in . + /// Attempt to handle the supplied as a selection of one of the mods in . /// - /// The key that was pressed by the user. + /// The event representing the user's keypress. /// The list of currently available mods. - /// Whether the was handled as a mod selection/deselection. - bool HandleHotkeyPressed(Key hotkey, IEnumerable availableMods); + /// Whether the supplied event was handled as a mod selection/deselection. + bool HandleHotkeyPressed(KeyDownEvent e, IEnumerable availableMods); } } diff --git a/osu.Game/Overlays/Mods/Input/NoopModHotkeyHandler.cs b/osu.Game/Overlays/Mods/Input/NoopModHotkeyHandler.cs index 81152226da..3f7a6298a1 100644 --- a/osu.Game/Overlays/Mods/Input/NoopModHotkeyHandler.cs +++ b/osu.Game/Overlays/Mods/Input/NoopModHotkeyHandler.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using osuTK.Input; +using osu.Framework.Input.Events; namespace osu.Game.Overlays.Mods.Input { @@ -12,6 +12,6 @@ namespace osu.Game.Overlays.Mods.Input /// public class NoopModHotkeyHandler : IModHotkeyHandler { - public bool HandleHotkeyPressed(Key hotkey, IEnumerable availableMods) => false; + public bool HandleHotkeyPressed(KeyDownEvent e, IEnumerable availableMods) => false; } } diff --git a/osu.Game/Overlays/Mods/Input/SequentialModHotkeyHandler.cs b/osu.Game/Overlays/Mods/Input/SequentialModHotkeyHandler.cs index 45cfa60fff..e6717053e1 100644 --- a/osu.Game/Overlays/Mods/Input/SequentialModHotkeyHandler.cs +++ b/osu.Game/Overlays/Mods/Input/SequentialModHotkeyHandler.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using osu.Framework.Input.Events; using osu.Game.Rulesets.Mods; using osuTK.Input; @@ -41,9 +42,9 @@ namespace osu.Game.Overlays.Mods.Input toggleKeys = keys; } - public bool HandleHotkeyPressed(Key hotkey, IEnumerable availableMods) + public bool HandleHotkeyPressed(KeyDownEvent e, IEnumerable availableMods) { - int index = Array.IndexOf(toggleKeys, hotkey); + int index = Array.IndexOf(toggleKeys, e.Key); if (index < 0) return false; diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index cf3d354d47..1fef7257b5 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -432,7 +432,7 @@ namespace osu.Game.Overlays.Mods if (e.ControlPressed || e.AltPressed || e.SuperPressed || e.Repeat) return false; - return hotkeyHandler.HandleHotkeyPressed(e.Key, availableMods); + return hotkeyHandler.HandleHotkeyPressed(e, availableMods); } #endregion From 7b7b8c1892e36a9d2dda89c95e69d1f6d09ed4af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 21 Jun 2022 14:24:30 +0200 Subject: [PATCH 1820/2328] Implement behaviour for classic selection style --- .../Mods/Input/ClassicModHotkeyHandler.cs | 66 ++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs b/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs index e22ad13451..0faf509136 100644 --- a/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs +++ b/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs @@ -1,8 +1,13 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; using osu.Framework.Input.Events; +using osu.Game.Rulesets.Mods; +using osuTK.Input; namespace osu.Game.Overlays.Mods.Input { @@ -11,6 +16,65 @@ namespace osu.Game.Overlays.Mods.Input /// public class ClassicModHotkeyHandler : IModHotkeyHandler { - public bool HandleHotkeyPressed(KeyDownEvent e, IEnumerable availableMods) => false; // TODO + private static readonly Dictionary mod_type_lookup = new Dictionary + { + [Key.Q] = new[] { typeof(ModEasy) }, + [Key.W] = new[] { typeof(ModNoFail) }, + [Key.E] = new[] { typeof(ModHalfTime) }, + [Key.A] = new[] { typeof(ModHardRock) }, + [Key.S] = new[] { typeof(ModSuddenDeath), typeof(ModPerfect) }, + [Key.D] = new[] { typeof(ModDoubleTime), typeof(ModNightcore) }, + [Key.F] = new[] { typeof(ModHidden) }, + [Key.G] = new[] { typeof(ModFlashlight) }, + [Key.Z] = new[] { typeof(ModRelax) }, + [Key.V] = new[] { typeof(ModAutoplay), typeof(ModCinema) } + }; + + public bool HandleHotkeyPressed(KeyDownEvent e, IEnumerable availableMods) + { + if (!mod_type_lookup.TryGetValue(e.Key, out var typesToMatch)) + return false; + + var matchingMods = availableMods.Where(modState => matches(modState, typesToMatch)).ToArray(); + + if (matchingMods.Length == 0) + return false; + + if (matchingMods.Length == 1) + { + matchingMods.Single().Active.Toggle(); + return true; + } + + // we're assuming that only one mod from the group can be active at a time. + // this is mostly ensured by `IncompatibleMods` definitions, but let's make sure just in case. + Debug.Assert(matchingMods.Count(modState => modState.Active.Value) <= 1); + int currentSelectedIndex = Array.FindIndex(matchingMods, modState => modState.Active.Value); + + // `FindIndex` will return -1 if it doesn't find the item. + // this is convenient in the forward direction, since if we add 1 then we'll end up at the first item, + // but less so in the backwards direction. + // for convenience, detect this situation and set the index to one index past the last item. + // this makes it so that if we subtract 1 then we'll end up at the last item again. + if (currentSelectedIndex < 0 && e.ShiftPressed) + currentSelectedIndex = matchingMods.Length; + + int indexToSelect = e.ShiftPressed ? currentSelectedIndex - 1 : currentSelectedIndex + 1; + + // `currentSelectedIndex` and `indexToSelect` can both be equal to -1 or `matchingMods.Length`. + // if the former is beyond array range, it means nothing was previously selected and so there's nothing to deselect. + // if the latter is beyond array range, it means that either the previous selection was first and we're going backwards, + // or it was last and we're going forwards. + // in either case there is nothing to select. + if (currentSelectedIndex >= 0 && currentSelectedIndex <= matchingMods.Length - 1) + matchingMods[currentSelectedIndex].Active.Value = false; + if (indexToSelect >= 0 && indexToSelect <= matchingMods.Length - 1) + matchingMods[indexToSelect].Active.Value = true; + + return true; + } + + private static bool matches(ModState modState, Type[] typesToMatch) + => typesToMatch.Any(typeToMatch => typeToMatch.IsInstanceOfType(modState.Mod)); } } From da1814e7c3bcc8beff26ec0de471a0ca19106a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 21 Jun 2022 14:48:41 +0200 Subject: [PATCH 1821/2328] Restructure everything to fix free mod overlay issue --- .../UserInterface/TestSceneModColumn.cs | 55 +++++++++++++++++-- .../Mods/Input/ClassicModHotkeyHandler.cs | 22 +++++++- .../Overlays/Mods/Input/ModHotkeyHandler.cs | 32 ----------- osu.Game/Overlays/Mods/ModColumn.cs | 33 +++++++++-- .../Overlays/Mods/UserModSelectOverlay.cs | 4 +- 5 files changed, 101 insertions(+), 45 deletions(-) delete mode 100644 osu.Game/Overlays/Mods/Input/ModHotkeyHandler.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs index 25e99ac24b..ec3c5b6ac6 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs @@ -179,7 +179,7 @@ namespace osu.Game.Tests.Visual.UserInterface } [Test] - public void TestClassicKeyboardSelection() + public void TestClassicKeyboardExclusiveSelection() { AddStep("set classic hotkey mode", () => configManager.SetValue(OsuSetting.ModSelectHotkeyStyle, ModSelectHotkeyStyle.Classic)); @@ -188,7 +188,7 @@ namespace osu.Game.Tests.Visual.UserInterface { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(30), - Child = column = new ModColumn(ModType.DifficultyIncrease, true) + Child = column = new ModColumn(ModType.DifficultyIncrease, false) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -228,6 +228,53 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("no change", () => this.ChildrenOfType().Single(panel => panel.Active.Value).Mod.Acronym == "NC"); } + [Test] + public void TestClassicKeyboardIncompatibleSelection() + { + AddStep("set classic hotkey mode", () => configManager.SetValue(OsuSetting.ModSelectHotkeyStyle, ModSelectHotkeyStyle.Classic)); + + ModColumn column = null!; + AddStep("create content", () => Child = new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(30), + Child = column = new ModColumn(ModType.DifficultyIncrease, true) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AvailableMods = getExampleModsFor(ModType.DifficultyIncrease) + } + }); + + AddUntilStep("wait for panel load", () => column.IsLoaded && column.ItemsLoaded); + + AddStep("press A", () => InputManager.Key(Key.A)); + AddAssert("HR panel selected", () => this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "HR").Active.Value); + + AddStep("press A again", () => InputManager.Key(Key.A)); + AddAssert("HR panel deselected", () => !this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "HR").Active.Value); + + AddStep("press D", () => InputManager.Key(Key.D)); + AddAssert("DT panel selected", () => this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "DT").Active.Value); + AddAssert("NC panel selected", () => this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "NC").Active.Value); + + AddStep("press D again", () => InputManager.Key(Key.D)); + AddAssert("DT panel deselected", () => !this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "DT").Active.Value); + AddAssert("NC panel deselected", () => !this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "NC").Active.Value); + + AddStep("press Shift-D", () => + { + InputManager.PressKey(Key.ShiftLeft); + InputManager.Key(Key.D); + InputManager.ReleaseKey(Key.ShiftLeft); + }); + AddAssert("DT panel selected", () => this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "DT").Active.Value); + AddAssert("NC panel selected", () => this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "NC").Active.Value); + + AddStep("press J", () => InputManager.Key(Key.J)); + AddAssert("no change", () => this.ChildrenOfType().Count(panel => panel.Active.Value) == 2); + } + private void setFilter(Func? filter) { foreach (var modState in this.ChildrenOfType().Single().AvailableMods) @@ -238,8 +285,8 @@ namespace osu.Game.Tests.Visual.UserInterface { public new bool SelectionAnimationRunning => base.SelectionAnimationRunning; - public TestModColumn(ModType modType, bool allowBulkSelection) - : base(modType, allowBulkSelection) + public TestModColumn(ModType modType, bool allowIncompatibleSelection) + : base(modType, allowIncompatibleSelection) { } } diff --git a/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs b/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs index 0faf509136..33d86cbdaa 100644 --- a/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs +++ b/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs @@ -30,6 +30,13 @@ namespace osu.Game.Overlays.Mods.Input [Key.V] = new[] { typeof(ModAutoplay), typeof(ModCinema) } }; + private readonly bool allowIncompatibleSelection; + + public ClassicModHotkeyHandler(bool allowIncompatibleSelection) + { + this.allowIncompatibleSelection = allowIncompatibleSelection; + } + public bool HandleHotkeyPressed(KeyDownEvent e, IEnumerable availableMods) { if (!mod_type_lookup.TryGetValue(e.Key, out var typesToMatch)) @@ -46,8 +53,19 @@ namespace osu.Game.Overlays.Mods.Input return true; } - // we're assuming that only one mod from the group can be active at a time. - // this is mostly ensured by `IncompatibleMods` definitions, but let's make sure just in case. + if (allowIncompatibleSelection) + { + // easier path - multiple incompatible mods can be active at a time. + // this is used in the free mod select overlay. + // in this case, just toggle everything. + bool anyActive = matchingMods.Any(mod => mod.Active.Value); + foreach (var mod in matchingMods) + mod.Active.Value = !anyActive; + return true; + } + + // we now know there are multiple possible mods to handle, and only one of them can be active at a time. + // let's make sure of this just in case. Debug.Assert(matchingMods.Count(modState => modState.Active.Value) <= 1); int currentSelectedIndex = Array.FindIndex(matchingMods, modState => modState.Active.Value); diff --git a/osu.Game/Overlays/Mods/Input/ModHotkeyHandler.cs b/osu.Game/Overlays/Mods/Input/ModHotkeyHandler.cs deleted file mode 100644 index 5c46b2065f..0000000000 --- a/osu.Game/Overlays/Mods/Input/ModHotkeyHandler.cs +++ /dev/null @@ -1,32 +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.Rulesets.Mods; - -namespace osu.Game.Overlays.Mods.Input -{ - /// - /// Static factory class for s. - /// - public static class ModHotkeyHandler - { - /// - /// Creates an appropriate for the given . - /// - public static IModHotkeyHandler Create(ModType modType, ModSelectHotkeyStyle style) - { - switch (modType) - { - case ModType.DifficultyReduction: - case ModType.DifficultyIncrease: - case ModType.Automation: - return style == ModSelectHotkeyStyle.Sequential - ? (IModHotkeyHandler)SequentialModHotkeyHandler.Create(modType) - : new ClassicModHotkeyHandler(); - - default: - return new NoopModHotkeyHandler(); - } - } - } -} diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index 1fef7257b5..f8f6b814ca 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -71,8 +71,7 @@ namespace osu.Game.Overlays.Mods protected virtual ModPanel CreateModPanel(ModState mod) => new ModPanel(mod); - private Bindable hotkeyStyle = null!; - private IModHotkeyHandler hotkeyHandler = null!; + private readonly bool allowIncompatibleSelection; private readonly TextFlowContainer headerText; private readonly Box headerBackground; @@ -83,14 +82,18 @@ namespace osu.Game.Overlays.Mods private Colour4 accentColour; + private Bindable hotkeyStyle = null!; + private IModHotkeyHandler hotkeyHandler = null!; + private Task? latestLoadTask; internal bool ItemsLoaded => latestLoadTask == null; private const float header_height = 42; - public ModColumn(ModType modType, bool allowBulkSelection) + public ModColumn(ModType modType, bool allowIncompatibleSelection) { ModType = modType; + this.allowIncompatibleSelection = allowIncompatibleSelection; Width = 320; RelativeSizeAxes = Axes.Y; @@ -198,7 +201,7 @@ namespace osu.Game.Overlays.Mods createHeaderText(); - if (allowBulkSelection) + if (allowIncompatibleSelection) { controlContainer.Height = 35; controlContainer.Add(toggleAllCheckbox = new ToggleAllCheckbox(this) @@ -253,7 +256,7 @@ namespace osu.Game.Overlays.Mods base.LoadComplete(); toggleAllCheckbox?.Current.BindValueChanged(_ => updateToggleAllText(), true); - hotkeyStyle.BindValueChanged(val => hotkeyHandler = ModHotkeyHandler.Create(ModType, val.NewValue), true); + hotkeyStyle.BindValueChanged(val => hotkeyHandler = CreateHotkeyHandler(val.NewValue), true); asyncLoadPanels(); } @@ -427,6 +430,26 @@ namespace osu.Game.Overlays.Mods #region Keyboard selection support + /// + /// Creates an appropriate for this column's and + /// the supplied . + /// + protected virtual IModHotkeyHandler CreateHotkeyHandler(ModSelectHotkeyStyle hotkeyStyle) + { + switch (ModType) + { + case ModType.DifficultyReduction: + case ModType.DifficultyIncrease: + case ModType.Automation: + return hotkeyStyle == ModSelectHotkeyStyle.Sequential + ? (IModHotkeyHandler)SequentialModHotkeyHandler.Create(ModType) + : new ClassicModHotkeyHandler(allowIncompatibleSelection); + + default: + return new NoopModHotkeyHandler(); + } + } + protected override bool OnKeyDown(KeyDownEvent e) { if (e.ControlPressed || e.AltPressed || e.SuperPressed || e.Repeat) diff --git a/osu.Game/Overlays/Mods/UserModSelectOverlay.cs b/osu.Game/Overlays/Mods/UserModSelectOverlay.cs index a292a50b72..1090306c5b 100644 --- a/osu.Game/Overlays/Mods/UserModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/UserModSelectOverlay.cs @@ -40,8 +40,8 @@ namespace osu.Game.Overlays.Mods private class UserModColumn : ModColumn { - public UserModColumn(ModType modType, bool allowBulkSelection) - : base(modType, allowBulkSelection) + public UserModColumn(ModType modType, bool allowIncompatibleSelection) + : base(modType, allowIncompatibleSelection) { } From a996325e19bf5496994802e0c8d88c081b164e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 21 Jun 2022 15:00:39 +0200 Subject: [PATCH 1822/2328] Add test coverage for filter handling in classic style --- .../Visual/UserInterface/TestSceneModColumn.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs index ec3c5b6ac6..3765bc2ca0 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs @@ -226,6 +226,11 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("press J", () => InputManager.Key(Key.J)); AddAssert("no change", () => this.ChildrenOfType().Single(panel => panel.Active.Value).Mod.Acronym == "NC"); + + AddStep("filter everything but NC", () => setFilter(mod => mod.Acronym == "NC")); + + AddStep("press A", () => InputManager.Key(Key.A)); + AddAssert("no change", () => this.ChildrenOfType().Single(panel => panel.Active.Value).Mod.Acronym == "NC"); } [Test] @@ -273,6 +278,11 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("press J", () => InputManager.Key(Key.J)); AddAssert("no change", () => this.ChildrenOfType().Count(panel => panel.Active.Value) == 2); + + AddStep("filter everything but NC", () => setFilter(mod => mod.Acronym == "NC")); + + AddStep("press A", () => InputManager.Key(Key.A)); + AddAssert("no change", () => this.ChildrenOfType().Count(panel => panel.Active.Value) == 2); } private void setFilter(Func? filter) From 9e5cc89edbcef90f2804e6a0eb163445b08f07a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 21 Jun 2022 15:01:33 +0200 Subject: [PATCH 1823/2328] Fix classic hotkeys toggling filtered mods --- osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs b/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs index 33d86cbdaa..4f3c18fc43 100644 --- a/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs +++ b/osu.Game/Overlays/Mods/Input/ClassicModHotkeyHandler.cs @@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Mods.Input if (!mod_type_lookup.TryGetValue(e.Key, out var typesToMatch)) return false; - var matchingMods = availableMods.Where(modState => matches(modState, typesToMatch)).ToArray(); + var matchingMods = availableMods.Where(modState => matches(modState, typesToMatch) && !modState.Filtered.Value).ToArray(); if (matchingMods.Length == 0) return false; From a9f6eb0293fd8fcc018f4ff2d29dba10f24bc117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 21 Jun 2022 15:18:37 +0200 Subject: [PATCH 1824/2328] Add test coverage for new intended behaviour of sequential hotkey style --- osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs index 3765bc2ca0..72cddc0ad2 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModColumn.cs @@ -165,9 +165,12 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("set filter to NF", () => setFilter(mod => mod.Acronym == "NF")); AddStep("press W", () => InputManager.Key(Key.W)); + AddAssert("NF panel not selected", () => !this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "NF").Active.Value); + + AddStep("press Q", () => InputManager.Key(Key.Q)); AddAssert("NF panel selected", () => this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "NF").Active.Value); - AddStep("press W again", () => InputManager.Key(Key.W)); + AddStep("press Q again", () => InputManager.Key(Key.Q)); AddAssert("NF panel deselected", () => !this.ChildrenOfType().Single(panel => panel.Mod.Acronym == "NF").Active.Value); AddStep("filter out everything", () => setFilter(_ => false)); From f564ed589fdac206748c43000d98b2c918f1ae78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 21 Jun 2022 15:19:41 +0200 Subject: [PATCH 1825/2328] Alter sequential hotkey style to always use visible index Previous behaviour was once mentioned off-hand as unintuitive. --- osu.Game/Overlays/Mods/Input/SequentialModHotkeyHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/Input/SequentialModHotkeyHandler.cs b/osu.Game/Overlays/Mods/Input/SequentialModHotkeyHandler.cs index e6717053e1..dedb556304 100644 --- a/osu.Game/Overlays/Mods/Input/SequentialModHotkeyHandler.cs +++ b/osu.Game/Overlays/Mods/Input/SequentialModHotkeyHandler.cs @@ -48,8 +48,8 @@ namespace osu.Game.Overlays.Mods.Input if (index < 0) return false; - var modState = availableMods.ElementAtOrDefault(index); - if (modState == null || modState.Filtered.Value) + var modState = availableMods.Where(modState => !modState.Filtered.Value).ElementAtOrDefault(index); + if (modState == null) return false; modState.Active.Toggle(); From 7013909322687424052ffe6562a0b26d4ca62a8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 21 Jun 2022 16:43:04 +0200 Subject: [PATCH 1826/2328] Remove unnecessary `protected virtual` --- osu.Game/Overlays/Mods/ModColumn.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index f8f6b814ca..c51e6baa0d 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -256,7 +256,7 @@ namespace osu.Game.Overlays.Mods base.LoadComplete(); toggleAllCheckbox?.Current.BindValueChanged(_ => updateToggleAllText(), true); - hotkeyStyle.BindValueChanged(val => hotkeyHandler = CreateHotkeyHandler(val.NewValue), true); + hotkeyStyle.BindValueChanged(val => hotkeyHandler = createHotkeyHandler(val.NewValue), true); asyncLoadPanels(); } @@ -434,7 +434,7 @@ namespace osu.Game.Overlays.Mods /// Creates an appropriate for this column's and /// the supplied . /// - protected virtual IModHotkeyHandler CreateHotkeyHandler(ModSelectHotkeyStyle hotkeyStyle) + private IModHotkeyHandler createHotkeyHandler(ModSelectHotkeyStyle hotkeyStyle) { switch (ModType) { From bff35cb34895848daa8af880483e08ff9c59b8ed Mon Sep 17 00:00:00 2001 From: cdwcgt Date: Wed, 22 Jun 2022 01:19:20 +0900 Subject: [PATCH 1827/2328] Shake button when replay already save --- .../Screens/Play/SaveFailedScoreButton.cs | 43 +++++++++++++++++-- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/SaveFailedScoreButton.cs b/osu.Game/Screens/Play/SaveFailedScoreButton.cs index 1c198421ab..3efd8fa4a3 100644 --- a/osu.Game/Screens/Play/SaveFailedScoreButton.cs +++ b/osu.Game/Screens/Play/SaveFailedScoreButton.cs @@ -4,20 +4,54 @@ using System; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Online; +using osuTK; namespace osu.Game.Screens.Play { - public class SaveFailedScoreButton : DownloadButton + public class SaveFailedScoreButton : CompositeDrawable { public Action? OnSave; + protected readonly Bindable State = new Bindable(); + + private DownloadButton button; + private ShakeContainer shakeContainer; + + public SaveFailedScoreButton() + { + InternalChild = shakeContainer = new ShakeContainer + { + RelativeSizeAxes = Axes.Both, + Child = button = new DownloadButton + { + RelativeSizeAxes = Axes.Both, + } + }; + Size = new Vector2(50, 30); + } + [BackgroundDependencyLoader] private void load() { + button.Action = () => + { + switch (State.Value) + { + case DownloadState.LocallyAvailable: + shakeContainer.Shake(); + break; + + default: + saveScore(); + break; + } + }; State.BindValueChanged(updateTooltip, true); - Action = saveScore; } private void saveScore() @@ -26,6 +60,7 @@ namespace osu.Game.Screens.Play OnSave?.Invoke(); State.Value = DownloadState.LocallyAvailable; + button.State.Value = DownloadState.LocallyAvailable; } private void updateTooltip(ValueChangedEvent state) @@ -33,11 +68,11 @@ namespace osu.Game.Screens.Play switch (state.NewValue) { case DownloadState.LocallyAvailable: - TooltipText = @"Score saved"; + button.TooltipText = @"Score saved"; break; default: - TooltipText = @"Save score"; + button.TooltipText = @"Save score"; break; } } From e4931f977cadd7d90a4f965d4215013eaa207fe6 Mon Sep 17 00:00:00 2001 From: Supersonicboss1 Date: Tue, 21 Jun 2022 23:00:03 +0100 Subject: [PATCH 1828/2328] improved UI of maintenance section in settings --- ...{GeneralSettings.cs => BeatmapSettings.cs} | 88 +++---------------- .../Maintenance/CollectionsSettings.cs | 49 +++++++++++ .../Sections/Maintenance/ScoreSettings.cs | 52 +++++++++++ .../Sections/Maintenance/SkinSettings.cs | 52 +++++++++++ .../Settings/Sections/MaintenanceSection.cs | 5 +- 5 files changed, 170 insertions(+), 76 deletions(-) rename osu.Game/Overlays/Settings/Sections/Maintenance/{GeneralSettings.cs => BeatmapSettings.cs} (62%) create mode 100644 osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs create mode 100644 osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs create mode 100644 osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs similarity index 62% rename from osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs rename to osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs index 916c607c1c..474f23e4e7 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs @@ -9,31 +9,25 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Beatmaps; -using osu.Game.Collections; using osu.Game.Database; using osu.Game.Localisation; using osu.Game.Scoring; -using osu.Game.Skinning; namespace osu.Game.Overlays.Settings.Sections.Maintenance { - public class GeneralSettings : SettingsSubsection + public class BeatmapSettings : SettingsSubsection { - protected override LocalisableString Header => "General"; - + protected override LocalisableString Header => "Beatmaps"; private SettingsButton importBeatmapsButton; private SettingsButton importScoresButton; - private SettingsButton importSkinsButton; - private SettingsButton importCollectionsButton; private SettingsButton deleteBeatmapsButton; + private SettingsButton deleteBeatmapVideosButton; private SettingsButton deleteScoresButton; - private SettingsButton deleteSkinsButton; private SettingsButton restoreButton; private SettingsButton undeleteButton; - private SettingsButton deleteBeatmapVideosButton; [BackgroundDependencyLoader(permitNulls: true)] - private void load(BeatmapManager beatmaps, ScoreManager scores, SkinManager skins, [CanBeNull] CollectionManager collectionManager, [CanBeNull] LegacyImportManager legacyImportManager, IDialogOverlay dialogOverlay) + private void load(BeatmapManager beatmaps, ScoreManager scores, [CanBeNull] LegacyImportManager legacyImportManager, IDialogOverlay dialogOverlay) { if (legacyImportManager?.SupportsImportFromStable == true) { @@ -46,6 +40,15 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance legacyImportManager.ImportFromStableAsync(StableContent.Beatmaps).ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true)); } }); + Add(importScoresButton = new SettingsButton + { + Text = MaintenanceSettingsStrings.ImportScoresFromStable, + Action = () => + { + importScoresButton.Enabled.Value = false; + legacyImportManager.ImportFromStableAsync(StableContent.Scores).ContinueWith(t => Schedule(() => importScoresButton.Enabled.Value = true)); + } + }); } Add(deleteBeatmapsButton = new DangerousSettingsButton @@ -74,19 +77,6 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance } }); - if (legacyImportManager?.SupportsImportFromStable == true) - { - Add(importScoresButton = new SettingsButton - { - Text = MaintenanceSettingsStrings.ImportScoresFromStable, - Action = () => - { - importScoresButton.Enabled.Value = false; - legacyImportManager.ImportFromStableAsync(StableContent.Scores).ContinueWith(t => Schedule(() => importScoresButton.Enabled.Value = true)); - } - }); - } - Add(deleteScoresButton = new DangerousSettingsButton { Text = MaintenanceSettingsStrings.DeleteAllScores, @@ -99,58 +89,6 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance })); } }); - - if (legacyImportManager?.SupportsImportFromStable == true) - { - Add(importSkinsButton = new SettingsButton - { - Text = MaintenanceSettingsStrings.ImportSkinsFromStable, - Action = () => - { - importSkinsButton.Enabled.Value = false; - legacyImportManager.ImportFromStableAsync(StableContent.Skins).ContinueWith(t => Schedule(() => importSkinsButton.Enabled.Value = true)); - } - }); - } - - Add(deleteSkinsButton = new DangerousSettingsButton - { - Text = MaintenanceSettingsStrings.DeleteAllSkins, - Action = () => - { - dialogOverlay?.Push(new MassDeleteConfirmationDialog(() => - { - deleteSkinsButton.Enabled.Value = false; - Task.Run(() => skins.Delete()).ContinueWith(t => Schedule(() => deleteSkinsButton.Enabled.Value = true)); - })); - } - }); - - if (collectionManager != null) - { - if (legacyImportManager?.SupportsImportFromStable == true) - { - Add(importCollectionsButton = new SettingsButton - { - Text = MaintenanceSettingsStrings.ImportCollectionsFromStable, - Action = () => - { - importCollectionsButton.Enabled.Value = false; - legacyImportManager.ImportFromStableAsync(StableContent.Collections).ContinueWith(t => Schedule(() => importCollectionsButton.Enabled.Value = true)); - } - }); - } - - Add(new DangerousSettingsButton - { - Text = MaintenanceSettingsStrings.DeleteAllCollections, - Action = () => - { - dialogOverlay?.Push(new MassDeleteConfirmationDialog(collectionManager.DeleteAll)); - } - }); - } - AddRange(new Drawable[] { restoreButton = new SettingsButton diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs new file mode 100644 index 0000000000..98a9a271ab --- /dev/null +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs @@ -0,0 +1,49 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable + +using JetBrains.Annotations; +using osu.Framework.Allocation; +using osu.Framework.Localisation; +using osu.Game.Collections; +using osu.Game.Database; +using osu.Game.Localisation; + +namespace osu.Game.Overlays.Settings.Sections.Maintenance +{ + public class CollectionsSettings : SettingsSubsection + { + protected override LocalisableString Header => "Collections"; + private SettingsButton importCollectionsButton; + + [BackgroundDependencyLoader(permitNulls: true)] + private void load([CanBeNull] CollectionManager collectionManager, [CanBeNull] LegacyImportManager legacyImportManager, IDialogOverlay dialogOverlay) + { + if (collectionManager != null) + { + if (legacyImportManager?.SupportsImportFromStable == true) + { + Add(importCollectionsButton = new SettingsButton + { + Text = MaintenanceSettingsStrings.ImportCollectionsFromStable, + Action = () => + { + importCollectionsButton.Enabled.Value = false; + legacyImportManager.ImportFromStableAsync(StableContent.Collections).ContinueWith(t => Schedule(() => importCollectionsButton.Enabled.Value = true)); + } + }); + } + + Add(new DangerousSettingsButton + { + Text = MaintenanceSettingsStrings.DeleteAllCollections, + Action = () => + { + dialogOverlay?.Push(new MassDeleteConfirmationDialog(collectionManager.DeleteAll)); + } + }); + } + } + } +} diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs new file mode 100644 index 0000000000..ddeb48725c --- /dev/null +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs @@ -0,0 +1,52 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable + +using System.Threading.Tasks; +using JetBrains.Annotations; +using osu.Framework.Allocation; +using osu.Framework.Localisation; +using osu.Game.Database; +using osu.Game.Localisation; +using osu.Game.Scoring; + +namespace osu.Game.Overlays.Settings.Sections.Maintenance +{ + public class ScoreSettings : SettingsSubsection + { + protected override LocalisableString Header => "Scores"; + private SettingsButton importScoresButton; + private SettingsButton deleteScoresButton; + + [BackgroundDependencyLoader(permitNulls: true)] + private void load(ScoreManager scores, [CanBeNull] LegacyImportManager legacyImportManager, IDialogOverlay dialogOverlay) + { + if (legacyImportManager?.SupportsImportFromStable == true) + { + Add(importScoresButton = new SettingsButton + { + Text = MaintenanceSettingsStrings.ImportScoresFromStable, + Action = () => + { + importScoresButton.Enabled.Value = false; + legacyImportManager.ImportFromStableAsync(StableContent.Scores).ContinueWith(t => Schedule(() => importScoresButton.Enabled.Value = true)); + } + }); + } + + Add(deleteScoresButton = new DangerousSettingsButton + { + Text = MaintenanceSettingsStrings.DeleteAllScores, + Action = () => + { + dialogOverlay?.Push(new MassDeleteConfirmationDialog(() => + { + deleteScoresButton.Enabled.Value = false; + Task.Run(() => scores.Delete()).ContinueWith(t => Schedule(() => deleteScoresButton.Enabled.Value = true)); + })); + } + }); + } + } +} diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs new file mode 100644 index 0000000000..6019023c50 --- /dev/null +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs @@ -0,0 +1,52 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable + +using System.Threading.Tasks; +using JetBrains.Annotations; +using osu.Framework.Allocation; +using osu.Framework.Localisation; +using osu.Game.Database; +using osu.Game.Localisation; +using osu.Game.Skinning; + +namespace osu.Game.Overlays.Settings.Sections.Maintenance +{ + public class SkinSettings : SettingsSubsection + { + protected override LocalisableString Header => "Skins"; + private SettingsButton importSkinsButton; + private SettingsButton deleteSkinsButton; + + [BackgroundDependencyLoader(permitNulls: true)] + private void load(SkinManager skins, [CanBeNull] LegacyImportManager legacyImportManager, IDialogOverlay dialogOverlay) + { + if (legacyImportManager?.SupportsImportFromStable == true) + { + Add(importSkinsButton = new SettingsButton + { + Text = MaintenanceSettingsStrings.ImportSkinsFromStable, + Action = () => + { + importSkinsButton.Enabled.Value = false; + legacyImportManager.ImportFromStableAsync(StableContent.Skins).ContinueWith(t => Schedule(() => importSkinsButton.Enabled.Value = true)); + } + }); + } + + Add(deleteSkinsButton = new DangerousSettingsButton + { + Text = MaintenanceSettingsStrings.DeleteAllSkins, + Action = () => + { + dialogOverlay?.Push(new MassDeleteConfirmationDialog(() => + { + deleteSkinsButton.Enabled.Value = false; + Task.Run(() => skins.Delete()).ContinueWith(t => Schedule(() => deleteSkinsButton.Enabled.Value = true)); + })); + } + }); + } + } +} diff --git a/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs b/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs index cfe1961bc1..19d02baa4a 100644 --- a/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs +++ b/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs @@ -24,7 +24,10 @@ namespace osu.Game.Overlays.Settings.Sections { Children = new Drawable[] { - new GeneralSettings() + new BeatmapSettings(), + new SkinSettings(), + new CollectionsSettings(), + new ScoreSettings() }; } } From 4aa86b0a8001fa1e0f2f6895f7160d226b80cb6d Mon Sep 17 00:00:00 2001 From: Supersonicboss1 Date: Tue, 21 Jun 2022 23:41:25 +0100 Subject: [PATCH 1829/2328] fixed duplicates and cleaned up code --- .../Sections/Maintenance/BeatmapSettings.cs | 113 +++++++----------- .../Maintenance/CollectionsSettings.cs | 36 +++--- .../Sections/Maintenance/ScoreSettings.cs | 2 +- .../Sections/Maintenance/SkinSettings.cs | 2 +- 4 files changed, 64 insertions(+), 89 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs index 474f23e4e7..57de259670 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.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. #nullable disable @@ -11,7 +11,6 @@ using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Localisation; -using osu.Game.Scoring; namespace osu.Game.Overlays.Settings.Sections.Maintenance { @@ -19,15 +18,13 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance { protected override LocalisableString Header => "Beatmaps"; private SettingsButton importBeatmapsButton; - private SettingsButton importScoresButton; private SettingsButton deleteBeatmapsButton; private SettingsButton deleteBeatmapVideosButton; - private SettingsButton deleteScoresButton; private SettingsButton restoreButton; private SettingsButton undeleteButton; [BackgroundDependencyLoader(permitNulls: true)] - private void load(BeatmapManager beatmaps, ScoreManager scores, [CanBeNull] LegacyImportManager legacyImportManager, IDialogOverlay dialogOverlay) + private void load(BeatmapManager beatmaps, [CanBeNull] LegacyImportManager legacyImportManager, IDialogOverlay dialogOverlay) { if (legacyImportManager?.SupportsImportFromStable == true) { @@ -40,76 +37,54 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance legacyImportManager.ImportFromStableAsync(StableContent.Beatmaps).ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true)); } }); - Add(importScoresButton = new SettingsButton + + Add(deleteBeatmapsButton = new DangerousSettingsButton { - Text = MaintenanceSettingsStrings.ImportScoresFromStable, + Text = MaintenanceSettingsStrings.DeleteAllBeatmaps, Action = () => { - importScoresButton.Enabled.Value = false; - legacyImportManager.ImportFromStableAsync(StableContent.Scores).ContinueWith(t => Schedule(() => importScoresButton.Enabled.Value = true)); + dialogOverlay?.Push(new MassDeleteConfirmationDialog(() => + { + deleteBeatmapsButton.Enabled.Value = false; + Task.Run(() => beatmaps.Delete()).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true)); + })); + } + }); + + Add(deleteBeatmapVideosButton = new DangerousSettingsButton + { + Text = MaintenanceSettingsStrings.DeleteAllBeatmapVideos, + Action = () => + { + dialogOverlay?.Push(new MassVideoDeleteConfirmationDialog(() => + { + deleteBeatmapVideosButton.Enabled.Value = false; + Task.Run(beatmaps.DeleteAllVideos).ContinueWith(t => Schedule(() => deleteBeatmapVideosButton.Enabled.Value = true)); + })); + } + }); + AddRange(new Drawable[] + { + restoreButton = new SettingsButton + { + Text = MaintenanceSettingsStrings.RestoreAllHiddenDifficulties, + Action = () => + { + restoreButton.Enabled.Value = false; + Task.Run(beatmaps.RestoreAll).ContinueWith(t => Schedule(() => restoreButton.Enabled.Value = true)); + } + }, + undeleteButton = new SettingsButton + { + Text = MaintenanceSettingsStrings.RestoreAllRecentlyDeletedBeatmaps, + Action = () => + { + undeleteButton.Enabled.Value = false; + Task.Run(beatmaps.UndeleteAll).ContinueWith(t => Schedule(() => undeleteButton.Enabled.Value = true)); + } } }); } - - Add(deleteBeatmapsButton = new DangerousSettingsButton - { - Text = MaintenanceSettingsStrings.DeleteAllBeatmaps, - Action = () => - { - dialogOverlay?.Push(new MassDeleteConfirmationDialog(() => - { - deleteBeatmapsButton.Enabled.Value = false; - Task.Run(() => beatmaps.Delete()).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true)); - })); - } - }); - - Add(deleteBeatmapVideosButton = new DangerousSettingsButton - { - Text = MaintenanceSettingsStrings.DeleteAllBeatmapVideos, - Action = () => - { - dialogOverlay?.Push(new MassVideoDeleteConfirmationDialog(() => - { - deleteBeatmapVideosButton.Enabled.Value = false; - Task.Run(beatmaps.DeleteAllVideos).ContinueWith(t => Schedule(() => deleteBeatmapVideosButton.Enabled.Value = true)); - })); - } - }); - - Add(deleteScoresButton = new DangerousSettingsButton - { - Text = MaintenanceSettingsStrings.DeleteAllScores, - Action = () => - { - dialogOverlay?.Push(new MassDeleteConfirmationDialog(() => - { - deleteScoresButton.Enabled.Value = false; - Task.Run(() => scores.Delete()).ContinueWith(t => Schedule(() => deleteScoresButton.Enabled.Value = true)); - })); - } - }); - AddRange(new Drawable[] - { - restoreButton = new SettingsButton - { - Text = MaintenanceSettingsStrings.RestoreAllHiddenDifficulties, - Action = () => - { - restoreButton.Enabled.Value = false; - Task.Run(beatmaps.RestoreAll).ContinueWith(t => Schedule(() => restoreButton.Enabled.Value = true)); - } - }, - undeleteButton = new SettingsButton - { - Text = MaintenanceSettingsStrings.RestoreAllRecentlyDeletedBeatmaps, - Action = () => - { - undeleteButton.Enabled.Value = false; - Task.Run(beatmaps.UndeleteAll).ContinueWith(t => Schedule(() => undeleteButton.Enabled.Value = true)); - } - }, - }); } } } diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs index 98a9a271ab..31b889ce0e 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.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. #nullable disable @@ -20,30 +20,30 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance [BackgroundDependencyLoader(permitNulls: true)] private void load([CanBeNull] CollectionManager collectionManager, [CanBeNull] LegacyImportManager legacyImportManager, IDialogOverlay dialogOverlay) { - if (collectionManager != null) - { - if (legacyImportManager?.SupportsImportFromStable == true) - { - Add(importCollectionsButton = new SettingsButton - { - Text = MaintenanceSettingsStrings.ImportCollectionsFromStable, - Action = () => - { - importCollectionsButton.Enabled.Value = false; - legacyImportManager.ImportFromStableAsync(StableContent.Collections).ContinueWith(t => Schedule(() => importCollectionsButton.Enabled.Value = true)); - } - }); - } + if (collectionManager == null) return; - Add(new DangerousSettingsButton + if (legacyImportManager?.SupportsImportFromStable == true) + + { + Add(importCollectionsButton = new SettingsButton { - Text = MaintenanceSettingsStrings.DeleteAllCollections, + Text = MaintenanceSettingsStrings.ImportCollectionsFromStable, Action = () => { - dialogOverlay?.Push(new MassDeleteConfirmationDialog(collectionManager.DeleteAll)); + importCollectionsButton.Enabled.Value = false; + legacyImportManager.ImportFromStableAsync(StableContent.Collections).ContinueWith(t => Schedule(() => importCollectionsButton.Enabled.Value = true)); } }); } + + Add(new DangerousSettingsButton + { + Text = MaintenanceSettingsStrings.DeleteAllCollections, + Action = () => + { + dialogOverlay?.Push(new MassDeleteConfirmationDialog(collectionManager.DeleteAll)); + } + }); } } } diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs index ddeb48725c..26d9d2aa51 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.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. #nullable disable diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs index 6019023c50..ad680b363e 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.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. #nullable disable From 50728f3fbc29a4e8fd9a39817b924468b50349ad Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Tue, 21 Jun 2022 18:31:09 -0700 Subject: [PATCH 1830/2328] Fix overlay header tab item not working with localisable string --- osu.Game/Overlays/TabControlOverlayHeader.cs | 28 +++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/TabControlOverlayHeader.cs b/osu.Game/Overlays/TabControlOverlayHeader.cs index 4e32afb86f..2b47e6bc46 100644 --- a/osu.Game/Overlays/TabControlOverlayHeader.cs +++ b/osu.Game/Overlays/TabControlOverlayHeader.cs @@ -8,10 +8,12 @@ using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; @@ -108,17 +110,25 @@ namespace osu.Game.Overlays public OverlayHeaderTabItem(T value) : base(value) { - if (!(Value is Enum enumValue)) - Text.Text = Value.ToString().ToLower(); - else + switch (Value) { - var localisableDescription = enumValue.GetLocalisableDescription(); - string nonLocalisableDescription = enumValue.GetDescription(); + case LocalisableString localisableString: + Text.Text = localisableString.ToLower(); + break; - // If localisable == non-localisable, then we must have a basic string, so .ToLower() is used. - Text.Text = localisableDescription.Equals(nonLocalisableDescription) - ? nonLocalisableDescription.ToLower() - : localisableDescription; + case Enum enumValue: + var localisableDescription = enumValue.GetLocalisableDescription(); + string nonLocalisableDescription = enumValue.GetDescription(); + + // If localisable == non-localisable, then we must have a basic string, so .ToLower() is used. + Text.Text = localisableDescription.Equals(nonLocalisableDescription) + ? nonLocalisableDescription.ToLower() + : localisableDescription; + break; + + default: + Text.Text = Value.ToString().ToLower(); + break; } Text.Font = OsuFont.GetFont(size: 14); From 07e0cd53a4c81d1256c21864ec71bc849ebf37d9 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Tue, 21 Jun 2022 19:06:08 -0700 Subject: [PATCH 1831/2328] Add back online view container to chat overlay --- osu.Game/Overlays/ChatOverlay.cs | 74 +++++++++++++++++++------------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 81a408598b..c491c0c695 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -18,6 +18,7 @@ using osu.Game.Configuration; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; +using osu.Game.Online; using osu.Game.Online.Chat; using osu.Game.Overlays.Chat; using osu.Game.Overlays.Chat.ChannelList; @@ -100,23 +101,10 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.X, Height = top_bar_height, }, - channelList = new ChannelList - { - RelativeSizeAxes = Axes.Y, - Width = side_bar_width, - Padding = new MarginPadding { Top = top_bar_height }, - }, new Container { RelativeSizeAxes = Axes.Both, - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Padding = new MarginPadding - { - Top = top_bar_height, - Left = side_bar_width, - Bottom = chat_bar_height, - }, + Padding = new MarginPadding { Top = top_bar_height }, Children = new Drawable[] { new Box @@ -124,24 +112,50 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both, Colour = colourProvider.Background4, }, - currentChannelContainer = new Container + new OnlineViewContainer("Sign in to chat") { RelativeSizeAxes = Axes.Both, - }, - loading = new LoadingLayer(true), - channelListing = new ChannelListing - { - RelativeSizeAxes = Axes.Both, - }, - }, - }, - textBar = new ChatTextBar - { - RelativeSizeAxes = Axes.X, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Padding = new MarginPadding { Left = side_bar_width }, - }, + Children = new Drawable[] + { + channelList = new ChannelList + { + RelativeSizeAxes = Axes.Y, + Width = side_bar_width, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Padding = new MarginPadding + { + Left = side_bar_width, + Bottom = chat_bar_height, + }, + Children = new Drawable[] + { + currentChannelContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, + loading = new LoadingLayer(true), + channelListing = new ChannelListing + { + RelativeSizeAxes = Axes.Both, + }, + }, + }, + textBar = new ChatTextBar + { + RelativeSizeAxes = Axes.X, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Padding = new MarginPadding { Left = side_bar_width }, + }, + } + } + } + } }; } From 23254d2ff206146b29fcf36c6643a404b1b33bbd Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 22 Jun 2022 13:02:33 +0900 Subject: [PATCH 1832/2328] Fix broken files --- .../Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs | 2 +- .../Settings/Sections/Maintenance/CollectionsSettings.cs | 2 +- .../Overlays/Settings/Sections/Maintenance/ScoreSettings.cs | 2 +- osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs index 57de259670..7d5c8a9958 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.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. #nullable disable diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs index 31b889ce0e..96583a1e4b 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.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. #nullable disable diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs index 26d9d2aa51..ddeb48725c 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.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. #nullable disable diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs index ad680b363e..6019023c50 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.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. #nullable disable From 1018c9852d0ce5e7b6bf3b0f4e056ea92e5d8664 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 22 Jun 2022 13:07:44 +0900 Subject: [PATCH 1833/2328] Cleanup nullability --- .../Sections/Maintenance/BeatmapSettings.cs | 18 ++++++++---------- .../Maintenance/CollectionsSettings.cs | 10 ++++------ .../Sections/Maintenance/ScoreSettings.cs | 12 +++++------- .../Sections/Maintenance/SkinSettings.cs | 12 +++++------- 4 files changed, 22 insertions(+), 30 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs index 7d5c8a9958..8039ee7cd9 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs @@ -1,10 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Threading.Tasks; -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; @@ -17,14 +14,15 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance public class BeatmapSettings : SettingsSubsection { protected override LocalisableString Header => "Beatmaps"; - private SettingsButton importBeatmapsButton; - private SettingsButton deleteBeatmapsButton; - private SettingsButton deleteBeatmapVideosButton; - private SettingsButton restoreButton; - private SettingsButton undeleteButton; - [BackgroundDependencyLoader(permitNulls: true)] - private void load(BeatmapManager beatmaps, [CanBeNull] LegacyImportManager legacyImportManager, IDialogOverlay dialogOverlay) + private SettingsButton importBeatmapsButton = null!; + private SettingsButton deleteBeatmapsButton = null!; + private SettingsButton deleteBeatmapVideosButton = null!; + private SettingsButton restoreButton = null!; + private SettingsButton undeleteButton = null!; + + [BackgroundDependencyLoader] + private void load(BeatmapManager beatmaps, LegacyImportManager? legacyImportManager, IDialogOverlay? dialogOverlay) { if (legacyImportManager?.SupportsImportFromStable == true) { diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs index 96583a1e4b..8387582fcb 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs @@ -1,9 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Localisation; using osu.Game.Collections; @@ -15,10 +12,11 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance public class CollectionsSettings : SettingsSubsection { protected override LocalisableString Header => "Collections"; - private SettingsButton importCollectionsButton; - [BackgroundDependencyLoader(permitNulls: true)] - private void load([CanBeNull] CollectionManager collectionManager, [CanBeNull] LegacyImportManager legacyImportManager, IDialogOverlay dialogOverlay) + private SettingsButton importCollectionsButton = null!; + + [BackgroundDependencyLoader] + private void load(CollectionManager? collectionManager, LegacyImportManager? legacyImportManager, IDialogOverlay? dialogOverlay) { if (collectionManager == null) return; diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs index ddeb48725c..9c1281f371 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs @@ -1,10 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Threading.Tasks; -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Localisation; using osu.Game.Database; @@ -16,11 +13,12 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance public class ScoreSettings : SettingsSubsection { protected override LocalisableString Header => "Scores"; - private SettingsButton importScoresButton; - private SettingsButton deleteScoresButton; - [BackgroundDependencyLoader(permitNulls: true)] - private void load(ScoreManager scores, [CanBeNull] LegacyImportManager legacyImportManager, IDialogOverlay dialogOverlay) + private SettingsButton importScoresButton = null!; + private SettingsButton deleteScoresButton = null!; + + [BackgroundDependencyLoader] + private void load(ScoreManager scores, LegacyImportManager? legacyImportManager, IDialogOverlay? dialogOverlay) { if (legacyImportManager?.SupportsImportFromStable == true) { diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs index 6019023c50..0fff9fef26 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs @@ -1,10 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Threading.Tasks; -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Localisation; using osu.Game.Database; @@ -16,11 +13,12 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance public class SkinSettings : SettingsSubsection { protected override LocalisableString Header => "Skins"; - private SettingsButton importSkinsButton; - private SettingsButton deleteSkinsButton; - [BackgroundDependencyLoader(permitNulls: true)] - private void load(SkinManager skins, [CanBeNull] LegacyImportManager legacyImportManager, IDialogOverlay dialogOverlay) + private SettingsButton importSkinsButton = null!; + private SettingsButton deleteSkinsButton = null!; + + [BackgroundDependencyLoader] + private void load(SkinManager skins, LegacyImportManager? legacyImportManager, IDialogOverlay? dialogOverlay) { if (legacyImportManager?.SupportsImportFromStable == true) { From 321920bc857b07f1359ac0407a080c56f2815a6c Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 22 Jun 2022 13:08:14 +0900 Subject: [PATCH 1834/2328] Remove one more nullable disable --- osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs b/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs index 19d02baa4a..841a7d0abe 100644 --- a/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs +++ b/osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; From ff440fc1a4517d1da519f2ace93aa75a0698c366 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 22 Jun 2022 13:13:04 +0900 Subject: [PATCH 1835/2328] Fix too many buttons inside condition --- .../Sections/Maintenance/BeatmapSettings.cs | 94 +++++++++---------- .../Maintenance/CollectionsSettings.cs | 1 - 2 files changed, 47 insertions(+), 48 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs index 8039ee7cd9..8c8c2c96ff 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs @@ -35,54 +35,54 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance legacyImportManager.ImportFromStableAsync(StableContent.Beatmaps).ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true)); } }); - - Add(deleteBeatmapsButton = new DangerousSettingsButton - { - Text = MaintenanceSettingsStrings.DeleteAllBeatmaps, - Action = () => - { - dialogOverlay?.Push(new MassDeleteConfirmationDialog(() => - { - deleteBeatmapsButton.Enabled.Value = false; - Task.Run(() => beatmaps.Delete()).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true)); - })); - } - }); - - Add(deleteBeatmapVideosButton = new DangerousSettingsButton - { - Text = MaintenanceSettingsStrings.DeleteAllBeatmapVideos, - Action = () => - { - dialogOverlay?.Push(new MassVideoDeleteConfirmationDialog(() => - { - deleteBeatmapVideosButton.Enabled.Value = false; - Task.Run(beatmaps.DeleteAllVideos).ContinueWith(t => Schedule(() => deleteBeatmapVideosButton.Enabled.Value = true)); - })); - } - }); - AddRange(new Drawable[] - { - restoreButton = new SettingsButton - { - Text = MaintenanceSettingsStrings.RestoreAllHiddenDifficulties, - Action = () => - { - restoreButton.Enabled.Value = false; - Task.Run(beatmaps.RestoreAll).ContinueWith(t => Schedule(() => restoreButton.Enabled.Value = true)); - } - }, - undeleteButton = new SettingsButton - { - Text = MaintenanceSettingsStrings.RestoreAllRecentlyDeletedBeatmaps, - Action = () => - { - undeleteButton.Enabled.Value = false; - Task.Run(beatmaps.UndeleteAll).ContinueWith(t => Schedule(() => undeleteButton.Enabled.Value = true)); - } - } - }); } + + Add(deleteBeatmapsButton = new DangerousSettingsButton + { + Text = MaintenanceSettingsStrings.DeleteAllBeatmaps, + Action = () => + { + dialogOverlay?.Push(new MassDeleteConfirmationDialog(() => + { + deleteBeatmapsButton.Enabled.Value = false; + Task.Run(() => beatmaps.Delete()).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true)); + })); + } + }); + + Add(deleteBeatmapVideosButton = new DangerousSettingsButton + { + Text = MaintenanceSettingsStrings.DeleteAllBeatmapVideos, + Action = () => + { + dialogOverlay?.Push(new MassVideoDeleteConfirmationDialog(() => + { + deleteBeatmapVideosButton.Enabled.Value = false; + Task.Run(beatmaps.DeleteAllVideos).ContinueWith(t => Schedule(() => deleteBeatmapVideosButton.Enabled.Value = true)); + })); + } + }); + AddRange(new Drawable[] + { + restoreButton = new SettingsButton + { + Text = MaintenanceSettingsStrings.RestoreAllHiddenDifficulties, + Action = () => + { + restoreButton.Enabled.Value = false; + Task.Run(beatmaps.RestoreAll).ContinueWith(t => Schedule(() => restoreButton.Enabled.Value = true)); + } + }, + undeleteButton = new SettingsButton + { + Text = MaintenanceSettingsStrings.RestoreAllRecentlyDeletedBeatmaps, + Action = () => + { + undeleteButton.Enabled.Value = false; + Task.Run(beatmaps.UndeleteAll).ContinueWith(t => Schedule(() => undeleteButton.Enabled.Value = true)); + } + } + }); } } } diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs index 8387582fcb..74e9ebc084 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs @@ -21,7 +21,6 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance if (collectionManager == null) return; if (legacyImportManager?.SupportsImportFromStable == true) - { Add(importCollectionsButton = new SettingsButton { From f561d5b4ad5a96d88690c14126efe41ee3e946eb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Jun 2022 14:32:42 +0900 Subject: [PATCH 1836/2328] Change always-discarded-parameter inspection to hint See https://github.com/ppy/osu/blob/f8830c6850128456266c82de83273204f8b74ac0/osu.Game/Rulesets/Scoring/ScoreProcessor.cs#L518 Coming up as a suggestion (the only one in the solution). --- osu.sln.DotSettings | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 286a1eb29f..e732b25951 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -126,6 +126,8 @@ HINT HINT WARNING + HINT + HINT HINT HINT HINT From 950551f4fda91db3ab8a078b29d2f4977fd3d370 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Wed, 22 Jun 2022 15:33:42 +0900 Subject: [PATCH 1837/2328] Fix metronome arm being stuck white when paused 'close enough' to center --- osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 37fc38404f..3895959982 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -276,6 +276,7 @@ namespace osu.Game.Screens.Edit.Timing if (Precision.AlmostEquals(swing.Rotation, 0, 1)) { swing.RotateTo(0, 60, Easing.OutQuint); + stick.FadeColour(overlayColourProvider.Colour2, 1000, Easing.OutQuint); sampleLatch?.Play(); return; } From 948c28f41532bd3b8406ce371cb453bdf1dbaca1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Jun 2022 20:34:05 +0900 Subject: [PATCH 1838/2328] Fix collection modified during `BlockAllOperations` if any subscriptions have been established --- osu.Game/Database/RealmAccess.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index cf9109eb8b..68f9dcb541 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -822,7 +822,7 @@ namespace osu.Game.Database // Before disposing the update context, clean up all subscriptions. // Note that in the case of realm notification subscriptions, this is not really required (they will be cleaned up by disposal). // In the case of custom subscriptions, we want them to fire before the update realm is disposed in case they do any follow-up work. - foreach (var action in customSubscriptionsResetMap) + foreach (var action in customSubscriptionsResetMap.ToArray()) { action.Value?.Dispose(); customSubscriptionsResetMap[action.Key] = null; From bf5a7e3f2aa077fcbddaea82e510b74975bb2973 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Wed, 22 Jun 2022 17:01:28 -0400 Subject: [PATCH 1839/2328] add locked room filter --- .../Lounge/Components/FilterCriteria.cs | 1 + .../Lounge/Components/RoomsContainer.cs | 2 ++ .../OnlinePlay/Lounge/LoungeSubScreen.cs | 19 +++++++++++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs index 67e805986a..45c1b9b394 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs @@ -13,5 +13,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components public RoomStatusFilter Status; public string Category; public RulesetInfo Ruleset; + public bool Locked = true; } } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs index 2c3a2997cc..908505e386 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs @@ -87,6 +87,8 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components matchingFilter &= r.FilterTerms.Any(term => term.ToString().Contains(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase)); } + matchingFilter &= criteria.Locked || !r.Room.HasPassword.Value; + r.MatchingFilter = matchingFilter; } }); diff --git a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs index f7f3c27ede..a726ff632f 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs @@ -85,6 +85,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge private RoomsContainer roomsContainer; private SearchTextBox searchTextBox; private Dropdown statusDropdown; + private Checkbox lockedCheckbox; [BackgroundDependencyLoader(true)] private void load([CanBeNull] IdleTracker idleTracker) @@ -224,9 +225,12 @@ namespace osu.Game.Screens.OnlinePlay.Lounge { SearchString = searchTextBox.Current.Value, Ruleset = ruleset.Value, - Status = statusDropdown.Current.Value + Status = statusDropdown.Current.Value, + Locked = lockedCheckbox.Current.Value, }; + #endregion + protected virtual IEnumerable CreateFilterControls() { statusDropdown = new SlimEnumDropdown @@ -237,10 +241,17 @@ namespace osu.Game.Screens.OnlinePlay.Lounge statusDropdown.Current.BindValueChanged(_ => UpdateFilter()); - yield return statusDropdown; - } + lockedCheckbox = new OsuTabControlCheckbox + { + Current = new Bindable(true), + RelativeSizeAxes = Axes.None, + Text = @"Show Locked", + }; - #endregion + lockedCheckbox.Current.BindValueChanged(_ => UpdateFilter()); + + return new Drawable[] { lockedCheckbox, statusDropdown, }; + } public override void OnEntering(ScreenTransitionEvent e) { From a03cfbc2d4ec60c07c3ea2156dad084a7e123247 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Wed, 22 Jun 2022 17:01:42 -0400 Subject: [PATCH 1840/2328] add test coverage --- .../TestSceneLoungeRoomsContainer.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs index 171f8eea52..363a2b4a4d 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs @@ -157,6 +157,26 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("3 rooms visible", () => container.Rooms.Count(r => r.IsPresent) == 3); } + [Test] + public void TestLockedFiltering() + { + AddStep("add rooms", () => + { + RoomManager.AddRooms(1, withPassword: true); + RoomManager.AddRooms(1, withPassword: false); + }); + + AddUntilStep("both rooms shown", () => container.Rooms.Count(r => r.IsPresent) == 2); + + AddStep("filter locked rooms", () => container.Filter.Value = new FilterCriteria { Locked = false }); + + AddUntilStep("locked room hidden", () => container.Rooms.All(r => !r.Room.HasPassword.Value)); + + AddStep("unfilter locked rooms", () => container.Filter.SetDefault()); + + AddUntilStep("both rooms shown", () => container.Rooms.Count(r => r.IsPresent) == 2); + } + [Test] public void TestPasswordProtectedRooms() { From bc557bacf05199aecd51adec69536eb1cdb10a9a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Jun 2022 14:10:17 +0900 Subject: [PATCH 1841/2328] Remove room null assertion in `TestMultiplayerClient.ChangeState` to avoid assert This method is run from async contexts, but `get_Room` asserts update thread which is not the case. Was causing silent test failures (showing as pass but failing `dotnet-test` via return code): TestSceneMultiplayer.TestGameplayFlow ``` [13:13:17] : [dotnet test] [runtime] 2022-06-22 13:13:16 [error]: Score preparation failed! [13:13:17] : [dotnet test] [runtime] 2022-06-22 13:13:16 [error]: NUnit.Framework.AssertionException: : [13:13:17] : [dotnet test] [runtime] 2022-06-22 13:13:16 [error]: at osu.Framework.Logging.ThrowingTraceListener.Fail(String message1, String message2) [13:13:17] : [dotnet test] [runtime] 2022-06-22 13:13:16 [error]: at System.Diagnostics.TraceInternal.Fail(String message, String detailMessage) [13:13:17] : [dotnet test] [runtime] 2022-06-22 13:13:16 [error]: at System.Diagnostics.TraceInternal.TraceProvider.Fail(String message, String detailMessage) [13:13:17] : [dotnet test] [runtime] 2022-06-22 13:13:16 [error]: at System.Diagnostics.Debug.Fail(String message, String detailMessage) [13:13:17] : [dotnet test] [runtime] 2022-06-22 13:13:16 [error]: at osu.Game.Online.Multiplayer.MultiplayerClient.get_Room() in /opt/buildagent/work/ecd860037212ac52/osu.Game/Online/Multiplayer/MultiplayerClient.cs:line 98 [13:13:17] : [dotnet test] [runtime] 2022-06-22 13:13:16 [error]: at osu.Game.Tests.Visual.Multiplayer.TestMultiplayerClient.ChangeState(MultiplayerUserState newState) in /opt/buildagent/work/ecd860037212ac52/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs:line 275 [13:13:17] : [dotnet test] [runtime] 2022-06-22 13:13:16 [error]: at osu.Game.Screens.OnlinePlay.Multiplayer.MultiplayerPlayer.PrepareScoreForResultsAsync(Score score) in /opt/buildagent/work/ecd860037212ac52/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs:line 223 [13:13:17] : [dotnet test] [runtime] 2022-06-22 13:13:16 [error]: at osu.Game.Screens.Play.Player.prepareScoreForResults() in /opt/buildagent/work/ecd860037212ac52/osu.Game/Screens/Play/Player.cs:line 747 ``` --- osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs index e5a1236abf..f2024a3107 100644 --- a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs +++ b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs @@ -272,8 +272,6 @@ namespace osu.Game.Tests.Visual.Multiplayer public override Task ChangeState(MultiplayerUserState newState) { - Debug.Assert(Room != null); - if (newState == MultiplayerUserState.Idle && LocalUser?.State == MultiplayerUserState.WaitingForLoad) return Task.CompletedTask; From ed9c55a7765d8e9771d6dd3b6ceca350c5781a3f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Jun 2022 14:33:07 +0900 Subject: [PATCH 1842/2328] Ban usage of `ManualResetEventSlim.Wait()` without a timeout value --- CodeAnalysis/BannedSymbols.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CodeAnalysis/BannedSymbols.txt b/CodeAnalysis/BannedSymbols.txt index b72df0a306..77197c4c51 100644 --- a/CodeAnalysis/BannedSymbols.txt +++ b/CodeAnalysis/BannedSymbols.txt @@ -16,3 +16,4 @@ M:Realms.CollectionExtensions.SubscribeForNotifications`1(System.Linq.IQueryable M:Realms.CollectionExtensions.SubscribeForNotifications`1(System.Collections.Generic.IList{``0},Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IList,NotificationCallbackDelegate) instead. M:System.Threading.Tasks.Task.Wait();Don't use Task.Wait. Use Task.WaitSafely() to ensure we avoid deadlocks. P:System.Threading.Tasks.Task`1.Result;Don't use Task.Result. Use Task.GetResultSafely() to ensure we avoid deadlocks. +M:System.Threading.ManualResetEventSlim.Wait();Specify a timeout to avoid waiting forever. From 7ef8b7df5f788427d2d0c0309923babb073b23bc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Jun 2022 14:33:20 +0900 Subject: [PATCH 1843/2328] Add timeout for all `ManualResetEventSlim.Wait` invocations Timeout values were taken as best-guesses of upper values we'd expect from sane execution. --- osu.Game.Benchmarks/BenchmarkRealmReads.cs | 4 ++-- osu.Game.Tests/Database/GeneralUsageTests.cs | 4 ++-- .../Visual/Multiplayer/TestSceneDrawableLoungeRoom.cs | 2 +- osu.Game/Database/DatabaseContextFactory.cs | 2 +- osu.Game/Graphics/ScreenshotManager.cs | 2 +- osu.Game/OsuGameBase.cs | 3 ++- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/osu.Game.Benchmarks/BenchmarkRealmReads.cs b/osu.Game.Benchmarks/BenchmarkRealmReads.cs index bdc24315bf..b26fc3fd59 100644 --- a/osu.Game.Benchmarks/BenchmarkRealmReads.cs +++ b/osu.Game.Benchmarks/BenchmarkRealmReads.cs @@ -76,7 +76,7 @@ namespace osu.Game.Benchmarks } }); - done.Wait(); + done.Wait(60000); } [Benchmark] @@ -115,7 +115,7 @@ namespace osu.Game.Benchmarks } }); - done.Wait(); + done.Wait(60000); } [Benchmark] diff --git a/osu.Game.Tests/Database/GeneralUsageTests.cs b/osu.Game.Tests/Database/GeneralUsageTests.cs index d10ab2ad2b..c28a0c63af 100644 --- a/osu.Game.Tests/Database/GeneralUsageTests.cs +++ b/osu.Game.Tests/Database/GeneralUsageTests.cs @@ -79,11 +79,11 @@ namespace osu.Game.Tests.Database { hasThreadedUsage.Set(); - stopThreadedUsage.Wait(); + stopThreadedUsage.Wait(60000); }); }, TaskCreationOptions.LongRunning | TaskCreationOptions.HideScheduler); - hasThreadedUsage.Wait(); + hasThreadedUsage.Wait(60000); Assert.Throws(() => { diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableLoungeRoom.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableLoungeRoom.cs index fc3079cba0..5b4e0a88aa 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableLoungeRoom.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableLoungeRoom.cs @@ -46,7 +46,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { Task.Run(() => { - allowResponseCallback.Wait(); + allowResponseCallback.Wait(10000); allowResponseCallback.Reset(); Schedule(() => d?.Invoke("Incorrect password")); }); diff --git a/osu.Game/Database/DatabaseContextFactory.cs b/osu.Game/Database/DatabaseContextFactory.cs index 8af649fbfa..075383c6e1 100644 --- a/osu.Game/Database/DatabaseContextFactory.cs +++ b/osu.Game/Database/DatabaseContextFactory.cs @@ -209,6 +209,6 @@ namespace osu.Game.Database public void SetMigrationCompletion() => migrationComplete.Set(); - public void WaitForMigrationCompletion() => migrationComplete.Wait(); + public void WaitForMigrationCompletion() => migrationComplete.Wait(300000); } } diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index 7147f89dd0..fe9865dad6 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -103,7 +103,7 @@ namespace osu.Game.Graphics framesWaitedEvent.Set(); }, 10, true); - framesWaitedEvent.Wait(); + framesWaitedEvent.Wait(1000); waitDelegate.Cancel(); } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 58929ce4a4..7bbad3bb72 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -451,7 +451,8 @@ namespace osu.Game readyToRun.Set(); }, false); - readyToRun.Wait(); + if (!readyToRun.Wait(30000)) + throw new TimeoutException("Attempting to block for migration took too long."); bool? cleanupSucceded = (Storage as OsuStorage)?.Migrate(Host.GetStorage(path)); From 51268d0cc8333bb7f74e74e6fc776b698ea47d63 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Jun 2022 15:28:20 +0900 Subject: [PATCH 1844/2328] Throw on `Wait` failure in a few remaining cases --- osu.Game/Database/DatabaseContextFactory.cs | 6 +++++- osu.Game/Graphics/ScreenshotManager.cs | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/DatabaseContextFactory.cs b/osu.Game/Database/DatabaseContextFactory.cs index 075383c6e1..af91fb4971 100644 --- a/osu.Game/Database/DatabaseContextFactory.cs +++ b/osu.Game/Database/DatabaseContextFactory.cs @@ -209,6 +209,10 @@ namespace osu.Game.Database public void SetMigrationCompletion() => migrationComplete.Set(); - public void WaitForMigrationCompletion() => migrationComplete.Wait(300000); + public void WaitForMigrationCompletion() + { + if (!migrationComplete.Wait(300000)) + throw new TimeoutException("Migration took too long (likely stuck)."); + } } } diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index fe9865dad6..2cc9e63c87 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -103,7 +103,9 @@ namespace osu.Game.Graphics framesWaitedEvent.Set(); }, 10, true); - framesWaitedEvent.Wait(1000); + if (!framesWaitedEvent.Wait(1000)) + throw new TimeoutException("Screenshot data did not arrive in a timely fashion"); + waitDelegate.Cancel(); } } From 9be13f88fd3711bddce59ec63522e0aff22b499b Mon Sep 17 00:00:00 2001 From: 63411 <62799417+molneya@users.noreply.github.com> Date: Thu, 23 Jun 2022 15:51:28 +0800 Subject: [PATCH 1845/2328] revert customAccuracy changes --- .../Difficulty/ManiaPerformanceCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs index 216dfe6c47..a925e7c0ac 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs @@ -73,6 +73,6 @@ namespace osu.Game.Rulesets.Mania.Difficulty /// /// Accuracy used to weight judgements independently from the score's actual accuracy. /// - private double customAccuracy => Math.Max((countPerfect * 320 + countGreat * 300 + countGood * 200 + countOk * 100 + countMeh * 50 - countMiss * 100) / (totalHits * 320), 0); + private double customAccuracy => (countPerfect * 320 + countGreat * 300 + countGood * 200 + countOk * 100 + countMeh * 50) / (totalHits * 320); } } From 158f0a1f233d14234ddc999dfe6b5d763f41e733 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Jun 2022 17:38:34 +0900 Subject: [PATCH 1846/2328] Remove remaining `Room!=null` checks in `TestMultiplayerClient` where possible --- .../Visual/Multiplayer/TestMultiplayerClient.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs index f2024a3107..6b7495762a 100644 --- a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs +++ b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs @@ -87,8 +87,6 @@ namespace osu.Game.Tests.Visual.Multiplayer switch (Room?.MatchState) { case TeamVersusRoomState teamVersus: - Debug.Assert(Room != null); - // simulate the server's automatic assignment of users to teams on join. // the "best" team is the one with the least users on it. int bestTeam = teamVersus.Teams @@ -103,6 +101,7 @@ namespace osu.Game.Tests.Visual.Multiplayer public void RemoveUser(APIUser user) { Debug.Assert(Room != null); + ((IMultiplayerClient)this).UserLeft(new MultiplayerRoomUser(user.Id)); Schedule(() => @@ -114,25 +113,23 @@ namespace osu.Game.Tests.Visual.Multiplayer public void ChangeRoomState(MultiplayerRoomState newState) { - Debug.Assert(Room != null); ((IMultiplayerClient)this).RoomStateChanged(newState); } public void ChangeUserState(int userId, MultiplayerUserState newState) { - Debug.Assert(Room != null); - ((IMultiplayerClient)this).UserStateChanged(userId, newState); updateRoomStateIfRequired(); } private void updateRoomStateIfRequired() { - Debug.Assert(Room != null); Debug.Assert(APIRoom != null); Schedule(() => { + Debug.Assert(Room != null); + switch (Room.State) { case MultiplayerRoomState.Open: @@ -179,8 +176,6 @@ namespace osu.Game.Tests.Visual.Multiplayer public void ChangeUserBeatmapAvailability(int userId, BeatmapAvailability newBeatmapAvailability) { - Debug.Assert(Room != null); - ((IMultiplayerClient)this).UserBeatmapAvailabilityChanged(userId, newBeatmapAvailability); } @@ -290,7 +285,6 @@ namespace osu.Game.Tests.Visual.Multiplayer public void ChangeUserMods(int userId, IEnumerable newMods) { - Debug.Assert(Room != null); ((IMultiplayerClient)this).UserModsChanged(userId, newMods.ToList()); } @@ -338,7 +332,6 @@ namespace osu.Game.Tests.Visual.Multiplayer public override Task AbortGameplay() { - Debug.Assert(Room != null); Debug.Assert(LocalUser != null); ChangeUserState(LocalUser.UserID, MultiplayerUserState.Idle); From 4a316fad2fedf334db9761764a46d59fb9e18e3a Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 23 Jun 2022 17:18:37 +0900 Subject: [PATCH 1847/2328] Add audio feedback for rearranging list items --- .../OsuRearrangeableListContainer.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs b/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs index 84d0d1eb32..a314992287 100644 --- a/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs +++ b/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs @@ -3,9 +3,14 @@ #nullable disable +using System.Collections.Specialized; +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Utils; namespace osu.Game.Graphics.Containers { @@ -18,11 +23,44 @@ namespace osu.Game.Graphics.Containers protected override ScrollContainer CreateScrollContainer() => new OsuScrollContainer(); + private Sample sampleSwap; + private double sampleLastPlaybackTime; + protected sealed override RearrangeableListItem CreateDrawable(TModel item) => CreateOsuDrawable(item).With(d => { d.DragActive.BindTo(DragActive); }); protected abstract OsuRearrangeableListItem CreateOsuDrawable(TModel item); + + protected OsuRearrangeableListContainer() + { + Items.CollectionChanged += (_, args) => + { + if (args.Action == NotifyCollectionChangedAction.Move) + playSwapSample(); + }; + } + + private void playSwapSample() + { + if (Time.Current - sampleLastPlaybackTime <= 35) + return; + + var channel = sampleSwap?.GetChannel(); + if (channel == null) + return; + + channel.Frequency.Value = 0.96 + RNG.NextDouble(0.08); + channel.Play(); + sampleLastPlaybackTime = Time.Current; + } + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + sampleSwap = audio.Samples.Get(@"UI/item-swap"); + sampleLastPlaybackTime = Time.Current; + } } } From d6b073ebad526db327ad0fcb43d4c9f9dbaf2fbb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Jun 2022 16:39:33 +0900 Subject: [PATCH 1848/2328] Move `DifficultyRetrieve` to own class and split both pathways into separate constructors --- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 63 ++++---------- .../Beatmaps/Drawables/DifficultyRetriever.cs | 85 +++++++++++++++++++ 2 files changed, 100 insertions(+), 48 deletions(-) create mode 100644 osu.Game/Beatmaps/Drawables/DifficultyRetriever.cs diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index a1b0f04aae..a5b13d10e6 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; -using System.Threading; using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -63,7 +62,8 @@ namespace osu.Game.Beatmaps.Drawables /// The mods to show the difficulty with. /// Whether to display a tooltip when hovered. /// Whether to perform difficulty lookup (including calculation if necessary). - public DifficultyIcon([NotNull] IBeatmapInfo beatmapInfo, [CanBeNull] IRulesetInfo ruleset, [CanBeNull] IReadOnlyList mods, bool shouldShowTooltip = true, bool performBackgroundDifficultyLookup = true) + public DifficultyIcon([NotNull] IBeatmapInfo beatmapInfo, [CanBeNull] IRulesetInfo ruleset, [CanBeNull] IReadOnlyList mods, bool shouldShowTooltip = true, + bool performBackgroundDifficultyLookup = true) : this(beatmapInfo, shouldShowTooltip, performBackgroundDifficultyLookup) { this.ruleset = ruleset ?? beatmapInfo.Ruleset; @@ -125,13 +125,21 @@ namespace osu.Game.Beatmaps.Drawables }; if (performBackgroundDifficultyLookup) - iconContainer.Add(new DelayedLoadUnloadWrapper(() => new DifficultyRetriever(beatmapInfo, ruleset, mods) { StarDifficulty = { BindTarget = difficultyBindable } }, 0)); + iconContainer.Add(new DelayedLoadUnloadWrapper(createDifficultyRetriever, 0)); else difficultyBindable.Value = new StarDifficulty(beatmapInfo.StarRating, 0); difficultyBindable.BindValueChanged(difficulty => background.Colour = colours.ForStarDifficulty(difficulty.NewValue.Stars)); } + private Drawable createDifficultyRetriever() + { + if (ruleset != null && mods != null) + return new DifficultyRetriever(beatmapInfo, ruleset, mods) { StarDifficulty = { BindTarget = difficultyBindable } }; + + return new DifficultyRetriever(beatmapInfo) { StarDifficulty = { BindTarget = difficultyBindable } }; + } + private Drawable getRulesetIcon() { int? onlineID = (ruleset ?? beatmapInfo.Ruleset).OnlineID; @@ -142,51 +150,10 @@ namespace osu.Game.Beatmaps.Drawables return new SpriteIcon { Icon = FontAwesome.Regular.QuestionCircle }; } - ITooltip IHasCustomTooltip.GetCustomTooltip() => new DifficultyIconTooltip(); + ITooltip IHasCustomTooltip. + GetCustomTooltip() => new DifficultyIconTooltip(); - DifficultyIconTooltipContent IHasCustomTooltip.TooltipContent => shouldShowTooltip ? new DifficultyIconTooltipContent(beatmapInfo, difficultyBindable) : null; - - private class DifficultyRetriever : Component - { - public readonly Bindable StarDifficulty = new Bindable(); - - private readonly IBeatmapInfo beatmapInfo; - private readonly IRulesetInfo ruleset; - private readonly IReadOnlyList mods; - - private CancellationTokenSource difficultyCancellation; - - [Resolved] - private BeatmapDifficultyCache difficultyCache { get; set; } - - public DifficultyRetriever(IBeatmapInfo beatmapInfo, IRulesetInfo ruleset, IReadOnlyList mods) - { - this.beatmapInfo = beatmapInfo; - this.ruleset = ruleset; - this.mods = mods; - } - - private IBindable localStarDifficulty; - - [BackgroundDependencyLoader] - private void load() - { - difficultyCancellation = new CancellationTokenSource(); - localStarDifficulty = ruleset != null - ? difficultyCache.GetBindableDifficulty(beatmapInfo, ruleset, mods, difficultyCancellation.Token) - : difficultyCache.GetBindableDifficulty(beatmapInfo, difficultyCancellation.Token); - localStarDifficulty.BindValueChanged(d => - { - if (d.NewValue is StarDifficulty diff) - StarDifficulty.Value = diff; - }); - } - - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - difficultyCancellation?.Cancel(); - } - } + DifficultyIconTooltipContent IHasCustomTooltip. + TooltipContent => shouldShowTooltip ? new DifficultyIconTooltipContent(beatmapInfo, difficultyBindable) : null; } } diff --git a/osu.Game/Beatmaps/Drawables/DifficultyRetriever.cs b/osu.Game/Beatmaps/Drawables/DifficultyRetriever.cs new file mode 100644 index 0000000000..a993f0657b --- /dev/null +++ b/osu.Game/Beatmaps/Drawables/DifficultyRetriever.cs @@ -0,0 +1,85 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using System.Collections.Generic; +using System.Threading; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; + +namespace osu.Game.Beatmaps.Drawables +{ + /// + /// A component solely responsible for calculating difficulty in the background. + /// Intended for use with to only run processing when usage is on-screen. + /// + public class DifficultyRetriever : Component + { + /// + /// The bindable star difficulty. + /// + public IBindable StarDifficulty => starDifficulty; + + private readonly Bindable starDifficulty = new Bindable(); + + private readonly IBeatmapInfo beatmapInfo; + + private readonly IRulesetInfo? ruleset; + private readonly IReadOnlyList? mods; + + private readonly CancellationTokenSource difficultyCancellation = new CancellationTokenSource(); + + [Resolved] + private BeatmapDifficultyCache difficultyCache { get; set; } = null!; + + /// + /// Construct a difficulty retriever that tracks the current ruleset / mod selection. + /// + /// The beatmap to use for calculation. + public DifficultyRetriever(IBeatmapInfo beatmapInfo) + { + this.beatmapInfo = beatmapInfo; + } + + /// + /// Construct a difficulty retriever that is calculated only once for the specified ruleset / mod combination. + /// This will not track global ruleset and mod changes. + /// + /// The beatmap to use for calculation. + /// The ruleset to use for calculation. + /// The mods to use for calculation. + public DifficultyRetriever(IBeatmapInfo beatmapInfo, IRulesetInfo ruleset, IReadOnlyList mods) + { + this.beatmapInfo = beatmapInfo; + this.ruleset = ruleset; + this.mods = mods; + } + + private IBindable localStarDifficulty = null!; + + [BackgroundDependencyLoader] + private void load() + { + localStarDifficulty = ruleset != null + ? difficultyCache.GetBindableDifficulty(beatmapInfo, ruleset, mods, difficultyCancellation.Token) + : difficultyCache.GetBindableDifficulty(beatmapInfo, difficultyCancellation.Token); + + localStarDifficulty.BindValueChanged(d => + { + if (d.NewValue is StarDifficulty diff) + starDifficulty.Value = diff; + }); + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + difficultyCancellation.Cancel(); + } + } +} From 3a83e5684c64226005ddddc349af36f1defba66a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Jun 2022 16:55:22 +0900 Subject: [PATCH 1849/2328] Tidy up `DifficultyIcon` --- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index a5b13d10e6..48ee1e1fc8 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -26,8 +26,6 @@ namespace osu.Game.Beatmaps.Drawables { public class DifficultyIcon : CompositeDrawable, IHasCustomTooltip { - private readonly Container iconContainer; - /// /// Size of this difficulty icon. /// @@ -46,14 +44,19 @@ namespace osu.Game.Beatmaps.Drawables [CanBeNull] private readonly IReadOnlyList mods; + [Resolved] + private IRulesetStore rulesets { get; set; } + private readonly bool shouldShowTooltip; private readonly bool performBackgroundDifficultyLookup; - private readonly Bindable difficultyBindable = new Bindable(); - private Drawable background; + private readonly Container iconContainer; + + private readonly Bindable difficultyBindable = new Bindable(); + /// /// Creates a new with a given and combination. /// @@ -87,9 +90,6 @@ namespace osu.Game.Beatmaps.Drawables InternalChild = iconContainer = new Container { Size = new Vector2(20f) }; } - [Resolved] - private IRulesetStore rulesets { get; set; } - [BackgroundDependencyLoader] private void load(OsuColour colours) { From 4a2ca4394b7ccd79fe32232ce3a84fa93a3f5234 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Jun 2022 18:37:36 +0900 Subject: [PATCH 1850/2328] Remove unused `ModeTypeInfo` class --- .../OnlinePlay/Components/ModeTypeInfo.cs | 78 ------------------- 1 file changed, 78 deletions(-) delete mode 100644 osu.Game/Screens/OnlinePlay/Components/ModeTypeInfo.cs diff --git a/osu.Game/Screens/OnlinePlay/Components/ModeTypeInfo.cs b/osu.Game/Screens/OnlinePlay/Components/ModeTypeInfo.cs deleted file mode 100644 index 641776a9e8..0000000000 --- a/osu.Game/Screens/OnlinePlay/Components/ModeTypeInfo.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -#nullable disable - -using System.Linq; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Beatmaps.Drawables; -using osu.Game.Rulesets; -using osuTK; - -namespace osu.Game.Screens.OnlinePlay.Components -{ - public class ModeTypeInfo : OnlinePlayComposite - { - private const float height = 28; - private const float transition_duration = 100; - - [Resolved] - private RulesetStore rulesets { get; set; } - - private Container drawableRuleset; - - public ModeTypeInfo() - { - AutoSizeAxes = Axes.Both; - } - - [BackgroundDependencyLoader] - private void load() - { - Container gameTypeContainer; - - InternalChild = new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5f, 0f), - LayoutDuration = 100, - Children = new[] - { - drawableRuleset = new Container - { - AutoSizeAxes = Axes.Both, - }, - gameTypeContainer = new Container - { - AutoSizeAxes = Axes.Both, - }, - }, - }; - - Type.BindValueChanged(type => gameTypeContainer.Child = new DrawableGameType(type.NewValue) { Size = new Vector2(height) }, true); - - Playlist.CollectionChanged += (_, __) => updateBeatmap(); - - updateBeatmap(); - } - - private void updateBeatmap() - { - var item = Playlist.FirstOrDefault(); - var ruleset = item == null ? null : rulesets.GetRuleset(item.RulesetID)?.CreateInstance(); - - if (item?.Beatmap != null && ruleset != null) - { - var mods = item.RequiredMods.Select(m => m.ToMod(ruleset)).ToArray(); - - drawableRuleset.FadeIn(transition_duration); - drawableRuleset.Child = new DifficultyIcon(item.Beatmap, ruleset.RulesetInfo, mods) { Size = new Vector2(height) }; - } - else - drawableRuleset.FadeOut(transition_duration); - } - } -} From 7dec530ca5b1a3cdf18c56f76863d9eaf3a2c633 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Jun 2022 18:37:53 +0900 Subject: [PATCH 1851/2328] Split out simple `DifficultyIcon` with no calculation overhead and update usages --- .../Drawables/CalculatingDifficultyIcon.cs | 80 +++++++++++++++++ osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 89 ++++++------------- .../Drawables/GroupedDifficultyIcon.cs | 2 +- osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs | 3 +- .../OnlinePlay/DrawableRoomPlaylistItem.cs | 2 +- .../Carousel/DrawableCarouselBeatmap.cs | 2 +- .../Carousel/FilterableDifficultyIcon.cs | 4 +- .../Select/Carousel/SetPanelContent.cs | 8 +- 8 files changed, 120 insertions(+), 70 deletions(-) create mode 100644 osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs diff --git a/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs new file mode 100644 index 0000000000..5f914f446c --- /dev/null +++ b/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs @@ -0,0 +1,80 @@ +#nullable enable +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; +using osuTK; + +namespace osu.Game.Beatmaps.Drawables +{ + /// + /// A difficulty icon which automatically calculates difficulty in the background. + /// + public class CalculatingDifficultyIcon : CompositeDrawable + { + /// + /// Size of this difficulty icon. + /// + public new Vector2 Size + { + get => difficultyIcon.Size; + set => difficultyIcon.Size = value; + } + + private readonly IRulesetInfo? ruleset; + + private readonly IReadOnlyList? mods; + + private readonly IBeatmapInfo beatmapInfo; + + private readonly DifficultyIcon difficultyIcon; + + /// + /// Creates a new with a given and combination. + /// + /// The beatmap to show the difficulty of. + /// The ruleset to show the difficulty with. + /// The mods to show the difficulty with. + /// Whether to display a tooltip when hovered. + /// Whether to perform difficulty lookup (including calculation if necessary). + public CalculatingDifficultyIcon(IBeatmapInfo beatmapInfo, IRulesetInfo? ruleset, IReadOnlyList? mods, bool shouldShowTooltip = true, + bool performBackgroundDifficultyLookup = true) + : this(beatmapInfo, shouldShowTooltip, performBackgroundDifficultyLookup) + { + this.ruleset = ruleset ?? beatmapInfo.Ruleset; + this.mods = mods ?? Array.Empty(); + } + + /// + /// Creates a new that follows the currently-selected ruleset and mods. + /// + /// The beatmap to show the difficulty of. + /// Whether to display a tooltip when hovered. + /// Whether to perform difficulty lookup (including calculation if necessary). + public CalculatingDifficultyIcon(IBeatmapInfo beatmapInfo, bool shouldShowTooltip = true, bool performBackgroundDifficultyLookup = true) + { + this.beatmapInfo = beatmapInfo ?? throw new ArgumentNullException(nameof(beatmapInfo)); + + AutoSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + difficultyIcon = new DifficultyIcon(beatmapInfo, beatmapInfo.Ruleset), + new DelayedLoadUnloadWrapper(createDifficultyRetriever, 0) + }; + } + + private Drawable createDifficultyRetriever() + { + if (ruleset != null && mods != null) + return new DifficultyRetriever(beatmapInfo, ruleset, mods) { StarDifficulty = { BindTarget = difficultyIcon.Current } }; + + return new DifficultyRetriever(beatmapInfo) { StarDifficulty = { BindTarget = difficultyIcon.Current } }; + } + } +} diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 48ee1e1fc8..d1b15cba76 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -1,11 +1,6 @@ -// 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. -#nullable disable - -using System; -using System.Collections.Generic; -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; @@ -15,16 +10,16 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Rulesets; -using osu.Game.Rulesets.Mods; using osuTK; using osuTK.Graphics; namespace osu.Game.Beatmaps.Drawables { - public class DifficultyIcon : CompositeDrawable, IHasCustomTooltip + public class DifficultyIcon : CompositeDrawable, IHasCustomTooltip, IHasCurrentValue { /// /// Size of this difficulty icon. @@ -35,58 +30,46 @@ namespace osu.Game.Beatmaps.Drawables set => iconContainer.Size = value; } - [NotNull] - private readonly IBeatmapInfo beatmapInfo; + private readonly IBeatmapInfo? beatmap; - [CanBeNull] private readonly IRulesetInfo ruleset; - [CanBeNull] - private readonly IReadOnlyList mods; - - [Resolved] - private IRulesetStore rulesets { get; set; } - - private readonly bool shouldShowTooltip; - - private readonly bool performBackgroundDifficultyLookup; - - private Drawable background; + private Drawable background = null!; private readonly Container iconContainer; - private readonly Bindable difficultyBindable = new Bindable(); + private readonly BindableWithCurrent difficulty = new BindableWithCurrent(); + + public virtual Bindable Current + { + get => difficulty.Current; + set => difficulty.Current = value; + } + + [Resolved] + private IRulesetStore rulesets { get; set; } = null!; /// - /// Creates a new with a given and combination. + /// Creates a new with a tooltip. Will use provided beatmap's for initial value. /// - /// The beatmap to show the difficulty of. - /// The ruleset to show the difficulty with. - /// The mods to show the difficulty with. - /// Whether to display a tooltip when hovered. - /// Whether to perform difficulty lookup (including calculation if necessary). - public DifficultyIcon([NotNull] IBeatmapInfo beatmapInfo, [CanBeNull] IRulesetInfo ruleset, [CanBeNull] IReadOnlyList mods, bool shouldShowTooltip = true, - bool performBackgroundDifficultyLookup = true) - : this(beatmapInfo, shouldShowTooltip, performBackgroundDifficultyLookup) + /// The beatmap to be displayed in the tooltip, and to be used for the initial star rating value. + /// An optional ruleset to be used for the icon display, in place of the beatmap's ruleset. + public DifficultyIcon(IBeatmapInfo beatmap, IRulesetInfo? ruleset) + : this(ruleset ?? beatmap.Ruleset) { - this.ruleset = ruleset ?? beatmapInfo.Ruleset; - this.mods = mods ?? Array.Empty(); + this.beatmap = beatmap; + Current.Value = new StarDifficulty(beatmap.StarRating, 0); } /// - /// Creates a new that follows the currently-selected ruleset and mods. + /// Creates a new with no tooltip. /// - /// The beatmap to show the difficulty of. - /// Whether to display a tooltip when hovered. - /// Whether to perform difficulty lookup (including calculation if necessary). - public DifficultyIcon([NotNull] IBeatmapInfo beatmapInfo, bool shouldShowTooltip = true, bool performBackgroundDifficultyLookup = true) + /// The ruleset to be used for the icon display. + public DifficultyIcon(IRulesetInfo ruleset) { - this.beatmapInfo = beatmapInfo ?? throw new ArgumentNullException(nameof(beatmapInfo)); - this.shouldShowTooltip = shouldShowTooltip; - this.performBackgroundDifficultyLookup = performBackgroundDifficultyLookup; + this.ruleset = ruleset; AutoSizeAxes = Axes.Both; - InternalChild = iconContainer = new Container { Size = new Vector2(20f) }; } @@ -111,7 +94,6 @@ namespace osu.Game.Beatmaps.Drawables Child = background = new Box { RelativeSizeAxes = Axes.Both, - Colour = colours.ForStarDifficulty(beatmapInfo.StarRating) // Default value that will be re-populated once difficulty calculation completes }, }, new ConstrainedIconContainer @@ -124,25 +106,12 @@ namespace osu.Game.Beatmaps.Drawables }, }; - if (performBackgroundDifficultyLookup) - iconContainer.Add(new DelayedLoadUnloadWrapper(createDifficultyRetriever, 0)); - else - difficultyBindable.Value = new StarDifficulty(beatmapInfo.StarRating, 0); - - difficultyBindable.BindValueChanged(difficulty => background.Colour = colours.ForStarDifficulty(difficulty.NewValue.Stars)); - } - - private Drawable createDifficultyRetriever() - { - if (ruleset != null && mods != null) - return new DifficultyRetriever(beatmapInfo, ruleset, mods) { StarDifficulty = { BindTarget = difficultyBindable } }; - - return new DifficultyRetriever(beatmapInfo) { StarDifficulty = { BindTarget = difficultyBindable } }; + Current.BindValueChanged(difficulty => background.Colour = colours.ForStarDifficulty(difficulty.NewValue.Stars), true); } private Drawable getRulesetIcon() { - int? onlineID = (ruleset ?? beatmapInfo.Ruleset).OnlineID; + int? onlineID = ruleset.OnlineID; if (onlineID >= 0 && rulesets.GetRuleset(onlineID.Value)?.CreateInstance() is Ruleset rulesetInstance) return rulesetInstance.CreateIcon(); @@ -154,6 +123,6 @@ namespace osu.Game.Beatmaps.Drawables GetCustomTooltip() => new DifficultyIconTooltip(); DifficultyIconTooltipContent IHasCustomTooltip. - TooltipContent => shouldShowTooltip ? new DifficultyIconTooltipContent(beatmapInfo, difficultyBindable) : null; + TooltipContent => (beatmap != null ? new DifficultyIconTooltipContent(beatmap, Current) : null)!; } } diff --git a/osu.Game/Beatmaps/Drawables/GroupedDifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/GroupedDifficultyIcon.cs index 15ca4c60d4..a713592246 100644 --- a/osu.Game/Beatmaps/Drawables/GroupedDifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/GroupedDifficultyIcon.cs @@ -19,7 +19,7 @@ namespace osu.Game.Beatmaps.Drawables /// /// Used in cases when there are too many difficulty icons to show. /// - public class GroupedDifficultyIcon : DifficultyIcon + public class GroupedDifficultyIcon : CalculatingDifficultyIcon { public GroupedDifficultyIcon(IEnumerable beatmaps, IRulesetInfo ruleset, Color4 counterColour) : base(beatmaps.OrderBy(b => b.StarRating).Last(), ruleset, null, false) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs index 8d89bb3cc7..2efdb71204 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs @@ -274,8 +274,9 @@ namespace osu.Game.Overlays.BeatmapSet Alpha = 0.5f } }, - icon = new DifficultyIcon(beatmapInfo, shouldShowTooltip: false) + icon = new DifficultyIcon(beatmapInfo.Ruleset) { + Current = { Value = new StarDifficulty(beatmapInfo.StarRating, 0) }, Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(size - tile_icon_padding * 2), diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs index 53519b8b00..a3a176477e 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs @@ -266,7 +266,7 @@ namespace osu.Game.Screens.OnlinePlay } if (beatmap != null) - difficultyIconContainer.Child = new DifficultyIcon(beatmap, ruleset, requiredMods, performBackgroundDifficultyLookup: false) { Size = new Vector2(icon_height) }; + difficultyIconContainer.Child = new DifficultyIcon(beatmap, ruleset) { Size = new Vector2(icon_height) }; else difficultyIconContainer.Clear(); diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 1bea689e7c..79eee63172 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -113,7 +113,7 @@ namespace osu.Game.Screens.Select.Carousel Origin = Anchor.CentreLeft, Children = new Drawable[] { - new DifficultyIcon(beatmapInfo, shouldShowTooltip: false) + new CalculatingDifficultyIcon(beatmapInfo, shouldShowTooltip: false) { Scale = new Vector2(1.8f), }, diff --git a/osu.Game/Screens/Select/Carousel/FilterableDifficultyIcon.cs b/osu.Game/Screens/Select/Carousel/FilterableDifficultyIcon.cs index b0841caa47..3f7d5c13ad 100644 --- a/osu.Game/Screens/Select/Carousel/FilterableDifficultyIcon.cs +++ b/osu.Game/Screens/Select/Carousel/FilterableDifficultyIcon.cs @@ -10,7 +10,7 @@ using osu.Game.Beatmaps.Drawables; namespace osu.Game.Screens.Select.Carousel { - public class FilterableDifficultyIcon : DifficultyIcon + public class FilterableDifficultyIcon : CalculatingDifficultyIcon { private readonly BindableBool filtered = new BindableBool(); @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Select.Carousel public readonly CarouselBeatmap Item; public FilterableDifficultyIcon(CarouselBeatmap item) - : base(item.BeatmapInfo, performBackgroundDifficultyLookup: false) + : base(item.BeatmapInfo) { filtered.BindTo(item.Filtered); filtered.ValueChanged += isFiltered => Schedule(() => this.FadeTo(isFiltered.NewValue ? 0.1f : 1, 100)); diff --git a/osu.Game/Screens/Select/Carousel/SetPanelContent.cs b/osu.Game/Screens/Select/Carousel/SetPanelContent.cs index 73a835d67f..c5e5a70d59 100644 --- a/osu.Game/Screens/Select/Carousel/SetPanelContent.cs +++ b/osu.Game/Screens/Select/Carousel/SetPanelContent.cs @@ -73,7 +73,7 @@ namespace osu.Game.Screens.Select.Carousel TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 }, Status = beatmapSet.Status }, - new FillFlowContainer + new FillFlowContainer { AutoSizeAxes = Axes.Both, Spacing = new Vector2(3), @@ -87,13 +87,13 @@ namespace osu.Game.Screens.Select.Carousel private const int maximum_difficulty_icons = 18; - private IEnumerable getDifficultyIcons() + private IEnumerable getDifficultyIcons() { var beatmaps = carouselSet.Beatmaps.ToList(); return beatmaps.Count > maximum_difficulty_icons - ? (IEnumerable)beatmaps.GroupBy(b => b.BeatmapInfo.Ruleset) - .Select(group => new FilterableGroupedDifficultyIcon(group.ToList(), group.Last().BeatmapInfo.Ruleset)) + ? (IEnumerable)beatmaps.GroupBy(b => b.BeatmapInfo.Ruleset) + .Select(group => new FilterableGroupedDifficultyIcon(group.ToList(), group.Last().BeatmapInfo.Ruleset)) : beatmaps.Select(b => new FilterableDifficultyIcon(b)); } } From 01da6f20b380923a196885e4a789fd29d21e668e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Jun 2022 18:53:21 +0900 Subject: [PATCH 1852/2328] Tidy up all remaining usages --- .../SongSelect/TestScenePlaySongSelect.cs | 4 +- .../Drawables/CalculatingDifficultyIcon.cs | 40 ++++--------------- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 9 ++++- .../Beatmaps/Drawables/DifficultyRetriever.cs | 2 - .../Drawables/GroupedDifficultyIcon.cs | 39 ------------------ .../Carousel/DrawableCarouselBeatmap.cs | 3 +- .../Carousel/FilterableDifficultyIcon.cs | 2 +- ...icultyIcon.cs => GroupedDifficultyIcon.cs} | 25 ++++++++++-- .../Select/Carousel/SetPanelContent.cs | 8 ++-- 9 files changed, 46 insertions(+), 86 deletions(-) delete mode 100644 osu.Game/Beatmaps/Drawables/GroupedDifficultyIcon.cs rename osu.Game/Screens/Select/Carousel/{FilterableGroupedDifficultyIcon.cs => GroupedDifficultyIcon.cs} (53%) diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 9fcd470d17..6d881555da 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -872,10 +872,10 @@ namespace osu.Game.Tests.Visual.SongSelect return set != null; }); - FilterableGroupedDifficultyIcon groupIcon = null; + GroupedDifficultyIcon groupIcon = null; AddUntilStep("Find group icon for different ruleset", () => { - return (groupIcon = set.ChildrenOfType() + return (groupIcon = set.ChildrenOfType() .FirstOrDefault(icon => icon.Items.First().BeatmapInfo.Ruleset.OnlineID == 3)) != null; }); diff --git a/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs index 5f914f446c..f8304226e5 100644 --- a/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs @@ -1,13 +1,9 @@ -#nullable enable -// 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 System; -using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets; -using osu.Game.Rulesets.Mods; using osuTK; namespace osu.Game.Beatmaps.Drawables @@ -26,30 +22,16 @@ namespace osu.Game.Beatmaps.Drawables set => difficultyIcon.Size = value; } - private readonly IRulesetInfo? ruleset; - - private readonly IReadOnlyList? mods; + public bool ShowTooltip + { + get => difficultyIcon.ShowTooltip; + set => difficultyIcon.ShowTooltip = value; + } private readonly IBeatmapInfo beatmapInfo; private readonly DifficultyIcon difficultyIcon; - /// - /// Creates a new with a given and combination. - /// - /// The beatmap to show the difficulty of. - /// The ruleset to show the difficulty with. - /// The mods to show the difficulty with. - /// Whether to display a tooltip when hovered. - /// Whether to perform difficulty lookup (including calculation if necessary). - public CalculatingDifficultyIcon(IBeatmapInfo beatmapInfo, IRulesetInfo? ruleset, IReadOnlyList? mods, bool shouldShowTooltip = true, - bool performBackgroundDifficultyLookup = true) - : this(beatmapInfo, shouldShowTooltip, performBackgroundDifficultyLookup) - { - this.ruleset = ruleset ?? beatmapInfo.Ruleset; - this.mods = mods ?? Array.Empty(); - } - /// /// Creates a new that follows the currently-selected ruleset and mods. /// @@ -64,17 +46,11 @@ namespace osu.Game.Beatmaps.Drawables InternalChildren = new Drawable[] { - difficultyIcon = new DifficultyIcon(beatmapInfo, beatmapInfo.Ruleset), + difficultyIcon = new DifficultyIcon(beatmapInfo), new DelayedLoadUnloadWrapper(createDifficultyRetriever, 0) }; } - private Drawable createDifficultyRetriever() - { - if (ruleset != null && mods != null) - return new DifficultyRetriever(beatmapInfo, ruleset, mods) { StarDifficulty = { BindTarget = difficultyIcon.Current } }; - - return new DifficultyRetriever(beatmapInfo) { StarDifficulty = { BindTarget = difficultyIcon.Current } }; - } + private Drawable createDifficultyRetriever() => new DifficultyRetriever(beatmapInfo) { StarDifficulty = { BindTarget = difficultyIcon.Current } }; } } diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index d1b15cba76..03ff0b29b0 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -30,6 +30,11 @@ namespace osu.Game.Beatmaps.Drawables set => iconContainer.Size = value; } + /// + /// Whether to display a tooltip on hover. Only works if a beatmap was provided at construction time. + /// + public bool ShowTooltip { get; set; } = true; + private readonly IBeatmapInfo? beatmap; private readonly IRulesetInfo ruleset; @@ -54,7 +59,7 @@ namespace osu.Game.Beatmaps.Drawables /// /// The beatmap to be displayed in the tooltip, and to be used for the initial star rating value. /// An optional ruleset to be used for the icon display, in place of the beatmap's ruleset. - public DifficultyIcon(IBeatmapInfo beatmap, IRulesetInfo? ruleset) + public DifficultyIcon(IBeatmapInfo beatmap, IRulesetInfo? ruleset = null) : this(ruleset ?? beatmap.Ruleset) { this.beatmap = beatmap; @@ -123,6 +128,6 @@ namespace osu.Game.Beatmaps.Drawables GetCustomTooltip() => new DifficultyIconTooltip(); DifficultyIconTooltipContent IHasCustomTooltip. - TooltipContent => (beatmap != null ? new DifficultyIconTooltipContent(beatmap, Current) : null)!; + TooltipContent => (ShowTooltip && beatmap != null ? new DifficultyIconTooltipContent(beatmap, Current) : null)!; } } diff --git a/osu.Game/Beatmaps/Drawables/DifficultyRetriever.cs b/osu.Game/Beatmaps/Drawables/DifficultyRetriever.cs index a993f0657b..90ef89ee36 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyRetriever.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyRetriever.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Collections.Generic; using System.Threading; using osu.Framework.Allocation; diff --git a/osu.Game/Beatmaps/Drawables/GroupedDifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/GroupedDifficultyIcon.cs deleted file mode 100644 index a713592246..0000000000 --- a/osu.Game/Beatmaps/Drawables/GroupedDifficultyIcon.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -#nullable disable - -using System.Collections.Generic; -using System.Linq; -using osu.Framework.Graphics; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Rulesets; -using osuTK.Graphics; - -namespace osu.Game.Beatmaps.Drawables -{ - /// - /// A difficulty icon that contains a counter on the right-side of it. - /// - /// - /// Used in cases when there are too many difficulty icons to show. - /// - public class GroupedDifficultyIcon : CalculatingDifficultyIcon - { - public GroupedDifficultyIcon(IEnumerable beatmaps, IRulesetInfo ruleset, Color4 counterColour) - : base(beatmaps.OrderBy(b => b.StarRating).Last(), ruleset, null, false) - { - AddInternal(new OsuSpriteText - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Padding = new MarginPadding { Left = Size.X }, - Margin = new MarginPadding { Left = 2, Right = 5 }, - Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold), - Text = beatmaps.Count().ToString(), - Colour = counterColour, - }); - } - } -} diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 79eee63172..e5fe03f929 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -113,8 +113,9 @@ namespace osu.Game.Screens.Select.Carousel Origin = Anchor.CentreLeft, Children = new Drawable[] { - new CalculatingDifficultyIcon(beatmapInfo, shouldShowTooltip: false) + new CalculatingDifficultyIcon(beatmapInfo) { + ShowTooltip = false, Scale = new Vector2(1.8f), }, new FillFlowContainer diff --git a/osu.Game/Screens/Select/Carousel/FilterableDifficultyIcon.cs b/osu.Game/Screens/Select/Carousel/FilterableDifficultyIcon.cs index 3f7d5c13ad..cc904fc1da 100644 --- a/osu.Game/Screens/Select/Carousel/FilterableDifficultyIcon.cs +++ b/osu.Game/Screens/Select/Carousel/FilterableDifficultyIcon.cs @@ -10,7 +10,7 @@ using osu.Game.Beatmaps.Drawables; namespace osu.Game.Screens.Select.Carousel { - public class FilterableDifficultyIcon : CalculatingDifficultyIcon + public class FilterableDifficultyIcon : DifficultyIcon { private readonly BindableBool filtered = new BindableBool(); diff --git a/osu.Game/Screens/Select/Carousel/FilterableGroupedDifficultyIcon.cs b/osu.Game/Screens/Select/Carousel/GroupedDifficultyIcon.cs similarity index 53% rename from osu.Game/Screens/Select/Carousel/FilterableGroupedDifficultyIcon.cs rename to osu.Game/Screens/Select/Carousel/GroupedDifficultyIcon.cs index f883740fd7..8b4140df56 100644 --- a/osu.Game/Screens/Select/Carousel/FilterableGroupedDifficultyIcon.cs +++ b/osu.Game/Screens/Select/Carousel/GroupedDifficultyIcon.cs @@ -8,23 +8,42 @@ using System.Linq; using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Game.Beatmaps.Drawables; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; using osu.Game.Rulesets; using osuTK.Graphics; namespace osu.Game.Screens.Select.Carousel { - public class FilterableGroupedDifficultyIcon : GroupedDifficultyIcon + /// + /// A difficulty icon that contains a counter on the right-side of it. + /// + /// + /// Used in cases when there are too many difficulty icons to show. + /// + public class GroupedDifficultyIcon : DifficultyIcon { public readonly List Items; - public FilterableGroupedDifficultyIcon(List items, RulesetInfo ruleset) - : base(items.Select(i => i.BeatmapInfo).ToList(), ruleset, Color4.White) + public GroupedDifficultyIcon(List items, RulesetInfo ruleset) + : base(items.OrderBy(b => b.BeatmapInfo.StarRating).Last().BeatmapInfo, ruleset) { Items = items; foreach (var item in items) item.Filtered.BindValueChanged(_ => Scheduler.AddOnce(updateFilteredDisplay)); + AddInternal(new OsuSpriteText + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Padding = new MarginPadding { Left = Size.X }, + Margin = new MarginPadding { Left = 2, Right = 5 }, + Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold), + Text = items.Count.ToString(), + Colour = Color4.White, + }); + updateFilteredDisplay(); } diff --git a/osu.Game/Screens/Select/Carousel/SetPanelContent.cs b/osu.Game/Screens/Select/Carousel/SetPanelContent.cs index c5e5a70d59..cc3d722852 100644 --- a/osu.Game/Screens/Select/Carousel/SetPanelContent.cs +++ b/osu.Game/Screens/Select/Carousel/SetPanelContent.cs @@ -73,7 +73,7 @@ namespace osu.Game.Screens.Select.Carousel TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 }, Status = beatmapSet.Status }, - new FillFlowContainer + new FillFlowContainer { AutoSizeAxes = Axes.Both, Spacing = new Vector2(3), @@ -87,13 +87,13 @@ namespace osu.Game.Screens.Select.Carousel private const int maximum_difficulty_icons = 18; - private IEnumerable getDifficultyIcons() + private IEnumerable getDifficultyIcons() { var beatmaps = carouselSet.Beatmaps.ToList(); return beatmaps.Count > maximum_difficulty_icons - ? (IEnumerable)beatmaps.GroupBy(b => b.BeatmapInfo.Ruleset) - .Select(group => new FilterableGroupedDifficultyIcon(group.ToList(), group.Last().BeatmapInfo.Ruleset)) + ? (IEnumerable)beatmaps.GroupBy(b => b.BeatmapInfo.Ruleset) + .Select(group => new GroupedDifficultyIcon(group.ToList(), group.Last().BeatmapInfo.Ruleset)) : beatmaps.Select(b => new FilterableDifficultyIcon(b)); } } From 32652ace75b2a3954e359f4af915385b77262b8e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Jun 2022 19:51:44 +0900 Subject: [PATCH 1853/2328] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index caea787e22..f2790d2520 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 652dc2740f..0802a98858 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -37,7 +37,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 0c3c38f9f0..a272df20d4 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -62,7 +62,7 @@ - + From b068df21497cba26067b98ed8d7356634421fb5e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Jun 2022 19:44:38 +0900 Subject: [PATCH 1854/2328] Enable NRT on `BeatmapDiffiultyCache` --- osu.Game/Beatmaps/BeatmapDifficultyCache.cs | 45 +++++++++------------ 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapDifficultyCache.cs b/osu.Game/Beatmaps/BeatmapDifficultyCache.cs index 69488277f1..b6314f5841 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyCache.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyCache.cs @@ -1,15 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions; @@ -50,19 +47,19 @@ namespace osu.Game.Beatmaps /// private readonly object bindableUpdateLock = new object(); - private CancellationTokenSource trackedUpdateCancellationSource; + private CancellationTokenSource trackedUpdateCancellationSource = new CancellationTokenSource(); [Resolved] - private BeatmapManager beatmapManager { get; set; } + private BeatmapManager beatmapManager { get; set; } = null!; [Resolved] - private Bindable currentRuleset { get; set; } + private Bindable currentRuleset { get; set; } = null!; [Resolved] - private Bindable> currentMods { get; set; } + private Bindable> currentMods { get; set; } = null!; - private ModSettingChangeTracker modSettingChangeTracker; - private ScheduledDelegate debouncedModSettingsChange; + private ModSettingChangeTracker? modSettingChangeTracker; + private ScheduledDelegate? debouncedModSettingsChange; protected override void LoadComplete() { @@ -91,7 +88,7 @@ namespace osu.Game.Beatmaps /// The to get the difficulty of. /// An optional which stops updating the star difficulty for the given . /// A bindable that is updated to contain the star difficulty when it becomes available. Will be null while in an initial calculating state (but not during updates to ruleset and mods if a stale value is already propagated). - public IBindable GetBindableDifficulty([NotNull] IBeatmapInfo beatmapInfo, CancellationToken cancellationToken = default) + public IBindable GetBindableDifficulty(IBeatmapInfo beatmapInfo, CancellationToken cancellationToken = default) { var bindable = createBindable(beatmapInfo, currentRuleset.Value, currentMods.Value, cancellationToken); @@ -112,7 +109,7 @@ namespace osu.Game.Beatmaps /// The s to get the difficulty with. If null, no mods will be assumed. /// An optional which stops updating the star difficulty for the given . /// A bindable that is updated to contain the star difficulty when it becomes available. Will be null while in an initial calculating state. - public IBindable GetBindableDifficulty([NotNull] IBeatmapInfo beatmapInfo, [CanBeNull] IRulesetInfo rulesetInfo, [CanBeNull] IEnumerable mods, + public IBindable GetBindableDifficulty(IBeatmapInfo beatmapInfo, IRulesetInfo? rulesetInfo, IEnumerable? mods, CancellationToken cancellationToken = default) => createBindable(beatmapInfo, rulesetInfo, mods, cancellationToken); @@ -128,8 +125,8 @@ namespace osu.Game.Beatmaps /// A return value indicates that the difficulty process failed or was interrupted early, /// and as such there is no usable star difficulty value to be returned. /// - public virtual Task GetDifficultyAsync([NotNull] IBeatmapInfo beatmapInfo, [CanBeNull] IRulesetInfo rulesetInfo = null, - [CanBeNull] IEnumerable mods = null, CancellationToken cancellationToken = default) + public virtual Task GetDifficultyAsync(IBeatmapInfo beatmapInfo, IRulesetInfo? rulesetInfo = null, + IEnumerable? mods = null, CancellationToken cancellationToken = default) { // In the case that the user hasn't given us a ruleset, use the beatmap's default ruleset. rulesetInfo ??= beatmapInfo.Ruleset; @@ -204,7 +201,6 @@ namespace osu.Game.Beatmaps lock (bindableUpdateLock) { cancelTrackedBindableUpdate(); - trackedUpdateCancellationSource = new CancellationTokenSource(); foreach (var b in trackedBindables) { @@ -223,16 +219,13 @@ namespace osu.Game.Beatmaps { lock (bindableUpdateLock) { - trackedUpdateCancellationSource?.Cancel(); - trackedUpdateCancellationSource = null; + trackedUpdateCancellationSource.Cancel(); + trackedUpdateCancellationSource = new CancellationTokenSource(); - if (linkedCancellationSources != null) - { - foreach (var c in linkedCancellationSources) - c.Dispose(); + foreach (var c in linkedCancellationSources) + c.Dispose(); - linkedCancellationSources.Clear(); - } + linkedCancellationSources.Clear(); } } @@ -244,7 +237,7 @@ namespace osu.Game.Beatmaps /// The initial s to get the difficulty with. /// An optional which stops updating the star difficulty for the given . /// The . - private BindableStarDifficulty createBindable([NotNull] IBeatmapInfo beatmapInfo, [CanBeNull] IRulesetInfo initialRulesetInfo, [CanBeNull] IEnumerable initialMods, + private BindableStarDifficulty createBindable(IBeatmapInfo beatmapInfo, IRulesetInfo? initialRulesetInfo, IEnumerable? initialMods, CancellationToken cancellationToken) { var bindable = new BindableStarDifficulty(beatmapInfo, cancellationToken); @@ -259,7 +252,7 @@ namespace osu.Game.Beatmaps /// The to update with. /// The s to update with. /// A token that may be used to cancel this update. - private void updateBindable([NotNull] BindableStarDifficulty bindable, [CanBeNull] IRulesetInfo rulesetInfo, [CanBeNull] IEnumerable mods, CancellationToken cancellationToken = default) + private void updateBindable(BindableStarDifficulty bindable, IRulesetInfo? rulesetInfo, IEnumerable? mods, CancellationToken cancellationToken = default) { // GetDifficultyAsync will fall back to existing data from IBeatmapInfo if not locally available // (contrary to GetAsync) @@ -329,7 +322,7 @@ namespace osu.Game.Beatmaps modSettingChangeTracker?.Dispose(); cancelTrackedBindableUpdate(); - updateScheduler?.Dispose(); + updateScheduler.Dispose(); } public readonly struct DifficultyCacheLookup : IEquatable @@ -339,7 +332,7 @@ namespace osu.Game.Beatmaps public readonly Mod[] OrderedMods; - public DifficultyCacheLookup([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo ruleset, IEnumerable mods) + public DifficultyCacheLookup(BeatmapInfo beatmapInfo, RulesetInfo? ruleset, IEnumerable? mods) { BeatmapInfo = beatmapInfo; // In the case that the user hasn't given us a ruleset, use the beatmap's default ruleset. From ef258122d23b4c2fe1a24756f38e266a7597b2e3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Jun 2022 19:46:59 +0900 Subject: [PATCH 1855/2328] Move `GetDifficultyRating` helper method to `StarDifficulty` --- .../TestSceneBeatmapDifficultyCache.cs | 2 +- osu.Game/Beatmaps/BeatmapDifficultyCache.cs | 29 ----------------- osu.Game/Beatmaps/EFBeatmapInfo.cs | 2 +- osu.Game/Beatmaps/StarDifficulty.cs | 31 ++++++++++++++++++- osu.Game/Screens/Edit/Verify/VerifyScreen.cs | 2 +- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/TestSceneBeatmapDifficultyCache.cs b/osu.Game.Tests/Beatmaps/TestSceneBeatmapDifficultyCache.cs index f87e5711a6..6eb103316f 100644 --- a/osu.Game.Tests/Beatmaps/TestSceneBeatmapDifficultyCache.cs +++ b/osu.Game.Tests/Beatmaps/TestSceneBeatmapDifficultyCache.cs @@ -157,7 +157,7 @@ namespace osu.Game.Tests.Beatmaps [TestCase(8.3, DifficultyRating.ExpertPlus)] public void TestDifficultyRatingMapping(double starRating, DifficultyRating expectedBracket) { - var actualBracket = BeatmapDifficultyCache.GetDifficultyRating(starRating); + var actualBracket = StarDifficulty.GetDifficultyRating(starRating); Assert.AreEqual(expectedBracket, actualBracket); } diff --git a/osu.Game/Beatmaps/BeatmapDifficultyCache.cs b/osu.Game/Beatmaps/BeatmapDifficultyCache.cs index b6314f5841..5e468e975a 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyCache.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyCache.cs @@ -13,7 +13,6 @@ using osu.Framework.Extensions; using osu.Framework.Lists; using osu.Framework.Logging; using osu.Framework.Threading; -using osu.Framework.Utils; using osu.Game.Configuration; using osu.Game.Database; using osu.Game.Rulesets; @@ -165,34 +164,6 @@ namespace osu.Game.Beatmaps updateScheduler); } - /// - /// Retrieves the that describes a star rating. - /// - /// - /// For more information, see: https://osu.ppy.sh/help/wiki/Difficulties - /// - /// The star rating. - /// The that best describes . - public static DifficultyRating GetDifficultyRating(double starRating) - { - if (Precision.AlmostBigger(starRating, 6.5, 0.005)) - return DifficultyRating.ExpertPlus; - - if (Precision.AlmostBigger(starRating, 5.3, 0.005)) - return DifficultyRating.Expert; - - if (Precision.AlmostBigger(starRating, 4.0, 0.005)) - return DifficultyRating.Insane; - - if (Precision.AlmostBigger(starRating, 2.7, 0.005)) - return DifficultyRating.Hard; - - if (Precision.AlmostBigger(starRating, 2.0, 0.005)) - return DifficultyRating.Normal; - - return DifficultyRating.Easy; - } - /// /// Updates all tracked using the current ruleset and mods. /// diff --git a/osu.Game/Beatmaps/EFBeatmapInfo.cs b/osu.Game/Beatmaps/EFBeatmapInfo.cs index 34311448eb..20abdc686a 100644 --- a/osu.Game/Beatmaps/EFBeatmapInfo.cs +++ b/osu.Game/Beatmaps/EFBeatmapInfo.cs @@ -128,7 +128,7 @@ namespace osu.Game.Beatmaps public List Scores { get; set; } [JsonIgnore] - public DifficultyRating DifficultyRating => BeatmapDifficultyCache.GetDifficultyRating(StarRating); + public DifficultyRating DifficultyRating => StarDifficulty.GetDifficultyRating(StarRating); public override string ToString() => this.GetDisplayTitle(); diff --git a/osu.Game/Beatmaps/StarDifficulty.cs b/osu.Game/Beatmaps/StarDifficulty.cs index 91bc3aacf6..e042f1c698 100644 --- a/osu.Game/Beatmaps/StarDifficulty.cs +++ b/osu.Game/Beatmaps/StarDifficulty.cs @@ -4,6 +4,7 @@ #nullable disable using JetBrains.Annotations; +using osu.Framework.Utils; using osu.Game.Rulesets.Difficulty; namespace osu.Game.Beatmaps @@ -50,6 +51,34 @@ namespace osu.Game.Beatmaps Attributes = null; } - public DifficultyRating DifficultyRating => BeatmapDifficultyCache.GetDifficultyRating(Stars); + public DifficultyRating DifficultyRating => GetDifficultyRating(Stars); + + /// + /// Retrieves the that describes a star rating. + /// + /// + /// For more information, see: https://osu.ppy.sh/help/wiki/Difficulties + /// + /// The star rating. + /// The that best describes . + public static DifficultyRating GetDifficultyRating(double starRating) + { + if (Precision.AlmostBigger(starRating, 6.5, 0.005)) + return DifficultyRating.ExpertPlus; + + if (Precision.AlmostBigger(starRating, 5.3, 0.005)) + return DifficultyRating.Expert; + + if (Precision.AlmostBigger(starRating, 4.0, 0.005)) + return DifficultyRating.Insane; + + if (Precision.AlmostBigger(starRating, 2.7, 0.005)) + return DifficultyRating.Hard; + + if (Precision.AlmostBigger(starRating, 2.0, 0.005)) + return DifficultyRating.Normal; + + return DifficultyRating.Easy; + } } } diff --git a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs index d5b32760c9..3030018138 100644 --- a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs +++ b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs @@ -31,7 +31,7 @@ namespace osu.Game.Screens.Edit.Verify [BackgroundDependencyLoader] private void load() { - InterpretedDifficulty.Default = BeatmapDifficultyCache.GetDifficultyRating(EditorBeatmap.BeatmapInfo.StarRating); + InterpretedDifficulty.Default = StarDifficulty.GetDifficultyRating(EditorBeatmap.BeatmapInfo.StarRating); InterpretedDifficulty.SetDefault(); Child = new Container From 9c46592e0e45279e4a92d4f9b415b61b17510787 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 23 Jun 2022 20:04:54 +0900 Subject: [PATCH 1856/2328] Move collection change event binding to LoadComplete --- osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs b/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs index a314992287..4cf2c3778a 100644 --- a/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs +++ b/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs @@ -33,8 +33,10 @@ namespace osu.Game.Graphics.Containers protected abstract OsuRearrangeableListItem CreateOsuDrawable(TModel item); - protected OsuRearrangeableListContainer() + protected override void LoadComplete() { + base.LoadComplete(); + Items.CollectionChanged += (_, args) => { if (args.Action == NotifyCollectionChangedAction.Move) From aaf619b35c8d6b8642c6d89d83cdb74a4758df00 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 23 Jun 2022 20:13:01 +0900 Subject: [PATCH 1857/2328] Don't play sample if there is no item being actively dragged --- osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs b/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs index 4cf2c3778a..b604ae73eb 100644 --- a/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs +++ b/osu.Game/Graphics/Containers/OsuRearrangeableListContainer.cs @@ -46,6 +46,9 @@ namespace osu.Game.Graphics.Containers private void playSwapSample() { + if (!DragActive.Value) + return; + if (Time.Current - sampleLastPlaybackTime <= 35) return; From 2def6d809bf4c48108a95324101c5a1c107b3bfa Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Thu, 23 Jun 2022 11:02:27 -0400 Subject: [PATCH 1858/2328] refactor to use enum dropdown --- .../Multiplayer/TestSceneLoungeRoomsContainer.cs | 12 +++++------- .../OnlinePlay/Lounge/Components/FilterCriteria.cs | 2 +- .../Lounge/Components/RoomPublicityFilter.cs | 13 +++++++++++++ .../OnlinePlay/Lounge/Components/RoomsContainer.cs | 2 +- .../Screens/OnlinePlay/Lounge/LoungeSubScreen.cs | 13 ++++++------- 5 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPublicityFilter.cs diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs index 363a2b4a4d..4ebd05d46a 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs @@ -158,7 +158,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] - public void TestLockedFiltering() + public void TestPublicityFiltering() { AddStep("add rooms", () => { @@ -166,15 +166,13 @@ namespace osu.Game.Tests.Visual.Multiplayer RoomManager.AddRooms(1, withPassword: false); }); - AddUntilStep("both rooms shown", () => container.Rooms.Count(r => r.IsPresent) == 2); + AddStep("filter public rooms", () => container.Filter.Value = new FilterCriteria { Publicity = RoomPublicityFilter.Public }); - AddStep("filter locked rooms", () => container.Filter.Value = new FilterCriteria { Locked = false }); + AddUntilStep("private room hidden", () => container.Rooms.All(r => !r.Room.HasPassword.Value)); - AddUntilStep("locked room hidden", () => container.Rooms.All(r => !r.Room.HasPassword.Value)); + AddStep("filter private rooms", () => container.Filter.Value = new FilterCriteria { Publicity = RoomPublicityFilter.Private }); - AddStep("unfilter locked rooms", () => container.Filter.SetDefault()); - - AddUntilStep("both rooms shown", () => container.Rooms.Count(r => r.IsPresent) == 2); + AddUntilStep("public room hidden", () => container.Rooms.All(r => r.Room.HasPassword.Value)); } [Test] diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs index 45c1b9b394..3bde1f07b8 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs @@ -13,6 +13,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components public RoomStatusFilter Status; public string Category; public RulesetInfo Ruleset; - public bool Locked = true; + public RoomPublicityFilter Publicity; } } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPublicityFilter.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPublicityFilter.cs new file mode 100644 index 0000000000..ffa527cb9c --- /dev/null +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPublicityFilter.cs @@ -0,0 +1,13 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable + +namespace osu.Game.Screens.OnlinePlay.Lounge.Components +{ + public enum RoomPublicityFilter + { + Public, + Private + } +} diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs index 908505e386..e5d7170f16 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs @@ -87,7 +87,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components matchingFilter &= r.FilterTerms.Any(term => term.ToString().Contains(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase)); } - matchingFilter &= criteria.Locked || !r.Room.HasPassword.Value; + matchingFilter &= (criteria.Publicity == RoomPublicityFilter.Public && !r.Room.HasPassword.Value) || (criteria.Publicity == RoomPublicityFilter.Private && r.Room.HasPassword.Value); r.MatchingFilter = matchingFilter; } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs index a726ff632f..7ec2c7d8e7 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs @@ -85,7 +85,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge private RoomsContainer roomsContainer; private SearchTextBox searchTextBox; private Dropdown statusDropdown; - private Checkbox lockedCheckbox; + private Dropdown publicityDropdown; [BackgroundDependencyLoader(true)] private void load([CanBeNull] IdleTracker idleTracker) @@ -226,7 +226,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge SearchString = searchTextBox.Current.Value, Ruleset = ruleset.Value, Status = statusDropdown.Current.Value, - Locked = lockedCheckbox.Current.Value, + Publicity = publicityDropdown.Current.Value, }; #endregion @@ -241,16 +241,15 @@ namespace osu.Game.Screens.OnlinePlay.Lounge statusDropdown.Current.BindValueChanged(_ => UpdateFilter()); - lockedCheckbox = new OsuTabControlCheckbox + publicityDropdown = new SlimEnumDropdown { - Current = new Bindable(true), RelativeSizeAxes = Axes.None, - Text = @"Show Locked", + Width = 160, }; - lockedCheckbox.Current.BindValueChanged(_ => UpdateFilter()); + publicityDropdown.Current.BindValueChanged(_ => UpdateFilter()); - return new Drawable[] { lockedCheckbox, statusDropdown, }; + return new Drawable[] { publicityDropdown, statusDropdown, }; } public override void OnEntering(ScreenTransitionEvent e) From 9a15adbfffb4b4db274b71db5cc00b20694ccf32 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Thu, 23 Jun 2022 11:24:28 -0400 Subject: [PATCH 1859/2328] add an all option to publicity filter --- .../Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs | 4 ++++ .../OnlinePlay/Lounge/Components/RoomPublicityFilter.cs | 1 + .../Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs index 4ebd05d46a..e16e71ca70 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs @@ -166,6 +166,10 @@ namespace osu.Game.Tests.Visual.Multiplayer RoomManager.AddRooms(1, withPassword: false); }); + AddStep("apply default filter", () => container.Filter.SetDefault()); + + AddUntilStep("both rooms visible", () => container.Rooms.Count(r => r.IsPresent) == 2); + AddStep("filter public rooms", () => container.Filter.Value = new FilterCriteria { Publicity = RoomPublicityFilter.Public }); AddUntilStep("private room hidden", () => container.Rooms.All(r => !r.Room.HasPassword.Value)); diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPublicityFilter.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPublicityFilter.cs index ffa527cb9c..53f85ba7c4 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPublicityFilter.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPublicityFilter.cs @@ -7,6 +7,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components { public enum RoomPublicityFilter { + All, Public, Private } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs index e5d7170f16..0e8918fa18 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs @@ -87,7 +87,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components matchingFilter &= r.FilterTerms.Any(term => term.ToString().Contains(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase)); } - matchingFilter &= (criteria.Publicity == RoomPublicityFilter.Public && !r.Room.HasPassword.Value) || (criteria.Publicity == RoomPublicityFilter.Private && r.Room.HasPassword.Value); + matchingFilter &= criteria.Publicity == RoomPublicityFilter.All || (criteria.Publicity == RoomPublicityFilter.Public && !r.Room.HasPassword.Value) || (criteria.Publicity == RoomPublicityFilter.Private && r.Room.HasPassword.Value); r.MatchingFilter = matchingFilter; } From d67c482c48b9cf3175672edccc84a91ec5d17c84 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Thu, 23 Jun 2022 11:36:08 -0400 Subject: [PATCH 1860/2328] move publicity filter to multi exclusively --- .../OnlinePlay/Lounge/LoungeSubScreen.cs | 18 ++++------------- .../Multiplayer/MultiplayerLoungeSubScreen.cs | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs index 7ec2c7d8e7..f7f3c27ede 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs @@ -85,7 +85,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge private RoomsContainer roomsContainer; private SearchTextBox searchTextBox; private Dropdown statusDropdown; - private Dropdown publicityDropdown; [BackgroundDependencyLoader(true)] private void load([CanBeNull] IdleTracker idleTracker) @@ -225,12 +224,9 @@ namespace osu.Game.Screens.OnlinePlay.Lounge { SearchString = searchTextBox.Current.Value, Ruleset = ruleset.Value, - Status = statusDropdown.Current.Value, - Publicity = publicityDropdown.Current.Value, + Status = statusDropdown.Current.Value }; - #endregion - protected virtual IEnumerable CreateFilterControls() { statusDropdown = new SlimEnumDropdown @@ -241,17 +237,11 @@ namespace osu.Game.Screens.OnlinePlay.Lounge statusDropdown.Current.BindValueChanged(_ => UpdateFilter()); - publicityDropdown = new SlimEnumDropdown - { - RelativeSizeAxes = Axes.None, - Width = 160, - }; - - publicityDropdown.Current.BindValueChanged(_ => UpdateFilter()); - - return new Drawable[] { publicityDropdown, statusDropdown, }; + yield return statusDropdown; } + #endregion + public override void OnEntering(ScreenTransitionEvent e) { base.OnEntering(e); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs index ae65e1d969..2c0f0f43fe 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs @@ -3,11 +3,15 @@ #nullable disable +using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Logging; using osu.Framework.Screens; +using osu.Framework.Graphics; +using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.Multiplayer; @@ -27,6 +31,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer [Resolved] private MultiplayerClient client { get; set; } + private Dropdown publicityDropdown; + public override void OnResuming(ScreenTransitionEvent e) { base.OnResuming(e); @@ -40,10 +46,24 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer } } + protected override IEnumerable CreateFilterControls() + { + publicityDropdown = new SlimEnumDropdown + { + RelativeSizeAxes = Axes.None, + Width = 160, + }; + + publicityDropdown.Current.BindValueChanged(_ => UpdateFilter()); + + return base.CreateFilterControls().Prepend(publicityDropdown); + } + protected override FilterCriteria CreateFilterCriteria() { var criteria = base.CreateFilterCriteria(); criteria.Category = @"realtime"; + criteria.Publicity = publicityDropdown.Current.Value; return criteria; } From 454eff43c542fdad3a37a37ea66bad6c594aa5ba Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Thu, 23 Jun 2022 11:40:25 -0400 Subject: [PATCH 1861/2328] publicity -> accesstype --- .../Multiplayer/TestSceneLoungeRoomsContainer.cs | 4 ++-- .../OnlinePlay/Lounge/Components/FilterCriteria.cs | 2 +- .../{RoomPublicityFilter.cs => RoomAccessType.cs} | 2 +- .../OnlinePlay/Lounge/Components/RoomsContainer.cs | 2 +- .../Multiplayer/MultiplayerLoungeSubScreen.cs | 10 +++++----- 5 files changed, 10 insertions(+), 10 deletions(-) rename osu.Game/Screens/OnlinePlay/Lounge/Components/{RoomPublicityFilter.cs => RoomAccessType.cs} (88%) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs index e16e71ca70..89be9cc188 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs @@ -170,11 +170,11 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("both rooms visible", () => container.Rooms.Count(r => r.IsPresent) == 2); - AddStep("filter public rooms", () => container.Filter.Value = new FilterCriteria { Publicity = RoomPublicityFilter.Public }); + AddStep("filter public rooms", () => container.Filter.Value = new FilterCriteria { AccessType = RoomAccessType.Public }); AddUntilStep("private room hidden", () => container.Rooms.All(r => !r.Room.HasPassword.Value)); - AddStep("filter private rooms", () => container.Filter.Value = new FilterCriteria { Publicity = RoomPublicityFilter.Private }); + AddStep("filter private rooms", () => container.Filter.Value = new FilterCriteria { AccessType = RoomAccessType.Private }); AddUntilStep("public room hidden", () => container.Rooms.All(r => r.Room.HasPassword.Value)); } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs index 3bde1f07b8..864634209b 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs @@ -13,6 +13,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components public RoomStatusFilter Status; public string Category; public RulesetInfo Ruleset; - public RoomPublicityFilter Publicity; + public RoomAccessType AccessType; } } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPublicityFilter.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomAccessType.cs similarity index 88% rename from osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPublicityFilter.cs rename to osu.Game/Screens/OnlinePlay/Lounge/Components/RoomAccessType.cs index 53f85ba7c4..bf8da65881 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPublicityFilter.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomAccessType.cs @@ -5,7 +5,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components { - public enum RoomPublicityFilter + public enum RoomAccessType { All, Public, diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs index 0e8918fa18..55fe8c129a 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs @@ -87,7 +87,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components matchingFilter &= r.FilterTerms.Any(term => term.ToString().Contains(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase)); } - matchingFilter &= criteria.Publicity == RoomPublicityFilter.All || (criteria.Publicity == RoomPublicityFilter.Public && !r.Room.HasPassword.Value) || (criteria.Publicity == RoomPublicityFilter.Private && r.Room.HasPassword.Value); + matchingFilter &= criteria.AccessType == RoomAccessType.All || (criteria.AccessType == RoomAccessType.Public && !r.Room.HasPassword.Value) || (criteria.AccessType == RoomAccessType.Private && r.Room.HasPassword.Value); r.MatchingFilter = matchingFilter; } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs index 2c0f0f43fe..63a482ce46 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs @@ -31,7 +31,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer [Resolved] private MultiplayerClient client { get; set; } - private Dropdown publicityDropdown; + private Dropdown roomAccessTypeDropdown; public override void OnResuming(ScreenTransitionEvent e) { @@ -48,22 +48,22 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer protected override IEnumerable CreateFilterControls() { - publicityDropdown = new SlimEnumDropdown + roomAccessTypeDropdown = new SlimEnumDropdown { RelativeSizeAxes = Axes.None, Width = 160, }; - publicityDropdown.Current.BindValueChanged(_ => UpdateFilter()); + roomAccessTypeDropdown.Current.BindValueChanged(_ => UpdateFilter()); - return base.CreateFilterControls().Prepend(publicityDropdown); + return base.CreateFilterControls().Prepend(roomAccessTypeDropdown); } protected override FilterCriteria CreateFilterCriteria() { var criteria = base.CreateFilterCriteria(); criteria.Category = @"realtime"; - criteria.Publicity = publicityDropdown.Current.Value; + criteria.AccessType = roomAccessTypeDropdown.Current.Value; return criteria; } From bea70988bc09fe4cbed5723715175248c4eedf3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 23 Jun 2022 17:57:22 +0200 Subject: [PATCH 1862/2328] Remove unnecessary `#nullable disable` --- osu.Game/Screens/OnlinePlay/Lounge/Components/RoomAccessType.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomAccessType.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomAccessType.cs index bf8da65881..1141ed2937 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomAccessType.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomAccessType.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - namespace osu.Game.Screens.OnlinePlay.Lounge.Components { public enum RoomAccessType From 04d69010b5666e1eb57ac02824c0fc2e2e257001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 23 Jun 2022 18:03:04 +0200 Subject: [PATCH 1863/2328] Split overlong conditional to local function --- .../Lounge/Components/RoomsContainer.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs index 55fe8c129a..24dd27c27b 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs @@ -87,11 +87,29 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components matchingFilter &= r.FilterTerms.Any(term => term.ToString().Contains(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase)); } - matchingFilter &= criteria.AccessType == RoomAccessType.All || (criteria.AccessType == RoomAccessType.Public && !r.Room.HasPassword.Value) || (criteria.AccessType == RoomAccessType.Private && r.Room.HasPassword.Value); + matchingFilter &= matchesAccessType(r, criteria.AccessType); r.MatchingFilter = matchingFilter; } }); + + static bool matchesAccessType(DrawableLoungeRoom room, RoomAccessType accessType) + { + switch (accessType) + { + case RoomAccessType.All: + return true; + + case RoomAccessType.Public: + return !room.Room.HasPassword.Value; + + case RoomAccessType.Private: + return room.Room.HasPassword.Value; + + default: + throw new ArgumentOutOfRangeException(nameof(accessType), accessType, $"Unsupported {nameof(RoomAccessType)} in filter"); + } + } } private void roomsChanged(object sender, NotifyCollectionChangedEventArgs args) From 489ed5d34d2fd8ead9ed49a7eda7e9361e1a8b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 23 Jun 2022 18:04:38 +0200 Subject: [PATCH 1864/2328] Rename test method --- .../Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs index 89be9cc188..d56716a0b5 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs @@ -158,7 +158,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] - public void TestPublicityFiltering() + public void TestAccessTypeFiltering() { AddStep("add rooms", () => { From eaae600a49b08299a96fdae2ec44b57712184758 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 24 Jun 2022 04:57:44 +0300 Subject: [PATCH 1865/2328] Fix typo in auto-import ignore rule --- osu.sln.DotSettings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index e732b25951..8fd750a50d 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -793,7 +793,7 @@ See the LICENCE file in the repository root for full licence text. <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> True - True + True True True True From 129c90709252aa6fc4dd11b69b0616fb4915dee8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 13:58:02 +0900 Subject: [PATCH 1866/2328] Remove unused parameters --- osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs index f8304226e5..2adba3ae99 100644 --- a/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs @@ -36,9 +36,7 @@ namespace osu.Game.Beatmaps.Drawables /// Creates a new that follows the currently-selected ruleset and mods. /// /// The beatmap to show the difficulty of. - /// Whether to display a tooltip when hovered. - /// Whether to perform difficulty lookup (including calculation if necessary). - public CalculatingDifficultyIcon(IBeatmapInfo beatmapInfo, bool shouldShowTooltip = true, bool performBackgroundDifficultyLookup = true) + public CalculatingDifficultyIcon(IBeatmapInfo beatmapInfo) { this.beatmapInfo = beatmapInfo ?? throw new ArgumentNullException(nameof(beatmapInfo)); From d9c1a9d71fd16c10601654af54e652533cbb7b0d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 13:59:17 +0900 Subject: [PATCH 1867/2328] Use new property to specify no tooltip, rather than passing only ruleset --- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 4 ++-- osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 03ff0b29b0..679e9c3665 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -55,7 +55,7 @@ namespace osu.Game.Beatmaps.Drawables private IRulesetStore rulesets { get; set; } = null!; /// - /// Creates a new with a tooltip. Will use provided beatmap's for initial value. + /// Creates a new . Will use provided beatmap's for initial value. /// /// The beatmap to be displayed in the tooltip, and to be used for the initial star rating value. /// An optional ruleset to be used for the icon display, in place of the beatmap's ruleset. @@ -67,7 +67,7 @@ namespace osu.Game.Beatmaps.Drawables } /// - /// Creates a new with no tooltip. + /// Creates a new without an associated beatmap. /// /// The ruleset to be used for the icon display. public DifficultyIcon(IRulesetInfo ruleset) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs index 2efdb71204..1a57a89957 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs @@ -274,8 +274,9 @@ namespace osu.Game.Overlays.BeatmapSet Alpha = 0.5f } }, - icon = new DifficultyIcon(beatmapInfo.Ruleset) + icon = new DifficultyIcon(beatmapInfo) { + ShowTooltip = false, Current = { Value = new StarDifficulty(beatmapInfo.StarRating, 0) }, Anchor = Anchor.Centre, Origin = Anchor.Centre, From 12ea8369ee504caddcaf38488cae09bfedb091b6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 14:06:31 +0900 Subject: [PATCH 1868/2328] Update retriever to be relatively sized --- .../Beatmaps/Drawables/CalculatingDifficultyIcon.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs index 2adba3ae99..df9766c891 100644 --- a/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osuTK; @@ -28,8 +27,6 @@ namespace osu.Game.Beatmaps.Drawables set => difficultyIcon.ShowTooltip = value; } - private readonly IBeatmapInfo beatmapInfo; - private readonly DifficultyIcon difficultyIcon; /// @@ -38,17 +35,16 @@ namespace osu.Game.Beatmaps.Drawables /// The beatmap to show the difficulty of. public CalculatingDifficultyIcon(IBeatmapInfo beatmapInfo) { - this.beatmapInfo = beatmapInfo ?? throw new ArgumentNullException(nameof(beatmapInfo)); - AutoSizeAxes = Axes.Both; InternalChildren = new Drawable[] { difficultyIcon = new DifficultyIcon(beatmapInfo), - new DelayedLoadUnloadWrapper(createDifficultyRetriever, 0) + new DelayedLoadUnloadWrapper(() => new DifficultyRetriever(beatmapInfo) { StarDifficulty = { BindTarget = difficultyIcon.Current } }, 0) + { + RelativeSizeAxes = Axes.Both, + } }; } - - private Drawable createDifficultyRetriever() => new DifficultyRetriever(beatmapInfo) { StarDifficulty = { BindTarget = difficultyIcon.Current } }; } } From 28837693e5a72ccf692df76a7bc231a473987c4b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 14:22:38 +0900 Subject: [PATCH 1869/2328] Nuke calculating everything The whole component is pointless so I'm just going to nuke for now I guess. Kind of makes the whole refactor effort pointless but oh well? To expand on this, the implementation was actually incorrect as pointed out at https://github.com/ppy/osu/pull/18819#pullrequestreview-1017886035. --- .../Drawables/CalculatingDifficultyIcon.cs | 50 ----------- .../Beatmaps/Drawables/DifficultyRetriever.cs | 83 ------------------- .../Carousel/DrawableCarouselBeatmap.cs | 6 +- 3 files changed, 5 insertions(+), 134 deletions(-) delete mode 100644 osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs delete mode 100644 osu.Game/Beatmaps/Drawables/DifficultyRetriever.cs diff --git a/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs deleted file mode 100644 index df9766c891..0000000000 --- a/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs +++ /dev/null @@ -1,50 +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.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osuTK; - -namespace osu.Game.Beatmaps.Drawables -{ - /// - /// A difficulty icon which automatically calculates difficulty in the background. - /// - public class CalculatingDifficultyIcon : CompositeDrawable - { - /// - /// Size of this difficulty icon. - /// - public new Vector2 Size - { - get => difficultyIcon.Size; - set => difficultyIcon.Size = value; - } - - public bool ShowTooltip - { - get => difficultyIcon.ShowTooltip; - set => difficultyIcon.ShowTooltip = value; - } - - private readonly DifficultyIcon difficultyIcon; - - /// - /// Creates a new that follows the currently-selected ruleset and mods. - /// - /// The beatmap to show the difficulty of. - public CalculatingDifficultyIcon(IBeatmapInfo beatmapInfo) - { - AutoSizeAxes = Axes.Both; - - InternalChildren = new Drawable[] - { - difficultyIcon = new DifficultyIcon(beatmapInfo), - new DelayedLoadUnloadWrapper(() => new DifficultyRetriever(beatmapInfo) { StarDifficulty = { BindTarget = difficultyIcon.Current } }, 0) - { - RelativeSizeAxes = Axes.Both, - } - }; - } - } -} diff --git a/osu.Game/Beatmaps/Drawables/DifficultyRetriever.cs b/osu.Game/Beatmaps/Drawables/DifficultyRetriever.cs deleted file mode 100644 index 90ef89ee36..0000000000 --- a/osu.Game/Beatmaps/Drawables/DifficultyRetriever.cs +++ /dev/null @@ -1,83 +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 System.Collections.Generic; -using System.Threading; -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets; -using osu.Game.Rulesets.Mods; - -namespace osu.Game.Beatmaps.Drawables -{ - /// - /// A component solely responsible for calculating difficulty in the background. - /// Intended for use with to only run processing when usage is on-screen. - /// - public class DifficultyRetriever : Component - { - /// - /// The bindable star difficulty. - /// - public IBindable StarDifficulty => starDifficulty; - - private readonly Bindable starDifficulty = new Bindable(); - - private readonly IBeatmapInfo beatmapInfo; - - private readonly IRulesetInfo? ruleset; - private readonly IReadOnlyList? mods; - - private readonly CancellationTokenSource difficultyCancellation = new CancellationTokenSource(); - - [Resolved] - private BeatmapDifficultyCache difficultyCache { get; set; } = null!; - - /// - /// Construct a difficulty retriever that tracks the current ruleset / mod selection. - /// - /// The beatmap to use for calculation. - public DifficultyRetriever(IBeatmapInfo beatmapInfo) - { - this.beatmapInfo = beatmapInfo; - } - - /// - /// Construct a difficulty retriever that is calculated only once for the specified ruleset / mod combination. - /// This will not track global ruleset and mod changes. - /// - /// The beatmap to use for calculation. - /// The ruleset to use for calculation. - /// The mods to use for calculation. - public DifficultyRetriever(IBeatmapInfo beatmapInfo, IRulesetInfo ruleset, IReadOnlyList mods) - { - this.beatmapInfo = beatmapInfo; - this.ruleset = ruleset; - this.mods = mods; - } - - private IBindable localStarDifficulty = null!; - - [BackgroundDependencyLoader] - private void load() - { - localStarDifficulty = ruleset != null - ? difficultyCache.GetBindableDifficulty(beatmapInfo, ruleset, mods, difficultyCancellation.Token) - : difficultyCache.GetBindableDifficulty(beatmapInfo, difficultyCancellation.Token); - - localStarDifficulty.BindValueChanged(d => - { - if (d.NewValue is StarDifficulty diff) - starDifficulty.Value = diff; - }); - } - - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - difficultyCancellation.Cancel(); - } - } -} diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index e5fe03f929..1b3cab20e8 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -53,7 +53,9 @@ namespace osu.Game.Screens.Select.Carousel private Action hideRequested; private Triangles triangles; + private StarCounter starCounter; + private DifficultyIcon difficultyIcon; [Resolved(CanBeNull = true)] private BeatmapSetOverlay beatmapOverlay { get; set; } @@ -113,7 +115,7 @@ namespace osu.Game.Screens.Select.Carousel Origin = Anchor.CentreLeft, Children = new Drawable[] { - new CalculatingDifficultyIcon(beatmapInfo) + difficultyIcon = new DifficultyIcon(beatmapInfo) { ShowTooltip = false, Scale = new Vector2(1.8f), @@ -217,6 +219,8 @@ namespace osu.Game.Screens.Select.Carousel starDifficultyBindable.BindValueChanged(d => { starCounter.Current = (float)(d.NewValue?.Stars ?? 0); + if (d.NewValue != null) + difficultyIcon.Current.Value = d.NewValue.Value; }, true); } From f4173a3bff4a170e78e6215a6a82a556798bee31 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 14:48:32 +0900 Subject: [PATCH 1870/2328] Update c# language version to 10 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index dbc84fb88f..1f59f19eaa 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@  - 8.0 + 10.0 true enable From f71f6302fd494ec8d12136f6709f36b705ac70ab Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 14:48:43 +0900 Subject: [PATCH 1871/2328] Remove unnecessary `null` casts --- osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs | 2 +- osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs | 4 ++-- osu.Game.Tests/Skins/TestSceneBeatmapSkinLookupDisables.cs | 2 +- .../Visual/UserInterface/TestSceneLabelledDrawable.cs | 2 +- .../Visual/UserInterface/TestSceneOsuAnimatedButton.cs | 3 +-- osu.Game.Tests/Visual/UserInterface/TestSceneOsuButton.cs | 3 +-- osu.Game/Graphics/Containers/ScalingContainer.cs | 2 +- osu.Game/Graphics/UserInterface/ShearedToggleButton.cs | 3 +-- osu.Game/Graphics/UserInterface/ToggleMenuItem.cs | 2 +- osu.Game/OsuGameBase.cs | 4 ++-- osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs | 4 ++-- osu.Game/Overlays/Mods/ModColumn.cs | 2 +- osu.Game/Overlays/Mods/ModPanel.cs | 6 +++--- osu.Game/Rulesets/EFRulesetInfo.cs | 2 +- osu.Game/Rulesets/Objects/SliderPath.cs | 2 +- osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs | 2 +- .../Screens/Edit/Components/Menus/DifficultyMenuItem.cs | 2 +- .../Edit/Compose/Components/Timeline/SamplePointPiece.cs | 2 +- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/Play/MasterGameplayClockContainer.cs | 2 +- osu.Game/Screens/Select/Carousel/SetPanelContent.cs | 4 ++-- osu.Game/Screens/Utility/LatencyCertifierScreen.cs | 4 ++-- osu.Game/Storyboards/CommandTimelineGroup.cs | 2 +- 23 files changed, 30 insertions(+), 33 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs index be2e9c7cb5..5706955fc5 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs @@ -161,7 +161,7 @@ namespace osu.Game.Rulesets.Osu.Tests => addCheckPositionChangeSteps(timeAtRepeat(startTime, repeatIndex), positionAtRepeat(repeatIndex), positionRemainsSame); private Func timeAtRepeat(Func startTime, int repeatIndex) => () => startTime() + 100 + duration_of_span * repeatIndex; - private Func positionAtRepeat(int repeatIndex) => repeatIndex % 2 == 0 ? (Func)getSliderStart : getSliderEnd; + private Func positionAtRepeat(int repeatIndex) => repeatIndex % 2 == 0 ? getSliderStart : getSliderEnd; private List getSliderCurve() => ((PlaySliderBody)drawableSlider.Body.Drawable).CurrentCurve; private Vector2 getSliderStart() => getSliderCurve().First(); diff --git a/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs b/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs index 4a5bb6de46..541ad1e8bb 100644 --- a/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs +++ b/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs @@ -364,12 +364,12 @@ namespace osu.Game.Tests.NonVisual private void confirmCurrentFrame(int? frame) { - Assert.AreEqual(frame is int x ? replay.Frames[x].Time : (double?)null, handler.CurrentFrame?.Time, "Unexpected current frame"); + Assert.AreEqual(frame is int x ? replay.Frames[x].Time : null, handler.CurrentFrame?.Time, "Unexpected current frame"); } private void confirmNextFrame(int? frame) { - Assert.AreEqual(frame is int x ? replay.Frames[x].Time : (double?)null, handler.NextFrame?.Time, "Unexpected next frame"); + Assert.AreEqual(frame is int x ? replay.Frames[x].Time : null, handler.NextFrame?.Time, "Unexpected next frame"); } private class TestReplayFrame : ReplayFrame diff --git a/osu.Game.Tests/Skins/TestSceneBeatmapSkinLookupDisables.cs b/osu.Game.Tests/Skins/TestSceneBeatmapSkinLookupDisables.cs index 77ceef6402..1493c10969 100644 --- a/osu.Game.Tests/Skins/TestSceneBeatmapSkinLookupDisables.cs +++ b/osu.Game.Tests/Skins/TestSceneBeatmapSkinLookupDisables.cs @@ -58,7 +58,7 @@ namespace osu.Game.Tests.Skins { AddStep($"Set beatmap skin enabled to {allowBeatmapLookups}", () => config.SetValue(OsuSetting.BeatmapSkins, allowBeatmapLookups)); - ISkin expected() => allowBeatmapLookups ? (ISkin)beatmapSource : userSource; + ISkin expected() => allowBeatmapLookups ? beatmapSource : userSource; AddAssert("Check lookup is from correct source", () => requester.FindProvider(s => s.GetDrawableComponent(new TestSkinComponent()) != null) == expected()); } diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledDrawable.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledDrawable.cs index f717bb4dee..7ce0fceff9 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledDrawable.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledDrawable.cs @@ -78,7 +78,7 @@ namespace osu.Game.Tests.Visual.UserInterface Origin = Anchor.Centre, Width = 500, AutoSizeAxes = Axes.Y, - Child = component = padded ? (LabelledDrawable)new PaddedLabelledDrawable() : new NonPaddedLabelledDrawable(), + Child = component = padded ? new PaddedLabelledDrawable() : new NonPaddedLabelledDrawable(), }; component.Label = "a sample component"; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs index 28599c740e..bab2121d70 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs @@ -3,7 +3,6 @@ #nullable disable -using System; using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Graphics.Sprites; @@ -89,7 +88,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddToggleStep("toggle enabled", toggle => { for (int i = 0; i < 6; i++) - button.Action = toggle ? () => { } : (Action)null; + button.Action = toggle ? () => { } : null; }); } diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuButton.cs index 0e31a133ac..d4c2bfd422 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuButton.cs @@ -3,7 +3,6 @@ #nullable disable -using System; using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; @@ -29,7 +28,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddToggleStep("toggle enabled", toggle => { for (int i = 0; i < 6; i++) - button.Action = toggle ? () => { } : (Action)null; + button.Action = toggle ? () => { } : null; }); } diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index 5c8579a144..17c51129a7 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -260,7 +260,7 @@ namespace osu.Game.Graphics.Containers if (host.Window == null) return; bool coversWholeScreen = Size == Vector2.One && safeArea.SafeAreaPadding.Value.Total == Vector2.Zero; - host.Window.CursorConfineRect = coversWholeScreen ? (RectangleF?)null : ToScreenSpace(DrawRectangle).AABBFloat; + host.Window.CursorConfineRect = coversWholeScreen ? null : ToScreenSpace(DrawRectangle).AABBFloat; } } } diff --git a/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs b/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs index 50682ddfe0..0bbcb2b976 100644 --- a/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs +++ b/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -47,7 +46,7 @@ namespace osu.Game.Graphics.UserInterface protected override void LoadComplete() { - Active.BindDisabledChanged(disabled => Action = disabled ? (Action?)null : Active.Toggle, true); + Active.BindDisabledChanged(disabled => Action = disabled ? null : Active.Toggle, true); Active.BindValueChanged(_ => { updateActiveState(); diff --git a/osu.Game/Graphics/UserInterface/ToggleMenuItem.cs b/osu.Game/Graphics/UserInterface/ToggleMenuItem.cs index 9d1650c970..6787e17113 100644 --- a/osu.Game/Graphics/UserInterface/ToggleMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/ToggleMenuItem.cs @@ -34,6 +34,6 @@ namespace osu.Game.Graphics.UserInterface { } - public override IconUsage? GetIconForState(bool state) => state ? (IconUsage?)FontAwesome.Solid.Check : null; + public override IconUsage? GetIconForState(bool state) => state ? FontAwesome.Solid.Check : null; } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 7bbad3bb72..1d9e2042ec 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -89,7 +89,7 @@ namespace osu.Game public virtual bool UseDevelopmentServer => DebugUtils.IsDebugBuild; internal EndpointConfiguration CreateEndpoints() => - UseDevelopmentServer ? (EndpointConfiguration)new DevelopmentEndpointConfiguration() : new ProductionEndpointConfiguration(); + UseDevelopmentServer ? new DevelopmentEndpointConfiguration() : new ProductionEndpointConfiguration(); public virtual Version AssemblyVersion => Assembly.GetEntryAssembly()?.GetName().Version ?? new Version(); @@ -583,6 +583,6 @@ namespace osu.Game ControlPointInfo IBeatSyncProvider.ControlPoints => Beatmap.Value.Beatmap.ControlPointInfo; IClock IBeatSyncProvider.Clock => Beatmap.Value.TrackLoaded ? Beatmap.Value.Track : (IClock)null; - ChannelAmplitudes? IBeatSyncProvider.Amplitudes => Beatmap.Value.TrackLoaded ? Beatmap.Value.Track.CurrentAmplitudes : (ChannelAmplitudes?)null; + ChannelAmplitudes? IBeatSyncProvider.Amplitudes => Beatmap.Value.TrackLoaded ? Beatmap.Value.Track.CurrentAmplitudes : null; } } diff --git a/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs b/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs index a6f412c00a..8cedd6b374 100644 --- a/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs +++ b/osu.Game/Overlays/Mods/IncompatibilityDisplayingModPanel.cs @@ -46,8 +46,8 @@ namespace osu.Game.Overlays.Mods && !ModUtils.CheckCompatibleSet(selectedMods.Value.Append(Mod)); } - protected override Colour4 BackgroundColour => incompatible.Value ? (Colour4)ColourProvider.Background6 : base.BackgroundColour; - protected override Colour4 ForegroundColour => incompatible.Value ? (Colour4)ColourProvider.Background5 : base.ForegroundColour; + protected override Colour4 BackgroundColour => incompatible.Value ? ColourProvider.Background6 : base.BackgroundColour; + protected override Colour4 ForegroundColour => incompatible.Value ? ColourProvider.Background5 : base.ForegroundColour; protected override void UpdateState() { diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index c51e6baa0d..3f788d10e3 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -442,7 +442,7 @@ namespace osu.Game.Overlays.Mods case ModType.DifficultyIncrease: case ModType.Automation: return hotkeyStyle == ModSelectHotkeyStyle.Sequential - ? (IModHotkeyHandler)SequentialModHotkeyHandler.Create(ModType) + ? SequentialModHotkeyHandler.Create(ModType) : new ClassicModHotkeyHandler(allowIncompatibleSelection); default: diff --git a/osu.Game/Overlays/Mods/ModPanel.cs b/osu.Game/Overlays/Mods/ModPanel.cs index 4d14a31189..02eb395bd9 100644 --- a/osu.Game/Overlays/Mods/ModPanel.cs +++ b/osu.Game/Overlays/Mods/ModPanel.cs @@ -216,9 +216,9 @@ namespace osu.Game.Overlays.Mods base.OnMouseUp(e); } - protected virtual Colour4 BackgroundColour => Active.Value ? activeColour.Darken(0.3f) : (Colour4)ColourProvider.Background3; - protected virtual Colour4 ForegroundColour => Active.Value ? activeColour : (Colour4)ColourProvider.Background2; - protected virtual Colour4 TextColour => Active.Value ? (Colour4)ColourProvider.Background6 : Colour4.White; + protected virtual Colour4 BackgroundColour => Active.Value ? activeColour.Darken(0.3f) : ColourProvider.Background3; + protected virtual Colour4 ForegroundColour => Active.Value ? activeColour : ColourProvider.Background2; + protected virtual Colour4 TextColour => Active.Value ? ColourProvider.Background6 : Colour4.White; protected virtual void UpdateState() { diff --git a/osu.Game/Rulesets/EFRulesetInfo.cs b/osu.Game/Rulesets/EFRulesetInfo.cs index 3c671496de..bd67bdb93c 100644 --- a/osu.Game/Rulesets/EFRulesetInfo.cs +++ b/osu.Game/Rulesets/EFRulesetInfo.cs @@ -79,7 +79,7 @@ namespace osu.Game.Rulesets public int OnlineID { get => ID ?? -1; - set => ID = value >= 0 ? value : (int?)null; + set => ID = value >= 0 ? value : null; } #endregion diff --git a/osu.Game/Rulesets/Objects/SliderPath.cs b/osu.Game/Rulesets/Objects/SliderPath.cs index 2285715564..ddc121eb5b 100644 --- a/osu.Game/Rulesets/Objects/SliderPath.cs +++ b/osu.Game/Rulesets/Objects/SliderPath.cs @@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Objects } public SliderPath(PathType type, Vector2[] controlPoints, double? expectedDistance = null) - : this(controlPoints.Select((c, i) => new PathControlPoint(c, i == 0 ? (PathType?)type : null)).ToArray(), expectedDistance) + : this(controlPoints.Select((c, i) => new PathControlPoint(c, i == 0 ? type : null)).ToArray(), expectedDistance) { } diff --git a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs index 09a090483d..020bae1c42 100644 --- a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs +++ b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs @@ -161,7 +161,7 @@ namespace osu.Game.Rulesets.Replays CurrentTime = Math.Clamp(time, frameStart, frameEnd); // In an important section, a mid-frame time cannot be used and a null is returned instead. - return inImportantSection && frameStart < time && time < frameEnd ? null : (double?)CurrentTime; + return inImportantSection && frameStart < time && time < frameEnd ? null : CurrentTime; } private double getFrameTime(int index) diff --git a/osu.Game/Screens/Edit/Components/Menus/DifficultyMenuItem.cs b/osu.Game/Screens/Edit/Components/Menus/DifficultyMenuItem.cs index ec1e621491..e14354222b 100644 --- a/osu.Game/Screens/Edit/Components/Menus/DifficultyMenuItem.cs +++ b/osu.Game/Screens/Edit/Components/Menus/DifficultyMenuItem.cs @@ -24,6 +24,6 @@ namespace osu.Game.Screens.Edit.Components.Menus Action.Value = () => difficultyChangeFunc.Invoke(beatmapInfo); } - public override IconUsage? GetIconForState(bool state) => state ? (IconUsage?)FontAwesome.Solid.Check : null; + public override IconUsage? GetIconForState(bool state) => state ? FontAwesome.Solid.Check : null; } } diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index 847c96b762..08fc8383c3 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -131,7 +131,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline } private static string? getCommonBank(SampleControlPoint[] relevantControlPoints) => relevantControlPoints.Select(point => point.SampleBank).Distinct().Count() == 1 ? relevantControlPoints.First().SampleBank : null; - private static int? getCommonVolume(SampleControlPoint[] relevantControlPoints) => relevantControlPoints.Select(point => point.SampleVolume).Distinct().Count() == 1 ? (int?)relevantControlPoints.First().SampleVolume : null; + private static int? getCommonVolume(SampleControlPoint[] relevantControlPoints) => relevantControlPoints.Select(point => point.SampleVolume).Distinct().Count() == 1 ? relevantControlPoints.First().SampleVolume : null; private void updateBankFor(IEnumerable objects, string? newBank) { diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 7a9dae33b4..20bdf75b7d 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -908,6 +908,6 @@ namespace osu.Game.Screens.Edit ControlPointInfo IBeatSyncProvider.ControlPoints => editorBeatmap.ControlPointInfo; IClock IBeatSyncProvider.Clock => clock; - ChannelAmplitudes? IBeatSyncProvider.Amplitudes => Beatmap.Value.TrackLoaded ? Beatmap.Value.Track.CurrentAmplitudes : (ChannelAmplitudes?)null; + ChannelAmplitudes? IBeatSyncProvider.Amplitudes => Beatmap.Value.TrackLoaded ? Beatmap.Value.Track.CurrentAmplitudes : null; } } diff --git a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs index 0994a7d9bb..cd37c541ec 100644 --- a/osu.Game/Screens/Play/MasterGameplayClockContainer.cs +++ b/osu.Game/Screens/Play/MasterGameplayClockContainer.cs @@ -255,7 +255,7 @@ namespace osu.Game.Screens.Play ControlPointInfo IBeatSyncProvider.ControlPoints => beatmap.Beatmap.ControlPointInfo; IClock IBeatSyncProvider.Clock => GameplayClock; - ChannelAmplitudes? IBeatSyncProvider.Amplitudes => beatmap.TrackLoaded ? beatmap.Track.CurrentAmplitudes : (ChannelAmplitudes?)null; + ChannelAmplitudes? IBeatSyncProvider.Amplitudes => beatmap.TrackLoaded ? beatmap.Track.CurrentAmplitudes : null; private class HardwareCorrectionOffsetClock : FramedOffsetClock { diff --git a/osu.Game/Screens/Select/Carousel/SetPanelContent.cs b/osu.Game/Screens/Select/Carousel/SetPanelContent.cs index 73a835d67f..0400e2c938 100644 --- a/osu.Game/Screens/Select/Carousel/SetPanelContent.cs +++ b/osu.Game/Screens/Select/Carousel/SetPanelContent.cs @@ -92,8 +92,8 @@ namespace osu.Game.Screens.Select.Carousel var beatmaps = carouselSet.Beatmaps.ToList(); return beatmaps.Count > maximum_difficulty_icons - ? (IEnumerable)beatmaps.GroupBy(b => b.BeatmapInfo.Ruleset) - .Select(group => new FilterableGroupedDifficultyIcon(group.ToList(), group.Last().BeatmapInfo.Ruleset)) + ? beatmaps.GroupBy(b => b.BeatmapInfo.Ruleset) + .Select(group => new FilterableGroupedDifficultyIcon(group.ToList(), group.Last().BeatmapInfo.Ruleset)) : beatmaps.Select(b => new FilterableDifficultyIcon(b)); } } diff --git a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs index 6754b65129..c9d4dc7811 100644 --- a/osu.Game/Screens/Utility/LatencyCertifierScreen.cs +++ b/osu.Game/Screens/Utility/LatencyCertifierScreen.cs @@ -448,14 +448,14 @@ namespace osu.Game.Screens.Utility mainArea.AddRange(new[] { - new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(DifficultyLevel) : (int?)null) + new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(DifficultyLevel) : null) { Width = 0.5f, VisualMode = { BindTarget = VisualMode }, IsActiveArea = { Value = true }, ReportUserBest = () => recordResult(betterSide == 0), }, - new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(DifficultyLevel) : (int?)null) + new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(DifficultyLevel) : null) { Width = 0.5f, VisualMode = { BindTarget = VisualMode }, diff --git a/osu.Game/Storyboards/CommandTimelineGroup.cs b/osu.Game/Storyboards/CommandTimelineGroup.cs index 20232012f6..6fc9f60177 100644 --- a/osu.Game/Storyboards/CommandTimelineGroup.cs +++ b/osu.Game/Storyboards/CommandTimelineGroup.cs @@ -56,7 +56,7 @@ namespace osu.Game.Storyboards { var first = Alpha.Commands.FirstOrDefault(); - return first?.StartValue == 0 ? first.StartTime : (double?)null; + return first?.StartValue == 0 ? first.StartTime : null; } } From 224c23df77c0430f78676377b8d155fb5375eb2e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 14:58:22 +0900 Subject: [PATCH 1872/2328] Downgrade to v9 to support iOS toolchain --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 1f59f19eaa..235feea8ce 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@  - 10.0 + 9.0 true enable From 545c04aaf5acfed70065131865821d9ce305dd64 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 16:18:51 +0900 Subject: [PATCH 1873/2328] Fix dangerous `File.Copy` causing intermittent realm migration test failures Resolves an issue I've been able to locally reproduce on windows. Basically, the `File.Copy` would begin while realm was blocking. The "restore" operation is posted to the `SynchronizationContext` to run on next update call, but in the mean time the copy would begin, causing a conflict of interest. Very dangerous. Only really noticeable on windows. --- osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs b/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs index 7d5f0bcd0c..a803974d30 100644 --- a/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs +++ b/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs @@ -254,7 +254,7 @@ namespace osu.Game.Tests.NonVisual Assert.That(File.Exists(Path.Combine(customPath, OsuGameBase.CLIENT_DATABASE_FILENAME))); Directory.CreateDirectory(customPath2); - File.Copy(Path.Combine(customPath, OsuGameBase.CLIENT_DATABASE_FILENAME), Path.Combine(customPath2, OsuGameBase.CLIENT_DATABASE_FILENAME)); + File.WriteAllText(Path.Combine(customPath2, OsuGameBase.CLIENT_DATABASE_FILENAME), "I am a text"); // Fails because file already exists. Assert.Throws(() => osu.Migrate(customPath2)); From 453b77e0dcac7c0f6742f5d51f046dd535abaf9a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 16:18:51 +0900 Subject: [PATCH 1874/2328] Fix dangerous `File.Copy` causing intermittent realm migration test failures Resolves an issue I've been able to locally reproduce on windows. Basically, the `File.Copy` would begin while realm was blocking. The "restore" operation is posted to the `SynchronizationContext` to run on next update call, but in the mean time the copy would begin, causing a conflict of interest. Very dangerous. Only really noticeable on windows. --- osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs b/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs index 7d5f0bcd0c..a803974d30 100644 --- a/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs +++ b/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs @@ -254,7 +254,7 @@ namespace osu.Game.Tests.NonVisual Assert.That(File.Exists(Path.Combine(customPath, OsuGameBase.CLIENT_DATABASE_FILENAME))); Directory.CreateDirectory(customPath2); - File.Copy(Path.Combine(customPath, OsuGameBase.CLIENT_DATABASE_FILENAME), Path.Combine(customPath2, OsuGameBase.CLIENT_DATABASE_FILENAME)); + File.WriteAllText(Path.Combine(customPath2, OsuGameBase.CLIENT_DATABASE_FILENAME), "I am a text"); // Fails because file already exists. Assert.Throws(() => osu.Migrate(customPath2)); From 0755430006d582dded0f6a01fcef137a95e666c6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 16:53:04 +0900 Subject: [PATCH 1875/2328] Use `AddOnce` for update calls --- osu.Game/Beatmaps/BeatmapDifficultyCache.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapDifficultyCache.cs b/osu.Game/Beatmaps/BeatmapDifficultyCache.cs index 5e468e975a..7cab868e28 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyCache.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyCache.cs @@ -64,13 +64,13 @@ namespace osu.Game.Beatmaps { base.LoadComplete(); - currentRuleset.BindValueChanged(_ => updateTrackedBindables()); + currentRuleset.BindValueChanged(_ => Scheduler.AddOnce(updateTrackedBindables)); currentMods.BindValueChanged(mods => { modSettingChangeTracker?.Dispose(); - updateTrackedBindables(); + Scheduler.AddOnce(updateTrackedBindables); modSettingChangeTracker = new ModSettingChangeTracker(mods.NewValue); modSettingChangeTracker.SettingChanged += _ => From c1791276700bfcb0d368d44321063343d8263d0a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 16:53:14 +0900 Subject: [PATCH 1876/2328] Remove unused bindable retrieval flow --- osu.Game/Beatmaps/BeatmapDifficultyCache.cs | 35 ++------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapDifficultyCache.cs b/osu.Game/Beatmaps/BeatmapDifficultyCache.cs index 7cab868e28..ef0fa36b16 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyCache.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyCache.cs @@ -89,7 +89,9 @@ namespace osu.Game.Beatmaps /// A bindable that is updated to contain the star difficulty when it becomes available. Will be null while in an initial calculating state (but not during updates to ruleset and mods if a stale value is already propagated). public IBindable GetBindableDifficulty(IBeatmapInfo beatmapInfo, CancellationToken cancellationToken = default) { - var bindable = createBindable(beatmapInfo, currentRuleset.Value, currentMods.Value, cancellationToken); + var bindable = new BindableStarDifficulty(beatmapInfo, cancellationToken); + + updateBindable(bindable, currentRuleset.Value, currentMods.Value, cancellationToken); lock (bindableUpdateLock) trackedBindables.Add(bindable); @@ -97,21 +99,6 @@ namespace osu.Game.Beatmaps return bindable; } - /// - /// Retrieves a bindable containing the star difficulty of a with a given and combination. - /// - /// - /// The bindable will not update to follow the currently-selected ruleset and mods or its settings. - /// - /// The to get the difficulty of. - /// The to get the difficulty with. If null, the 's ruleset is used. - /// The s to get the difficulty with. If null, no mods will be assumed. - /// An optional which stops updating the star difficulty for the given . - /// A bindable that is updated to contain the star difficulty when it becomes available. Will be null while in an initial calculating state. - public IBindable GetBindableDifficulty(IBeatmapInfo beatmapInfo, IRulesetInfo? rulesetInfo, IEnumerable? mods, - CancellationToken cancellationToken = default) - => createBindable(beatmapInfo, rulesetInfo, mods, cancellationToken); - /// /// Retrieves the difficulty of a . /// @@ -200,22 +187,6 @@ namespace osu.Game.Beatmaps } } - /// - /// Creates a new and triggers an initial value update. - /// - /// The that star difficulty should correspond to. - /// The initial to get the difficulty with. - /// The initial s to get the difficulty with. - /// An optional which stops updating the star difficulty for the given . - /// The . - private BindableStarDifficulty createBindable(IBeatmapInfo beatmapInfo, IRulesetInfo? initialRulesetInfo, IEnumerable? initialMods, - CancellationToken cancellationToken) - { - var bindable = new BindableStarDifficulty(beatmapInfo, cancellationToken); - updateBindable(bindable, initialRulesetInfo, initialMods, cancellationToken); - return bindable; - } - /// /// Updates the value of a with a given ruleset + mods. /// From 26c5b59f6d55976d36a6007aecab4b1e7fb9f39a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 20 Jun 2022 14:39:47 +0200 Subject: [PATCH 1877/2328] Replace usages of `string.To{Lower,Upper}()` --- CodeAnalysis/BannedSymbols.txt | 2 ++ osu.Game.Rulesets.Catch/CatchSkinComponent.cs | 2 +- osu.Game.Rulesets.Mania/ManiaSkinComponent.cs | 2 +- osu.Game.Rulesets.Osu/OsuSkinComponent.cs | 2 +- .../Skinning/TestSceneDrawableTaikoMascot.cs | 6 +++--- osu.Game.Rulesets.Taiko/TaikoSkinComponent.cs | 2 +- osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs | 4 ++-- osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs | 2 +- osu.Game.Tournament/Models/TournamentTeam.cs | 4 ++-- .../Screens/Ladder/Components/DrawableTournamentRound.cs | 4 ++-- osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs | 2 +- .../Beatmaps/Drawables/Cards/Buttons/FavouriteButton.cs | 2 +- osu.Game/Database/IModelImporter.cs | 2 +- osu.Game/Database/ModelManager.cs | 2 +- osu.Game/Database/RealmArchiveModelImporter.cs | 2 +- osu.Game/Online/API/Requests/GetSpotlightRankingsRequest.cs | 2 +- osu.Game/Online/API/Requests/GetUserRequest.cs | 2 +- osu.Game/Online/Leaderboards/UserTopScoreContainer.cs | 2 +- osu.Game/Overlays/Chat/DaySeparator.cs | 3 ++- osu.Game/Overlays/News/NewsCard.cs | 3 ++- osu.Game/Overlays/TabControlOverlayHeader.cs | 6 +++--- osu.Game/Rulesets/Edit/Checks/CheckMutedObjects.cs | 2 +- osu.Game/Rulesets/Edit/Checks/CheckTooShortAudioFiles.cs | 2 +- .../OnlinePlay/Match/Components/RoomSettingsOverlay.cs | 2 +- osu.Game/Screens/Select/FilterQueryParser.cs | 2 +- 25 files changed, 35 insertions(+), 31 deletions(-) diff --git a/CodeAnalysis/BannedSymbols.txt b/CodeAnalysis/BannedSymbols.txt index 77197c4c51..8b5431e2d6 100644 --- a/CodeAnalysis/BannedSymbols.txt +++ b/CodeAnalysis/BannedSymbols.txt @@ -17,3 +17,5 @@ M:Realms.CollectionExtensions.SubscribeForNotifications`1(System.Collections.Gen M:System.Threading.Tasks.Task.Wait();Don't use Task.Wait. Use Task.WaitSafely() to ensure we avoid deadlocks. P:System.Threading.Tasks.Task`1.Result;Don't use Task.Result. Use Task.GetResultSafely() to ensure we avoid deadlocks. M:System.Threading.ManualResetEventSlim.Wait();Specify a timeout to avoid waiting forever. +M:System.String.ToLower();string.ToLower() changes behaviour depending on CultureInfo.CurrentCulture. Use string.ToLowerInvariant() instead. If wanting culture-sensitive behaviour, explicitly provide CultureInfo.CurrentCulture or use LocalisableString. +M:System.String.ToUpper();string.ToUpper() changes behaviour depending on CultureInfo.CurrentCulture. Use string.ToUpperInvariant() instead. If wanting culture-sensitive behaviour, explicitly provide CultureInfo.CurrentCulture or use LocalisableString. diff --git a/osu.Game.Rulesets.Catch/CatchSkinComponent.cs b/osu.Game.Rulesets.Catch/CatchSkinComponent.cs index 0fcdd34ca3..e79da667da 100644 --- a/osu.Game.Rulesets.Catch/CatchSkinComponent.cs +++ b/osu.Game.Rulesets.Catch/CatchSkinComponent.cs @@ -16,6 +16,6 @@ namespace osu.Game.Rulesets.Catch protected override string RulesetPrefix => "catch"; // todo: use CatchRuleset.SHORT_NAME; - protected override string ComponentName => Component.ToString().ToLower(); + protected override string ComponentName => Component.ToString().ToLowerInvariant(); } } diff --git a/osu.Game.Rulesets.Mania/ManiaSkinComponent.cs b/osu.Game.Rulesets.Mania/ManiaSkinComponent.cs index b709f85523..21b362df00 100644 --- a/osu.Game.Rulesets.Mania/ManiaSkinComponent.cs +++ b/osu.Game.Rulesets.Mania/ManiaSkinComponent.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mania protected override string RulesetPrefix => ManiaRuleset.SHORT_NAME; - protected override string ComponentName => Component.ToString().ToLower(); + protected override string ComponentName => Component.ToString().ToLowerInvariant(); } public enum ManiaSkinComponents diff --git a/osu.Game.Rulesets.Osu/OsuSkinComponent.cs b/osu.Game.Rulesets.Osu/OsuSkinComponent.cs index 82c4005c5e..0abaf2c924 100644 --- a/osu.Game.Rulesets.Osu/OsuSkinComponent.cs +++ b/osu.Game.Rulesets.Osu/OsuSkinComponent.cs @@ -16,6 +16,6 @@ namespace osu.Game.Rulesets.Osu protected override string RulesetPrefix => OsuRuleset.SHORT_NAME; - protected override string ComponentName => Component.ToString().ToLower(); + protected override string ComponentName => Component.ToString().ToLowerInvariant(); } } diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs index 1bf6c0560a..ef95358d34 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs @@ -144,7 +144,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning createDrawableRuleset(); assertStateAfterResult(new JudgementResult(new Swell(), new TaikoSwellJudgement()) { Type = HitResult.Great }, TaikoMascotAnimationState.Clear); - AddUntilStep($"state reverts to {expectedStateAfterClear.ToString().ToLower()}", () => allMascotsIn(expectedStateAfterClear)); + AddUntilStep($"state reverts to {expectedStateAfterClear.ToString().ToLowerInvariant()}", () => allMascotsIn(expectedStateAfterClear)); } private void setBeatmap(bool kiai = false) @@ -195,7 +195,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning { TaikoMascotAnimationState[] mascotStates = null; - AddStep($"{judgementResult.Type.ToString().ToLower()} result for {judgementResult.Judgement.GetType().Name.Humanize(LetterCasing.LowerCase)}", + AddStep($"{judgementResult.Type.ToString().ToLowerInvariant()} result for {judgementResult.Judgement.GetType().Name.Humanize(LetterCasing.LowerCase)}", () => { applyNewResult(judgementResult); @@ -204,7 +204,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning Schedule(() => mascotStates = animatedMascots.Select(mascot => mascot.State.Value).ToArray()); }); - AddAssert($"state is {expectedState.ToString().ToLower()}", () => mascotStates.All(state => state == expectedState)); + AddAssert($"state is {expectedState.ToString().ToLowerInvariant()}", () => mascotStates.All(state => state == expectedState)); } private void applyNewResult(JudgementResult judgementResult) diff --git a/osu.Game.Rulesets.Taiko/TaikoSkinComponent.cs b/osu.Game.Rulesets.Taiko/TaikoSkinComponent.cs index 676a3d4bc3..63314a6822 100644 --- a/osu.Game.Rulesets.Taiko/TaikoSkinComponent.cs +++ b/osu.Game.Rulesets.Taiko/TaikoSkinComponent.cs @@ -16,6 +16,6 @@ namespace osu.Game.Rulesets.Taiko protected override string RulesetPrefix => TaikoRuleset.SHORT_NAME; - protected override string ComponentName => Component.ToString().ToLower(); + protected override string ComponentName => Component.ToString().ToLowerInvariant(); } } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs b/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs index bacd9b41f8..26a37fc464 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs @@ -139,10 +139,10 @@ namespace osu.Game.Rulesets.Taiko.UI private static Texture getAnimationFrame(ISkin skin, TaikoMascotAnimationState state, int frameIndex) { - var texture = skin.GetTexture($"pippidon{state.ToString().ToLower()}{frameIndex}"); + var texture = skin.GetTexture($"pippidon{state.ToString().ToLowerInvariant()}{frameIndex}"); if (frameIndex == 0 && texture == null) - texture = skin.GetTexture($"pippidon{state.ToString().ToLower()}"); + texture = skin.GetTexture($"pippidon{state.ToString().ToLowerInvariant()}"); return texture; } diff --git a/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs b/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs index f9c4985219..c4e8bbfccf 100644 --- a/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs +++ b/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs @@ -192,7 +192,7 @@ namespace osu.Game.Tests.Gameplay AddStep("apply perfect hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Perfect })); AddAssert("not failed", () => !processor.HasFailed); - AddStep($"apply {resultApplied.ToString().ToLower()} hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = resultApplied })); + AddStep($"apply {resultApplied.ToString().ToLowerInvariant()} hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = resultApplied })); AddAssert("failed", () => processor.HasFailed); } diff --git a/osu.Game.Tournament/Models/TournamentTeam.cs b/osu.Game.Tournament/Models/TournamentTeam.cs index 9dbe23b4b3..ac57f748da 100644 --- a/osu.Game.Tournament/Models/TournamentTeam.cs +++ b/osu.Game.Tournament/Models/TournamentTeam.cs @@ -66,14 +66,14 @@ namespace osu.Game.Tournament.Models { // use a sane default flag name based on acronym. if (val.OldValue.StartsWith(FlagName.Value, StringComparison.InvariantCultureIgnoreCase)) - FlagName.Value = val.NewValue.Length >= 2 ? val.NewValue?.Substring(0, 2).ToUpper() : string.Empty; + FlagName.Value = val.NewValue.Length >= 2 ? val.NewValue?.Substring(0, 2).ToUpperInvariant() : string.Empty; }; FullName.ValueChanged += val => { // use a sane acronym based on full name. if (val.OldValue.StartsWith(Acronym.Value, StringComparison.InvariantCultureIgnoreCase)) - Acronym.Value = val.NewValue.Length >= 3 ? val.NewValue?.Substring(0, 3).ToUpper() : string.Empty; + Acronym.Value = val.NewValue.Length >= 3 ? val.NewValue?.Substring(0, 3).ToUpperInvariant() : string.Empty; }; } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs index ac196130d6..544725996a 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs @@ -49,10 +49,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components }; name = round.Name.GetBoundCopy(); - name.BindValueChanged(n => textName.Text = ((losers ? "Losers " : "") + round.Name).ToUpper(), true); + name.BindValueChanged(n => textName.Text = ((losers ? "Losers " : "") + round.Name).ToUpperInvariant(), true); description = round.Description.GetBoundCopy(); - description.BindValueChanged(n => textDescription.Text = round.Description.Value?.ToUpper(), true); + description.BindValueChanged(n => textDescription.Text = round.Description.Value?.ToUpperInvariant(), true); } } } diff --git a/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs index df6e8e816e..925c697346 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs @@ -198,7 +198,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro { row.Add(new Sprite { - Texture = textures.Get($"Mods/{mods.ToLower()}"), + Texture = textures.Get($"Mods/{mods.ToLowerInvariant()}"), Scale = new Vector2(0.5f) }); } diff --git a/osu.Game/Beatmaps/Drawables/Cards/Buttons/FavouriteButton.cs b/osu.Game/Beatmaps/Drawables/Cards/Buttons/FavouriteButton.cs index 78481ac27a..bc0fcb92bb 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/Buttons/FavouriteButton.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/Buttons/FavouriteButton.cs @@ -64,7 +64,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons }; favouriteRequest.Failure += e => { - Logger.Error(e, $"Failed to {actionType.ToString().ToLower()} beatmap: {e.Message}"); + Logger.Error(e, $"Failed to {actionType.ToString().ToLowerInvariant()} beatmap: {e.Message}"); Enabled.Value = true; }; diff --git a/osu.Game/Database/IModelImporter.cs b/osu.Game/Database/IModelImporter.cs index 26342cb5fe..ebb8be39ef 100644 --- a/osu.Game/Database/IModelImporter.cs +++ b/osu.Game/Database/IModelImporter.cs @@ -26,7 +26,7 @@ namespace osu.Game.Database /// /// A user displayable name for the model type associated with this manager. /// - string HumanisedModelName => $"{typeof(TModel).Name.Replace(@"Info", "").ToLower()}"; + string HumanisedModelName => $"{typeof(TModel).Name.Replace(@"Info", "").ToLowerInvariant()}"; /// /// Fired when the user requests to view the resulting import. diff --git a/osu.Game/Database/ModelManager.cs b/osu.Game/Database/ModelManager.cs index e0c3dccf57..9603412178 100644 --- a/osu.Game/Database/ModelManager.cs +++ b/osu.Game/Database/ModelManager.cs @@ -201,6 +201,6 @@ namespace osu.Game.Database public Action? PostNotification { get; set; } - public virtual string HumanisedModelName => $"{typeof(TModel).Name.Replace(@"Info", "").ToLower()}"; + public virtual string HumanisedModelName => $"{typeof(TModel).Name.Replace(@"Info", "").ToLowerInvariant()}"; } } diff --git a/osu.Game/Database/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs index 27bfaf05be..a3349d9918 100644 --- a/osu.Game/Database/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -549,6 +549,6 @@ namespace osu.Game.Database yield return f.Filename; } - public virtual string HumanisedModelName => $"{typeof(TModel).Name.Replace(@"Info", "").ToLower()}"; + public virtual string HumanisedModelName => $"{typeof(TModel).Name.Replace(@"Info", "").ToLowerInvariant()}"; } } diff --git a/osu.Game/Online/API/Requests/GetSpotlightRankingsRequest.cs b/osu.Game/Online/API/Requests/GetSpotlightRankingsRequest.cs index 75b0cf8027..2d8a8b3b61 100644 --- a/osu.Game/Online/API/Requests/GetSpotlightRankingsRequest.cs +++ b/osu.Game/Online/API/Requests/GetSpotlightRankingsRequest.cs @@ -26,7 +26,7 @@ namespace osu.Game.Online.API.Requests var req = base.CreateWebRequest(); req.AddParameter("spotlight", spotlight.ToString()); - req.AddParameter("filter", sort.ToString().ToLower()); + req.AddParameter("filter", sort.ToString().ToLowerInvariant()); return req; } diff --git a/osu.Game/Online/API/Requests/GetUserRequest.cs b/osu.Game/Online/API/Requests/GetUserRequest.cs index ab45e8e48f..7dcf75950e 100644 --- a/osu.Game/Online/API/Requests/GetUserRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRequest.cs @@ -45,7 +45,7 @@ namespace osu.Game.Online.API.Requests Ruleset = ruleset; } - protected override string Target => Lookup != null ? $@"users/{Lookup}/{Ruleset?.ShortName}?key={lookupType.ToString().ToLower()}" : $@"me/{Ruleset?.ShortName}"; + protected override string Target => Lookup != null ? $@"users/{Lookup}/{Ruleset?.ShortName}?key={lookupType.ToString().ToLowerInvariant()}" : $@"me/{Ruleset?.ShortName}"; private enum LookupType { diff --git a/osu.Game/Online/Leaderboards/UserTopScoreContainer.cs b/osu.Game/Online/Leaderboards/UserTopScoreContainer.cs index df8717fe6d..2d2d82821c 100644 --- a/osu.Game/Online/Leaderboards/UserTopScoreContainer.cs +++ b/osu.Game/Online/Leaderboards/UserTopScoreContainer.cs @@ -48,7 +48,7 @@ namespace osu.Game.Online.Leaderboards { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = @"your personal best".ToUpper(), + Text = @"your personal best".ToUpperInvariant(), Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold), }, scoreContainer = new Container diff --git a/osu.Game/Overlays/Chat/DaySeparator.cs b/osu.Game/Overlays/Chat/DaySeparator.cs index c7961d1a39..be0b53785c 100644 --- a/osu.Game/Overlays/Chat/DaySeparator.cs +++ b/osu.Game/Overlays/Chat/DaySeparator.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -79,7 +80,7 @@ namespace osu.Game.Overlays.Chat { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Text = time.ToLocalTime().ToString("dd MMMM yyyy").ToUpper(), + Text = time.ToLocalTime().ToLocalisableString(@"dd MMMM yyyy").ToUpper(), Font = OsuFont.Torus.With(size: TextSize, weight: FontWeight.SemiBold), Colour = colourProvider?.Content1 ?? Colour4.White, }, diff --git a/osu.Game/Overlays/News/NewsCard.cs b/osu.Game/Overlays/News/NewsCard.cs index 69094a0df7..eb76522e11 100644 --- a/osu.Game/Overlays/News/NewsCard.cs +++ b/osu.Game/Overlays/News/NewsCard.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; @@ -146,7 +147,7 @@ namespace osu.Game.Overlays.News }, new OsuSpriteText { - Text = date.ToString("d MMM yyyy").ToUpper(), + Text = date.ToLocalisableString(@"d MMM yyyy").ToUpper(), Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold), Margin = new MarginPadding { diff --git a/osu.Game/Overlays/TabControlOverlayHeader.cs b/osu.Game/Overlays/TabControlOverlayHeader.cs index 4e32afb86f..84a5bf1144 100644 --- a/osu.Game/Overlays/TabControlOverlayHeader.cs +++ b/osu.Game/Overlays/TabControlOverlayHeader.cs @@ -109,15 +109,15 @@ namespace osu.Game.Overlays : base(value) { if (!(Value is Enum enumValue)) - Text.Text = Value.ToString().ToLower(); + Text.Text = Value.ToString().ToLowerInvariant(); else { var localisableDescription = enumValue.GetLocalisableDescription(); string nonLocalisableDescription = enumValue.GetDescription(); - // If localisable == non-localisable, then we must have a basic string, so .ToLower() is used. + // If localisable == non-localisable, then we must have a basic string, so .ToLowerInvariant() is used. Text.Text = localisableDescription.Equals(nonLocalisableDescription) - ? nonLocalisableDescription.ToLower() + ? nonLocalisableDescription.ToLowerInvariant() : localisableDescription; } diff --git a/osu.Game/Rulesets/Edit/Checks/CheckMutedObjects.cs b/osu.Game/Rulesets/Edit/Checks/CheckMutedObjects.cs index cb6c4a9928..00b1ca9dc9 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckMutedObjects.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckMutedObjects.cs @@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Edit.Checks if (edgeType == EdgeType.None) yield break; - string postfix = hitObject is IHasDuration ? edgeType.ToString().ToLower() : null; + string postfix = hitObject is IHasDuration ? edgeType.ToString().ToLowerInvariant() : null; if (maxVolume <= muted_threshold) { diff --git a/osu.Game/Rulesets/Edit/Checks/CheckTooShortAudioFiles.cs b/osu.Game/Rulesets/Edit/Checks/CheckTooShortAudioFiles.cs index a461f63d2d..2a222aece0 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckTooShortAudioFiles.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckTooShortAudioFiles.cs @@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Edit.Checks } } - private bool hasAudioExtension(string filename) => audioExtensions.Any(filename.ToLower().EndsWith); + private bool hasAudioExtension(string filename) => audioExtensions.Any(filename.ToLowerInvariant().EndsWith); private bool probablyHasAudioData(Stream data) => data.Length > min_bytes_threshold; public class IssueTemplateTooShort : IssueTemplate diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/RoomSettingsOverlay.cs b/osu.Game/Screens/OnlinePlay/Match/Components/RoomSettingsOverlay.cs index c295e9f85e..71447b15e2 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/RoomSettingsOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/RoomSettingsOverlay.cs @@ -135,7 +135,7 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components new OsuSpriteText { Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 12), - Text = title.ToUpper(), + Text = title.ToUpperInvariant(), }, content = new Container { diff --git a/osu.Game/Screens/Select/FilterQueryParser.cs b/osu.Game/Screens/Select/FilterQueryParser.cs index 92f707ae3e..03b72bf5e9 100644 --- a/osu.Game/Screens/Select/FilterQueryParser.cs +++ b/osu.Game/Screens/Select/FilterQueryParser.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Select { foreach (Match match in query_syntax_regex.Matches(query)) { - string key = match.Groups["key"].Value.ToLower(); + string key = match.Groups["key"].Value.ToLowerInvariant(); var op = parseOperator(match.Groups["op"].Value); string value = match.Groups["value"].Value; From 2ae48d5a87f3a71c67742869973d452106697e3c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 17:46:46 +0900 Subject: [PATCH 1878/2328] Rename incorrect parameter name in `BeatmapManager.GetWorkingBeatmap` --- osu.Game/Beatmaps/BeatmapManager.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 816808638f..73c879226b 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -418,22 +418,22 @@ namespace osu.Game.Beatmaps #region Implementation of IWorkingBeatmapCache - public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo? importedBeatmap) + public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo? beatmapInfo) { // Detached sets don't come with files. // If we seem to be missing files, now is a good time to re-fetch. - if (importedBeatmap?.BeatmapSet?.Files.Count == 0) + if (beatmapInfo?.BeatmapSet?.Files.Count == 0) { Realm.Run(r => { - var refetch = r.Find(importedBeatmap.ID)?.Detach(); + var refetch = r.Find(beatmapInfo.ID)?.Detach(); if (refetch != null) - importedBeatmap = refetch; + beatmapInfo = refetch; }); } - return workingBeatmapCache.GetWorkingBeatmap(importedBeatmap); + return workingBeatmapCache.GetWorkingBeatmap(beatmapInfo); } void IWorkingBeatmapCache.Invalidate(BeatmapSetInfo beatmapSetInfo) => workingBeatmapCache.Invalidate(beatmapSetInfo); From 823b3c1c0fcc74b4260c7ab09bdf13468f8984e1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 19:04:29 +0900 Subject: [PATCH 1879/2328] Ensure `WorkingBeatmap` is always using a detached instance --- osu.Game/Beatmaps/BeatmapManager.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 73c879226b..670dba14ec 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -422,7 +422,7 @@ namespace osu.Game.Beatmaps { // Detached sets don't come with files. // If we seem to be missing files, now is a good time to re-fetch. - if (beatmapInfo?.BeatmapSet?.Files.Count == 0) + if (beatmapInfo?.IsManaged == true || beatmapInfo?.BeatmapSet?.Files.Count == 0) { Realm.Run(r => { @@ -433,6 +433,8 @@ namespace osu.Game.Beatmaps }); } + Debug.Assert(beatmapInfo?.IsManaged != true); + return workingBeatmapCache.GetWorkingBeatmap(beatmapInfo); } From 06d59b717c69ed873ca6a65cd5d02b45777f1fa4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 18:39:53 +0900 Subject: [PATCH 1880/2328] Move beatmap processing tasks to new `BeatmapUpdater` class --- .../Database/BeatmapImporterTests.cs | 58 +++++++------- ...eneOnlinePlayBeatmapAvailabilityTracker.cs | 8 +- osu.Game/Beatmaps/BeatmapImporter.cs | 70 ++--------------- osu.Game/Beatmaps/BeatmapManager.cs | 13 +++- osu.Game/Beatmaps/BeatmapUpdater.cs | 78 +++++++++++++++++++ osu.Game/OsuGameBase.cs | 2 +- 6 files changed, 130 insertions(+), 99 deletions(-) create mode 100644 osu.Game/Beatmaps/BeatmapUpdater.cs diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index be11476c73..f54dd3eb11 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -35,7 +35,8 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using (var importer = new BeatmapImporter(storage, realm)) + var importer = new BeatmapImporter(storage, realm); + using (new RealmRulesetStore(realm, storage)) { var beatmapSet = await importer.Import(new ImportTask(TestResources.GetTestBeatmapStream(), "renatus.osz")); @@ -76,7 +77,8 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using (var importer = new BeatmapImporter(storage, realm)) + var importer = new BeatmapImporter(storage, realm); + using (new RealmRulesetStore(realm, storage)) { var beatmapSet = await importer.Import(new ImportTask(TestResources.GetTestBeatmapStream(), "renatus.osz")); @@ -134,7 +136,8 @@ namespace osu.Game.Tests.Database var manager = new ModelManager(storage, realm); - using (var importer = new BeatmapImporter(storage, realm)) + var importer = new BeatmapImporter(storage, realm); + using (new RealmRulesetStore(realm, storage)) { Task.Run(async () => @@ -160,7 +163,8 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using (var importer = new BeatmapImporter(storage, realm)) + var importer = new BeatmapImporter(storage, realm); + using (new RealmRulesetStore(realm, storage)) { var imported = await importer.Import(new ImportTask(TestResources.GetTestBeatmapStream(), "renatus.osz")); @@ -187,7 +191,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); await LoadOszIntoStore(importer, realm.Realm); @@ -199,7 +203,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -217,7 +221,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -231,7 +235,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? tempPath = TestResources.GetTestBeatmapForImport(); @@ -261,7 +265,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -281,7 +285,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -317,7 +321,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -366,7 +370,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -417,7 +421,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -465,7 +469,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -513,7 +517,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -548,7 +552,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var progressNotification = new ImportProgressNotification(); @@ -586,7 +590,7 @@ namespace osu.Game.Tests.Database Interlocked.Increment(ref loggedExceptionCount); }; - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -638,7 +642,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm, batchImport: true); @@ -665,7 +669,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realmFactory, storage) => { - using var importer = new BeatmapImporter(storage, realmFactory); + var importer = new BeatmapImporter(storage, realmFactory); using var store = new RealmRulesetStore(realmFactory, storage); var imported = await LoadOszIntoStore(importer, realmFactory.Realm); @@ -697,7 +701,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -724,7 +728,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var imported = await LoadOszIntoStore(importer, realm.Realm); @@ -750,7 +754,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealm((realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); var metadata = new BeatmapMetadata @@ -798,7 +802,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -815,7 +819,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -851,7 +855,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -893,7 +897,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); @@ -944,7 +948,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealmAsync(async (realm, storage) => { - using var importer = new BeatmapImporter(storage, realm); + var importer = new BeatmapImporter(storage, realm); using var store = new RealmRulesetStore(realm, storage); string? temp = TestResources.GetTestBeatmapForImport(); diff --git a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs index 1d33a895eb..0bf47141e4 100644 --- a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs +++ b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs @@ -212,17 +212,17 @@ namespace osu.Game.Tests.Online { } - protected override BeatmapImporter CreateBeatmapImporter(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapOnlineLookupQueue onlineLookupQueue) + protected override BeatmapImporter CreateBeatmapImporter(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapUpdater beatmapUpdater) { - return new TestBeatmapImporter(this, storage, realm, onlineLookupQueue); + return new TestBeatmapImporter(this, storage, realm, beatmapUpdater); } internal class TestBeatmapImporter : BeatmapImporter { private readonly TestBeatmapManager testBeatmapManager; - public TestBeatmapImporter(TestBeatmapManager testBeatmapManager, Storage storage, RealmAccess databaseAccess, BeatmapOnlineLookupQueue beatmapOnlineLookupQueue) - : base(storage, databaseAccess, beatmapOnlineLookupQueue) + public TestBeatmapImporter(TestBeatmapManager testBeatmapManager, Storage storage, RealmAccess databaseAccess, BeatmapUpdater beatmapUpdater) + : base(storage, databaseAccess, beatmapUpdater) { this.testBeatmapManager = testBeatmapManager; } diff --git a/osu.Game/Beatmaps/BeatmapImporter.cs b/osu.Game/Beatmaps/BeatmapImporter.cs index 237088036c..0620e5d9b1 100644 --- a/osu.Game/Beatmaps/BeatmapImporter.cs +++ b/osu.Game/Beatmaps/BeatmapImporter.cs @@ -6,10 +6,8 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; -using osu.Framework.Audio.Track; using osu.Framework.Extensions; using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Graphics.Textures; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Framework.Testing; @@ -20,8 +18,6 @@ using osu.Game.IO; using osu.Game.IO.Archives; using osu.Game.Models; using osu.Game.Rulesets; -using osu.Game.Rulesets.Objects; -using osu.Game.Skinning; using Realms; namespace osu.Game.Beatmaps @@ -30,18 +26,18 @@ namespace osu.Game.Beatmaps /// Handles the storage and retrieval of Beatmaps/WorkingBeatmaps. /// [ExcludeFromDynamicCompile] - public class BeatmapImporter : RealmArchiveModelImporter, IDisposable + public class BeatmapImporter : RealmArchiveModelImporter { public override IEnumerable HandledExtensions => new[] { ".osz" }; protected override string[] HashableFileTypes => new[] { ".osu" }; - private readonly BeatmapOnlineLookupQueue? onlineLookupQueue; + private readonly BeatmapUpdater? beatmapUpdater; - public BeatmapImporter(Storage storage, RealmAccess realm, BeatmapOnlineLookupQueue? onlineLookupQueue = null) + public BeatmapImporter(Storage storage, RealmAccess realm, BeatmapUpdater? beatmapUpdater = null) : base(storage, realm) { - this.onlineLookupQueue = onlineLookupQueue; + this.beatmapUpdater = beatmapUpdater; } protected override bool ShouldDeleteArchive(string path) => Path.GetExtension(path).ToLowerInvariant() == ".osz"; @@ -65,8 +61,7 @@ namespace osu.Game.Beatmaps bool hadOnlineIDs = beatmapSet.Beatmaps.Any(b => b.OnlineID > 0); - onlineLookupQueue?.Update(beatmapSet); - + // TODO: this may no longer be valid as we aren't doing an online population at this point. // ensure at least one beatmap was able to retrieve or keep an online ID, else drop the set ID. if (hadOnlineIDs && !beatmapSet.Beatmaps.Any(b => b.OnlineID > 0)) { @@ -85,6 +80,8 @@ namespace osu.Game.Beatmaps // If this is ever an issue, we can consider marking as pending delete but not resetting the IDs (but care will be required for // beatmaps, which don't have their own `DeletePending` state). + beatmapUpdater?.Process(beatmapSet, realm); + if (beatmapSet.OnlineID > 0) { var existingSetWithSameOnlineID = realm.All().SingleOrDefault(b => b.OnlineID == beatmapSet.OnlineID); @@ -278,64 +275,11 @@ namespace osu.Game.Beatmaps MD5Hash = memoryStream.ComputeMD5Hash(), }; - updateBeatmapStatistics(beatmap, decoded); - beatmaps.Add(beatmap); } } return beatmaps; } - - private void updateBeatmapStatistics(BeatmapInfo beatmap, IBeatmap decoded) - { - var rulesetInstance = ((IRulesetInfo)beatmap.Ruleset).CreateInstance(); - - decoded.BeatmapInfo.Ruleset = rulesetInstance.RulesetInfo; - - // TODO: this should be done in a better place once we actually need to dynamically update it. - beatmap.StarRating = rulesetInstance.CreateDifficultyCalculator(new DummyConversionBeatmap(decoded)).Calculate().StarRating; - beatmap.Length = calculateLength(decoded); - beatmap.BPM = 60000 / decoded.GetMostCommonBeatLength(); - } - - private double calculateLength(IBeatmap b) - { - if (!b.HitObjects.Any()) - return 0; - - var lastObject = b.HitObjects.Last(); - - //TODO: this isn't always correct (consider mania where a non-last object may last for longer than the last in the list). - double endTime = lastObject.GetEndTime(); - double startTime = b.HitObjects.First().StartTime; - - return endTime - startTime; - } - - public void Dispose() - { - onlineLookupQueue?.Dispose(); - } - - /// - /// A dummy WorkingBeatmap for the purpose of retrieving a beatmap for star difficulty calculation. - /// - private class DummyConversionBeatmap : WorkingBeatmap - { - private readonly IBeatmap beatmap; - - public DummyConversionBeatmap(IBeatmap beatmap) - : base(beatmap.BeatmapInfo, null) - { - this.beatmap = beatmap; - } - - protected override IBeatmap GetBeatmap() => beatmap; - protected override Texture? GetBackground() => null; - protected override Track? GetBeatmapTrack() => null; - protected internal override ISkin? GetSkin() => null; - public override Stream? GetStream(string storagePath) => null; - } } } diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 670dba14ec..ee7fcb5b47 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -42,9 +42,10 @@ namespace osu.Game.Beatmaps private readonly WorkingBeatmapCache workingBeatmapCache; private readonly BeatmapOnlineLookupQueue? onlineBeatmapLookupQueue; + private readonly BeatmapUpdater? beatmapUpdater; public BeatmapManager(Storage storage, RealmAccess realm, RulesetStore rulesets, IAPIProvider? api, AudioManager audioManager, IResourceStore gameResources, GameHost? host = null, - WorkingBeatmap? defaultBeatmap = null, bool performOnlineLookups = false) + WorkingBeatmap? defaultBeatmap = null, BeatmapDifficultyCache? difficultyCache = null, bool performOnlineLookups = false) : base(storage, realm) { if (performOnlineLookups) @@ -52,14 +53,18 @@ namespace osu.Game.Beatmaps if (api == null) throw new ArgumentNullException(nameof(api), "API must be provided if online lookups are required."); + if (difficultyCache == null) + throw new ArgumentNullException(nameof(difficultyCache), "Difficulty cache must be provided if online lookups are required."); + onlineBeatmapLookupQueue = new BeatmapOnlineLookupQueue(api, storage); + beatmapUpdater = new BeatmapUpdater(this, onlineBeatmapLookupQueue, difficultyCache); } var userResources = new RealmFileStore(realm, storage).Store; BeatmapTrackStore = audioManager.GetTrackStore(userResources); - beatmapImporter = CreateBeatmapImporter(storage, realm, rulesets, onlineBeatmapLookupQueue); + beatmapImporter = CreateBeatmapImporter(storage, realm, rulesets, beatmapUpdater); beatmapImporter.PostNotification = obj => PostNotification?.Invoke(obj); workingBeatmapCache = CreateWorkingBeatmapCache(audioManager, gameResources, userResources, defaultBeatmap, host); @@ -71,8 +76,8 @@ namespace osu.Game.Beatmaps return new WorkingBeatmapCache(BeatmapTrackStore, audioManager, resources, storage, defaultBeatmap, host); } - protected virtual BeatmapImporter CreateBeatmapImporter(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapOnlineLookupQueue? onlineLookupQueue) => - new BeatmapImporter(storage, realm, onlineLookupQueue); + protected virtual BeatmapImporter CreateBeatmapImporter(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapUpdater? beatmapUpdater) => + new BeatmapImporter(storage, realm, beatmapUpdater); /// /// Create a new beatmap set, backed by a model, diff --git a/osu.Game/Beatmaps/BeatmapUpdater.cs b/osu.Game/Beatmaps/BeatmapUpdater.cs new file mode 100644 index 0000000000..8ccaf893a7 --- /dev/null +++ b/osu.Game/Beatmaps/BeatmapUpdater.cs @@ -0,0 +1,78 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable enable + +using System.Linq; +using System.Threading.Tasks; +using osu.Framework.Extensions; +using osu.Game.Database; +using osu.Game.Rulesets.Objects; + +namespace osu.Game.Beatmaps +{ + /// + /// Handles all processing required to ensure a local beatmap is in a consistent state with any changes. + /// + public class BeatmapUpdater + { + private readonly BeatmapManager beatmapManager; + private readonly BeatmapOnlineLookupQueue onlineLookupQueue; + private readonly BeatmapDifficultyCache difficultyCache; + + public BeatmapUpdater(BeatmapManager beatmapManager, BeatmapOnlineLookupQueue onlineLookupQueue, BeatmapDifficultyCache difficultyCache) + { + this.beatmapManager = beatmapManager; + this.onlineLookupQueue = onlineLookupQueue; + this.difficultyCache = difficultyCache; + } + + /// + /// Queue a beatmap for background processing. + /// + public void Queue(Live beatmap) + { + // For now, just fire off a task. + // TODO: Add actual queueing probably. + Task.Factory.StartNew(() => beatmap.PerformRead(Process)); + } + + /// + /// Run all processing on a beatmap immediately. + /// + public void Process(BeatmapSetInfo beatmapSet) + { + beatmapSet.Realm.Write(() => + { + onlineLookupQueue.Update(beatmapSet); + + foreach (var beatmap in beatmapSet.Beatmaps) + { + var working = beatmapManager.GetWorkingBeatmap(beatmap); + + // Because we aren't guaranteed all processing will happen on this thread, it's very hard to use the live realm object. + // This can be fixed by adding a synchronous flow to `BeatmapDifficultyCache`. + var detachedBeatmap = beatmap.Detach(); + + beatmap.StarRating = difficultyCache.GetDifficultyAsync(detachedBeatmap).GetResultSafely()?.Stars ?? 0; + beatmap.Length = calculateLength(working.Beatmap); + beatmap.BPM = 60000 / working.Beatmap.GetMostCommonBeatLength(); + } + }); + } + + private double calculateLength(IBeatmap b) + { + if (!b.HitObjects.Any()) + return 0; + + var lastObject = b.HitObjects.Last(); + + //TODO: this isn't always correct (consider mania where a non-last object may last for longer than the last in the list). + double endTime = lastObject.GetEndTime(); + double startTime = b.HitObjects.First().StartTime; + + return endTime - startTime; + } + } +} diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 7bbad3bb72..403c5d1b49 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -272,7 +272,7 @@ namespace osu.Game // ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup() dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, realm, Scheduler, difficultyCache, LocalConfig)); - dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, realm, RulesetStore, API, Audio, Resources, Host, defaultBeatmap, performOnlineLookups: true)); + dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, realm, RulesetStore, API, Audio, Resources, Host, defaultBeatmap, difficultyCache, performOnlineLookups: true)); dependencies.Cache(BeatmapDownloader = new BeatmapModelDownloader(BeatmapManager, API)); dependencies.Cache(ScoreDownloader = new ScoreModelDownloader(ScoreManager, API)); From fe570d8052356d3c5a64410719e3ea716a920f17 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 18:57:57 +0900 Subject: [PATCH 1881/2328] Queue beatmaps for update after editing --- osu.Game/Beatmaps/BeatmapManager.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index ee7fcb5b47..1b85207f22 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -324,6 +324,10 @@ namespace osu.Game.Beatmaps workingBeatmapCache.Invalidate(beatmapInfo); + Debug.Assert(beatmapInfo.BeatmapSet != null); + + beatmapUpdater?.Queue(Realm.Run(r => r.Find(setInfo.ID).ToLive(Realm))); + static string createBeatmapFilenameFromMetadata(BeatmapInfo beatmapInfo) { var metadata = beatmapInfo.Metadata; From 021b16f2f3635469fd5b9673424582dc3dfafebf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 19:25:18 +0900 Subject: [PATCH 1882/2328] Ensure `WorkingBeatmap` is invalidated after update --- osu.Game/Beatmaps/BeatmapUpdater.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapUpdater.cs b/osu.Game/Beatmaps/BeatmapUpdater.cs index 8ccaf893a7..7689f4d007 100644 --- a/osu.Game/Beatmaps/BeatmapUpdater.cs +++ b/osu.Game/Beatmaps/BeatmapUpdater.cs @@ -16,13 +16,13 @@ namespace osu.Game.Beatmaps /// public class BeatmapUpdater { - private readonly BeatmapManager beatmapManager; + private readonly IWorkingBeatmapCache workingBeatmapCache; private readonly BeatmapOnlineLookupQueue onlineLookupQueue; private readonly BeatmapDifficultyCache difficultyCache; - public BeatmapUpdater(BeatmapManager beatmapManager, BeatmapOnlineLookupQueue onlineLookupQueue, BeatmapDifficultyCache difficultyCache) + public BeatmapUpdater(IWorkingBeatmapCache workingBeatmapCache, BeatmapOnlineLookupQueue onlineLookupQueue, BeatmapDifficultyCache difficultyCache) { - this.beatmapManager = beatmapManager; + this.workingBeatmapCache = workingBeatmapCache; this.onlineLookupQueue = onlineLookupQueue; this.difficultyCache = difficultyCache; } @@ -48,17 +48,19 @@ namespace osu.Game.Beatmaps foreach (var beatmap in beatmapSet.Beatmaps) { - var working = beatmapManager.GetWorkingBeatmap(beatmap); - // Because we aren't guaranteed all processing will happen on this thread, it's very hard to use the live realm object. // This can be fixed by adding a synchronous flow to `BeatmapDifficultyCache`. var detachedBeatmap = beatmap.Detach(); beatmap.StarRating = difficultyCache.GetDifficultyAsync(detachedBeatmap).GetResultSafely()?.Stars ?? 0; + + var working = workingBeatmapCache.GetWorkingBeatmap(beatmap); beatmap.Length = calculateLength(working.Beatmap); beatmap.BPM = 60000 / working.Beatmap.GetMostCommonBeatLength(); } }); + + workingBeatmapCache.Invalidate(beatmapSet); } private double calculateLength(IBeatmap b) From 6999933d33a4289f4dd5645079f2fb2d3f8f04e1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 18:27:47 +0900 Subject: [PATCH 1883/2328] Split updater process into realm transaction and non-transaction --- osu.Game/Beatmaps/BeatmapManager.cs | 13 ++++++---- osu.Game/Beatmaps/BeatmapUpdater.cs | 39 +++++++++++++++-------------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 1b85207f22..effa0ab094 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -319,15 +319,18 @@ namespace osu.Game.Beatmaps AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo)); - Realm.Write(r => setInfo.CopyChangesToRealm(r.Find(setInfo.ID))); + Realm.Write(r => + { + var liveBeatmapSet = r.Find(setInfo.ID); + + setInfo.CopyChangesToRealm(liveBeatmapSet); + + beatmapUpdater?.Process(liveBeatmapSet, r); + }); } - workingBeatmapCache.Invalidate(beatmapInfo); - Debug.Assert(beatmapInfo.BeatmapSet != null); - beatmapUpdater?.Queue(Realm.Run(r => r.Find(setInfo.ID).ToLive(Realm))); - static string createBeatmapFilenameFromMetadata(BeatmapInfo beatmapInfo) { var metadata = beatmapInfo.Metadata; diff --git a/osu.Game/Beatmaps/BeatmapUpdater.cs b/osu.Game/Beatmaps/BeatmapUpdater.cs index 7689f4d007..a24407a734 100644 --- a/osu.Game/Beatmaps/BeatmapUpdater.cs +++ b/osu.Game/Beatmaps/BeatmapUpdater.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using osu.Framework.Extensions; using osu.Game.Database; using osu.Game.Rulesets.Objects; +using Realms; namespace osu.Game.Beatmaps { @@ -40,27 +41,27 @@ namespace osu.Game.Beatmaps /// /// Run all processing on a beatmap immediately. /// - public void Process(BeatmapSetInfo beatmapSet) + public void Process(BeatmapSetInfo beatmapSet) => beatmapSet.Realm.Write(r => Process(beatmapSet, r)); + + public void Process(BeatmapSetInfo beatmapSet, Realm realm) { - beatmapSet.Realm.Write(() => - { - onlineLookupQueue.Update(beatmapSet); - - foreach (var beatmap in beatmapSet.Beatmaps) - { - // Because we aren't guaranteed all processing will happen on this thread, it's very hard to use the live realm object. - // This can be fixed by adding a synchronous flow to `BeatmapDifficultyCache`. - var detachedBeatmap = beatmap.Detach(); - - beatmap.StarRating = difficultyCache.GetDifficultyAsync(detachedBeatmap).GetResultSafely()?.Stars ?? 0; - - var working = workingBeatmapCache.GetWorkingBeatmap(beatmap); - beatmap.Length = calculateLength(working.Beatmap); - beatmap.BPM = 60000 / working.Beatmap.GetMostCommonBeatLength(); - } - }); - + // Before we use below, we want to invalidate. workingBeatmapCache.Invalidate(beatmapSet); + + onlineLookupQueue.Update(beatmapSet); + + foreach (var beatmap in beatmapSet.Beatmaps) + { + // Because we aren't guaranteed all processing will happen on this thread, it's very hard to use the live realm object. + // This can be fixed by adding a synchronous flow to `BeatmapDifficultyCache`. + var detachedBeatmap = beatmap.Detach(); + + beatmap.StarRating = difficultyCache.GetDifficultyAsync(detachedBeatmap).GetResultSafely()?.Stars ?? 0; + + var working = workingBeatmapCache.GetWorkingBeatmap(beatmap); + beatmap.Length = calculateLength(working.Beatmap); + beatmap.BPM = 60000 / working.Beatmap.GetMostCommonBeatLength(); + } } private double calculateLength(IBeatmap b) From 66a01d1ed29a261a0b5a490eef1e63b0177d2a5c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jun 2022 19:48:46 +0900 Subject: [PATCH 1884/2328] Allow song select to refresh the global `WorkingBeatmap` after an external update --- osu.Game/Beatmaps/BeatmapManager.cs | 6 ++++++ osu.Game/Beatmaps/IWorkingBeatmapCache.cs | 4 ++++ osu.Game/Beatmaps/WorkingBeatmapCache.cs | 3 +++ osu.Game/Screens/Select/SongSelect.cs | 18 ++++++++++++++++++ 4 files changed, 31 insertions(+) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index effa0ab094..ff176484b6 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -453,6 +453,12 @@ namespace osu.Game.Beatmaps void IWorkingBeatmapCache.Invalidate(BeatmapSetInfo beatmapSetInfo) => workingBeatmapCache.Invalidate(beatmapSetInfo); void IWorkingBeatmapCache.Invalidate(BeatmapInfo beatmapInfo) => workingBeatmapCache.Invalidate(beatmapInfo); + public event Action? OnInvalidated + { + add => workingBeatmapCache.OnInvalidated += value; + remove => workingBeatmapCache.OnInvalidated -= value; + } + public override bool IsAvailableLocally(BeatmapSetInfo model) => Realm.Run(realm => realm.All().Any(s => s.OnlineID == model.OnlineID)); #endregion diff --git a/osu.Game/Beatmaps/IWorkingBeatmapCache.cs b/osu.Game/Beatmaps/IWorkingBeatmapCache.cs index ad9cac6957..36c53fce99 100644 --- a/osu.Game/Beatmaps/IWorkingBeatmapCache.cs +++ b/osu.Game/Beatmaps/IWorkingBeatmapCache.cs @@ -3,6 +3,8 @@ #nullable disable +using System; + namespace osu.Game.Beatmaps { public interface IWorkingBeatmapCache @@ -25,5 +27,7 @@ namespace osu.Game.Beatmaps /// /// The beatmap info to invalidate any cached entries for. void Invalidate(BeatmapInfo beatmapInfo); + + event Action OnInvalidated; } } diff --git a/osu.Game/Beatmaps/WorkingBeatmapCache.cs b/osu.Game/Beatmaps/WorkingBeatmapCache.cs index 4495fb8318..9d31c58709 100644 --- a/osu.Game/Beatmaps/WorkingBeatmapCache.cs +++ b/osu.Game/Beatmaps/WorkingBeatmapCache.cs @@ -76,10 +76,13 @@ namespace osu.Game.Beatmaps { Logger.Log($"Invalidating working beatmap cache for {info}"); workingCache.Remove(working); + OnInvalidated?.Invoke(working); } } } + public event Action OnInvalidated; + public virtual WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo) { if (beatmapInfo?.BeatmapSet == null) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 41fb55a856..d3635ea553 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -296,8 +296,24 @@ namespace osu.Game.Screens.Select base.LoadComplete(); modSelectOverlayRegistration = OverlayManager?.RegisterBlockingOverlay(ModSelect); + + beatmaps.OnInvalidated += workingBeatmapInvalidated; } + private void workingBeatmapInvalidated(WorkingBeatmap working) => Scheduler.AddOnce(w => + { + // The global beatmap may have already been updated (ie. by the editor). + // Only perform the actual switch if we still need to. + if (w == Beatmap.Value) + { + // Not sure if this refresh is required. + var beatmapInfo = beatmaps.QueryBeatmap(b => b.ID == w.BeatmapInfo.ID); + Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo); + } + + updateComponentFromBeatmap(Beatmap.Value); + }, working); + /// /// Creates the buttons to be displayed in the footer. /// @@ -700,6 +716,8 @@ namespace osu.Game.Screens.Select music.TrackChanged -= ensureTrackLooping; modSelectOverlayRegistration?.Dispose(); + + beatmaps.OnInvalidated -= workingBeatmapInvalidated; } /// From 30b3973c9fcef6a8a1a308376815d5559eea3d65 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 18:39:44 +0900 Subject: [PATCH 1885/2328] Difficulty cache invalidation flow --- osu.Game/Beatmaps/BeatmapDifficultyCache.cs | 5 +++++ osu.Game/Beatmaps/BeatmapUpdater.cs | 2 ++ osu.Game/Database/MemoryCachingComponent.cs | 10 ++++++++++ 3 files changed, 17 insertions(+) diff --git a/osu.Game/Beatmaps/BeatmapDifficultyCache.cs b/osu.Game/Beatmaps/BeatmapDifficultyCache.cs index ef0fa36b16..493de5bef4 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyCache.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyCache.cs @@ -81,6 +81,11 @@ namespace osu.Game.Beatmaps }, true); } + public void Invalidate(IBeatmapInfo beatmap) + { + base.Invalidate(lookup => lookup.BeatmapInfo.Equals(beatmap)); + } + /// /// Retrieves a bindable containing the star difficulty of a that follows the currently-selected ruleset and mods. /// diff --git a/osu.Game/Beatmaps/BeatmapUpdater.cs b/osu.Game/Beatmaps/BeatmapUpdater.cs index a24407a734..e6703dd8d0 100644 --- a/osu.Game/Beatmaps/BeatmapUpdater.cs +++ b/osu.Game/Beatmaps/BeatmapUpdater.cs @@ -61,6 +61,8 @@ namespace osu.Game.Beatmaps var working = workingBeatmapCache.GetWorkingBeatmap(beatmap); beatmap.Length = calculateLength(working.Beatmap); beatmap.BPM = 60000 / working.Beatmap.GetMostCommonBeatLength(); + + difficultyCache.Invalidate(beatmap); } } diff --git a/osu.Game/Database/MemoryCachingComponent.cs b/osu.Game/Database/MemoryCachingComponent.cs index 6e6d928dcc..215050460b 100644 --- a/osu.Game/Database/MemoryCachingComponent.cs +++ b/osu.Game/Database/MemoryCachingComponent.cs @@ -3,6 +3,7 @@ #nullable disable +using System; using System.Collections.Concurrent; using System.Threading; using System.Threading.Tasks; @@ -39,6 +40,15 @@ namespace osu.Game.Database return computed; } + protected void Invalidate(Func invalidationFunction) + { + foreach (var kvp in cache) + { + if (invalidationFunction(kvp.Key)) + cache.TryRemove(kvp.Key, out _); + } + } + protected bool CheckExists([NotNull] TLookup lookup, out TValue value) => cache.TryGetValue(lookup, out value); From 0c3d890f76588465df93aa2e80d57bc7199b4f17 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 19:04:20 +0900 Subject: [PATCH 1886/2328] Fix reprocessing not working on import due to realm threading woes --- osu.Game/Beatmaps/BeatmapImporter.cs | 9 +++++++-- osu.Game/Beatmaps/BeatmapUpdater.cs | 17 +++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapImporter.cs b/osu.Game/Beatmaps/BeatmapImporter.cs index 0620e5d9b1..05c5a15505 100644 --- a/osu.Game/Beatmaps/BeatmapImporter.cs +++ b/osu.Game/Beatmaps/BeatmapImporter.cs @@ -80,8 +80,6 @@ namespace osu.Game.Beatmaps // If this is ever an issue, we can consider marking as pending delete but not resetting the IDs (but care will be required for // beatmaps, which don't have their own `DeletePending` state). - beatmapUpdater?.Process(beatmapSet, realm); - if (beatmapSet.OnlineID > 0) { var existingSetWithSameOnlineID = realm.All().SingleOrDefault(b => b.OnlineID == beatmapSet.OnlineID); @@ -99,6 +97,13 @@ namespace osu.Game.Beatmaps } } + protected override void PostImport(BeatmapSetInfo model, Realm realm) + { + base.PostImport(model, realm); + + beatmapUpdater?.Process(model); + } + private void validateOnlineIds(BeatmapSetInfo beatmapSet, Realm realm) { var beatmapIds = beatmapSet.Beatmaps.Where(b => b.OnlineID > 0).Select(b => b.OnlineID).ToList(); diff --git a/osu.Game/Beatmaps/BeatmapUpdater.cs b/osu.Game/Beatmaps/BeatmapUpdater.cs index e6703dd8d0..0397cfbea9 100644 --- a/osu.Game/Beatmaps/BeatmapUpdater.cs +++ b/osu.Game/Beatmaps/BeatmapUpdater.cs @@ -3,9 +3,9 @@ #nullable enable +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; -using osu.Framework.Extensions; using osu.Game.Database; using osu.Game.Rulesets.Objects; using Realms; @@ -52,17 +52,18 @@ namespace osu.Game.Beatmaps foreach (var beatmap in beatmapSet.Beatmaps) { - // Because we aren't guaranteed all processing will happen on this thread, it's very hard to use the live realm object. - // This can be fixed by adding a synchronous flow to `BeatmapDifficultyCache`. - var detachedBeatmap = beatmap.Detach(); + difficultyCache.Invalidate(beatmap); - beatmap.StarRating = difficultyCache.GetDifficultyAsync(detachedBeatmap).GetResultSafely()?.Stars ?? 0; + var working = workingBeatmapCache.GetWorkingBeatmap(beatmap.Detach()); + var ruleset = working.BeatmapInfo.Ruleset.CreateInstance(); - var working = workingBeatmapCache.GetWorkingBeatmap(beatmap); + Debug.Assert(ruleset != null); + + var calculator = ruleset.CreateDifficultyCalculator(working); + + beatmap.StarRating = calculator.Calculate().StarRating; beatmap.Length = calculateLength(working.Beatmap); beatmap.BPM = 60000 / working.Beatmap.GetMostCommonBeatLength(); - - difficultyCache.Invalidate(beatmap); } } From 7692bac35a27618c8c5b74a80923d862d2340159 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 21:02:14 +0900 Subject: [PATCH 1887/2328] Simplify refetch (and ensure to invalidate after processing) --- osu.Game/Beatmaps/BeatmapManager.cs | 22 +++++++++++++--------- osu.Game/Beatmaps/BeatmapUpdater.cs | 5 ++++- osu.Game/Screens/Edit/Editor.cs | 4 +--- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index ff176484b6..26f538f65b 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -430,26 +430,30 @@ namespace osu.Game.Beatmaps #region Implementation of IWorkingBeatmapCache - public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo? beatmapInfo) + /// + /// Retrieve a instance for the provided + /// + /// The beatmap to lookup. + /// Whether to force a refetch from the database to ensure is up-to-date. + /// A instance correlating to the provided . + public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, bool refetch = false) { // Detached sets don't come with files. // If we seem to be missing files, now is a good time to re-fetch. - if (beatmapInfo?.IsManaged == true || beatmapInfo?.BeatmapSet?.Files.Count == 0) + if (refetch || beatmapInfo.IsManaged || beatmapInfo.BeatmapSet?.Files.Count == 0) { - Realm.Run(r => - { - var refetch = r.Find(beatmapInfo.ID)?.Detach(); + workingBeatmapCache.Invalidate(beatmapInfo); - if (refetch != null) - beatmapInfo = refetch; - }); + Guid id = beatmapInfo.ID; + beatmapInfo = Realm.Run(r => r.Find(id)?.Detach()) ?? beatmapInfo; } - Debug.Assert(beatmapInfo?.IsManaged != true); + Debug.Assert(beatmapInfo.IsManaged != true); return workingBeatmapCache.GetWorkingBeatmap(beatmapInfo); } + WorkingBeatmap IWorkingBeatmapCache.GetWorkingBeatmap(BeatmapInfo beatmapInfo) => GetWorkingBeatmap(beatmapInfo); void IWorkingBeatmapCache.Invalidate(BeatmapSetInfo beatmapSetInfo) => workingBeatmapCache.Invalidate(beatmapSetInfo); void IWorkingBeatmapCache.Invalidate(BeatmapInfo beatmapInfo) => workingBeatmapCache.Invalidate(beatmapInfo); diff --git a/osu.Game/Beatmaps/BeatmapUpdater.cs b/osu.Game/Beatmaps/BeatmapUpdater.cs index 0397cfbea9..caef094701 100644 --- a/osu.Game/Beatmaps/BeatmapUpdater.cs +++ b/osu.Game/Beatmaps/BeatmapUpdater.cs @@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps { difficultyCache.Invalidate(beatmap); - var working = workingBeatmapCache.GetWorkingBeatmap(beatmap.Detach()); + var working = workingBeatmapCache.GetWorkingBeatmap(beatmap); var ruleset = working.BeatmapInfo.Ruleset.CreateInstance(); Debug.Assert(ruleset != null); @@ -65,6 +65,9 @@ namespace osu.Game.Beatmaps beatmap.Length = calculateLength(working.Beatmap); beatmap.BPM = 60000 / working.Beatmap.GetMostCommonBeatLength(); } + + // And invalidate again afterwards as re-fetching the most up-to-date database metadata will be required. + workingBeatmapCache.Invalidate(beatmapSet); } private double calculateLength(IBeatmap b) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 7a9dae33b4..528a237ac4 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -630,9 +630,7 @@ namespace osu.Game.Screens.Edit // To update the game-wide beatmap with any changes, perform a re-fetch on exit/suspend. // This is required as the editor makes its local changes via EditorBeatmap // (which are not propagated outwards to a potentially cached WorkingBeatmap). - ((IWorkingBeatmapCache)beatmapManager).Invalidate(Beatmap.Value.BeatmapInfo); - var refetchedBeatmapInfo = beatmapManager.QueryBeatmap(b => b.ID == Beatmap.Value.BeatmapInfo.ID); - var refetchedBeatmap = beatmapManager.GetWorkingBeatmap(refetchedBeatmapInfo); + var refetchedBeatmap = beatmapManager.GetWorkingBeatmap(Beatmap.Value.BeatmapInfo, true); if (!(refetchedBeatmap is DummyWorkingBeatmap)) { From 2c5e5fed6f8edd6f0238c5c8af09b440d9421aca Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 21:02:29 +0900 Subject: [PATCH 1888/2328] Add test coverage of star rating and difficulty updating on editor save --- .../Visual/Editing/TestSceneEditorSaving.cs | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs index e9bbf1e33d..bcf02cd814 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs @@ -9,6 +9,7 @@ using osu.Framework.Allocation; using osu.Framework.Screens; using osu.Framework.Testing; using osu.Framework.Utils; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Compose.Components.Timeline; @@ -130,6 +131,54 @@ namespace osu.Game.Tests.Visual.Editing !ReferenceEquals(EditorBeatmap.HitObjects[0].DifficultyControlPoint, DifficultyControlPoint.DEFAULT)); } + [Test] + public void TestLengthAndStarRatingUpdated() + { + WorkingBeatmap working = null; + double lastStarRating = 0; + double lastLength = 0; + + AddStep("Add timing point", () => EditorBeatmap.ControlPointInfo.Add(500, new TimingControlPoint())); + AddStep("Change to placement mode", () => InputManager.Key(Key.Number2)); + AddStep("Move to playfield", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.Centre)); + AddStep("Place single hitcircle", () => InputManager.Click(MouseButton.Left)); + AddAssert("One hitobject placed", () => EditorBeatmap.HitObjects.Count == 1); + + SaveEditor(); + AddStep("Get working beatmap", () => working = Game.BeatmapManager.GetWorkingBeatmap(EditorBeatmap.BeatmapInfo, true)); + + AddAssert("Beatmap length is zero", () => working.BeatmapInfo.Length == 0); + checkDifficultyIncreased(); + + AddStep("Move forward", () => InputManager.Key(Key.Right)); + AddStep("Place another hitcircle", () => InputManager.Click(MouseButton.Left)); + AddAssert("Two hitobjects placed", () => EditorBeatmap.HitObjects.Count == 2); + + SaveEditor(); + AddStep("Get working beatmap", () => working = Game.BeatmapManager.GetWorkingBeatmap(EditorBeatmap.BeatmapInfo, true)); + + checkDifficultyIncreased(); + checkLengthIncreased(); + + void checkLengthIncreased() + { + AddStep("Beatmap length increased", () => + { + Assert.That(working.BeatmapInfo.Length, Is.GreaterThan(lastLength)); + lastLength = working.BeatmapInfo.Length; + }); + } + + void checkDifficultyIncreased() + { + AddStep("Beatmap difficulty increased", () => + { + Assert.That(working.BeatmapInfo.StarRating, Is.GreaterThan(lastStarRating)); + lastStarRating = working.BeatmapInfo.StarRating; + }); + } + } + [Test] public void TestExitWithoutSaveFromExistingBeatmap() { From 31a447fda0532fcf15f8c8251ca890c533386492 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 21:25:23 +0900 Subject: [PATCH 1889/2328] Update parameter discards --- osu.Desktop/DiscordRichPresence.cs | 2 +- osu.Desktop/Program.cs | 8 +++--- osu.Game.Benchmarks/BenchmarkRealmReads.cs | 2 +- .../JuiceStreamPathTest.cs | 2 +- .../TestSceneHyperDash.cs | 2 +- .../Edit/CatchHitObjectComposer.cs | 6 ++--- .../Edit/CatchHitObjectUtils.cs | 4 +-- .../Edit/CatchSelectionHandler.cs | 2 +- osu.Game.Rulesets.Catch/UI/Catcher.cs | 6 ++--- .../Beatmaps/ManiaBeatmapConverter.cs | 2 +- .../Difficulty/ManiaDifficultyCalculator.cs | 6 ++--- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 26 +++++++++---------- .../Mods/ManiaModRandom.cs | 2 +- .../Replays/ManiaAutoGenerator.cs | 4 +-- .../LegacyMainCirclePieceTest.cs | 2 +- .../Mods/TestSceneOsuModSpunOut.cs | 4 +-- .../Edit/OsuHitObjectComposer.cs | 4 +-- .../Mods/OsuModApproachDifferent.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs | 8 +++--- .../Mods/OsuModObjectScaleTween.cs | 8 +++--- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 8 +++--- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 +- osu.Game.Rulesets.Osu/OsuRuleset.cs | 8 +++--- .../Replays/OsuAutoGenerator.cs | 2 +- .../Scoring/OsuScoreProcessor.cs | 2 +- .../Skinning/Legacy/LegacyNewStyleSpinner.cs | 2 +- .../UI/ObjectOrderedHitPolicy.cs | 2 +- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 2 +- .../OsuHitObjectGenerationUtils_Reposition.cs | 4 +-- .../TestSceneTaikoSuddenDeath.cs | 2 +- .../Mods/TaikoModHidden.cs | 4 +-- osu.Game.Rulesets.Taiko/Objects/Hit.cs | 2 +- .../Objects/TaikoStrongableHitObject.cs | 2 +- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 8 +++--- .../Collections/IO/ImportCollectionsTest.cs | 2 +- osu.Game.Tests/Database/GeneralUsageTests.cs | 2 +- osu.Game.Tests/Database/RealmLiveTests.cs | 2 +- .../Skinning/LegacySkinTextureFallbackTest.cs | 2 +- .../TestSceneDrawableScrollingRuleset.cs | 4 +-- .../Visual/Gameplay/TestSceneFailAnimation.cs | 2 +- .../Visual/Gameplay/TestSceneFailJudgement.cs | 2 +- .../Visual/Gameplay/TestSceneSkinEditor.cs | 2 +- .../Gameplay/TestSceneSkinnableDrawable.cs | 6 ++--- .../Gameplay/TestSceneStoryboardWithOutro.cs | 4 +-- ...MultiplayerGameplayLeaderboardTestScene.cs | 2 +- .../TestSceneDrawableLoungeRoom.cs | 2 +- .../Multiplayer/TestSceneMatchStartControl.cs | 2 +- .../Visual/Online/TestSceneNewsSidebar.cs | 2 +- .../TestScenePlaylistsResultsScreen.cs | 4 +-- .../Visual/Settings/TestSceneSettingsPanel.cs | 2 +- .../SongSelect/TestSceneBeatmapInfoWedge.cs | 8 +++--- .../TestSceneBeatSyncedContainer.cs | 8 +++--- .../TestSceneBeatmapListingSearchControl.cs | 6 ++--- .../TestSceneFirstRunSetupOverlay.cs | 2 +- .../TestSceneModSelectOverlay.cs | 2 +- osu.Game.Tournament/Components/DateTextBox.cs | 2 +- .../Components/DrawableTeamFlag.cs | 2 +- .../Components/DrawableTeamTitle.cs | 2 +- .../Components/DrawableTournamentTeam.cs | 2 +- .../Screens/Drawings/DrawingsScreen.cs | 2 +- .../Screens/Editors/LadderEditorScreen.cs | 2 +- .../Components/DrawableTournamentRound.cs | 4 +-- .../Screens/Ladder/LadderScreen.cs | 2 +- osu.Game.Tournament/TournamentGame.cs | 2 +- osu.Game.Tournament/TournamentGameBase.cs | 2 +- osu.Game.Tournament/TournamentSceneManager.cs | 4 +-- .../ControlPoints/ControlPointInfo.cs | 4 +-- .../Drawables/BundledBeatmapDownloader.cs | 2 +- .../Beatmaps/Formats/JsonBeatmapDecoder.cs | 2 +- .../Beatmaps/Formats/LegacyBeatmapEncoder.cs | 4 +-- .../Formats/LegacyStoryboardDecoder.cs | 2 +- .../Beatmaps/Legacy/LegacyControlPointInfo.cs | 4 +-- osu.Game/Collections/BeatmapCollection.cs | 2 +- .../Collections/CollectionFilterDropdown.cs | 4 +-- osu.Game/Collections/CollectionManager.cs | 2 +- osu.Game/Database/RealmAccess.cs | 2 +- osu.Game/Database/RealmObjectExtensions.cs | 14 +++++----- osu.Game/Extensions/TaskExtensions.cs | 2 +- .../Markdown/OsuMarkdownContainer.cs | 2 +- osu.Game/Graphics/UserInterface/BarGraph.cs | 2 +- .../Graphics/UserInterface/LoadingLayer.cs | 4 +-- .../Graphics/UserInterface/StarCounter.cs | 2 +- .../Bindings/DatabasedKeyBindingContainer.cs | 2 +- osu.Game/Input/IdleTracker.cs | 10 +++---- osu.Game/Online/BeatmapDownloadTracker.cs | 2 +- osu.Game/Online/Chat/ChannelManager.cs | 2 +- osu.Game/Online/HubClientConnector.cs | 2 +- .../OnlinePlayBeatmapAvailabilityTracker.cs | 2 +- osu.Game/Online/ScoreDownloadTracker.cs | 2 +- osu.Game/OsuGameBase.cs | 2 +- .../BeatmapListingFilterControl.cs | 6 ++--- osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs | 2 +- .../BeatmapSet/Scores/ScoresContainer.cs | 2 +- osu.Game/Overlays/Comments/CommentEditor.cs | 2 +- .../Overlays/Comments/CommentsContainer.cs | 4 +-- .../Dashboard/Friends/FriendDisplay.cs | 2 +- osu.Game/Overlays/Login/LoginForm.cs | 2 +- .../Overlays/MedalSplash/DrawableMedal.cs | 2 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 6 ++--- osu.Game/Overlays/Music/PlaylistOverlay.cs | 2 +- .../Notifications/ProgressNotification.cs | 2 +- osu.Game/Overlays/OSD/TrackedSettingToast.cs | 2 +- .../Sections/Graphics/LayoutSettings.cs | 6 ++--- .../Sections/Maintenance/BeatmapSettings.cs | 10 +++---- .../Maintenance/CollectionsSettings.cs | 2 +- .../Sections/Maintenance/ScoreSettings.cs | 4 +-- .../Sections/Maintenance/SkinSettings.cs | 4 +-- .../Overlays/Settings/Sections/SkinSection.cs | 4 +-- .../Configuration/RulesetConfigManager.cs | 2 +- osu.Game/Rulesets/Edit/PlacementBlueprint.cs | 4 +-- .../Mods/DifficultyAdjustSettingsControl.cs | 4 +-- osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs | 4 +-- osu.Game/Rulesets/Mods/ModTimeRamp.cs | 2 +- osu.Game/Rulesets/Ruleset.cs | 26 +++++++++---------- osu.Game/Rulesets/UI/RulesetInputManager.cs | 2 +- .../TernaryButtons/DrawableTernaryButton.cs | 2 +- .../Summary/Parts/ControlPointPart.cs | 2 +- .../Summary/Parts/GroupVisualisation.cs | 8 +++--- .../Timelines/Summary/Parts/TimelinePart.cs | 2 +- .../Compose/Components/BeatDivisorControl.cs | 2 +- .../Compose/Components/BlueprintContainer.cs | 2 +- .../Components/EditorSelectionHandler.cs | 2 +- .../Compose/Components/SelectionHandler.cs | 2 +- .../Components/Timeline/SamplePointPiece.cs | 6 ++--- .../Timeline/TimelineControlPointDisplay.cs | 2 +- .../Timeline/TimelineControlPointGroup.cs | 2 +- .../Screens/Edit/Compose/ComposeScreen.cs | 2 +- osu.Game/Screens/Edit/EditorBeatmap.cs | 4 +-- osu.Game/Screens/Edit/EditorBeatmapSkin.cs | 2 +- osu.Game/Screens/Edit/Setup/DesignSection.cs | 2 +- .../Screens/Edit/Timing/ControlPointTable.cs | 4 +-- .../Edit/Timing/LabelledTimeSignature.cs | 2 +- .../Edit/Timing/SliderWithTextBoxInput.cs | 2 +- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 2 +- osu.Game/Screens/Edit/Timing/TimingSection.cs | 2 +- .../Edit/Timing/WaveformComparisonDisplay.cs | 2 +- osu.Game/Screens/Edit/Verify/IssueList.cs | 2 +- osu.Game/Screens/Menu/Disclaimer.cs | 2 +- .../OnlinePlay/Components/BeatmapTitle.cs | 2 +- .../Components/MatchBeatmapDetailArea.cs | 2 +- .../Components/OnlinePlayBackgroundSprite.cs | 2 +- .../Components/OverlinedPlaylistHeader.cs | 2 +- .../OnlinePlay/Components/ParticipantsList.cs | 2 +- .../Components/StarRatingRangeDisplay.cs | 2 +- .../OnlinePlay/DrawableRoomPlaylist.cs | 2 +- osu.Game/Screens/OnlinePlay/Header.cs | 4 +-- .../Lounge/Components/PlaylistCountPill.cs | 2 +- .../OnlinePlay/Lounge/DrawableLoungeRoom.cs | 2 +- .../Lounge/LoungeBackgroundScreen.cs | 2 +- .../OnlinePlay/Lounge/LoungeSubScreen.cs | 2 +- .../Match/MultiplayerReadyButton.cs | 2 +- .../Match/MultiplayerSpectateButton.cs | 2 +- .../Playlist/MultiplayerPlaylistTabControl.cs | 2 +- .../Match/Playlist/MultiplayerQueueList.cs | 2 +- .../Multiplayer/MultiplayerLoungeSubScreen.cs | 2 +- .../Multiplayer/MultiplayerPlayer.cs | 2 +- .../Spectate/MultiSpectatorScreen.cs | 2 +- .../Screens/OnlinePlay/OnlinePlayComposite.cs | 2 +- .../Playlists/PlaylistsRoomSubScreen.cs | 2 +- osu.Game/Screens/Play/FailAnimation.cs | 2 +- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 4 +-- .../Screens/Play/HUD/HoldForMenuButton.cs | 2 +- osu.Game/Screens/Play/HUDOverlay.cs | 2 +- osu.Game/Screens/Play/KeyCounterDisplay.cs | 8 +++--- osu.Game/Screens/Play/Player.cs | 4 +-- osu.Game/Screens/Play/ReplayPlayer.cs | 2 +- .../Expanded/Statistics/ComboStatistic.cs | 2 +- .../Ranking/Statistics/StatisticsPanel.cs | 2 +- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- osu.Game/Screens/Select/BeatmapDetailArea.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- .../Screens/Select/Carousel/TopLocalRank.cs | 2 +- .../Screens/Select/Details/AdvancedStats.cs | 2 +- .../Screens/Select/PlayBeatmapDetailArea.cs | 2 +- osu.Game/Skinning/DefaultSkin.cs | 2 +- osu.Game/Skinning/Editor/SkinEditor.cs | 4 +-- osu.Game/Skinning/Editor/SkinEditorOverlay.cs | 2 +- osu.Game/Skinning/LegacyManiaSkinDecoder.cs | 12 ++++----- osu.Game/Skinning/SkinImporter.cs | 2 +- osu.Game/Skinning/SkinProvidingContainer.cs | 6 ++--- osu.Game/Storyboards/StoryboardSprite.cs | 10 +++---- osu.Game/Tests/Visual/ScreenTestScene.cs | 4 +-- 182 files changed, 309 insertions(+), 309 deletions(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index f2531c1cae..d0b6953c30 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -57,7 +57,7 @@ namespace osu.Desktop client.OnReady += onReady; // safety measure for now, until we performance test / improve backoff for failed connections. - client.OnConnectionFailed += (_, __) => client.Deinitialize(); + client.OnConnectionFailed += (_, _) => client.Deinitialize(); client.OnError += (_, e) => Logger.Log($"An error occurred with Discord RPC Client: {e.Code} {e.Message}", LoggingTarget.Network); diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 7a5809e915..712f300671 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -129,18 +129,18 @@ namespace osu.Desktop [SupportedOSPlatform("windows")] private static void setupSquirrel() { - SquirrelAwareApp.HandleEvents(onInitialInstall: (version, tools) => + SquirrelAwareApp.HandleEvents(onInitialInstall: (_, tools) => { tools.CreateShortcutForThisExe(); tools.CreateUninstallerRegistryEntry(); - }, onAppUpdate: (version, tools) => + }, onAppUpdate: (_, tools) => { tools.CreateUninstallerRegistryEntry(); - }, onAppUninstall: (version, tools) => + }, onAppUninstall: (_, tools) => { tools.RemoveShortcutForThisExe(); tools.RemoveUninstallerRegistryEntry(); - }, onEveryRun: (version, tools, firstRun) => + }, onEveryRun: (_, _, _) => { // While setting the `ProcessAppUserModelId` fixes duplicate icons/shortcuts on the taskbar, it currently // causes the right-click context menu to function incorrectly. diff --git a/osu.Game.Benchmarks/BenchmarkRealmReads.cs b/osu.Game.Benchmarks/BenchmarkRealmReads.cs index b26fc3fd59..5ffda6504e 100644 --- a/osu.Game.Benchmarks/BenchmarkRealmReads.cs +++ b/osu.Game.Benchmarks/BenchmarkRealmReads.cs @@ -31,7 +31,7 @@ namespace osu.Game.Benchmarks realm = new RealmAccess(storage, OsuGameBase.CLIENT_DATABASE_FILENAME); - realm.Run(r => + realm.Run(_ => { realm.Write(c => c.Add(TestResources.CreateTestBeatmapSetInfo(rulesets: new[] { new OsuRuleset().RulesetInfo }))); }); diff --git a/osu.Game.Rulesets.Catch.Tests/JuiceStreamPathTest.cs b/osu.Game.Rulesets.Catch.Tests/JuiceStreamPathTest.cs index 54d26a0f3d..0de992c1df 100644 --- a/osu.Game.Rulesets.Catch.Tests/JuiceStreamPathTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/JuiceStreamPathTest.cs @@ -92,7 +92,7 @@ namespace osu.Game.Rulesets.Catch.Tests new JuiceStreamPathVertex(20, -5) })); - removeCount = path.RemoveVertices((_, i) => true); + removeCount = path.RemoveVertices((_, _) => true); Assert.That(removeCount, Is.EqualTo(1)); Assert.That(path.Vertices, Is.EqualTo(new[] { diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs index 655edf7e08..4886942dc6 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.Tests hyperDashCount = 0; // this needs to be done within the frame stable context due to how quickly hyperdash state changes occur. - Player.DrawableRuleset.FrameStableComponents.OnUpdate += d => + Player.DrawableRuleset.FrameStableComponents.OnUpdate += _ => { var catcher = Player.ChildrenOfType().FirstOrDefault(); diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs index 01156ab021..f31dc3ef9c 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs @@ -135,15 +135,15 @@ namespace osu.Game.Rulesets.Catch.Edit { switch (BlueprintContainer.CurrentTool) { - case SelectTool _: + case SelectTool: if (EditorBeatmap.SelectedHitObjects.Count == 0) return null; double minTime = EditorBeatmap.SelectedHitObjects.Min(hitObject => hitObject.StartTime); return getLastSnappableHitObject(minTime); - case FruitCompositionTool _: - case JuiceStreamCompositionTool _: + case FruitCompositionTool: + case JuiceStreamCompositionTool: if (!CursorInPlacementArea) return null; diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectUtils.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectUtils.cs index 4390234b59..889d3909bd 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectUtils.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectUtils.cs @@ -42,10 +42,10 @@ namespace osu.Game.Rulesets.Catch.Edit case Droplet droplet: return droplet is TinyDroplet ? PositionRange.EMPTY : new PositionRange(droplet.OriginalX); - case JuiceStream _: + case JuiceStream: return GetPositionRange(hitObject.NestedHitObjects); - case BananaShower _: + case BananaShower: // A banana shower occupies the whole screen width. return new PositionRange(0, CatchPlayfield.WIDTH); diff --git a/osu.Game.Rulesets.Catch/Edit/CatchSelectionHandler.cs b/osu.Game.Rulesets.Catch/Edit/CatchSelectionHandler.cs index 319cb1bfc9..5aac521d0b 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchSelectionHandler.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchSelectionHandler.cs @@ -131,7 +131,7 @@ namespace osu.Game.Rulesets.Catch.Edit { switch (hitObject) { - case BananaShower _: + case BananaShower: return false; case JuiceStream juiceStream: diff --git a/osu.Game.Rulesets.Catch/UI/Catcher.cs b/osu.Game.Rulesets.Catch/UI/Catcher.cs index 6a3ec336d1..efc841dfac 100644 --- a/osu.Game.Rulesets.Catch/UI/Catcher.cs +++ b/osu.Game.Rulesets.Catch/UI/Catcher.cs @@ -389,13 +389,13 @@ namespace osu.Game.Rulesets.Catch.UI { switch (source) { - case Fruit _: + case Fruit: return caughtFruitPool.Get(); - case Banana _: + case Banana: return caughtBananaPool.Get(); - case Droplet _: + case Droplet: return caughtDropletPool.Get(); default: diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 2b4f497785..90cd7f57b5 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -173,7 +173,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps switch (original) { - case IHasDistance _: + case IHasDistance: { var generator = new DistanceObjectPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap); conversion = generator; diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs index 8002410f70..979aaa1cf5 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -156,9 +156,9 @@ namespace osu.Game.Rulesets.Mania.Difficulty { switch (m) { - case ManiaModNoFail _: - case ManiaModEasy _: - case ManiaModHalfTime _: + case ManiaModNoFail: + case ManiaModEasy: + case ManiaModHalfTime: scoreMultiplier *= 0.5; break; } diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 98a492450e..4723416c30 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -146,56 +146,56 @@ namespace osu.Game.Rulesets.Mania { switch (mod) { - case ManiaModKey1 _: + case ManiaModKey1: value |= LegacyMods.Key1; break; - case ManiaModKey2 _: + case ManiaModKey2: value |= LegacyMods.Key2; break; - case ManiaModKey3 _: + case ManiaModKey3: value |= LegacyMods.Key3; break; - case ManiaModKey4 _: + case ManiaModKey4: value |= LegacyMods.Key4; break; - case ManiaModKey5 _: + case ManiaModKey5: value |= LegacyMods.Key5; break; - case ManiaModKey6 _: + case ManiaModKey6: value |= LegacyMods.Key6; break; - case ManiaModKey7 _: + case ManiaModKey7: value |= LegacyMods.Key7; break; - case ManiaModKey8 _: + case ManiaModKey8: value |= LegacyMods.Key8; break; - case ManiaModKey9 _: + case ManiaModKey9: value |= LegacyMods.Key9; break; - case ManiaModDualStages _: + case ManiaModDualStages: value |= LegacyMods.KeyCoop; break; - case ManiaModFadeIn _: + case ManiaModFadeIn: value |= LegacyMods.FadeIn; value &= ~LegacyMods.Hidden; // this is toggled on in the base call due to inheritance, but we don't want that. break; - case ManiaModMirror _: + case ManiaModMirror: value |= LegacyMods.Mirror; break; - case ManiaModRandom _: + case ManiaModRandom: value |= LegacyMods.Random; break; } diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs index c7c7a6003e..22347d21b8 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Mania.Mods var rng = new Random((int)Seed.Value); int availableColumns = ((ManiaBeatmap)beatmap).TotalColumns; - var shuffledColumns = Enumerable.Range(0, availableColumns).OrderBy(item => rng.Next()).ToList(); + var shuffledColumns = Enumerable.Range(0, availableColumns).OrderBy(_ => rng.Next()).ToList(); beatmap.HitObjects.OfType().ForEach(h => h.Column = shuffledColumns[h.Column]); } diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs index 3814ad84f1..26572de412 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs @@ -57,11 +57,11 @@ namespace osu.Game.Rulesets.Mania.Replays { switch (point) { - case HitPoint _: + case HitPoint: actions.Add(columnActions[point.Column]); break; - case ReleasePoint _: + case ReleasePoint: actions.Remove(columnActions[point.Column]); break; } diff --git a/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs b/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs index 2c4310202e..7c4ab2f5f4 100644 --- a/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/LegacyMainCirclePieceTest.cs @@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Osu.Tests skin.Setup(s => s.GetTexture(It.IsAny())).CallBase(); skin.Setup(s => s.GetTexture(It.IsIn(textureFilenames), It.IsAny(), It.IsAny())) - .Returns((string componentName, WrapMode _, WrapMode __) => new Texture(1, 1) { AssetName = componentName }); + .Returns((string componentName, WrapMode _, WrapMode _) => new Texture(1, 1) { AssetName = componentName }); Child = new DependencyProvidingContainer { diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSpunOut.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSpunOut.cs index fe8bba3ed8..4f6d6376bf 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSpunOut.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSpunOut.cs @@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods lastResult = null; spinner = nextSpinner; - spinner.OnNewResult += (o, result) => lastResult = result; + spinner.OnNewResult += (_, result) => lastResult = result; } return lastResult?.Type == HitResult.Great; @@ -116,7 +116,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods return false; spinner = nextSpinner; - spinner.OnNewResult += (o, result) => results.Add(result); + spinner.OnNewResult += (_, result) => results.Add(result); results.Clear(); } diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 066a114f66..60896b17bf 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Osu.Edit }); selectedHitObjects = EditorBeatmap.SelectedHitObjects.GetBoundCopy(); - selectedHitObjects.CollectionChanged += (_, __) => updateDistanceSnapGrid(); + selectedHitObjects.CollectionChanged += (_, _) => updateDistanceSnapGrid(); placementObject = EditorBeatmap.PlacementObject.GetBoundCopy(); placementObject.ValueChanged += _ => updateDistanceSnapGrid(); @@ -204,7 +204,7 @@ namespace osu.Game.Rulesets.Osu.Edit switch (BlueprintContainer.CurrentTool) { - case SelectTool _: + case SelectTool: if (!EditorBeatmap.SelectedHitObjects.Any()) return; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs b/osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs index 3d4a26b3ff..e25845f5ab 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.Mods public void ApplyToDrawableHitObject(DrawableHitObject drawable) { - drawable.ApplyCustomUpdateState += (drawableObject, state) => + drawable.ApplyCustomUpdateState += (drawableObject, _) => { if (!(drawableObject is DrawableHitCircle drawableHitCircle)) return; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs index f9422e1ff9..11ceb0f710 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs @@ -88,7 +88,7 @@ namespace osu.Game.Rulesets.Osu.Mods switch (drawableObject) { - case DrawableSliderTail _: + case DrawableSliderTail: using (drawableObject.BeginAbsoluteSequence(fadeStartTime)) drawableObject.FadeOut(fadeDuration); @@ -165,14 +165,14 @@ namespace osu.Game.Rulesets.Osu.Mods switch (hitObject) { - case Slider _: + case Slider: return (fadeOutStartTime, longFadeDuration); - case SliderTick _: + case SliderTick: double tickFadeOutDuration = Math.Min(hitObject.TimePreempt - DrawableSliderTick.ANIM_DURATION, 1000); return (hitObject.StartTime - tickFadeOutDuration, tickFadeOutDuration); - case Spinner _: + case Spinner: return (fadeOutStartTime + longFadeDuration, fadeOutDuration); default: diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModObjectScaleTween.cs b/osu.Game.Rulesets.Osu/Mods/OsuModObjectScaleTween.cs index d96724929f..44942e9e37 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModObjectScaleTween.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModObjectScaleTween.cs @@ -44,13 +44,13 @@ namespace osu.Game.Rulesets.Osu.Mods // apply grow effect switch (drawable) { - case DrawableSliderHead _: - case DrawableSliderTail _: + case DrawableSliderHead: + case DrawableSliderTail: // special cases we should *not* be scaling. break; - case DrawableSlider _: - case DrawableHitCircle _: + case DrawableSlider: + case DrawableHitCircle: { using (drawable.BeginAbsoluteSequence(h.StartTime - h.TimePreempt)) drawable.ScaleTo(StartScale.Value).Then().ScaleTo(EndScale, h.TimePreempt, Easing.OutSine); diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 51994a3e1a..5a08df3803 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -34,10 +34,10 @@ namespace osu.Game.Rulesets.Osu.Mods { switch (drawable) { - case DrawableSliderHead _: - case DrawableSliderTail _: - case DrawableSliderTick _: - case DrawableSliderRepeat _: + case DrawableSliderHead: + case DrawableSliderTail: + case DrawableSliderTick: + case DrawableSliderRepeat: return; default: diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index dcb47347ef..a5468ff613 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -156,7 +156,7 @@ namespace osu.Game.Rulesets.Osu.Objects public Slider() { - SamplesBindable.CollectionChanged += (_, __) => UpdateNestedSamples(); + SamplesBindable.CollectionChanged += (_, _) => UpdateNestedSamples(); Path.Version.ValueChanged += _ => updateNestedPositions(); } diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 8b9dc71a8b..120ce32612 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -120,19 +120,19 @@ namespace osu.Game.Rulesets.Osu { switch (mod) { - case OsuModAutopilot _: + case OsuModAutopilot: value |= LegacyMods.Autopilot; break; - case OsuModSpunOut _: + case OsuModSpunOut: value |= LegacyMods.SpunOut; break; - case OsuModTarget _: + case OsuModTarget: value |= LegacyMods.Target; break; - case OsuModTouchDevice _: + case OsuModTouchDevice: value |= LegacyMods.TouchDevice; break; } diff --git a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs index 27029afece..b0155c02cf 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs @@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.Osu.Replays hitWindows = slider.TailCircle.HitWindows; break; - case Spinner _: + case Spinner: hitWindows = defaultHitWindows; break; } diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index 7a71ef6c65..34a1bd40e9 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Scoring { switch (hitObject) { - case HitCircle _: + case HitCircle: return new OsuHitCircleJudgementResult(hitObject, judgement); default: diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyNewStyleSpinner.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyNewStyleSpinner.cs index e4ca0d2ea8..d5cc469ca9 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyNewStyleSpinner.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyNewStyleSpinner.cs @@ -126,7 +126,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy break; - case DrawableSpinnerBonusTick _: + case DrawableSpinnerBonusTick: if (state == ArmedState.Hit) glow.FlashColour(Color4.White, 200); diff --git a/osu.Game.Rulesets.Osu/UI/ObjectOrderedHitPolicy.cs b/osu.Game.Rulesets.Osu/UI/ObjectOrderedHitPolicy.cs index fba225d464..6330208d37 100644 --- a/osu.Game.Rulesets.Osu/UI/ObjectOrderedHitPolicy.cs +++ b/osu.Game.Rulesets.Osu/UI/ObjectOrderedHitPolicy.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.UI switch (obj) { - case DrawableSpinner _: + case DrawableSpinner: continue; case DrawableSlider slider: diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index ad27428010..3179b37d5a 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -96,7 +96,7 @@ namespace osu.Game.Rulesets.Osu.UI // note: `Slider`'s `ProxiedLayer` is added when its nested `DrawableHitCircle` is loaded. switch (drawable) { - case DrawableSpinner _: + case DrawableSpinner: spinnerProxies.Add(drawable.CreateProxy()); break; diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs index c413226e63..3a156d4d25 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs @@ -88,11 +88,11 @@ namespace osu.Game.Rulesets.Osu.Utils switch (hitObject) { - case HitCircle _: + case HitCircle: shift = clampHitCircleToPlayfield(current); break; - case Slider _: + case Slider: shift = clampSliderToPlayfield(current); break; } diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs index 51772df4a7..cdfab4a215 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs @@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Taiko.Tests AddStep("Setup judgements", () => { judged = false; - Player.ScoreProcessor.NewJudgement += b => judged = true; + Player.ScoreProcessor.NewJudgement += _ => judged = true; }); AddUntilStep("swell judged", () => judged); AddAssert("failed", () => Player.GameplayState.HasFailed); diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index 69eace4302..e065bb43fd 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -48,8 +48,8 @@ namespace osu.Game.Rulesets.Taiko.Mods { switch (hitObject) { - case DrawableDrumRollTick _: - case DrawableHit _: + case DrawableDrumRollTick: + case DrawableHit: double preempt = drawableRuleset.TimeRange.Value / drawableRuleset.ControlPointAt(hitObject.HitObject.StartTime).Multiplier; double start = hitObject.HitObject.StartTime - preempt * fade_out_start_time; double duration = preempt * fade_out_duration; diff --git a/osu.Game.Rulesets.Taiko/Objects/Hit.cs b/osu.Game.Rulesets.Taiko/Objects/Hit.cs index 8bc0dc6df0..20f3304c30 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Hit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Hit.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Taiko.Objects DisplayColour.Value = Type == HitType.Centre ? COLOUR_CENTRE : COLOUR_RIM; }); - SamplesBindable.BindCollectionChanged((_, __) => updateTypeFromSamples()); + SamplesBindable.BindCollectionChanged((_, _) => updateTypeFromSamples()); } private void updateTypeFromSamples() diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoStrongableHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoStrongableHitObject.cs index b7bdd98d2a..d4d59d5d44 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoStrongableHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoStrongableHitObject.cs @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Taiko.Objects protected TaikoStrongableHitObject() { IsStrongBindable.BindValueChanged(_ => updateSamplesFromType()); - SamplesBindable.BindCollectionChanged((_, __) => updateTypeFromSamples()); + SamplesBindable.BindCollectionChanged((_, _) => updateTypeFromSamples()); } private void updateTypeFromSamples() diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 4e0c8029fb..4ef7c24464 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -245,7 +245,7 @@ namespace osu.Game.Rulesets.Taiko.UI barLinePlayfield.Add(barLine); break; - case DrawableTaikoHitObject _: + case DrawableTaikoHitObject: base.Add(h); break; @@ -261,7 +261,7 @@ namespace osu.Game.Rulesets.Taiko.UI case DrawableBarLine barLine: return barLinePlayfield.Remove(barLine); - case DrawableTaikoHitObject _: + case DrawableTaikoHitObject: return base.Remove(h); default: @@ -280,12 +280,12 @@ namespace osu.Game.Rulesets.Taiko.UI switch (result.Judgement) { - case TaikoStrongJudgement _: + case TaikoStrongJudgement: if (result.IsHit) hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongNestedHit)judgedObject).ParentHitObject)?.VisualiseSecondHit(result); break; - case TaikoDrumRollTickJudgement _: + case TaikoDrumRollTickJudgement: if (!result.IsHit) break; diff --git a/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs b/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs index 7f466925a4..c31aafa67f 100644 --- a/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs +++ b/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs @@ -99,7 +99,7 @@ namespace osu.Game.Tests.Collections.IO public async Task TestImportMalformedDatabase() { bool exceptionThrown = false; - UnhandledExceptionEventHandler setException = (_, __) => exceptionThrown = true; + UnhandledExceptionEventHandler setException = (_, _) => exceptionThrown = true; using (HeadlessGameHost host = new CleanRunHeadlessGameHost()) { diff --git a/osu.Game.Tests/Database/GeneralUsageTests.cs b/osu.Game.Tests/Database/GeneralUsageTests.cs index c28a0c63af..65f805bafb 100644 --- a/osu.Game.Tests/Database/GeneralUsageTests.cs +++ b/osu.Game.Tests/Database/GeneralUsageTests.cs @@ -46,7 +46,7 @@ namespace osu.Game.Tests.Database realm.RegisterCustomSubscription(r => { - var subscription = r.All().QueryAsyncWithNotifications((sender, changes, error) => + var subscription = r.All().QueryAsyncWithNotifications((_, _, _) => { realm.Run(_ => { diff --git a/osu.Game.Tests/Database/RealmLiveTests.cs b/osu.Game.Tests/Database/RealmLiveTests.cs index 416216062e..00a667521d 100644 --- a/osu.Game.Tests/Database/RealmLiveTests.cs +++ b/osu.Game.Tests/Database/RealmLiveTests.cs @@ -189,7 +189,7 @@ namespace osu.Game.Tests.Database }); // Can't be used, even from within a valid context. - realm.Run(threadContext => + realm.Run(_ => { Assert.Throws(() => { diff --git a/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs b/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs index efab884d37..22aa78838a 100644 --- a/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs +++ b/osu.Game.Tests/NonVisual/Skinning/LegacySkinTextureFallbackTest.cs @@ -157,7 +157,7 @@ namespace osu.Game.Tests.NonVisual.Skinning { // use an incrementing width to allow assertion matching on correct textures as they turn from uploads into actual textures. int width = 1; - Textures = fileNames.ToDictionary(fileName => fileName, fileName => new TextureUpload(new Image(width, width++))); + Textures = fileNames.ToDictionary(fileName => fileName, _ => new TextureUpload(new Image(width, width++))); } public TextureUpload Get(string name) => Textures.GetValueOrDefault(name); diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableScrollingRuleset.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableScrollingRuleset.cs index f9a3695d65..a79ba0ae5d 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableScrollingRuleset.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableScrollingRuleset.cs @@ -322,8 +322,8 @@ namespace osu.Game.Tests.Visual.Gameplay { switch (h) { - case TestPooledHitObject _: - case TestPooledParentHitObject _: + case TestPooledHitObject: + case TestPooledParentHitObject: return null; case TestParentHitObject p: diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs index 0b737f5110..ce01bf2fb5 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs @@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual.Gameplay protected override void LoadComplete() { base.LoadComplete(); - HealthProcessor.FailConditions += (_, __) => true; + HealthProcessor.FailConditions += (_, _) => true; } private double lastFrequency = double.MaxValue; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs index 90a4b536bb..5e87eff717 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs @@ -49,7 +49,7 @@ namespace osu.Game.Tests.Visual.Gameplay protected override void LoadComplete() { base.LoadComplete(); - HealthProcessor.FailConditions += (_, __) => true; + HealthProcessor.FailConditions += (_, _) => true; } } } diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs index 3bebf2b68b..f319290441 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs @@ -45,7 +45,7 @@ namespace osu.Game.Tests.Visual.Gameplay [Test] public void TestToggleEditor() { - AddToggleStep("toggle editor visibility", visible => skinEditor.ToggleVisibility()); + AddToggleStep("toggle editor visibility", _ => skinEditor.ToggleVisibility()); } [Test] diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableDrawable.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableDrawable.cs index 757a261de6..16593effd6 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableDrawable.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableDrawable.cs @@ -103,7 +103,7 @@ namespace osu.Game.Tests.Visual.Gameplay Child = new SkinProvidingContainer(secondarySource) { RelativeSizeAxes = Axes.Both, - Child = consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation")) + Child = consumer = new SkinConsumer("test", _ => new NamedBox("Default Implementation")) } }; }); @@ -132,7 +132,7 @@ namespace osu.Game.Tests.Visual.Gameplay }; }); - AddStep("add permissive", () => target.Add(consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation")))); + AddStep("add permissive", () => target.Add(consumer = new SkinConsumer("test", _ => new NamedBox("Default Implementation")))); AddAssert("consumer using override source", () => consumer.Drawable is SecondarySourceBox); AddAssert("skinchanged only called once", () => consumer.SkinChangedCount == 1); } @@ -155,7 +155,7 @@ namespace osu.Game.Tests.Visual.Gameplay }; }); - AddStep("add permissive", () => target.Add(consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation")))); + AddStep("add permissive", () => target.Add(consumer = new SkinConsumer("test", _ => new NamedBox("Default Implementation")))); AddAssert("consumer using override source", () => consumer.Drawable is SecondarySourceBox); AddStep("disable", () => target.Disable()); AddAssert("consumer using base source", () => consumer.Drawable is BaseSourceBox); diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs index 68d024e63f..002e35f742 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs @@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual.Gameplay base.SetUpSteps(); AddStep("enable storyboard", () => LocalConfig.SetValue(OsuSetting.ShowStoryboard, true)); AddStep("set dim level to 0", () => LocalConfig.SetValue(OsuSetting.DimLevel, 0)); - AddStep("reset fail conditions", () => currentFailConditions = (_, __) => false); + AddStep("reset fail conditions", () => currentFailConditions = (_, _) => false); AddStep("set storyboard duration to 2s", () => currentStoryboardDuration = 2000); AddStep("set ShowResults = true", () => showResults = true); } @@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual.Gameplay { CreateTest(() => { - AddStep("fail on first judgement", () => currentFailConditions = (_, __) => true); + AddStep("fail on first judgement", () => currentFailConditions = (_, _) => true); // Fail occurs at 164ms with the provided beatmap. // Fail animation runs for 2.5s realtime but the gameplay time change is *variable* due to the frequency transform being applied, so we need a bit of lenience. diff --git a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs index 43ca47778a..631f2e707a 100644 --- a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs +++ b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs @@ -57,7 +57,7 @@ namespace osu.Game.Tests.Visual.Multiplayer // To emulate `MultiplayerClient.CurrentMatchPlayingUserIds` we need a bindable list of *only IDs*. // This tracks the list of users 1:1. - MultiplayerUsers.BindCollectionChanged((c, e) => + MultiplayerUsers.BindCollectionChanged((_, e) => { switch (e.Action) { diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableLoungeRoom.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableLoungeRoom.cs index 5b4e0a88aa..be1f21a7b2 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableLoungeRoom.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableLoungeRoom.cs @@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.Multiplayer var mockLounge = new Mock(); mockLounge .Setup(l => l.Join(It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>())) - .Callback, Action>((a, b, c, d) => + .Callback, Action>((_, _, _, d) => { Task.Run(() => { diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs index 0cdc144b6a..a800b21bc9 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchStartControl.cs @@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual.Multiplayer setRoomCountdown(countdownStart.Duration); break; - case StopCountdownRequest _: + case StopCountdownRequest: multiplayerRoom.Countdown = null; raiseRoomUpdated(); break; diff --git a/osu.Game.Tests/Visual/Online/TestSceneNewsSidebar.cs b/osu.Game.Tests/Visual/Online/TestSceneNewsSidebar.cs index f28eaf5ad0..266e98db15 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneNewsSidebar.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneNewsSidebar.cs @@ -219,7 +219,7 @@ namespace osu.Game.Tests.Visual.Online { base.LoadComplete(); - Metadata.BindValueChanged(metadata => + Metadata.BindValueChanged(_ => { foreach (var b in this.ChildrenOfType()) b.Action = () => YearChanged?.Invoke(b.Year); diff --git a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs index a46e675370..8a04cd96fe 100644 --- a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs +++ b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs @@ -187,8 +187,8 @@ namespace osu.Game.Tests.Visual.Playlists // pre-check for requests we should be handling (as they are scheduled below). switch (request) { - case ShowPlaylistUserScoreRequest _: - case IndexPlaylistScoresRequest _: + case ShowPlaylistUserScoreRequest: + case IndexPlaylistScoresRequest: break; default: diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs index abf65602f9..9791bb6248 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs @@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual.Settings public void ToggleVisibility() { AddWaitStep("wait some", 5); - AddToggleStep("toggle visibility", visible => settings.ToggleVisibility()); + AddToggleStep("toggle visibility", _ => settings.ToggleVisibility()); } [Test] diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs index 6490fd822e..f9d18f4236 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs @@ -91,19 +91,19 @@ namespace osu.Game.Tests.Visual.SongSelect switch (instance) { - case OsuRuleset _: + case OsuRuleset: testInfoLabels(5); break; - case TaikoRuleset _: + case TaikoRuleset: testInfoLabels(5); break; - case CatchRuleset _: + case CatchRuleset: testInfoLabels(5); break; - case ManiaRuleset _: + case ManiaRuleset: testInfoLabels(4); break; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs index 6cf66963a5..368babc9b5 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs @@ -70,7 +70,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("Set time before zero", () => { - beatContainer.NewBeat = (i, timingControlPoint, effectControlPoint, channelAmplitudes) => + beatContainer.NewBeat = (i, timingControlPoint, _, _) => { lastActuationTime = gameplayClockContainer.CurrentTime; lastTimingPoint = timingControlPoint; @@ -105,7 +105,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("Set time before zero", () => { - beatContainer.NewBeat = (i, timingControlPoint, effectControlPoint, channelAmplitudes) => + beatContainer.NewBeat = (i, timingControlPoint, _, _) => { lastBeatIndex = i; lastBpm = timingControlPoint.BPM; @@ -126,7 +126,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("bind event", () => { - beatContainer.NewBeat = (i, timingControlPoint, effectControlPoint, channelAmplitudes) => lastBpm = timingControlPoint.BPM; + beatContainer.NewBeat = (_, timingControlPoint, _, _) => lastBpm = timingControlPoint.BPM; }); AddUntilStep("wait for trigger", () => lastBpm != null); @@ -157,7 +157,7 @@ namespace osu.Game.Tests.Visual.UserInterface actualEffectPoint = null; beatContainer.AllowMistimedEventFiring = false; - beatContainer.NewBeat = (i, timingControlPoint, effectControlPoint, channelAmplitudes) => + beatContainer.NewBeat = (_, _, effectControlPoint, _) => { if (Precision.AlmostEquals(gameplayClockContainer.CurrentTime + earlyActivationMilliseconds, expectedEffectPoint.Time, BeatSyncedContainer.MISTIMED_ALLOWANCE)) actualEffectPoint = effectControlPoint; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingSearchControl.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingSearchControl.cs index 1107fad834..44f2da2b95 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingSearchControl.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapListingSearchControl.cs @@ -77,13 +77,13 @@ namespace osu.Game.Tests.Visual.UserInterface }; control.Query.BindValueChanged(q => query.Text = $"Query: {q.NewValue}", true); - control.General.BindCollectionChanged((u, v) => general.Text = $"General: {(control.General.Any() ? string.Join('.', control.General.Select(i => i.ToString().Underscore())) : "")}", true); + control.General.BindCollectionChanged((_, _) => general.Text = $"General: {(control.General.Any() ? string.Join('.', control.General.Select(i => i.ToString().Underscore())) : "")}", true); control.Ruleset.BindValueChanged(r => ruleset.Text = $"Ruleset: {r.NewValue}", true); control.Category.BindValueChanged(c => category.Text = $"Category: {c.NewValue}", true); control.Genre.BindValueChanged(g => genre.Text = $"Genre: {g.NewValue}", true); control.Language.BindValueChanged(l => language.Text = $"Language: {l.NewValue}", true); - control.Extra.BindCollectionChanged((u, v) => extra.Text = $"Extra: {(control.Extra.Any() ? string.Join('.', control.Extra.Select(i => i.ToString().ToLowerInvariant())) : "")}", true); - control.Ranks.BindCollectionChanged((u, v) => ranks.Text = $"Ranks: {(control.Ranks.Any() ? string.Join('.', control.Ranks.Select(i => i.ToString())) : "")}", true); + control.Extra.BindCollectionChanged((_, _) => extra.Text = $"Extra: {(control.Extra.Any() ? string.Join('.', control.Extra.Select(i => i.ToString().ToLowerInvariant())) : "")}", true); + control.Ranks.BindCollectionChanged((_, _) => ranks.Text = $"Ranks: {(control.Ranks.Any() ? string.Join('.', control.Ranks.Select(i => i.ToString())) : "")}", true); control.Played.BindValueChanged(p => played.Text = $"Played: {p.NewValue}", true); control.ExplicitContent.BindValueChanged(e => explicitMap.Text = $"Explicit Maps: {e.NewValue}", true); }); diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs index a3ae55670a..b845b85e1f 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunSetupOverlay.cs @@ -54,7 +54,7 @@ namespace osu.Game.Tests.Visual.UserInterface notificationOverlay.Reset(); performer.Setup(g => g.PerformFromScreen(It.IsAny>(), It.IsAny>())) - .Callback((Action action, IEnumerable types) => action(null)); + .Callback((Action action, IEnumerable _) => action(null)); notificationOverlay.Setup(n => n.Post(It.IsAny())) .Callback((Notification n) => lastNotification = n); diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs index 31061dc109..006707d064 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs @@ -387,7 +387,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddUntilStep("double time not visible", () => modSelectOverlay.ChildrenOfType().Where(panel => panel.Mod is OsuModDoubleTime).All(panel => panel.Filtered.Value)); AddAssert("nightcore still visible", () => modSelectOverlay.ChildrenOfType().Where(panel => panel.Mod is OsuModNightcore).Any(panel => !panel.Filtered.Value)); - AddStep("make double time valid again", () => modSelectOverlay.IsValidMod = m => true); + AddStep("make double time valid again", () => modSelectOverlay.IsValidMod = _ => true); AddUntilStep("double time visible", () => modSelectOverlay.ChildrenOfType().Where(panel => panel.Mod is OsuModDoubleTime).Any(panel => !panel.Filtered.Value)); AddAssert("nightcore still visible", () => modSelectOverlay.ChildrenOfType().Where(b => b.Mod is OsuModNightcore).Any(panel => !panel.Filtered.Value)); } diff --git a/osu.Game.Tournament/Components/DateTextBox.cs b/osu.Game.Tournament/Components/DateTextBox.cs index 8eccb9e0e0..76d12a6b03 100644 --- a/osu.Game.Tournament/Components/DateTextBox.cs +++ b/osu.Game.Tournament/Components/DateTextBox.cs @@ -30,7 +30,7 @@ namespace osu.Game.Tournament.Components { base.Current = new Bindable(string.Empty); - ((OsuTextBox)Control).OnCommit += (sender, newText) => + ((OsuTextBox)Control).OnCommit += (sender, _) => { try { diff --git a/osu.Game.Tournament/Components/DrawableTeamFlag.cs b/osu.Game.Tournament/Components/DrawableTeamFlag.cs index 6e9c1120e4..348fd8cd76 100644 --- a/osu.Game.Tournament/Components/DrawableTeamFlag.cs +++ b/osu.Game.Tournament/Components/DrawableTeamFlag.cs @@ -45,7 +45,7 @@ namespace osu.Game.Tournament.Components FillMode = FillMode.Fill }; - (flag = team.FlagName.GetBoundCopy()).BindValueChanged(acronym => flagSprite.Texture = textures.Get($@"Flags/{team.FlagName}"), true); + (flag = team.FlagName.GetBoundCopy()).BindValueChanged(_ => flagSprite.Texture = textures.Get($@"Flags/{team.FlagName}"), true); } } } diff --git a/osu.Game.Tournament/Components/DrawableTeamTitle.cs b/osu.Game.Tournament/Components/DrawableTeamTitle.cs index b7e936026c..e64e08a921 100644 --- a/osu.Game.Tournament/Components/DrawableTeamTitle.cs +++ b/osu.Game.Tournament/Components/DrawableTeamTitle.cs @@ -27,7 +27,7 @@ namespace osu.Game.Tournament.Components { if (team == null) return; - (acronym = team.Acronym.GetBoundCopy()).BindValueChanged(acronym => Text.Text = team?.FullName.Value ?? string.Empty, true); + (acronym = team.Acronym.GetBoundCopy()).BindValueChanged(_ => Text.Text = team?.FullName.Value ?? string.Empty, true); } } } diff --git a/osu.Game.Tournament/Components/DrawableTournamentTeam.cs b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs index 84cae92a39..eb1dde21e7 100644 --- a/osu.Game.Tournament/Components/DrawableTournamentTeam.cs +++ b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs @@ -38,7 +38,7 @@ namespace osu.Game.Tournament.Components { if (Team == null) return; - (acronym = Team.Acronym.GetBoundCopy()).BindValueChanged(acronym => AcronymText.Text = Team?.Acronym.Value?.ToUpperInvariant() ?? string.Empty, true); + (acronym = Team.Acronym.GetBoundCopy()).BindValueChanged(_ => AcronymText.Text = Team?.Acronym.Value?.ToUpperInvariant() ?? string.Empty, true); } } } diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index 58ba3c1e8b..32da4d1b36 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -219,7 +219,7 @@ namespace osu.Game.Tournament.Screens.Drawings } } - writeOp = writeOp?.ContinueWith(t => { writeAction(); }) ?? Task.Run(writeAction); + writeOp = writeOp?.ContinueWith(_ => { writeAction(); }) ?? Task.Run(writeAction); } private void reloadTeams() diff --git a/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs index 6052bcdeb7..4261828df2 100644 --- a/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs @@ -44,7 +44,7 @@ namespace osu.Game.Tournament.Screens.Editors AddInternal(rightClickMessage = new WarningBox("Right click to place and link matches")); - LadderInfo.Matches.CollectionChanged += (_, __) => updateMessage(); + LadderInfo.Matches.CollectionChanged += (_, _) => updateMessage(); updateMessage(); } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs index 544725996a..466b9ed482 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs @@ -49,10 +49,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components }; name = round.Name.GetBoundCopy(); - name.BindValueChanged(n => textName.Text = ((losers ? "Losers " : "") + round.Name).ToUpperInvariant(), true); + name.BindValueChanged(_ => textName.Text = ((losers ? "Losers " : "") + round.Name).ToUpperInvariant(), true); description = round.Description.GetBoundCopy(); - description.BindValueChanged(n => textDescription.Text = round.Description.Value?.ToUpperInvariant(), true); + description.BindValueChanged(_ => textDescription.Text = round.Description.Value?.ToUpperInvariant(), true); } } } diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index f274503894..23bfa84afc 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -75,7 +75,7 @@ namespace osu.Game.Tournament.Screens.Ladder foreach (var match in LadderInfo.Matches) addMatch(match); - LadderInfo.Rounds.CollectionChanged += (_, __) => layout.Invalidate(); + LadderInfo.Rounds.CollectionChanged += (_, _) => layout.Invalidate(); LadderInfo.Matches.CollectionChanged += (_, args) => { switch (args.Action) diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index c2c6c271cb..537fbfc038 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -137,7 +137,7 @@ namespace osu.Game.Tournament heightWarning.Alpha = size.NewValue.Width < minWidth ? 1 : 0; }), true); - windowMode.BindValueChanged(mode => ScheduleAfterChildren(() => + windowMode.BindValueChanged(_ => ScheduleAfterChildren(() => { windowMode.Value = WindowMode.Windowed; }), true); diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 95d2adc4fa..ccbe77fa95 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -267,7 +267,7 @@ namespace osu.Game.Tournament } else { - req.Success += res => { populate(); }; + req.Success += _ => { populate(); }; req.Failure += _ => { user.OnlineID = 1; diff --git a/osu.Game.Tournament/TournamentSceneManager.cs b/osu.Game.Tournament/TournamentSceneManager.cs index afbfc2d368..296b259d72 100644 --- a/osu.Game.Tournament/TournamentSceneManager.cs +++ b/osu.Game.Tournament/TournamentSceneManager.cs @@ -204,12 +204,12 @@ namespace osu.Game.Tournament switch (currentScreen) { - case MapPoolScreen _: + case MapPoolScreen: chatContainer.FadeIn(TournamentScreen.FADE_DELAY); chatContainer.ResizeWidthTo(1, 500, Easing.OutQuint); break; - case GameplayScreen _: + case GameplayScreen: chatContainer.FadeIn(TournamentScreen.FADE_DELAY); chatContainer.ResizeWidthTo(0.5f, 500, Easing.OutQuint); break; diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index eda7ef0bcc..4be6b5eede 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -254,12 +254,12 @@ namespace osu.Game.Beatmaps.ControlPoints switch (newPoint) { - case TimingControlPoint _: + case TimingControlPoint: // Timing points are a special case and need to be added regardless of fallback availability. existing = BinarySearch(TimingPoints, time); break; - case EffectControlPoint _: + case EffectControlPoint: existing = EffectPointAt(time); break; } diff --git a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs index 9b97df906b..80af4108c7 100644 --- a/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs +++ b/osu.Game/Beatmaps/Drawables/BundledBeatmapDownloader.cs @@ -102,7 +102,7 @@ namespace osu.Game.Beatmaps.Drawables // Matches osu-stable, in order to provide new users with roughly the same randomised selection of bundled beatmaps. var random = new LegacyRandom(DateTime.UtcNow.Year * 1000 + (DateTime.UtcNow.DayOfYear / 7)); - downloadableFilenames.AddRange(sourceFilenames.OrderBy(x => random.NextDouble()).Take(limit ?? int.MaxValue)); + downloadableFilenames.AddRange(sourceFilenames.OrderBy(_ => random.NextDouble()).Take(limit ?? int.MaxValue)); } catch { } } diff --git a/osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs index 2f11c18993..4f292a9a1f 100644 --- a/osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs @@ -12,7 +12,7 @@ namespace osu.Game.Beatmaps.Formats { public static void Register() { - AddDecoder("{", m => new JsonBeatmapDecoder()); + AddDecoder("{", _ => new JsonBeatmapDecoder()); } protected override void ParseStreamInto(LineBufferedReader stream, Beatmap output) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs index 984e88d3a9..03c63ff4f2 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs @@ -373,11 +373,11 @@ namespace osu.Game.Beatmaps.Formats switch (hitObject) { - case IHasPath _: + case IHasPath: type |= LegacyHitObjectType.Slider; break; - case IHasDuration _: + case IHasDuration: if (onlineRulesetID == 3) type |= LegacyHitObjectType.Hold; else diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs index 3021688aaf..b8f60f0bc6 100644 --- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs @@ -35,7 +35,7 @@ namespace osu.Game.Beatmaps.Formats { // note that this isn't completely correct AddDecoder(@"osu file format v", m => new LegacyStoryboardDecoder(Parsing.ParseInt(m.Split('v').Last()))); - AddDecoder(@"[Events]", m => new LegacyStoryboardDecoder()); + AddDecoder(@"[Events]", _ => new LegacyStoryboardDecoder()); SetFallbackDecoder(() => new LegacyStoryboardDecoder()); } diff --git a/osu.Game/Beatmaps/Legacy/LegacyControlPointInfo.cs b/osu.Game/Beatmaps/Legacy/LegacyControlPointInfo.cs index 19432f0c58..5c3c72c9e4 100644 --- a/osu.Game/Beatmaps/Legacy/LegacyControlPointInfo.cs +++ b/osu.Game/Beatmaps/Legacy/LegacyControlPointInfo.cs @@ -56,12 +56,12 @@ namespace osu.Game.Beatmaps.Legacy { switch (newPoint) { - case SampleControlPoint _: + case SampleControlPoint: // intentionally don't use SamplePointAt (we always need to consider the first sample point). var existing = BinarySearch(SamplePoints, time); return newPoint.IsRedundant(existing); - case DifficultyControlPoint _: + case DifficultyControlPoint: return newPoint.IsRedundant(DifficultyPointAt(time)); default: diff --git a/osu.Game/Collections/BeatmapCollection.cs b/osu.Game/Collections/BeatmapCollection.cs index 23b2ef60dd..742d757bec 100644 --- a/osu.Game/Collections/BeatmapCollection.cs +++ b/osu.Game/Collections/BeatmapCollection.cs @@ -36,7 +36,7 @@ namespace osu.Game.Collections public BeatmapCollection() { - BeatmapHashes.CollectionChanged += (_, __) => onChange(); + BeatmapHashes.CollectionChanged += (_, _) => onChange(); Name.ValueChanged += _ => onChange(); } diff --git a/osu.Game/Collections/CollectionFilterDropdown.cs b/osu.Game/Collections/CollectionFilterDropdown.cs index 46d90b930c..d099eb6e1b 100644 --- a/osu.Game/Collections/CollectionFilterDropdown.cs +++ b/osu.Game/Collections/CollectionFilterDropdown.cs @@ -67,7 +67,7 @@ namespace osu.Game.Collections // An extra bindable is enough to subvert this behaviour. base.Current = Current; - collections.BindCollectionChanged((_, __) => collectionsChanged(), true); + collections.BindCollectionChanged((_, _) => collectionsChanged(), true); Current.BindValueChanged(filterChanged, true); } @@ -233,7 +233,7 @@ namespace osu.Game.Collections if (collectionBeatmaps != null) { - collectionBeatmaps.CollectionChanged += (_, __) => collectionChanged(); + collectionBeatmaps.CollectionChanged += (_, _) => collectionChanged(); beatmap.BindValueChanged(_ => collectionChanged(), true); } diff --git a/osu.Game/Collections/CollectionManager.cs b/osu.Game/Collections/CollectionManager.cs index c6e52a1b75..796b3c426c 100644 --- a/osu.Game/Collections/CollectionManager.cs +++ b/osu.Game/Collections/CollectionManager.cs @@ -261,7 +261,7 @@ namespace osu.Game.Collections private void backgroundSave() { int current = Interlocked.Increment(ref lastSave); - Task.Delay(100).ContinueWith(task => + Task.Delay(100).ContinueWith(_ => { if (current != lastSave) return; diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 68f9dcb541..3ea7a14826 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -454,7 +454,7 @@ namespace osu.Game.Database public IDisposable SubscribeToPropertyChanged(Func modelAccessor, Expression> propertyLookup, Action onChanged) where TModel : RealmObjectBase { - return RegisterCustomSubscription(r => + return RegisterCustomSubscription(_ => { string propertyName = getMemberName(propertyLookup); diff --git a/osu.Game/Database/RealmObjectExtensions.cs b/osu.Game/Database/RealmObjectExtensions.cs index 25416c7fa2..a771aa04df 100644 --- a/osu.Game/Database/RealmObjectExtensions.cs +++ b/osu.Game/Database/RealmObjectExtensions.cs @@ -20,7 +20,7 @@ namespace osu.Game.Database { private static readonly IMapper write_mapper = new MapperConfiguration(c => { - c.ShouldMapField = fi => false; + c.ShouldMapField = _ => false; c.ShouldMapProperty = pi => pi.SetMethod?.IsPublic == true; c.CreateMap() @@ -70,7 +70,7 @@ namespace osu.Game.Database } }); - c.Internal().ForAllMaps((typeMap, expression) => + c.Internal().ForAllMaps((_, expression) => { expression.ForAllMembers(m => { @@ -87,7 +87,7 @@ namespace osu.Game.Database c.CreateMap() .ConstructUsing(_ => new BeatmapSetInfo(null)) .MaxDepth(2) - .AfterMap((s, d) => + .AfterMap((_, d) => { foreach (var beatmap in d.Beatmaps) beatmap.BeatmapSet = d; @@ -97,7 +97,7 @@ namespace osu.Game.Database // Only hasn't been done yet as we detach at the point of BeatmapInfo less often. c.CreateMap() .MaxDepth(2) - .AfterMap((s, d) => + .AfterMap((_, d) => { for (int i = 0; i < d.BeatmapSet?.Beatmaps.Count; i++) { @@ -121,7 +121,7 @@ namespace osu.Game.Database .ConstructUsing(_ => new BeatmapSetInfo(null)) .MaxDepth(2) .ForMember(b => b.Files, cc => cc.Ignore()) - .AfterMap((s, d) => + .AfterMap((_, d) => { foreach (var beatmap in d.Beatmaps) beatmap.BeatmapSet = d; @@ -135,14 +135,14 @@ namespace osu.Game.Database private static void applyCommonConfiguration(IMapperConfigurationExpression c) { - c.ShouldMapField = fi => false; + c.ShouldMapField = _ => false; // This is specifically to avoid mapping explicit interface implementations. // If we want to limit this further, we can avoid mapping properties with no setter that are not IList<>. // Takes a bit of effort to determine whether this is the case though, see https://stackoverflow.com/questions/951536/how-do-i-tell-whether-a-type-implements-ilist c.ShouldMapProperty = pi => pi.GetMethod?.IsPublic == true; - c.Internal().ForAllMaps((typeMap, expression) => + c.Internal().ForAllMaps((_, expression) => { expression.ForAllMembers(m => { diff --git a/osu.Game/Extensions/TaskExtensions.cs b/osu.Game/Extensions/TaskExtensions.cs index 5165ae59b5..b4a0c02e35 100644 --- a/osu.Game/Extensions/TaskExtensions.cs +++ b/osu.Game/Extensions/TaskExtensions.cs @@ -31,7 +31,7 @@ namespace osu.Game.Extensions { var tcs = new TaskCompletionSource(); - task.ContinueWith(t => + task.ContinueWith(_ => { // the previous task has finished execution or been cancelled, so we can run the provided continuation. diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownContainer.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownContainer.cs index aa156efee9..a2370a76cb 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownContainer.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownContainer.cs @@ -27,7 +27,7 @@ namespace osu.Game.Graphics.Containers.Markdown { switch (markdownObject) { - case YamlFrontMatterBlock _: + case YamlFrontMatterBlock: // Don't parse YAML Frontmatter break; diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 00ed6c1c92..f55875ac58 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -74,7 +74,7 @@ namespace osu.Game.Graphics.UserInterface } //I'm using ToList() here because Where() returns an Enumerable which can change it's elements afterwards - RemoveRange(Children.Where((bar, index) => index >= value.Count()).ToList()); + RemoveRange(Children.Where((_, index) => index >= value.Count()).ToList()); } } } diff --git a/osu.Game/Graphics/UserInterface/LoadingLayer.cs b/osu.Game/Graphics/UserInterface/LoadingLayer.cs index 407823fc2a..b3655eaab4 100644 --- a/osu.Game/Graphics/UserInterface/LoadingLayer.cs +++ b/osu.Game/Graphics/UserInterface/LoadingLayer.cs @@ -55,12 +55,12 @@ namespace osu.Game.Graphics.UserInterface switch (e) { // blocking scroll can cause weird behaviour when this layer is used within a ScrollContainer. - case ScrollEvent _: + case ScrollEvent: return false; // blocking touch events causes the ISourcedFromTouch versions to not be fired, potentially impeding behaviour of drawables *above* the loading layer that may utilise these. // note that this will not work well if touch handling elements are beneath this loading layer (something to consider for the future). - case TouchEvent _: + case TouchEvent: return false; } diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index a8051a94d9..d9274bf2cb 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -68,7 +68,7 @@ namespace osu.Game.Graphics.UserInterface AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(star_spacing), - ChildrenEnumerable = Enumerable.Range(0, StarCount).Select(i => CreateStar()) + ChildrenEnumerable = Enumerable.Range(0, StarCount).Select(_ => CreateStar()) } }; } diff --git a/osu.Game/Input/Bindings/DatabasedKeyBindingContainer.cs b/osu.Game/Input/Bindings/DatabasedKeyBindingContainer.cs index 974abc4036..14a041b459 100644 --- a/osu.Game/Input/Bindings/DatabasedKeyBindingContainer.cs +++ b/osu.Game/Input/Bindings/DatabasedKeyBindingContainer.cs @@ -51,7 +51,7 @@ namespace osu.Game.Input.Bindings protected override void LoadComplete() { - realmSubscription = realm.RegisterForNotifications(queryRealmKeyBindings, (sender, changes, error) => + realmSubscription = realm.RegisterForNotifications(queryRealmKeyBindings, (sender, _, _) => { // The first fire of this is a bit redundant as this is being called in base.LoadComplete, // but this is safest in case the subscription is restored after a context recycle. diff --git a/osu.Game/Input/IdleTracker.cs b/osu.Game/Input/IdleTracker.cs index 279cfb5a4e..45036b3e41 100644 --- a/osu.Game/Input/IdleTracker.cs +++ b/osu.Game/Input/IdleTracker.cs @@ -80,11 +80,11 @@ namespace osu.Game.Input switch (e) { - case KeyDownEvent _: - case KeyUpEvent _: - case MouseDownEvent _: - case MouseUpEvent _: - case MouseMoveEvent _: + case KeyDownEvent: + case KeyUpEvent: + case MouseDownEvent: + case MouseUpEvent: + case MouseMoveEvent: return updateLastInteractionTime(); default: diff --git a/osu.Game/Online/BeatmapDownloadTracker.cs b/osu.Game/Online/BeatmapDownloadTracker.cs index 1e3add6201..19708cc07d 100644 --- a/osu.Game/Online/BeatmapDownloadTracker.cs +++ b/osu.Game/Online/BeatmapDownloadTracker.cs @@ -40,7 +40,7 @@ namespace osu.Game.Online // Used to interact with manager classes that don't support interface types. Will eventually be replaced. var beatmapSetInfo = new BeatmapSetInfo { OnlineID = TrackedItem.OnlineID }; - realmSubscription = realm.RegisterForNotifications(r => r.All().Where(s => s.OnlineID == TrackedItem.OnlineID && !s.DeletePending), (items, changes, ___) => + realmSubscription = realm.RegisterForNotifications(r => r.All().Where(s => s.OnlineID == TrackedItem.OnlineID && !s.DeletePending), (items, _, _) => { if (items.Any()) Schedule(() => UpdateState(DownloadState.LocallyAvailable)); diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 4c762d002d..48dfaadfa5 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -465,7 +465,7 @@ namespace osu.Game.Online.Chat default: var req = new JoinChannelRequest(channel); req.Success += () => joinChannel(channel, fetchInitialMessages); - req.Failure += ex => LeaveChannel(channel); + req.Failure += _ => LeaveChannel(channel); api.Queue(req); return channel; } diff --git a/osu.Game/Online/HubClientConnector.cs b/osu.Game/Online/HubClientConnector.cs index f9000c01ef..61e9eaa8c0 100644 --- a/osu.Game/Online/HubClientConnector.cs +++ b/osu.Game/Online/HubClientConnector.cs @@ -64,7 +64,7 @@ namespace osu.Game.Online this.preferMessagePack = preferMessagePack; apiState.BindTo(api.State); - apiState.BindValueChanged(state => connectIfPossible(), true); + apiState.BindValueChanged(_ => connectIfPossible(), true); } public void Reconnect() diff --git a/osu.Game/Online/Rooms/OnlinePlayBeatmapAvailabilityTracker.cs b/osu.Game/Online/Rooms/OnlinePlayBeatmapAvailabilityTracker.cs index 032215f5d3..2fd8445980 100644 --- a/osu.Game/Online/Rooms/OnlinePlayBeatmapAvailabilityTracker.cs +++ b/osu.Game/Online/Rooms/OnlinePlayBeatmapAvailabilityTracker.cs @@ -101,7 +101,7 @@ namespace osu.Game.Online.Rooms // handles changes to hash that didn't occur from the import process (ie. a user editing the beatmap in the editor, somehow). realmSubscription?.Dispose(); - realmSubscription = realm.RegisterForNotifications(r => filteredBeatmaps(), (items, changes, ___) => + realmSubscription = realm.RegisterForNotifications(_ => filteredBeatmaps(), (_, changes, _) => { if (changes == null) return; diff --git a/osu.Game/Online/ScoreDownloadTracker.cs b/osu.Game/Online/ScoreDownloadTracker.cs index cab6bd0722..680bb16264 100644 --- a/osu.Game/Online/ScoreDownloadTracker.cs +++ b/osu.Game/Online/ScoreDownloadTracker.cs @@ -48,7 +48,7 @@ namespace osu.Game.Online realmSubscription = realm.RegisterForNotifications(r => r.All().Where(s => ((s.OnlineID > 0 && s.OnlineID == TrackedItem.OnlineID) || (!string.IsNullOrEmpty(s.Hash) && s.Hash == TrackedItem.Hash)) - && !s.DeletePending), (items, changes, ___) => + && !s.DeletePending), (items, _, _) => { if (items.Any()) Schedule(() => UpdateState(DownloadState.LocallyAvailable)); diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 1d9e2042ec..b0ba62a6ac 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -481,7 +481,7 @@ namespace osu.Game { switch (handler) { - case MidiHandler _: + case MidiHandler: return new InputSection.HandlerSection(handler); // return null for handlers that shouldn't have settings. diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapListingFilterControl.cs b/osu.Game/Overlays/BeatmapListing/BeatmapListingFilterControl.cs index 4457705676..767b8646e3 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapListingFilterControl.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapListingFilterControl.cs @@ -161,13 +161,13 @@ namespace osu.Game.Overlays.BeatmapListing queueUpdateSearch(true); }); - searchControl.General.CollectionChanged += (_, __) => queueUpdateSearch(); + searchControl.General.CollectionChanged += (_, _) => queueUpdateSearch(); searchControl.Ruleset.BindValueChanged(_ => queueUpdateSearch()); searchControl.Category.BindValueChanged(_ => queueUpdateSearch()); searchControl.Genre.BindValueChanged(_ => queueUpdateSearch()); searchControl.Language.BindValueChanged(_ => queueUpdateSearch()); - searchControl.Extra.CollectionChanged += (_, __) => queueUpdateSearch(); - searchControl.Ranks.CollectionChanged += (_, __) => queueUpdateSearch(); + searchControl.Extra.CollectionChanged += (_, _) => queueUpdateSearch(); + searchControl.Ranks.CollectionChanged += (_, _) => queueUpdateSearch(); searchControl.Played.BindValueChanged(_ => queueUpdateSearch()); searchControl.ExplicitContent.BindValueChanged(_ => queueUpdateSearch()); diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs index 1a57a89957..b27d9b3f1e 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs @@ -156,7 +156,7 @@ namespace osu.Game.Overlays.BeatmapSet { base.LoadComplete(); - ruleset.ValueChanged += r => updateDisplay(); + ruleset.ValueChanged += _ => updateDisplay(); // done here so everything can bind in intialization and get the first trigger Beatmap.TriggerChange(); diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index 2ea94bb412..c2e54d0d7b 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -217,7 +217,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores scope.BindValueChanged(_ => getScores()); ruleset.BindValueChanged(_ => getScores()); - modSelector.SelectedMods.CollectionChanged += (_, __) => getScores(); + modSelector.SelectedMods.CollectionChanged += (_, _) => getScores(); Beatmap.BindValueChanged(onBeatmapChanged); user.BindValueChanged(onUserChanged, true); diff --git a/osu.Game/Overlays/Comments/CommentEditor.cs b/osu.Game/Overlays/Comments/CommentEditor.cs index 2e8080ba43..e2a7e78356 100644 --- a/osu.Game/Overlays/Comments/CommentEditor.cs +++ b/osu.Game/Overlays/Comments/CommentEditor.cs @@ -117,7 +117,7 @@ namespace osu.Game.Overlays.Comments } }); - textBox.OnCommit += (u, v) => + textBox.OnCommit += (_, _) => { if (commitButton.IsBlocked.Value) return; diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs index 4ab6f4f88d..4a836e0e62 100644 --- a/osu.Game/Overlays/Comments/CommentsContainer.cs +++ b/osu.Game/Overlays/Comments/CommentsContainer.cs @@ -251,8 +251,8 @@ namespace osu.Game.Overlays.Comments if (bundle.HasMore) { int loadedTopLevelComments = 0; - pinnedContent.Children.OfType().ForEach(p => loadedTopLevelComments++); - content.Children.OfType().ForEach(p => loadedTopLevelComments++); + pinnedContent.Children.OfType().ForEach(_ => loadedTopLevelComments++); + content.Children.OfType().ForEach(_ => loadedTopLevelComments++); moreButton.Current.Value = bundle.TopLevelCount - loadedTopLevelComments; moreButton.IsLoading = false; diff --git a/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs b/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs index bfeaf50b53..bfd356193d 100644 --- a/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs +++ b/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs @@ -145,7 +145,7 @@ namespace osu.Game.Overlays.Dashboard.Friends controlBackground.Colour = colourProvider.Background5; apiFriends.BindTo(api.Friends); - apiFriends.BindCollectionChanged((_, __) => Schedule(() => Users = apiFriends.ToList()), true); + apiFriends.BindCollectionChanged((_, _) => Schedule(() => Users = apiFriends.ToList()), true); } protected override void LoadComplete() diff --git a/osu.Game/Overlays/Login/LoginForm.cs b/osu.Game/Overlays/Login/LoginForm.cs index 08522b2921..f545e2892f 100644 --- a/osu.Game/Overlays/Login/LoginForm.cs +++ b/osu.Game/Overlays/Login/LoginForm.cs @@ -109,7 +109,7 @@ namespace osu.Game.Overlays.Login } }; - password.OnCommit += (sender, newText) => performLogin(); + password.OnCommit += (_, _) => performLogin(); if (api?.LastLoginError?.Message is string error) errorText.AddErrors(new[] { error }); diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index 53e8452dd1..1c007c913e 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -112,7 +112,7 @@ namespace osu.Game.Overlays.MedalSplash s.Font = s.Font.With(size: 16); }); - medalContainer.OnLoadComplete += d => + medalContainer.OnLoadComplete += _ => { unlocked.Position = new Vector2(0f, medalContainer.DrawSize.Y / 2 + 10); infoFlow.Position = new Vector2(0f, unlocked.Position.Y + 90); diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 811db393d6..69cb3a49fc 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -40,7 +40,7 @@ namespace osu.Game.Overlays.Mods /// public Bindable>> AvailableMods { get; } = new Bindable>>(new Dictionary>()); - private Func isValidMod = m => true; + private Func isValidMod = _ => true; /// /// A function determining whether each mod in the column should be displayed. @@ -689,11 +689,11 @@ namespace osu.Game.Overlays.Mods switch (e) { - case ClickEvent _: + case ClickEvent: OnClicked?.Invoke(); return true; - case MouseEvent _: + case MouseEvent: return true; } diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 3c25fc0421..e33fc8064f 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -85,7 +85,7 @@ namespace osu.Game.Overlays.Music }, }; - filter.Search.OnCommit += (sender, newText) => + filter.Search.OnCommit += (_, _) => { list.FirstVisibleSet?.PerformRead(set => { diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index d76df5b1ed..719e77db83 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -129,7 +129,7 @@ namespace osu.Game.Overlays.Notifications case ProgressNotificationState.Completed: loadingSpinner.Hide(); NotificationContent.MoveToY(-DrawSize.Y / 2, 200, Easing.OutQuint); - this.FadeOut(200).Finally(d => Completed()); + this.FadeOut(200).Finally(_ => Completed()); break; } } diff --git a/osu.Game/Overlays/OSD/TrackedSettingToast.cs b/osu.Game/Overlays/OSD/TrackedSettingToast.cs index c66811a3e9..3bed5e7e4c 100644 --- a/osu.Game/Overlays/OSD/TrackedSettingToast.cs +++ b/osu.Game/Overlays/OSD/TrackedSettingToast.cs @@ -68,7 +68,7 @@ namespace osu.Game.Overlays.OSD if (val) selectedOption = 0; break; - case Enum _: + case Enum: var values = Enum.GetValues(description.RawValue.GetType()); optionCount = values.Length; selectedOption = Convert.ToInt32(description.RawValue); diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 2c8e809379..28642f12a1 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -160,13 +160,13 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics scalingSettings.ForEach(s => bindPreviewEvent(s.Current)); - windowModeDropdown.Current.BindValueChanged(mode => + windowModeDropdown.Current.BindValueChanged(_ => { updateDisplayModeDropdowns(); updateScreenModeWarning(); }, true); - windowModes.BindCollectionChanged((sender, args) => + windowModes.BindCollectionChanged((_, _) => { if (windowModes.Count > 1) windowModeDropdown.Show(); @@ -190,7 +190,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics updateDisplayModeDropdowns(); }), true); - scalingMode.BindValueChanged(mode => + scalingMode.BindValueChanged(_ => { scalingSettings.ClearTransforms(); scalingSettings.AutoSizeDuration = transition_duration; diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs index 8c8c2c96ff..453dbd2e18 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/BeatmapSettings.cs @@ -32,7 +32,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance Action = () => { importBeatmapsButton.Enabled.Value = false; - legacyImportManager.ImportFromStableAsync(StableContent.Beatmaps).ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true)); + legacyImportManager.ImportFromStableAsync(StableContent.Beatmaps).ContinueWith(_ => Schedule(() => importBeatmapsButton.Enabled.Value = true)); } }); } @@ -45,7 +45,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance dialogOverlay?.Push(new MassDeleteConfirmationDialog(() => { deleteBeatmapsButton.Enabled.Value = false; - Task.Run(() => beatmaps.Delete()).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true)); + Task.Run(() => beatmaps.Delete()).ContinueWith(_ => Schedule(() => deleteBeatmapsButton.Enabled.Value = true)); })); } }); @@ -58,7 +58,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance dialogOverlay?.Push(new MassVideoDeleteConfirmationDialog(() => { deleteBeatmapVideosButton.Enabled.Value = false; - Task.Run(beatmaps.DeleteAllVideos).ContinueWith(t => Schedule(() => deleteBeatmapVideosButton.Enabled.Value = true)); + Task.Run(beatmaps.DeleteAllVideos).ContinueWith(_ => Schedule(() => deleteBeatmapVideosButton.Enabled.Value = true)); })); } }); @@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance Action = () => { restoreButton.Enabled.Value = false; - Task.Run(beatmaps.RestoreAll).ContinueWith(t => Schedule(() => restoreButton.Enabled.Value = true)); + Task.Run(beatmaps.RestoreAll).ContinueWith(_ => Schedule(() => restoreButton.Enabled.Value = true)); } }, undeleteButton = new SettingsButton @@ -79,7 +79,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance Action = () => { undeleteButton.Enabled.Value = false; - Task.Run(beatmaps.UndeleteAll).ContinueWith(t => Schedule(() => undeleteButton.Enabled.Value = true)); + Task.Run(beatmaps.UndeleteAll).ContinueWith(_ => Schedule(() => undeleteButton.Enabled.Value = true)); } } }); diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs index 74e9ebc084..5367f644ca 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/CollectionsSettings.cs @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance Action = () => { importCollectionsButton.Enabled.Value = false; - legacyImportManager.ImportFromStableAsync(StableContent.Collections).ContinueWith(t => Schedule(() => importCollectionsButton.Enabled.Value = true)); + legacyImportManager.ImportFromStableAsync(StableContent.Collections).ContinueWith(_ => Schedule(() => importCollectionsButton.Enabled.Value = true)); } }); } diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs index 9c1281f371..70e11d45dc 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/ScoreSettings.cs @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance Action = () => { importScoresButton.Enabled.Value = false; - legacyImportManager.ImportFromStableAsync(StableContent.Scores).ContinueWith(t => Schedule(() => importScoresButton.Enabled.Value = true)); + legacyImportManager.ImportFromStableAsync(StableContent.Scores).ContinueWith(_ => Schedule(() => importScoresButton.Enabled.Value = true)); } }); } @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance dialogOverlay?.Push(new MassDeleteConfirmationDialog(() => { deleteScoresButton.Enabled.Value = false; - Task.Run(() => scores.Delete()).ContinueWith(t => Schedule(() => deleteScoresButton.Enabled.Value = true)); + Task.Run(() => scores.Delete()).ContinueWith(_ => Schedule(() => deleteScoresButton.Enabled.Value = true)); })); } }); diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs index 0fff9fef26..c95b1d4dd8 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance Action = () => { importSkinsButton.Enabled.Value = false; - legacyImportManager.ImportFromStableAsync(StableContent.Skins).ContinueWith(t => Schedule(() => importSkinsButton.Enabled.Value = true)); + legacyImportManager.ImportFromStableAsync(StableContent.Skins).ContinueWith(_ => Schedule(() => importSkinsButton.Enabled.Value = true)); } }); } @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance dialogOverlay?.Push(new MassDeleteConfirmationDialog(() => { deleteSkinsButton.Enabled.Value = false; - Task.Run(() => skins.Delete()).ContinueWith(t => Schedule(() => deleteSkinsButton.Enabled.Value = true)); + Task.Run(() => skins.Delete()).ContinueWith(_ => Schedule(() => deleteSkinsButton.Enabled.Value = true)); })); } }); diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index 6494b59b09..741b6b5815 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -82,12 +82,12 @@ namespace osu.Game.Overlays.Settings.Sections skinDropdown.Current = dropdownBindable; - realmSubscription = realm.RegisterForNotifications(r => realm.Realm.All() + realmSubscription = realm.RegisterForNotifications(_ => realm.Realm.All() .Where(s => !s.DeletePending) .OrderByDescending(s => s.Protected) // protected skins should be at the top. .ThenBy(s => s.Name, StringComparer.OrdinalIgnoreCase), skinsChanged); - configBindable.BindValueChanged(id => Scheduler.AddOnce(updateSelectedSkinFromConfig)); + configBindable.BindValueChanged(_ => Scheduler.AddOnce(updateSelectedSkinFromConfig)); dropdownBindable.BindValueChanged(dropdownSelectionChanged); } diff --git a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs index 6c56f3a912..5a03d66b84 100644 --- a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs +++ b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs @@ -96,7 +96,7 @@ namespace osu.Game.Rulesets.Configuration databasedSettings.Add(setting); } - bindable.ValueChanged += b => + bindable.ValueChanged += _ => { lock (pendingWrites) pendingWrites.Add(lookup); diff --git a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs index 3e93e576ba..c8196b6865 100644 --- a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs +++ b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs @@ -129,10 +129,10 @@ namespace osu.Game.Rulesets.Edit switch (e) { - case ScrollEvent _: + case ScrollEvent: return false; - case DoubleClickEvent _: + case DoubleClickEvent: return false; case MouseButtonEvent mouse: diff --git a/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs b/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs index 9307e36b99..a42d4a049a 100644 --- a/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs +++ b/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs @@ -55,8 +55,8 @@ namespace osu.Game.Rulesets.Mods { base.LoadComplete(); - Current.BindValueChanged(current => updateCurrentFromSlider()); - beatmap.BindValueChanged(b => updateCurrentFromSlider(), true); + Current.BindValueChanged(_ => updateCurrentFromSlider()); + beatmap.BindValueChanged(_ => updateCurrentFromSlider(), true); sliderDisplayCurrent.BindValueChanged(number => { diff --git a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs index 2f5707562e..aea6e12a07 100644 --- a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs +++ b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs @@ -165,7 +165,7 @@ namespace osu.Game.Rulesets.Mods public void ApplyToDrawableHitObject(DrawableHitObject drawable) { - drawable.OnNewResult += (o, result) => + drawable.OnNewResult += (_, result) => { if (ratesForRewinding.ContainsKey(result.HitObject)) return; if (!shouldProcessResult(result)) return; @@ -177,7 +177,7 @@ namespace osu.Game.Rulesets.Mods updateTargetRate(); }; - drawable.OnRevertResult += (o, result) => + drawable.OnRevertResult += (_, result) => { if (!ratesForRewinding.ContainsKey(result.HitObject)) return; if (!shouldProcessResult(result)) return; diff --git a/osu.Game/Rulesets/Mods/ModTimeRamp.cs b/osu.Game/Rulesets/Mods/ModTimeRamp.cs index a1aad3a6b9..daa4b7c797 100644 --- a/osu.Game/Rulesets/Mods/ModTimeRamp.cs +++ b/osu.Game/Rulesets/Mods/ModTimeRamp.cs @@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Mods protected ModTimeRamp() { // for preview purpose at song select. eventually we'll want to be able to update every frame. - FinalRate.BindValueChanged(val => applyRateAdjustment(double.PositiveInfinity), true); + FinalRate.BindValueChanged(_ => applyRateAdjustment(double.PositiveInfinity), true); AdjustPitch.BindValueChanged(applyPitchAdjustment); } diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index 8bde71dcd7..e098472999 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -126,55 +126,55 @@ namespace osu.Game.Rulesets { switch (mod) { - case ModNoFail _: + case ModNoFail: value |= LegacyMods.NoFail; break; - case ModEasy _: + case ModEasy: value |= LegacyMods.Easy; break; - case ModHidden _: + case ModHidden: value |= LegacyMods.Hidden; break; - case ModHardRock _: + case ModHardRock: value |= LegacyMods.HardRock; break; - case ModPerfect _: + case ModPerfect: value |= LegacyMods.Perfect; break; - case ModSuddenDeath _: + case ModSuddenDeath: value |= LegacyMods.SuddenDeath; break; - case ModNightcore _: + case ModNightcore: value |= LegacyMods.Nightcore; break; - case ModDoubleTime _: + case ModDoubleTime: value |= LegacyMods.DoubleTime; break; - case ModRelax _: + case ModRelax: value |= LegacyMods.Relax; break; - case ModHalfTime _: + case ModHalfTime: value |= LegacyMods.HalfTime; break; - case ModFlashlight _: + case ModFlashlight: value |= LegacyMods.Flashlight; break; - case ModCinema _: + case ModCinema: value |= LegacyMods.Cinema; break; - case ModAutoplay _: + case ModAutoplay: value |= LegacyMods.Autoplay; break; } diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index f1ed23bb21..7c37913576 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -123,7 +123,7 @@ namespace osu.Game.Rulesets.UI { switch (e) { - case MouseDownEvent _: + case MouseDownEvent: if (mouseDisabled.Value) return true; // importantly, block upwards propagation so global bindings also don't fire. diff --git a/osu.Game/Screens/Edit/Components/TernaryButtons/DrawableTernaryButton.cs b/osu.Game/Screens/Edit/Components/TernaryButtons/DrawableTernaryButton.cs index 82a9db956a..55302833c1 100644 --- a/osu.Game/Screens/Edit/Components/TernaryButtons/DrawableTernaryButton.cs +++ b/osu.Game/Screens/Edit/Components/TernaryButtons/DrawableTernaryButton.cs @@ -67,7 +67,7 @@ namespace osu.Game.Screens.Edit.Components.TernaryButtons { base.LoadComplete(); - Button.Bindable.BindValueChanged(selected => updateSelectionState(), true); + Button.Bindable.BindValueChanged(_ => updateSelectionState(), true); Action = onAction; } diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs index ee82ded39d..54ef5a2bd7 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts controlPointGroups.UnbindAll(); controlPointGroups.BindTo(beatmap.ControlPointInfo.Groups); - controlPointGroups.BindCollectionChanged((sender, args) => + controlPointGroups.BindCollectionChanged((_, args) => { switch (args.Action) { diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/GroupVisualisation.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/GroupVisualisation.cs index cccb646ba4..e058cae191 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/GroupVisualisation.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/GroupVisualisation.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts // Run in constructor so IsRedundant calls can work correctly. controlPoints.BindTo(Group.ControlPoints); - controlPoints.BindCollectionChanged((_, __) => + controlPoints.BindCollectionChanged((_, _) => { ClearInternal(); @@ -40,15 +40,15 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts { switch (point) { - case TimingControlPoint _: + case TimingControlPoint: AddInternal(new ControlPointVisualisation(point) { Y = 0, }); break; - case DifficultyControlPoint _: + case DifficultyControlPoint: AddInternal(new ControlPointVisualisation(point) { Y = 0.25f, }); break; - case SampleControlPoint _: + case SampleControlPoint: AddInternal(new ControlPointVisualisation(point) { Y = 0.5f, }); break; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs index c1ae2ff8d1..54914f4b23 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs @@ -38,7 +38,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts { AddInternal(this.content = content ?? new Container { RelativeSizeAxes = Axes.Both }); - beatmap.ValueChanged += b => + beatmap.ValueChanged += _ => { updateRelativeChildSize(); }; diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs index 6a94fce78a..40403e08ad 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs @@ -293,7 +293,7 @@ namespace osu.Game.Screens.Edit.Compose.Components { base.LoadComplete(); BeatDivisor.BindValueChanged(_ => updateState(), true); - divisorTextBox.OnCommit += (_, __) => setPresets(); + divisorTextBox.OnCommit += (_, _) => setPresets(); Schedule(() => GetContainingInputManager().ChangeFocus(divisorTextBox)); } diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index d38aac1173..540fbf9a72 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Edit.Compose.Components [BackgroundDependencyLoader] private void load() { - SelectedItems.CollectionChanged += (selectedObjects, args) => + SelectedItems.CollectionChanged += (_, args) => { switch (args.Action) { diff --git a/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs index 1c9faadda1..0bdfc5b0a0 100644 --- a/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs +++ b/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs @@ -31,7 +31,7 @@ namespace osu.Game.Screens.Edit.Compose.Components // bring in updates from selection changes EditorBeatmap.HitObjectUpdated += _ => Scheduler.AddOnce(UpdateTernaryStates); - SelectedItems.CollectionChanged += (sender, args) => Scheduler.AddOnce(UpdateTernaryStates); + SelectedItems.CollectionChanged += (_, _) => Scheduler.AddOnce(UpdateTernaryStates); } protected override void DeleteItems(IEnumerable items) => EditorBeatmap.RemoveRange(items); diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs index 91af3fde16..8419d3b380 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs @@ -64,7 +64,7 @@ namespace osu.Game.Screens.Edit.Compose.Components { InternalChild = SelectionBox = CreateSelectionBox(); - SelectedItems.CollectionChanged += (sender, args) => + SelectedItems.CollectionChanged += (_, _) => { Scheduler.AddOnce(updateVisibility); }; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index 08fc8383c3..648ffd9609 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -38,8 +38,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline [BackgroundDependencyLoader] private void load() { - volume.BindValueChanged(volume => updateText()); - bank.BindValueChanged(bank => updateText(), true); + volume.BindValueChanged(_ => updateText()); + bank.BindValueChanged(_ => updateText(), true); } protected override bool OnClick(ClickEvent e) @@ -119,7 +119,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline }); // on commit, ensure that the value is correct by sourcing it from the objects' control points again. // this ensures that committing empty text causes a revert to the previous value. - bank.OnCommit += (_, __) => bank.Current.Value = getCommonBank(relevantControlPoints); + bank.OnCommit += (_, _) => bank.Current.Value = getCommonBank(relevantControlPoints); volume.Current.BindValueChanged(val => updateVolumeFor(relevantObjects, val.NewValue)); } diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointDisplay.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointDisplay.cs index 544c3f8369..cfc71256e8 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointDisplay.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointDisplay.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline controlPointGroups.UnbindAll(); controlPointGroups.BindTo(beatmap.ControlPointInfo.Groups); - controlPointGroups.BindCollectionChanged((sender, args) => + controlPointGroups.BindCollectionChanged((_, args) => { switch (args.Action) { diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointGroup.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointGroup.cs index 4017a745e1..10355045be 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointGroup.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointGroup.cs @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline base.LoadComplete(); controlPoints.BindTo(Group.ControlPoints); - controlPoints.BindCollectionChanged((_, __) => + controlPoints.BindCollectionChanged((_, _) => { ClearInternal(); diff --git a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs index ef670c9fcf..3d18b00e75 100644 --- a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs +++ b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs @@ -89,7 +89,7 @@ namespace osu.Game.Screens.Edit.Compose if (composer == null) return; - EditorBeatmap.SelectedHitObjects.BindCollectionChanged((_, __) => updateClipboardActionAvailability()); + EditorBeatmap.SelectedHitObjects.BindCollectionChanged((_, _) => updateClipboardActionAvailability()); clipboard.BindValueChanged(_ => updateClipboardActionAvailability()); composer.OnLoadComplete += _ => updateClipboardActionAvailability(); updateClipboardActionAvailability(); diff --git a/osu.Game/Screens/Edit/EditorBeatmap.cs b/osu.Game/Screens/Edit/EditorBeatmap.cs index 582c8f5272..0a6f9974b0 100644 --- a/osu.Game/Screens/Edit/EditorBeatmap.cs +++ b/osu.Game/Screens/Edit/EditorBeatmap.cs @@ -105,8 +105,8 @@ namespace osu.Game.Screens.Edit { switch (controlPoint) { - case DifficultyControlPoint _: - case SampleControlPoint _: + case DifficultyControlPoint: + case SampleControlPoint: // skip legacy types. continue; diff --git a/osu.Game/Screens/Edit/EditorBeatmapSkin.cs b/osu.Game/Screens/Edit/EditorBeatmapSkin.cs index 244fd5f1e9..475c894b30 100644 --- a/osu.Game/Screens/Edit/EditorBeatmapSkin.cs +++ b/osu.Game/Screens/Edit/EditorBeatmapSkin.cs @@ -41,7 +41,7 @@ namespace osu.Game.Screens.Edit ComboColours = new BindableList(); if (Skin.Configuration.ComboColours != null) ComboColours.AddRange(Skin.Configuration.ComboColours.Select(c => (Colour4)c)); - ComboColours.BindCollectionChanged((_, __) => updateColours()); + ComboColours.BindCollectionChanged((_, _) => updateColours()); } private void invokeSkinChanged() => BeatmapSkinChanged?.Invoke(); diff --git a/osu.Game/Screens/Edit/Setup/DesignSection.cs b/osu.Game/Screens/Edit/Setup/DesignSection.cs index 12a6843067..40bbfeaf7d 100644 --- a/osu.Game/Screens/Edit/Setup/DesignSection.cs +++ b/osu.Game/Screens/Edit/Setup/DesignSection.cs @@ -100,7 +100,7 @@ namespace osu.Game.Screens.Edit.Setup EnableCountdown.Current.BindValueChanged(_ => updateBeatmap()); CountdownSpeed.Current.BindValueChanged(_ => updateBeatmap()); - CountdownOffset.OnCommit += (_, __) => onOffsetCommitted(); + CountdownOffset.OnCommit += (_, _) => onOffsetCommitted(); widescreenSupport.Current.BindValueChanged(_ => updateBeatmap()); epilepsyWarning.Current.BindValueChanged(_ => updateBeatmap()); diff --git a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs index b5c162ab11..b51da2c53d 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs @@ -63,7 +63,7 @@ namespace osu.Game.Screens.Edit.Timing { base.LoadComplete(); - selectedGroup.BindValueChanged(group => + selectedGroup.BindValueChanged(_ => { // TODO: This should scroll the selected row into view. updateSelectedGroup(); @@ -153,7 +153,7 @@ namespace osu.Game.Screens.Edit.Timing protected override void LoadComplete() { base.LoadComplete(); - controlPoints.CollectionChanged += (_, __) => createChildren(); + controlPoints.CollectionChanged += (_, _) => createChildren(); } private void createChildren() diff --git a/osu.Game/Screens/Edit/Timing/LabelledTimeSignature.cs b/osu.Game/Screens/Edit/Timing/LabelledTimeSignature.cs index d05777e793..998e49a6ab 100644 --- a/osu.Game/Screens/Edit/Timing/LabelledTimeSignature.cs +++ b/osu.Game/Screens/Edit/Timing/LabelledTimeSignature.cs @@ -76,7 +76,7 @@ namespace osu.Game.Screens.Edit.Timing base.LoadComplete(); Current.BindValueChanged(_ => updateFromCurrent(), true); - numeratorBox.OnCommit += (_, __) => updateFromNumeratorBox(); + numeratorBox.OnCommit += (_, _) => updateFromNumeratorBox(); } private void updateFromCurrent() diff --git a/osu.Game/Screens/Edit/Timing/SliderWithTextBoxInput.cs b/osu.Game/Screens/Edit/Timing/SliderWithTextBoxInput.cs index 6a804c7e3e..4dcb5ad2ba 100644 --- a/osu.Game/Screens/Edit/Timing/SliderWithTextBoxInput.cs +++ b/osu.Game/Screens/Edit/Timing/SliderWithTextBoxInput.cs @@ -70,7 +70,7 @@ namespace osu.Game.Screens.Edit.Timing Current.TriggerChange(); }; - Current.BindValueChanged(val => + Current.BindValueChanged(_ => { decimal decimalValue = slider.Current.Value.ToDecimal(NumberFormatInfo.InvariantInfo); textBox.Text = decimalValue.ToString($@"N{FormatUtils.FindPrecision(decimalValue)}"); diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index c33dcc6e91..fd218209d4 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -137,7 +137,7 @@ namespace osu.Game.Screens.Edit.Timing }, true); controlPointGroups.BindTo(Beatmap.ControlPointInfo.Groups); - controlPointGroups.BindCollectionChanged((sender, args) => + controlPointGroups.BindCollectionChanged((_, _) => { table.ControlGroups = controlPointGroups; changeHandler?.SaveState(); diff --git a/osu.Game/Screens/Edit/Timing/TimingSection.cs b/osu.Game/Screens/Edit/Timing/TimingSection.cs index 8413409d84..9b86969db1 100644 --- a/osu.Game/Screens/Edit/Timing/TimingSection.cs +++ b/osu.Game/Screens/Edit/Timing/TimingSection.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Edit.Timing { Label = "BPM"; - OnCommit += (val, isNew) => + OnCommit += (_, isNew) => { if (!isNew) return; diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index 1cdcfdf167..2956a28547 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -91,7 +91,7 @@ namespace osu.Game.Screens.Edit.Timing selectedGroup.BindValueChanged(_ => updateTimingGroup(), true); controlPointGroups.BindTo(editorBeatmap.ControlPointInfo.Groups); - controlPointGroups.BindCollectionChanged((_, __) => updateTimingGroup()); + controlPointGroups.BindCollectionChanged((_, _) => updateTimingGroup()); beatLength.BindValueChanged(_ => regenerateDisplay(true), true); diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs index 7ce70b4b5f..bffda4ec41 100644 --- a/osu.Game/Screens/Edit/Verify/IssueList.cs +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -87,7 +87,7 @@ namespace osu.Game.Screens.Edit.Verify base.LoadComplete(); verify.InterpretedDifficulty.BindValueChanged(_ => refresh()); - verify.HiddenIssueTypes.BindCollectionChanged((_, __) => refresh()); + verify.HiddenIssueTypes.BindCollectionChanged((_, _) => refresh()); refresh(); } diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index f77123af52..a81658a4b6 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -222,7 +222,7 @@ namespace osu.Game.Screens.Menu .Then(5500) .FadeOut(250) .ScaleTo(0.9f, 250, Easing.InQuint) - .Finally(d => + .Finally(_ => { if (nextScreen != null) this.Push(nextScreen); diff --git a/osu.Game/Screens/OnlinePlay/Components/BeatmapTitle.cs b/osu.Game/Screens/OnlinePlay/Components/BeatmapTitle.cs index 1dc05def0f..39a887f820 100644 --- a/osu.Game/Screens/OnlinePlay/Components/BeatmapTitle.cs +++ b/osu.Game/Screens/OnlinePlay/Components/BeatmapTitle.cs @@ -27,7 +27,7 @@ namespace osu.Game.Screens.OnlinePlay.Components [BackgroundDependencyLoader] private void load() { - Playlist.CollectionChanged += (_, __) => updateText(); + Playlist.CollectionChanged += (_, _) => updateText(); updateText(); } diff --git a/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs b/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs index bed55e8a79..9a48769405 100644 --- a/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs +++ b/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs @@ -86,7 +86,7 @@ namespace osu.Game.Screens.OnlinePlay.Components switch (tab) { - case BeatmapDetailAreaPlaylistTabItem _: + case BeatmapDetailAreaPlaylistTabItem: playlistArea.Show(); break; diff --git a/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundSprite.cs b/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundSprite.cs index 795f776496..fe89eaf591 100644 --- a/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundSprite.cs +++ b/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundSprite.cs @@ -26,7 +26,7 @@ namespace osu.Game.Screens.OnlinePlay.Components InternalChild = sprite = CreateBackgroundSprite(); CurrentPlaylistItem.BindValueChanged(_ => updateBeatmap()); - Playlist.CollectionChanged += (_, __) => updateBeatmap(); + Playlist.CollectionChanged += (_, _) => updateBeatmap(); updateBeatmap(); } diff --git a/osu.Game/Screens/OnlinePlay/Components/OverlinedPlaylistHeader.cs b/osu.Game/Screens/OnlinePlay/Components/OverlinedPlaylistHeader.cs index 43ad5e97ec..a268d4d917 100644 --- a/osu.Game/Screens/OnlinePlay/Components/OverlinedPlaylistHeader.cs +++ b/osu.Game/Screens/OnlinePlay/Components/OverlinedPlaylistHeader.cs @@ -18,7 +18,7 @@ namespace osu.Game.Screens.OnlinePlay.Components { base.LoadComplete(); - Playlist.BindCollectionChanged((_, __) => Details.Value = Playlist.GetTotalDuration(), true); + Playlist.BindCollectionChanged((_, _) => Details.Value = Playlist.GetTotalDuration(), true); } } } diff --git a/osu.Game/Screens/OnlinePlay/Components/ParticipantsList.cs b/osu.Game/Screens/OnlinePlay/Components/ParticipantsList.cs index d8515d2bd2..2f38321e13 100644 --- a/osu.Game/Screens/OnlinePlay/Components/ParticipantsList.cs +++ b/osu.Game/Screens/OnlinePlay/Components/ParticipantsList.cs @@ -60,7 +60,7 @@ namespace osu.Game.Screens.OnlinePlay.Components [BackgroundDependencyLoader] private void load() { - RecentParticipants.CollectionChanged += (_, __) => updateParticipants(); + RecentParticipants.CollectionChanged += (_, _) => updateParticipants(); updateParticipants(); } diff --git a/osu.Game/Screens/OnlinePlay/Components/StarRatingRangeDisplay.cs b/osu.Game/Screens/OnlinePlay/Components/StarRatingRangeDisplay.cs index 4cf785ce60..b6ef080e44 100644 --- a/osu.Game/Screens/OnlinePlay/Components/StarRatingRangeDisplay.cs +++ b/osu.Game/Screens/OnlinePlay/Components/StarRatingRangeDisplay.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.OnlinePlay.Components base.LoadComplete(); DifficultyRange.BindValueChanged(_ => updateRange()); - Playlist.BindCollectionChanged((_, __) => updateRange(), true); + Playlist.BindCollectionChanged((_, _) => updateRange(), true); } private void updateRange() diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs index 489bf128e8..5193fe5cbf 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs @@ -181,7 +181,7 @@ namespace osu.Game.Screens.OnlinePlay // schedules added as the properties may change value while the drawable items haven't been created yet. SelectedItem.BindValueChanged(_ => Scheduler.AddOnce(scrollToSelection)); - Items.BindCollectionChanged((_, __) => Scheduler.AddOnce(scrollToSelection), true); + Items.BindCollectionChanged((_, _) => Scheduler.AddOnce(scrollToSelection), true); } private void scrollToSelection() diff --git a/osu.Game/Screens/OnlinePlay/Header.cs b/osu.Game/Screens/OnlinePlay/Header.cs index 06befe0971..a9e9f046e2 100644 --- a/osu.Game/Screens/OnlinePlay/Header.cs +++ b/osu.Game/Screens/OnlinePlay/Header.cs @@ -38,8 +38,8 @@ namespace osu.Game.Screens.OnlinePlay }; // unnecessary to unbind these as this header has the same lifetime as the screen stack we are attaching to. - stack.ScreenPushed += (_, __) => updateSubScreenTitle(); - stack.ScreenExited += (_, __) => updateSubScreenTitle(); + stack.ScreenPushed += (_, _) => updateSubScreenTitle(); + stack.ScreenExited += (_, _) => updateSubScreenTitle(); } private void updateSubScreenTitle() => title.Screen = stack.CurrentScreen as IOnlinePlaySubScreen; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/PlaylistCountPill.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/PlaylistCountPill.cs index 5bdd24221c..474463d5f1 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/PlaylistCountPill.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/PlaylistCountPill.cs @@ -44,7 +44,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components base.LoadComplete(); PlaylistItemStats.BindValueChanged(_ => updateCount()); - Playlist.BindCollectionChanged((_, __) => updateCount(), true); + Playlist.BindCollectionChanged((_, _) => updateCount(), true); } private void updateCount() diff --git a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs index 9784e5aace..8a2aeb9e5e 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs @@ -250,7 +250,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge base.LoadComplete(); ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(passwordTextBox)); - passwordTextBox.OnCommit += (_, __) => performJoin(); + passwordTextBox.OnCommit += (_, _) => performJoin(); } private void performJoin() diff --git a/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs b/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs index d81fee24e0..58ccb24f7a 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/LoungeBackgroundScreen.cs @@ -17,7 +17,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge public LoungeBackgroundScreen() { SelectedRoom.BindValueChanged(onSelectedRoomChanged); - playlist.BindCollectionChanged((_, __) => PlaylistItem = playlist.GetCurrentItem()); + playlist.BindCollectionChanged((_, _) => PlaylistItem = playlist.GetCurrentItem()); } private void onSelectedRoomChanged(ValueChangedEvent room) diff --git a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs index f7f3c27ede..09bc496da5 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/LoungeSubScreen.cs @@ -304,7 +304,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge joiningRoomOperation = ongoingOperationTracker?.BeginOperation(); - RoomManager?.JoinRoom(room, password, r => + RoomManager?.JoinRoom(room, password, _ => { Open(room); joiningRoomOperation?.Dispose(); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs index 20762b2f22..c5d6da1ebc 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs @@ -61,7 +61,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match switch (room?.Countdown) { - case MatchStartCountdown _: + case MatchStartCountdown: newCountdown = room.Countdown; break; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs index b5bb4a766f..b55a7d0731 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs @@ -41,7 +41,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match { var clickOperation = ongoingOperationTracker.BeginOperation(); - Client.ToggleSpectate().ContinueWith(t => endOperation()); + Client.ToggleSpectate().ContinueWith(_ => endOperation()); void endOperation() => clickOperation?.Dispose(); } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistTabControl.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistTabControl.cs index 9877c15f2f..f7abc91227 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistTabControl.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistTabControl.cs @@ -34,7 +34,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist protected override void LoadComplete() { base.LoadComplete(); - QueueItems.BindCollectionChanged((_, __) => Text.Text = QueueItems.Count > 0 ? $"Queue ({QueueItems.Count})" : "Queue", true); + QueueItems.BindCollectionChanged((_, _) => Text.Text = QueueItems.Count > 0 ? $"Queue ({QueueItems.Count})" : "Queue", true); } } } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerQueueList.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerQueueList.cs index 04342788db..39740e650f 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerQueueList.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerQueueList.cs @@ -41,7 +41,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist protected override void LoadComplete() { base.LoadComplete(); - roomPlaylist.BindCollectionChanged((_, __) => InvalidateLayout()); + roomPlaylist.BindCollectionChanged((_, _) => InvalidateLayout()); } public override IEnumerable FlowingChildren => base.FlowingChildren.OfType>().OrderBy(item => item.Model.PlaylistOrder); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs index ae65e1d969..d49f894ad7 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs @@ -81,7 +81,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer private void load() { isConnected.BindTo(client.IsConnected); - isConnected.BindValueChanged(c => Scheduler.AddOnce(poll), true); + isConnected.BindValueChanged(_ => Scheduler.AddOnce(poll), true); } private void poll() diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs index df0f94688b..a82da7b185 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs @@ -125,7 +125,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer client.GameplayStarted += onGameplayStarted; client.ResultsReady += onResultsReady; - ScoreProcessor.HasCompleted.BindValueChanged(completed => + ScoreProcessor.HasCompleted.BindValueChanged(_ => { // wait for server to tell us that results are ready (see SubmitScore implementation) loadingDisplay.Show(); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs index e048c12686..8270bb3b6f 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs @@ -133,7 +133,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate LoadComponentAsync(leaderboard = new MultiSpectatorLeaderboard(users) { Expanded = { Value = true }, - }, l => + }, _ => { foreach (var instance in instances) leaderboard.AddClock(instance.UserId, instance.GameplayClock); diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs b/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs index 1d9ea5f77d..0bf5f2604c 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs @@ -94,7 +94,7 @@ namespace osu.Game.Screens.OnlinePlay base.LoadComplete(); subScreenSelectedItem?.BindValueChanged(_ => UpdateSelectedItem()); - Playlist.BindCollectionChanged((_, __) => UpdateSelectedItem(), true); + Playlist.BindCollectionChanged((_, _) => UpdateSelectedItem(), true); } protected void UpdateSelectedItem() diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSubScreen.cs index ff657e16fb..8a9c4db6ad 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSubScreen.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists } }, true); - Room.MaxAttempts.BindValueChanged(attempts => progressSection.Alpha = Room.MaxAttempts.Value != null ? 1 : 0, true); + Room.MaxAttempts.BindValueChanged(_ => progressSection.Alpha = Room.MaxAttempts.Value != null ? 1 : 0, true); } protected override Drawable CreateMainContent() => new Container diff --git a/osu.Game/Screens/Play/FailAnimation.cs b/osu.Game/Screens/Play/FailAnimation.cs index ca485aa8ea..c1223d7262 100644 --- a/osu.Game/Screens/Play/FailAnimation.cs +++ b/osu.Game/Screens/Play/FailAnimation.cs @@ -198,7 +198,7 @@ namespace osu.Game.Screens.Play dropOffScreen(obj, failTime, rotation, originalScale, originalPosition); // need to reapply the fail drop after judgement state changes - obj.ApplyCustomUpdateState += (o, _) => dropOffScreen(obj, failTime, rotation, originalScale, originalPosition); + obj.ApplyCustomUpdateState += (_, _) => dropOffScreen(obj, failTime, rotation, originalScale, originalPosition); appliedObjects.Add(obj); } diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index 99b9362700..c2652e9212 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -142,7 +142,7 @@ namespace osu.Game.Screens.Play }, }; - State.ValueChanged += s => InternalButtons.Deselect(); + State.ValueChanged += _ => InternalButtons.Deselect(); updateRetryCount(); } @@ -267,7 +267,7 @@ namespace osu.Game.Screens.Play { switch (e) { - case ScrollEvent _: + case ScrollEvent: if (ReceivePositionalInputAt(e.ScreenSpaceMousePosition)) return globalAction.TriggerEvent(e); diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index aa9a2ab242..39a8f1e783 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -218,7 +218,7 @@ namespace osu.Game.Screens.Play.HUD overlayCircle.ScaleTo(0, 100) .Then().FadeOut().ScaleTo(1).FadeIn(500) - .OnComplete(a => + .OnComplete(_ => { icon.ScaleTo(1, 100); circularProgress.FadeOut(100).OnComplete(_ => diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index fe27e1fc24..8f80644d52 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -352,7 +352,7 @@ namespace osu.Game.Screens.Play // When the scoring mode changes, relative positions of elements may change (see DefaultSkin.GetDrawableComponent). // This is a best effort implementation for cases where users haven't customised layouts. scoringMode = config.GetBindable(OsuSetting.ScoreDisplayMode); - scoringMode.BindValueChanged(val => Reload()); + scoringMode.BindValueChanged(_ => Reload()); } } } diff --git a/osu.Game/Screens/Play/KeyCounterDisplay.cs b/osu.Game/Screens/Play/KeyCounterDisplay.cs index ef28632d76..b6094726c0 100644 --- a/osu.Game/Screens/Play/KeyCounterDisplay.cs +++ b/osu.Game/Screens/Play/KeyCounterDisplay.cs @@ -157,10 +157,10 @@ namespace osu.Game.Screens.Play { switch (e) { - case KeyDownEvent _: - case KeyUpEvent _: - case MouseDownEvent _: - case MouseUpEvent _: + case KeyDownEvent: + case KeyUpEvent: + case MouseDownEvent: + case MouseUpEvent: return Target.Children.Any(c => c.TriggerEvent(e)); } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 4a8460ff46..4040adc48d 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -173,7 +173,7 @@ namespace osu.Game.Screens.Play PrepareReplay(); - ScoreProcessor.NewJudgement += result => ScoreProcessor.PopulateScore(Score.ScoreInfo); + ScoreProcessor.NewJudgement += _ => ScoreProcessor.PopulateScore(Score.ScoreInfo); ScoreProcessor.OnResetFromReplayFrame += () => ScoreProcessor.PopulateScore(Score.ScoreInfo); gameActive.BindValueChanged(_ => updatePauseOnFocusLostState(), true); @@ -315,7 +315,7 @@ namespace osu.Game.Screens.Play GameplayClockContainer.Start(); }); - DrawableRuleset.IsPaused.BindValueChanged(paused => + DrawableRuleset.IsPaused.BindValueChanged(_ => { updateGameplayState(); updateSampleDisabledState(); diff --git a/osu.Game/Screens/Play/ReplayPlayer.cs b/osu.Game/Screens/Play/ReplayPlayer.cs index 2a5e356df8..64b4853a67 100644 --- a/osu.Game/Screens/Play/ReplayPlayer.cs +++ b/osu.Game/Screens/Play/ReplayPlayer.cs @@ -26,7 +26,7 @@ namespace osu.Game.Screens.Play protected override bool CheckModsAllowFailure() => false; public ReplayPlayer(Score score, PlayerConfiguration configuration = null) - : this((_, __) => score, configuration) + : this((_, _) => score, configuration) { } diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs index 5d7b04743e..3505786b64 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics Spacing = new Vector2(10, 0), Children = new[] { - base.CreateContent().With(d => + base.CreateContent().With(_ => { Anchor = Anchor.CentreLeft; Origin = Anchor.CentreLeft; diff --git a/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs b/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs index 384f4c4d4f..ab68dec92d 100644 --- a/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs +++ b/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs @@ -87,7 +87,7 @@ namespace osu.Game.Screens.Ranking.Statistics Task.Run(() => { playableBeatmap = beatmapManager.GetWorkingBeatmap(newScore.BeatmapInfo).GetPlayableBeatmap(newScore.Ruleset, newScore.Mods); - }, loadCancellation.Token).ContinueWith(t => Schedule(() => + }, loadCancellation.Token).ContinueWith(_ => Schedule(() => { bool hitEventsAvailable = newScore.HitEvents.Count != 0; Container container; diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 87a1fb4ccb..72e6c7d159 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -959,7 +959,7 @@ namespace osu.Game.Screens.Select { // root should always remain selected. if not, PerformSelection will not be called. State.Value = CarouselItemState.Selected; - State.ValueChanged += state => State.Value = CarouselItemState.Selected; + State.ValueChanged += _ => State.Value = CarouselItemState.Selected; this.carousel = carousel; } diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index dfcd43189b..bf6803f551 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -86,7 +86,7 @@ namespace osu.Game.Screens.Select { switch (tab) { - case BeatmapDetailAreaDetailTabItem _: + case BeatmapDetailAreaDetailTabItem: Details.Show(); break; diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index fdc0d4efdd..2fe62c4a4e 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -217,7 +217,7 @@ namespace osu.Game.Screens.Select }); }; - lookup.Failure += e => + lookup.Failure += _ => { Schedule(() => { diff --git a/osu.Game/Screens/Select/Carousel/TopLocalRank.cs b/osu.Game/Screens/Select/Carousel/TopLocalRank.cs index a948e5b0bd..cc01f61c57 100644 --- a/osu.Game/Screens/Select/Carousel/TopLocalRank.cs +++ b/osu.Game/Screens/Select/Carousel/TopLocalRank.cs @@ -57,7 +57,7 @@ namespace osu.Game.Screens.Select.Carousel + $" && {nameof(ScoreInfo.Ruleset)}.{nameof(RulesetInfo.ShortName)} == $2" + $" && {nameof(ScoreInfo.DeletePending)} == false", api.LocalUser.Value.Id, beatmapInfo.ID, ruleset.Value.ShortName) .OrderByDescending(s => s.TotalScore), - (items, changes, ___) => + (items, _, _) => { Rank = items.FirstOrDefault()?.Rank; // Required since presence is changed via IsPresent override diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index 59eb3fa607..693f182065 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -96,7 +96,7 @@ namespace osu.Game.Screens.Select.Details modSettingChangeTracker?.Dispose(); modSettingChangeTracker = new ModSettingChangeTracker(mods.NewValue); - modSettingChangeTracker.SettingChanged += m => + modSettingChangeTracker.SettingChanged += _ => { debouncedStatisticsUpdate?.Cancel(); debouncedStatisticsUpdate = Scheduler.AddDelayed(updateStatistics, 100); diff --git a/osu.Game/Screens/Select/PlayBeatmapDetailArea.cs b/osu.Game/Screens/Select/PlayBeatmapDetailArea.cs index 4d3c844753..a19acddb48 100644 --- a/osu.Game/Screens/Select/PlayBeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/PlayBeatmapDetailArea.cs @@ -113,7 +113,7 @@ namespace osu.Game.Screens.Select { switch (item) { - case BeatmapDetailAreaDetailTabItem _: + case BeatmapDetailAreaDetailTabItem: return TabType.Details; case BeatmapDetailAreaLeaderboardTabItem leaderboardTab: diff --git a/osu.Game/Skinning/DefaultSkin.cs b/osu.Game/Skinning/DefaultSkin.cs index 43b3cb0aa4..2467b7d039 100644 --- a/osu.Game/Skinning/DefaultSkin.cs +++ b/osu.Game/Skinning/DefaultSkin.cs @@ -74,7 +74,7 @@ namespace osu.Game.Skinning switch (target.Target) { case SkinnableTarget.SongSelect: - var songSelectComponents = new SkinnableTargetComponentsContainer(container => + var songSelectComponents = new SkinnableTargetComponentsContainer(_ => { // do stuff when we need to. }); diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index 7e9f1d0e8e..649b63dda4 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -190,13 +190,13 @@ namespace osu.Game.Skinning.Editor // schedule ensures this only happens when the skin editor is visible. // also avoid some weird endless recursion / bindable feedback loop (something to do with tracking skins across three different bindable types). // probably something which will be factored out in a future database refactor so not too concerning for now. - currentSkin.BindValueChanged(skin => + currentSkin.BindValueChanged(_ => { hasBegunMutating = false; Scheduler.AddOnce(skinChanged); }, true); - SelectedComponents.BindCollectionChanged((_, __) => Scheduler.AddOnce(populateSettings), true); + SelectedComponents.BindCollectionChanged((_, _) => Scheduler.AddOnce(populateSettings), true); } public void UpdateTargetScreen(Drawable targetScreen) diff --git a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs index de33d49941..000917f728 100644 --- a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs +++ b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs @@ -70,7 +70,7 @@ namespace osu.Game.Skinning.Editor var editor = new SkinEditor(); - editor.State.BindValueChanged(visibility => updateComponentVisibility()); + editor.State.BindValueChanged(_ => updateComponentVisibility()); skinEditor = editor; diff --git a/osu.Game/Skinning/LegacyManiaSkinDecoder.cs b/osu.Game/Skinning/LegacyManiaSkinDecoder.cs index 2aaf0ba18e..49914c53aa 100644 --- a/osu.Game/Skinning/LegacyManiaSkinDecoder.cs +++ b/osu.Game/Skinning/LegacyManiaSkinDecoder.cs @@ -120,16 +120,16 @@ namespace osu.Game.Skinning currentConfig.MinimumColumnWidth = minWidth; break; - case string _ when pair.Key.StartsWith("Colour", StringComparison.Ordinal): + case string when pair.Key.StartsWith("Colour", StringComparison.Ordinal): HandleColours(currentConfig, line); break; // Custom sprite paths - case string _ when pair.Key.StartsWith("NoteImage", StringComparison.Ordinal): - case string _ when pair.Key.StartsWith("KeyImage", StringComparison.Ordinal): - case string _ when pair.Key.StartsWith("Hit", StringComparison.Ordinal): - case string _ when pair.Key.StartsWith("Stage", StringComparison.Ordinal): - case string _ when pair.Key.StartsWith("Lighting", StringComparison.Ordinal): + case string when pair.Key.StartsWith("NoteImage", StringComparison.Ordinal): + case string when pair.Key.StartsWith("KeyImage", StringComparison.Ordinal): + case string when pair.Key.StartsWith("Hit", StringComparison.Ordinal): + case string when pair.Key.StartsWith("Stage", StringComparison.Ordinal): + case string when pair.Key.StartsWith("Lighting", StringComparison.Ordinal): currentConfig.ImageLookups[pair.Key] = pair.Value; break; } diff --git a/osu.Game/Skinning/SkinImporter.cs b/osu.Game/Skinning/SkinImporter.cs index 1b5de9abb5..ed31a8c3f5 100644 --- a/osu.Game/Skinning/SkinImporter.cs +++ b/osu.Game/Skinning/SkinImporter.cs @@ -214,7 +214,7 @@ namespace osu.Game.Skinning { try { - realm.Write(r => skin.Hash = ComputeHash(skin)); + realm.Write(_ => skin.Hash = ComputeHash(skin)); } catch (Exception e) { diff --git a/osu.Game/Skinning/SkinProvidingContainer.cs b/osu.Game/Skinning/SkinProvidingContainer.cs index d7399b0141..e447570931 100644 --- a/osu.Game/Skinning/SkinProvidingContainer.cs +++ b/osu.Game/Skinning/SkinProvidingContainer.cs @@ -269,9 +269,9 @@ namespace osu.Game.Skinning { switch (lookup) { - case GlobalSkinColours _: - case SkinComboColourLookup _: - case SkinCustomColourLookup _: + case GlobalSkinColours: + case SkinComboColourLookup: + case SkinCustomColourLookup: if (provider.AllowColourLookup) return skin.GetConfig(lookup); diff --git a/osu.Game/Storyboards/StoryboardSprite.cs b/osu.Game/Storyboards/StoryboardSprite.cs index 838dc618f2..a759482b5d 100644 --- a/osu.Game/Storyboards/StoryboardSprite.cs +++ b/osu.Game/Storyboards/StoryboardSprite.cs @@ -109,20 +109,20 @@ namespace osu.Game.Storyboards generateCommands(generated, getCommands(g => g.Rotation, triggeredGroups), (d, value) => d.Rotation = value, (d, value, duration, easing) => d.RotateTo(value, duration, easing)); generateCommands(generated, getCommands(g => g.Colour, triggeredGroups), (d, value) => d.Colour = value, (d, value, duration, easing) => d.FadeColour(value, duration, easing)); generateCommands(generated, getCommands(g => g.Alpha, triggeredGroups), (d, value) => d.Alpha = value, (d, value, duration, easing) => d.FadeTo(value, duration, easing)); - generateCommands(generated, getCommands(g => g.BlendingParameters, triggeredGroups), (d, value) => d.Blending = value, (d, value, duration, easing) => d.TransformBlendingMode(value, duration), + generateCommands(generated, getCommands(g => g.BlendingParameters, triggeredGroups), (d, value) => d.Blending = value, (d, value, duration, _) => d.TransformBlendingMode(value, duration), false); if (drawable is IVectorScalable vectorScalable) { - generateCommands(generated, getCommands(g => g.VectorScale, triggeredGroups), (d, value) => vectorScalable.VectorScale = value, - (d, value, duration, easing) => vectorScalable.VectorScaleTo(value, duration, easing)); + generateCommands(generated, getCommands(g => g.VectorScale, triggeredGroups), (_, value) => vectorScalable.VectorScale = value, + (_, value, duration, easing) => vectorScalable.VectorScaleTo(value, duration, easing)); } if (drawable is IFlippable flippable) { - generateCommands(generated, getCommands(g => g.FlipH, triggeredGroups), (d, value) => flippable.FlipH = value, (d, value, duration, easing) => flippable.TransformFlipH(value, duration), + generateCommands(generated, getCommands(g => g.FlipH, triggeredGroups), (_, value) => flippable.FlipH = value, (_, value, duration, _) => flippable.TransformFlipH(value, duration), false); - generateCommands(generated, getCommands(g => g.FlipV, triggeredGroups), (d, value) => flippable.FlipV = value, (d, value, duration, easing) => flippable.TransformFlipV(value, duration), + generateCommands(generated, getCommands(g => g.FlipV, triggeredGroups), (_, value) => flippable.FlipV = value, (_, value, duration, _) => flippable.TransformFlipV(value, duration), false); } diff --git a/osu.Game/Tests/Visual/ScreenTestScene.cs b/osu.Game/Tests/Visual/ScreenTestScene.cs index 9adf6458cd..803db07fa0 100644 --- a/osu.Game/Tests/Visual/ScreenTestScene.cs +++ b/osu.Game/Tests/Visual/ScreenTestScene.cs @@ -49,8 +49,8 @@ namespace osu.Game.Tests.Visual } }); - Stack.ScreenPushed += (lastScreen, newScreen) => Logger.Log($"{nameof(ScreenTestScene)} screen changed → {newScreen}"); - Stack.ScreenExited += (lastScreen, newScreen) => Logger.Log($"{nameof(ScreenTestScene)} screen changed ← {newScreen}"); + Stack.ScreenPushed += (_, newScreen) => Logger.Log($"{nameof(ScreenTestScene)} screen changed → {newScreen}"); + Stack.ScreenExited += (_, newScreen) => Logger.Log($"{nameof(ScreenTestScene)} screen changed ← {newScreen}"); } protected void LoadScreen(OsuScreen screen) => Stack.Push(screen); From 81bfe1406386a8c40132ccdc39afefdbf5049609 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 21:28:24 +0900 Subject: [PATCH 1890/2328] Update `DotSettings` to match framework (in most cases) --- osu.sln.DotSettings | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 8fd750a50d..32dbb62e5e 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -7,19 +7,22 @@ ExplicitlyExcluded SOLUTION WARNING + WARNING + WARNING WARNING WARNING HINT HINT WARNING + WARNING + WARNING WARNING True WARNING WARNING HINT DO_NOT_SHOW - WARNING - WARNING + HINT HINT HINT WARNING @@ -58,14 +61,17 @@ HINT HINT HINT - WARNING + HINT + DO_NOT_SHOW WARNING WARNING WARNING WARNING + DO_NOT_SHOW WARNING WARNING WARNING + DO_NOT_SHOW WARNING WARNING WARNING @@ -73,7 +79,7 @@ WARNING HINT WARNING - HINT + DO_NOT_SHOW DO_NOT_SHOW WARNING DO_NOT_SHOW @@ -107,7 +113,6 @@ HINT HINT WARNING - DO_NOT_SHOW DO_NOT_SHOW WARNING WARNING @@ -118,16 +123,13 @@ WARNING WARNING WARNING - HINT + HINT WARNING WARNING WARNING WARNING HINT - HINT WARNING - HINT - HINT HINT HINT HINT @@ -135,8 +137,10 @@ HINT HINT WARNING + HINT + HINT WARNING - WARNING + HINT WARNING WARNING WARNING @@ -145,6 +149,7 @@ DO_NOT_SHOW DO_NOT_SHOW DO_NOT_SHOW + WARNING WARNING WARNING WARNING @@ -213,8 +218,7 @@ WARNING SUGGESTION DO_NOT_SHOW - - True + HINT DO_NOT_SHOW WARNING WARNING @@ -230,8 +234,8 @@ HINT HINT HINT - HINT HINT + HINT HINT DO_NOT_SHOW WARNING @@ -265,6 +269,7 @@ Explicit ExpressionBody BlockBody + ExplicitlyTyped True NEXT_LINE True From 14327943a2d0eb550ed1d4f8bddaef9a2c8d8246 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 21:28:30 +0900 Subject: [PATCH 1891/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index f2790d2520..9cd1709211 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 0802a98858..9e7c0020c3 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index a272df20d4..5315831a33 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From df30bedab6f14d45466dd1c6391dec1ad99bf871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 24 Jun 2022 16:01:52 +0200 Subject: [PATCH 1892/2328] Update framework again --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 9cd1709211..8f4a102cce 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 9e7c0020c3..b9033f1bb9 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 5315831a33..a1e4cf3ba0 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From a83c45b50e4f126bfa218d4bd8e4d8a2bf1e5145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 24 Jun 2022 16:07:14 +0200 Subject: [PATCH 1893/2328] Fix compile failures from framework breaking change --- osu.Game.Tournament/TournamentGameBase.cs | 2 +- osu.Game/OsuGameBase.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index ccbe77fa95..75c9f17d4c 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -62,7 +62,7 @@ namespace osu.Game.Tournament dependencies.Cache(new TournamentVideoResourceStore(storage)); - Textures.AddStore(new TextureLoaderStore(new StorageBackedResourceStore(storage))); + Textures.AddTextureSource(new TextureLoaderStore(new StorageBackedResourceStore(storage))); dependencies.CacheAs(new StableInfo(storage)); } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index b0ba62a6ac..7d39aad226 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -244,7 +244,7 @@ namespace osu.Game dependencies.CacheAs(Storage); var largeStore = new LargeTextureStore(Host.CreateTextureLoaderStore(new NamespacedResourceStore(Resources, @"Textures"))); - largeStore.AddStore(Host.CreateTextureLoaderStore(new OnlineStore())); + largeStore.AddTextureSource(Host.CreateTextureLoaderStore(new OnlineStore())); dependencies.Cache(largeStore); dependencies.CacheAs(this); From e0c2228b4181d707702873c9d4943003debb7b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 24 Jun 2022 16:40:35 +0200 Subject: [PATCH 1894/2328] Revert downgrades in code inspection settings --- osu.sln.DotSettings | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 32dbb62e5e..a55b3b5074 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -22,7 +22,8 @@ WARNING HINT DO_NOT_SHOW - HINT + WARNING + WARNING HINT HINT WARNING @@ -61,7 +62,7 @@ HINT HINT HINT - HINT + WARNING DO_NOT_SHOW WARNING WARNING @@ -79,7 +80,7 @@ WARNING HINT WARNING - DO_NOT_SHOW + HINT DO_NOT_SHOW WARNING DO_NOT_SHOW @@ -113,6 +114,7 @@ HINT HINT WARNING + DO_NOT_SHOW DO_NOT_SHOW WARNING WARNING @@ -129,7 +131,10 @@ WARNING WARNING HINT + HINT WARNING + HINT + HINT HINT HINT HINT @@ -140,7 +145,7 @@ HINT HINT WARNING - HINT + WARNING WARNING WARNING WARNING @@ -218,7 +223,8 @@ WARNING SUGGESTION DO_NOT_SHOW - HINT + + True DO_NOT_SHOW WARNING WARNING @@ -234,8 +240,8 @@ HINT HINT HINT - HINT HINT + HINT HINT DO_NOT_SHOW WARNING From a039f9878a6b4eca158982dce24fdd4ca0dd8584 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 25 Jun 2022 19:33:44 +0900 Subject: [PATCH 1895/2328] Adjust menu cursor rotation to follow mouse, rather than be fixated around original click location --- osu.Game/Graphics/Cursor/MenuCursor.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 4544633318..b387dbf9a8 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -51,6 +51,9 @@ namespace osu.Game.Graphics.Cursor { if (dragRotationState != DragRotationState.NotDragging) { + if (Vector2.Distance(positionMouseDown, e.MousePosition) > 100) + positionMouseDown = Interpolation.ValueAt(0.001f, positionMouseDown, e.MousePosition, 0, Clock.ElapsedFrameTime); + var position = e.MousePosition; float distance = Vector2Extensions.Distance(position, positionMouseDown); From 2ecab454aa4dbde8ca37f2d07a0f93be80e9dff0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 25 Jun 2022 19:43:39 +0900 Subject: [PATCH 1896/2328] Adjust animations and tolerances to make things feel snappier --- osu.Game/Graphics/Cursor/MenuCursor.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index b387dbf9a8..10ed76ebdd 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -51,15 +51,16 @@ namespace osu.Game.Graphics.Cursor { if (dragRotationState != DragRotationState.NotDragging) { - if (Vector2.Distance(positionMouseDown, e.MousePosition) > 100) - positionMouseDown = Interpolation.ValueAt(0.001f, positionMouseDown, e.MousePosition, 0, Clock.ElapsedFrameTime); + // make the rotation centre point floating. + if (Vector2.Distance(positionMouseDown, e.MousePosition) > 60) + positionMouseDown = Interpolation.ValueAt(0.005f, positionMouseDown, e.MousePosition, 0, Clock.ElapsedFrameTime); var position = e.MousePosition; float distance = Vector2Extensions.Distance(position, positionMouseDown); // don't start rotating until we're moved a minimum distance away from the mouse down location, // else it can have an annoying effect. - if (dragRotationState == DragRotationState.DragStarted && distance > 30) + if (dragRotationState == DragRotationState.DragStarted && distance > 80) dragRotationState = DragRotationState.Rotating; // don't rotate when distance is zero to avoid NaN @@ -74,7 +75,7 @@ namespace osu.Game.Graphics.Cursor if (diff > 180) diff -= 360; degrees = activeCursor.Rotation + diff; - activeCursor.RotateTo(degrees, 600, Easing.OutQuint); + activeCursor.RotateTo(degrees, 120, Easing.OutQuint); } } @@ -114,7 +115,7 @@ namespace osu.Game.Graphics.Cursor if (dragRotationState != DragRotationState.NotDragging) { - activeCursor.RotateTo(0, 600 * (1 + Math.Abs(activeCursor.Rotation / 720)), Easing.OutElasticHalf); + activeCursor.RotateTo(0, 400 * (0.5f + Math.Abs(activeCursor.Rotation / 960)), Easing.OutElasticQuarter); dragRotationState = DragRotationState.NotDragging; } From 1a22377e19d45ee88dab9e9effba1260b7bacf47 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 26 Jun 2022 16:42:28 +0900 Subject: [PATCH 1897/2328] Fix test deadlock due to TPL threadpool saturation As found in aggressive CI runs: ```csharp 00007F6F527F32B0 00007f74f937c72d (MethodDesc 00007f74f5545a78 + 0x22d System.Threading.ManualResetEventSlim.Wait(Int32, System.Threading.CancellationToken)), calling (MethodDesc 00007f74f51c0838 + 0 System.Threading.Monitor.Wait(System.Object, Int32)) 00007F6F527F3330 00007f74f93861ca (MethodDesc 00007f74f5259100 + 0x10a System.Threading.Tasks.Task.SpinThenBlockingWait(Int32, System.Threading.CancellationToken)), calling (MethodDesc 00007f74f5545a78 + 0 System.Threading.ManualResetEventSlim.Wait(Int32, System.Threading.CancellationToken)) 00007F6F527F3390 00007f74f9385d11 (MethodDesc 00007f74f52590e8 + 0x81 System.Threading.Tasks.Task.InternalWaitCore(Int32, System.Threading.CancellationToken)), calling (MethodDesc 00007f74f5259100 + 0 System.Threading.Tasks.Task.SpinThenBlockingWait(Int32, System.Threading.CancellationToken)) 00007F6F527F33E0 00007f74fc3823af (MethodDesc 00007f74f5934c08 + 0x4f System.Threading.Tasks.Task`1[[System.Boolean, System.Private.CoreLib]].GetResultCore(Boolean)), calling (MethodDesc 00007f74f52590e8 + 0 System.Threading.Tasks.Task.InternalWaitCore(Int32, System.Threading.CancellationToken)) 00007F6F527F3400 00007f74fb0aad92 (MethodDesc 00007f74fb28b000 + 0x122 osu.Game.Tests.Visual.OnlinePlay.OnlinePlayTestScene+<>c__DisplayClass21_0.b__1(osu.Game.Online.API.APIRequest)), calling (MethodDesc 00007f74f5934be8 + 0 System.Threading.Tasks.Task`1[[System.Boolean, System.Private.CoreLib]].get_Result()) 00007F6F527F3470 00007f74fa9c6dd7 (MethodDesc 00007f74f921f6c8 + 0x77 osu.Game.Online.API.DummyAPIAccess.PerformAsync(osu.Game.Online.API.APIRequest)) 00007F6F527F34C0 00007f74fb13c718 (MethodDesc 00007f74fb4e0c50 + 0x538 osu.Game.Database.OnlineLookupCache`3+d__13[[System.Int32, System.Private.CoreLib],[System.__Canon, System.Private.CoreLib],[System.__Canon, System.Private.CoreLib]].MoveNext()) ``` Going with the simplest solution, as what we had was pretty ugly to start with and I don't want to overthink this, just push a fix and hope for the best. --- .../Visual/OnlinePlay/OnlinePlayTestScene.cs | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs b/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs index 282312c9c1..6577057c17 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs @@ -4,14 +4,14 @@ #nullable disable using System; -using System.Threading.Tasks; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Database; +using osu.Framework.Logging; using osu.Game.Beatmaps; +using osu.Game.Database; using osu.Game.Online.API; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay; @@ -72,22 +72,18 @@ namespace osu.Game.Tests.Visual.OnlinePlay ((DummyAPIAccess)API).HandleRequest = request => { - TaskCompletionSource tcs = new TaskCompletionSource(); - - // Because some of the handlers use realm, we need to ensure the game is still alive when firing. - // If we don't, a stray `PerformAsync` could hit an `ObjectDisposedException` if running too late. - Scheduler.Add(() => + try { - bool result = handler.HandleRequest(request, API.LocalUser.Value, beatmapManager); - tcs.SetResult(result); - }, false); - -#pragma warning disable RS0030 - // We can't GetResultSafely() here (will fail with "Can't use GetResultSafely from inside an async operation."), but Wait is safe enough due to - // the task being a TaskCompletionSource. - // Importantly, this doesn't deadlock because of the scheduler call above running inline where feasible (see the `false` argument). - return tcs.Task.Result; -#pragma warning restore RS0030 + return handler.HandleRequest(request, API.LocalUser.Value, beatmapManager); + } + catch (ObjectDisposedException) + { + // These requests can be fired asynchronously, but potentially arrive after game components + // have been disposed (ie. realm in BeatmapManager). + // This only happens in tests and it's easiest to ignore them for now. + Logger.Log($"Handled {nameof(ObjectDisposedException)} in test request handling"); + return true; + } }; }); From cd9eaf215b9d3c9a10271d008a8a3baa25f0407c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 02:58:01 +0900 Subject: [PATCH 1898/2328] Attempt to fix flaky `PlaylistOverlay` test --- .../Visual/UserInterface/TestScenePlaylistOverlay.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestScenePlaylistOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestScenePlaylistOverlay.cs index 4c35ec40b5..ee5ef2f364 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestScenePlaylistOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestScenePlaylistOverlay.cs @@ -27,6 +27,8 @@ namespace osu.Game.Tests.Visual.UserInterface private Live first; + private const int item_count = 100; + [SetUp] public void Setup() => Schedule(() => { @@ -46,7 +48,7 @@ namespace osu.Game.Tests.Visual.UserInterface beatmapSets.Clear(); - for (int i = 0; i < 100; i++) + for (int i = 0; i < item_count; i++) { beatmapSets.Add(TestResources.CreateTestBeatmapSetInfo().ToLiveUnmanaged()); } @@ -59,6 +61,13 @@ namespace osu.Game.Tests.Visual.UserInterface [Test] public void TestRearrangeItems() { + AddUntilStep("wait for load complete", () => + { + return this + .ChildrenOfType() + .Count(i => i.ChildrenOfType().First().DelayedLoadCompleted) > 6; + }); + AddUntilStep("wait for animations to complete", () => !playlistOverlay.Transforms.Any()); AddStep("hold 1st item handle", () => From b5a8889fb80e359d0afb17a7d1e76dc4b66df941 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 03:04:49 +0900 Subject: [PATCH 1899/2328] Attempt to fix flaky `EditorNavigation` test Conditionals taken from https://github.com/ppy/osu/blob/f8830c6850128456266c82de83273204f8b74ac0/osu.Game/Tests/Visual/EditorTestScene.cs#L61-L62 where it seemed to resolve other similar cases. --- osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs index 85b50a9b21..273e8abcd7 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs @@ -9,10 +9,12 @@ using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Database; +using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Components.Timelines.Summary; +using osu.Game.Screens.Edit.Compose.Components.Timeline; using osu.Game.Screens.Edit.GameplayTest; using osu.Game.Screens.Select; using osu.Game.Tests.Resources; @@ -38,7 +40,10 @@ namespace osu.Game.Tests.Visual.Editing AddStep("switch ruleset", () => Game.Ruleset.Value = new ManiaRuleset().RulesetInfo); AddStep("open editor", () => ((PlaySongSelect)Game.ScreenStack.CurrentScreen).Edit(beatmapSet.Beatmaps.First(beatmap => beatmap.Ruleset.OnlineID == 0))); - AddUntilStep("wait for editor open", () => Game.ScreenStack.CurrentScreen is Editor editor && editor.IsLoaded); + AddUntilStep("wait for editor open", () => Game.ScreenStack.CurrentScreen is Editor editor + && editor.IsLoaded + && editor.ChildrenOfType().FirstOrDefault()?.IsLoaded == true + && editor.ChildrenOfType().FirstOrDefault()?.IsLoaded == true); AddStep("test gameplay", () => { var testGameplayButton = this.ChildrenOfType().Single(); From da61d0547ffb39614a6c7b93610ac26c77e1fc67 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 15:24:25 +0900 Subject: [PATCH 1900/2328] Include archive name in import log output --- osu.Game/Database/RealmArchiveModelImporter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Database/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs index a3349d9918..76f6db1384 100644 --- a/osu.Game/Database/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -296,7 +296,8 @@ namespace osu.Game.Database try { - LogForModel(item, @"Beginning import..."); + // Log output here will be missing a valid hash in non-batch imports. + LogForModel(item, $@"Beginning import from {archive?.Name ?? "unknown"}..."); // TODO: do we want to make the transaction this local? not 100% sure, will need further investigation. using (var transaction = realm.BeginWrite()) From 13c8d330094370093b33f724d84f4a914761e528 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 15:29:01 +0900 Subject: [PATCH 1901/2328] Fix second case of empty beatmaps being reported to sentry as errors --- osu.Game/Beatmaps/BeatmapImporter.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapImporter.cs b/osu.Game/Beatmaps/BeatmapImporter.cs index 237088036c..d89541844b 100644 --- a/osu.Game/Beatmaps/BeatmapImporter.cs +++ b/osu.Game/Beatmaps/BeatmapImporter.cs @@ -18,7 +18,6 @@ using osu.Game.Database; using osu.Game.Extensions; using osu.Game.IO; using osu.Game.IO.Archives; -using osu.Game.Models; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; using osu.Game.Skinning; @@ -49,7 +48,7 @@ namespace osu.Game.Beatmaps protected override void Populate(BeatmapSetInfo beatmapSet, ArchiveReader? archive, Realm realm, CancellationToken cancellationToken = default) { if (archive != null) - beatmapSet.Beatmaps.AddRange(createBeatmapDifficulties(beatmapSet.Files, realm)); + beatmapSet.Beatmaps.AddRange(createBeatmapDifficulties(beatmapSet, realm)); foreach (BeatmapInfo b in beatmapSet.Beatmaps) { @@ -200,23 +199,32 @@ namespace osu.Game.Beatmaps /// /// Create all required s for the provided archive. /// - private List createBeatmapDifficulties(IList files, Realm realm) + private List createBeatmapDifficulties(BeatmapSetInfo beatmapSet, Realm realm) { var beatmaps = new List(); - foreach (var file in files.Where(f => f.Filename.EndsWith(".osu", StringComparison.OrdinalIgnoreCase))) + foreach (var file in beatmapSet.Files.Where(f => f.Filename.EndsWith(".osu", StringComparison.OrdinalIgnoreCase))) { using (var memoryStream = new MemoryStream(Files.Store.Get(file.File.GetStoragePath()))) // we need a memory stream so we can seek { IBeatmap decoded; + using (var lineReader = new LineBufferedReader(memoryStream, true)) + { + if (lineReader.PeekLine() == null) + { + LogForModel(beatmapSet, $"No content found in beatmap file {file.Filename}."); + continue; + } + decoded = Decoder.GetDecoder(lineReader).Decode(lineReader); + } string hash = memoryStream.ComputeSHA2Hash(); if (beatmaps.Any(b => b.Hash == hash)) { - Logger.Log($"Skipping import of {file.Filename} due to duplicate file content.", LoggingTarget.Database); + LogForModel(beatmapSet, $"Skipping import of {file.Filename} due to duplicate file content."); continue; } @@ -227,7 +235,7 @@ namespace osu.Game.Beatmaps if (ruleset?.Available != true) { - Logger.Log($"Skipping import of {file.Filename} due to missing local ruleset {decodedInfo.Ruleset.OnlineID}.", LoggingTarget.Database); + LogForModel(beatmapSet, $"Skipping import of {file.Filename} due to missing local ruleset {decodedInfo.Ruleset.OnlineID}."); continue; } From 01487a11859af1cd36719fe250d34dff919c66cd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 15:52:45 +0900 Subject: [PATCH 1902/2328] Add assertion on realm re-fetch being not-null --- osu.Game/Database/ModelManager.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Database/ModelManager.cs b/osu.Game/Database/ModelManager.cs index 9603412178..4224c92f2c 100644 --- a/osu.Game/Database/ModelManager.cs +++ b/osu.Game/Database/ModelManager.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using osu.Framework.Platform; @@ -46,6 +47,7 @@ namespace osu.Game.Database Realm.Realm.Write(realm => { var managed = realm.Find(item.ID); + Debug.Assert(managed != null); operation(managed); item.Files.Clear(); From b70b365411ab9c820da30829b6dbcc5c42c3b15a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 15:53:05 +0900 Subject: [PATCH 1903/2328] Ensure files are cleaned up even on test step failure in `TestAddAudioTrack` --- .../Editing/TestSceneEditorBeatmapCreation.cs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs index a204fc5686..fcbf63da79 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs @@ -95,18 +95,23 @@ namespace osu.Game.Tests.Visual.Editing string extractedFolder = $"{temp}_extracted"; Directory.CreateDirectory(extractedFolder); - using (var zip = ZipArchive.Open(temp)) - zip.WriteToDirectory(extractedFolder); + try + { + using (var zip = ZipArchive.Open(temp)) + zip.WriteToDirectory(extractedFolder); - bool success = setup.ChildrenOfType().First().ChangeAudioTrack(new FileInfo(Path.Combine(extractedFolder, "03. Renatus - Soleily 192kbps.mp3"))); + bool success = setup.ChildrenOfType().First().ChangeAudioTrack(new FileInfo(Path.Combine(extractedFolder, "03. Renatus - Soleily 192kbps.mp3"))); - File.Delete(temp); - Directory.Delete(extractedFolder, true); + // ensure audio file is copied to beatmap as "audio.mp3" rather than original filename. + Assert.That(Beatmap.Value.Metadata.AudioFile == "audio.mp3"); - // ensure audio file is copied to beatmap as "audio.mp3" rather than original filename. - Assert.That(Beatmap.Value.Metadata.AudioFile == "audio.mp3"); - - return success; + return success; + } + finally + { + File.Delete(temp); + Directory.Delete(extractedFolder, true); + } }); AddAssert("track length changed", () => Beatmap.Value.Track.Length > 60000); From 10d1bbb1316f427598d2cd714ebc7b645061e030 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 15:58:51 +0900 Subject: [PATCH 1904/2328] Log global working beatmap updates in `OsuGameBase` instead of `OsuGame` --- osu.Game/OsuGame.cs | 1 - osu.Game/OsuGameBase.cs | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index f51a18b36f..7724241d5a 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -612,7 +612,6 @@ namespace osu.Game { beatmap.OldValue?.CancelAsyncLoad(); beatmap.NewValue?.BeginAsyncLoad(); - Logger.Log($"Game-wide working beatmap updated to {beatmap.NewValue}"); } private void modsChanged(ValueChangedEvent> mods) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 7d39aad226..57369419d2 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -490,10 +490,12 @@ namespace osu.Game } } - private void onBeatmapChanged(ValueChangedEvent valueChangedEvent) + private void onBeatmapChanged(ValueChangedEvent beatmap) { if (IsLoaded && !ThreadSafety.IsUpdateThread) throw new InvalidOperationException("Global beatmap bindable must be changed from update thread."); + + Logger.Log($"Game-wide working beatmap updated to {beatmap.NewValue}"); } private void onRulesetChanged(ValueChangedEvent r) From f6a6538e9698f402ce612b8abecef67ec533aac5 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 27 Jun 2022 15:01:53 +0900 Subject: [PATCH 1905/2328] Add more properties to IBeatmapOnlineInfo --- osu.Game/Beatmaps/IBeatmapOnlineInfo.cs | 33 ++++++++++++++++--- .../API/Requests/Responses/APIBeatmap.cs | 3 ++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/IBeatmapOnlineInfo.cs b/osu.Game/Beatmaps/IBeatmapOnlineInfo.cs index 160b7cf0ae..e1634e7d24 100644 --- a/osu.Game/Beatmaps/IBeatmapOnlineInfo.cs +++ b/osu.Game/Beatmaps/IBeatmapOnlineInfo.cs @@ -13,25 +13,50 @@ namespace osu.Game.Beatmaps /// int? MaxCombo { get; } + /// + /// The approach rate. + /// + float ApproachRate { get; } + + /// + /// The circle size. + /// + float CircleSize { get; } + + /// + /// The drain rate. + /// + float DrainRate { get; } + + /// + /// The overall difficulty. + /// + float OverallDifficulty { get; } + /// /// The amount of circles in this beatmap. /// - public int CircleCount { get; } + int CircleCount { get; } /// /// The amount of sliders in this beatmap. /// - public int SliderCount { get; } + int SliderCount { get; } + + /// + /// The amount of spinners in tihs beatmap. + /// + int SpinnerCount { get; } /// /// The amount of plays this beatmap has. /// - public int PlayCount { get; } + int PlayCount { get; } /// /// The amount of passes this beatmap has. /// - public int PassCount { get; } + int PassCount { get; } APIFailTimes? FailTimes { get; } } diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs index 258708de2b..735fde333d 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs @@ -69,6 +69,9 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"count_sliders")] public int SliderCount { get; set; } + [JsonProperty(@"count_spinners")] + public int SpinnerCount { get; set; } + [JsonProperty(@"version")] public string DifficultyName { get; set; } = string.Empty; From 0579780bb8c38e25675755a4bc5cf045c2e1e7aa Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 27 Jun 2022 15:05:49 +0900 Subject: [PATCH 1906/2328] Add IBeatmapOnlineInfo parameter and use to extract more data --- .../Difficulty/CatchDifficultyAttributes.cs | 5 +++-- .../Difficulty/ManiaDifficultyAttributes.cs | 5 +++-- .../Difficulty/OsuDifficultyAttributes.cs | 10 ++++++++-- .../Difficulty/TaikoDifficultyAttributes.cs | 5 +++-- osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs | 4 +++- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs index 9951d736c3..c2f5aa3629 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using Newtonsoft.Json; +using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; namespace osu.Game.Rulesets.Catch.Difficulty @@ -31,9 +32,9 @@ namespace osu.Game.Rulesets.Catch.Difficulty yield return (ATTRIB_ID_MAX_COMBO, MaxCombo); } - public override void FromDatabaseAttributes(IReadOnlyDictionary values) + public override void FromDatabaseAttributes(IReadOnlyDictionary values, IBeatmapOnlineInfo onlineInfo) { - base.FromDatabaseAttributes(values); + base.FromDatabaseAttributes(values, onlineInfo); StarRating = values[ATTRIB_ID_AIM]; ApproachRate = values[ATTRIB_ID_APPROACH_RATE]; diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs index 8a5161be79..023c45fbcf 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using Newtonsoft.Json; +using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; namespace osu.Game.Rulesets.Mania.Difficulty @@ -37,9 +38,9 @@ namespace osu.Game.Rulesets.Mania.Difficulty yield return (ATTRIB_ID_SCORE_MULTIPLIER, ScoreMultiplier); } - public override void FromDatabaseAttributes(IReadOnlyDictionary values) + public override void FromDatabaseAttributes(IReadOnlyDictionary values, IBeatmapOnlineInfo onlineInfo) { - base.FromDatabaseAttributes(values); + base.FromDatabaseAttributes(values, onlineInfo); MaxCombo = (int)values[ATTRIB_ID_MAX_COMBO]; StarRating = values[ATTRIB_ID_DIFFICULTY]; diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs index 19217015c1..abab44b96a 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; using Newtonsoft.Json; +using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Mods; @@ -96,9 +97,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty yield return (ATTRIB_ID_SLIDER_FACTOR, SliderFactor); } - public override void FromDatabaseAttributes(IReadOnlyDictionary values) + public override void FromDatabaseAttributes(IReadOnlyDictionary values, IBeatmapOnlineInfo onlineInfo) { - base.FromDatabaseAttributes(values); + base.FromDatabaseAttributes(values, onlineInfo); AimDifficulty = values[ATTRIB_ID_AIM]; SpeedDifficulty = values[ATTRIB_ID_SPEED]; @@ -108,6 +109,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty StarRating = values[ATTRIB_ID_DIFFICULTY]; FlashlightDifficulty = values.GetValueOrDefault(ATTRIB_ID_FLASHLIGHT); SliderFactor = values[ATTRIB_ID_SLIDER_FACTOR]; + + DrainRate = onlineInfo.DrainRate; + HitCircleCount = onlineInfo.CircleCount; + SliderCount = onlineInfo.SliderCount; + SpinnerCount = onlineInfo.SpinnerCount; } #region Newtonsoft.Json implicit ShouldSerialize() methods diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs index 6c617a22a4..eec59afc5b 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using Newtonsoft.Json; +using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; namespace osu.Game.Rulesets.Taiko.Difficulty @@ -57,9 +58,9 @@ namespace osu.Game.Rulesets.Taiko.Difficulty yield return (ATTRIB_ID_GREAT_HIT_WINDOW, GreatHitWindow); } - public override void FromDatabaseAttributes(IReadOnlyDictionary values) + public override void FromDatabaseAttributes(IReadOnlyDictionary values, IBeatmapOnlineInfo onlineInfo) { - base.FromDatabaseAttributes(values); + base.FromDatabaseAttributes(values, onlineInfo); MaxCombo = (int)values[ATTRIB_ID_MAX_COMBO]; StarRating = values[ATTRIB_ID_DIFFICULTY]; diff --git a/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs b/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs index e0844a5c8a..1f08790408 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; +using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Difficulty @@ -74,7 +75,8 @@ namespace osu.Game.Rulesets.Difficulty /// Reads osu-web database attribute mappings into this object. /// /// The attribute mappings. - public virtual void FromDatabaseAttributes(IReadOnlyDictionary values) + /// The where more information about the beatmap may be extracted from (such as AR/CS/OD/etc). + public virtual void FromDatabaseAttributes(IReadOnlyDictionary values, IBeatmapOnlineInfo onlineInfo) { } } From 0fd2c010e5f8de3ec1ba777925d426dfcb63b55e Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 27 Jun 2022 15:06:42 +0900 Subject: [PATCH 1907/2328] Remove NRT disables from attributes classes --- .../Difficulty/CatchDifficultyAttributes.cs | 2 -- .../Difficulty/ManiaDifficultyAttributes.cs | 2 -- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs | 2 -- .../Difficulty/TaikoDifficultyAttributes.cs | 2 -- osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs | 5 ++--- 5 files changed, 2 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs index c2f5aa3629..2d01153f98 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs index 023c45fbcf..680732f26e 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs index abab44b96a..4b06502e32 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs index eec59afc5b..380ab4a4fc 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Beatmaps; diff --git a/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs b/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs index 1f08790408..b0e83d6abe 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs @@ -1,8 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - +using System; using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; @@ -31,7 +30,7 @@ namespace osu.Game.Rulesets.Difficulty /// /// The mods which were applied to the beatmap. /// - public Mod[] Mods { get; set; } + public Mod[] Mods { get; set; } = Array.Empty(); /// /// The combined star rating of all skills. From 5a7d339cc871aeacaf1f2623f289eb2b599e7253 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 16:19:31 +0900 Subject: [PATCH 1908/2328] Centralise and harden editor-ready-for-use check Not only does this combine the check into one location, but it also adds a check on the global `WorkingBeatmap` being updated, which is the only way I can see the following failure happening: ```csharp 05:19:07 osu.Game.Tests: osu.Game.Tests.Visual.Editing.TestSceneEditorBeatmapCreation.TestAddAudioTrack 05:19:07 Failed TestAddAudioTrack [161 ms] 05:19:07 Error Message: 05:19:07 TearDown : System.NullReferenceException : Object reference not set to an instance of an object. 05:19:07 Stack Trace: 05:19:07 --TearDown 05:19:07 at osu.Game.Database.ModelManager`1.<>c__DisplayClass7_0.b__0(TModel managed) in C:\BuildAgent\work\ecd860037212ac52\osu.Game\Database\ModelManager.cs:line 36 05:19:07 at osu.Game.Database.ModelManager`1.<>c__DisplayClass8_0.b__0(Realm realm) in C:\BuildAgent\work\ecd860037212ac52\osu.Game\Database\ModelManager.cs:line 49 05:19:07 at osu.Game.Database.RealmExtensions.Write(Realm realm, Action`1 function) in C:\BuildAgent\work\ecd860037212ac52\osu.Game\Database\RealmExtensions.cs:line 14 05:19:07 at osu.Game.Database.ModelManager`1.performFileOperation(TModel item, Action`1 operation) in C:\BuildAgent\work\ecd860037212ac52\osu.Game\Database\ModelManager.cs:line 46 05:19:07 at osu.Game.Database.ModelManager`1.AddFile(TModel item, Stream contents, String filename) in C:\BuildAgent\work\ecd860037212ac52\osu.Game\Database\ModelManager.cs:line 36 05:19:07 at osu.Game.Screens.Edit.Setup.ResourcesSection.ChangeAudioTrack(FileInfo source) in C:\BuildAgent\work\ecd860037212ac52\osu.Game\Screens\Edit\Setup\ResourcesSection.cs:line 115 05:19:07 at osu.Game.Tests.Visual.Editing.TestSceneEditorBeatmapCreation.b__13_0() in C:\BuildAgent\work\ecd860037212ac52\osu.Game.Tests\Visual\Editing\TestSceneEditorBeatmapCreation.cs:line 101 05:19:07 at osu.Framework.Testing.Drawables.Steps.AssertButton.checkAssert() 05:19:07 at osu.Framework.Testing.Drawables.Steps.StepButton.PerformStep(Boolean userTriggered) 05:19:07 at osu.Framework.Testing.TestScene.runNextStep(Action onCompletion, Action`1 onError, Func`2 stopCondition) ``` --- .../Editor/TestSceneSliderVelocityAdjust.cs | 9 ++---- .../Editing/TestSceneEditorBeatmapCreation.cs | 2 -- .../Editing/TestSceneEditorNavigation.cs | 7 +---- osu.Game/Screens/Edit/Editor.cs | 29 +++++++++++++++++++ osu.Game/Tests/Visual/EditorTestScene.cs | 8 ++--- 5 files changed, 34 insertions(+), 21 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderVelocityAdjust.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderVelocityAdjust.cs index 3d9fe37e0f..ef9e332253 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderVelocityAdjust.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderVelocityAdjust.cs @@ -10,7 +10,6 @@ using osu.Framework.Input; using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Beatmaps; -using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.UI; using osu.Game.Screens.Edit; @@ -41,10 +40,6 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(ruleset, false); - private bool editorComponentsReady => editor.ChildrenOfType().FirstOrDefault()?.IsLoaded == true - && editor.ChildrenOfType().FirstOrDefault()?.IsLoaded == true - && editor?.ChildrenOfType().FirstOrDefault()?.IsLoaded == true; - [TestCase(true)] [TestCase(false)] public void TestVelocityChangeSavesCorrectly(bool adjustVelocity) @@ -52,7 +47,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor double? velocity = null; AddStep("enter editor", () => Game.ScreenStack.Push(new EditorLoader())); - AddUntilStep("wait for editor load", () => editorComponentsReady); + AddUntilStep("wait for editor load", () => editor?.ReadyForUse == true); AddStep("seek to first control point", () => editorClock.Seek(editorBeatmap.ControlPointInfo.TimingPoints.First().Time)); AddStep("enter slider placement mode", () => InputManager.Key(Key.Number3)); @@ -91,7 +86,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor AddStep("exit", () => InputManager.Key(Key.Escape)); AddStep("enter editor (again)", () => Game.ScreenStack.Push(new EditorLoader())); - AddUntilStep("wait for editor load", () => editorComponentsReady); + AddUntilStep("wait for editor load", () => editor?.ReadyForUse == true); AddStep("seek to slider", () => editorClock.Seek(slider.StartTime)); AddAssert("slider has correct velocity", () => slider.Velocity == velocity); diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs index fcbf63da79..b711d55e15 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs @@ -36,8 +36,6 @@ namespace osu.Game.Tests.Visual.Editing { protected override Ruleset CreateEditorRuleset() => new OsuRuleset(); - protected override bool EditorComponentsReady => Editor.ChildrenOfType().SingleOrDefault()?.IsLoaded == true; - protected override bool IsolateSavingFromDatabase => false; [Resolved] diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs index 273e8abcd7..62ca97d5e0 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs @@ -9,12 +9,10 @@ using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Database; -using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Components.Timelines.Summary; -using osu.Game.Screens.Edit.Compose.Components.Timeline; using osu.Game.Screens.Edit.GameplayTest; using osu.Game.Screens.Select; using osu.Game.Tests.Resources; @@ -40,10 +38,7 @@ namespace osu.Game.Tests.Visual.Editing AddStep("switch ruleset", () => Game.Ruleset.Value = new ManiaRuleset().RulesetInfo); AddStep("open editor", () => ((PlaySongSelect)Game.ScreenStack.CurrentScreen).Edit(beatmapSet.Beatmaps.First(beatmap => beatmap.Ruleset.OnlineID == 0))); - AddUntilStep("wait for editor open", () => Game.ScreenStack.CurrentScreen is Editor editor - && editor.IsLoaded - && editor.ChildrenOfType().FirstOrDefault()?.IsLoaded == true - && editor.ChildrenOfType().FirstOrDefault()?.IsLoaded == true); + AddUntilStep("wait for editor open", () => Game.ScreenStack.CurrentScreen is Editor editor && editor.ReadyForUse); AddStep("test gameplay", () => { var testGameplayButton = this.ChildrenOfType().Single(); diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 20bdf75b7d..9dbb5f4cfe 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -21,6 +21,7 @@ using osu.Framework.Input.Events; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Framework.Screens; +using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game.Audio; using osu.Game.Beatmaps; @@ -39,6 +40,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Screens.Edit.Components.Menus; using osu.Game.Screens.Edit.Compose; +using osu.Game.Screens.Edit.Compose.Components.Timeline; using osu.Game.Screens.Edit.Design; using osu.Game.Screens.Edit.GameplayTest; using osu.Game.Screens.Edit.Setup; @@ -97,6 +99,32 @@ namespace osu.Game.Screens.Edit public IBindable SamplePlaybackDisabled => samplePlaybackDisabled; + /// + /// Ensure all asynchronously loading pieces of the editor are in a good state. + /// This exists here for convenience for tests, not for actual use. + /// Eventually we'd probably want a better way to signal this. + /// + public bool ReadyForUse + { + get + { + if (!workingBeatmapUpdated) + return false; + + var loadedScreen = screenContainer?.Children.SingleOrDefault(s => s.IsLoaded); + + if (loadedScreen == null) + return false; + + if (loadedScreen is EditorScreenWithTimeline) + return loadedScreen.ChildrenOfType().FirstOrDefault()?.IsLoaded == true; + + return true; + } + } + + private bool workingBeatmapUpdated; + private readonly Bindable samplePlaybackDisabled = new Bindable(); private bool canSave; @@ -219,6 +247,7 @@ namespace osu.Game.Screens.Edit // this assumes that nothing during the rest of this load() method is accessing Beatmap.Value (loadableBeatmap should be preferred). // generally this is quite safe, as the actual load of editor content comes after menuBar.Mode.ValueChanged is fired in its own LoadComplete. Beatmap.Value = loadableBeatmap; + workingBeatmapUpdated = true; }); OsuMenuItem undoMenuItem; diff --git a/osu.Game/Tests/Visual/EditorTestScene.cs b/osu.Game/Tests/Visual/EditorTestScene.cs index 3f5fee5768..31036247ab 100644 --- a/osu.Game/Tests/Visual/EditorTestScene.cs +++ b/osu.Game/Tests/Visual/EditorTestScene.cs @@ -17,9 +17,7 @@ using osu.Game.Online.API; using osu.Game.Overlays; using osu.Game.Overlays.Dialog; using osu.Game.Rulesets; -using osu.Game.Rulesets.Edit; using osu.Game.Screens.Edit; -using osu.Game.Screens.Edit.Compose.Components.Timeline; using osu.Game.Screens.Menu; using osu.Game.Skinning; @@ -58,15 +56,13 @@ namespace osu.Game.Tests.Visual Dependencies.CacheAs(testBeatmapManager = new TestBeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default)); } - protected virtual bool EditorComponentsReady => Editor.ChildrenOfType().FirstOrDefault()?.IsLoaded == true - && Editor.ChildrenOfType().FirstOrDefault()?.IsLoaded == true; - public override void SetUpSteps() { base.SetUpSteps(); AddStep("load editor", LoadEditor); - AddUntilStep("wait for editor to load", () => EditorComponentsReady); + AddUntilStep("wait for editor to load", () => Editor?.ReadyForUse == true); + AddUntilStep("wait for beatmap updated", () => !Beatmap.IsDefault); } protected virtual void LoadEditor() From 13dcaf82ada9d3e1a96322c49a194da0652b525d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 16:50:07 +0900 Subject: [PATCH 1909/2328] Fix chat tests failing 1/10000 runs https://github.com/ppy/osu/blob/31a447fda0532fcf15f8c8251ca890c533386492/osu.Game/Online/Chat/ChannelManager.cs#L412-L414 Sigh. --- osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs | 4 ++-- osu.Game/Online/API/DummyAPIAccess.cs | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs index 1fb0195368..73bad6e631 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs @@ -549,7 +549,7 @@ namespace osu.Game.Tests.Visual.Online private Channel createPrivateChannel() { - int id = RNG.Next(0, 10000); + int id = RNG.Next(0, DummyAPIAccess.DUMMY_USER_ID - 1); return new Channel(new APIUser { Id = id, @@ -559,7 +559,7 @@ namespace osu.Game.Tests.Visual.Online private Channel createAnnounceChannel() { - int id = RNG.Next(0, 10000); + int id = RNG.Next(0, DummyAPIAccess.DUMMY_USER_ID - 1); return new Channel { Name = $"Announce {id}", diff --git a/osu.Game/Online/API/DummyAPIAccess.cs b/osu.Game/Online/API/DummyAPIAccess.cs index 245760a00a..07d544260e 100644 --- a/osu.Game/Online/API/DummyAPIAccess.cs +++ b/osu.Game/Online/API/DummyAPIAccess.cs @@ -15,10 +15,12 @@ namespace osu.Game.Online.API { public class DummyAPIAccess : Component, IAPIProvider { + public const int DUMMY_USER_ID = 1001; + public Bindable LocalUser { get; } = new Bindable(new APIUser { Username = @"Dummy", - Id = 1001, + Id = DUMMY_USER_ID, }); public BindableList Friends { get; } = new BindableList(); From 8c3c1f095eaf966c3cc08691531e78582ae659ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 17:04:28 +0900 Subject: [PATCH 1910/2328] Update rollback test expectations I can't find a better way to do this. It's very hard to trigger an actual failure in the import process these days. For now I've just made this work with the new assumptions. May be worth removing the test in the future if this ever backfires. --- osu.Game.Tests/Database/BeatmapImporterTests.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index be11476c73..8c28f8cedd 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; +using System.Text; using System.Threading; using System.Threading.Tasks; using NUnit.Framework; @@ -607,6 +608,12 @@ namespace osu.Game.Tests.Database using (var outStream = File.Open(brokenTempFilename, FileMode.CreateNew)) using (var zip = ZipArchive.Open(brokenOsz)) { + foreach (var entry in zip.Entries.ToArray()) + { + if (entry.Key.EndsWith(".osu", StringComparison.InvariantCulture)) + zip.RemoveEntry(entry); + } + zip.AddEntry("broken.osu", brokenOsu, false); zip.SaveTo(outStream, CompressionType.Deflate); } @@ -627,7 +634,7 @@ namespace osu.Game.Tests.Database checkSingleReferencedFileCount(realm.Realm, 18); - Assert.AreEqual(1, loggedExceptionCount); + Assert.AreEqual(0, loggedExceptionCount); File.Delete(brokenTempFilename); }); From 401d9c1baed7bc9d60a88d286566a2e8537c1aff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 17:13:46 +0900 Subject: [PATCH 1911/2328] Fix `TestStoryboardSkipOutro` occasionally failing due to strict timings --- osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs index 002e35f742..0ba8583b56 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs @@ -52,10 +52,11 @@ namespace osu.Game.Tests.Visual.Gameplay [Test] public void TestStoryboardSkipOutro() { + AddStep("set storyboard duration to long", () => currentStoryboardDuration = 200000); CreateTest(null); AddUntilStep("completion set by processor", () => Player.ScoreProcessor.HasCompleted.Value); AddStep("skip outro", () => InputManager.Key(osuTK.Input.Key.Space)); - AddAssert("player is no longer current screen", () => !Player.IsCurrentScreen()); + AddUntilStep("player is no longer current screen", () => !Player.IsCurrentScreen()); AddUntilStep("wait for score shown", () => Player.IsScoreShown); } From f6a61472c413357bd46add03f2924d0662929dfb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 17:59:40 +0900 Subject: [PATCH 1912/2328] Fix occasional failure in realm test proceedings due to incorrect `Debug.Assert` After a `BlockAllOperations`, the restoration of the `updateRealm` instance is not instance. It is posted to a `SynchronizationContext`. The assertion which has been removed in this commit was assuming it would always be an immediate operation. To ensure this works as expected, I've tracked the initialised state via a new `bool`. ```csharp System.TimeoutException : Attempting to block for migration took too long. 1) Host threw exception System.AggregateException: One or more errors occurred. (: ) ---> NUnit.Framework.AssertionException: : at osu.Framework.Logging.ThrowingTraceListener.Fail(String message1, String message2) at System.Diagnostics.TraceInternal.Fail(String message, String detailMessage) at System.Diagnostics.TraceInternal.TraceProvider.Fail(String message, String detailMessage) at System.Diagnostics.Debug.Fail(String message, String detailMessage) at osu.Game.Database.RealmAccess.BlockAllOperations() in /opt/buildagent/work/ecd860037212ac52/osu.Game/Database/RealmAccess.cs:line 813 at osu.Game.OsuGameBase.<>c__DisplayClass108_1.b__0() in /opt/buildagent/work/ecd860037212ac52/osu.Game/OsuGameBase.cs:line 449 at osu.Framework.Threading.ScheduledDelegate.RunTaskInternal() at osu.Framework.Threading.Scheduler.Update() at osu.Framework.Graphics.Drawable.UpdateSubTree() at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree() ``` https://teamcity.ppy.sh/buildConfiguration/Osu_Build/322?hideProblemsFromDependencies=false&hideTestsFromDependencies=false&expandBuildTestsSection=true --- osu.Game/Database/RealmAccess.cs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 3ea7a14826..089a783177 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -102,6 +102,12 @@ namespace osu.Game.Database private Realm? updateRealm; + /// + /// Tracks whether a realm was ever fetched from this instance. + /// After a fetch occurs, blocking operations will be guaranteed to restore any subscriptions. + /// + private bool hasInitialisedOnce; + private bool isSendingNotificationResetEvents; public Realm Realm => ensureUpdateRealm(); @@ -121,6 +127,7 @@ namespace osu.Game.Database if (updateRealm == null) { updateRealm = getRealmInstance(); + hasInitialisedOnce = true; Logger.Log(@$"Opened realm ""{updateRealm.Config.DatabasePath}"" at version {updateRealm.Config.SchemaVersion}"); @@ -806,13 +813,7 @@ namespace osu.Game.Database lock (realmLock) { - if (updateRealm == null) - { - // null realm means the update thread has not yet retrieved its instance. - // we don't need to worry about reviving the update instance in this case, so don't bother with the SynchronizationContext. - Debug.Assert(!ThreadSafety.IsUpdateThread); - } - else + if (hasInitialisedOnce) { if (!ThreadSafety.IsUpdateThread) throw new InvalidOperationException(@$"{nameof(BlockAllOperations)} must be called from the update thread."); @@ -827,12 +828,12 @@ namespace osu.Game.Database action.Value?.Dispose(); customSubscriptionsResetMap[action.Key] = null; } + + updateRealm?.Dispose(); + updateRealm = null; } Logger.Log(@"Blocking realm operations.", LoggingTarget.Database); - - updateRealm?.Dispose(); - updateRealm = null; } const int sleep_length = 200; From 5af1106fa5f0e9f49cadbbca052c3ee5d65d2df5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 18:04:52 +0900 Subject: [PATCH 1913/2328] Remove unused using statement --- osu.Game.Tests/Database/BeatmapImporterTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index 8c28f8cedd..6f5a79c9da 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; using NUnit.Framework; From 0ba29b6fa64eac5a908903fbbfbe0270662879a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 18:28:00 +0900 Subject: [PATCH 1914/2328] Use `currentScreen` instead to make sure the screen we care about is loaded --- osu.Game/Screens/Edit/Editor.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 9dbb5f4cfe..81ae08aea1 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -111,13 +111,11 @@ namespace osu.Game.Screens.Edit if (!workingBeatmapUpdated) return false; - var loadedScreen = screenContainer?.Children.SingleOrDefault(s => s.IsLoaded); - - if (loadedScreen == null) + if (currentScreen?.IsLoaded != true) return false; - if (loadedScreen is EditorScreenWithTimeline) - return loadedScreen.ChildrenOfType().FirstOrDefault()?.IsLoaded == true; + if (currentScreen is EditorScreenWithTimeline) + return currentScreen.ChildrenOfType().FirstOrDefault()?.IsLoaded == true; return true; } From 50c1c066deff819c782f77e6bcd1814ed8b3b2a5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 18:41:27 +0900 Subject: [PATCH 1915/2328] Add various logging of global `WorkingBeatmap` state changes --- osu.Game/OsuGame.cs | 6 ++++++ osu.Game/Overlays/MusicController.cs | 3 +++ osu.Game/Screens/Menu/MainMenu.cs | 3 +++ osu.Game/Screens/Select/SongSelect.cs | 7 +++++-- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index f51a18b36f..1458af1ea1 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -486,6 +486,7 @@ namespace osu.Game /// public void PresentBeatmap(IBeatmapSetInfo beatmap, Predicate difficultyCriteria = null) { + Logger.Log($"Beginning {nameof(PresentBeatmap)} with beatmap {beatmap}"); Live databasedSet = null; if (beatmap.OnlineID > 0) @@ -522,6 +523,7 @@ namespace osu.Game } else { + Logger.Log($"Completing {nameof(PresentBeatmap)} with beatmap {beatmap} ruleset {selection.Ruleset}"); Ruleset.Value = selection.Ruleset; Beatmap.Value = BeatmapManager.GetWorkingBeatmap(selection); } @@ -534,6 +536,8 @@ namespace osu.Game /// public void PresentScore(IScoreInfo score, ScorePresentType presentType = ScorePresentType.Results) { + Logger.Log($"Beginning {nameof(PresentScore)} with score {score}"); + // The given ScoreInfo may have missing properties if it was retrieved from online data. Re-retrieve it from the database // to ensure all the required data for presenting a replay are present. ScoreInfo databasedScoreInfo = null; @@ -568,6 +572,8 @@ namespace osu.Game PerformFromScreen(screen => { + Logger.Log($"{nameof(PresentScore)} updating beatmap ({databasedBeatmap}) and ruleset ({databasedScore.ScoreInfo.Ruleset} to match score"); + Ruleset.Value = databasedScore.ScoreInfo.Ruleset; Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap); diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index bce7e9b797..1c2c9f2b48 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -14,6 +14,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Audio; using osu.Framework.Graphics.Containers; +using osu.Framework.Logging; using osu.Framework.Threading; using osu.Game.Beatmaps; using osu.Game.Database; @@ -106,10 +107,12 @@ namespace osu.Game.Overlays if (beatmap.Disabled) return; + Logger.Log($"{nameof(MusicController)} skipping to next track to {nameof(EnsurePlayingSomething)}"); NextTrack(); } else if (!IsPlaying) { + Logger.Log($"{nameof(MusicController)} starting playback to {nameof(EnsurePlayingSomething)}"); Play(); } } diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 6a74a6bd6e..ba63902b46 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -10,6 +10,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; +using osu.Framework.Logging; using osu.Framework.Platform; using osu.Framework.Screens; using osu.Game.Beatmaps; @@ -302,6 +303,8 @@ namespace osu.Game.Screens.Menu public void PresentBeatmap(WorkingBeatmap beatmap, RulesetInfo ruleset) { + Logger.Log($"{nameof(MainMenu)} completing {nameof(PresentBeatmap)} with beatmap {beatmap} ruleset {ruleset}"); + Beatmap.Value = beatmap; Ruleset.Value = ruleset; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 41fb55a856..b89acfa570 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -494,7 +494,7 @@ namespace osu.Game.Screens.Select // clear pending task immediately to track any potential nested debounce operation. selectionChangedDebounce = null; - Logger.Log($"updating selection with beatmap:{beatmap?.ID.ToString() ?? "null"} ruleset:{ruleset?.ShortName ?? "null"}"); + Logger.Log($"Song select updating selection with beatmap:{beatmap?.ID.ToString() ?? "null"} ruleset:{ruleset?.ShortName ?? "null"}"); if (transferRulesetValue()) { @@ -519,7 +519,7 @@ namespace osu.Game.Screens.Select // In these cases, the other component has already loaded the beatmap, so we don't need to do so again. if (!EqualityComparer.Default.Equals(beatmap, Beatmap.Value.BeatmapInfo)) { - Logger.Log($"beatmap changed from \"{Beatmap.Value.BeatmapInfo}\" to \"{beatmap}\""); + Logger.Log($"Song select changing beatmap from \"{Beatmap.Value.BeatmapInfo}\" to \"{beatmap?.ToString() ?? "null"}\""); Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap); } @@ -737,7 +737,10 @@ namespace osu.Game.Screens.Select bool isNewTrack = !lastTrack.TryGetTarget(out var last) || last != track; if (!track.IsRunning && (music.UserPauseRequested != true || isNewTrack)) + { + Logger.Log($"Song select decided to {nameof(ensurePlayingSelected)}"); music.Play(true); + } lastTrack.SetTarget(track); } From 1fc4fa68204c5cb3e9b1a02509ab5afcebdc4638 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 19:20:15 +0900 Subject: [PATCH 1916/2328] Remove unnecessary `Task.Run` workaround in tests --- .../Database/RealmSubscriptionRegistrationTests.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/osu.Game.Tests/Database/RealmSubscriptionRegistrationTests.cs b/osu.Game.Tests/Database/RealmSubscriptionRegistrationTests.cs index b8ce036da1..c74341b5c9 100644 --- a/osu.Game.Tests/Database/RealmSubscriptionRegistrationTests.cs +++ b/osu.Game.Tests/Database/RealmSubscriptionRegistrationTests.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading; -using System.Threading.Tasks; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Extensions; @@ -84,11 +83,7 @@ namespace osu.Game.Tests.Database realm.Run(r => r.Refresh()); - // Without forcing the write onto its own thread, realm will internally run the operation synchronously, which can cause a deadlock with `WaitSafely`. - Task.Run(async () => - { - await realm.WriteAsync(r => r.Add(TestResources.CreateTestBeatmapSetInfo())); - }).WaitSafely(); + realm.WriteAsync(r => r.Add(TestResources.CreateTestBeatmapSetInfo())).WaitSafely(); realm.Run(r => r.Refresh()); From c39c99bd43ce32f1f58ac274703e9dd3f542bcf6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 19:20:28 +0900 Subject: [PATCH 1917/2328] Ensure all async writes are completed before realm is disposed --- osu.Game/Database/RealmAccess.cs | 42 +++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 089a783177..2618fe373e 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -388,26 +388,43 @@ namespace osu.Game.Database } } + private readonly CountdownEvent pendingAsyncWrites = new CountdownEvent(0); + /// /// Write changes to realm asynchronously, guaranteeing order of execution. /// /// The work to run. public Task WriteAsync(Action action) { - // Regardless of calling Realm.GetInstance or Realm.GetInstanceAsync, there is a blocking overhead on retrieval. - // Adding a forced Task.Run resolves this. + // Required to ensure the write is tracked and accounted for before disposal. + // Can potentially be avoided if we have a need to do so in the future. + if (!ThreadSafety.IsUpdateThread) + throw new InvalidOperationException(@$"{nameof(WriteAsync)} must be called from the update thread."); - return Task.Run(async () => + lock (realmLock) { - total_writes_async.Value++; + // CountdownEvent will fail if already at zero. + if (!pendingAsyncWrites.TryAddCount()) + pendingAsyncWrites.Reset(1); - // Not attempting to use Realm.GetInstanceAsync as there's seemingly no benefit to us (for now) and it adds complexity due to locking - // concerns in getRealmInstance(). On a quick check, it looks to be more suited to cases where realm is connecting to an online sync - // server, which we don't use. May want to report upstream or revisit in the future. - using (var realm = getRealmInstance()) - // ReSharper disable once AccessToDisposedClosure (WriteAsync should be marked as [InstantHandle]). - await realm.WriteAsync(() => action(realm)); - }); + // Regardless of calling Realm.GetInstance or Realm.GetInstanceAsync, there is a blocking overhead on retrieval. + // Adding a forced Task.Run resolves this. + var writeTask = Task.Run(async () => + { + total_writes_async.Value++; + + // Not attempting to use Realm.GetInstanceAsync as there's seemingly no benefit to us (for now) and it adds complexity due to locking + // concerns in getRealmInstance(). On a quick check, it looks to be more suited to cases where realm is connecting to an online sync + // server, which we don't use. May want to report upstream or revisit in the future. + using (var realm = getRealmInstance()) + // ReSharper disable once AccessToDisposedClosure (WriteAsync should be marked as [InstantHandle]). + await realm.WriteAsync(() => action(realm)); + + pendingAsyncWrites.Signal(); + }); + + return writeTask; + } } /// @@ -910,6 +927,9 @@ namespace osu.Game.Database public void Dispose() { + if (!pendingAsyncWrites.Wait(10000)) + Logger.Log("Realm took too long waiting on pending async writes", level: LogLevel.Error); + lock (realmLock) { updateRealm?.Dispose(); From 83982d258d96590722da57126219dfc1c920a7fb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 19:34:28 +0900 Subject: [PATCH 1918/2328] Throw immediately if attempting to `WriteAsync` after disposed --- osu.Game/Database/RealmAccess.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 2618fe373e..7a9561fc5e 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -396,6 +396,9 @@ namespace osu.Game.Database /// The work to run. public Task WriteAsync(Action action) { + if (isDisposed) + throw new ObjectDisposedException(nameof(RealmAccess)); + // Required to ensure the write is tracked and accounted for before disposal. // Can potentially be avoided if we have a need to do so in the future. if (!ThreadSafety.IsUpdateThread) From 62038850406fe5cccd1151cca141c1adb802ef1f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 19:34:42 +0900 Subject: [PATCH 1919/2328] Add test coverage of realm async writes --- osu.Game.Tests/Database/GeneralUsageTests.cs | 61 ++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/osu.Game.Tests/Database/GeneralUsageTests.cs b/osu.Game.Tests/Database/GeneralUsageTests.cs index 65f805bafb..db6e97dab2 100644 --- a/osu.Game.Tests/Database/GeneralUsageTests.cs +++ b/osu.Game.Tests/Database/GeneralUsageTests.cs @@ -2,11 +2,14 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Linq; using System.Threading; using System.Threading.Tasks; using NUnit.Framework; +using osu.Framework.Extensions; using osu.Game.Beatmaps; using osu.Game.Database; +using osu.Game.Tests.Resources; namespace osu.Game.Tests.Database { @@ -33,6 +36,64 @@ namespace osu.Game.Tests.Database }); } + [Test] + public void TestAsyncWriteAsync() + { + RunTestWithRealmAsync(async (realm, _) => + { + await realm.WriteAsync(r => r.Add(TestResources.CreateTestBeatmapSetInfo())); + + realm.Run(r => r.Refresh()); + + Assert.That(realm.Run(r => r.All().Count()), Is.EqualTo(1)); + }); + } + + [Test] + public void TestAsyncWrite() + { + RunTestWithRealm((realm, _) => + { + realm.WriteAsync(r => r.Add(TestResources.CreateTestBeatmapSetInfo())).WaitSafely(); + + realm.Run(r => r.Refresh()); + + Assert.That(realm.Run(r => r.All().Count()), Is.EqualTo(1)); + }); + } + + [Test] + public void TestAsyncWriteAfterDisposal() + { + RunTestWithRealm((realm, _) => + { + realm.Dispose(); + Assert.ThrowsAsync(() => realm.WriteAsync(r => r.Add(TestResources.CreateTestBeatmapSetInfo()))); + }); + } + + [Test] + public void TestAsyncWriteBeforeDisposal() + { + ManualResetEventSlim resetEvent = new ManualResetEventSlim(); + + RunTestWithRealm((realm, _) => + { + var writeTask = realm.WriteAsync(r => + { + // ensure that disposal blocks for our execution + Assert.That(resetEvent.Wait(100), Is.False); + + r.Add(TestResources.CreateTestBeatmapSetInfo()); + }); + + realm.Dispose(); + resetEvent.Set(); + + writeTask.WaitSafely(); + }); + } + /// /// Test to ensure that a `CreateContext` call nested inside a subscription doesn't cause any deadlocks /// due to context fetching semaphores. From aa7d54f8b6c31fd7e485721da2de000b4855414e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jun 2022 20:10:15 +0900 Subject: [PATCH 1920/2328] Add logging for various cases of `SongSelect.FinaliseSelection` being aborted --- .../OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs | 4 ++++ osu.Game/Screens/Select/SongSelect.cs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs index 0f589a8b35..dbd679104e 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSongSelect.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Logging; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; @@ -78,7 +79,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer protected override bool SelectItem(PlaylistItem item) { if (operationInProgress.Value) + { + Logger.Log($"{nameof(SelectedItem)} aborted due to {nameof(operationInProgress)}"); return false; + } // If the client is already in a room, update via the client. // Otherwise, update the playlist directly in preparation for it to be submitted to the API on match creation. diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 41fb55a856..4e45abab3f 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -360,7 +360,10 @@ namespace osu.Game.Screens.Select { // This is very important as we have not yet bound to screen-level bindables before the carousel load is completed. if (!Carousel.BeatmapSetsLoaded) + { + Logger.Log($"{nameof(FinaliseSelection)} aborted as carousel beatmaps are not yet loaded"); return; + } if (ruleset != null) Ruleset.Value = ruleset; From 6c6de9ce533d5cd99b38390b396cabdc3ec34e9f Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 27 Jun 2022 20:40:02 +0900 Subject: [PATCH 1921/2328] Fix typo --- osu.Game/Overlays/MusicController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 1c2c9f2b48..4a10f30a7a 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -107,7 +107,7 @@ namespace osu.Game.Overlays if (beatmap.Disabled) return; - Logger.Log($"{nameof(MusicController)} skipping to next track to {nameof(EnsurePlayingSomething)}"); + Logger.Log($"{nameof(MusicController)} skipping next track to {nameof(EnsurePlayingSomething)}"); NextTrack(); } else if (!IsPlaying) From 3e3843dcf9a8a943f730a3e74ca2cd5f44dd20c8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 00:32:36 +0900 Subject: [PATCH 1922/2328] Fix potential crash on `CloseAllOverlays` due to collection mutation --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 7f4e4af455..01f0b09a3e 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -249,7 +249,7 @@ namespace osu.Game /// Whether the toolbar should also be hidden. public void CloseAllOverlays(bool hideToolbar = true) { - foreach (var overlay in focusedOverlays) + foreach (var overlay in focusedOverlays.ToArray()) overlay.Hide(); if (hideToolbar) Toolbar.Hide(); From b28cfc222b22a417f69f6449f36465c5a20cb385 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 01:19:20 +0900 Subject: [PATCH 1923/2328] Schedule unregister instead --- osu.Game/OsuGame.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 01f0b09a3e..ef42522f9d 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -231,7 +231,7 @@ namespace osu.Game /// /// Unregisters a blocking that was not created by itself. /// - private void unregisterBlockingOverlay(OverlayContainer overlayContainer) + private void unregisterBlockingOverlay(OverlayContainer overlayContainer) => Schedule(() => { externalOverlays.Remove(overlayContainer); @@ -239,7 +239,7 @@ namespace osu.Game focusedOverlays.Remove(focusedOverlayContainer); overlayContainer.Expire(); - } + }); #endregion @@ -249,7 +249,7 @@ namespace osu.Game /// Whether the toolbar should also be hidden. public void CloseAllOverlays(bool hideToolbar = true) { - foreach (var overlay in focusedOverlays.ToArray()) + foreach (var overlay in focusedOverlays) overlay.Hide(); if (hideToolbar) Toolbar.Hide(); From 569fde4b47976898cf1df4cd5965e54af7caa238 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 01:34:24 +0900 Subject: [PATCH 1924/2328] Add messages to all `InvalidOperationException`s Without this, they can be very non-descript and hard to track down --- osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs | 8 ++++---- osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs | 8 ++++---- .../Visual/SongSelect/TestSceneAdvancedStats.cs | 2 +- osu.Game/Online/API/Requests/Responses/APIScore.cs | 2 +- osu.Game/Online/Rooms/MultiplayerScore.cs | 2 +- .../Profile/Sections/Ranks/DrawableProfileScore.cs | 2 +- osu.Game/Screens/Edit/EditorBeatmap.cs | 2 +- osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs index a779fae510..14da07bc2d 100644 --- a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs +++ b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs @@ -83,14 +83,14 @@ namespace osu.Game.Tests.NonVisual public override event Action NewResult { - add => throw new InvalidOperationException(); - remove => throw new InvalidOperationException(); + add => throw new InvalidOperationException($"{nameof(NewResult)} operations not supported in test context"); + remove => throw new InvalidOperationException($"{nameof(NewResult)} operations not supported in test context"); } public override event Action RevertResult { - add => throw new InvalidOperationException(); - remove => throw new InvalidOperationException(); + add => throw new InvalidOperationException($"{nameof(RevertResult)} operations not supported in test context"); + remove => throw new InvalidOperationException($"{nameof(RevertResult)} operations not supported in test context"); } public override Playfield Playfield { get; } diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs index 70d7f6a28b..707f807e64 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs @@ -273,14 +273,14 @@ namespace osu.Game.Tests.Visual.Gameplay public override event Action NewResult { - add => throw new InvalidOperationException(); - remove => throw new InvalidOperationException(); + add => throw new InvalidOperationException($"{nameof(NewResult)} operations not supported in test context"); + remove => throw new InvalidOperationException($"{nameof(NewResult)} operations not supported in test context"); } public override event Action RevertResult { - add => throw new InvalidOperationException(); - remove => throw new InvalidOperationException(); + add => throw new InvalidOperationException($"{nameof(RevertResult)} operations not supported in test context"); + remove => throw new InvalidOperationException($"{nameof(RevertResult)} operations not supported in test context"); } public override Playfield Playfield { get; } diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs index 77670c38f3..4510fda11d 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs @@ -70,7 +70,7 @@ namespace osu.Game.Tests.Visual.SongSelect { AddStep("set beatmap", () => advancedStats.BeatmapInfo = new BeatmapInfo { - Ruleset = rulesets.GetRuleset(3) ?? throw new InvalidOperationException(), + Ruleset = rulesets.GetRuleset(3) ?? throw new InvalidOperationException("osu!mania ruleset not found"), Difficulty = new BeatmapDifficulty { CircleSize = 5, diff --git a/osu.Game/Online/API/Requests/Responses/APIScore.cs b/osu.Game/Online/API/Requests/Responses/APIScore.cs index 1b56362aec..f236607761 100644 --- a/osu.Game/Online/API/Requests/Responses/APIScore.cs +++ b/osu.Game/Online/API/Requests/Responses/APIScore.cs @@ -88,7 +88,7 @@ namespace osu.Game.Online.API.Requests.Responses /// public ScoreInfo CreateScoreInfo(RulesetStore rulesets, BeatmapInfo beatmap = null) { - var ruleset = rulesets.GetRuleset(RulesetID) ?? throw new InvalidOperationException(); + var ruleset = rulesets.GetRuleset(RulesetID) ?? throw new InvalidOperationException($"Ruleset with ID of {RulesetID} not found locally"); var rulesetInstance = ruleset.CreateInstance(); diff --git a/osu.Game/Online/Rooms/MultiplayerScore.cs b/osu.Game/Online/Rooms/MultiplayerScore.cs index 13f14bca5b..6f597e5b10 100644 --- a/osu.Game/Online/Rooms/MultiplayerScore.cs +++ b/osu.Game/Online/Rooms/MultiplayerScore.cs @@ -79,7 +79,7 @@ namespace osu.Game.Online.Rooms TotalScore = TotalScore, MaxCombo = MaxCombo, BeatmapInfo = beatmap, - Ruleset = rulesets.GetRuleset(playlistItem.RulesetID) ?? throw new InvalidOperationException(), + Ruleset = rulesets.GetRuleset(playlistItem.RulesetID) ?? throw new InvalidOperationException($"Ruleset with ID of {playlistItem.RulesetID} not found locally"), Statistics = Statistics, User = User, Accuracy = Accuracy, diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs index 54a262f6a6..90a357a281 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs @@ -136,7 +136,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks Spacing = new Vector2(2), Children = Score.Mods.Select(mod => { - var ruleset = rulesets.GetRuleset(Score.RulesetID) ?? throw new InvalidOperationException(); + var ruleset = rulesets.GetRuleset(Score.RulesetID) ?? throw new InvalidOperationException($"Ruleset with ID of {Score.RulesetID} not found locally"); return new ModIcon(ruleset.CreateInstance().CreateModFromAcronym(mod.Acronym)) { diff --git a/osu.Game/Screens/Edit/EditorBeatmap.cs b/osu.Game/Screens/Edit/EditorBeatmap.cs index 0a6f9974b0..96425e8bc8 100644 --- a/osu.Game/Screens/Edit/EditorBeatmap.cs +++ b/osu.Game/Screens/Edit/EditorBeatmap.cs @@ -122,7 +122,7 @@ namespace osu.Game.Screens.Edit public BeatmapInfo BeatmapInfo { get => beatmapInfo; - set => throw new InvalidOperationException(); + set => throw new InvalidOperationException($"Can't set {nameof(BeatmapInfo)} on {nameof(EditorBeatmap)}"); } public BeatmapMetadata Metadata => beatmapInfo.Metadata; diff --git a/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs b/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs index fc29c5aac5..db1d94aee2 100644 --- a/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs +++ b/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs @@ -134,7 +134,7 @@ namespace osu.Game.Tests.Visual.Spectator FrameSendAttempts++; if (ShouldFailSendingFrames) - return Task.FromException(new InvalidOperationException()); + return Task.FromException(new InvalidOperationException($"Intentional fail via {ShouldFailSendingFrames}")); return ((ISpectatorClient)this).UserSentFrames(api.LocalUser.Value.Id, bundle); } From 54fe6b7df3ae62e0dc7a61f28ef0e3ff85aee06e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 01:43:09 +0900 Subject: [PATCH 1925/2328] Fix incorrect string interpolation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs b/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs index db1d94aee2..2531f3c485 100644 --- a/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs +++ b/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs @@ -134,7 +134,7 @@ namespace osu.Game.Tests.Visual.Spectator FrameSendAttempts++; if (ShouldFailSendingFrames) - return Task.FromException(new InvalidOperationException($"Intentional fail via {ShouldFailSendingFrames}")); + return Task.FromException(new InvalidOperationException($"Intentional fail via {nameof(ShouldFailSendingFrames)}")); return ((ISpectatorClient)this).UserSentFrames(api.LocalUser.Value.Id, bundle); } From 1a0228415d526599dbba42ba8cc08ba767142367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 27 Jun 2022 22:26:00 +0200 Subject: [PATCH 1926/2328] Wait for and dismiss notification in editor navigation test --- osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs index 62ca97d5e0..a21ef6f897 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs @@ -9,6 +9,7 @@ using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Database; +using osu.Game.Overlays.Notifications; using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Edit; @@ -35,6 +36,8 @@ namespace osu.Game.Tests.Visual.Editing () => Game.Beatmap.Value.BeatmapSetInfo.Equals(beatmapSet) && Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect && songSelect.IsLoaded); + AddUntilStep("wait for completion notification", () => Game.Notifications.ChildrenOfType().Count() == 1); + AddStep("dismiss notifications", () => Game.Notifications.Hide()); AddStep("switch ruleset", () => Game.Ruleset.Value = new ManiaRuleset().RulesetInfo); AddStep("open editor", () => ((PlaySongSelect)Game.ScreenStack.CurrentScreen).Edit(beatmapSet.Beatmaps.First(beatmap => beatmap.Ruleset.OnlineID == 0))); From c1075d113fb13b586a216444946057f936c8d86a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 13:58:35 +0900 Subject: [PATCH 1927/2328] Add logging around current channel changes and join requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tracking down a flaky test (https://teamcity.ppy.sh/buildConfiguration/Osu_Build/553?hideProblemsFromDependencies=false&expandBuildTestsSection=true&hideTestsFromDependencies=false): ```csharp TearDown : System.TimeoutException : "PM Channel 1 displayed" timed out --TearDown at osu.Framework.Testing.Drawables.Steps.UntilStepButton.<>c__DisplayClass11_0.<.ctor>b__0() at osu.Framework.Testing.Drawables.Steps.StepButton.PerformStep(Boolean userTriggered) at osu.Framework.Testing.TestScene.runNextStep(Action onCompletion, Action`1 onError, Func`2 stopCondition) --- End of stack trace from previous location --- at osu.Framework.Testing.TestSceneTestRunner.TestRunner.RunTestBlocking(TestScene test) at osu.Game.Tests.Visual.OsuTestScene.OsuTestSceneTestRunner.RunTestBlocking(TestScene test) in /opt/buildagent/work/ecd860037212ac52/osu.Game/Tests/Visual/OsuTestScene.cs:line 503 at osu.Framework.Testing.TestScene.RunTestsFromNUnit() ------- Stdout: ------- [runtime] 2022-06-27 23:18:55 [verbose]: 💨 Class: TestSceneChatOverlay [runtime] 2022-06-27 23:18:55 [verbose]: 🔶 Test: TestKeyboardNextChannel [runtime] 2022-06-27 23:18:55 [verbose]: Chat is now polling every 60000 ms [runtime] 2022-06-27 23:18:55 [verbose]: 🔸 Step #1 Setup request handler [runtime] 2022-06-27 23:18:55 [verbose]: 🔸 Step #2 Add test channels [runtime] 2022-06-27 23:18:55 [verbose]: 🔸 Step #3 Show overlay with channels [runtime] 2022-06-27 23:18:55 [verbose]: Unhandled Request Type: osu.Game.Online.API.Requests.CreateChannelRequest [network] 2022-06-27 23:18:55 [verbose]: Failing request osu.Game.Online.API.Requests.CreateChannelRequest (System.InvalidOperationException: DummyAPIAccess cannot process this request.) [runtime] 2022-06-27 23:18:55 [verbose]: Unhandled Request Type: osu.Game.Online.API.Requests.CreateChannelRequest [network] 2022-06-27 23:18:55 [verbose]: Failing request osu.Game.Online.API.Requests.CreateChannelRequest (System.InvalidOperationException: DummyAPIAccess cannot process this request.) [runtime] 2022-06-27 23:18:55 [verbose]: 🔸 Step #4 Select channel 1 [runtime] 2022-06-27 23:18:55 [verbose]: 🔸 Step #5 Channel 1 is visible [runtime] 2022-06-27 23:18:55 [verbose]: 🔸 Step #6 Press document next keys [runtime] 2022-06-27 23:18:55 [verbose]: 🔸 Step #7 Channel 2 is visible [runtime] 2022-06-27 23:18:55 [verbose]: 🔸 Step #8 Press document next keys [runtime] 2022-06-27 23:18:55 [verbose]: 🔸 Step #9 PM Channel 1 displayed [network] 2022-06-27 23:18:55 [verbose]: Request to https://a.ppy.sh/587 failed with System.Net.WebException: NotFound. [network] 2022-06-27 23:18:55 [verbose]: Request to https://a.ppy.sh/503 failed with System.Net.WebException: NotFound. [runtime] 2022-06-27 23:19:05 [verbose]: 💥 Failed (on attempt 5,550) [runtime] 2022-06-27 23:19:05 [verbose]: ⏳ Currently loading components (0) [runtime] 2022-06-27 23:19:05 [verbose]: 🧵 Task schedulers [runtime] 2022-06-27 23:19:05 [verbose]: LoadComponentsAsync (standard) concurrency:4 running:0 pending:0 [runtime] 2022-06-27 23:19:05 [verbose]: LoadComponentsAsync (long load) concurrency:4 running:0 pending:0 [runtime] 2022-06-27 23:19:05 [verbose]: 🎱 Thread pool [runtime] 2022-06-27 23:19:05 [verbose]: worker: min 1 max 32,767 available 32,766 [runtime] 2022-06-27 23:19:05 [verbose]: completion: min 1 max 1,000 available 1,000 [runtime] 2022-06-27 23:19:05 [debug]: Focus on "ChatTextBox" no longer valid as a result of unfocusIfNoLongerValid. [runtime] 2022-06-27 23:19:05 [debug]: Focus changed from ChatTextBox to nothing. ``` This kind of logging should be helpful: ```csharp [runtime] 2022-06-28 04:59:57 [verbose]: 🔸 Step #5 Channel 1 is visible [runtime] 2022-06-28 04:59:57 [verbose]: 🔸 Step #6 Press document next keys [runtime] 2022-06-28 04:59:57 [verbose]: Current channel changed to #channel-2 [runtime] 2022-06-28 04:59:57 [debug]: Pressed (DocumentNext) handled by TestSceneChatOverlay+TestChatOverlay. [runtime] 2022-06-28 04:59:57 [debug]: KeyDownEvent(PageDown, False) handled by ManualInputManager+LocalPlatformActionContainer. [runtime] 2022-06-28 04:59:57 [verbose]: 🔸 Step #7 Channel 2 is visible [runtime] 2022-06-28 04:59:57 [verbose]: 🔸 Step #8 Press document next keys [runtime] 2022-06-28 04:59:57 [verbose]: Current channel changed to test user 685 [runtime] 2022-06-28 04:59:57 [debug]: Pressed (DocumentNext) handled by TestSceneChatOverlay+TestChatOverlay. [runtime] 2022-06-28 04:59:57 [debug]: KeyDownEvent(PageDown, False) handled by ManualInputManager+LocalPlatformActionContainer. [runtime] 2022-06-28 04:59:57 [verbose]: 🔸 Step #9 PM Channel 1 displayed [runtime] 2022-06-28 04:59:57 [verbose]: 🔸 Step #10 Press document next keys [runtime] 2022-06-28 04:59:57 [verbose]: Current channel changed to test user 218 ``` --- .../Visual/Online/TestSceneChatOverlay.cs | 2 +- osu.Game/Online/Chat/ChannelManager.cs | 30 +++++++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs index 73bad6e631..ff2817c439 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs @@ -472,8 +472,8 @@ namespace osu.Game.Tests.Visual.Online }); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); - waitForChannel1Visible(); + AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext)); waitForChannel2Visible(); diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 48dfaadfa5..ec84b0643d 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -133,12 +133,14 @@ namespace osu.Game.Online.Chat ?? JoinChannel(new Channel(user)); } - private void currentChannelChanged(ValueChangedEvent e) + private void currentChannelChanged(ValueChangedEvent channel) { - bool isSelectorChannel = e.NewValue is ChannelListing.ChannelListingChannel; + bool isSelectorChannel = channel.NewValue is ChannelListing.ChannelListingChannel; if (!isSelectorChannel) - JoinChannel(e.NewValue); + JoinChannel(channel.NewValue); + + Logger.Log($"Current channel changed to {channel.NewValue}"); } /// @@ -447,9 +449,17 @@ namespace osu.Game.Online.Chat return channel; case ChannelType.PM: + Logger.Log($"Attempting to join PM channel {channel}"); + var createRequest = new CreateChannelRequest(channel); + createRequest.Failure += e => + { + Logger.Log($"Failed to join PM channel {channel} ({e.Message})"); + }; createRequest.Success += resChannel => { + Logger.Log($"Joined PM channel {channel} ({resChannel.ChannelID})"); + if (resChannel.ChannelID.HasValue) { channel.Id = resChannel.ChannelID.Value; @@ -463,9 +473,19 @@ namespace osu.Game.Online.Chat break; default: + Logger.Log($"Attempting to join public channel {channel}"); + var req = new JoinChannelRequest(channel); - req.Success += () => joinChannel(channel, fetchInitialMessages); - req.Failure += _ => LeaveChannel(channel); + req.Success += () => + { + Logger.Log($"Joined public channel {channel}"); + joinChannel(channel, fetchInitialMessages); + }; + req.Failure += e => + { + Logger.Log($"Failed to join public channel {channel} ({e.Message})"); + LeaveChannel(channel); + }; api.Queue(req); return channel; } From a2701a32055c752fb2ce6c8a937623b69da583b6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 14:58:33 +0900 Subject: [PATCH 1928/2328] Increase leaniences on `TestSceneSpectatorPlayback.TestWithSendFailure` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not really sure how to improve this further, but should help with cases like this: ```csharp [runtime] 2022-06-28 05:32:06 [verbose]: 💨 Class: TestSceneSpectatorPlayback [runtime] 2022-06-28 05:32:06 [verbose]: 🔶 Test: TestWithSendFailure [runtime] 2022-06-28 05:32:06 [verbose]: 🔸 Step #1 Setup containers [runtime] 2022-06-28 05:32:06 [verbose]: Received 1 new frames (total 1 of 2) [runtime] 2022-06-28 05:32:06 [verbose]: 🔸 Step #2 received frames [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 7 of 8) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 13 of 19) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 19 of 29) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 25 of 44) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 31 of 45) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 37 of 59) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 43 of 67) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 49 of 125) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 55 of 126) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 61 of 127) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 67 of 128) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 73 of 129) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 79 of 130) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 85 of 131) [runtime] 2022-06-28 05:32:06 [verbose]: ✔️ 22 repetitions [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 91 of 132) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 97 of 133) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 103 of 134) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 109 of 135) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 115 of 136) [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 121 of 137) [runtime] 2022-06-28 05:32:06 [verbose]: 🔸 Step #3 start failing sends [runtime] 2022-06-28 05:32:06 [verbose]: Received 6 new frames (total 127 of 138) [runtime] 2022-06-28 05:32:06 [verbose]: 🔸 Step #4 wait for send attempts [runtime] 2022-06-28 05:32:06 [verbose]: 🔸 Step #5 frames did not increase [runtime] 2022-06-28 05:32:06 [verbose]: 💥 Failed [runtime] 2022-06-28 05:32:06 [verbose]: ⏳ Currently loading components (0) [runtime] 2022-06-28 05:32:06 [verbose]: 🧵 Task schedulers [runtime] 2022-06-28 05:32:06 [verbose]: LoadComponentsAsync (standard) concurrency:4 running:0 pending:0 [runtime] 2022-06-28 05:32:06 [verbose]: LoadComponentsAsync (long load) concurrency:4 running:0 pending:0 [runtime] 2022-06-28 05:32:06 [verbose]: 🎱 Thread pool [runtime] 2022-06-28 05:32:06 [verbose]: worker: min 1 max 32,767 available 32,766 [runtime] 2022-06-28 05:32:06 [verbose]: completion: min 1 max 1,000 available 1,000 [runtime] 2022-06-28 05:32:06 [verbose]: Host execution state changed to Stopping ``` https://teamcity.ppy.sh/buildConfiguration/Osu_Build/811?hideProblemsFromDependencies=false&hideTestsFromDependencies=false&expandBuildTestsSection=true --- .../Visual/Gameplay/TestSceneSpectatorPlayback.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs index 1e517efef2..5fad661e9b 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs @@ -167,11 +167,16 @@ namespace osu.Game.Tests.Visual.Gameplay AddStep("start failing sends", () => { spectatorClient.ShouldFailSendingFrames = true; - framesReceivedSoFar = replay.Frames.Count; frameSendAttemptsSoFar = spectatorClient.FrameSendAttempts; }); - AddUntilStep("wait for send attempts", () => spectatorClient.FrameSendAttempts > frameSendAttemptsSoFar + 5); + AddUntilStep("wait for next send attempt", () => + { + framesReceivedSoFar = replay.Frames.Count; + return spectatorClient.FrameSendAttempts > frameSendAttemptsSoFar + 1; + }); + + AddUntilStep("wait for more send attempts", () => spectatorClient.FrameSendAttempts > frameSendAttemptsSoFar + 10); AddAssert("frames did not increase", () => framesReceivedSoFar == replay.Frames.Count); AddStep("stop failing sends", () => spectatorClient.ShouldFailSendingFrames = false); From 22b254e5c5ce9aee62f21f0863394f26e1212a2c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 15:09:28 +0900 Subject: [PATCH 1929/2328] Handle task exception outside of schedule to avoid unobserved exceptions --- osu.Game/Online/Spectator/SpectatorClient.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/osu.Game/Online/Spectator/SpectatorClient.cs b/osu.Game/Online/Spectator/SpectatorClient.cs index 4a43aa6c66..08e1e78d86 100644 --- a/osu.Game/Online/Spectator/SpectatorClient.cs +++ b/osu.Game/Online/Spectator/SpectatorClient.cs @@ -294,17 +294,21 @@ namespace osu.Game.Online.Spectator lastSend = tcs.Task; - SendFramesInternal(bundle).ContinueWith(t => Schedule(() => + SendFramesInternal(bundle).ContinueWith(t => { + // Handle exception outside of `Schedule` to ensure it doesn't go unovserved. bool wasSuccessful = t.Exception == null; - // If the last bundle send wasn't successful, try again without dequeuing. - if (wasSuccessful) - pendingFrameBundles.Dequeue(); + return Schedule(() => + { + // If the last bundle send wasn't successful, try again without dequeuing. + if (wasSuccessful) + pendingFrameBundles.Dequeue(); - tcs.SetResult(wasSuccessful); - sendNextBundleIfRequired(); - })); + tcs.SetResult(wasSuccessful); + sendNextBundleIfRequired(); + }); + }); } } } From 35745c83b7fa468468c5b032bda97d5120c59f27 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 15:19:02 +0900 Subject: [PATCH 1930/2328] Replace dodgy `SetUpSteps` overriding with usage of `HasCustomSteps` --- .../TestSceneCatchPlayerLegacySkin.cs | 2 +- .../TestSceneSliderSnaking.cs | 29 ++++++------------- .../TestSceneStoryboardSamplePlayback.cs | 2 +- .../Gameplay/TestSceneStoryboardWithOutro.cs | 12 ++++---- osu.Game/Tests/Visual/PlayerTestScene.cs | 4 +-- 5 files changed, 19 insertions(+), 30 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayerLegacySkin.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayerLegacySkin.cs index 731cb4e135..8dd6f82c57 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayerLegacySkin.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayerLegacySkin.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Catch.Tests AddStep("change component scale", () => Player.ChildrenOfType().First().Scale = new Vector2(2f)); AddStep("update target", () => Player.ChildrenOfType().ForEach(LegacySkin.UpdateDrawableTarget)); AddStep("exit player", () => Player.Exit()); - CreateTest(null); + CreateTest(); } AddAssert("legacy HUD combo counter hidden", () => diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs index 5706955fc5..366793058d 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs @@ -66,10 +66,7 @@ namespace osu.Game.Rulesets.Osu.Tests drawableSlider = null; }); - [SetUpSteps] - public override void SetUpSteps() - { - } + protected override bool HasCustomSteps => true; [TestCase(0)] [TestCase(1)] @@ -77,7 +74,7 @@ namespace osu.Game.Rulesets.Osu.Tests public void TestSnakingEnabled(int sliderIndex) { AddStep("enable autoplay", () => autoplay = true); - base.SetUpSteps(); + CreateTest(); AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning); retrieveSlider(sliderIndex); @@ -101,7 +98,7 @@ namespace osu.Game.Rulesets.Osu.Tests public void TestSnakingDisabled(int sliderIndex) { AddStep("have autoplay", () => autoplay = true); - base.SetUpSteps(); + CreateTest(); AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning); retrieveSlider(sliderIndex); @@ -121,8 +118,7 @@ namespace osu.Game.Rulesets.Osu.Tests { AddStep("enable autoplay", () => autoplay = true); setSnaking(true); - base.SetUpSteps(); - + CreateTest(); // repeat might have a chance to update its position depending on where in the frame its hit, // so some leniency is allowed here instead of checking strict equality addCheckPositionChangeSteps(() => 16600, getSliderRepeat, positionAlmostSame); @@ -133,15 +129,14 @@ namespace osu.Game.Rulesets.Osu.Tests { AddStep("disable autoplay", () => autoplay = false); setSnaking(true); - base.SetUpSteps(); - + CreateTest(); addCheckPositionChangeSteps(() => 16600, getSliderRepeat, positionDecreased); } private void retrieveSlider(int index) { AddStep("retrieve slider at index", () => slider = (Slider)beatmap.HitObjects[index]); - addSeekStep(() => slider); + addSeekStep(() => slider.StartTime); AddUntilStep("retrieve drawable slider", () => (drawableSlider = (DrawableSlider)Player.DrawableRuleset.Playfield.AllHitObjects.SingleOrDefault(d => d.HitObject == slider)) != null); } @@ -205,16 +200,10 @@ namespace osu.Game.Rulesets.Osu.Tests }); } - private void addSeekStep(Func slider) + private void addSeekStep(Func getTime) { - AddStep("seek to slider", () => Player.GameplayClockContainer.Seek(slider().StartTime)); - AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(slider().StartTime, Player.DrawableRuleset.FrameStableClock.CurrentTime, 100)); - } - - private void addSeekStep(Func time) - { - AddStep("seek to time", () => Player.GameplayClockContainer.Seek(time())); - AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time(), Player.DrawableRuleset.FrameStableClock.CurrentTime, 100)); + AddStep("seek to time", () => Player.GameplayClockContainer.Seek(getTime())); + AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(getTime(), Player.DrawableRuleset.FrameStableClock.CurrentTime, 100)); } protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new Beatmap { HitObjects = createHitObjects() }; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardSamplePlayback.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardSamplePlayback.cs index 079d459beb..f0e184d727 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardSamplePlayback.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardSamplePlayback.cs @@ -121,7 +121,7 @@ namespace osu.Game.Tests.Visual.Gameplay private void createPlayerTest() { - CreateTest(null); + CreateTest(); AddAssert("storyboard loaded", () => Player.Beatmap.Value.Storyboard != null); waitUntilStoryboardSamplesPlay(); diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs index 0ba8583b56..e2b2ad85a3 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs @@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual.Gameplay public void TestStoryboardSkipOutro() { AddStep("set storyboard duration to long", () => currentStoryboardDuration = 200000); - CreateTest(null); + CreateTest(); AddUntilStep("completion set by processor", () => Player.ScoreProcessor.HasCompleted.Value); AddStep("skip outro", () => InputManager.Key(osuTK.Input.Key.Space)); AddUntilStep("player is no longer current screen", () => !Player.IsCurrentScreen()); @@ -63,7 +63,7 @@ namespace osu.Game.Tests.Visual.Gameplay [Test] public void TestStoryboardNoSkipOutro() { - CreateTest(null); + CreateTest(); AddUntilStep("storyboard ends", () => Player.GameplayClockContainer.GameplayClock.CurrentTime >= currentStoryboardDuration); AddUntilStep("wait for score shown", () => Player.IsScoreShown); } @@ -71,7 +71,7 @@ namespace osu.Game.Tests.Visual.Gameplay [Test] public void TestStoryboardExitDuringOutroStillExits() { - CreateTest(null); + CreateTest(); AddUntilStep("completion set by processor", () => Player.ScoreProcessor.HasCompleted.Value); AddStep("exit via pause", () => Player.ExitViaPause()); AddAssert("player exited", () => !Player.IsCurrentScreen() && Player.GetChildScreen() == null); @@ -81,7 +81,7 @@ namespace osu.Game.Tests.Visual.Gameplay [TestCase(true)] public void TestStoryboardToggle(bool enabledAtBeginning) { - CreateTest(null); + CreateTest(); AddStep($"{(enabledAtBeginning ? "enable" : "disable")} storyboard", () => LocalConfig.SetValue(OsuSetting.ShowStoryboard, enabledAtBeginning)); AddStep("toggle storyboard", () => LocalConfig.SetValue(OsuSetting.ShowStoryboard, !enabledAtBeginning)); AddUntilStep("wait for score shown", () => Player.IsScoreShown); @@ -130,7 +130,7 @@ namespace osu.Game.Tests.Visual.Gameplay { SkipOverlay.FadeContainer fadeContainer() => Player.ChildrenOfType().First(); - CreateTest(null); + CreateTest(); AddUntilStep("completion set by processor", () => Player.ScoreProcessor.HasCompleted.Value); AddUntilStep("skip overlay content becomes visible", () => fadeContainer().State == Visibility.Visible); @@ -144,7 +144,7 @@ namespace osu.Game.Tests.Visual.Gameplay [Test] public void TestPerformExitNoOutro() { - CreateTest(null); + CreateTest(); AddStep("disable storyboard", () => LocalConfig.SetValue(OsuSetting.ShowStoryboard, false)); AddUntilStep("completion set by processor", () => Player.ScoreProcessor.HasCompleted.Value); AddStep("exit via pause", () => Player.ExitViaPause()); diff --git a/osu.Game/Tests/Visual/PlayerTestScene.cs b/osu.Game/Tests/Visual/PlayerTestScene.cs index 521fd8f21a..e1714299b6 100644 --- a/osu.Game/Tests/Visual/PlayerTestScene.cs +++ b/osu.Game/Tests/Visual/PlayerTestScene.cs @@ -39,10 +39,10 @@ namespace osu.Game.Tests.Visual base.SetUpSteps(); if (!HasCustomSteps) - CreateTest(null); + CreateTest(); } - protected void CreateTest(Action action) + protected void CreateTest([CanBeNull] Action action = null) { if (action != null && !HasCustomSteps) throw new InvalidOperationException($"Cannot add custom test steps without {nameof(HasCustomSteps)} being set."); From 6bfd351dec8e4a1a38a8ab60e36580534b3fa6ad Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 15:23:29 +0900 Subject: [PATCH 1931/2328] Add logging of `GameplayClockContainer` seeks --- osu.Game/Screens/Play/GameplayClockContainer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index 6403943a53..9396b3311f 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -8,6 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Logging; using osu.Framework.Timing; namespace osu.Game.Screens.Play @@ -101,6 +102,8 @@ namespace osu.Game.Screens.Play /// The destination time to seek to. public virtual void Seek(double time) { + Logger.Log($"{nameof(GameplayClockContainer)} seeking to {time}"); + AdjustableSource.Seek(time); // Manually process to make sure the gameplay clock is correctly updated after a seek. From e10ac45fd73b7345898c700591edabfe7d84ee3a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 16:54:53 +0900 Subject: [PATCH 1932/2328] Remove probably redundant `realmLock` As far as I can tell all accesses are safe due to update thread guarantees. The only weird one may be async writes during a `BlockAllOperations`, but the `Compact` loop should handle this quite amicably. --- osu.Game/Database/RealmAccess.cs | 147 +++++++++++++------------------ 1 file changed, 62 insertions(+), 85 deletions(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 7a9561fc5e..715066f32d 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -98,8 +98,6 @@ namespace osu.Game.Database private static readonly GlobalStatistic total_writes_async = GlobalStatistics.Get(@"Realm", @"Writes (Async)"); - private readonly object realmLock = new object(); - private Realm? updateRealm; /// @@ -122,24 +120,21 @@ namespace osu.Game.Database if (!ThreadSafety.IsUpdateThread) throw new InvalidOperationException(@$"Use {nameof(getRealmInstance)} when performing realm operations from a non-update thread"); - lock (realmLock) + if (updateRealm == null) { - if (updateRealm == null) - { - updateRealm = getRealmInstance(); - hasInitialisedOnce = true; + updateRealm = getRealmInstance(); + hasInitialisedOnce = true; - Logger.Log(@$"Opened realm ""{updateRealm.Config.DatabasePath}"" at version {updateRealm.Config.SchemaVersion}"); + Logger.Log(@$"Opened realm ""{updateRealm.Config.DatabasePath}"" at version {updateRealm.Config.SchemaVersion}"); - // Resubscribe any subscriptions - foreach (var action in customSubscriptionsResetMap.Keys) - registerSubscription(action); - } - - Debug.Assert(updateRealm != null); - - return updateRealm; + // Resubscribe any subscriptions + foreach (var action in customSubscriptionsResetMap.Keys) + registerSubscription(action); } + + Debug.Assert(updateRealm != null); + + return updateRealm; } internal static bool CurrentThreadSubscriptionsAllowed => current_thread_subscriptions_allowed.Value; @@ -404,30 +399,27 @@ namespace osu.Game.Database if (!ThreadSafety.IsUpdateThread) throw new InvalidOperationException(@$"{nameof(WriteAsync)} must be called from the update thread."); - lock (realmLock) + // CountdownEvent will fail if already at zero. + if (!pendingAsyncWrites.TryAddCount()) + pendingAsyncWrites.Reset(1); + + // Regardless of calling Realm.GetInstance or Realm.GetInstanceAsync, there is a blocking overhead on retrieval. + // Adding a forced Task.Run resolves this. + var writeTask = Task.Run(async () => { - // CountdownEvent will fail if already at zero. - if (!pendingAsyncWrites.TryAddCount()) - pendingAsyncWrites.Reset(1); + total_writes_async.Value++; - // Regardless of calling Realm.GetInstance or Realm.GetInstanceAsync, there is a blocking overhead on retrieval. - // Adding a forced Task.Run resolves this. - var writeTask = Task.Run(async () => - { - total_writes_async.Value++; + // Not attempting to use Realm.GetInstanceAsync as there's seemingly no benefit to us (for now) and it adds complexity due to locking + // concerns in getRealmInstance(). On a quick check, it looks to be more suited to cases where realm is connecting to an online sync + // server, which we don't use. May want to report upstream or revisit in the future. + using (var realm = getRealmInstance()) + // ReSharper disable once AccessToDisposedClosure (WriteAsync should be marked as [InstantHandle]). + await realm.WriteAsync(() => action(realm)); - // Not attempting to use Realm.GetInstanceAsync as there's seemingly no benefit to us (for now) and it adds complexity due to locking - // concerns in getRealmInstance(). On a quick check, it looks to be more suited to cases where realm is connecting to an online sync - // server, which we don't use. May want to report upstream or revisit in the future. - using (var realm = getRealmInstance()) - // ReSharper disable once AccessToDisposedClosure (WriteAsync should be marked as [InstantHandle]). - await realm.WriteAsync(() => action(realm)); + pendingAsyncWrites.Signal(); + }); - pendingAsyncWrites.Signal(); - }); - - return writeTask; - } + return writeTask; } /// @@ -452,14 +444,11 @@ namespace osu.Game.Database public IDisposable RegisterForNotifications(Func> query, NotificationCallbackDelegate callback) where T : RealmObjectBase { - lock (realmLock) - { - Func action = realm => query(realm).QueryAsyncWithNotifications(callback); + Func action = realm => query(realm).QueryAsyncWithNotifications(callback); - // Store an action which is used when blocking to ensure consumers don't use results of a stale changeset firing. - notificationsResetMap.Add(action, () => callback(new EmptyRealmSet(), null, null)); - return RegisterCustomSubscription(action); - } + // Store an action which is used when blocking to ensure consumers don't use results of a stale changeset firing. + notificationsResetMap.Add(action, () => callback(new EmptyRealmSet(), null, null)); + return RegisterCustomSubscription(action); } /// @@ -550,15 +539,12 @@ namespace osu.Game.Database void unsubscribe() { - lock (realmLock) + if (customSubscriptionsResetMap.TryGetValue(action, out var unsubscriptionAction)) { - if (customSubscriptionsResetMap.TryGetValue(action, out var unsubscriptionAction)) - { - unsubscriptionAction?.Dispose(); - customSubscriptionsResetMap.Remove(action); - notificationsResetMap.Remove(action); - total_subscriptions.Value--; - } + unsubscriptionAction?.Dispose(); + customSubscriptionsResetMap.Remove(action); + notificationsResetMap.Remove(action); + total_subscriptions.Value--; } } }); @@ -568,19 +554,16 @@ namespace osu.Game.Database { Debug.Assert(ThreadSafety.IsUpdateThread); - lock (realmLock) - { - // Retrieve realm instance outside of flag update to ensure that the instance is retrieved, - // as attempting to access it inside the subscription if it's not constructed would lead to - // cyclic invocations of the subscription callback. - var realm = Realm; + // Retrieve realm instance outside of flag update to ensure that the instance is retrieved, + // as attempting to access it inside the subscription if it's not constructed would lead to + // cyclic invocations of the subscription callback. + var realm = Realm; - Debug.Assert(!customSubscriptionsResetMap.TryGetValue(action, out var found) || found == null); + Debug.Assert(!customSubscriptionsResetMap.TryGetValue(action, out var found) || found == null); - current_thread_subscriptions_allowed.Value = true; - customSubscriptionsResetMap[action] = action(realm); - current_thread_subscriptions_allowed.Value = false; - } + current_thread_subscriptions_allowed.Value = true; + customSubscriptionsResetMap[action] = action(realm); + current_thread_subscriptions_allowed.Value = false; } private Realm getRealmInstance() @@ -831,31 +814,28 @@ namespace osu.Game.Database { realmRetrievalLock.Wait(); - lock (realmLock) + if (hasInitialisedOnce) { - if (hasInitialisedOnce) + if (!ThreadSafety.IsUpdateThread) + throw new InvalidOperationException(@$"{nameof(BlockAllOperations)} must be called from the update thread."); + + syncContext = SynchronizationContext.Current; + + // Before disposing the update context, clean up all subscriptions. + // Note that in the case of realm notification subscriptions, this is not really required (they will be cleaned up by disposal). + // In the case of custom subscriptions, we want them to fire before the update realm is disposed in case they do any follow-up work. + foreach (var action in customSubscriptionsResetMap.ToArray()) { - if (!ThreadSafety.IsUpdateThread) - throw new InvalidOperationException(@$"{nameof(BlockAllOperations)} must be called from the update thread."); - - syncContext = SynchronizationContext.Current; - - // Before disposing the update context, clean up all subscriptions. - // Note that in the case of realm notification subscriptions, this is not really required (they will be cleaned up by disposal). - // In the case of custom subscriptions, we want them to fire before the update realm is disposed in case they do any follow-up work. - foreach (var action in customSubscriptionsResetMap.ToArray()) - { - action.Value?.Dispose(); - customSubscriptionsResetMap[action.Key] = null; - } - - updateRealm?.Dispose(); - updateRealm = null; + action.Value?.Dispose(); + customSubscriptionsResetMap[action.Key] = null; } - Logger.Log(@"Blocking realm operations.", LoggingTarget.Database); + updateRealm?.Dispose(); + updateRealm = null; } + Logger.Log(@"Blocking realm operations.", LoggingTarget.Database); + const int sleep_length = 200; int timeout = 5000; @@ -933,10 +913,7 @@ namespace osu.Game.Database if (!pendingAsyncWrites.Wait(10000)) Logger.Log("Realm took too long waiting on pending async writes", level: LogLevel.Error); - lock (realmLock) - { - updateRealm?.Dispose(); - } + updateRealm?.Dispose(); if (!isDisposed) { From d64959ad0c8a7dccf241741801f5854586229edb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 17:07:49 +0900 Subject: [PATCH 1933/2328] Add test coverage of async writes during a blocking operation --- osu.Game.Tests/Database/GeneralUsageTests.cs | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/osu.Game.Tests/Database/GeneralUsageTests.cs b/osu.Game.Tests/Database/GeneralUsageTests.cs index db6e97dab2..5b6f7a0a53 100644 --- a/osu.Game.Tests/Database/GeneralUsageTests.cs +++ b/osu.Game.Tests/Database/GeneralUsageTests.cs @@ -49,6 +49,27 @@ namespace osu.Game.Tests.Database }); } + [Test] + public void TestAsyncWriteWhileBlocking() + { + RunTestWithRealm((realm, _) => + { + Task writeTask; + + using (realm.BlockAllOperations()) + { + writeTask = realm.WriteAsync(r => r.Add(TestResources.CreateTestBeatmapSetInfo())); + Thread.Sleep(100); + Assert.That(writeTask.IsCompleted, Is.False); + } + + writeTask.WaitSafely(); + + realm.Run(r => r.Refresh()); + Assert.That(realm.Run(r => r.All().Count()), Is.EqualTo(1)); + }); + } + [Test] public void TestAsyncWrite() { From 21d31ee218ab60d886c20155e9b817f5dc44257e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 18:04:08 +0900 Subject: [PATCH 1934/2328] Ensure joined channels are actually joined to avoid unexpected tab order --- .../Visual/Online/TestSceneChatOverlay.cs | 71 +++++++++++-------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs index ff2817c439..c57606d44b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs @@ -40,7 +40,6 @@ namespace osu.Game.Tests.Visual.Online private ChannelManager channelManager; private APIUser testUser; - private Channel testPMChannel; private Channel[] testChannels; private Channel testChannel1 => testChannels[0]; @@ -53,7 +52,6 @@ namespace osu.Game.Tests.Visual.Online public void SetUp() => Schedule(() => { testUser = new APIUser { Username = "test user", Id = 5071479 }; - testPMChannel = new Channel(testUser); testChannels = Enumerable.Range(1, 10).Select(createPublicChannel).ToArray(); Child = new DependencyProvidingContainer @@ -181,7 +179,7 @@ namespace osu.Game.Tests.Visual.Online { AddStep("Show overlay", () => chatOverlay.Show()); AddAssert("Listing is visible", () => listingIsVisible); - AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + joinTestChannel(0); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); waitForChannel1Visible(); } @@ -203,12 +201,11 @@ namespace osu.Game.Tests.Visual.Online [Test] public void TestChannelCloseButton() { + var testPMChannel = new Channel(testUser); + AddStep("Show overlay", () => chatOverlay.Show()); - AddStep("Join PM and public channels", () => - { - channelManager.JoinChannel(testChannel1); - channelManager.JoinChannel(testPMChannel); - }); + joinTestChannel(0); + joinChannel(testPMChannel); AddStep("Select PM channel", () => clickDrawable(getChannelListItem(testPMChannel))); AddStep("Click close button", () => { @@ -229,7 +226,7 @@ namespace osu.Game.Tests.Visual.Online public void TestChatCommand() { AddStep("Show overlay", () => chatOverlay.Show()); - AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + joinTestChannel(0); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); AddStep("Open chat with user", () => channelManager.PostCommand($"chat {testUser.Username}")); AddAssert("PM channel is selected", () => @@ -248,14 +245,16 @@ namespace osu.Game.Tests.Visual.Online [Test] public void TestMultiplayerChannelIsNotShown() { - Channel multiplayerChannel = null; + Channel multiplayerChannel; AddStep("Show overlay", () => chatOverlay.Show()); - AddStep("Join multiplayer channel", () => channelManager.JoinChannel(multiplayerChannel = new Channel(new APIUser()) + + joinChannel(multiplayerChannel = new Channel(new APIUser()) { Name = "#mp_1", Type = ChannelType.Multiplayer, - })); + }); + AddAssert("Channel is joined", () => channelManager.JoinedChannels.Contains(multiplayerChannel)); AddUntilStep("Channel not present in listing", () => !chatOverlay.ChildrenOfType() .Where(item => item.IsPresent) @@ -269,7 +268,7 @@ namespace osu.Game.Tests.Visual.Online Message message = null; AddStep("Show overlay", () => chatOverlay.Show()); - AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + joinTestChannel(0); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); AddStep("Send message in channel 1", () => { @@ -291,8 +290,8 @@ namespace osu.Game.Tests.Visual.Online Message message = null; AddStep("Show overlay", () => chatOverlay.Show()); - AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); - AddStep("Join channel 2", () => channelManager.JoinChannel(testChannel2)); + joinTestChannel(0); + joinTestChannel(1); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); AddStep("Send message in channel 2", () => { @@ -314,8 +313,8 @@ namespace osu.Game.Tests.Visual.Online Message message = null; AddStep("Show overlay", () => chatOverlay.Show()); - AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); - AddStep("Join channel 2", () => channelManager.JoinChannel(testChannel2)); + joinTestChannel(0); + joinTestChannel(1); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); AddStep("Send message in channel 2", () => { @@ -337,7 +336,7 @@ namespace osu.Game.Tests.Visual.Online { Message message = null; - AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + joinTestChannel(0); AddStep("Send message in channel 1", () => { testChannel1.AddNewMessages(message = new Message @@ -357,7 +356,7 @@ namespace osu.Game.Tests.Visual.Online { Message message = null; - AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + joinTestChannel(0); AddStep("Send message in channel 1", () => { testChannel1.AddNewMessages(message = new Message @@ -378,7 +377,7 @@ namespace osu.Game.Tests.Visual.Online { AddStep("Show overlay", () => chatOverlay.Show()); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); - AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + joinTestChannel(0); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); waitForChannel1Visible(); AddAssert("TextBox is focused", () => InputManager.FocusedDrawable == chatOverlayTextBox); @@ -404,11 +403,11 @@ namespace osu.Game.Tests.Visual.Online chatOverlay.Show(); chatOverlay.SlowLoading = true; }); - AddStep("Join channel 1", () => channelManager.JoinChannel(testChannel1)); + joinTestChannel(0); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); AddUntilStep("Channel 1 loading", () => !channelIsVisible && chatOverlay.GetSlowLoadingChannel(testChannel1).LoadState == LoadState.Loading); - AddStep("Join channel 2", () => channelManager.JoinChannel(testChannel2)); + joinTestChannel(1); AddStep("Select channel 2", () => clickDrawable(getChannelListItem(testChannel2))); AddUntilStep("Channel 2 loading", () => !channelIsVisible && chatOverlay.GetSlowLoadingChannel(testChannel2).LoadState == LoadState.Loading); @@ -461,15 +460,13 @@ namespace osu.Game.Tests.Visual.Online Channel pmChannel1 = createPrivateChannel(); Channel pmChannel2 = createPrivateChannel(); - AddStep("Show overlay with channels", () => - { - channelManager.JoinChannel(testChannel1); - channelManager.JoinChannel(testChannel2); - channelManager.JoinChannel(pmChannel1); - channelManager.JoinChannel(pmChannel2); - channelManager.JoinChannel(announceChannel); - chatOverlay.Show(); - }); + joinTestChannel(0); + joinTestChannel(1); + joinChannel(pmChannel1); + joinChannel(pmChannel2); + joinChannel(announceChannel); + + AddStep("Show overlay", () => chatOverlay.Show()); AddStep("Select channel 1", () => clickDrawable(getChannelListItem(testChannel1))); waitForChannel1Visible(); @@ -490,6 +487,18 @@ namespace osu.Game.Tests.Visual.Online waitForChannel1Visible(); } + private void joinTestChannel(int i) + { + AddStep($"Join test channel {i}", () => channelManager.JoinChannel(testChannels[i])); + AddUntilStep("wait for join completed", () => testChannels[i].Joined.Value); + } + + private void joinChannel(Channel channel) + { + AddStep($"Join channel {channel}", () => channelManager.JoinChannel(channel)); + AddUntilStep("wait for join completed", () => channel.Joined.Value); + } + private void waitForChannel1Visible() => AddUntilStep("Channel 1 is visible", () => channelIsVisible && currentDrawableChannel?.Channel == testChannel1); From ed1b809f54b22116ee6f04738f85d11a22ff8457 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 18:11:30 +0900 Subject: [PATCH 1935/2328] Add missing request handling to actually join PM channels --- osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs index c57606d44b..d2d9b9a9e5 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs @@ -78,6 +78,14 @@ namespace osu.Game.Tests.Visual.Online { switch (req) { + case CreateChannelRequest createRequest: + createRequest.TriggerSuccess(new APIChatChannel + { + ChannelID = ((int)createRequest.Channel.Id), + RecentMessages = new List() + }); + return true; + case GetUpdatesRequest getUpdates: getUpdates.TriggerFailure(new WebException()); return true; From 975ba83838a63f97e7942f3958ad9d3dd50d80d4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 18:19:43 +0900 Subject: [PATCH 1936/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 8f4a102cce..f884ce0eff 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b9033f1bb9..dbfdf0fde8 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index a1e4cf3ba0..11c177dbae 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From c282e193169431e8c7bbe1bf26ad77b6c197396b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 16:29:19 +0900 Subject: [PATCH 1937/2328] Update language initialisation in line with framework `LocalisationManager` changes --- osu.Game/OsuGame.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index ef42522f9d..bd0a2680ae 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -24,6 +24,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; +using osu.Framework.Localisation; using osu.Framework.Logging; using osu.Framework.Screens; using osu.Framework.Threading; @@ -686,27 +687,29 @@ namespace osu.Game { base.LoadComplete(); - foreach (var language in Enum.GetValues(typeof(Language)).OfType()) + var languages = Enum.GetValues(typeof(Language)).OfType(); + + var mappings = languages.Select(language => { #if DEBUG if (language == Language.debug) - { - Localisation.AddLanguage(Language.debug.ToString(), new DebugLocalisationStore()); - continue; - } + return new LocaleMapping("debug", new DebugLocalisationStore()); #endif string cultureCode = language.ToCultureCode(); try { - Localisation.AddLanguage(cultureCode, new ResourceManagerLocalisationStore(cultureCode)); + return new LocaleMapping(new ResourceManagerLocalisationStore(cultureCode)); } catch (Exception ex) { Logger.Error(ex, $"Could not load localisations for language \"{cultureCode}\""); + return null; } - } + }).Where(m => m != null); + + Localisation.AddLocaleMappings(mappings); // The next time this is updated is in UpdateAfterChildren, which occurs too late and results // in the cursor being shown for a few frames during the intro. From 7c9c499e19d033ef0b352df7930668c67ddd3017 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jun 2022 19:21:41 +0900 Subject: [PATCH 1938/2328] Update resources (translation updates) --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index f884ce0eff..2ef3bb2dd1 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index dbfdf0fde8..ab690b22a6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -37,7 +37,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 11c177dbae..a84fc40a45 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -62,7 +62,7 @@ - + From 946178ca412762ff871d8ea7f4d0579b8eebaf76 Mon Sep 17 00:00:00 2001 From: cdwcgt Date: Tue, 28 Jun 2022 20:03:21 +0900 Subject: [PATCH 1939/2328] Remove useless `LocalisableDescription` --- osu.Game/Scoring/ScoreRank.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Scoring/ScoreRank.cs b/osu.Game/Scoring/ScoreRank.cs index dc90e417cd..a4bb99add1 100644 --- a/osu.Game/Scoring/ScoreRank.cs +++ b/osu.Game/Scoring/ScoreRank.cs @@ -11,8 +11,6 @@ namespace osu.Game.Scoring { public enum ScoreRank { - // TODO: reconsider changing later on - [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.RankD))] [Description(@"F")] F = -1, From 2269f1046ed34d4dad8542013a322290ebda5458 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Tue, 28 Jun 2022 20:59:03 +0800 Subject: [PATCH 1940/2328] Remove the nullable disable annotations. --- osu.Game/Migrations/20171019041408_InitialCreate.Designer.cs | 2 -- osu.Game/Migrations/20171019041408_InitialCreate.cs | 2 -- .../Migrations/20171025071459_AddMissingIndexRules.Designer.cs | 2 -- osu.Game/Migrations/20171025071459_AddMissingIndexRules.cs | 2 -- ...0171119065731_AddBeatmapOnlineIDUniqueConstraint.Designer.cs | 2 -- .../20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs | 2 -- .../20171209034410_AddRulesetInfoShortName.Designer.cs | 2 -- osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs | 2 -- osu.Game/Migrations/20180125143340_Settings.Designer.cs | 2 -- osu.Game/Migrations/20180125143340_Settings.cs | 2 -- osu.Game/Migrations/20180131154205_AddMuteBinding.cs | 2 -- osu.Game/Migrations/20180219060912_AddSkins.Designer.cs | 2 -- osu.Game/Migrations/20180219060912_AddSkins.cs | 2 -- .../20180529055154_RemoveUniqueHashConstraints.Designer.cs | 2 -- .../Migrations/20180529055154_RemoveUniqueHashConstraints.cs | 2 -- .../20180621044111_UpdateTaikoDefaultBindings.Designer.cs | 2 -- .../Migrations/20180621044111_UpdateTaikoDefaultBindings.cs | 2 -- .../Migrations/20180628011956_RemoveNegativeSetIDs.Designer.cs | 2 -- osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs | 2 -- osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs | 2 -- osu.Game/Migrations/20180913080842_AddRankStatus.cs | 2 -- osu.Game/Migrations/20181007180454_StandardizePaths.Designer.cs | 2 -- osu.Game/Migrations/20181007180454_StandardizePaths.cs | 2 -- osu.Game/Migrations/20181128100659_AddSkinInfoHash.Designer.cs | 2 -- osu.Game/Migrations/20181128100659_AddSkinInfoHash.cs | 2 -- .../Migrations/20181130113755_AddScoreInfoTables.Designer.cs | 2 -- osu.Game/Migrations/20181130113755_AddScoreInfoTables.cs | 2 -- osu.Game/Migrations/20190225062029_AddUserIDColumn.Designer.cs | 2 -- osu.Game/Migrations/20190225062029_AddUserIDColumn.cs | 2 -- osu.Game/Migrations/20190525060824_SkinSettings.Designer.cs | 2 -- osu.Game/Migrations/20190525060824_SkinSettings.cs | 2 -- .../20190605091246_AddDateAddedColumnToBeatmapSet.Designer.cs | 2 -- .../Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs | 2 -- .../20190708070844_AddBPMAndLengthColumns.Designer.cs | 2 -- osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs | 2 -- osu.Game/Migrations/20190913104727_AddBeatmapVideo.Designer.cs | 2 -- osu.Game/Migrations/20190913104727_AddBeatmapVideo.cs | 2 -- .../Migrations/20200302094919_RefreshVolumeBindings.Designer.cs | 2 -- osu.Game/Migrations/20200302094919_RefreshVolumeBindings.cs | 2 -- .../Migrations/20201019224408_AddEpilepsyWarning.Designer.cs | 2 -- osu.Game/Migrations/20201019224408_AddEpilepsyWarning.cs | 2 -- .../20210412045700_RefreshVolumeBindingsAgain.Designer.cs | 2 -- .../Migrations/20210412045700_RefreshVolumeBindingsAgain.cs | 2 -- .../20210511060743_AddSkinInstantiationInfo.Designer.cs | 2 -- osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.cs | 2 -- .../20210514062639_AddAuthorIdToBeatmapMetadata.Designer.cs | 2 -- .../Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.cs | 2 -- .../Migrations/20210824185035_AddCountdownSettings.Designer.cs | 2 -- osu.Game/Migrations/20210824185035_AddCountdownSettings.cs | 2 -- .../20210912144011_AddSamplesMatchPlaybackRate.Designer.cs | 2 -- .../Migrations/20210912144011_AddSamplesMatchPlaybackRate.cs | 2 -- osu.Game/Migrations/20211020081609_ResetSkinHashes.cs | 2 -- osu.Game/Migrations/OsuDbContextModelSnapshot.cs | 2 -- 53 files changed, 106 deletions(-) diff --git a/osu.Game/Migrations/20171019041408_InitialCreate.Designer.cs b/osu.Game/Migrations/20171019041408_InitialCreate.Designer.cs index 7104245d9e..c751530bf4 100644 --- a/osu.Game/Migrations/20171019041408_InitialCreate.Designer.cs +++ b/osu.Game/Migrations/20171019041408_InitialCreate.Designer.cs @@ -1,7 +1,5 @@ // using Microsoft.EntityFrameworkCore; - -#nullable disable using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20171019041408_InitialCreate.cs b/osu.Game/Migrations/20171019041408_InitialCreate.cs index f1c7c94638..08ab64fd08 100644 --- a/osu.Game/Migrations/20171019041408_InitialCreate.cs +++ b/osu.Game/Migrations/20171019041408_InitialCreate.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20171025071459_AddMissingIndexRules.Designer.cs b/osu.Game/Migrations/20171025071459_AddMissingIndexRules.Designer.cs index b464c15ce2..4cd234f2ef 100644 --- a/osu.Game/Migrations/20171025071459_AddMissingIndexRules.Designer.cs +++ b/osu.Game/Migrations/20171025071459_AddMissingIndexRules.Designer.cs @@ -1,7 +1,5 @@ // using Microsoft.EntityFrameworkCore; - -#nullable disable using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20171025071459_AddMissingIndexRules.cs b/osu.Game/Migrations/20171025071459_AddMissingIndexRules.cs index 1d0164a1d9..4ec3952941 100644 --- a/osu.Game/Migrations/20171025071459_AddMissingIndexRules.cs +++ b/osu.Game/Migrations/20171025071459_AddMissingIndexRules.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.Designer.cs b/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.Designer.cs index 53e8b887d8..006acf12cd 100644 --- a/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.Designer.cs +++ b/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.Designer.cs @@ -1,7 +1,5 @@ // using Microsoft.EntityFrameworkCore; - -#nullable disable using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs b/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs index 765a6a5b58..6aba12f86f 100644 --- a/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs +++ b/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.Designer.cs b/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.Designer.cs index 4da20141bc..fc2496bc24 100644 --- a/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.Designer.cs +++ b/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.Designer.cs @@ -1,7 +1,5 @@ // using Microsoft.EntityFrameworkCore; - -#nullable disable using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs b/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs index 3379efa68e..5688455f79 100644 --- a/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs +++ b/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20180125143340_Settings.Designer.cs b/osu.Game/Migrations/20180125143340_Settings.Designer.cs index 68054d6404..4bb599eec1 100644 --- a/osu.Game/Migrations/20180125143340_Settings.Designer.cs +++ b/osu.Game/Migrations/20180125143340_Settings.Designer.cs @@ -1,7 +1,5 @@ // using Microsoft.EntityFrameworkCore; - -#nullable disable using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20180125143340_Settings.cs b/osu.Game/Migrations/20180125143340_Settings.cs index 8f7d0a6ed3..1feb37531f 100644 --- a/osu.Game/Migrations/20180125143340_Settings.cs +++ b/osu.Game/Migrations/20180125143340_Settings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20180131154205_AddMuteBinding.cs b/osu.Game/Migrations/20180131154205_AddMuteBinding.cs index 3e97e78e61..8646d1d76b 100644 --- a/osu.Game/Migrations/20180131154205_AddMuteBinding.cs +++ b/osu.Game/Migrations/20180131154205_AddMuteBinding.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Infrastructure; using osu.Game.Database; diff --git a/osu.Game/Migrations/20180219060912_AddSkins.Designer.cs b/osu.Game/Migrations/20180219060912_AddSkins.Designer.cs index 7d95a702b8..cdc4ef2e66 100644 --- a/osu.Game/Migrations/20180219060912_AddSkins.Designer.cs +++ b/osu.Game/Migrations/20180219060912_AddSkins.Designer.cs @@ -1,7 +1,5 @@ // using Microsoft.EntityFrameworkCore; - -#nullable disable using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20180219060912_AddSkins.cs b/osu.Game/Migrations/20180219060912_AddSkins.cs index df9d267a14..319748bed6 100644 --- a/osu.Game/Migrations/20180219060912_AddSkins.cs +++ b/osu.Game/Migrations/20180219060912_AddSkins.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.Designer.cs b/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.Designer.cs index 7e490c7833..f28408bfb3 100644 --- a/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.Designer.cs +++ b/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.Designer.cs @@ -1,7 +1,5 @@ // using Microsoft.EntityFrameworkCore; - -#nullable disable using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs b/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs index 62c341b0c6..91eabe8868 100644 --- a/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs +++ b/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.Designer.cs b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.Designer.cs index a103cdad20..aaa11e88b6 100644 --- a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.Designer.cs +++ b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs index b08fa7a899..d888ccd5a2 100644 --- a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs +++ b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.Designer.cs b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.Designer.cs index 5b1734554a..7eeacd56d7 100644 --- a/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.Designer.cs +++ b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs index 4ba0a4d0e6..fdea636ac6 100644 --- a/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs +++ b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs b/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs index ceef5b6948..5ab43da046 100644 --- a/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs +++ b/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20180913080842_AddRankStatus.cs b/osu.Game/Migrations/20180913080842_AddRankStatus.cs index ec82925b03..bb147dff84 100644 --- a/osu.Game/Migrations/20180913080842_AddRankStatus.cs +++ b/osu.Game/Migrations/20180913080842_AddRankStatus.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20181007180454_StandardizePaths.Designer.cs b/osu.Game/Migrations/20181007180454_StandardizePaths.Designer.cs index d1185ef186..b387a45ecf 100644 --- a/osu.Game/Migrations/20181007180454_StandardizePaths.Designer.cs +++ b/osu.Game/Migrations/20181007180454_StandardizePaths.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20181007180454_StandardizePaths.cs b/osu.Game/Migrations/20181007180454_StandardizePaths.cs index f9323c0b9b..30f27043a0 100644 --- a/osu.Game/Migrations/20181007180454_StandardizePaths.cs +++ b/osu.Game/Migrations/20181007180454_StandardizePaths.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20181128100659_AddSkinInfoHash.Designer.cs b/osu.Game/Migrations/20181128100659_AddSkinInfoHash.Designer.cs index 0797090c7b..120674671a 100644 --- a/osu.Game/Migrations/20181128100659_AddSkinInfoHash.Designer.cs +++ b/osu.Game/Migrations/20181128100659_AddSkinInfoHash.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20181128100659_AddSkinInfoHash.cs b/osu.Game/Migrations/20181128100659_AddSkinInfoHash.cs index 43689f2a3c..ee825a1e9c 100644 --- a/osu.Game/Migrations/20181128100659_AddSkinInfoHash.cs +++ b/osu.Game/Migrations/20181128100659_AddSkinInfoHash.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20181130113755_AddScoreInfoTables.Designer.cs b/osu.Game/Migrations/20181130113755_AddScoreInfoTables.Designer.cs index 3b70ad8d45..eee53182ce 100644 --- a/osu.Game/Migrations/20181130113755_AddScoreInfoTables.Designer.cs +++ b/osu.Game/Migrations/20181130113755_AddScoreInfoTables.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20181130113755_AddScoreInfoTables.cs b/osu.Game/Migrations/20181130113755_AddScoreInfoTables.cs index f52edacc7f..58980132f3 100644 --- a/osu.Game/Migrations/20181130113755_AddScoreInfoTables.cs +++ b/osu.Game/Migrations/20181130113755_AddScoreInfoTables.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20190225062029_AddUserIDColumn.Designer.cs b/osu.Game/Migrations/20190225062029_AddUserIDColumn.Designer.cs index 51b63bd9eb..8e1e3a59f3 100644 --- a/osu.Game/Migrations/20190225062029_AddUserIDColumn.Designer.cs +++ b/osu.Game/Migrations/20190225062029_AddUserIDColumn.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20190225062029_AddUserIDColumn.cs b/osu.Game/Migrations/20190225062029_AddUserIDColumn.cs index 00d807d5c4..f2eef600dc 100644 --- a/osu.Game/Migrations/20190225062029_AddUserIDColumn.cs +++ b/osu.Game/Migrations/20190225062029_AddUserIDColumn.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20190525060824_SkinSettings.Designer.cs b/osu.Game/Migrations/20190525060824_SkinSettings.Designer.cs index 9d6515e5c6..348c42adb9 100644 --- a/osu.Game/Migrations/20190525060824_SkinSettings.Designer.cs +++ b/osu.Game/Migrations/20190525060824_SkinSettings.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20190525060824_SkinSettings.cs b/osu.Game/Migrations/20190525060824_SkinSettings.cs index 463d4fe1ad..7779b55bb7 100644 --- a/osu.Game/Migrations/20190525060824_SkinSettings.cs +++ b/osu.Game/Migrations/20190525060824_SkinSettings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.Designer.cs b/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.Designer.cs index 1bc2e76ae5..9477369aa0 100644 --- a/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.Designer.cs +++ b/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs b/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs index 61925a4cb4..0620a0624f 100644 --- a/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs +++ b/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.Designer.cs b/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.Designer.cs index c51b8739bc..c5fcc16f84 100644 --- a/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.Designer.cs +++ b/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs b/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs index 19a2464157..f8ce354aa1 100644 --- a/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs +++ b/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20190913104727_AddBeatmapVideo.Designer.cs b/osu.Game/Migrations/20190913104727_AddBeatmapVideo.Designer.cs index 95583e7587..826233a2b0 100644 --- a/osu.Game/Migrations/20190913104727_AddBeatmapVideo.Designer.cs +++ b/osu.Game/Migrations/20190913104727_AddBeatmapVideo.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20190913104727_AddBeatmapVideo.cs b/osu.Game/Migrations/20190913104727_AddBeatmapVideo.cs index c1208e0bf1..af82b4db20 100644 --- a/osu.Game/Migrations/20190913104727_AddBeatmapVideo.cs +++ b/osu.Game/Migrations/20190913104727_AddBeatmapVideo.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.Designer.cs b/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.Designer.cs index 3c7de0602b..22316b0380 100644 --- a/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.Designer.cs +++ b/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.cs b/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.cs index 73cfb1725b..3d2ddbf6fc 100644 --- a/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.cs +++ b/osu.Game/Migrations/20200302094919_RefreshVolumeBindings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.Designer.cs b/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.Designer.cs index 24acc3195f..1c05de832e 100644 --- a/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.Designer.cs +++ b/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.cs b/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.cs index eaca8785f9..58a35a7bf3 100644 --- a/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.cs +++ b/osu.Game/Migrations/20201019224408_AddEpilepsyWarning.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.Designer.cs b/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.Designer.cs index 704af354c9..2c100d39b9 100644 --- a/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.Designer.cs +++ b/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.cs b/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.cs index 7772c0e86b..4d3941dd20 100644 --- a/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.cs +++ b/osu.Game/Migrations/20210412045700_RefreshVolumeBindingsAgain.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.Designer.cs b/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.Designer.cs index 097bd6a244..b808c648da 100644 --- a/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.Designer.cs +++ b/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.cs b/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.cs index 1cc9ab6120..887635fa85 100644 --- a/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.cs +++ b/osu.Game/Migrations/20210511060743_AddSkinInstantiationInfo.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.Designer.cs b/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.Designer.cs index ca9502422b..89bab3a0fa 100644 --- a/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.Designer.cs +++ b/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.cs b/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.cs index 82c5b27769..7b579e27b9 100644 --- a/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.cs +++ b/osu.Game/Migrations/20210514062639_AddAuthorIdToBeatmapMetadata.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20210824185035_AddCountdownSettings.Designer.cs b/osu.Game/Migrations/20210824185035_AddCountdownSettings.Designer.cs index 2a4e370649..afeb42130d 100644 --- a/osu.Game/Migrations/20210824185035_AddCountdownSettings.Designer.cs +++ b/osu.Game/Migrations/20210824185035_AddCountdownSettings.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20210824185035_AddCountdownSettings.cs b/osu.Game/Migrations/20210824185035_AddCountdownSettings.cs index dd6fa23387..d1b09e2c1d 100644 --- a/osu.Game/Migrations/20210824185035_AddCountdownSettings.cs +++ b/osu.Game/Migrations/20210824185035_AddCountdownSettings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.Designer.cs b/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.Designer.cs index 9e09f2c69e..6e53d7fae0 100644 --- a/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.Designer.cs +++ b/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.Designer.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.cs b/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.cs index 0598a41f09..f6fc1f4420 100644 --- a/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.cs +++ b/osu.Game/Migrations/20210912144011_AddSamplesMatchPlaybackRate.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Migrations; namespace osu.Game.Migrations diff --git a/osu.Game/Migrations/20211020081609_ResetSkinHashes.cs b/osu.Game/Migrations/20211020081609_ResetSkinHashes.cs index 0f7a2a5702..6d53c019ec 100644 --- a/osu.Game/Migrations/20211020081609_ResetSkinHashes.cs +++ b/osu.Game/Migrations/20211020081609_ResetSkinHashes.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using osu.Game.Database; diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index 7e38889fa6..036c26cb0a 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -1,7 +1,5 @@ // using System; - -#nullable disable using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; From de7f2a0bba6953b486689427198b0b1fd2804a30 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Tue, 28 Jun 2022 20:56:02 +0800 Subject: [PATCH 1941/2328] Remove the nullable disable annotation in the localisation. --- osu.Game/Localisation/AudioSettingsStrings.cs | 2 -- osu.Game/Localisation/BeatmapOffsetControlStrings.cs | 2 -- osu.Game/Localisation/BindingSettingsStrings.cs | 2 -- osu.Game/Localisation/ButtonSystemStrings.cs | 2 -- osu.Game/Localisation/ChatStrings.cs | 2 -- osu.Game/Localisation/CommonStrings.cs | 2 -- osu.Game/Localisation/DebugLocalisationStore.cs | 2 -- osu.Game/Localisation/DebugSettingsStrings.cs | 2 -- osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs | 2 -- .../FirstRunOverlayImportFromStableScreenStrings.cs | 2 -- osu.Game/Localisation/FirstRunSetupBeatmapScreenStrings.cs | 2 -- osu.Game/Localisation/FirstRunSetupOverlayStrings.cs | 2 -- osu.Game/Localisation/GameplaySettingsStrings.cs | 2 -- osu.Game/Localisation/GeneralSettingsStrings.cs | 2 -- osu.Game/Localisation/GlobalActionKeyBindingStrings.cs | 2 -- osu.Game/Localisation/GraphicsSettingsStrings.cs | 2 -- osu.Game/Localisation/InputSettingsStrings.cs | 2 -- osu.Game/Localisation/JoystickSettingsStrings.cs | 2 -- osu.Game/Localisation/Language.cs | 2 -- osu.Game/Localisation/LayoutSettingsStrings.cs | 2 -- osu.Game/Localisation/LeaderboardStrings.cs | 2 -- osu.Game/Localisation/MaintenanceSettingsStrings.cs | 2 -- osu.Game/Localisation/ModSelectOverlayStrings.cs | 2 -- osu.Game/Localisation/MouseSettingsStrings.cs | 2 -- osu.Game/Localisation/MultiplayerTeamResultsScreenStrings.cs | 2 -- osu.Game/Localisation/NamedOverlayComponentStrings.cs | 2 -- osu.Game/Localisation/NotificationsStrings.cs | 2 -- osu.Game/Localisation/NowPlayingStrings.cs | 2 -- osu.Game/Localisation/OnlineSettingsStrings.cs | 2 -- osu.Game/Localisation/RulesetSettingsStrings.cs | 2 -- osu.Game/Localisation/SettingsStrings.cs | 2 -- osu.Game/Localisation/SkinSettingsStrings.cs | 2 -- osu.Game/Localisation/TabletSettingsStrings.cs | 2 -- osu.Game/Localisation/ToastStrings.cs | 2 -- osu.Game/Localisation/UserInterfaceStrings.cs | 2 -- 35 files changed, 70 deletions(-) diff --git a/osu.Game/Localisation/AudioSettingsStrings.cs b/osu.Game/Localisation/AudioSettingsStrings.cs index 0dc95da2f4..0f0f560df9 100644 --- a/osu.Game/Localisation/AudioSettingsStrings.cs +++ b/osu.Game/Localisation/AudioSettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/BeatmapOffsetControlStrings.cs b/osu.Game/Localisation/BeatmapOffsetControlStrings.cs index 417cf335e0..632a1ad0ea 100644 --- a/osu.Game/Localisation/BeatmapOffsetControlStrings.cs +++ b/osu.Game/Localisation/BeatmapOffsetControlStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/BindingSettingsStrings.cs b/osu.Game/Localisation/BindingSettingsStrings.cs index 39b5ac0d21..ad4a650a1f 100644 --- a/osu.Game/Localisation/BindingSettingsStrings.cs +++ b/osu.Game/Localisation/BindingSettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/ButtonSystemStrings.cs b/osu.Game/Localisation/ButtonSystemStrings.cs index c71a99711b..ba4abf63a6 100644 --- a/osu.Game/Localisation/ButtonSystemStrings.cs +++ b/osu.Game/Localisation/ButtonSystemStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/ChatStrings.cs b/osu.Game/Localisation/ChatStrings.cs index b07ed18f7b..7bd284a94e 100644 --- a/osu.Game/Localisation/ChatStrings.cs +++ b/osu.Game/Localisation/ChatStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/CommonStrings.cs b/osu.Game/Localisation/CommonStrings.cs index 39dc7cf518..1ee562e122 100644 --- a/osu.Game/Localisation/CommonStrings.cs +++ b/osu.Game/Localisation/CommonStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/DebugLocalisationStore.cs b/osu.Game/Localisation/DebugLocalisationStore.cs index 83ae4581a8..2b114b1bd8 100644 --- a/osu.Game/Localisation/DebugLocalisationStore.cs +++ b/osu.Game/Localisation/DebugLocalisationStore.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; using System.Globalization; diff --git a/osu.Game/Localisation/DebugSettingsStrings.cs b/osu.Game/Localisation/DebugSettingsStrings.cs index e6de4ddee9..74b2c8d892 100644 --- a/osu.Game/Localisation/DebugSettingsStrings.cs +++ b/osu.Game/Localisation/DebugSettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs b/osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs index 4bcbdcff7b..952ca22678 100644 --- a/osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs +++ b/osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/FirstRunOverlayImportFromStableScreenStrings.cs b/osu.Game/Localisation/FirstRunOverlayImportFromStableScreenStrings.cs index 38f5860cc5..deac7d8628 100644 --- a/osu.Game/Localisation/FirstRunOverlayImportFromStableScreenStrings.cs +++ b/osu.Game/Localisation/FirstRunOverlayImportFromStableScreenStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/FirstRunSetupBeatmapScreenStrings.cs b/osu.Game/Localisation/FirstRunSetupBeatmapScreenStrings.cs index 331a8c6764..3a7fe4bb12 100644 --- a/osu.Game/Localisation/FirstRunSetupBeatmapScreenStrings.cs +++ b/osu.Game/Localisation/FirstRunSetupBeatmapScreenStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs index 0c73d7a85b..91b427e2ca 100644 --- a/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs +++ b/osu.Game/Localisation/FirstRunSetupOverlayStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/GameplaySettingsStrings.cs b/osu.Game/Localisation/GameplaySettingsStrings.cs index 1719b7d6e8..8a0f773551 100644 --- a/osu.Game/Localisation/GameplaySettingsStrings.cs +++ b/osu.Game/Localisation/GameplaySettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/GeneralSettingsStrings.cs b/osu.Game/Localisation/GeneralSettingsStrings.cs index 8cf26a930d..2aa91f5245 100644 --- a/osu.Game/Localisation/GeneralSettingsStrings.cs +++ b/osu.Game/Localisation/GeneralSettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs index d45fba6f17..82d03dbb5b 100644 --- a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs +++ b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/GraphicsSettingsStrings.cs b/osu.Game/Localisation/GraphicsSettingsStrings.cs index a73d67067e..38355d9041 100644 --- a/osu.Game/Localisation/GraphicsSettingsStrings.cs +++ b/osu.Game/Localisation/GraphicsSettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/InputSettingsStrings.cs b/osu.Game/Localisation/InputSettingsStrings.cs index a16dcd998a..e46b4cecf3 100644 --- a/osu.Game/Localisation/InputSettingsStrings.cs +++ b/osu.Game/Localisation/InputSettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/JoystickSettingsStrings.cs b/osu.Game/Localisation/JoystickSettingsStrings.cs index efda1afd48..976ec1adde 100644 --- a/osu.Game/Localisation/JoystickSettingsStrings.cs +++ b/osu.Game/Localisation/JoystickSettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/Language.cs b/osu.Game/Localisation/Language.cs index f9094b9540..c13a1a10cb 100644 --- a/osu.Game/Localisation/Language.cs +++ b/osu.Game/Localisation/Language.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.ComponentModel; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/LayoutSettingsStrings.cs b/osu.Game/Localisation/LayoutSettingsStrings.cs index 1a0b015050..b4326b8e39 100644 --- a/osu.Game/Localisation/LayoutSettingsStrings.cs +++ b/osu.Game/Localisation/LayoutSettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/LeaderboardStrings.cs b/osu.Game/Localisation/LeaderboardStrings.cs index 14bc5b7af4..8e53f8e88c 100644 --- a/osu.Game/Localisation/LeaderboardStrings.cs +++ b/osu.Game/Localisation/LeaderboardStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/MaintenanceSettingsStrings.cs b/osu.Game/Localisation/MaintenanceSettingsStrings.cs index 4cb514feb0..7a04bcd1ca 100644 --- a/osu.Game/Localisation/MaintenanceSettingsStrings.cs +++ b/osu.Game/Localisation/MaintenanceSettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/ModSelectOverlayStrings.cs b/osu.Game/Localisation/ModSelectOverlayStrings.cs index 3d99075922..e9af7147e3 100644 --- a/osu.Game/Localisation/ModSelectOverlayStrings.cs +++ b/osu.Game/Localisation/ModSelectOverlayStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/MouseSettingsStrings.cs b/osu.Game/Localisation/MouseSettingsStrings.cs index 563d6f7637..fd7225ad2e 100644 --- a/osu.Game/Localisation/MouseSettingsStrings.cs +++ b/osu.Game/Localisation/MouseSettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/MultiplayerTeamResultsScreenStrings.cs b/osu.Game/Localisation/MultiplayerTeamResultsScreenStrings.cs index 956d5195e7..92cedce3e0 100644 --- a/osu.Game/Localisation/MultiplayerTeamResultsScreenStrings.cs +++ b/osu.Game/Localisation/MultiplayerTeamResultsScreenStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/NamedOverlayComponentStrings.cs b/osu.Game/Localisation/NamedOverlayComponentStrings.cs index f6a50460dc..475bea2a4a 100644 --- a/osu.Game/Localisation/NamedOverlayComponentStrings.cs +++ b/osu.Game/Localisation/NamedOverlayComponentStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/NotificationsStrings.cs b/osu.Game/Localisation/NotificationsStrings.cs index c60e5d3415..382e0d81f4 100644 --- a/osu.Game/Localisation/NotificationsStrings.cs +++ b/osu.Game/Localisation/NotificationsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/NowPlayingStrings.cs b/osu.Game/Localisation/NowPlayingStrings.cs index 75d9b28ea6..f334637338 100644 --- a/osu.Game/Localisation/NowPlayingStrings.cs +++ b/osu.Game/Localisation/NowPlayingStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/OnlineSettingsStrings.cs b/osu.Game/Localisation/OnlineSettingsStrings.cs index ebb21afeb7..6862f4ac2c 100644 --- a/osu.Game/Localisation/OnlineSettingsStrings.cs +++ b/osu.Game/Localisation/OnlineSettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/RulesetSettingsStrings.cs b/osu.Game/Localisation/RulesetSettingsStrings.cs index 08901a641e..a356c9e20b 100644 --- a/osu.Game/Localisation/RulesetSettingsStrings.cs +++ b/osu.Game/Localisation/RulesetSettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/SettingsStrings.cs b/osu.Game/Localisation/SettingsStrings.cs index 5dcab39e10..aa2e2740eb 100644 --- a/osu.Game/Localisation/SettingsStrings.cs +++ b/osu.Game/Localisation/SettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/SkinSettingsStrings.cs b/osu.Game/Localisation/SkinSettingsStrings.cs index 42b72fdbb8..81035c5a5e 100644 --- a/osu.Game/Localisation/SkinSettingsStrings.cs +++ b/osu.Game/Localisation/SkinSettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/TabletSettingsStrings.cs b/osu.Game/Localisation/TabletSettingsStrings.cs index 8d2bc21652..d62d348df9 100644 --- a/osu.Game/Localisation/TabletSettingsStrings.cs +++ b/osu.Game/Localisation/TabletSettingsStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/ToastStrings.cs b/osu.Game/Localisation/ToastStrings.cs index 00a0031293..52e75425bf 100644 --- a/osu.Game/Localisation/ToastStrings.cs +++ b/osu.Game/Localisation/ToastStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation diff --git a/osu.Game/Localisation/UserInterfaceStrings.cs b/osu.Game/Localisation/UserInterfaceStrings.cs index a007f760d8..a090b8c14c 100644 --- a/osu.Game/Localisation/UserInterfaceStrings.cs +++ b/osu.Game/Localisation/UserInterfaceStrings.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Localisation; namespace osu.Game.Localisation From aacded0ecf2aaecaac5ea48e7fff00a9052064ca Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Tue, 28 Jun 2022 07:33:05 -0700 Subject: [PATCH 1942/2328] Fix difficulty adjust settings having more padding on sliders --- osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs b/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs index a42d4a049a..599e81f2b8 100644 --- a/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs +++ b/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; using osu.Game.Beatmaps; +using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; namespace osu.Game.Rulesets.Mods @@ -103,9 +104,9 @@ namespace osu.Game.Rulesets.Mods { InternalChildren = new Drawable[] { - new SettingsSlider + new OsuSliderBar { - ShowsDefaultIndicator = false, + RelativeSizeAxes = Axes.X, Current = currentNumber, KeyboardStep = 0.1f, } From f07107aba9e3812e8ae94a09fac8a00374da5e42 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Tue, 28 Jun 2022 08:38:15 -0700 Subject: [PATCH 1943/2328] Fix failing diff adjust slider tests --- .../UserInterface/TestSceneModDifficultyAdjustSettings.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModDifficultyAdjustSettings.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModDifficultyAdjustSettings.cs index 72e503dc33..9641e6b1bf 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModDifficultyAdjustSettings.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModDifficultyAdjustSettings.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Configuration; +using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Mods; @@ -246,7 +247,7 @@ namespace osu.Game.Tests.Visual.UserInterface { AddStep($"Set {name} slider to {value}", () => this.ChildrenOfType().First(c => c.LabelText == name) - .ChildrenOfType>().First().Current.Value = value); + .ChildrenOfType>().First().Current.Value = value); } private void checkBindableAtValue(string name, float? expectedValue) @@ -260,7 +261,7 @@ namespace osu.Game.Tests.Visual.UserInterface { AddAssert($"Slider {name} at {expectedValue}", () => this.ChildrenOfType().First(c => c.LabelText == name) - .ChildrenOfType>().First().Current.Value == expectedValue); + .ChildrenOfType>().First().Current.Value == expectedValue); } private void setBeatmapWithDifficultyParameters(float value) From d07c2a64b934303314fec10956ec437a464cc6a2 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Tue, 28 Jun 2022 08:39:09 -0700 Subject: [PATCH 1944/2328] Remove unused using --- .../Visual/UserInterface/TestSceneModDifficultyAdjustSettings.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModDifficultyAdjustSettings.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModDifficultyAdjustSettings.cs index 9641e6b1bf..181f46a996 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModDifficultyAdjustSettings.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModDifficultyAdjustSettings.cs @@ -14,7 +14,6 @@ using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; -using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Mods; using osuTK; From 978a80dd6f2b6bbc615ca520eac176da6e58ae88 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Jun 2022 01:52:50 +0900 Subject: [PATCH 1945/2328] Change closure elimination to hint Pretty noisy as a suggestion, and can fire incorrectly quite a lot (aka `Schedule()`). --- osu.sln.DotSettings | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index a55b3b5074..0794095854 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -98,6 +98,7 @@ WARNING HINT DO_NOT_SHOW + HINT HINT HINT ERROR From 36e71d39f2bbdd119148659e5682683f3bf07943 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Tue, 28 Jun 2022 09:54:18 -0700 Subject: [PATCH 1946/2328] Fix one more mod settings test --- .../Visual/UserInterface/TestSceneModSelectOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs index 006707d064..4de70f6f9e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs @@ -230,7 +230,7 @@ namespace osu.Game.Tests.Visual.UserInterface createScreen(); AddStep("select diff adjust", () => SelectedMods.Value = new Mod[] { new OsuModDifficultyAdjust() }); - AddStep("set setting", () => modSelectOverlay.ChildrenOfType>().First().Current.Value = 8); + AddStep("set setting", () => modSelectOverlay.ChildrenOfType>().First().Current.Value = 8); AddAssert("ensure setting is propagated", () => SelectedMods.Value.OfType().Single().CircleSize.Value == 8); From ecdb30d215f57df0cbb608acafe676b25b5b25a4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Jun 2022 02:28:21 +0900 Subject: [PATCH 1947/2328] Fix one more case of collection modification during enumeration https://sentry.ppy.sh/share/issue/a61c27b2a63a4a6aa80e75873f9d87ca/ --- osu.Game/Database/RealmAccess.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 089a783177..cb34a92702 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -132,7 +132,7 @@ namespace osu.Game.Database Logger.Log(@$"Opened realm ""{updateRealm.Config.DatabasePath}"" at version {updateRealm.Config.SchemaVersion}"); // Resubscribe any subscriptions - foreach (var action in customSubscriptionsResetMap.Keys) + foreach (var action in customSubscriptionsResetMap.Keys.ToArray()) registerSubscription(action); } From 3a00131606d11382b1ca264be4803cc7fb300ae3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Jun 2022 13:51:48 +0900 Subject: [PATCH 1948/2328] Bump fastlane --- Gemfile.lock | 60 ++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ddab497657..cae682ec2b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,20 +8,20 @@ GEM artifactory (3.0.15) atomos (0.1.3) aws-eventstream (1.2.0) - aws-partitions (1.570.0) - aws-sdk-core (3.130.0) + aws-partitions (1.601.0) + aws-sdk-core (3.131.2) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.525.0) aws-sigv4 (~> 1.1) - jmespath (~> 1.0) - aws-sdk-kms (1.55.0) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.57.0) aws-sdk-core (~> 3, >= 3.127.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.113.0) + aws-sdk-s3 (1.114.0) aws-sdk-core (~> 3, >= 3.127.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.4) - aws-sigv4 (1.4.0) + aws-sigv4 (1.5.0) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) claide (1.1.0) @@ -36,7 +36,7 @@ GEM unf (>= 0.0.5, < 1.0.0) dotenv (2.7.6) emoji_regex (3.2.3) - excon (0.92.1) + excon (0.92.3) faraday (1.10.0) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) @@ -56,8 +56,8 @@ GEM faraday-em_synchrony (1.0.0) faraday-excon (1.1.0) faraday-httpclient (1.0.1) - faraday-multipart (1.0.3) - multipart-post (>= 1.2, < 3) + faraday-multipart (1.0.4) + multipart-post (~> 2) faraday-net_http (1.0.1) faraday-net_http_persistent (1.2.0) faraday-patron (1.0.0) @@ -66,7 +66,7 @@ GEM faraday_middleware (1.2.0) faraday (~> 1.0) fastimage (2.2.6) - fastlane (2.205.1) + fastlane (2.206.2) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -110,9 +110,9 @@ GEM souyuz (= 0.11.1) fastlane-plugin-xamarin (0.6.3) gh_inspector (1.1.3) - google-apis-androidpublisher_v3 (0.16.0) - google-apis-core (>= 0.4, < 2.a) - google-apis-core (0.4.2) + google-apis-androidpublisher_v3 (0.23.0) + google-apis-core (>= 0.6, < 2.a) + google-apis-core (0.6.0) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.16.2, < 2.a) httpclient (>= 2.8.1, < 3.a) @@ -121,19 +121,19 @@ GEM retriable (>= 2.0, < 4.a) rexml webrick - google-apis-iamcredentials_v1 (0.10.0) - google-apis-core (>= 0.4, < 2.a) - google-apis-playcustomapp_v1 (0.7.0) - google-apis-core (>= 0.4, < 2.a) - google-apis-storage_v1 (0.11.0) - google-apis-core (>= 0.4, < 2.a) + google-apis-iamcredentials_v1 (0.12.0) + google-apis-core (>= 0.6, < 2.a) + google-apis-playcustomapp_v1 (0.9.0) + google-apis-core (>= 0.6, < 2.a) + google-apis-storage_v1 (0.16.0) + google-apis-core (>= 0.6, < 2.a) google-cloud-core (1.6.0) google-cloud-env (~> 1.0) google-cloud-errors (~> 1.0) google-cloud-env (1.6.0) faraday (>= 0.17.3, < 3.0) google-cloud-errors (1.2.0) - google-cloud-storage (1.36.1) + google-cloud-storage (1.36.2) addressable (~> 2.8) digest-crc (~> 0.4) google-apis-iamcredentials_v1 (~> 0.1) @@ -141,7 +141,7 @@ GEM google-cloud-core (~> 1.6) googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) - googleauth (1.1.2) + googleauth (1.2.0) faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) memoist (~> 0.16) @@ -149,12 +149,12 @@ GEM os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) highline (2.0.3) - http-cookie (1.0.4) + http-cookie (1.0.5) domain_name (~> 0.5) httpclient (2.8.3) jmespath (1.6.1) - json (2.6.1) - jwt (2.3.0) + json (2.6.2) + jwt (2.4.1) memoist (0.16.2) mini_magick (4.11.0) mini_mime (1.1.2) @@ -169,10 +169,10 @@ GEM optparse (0.1.1) os (1.1.4) plist (3.6.0) - public_suffix (4.0.6) + public_suffix (4.0.7) racc (1.6.0) rake (13.0.6) - representable (3.1.1) + representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) @@ -182,9 +182,9 @@ GEM ruby2_keywords (0.0.5) rubyzip (2.3.2) security (0.1.3) - signet (0.16.1) + signet (0.17.0) addressable (~> 2.8) - faraday (>= 0.17.5, < 3.0) + faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) multi_json (~> 1.10) simctl (1.6.8) @@ -205,11 +205,11 @@ GEM uber (0.1.0) unf (0.1.4) unf_ext - unf_ext (0.0.8.1) + unf_ext (0.0.8.2) unicode-display_width (1.8.0) webrick (1.7.0) word_wrap (1.0.0) - xcodeproj (1.21.0) + xcodeproj (1.22.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) From 34b9118fb3bf83f7cb7055e322ef147267aeedb7 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 29 Jun 2022 16:08:59 +0900 Subject: [PATCH 1949/2328] Cleanup by using const value --- osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs | 9 +-------- .../Difficulty/Skills/OsuStrainSkill.cs | 8 +++++++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index f64c218c65..84ef109598 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -43,13 +43,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills return currentStrain; } - public override double DifficultyValue() - { - double difficulty = GetCurrentStrainPeaks().Sum(); - - // 1.06 comes from the default DifficultyMultiplier field in OsuStrainSkill, - // and it's added here to keep values the same after Flashlight was converted from OsuStrainSkill. - return difficulty * 1.06; - } + public override double DifficultyValue() => GetCurrentStrainPeaks().Sum() * OsuStrainSkill.DEFAULT_DIFFICULTY_MULTIPLIER; } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/OsuStrainSkill.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/OsuStrainSkill.cs index 94b5727e3f..d6683ade05 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/OsuStrainSkill.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/OsuStrainSkill.cs @@ -14,6 +14,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills { public abstract class OsuStrainSkill : StrainSkill { + /// + /// The default multiplier applied by to the final difficulty value after all other calculations. + /// May be overridden via . + /// + public const double DEFAULT_DIFFICULTY_MULTIPLIER = 1.06; + /// /// The number of sections with the highest strains, which the peak strain reductions will apply to. /// This is done in order to decrease their impact on the overall difficulty of the map for this skill. @@ -28,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills /// /// The final multiplier to be applied to after all other calculations. /// - protected virtual double DifficultyMultiplier => 1.06; + protected virtual double DifficultyMultiplier => DEFAULT_DIFFICULTY_MULTIPLIER; protected OsuStrainSkill(Mod[] mods) : base(mods) From 0211fe7ae8d1e472158c2544d14b2ba6dff70daf Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 29 Jun 2022 16:29:14 +0900 Subject: [PATCH 1950/2328] Fix exception + possible div-by-0 --- osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs | 2 +- osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs index 6218d1a54a..c3b7834009 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs @@ -168,7 +168,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty double relevantCountGreat = Math.Max(0, countGreat - relevantTotalDiff); double relevantCountOk = Math.Max(0, countOk - Math.Max(0, relevantTotalDiff - countGreat)); double relevantCountMeh = Math.Max(0, countMeh - Math.Max(0, relevantTotalDiff - countGreat - countOk)); - double relevantAccuracy = (relevantCountGreat * 6.0 + relevantCountOk * 2.0 + relevantCountMeh) / (attributes.SpeedNoteCount * 6.0); + double relevantAccuracy = attributes.SpeedNoteCount == 0 ? 0 : (relevantCountGreat * 6.0 + relevantCountOk * 2.0 + relevantCountMeh) / (attributes.SpeedNoteCount * 6.0); // Scale the speed value with accuracy and OD. speedValue *= (0.95 + Math.Pow(attributes.OverallDifficulty, 2) / 750) * Math.Pow((accuracy + relevantAccuracy) / 2.0, (14.5 - Math.Max(attributes.OverallDifficulty, 8)) / 2); diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index 38cfc1ece5..3e0f2a5638 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -56,6 +56,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills public double RelevantNoteCount() { + if (objectStrains.Count == 0) + return 0; + double maxStrain = objectStrains.Max(); return objectStrains.Aggregate((total, next) => total + (1.0 / (1.0 + Math.Exp(-(next / maxStrain * 12.0 - 6.0))))); } From e6ccca804527f8032cf20dd0e8a84eb409b27735 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 29 Jun 2022 16:29:17 +0900 Subject: [PATCH 1951/2328] Fix inspection --- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index fab3fa8425..75d9469da3 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier; double aimRatingNoSliders = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier; double speedRating = Math.Sqrt(skills[2].DifficultyValue()) * difficulty_multiplier; - double speedNotes = (skills[2] as Speed).RelevantNoteCount(); + double speedNotes = ((Speed)skills[2]).RelevantNoteCount(); double flashlightRating = Math.Sqrt(skills[3].DifficultyValue()) * difficulty_multiplier; double sliderFactor = aimRating > 0 ? aimRatingNoSliders / aimRating : 1; From ad95f037de2ead8f5da46f4f1201df5bb8cdde3a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 29 Jun 2022 16:42:53 +0900 Subject: [PATCH 1952/2328] Prevent another case of potential div-by-0 --- osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index 3e0f2a5638..76d93f536c 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -60,6 +60,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills return 0; double maxStrain = objectStrains.Max(); + + if (maxStrain == 0) + return 0; + return objectStrains.Aggregate((total, next) => total + (1.0 / (1.0 + Math.Exp(-(next / maxStrain * 12.0 - 6.0))))); } } From 6d91c0f375369c182312bfde644cae26443339a9 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 29 Jun 2022 16:57:10 +0900 Subject: [PATCH 1953/2328] Resolve inspection issue --- osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index 76d93f536c..a156726f94 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double DifficultyMultiplier => 1.04; private readonly double greatWindow; - private List objectStrains = new List(); + private readonly List objectStrains = new List(); public Speed(Mod[] mods, double hitWindowGreat) : base(mods) From 0e0e9968aca4027b8730a97942fdd71995dc4fd6 Mon Sep 17 00:00:00 2001 From: goodtrailer Date: Wed, 29 Jun 2022 01:23:35 -0700 Subject: [PATCH 1954/2328] Split ball and followcircle into default/legacy files --- .../TestSceneSliderApplication.cs | 5 +- .../Objects/Drawables/DrawableSlider.cs | 19 ++-- .../Drawables/DrawableSliderBall.cs} | 100 +++--------------- .../Skinning/Default/DefaultFollowCircle.cs | 33 ++++++ .../Skinning/Default/DefaultSliderBall.cs | 60 +++++++++++ .../Skinning/Legacy/LegacyFollowCircle.cs | 22 ++++ .../Legacy/OsuLegacySkinTransformer.cs | 10 +- 7 files changed, 147 insertions(+), 102 deletions(-) rename osu.Game.Rulesets.Osu/{Skinning/Default/SliderBall.cs => Objects/Drawables/DrawableSliderBall.cs} (67%) create mode 100644 osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs create mode 100644 osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs create mode 100644 osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderApplication.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderApplication.cs index 2981f1164d..08a62fe3ae 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderApplication.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderApplication.cs @@ -14,7 +14,6 @@ using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.Osu.Skinning.Default; using osu.Game.Skinning; using osu.Game.Tests.Visual; using osuTK; @@ -93,10 +92,10 @@ namespace osu.Game.Rulesets.Osu.Tests }); AddStep("set accent white", () => dho.AccentColour.Value = Color4.White); - AddAssert("ball is white", () => dho.ChildrenOfType().Single().AccentColour == Color4.White); + AddAssert("ball is white", () => dho.ChildrenOfType().Single().AccentColour == Color4.White); AddStep("set accent red", () => dho.AccentColour.Value = Color4.Red); - AddAssert("ball is red", () => dho.ChildrenOfType().Single().AccentColour == Color4.Red); + AddAssert("ball is red", () => dho.ChildrenOfType().Single().AccentColour == Color4.Red); } private Slider prepareObject(Slider slider) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 9e3b762690..91bb7f95f6 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -29,7 +29,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public DrawableSliderHead HeadCircle => headContainer.Child; public DrawableSliderTail TailCircle => tailContainer.Child; - public SliderBall Ball { get; private set; } + [Cached] + public DrawableSliderBall Ball { get; private set; } + public SkinnableDrawable Body { get; private set; } /// @@ -60,6 +62,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public DrawableSlider([CanBeNull] Slider s = null) : base(s) { + Ball = new DrawableSliderBall + { + GetInitialHitAction = () => HeadCircle.HitAction, + BypassAutoSizeAxes = Axes.Both, + AlwaysPresent = true, + Alpha = 0 + }; } [BackgroundDependencyLoader] @@ -73,13 +82,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables repeatContainer = new Container { RelativeSizeAxes = Axes.Both }, headContainer = new Container { RelativeSizeAxes = Axes.Both }, OverlayElementContainer = new Container { RelativeSizeAxes = Axes.Both, }, - Ball = new SliderBall(this) - { - GetInitialHitAction = () => HeadCircle.HitAction, - BypassAutoSizeAxes = Axes.Both, - AlwaysPresent = true, - Alpha = 0 - }, + Ball, slidingSample = new PausableSkinnableSound { Looping = true } }; diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderBall.cs similarity index 67% rename from osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderBall.cs index 389e9343e7..7bde60b39d 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderBall.cs @@ -7,24 +7,21 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Types; -using osu.Game.Rulesets.Osu.Objects; -using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Rulesets.Osu.Skinning.Default; using osu.Game.Skinning; using osuTK; using osuTK.Graphics; -namespace osu.Game.Rulesets.Osu.Skinning.Default +namespace osu.Game.Rulesets.Osu.Objects.Drawables { - public class SliderBall : CircularContainer, ISliderProgress, IRequireHighFrequencyMousePosition, IHasAccentColour + public class DrawableSliderBall : CircularContainer, ISliderProgress, IRequireHighFrequencyMousePosition, IHasAccentColour { public Func GetInitialHitAction; @@ -34,14 +31,15 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default set => ball.Colour = value; } - private readonly Drawable followCircle; - private readonly Drawable fullSizeFollowCircle; - private readonly DrawableSlider drawableSlider; - private readonly Drawable ball; + private Drawable followCircle; + private Drawable followCircleReceptor; + private DrawableSlider drawableSlider; + private Drawable ball; - public SliderBall(DrawableSlider drawableSlider) + [BackgroundDependencyLoader] + private void load(DrawableHitObject drawableSlider) { - this.drawableSlider = drawableSlider; + this.drawableSlider = (DrawableSlider)drawableSlider; Origin = Anchor.Centre; @@ -49,15 +47,14 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default Children = new[] { - followCircle = new FollowCircleContainer + followCircle = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SliderFollowCircle), _ => new DefaultFollowCircle()) { Origin = Anchor.Centre, Anchor = Anchor.Centre, RelativeSizeAxes = Axes.Both, Alpha = 0, - Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SliderFollowCircle), _ => new DefaultFollowCircle()), }, - fullSizeFollowCircle = new CircularContainer + followCircleReceptor = new CircularContainer { Origin = Anchor.Centre, Anchor = Anchor.Centre, @@ -106,7 +103,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default tracking = value; - fullSizeFollowCircle.Scale = new Vector2(tracking ? 2.4f : 1f); + followCircleReceptor.Scale = new Vector2(tracking ? 2.4f : 1f); followCircle.ScaleTo(tracking ? 2.4f : 1f, 300, Easing.OutQuint); followCircle.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint); @@ -167,7 +164,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default // in valid time range Time.Current >= drawableSlider.HitObject.StartTime && Time.Current < drawableSlider.HitObject.EndTime && // in valid position range - lastScreenSpaceMousePosition.HasValue && fullSizeFollowCircle.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) && + lastScreenSpaceMousePosition.HasValue && followCircleReceptor.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) && // valid action (actions?.Any(isValidTrackingAction) ?? false); @@ -205,74 +202,5 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default ball.Rotation = -90 + (float)(-Math.Atan2(diff.X, diff.Y) * 180 / Math.PI); lastPosition = Position; } - - private class FollowCircleContainer : CircularContainer - { - public override bool HandlePositionalInput => true; - } - - public class DefaultFollowCircle : CompositeDrawable - { - public DefaultFollowCircle() - { - RelativeSizeAxes = Axes.Both; - - InternalChild = new CircularContainer - { - RelativeSizeAxes = Axes.Both, - Masking = true, - BorderThickness = 5, - BorderColour = Color4.Orange, - Blending = BlendingParameters.Additive, - Child = new Box - { - Colour = Color4.Orange, - RelativeSizeAxes = Axes.Both, - Alpha = 0.2f, - } - }; - } - } - - public class DefaultSliderBall : CompositeDrawable - { - private Box box; - - [BackgroundDependencyLoader] - private void load(DrawableHitObject drawableObject, ISkinSource skin) - { - var slider = (DrawableSlider)drawableObject; - - RelativeSizeAxes = Axes.Both; - - float radius = skin.GetConfig(OsuSkinConfiguration.SliderPathRadius)?.Value ?? OsuHitObject.OBJECT_RADIUS; - - InternalChild = new CircularContainer - { - Masking = true, - RelativeSizeAxes = Axes.Both, - Scale = new Vector2(radius / OsuHitObject.OBJECT_RADIUS), - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Blending = BlendingParameters.Additive, - BorderThickness = 10, - BorderColour = Color4.White, - Alpha = 1, - Child = box = new Box - { - Blending = BlendingParameters.Additive, - RelativeSizeAxes = Axes.Both, - Colour = Color4.White, - AlwaysPresent = true, - Alpha = 0 - } - }; - - slider.Tracking.BindValueChanged(trackingChanged, true); - } - - private void trackingChanged(ValueChangedEvent tracking) => - box.FadeTo(tracking.NewValue ? 0.3f : 0.05f, 200, Easing.OutQuint); - } } } diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs new file mode 100644 index 0000000000..8211448705 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs @@ -0,0 +1,33 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osuTK.Graphics; + +namespace osu.Game.Rulesets.Osu.Skinning.Default +{ + public class DefaultFollowCircle : CompositeDrawable + { + public DefaultFollowCircle() + { + RelativeSizeAxes = Axes.Both; + + InternalChild = new CircularContainer + { + RelativeSizeAxes = Axes.Both, + Masking = true, + BorderThickness = 5, + BorderColour = Color4.Orange, + Blending = BlendingParameters.Additive, + Child = new Box + { + Colour = Color4.Orange, + RelativeSizeAxes = Axes.Both, + Alpha = 0.2f, + } + }; + } + } +} diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs new file mode 100644 index 0000000000..47308375e6 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs @@ -0,0 +1,60 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable + +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Skinning; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Rulesets.Osu.Skinning.Default +{ + public class DefaultSliderBall : CompositeDrawable + { + private Box box; + + [BackgroundDependencyLoader] + private void load(DrawableHitObject drawableObject, ISkinSource skin) + { + var slider = (DrawableSlider)drawableObject; + + RelativeSizeAxes = Axes.Both; + + float radius = skin.GetConfig(OsuSkinConfiguration.SliderPathRadius)?.Value ?? OsuHitObject.OBJECT_RADIUS; + + InternalChild = new CircularContainer + { + Masking = true, + RelativeSizeAxes = Axes.Both, + Scale = new Vector2(radius / OsuHitObject.OBJECT_RADIUS), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Blending = BlendingParameters.Additive, + BorderThickness = 10, + BorderColour = Color4.White, + Alpha = 1, + Child = box = new Box + { + Blending = BlendingParameters.Additive, + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + AlwaysPresent = true, + Alpha = 0 + } + }; + + slider.Tracking.BindValueChanged(trackingChanged, true); + } + + private void trackingChanged(ValueChangedEvent tracking) => + box.FadeTo(tracking.NewValue ? 0.3f : 0.05f, 200, Easing.OutQuint); + } +} diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs new file mode 100644 index 0000000000..b8a559ce07 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs @@ -0,0 +1,22 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Rulesets.Osu.Skinning.Legacy +{ + public class LegacyFollowCircle : CompositeDrawable + { + public LegacyFollowCircle(Drawable animationContent) + { + // follow circles are 2x the hitcircle resolution in legacy skins (since they are scaled down from >1x + animationContent.Scale *= 0.5f; + animationContent.Anchor = Anchor.Centre; + animationContent.Origin = Anchor.Centre; + + RelativeSizeAxes = Axes.Both; + InternalChild = animationContent; + } + } +} diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs index e7d28a9bd7..885a2c12fb 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs @@ -41,11 +41,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy return this.GetAnimation(component.LookupName, false, false); case OsuSkinComponents.SliderFollowCircle: - var followCircle = this.GetAnimation("sliderfollowcircle", true, true, true); - if (followCircle != null) - // follow circles are 2x the hitcircle resolution in legacy skins (since they are scaled down from >1x - followCircle.Scale *= 0.5f; - return followCircle; + var followCircleContent = this.GetAnimation("sliderfollowcircle", true, true, true); + if (followCircleContent != null) + return new LegacyFollowCircle(followCircleContent); + + return null; case OsuSkinComponents.SliderBall: var sliderBallContent = this.GetAnimation("sliderb", true, true, animationSeparator: ""); From b092e6937a6d9fbec870b2804470935b0392466b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Jun 2022 18:51:07 +0900 Subject: [PATCH 1955/2328] Guard against ruleset icon creation failures to avoid whole game death --- osu.Game/Rulesets/RulesetSelector.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/RulesetSelector.cs b/osu.Game/Rulesets/RulesetSelector.cs index 35244eb86e..1909e741f0 100644 --- a/osu.Game/Rulesets/RulesetSelector.cs +++ b/osu.Game/Rulesets/RulesetSelector.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Allocation; +using osu.Framework.Logging; namespace osu.Game.Rulesets { @@ -19,7 +20,16 @@ namespace osu.Game.Rulesets private void load() { foreach (var r in Rulesets.AvailableRulesets) - AddItem(r); + { + try + { + AddItem(r); + } + catch + { + Logger.Log($"Could not create ruleset icon for {r.Name}. Please check for an update.", level: LogLevel.Error); + } + } } } } From 6c64cea057121dbb49458eb21e69c7ae9ddfbb72 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Jun 2022 18:56:15 +0900 Subject: [PATCH 1956/2328] Catch a second location --- osu.Game/Overlays/Settings/SettingsFooter.cs | 24 +++++++++++++------- osu.Game/Rulesets/RulesetSelector.cs | 6 ++--- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsFooter.cs b/osu.Game/Overlays/Settings/SettingsFooter.cs index 2f182d537f..b9ac1aa53b 100644 --- a/osu.Game/Overlays/Settings/SettingsFooter.cs +++ b/osu.Game/Overlays/Settings/SettingsFooter.cs @@ -8,6 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Development; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Logging; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -32,16 +33,23 @@ namespace osu.Game.Overlays.Settings foreach (var ruleset in rulesets.AvailableRulesets) { - var icon = new ConstrainedIconContainer + try { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Icon = ruleset.CreateInstance().CreateIcon(), - Colour = Color4.Gray, - Size = new Vector2(20), - }; + var icon = new ConstrainedIconContainer + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Icon = ruleset.CreateInstance().CreateIcon(), + Colour = Color4.Gray, + Size = new Vector2(20), + }; - modes.Add(icon); + modes.Add(icon); + } + catch + { + Logger.Log($"Could not create ruleset icon for {ruleset.Name}. Please check for an update from the developer.", level: LogLevel.Error); + } } Children = new Drawable[] diff --git a/osu.Game/Rulesets/RulesetSelector.cs b/osu.Game/Rulesets/RulesetSelector.cs index 1909e741f0..701e60eec9 100644 --- a/osu.Game/Rulesets/RulesetSelector.cs +++ b/osu.Game/Rulesets/RulesetSelector.cs @@ -19,15 +19,15 @@ namespace osu.Game.Rulesets [BackgroundDependencyLoader] private void load() { - foreach (var r in Rulesets.AvailableRulesets) + foreach (var ruleset in Rulesets.AvailableRulesets) { try { - AddItem(r); + AddItem(ruleset); } catch { - Logger.Log($"Could not create ruleset icon for {r.Name}. Please check for an update.", level: LogLevel.Error); + Logger.Log($"Could not create ruleset icon for {ruleset.Name}. Please check for an update from the developer.", level: LogLevel.Error); } } } From e3eba58cb644773817e57b2f94ae9e9781bbd913 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 29 Jun 2022 13:37:17 +0300 Subject: [PATCH 1957/2328] Catch in triangles intro --- osu.Game/Screens/Menu/IntroTriangles.cs | 34 ++++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index d59a07a350..ad098ae8df 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -4,7 +4,6 @@ #nullable disable using System; -using System.Collections.Generic; using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -14,6 +13,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Textures; +using osu.Framework.Logging; using osu.Framework.Utils; using osu.Framework.Timing; using osu.Game.Graphics; @@ -340,24 +340,28 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader] private void load(RulesetStore rulesets) { - var modes = new List(); - - foreach (var ruleset in rulesets.AvailableRulesets) - { - var icon = new ConstrainedIconContainer - { - Icon = ruleset.CreateInstance().CreateIcon(), - Size = new Vector2(30), - }; - - modes.Add(icon); - } - AutoSizeAxes = Axes.Both; - Children = modes; Anchor = Anchor.Centre; Origin = Anchor.Centre; + + foreach (var ruleset in rulesets.AvailableRulesets) + { + try + { + var icon = new ConstrainedIconContainer + { + Icon = ruleset.CreateInstance().CreateIcon(), + Size = new Vector2(30), + }; + + Add(icon); + } + catch + { + Logger.Log($"Could not create ruleset icon for {ruleset.Name}. Please check for an update from the developer.", level: LogLevel.Error); + } + } } } From 87e3b4418113831cb612109a4813bfac115b8e86 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 29 Jun 2022 13:37:02 +0300 Subject: [PATCH 1958/2328] Ensure icon is loaded inside try-catch --- osu.Game/Overlays/Settings/SettingsFooter.cs | 56 ++++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsFooter.cs b/osu.Game/Overlays/Settings/SettingsFooter.cs index b9ac1aa53b..db0dc8fd5e 100644 --- a/osu.Game/Overlays/Settings/SettingsFooter.cs +++ b/osu.Game/Overlays/Settings/SettingsFooter.cs @@ -3,7 +3,6 @@ #nullable disable -using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Development; using osu.Framework.Graphics; @@ -29,7 +28,33 @@ namespace osu.Game.Overlays.Settings Direction = FillDirection.Vertical; Padding = new MarginPadding { Top = 20, Bottom = 30, Horizontal = SettingsPanel.CONTENT_MARGINS }; - var modes = new List(); + FillFlowContainer modes; + + Children = new Drawable[] + { + modes = new FillFlowContainer + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Direction = FillDirection.Full, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Spacing = new Vector2(5), + Padding = new MarginPadding { Bottom = 10 }, + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = game.Name, + Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold), + }, + new BuildDisplay(game.Version, DebugUtils.IsDebugBuild) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + } + }; foreach (var ruleset in rulesets.AvailableRulesets) { @@ -51,33 +76,6 @@ namespace osu.Game.Overlays.Settings Logger.Log($"Could not create ruleset icon for {ruleset.Name}. Please check for an update from the developer.", level: LogLevel.Error); } } - - Children = new Drawable[] - { - new FillFlowContainer - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Direction = FillDirection.Full, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Children = modes, - Spacing = new Vector2(5), - Padding = new MarginPadding { Bottom = 10 }, - }, - new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Text = game.Name, - Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold), - }, - new BuildDisplay(game.Version, DebugUtils.IsDebugBuild) - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - } - }; } private class BuildDisplay : OsuAnimatedButton From 32af4e41eaa3805ddc2ffb94909f289877aa1996 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Jun 2022 20:56:01 +0900 Subject: [PATCH 1959/2328] Add back thread safety and locking as required --- osu.Game/Database/RealmAccess.cs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 715066f32d..728cd5c7c3 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -446,8 +446,12 @@ namespace osu.Game.Database { Func action = realm => query(realm).QueryAsyncWithNotifications(callback); - // Store an action which is used when blocking to ensure consumers don't use results of a stale changeset firing. - notificationsResetMap.Add(action, () => callback(new EmptyRealmSet(), null, null)); + lock (notificationsResetMap) + { + // Store an action which is used when blocking to ensure consumers don't use results of a stale changeset firing. + notificationsResetMap.Add(action, () => callback(new EmptyRealmSet(), null, null)); + } + return RegisterCustomSubscription(action); } @@ -543,7 +547,12 @@ namespace osu.Game.Database { unsubscriptionAction?.Dispose(); customSubscriptionsResetMap.Remove(action); - notificationsResetMap.Remove(action); + + lock (notificationsResetMap) + { + notificationsResetMap.Remove(action); + } + total_subscriptions.Value--; } } @@ -805,6 +814,9 @@ namespace osu.Game.Database /// An which should be disposed to end the blocking section. public IDisposable BlockAllOperations() { + if (!ThreadSafety.IsUpdateThread) + throw new InvalidOperationException(@$"{nameof(BlockAllOperations)} must be called from the update thread."); + if (isDisposed) throw new ObjectDisposedException(nameof(RealmAccess)); @@ -816,9 +828,6 @@ namespace osu.Game.Database if (hasInitialisedOnce) { - if (!ThreadSafety.IsUpdateThread) - throw new InvalidOperationException(@$"{nameof(BlockAllOperations)} must be called from the update thread."); - syncContext = SynchronizationContext.Current; // Before disposing the update context, clean up all subscriptions. From 18d465eff7dc30e4d9c5ad5ee6a0d277e2012dc5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Jun 2022 21:02:23 +0900 Subject: [PATCH 1960/2328] Guard against `NaN` star difficulty results --- osu.Game/Beatmaps/BeatmapDifficultyCache.cs | 2 +- osu.Game/Beatmaps/StarDifficulty.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapDifficultyCache.cs b/osu.Game/Beatmaps/BeatmapDifficultyCache.cs index ef0fa36b16..611b47c120 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyCache.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyCache.cs @@ -207,7 +207,7 @@ namespace osu.Game.Beatmaps if (cancellationToken.IsCancellationRequested) return; - var starDifficulty = task.GetResultSafely(); + StarDifficulty? starDifficulty = task.GetResultSafely(); if (starDifficulty != null) bindable.Value = starDifficulty.Value; diff --git a/osu.Game/Beatmaps/StarDifficulty.cs b/osu.Game/Beatmaps/StarDifficulty.cs index e042f1c698..6aac275a6a 100644 --- a/osu.Game/Beatmaps/StarDifficulty.cs +++ b/osu.Game/Beatmaps/StarDifficulty.cs @@ -34,7 +34,7 @@ namespace osu.Game.Beatmaps /// public StarDifficulty([NotNull] DifficultyAttributes attributes) { - Stars = attributes.StarRating; + Stars = double.IsFinite(attributes.StarRating) ? attributes.StarRating : 0; MaxCombo = attributes.MaxCombo; Attributes = attributes; // Todo: Add more members (BeatmapInfo.DifficultyRating? Attributes? Etc...) @@ -46,7 +46,7 @@ namespace osu.Game.Beatmaps /// public StarDifficulty(double starDifficulty, int maxCombo) { - Stars = starDifficulty; + Stars = double.IsFinite(starDifficulty) ? starDifficulty : 0; MaxCombo = maxCombo; Attributes = null; } From 7cb4e32c17ffb61c91c7b5d9e84c1f0729839e33 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Jun 2022 22:45:19 +0900 Subject: [PATCH 1961/2328] Add one more lock to appease CI --- osu.Game/Database/RealmAccess.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 59a235dbc2..8cf9bb4a47 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -880,8 +880,11 @@ namespace osu.Game.Database try { - foreach (var action in notificationsResetMap.Values) - action(); + lock (notificationsResetMap) + { + foreach (var action in notificationsResetMap.Values) + action(); + } } finally { From fd0d8b1ce3d5062b349484436d035d35a13a0e88 Mon Sep 17 00:00:00 2001 From: cdwcgt Date: Wed, 29 Jun 2022 22:50:47 +0900 Subject: [PATCH 1962/2328] Add button state, fix async issues, watch replay method Most borrowed from `ReplayDownloadButton` --- osu.Game/Screens/Play/FailOverlay.cs | 8 +- osu.Game/Screens/Play/Player.cs | 7 +- .../Screens/Play/SaveFailedScoreButton.cs | 93 +++++++++++++++---- 3 files changed, 86 insertions(+), 22 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 881791271b..75b06f859d 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -4,6 +4,8 @@ #nullable disable using System; +using System.Threading.Tasks; +using osu.Game.Scoring; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osuTK; @@ -18,7 +20,7 @@ namespace osu.Game.Screens.Play { public class FailOverlay : GameplayMenuOverlay { - public Action SaveReplay; + public Func> SaveReplay; public override string Header => "failed"; public override string Description => "you're dead, try again?"; @@ -52,10 +54,8 @@ namespace osu.Game.Screens.Play Direction = FillDirection.Horizontal, Children = new Drawable[] { - new SaveFailedScoreButton() + new SaveFailedScoreButton(SaveReplay) { - OnSave = SaveReplay, - RelativeSizeAxes = Axes.Y, Width = 300 }, } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 8223ed1e3d..f20cb74db6 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -1043,7 +1043,7 @@ namespace osu.Game.Screens.Play return base.OnExiting(e); } - private async void saveFailedReplay() + private async Task saveFailedReplay() { Score.ScoreInfo.Passed = false; Score.ScoreInfo.Rank = ScoreRank.F; @@ -1051,12 +1051,15 @@ namespace osu.Game.Screens.Play try { - await ImportScore(scoreCopy).ConfigureAwait(false); + await ImportScore(scoreCopy); } catch (Exception ex) { Logger.Error(ex, @"Score import failed!"); + return null; } + + return scoreCopy.ScoreInfo; } /// diff --git a/osu.Game/Screens/Play/SaveFailedScoreButton.cs b/osu.Game/Screens/Play/SaveFailedScoreButton.cs index 3efd8fa4a3..b5727487dc 100644 --- a/osu.Game/Screens/Play/SaveFailedScoreButton.cs +++ b/osu.Game/Screens/Play/SaveFailedScoreButton.cs @@ -1,11 +1,16 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Threading; +using osu.Game.Scoring; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Online; @@ -15,14 +20,25 @@ namespace osu.Game.Screens.Play { public class SaveFailedScoreButton : CompositeDrawable { - public Action? OnSave; + public Func> SaveReplay; + private Task saveReplayAsync; + private ScoreInfo score; - protected readonly Bindable State = new Bindable(); + private ScheduledDelegate saveScoreDelegate; + + protected readonly Bindable State = new Bindable(); private DownloadButton button; private ShakeContainer shakeContainer; - public SaveFailedScoreButton() + public SaveFailedScoreButton(Func> sr) + { + Size = new Vector2(50, 30); + SaveReplay = sr; + } + + [BackgroundDependencyLoader(true)] + private void load(OsuGame game) { InternalChild = shakeContainer = new ShakeContainer { @@ -32,17 +48,16 @@ namespace osu.Game.Screens.Play RelativeSizeAxes = Axes.Both, } }; - Size = new Vector2(50, 30); - } - [BackgroundDependencyLoader] - private void load() - { button.Action = () => { switch (State.Value) { - case DownloadState.LocallyAvailable: + case ImportState.Imported: + game?.PresentScore(score, ScorePresentType.Gameplay); + break; + + case ImportState.Importing: shakeContainer.Shake(); break; @@ -52,23 +67,61 @@ namespace osu.Game.Screens.Play } }; State.BindValueChanged(updateTooltip, true); + State.BindValueChanged(state => + { + switch (state.NewValue) + { + case ImportState.Imported: + button.State.Value = DownloadState.LocallyAvailable; + break; + + case ImportState.Importing: + button.State.Value = DownloadState.Importing; + break; + + case ImportState.Failed: + button.State.Value = DownloadState.NotDownloaded; + break; + } + }, true); } private void saveScore() { - if (State.Value != DownloadState.LocallyAvailable) - OnSave?.Invoke(); + State.Value = ImportState.Importing; + saveReplayAsync = Task.Run(SaveReplay); - State.Value = DownloadState.LocallyAvailable; - button.State.Value = DownloadState.LocallyAvailable; + saveScoreDelegate = new ScheduledDelegate(() => + { + if (saveReplayAsync?.IsCompleted != true) + // If the asynchronous preparation has not completed, keep repeating this delegate. + return; + + saveScoreDelegate?.Cancel(); + + score = saveReplayAsync.GetAwaiter().GetResult(); + + State.Value = score != null ? ImportState.Imported : ImportState.Failed; + }, Time.Current, 50); + + Scheduler.Add(saveScoreDelegate); } - private void updateTooltip(ValueChangedEvent state) + private void updateTooltip(ValueChangedEvent state) { switch (state.NewValue) { - case DownloadState.LocallyAvailable: - button.TooltipText = @"Score saved"; + case ImportState.Imported: + button.TooltipText = @"Watch replay"; + break; + + case ImportState.Importing: + button.TooltipText = @"Importing score"; + break; + + case ImportState.Failed: + button.State.Value = DownloadState.NotDownloaded; + button.TooltipText = @"Import failed, click button to re-import"; break; default: @@ -76,5 +129,13 @@ namespace osu.Game.Screens.Play break; } } + + public enum ImportState + { + NotImported, + Failed, + Importing, + Imported + } } } From 582175c3a429e36e4d58798693518c0fffc3508d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Jun 2022 22:57:52 +0900 Subject: [PATCH 1963/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 2ef3bb2dd1..584fe0a3ef 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index ab690b22a6..ff223f5107 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index a84fc40a45..b8a4aca02e 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 13108155d3e4ef0ca2e19d520e9ddfcf2c8a4b95 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 03:43:56 +0900 Subject: [PATCH 1964/2328] Fix crash on visual esting `TestSceneChatOverlay` due to null user --- osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs index d2d9b9a9e5..247ea52648 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs @@ -39,7 +39,8 @@ namespace osu.Game.Tests.Visual.Online private TestChatOverlay chatOverlay; private ChannelManager channelManager; - private APIUser testUser; + private readonly APIUser testUser = new APIUser { Username = "test user", Id = 5071479 }; + private Channel[] testChannels; private Channel testChannel1 => testChannels[0]; @@ -51,7 +52,6 @@ namespace osu.Game.Tests.Visual.Online [SetUp] public void SetUp() => Schedule(() => { - testUser = new APIUser { Username = "test user", Id = 5071479 }; testChannels = Enumerable.Range(1, 10).Select(createPublicChannel).ToArray(); Child = new DependencyProvidingContainer From 46cbbf5c6eb240b416ee24445ed8aa5beeead54a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 04:45:02 +0900 Subject: [PATCH 1965/2328] Fix flaky song select placeholder test by changing ruleset post-display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Was failing occasionally due to the beatmap present operation causing the test's ruleset change to undo. ```csharp TearDown : System.TimeoutException : "wait for placeholder visible" timed out --TearDown at osu.Framework.Testing.Drawables.Steps.UntilStepButton.<>c__DisplayClass11_0.<.ctor>b__0() at osu.Framework.Testing.Drawables.Steps.StepButton.PerformStep(Boolean userTriggered) at osu.Framework.Testing.TestScene.runNextStep(Action onCompletion, Action`1 onError, Func`2 stopCondition) --- End of stack trace from previous location --- at osu.Framework.Testing.TestSceneTestRunner.TestRunner.RunTestBlocking(TestScene test) at osu.Game.Tests.Visual.OsuTestScene.OsuTestSceneTestRunner.RunTestBlocking(TestScene test) in /opt/buildagent/work/ecd860037212ac52/osu.Game/Tests/Visual/OsuTestScene.cs:line 503 at osu.Framework.Testing.TestScene.RunTestsFromNUnit() ------- Stdout: ------- [runtime] 2022-06-29 10:36:45 [verbose]: 💨 Class: TestScenePlaySongSelect [runtime] 2022-06-29 10:36:45 [verbose]: 🔶 Test: TestPlaceholderConvertSetting [runtime] 2022-06-29 10:36:45 [verbose]: 🔸 Step #1 exit all screens [runtime] 2022-06-29 10:36:45 [verbose]: 🔸 Step #2 reset defaults [runtime] 2022-06-29 10:36:45 [verbose]: 🔸 Step #3 delete all beatmaps [runtime] 2022-06-29 10:36:45 [verbose]: 🔸 Step #4 change ruleset to 2 [runtime] 2022-06-29 10:36:45 [verbose]: 🔸 Step #5 import test map for ruleset 0 [database] 2022-06-29 10:36:45 [verbose]: [efc1a] Beginning import from unknown... [database] 2022-06-29 10:36:45 [verbose]: [efc1a] Import successfully completed! [runtime] 2022-06-29 10:36:45 [verbose]: 🔸 Step #6 wait for imported to arrive in carousel [runtime] 2022-06-29 10:36:45 [verbose]: 🔸 Step #7 change convert setting [runtime] 2022-06-29 10:36:45 [verbose]: 🔸 Step #8 create song select [runtime] 2022-06-29 10:36:45 [verbose]: ScreenTestScene screen changed → TestScenePlaySongSelect+TestSongSelect [runtime] 2022-06-29 10:36:45 [verbose]: 📺 ScreenTestScene(OsuScreenStack)#338(depth:1) loading TestScenePlaySongSelect+TestSongSelect#263 [runtime] 2022-06-29 10:36:45 [verbose]: decoupled ruleset transferred ("" -> "osu!catch") [runtime] 2022-06-29 10:36:45 [verbose]: 🔸 Step #9 wait for present [runtime] 2022-06-29 10:36:45 [verbose]: 📺 ScreenTestScene(OsuScreenStack)#338(depth:1) entered TestScenePlaySongSelect+TestSongSelect#263 [runtime] 2022-06-29 10:36:45 [verbose]: 📺 BackgroundScreenStack#328(depth:1) loading BackgroundScreenBeatmap#338 [runtime] 2022-06-29 10:36:45 [verbose]: 📺 BackgroundScreenStack#328(depth:1) entered BackgroundScreenBeatmap#338 [runtime] 2022-06-29 10:36:45 [verbose]: Song select updating selection with beatmap:null ruleset:fruits [runtime] 2022-06-29 10:36:45 [verbose]: Song select changing beatmap from "please load a beatmap! - no beatmaps available!" to "null" [runtime] 2022-06-29 10:36:45 [verbose]: Song select working beatmap updated to Some Artist 0 - Some Song (set id 6224) ece7b702-895c-4f15-892f-05e4ff5e9a24 (Some Guy 3) [Normal 6224000 (length 0:50, bpm 106.7)] [runtime] 2022-06-29 10:36:45 [verbose]: Song select updating selection with beatmap:null ruleset:osu [runtime] 2022-06-29 10:36:45 [verbose]: decoupled ruleset transferred ("osu!catch" -> "osu!") [runtime] 2022-06-29 10:36:45 [verbose]: Song select updating selection with beatmap:74232aa2-2a1f-4920-b643-e85976838251 ruleset:osu [runtime] 2022-06-29 10:36:45 [verbose]: Song select decided to ensurePlayingSelected [runtime] 2022-06-29 10:36:45 [verbose]: Game-wide working beatmap updated to Some Artist 0 - Some Song (set id 6224) ece7b702-895c-4f15-892f-05e4ff5e9a24 (Some Guy 3) [Normal 6224000 (length 0:50, bpm 106.7)] [runtime] 2022-06-29 10:36:45 [debug]: Focus changed from nothing to SeekLimitedSearchTextBox. [network] 2022-06-29 10:36:45 [verbose]: Failing request osu.Game.Online.API.Requests.GetBeatmapRequest (System.InvalidOperationException: DummyAPIAccess cannot process this request.) [runtime] 2022-06-29 10:36:45 [verbose]: ✔️ 16 repetitions [runtime] 2022-06-29 10:36:45 [verbose]: 🔸 Step #10 wait for carousel loaded [runtime] 2022-06-29 10:36:45 [verbose]: 🔸 Step #11 wait for placeholder visible [runtime] 2022-06-29 10:36:55 [verbose]: 💥 Failed (on attempt 1,459) [runtime] 2022-06-29 10:36:55 [verbose]: ⏳ Currently loading components (0) [runtime] 2022-06-29 10:36:55 [verbose]: 🧵 Task schedulers [runtime] 2022-06-29 10:36:55 [verbose]: LoadComponentsAsync (standard) concurrency:4 running:0 pending:0 [runtime] 2022-06-29 10:36:55 [verbose]: LoadComponentsAsync (long load) concurrency:4 running:0 pending:0 [runtime] 2022-06-29 10:36:55 [verbose]: 🎱 Thread pool [runtime] 2022-06-29 10:36:55 [verbose]: worker: min 1 max 32,767 available 32,766 [runtime] 2022-06-29 10:36:55 [verbose]: completion: min 1 max 1,000 available 1,000 [runtime] 2022-06-29 10:36:55 [debug]: Focus on "SeekLimitedSearchTextBox" no longer valid as a result of unfocusIfNoLongerValid. [runtime] 2022-06-29 10:36:55 [debug]: Focus changed from SeekLimitedSearchTextBox to nothing. ``` --- osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 6d881555da..6896b442e0 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -100,12 +100,13 @@ namespace osu.Game.Tests.Visual.SongSelect [Test] public void TestPlaceholderConvertSetting() { - changeRuleset(2); addRulesetImportStep(0); AddStep("change convert setting", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, false)); createSongSelect(); + changeRuleset(2); + AddUntilStep("wait for placeholder visible", () => getPlaceholder()?.State.Value == Visibility.Visible); AddStep("click link in placeholder", () => getPlaceholder().ChildrenOfType().First().TriggerClick()); From 8171deec494d8b1a2f9794453bb54f8d88821ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 29 Jun 2022 22:38:06 +0200 Subject: [PATCH 1966/2328] Attempt to fix editor navigation test failures again First of all, stop relying that `InputManager` will successfully press the gameplay test button, because it won't if it's obscured by the notification overlay. Closing the overlay in a loop doesn't work because there's a chance that a notification is posted, then all overlays are closed, then another notification is posted, and so the button still isn't clickable. Instead, use the `TestGameplay()` method directly. Secondly, the notifications will still block `EditorPlayerLoader` from transitioning to `EditorPlayer`. Here we have no other choice than to aggressively dismiss notifications every spin of the relevant until step and hope we eventually progress to `EditorPlayer`. --- .../Editing/TestSceneEditorNavigation.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs index a21ef6f897..327d581e37 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorNavigation.cs @@ -6,18 +6,14 @@ using NUnit.Framework; using osu.Framework.Extensions; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.ObjectExtensions; -using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Database; -using osu.Game.Overlays.Notifications; using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Edit; -using osu.Game.Screens.Edit.Components.Timelines.Summary; using osu.Game.Screens.Edit.GameplayTest; using osu.Game.Screens.Select; using osu.Game.Tests.Resources; -using osuTK.Input; namespace osu.Game.Tests.Visual.Editing { @@ -36,20 +32,21 @@ namespace osu.Game.Tests.Visual.Editing () => Game.Beatmap.Value.BeatmapSetInfo.Equals(beatmapSet) && Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect && songSelect.IsLoaded); - AddUntilStep("wait for completion notification", () => Game.Notifications.ChildrenOfType().Count() == 1); - AddStep("dismiss notifications", () => Game.Notifications.Hide()); AddStep("switch ruleset", () => Game.Ruleset.Value = new ManiaRuleset().RulesetInfo); AddStep("open editor", () => ((PlaySongSelect)Game.ScreenStack.CurrentScreen).Edit(beatmapSet.Beatmaps.First(beatmap => beatmap.Ruleset.OnlineID == 0))); AddUntilStep("wait for editor open", () => Game.ScreenStack.CurrentScreen is Editor editor && editor.ReadyForUse); - AddStep("test gameplay", () => + AddStep("test gameplay", () => ((Editor)Game.ScreenStack.CurrentScreen).TestGameplay()); + + AddUntilStep("wait for player", () => { - var testGameplayButton = this.ChildrenOfType().Single(); - InputManager.MoveMouseTo(testGameplayButton); - InputManager.Click(MouseButton.Left); + // notifications may fire at almost any inopportune time and cause annoying test failures. + // relentlessly attempt to dismiss any and all interfering overlays, which includes notifications. + // this is theoretically not foolproof, but it's the best that can be done here. + Game.CloseAllOverlays(); + return Game.ScreenStack.CurrentScreen is EditorPlayer editorPlayer && editorPlayer.IsLoaded; }); - AddUntilStep("wait for player", () => Game.ScreenStack.CurrentScreen is EditorPlayer editorPlayer && editorPlayer.IsLoaded); AddAssert("current ruleset is osu!", () => Game.Ruleset.Value.Equals(new OsuRuleset().RulesetInfo)); AddStep("exit to song select", () => Game.PerformFromScreen(_ => { }, typeof(PlaySongSelect).Yield())); From c5d31f50cd4053adedaa4787edc0fcb1222bbc6e Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 30 Jun 2022 11:21:15 +0900 Subject: [PATCH 1967/2328] Attempt to fix flaky TestSceneAutoplay test --- .../Visual/Gameplay/TestSceneAutoplay.cs | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs index 019bfe322e..47c8dc0f8d 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs @@ -6,10 +6,10 @@ using System.ComponentModel; using System.Linq; using osu.Framework.Testing; -using osu.Game.Beatmaps.Timing; using osu.Game.Graphics.Containers; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play; using osu.Game.Screens.Play.Break; @@ -31,19 +31,20 @@ namespace osu.Game.Tests.Visual.Gameplay protected override void AddCheckSteps() { + // It doesn't matter which ruleset is used - this beatmap is only used for reference. + var beatmap = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo); + AddUntilStep("score above zero", () => Player.ScoreProcessor.TotalScore.Value > 0); AddUntilStep("key counter counted keys", () => Player.HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 2)); - seekToBreak(0); + + seekTo(beatmap.Beatmap.Breaks[0].StartTime); AddAssert("keys not counting", () => !Player.HUDOverlay.KeyCounter.IsCounting); AddAssert("overlay displays 100% accuracy", () => Player.BreakOverlay.ChildrenOfType().Single().AccuracyDisplay.Current.Value == 1); + AddStep("rewind", () => Player.GameplayClockContainer.Seek(-80000)); AddUntilStep("key counter reset", () => Player.HUDOverlay.KeyCounter.Children.All(kc => kc.CountPresses == 0)); - seekToBreak(0); - seekToBreak(1); - - AddStep("seek to completion", () => Player.GameplayClockContainer.Seek(Player.DrawableRuleset.Objects.Last().GetEndTime())); - + seekTo(beatmap.Beatmap.HitObjects[^1].GetEndTime()); AddUntilStep("results displayed", () => getResultsScreen()?.IsLoaded == true); AddAssert("score has combo", () => getResultsScreen().Score.Combo > 100); @@ -58,12 +59,18 @@ namespace osu.Game.Tests.Visual.Gameplay ResultsScreen getResultsScreen() => Stack.CurrentScreen as ResultsScreen; } - private void seekToBreak(int breakIndex) + private void seekTo(double time) { - AddStep($"seek to break {breakIndex}", () => Player.GameplayClockContainer.Seek(destBreak().StartTime)); - AddUntilStep("wait for seek to complete", () => Player.DrawableRuleset.FrameStableClock.CurrentTime >= destBreak().StartTime); + AddStep($"seek to {time}", () => Player.GameplayClockContainer.Seek(time)); - BreakPeriod destBreak() => Beatmap.Value.Beatmap.Breaks.ElementAt(breakIndex); + // Prevent test timeouts by seeking in 10 second increments. + for (double t = 0; t < time; t += 10000) + { + double expectedTime = t; + AddUntilStep($"current time >= {t}", () => Player.DrawableRuleset.FrameStableClock.CurrentTime >= expectedTime); + } + + AddUntilStep("wait for seek to complete", () => Player.DrawableRuleset.FrameStableClock.CurrentTime >= time); } } } From edc4ace17e4f703b6ee0b362e943388d25262748 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 30 Jun 2022 11:52:29 +0900 Subject: [PATCH 1968/2328] Attach DT with NC, SD with PF, and Cinema with Autoplay --- osu.Game/Rulesets/Ruleset.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index e098472999..c1ec6c30ef 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -143,7 +143,7 @@ namespace osu.Game.Rulesets break; case ModPerfect: - value |= LegacyMods.Perfect; + value |= LegacyMods.Perfect | LegacyMods.SuddenDeath; break; case ModSuddenDeath: @@ -151,7 +151,7 @@ namespace osu.Game.Rulesets break; case ModNightcore: - value |= LegacyMods.Nightcore; + value |= LegacyMods.Nightcore | LegacyMods.DoubleTime; break; case ModDoubleTime: @@ -171,7 +171,7 @@ namespace osu.Game.Rulesets break; case ModCinema: - value |= LegacyMods.Cinema; + value |= LegacyMods.Cinema | LegacyMods.Autoplay; break; case ModAutoplay: From 6c2d02fefdd5498553ca65b7546f717546e06c0d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 30 Jun 2022 12:37:03 +0900 Subject: [PATCH 1969/2328] Fix tests --- .../CatchLegacyModConversionTest.cs | 15 +++++++++------ .../ManiaLegacyModConversionTest.cs | 9 ++++++--- .../OsuLegacyModConversionTest.cs | 9 ++++++--- .../TaikoLegacyModConversionTest.cs | 15 +++++++++------ 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/CatchLegacyModConversionTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchLegacyModConversionTest.cs index c65c9df9f9..b9d6f28228 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchLegacyModConversionTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchLegacyModConversionTest.cs @@ -24,21 +24,24 @@ namespace osu.Game.Rulesets.Catch.Tests new object[] { LegacyMods.DoubleTime, new[] { typeof(CatchModDoubleTime) } }, new object[] { LegacyMods.Relax, new[] { typeof(CatchModRelax) } }, new object[] { LegacyMods.HalfTime, new[] { typeof(CatchModHalfTime) } }, - new object[] { LegacyMods.Nightcore, new[] { typeof(CatchModNightcore) } }, new object[] { LegacyMods.Flashlight, new[] { typeof(CatchModFlashlight) } }, new object[] { LegacyMods.Autoplay, new[] { typeof(CatchModAutoplay) } }, - new object[] { LegacyMods.Perfect, new[] { typeof(CatchModPerfect) } }, - new object[] { LegacyMods.Cinema, new[] { typeof(CatchModCinema) } }, new object[] { LegacyMods.HardRock | LegacyMods.DoubleTime, new[] { typeof(CatchModHardRock), typeof(CatchModDoubleTime) } } }; + [TestCaseSource(nameof(catch_mod_mapping))] + [TestCase(LegacyMods.Cinema, new[] { typeof(CatchModCinema) })] + [TestCase(LegacyMods.Cinema | LegacyMods.Autoplay, new[] { typeof(CatchModCinema) })] + [TestCase(LegacyMods.Nightcore, new[] { typeof(CatchModNightcore) })] + [TestCase(LegacyMods.Nightcore | LegacyMods.DoubleTime, new[] { typeof(CatchModNightcore) })] + [TestCase(LegacyMods.Perfect, new[] { typeof(CatchModPerfect) })] + [TestCase(LegacyMods.Perfect | LegacyMods.SuddenDeath, new[] { typeof(CatchModPerfect) })] + public new void TestFromLegacy(LegacyMods legacyMods, Type[] expectedMods) => base.TestFromLegacy(legacyMods, expectedMods); + [TestCaseSource(nameof(catch_mod_mapping))] [TestCase(LegacyMods.Cinema | LegacyMods.Autoplay, new[] { typeof(CatchModCinema) })] [TestCase(LegacyMods.Nightcore | LegacyMods.DoubleTime, new[] { typeof(CatchModNightcore) })] [TestCase(LegacyMods.Perfect | LegacyMods.SuddenDeath, new[] { typeof(CatchModPerfect) })] - public new void TestFromLegacy(LegacyMods legacyMods, Type[] expectedMods) => base.TestFromLegacy(legacyMods, expectedMods); - - [TestCaseSource(nameof(catch_mod_mapping))] public new void TestToLegacy(LegacyMods legacyMods, Type[] givenMods) => base.TestToLegacy(legacyMods, givenMods); protected override Ruleset CreateRuleset() => new CatchRuleset(); diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaLegacyModConversionTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaLegacyModConversionTest.cs index accae29ffe..9dee861e66 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaLegacyModConversionTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaLegacyModConversionTest.cs @@ -23,10 +23,8 @@ namespace osu.Game.Rulesets.Mania.Tests new object[] { LegacyMods.SuddenDeath, new[] { typeof(ManiaModSuddenDeath) } }, new object[] { LegacyMods.DoubleTime, new[] { typeof(ManiaModDoubleTime) } }, new object[] { LegacyMods.HalfTime, new[] { typeof(ManiaModHalfTime) } }, - new object[] { LegacyMods.Nightcore, new[] { typeof(ManiaModNightcore) } }, new object[] { LegacyMods.Flashlight, new[] { typeof(ManiaModFlashlight) } }, new object[] { LegacyMods.Autoplay, new[] { typeof(ManiaModAutoplay) } }, - new object[] { LegacyMods.Perfect, new[] { typeof(ManiaModPerfect) } }, new object[] { LegacyMods.Key4, new[] { typeof(ManiaModKey4) } }, new object[] { LegacyMods.Key5, new[] { typeof(ManiaModKey5) } }, new object[] { LegacyMods.Key6, new[] { typeof(ManiaModKey6) } }, @@ -34,7 +32,6 @@ namespace osu.Game.Rulesets.Mania.Tests new object[] { LegacyMods.Key8, new[] { typeof(ManiaModKey8) } }, new object[] { LegacyMods.FadeIn, new[] { typeof(ManiaModFadeIn) } }, new object[] { LegacyMods.Random, new[] { typeof(ManiaModRandom) } }, - new object[] { LegacyMods.Cinema, new[] { typeof(ManiaModCinema) } }, new object[] { LegacyMods.Key9, new[] { typeof(ManiaModKey9) } }, new object[] { LegacyMods.KeyCoop, new[] { typeof(ManiaModDualStages) } }, new object[] { LegacyMods.Key1, new[] { typeof(ManiaModKey1) } }, @@ -45,12 +42,18 @@ namespace osu.Game.Rulesets.Mania.Tests }; [TestCaseSource(nameof(mania_mod_mapping))] + [TestCase(LegacyMods.Cinema, new[] { typeof(ManiaModCinema) })] [TestCase(LegacyMods.Cinema | LegacyMods.Autoplay, new[] { typeof(ManiaModCinema) })] + [TestCase(LegacyMods.Nightcore, new[] { typeof(ManiaModNightcore) })] [TestCase(LegacyMods.Nightcore | LegacyMods.DoubleTime, new[] { typeof(ManiaModNightcore) })] + [TestCase(LegacyMods.Perfect, new[] { typeof(ManiaModPerfect) })] [TestCase(LegacyMods.Perfect | LegacyMods.SuddenDeath, new[] { typeof(ManiaModPerfect) })] public new void TestFromLegacy(LegacyMods legacyMods, Type[] expectedMods) => base.TestFromLegacy(legacyMods, expectedMods); [TestCaseSource(nameof(mania_mod_mapping))] + [TestCase(LegacyMods.Cinema | LegacyMods.Autoplay, new[] { typeof(ManiaModCinema) })] + [TestCase(LegacyMods.Nightcore | LegacyMods.DoubleTime, new[] { typeof(ManiaModNightcore) })] + [TestCase(LegacyMods.Perfect | LegacyMods.SuddenDeath, new[] { typeof(ManiaModPerfect) })] public new void TestToLegacy(LegacyMods legacyMods, Type[] givenMods) => base.TestToLegacy(legacyMods, givenMods); protected override Ruleset CreateRuleset() => new ManiaRuleset(); diff --git a/osu.Game.Rulesets.Osu.Tests/OsuLegacyModConversionTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuLegacyModConversionTest.cs index db9872b152..01d83b55e6 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuLegacyModConversionTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuLegacyModConversionTest.cs @@ -25,24 +25,27 @@ namespace osu.Game.Rulesets.Osu.Tests new object[] { LegacyMods.DoubleTime, new[] { typeof(OsuModDoubleTime) } }, new object[] { LegacyMods.Relax, new[] { typeof(OsuModRelax) } }, new object[] { LegacyMods.HalfTime, new[] { typeof(OsuModHalfTime) } }, - new object[] { LegacyMods.Nightcore, new[] { typeof(OsuModNightcore) } }, new object[] { LegacyMods.Flashlight, new[] { typeof(OsuModFlashlight) } }, new object[] { LegacyMods.Autoplay, new[] { typeof(OsuModAutoplay) } }, new object[] { LegacyMods.SpunOut, new[] { typeof(OsuModSpunOut) } }, new object[] { LegacyMods.Autopilot, new[] { typeof(OsuModAutopilot) } }, - new object[] { LegacyMods.Perfect, new[] { typeof(OsuModPerfect) } }, - new object[] { LegacyMods.Cinema, new[] { typeof(OsuModCinema) } }, new object[] { LegacyMods.Target, new[] { typeof(OsuModTarget) } }, new object[] { LegacyMods.HardRock | LegacyMods.DoubleTime, new[] { typeof(OsuModHardRock), typeof(OsuModDoubleTime) } } }; [TestCaseSource(nameof(osu_mod_mapping))] + [TestCase(LegacyMods.Cinema, new[] { typeof(OsuModCinema) })] [TestCase(LegacyMods.Cinema | LegacyMods.Autoplay, new[] { typeof(OsuModCinema) })] + [TestCase(LegacyMods.Nightcore, new[] { typeof(OsuModNightcore) })] [TestCase(LegacyMods.Nightcore | LegacyMods.DoubleTime, new[] { typeof(OsuModNightcore) })] + [TestCase(LegacyMods.Perfect, new[] { typeof(OsuModPerfect) })] [TestCase(LegacyMods.Perfect | LegacyMods.SuddenDeath, new[] { typeof(OsuModPerfect) })] public new void TestFromLegacy(LegacyMods legacyMods, Type[] expectedMods) => base.TestFromLegacy(legacyMods, expectedMods); [TestCaseSource(nameof(osu_mod_mapping))] + [TestCase(LegacyMods.Cinema | LegacyMods.Autoplay, new[] { typeof(OsuModCinema) })] + [TestCase(LegacyMods.Nightcore | LegacyMods.DoubleTime, new[] { typeof(OsuModNightcore) })] + [TestCase(LegacyMods.Perfect | LegacyMods.SuddenDeath, new[] { typeof(OsuModPerfect) })] public new void TestToLegacy(LegacyMods legacyMods, Type[] givenMods) => base.TestToLegacy(legacyMods, givenMods); protected override Ruleset CreateRuleset() => new OsuRuleset(); diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoLegacyModConversionTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoLegacyModConversionTest.cs index 3553cb27dc..c86f8cb8d2 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TaikoLegacyModConversionTest.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoLegacyModConversionTest.cs @@ -24,22 +24,25 @@ namespace osu.Game.Rulesets.Taiko.Tests new object[] { LegacyMods.DoubleTime, new[] { typeof(TaikoModDoubleTime) } }, new object[] { LegacyMods.Relax, new[] { typeof(TaikoModRelax) } }, new object[] { LegacyMods.HalfTime, new[] { typeof(TaikoModHalfTime) } }, - new object[] { LegacyMods.Nightcore, new[] { typeof(TaikoModNightcore) } }, new object[] { LegacyMods.Flashlight, new[] { typeof(TaikoModFlashlight) } }, new object[] { LegacyMods.Autoplay, new[] { typeof(TaikoModAutoplay) } }, - new object[] { LegacyMods.Perfect, new[] { typeof(TaikoModPerfect) } }, new object[] { LegacyMods.Random, new[] { typeof(TaikoModRandom) } }, - new object[] { LegacyMods.Cinema, new[] { typeof(TaikoModCinema) } }, new object[] { LegacyMods.HardRock | LegacyMods.DoubleTime, new[] { typeof(TaikoModHardRock), typeof(TaikoModDoubleTime) } } }; + [TestCaseSource(nameof(taiko_mod_mapping))] + [TestCase(LegacyMods.Cinema, new[] { typeof(TaikoModCinema) })] + [TestCase(LegacyMods.Cinema | LegacyMods.Autoplay, new[] { typeof(TaikoModCinema) })] + [TestCase(LegacyMods.Nightcore, new[] { typeof(TaikoModNightcore) })] + [TestCase(LegacyMods.Nightcore | LegacyMods.DoubleTime, new[] { typeof(TaikoModNightcore) })] + [TestCase(LegacyMods.Perfect, new[] { typeof(TaikoModPerfect) })] + [TestCase(LegacyMods.Perfect | LegacyMods.SuddenDeath, new[] { typeof(TaikoModPerfect) })] + public new void TestFromLegacy(LegacyMods legacyMods, Type[] expectedMods) => base.TestFromLegacy(legacyMods, expectedMods); + [TestCaseSource(nameof(taiko_mod_mapping))] [TestCase(LegacyMods.Cinema | LegacyMods.Autoplay, new[] { typeof(TaikoModCinema) })] [TestCase(LegacyMods.Nightcore | LegacyMods.DoubleTime, new[] { typeof(TaikoModNightcore) })] [TestCase(LegacyMods.Perfect | LegacyMods.SuddenDeath, new[] { typeof(TaikoModPerfect) })] - public new void TestFromLegacy(LegacyMods legacyMods, Type[] expectedMods) => base.TestFromLegacy(legacyMods, expectedMods); - - [TestCaseSource(nameof(taiko_mod_mapping))] public new void TestToLegacy(LegacyMods legacyMods, Type[] givenMods) => base.TestToLegacy(legacyMods, givenMods); protected override Ruleset CreateRuleset() => new TaikoRuleset(); From c6520de749daeaaf6b7e1e8962d7c46d25491aa4 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 30 Jun 2022 14:24:49 +0900 Subject: [PATCH 1970/2328] Ensure PlaylistItem beatmap is not null --- osu.Game/Online/Rooms/PlaylistItem.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/Rooms/PlaylistItem.cs b/osu.Game/Online/Rooms/PlaylistItem.cs index a0711d9ded..2213311c67 100644 --- a/osu.Game/Online/Rooms/PlaylistItem.cs +++ b/osu.Game/Online/Rooms/PlaylistItem.cs @@ -72,7 +72,7 @@ namespace osu.Game.Online.Rooms /// In many cases, this will *not* contain any usable information apart from OnlineID. /// [JsonIgnore] - public IBeatmapInfo Beatmap { get; set; } = null!; + public IBeatmapInfo Beatmap { get; private set; } [JsonIgnore] public IBindable Valid => valid; @@ -81,6 +81,7 @@ namespace osu.Game.Online.Rooms [JsonConstructor] private PlaylistItem() + : this(new APIBeatmap()) { } From 0abb400f6400e8ceca40bbf34950aa1671a06eb4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 15:14:25 +0900 Subject: [PATCH 1971/2328] Add reproduction of transaction not being exited correctly --- osu.Game.Tests/Database/RealmLiveTests.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/osu.Game.Tests/Database/RealmLiveTests.cs b/osu.Game.Tests/Database/RealmLiveTests.cs index 00a667521d..fd1f564f59 100644 --- a/osu.Game.Tests/Database/RealmLiveTests.cs +++ b/osu.Game.Tests/Database/RealmLiveTests.cs @@ -91,6 +91,25 @@ namespace osu.Game.Tests.Database Assert.IsFalse(liveBeatmap.PerformRead(l => l.Hidden)); } + [Test] + public void TestTransactionRolledBackOnException() + { + RunTestWithRealm((realm, _) => + { + var beatmap = new BeatmapInfo(CreateRuleset(), new BeatmapDifficulty(), new BeatmapMetadata()); + + realm.Run(r => r.Write(_ => r.Add(beatmap))); + + var liveBeatmap = beatmap.ToLive(realm); + + Assert.Throws(() => liveBeatmap.PerformWrite(l => throw new InvalidOperationException())); + Assert.IsFalse(liveBeatmap.PerformRead(l => l.Hidden)); + + liveBeatmap.PerformWrite(l => l.Hidden = true); + Assert.IsTrue(liveBeatmap.PerformRead(l => l.Hidden)); + }); + } + [Test] public void TestScopedReadWithoutContext() { From 78d86fd3ffef5f61b06ea557ab777a0990174762 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 15:11:22 +0900 Subject: [PATCH 1972/2328] Fix `PerformWrite` not rolling back transaction on exception --- osu.Game/Database/RealmLive.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Database/RealmLive.cs b/osu.Game/Database/RealmLive.cs index 72de747807..9c871a3929 100644 --- a/osu.Game/Database/RealmLive.cs +++ b/osu.Game/Database/RealmLive.cs @@ -104,9 +104,12 @@ namespace osu.Game.Database PerformRead(t => { - var transaction = t.Realm.BeginWrite(); - perform(t); - transaction.Commit(); + using (var transaction = t.Realm.BeginWrite()) + { + perform(t); + transaction.Commit(); + } + RealmLiveStatistics.WRITES.Value++; }); } From 356c0501ec25596ed62dc0c8ae0c4af3cf56878f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 15:40:44 +0900 Subject: [PATCH 1973/2328] Guard again potential nulls in `RealmNamedFileUsage` Hopefully help in figuring out https://sentry.ppy.sh/organizations/ppy/issues/3679/?project=2&query=user%3A%22id%3A10078484%22 --- osu.Game/Models/RealmNamedFileUsage.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Models/RealmNamedFileUsage.cs b/osu.Game/Models/RealmNamedFileUsage.cs index 0f6f439d73..c4310c4edb 100644 --- a/osu.Game/Models/RealmNamedFileUsage.cs +++ b/osu.Game/Models/RealmNamedFileUsage.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using JetBrains.Annotations; using osu.Framework.Testing; using osu.Game.Database; @@ -19,8 +20,8 @@ namespace osu.Game.Models public RealmNamedFileUsage(RealmFile file, string filename) { - File = file; - Filename = filename; + File = file ?? throw new ArgumentNullException(nameof(file)); + Filename = filename ?? throw new ArgumentNullException(nameof(filename)); } [UsedImplicitly] From 10934450cc2e35ccd02a70278ec073c433057881 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 16:02:46 +0900 Subject: [PATCH 1974/2328] Fix directory cleanup occurring too early during realm tests --- .../NonVisual/CustomDataDirectoryTest.cs | 47 +++++++------------ 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs b/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs index a803974d30..216bd0fd3c 100644 --- a/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs +++ b/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs @@ -44,8 +44,7 @@ namespace osu.Game.Tests.NonVisual [Test] public void TestCustomDirectory() { - string customPath = prepareCustomPath(); - + using (prepareCustomPath(out string customPath)) using (var host = new CustomTestHeadlessGameHost()) { using (var storageConfig = new StorageConfigManager(host.InitialStorage)) @@ -63,7 +62,6 @@ namespace osu.Game.Tests.NonVisual finally { host.Exit(); - cleanupPath(customPath); } } } @@ -71,8 +69,7 @@ namespace osu.Game.Tests.NonVisual [Test] public void TestSubDirectoryLookup() { - string customPath = prepareCustomPath(); - + using (prepareCustomPath(out string customPath)) using (var host = new CustomTestHeadlessGameHost()) { using (var storageConfig = new StorageConfigManager(host.InitialStorage)) @@ -97,7 +94,6 @@ namespace osu.Game.Tests.NonVisual finally { host.Exit(); - cleanupPath(customPath); } } } @@ -105,8 +101,7 @@ namespace osu.Game.Tests.NonVisual [Test] public void TestMigration() { - string customPath = prepareCustomPath(); - + using (prepareCustomPath(out string customPath)) using (var host = new CustomTestHeadlessGameHost()) { try @@ -173,7 +168,6 @@ namespace osu.Game.Tests.NonVisual finally { host.Exit(); - cleanupPath(customPath); } } } @@ -181,9 +175,8 @@ namespace osu.Game.Tests.NonVisual [Test] public void TestMigrationBetweenTwoTargets() { - string customPath = prepareCustomPath(); - string customPath2 = prepareCustomPath(); - + using (prepareCustomPath(out string customPath)) + using (prepareCustomPath(out string customPath2)) using (var host = new CustomTestHeadlessGameHost()) { try @@ -205,8 +198,6 @@ namespace osu.Game.Tests.NonVisual finally { host.Exit(); - cleanupPath(customPath); - cleanupPath(customPath2); } } } @@ -214,8 +205,7 @@ namespace osu.Game.Tests.NonVisual [Test] public void TestMigrationToSameTargetFails() { - string customPath = prepareCustomPath(); - + using (prepareCustomPath(out string customPath)) using (var host = new CustomTestHeadlessGameHost()) { try @@ -228,7 +218,6 @@ namespace osu.Game.Tests.NonVisual finally { host.Exit(); - cleanupPath(customPath); } } } @@ -236,9 +225,8 @@ namespace osu.Game.Tests.NonVisual [Test] public void TestMigrationFailsOnExistingData() { - string customPath = prepareCustomPath(); - string customPath2 = prepareCustomPath(); - + using (prepareCustomPath(out string customPath)) + using (prepareCustomPath(out string customPath2)) using (var host = new CustomTestHeadlessGameHost()) { try @@ -267,8 +255,6 @@ namespace osu.Game.Tests.NonVisual finally { host.Exit(); - cleanupPath(customPath); - cleanupPath(customPath2); } } } @@ -276,8 +262,7 @@ namespace osu.Game.Tests.NonVisual [Test] public void TestMigrationToNestedTargetFails() { - string customPath = prepareCustomPath(); - + using (prepareCustomPath(out string customPath)) using (var host = new CustomTestHeadlessGameHost()) { try @@ -298,7 +283,6 @@ namespace osu.Game.Tests.NonVisual finally { host.Exit(); - cleanupPath(customPath); } } } @@ -306,8 +290,7 @@ namespace osu.Game.Tests.NonVisual [Test] public void TestMigrationToSeeminglyNestedTarget() { - string customPath = prepareCustomPath(); - + using (prepareCustomPath(out string customPath)) using (var host = new CustomTestHeadlessGameHost()) { try @@ -328,7 +311,6 @@ namespace osu.Game.Tests.NonVisual finally { host.Exit(); - cleanupPath(customPath); } } } @@ -343,14 +325,17 @@ namespace osu.Game.Tests.NonVisual return path; } - private static string prepareCustomPath() => Path.Combine(TestRunHeadlessGameHost.TemporaryTestDirectory, $"custom-path-{Guid.NewGuid()}"); + private static IDisposable prepareCustomPath(out string path) + { + path = Path.Combine(TestRunHeadlessGameHost.TemporaryTestDirectory, $"custom-path-{Guid.NewGuid()}"); + return new InvokeOnDisposal(path, cleanupPath); + } private static void cleanupPath(string path) { try { - if (Directory.Exists(path)) - Directory.Delete(path, true); + if (Directory.Exists(path)) Directory.Delete(path, true); } catch { From 82134ad1a668bb5a35b7d3feae7404090bce4bf5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 16:46:28 +0900 Subject: [PATCH 1975/2328] Allow `null` parameter to `GetWorkingBeatmap` for now --- osu.Game/Beatmaps/BeatmapManager.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 26f538f65b..5f83bbb0dd 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -436,20 +436,23 @@ namespace osu.Game.Beatmaps /// The beatmap to lookup. /// Whether to force a refetch from the database to ensure is up-to-date. /// A instance correlating to the provided . - public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, bool refetch = false) + public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo? beatmapInfo, bool refetch = false) { - // Detached sets don't come with files. - // If we seem to be missing files, now is a good time to re-fetch. - if (refetch || beatmapInfo.IsManaged || beatmapInfo.BeatmapSet?.Files.Count == 0) + if (beatmapInfo != null) { - workingBeatmapCache.Invalidate(beatmapInfo); + // Detached sets don't come with files. + // If we seem to be missing files, now is a good time to re-fetch. + if (refetch || beatmapInfo.IsManaged || beatmapInfo.BeatmapSet?.Files.Count == 0) + { + workingBeatmapCache.Invalidate(beatmapInfo); - Guid id = beatmapInfo.ID; - beatmapInfo = Realm.Run(r => r.Find(id)?.Detach()) ?? beatmapInfo; + Guid id = beatmapInfo.ID; + beatmapInfo = Realm.Run(r => r.Find(id)?.Detach()) ?? beatmapInfo; + } + + Debug.Assert(beatmapInfo.IsManaged != true); } - Debug.Assert(beatmapInfo.IsManaged != true); - return workingBeatmapCache.GetWorkingBeatmap(beatmapInfo); } From e34c2f0acac243ecc4a53cc256b02468b032f97e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 16:47:26 +0900 Subject: [PATCH 1976/2328] Remove unnecessary `nullable-enable` --- osu.Game/Beatmaps/BeatmapUpdater.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapUpdater.cs b/osu.Game/Beatmaps/BeatmapUpdater.cs index caef094701..62a6fc7293 100644 --- a/osu.Game/Beatmaps/BeatmapUpdater.cs +++ b/osu.Game/Beatmaps/BeatmapUpdater.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable enable - using System.Diagnostics; using System.Linq; using System.Threading.Tasks; From ef42c6ecdf95f659faf31980c2c27e7ebc3a1a94 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 16:51:31 +0900 Subject: [PATCH 1977/2328] Add missing xmldoc --- osu.Game/Beatmaps/IWorkingBeatmapCache.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Beatmaps/IWorkingBeatmapCache.cs b/osu.Game/Beatmaps/IWorkingBeatmapCache.cs index 36c53fce99..e28f802e78 100644 --- a/osu.Game/Beatmaps/IWorkingBeatmapCache.cs +++ b/osu.Game/Beatmaps/IWorkingBeatmapCache.cs @@ -28,6 +28,9 @@ namespace osu.Game.Beatmaps /// The beatmap info to invalidate any cached entries for. void Invalidate(BeatmapInfo beatmapInfo); + /// + /// Fired whenever a is invalidated. + /// event Action OnInvalidated; } } From 0698471627b384e63af9cfd4e47a7f28d08abd6f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 17:03:19 +0900 Subject: [PATCH 1978/2328] Move `BeatmapOnlineLookupQueue` to inside `BeatmapUpdater` --- osu.Game/Beatmaps/BeatmapManager.cs | 6 ++---- osu.Game/Beatmaps/BeatmapUpdater.cs | 21 ++++++++++++++++++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 5f83bbb0dd..e16a87eb50 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -41,7 +41,6 @@ namespace osu.Game.Beatmaps private readonly BeatmapImporter beatmapImporter; private readonly WorkingBeatmapCache workingBeatmapCache; - private readonly BeatmapOnlineLookupQueue? onlineBeatmapLookupQueue; private readonly BeatmapUpdater? beatmapUpdater; public BeatmapManager(Storage storage, RealmAccess realm, RulesetStore rulesets, IAPIProvider? api, AudioManager audioManager, IResourceStore gameResources, GameHost? host = null, @@ -56,8 +55,7 @@ namespace osu.Game.Beatmaps if (difficultyCache == null) throw new ArgumentNullException(nameof(difficultyCache), "Difficulty cache must be provided if online lookups are required."); - onlineBeatmapLookupQueue = new BeatmapOnlineLookupQueue(api, storage); - beatmapUpdater = new BeatmapUpdater(this, onlineBeatmapLookupQueue, difficultyCache); + beatmapUpdater = new BeatmapUpdater(this, difficultyCache, api, storage); } var userResources = new RealmFileStore(realm, storage).Store; @@ -474,7 +472,7 @@ namespace osu.Game.Beatmaps public void Dispose() { - onlineBeatmapLookupQueue?.Dispose(); + beatmapUpdater?.Dispose(); } #endregion diff --git a/osu.Game/Beatmaps/BeatmapUpdater.cs b/osu.Game/Beatmaps/BeatmapUpdater.cs index 62a6fc7293..d800b09a2b 100644 --- a/osu.Game/Beatmaps/BeatmapUpdater.cs +++ b/osu.Game/Beatmaps/BeatmapUpdater.cs @@ -1,10 +1,14 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; +using osu.Framework.Extensions.ObjectExtensions; +using osu.Framework.Platform; using osu.Game.Database; +using osu.Game.Online.API; using osu.Game.Rulesets.Objects; using Realms; @@ -13,17 +17,18 @@ namespace osu.Game.Beatmaps /// /// Handles all processing required to ensure a local beatmap is in a consistent state with any changes. /// - public class BeatmapUpdater + public class BeatmapUpdater : IDisposable { private readonly IWorkingBeatmapCache workingBeatmapCache; private readonly BeatmapOnlineLookupQueue onlineLookupQueue; private readonly BeatmapDifficultyCache difficultyCache; - public BeatmapUpdater(IWorkingBeatmapCache workingBeatmapCache, BeatmapOnlineLookupQueue onlineLookupQueue, BeatmapDifficultyCache difficultyCache) + public BeatmapUpdater(IWorkingBeatmapCache workingBeatmapCache, BeatmapDifficultyCache difficultyCache, IAPIProvider api, Storage storage) { this.workingBeatmapCache = workingBeatmapCache; - this.onlineLookupQueue = onlineLookupQueue; this.difficultyCache = difficultyCache; + + onlineLookupQueue = new BeatmapOnlineLookupQueue(api, storage); } /// @@ -81,5 +86,15 @@ namespace osu.Game.Beatmaps return endTime - startTime; } + + #region Implementation of IDisposable + + public void Dispose() + { + if (onlineLookupQueue.IsNotNull()) + onlineLookupQueue.Dispose(); + } + + #endregion } } From aab4dcefbd060b514c79765ceee8e46ad321515e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 17:13:26 +0900 Subject: [PATCH 1979/2328] Remove unnecessary invalidation handling flow --- osu.Game/Beatmaps/IWorkingBeatmapCache.cs | 9 --------- osu.Game/Screens/Select/SongSelect.cs | 18 ------------------ 2 files changed, 27 deletions(-) diff --git a/osu.Game/Beatmaps/IWorkingBeatmapCache.cs b/osu.Game/Beatmaps/IWorkingBeatmapCache.cs index e28f802e78..3eb33f10d6 100644 --- a/osu.Game/Beatmaps/IWorkingBeatmapCache.cs +++ b/osu.Game/Beatmaps/IWorkingBeatmapCache.cs @@ -1,10 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - -using System; - namespace osu.Game.Beatmaps { public interface IWorkingBeatmapCache @@ -27,10 +23,5 @@ namespace osu.Game.Beatmaps /// /// The beatmap info to invalidate any cached entries for. void Invalidate(BeatmapInfo beatmapInfo); - - /// - /// Fired whenever a is invalidated. - /// - event Action OnInvalidated; } } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 73bcabba31..7abcbfca42 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -296,24 +296,8 @@ namespace osu.Game.Screens.Select base.LoadComplete(); modSelectOverlayRegistration = OverlayManager?.RegisterBlockingOverlay(ModSelect); - - beatmaps.OnInvalidated += workingBeatmapInvalidated; } - private void workingBeatmapInvalidated(WorkingBeatmap working) => Scheduler.AddOnce(w => - { - // The global beatmap may have already been updated (ie. by the editor). - // Only perform the actual switch if we still need to. - if (w == Beatmap.Value) - { - // Not sure if this refresh is required. - var beatmapInfo = beatmaps.QueryBeatmap(b => b.ID == w.BeatmapInfo.ID); - Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo); - } - - updateComponentFromBeatmap(Beatmap.Value); - }, working); - /// /// Creates the buttons to be displayed in the footer. /// @@ -719,8 +703,6 @@ namespace osu.Game.Screens.Select music.TrackChanged -= ensureTrackLooping; modSelectOverlayRegistration?.Dispose(); - - beatmaps.OnInvalidated -= workingBeatmapInvalidated; } /// From 2a7321086548a6f99a35c4517357ff77d3ab996c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 17:17:06 +0900 Subject: [PATCH 1980/2328] Add xmldoc and update parameter naming for `MemoryCachingComponent.Invalidate` flow --- osu.Game/Database/MemoryCachingComponent.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/MemoryCachingComponent.cs b/osu.Game/Database/MemoryCachingComponent.cs index 215050460b..104943bbae 100644 --- a/osu.Game/Database/MemoryCachingComponent.cs +++ b/osu.Game/Database/MemoryCachingComponent.cs @@ -40,11 +40,15 @@ namespace osu.Game.Database return computed; } - protected void Invalidate(Func invalidationFunction) + /// + /// Invalidate all entries matching a provided predicate. + /// + /// The predicate to decide which keys should be invalidated. + protected void Invalidate(Func matchKeyPredicate) { foreach (var kvp in cache) { - if (invalidationFunction(kvp.Key)) + if (matchKeyPredicate(kvp.Key)) cache.TryRemove(kvp.Key, out _); } } From 7ab83359359602f44440ef56ff8f2968ec1a29fd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 17:42:44 +0900 Subject: [PATCH 1981/2328] Fix various multiplayer test failures due to not waiting for ongoing operation As seen at https://teamcity.ppy.sh/buildConfiguration/Osu_Build/1138?hideProblemsFromDependencies=false&hideTestsFromDependencies=false&expandBuildChangesSection=true&expandBuildTestsSection=true. --- .../Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs | 2 ++ osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs | 2 ++ .../Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs | 1 + 3 files changed, 5 insertions(+) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs index 86da9dc33d..190b2128f9 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs @@ -15,6 +15,7 @@ using osu.Game.Rulesets.Catch; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; +using osu.Game.Screens.OnlinePlay; using osu.Game.Screens.OnlinePlay.Multiplayer; using osu.Game.Screens.OnlinePlay.Multiplayer.Match; using osu.Game.Screens.Play; @@ -146,6 +147,7 @@ namespace osu.Game.Tests.Visual.Multiplayer if (mods != null) AddStep($"set mods to {string.Join(",", mods.Select(m => m.Acronym))}", () => songSelect.AsNonNull().Mods.Value = mods); + AddUntilStep("wait for ongoing operation to complete", () => !(CurrentScreen as OnlinePlayScreen).ChildrenOfType().Single().InProgress.Value); AddStep("select other beatmap", () => songSelect.AsNonNull().FinaliseSelection(beatmap())); AddUntilStep("wait for return to match", () => CurrentSubScreen is MultiplayerMatchSubScreen); } diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs index fe584fe3da..e436f418ab 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs @@ -104,6 +104,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("wait for song select", () => CurrentSubScreen is Screens.Select.SongSelect select && select.BeatmapSetsLoaded); BeatmapInfo otherBeatmap = null; + AddUntilStep("wait for ongoing operation to complete", () => !(CurrentScreen as OnlinePlayScreen).ChildrenOfType().Single().InProgress.Value); AddStep("select other beatmap", () => ((Screens.Select.SongSelect)CurrentSubScreen).FinaliseSelection(otherBeatmap = beatmap())); AddUntilStep("wait for return to match", () => CurrentSubScreen is MultiplayerMatchSubScreen); @@ -119,6 +120,7 @@ namespace osu.Game.Tests.Visual.Multiplayer }); AddUntilStep("wait for song select", () => CurrentSubScreen is Screens.Select.SongSelect select && select.BeatmapSetsLoaded); + AddUntilStep("wait for ongoing operation to complete", () => !(CurrentScreen as OnlinePlayScreen).ChildrenOfType().Single().InProgress.Value); AddStep("select other beatmap", () => ((Screens.Select.SongSelect)CurrentSubScreen).FinaliseSelection(beatmap())); AddUntilStep("wait for return to match", () => CurrentSubScreen is MultiplayerMatchSubScreen); } diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs index 285258d7c0..ba79a96692 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs @@ -110,6 +110,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("wait for selection", () => Beatmap.Value.BeatmapInfo.Equals(selectedBeatmap)); AddStep("set mods", () => SelectedMods.Value = new[] { new TaikoModDoubleTime() }); + AddUntilStep("wait for ongoing operation to complete", () => !OnlinePlayDependencies.OngoingOperationTracker.InProgress.Value); AddStep("confirm selection", () => songSelect.FinaliseSelection()); AddUntilStep("song select exited", () => !songSelect.IsCurrentScreen()); From 84ecd524c851f6fe0679a7b3b164832a017626fb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 17:58:43 +0900 Subject: [PATCH 1982/2328] Move wait steps upwards --- .../Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs | 2 +- .../Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs index 190b2128f9..32fd7724e0 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs @@ -140,6 +140,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("wait for song select", () => (songSelect = CurrentSubScreen as Screens.Select.SongSelect) != null); AddUntilStep("wait for loaded", () => songSelect.AsNonNull().BeatmapSetsLoaded); + AddUntilStep("wait for ongoing operation to complete", () => !(CurrentScreen as OnlinePlayScreen).ChildrenOfType().Single().InProgress.Value); if (ruleset != null) AddStep($"set {ruleset.Name} ruleset", () => songSelect.AsNonNull().Ruleset.Value = ruleset); @@ -147,7 +148,6 @@ namespace osu.Game.Tests.Visual.Multiplayer if (mods != null) AddStep($"set mods to {string.Join(",", mods.Select(m => m.Acronym))}", () => songSelect.AsNonNull().Mods.Value = mods); - AddUntilStep("wait for ongoing operation to complete", () => !(CurrentScreen as OnlinePlayScreen).ChildrenOfType().Single().InProgress.Value); AddStep("select other beatmap", () => songSelect.AsNonNull().FinaliseSelection(beatmap())); AddUntilStep("wait for return to match", () => CurrentSubScreen is MultiplayerMatchSubScreen); } diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs index ba79a96692..ab4f9c37b2 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSongSelect.cs @@ -107,10 +107,12 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("change ruleset", () => Ruleset.Value = new TaikoRuleset().RulesetInfo); AddStep("select beatmap", () => songSelect.Carousel.SelectBeatmap(selectedBeatmap = beatmaps.First(beatmap => beatmap.Ruleset.OnlineID == new TaikoRuleset().LegacyID))); + AddUntilStep("wait for selection", () => Beatmap.Value.BeatmapInfo.Equals(selectedBeatmap)); + AddUntilStep("wait for ongoing operation to complete", () => !OnlinePlayDependencies.OngoingOperationTracker.InProgress.Value); + AddStep("set mods", () => SelectedMods.Value = new[] { new TaikoModDoubleTime() }); - AddUntilStep("wait for ongoing operation to complete", () => !OnlinePlayDependencies.OngoingOperationTracker.InProgress.Value); AddStep("confirm selection", () => songSelect.FinaliseSelection()); AddUntilStep("song select exited", () => !songSelect.IsCurrentScreen()); From 33209ecd254f40f3d4dcc64be9fa7b470ac872a9 Mon Sep 17 00:00:00 2001 From: cdwcgt Date: Thu, 30 Jun 2022 19:51:58 +0900 Subject: [PATCH 1983/2328] remove useless value change --- osu.Game/Screens/Play/SaveFailedScoreButton.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/SaveFailedScoreButton.cs b/osu.Game/Screens/Play/SaveFailedScoreButton.cs index b5727487dc..9a30e23ddd 100644 --- a/osu.Game/Screens/Play/SaveFailedScoreButton.cs +++ b/osu.Game/Screens/Play/SaveFailedScoreButton.cs @@ -66,7 +66,6 @@ namespace osu.Game.Screens.Play break; } }; - State.BindValueChanged(updateTooltip, true); State.BindValueChanged(state => { switch (state.NewValue) @@ -84,6 +83,7 @@ namespace osu.Game.Screens.Play break; } }, true); + State.BindValueChanged(updateTooltip, true); } private void saveScore() @@ -120,7 +120,6 @@ namespace osu.Game.Screens.Play break; case ImportState.Failed: - button.State.Value = DownloadState.NotDownloaded; button.TooltipText = @"Import failed, click button to re-import"; break; From e50e0f733975cbc43a2626a1c8aa407a57634a8e Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 30 Jun 2022 23:05:09 +0800 Subject: [PATCH 1984/2328] Remove the nullable disable annotate. --- osu.Game/Utils/BatteryInfo.cs | 2 -- osu.Game/Utils/ColourUtils.cs | 2 -- osu.Game/Utils/FormatUtils.cs | 2 -- osu.Game/Utils/HumanizerUtils.cs | 2 -- osu.Game/Utils/IDeepCloneable.cs | 2 -- osu.Game/Utils/LegacyRandom.cs | 2 -- osu.Game/Utils/LegacyUtils.cs | 2 -- osu.Game/Utils/NamingUtils.cs | 2 -- osu.Game/Utils/PeriodTracker.cs | 2 -- osu.Game/Utils/StatelessRNG.cs | 2 -- osu.Game/Utils/ZipUtils.cs | 2 -- 11 files changed, 22 deletions(-) diff --git a/osu.Game/Utils/BatteryInfo.cs b/osu.Game/Utils/BatteryInfo.cs index be12671b84..dd9b695e1f 100644 --- a/osu.Game/Utils/BatteryInfo.cs +++ b/osu.Game/Utils/BatteryInfo.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - namespace osu.Game.Utils { /// diff --git a/osu.Game/Utils/ColourUtils.cs b/osu.Game/Utils/ColourUtils.cs index 7e665fd9a7..515963971d 100644 --- a/osu.Game/Utils/ColourUtils.cs +++ b/osu.Game/Utils/ColourUtils.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using osu.Framework.Utils; using osuTK.Graphics; diff --git a/osu.Game/Utils/FormatUtils.cs b/osu.Game/Utils/FormatUtils.cs index 07a1879267..799dc75ca9 100644 --- a/osu.Game/Utils/FormatUtils.cs +++ b/osu.Game/Utils/FormatUtils.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using Humanizer; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Utils/HumanizerUtils.cs b/osu.Game/Utils/HumanizerUtils.cs index 27d3317b80..5b7c3630d9 100644 --- a/osu.Game/Utils/HumanizerUtils.cs +++ b/osu.Game/Utils/HumanizerUtils.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Globalization; using Humanizer; diff --git a/osu.Game/Utils/IDeepCloneable.cs b/osu.Game/Utils/IDeepCloneable.cs index a0a2548f6c..6877f346c4 100644 --- a/osu.Game/Utils/IDeepCloneable.cs +++ b/osu.Game/Utils/IDeepCloneable.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - namespace osu.Game.Utils { /// A generic interface for a deeply cloneable type. diff --git a/osu.Game/Utils/LegacyRandom.cs b/osu.Game/Utils/LegacyRandom.cs index ace8f8f65c..cf731aa91f 100644 --- a/osu.Game/Utils/LegacyRandom.cs +++ b/osu.Game/Utils/LegacyRandom.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using osu.Framework.Utils; diff --git a/osu.Game/Utils/LegacyUtils.cs b/osu.Game/Utils/LegacyUtils.cs index 400d3b3865..64306adf50 100644 --- a/osu.Game/Utils/LegacyUtils.cs +++ b/osu.Game/Utils/LegacyUtils.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; diff --git a/osu.Game/Utils/NamingUtils.cs b/osu.Game/Utils/NamingUtils.cs index 6b1be8885d..482e3d0954 100644 --- a/osu.Game/Utils/NamingUtils.cs +++ b/osu.Game/Utils/NamingUtils.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using System.Text.RegularExpressions; diff --git a/osu.Game/Utils/PeriodTracker.cs b/osu.Game/Utils/PeriodTracker.cs index d8251f49ca..ba77702247 100644 --- a/osu.Game/Utils/PeriodTracker.cs +++ b/osu.Game/Utils/PeriodTracker.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Utils/StatelessRNG.cs b/osu.Game/Utils/StatelessRNG.cs index 548aaa887f..3db632fc42 100644 --- a/osu.Game/Utils/StatelessRNG.cs +++ b/osu.Game/Utils/StatelessRNG.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; namespace osu.Game.Utils diff --git a/osu.Game/Utils/ZipUtils.cs b/osu.Game/Utils/ZipUtils.cs index d6ad3e132e..eb2d2d3b80 100644 --- a/osu.Game/Utils/ZipUtils.cs +++ b/osu.Game/Utils/ZipUtils.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.IO; using SharpCompress.Archives.Zip; From d94f700ab10d6ef1d835a725a83640ca1a569519 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 30 Jun 2022 23:06:49 +0800 Subject: [PATCH 1985/2328] Remove the nullable disable annotate in the test project. --- osu.Game.Tests/Utils/NamingUtilsTest.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Tests/Utils/NamingUtilsTest.cs b/osu.Game.Tests/Utils/NamingUtilsTest.cs index 2195933197..62e688db90 100644 --- a/osu.Game.Tests/Utils/NamingUtilsTest.cs +++ b/osu.Game.Tests/Utils/NamingUtilsTest.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Linq; using NUnit.Framework; using osu.Game.Utils; From 26de34da844ee45a50db4d2e31a60abf0afd8703 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 30 Jun 2022 23:20:40 +0800 Subject: [PATCH 1986/2328] Remove the nullable disable annotation. --- osu.Game/Extensions/CollectionExtensions.cs | 2 -- osu.Game/Extensions/DrawableExtensions.cs | 2 -- osu.Game/Extensions/LanguageExtensions.cs | 2 -- osu.Game/Extensions/TimeDisplayExtensions.cs | 2 -- osu.Game/Extensions/TypeExtensions.cs | 2 -- osu.Game/Extensions/WebRequestExtensions.cs | 2 -- 6 files changed, 12 deletions(-) diff --git a/osu.Game/Extensions/CollectionExtensions.cs b/osu.Game/Extensions/CollectionExtensions.cs index c573d169f1..473dc4b8f4 100644 --- a/osu.Game/Extensions/CollectionExtensions.cs +++ b/osu.Game/Extensions/CollectionExtensions.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; namespace osu.Game.Extensions diff --git a/osu.Game/Extensions/DrawableExtensions.cs b/osu.Game/Extensions/DrawableExtensions.cs index c2c00e342b..d1aba2bfe3 100644 --- a/osu.Game/Extensions/DrawableExtensions.cs +++ b/osu.Game/Extensions/DrawableExtensions.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Humanizer; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game/Extensions/LanguageExtensions.cs b/osu.Game/Extensions/LanguageExtensions.cs index 3b1e9c7719..b67e7fb6fc 100644 --- a/osu.Game/Extensions/LanguageExtensions.cs +++ b/osu.Game/Extensions/LanguageExtensions.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Globalization; using osu.Game.Localisation; diff --git a/osu.Game/Extensions/TimeDisplayExtensions.cs b/osu.Game/Extensions/TimeDisplayExtensions.cs index 94871233ed..98633958ee 100644 --- a/osu.Game/Extensions/TimeDisplayExtensions.cs +++ b/osu.Game/Extensions/TimeDisplayExtensions.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using Humanizer; using osu.Framework.Extensions.LocalisationExtensions; diff --git a/osu.Game/Extensions/TypeExtensions.cs b/osu.Game/Extensions/TypeExtensions.cs index 6f160b0479..2e93c81758 100644 --- a/osu.Game/Extensions/TypeExtensions.cs +++ b/osu.Game/Extensions/TypeExtensions.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Linq; diff --git a/osu.Game/Extensions/WebRequestExtensions.cs b/osu.Game/Extensions/WebRequestExtensions.cs index 79115c6023..50837a648d 100644 --- a/osu.Game/Extensions/WebRequestExtensions.cs +++ b/osu.Game/Extensions/WebRequestExtensions.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Globalization; using Newtonsoft.Json.Linq; using osu.Framework.IO.Network; From a5b1f1a688fe3d9ad0bd2e87b89f45e3c403ad6a Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 30 Jun 2022 23:23:14 +0800 Subject: [PATCH 1987/2328] mark the string as nullable. --- osu.Game/Extensions/TypeExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Extensions/TypeExtensions.cs b/osu.Game/Extensions/TypeExtensions.cs index 2e93c81758..072b18b0ba 100644 --- a/osu.Game/Extensions/TypeExtensions.cs +++ b/osu.Game/Extensions/TypeExtensions.cs @@ -21,7 +21,7 @@ namespace osu.Game.Extensions /// internal static string GetInvariantInstantiationInfo(this Type type) { - string assemblyQualifiedName = type.AssemblyQualifiedName; + string? assemblyQualifiedName = type.AssemblyQualifiedName; if (assemblyQualifiedName == null) throw new ArgumentException($"{type}'s assembly-qualified name is null. Ensure that it is a concrete type and not a generic type parameter.", nameof(type)); From 48047f2e58f103de50213d4be12c4abd33c47abf Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 30 Jun 2022 23:29:49 +0800 Subject: [PATCH 1988/2328] Move the null check in the outside. AddCursor() should not accept the null value. --- osu.Game/Extensions/WebRequestExtensions.cs | 2 +- osu.Game/Online/API/Requests/GetNewsRequest.cs | 10 +++++----- .../Online/API/Requests/SearchBeatmapSetsRequest.cs | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/osu.Game/Extensions/WebRequestExtensions.cs b/osu.Game/Extensions/WebRequestExtensions.cs index 50837a648d..a80b79f259 100644 --- a/osu.Game/Extensions/WebRequestExtensions.cs +++ b/osu.Game/Extensions/WebRequestExtensions.cs @@ -16,7 +16,7 @@ namespace osu.Game.Extensions /// public static void AddCursor(this WebRequest webRequest, Cursor cursor) { - cursor?.Properties.ForEach(x => + cursor.Properties.ForEach(x => { webRequest.AddParameter("cursor[" + x.Key + "]", (x.Value as JValue)?.ToString(CultureInfo.InvariantCulture) ?? x.Value.ToString()); }); diff --git a/osu.Game/Online/API/Requests/GetNewsRequest.cs b/osu.Game/Online/API/Requests/GetNewsRequest.cs index e1c9eefe30..64bed344bb 100644 --- a/osu.Game/Online/API/Requests/GetNewsRequest.cs +++ b/osu.Game/Online/API/Requests/GetNewsRequest.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.IO.Network; using osu.Game.Extensions; @@ -11,9 +9,9 @@ namespace osu.Game.Online.API.Requests public class GetNewsRequest : APIRequest { private readonly int? year; - private readonly Cursor cursor; + private readonly Cursor? cursor; - public GetNewsRequest(int? year = null, Cursor cursor = null) + public GetNewsRequest(int? year = null, Cursor? cursor = null) { this.year = year; this.cursor = cursor; @@ -22,7 +20,9 @@ namespace osu.Game.Online.API.Requests protected override WebRequest CreateWebRequest() { var req = base.CreateWebRequest(); - req.AddCursor(cursor); + + if (cursor != null) + req.AddCursor(cursor); if (year.HasValue) req.AddParameter("year", year.Value.ToString()); diff --git a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs index 73f6fce4f9..082f9bb371 100644 --- a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs @@ -112,7 +112,8 @@ namespace osu.Game.Online.API.Requests req.AddParameter("nsfw", ExplicitContent == SearchExplicit.Show ? "true" : "false"); - req.AddCursor(cursor); + if (cursor != null) + req.AddCursor(cursor); return req; } From 3785027284ba1701af5b001d4dadd73bd96145d4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 14:35:47 +0900 Subject: [PATCH 1989/2328] Update `OsuSliderBar` colours to not use transparency --- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 3356153e17..493c8638cc 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -111,7 +111,6 @@ namespace osu.Game.Graphics.UserInterface RelativeSizeAxes = Axes.None, Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Alpha = 0.5f, }, }, }, @@ -137,7 +136,7 @@ namespace osu.Game.Graphics.UserInterface { sample = audio.Samples.Get(@"UI/notch-tick"); AccentColour = colourProvider?.Highlight1 ?? colours.Pink; - BackgroundColour = colourProvider?.Background5 ?? colours.Pink.Opacity(0.5f); + BackgroundColour = colourProvider?.Background5 ?? colours.PinkDarker.Darken(1); } protected override void Update() From d54f7fc7289124ca119ac71df2b6cde2f621c392 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 19:54:08 +0900 Subject: [PATCH 1990/2328] Move slider range control to song select --- .../Graphics/UserInterface/OsuSliderBar.cs | 16 ++-- .../UserInterface/SongSelectSettings.cs | 36 -------- .../Select/DifficultyRangeFilterControl.cs | 90 +++++++++++++++++++ osu.Game/Screens/Select/FilterControl.cs | 5 ++ 4 files changed, 103 insertions(+), 44 deletions(-) create mode 100644 osu.Game/Screens/Select/DifficultyRangeFilterControl.cs diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 493c8638cc..1e472ed85b 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -38,8 +38,8 @@ namespace osu.Game.Graphics.UserInterface private T lastSampleValue; protected readonly Nub Nub; - private readonly Box leftBox; - private readonly Box rightBox; + protected readonly Box LeftBox; + protected readonly Box RightBox; private readonly Container nubContainer; public virtual LocalisableString TooltipText { get; private set; } @@ -57,7 +57,7 @@ namespace osu.Game.Graphics.UserInterface set { accentColour = value; - leftBox.Colour = value; + LeftBox.Colour = value; } } @@ -69,7 +69,7 @@ namespace osu.Game.Graphics.UserInterface set { backgroundColour = value; - rightBox.Colour = value; + RightBox.Colour = value; } } @@ -96,7 +96,7 @@ namespace osu.Game.Graphics.UserInterface CornerRadius = 5f, Children = new Drawable[] { - leftBox = new Box + LeftBox = new Box { Height = 5, EdgeSmoothness = new Vector2(0, 0.5f), @@ -104,7 +104,7 @@ namespace osu.Game.Graphics.UserInterface Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, }, - rightBox = new Box + RightBox = new Box { Height = 5, EdgeSmoothness = new Vector2(0, 0.5f), @@ -225,9 +225,9 @@ namespace osu.Game.Graphics.UserInterface protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); - leftBox.Scale = new Vector2(Math.Clamp( + LeftBox.Scale = new Vector2(Math.Clamp( RangePadding + Nub.DrawPosition.X - Nub.DrawWidth / 2, 0, DrawWidth), 1); - rightBox.Scale = new Vector2(Math.Clamp( + RightBox.Scale = new Vector2(Math.Clamp( DrawWidth - Nub.DrawPosition.X - RangePadding - Nub.DrawWidth / 2, 0, DrawWidth), 1); } diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs index 507e116723..708bee6fbd 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/SongSelectSettings.cs @@ -3,13 +3,10 @@ #nullable disable -using System; using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; using osu.Game.Overlays.Mods.Input; @@ -17,20 +14,11 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface { public class SongSelectSettings : SettingsSubsection { - private Bindable minStars; - private Bindable maxStars; - protected override LocalisableString Header => UserInterfaceStrings.SongSelectHeader; [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - minStars = config.GetBindable(OsuSetting.DisplayStarsMinimum); - maxStars = config.GetBindable(OsuSetting.DisplayStarsMaximum); - - minStars.ValueChanged += min => maxStars.Value = Math.Max(min.NewValue, maxStars.Value); - maxStars.ValueChanged += max => minStars.Value = Math.Min(max.NewValue, minStars.Value); - Children = new Drawable[] { new SettingsCheckbox @@ -44,20 +32,6 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface LabelText = UserInterfaceStrings.ShowConvertedBeatmaps, Current = config.GetBindable(OsuSetting.ShowConvertedBeatmaps), }, - new SettingsSlider - { - LabelText = UserInterfaceStrings.StarsMinimum, - Current = config.GetBindable(OsuSetting.DisplayStarsMinimum), - KeyboardStep = 0.1f, - Keywords = new[] { "minimum", "maximum", "star", "difficulty" } - }, - new SettingsSlider - { - LabelText = UserInterfaceStrings.StarsMaximum, - Current = config.GetBindable(OsuSetting.DisplayStarsMaximum), - KeyboardStep = 0.1f, - Keywords = new[] { "minimum", "maximum", "star", "difficulty" } - }, new SettingsEnumDropdown { LabelText = UserInterfaceStrings.RandomSelectionAlgorithm, @@ -71,15 +45,5 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface } }; } - - private class MaximumStarsSlider : StarsSlider - { - public override LocalisableString TooltipText => Current.IsDefault ? UserInterfaceStrings.NoLimit : base.TooltipText; - } - - private class StarsSlider : OsuSliderBar - { - public override LocalisableString TooltipText => Current.Value.ToString(@"0.## stars"); - } } } diff --git a/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs b/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs new file mode 100644 index 0000000000..6148d22838 --- /dev/null +++ b/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs @@ -0,0 +1,90 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable +using System; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Localisation; +using osu.Game.Configuration; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Localisation; +using osuTK; + +namespace osu.Game.Screens.Select +{ + internal class DifficultyRangeFilterControl : CompositeDrawable + { + private Bindable minStars; + private Bindable maxStars; + + private StarsSlider lowerSlider; + private MaximumStarsSlider upperSlider; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + const float vertical_offset = 15; + + InternalChildren = new[] + { + new OsuSpriteText + { + Text = "Difficulty range", + Font = OsuFont.GetFont(size: 14), + }, + upperSlider = new MaximumStarsSlider + { + Current = config.GetBindable(OsuSetting.DisplayStarsMaximum), + KeyboardStep = 0.1f, + RelativeSizeAxes = Axes.X, + Y = vertical_offset, + }, + lowerSlider = new StarsSlider + { + Current = config.GetBindable(OsuSetting.DisplayStarsMinimum), + KeyboardStep = 0.1f, + RelativeSizeAxes = Axes.X, + Y = vertical_offset, + }, + lowerSlider.Nub.CreateProxy(), + upperSlider.Nub.CreateProxy(), + }; + + lowerSlider.LeftBox.Height = 6; + + minStars = config.GetBindable(OsuSetting.DisplayStarsMinimum); + maxStars = config.GetBindable(OsuSetting.DisplayStarsMaximum); + + lowerSlider.AccentColour = lowerSlider.BackgroundColour; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + minStars.ValueChanged += min => maxStars.Value = Math.Max(min.NewValue, maxStars.Value); + maxStars.ValueChanged += max => minStars.Value = Math.Min(max.NewValue, minStars.Value); + } + + private class MaximumStarsSlider : StarsSlider + { + public override LocalisableString TooltipText => Current.IsDefault ? UserInterfaceStrings.NoLimit : base.TooltipText; + } + + private class StarsSlider : OsuSliderBar + { + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Nub.ReceivePositionalInputAt(screenSpacePos); + + public override LocalisableString TooltipText => Current.Value.ToString(@"0.## stars"); + + public new Nub Nub => base.Nub; + public new Box LeftBox => base.LeftBox; + } + } +} diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index da764223a3..714de2487f 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -158,6 +158,11 @@ namespace osu.Game.Screens.Select Height = 20, Children = new Drawable[] { + new DifficultyRangeFilterControl + { + RelativeSizeAxes = Axes.Both, + Width = 0.5f, + }, collectionDropdown = new CollectionFilterDropdown { Anchor = Anchor.TopRight, From 32139ac13fe90f00123d77d42b9d300afccd3746 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 14:22:15 +0900 Subject: [PATCH 1991/2328] Tidy up implementation and add basic visual test --- .../TestSceneDifficultyRangeFilterControl.cs | 26 ++++++++ .../Select/DifficultyRangeFilterControl.cs | 61 ++++++++++++++----- 2 files changed, 71 insertions(+), 16 deletions(-) create mode 100644 osu.Game.Tests/Visual/SongSelect/TestSceneDifficultyRangeFilterControl.cs diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneDifficultyRangeFilterControl.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneDifficultyRangeFilterControl.cs new file mode 100644 index 0000000000..cc0909a835 --- /dev/null +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneDifficultyRangeFilterControl.cs @@ -0,0 +1,26 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable +using NUnit.Framework; +using osu.Framework.Graphics; +using osu.Game.Screens.Select; +using osuTK; + +namespace osu.Game.Tests.Visual.SongSelect +{ + public class TestSceneDifficultyRangeFilterControl : OsuTestScene + { + [Test] + public void TestBasic() + { + Child = new DifficultyRangeFilterControl + { + Width = 200, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Scale = new Vector2(3), + }; + } + } +} diff --git a/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs b/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs index 6148d22838..156e373b6d 100644 --- a/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs +++ b/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs @@ -7,7 +7,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; using osu.Game.Configuration; using osu.Game.Graphics; @@ -15,13 +14,14 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; using osuTK; +using osuTK.Graphics; namespace osu.Game.Screens.Select { internal class DifficultyRangeFilterControl : CompositeDrawable { - private Bindable minStars; - private Bindable maxStars; + private Bindable lowerStars; + private Bindable upperStars; private StarsSlider lowerSlider; private MaximumStarsSlider upperSlider; @@ -45,46 +45,75 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.X, Y = vertical_offset, }, - lowerSlider = new StarsSlider + lowerSlider = new MinimumStarsSlider { Current = config.GetBindable(OsuSetting.DisplayStarsMinimum), KeyboardStep = 0.1f, RelativeSizeAxes = Axes.X, Y = vertical_offset, }, - lowerSlider.Nub.CreateProxy(), upperSlider.Nub.CreateProxy(), + lowerSlider.Nub.CreateProxy(), }; - lowerSlider.LeftBox.Height = 6; - - minStars = config.GetBindable(OsuSetting.DisplayStarsMinimum); - maxStars = config.GetBindable(OsuSetting.DisplayStarsMaximum); - - lowerSlider.AccentColour = lowerSlider.BackgroundColour; + lowerStars = config.GetBindable(OsuSetting.DisplayStarsMinimum); + upperStars = config.GetBindable(OsuSetting.DisplayStarsMaximum); } protected override void LoadComplete() { base.LoadComplete(); - minStars.ValueChanged += min => maxStars.Value = Math.Max(min.NewValue, maxStars.Value); - maxStars.ValueChanged += max => minStars.Value = Math.Min(max.NewValue, minStars.Value); + lowerStars.ValueChanged += min => upperStars.Value = Math.Max(min.NewValue + 0.1, upperStars.Value); + upperStars.ValueChanged += max => lowerStars.Value = Math.Min(max.NewValue - 0.1, lowerStars.Value); + } + + private class MinimumStarsSlider : StarsSlider + { + protected override void LoadComplete() + { + base.LoadComplete(); + + LeftBox.Height = 6; // hide any colour bleeding from overlap + + AccentColour = BackgroundColour; + BackgroundColour = Color4.Transparent; + } + + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => + base.ReceivePositionalInputAt(screenSpacePos) + && screenSpacePos.X <= Nub.ScreenSpaceDrawQuad.TopRight.X; + + public override LocalisableString TooltipText => Current.IsDefault ? UserInterfaceStrings.NoLimit : base.TooltipText; } private class MaximumStarsSlider : StarsSlider { + protected override void LoadComplete() + { + base.LoadComplete(); + + RightBox.Height = 6; // just to match the left bar height really + } + + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => + base.ReceivePositionalInputAt(screenSpacePos) + && screenSpacePos.X >= Nub.ScreenSpaceDrawQuad.TopLeft.X; public override LocalisableString TooltipText => Current.IsDefault ? UserInterfaceStrings.NoLimit : base.TooltipText; } private class StarsSlider : OsuSliderBar { - public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Nub.ReceivePositionalInputAt(screenSpacePos); - public override LocalisableString TooltipText => Current.Value.ToString(@"0.## stars"); public new Nub Nub => base.Nub; - public new Box LeftBox => base.LeftBox; + + protected override void LoadComplete() + { + base.LoadComplete(); + Nub.Width = Nub.HEIGHT; + RangePadding = Nub.Width / 2; + } } } } From cb9947b1c92ac11b7735074044b6b5c2f9afdaa4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 14:41:32 +0900 Subject: [PATCH 1992/2328] Align song select components a bit better --- osu.Game/Screens/Select/DifficultyRangeFilterControl.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs b/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs index 156e373b6d..8e67a669e4 100644 --- a/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs +++ b/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - const float vertical_offset = 15; + const float vertical_offset = 13; InternalChildren = new[] { diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 714de2487f..a92b631100 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -155,20 +155,23 @@ namespace osu.Game.Screens.Select new Container { RelativeSizeAxes = Axes.X, - Height = 20, + Height = 40, Children = new Drawable[] { new DifficultyRangeFilterControl { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, RelativeSizeAxes = Axes.Both, - Width = 0.5f, + Width = 0.48f, }, collectionDropdown = new CollectionFilterDropdown { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, RelativeSizeAxes = Axes.X, - Width = 0.4f, + Y = 4, + Width = 0.5f, } } }, From 545df0a8e8d8d0ac75db6060266afbf998774597 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 15:17:26 +0900 Subject: [PATCH 1993/2328] Display difficulty on nub --- osu.Game/Graphics/UserInterface/Nub.cs | 2 +- .../Select/DifficultyRangeFilterControl.cs | 23 +++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index 249fa2fbb2..7a3e54ddf1 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -19,7 +19,7 @@ using osu.Game.Overlays; namespace osu.Game.Graphics.UserInterface { - public class Nub : CompositeDrawable, IHasCurrentValue, IHasAccentColour + public class Nub : Container, IHasCurrentValue, IHasAccentColour { public const float HEIGHT = 15; diff --git a/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs b/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs index 8e67a669e4..7115c59ebf 100644 --- a/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs +++ b/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs @@ -83,8 +83,6 @@ namespace osu.Game.Screens.Select public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) && screenSpacePos.X <= Nub.ScreenSpaceDrawQuad.TopRight.X; - - public override LocalisableString TooltipText => Current.IsDefault ? UserInterfaceStrings.NoLimit : base.TooltipText; } private class MaximumStarsSlider : StarsSlider @@ -99,12 +97,15 @@ namespace osu.Game.Screens.Select public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) && screenSpacePos.X >= Nub.ScreenSpaceDrawQuad.TopLeft.X; - public override LocalisableString TooltipText => Current.IsDefault ? UserInterfaceStrings.NoLimit : base.TooltipText; } private class StarsSlider : OsuSliderBar { - public override LocalisableString TooltipText => Current.Value.ToString(@"0.## stars"); + private OsuSpriteText currentDisplay; + + public override LocalisableString TooltipText => Current.IsDefault + ? UserInterfaceStrings.NoLimit + : Current.Value.ToString(@"0.## stars"); public new Nub Nub => base.Nub; @@ -113,6 +114,20 @@ namespace osu.Game.Screens.Select base.LoadComplete(); Nub.Width = Nub.HEIGHT; RangePadding = Nub.Width / 2; + + Nub.Add(currentDisplay = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Y = -0.5f, + Colour = Color4.White, + Font = OsuFont.Torus.With(size: 10), + }); + + Current.BindValueChanged(current => + { + currentDisplay.Text = current.NewValue != Current.Default ? current.NewValue.ToString("N1") : "∞"; + }, true); } } } From f3af61213317ff8c735157bc0936fbf84d3ba9e1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 15:17:53 +0900 Subject: [PATCH 1994/2328] Suggest removing difficulty filter if no matches found at song select --- .../Screens/Select/NoResultsPlaceholder.cs | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/osu.Game/Screens/Select/NoResultsPlaceholder.cs b/osu.Game/Screens/Select/NoResultsPlaceholder.cs index e1a8e3e060..d018228e14 100644 --- a/osu.Game/Screens/Select/NoResultsPlaceholder.cs +++ b/osu.Game/Screens/Select/NoResultsPlaceholder.cs @@ -50,7 +50,7 @@ namespace osu.Game.Screens.Select Masking = true; CornerRadius = 10; - Width = 300; + Width = 400; AutoSizeAxes = Axes.Y; Anchor = Anchor.Centre; @@ -118,22 +118,35 @@ namespace osu.Game.Screens.Select textFlow.AddParagraph("No beatmaps match your filter criteria!"); textFlow.AddParagraph(string.Empty); - if (string.IsNullOrEmpty(filter?.SearchText)) + if (filter?.UserStarDifficulty.HasFilter == true) { - // TODO: Add realm queries to hint at which ruleset results are available in (and allow clicking to switch). - // TODO: Make this message more certain by ensuring the osu! beatmaps exist before suggesting. - if (filter?.Ruleset.OnlineID > 0 && !filter.AllowConvertedBeatmaps) + textFlow.AddParagraph("- Try "); + textFlow.AddLink("removing", () => { - textFlow.AddParagraph("Beatmaps may be available by "); - textFlow.AddLink("enabling automatic conversion", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, true)); - textFlow.AddText("!"); - } + config.SetValue(OsuSetting.DisplayStarsMinimum, 0.0); + config.SetValue(OsuSetting.DisplayStarsMaximum, 10.1); + }); + + string lowerStar = filter.UserStarDifficulty.Min == null ? "∞" : $"{filter.UserStarDifficulty.Min:N1}"; + string upperStar = filter.UserStarDifficulty.Max == null ? "∞" : $"{filter.UserStarDifficulty.Max:N1}"; + + textFlow.AddText($" the {lowerStar}-{upperStar} star difficulty filter."); } - else + + // TODO: Add realm queries to hint at which ruleset results are available in (and allow clicking to switch). + // TODO: Make this message more certain by ensuring the osu! beatmaps exist before suggesting. + if (filter?.Ruleset.OnlineID > 0 && !filter.AllowConvertedBeatmaps) { - textFlow.AddParagraph("You can try "); + textFlow.AddParagraph("- Try"); + textFlow.AddLink(" enabling ", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, true)); + textFlow.AddText("automatic conversion!"); + } + + if (!string.IsNullOrEmpty(filter?.SearchText)) + { + textFlow.AddParagraph("- Try "); textFlow.AddLink("searching online", LinkAction.SearchBeatmapSet, filter.SearchText); - textFlow.AddText(" for this query."); + textFlow.AddText($" for \"{filter.SearchText}\"."); } } From 3e0f4e7609106115905452202cdc6c538f07a3ab Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 15:28:55 +0900 Subject: [PATCH 1995/2328] Add test coverage of difficulty filter reset --- .../Visual/SongSelect/TestScenePlaySongSelect.cs | 16 ++++++++++++++++ osu.Game/Screens/Select/NoResultsPlaceholder.cs | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 6896b442e0..159a3b1923 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -97,6 +97,22 @@ namespace osu.Game.Tests.Visual.SongSelect AddUntilStep("wait for placeholder visible", () => getPlaceholder()?.State.Value == Visibility.Visible); } + [Test] + public void TestPlaceholderStarDifficulty() + { + addRulesetImportStep(0); + AddStep("change star filter", () => config.SetValue(OsuSetting.DisplayStarsMinimum, 10.0)); + + createSongSelect(); + + AddUntilStep("wait for placeholder visible", () => getPlaceholder()?.State.Value == Visibility.Visible); + + AddStep("click link in placeholder", () => getPlaceholder().ChildrenOfType().First().TriggerClick()); + + AddUntilStep("star filter reset", () => config.Get(OsuSetting.DisplayStarsMinimum) == 0.0); + AddUntilStep("wait for placeholder visible", () => getPlaceholder()?.State.Value == Visibility.Hidden); + } + [Test] public void TestPlaceholderConvertSetting() { diff --git a/osu.Game/Screens/Select/NoResultsPlaceholder.cs b/osu.Game/Screens/Select/NoResultsPlaceholder.cs index d018228e14..5d5eafd2e6 100644 --- a/osu.Game/Screens/Select/NoResultsPlaceholder.cs +++ b/osu.Game/Screens/Select/NoResultsPlaceholder.cs @@ -135,7 +135,7 @@ namespace osu.Game.Screens.Select // TODO: Add realm queries to hint at which ruleset results are available in (and allow clicking to switch). // TODO: Make this message more certain by ensuring the osu! beatmaps exist before suggesting. - if (filter?.Ruleset.OnlineID > 0 && !filter.AllowConvertedBeatmaps) + if (filter?.Ruleset?.OnlineID > 0 && !filter.AllowConvertedBeatmaps) { textFlow.AddParagraph("- Try"); textFlow.AddLink(" enabling ", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, true)); From 58e25a3a01369996401c1ed931667e19bf6d85b9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 15:42:35 +0900 Subject: [PATCH 1996/2328] Fix potential crash in `BeatmapLeaderboard` during rapid refresh operations --- .../Screens/Select/Leaderboards/BeatmapLeaderboard.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index f1f11518ee..43eaff56b3 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -111,7 +112,7 @@ namespace osu.Game.Screens.Select.Leaderboards if (Scope == BeatmapLeaderboardScope.Local) { - subscribeToLocalScores(cancellationToken); + subscribeToLocalScores(fetchBeatmapInfo, cancellationToken); return null; } @@ -174,14 +175,13 @@ namespace osu.Game.Screens.Select.Leaderboards Action = () => ScoreSelected?.Invoke(model) }; - private void subscribeToLocalScores(CancellationToken cancellationToken) + private void subscribeToLocalScores(BeatmapInfo beatmapInfo, CancellationToken cancellationToken) { + Debug.Assert(beatmapInfo != null); + scoreSubscription?.Dispose(); scoreSubscription = null; - if (beatmapInfo == null) - return; - scoreSubscription = realm.RegisterForNotifications(r => r.All().Filter($"{nameof(ScoreInfo.BeatmapInfo)}.{nameof(BeatmapInfo.ID)} == $0" + $" AND {nameof(ScoreInfo.Ruleset)}.{nameof(RulesetInfo.ShortName)} == $1" From 1777a6d24abffb933105e6fdd148368a4c841d50 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 16:06:18 +0900 Subject: [PATCH 1997/2328] Add attribute to retry flaky tests on normal CI runs --- osu.Game/Tests/FlakyTestAttribute.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 osu.Game/Tests/FlakyTestAttribute.cs diff --git a/osu.Game/Tests/FlakyTestAttribute.cs b/osu.Game/Tests/FlakyTestAttribute.cs new file mode 100644 index 0000000000..a5646f5d00 --- /dev/null +++ b/osu.Game/Tests/FlakyTestAttribute.cs @@ -0,0 +1,26 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable +using System; +using NUnit.Framework; + +namespace osu.Game.Tests +{ + /// + /// An attribute to mark any flaky tests. + /// Will add a retry count unless environment variable `FAIL_FLAKY_TESTS` is set to `1`. + /// + public class FlakyTestAttribute : RetryAttribute + { + public FlakyTestAttribute() + : this(10) + { + } + + public FlakyTestAttribute(int tryCount) + : base(Environment.GetEnvironmentVariable("FAIL_FLAKY_TESTS") == "1" ? 0 : tryCount) + { + } + } +} From b597843579c3a10fbf043b91bac12b1db3ac7b47 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 16:17:40 +0900 Subject: [PATCH 1998/2328] Mark and document remaining flaky tests --- .../TestSceneSliderSnaking.cs | 21 ++++++++++ .../TestSceneMasterGameplayClockContainer.cs | 10 +++++ .../Editing/TestSceneEditorBeatmapCreation.cs | 19 ++++++++++ .../Visual/Editing/TestSceneTimelineZoom.cs | 10 +++++ .../TestSceneCompletionCancellation.cs | 10 +++++ .../TestSceneMultiplayerMatchSubScreen.cs | 38 +++++++++++++++++++ 6 files changed, 108 insertions(+) diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs index 366793058d..0118ed6513 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs @@ -24,6 +24,7 @@ using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Skinning.Default; using osu.Game.Storyboards; +using osu.Game.Tests; using osuTK; namespace osu.Game.Rulesets.Osu.Tests @@ -71,6 +72,16 @@ namespace osu.Game.Rulesets.Osu.Tests [TestCase(0)] [TestCase(1)] [TestCase(2)] + [FlakyTest] + /* + * Fail rate around 0.15% + * + * TearDown : System.TimeoutException : "wait for seek to finish" timed out + * --TearDown + * at osu.Framework.Testing.Drawables.Steps.UntilStepButton.<>c__DisplayClass11_0.<.ctor>b__0() + * at osu.Framework.Testing.Drawables.Steps.StepButton.PerformStep(Boolean userTriggered) + * at osu.Framework.Testing.TestScene.runNextStep(Action onCompletion, Action`1 onError, Func`2 stopCondition) + */ public void TestSnakingEnabled(int sliderIndex) { AddStep("enable autoplay", () => autoplay = true); @@ -95,6 +106,16 @@ namespace osu.Game.Rulesets.Osu.Tests [TestCase(0)] [TestCase(1)] [TestCase(2)] + [FlakyTest] + /* + * Fail rate around 0.15% + * + * TearDown : System.TimeoutException : "wait for seek to finish" timed out + * --TearDown + * at osu.Framework.Testing.Drawables.Steps.UntilStepButton.<>c__DisplayClass11_0.<.ctor>b__0() + * at osu.Framework.Testing.Drawables.Steps.StepButton.PerformStep(Boolean userTriggered) + * at osu.Framework.Testing.TestScene.runNextStep(Action onCompletion, Action`1 onError, Func`2 stopCondition) + */ public void TestSnakingDisabled(int sliderIndex) { AddStep("have autoplay", () => autoplay = true); diff --git a/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs b/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs index ced397921c..ae431e77ae 100644 --- a/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs +++ b/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs @@ -78,6 +78,16 @@ namespace osu.Game.Tests.Gameplay } [Test] + [FlakyTest] + /* + * Fail rate around 0.15% + * + * TearDown : osu.Framework.Testing.Drawables.Steps.AssertButton+TracedException : gameplay clock time = 2500 + * --TearDown + * at osu.Framework.Threading.ScheduledDelegate.RunTaskInternal() + * at osu.Framework.Threading.Scheduler.Update() + * at osu.Framework.Graphics.Drawable.UpdateSubTree() + */ public void TestSeekPerformsInGameplayTime( [Values(1.0, 0.5, 2.0)] double clockRate, [Values(0.0, 200.0, -200.0)] double userOffset, diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs index b711d55e15..2707682b4c 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs @@ -82,6 +82,25 @@ namespace osu.Game.Tests.Visual.Editing } [Test] + [FlakyTest] + /* + * Fail rate around 1.2%. + * + * Failing with realm refetch occasionally being null. + * My only guess is that the WorkingBeatmap at SetupScreen is dummy instead of the true one. + * If it's something else, we have larger issues with realm, but I don't think that's the case. + * + * at osu.Framework.Logging.ThrowingTraceListener.Fail(String message1, String message2) + * at System.Diagnostics.TraceInternal.Fail(String message, String detailMessage) + * at System.Diagnostics.TraceInternal.TraceProvider.Fail(String message, String detailMessage) + * at System.Diagnostics.Debug.Fail(String message, String detailMessage) + * at osu.Game.Database.ModelManager`1.<>c__DisplayClass8_0.b__0(Realm realm) ModelManager.cs:line 50 + * at osu.Game.Database.RealmExtensions.Write(Realm realm, Action`1 function) RealmExtensions.cs:line 14 + * at osu.Game.Database.ModelManager`1.performFileOperation(TModel item, Action`1 operation) ModelManager.cs:line 47 + * at osu.Game.Database.ModelManager`1.AddFile(TModel item, Stream contents, String filename) ModelManager.cs:line 37 + * at osu.Game.Screens.Edit.Setup.ResourcesSection.ChangeAudioTrack(FileInfo source) ResourcesSection.cs:line 115 + * at osu.Game.Tests.Visual.Editing.TestSceneEditorBeatmapCreation.b__11_0() TestSceneEditorBeatmapCreation.cs:line 101 + */ public void TestAddAudioTrack() { AddAssert("switch track to real track", () => diff --git a/osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs b/osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs index fd103ff70f..2cada1989e 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneTimelineZoom.cs @@ -14,6 +14,16 @@ namespace osu.Game.Tests.Visual.Editing public override Drawable CreateTestComponent() => Empty(); [Test] + [FlakyTest] + /* + * Fail rate around 0.3% + * + * TearDown : osu.Framework.Testing.Drawables.Steps.AssertButton+TracedException : range halved + * --TearDown + * at osu.Framework.Threading.ScheduledDelegate.RunTaskInternal() + * at osu.Framework.Threading.Scheduler.Update() + * at osu.Framework.Graphics.Drawable.UpdateSubTree() + */ public void TestVisibleRangeUpdatesOnZoomChange() { double initialVisibleRange = 0; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneCompletionCancellation.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneCompletionCancellation.cs index 6aedc64370..13ceb05aff 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneCompletionCancellation.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneCompletionCancellation.cs @@ -61,6 +61,16 @@ namespace osu.Game.Tests.Visual.Gameplay /// Tests whether can still pause after cancelling completion by reverting back to true. /// [Test] + [FlakyTest] + /* + * Fail rate around 0.45% + * + * TearDown : System.TimeoutException : "completion set by processor" timed out + * --TearDown + * at osu.Framework.Testing.Drawables.Steps.UntilStepButton.<>c__DisplayClass11_0.<.ctor>b__0() + * at osu.Framework.Testing.Drawables.Steps.StepButton.PerformStep(Boolean userTriggered) + * at osu.Framework.Testing.TestScene.runNextStep(Action onCompletion, Action`1 onError, Func`2 stopCondition) + */ public void TestCanPauseAfterCancellation() { complete(); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs index bb7587ac56..3a48f68f1d 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs @@ -74,6 +74,25 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] + [FlakyTest] + /* + * Fail rate around 1.5% + * + * TearDown : System.AggregateException : One or more errors occurred. (Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')) + ----> System.ArgumentOutOfRangeException : Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index') + * --TearDown + * at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) + * at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) + * at osu.Framework.Extensions.TaskExtensions.WaitSafely(Task task) + * at osu.Framework.Testing.TestScene.checkForErrors() + * at osu.Framework.Testing.TestScene.RunTestsFromNUnit() + *--ArgumentOutOfRangeException + * at osu.Framework.Bindables.BindableList`1.removeAt(Int32 index, BindableList`1 caller) + * at osu.Framework.Bindables.BindableList`1.removeAt(Int32 index, BindableList`1 caller) + * at osu.Framework.Bindables.BindableList`1.removeAt(Int32 index, BindableList`1 caller) + * at osu.Game.Online.Multiplayer.MultiplayerClient.<>c__DisplayClass106_0.b__0() in C:\BuildAgent\work\ecd860037212ac52\osu.Game\Online\Multiplayer\MultiplayerClient .cs:line 702 + * at osu.Framework.Threading.ScheduledDelegate.RunTaskInternal() + */ public void TestCreatedRoom() { AddStep("add playlist item", () => @@ -90,6 +109,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] + [FlakyTest] public void TestTaikoOnlyMod() { AddStep("add playlist item", () => @@ -110,6 +130,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] + [FlakyTest] public void TestSettingValidity() { AddAssert("create button not enabled", () => !this.ChildrenOfType().Single().Enabled.Value); @@ -126,6 +147,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] + [FlakyTest] public void TestStartMatchWhileSpectating() { AddStep("set playlist", () => @@ -156,6 +178,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] + [FlakyTest] public void TestFreeModSelectionHasAllowedMods() { AddStep("add playlist item with allowed mod", () => @@ -183,6 +206,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] + [FlakyTest] public void TestModSelectKeyWithAllowedMods() { AddStep("add playlist item with allowed mod", () => @@ -204,6 +228,19 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] + [FlakyTest] + /* + * Fail rate around 0.3% + * + * Somehow there are two mod select overlays? + * + * TearDown : System.InvalidOperationException : Sequence contains more than one element + * --TearDown + * at System.Linq.ThrowHelper.ThrowMoreThanOneElementException() + * at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Boolean& found) + * at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source) + * at osu.Game.Tests.Visual.Multiplayer.TestSceneMultiplayerMatchSubScreen.b__14_3() in /opt/buildagent/work/ecd860037212ac52/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs:line 223 + */ public void TestModSelectKeyWithNoAllowedMods() { AddStep("add playlist item with no allowed mods", () => @@ -224,6 +261,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] + [FlakyTest] public void TestNextPlaylistItemSelectedAfterCompletion() { AddStep("add two playlist items", () => From c4f166084133f129d1f0195473836943db4dff5f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 16:20:34 +0900 Subject: [PATCH 1999/2328] Rename ENVVAR in line with previous one (`OSU_TESTS_NO_TIMEOUT`) --- osu.Game/Tests/FlakyTestAttribute.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Tests/FlakyTestAttribute.cs b/osu.Game/Tests/FlakyTestAttribute.cs index a5646f5d00..a1c16284c8 100644 --- a/osu.Game/Tests/FlakyTestAttribute.cs +++ b/osu.Game/Tests/FlakyTestAttribute.cs @@ -19,7 +19,7 @@ namespace osu.Game.Tests } public FlakyTestAttribute(int tryCount) - : base(Environment.GetEnvironmentVariable("FAIL_FLAKY_TESTS") == "1" ? 0 : tryCount) + : base(Environment.GetEnvironmentVariable("OSU_TESTS_FAIL_FLAKY") == "1" ? 0 : tryCount) { } } From 615c3234d8df6339635f6ae7dcbca6158b282e26 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 16:25:21 +0900 Subject: [PATCH 2000/2328] Remove non-required NRT hint --- osu.Game/Tests/FlakyTestAttribute.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Tests/FlakyTestAttribute.cs b/osu.Game/Tests/FlakyTestAttribute.cs index a1c16284c8..299dbb89a2 100644 --- a/osu.Game/Tests/FlakyTestAttribute.cs +++ b/osu.Game/Tests/FlakyTestAttribute.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable using System; using NUnit.Framework; From c22e77e481f62226507a7ef721e1f106b6f1bc4e Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 1 Jul 2022 16:40:52 +0900 Subject: [PATCH 2001/2328] Fix test sometimes referencing old ModSelect object --- .../TestSceneMultiplayerMatchSubScreen.cs | 9 ++++----- .../Screens/OnlinePlay/Match/RoomSubScreen.cs | 20 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs index bb7587ac56..07a6352e10 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs @@ -176,8 +176,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("mod select contents loaded", () => this.ChildrenOfType().Any() && this.ChildrenOfType().All(col => col.IsLoaded && col.ItemsLoaded)); AddUntilStep("mod select contains only double time mod", - () => this.ChildrenOfType() - .SingleOrDefault()? + () => this.ChildrenOfType().Single().UserModsSelectOverlay .ChildrenOfType() .SingleOrDefault(panel => !panel.Filtered.Value)?.Mod is OsuModDoubleTime); } @@ -200,7 +199,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("press toggle mod select key", () => InputManager.Key(Key.F1)); - AddUntilStep("mod select shown", () => this.ChildrenOfType().Single().State.Value == Visibility.Visible); + AddUntilStep("mod select shown", () => this.ChildrenOfType().Single().UserModsSelectOverlay.State.Value == Visibility.Visible); } [Test] @@ -219,8 +218,8 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("press toggle mod select key", () => InputManager.Key(Key.F1)); - AddWaitStep("wait some", 3); - AddAssert("mod select not shown", () => this.ChildrenOfType().Single().State.Value == Visibility.Hidden); + // AddWaitStep("wait some", 3); + AddAssert("mod select not shown", () => this.ChildrenOfType().Single().UserModsSelectOverlay.State.Value == Visibility.Hidden); } [Test] diff --git a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs index e7d31fbdde..db636f6f95 100644 --- a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs @@ -86,7 +86,7 @@ namespace osu.Game.Screens.OnlinePlay.Match public readonly Room Room; private readonly bool allowEdit; - private ModSelectOverlay userModsSelectOverlay; + public ModSelectOverlay UserModsSelectOverlay { get; private set; } [CanBeNull] private IDisposable userModsSelectOverlayRegistration; @@ -236,7 +236,7 @@ namespace osu.Game.Screens.OnlinePlay.Match } }; - LoadComponent(userModsSelectOverlay = new UserModSelectOverlay(OverlayColourScheme.Plum) + LoadComponent(UserModsSelectOverlay = new UserModSelectOverlay(OverlayColourScheme.Plum) { SelectedMods = { BindTarget = UserMods }, IsValidMod = _ => false @@ -269,7 +269,7 @@ namespace osu.Game.Screens.OnlinePlay.Match beatmapAvailabilityTracker.SelectedItem.BindTo(SelectedItem); beatmapAvailabilityTracker.Availability.BindValueChanged(_ => updateWorkingBeatmap()); - userModsSelectOverlayRegistration = overlayManager?.RegisterBlockingOverlay(userModsSelectOverlay); + userModsSelectOverlayRegistration = overlayManager?.RegisterBlockingOverlay(UserModsSelectOverlay); } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) @@ -289,9 +289,9 @@ namespace osu.Game.Screens.OnlinePlay.Match return base.OnBackButton(); } - if (userModsSelectOverlay.State.Value == Visibility.Visible) + if (UserModsSelectOverlay.State.Value == Visibility.Visible) { - userModsSelectOverlay.Hide(); + UserModsSelectOverlay.Hide(); return true; } @@ -304,7 +304,7 @@ namespace osu.Game.Screens.OnlinePlay.Match return base.OnBackButton(); } - protected void ShowUserModSelect() => userModsSelectOverlay.Show(); + protected void ShowUserModSelect() => UserModsSelectOverlay.Show(); public override void OnEntering(ScreenTransitionEvent e) { @@ -385,13 +385,13 @@ namespace osu.Game.Screens.OnlinePlay.Match if (!selected.AllowedMods.Any()) { UserModsSection?.Hide(); - userModsSelectOverlay.Hide(); - userModsSelectOverlay.IsValidMod = _ => false; + UserModsSelectOverlay.Hide(); + UserModsSelectOverlay.IsValidMod = _ => false; } else { UserModsSection?.Show(); - userModsSelectOverlay.IsValidMod = m => allowedMods.Any(a => a.GetType() == m.GetType()); + UserModsSelectOverlay.IsValidMod = m => allowedMods.Any(a => a.GetType() == m.GetType()); } } @@ -430,7 +430,7 @@ namespace osu.Game.Screens.OnlinePlay.Match private void onLeaving() { - userModsSelectOverlay.Hide(); + UserModsSelectOverlay.Hide(); endHandlingTrack(); } From 58c9bb031fbbaf958079c1568b4df5cc715bc0ff Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 1 Jul 2022 16:51:15 +0900 Subject: [PATCH 2002/2328] Apply PR reviews/fixes --- .../Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs | 2 +- osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs index 07a6352e10..f925622a80 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs @@ -218,7 +218,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("press toggle mod select key", () => InputManager.Key(Key.F1)); - // AddWaitStep("wait some", 3); + AddWaitStep("wait some", 3); AddAssert("mod select not shown", () => this.ChildrenOfType().Single().UserModsSelectOverlay.State.Value == Visibility.Hidden); } diff --git a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs index db636f6f95..bae25dc9f8 100644 --- a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs @@ -86,7 +86,7 @@ namespace osu.Game.Screens.OnlinePlay.Match public readonly Room Room; private readonly bool allowEdit; - public ModSelectOverlay UserModsSelectOverlay { get; private set; } + internal ModSelectOverlay UserModsSelectOverlay { get; private set; } [CanBeNull] private IDisposable userModsSelectOverlayRegistration; From 8f8c2a8c9aa1e87a2468bed6408a33939e6d9b85 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 16:55:47 +0900 Subject: [PATCH 2003/2328] Remove one flaky test description (fixed via #18966) --- .../TestSceneMultiplayerMatchSubScreen.cs | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs index 3a48f68f1d..75a011b6eb 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs @@ -109,7 +109,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] - [FlakyTest] + [FlakyTest] // See above public void TestTaikoOnlyMod() { AddStep("add playlist item", () => @@ -130,7 +130,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] - [FlakyTest] + [FlakyTest] // See above public void TestSettingValidity() { AddAssert("create button not enabled", () => !this.ChildrenOfType().Single().Enabled.Value); @@ -147,7 +147,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] - [FlakyTest] + [FlakyTest] // See above public void TestStartMatchWhileSpectating() { AddStep("set playlist", () => @@ -178,7 +178,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] - [FlakyTest] + [FlakyTest] // See above public void TestFreeModSelectionHasAllowedMods() { AddStep("add playlist item with allowed mod", () => @@ -206,7 +206,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] - [FlakyTest] + [FlakyTest] // See above public void TestModSelectKeyWithAllowedMods() { AddStep("add playlist item with allowed mod", () => @@ -228,19 +228,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] - [FlakyTest] - /* - * Fail rate around 0.3% - * - * Somehow there are two mod select overlays? - * - * TearDown : System.InvalidOperationException : Sequence contains more than one element - * --TearDown - * at System.Linq.ThrowHelper.ThrowMoreThanOneElementException() - * at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Boolean& found) - * at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source) - * at osu.Game.Tests.Visual.Multiplayer.TestSceneMultiplayerMatchSubScreen.b__14_3() in /opt/buildagent/work/ecd860037212ac52/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs:line 223 - */ + [FlakyTest] // See above public void TestModSelectKeyWithNoAllowedMods() { AddStep("add playlist item with no allowed mods", () => @@ -261,7 +249,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } [Test] - [FlakyTest] + [FlakyTest] // See above public void TestNextPlaylistItemSelectedAfterCompletion() { AddStep("add two playlist items", () => From 17ad6648d1e837a7a85f57792a9185377b37bd52 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 17:07:00 +0900 Subject: [PATCH 2004/2328] Fix new test failing on headless runs --- .../TestSceneDifficultyRangeFilterControl.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneDifficultyRangeFilterControl.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneDifficultyRangeFilterControl.cs index cc0909a835..ffad15287b 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneDifficultyRangeFilterControl.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneDifficultyRangeFilterControl.cs @@ -14,13 +14,16 @@ namespace osu.Game.Tests.Visual.SongSelect [Test] public void TestBasic() { - Child = new DifficultyRangeFilterControl + AddStep("create control", () => { - Width = 200, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Scale = new Vector2(3), - }; + Child = new DifficultyRangeFilterControl + { + Width = 200, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Scale = new Vector2(3), + }; + }); } } } From 0e1f08eff870b325b837b03db6cce7f1679f3d20 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 17:10:04 +0900 Subject: [PATCH 2005/2328] Fix regressing `BeatmapRecommendations` tests due to diffcalc running at --- .../TestSceneBeatmapRecommendations.cs | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs index 117515977e..504ded5406 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; @@ -166,15 +167,22 @@ namespace osu.Game.Tests.Visual.SongSelect var beatmapSet = TestResources.CreateTestBeatmapSetInfo(rulesets.Length, rulesets); - for (int i = 0; i < rulesets.Length; i++) + var importedBeatmapSet = Game.BeatmapManager.Import(beatmapSet); + + Debug.Assert(importedBeatmapSet != null); + + importedBeatmapSet.PerformWrite(s => { - var beatmap = beatmapSet.Beatmaps[i]; + for (int i = 0; i < rulesets.Length; i++) + { + var beatmap = s.Beatmaps[i]; - beatmap.StarRating = i + 1; - beatmap.DifficultyName = $"SR{i + 1}"; - } + beatmap.StarRating = i + 1; + beatmap.DifficultyName = $"SR{i + 1}"; + } + }); - return Game.BeatmapManager.Import(beatmapSet)?.Value; + return importedBeatmapSet.Value; } private bool ensureAllBeatmapSetsImported(IEnumerable beatmapSets) => beatmapSets.All(set => set != null); From 0cfaef36058a374feb31d73a400e3bfc201777dc Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 1 Jul 2022 11:21:52 +0300 Subject: [PATCH 2006/2328] Remove iOS build CI workaround --- .github/workflows/ci.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c728d89ed1..ef729a779f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,12 +126,6 @@ jobs: with: dotnet-version: "6.0.x" - # macOS agents recently have empty NuGet config files, resulting in restore failures, - # see https://github.com/actions/virtual-environments/issues/5768 - # Add the global nuget package source manually for now. - - name: Setup NuGet.Config - run: echo '' > ~/.config/NuGet/NuGet.Config - # Contrary to seemingly any other msbuild, msbuild running on macOS/Mono # cannot accept .sln(f) files as arguments. # Build just the main game for now. From e213c1a4ef6a489ad1154a353ab0beb4fc310da1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 17:26:40 +0900 Subject: [PATCH 2007/2328] Rename enum to explicitly mention it is a filter --- .../Multiplayer/TestSceneLoungeRoomsContainer.cs | 4 ++-- .../OnlinePlay/Lounge/Components/FilterCriteria.cs | 2 +- .../{RoomAccessType.cs => RoomPermissionsFilter.cs} | 2 +- .../OnlinePlay/Lounge/Components/RoomsContainer.cs | 12 ++++++------ .../Multiplayer/MultiplayerLoungeSubScreen.cs | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) rename osu.Game/Screens/OnlinePlay/Lounge/Components/{RoomAccessType.cs => RoomPermissionsFilter.cs} (87%) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs index d56716a0b5..82e7bf8969 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneLoungeRoomsContainer.cs @@ -170,11 +170,11 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("both rooms visible", () => container.Rooms.Count(r => r.IsPresent) == 2); - AddStep("filter public rooms", () => container.Filter.Value = new FilterCriteria { AccessType = RoomAccessType.Public }); + AddStep("filter public rooms", () => container.Filter.Value = new FilterCriteria { Permissions = RoomPermissionsFilter.Public }); AddUntilStep("private room hidden", () => container.Rooms.All(r => !r.Room.HasPassword.Value)); - AddStep("filter private rooms", () => container.Filter.Value = new FilterCriteria { AccessType = RoomAccessType.Private }); + AddStep("filter private rooms", () => container.Filter.Value = new FilterCriteria { Permissions = RoomPermissionsFilter.Private }); AddUntilStep("public room hidden", () => container.Rooms.All(r => r.Room.HasPassword.Value)); } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs index 864634209b..3a687ad351 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/FilterCriteria.cs @@ -13,6 +13,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components public RoomStatusFilter Status; public string Category; public RulesetInfo Ruleset; - public RoomAccessType AccessType; + public RoomPermissionsFilter Permissions; } } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomAccessType.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPermissionsFilter.cs similarity index 87% rename from osu.Game/Screens/OnlinePlay/Lounge/Components/RoomAccessType.cs rename to osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPermissionsFilter.cs index 1141ed2937..faef2a9d57 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomAccessType.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPermissionsFilter.cs @@ -3,7 +3,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components { - public enum RoomAccessType + public enum RoomPermissionsFilter { All, Public, diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs index 24dd27c27b..6142fc78a8 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs @@ -87,27 +87,27 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components matchingFilter &= r.FilterTerms.Any(term => term.ToString().Contains(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase)); } - matchingFilter &= matchesAccessType(r, criteria.AccessType); + matchingFilter &= matchPermissions(r, criteria.Permissions); r.MatchingFilter = matchingFilter; } }); - static bool matchesAccessType(DrawableLoungeRoom room, RoomAccessType accessType) + static bool matchPermissions(DrawableLoungeRoom room, RoomPermissionsFilter accessType) { switch (accessType) { - case RoomAccessType.All: + case RoomPermissionsFilter.All: return true; - case RoomAccessType.Public: + case RoomPermissionsFilter.Public: return !room.Room.HasPassword.Value; - case RoomAccessType.Private: + case RoomPermissionsFilter.Private: return room.Room.HasPassword.Value; default: - throw new ArgumentOutOfRangeException(nameof(accessType), accessType, $"Unsupported {nameof(RoomAccessType)} in filter"); + throw new ArgumentOutOfRangeException(nameof(accessType), accessType, $"Unsupported {nameof(RoomPermissionsFilter)} in filter"); } } } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs index b482b1b680..37b977cff7 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs @@ -31,7 +31,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer [Resolved] private MultiplayerClient client { get; set; } - private Dropdown roomAccessTypeDropdown; + private Dropdown roomAccessTypeDropdown; public override void OnResuming(ScreenTransitionEvent e) { @@ -48,7 +48,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer protected override IEnumerable CreateFilterControls() { - roomAccessTypeDropdown = new SlimEnumDropdown + roomAccessTypeDropdown = new SlimEnumDropdown { RelativeSizeAxes = Axes.None, Width = 160, @@ -63,7 +63,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer { var criteria = base.CreateFilterCriteria(); criteria.Category = @"realtime"; - criteria.AccessType = roomAccessTypeDropdown.Current.Value; + criteria.Permissions = roomAccessTypeDropdown.Current.Value; return criteria; } From 5880b824d0e91361de9d6cd2fea7b9fc18fe7f69 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 1 Jul 2022 11:30:51 +0300 Subject: [PATCH 2008/2328] Simplify description logic for overlay tab items --- osu.Game/Overlays/TabControlOverlayHeader.cs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/osu.Game/Overlays/TabControlOverlayHeader.cs b/osu.Game/Overlays/TabControlOverlayHeader.cs index 88ee565859..caec4aeed0 100644 --- a/osu.Game/Overlays/TabControlOverlayHeader.cs +++ b/osu.Game/Overlays/TabControlOverlayHeader.cs @@ -3,7 +3,6 @@ #nullable disable -using System; using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -13,7 +12,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; @@ -110,20 +108,7 @@ namespace osu.Game.Overlays public OverlayHeaderTabItem(T value) : base(value) { - if (!(Value is Enum enumValue)) - Text.Text = Value.ToString().ToLowerInvariant(); - else - { - case LocalisableString localisableString: - Text.Text = localisableString.ToLower(); - break; - - // If localisable == non-localisable, then we must have a basic string, so .ToLowerInvariant() is used. - Text.Text = localisableDescription.Equals(nonLocalisableDescription) - ? nonLocalisableDescription.ToLowerInvariant() - : localisableDescription; - } - + Text.Text = value.GetLocalisableDescription().ToLower(); Text.Font = OsuFont.GetFont(size: 14); Text.Margin = new MarginPadding { Vertical = 16.5f }; // 15px padding + 1.5px line-height difference compensation Bar.Margin = new MarginPadding { Bottom = bar_height }; From a17e18103f983649af80c9a15e1f14b3e6e52774 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Jul 2022 18:19:31 +0900 Subject: [PATCH 2009/2328] Improve description --- osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs index 807be997db..052c7128f6 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Name => "Repel"; public override string Acronym => "RP"; public override ModType Type => ModType.Fun; - public override string Description => "Run away!"; + public override string Description => "Hit objects run away!"; public override double ScoreMultiplier => 1; public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay), typeof(OsuModMagnetised) }; From 1c2ffb3bc4414b6c8ca51d716b2d745fc53e6d5b Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 1 Jul 2022 18:03:26 +0900 Subject: [PATCH 2010/2328] Fix server-side objects being sent to client --- .../Multiplayer/TestMultiplayerClient.cs | 54 +++++++++++-------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs index 6b7495762a..ff83997936 100644 --- a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs +++ b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs @@ -6,9 +6,11 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; +using MessagePack; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions; +using osu.Game.Online; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Multiplayer; @@ -50,7 +52,7 @@ namespace osu.Game.Tests.Visual.Multiplayer /// private Room? serverSideAPIRoom; - private MultiplayerPlaylistItem? currentItem => Room?.Playlist[currentIndex]; + private MultiplayerPlaylistItem? currentItem => serverSidePlaylist[currentIndex]; private int currentIndex; private long lastPlaylistItemId; @@ -79,7 +81,7 @@ namespace osu.Game.Tests.Visual.Multiplayer private void addUser(MultiplayerRoomUser user) { - ((IMultiplayerClient)this).UserJoined(user).WaitSafely(); + ((IMultiplayerClient)this).UserJoined(clone(user)).WaitSafely(); // We want the user to be immediately available for testing, so force a scheduler update to run the update-bound continuation. Scheduler.Update(); @@ -93,7 +95,7 @@ namespace osu.Game.Tests.Visual.Multiplayer .Select(team => (teamID: team.ID, userCount: Room.Users.Count(u => (u.MatchState as TeamVersusUserState)?.TeamID == team.ID))) .OrderBy(pair => pair.userCount) .First().teamID; - ((IMultiplayerClient)this).MatchUserStateChanged(user.UserID, new TeamVersusUserState { TeamID = bestTeam }).WaitSafely(); + ((IMultiplayerClient)this).MatchUserStateChanged(clone(user.UserID), clone(new TeamVersusUserState { TeamID = bestTeam })).WaitSafely(); break; } } @@ -102,7 +104,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { Debug.Assert(Room != null); - ((IMultiplayerClient)this).UserLeft(new MultiplayerRoomUser(user.Id)); + ((IMultiplayerClient)this).UserLeft(clone(new MultiplayerRoomUser(user.Id))); Schedule(() => { @@ -113,12 +115,12 @@ namespace osu.Game.Tests.Visual.Multiplayer public void ChangeRoomState(MultiplayerRoomState newState) { - ((IMultiplayerClient)this).RoomStateChanged(newState); + ((IMultiplayerClient)this).RoomStateChanged(clone(newState)); } public void ChangeUserState(int userId, MultiplayerUserState newState) { - ((IMultiplayerClient)this).UserStateChanged(userId, newState); + ((IMultiplayerClient)this).UserStateChanged(clone(userId), clone(newState)); updateRoomStateIfRequired(); } @@ -176,7 +178,7 @@ namespace osu.Game.Tests.Visual.Multiplayer public void ChangeUserBeatmapAvailability(int userId, BeatmapAvailability newBeatmapAvailability) { - ((IMultiplayerClient)this).UserBeatmapAvailabilityChanged(userId, newBeatmapAvailability); + ((IMultiplayerClient)this).UserBeatmapAvailabilityChanged(clone(userId), clone(newBeatmapAvailability)); } protected override async Task JoinRoom(long roomId, string? password = null) @@ -205,7 +207,7 @@ namespace osu.Game.Tests.Visual.Multiplayer QueueMode = serverSideAPIRoom.QueueMode.Value, AutoStartDuration = serverSideAPIRoom.AutoStartDuration.Value }, - Playlist = serverSidePlaylist.ToList(), + Playlist = serverSidePlaylist, Users = { localUser }, Host = localUser }; @@ -216,7 +218,7 @@ namespace osu.Game.Tests.Visual.Multiplayer RoomSetupAction?.Invoke(room); RoomSetupAction = null; - return room; + return clone(room); } protected override void OnRoomJoined() @@ -236,13 +238,13 @@ namespace osu.Game.Tests.Visual.Multiplayer return Task.CompletedTask; } - public override Task TransferHost(int userId) => ((IMultiplayerClient)this).HostChanged(userId); + public override Task TransferHost(int userId) => ((IMultiplayerClient)this).HostChanged(clone(userId)); public override Task KickUser(int userId) { Debug.Assert(Room != null); - return ((IMultiplayerClient)this).UserKicked(Room.Users.Single(u => u.UserID == userId)); + return ((IMultiplayerClient)this).UserKicked(clone(Room.Users.Single(u => u.UserID == userId))); } public override async Task ChangeSettings(MultiplayerRoomSettings settings) @@ -256,7 +258,7 @@ namespace osu.Game.Tests.Visual.Multiplayer await changeQueueMode(settings.QueueMode).ConfigureAwait(false); - await ((IMultiplayerClient)this).SettingsChanged(settings).ConfigureAwait(false); + await ((IMultiplayerClient)this).SettingsChanged(clone(settings)).ConfigureAwait(false); foreach (var user in Room.Users.Where(u => u.State == MultiplayerUserState.Ready)) ChangeUserState(user.UserID, MultiplayerUserState.Idle); @@ -285,7 +287,7 @@ namespace osu.Game.Tests.Visual.Multiplayer public void ChangeUserMods(int userId, IEnumerable newMods) { - ((IMultiplayerClient)this).UserModsChanged(userId, newMods.ToList()); + ((IMultiplayerClient)this).UserModsChanged(clone(userId), clone(newMods)); } public override Task ChangeUserMods(IEnumerable newMods) @@ -312,7 +314,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { userState.TeamID = targetTeam.ID; - await ((IMultiplayerClient)this).MatchUserStateChanged(LocalUser.UserID, userState).ConfigureAwait(false); + await ((IMultiplayerClient)this).MatchUserStateChanged(clone(LocalUser.UserID), clone(userState)).ConfigureAwait(false); } break; @@ -382,7 +384,7 @@ namespace osu.Game.Tests.Visual.Multiplayer serverSidePlaylist[serverSidePlaylist.IndexOf(existingItem)] = item; serverSideAPIRoom.Playlist[serverSideAPIRoom.Playlist.IndexOf(serverSideAPIRoom.Playlist.Single(i => i.ID == item.ID))] = new PlaylistItem(item); - await ((IMultiplayerClient)this).PlaylistItemChanged(item).ConfigureAwait(false); + await ((IMultiplayerClient)this).PlaylistItemChanged(clone(item)).ConfigureAwait(false); } public override Task EditPlaylistItem(MultiplayerPlaylistItem item) => EditUserPlaylistItem(api.LocalUser.Value.OnlineID, item); @@ -409,7 +411,7 @@ namespace osu.Game.Tests.Visual.Multiplayer serverSidePlaylist.Remove(item); serverSideAPIRoom.Playlist.RemoveAll(i => i.ID == item.ID); - await ((IMultiplayerClient)this).PlaylistItemRemoved(playlistItemId).ConfigureAwait(false); + await ((IMultiplayerClient)this).PlaylistItemRemoved(clone(playlistItemId)).ConfigureAwait(false); await updateCurrentItem(Room).ConfigureAwait(false); updateRoomStateIfRequired(); @@ -427,14 +429,14 @@ namespace osu.Game.Tests.Visual.Multiplayer await ((IMultiplayerClient)this).MatchRoomStateChanged(null).ConfigureAwait(false); foreach (var user in Room.Users) - await ((IMultiplayerClient)this).MatchUserStateChanged(user.UserID, null).ConfigureAwait(false); + await ((IMultiplayerClient)this).MatchUserStateChanged(clone(user.UserID), null).ConfigureAwait(false); break; case MatchType.TeamVersus: - await ((IMultiplayerClient)this).MatchRoomStateChanged(TeamVersusRoomState.CreateDefault()).ConfigureAwait(false); + await ((IMultiplayerClient)this).MatchRoomStateChanged(clone(TeamVersusRoomState.CreateDefault())).ConfigureAwait(false); foreach (var user in Room.Users) - await ((IMultiplayerClient)this).MatchUserStateChanged(user.UserID, new TeamVersusUserState()).ConfigureAwait(false); + await ((IMultiplayerClient)this).MatchUserStateChanged(clone(user.UserID), clone(new TeamVersusUserState())).ConfigureAwait(false); break; } } @@ -463,7 +465,7 @@ namespace osu.Game.Tests.Visual.Multiplayer currentItem.Expired = true; currentItem.PlayedAt = DateTimeOffset.Now; - await ((IMultiplayerClient)this).PlaylistItemChanged(currentItem).ConfigureAwait(false); + await ((IMultiplayerClient)this).PlaylistItemChanged(clone(currentItem)).ConfigureAwait(false); await updatePlaylistOrder(Room).ConfigureAwait(false); // In host-only mode, a duplicate playlist item will be used for the next round. @@ -496,7 +498,7 @@ namespace osu.Game.Tests.Visual.Multiplayer serverSidePlaylist.Add(item); serverSideAPIRoom.Playlist.Add(new PlaylistItem(item)); - await ((IMultiplayerClient)this).PlaylistItemAdded(item).ConfigureAwait(false); + await ((IMultiplayerClient)this).PlaylistItemAdded(clone(item)).ConfigureAwait(false); await updatePlaylistOrder(Room).ConfigureAwait(false); } @@ -514,7 +516,7 @@ namespace osu.Game.Tests.Visual.Multiplayer room.Settings.PlaylistItemId = nextItem.ID; if (notify && nextItem.ID != lastItem) - await ((IMultiplayerClient)this).SettingsChanged(room.Settings).ConfigureAwait(false); + await ((IMultiplayerClient)this).SettingsChanged(clone(room.Settings)).ConfigureAwait(false); } private async Task updatePlaylistOrder(MultiplayerRoom room) @@ -564,12 +566,18 @@ namespace osu.Game.Tests.Visual.Multiplayer item.PlaylistOrder = (ushort)i; - await ((IMultiplayerClient)this).PlaylistItemChanged(item).ConfigureAwait(false); + await ((IMultiplayerClient)this).PlaylistItemChanged(clone(item)).ConfigureAwait(false); } // Also ensure that the API room's playlist is correct. foreach (var item in serverSideAPIRoom.Playlist) item.PlaylistOrder = serverSidePlaylist.Single(i => i.ID == item.ID).PlaylistOrder; } + + private T clone(T incoming) + { + byte[]? serialized = MessagePackSerializer.Serialize(typeof(T), incoming, SignalRUnionWorkaroundResolver.OPTIONS); + return MessagePackSerializer.Deserialize(serialized, SignalRUnionWorkaroundResolver.OPTIONS); + } } } From 0be858b5bf7acbc3906f4c9172a16e4920e2791e Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 1 Jul 2022 18:04:29 +0900 Subject: [PATCH 2011/2328] Rename APIRoom -> ClientAPIRoom, remove unused asserts --- .../Visual/Multiplayer/QueueModeTestScene.cs | 2 +- .../TestSceneAllPlayersQueueMode.cs | 26 +++++++++---------- .../Multiplayer/TestSceneHostOnlyQueueMode.cs | 24 ++++++++--------- .../Multiplayer/TestSceneMultiplayer.cs | 12 ++++----- .../TestSceneMultiplayerMatchSubScreen.cs | 2 +- .../Multiplayer/TestSceneMultiplayerPlayer.cs | 2 +- .../TestSceneMultiplayerQueueList.cs | 8 +++--- .../Visual/Multiplayer/TestSceneTeamVersus.cs | 4 +-- .../Multiplayer/TestMultiplayerClient.cs | 10 +------ 9 files changed, 41 insertions(+), 49 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/QueueModeTestScene.cs b/osu.Game.Tests/Visual/Multiplayer/QueueModeTestScene.cs index 074a92f5b0..53bed75723 100644 --- a/osu.Game.Tests/Visual/Multiplayer/QueueModeTestScene.cs +++ b/osu.Game.Tests/Visual/Multiplayer/QueueModeTestScene.cs @@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestCreatedWithCorrectMode() { - AddAssert("room created with correct mode", () => MultiplayerClient.APIRoom?.QueueMode.Value == Mode); + AddAssert("room created with correct mode", () => MultiplayerClient.ClientAPIRoom?.QueueMode.Value == Mode); } protected void RunGameplay() diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs index 32fd7724e0..b08102df8c 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs @@ -30,19 +30,19 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestFirstItemSelectedByDefault() { - AddAssert("first item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.APIRoom?.Playlist[0].ID); + AddAssert("first item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); } [Test] public void TestItemAddedToTheEndOfQueue() { addItem(() => OtherBeatmap); - AddAssert("playlist has 2 items", () => MultiplayerClient.APIRoom?.Playlist.Count == 2); + AddAssert("playlist has 2 items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 2); addItem(() => InitialBeatmap); - AddAssert("playlist has 3 items", () => MultiplayerClient.APIRoom?.Playlist.Count == 3); + AddAssert("playlist has 3 items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 3); - AddAssert("first item still selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.APIRoom?.Playlist[0].ID); + AddAssert("first item still selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); } [Test] @@ -50,9 +50,9 @@ namespace osu.Game.Tests.Visual.Multiplayer { RunGameplay(); - AddAssert("playlist has only one item", () => MultiplayerClient.APIRoom?.Playlist.Count == 1); - AddAssert("playlist item is expired", () => MultiplayerClient.APIRoom?.Playlist[0].Expired == true); - AddAssert("last item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.APIRoom?.Playlist[0].ID); + AddAssert("playlist has only one item", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 1); + AddAssert("playlist item is expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[0].Expired == true); + AddAssert("last item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); } [Test] @@ -63,13 +63,13 @@ namespace osu.Game.Tests.Visual.Multiplayer RunGameplay(); - AddAssert("first item expired", () => MultiplayerClient.APIRoom?.Playlist[0].Expired == true); - AddAssert("next item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.APIRoom?.Playlist[1].ID); + AddAssert("first item expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[0].Expired == true); + AddAssert("next item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[1].ID); RunGameplay(); - AddAssert("second item expired", () => MultiplayerClient.APIRoom?.Playlist[1].Expired == true); - AddAssert("next item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.APIRoom?.Playlist[2].ID); + AddAssert("second item expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[1].Expired == true); + AddAssert("next item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[2].ID); } [Test] @@ -82,8 +82,8 @@ namespace osu.Game.Tests.Visual.Multiplayer RunGameplay(); AddStep("change queue mode", () => MultiplayerClient.ChangeSettings(queueMode: QueueMode.HostOnly)); - AddAssert("playlist has 3 items", () => MultiplayerClient.APIRoom?.Playlist.Count == 3); - AddAssert("item 2 is not expired", () => MultiplayerClient.APIRoom?.Playlist[1].Expired == false); + AddAssert("playlist has 3 items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 3); + AddAssert("item 2 is not expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[1].Expired == false); AddAssert("current item is the other beatmap", () => MultiplayerClient.Room?.Settings.PlaylistItemId == 2); } diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs index e436f418ab..8f19590731 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestFirstItemSelectedByDefault() { - AddAssert("first item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.APIRoom?.Playlist[0].ID); + AddAssert("first item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); } [Test] @@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { selectNewItem(() => InitialBeatmap); - AddAssert("playlist item still selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.APIRoom?.Playlist[0].ID); + AddAssert("playlist item still selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); } [Test] @@ -40,7 +40,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { selectNewItem(() => OtherBeatmap); - AddAssert("playlist item still selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.APIRoom?.Playlist[0].ID); + AddAssert("playlist item still selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); } [Test] @@ -48,10 +48,10 @@ namespace osu.Game.Tests.Visual.Multiplayer { RunGameplay(); - AddAssert("playlist contains two items", () => MultiplayerClient.APIRoom?.Playlist.Count == 2); - AddAssert("first playlist item expired", () => MultiplayerClient.APIRoom?.Playlist[0].Expired == true); - AddAssert("second playlist item not expired", () => MultiplayerClient.APIRoom?.Playlist[1].Expired == false); - AddAssert("second playlist item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.APIRoom?.Playlist[1].ID); + AddAssert("playlist contains two items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 2); + AddAssert("first playlist item expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[0].Expired == true); + AddAssert("second playlist item not expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[1].Expired == false); + AddAssert("second playlist item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[1].ID); } [Test] @@ -60,12 +60,12 @@ namespace osu.Game.Tests.Visual.Multiplayer RunGameplay(); IBeatmapInfo firstBeatmap = null; - AddStep("get first playlist item beatmap", () => firstBeatmap = MultiplayerClient.APIRoom?.Playlist[0].Beatmap); + AddStep("get first playlist item beatmap", () => firstBeatmap = MultiplayerClient.ClientAPIRoom?.Playlist[0].Beatmap); selectNewItem(() => OtherBeatmap); - AddAssert("first playlist item hasn't changed", () => MultiplayerClient.APIRoom?.Playlist[0].Beatmap == firstBeatmap); - AddAssert("second playlist item changed", () => MultiplayerClient.APIRoom?.Playlist[1].Beatmap != firstBeatmap); + AddAssert("first playlist item hasn't changed", () => MultiplayerClient.ClientAPIRoom?.Playlist[0].Beatmap == firstBeatmap); + AddAssert("second playlist item changed", () => MultiplayerClient.ClientAPIRoom?.Playlist[1].Beatmap != firstBeatmap); } [Test] @@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual.Multiplayer QueueMode = QueueMode.AllPlayers }).WaitSafely()); - AddUntilStep("api room updated", () => MultiplayerClient.APIRoom?.QueueMode.Value == QueueMode.AllPlayers); + AddUntilStep("api room updated", () => MultiplayerClient.ClientAPIRoom?.QueueMode.Value == QueueMode.AllPlayers); } [Test] @@ -84,7 +84,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { addItem(() => OtherBeatmap); - AddAssert("playlist contains two items", () => MultiplayerClient.APIRoom?.Playlist.Count == 2); + AddAssert("playlist contains two items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 2); } private void selectNewItem(Func beatmap) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs index d464527976..37cc803daf 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs @@ -243,8 +243,8 @@ namespace osu.Game.Tests.Visual.Multiplayer } }); - AddAssert("Check participant count correct", () => multiplayerClient.APIRoom?.ParticipantCount.Value == 1); - AddAssert("Check participant list contains user", () => multiplayerClient.APIRoom?.RecentParticipants.Count(u => u.Id == API.LocalUser.Value.Id) == 1); + AddAssert("Check participant count correct", () => multiplayerClient.ClientAPIRoom?.ParticipantCount.Value == 1); + AddAssert("Check participant list contains user", () => multiplayerClient.ClientAPIRoom?.RecentParticipants.Count(u => u.Id == API.LocalUser.Value.Id) == 1); } [Test] @@ -303,8 +303,8 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("wait for room open", () => this.ChildrenOfType().FirstOrDefault()?.IsLoaded == true); AddUntilStep("wait for join", () => multiplayerClient.RoomJoined); - AddAssert("Check participant count correct", () => multiplayerClient.APIRoom?.ParticipantCount.Value == 1); - AddAssert("Check participant list contains user", () => multiplayerClient.APIRoom?.RecentParticipants.Count(u => u.Id == API.LocalUser.Value.Id) == 1); + AddAssert("Check participant count correct", () => multiplayerClient.ClientAPIRoom?.ParticipantCount.Value == 1); + AddAssert("Check participant list contains user", () => multiplayerClient.ClientAPIRoom?.RecentParticipants.Count(u => u.Id == API.LocalUser.Value.Id) == 1); } [Test] @@ -323,7 +323,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } }); - AddAssert("room has password", () => multiplayerClient.APIRoom?.Password.Value == "password"); + AddAssert("room has password", () => multiplayerClient.ClientAPIRoom?.Password.Value == "password"); } [Test] @@ -377,7 +377,7 @@ namespace osu.Game.Tests.Visual.Multiplayer }); AddStep("change password", () => multiplayerClient.ChangeSettings(password: "password2")); - AddUntilStep("local password changed", () => multiplayerClient.APIRoom?.Password.Value == "password2"); + AddUntilStep("local password changed", () => multiplayerClient.ClientAPIRoom?.Password.Value == "password2"); } [Test] diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs index bb7587ac56..478c8d3318 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs @@ -254,7 +254,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("last playlist item selected", () => { - var lastItem = this.ChildrenOfType().Single(p => p.Item.ID == MultiplayerClient.APIRoom?.Playlist.Last().ID); + var lastItem = this.ChildrenOfType().Single(p => p.Item.ID == MultiplayerClient.ClientAPIRoom?.Playlist.Last().ID); return lastItem.IsSelectedItem; }); } diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs index 042a9297eb..300980a53f 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs @@ -30,7 +30,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("initialise gameplay", () => { - Stack.Push(player = new MultiplayerPlayer(MultiplayerClient.APIRoom, new PlaylistItem(Beatmap.Value.BeatmapInfo) + Stack.Push(player = new MultiplayerPlayer(MultiplayerClient.ClientAPIRoom, new PlaylistItem(Beatmap.Value.BeatmapInfo) { RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID, }, MultiplayerClient.Room?.Users.ToArray())); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerQueueList.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerQueueList.cs index fcd6dd5bd2..8aa7d5aec2 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerQueueList.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerQueueList.cs @@ -52,7 +52,7 @@ namespace osu.Game.Tests.Visual.Multiplayer Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(500, 300), - Items = { BindTarget = MultiplayerClient.APIRoom!.Playlist } + Items = { BindTarget = MultiplayerClient.ClientAPIRoom!.Playlist } }; }); @@ -70,7 +70,7 @@ namespace osu.Game.Tests.Visual.Multiplayer public void TestDeleteButtonAlwaysVisibleForHost() { AddStep("set all players queue mode", () => MultiplayerClient.ChangeSettings(new MultiplayerRoomSettings { QueueMode = QueueMode.AllPlayers }).WaitSafely()); - AddUntilStep("wait for queue mode change", () => MultiplayerClient.APIRoom?.QueueMode.Value == QueueMode.AllPlayers); + AddUntilStep("wait for queue mode change", () => MultiplayerClient.ClientAPIRoom?.QueueMode.Value == QueueMode.AllPlayers); addPlaylistItem(() => API.LocalUser.Value.OnlineID); assertDeleteButtonVisibility(1, true); @@ -82,7 +82,7 @@ namespace osu.Game.Tests.Visual.Multiplayer public void TestDeleteButtonOnlyVisibleForItemOwnerIfNotHost() { AddStep("set all players queue mode", () => MultiplayerClient.ChangeSettings(new MultiplayerRoomSettings { QueueMode = QueueMode.AllPlayers }).WaitSafely()); - AddUntilStep("wait for queue mode change", () => MultiplayerClient.APIRoom?.QueueMode.Value == QueueMode.AllPlayers); + AddUntilStep("wait for queue mode change", () => MultiplayerClient.ClientAPIRoom?.QueueMode.Value == QueueMode.AllPlayers); AddStep("join other user", () => MultiplayerClient.AddUser(new APIUser { Id = 1234 })); AddStep("set other user as host", () => MultiplayerClient.TransferHost(1234)); @@ -101,7 +101,7 @@ namespace osu.Game.Tests.Visual.Multiplayer public void TestCurrentItemDoesNotHaveDeleteButton() { AddStep("set all players queue mode", () => MultiplayerClient.ChangeSettings(new MultiplayerRoomSettings { QueueMode = QueueMode.AllPlayers }).WaitSafely()); - AddUntilStep("wait for queue mode change", () => MultiplayerClient.APIRoom?.QueueMode.Value == QueueMode.AllPlayers); + AddUntilStep("wait for queue mode change", () => MultiplayerClient.ClientAPIRoom?.QueueMode.Value == QueueMode.AllPlayers); addPlaylistItem(() => API.LocalUser.Value.OnlineID); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneTeamVersus.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneTeamVersus.cs index 2e39449f64..7d93e550d0 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneTeamVersus.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneTeamVersus.cs @@ -133,14 +133,14 @@ namespace osu.Game.Tests.Visual.Multiplayer } }); - AddUntilStep("match type head to head", () => multiplayerClient.APIRoom?.Type.Value == MatchType.HeadToHead); + AddUntilStep("match type head to head", () => multiplayerClient.ClientAPIRoom?.Type.Value == MatchType.HeadToHead); AddStep("change match type", () => multiplayerClient.ChangeSettings(new MultiplayerRoomSettings { MatchType = MatchType.TeamVersus }).WaitSafely()); - AddUntilStep("api room updated to team versus", () => multiplayerClient.APIRoom?.Type.Value == MatchType.TeamVersus); + AddUntilStep("api room updated to team versus", () => multiplayerClient.ClientAPIRoom?.Type.Value == MatchType.TeamVersus); } [Test] diff --git a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs index ff83997936..860cf7dee9 100644 --- a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs +++ b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs @@ -31,7 +31,7 @@ namespace osu.Game.Tests.Visual.Multiplayer /// /// The local client's . This is not always equivalent to the server-side room. /// - public new Room? APIRoom => base.APIRoom; + public Room? ClientAPIRoom => APIRoom; public Action? RoomSetupAction; @@ -126,8 +126,6 @@ namespace osu.Game.Tests.Visual.Multiplayer private void updateRoomStateIfRequired() { - Debug.Assert(APIRoom != null); - Schedule(() => { Debug.Assert(Room != null); @@ -223,7 +221,6 @@ namespace osu.Game.Tests.Visual.Multiplayer protected override void OnRoomJoined() { - Debug.Assert(APIRoom != null); Debug.Assert(Room != null); // emulate the server sending this after the join room. scheduler required to make sure the join room event is fired first (in Join). @@ -250,7 +247,6 @@ namespace osu.Game.Tests.Visual.Multiplayer public override async Task ChangeSettings(MultiplayerRoomSettings settings) { Debug.Assert(Room != null); - Debug.Assert(APIRoom != null); Debug.Assert(currentItem != null); // Server is authoritative for the time being. @@ -344,7 +340,6 @@ namespace osu.Game.Tests.Visual.Multiplayer public async Task AddUserPlaylistItem(int userId, MultiplayerPlaylistItem item) { Debug.Assert(Room != null); - Debug.Assert(APIRoom != null); Debug.Assert(currentItem != null); if (Room.Settings.QueueMode == QueueMode.HostOnly && Room.Host?.UserID != LocalUser?.UserID) @@ -392,7 +387,6 @@ namespace osu.Game.Tests.Visual.Multiplayer public async Task RemoveUserPlaylistItem(int userId, long playlistItemId) { Debug.Assert(Room != null); - Debug.Assert(APIRoom != null); Debug.Assert(serverSideAPIRoom != null); var item = serverSidePlaylist.Find(i => i.ID == playlistItemId); @@ -444,7 +438,6 @@ namespace osu.Game.Tests.Visual.Multiplayer private async Task changeQueueMode(QueueMode newMode) { Debug.Assert(Room != null); - Debug.Assert(APIRoom != null); Debug.Assert(currentItem != null); // When changing to host-only mode, ensure that at least one non-expired playlist item exists by duplicating the current item. @@ -458,7 +451,6 @@ namespace osu.Game.Tests.Visual.Multiplayer public async Task FinishCurrentItem() { Debug.Assert(Room != null); - Debug.Assert(APIRoom != null); Debug.Assert(currentItem != null); // Expire the current playlist item. From b64c0d011c877332d11c19170e620bd2f8a849a3 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 1 Jul 2022 18:58:22 +0900 Subject: [PATCH 2012/2328] Isolate client's Room from TestMultiplayerClient --- .../StatefulMultiplayerClientTest.cs | 10 +- .../TestSceneAllPlayersQueueMode.cs | 12 +- .../Multiplayer/TestSceneHostOnlyQueueMode.cs | 8 +- .../Multiplayer/TestSceneMultiplayer.cs | 64 ++-- .../TestSceneMultiplayerMatchSubScreen.cs | 2 +- .../TestSceneMultiplayerParticipantsList.cs | 8 +- .../Multiplayer/TestSceneMultiplayerPlayer.cs | 2 +- .../TestSceneMultiplayerQueueList.cs | 2 +- .../TestSceneMultiplayerSpectateButton.cs | 4 +- .../Visual/Multiplayer/TestSceneTeamVersus.cs | 16 +- .../Online/Multiplayer/MultiplayerClient.cs | 2 +- .../Multiplayer/TestMultiplayerClient.cs | 335 ++++++++++-------- 12 files changed, 260 insertions(+), 205 deletions(-) diff --git a/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs b/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs index 9c8b977ad9..0bcb38327e 100644 --- a/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs +++ b/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tests.NonVisual.Multiplayer var user = new APIUser { Id = 33 }; AddRepeatStep("add user multiple times", () => MultiplayerClient.AddUser(user), 3); - AddAssert("room has 2 users", () => MultiplayerClient.Room?.Users.Count == 2); + AddUntilStep("room has 2 users", () => MultiplayerClient.ClientRoom?.Users.Count == 2); } [Test] @@ -33,10 +33,10 @@ namespace osu.Game.Tests.NonVisual.Multiplayer var user = new APIUser { Id = 44 }; AddStep("add user", () => MultiplayerClient.AddUser(user)); - AddAssert("room has 2 users", () => MultiplayerClient.Room?.Users.Count == 2); + AddUntilStep("room has 2 users", () => MultiplayerClient.ClientRoom?.Users.Count == 2); AddRepeatStep("remove user multiple times", () => MultiplayerClient.RemoveUser(user), 3); - AddAssert("room has 1 user", () => MultiplayerClient.Room?.Users.Count == 1); + AddUntilStep("room has 1 user", () => MultiplayerClient.ClientRoom?.Users.Count == 1); } [Test] @@ -59,7 +59,7 @@ namespace osu.Game.Tests.NonVisual.Multiplayer changeState(6, MultiplayerUserState.WaitingForLoad); checkPlayingUserCount(6); - AddStep("another user left", () => MultiplayerClient.RemoveUser((MultiplayerClient.Room?.Users.Last().User).AsNonNull())); + AddStep("another user left", () => MultiplayerClient.RemoveUser((MultiplayerClient.ServerRoom?.Users.Last().User).AsNonNull())); checkPlayingUserCount(5); AddStep("leave room", () => MultiplayerClient.LeaveRoom()); @@ -103,7 +103,7 @@ namespace osu.Game.Tests.NonVisual.Multiplayer { for (int i = 0; i < userCount; ++i) { - int userId = MultiplayerClient.Room?.Users[i].UserID ?? throw new AssertionException("Room cannot be null!"); + int userId = MultiplayerClient.ServerRoom?.Users[i].UserID ?? throw new AssertionException("Room cannot be null!"); MultiplayerClient.ChangeUserState(userId, state); } }); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs index b08102df8c..a94a60f12d 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs @@ -30,7 +30,7 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestFirstItemSelectedByDefault() { - AddAssert("first item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); + AddUntilStep("first item selected", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); } [Test] @@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.Multiplayer addItem(() => InitialBeatmap); AddAssert("playlist has 3 items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 3); - AddAssert("first item still selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); + AddUntilStep("first item still selected", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); } [Test] @@ -52,7 +52,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddAssert("playlist has only one item", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 1); AddAssert("playlist item is expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[0].Expired == true); - AddAssert("last item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); + AddUntilStep("last item selected", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); } [Test] @@ -64,12 +64,12 @@ namespace osu.Game.Tests.Visual.Multiplayer RunGameplay(); AddAssert("first item expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[0].Expired == true); - AddAssert("next item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[1].ID); + AddUntilStep("next item selected", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[1].ID); RunGameplay(); AddAssert("second item expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[1].Expired == true); - AddAssert("next item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[2].ID); + AddUntilStep("next item selected", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[2].ID); } [Test] @@ -84,7 +84,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("change queue mode", () => MultiplayerClient.ChangeSettings(queueMode: QueueMode.HostOnly)); AddAssert("playlist has 3 items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 3); AddAssert("item 2 is not expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[1].Expired == false); - AddAssert("current item is the other beatmap", () => MultiplayerClient.Room?.Settings.PlaylistItemId == 2); + AddUntilStep("current item is the other beatmap", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == 2); } [Test] diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs index 8f19590731..15a1354c98 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestFirstItemSelectedByDefault() { - AddAssert("first item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); + AddUntilStep("first item selected", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); } [Test] @@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { selectNewItem(() => InitialBeatmap); - AddAssert("playlist item still selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); + AddUntilStep("playlist item still selected", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); } [Test] @@ -40,7 +40,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { selectNewItem(() => OtherBeatmap); - AddAssert("playlist item still selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); + AddUntilStep("playlist item still selected", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); } [Test] @@ -51,7 +51,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddAssert("playlist contains two items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 2); AddAssert("first playlist item expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[0].Expired == true); AddAssert("second playlist item not expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[1].Expired == false); - AddAssert("second playlist item selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[1].ID); + AddUntilStep("second playlist item selected", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[1].ID); } [Test] diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs index 37cc803daf..193d1d4248 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs @@ -116,25 +116,25 @@ namespace osu.Game.Tests.Visual.Multiplayer // all ready AddUntilStep("all players ready", () => { - var nextUnready = multiplayerClient.Room?.Users.FirstOrDefault(c => c.State == MultiplayerUserState.Idle); + var nextUnready = multiplayerClient.ClientRoom?.Users.FirstOrDefault(c => c.State == MultiplayerUserState.Idle); if (nextUnready != null) multiplayerClient.ChangeUserState(nextUnready.UserID, MultiplayerUserState.Ready); - return multiplayerClient.Room?.Users.All(u => u.State == MultiplayerUserState.Ready) == true; + return multiplayerClient.ClientRoom?.Users.All(u => u.State == MultiplayerUserState.Ready) == true; }); AddStep("unready all players at once", () => { - Debug.Assert(multiplayerClient.Room != null); + Debug.Assert(multiplayerClient.ServerRoom != null); - foreach (var u in multiplayerClient.Room.Users) multiplayerClient.ChangeUserState(u.UserID, MultiplayerUserState.Idle); + foreach (var u in multiplayerClient.ServerRoom.Users) multiplayerClient.ChangeUserState(u.UserID, MultiplayerUserState.Idle); }); AddStep("ready all players at once", () => { - Debug.Assert(multiplayerClient.Room != null); + Debug.Assert(multiplayerClient.ServerRoom != null); - foreach (var u in multiplayerClient.Room.Users) multiplayerClient.ChangeUserState(u.UserID, MultiplayerUserState.Ready); + foreach (var u in multiplayerClient.ServerRoom.Users) multiplayerClient.ChangeUserState(u.UserID, MultiplayerUserState.Ready); }); } @@ -146,7 +146,7 @@ namespace osu.Game.Tests.Visual.Multiplayer private void removeLastUser() { - APIUser lastUser = multiplayerClient.Room?.Users.Last().User; + APIUser lastUser = multiplayerClient.ServerRoom?.Users.Last().User; if (lastUser == null || lastUser == multiplayerClient.LocalUser?.User) return; @@ -156,7 +156,7 @@ namespace osu.Game.Tests.Visual.Multiplayer private void kickLastUser() { - APIUser lastUser = multiplayerClient.Room?.Users.Last().User; + APIUser lastUser = multiplayerClient.ServerRoom?.Users.Last().User; if (lastUser == null || lastUser == multiplayerClient.LocalUser?.User) return; @@ -166,14 +166,14 @@ namespace osu.Game.Tests.Visual.Multiplayer private void markNextPlayerReady() { - var nextUnready = multiplayerClient.Room?.Users.FirstOrDefault(c => c.State == MultiplayerUserState.Idle); + var nextUnready = multiplayerClient.ServerRoom?.Users.FirstOrDefault(c => c.State == MultiplayerUserState.Idle); if (nextUnready != null) multiplayerClient.ChangeUserState(nextUnready.UserID, MultiplayerUserState.Ready); } private void markNextPlayerIdle() { - var nextUnready = multiplayerClient.Room?.Users.FirstOrDefault(c => c.State == MultiplayerUserState.Ready); + var nextUnready = multiplayerClient.ServerRoom?.Users.FirstOrDefault(c => c.State == MultiplayerUserState.Ready); if (nextUnready != null) multiplayerClient.ChangeUserState(nextUnready.UserID, MultiplayerUserState.Idle); } @@ -421,22 +421,22 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("Enter song select", () => { var currentSubScreen = ((Screens.OnlinePlay.Multiplayer.Multiplayer)multiplayerComponents.CurrentScreen).CurrentSubScreen; - ((MultiplayerMatchSubScreen)currentSubScreen).OpenSongSelection(multiplayerClient.Room?.Settings.PlaylistItemId); + ((MultiplayerMatchSubScreen)currentSubScreen).OpenSongSelection(multiplayerClient.ClientRoom?.Settings.PlaylistItemId); }); AddUntilStep("wait for song select", () => this.ChildrenOfType().FirstOrDefault()?.BeatmapSetsLoaded == true); - AddAssert("Beatmap matches current item", () => Beatmap.Value.BeatmapInfo.OnlineID == multiplayerClient.Room?.Playlist.First().BeatmapID); + AddUntilStep("Beatmap matches current item", () => Beatmap.Value.BeatmapInfo.OnlineID == multiplayerClient.ClientRoom?.Playlist.First().BeatmapID); AddStep("Select next beatmap", () => InputManager.Key(Key.Down)); - AddUntilStep("Beatmap doesn't match current item", () => Beatmap.Value.BeatmapInfo.OnlineID != multiplayerClient.Room?.Playlist.First().BeatmapID); + AddUntilStep("Beatmap doesn't match current item", () => Beatmap.Value.BeatmapInfo.OnlineID != multiplayerClient.ClientRoom?.Playlist.First().BeatmapID); AddStep("start match externally", () => multiplayerClient.StartMatch().WaitSafely()); AddUntilStep("play started", () => multiplayerComponents.CurrentScreen is Player); - AddAssert("Beatmap matches current item", () => Beatmap.Value.BeatmapInfo.OnlineID == multiplayerClient.Room?.Playlist.First().BeatmapID); + AddUntilStep("Beatmap matches current item", () => Beatmap.Value.BeatmapInfo.OnlineID == multiplayerClient.ClientRoom?.Playlist.First().BeatmapID); } [Test] @@ -459,22 +459,22 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("Enter song select", () => { var currentSubScreen = ((Screens.OnlinePlay.Multiplayer.Multiplayer)multiplayerComponents.CurrentScreen).CurrentSubScreen; - ((MultiplayerMatchSubScreen)currentSubScreen).OpenSongSelection(multiplayerClient.Room?.Settings.PlaylistItemId); + ((MultiplayerMatchSubScreen)currentSubScreen).OpenSongSelection(multiplayerClient.ClientRoom?.Settings.PlaylistItemId); }); AddUntilStep("wait for song select", () => this.ChildrenOfType().FirstOrDefault()?.BeatmapSetsLoaded == true); - AddAssert("Ruleset matches current item", () => Ruleset.Value.OnlineID == multiplayerClient.Room?.Playlist.First().RulesetID); + AddUntilStep("Ruleset matches current item", () => Ruleset.Value.OnlineID == multiplayerClient.ClientRoom?.Playlist.First().RulesetID); AddStep("Switch ruleset", () => ((MultiplayerMatchSongSelect)multiplayerComponents.MultiplayerScreen.CurrentSubScreen).Ruleset.Value = new CatchRuleset().RulesetInfo); - AddUntilStep("Ruleset doesn't match current item", () => Ruleset.Value.OnlineID != multiplayerClient.Room?.Playlist.First().RulesetID); + AddUntilStep("Ruleset doesn't match current item", () => Ruleset.Value.OnlineID != multiplayerClient.ClientRoom?.Playlist.First().RulesetID); AddStep("start match externally", () => multiplayerClient.StartMatch().WaitSafely()); AddUntilStep("play started", () => multiplayerComponents.CurrentScreen is Player); - AddAssert("Ruleset matches current item", () => Ruleset.Value.OnlineID == multiplayerClient.Room?.Playlist.First().RulesetID); + AddUntilStep("Ruleset matches current item", () => Ruleset.Value.OnlineID == multiplayerClient.ClientRoom?.Playlist.First().RulesetID); } [Test] @@ -497,25 +497,25 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("Enter song select", () => { var currentSubScreen = ((Screens.OnlinePlay.Multiplayer.Multiplayer)multiplayerComponents.CurrentScreen).CurrentSubScreen; - ((MultiplayerMatchSubScreen)currentSubScreen).OpenSongSelection(multiplayerClient.Room?.Settings.PlaylistItemId); + ((MultiplayerMatchSubScreen)currentSubScreen).OpenSongSelection(multiplayerClient.ClientRoom?.Settings.PlaylistItemId); }); AddUntilStep("wait for song select", () => this.ChildrenOfType().FirstOrDefault()?.BeatmapSetsLoaded == true); - AddAssert("Mods match current item", - () => SelectedMods.Value.Select(m => m.Acronym).SequenceEqual(multiplayerClient.Room.AsNonNull().Playlist.First().RequiredMods.Select(m => m.Acronym))); + AddUntilStep("Mods match current item", + () => SelectedMods.Value.Select(m => m.Acronym).SequenceEqual(multiplayerClient.ClientRoom.AsNonNull().Playlist.First().RequiredMods.Select(m => m.Acronym))); AddStep("Switch required mods", () => ((MultiplayerMatchSongSelect)multiplayerComponents.MultiplayerScreen.CurrentSubScreen).Mods.Value = new Mod[] { new OsuModDoubleTime() }); - AddAssert("Mods don't match current item", - () => !SelectedMods.Value.Select(m => m.Acronym).SequenceEqual(multiplayerClient.Room.AsNonNull().Playlist.First().RequiredMods.Select(m => m.Acronym))); + AddUntilStep("Mods don't match current item", + () => !SelectedMods.Value.Select(m => m.Acronym).SequenceEqual(multiplayerClient.ClientRoom.AsNonNull().Playlist.First().RequiredMods.Select(m => m.Acronym))); AddStep("start match externally", () => multiplayerClient.StartMatch().WaitSafely()); AddUntilStep("play started", () => multiplayerComponents.CurrentScreen is Player); - AddAssert("Mods match current item", - () => SelectedMods.Value.Select(m => m.Acronym).SequenceEqual(multiplayerClient.Room.AsNonNull().Playlist.First().RequiredMods.Select(m => m.Acronym))); + AddUntilStep("Mods match current item", + () => SelectedMods.Value.Select(m => m.Acronym).SequenceEqual(multiplayerClient.ClientRoom.AsNonNull().Playlist.First().RequiredMods.Select(m => m.Acronym))); } [Test] @@ -890,7 +890,7 @@ namespace osu.Game.Tests.Visual.Multiplayer RulesetID = new OsuRuleset().RulesetInfo.OnlineID, })).WaitSafely()); - AddUntilStep("item arrived in playlist", () => multiplayerClient.Room?.Playlist.Count == 2); + AddUntilStep("item arrived in playlist", () => multiplayerClient.ClientRoom?.Playlist.Count == 2); AddStep("exit gameplay as initial user", () => multiplayerComponents.MultiplayerScreen.MakeCurrent()); AddUntilStep("queue contains item", () => this.ChildrenOfType().Single().Items.Single().ID == 2); @@ -921,10 +921,10 @@ namespace osu.Game.Tests.Visual.Multiplayer RulesetID = new OsuRuleset().RulesetInfo.OnlineID, })).WaitSafely()); - AddUntilStep("item arrived in playlist", () => multiplayerClient.Room?.Playlist.Count == 2); + AddUntilStep("item arrived in playlist", () => multiplayerClient.ClientRoom?.Playlist.Count == 2); AddStep("delete item as other user", () => multiplayerClient.RemoveUserPlaylistItem(1234, 2).WaitSafely()); - AddUntilStep("item removed from playlist", () => multiplayerClient.Room?.Playlist.Count == 1); + AddUntilStep("item removed from playlist", () => multiplayerClient.ClientRoom?.Playlist.Count == 1); AddStep("exit gameplay as initial user", () => multiplayerComponents.MultiplayerScreen.MakeCurrent()); AddUntilStep("queue is empty", () => this.ChildrenOfType().Single().Items.Count == 0); @@ -957,7 +957,7 @@ namespace osu.Game.Tests.Visual.Multiplayer runGameplay(); AddStep("exit gameplay for other user", () => multiplayerClient.ChangeUserState(1234, MultiplayerUserState.Idle)); - AddUntilStep("wait for room to be idle", () => multiplayerClient.Room?.State == MultiplayerRoomState.Open); + AddUntilStep("wait for room to be idle", () => multiplayerClient.ClientRoom?.State == MultiplayerRoomState.Open); runGameplay(); @@ -969,9 +969,9 @@ namespace osu.Game.Tests.Visual.Multiplayer multiplayerClient.StartMatch().WaitSafely(); }); - AddUntilStep("wait for loading", () => multiplayerClient.Room?.State == MultiplayerRoomState.WaitingForLoad); + AddUntilStep("wait for loading", () => multiplayerClient.ClientRoom?.State == MultiplayerRoomState.WaitingForLoad); AddStep("set player loaded", () => multiplayerClient.ChangeUserState(1234, MultiplayerUserState.Loaded)); - AddUntilStep("wait for gameplay to start", () => multiplayerClient.Room?.State == MultiplayerRoomState.Playing); + AddUntilStep("wait for gameplay to start", () => multiplayerClient.ClientRoom?.State == MultiplayerRoomState.Playing); AddUntilStep("wait for local user to enter spectator", () => multiplayerComponents.CurrentScreen is MultiSpectatorScreen); } } @@ -996,7 +996,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("click ready button", () => { - user = playingUserId == null ? multiplayerClient.LocalUser : multiplayerClient.Room?.Users.Single(u => u.UserID == playingUserId); + user = playingUserId == null ? multiplayerClient.LocalUser : multiplayerClient.ServerRoom?.Users.Single(u => u.UserID == playingUserId); lastState = user?.State ?? MultiplayerUserState.Idle; InputManager.MoveMouseTo(readyButton); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs index 478c8d3318..f9eec6b728 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs @@ -152,7 +152,7 @@ namespace osu.Game.Tests.Visual.Multiplayer ClickButtonWhenEnabled(); - AddUntilStep("match started", () => MultiplayerClient.Room?.State == MultiplayerRoomState.WaitingForLoad); + AddUntilStep("match started", () => MultiplayerClient.ClientRoom?.State == MultiplayerRoomState.WaitingForLoad); } [Test] diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs index 75e3da05d3..7db18d1127 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs @@ -53,14 +53,14 @@ namespace osu.Game.Tests.Visual.Multiplayer AddAssert("one unique panel", () => this.ChildrenOfType().Select(p => p.User).Distinct().Count() == 1); AddStep("add non-resolvable user", () => MultiplayerClient.TestAddUnresolvedUser()); - AddAssert("null user added", () => MultiplayerClient.Room.AsNonNull().Users.Count(u => u.User == null) == 1); + AddUntilStep("null user added", () => MultiplayerClient.ClientRoom.AsNonNull().Users.Count(u => u.User == null) == 1); AddUntilStep("two unique panels", () => this.ChildrenOfType().Select(p => p.User).Distinct().Count() == 2); AddStep("kick null user", () => this.ChildrenOfType().Single(p => p.User.User == null) .ChildrenOfType().Single().TriggerClick()); - AddAssert("null user kicked", () => MultiplayerClient.Room.AsNonNull().Users.Count == 1); + AddUntilStep("null user kicked", () => MultiplayerClient.ClientRoom.AsNonNull().Users.Count == 1); } [Test] @@ -80,7 +80,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("remove host", () => MultiplayerClient.RemoveUser(API.LocalUser.Value)); - AddAssert("single panel is for second user", () => this.ChildrenOfType().Single().User.User == secondUser); + AddAssert("single panel is for second user", () => this.ChildrenOfType().Single().User.UserID == secondUser.Id); } [Test] @@ -217,7 +217,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("kick second user", () => this.ChildrenOfType().Single(d => d.IsPresent).TriggerClick()); - AddAssert("second user kicked", () => MultiplayerClient.Room?.Users.Single().UserID == API.LocalUser.Value.Id); + AddUntilStep("second user kicked", () => MultiplayerClient.ClientRoom?.Users.Single().UserID == API.LocalUser.Value.Id); } [Test] diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs index 300980a53f..9fee771b97 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs @@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual.Multiplayer Stack.Push(player = new MultiplayerPlayer(MultiplayerClient.ClientAPIRoom, new PlaylistItem(Beatmap.Value.BeatmapInfo) { RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID, - }, MultiplayerClient.Room?.Users.ToArray())); + }, MultiplayerClient.ServerRoom?.Users.ToArray())); }); AddUntilStep("wait for player to be current", () => player.IsCurrentScreen() && player.IsLoaded); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerQueueList.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerQueueList.cs index 8aa7d5aec2..e709a955b3 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerQueueList.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerQueueList.cs @@ -109,7 +109,7 @@ namespace osu.Game.Tests.Visual.Multiplayer assertDeleteButtonVisibility(1, true); AddStep("finish current item", () => MultiplayerClient.FinishCurrentItem().WaitSafely()); - AddUntilStep("wait for next item to be selected", () => MultiplayerClient.Room?.Settings.PlaylistItemId == 2); + AddUntilStep("wait for next item to be selected", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == 2); AddUntilStep("wait for two items in playlist", () => playlist.ChildrenOfType().Count() == 2); assertDeleteButtonVisibility(0, false); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectateButton.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectateButton.cs index 486da48449..91c87548c7 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectateButton.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectateButton.cs @@ -99,10 +99,10 @@ namespace osu.Game.Tests.Visual.Multiplayer public void TestToggleWhenIdle(MultiplayerUserState initialState) { ClickButtonWhenEnabled(); - AddUntilStep("user is spectating", () => MultiplayerClient.Room?.Users[0].State == MultiplayerUserState.Spectating); + AddUntilStep("user is spectating", () => MultiplayerClient.ClientRoom?.Users[0].State == MultiplayerUserState.Spectating); ClickButtonWhenEnabled(); - AddUntilStep("user is idle", () => MultiplayerClient.Room?.Users[0].State == MultiplayerUserState.Idle); + AddUntilStep("user is idle", () => MultiplayerClient.ClientRoom?.Users[0].State == MultiplayerUserState.Idle); } [TestCase(MultiplayerRoomState.Closed)] diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneTeamVersus.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneTeamVersus.cs index 7d93e550d0..d80537a2e5 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneTeamVersus.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneTeamVersus.cs @@ -76,8 +76,8 @@ namespace osu.Game.Tests.Visual.Multiplayer } }); - AddUntilStep("room type is team vs", () => multiplayerClient.Room?.Settings.MatchType == MatchType.TeamVersus); - AddAssert("user state arrived", () => multiplayerClient.Room?.Users.FirstOrDefault()?.MatchState is TeamVersusUserState); + AddUntilStep("room type is team vs", () => multiplayerClient.ClientRoom?.Settings.MatchType == MatchType.TeamVersus); + AddUntilStep("user state arrived", () => multiplayerClient.ClientRoom?.Users.FirstOrDefault()?.MatchState is TeamVersusUserState); } [Test] @@ -96,7 +96,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } }); - AddAssert("user on team 0", () => (multiplayerClient.Room?.Users.FirstOrDefault()?.MatchState as TeamVersusUserState)?.TeamID == 0); + AddUntilStep("user on team 0", () => (multiplayerClient.ClientRoom?.Users.FirstOrDefault()?.MatchState as TeamVersusUserState)?.TeamID == 0); AddStep("add another user", () => multiplayerClient.AddUser(new APIUser { Username = "otheruser", Id = 44 })); AddStep("press own button", () => @@ -104,17 +104,17 @@ namespace osu.Game.Tests.Visual.Multiplayer InputManager.MoveMouseTo(multiplayerComponents.ChildrenOfType().First()); InputManager.Click(MouseButton.Left); }); - AddAssert("user on team 1", () => (multiplayerClient.Room?.Users.FirstOrDefault()?.MatchState as TeamVersusUserState)?.TeamID == 1); + AddUntilStep("user on team 1", () => (multiplayerClient.ClientRoom?.Users.FirstOrDefault()?.MatchState as TeamVersusUserState)?.TeamID == 1); AddStep("press own button again", () => InputManager.Click(MouseButton.Left)); - AddAssert("user on team 0", () => (multiplayerClient.Room?.Users.FirstOrDefault()?.MatchState as TeamVersusUserState)?.TeamID == 0); + AddUntilStep("user on team 0", () => (multiplayerClient.ClientRoom?.Users.FirstOrDefault()?.MatchState as TeamVersusUserState)?.TeamID == 0); AddStep("press other user's button", () => { InputManager.MoveMouseTo(multiplayerComponents.ChildrenOfType().ElementAt(1)); InputManager.Click(MouseButton.Left); }); - AddAssert("user still on team 0", () => (multiplayerClient.Room?.Users.FirstOrDefault()?.MatchState as TeamVersusUserState)?.TeamID == 0); + AddUntilStep("user still on team 0", () => (multiplayerClient.ClientRoom?.Users.FirstOrDefault()?.MatchState as TeamVersusUserState)?.TeamID == 0); } [Test] @@ -158,13 +158,13 @@ namespace osu.Game.Tests.Visual.Multiplayer } }); - AddUntilStep("room type is head to head", () => multiplayerClient.Room?.Settings.MatchType == MatchType.HeadToHead); + AddUntilStep("room type is head to head", () => multiplayerClient.ClientRoom?.Settings.MatchType == MatchType.HeadToHead); AddUntilStep("team displays are not displaying teams", () => multiplayerComponents.ChildrenOfType().All(d => d.DisplayedTeam == null)); AddStep("change to team vs", () => multiplayerClient.ChangeSettings(matchType: MatchType.TeamVersus)); - AddUntilStep("room type is team vs", () => multiplayerClient.Room?.Settings.MatchType == MatchType.TeamVersus); + AddUntilStep("room type is team vs", () => multiplayerClient.ClientRoom?.Settings.MatchType == MatchType.TeamVersus); AddUntilStep("team displays are displaying teams", () => multiplayerComponents.ChildrenOfType().All(d => d.DisplayedTeam != null)); } diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index 22f474ed42..9832acb140 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -413,7 +413,7 @@ namespace osu.Game.Online.Multiplayer UserJoined?.Invoke(user); RoomUpdated?.Invoke(); - }); + }, false); } Task IMultiplayerClient.UserLeft(MultiplayerRoomUser user) => diff --git a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs index 860cf7dee9..3165a4ecff 100644 --- a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs +++ b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs @@ -31,7 +31,30 @@ namespace osu.Game.Tests.Visual.Multiplayer /// /// The local client's . This is not always equivalent to the server-side room. /// - public Room? ClientAPIRoom => APIRoom; + public Room? ClientAPIRoom => base.APIRoom; + + /// + /// The local client's . This is not always equivalent to the server-side room. + /// + public MultiplayerRoom? ClientRoom => base.Room; + + /// + /// The server's . This is always up-to-date. + /// + public Room? ServerAPIRoom { get; private set; } + + /// + /// The server's . This is always up-to-date. + /// + public MultiplayerRoom? ServerRoom { get; private set; } + + [Obsolete] + protected new Room APIRoom => throw new InvalidOperationException($"Accessing the client-side API room via {nameof(TestMultiplayerClient)} is unsafe. " + + $"Use {nameof(ClientAPIRoom)} if this was intended."); + + [Obsolete] + public new MultiplayerRoom Room => throw new InvalidOperationException($"Accessing the client-side room via {nameof(TestMultiplayerClient)} is unsafe. " + + $"Use {nameof(ClientRoom)} if this was intended."); public Action? RoomSetupAction; @@ -42,17 +65,7 @@ namespace osu.Game.Tests.Visual.Multiplayer private readonly TestMultiplayerRoomManager roomManager; - /// - /// Guaranteed up-to-date playlist. - /// - private readonly List serverSidePlaylist = new List(); - - /// - /// Guaranteed up-to-date API room. - /// - private Room? serverSideAPIRoom; - - private MultiplayerPlaylistItem? currentItem => serverSidePlaylist[currentIndex]; + private MultiplayerPlaylistItem? currentItem => ServerRoom?.Playlist[currentIndex]; private int currentIndex; private long lastPlaylistItemId; @@ -81,150 +94,160 @@ namespace osu.Game.Tests.Visual.Multiplayer private void addUser(MultiplayerRoomUser user) { + Debug.Assert(ServerRoom != null); + + ServerRoom.Users.Add(user); ((IMultiplayerClient)this).UserJoined(clone(user)).WaitSafely(); - // We want the user to be immediately available for testing, so force a scheduler update to run the update-bound continuation. - Scheduler.Update(); - - switch (Room?.MatchState) + switch (ServerRoom?.MatchState) { case TeamVersusRoomState teamVersus: // simulate the server's automatic assignment of users to teams on join. // the "best" team is the one with the least users on it. int bestTeam = teamVersus.Teams - .Select(team => (teamID: team.ID, userCount: Room.Users.Count(u => (u.MatchState as TeamVersusUserState)?.TeamID == team.ID))) + .Select(team => (teamID: team.ID, userCount: ServerRoom.Users.Count(u => (u.MatchState as TeamVersusUserState)?.TeamID == team.ID))) .OrderBy(pair => pair.userCount) .First().teamID; - ((IMultiplayerClient)this).MatchUserStateChanged(clone(user.UserID), clone(new TeamVersusUserState { TeamID = bestTeam })).WaitSafely(); + + user.MatchState = new TeamVersusUserState { TeamID = bestTeam }; + ((IMultiplayerClient)this).MatchUserStateChanged(clone(user.UserID), clone(user.MatchState)).WaitSafely(); break; } } public void RemoveUser(APIUser user) { - Debug.Assert(Room != null); + Debug.Assert(ServerRoom != null); + ServerRoom.Users.Remove(ServerRoom.Users.Single(u => u.UserID == user.Id)); ((IMultiplayerClient)this).UserLeft(clone(new MultiplayerRoomUser(user.Id))); - Schedule(() => - { - if (Room.Users.Any()) - TransferHost(Room.Users.First().UserID); - }); + if (ServerRoom.Users.Any()) + TransferHost(ServerRoom.Users.First().UserID); } public void ChangeRoomState(MultiplayerRoomState newState) { - ((IMultiplayerClient)this).RoomStateChanged(clone(newState)); + Debug.Assert(ServerRoom != null); + + ServerRoom.State = clone(newState); + + ((IMultiplayerClient)this).RoomStateChanged(clone(ServerRoom.State)); } public void ChangeUserState(int userId, MultiplayerUserState newState) { - ((IMultiplayerClient)this).UserStateChanged(clone(userId), clone(newState)); + Debug.Assert(ServerRoom != null); + + var user = ServerRoom.Users.Single(u => u.UserID == userId); + user.State = clone(newState); + + ((IMultiplayerClient)this).UserStateChanged(clone(userId), clone(user.State)); + updateRoomStateIfRequired(); } private void updateRoomStateIfRequired() { - Schedule(() => + Debug.Assert(ServerRoom != null); + + switch (ServerRoom.State) { - Debug.Assert(Room != null); + case MultiplayerRoomState.Open: + break; - switch (Room.State) - { - case MultiplayerRoomState.Open: - break; + case MultiplayerRoomState.WaitingForLoad: + if (ServerRoom.Users.All(u => u.State != MultiplayerUserState.WaitingForLoad)) + { + var loadedUsers = ServerRoom.Users.Where(u => u.State == MultiplayerUserState.Loaded).ToArray(); - case MultiplayerRoomState.WaitingForLoad: - if (Room.Users.All(u => u.State != MultiplayerUserState.WaitingForLoad)) + if (loadedUsers.Length == 0) { - var loadedUsers = Room.Users.Where(u => u.State == MultiplayerUserState.Loaded).ToArray(); - - if (loadedUsers.Length == 0) - { - // all users have bailed from the load sequence. cancel the game start. - ChangeRoomState(MultiplayerRoomState.Open); - return; - } - - foreach (var u in Room.Users.Where(u => u.State == MultiplayerUserState.Loaded)) - ChangeUserState(u.UserID, MultiplayerUserState.Playing); - - ((IMultiplayerClient)this).GameplayStarted(); - - ChangeRoomState(MultiplayerRoomState.Playing); - } - - break; - - case MultiplayerRoomState.Playing: - if (Room.Users.All(u => u.State != MultiplayerUserState.Playing)) - { - foreach (var u in Room.Users.Where(u => u.State == MultiplayerUserState.FinishedPlay)) - ChangeUserState(u.UserID, MultiplayerUserState.Results); - + // all users have bailed from the load sequence. cancel the game start. ChangeRoomState(MultiplayerRoomState.Open); - ((IMultiplayerClient)this).ResultsReady(); - - FinishCurrentItem().WaitSafely(); + return; } - break; - } - }); + foreach (var u in ServerRoom.Users.Where(u => u.State == MultiplayerUserState.Loaded)) + ChangeUserState(u.UserID, MultiplayerUserState.Playing); + + ((IMultiplayerClient)this).GameplayStarted(); + + ChangeRoomState(MultiplayerRoomState.Playing); + } + + break; + + case MultiplayerRoomState.Playing: + if (ServerRoom.Users.All(u => u.State != MultiplayerUserState.Playing)) + { + foreach (var u in ServerRoom.Users.Where(u => u.State == MultiplayerUserState.FinishedPlay)) + ChangeUserState(u.UserID, MultiplayerUserState.Results); + + ChangeRoomState(MultiplayerRoomState.Open); + ((IMultiplayerClient)this).ResultsReady(); + + FinishCurrentItem().WaitSafely(); + } + + break; + } } public void ChangeUserBeatmapAvailability(int userId, BeatmapAvailability newBeatmapAvailability) { - ((IMultiplayerClient)this).UserBeatmapAvailabilityChanged(clone(userId), clone(newBeatmapAvailability)); + Debug.Assert(ServerRoom != null); + + var user = ServerRoom.Users.Single(u => u.UserID == userId); + user.BeatmapAvailability = clone(newBeatmapAvailability); + + ((IMultiplayerClient)this).UserBeatmapAvailabilityChanged(clone(userId), clone(user.BeatmapAvailability)); } protected override async Task JoinRoom(long roomId, string? password = null) { - serverSideAPIRoom = roomManager.ServerSideRooms.Single(r => r.RoomID.Value == roomId); + ServerAPIRoom = roomManager.ServerSideRooms.Single(r => r.RoomID.Value == roomId); - if (password != serverSideAPIRoom.Password.Value) + if (password != ServerAPIRoom.Password.Value) throw new InvalidOperationException("Invalid password."); - serverSidePlaylist.Clear(); - serverSidePlaylist.AddRange(serverSideAPIRoom.Playlist.Select(item => new MultiplayerPlaylistItem(item))); - lastPlaylistItemId = serverSidePlaylist.Max(item => item.ID); + lastPlaylistItemId = ServerAPIRoom.Playlist.Max(item => item.ID); var localUser = new MultiplayerRoomUser(api.LocalUser.Value.Id) { User = api.LocalUser.Value }; - var room = new MultiplayerRoom(roomId) + ServerRoom = new MultiplayerRoom(roomId) { Settings = { - Name = serverSideAPIRoom.Name.Value, - MatchType = serverSideAPIRoom.Type.Value, + Name = ServerAPIRoom.Name.Value, + MatchType = ServerAPIRoom.Type.Value, Password = password, - QueueMode = serverSideAPIRoom.QueueMode.Value, - AutoStartDuration = serverSideAPIRoom.AutoStartDuration.Value + QueueMode = ServerAPIRoom.QueueMode.Value, + AutoStartDuration = ServerAPIRoom.AutoStartDuration.Value }, - Playlist = serverSidePlaylist, + Playlist = ServerAPIRoom.Playlist.Select(item => new MultiplayerPlaylistItem(item)).ToList(), Users = { localUser }, Host = localUser }; - await updatePlaylistOrder(room).ConfigureAwait(false); - await updateCurrentItem(room, false).ConfigureAwait(false); + await updatePlaylistOrder(ServerRoom).ConfigureAwait(false); + await updateCurrentItem(ServerRoom, false).ConfigureAwait(false); - RoomSetupAction?.Invoke(room); + RoomSetupAction?.Invoke(ServerRoom); RoomSetupAction = null; - return clone(room); + return clone(ServerRoom); } protected override void OnRoomJoined() { - Debug.Assert(Room != null); + Debug.Assert(ServerRoom != null); // emulate the server sending this after the join room. scheduler required to make sure the join room event is fired first (in Join). - changeMatchType(Room.Settings.MatchType).WaitSafely(); + changeMatchType(ServerRoom.Settings.MatchType).WaitSafely(); RoomJoined = true; } @@ -235,28 +258,42 @@ namespace osu.Game.Tests.Visual.Multiplayer return Task.CompletedTask; } - public override Task TransferHost(int userId) => ((IMultiplayerClient)this).HostChanged(clone(userId)); + public override Task TransferHost(int userId) + { + Debug.Assert(ServerRoom != null); + + ServerRoom.Host = ServerRoom.Users.Single(u => u.UserID == userId); + + return ((IMultiplayerClient)this).HostChanged(clone(userId)); + } public override Task KickUser(int userId) { - Debug.Assert(Room != null); + Debug.Assert(ServerRoom != null); - return ((IMultiplayerClient)this).UserKicked(clone(Room.Users.Single(u => u.UserID == userId))); + var user = ServerRoom.Users.Single(u => u.UserID == userId); + + ServerRoom.Users.Remove(user); + + return ((IMultiplayerClient)this).UserKicked(clone(user)); } public override async Task ChangeSettings(MultiplayerRoomSettings settings) { - Debug.Assert(Room != null); + Debug.Assert(ServerRoom != null); Debug.Assert(currentItem != null); + settings = clone(settings); + // Server is authoritative for the time being. - settings.PlaylistItemId = Room.Settings.PlaylistItemId; + settings.PlaylistItemId = ServerRoom.Settings.PlaylistItemId; + ServerRoom.Settings = settings; await changeQueueMode(settings.QueueMode).ConfigureAwait(false); await ((IMultiplayerClient)this).SettingsChanged(clone(settings)).ConfigureAwait(false); - foreach (var user in Room.Users.Where(u => u.State == MultiplayerUserState.Ready)) + foreach (var user in ServerRoom.Users.Where(u => u.State == MultiplayerUserState.Ready)) ChangeUserState(user.UserID, MultiplayerUserState.Idle); await changeMatchType(settings.MatchType).ConfigureAwait(false); @@ -283,7 +320,12 @@ namespace osu.Game.Tests.Visual.Multiplayer public void ChangeUserMods(int userId, IEnumerable newMods) { - ((IMultiplayerClient)this).UserModsChanged(clone(userId), clone(newMods)); + Debug.Assert(ServerRoom != null); + + var user = ServerRoom.Users.Single(u => u.UserID == userId); + user.Mods = clone(newMods).ToArray(); + + ((IMultiplayerClient)this).UserModsChanged(clone(userId), clone(user.Mods)); } public override Task ChangeUserMods(IEnumerable newMods) @@ -294,14 +336,14 @@ namespace osu.Game.Tests.Visual.Multiplayer public override async Task SendMatchRequest(MatchUserRequest request) { - Debug.Assert(Room != null); + Debug.Assert(ServerRoom != null); Debug.Assert(LocalUser != null); switch (request) { case ChangeTeamRequest changeTeam: - TeamVersusRoomState roomState = (TeamVersusRoomState)Room.MatchState!; + TeamVersusRoomState roomState = (TeamVersusRoomState)ServerRoom.MatchState!; TeamVersusUserState userState = (TeamVersusUserState)LocalUser.MatchState!; var targetTeam = roomState.Teams.FirstOrDefault(t => t.ID == changeTeam.TeamID); @@ -319,10 +361,10 @@ namespace osu.Game.Tests.Visual.Multiplayer public override Task StartMatch() { - Debug.Assert(Room != null); + Debug.Assert(ServerRoom != null); ChangeRoomState(MultiplayerRoomState.WaitingForLoad); - foreach (var user in Room.Users.Where(u => u.State == MultiplayerUserState.Ready)) + foreach (var user in ServerRoom.Users.Where(u => u.State == MultiplayerUserState.Ready)) ChangeUserState(user.UserID, MultiplayerUserState.WaitingForLoad); return ((IMultiplayerClient)this).LoadRequested(); @@ -339,35 +381,35 @@ namespace osu.Game.Tests.Visual.Multiplayer public async Task AddUserPlaylistItem(int userId, MultiplayerPlaylistItem item) { - Debug.Assert(Room != null); + Debug.Assert(ServerRoom != null); Debug.Assert(currentItem != null); - if (Room.Settings.QueueMode == QueueMode.HostOnly && Room.Host?.UserID != LocalUser?.UserID) + if (ServerRoom.Settings.QueueMode == QueueMode.HostOnly && ServerRoom.Host?.UserID != LocalUser?.UserID) throw new InvalidOperationException("Local user is not the room host."); item.OwnerID = userId; await addItem(item).ConfigureAwait(false); - await updateCurrentItem(Room).ConfigureAwait(false); + await updateCurrentItem(ServerRoom).ConfigureAwait(false); updateRoomStateIfRequired(); } - public override Task AddPlaylistItem(MultiplayerPlaylistItem item) => AddUserPlaylistItem(api.LocalUser.Value.OnlineID, item); + public override Task AddPlaylistItem(MultiplayerPlaylistItem item) => AddUserPlaylistItem(api.LocalUser.Value.OnlineID, clone(item)); public async Task EditUserPlaylistItem(int userId, MultiplayerPlaylistItem item) { - Debug.Assert(Room != null); + Debug.Assert(ServerRoom != null); Debug.Assert(currentItem != null); - Debug.Assert(serverSideAPIRoom != null); + Debug.Assert(ServerAPIRoom != null); item.OwnerID = userId; - var existingItem = serverSidePlaylist.SingleOrDefault(i => i.ID == item.ID); + var existingItem = ServerRoom.Playlist.SingleOrDefault(i => i.ID == item.ID); if (existingItem == null) throw new InvalidOperationException("Attempted to change an item that doesn't exist."); - if (existingItem.OwnerID != userId && Room.Host?.UserID != LocalUser?.UserID) + if (existingItem.OwnerID != userId && ServerRoom.Host?.UserID != LocalUser?.UserID) throw new InvalidOperationException("Attempted to change an item which is not owned by the user."); if (existingItem.Expired) @@ -376,20 +418,20 @@ namespace osu.Game.Tests.Visual.Multiplayer // Ensure the playlist order doesn't change. item.PlaylistOrder = existingItem.PlaylistOrder; - serverSidePlaylist[serverSidePlaylist.IndexOf(existingItem)] = item; - serverSideAPIRoom.Playlist[serverSideAPIRoom.Playlist.IndexOf(serverSideAPIRoom.Playlist.Single(i => i.ID == item.ID))] = new PlaylistItem(item); + ServerRoom.Playlist[ServerRoom.Playlist.IndexOf(existingItem)] = item; + ServerAPIRoom.Playlist[ServerAPIRoom.Playlist.IndexOf(ServerAPIRoom.Playlist.Single(i => i.ID == item.ID))] = new PlaylistItem(item); await ((IMultiplayerClient)this).PlaylistItemChanged(clone(item)).ConfigureAwait(false); } - public override Task EditPlaylistItem(MultiplayerPlaylistItem item) => EditUserPlaylistItem(api.LocalUser.Value.OnlineID, item); + public override Task EditPlaylistItem(MultiplayerPlaylistItem item) => EditUserPlaylistItem(api.LocalUser.Value.OnlineID, clone(item)); public async Task RemoveUserPlaylistItem(int userId, long playlistItemId) { - Debug.Assert(Room != null); - Debug.Assert(serverSideAPIRoom != null); + Debug.Assert(ServerRoom != null); + Debug.Assert(ServerAPIRoom != null); - var item = serverSidePlaylist.Find(i => i.ID == playlistItemId); + var item = ServerRoom.Playlist.FirstOrDefault(i => i.ID == playlistItemId); if (item == null) throw new InvalidOperationException("Item does not exist in the room."); @@ -403,11 +445,11 @@ namespace osu.Game.Tests.Visual.Multiplayer if (item.Expired) throw new InvalidOperationException("Attempted to remove an item which has already been played."); - serverSidePlaylist.Remove(item); - serverSideAPIRoom.Playlist.RemoveAll(i => i.ID == item.ID); + ServerRoom.Playlist.Remove(item); + ServerAPIRoom.Playlist.RemoveAll(i => i.ID == item.ID); await ((IMultiplayerClient)this).PlaylistItemRemoved(clone(playlistItemId)).ConfigureAwait(false); - await updateCurrentItem(Room).ConfigureAwait(false); + await updateCurrentItem(ServerRoom).ConfigureAwait(false); updateRoomStateIfRequired(); } @@ -415,42 +457,52 @@ namespace osu.Game.Tests.Visual.Multiplayer private async Task changeMatchType(MatchType type) { - Debug.Assert(Room != null); + Debug.Assert(ServerRoom != null); switch (type) { case MatchType.HeadToHead: - await ((IMultiplayerClient)this).MatchRoomStateChanged(null).ConfigureAwait(false); + ServerRoom.MatchState = null; + await ((IMultiplayerClient)this).MatchRoomStateChanged(clone(ServerRoom.MatchState)).ConfigureAwait(false); + + foreach (var user in ServerRoom.Users) + { + user.MatchState = null; + await ((IMultiplayerClient)this).MatchUserStateChanged(clone(user.UserID), clone(user.MatchState)).ConfigureAwait(false); + } - foreach (var user in Room.Users) - await ((IMultiplayerClient)this).MatchUserStateChanged(clone(user.UserID), null).ConfigureAwait(false); break; case MatchType.TeamVersus: - await ((IMultiplayerClient)this).MatchRoomStateChanged(clone(TeamVersusRoomState.CreateDefault())).ConfigureAwait(false); + ServerRoom.MatchState = TeamVersusRoomState.CreateDefault(); + await ((IMultiplayerClient)this).MatchRoomStateChanged(clone(ServerRoom.MatchState)).ConfigureAwait(false); + + foreach (var user in ServerRoom.Users) + { + user.MatchState = new TeamVersusUserState(); + await ((IMultiplayerClient)this).MatchUserStateChanged(clone(user.UserID), clone(user.MatchState)).ConfigureAwait(false); + } - foreach (var user in Room.Users) - await ((IMultiplayerClient)this).MatchUserStateChanged(clone(user.UserID), clone(new TeamVersusUserState())).ConfigureAwait(false); break; } } private async Task changeQueueMode(QueueMode newMode) { - Debug.Assert(Room != null); + Debug.Assert(ServerRoom != null); Debug.Assert(currentItem != null); // When changing to host-only mode, ensure that at least one non-expired playlist item exists by duplicating the current item. - if (newMode == QueueMode.HostOnly && serverSidePlaylist.All(item => item.Expired)) + if (newMode == QueueMode.HostOnly && ServerRoom.Playlist.All(item => item.Expired)) await duplicateCurrentItem().ConfigureAwait(false); - await updatePlaylistOrder(Room).ConfigureAwait(false); - await updateCurrentItem(Room).ConfigureAwait(false); + await updatePlaylistOrder(ServerRoom).ConfigureAwait(false); + await updateCurrentItem(ServerRoom).ConfigureAwait(false); } public async Task FinishCurrentItem() { - Debug.Assert(Room != null); + Debug.Assert(ServerRoom != null); Debug.Assert(currentItem != null); // Expire the current playlist item. @@ -458,13 +510,13 @@ namespace osu.Game.Tests.Visual.Multiplayer currentItem.PlayedAt = DateTimeOffset.Now; await ((IMultiplayerClient)this).PlaylistItemChanged(clone(currentItem)).ConfigureAwait(false); - await updatePlaylistOrder(Room).ConfigureAwait(false); + await updatePlaylistOrder(ServerRoom).ConfigureAwait(false); // In host-only mode, a duplicate playlist item will be used for the next round. - if (Room.Settings.QueueMode == QueueMode.HostOnly && serverSidePlaylist.All(item => item.Expired)) + if (ServerRoom.Settings.QueueMode == QueueMode.HostOnly && ServerRoom.Playlist.All(item => item.Expired)) await duplicateCurrentItem().ConfigureAwait(false); - await updateCurrentItem(Room).ConfigureAwait(false); + await updateCurrentItem(ServerRoom).ConfigureAwait(false); } private async Task duplicateCurrentItem() @@ -483,26 +535,28 @@ namespace osu.Game.Tests.Visual.Multiplayer private async Task addItem(MultiplayerPlaylistItem item) { - Debug.Assert(Room != null); - Debug.Assert(serverSideAPIRoom != null); + Debug.Assert(ServerRoom != null); + Debug.Assert(ServerAPIRoom != null); item.ID = ++lastPlaylistItemId; - serverSidePlaylist.Add(item); - serverSideAPIRoom.Playlist.Add(new PlaylistItem(item)); + ServerRoom.Playlist.Add(item); + ServerAPIRoom.Playlist.Add(new PlaylistItem(item)); await ((IMultiplayerClient)this).PlaylistItemAdded(clone(item)).ConfigureAwait(false); - await updatePlaylistOrder(Room).ConfigureAwait(false); + await updatePlaylistOrder(ServerRoom).ConfigureAwait(false); } - private IEnumerable upcomingItems => serverSidePlaylist.Where(i => !i.Expired).OrderBy(i => i.PlaylistOrder); + private IEnumerable upcomingItems => ServerRoom?.Playlist.Where(i => !i.Expired).OrderBy(i => i.PlaylistOrder) ?? Enumerable.Empty(); private async Task updateCurrentItem(MultiplayerRoom room, bool notify = true) { - // Pick the next non-expired playlist item by playlist order, or default to the most-recently-expired item. - MultiplayerPlaylistItem nextItem = upcomingItems.FirstOrDefault() ?? serverSidePlaylist.OrderByDescending(i => i.PlayedAt).First(); + Debug.Assert(ServerRoom != null); - currentIndex = serverSidePlaylist.IndexOf(nextItem); + // Pick the next non-expired playlist item by playlist order, or default to the most-recently-expired item. + MultiplayerPlaylistItem nextItem = upcomingItems.FirstOrDefault() ?? ServerRoom.Playlist.OrderByDescending(i => i.PlayedAt).First(); + + currentIndex = ServerRoom.Playlist.IndexOf(nextItem); long lastItem = room.Settings.PlaylistItemId; room.Settings.PlaylistItemId = nextItem.ID; @@ -513,21 +567,22 @@ namespace osu.Game.Tests.Visual.Multiplayer private async Task updatePlaylistOrder(MultiplayerRoom room) { - Debug.Assert(serverSideAPIRoom != null); + Debug.Assert(ServerRoom != null); + Debug.Assert(ServerAPIRoom != null); List orderedActiveItems; switch (room.Settings.QueueMode) { default: - orderedActiveItems = serverSidePlaylist.Where(item => !item.Expired).OrderBy(item => item.ID).ToList(); + orderedActiveItems = ServerRoom.Playlist.Where(item => !item.Expired).OrderBy(item => item.ID).ToList(); break; case QueueMode.AllPlayersRoundRobin: var itemsByPriority = new List<(MultiplayerPlaylistItem item, int priority)>(); // Assign a priority for items from each user, starting from 0 and increasing in order which the user added the items. - foreach (var group in serverSidePlaylist.Where(item => !item.Expired).OrderBy(item => item.ID).GroupBy(item => item.OwnerID)) + foreach (var group in ServerRoom.Playlist.Where(item => !item.Expired).OrderBy(item => item.ID).GroupBy(item => item.OwnerID)) { int priority = 0; itemsByPriority.AddRange(group.Select(item => (item, priority++))); @@ -562,8 +617,8 @@ namespace osu.Game.Tests.Visual.Multiplayer } // Also ensure that the API room's playlist is correct. - foreach (var item in serverSideAPIRoom.Playlist) - item.PlaylistOrder = serverSidePlaylist.Single(i => i.ID == item.ID).PlaylistOrder; + foreach (var item in ServerAPIRoom.Playlist) + item.PlaylistOrder = ServerRoom.Playlist.Single(i => i.ID == item.ID).PlaylistOrder; } private T clone(T incoming) From 37acec1952f58552d3c0d1b721a12561fc71ef7c Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 1 Jul 2022 19:15:31 +0900 Subject: [PATCH 2013/2328] Isolate client's LocalUser from TestMultiplayerClient --- osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs index 3165a4ecff..7c14851176 100644 --- a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs +++ b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs @@ -56,6 +56,8 @@ namespace osu.Game.Tests.Visual.Multiplayer public new MultiplayerRoom Room => throw new InvalidOperationException($"Accessing the client-side room via {nameof(TestMultiplayerClient)} is unsafe. " + $"Use {nameof(ClientRoom)} if this was intended."); + public new MultiplayerRoomUser? LocalUser => ServerRoom?.Users.SingleOrDefault(u => u.User?.Id == API.LocalUser.Value.Id); + public Action? RoomSetupAction; public bool RoomJoined { get; private set; } From 084a65578cc532482a2377754b72129e090b7deb Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 1 Jul 2022 19:36:37 +0900 Subject: [PATCH 2014/2328] Always clone messages incoming from client-side --- .../Multiplayer/TestMultiplayerClient.cs | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs index 7c14851176..19b887eea5 100644 --- a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs +++ b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs @@ -201,13 +201,16 @@ namespace osu.Game.Tests.Visual.Multiplayer Debug.Assert(ServerRoom != null); var user = ServerRoom.Users.Single(u => u.UserID == userId); - user.BeatmapAvailability = clone(newBeatmapAvailability); + user.BeatmapAvailability = newBeatmapAvailability; ((IMultiplayerClient)this).UserBeatmapAvailabilityChanged(clone(userId), clone(user.BeatmapAvailability)); } protected override async Task JoinRoom(long roomId, string? password = null) { + roomId = clone(roomId); + password = clone(password); + ServerAPIRoom = roomManager.ServerSideRooms.Single(r => r.RoomID.Value == roomId); if (password != ServerAPIRoom.Password.Value) @@ -262,6 +265,8 @@ namespace osu.Game.Tests.Visual.Multiplayer public override Task TransferHost(int userId) { + userId = clone(userId); + Debug.Assert(ServerRoom != null); ServerRoom.Host = ServerRoom.Users.Single(u => u.UserID == userId); @@ -271,10 +276,11 @@ namespace osu.Game.Tests.Visual.Multiplayer public override Task KickUser(int userId) { + userId = clone(userId); + Debug.Assert(ServerRoom != null); var user = ServerRoom.Users.Single(u => u.UserID == userId); - ServerRoom.Users.Remove(user); return ((IMultiplayerClient)this).UserKicked(clone(user)); @@ -282,11 +288,11 @@ namespace osu.Game.Tests.Visual.Multiplayer public override async Task ChangeSettings(MultiplayerRoomSettings settings) { + settings = clone(settings); + Debug.Assert(ServerRoom != null); Debug.Assert(currentItem != null); - settings = clone(settings); - // Server is authoritative for the time being. settings.PlaylistItemId = ServerRoom.Settings.PlaylistItemId; ServerRoom.Settings = settings; @@ -304,40 +310,44 @@ namespace osu.Game.Tests.Visual.Multiplayer public override Task ChangeState(MultiplayerUserState newState) { + newState = clone(newState); + if (newState == MultiplayerUserState.Idle && LocalUser?.State == MultiplayerUserState.WaitingForLoad) return Task.CompletedTask; - ChangeUserState(api.LocalUser.Value.Id, newState); + ChangeUserState(api.LocalUser.Value.Id, clone(newState)); return Task.CompletedTask; } public override Task ChangeBeatmapAvailability(BeatmapAvailability newBeatmapAvailability) { - ChangeUserBeatmapAvailability(api.LocalUser.Value.Id, newBeatmapAvailability); + ChangeUserBeatmapAvailability(api.LocalUser.Value.Id, clone(newBeatmapAvailability)); return Task.CompletedTask; } public void ChangeUserMods(int userId, IEnumerable newMods) - => ChangeUserMods(userId, newMods.Select(m => new APIMod(m)).ToList()); + => ChangeUserMods(userId, newMods.Select(m => new APIMod(m))); public void ChangeUserMods(int userId, IEnumerable newMods) { Debug.Assert(ServerRoom != null); var user = ServerRoom.Users.Single(u => u.UserID == userId); - user.Mods = clone(newMods).ToArray(); + user.Mods = newMods.ToArray(); ((IMultiplayerClient)this).UserModsChanged(clone(userId), clone(user.Mods)); } public override Task ChangeUserMods(IEnumerable newMods) { - ChangeUserMods(api.LocalUser.Value.Id, newMods); + ChangeUserMods(api.LocalUser.Value.Id, clone(newMods)); return Task.CompletedTask; } public override async Task SendMatchRequest(MatchUserRequest request) { + request = clone(request); + Debug.Assert(ServerRoom != null); Debug.Assert(LocalUser != null); @@ -455,7 +465,7 @@ namespace osu.Game.Tests.Visual.Multiplayer updateRoomStateIfRequired(); } - public override Task RemovePlaylistItem(long playlistItemId) => RemoveUserPlaylistItem(api.LocalUser.Value.OnlineID, playlistItemId); + public override Task RemovePlaylistItem(long playlistItemId) => RemoveUserPlaylistItem(api.LocalUser.Value.OnlineID, clone(playlistItemId)); private async Task changeMatchType(MatchType type) { From 93c68e4329fca6158d62984a0c714eb157f825f5 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 1 Jul 2022 19:46:46 +0900 Subject: [PATCH 2015/2328] More test hardening around ClientAPIRoom usages --- .../Visual/Multiplayer/QueueModeTestScene.cs | 2 +- .../Multiplayer/TestSceneAllPlayersQueueMode.cs | 16 ++++++++-------- .../Multiplayer/TestSceneHostOnlyQueueMode.cs | 14 +++++++------- .../Visual/Multiplayer/TestSceneMultiplayer.cs | 10 +++++----- .../TestSceneMultiplayerMatchSubScreen.cs | 2 +- .../Multiplayer/TestSceneMultiplayerPlayer.cs | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/QueueModeTestScene.cs b/osu.Game.Tests/Visual/Multiplayer/QueueModeTestScene.cs index 53bed75723..2b461cf6f6 100644 --- a/osu.Game.Tests/Visual/Multiplayer/QueueModeTestScene.cs +++ b/osu.Game.Tests/Visual/Multiplayer/QueueModeTestScene.cs @@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestCreatedWithCorrectMode() { - AddAssert("room created with correct mode", () => MultiplayerClient.ClientAPIRoom?.QueueMode.Value == Mode); + AddUntilStep("room created with correct mode", () => MultiplayerClient.ClientAPIRoom?.QueueMode.Value == Mode); } protected void RunGameplay() diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs index a94a60f12d..5947cabf7f 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneAllPlayersQueueMode.cs @@ -37,10 +37,10 @@ namespace osu.Game.Tests.Visual.Multiplayer public void TestItemAddedToTheEndOfQueue() { addItem(() => OtherBeatmap); - AddAssert("playlist has 2 items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 2); + AddUntilStep("playlist has 2 items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 2); addItem(() => InitialBeatmap); - AddAssert("playlist has 3 items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 3); + AddUntilStep("playlist has 3 items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 3); AddUntilStep("first item still selected", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); } @@ -50,8 +50,8 @@ namespace osu.Game.Tests.Visual.Multiplayer { RunGameplay(); - AddAssert("playlist has only one item", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 1); - AddAssert("playlist item is expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[0].Expired == true); + AddUntilStep("playlist has only one item", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 1); + AddUntilStep("playlist item is expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[0].Expired == true); AddUntilStep("last item selected", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[0].ID); } @@ -63,12 +63,12 @@ namespace osu.Game.Tests.Visual.Multiplayer RunGameplay(); - AddAssert("first item expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[0].Expired == true); + AddUntilStep("first item expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[0].Expired == true); AddUntilStep("next item selected", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[1].ID); RunGameplay(); - AddAssert("second item expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[1].Expired == true); + AddUntilStep("second item expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[1].Expired == true); AddUntilStep("next item selected", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[2].ID); } @@ -82,8 +82,8 @@ namespace osu.Game.Tests.Visual.Multiplayer RunGameplay(); AddStep("change queue mode", () => MultiplayerClient.ChangeSettings(queueMode: QueueMode.HostOnly)); - AddAssert("playlist has 3 items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 3); - AddAssert("item 2 is not expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[1].Expired == false); + AddUntilStep("playlist has 3 items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 3); + AddUntilStep("item 2 is not expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[1].Expired == false); AddUntilStep("current item is the other beatmap", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == 2); } diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs index 15a1354c98..800b523a9d 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneHostOnlyQueueMode.cs @@ -48,9 +48,9 @@ namespace osu.Game.Tests.Visual.Multiplayer { RunGameplay(); - AddAssert("playlist contains two items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 2); - AddAssert("first playlist item expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[0].Expired == true); - AddAssert("second playlist item not expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[1].Expired == false); + AddUntilStep("playlist contains two items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 2); + AddUntilStep("first playlist item expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[0].Expired == true); + AddUntilStep("second playlist item not expired", () => MultiplayerClient.ClientAPIRoom?.Playlist[1].Expired == false); AddUntilStep("second playlist item selected", () => MultiplayerClient.ClientRoom?.Settings.PlaylistItemId == MultiplayerClient.ClientAPIRoom?.Playlist[1].ID); } @@ -60,12 +60,12 @@ namespace osu.Game.Tests.Visual.Multiplayer RunGameplay(); IBeatmapInfo firstBeatmap = null; - AddStep("get first playlist item beatmap", () => firstBeatmap = MultiplayerClient.ClientAPIRoom?.Playlist[0].Beatmap); + AddStep("get first playlist item beatmap", () => firstBeatmap = MultiplayerClient.ServerAPIRoom?.Playlist[0].Beatmap); selectNewItem(() => OtherBeatmap); - AddAssert("first playlist item hasn't changed", () => MultiplayerClient.ClientAPIRoom?.Playlist[0].Beatmap == firstBeatmap); - AddAssert("second playlist item changed", () => MultiplayerClient.ClientAPIRoom?.Playlist[1].Beatmap != firstBeatmap); + AddUntilStep("first playlist item hasn't changed", () => MultiplayerClient.ServerAPIRoom?.Playlist[0].Beatmap == firstBeatmap); + AddUntilStep("second playlist item changed", () => MultiplayerClient.ClientAPIRoom?.Playlist[1].Beatmap != firstBeatmap); } [Test] @@ -84,7 +84,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { addItem(() => OtherBeatmap); - AddAssert("playlist contains two items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 2); + AddUntilStep("playlist contains two items", () => MultiplayerClient.ClientAPIRoom?.Playlist.Count == 2); } private void selectNewItem(Func beatmap) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs index 193d1d4248..da48fb7332 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs @@ -243,8 +243,8 @@ namespace osu.Game.Tests.Visual.Multiplayer } }); - AddAssert("Check participant count correct", () => multiplayerClient.ClientAPIRoom?.ParticipantCount.Value == 1); - AddAssert("Check participant list contains user", () => multiplayerClient.ClientAPIRoom?.RecentParticipants.Count(u => u.Id == API.LocalUser.Value.Id) == 1); + AddUntilStep("Check participant count correct", () => multiplayerClient.ClientAPIRoom?.ParticipantCount.Value == 1); + AddUntilStep("Check participant list contains user", () => multiplayerClient.ClientAPIRoom?.RecentParticipants.Count(u => u.Id == API.LocalUser.Value.Id) == 1); } [Test] @@ -303,8 +303,8 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("wait for room open", () => this.ChildrenOfType().FirstOrDefault()?.IsLoaded == true); AddUntilStep("wait for join", () => multiplayerClient.RoomJoined); - AddAssert("Check participant count correct", () => multiplayerClient.ClientAPIRoom?.ParticipantCount.Value == 1); - AddAssert("Check participant list contains user", () => multiplayerClient.ClientAPIRoom?.RecentParticipants.Count(u => u.Id == API.LocalUser.Value.Id) == 1); + AddUntilStep("Check participant count correct", () => multiplayerClient.ClientAPIRoom?.ParticipantCount.Value == 1); + AddUntilStep("Check participant list contains user", () => multiplayerClient.ClientAPIRoom?.RecentParticipants.Count(u => u.Id == API.LocalUser.Value.Id) == 1); } [Test] @@ -323,7 +323,7 @@ namespace osu.Game.Tests.Visual.Multiplayer } }); - AddAssert("room has password", () => multiplayerClient.ClientAPIRoom?.Password.Value == "password"); + AddUntilStep("room has password", () => multiplayerClient.ClientAPIRoom?.Password.Value == "password"); } [Test] diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs index f9eec6b728..aa935cb1d4 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs @@ -254,7 +254,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("last playlist item selected", () => { - var lastItem = this.ChildrenOfType().Single(p => p.Item.ID == MultiplayerClient.ClientAPIRoom?.Playlist.Last().ID); + var lastItem = this.ChildrenOfType().Single(p => p.Item.ID == MultiplayerClient.ServerAPIRoom?.Playlist.Last().ID); return lastItem.IsSelectedItem; }); } diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs index 9fee771b97..f6a6b3c667 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs @@ -30,7 +30,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("initialise gameplay", () => { - Stack.Push(player = new MultiplayerPlayer(MultiplayerClient.ClientAPIRoom, new PlaylistItem(Beatmap.Value.BeatmapInfo) + Stack.Push(player = new MultiplayerPlayer(MultiplayerClient.ServerAPIRoom, new PlaylistItem(Beatmap.Value.BeatmapInfo) { RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID, }, MultiplayerClient.ServerRoom?.Users.ToArray())); From 6995b34b08884384528d0a35afa9da56ad7c9985 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Fri, 1 Jul 2022 13:14:11 +0200 Subject: [PATCH 2016/2328] Add Android joystick settings --- osu.Android/AndroidJoystickSettings.cs | 76 ++++++++++++++++++++++++++ osu.Android/OsuGameAndroid.cs | 3 + 2 files changed, 79 insertions(+) create mode 100644 osu.Android/AndroidJoystickSettings.cs diff --git a/osu.Android/AndroidJoystickSettings.cs b/osu.Android/AndroidJoystickSettings.cs new file mode 100644 index 0000000000..26e921a426 --- /dev/null +++ b/osu.Android/AndroidJoystickSettings.cs @@ -0,0 +1,76 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Android.Input; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Localisation; +using osu.Game.Localisation; +using osu.Game.Overlays.Settings; + +namespace osu.Android +{ + public class AndroidJoystickSettings : SettingsSubsection + { + protected override LocalisableString Header => JoystickSettingsStrings.JoystickGamepad; + + private readonly AndroidJoystickHandler joystickHandler; + + private readonly Bindable enabled = new BindableBool(true); + + private SettingsSlider deadzoneSlider = null!; + + private Bindable handlerDeadzone = null!; + + private Bindable localDeadzone = null!; + + public AndroidJoystickSettings(AndroidJoystickHandler joystickHandler) + { + this.joystickHandler = joystickHandler; + } + + [BackgroundDependencyLoader] + private void load() + { + // use local bindable to avoid changing enabled state of game host's bindable. + handlerDeadzone = joystickHandler.DeadzoneThreshold.GetBoundCopy(); + localDeadzone = handlerDeadzone.GetUnboundCopy(); + + Children = new Drawable[] + { + new SettingsCheckbox + { + LabelText = CommonStrings.Enabled, + Current = enabled + }, + deadzoneSlider = new SettingsSlider + { + LabelText = JoystickSettingsStrings.DeadzoneThreshold, + KeyboardStep = 0.01f, + DisplayAsPercentage = true, + Current = localDeadzone, + }, + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + enabled.BindTo(joystickHandler.Enabled); + enabled.BindValueChanged(e => deadzoneSlider.Current.Disabled = !e.NewValue, true); + + handlerDeadzone.BindValueChanged(val => + { + bool disabled = localDeadzone.Disabled; + + localDeadzone.Disabled = false; + localDeadzone.Value = val.NewValue; + localDeadzone.Disabled = disabled; + }, true); + + localDeadzone.BindValueChanged(val => handlerDeadzone.Value = val.NewValue); + } + } +} diff --git a/osu.Android/OsuGameAndroid.cs b/osu.Android/OsuGameAndroid.cs index 636fc7d2df..062f2ce10c 100644 --- a/osu.Android/OsuGameAndroid.cs +++ b/osu.Android/OsuGameAndroid.cs @@ -96,6 +96,9 @@ namespace osu.Android case AndroidMouseHandler mh: return new AndroidMouseSettings(mh); + case AndroidJoystickHandler jh: + return new AndroidJoystickSettings(jh); + default: return base.CreateSettingsSubsectionFor(handler); } From 9d28d5f8ee5472356d6ef5fb2a992965b656d751 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Fri, 1 Jul 2022 20:43:12 +0900 Subject: [PATCH 2017/2328] Update SFX for mod overlay show/hide --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 39 ++++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 69cb3a49fc..bf5200902c 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -6,6 +6,8 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -28,6 +30,9 @@ namespace osu.Game.Overlays.Mods { public const int BUTTON_WIDTH = 200; + protected override string PopInSampleName => ""; + protected override string PopOutSampleName => @"SongSelect/mod-select-overlay-pop-out"; + [Cached] public Bindable> SelectedMods { get; private set; } = new Bindable>(Array.Empty()); @@ -101,17 +106,21 @@ namespace osu.Game.Overlays.Mods private ShearedToggleButton? customisationButton; + private Sample? columnAppearSample; + protected ModSelectOverlay(OverlayColourScheme colourScheme = OverlayColourScheme.Green) : base(colourScheme) { } [BackgroundDependencyLoader] - private void load(OsuGameBase game, OsuColour colours) + private void load(OsuGameBase game, OsuColour colours, AudioManager audio) { Header.Title = ModSelectOverlayStrings.ModSelectTitle; Header.Description = ModSelectOverlayStrings.ModSelectDescription; + columnAppearSample = audio.Samples.Get(@"SongSelect/mod-column-pop-in"); + AddRange(new Drawable[] { new ClickToReturnContainer @@ -453,8 +462,32 @@ namespace osu.Game.Overlays.Mods .MoveToY(0, duration, Easing.OutQuint) .FadeIn(duration, Easing.OutQuint); - if (!allFiltered) - nonFilteredColumnCount += 1; + if (allFiltered) + continue; + + int columnNumber = nonFilteredColumnCount; + Scheduler.AddDelayed(() => + { + var channel = columnAppearSample?.GetChannel(); + if (channel == null) return; + + // don't play sample if column isn't visible, but try to play it at least 5 times (assuming there's at least 5 visible columns in `columnFlow`) + if (columnNumber > 5 && !column.Active.Value) return; + + // use X position of the column on screen as a basis for panning the sample + var bounds = column.Parent.BoundingBox; + float balance = (bounds.TopLeft.X + bounds.Width / 2) / RelativeToAbsoluteFactor.X; + + // dip frequency and ramp volume of sample over the first 5 displayed columns + float progress = Math.Min(1, columnNumber / 5f); + + channel.Frequency.Value = 1.3 - (progress * 0.3) + RNG.NextDouble(0.1); + channel.Volume.Value = Math.Max(progress, 0.2); + channel.Balance.Value = -1 + balance * 2; + channel.Play(); + }, delay); + + nonFilteredColumnCount += 1; } } From 6644f9a72a4fd7d9dbf96d00572eb1e57a7019bf Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 1 Jul 2022 21:14:05 +0900 Subject: [PATCH 2018/2328] Fix completely incorrect test --- .../NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs b/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs index 0bcb38327e..d1c5e2d8b3 100644 --- a/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs +++ b/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs @@ -35,7 +35,7 @@ namespace osu.Game.Tests.NonVisual.Multiplayer AddStep("add user", () => MultiplayerClient.AddUser(user)); AddUntilStep("room has 2 users", () => MultiplayerClient.ClientRoom?.Users.Count == 2); - AddRepeatStep("remove user multiple times", () => MultiplayerClient.RemoveUser(user), 3); + AddStep("remove user", () => MultiplayerClient.RemoveUser(user)); AddUntilStep("room has 1 user", () => MultiplayerClient.ClientRoom?.Users.Count == 1); } From 76d4f86ca3616bc00b9fb62b62244496ab8c5661 Mon Sep 17 00:00:00 2001 From: goodtrailer Date: Fri, 1 Jul 2022 18:21:03 -0700 Subject: [PATCH 2019/2328] Make legacy slider ball fade out instantly --- .../Skinning/Legacy/LegacySliderBall.cs | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs index 07e60c82d0..f3be52b227 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs @@ -7,6 +7,8 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Skinning; using osuTK.Graphics; @@ -18,6 +20,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy private readonly ISkin skin; + private DrawableSlider slider; + private Sprite layerNd; private Sprite layerSpec; @@ -30,8 +34,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy } [BackgroundDependencyLoader] - private void load() + private void load(DrawableHitObject dho) { + slider = (DrawableSlider)dho; + var ballColour = skin.GetConfig(OsuSkinColour.SliderBall)?.Value ?? Color4.White; InternalChildren = new[] @@ -56,6 +62,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy Blending = BlendingParameters.Additive, }, }; + + slider.ApplyCustomUpdateState += updateStateTransforms; } protected override void UpdateAfterChildren() @@ -68,5 +76,25 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy layerNd.Rotation = -appliedRotation; layerSpec.Rotation = -appliedRotation; } + + private void updateStateTransforms(DrawableHitObject obj, ArmedState _) + { + if (obj is not DrawableSlider) + return; + + using (BeginAbsoluteSequence(slider.StateUpdateTime)) + this.FadeIn(); + + using (BeginAbsoluteSequence(slider.HitStateUpdateTime)) + this.FadeOut(); + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + if (slider != null) + slider.ApplyCustomUpdateState -= updateStateTransforms; + } } } From 623a99d53abda7e654e4e7a660e0364e2ef54026 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Jul 2022 11:58:45 +0900 Subject: [PATCH 2020/2328] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 584fe0a3ef..86f4337521 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index ff223f5107..40c22c1b21 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -37,7 +37,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index b8a4aca02e..09ae70a01f 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -62,7 +62,7 @@ - + From 634b6cdbbeba1bd768d812fa57eb7ad51db994ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Jul 2022 12:16:16 +0900 Subject: [PATCH 2021/2328] Send beatmap has to server on solo score request Right now, the client does nothing to ensure a beatmap is in a valid state before requesting to submit a score. There is further work to be done client-side so it is more aware of this state (already handled for playlists, but not for the solo gameplay loop), but the solution I have in mind for that is a bit more involved. This is not used server-side yet, but I want to get this sending so we can start using it for some very basic validation. Will resolve the basic portion of #11922 after implemented server-side. --- osu.Game/Online/Solo/CreateSoloScoreRequest.cs | 10 ++++++---- osu.Game/Screens/Play/SoloPlayer.cs | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Online/Solo/CreateSoloScoreRequest.cs b/osu.Game/Online/Solo/CreateSoloScoreRequest.cs index e4612b6659..8c92b32915 100644 --- a/osu.Game/Online/Solo/CreateSoloScoreRequest.cs +++ b/osu.Game/Online/Solo/CreateSoloScoreRequest.cs @@ -6,6 +6,7 @@ using System.Globalization; using System.Net.Http; using osu.Framework.IO.Network; +using osu.Game.Beatmaps; using osu.Game.Online.API; using osu.Game.Online.Rooms; @@ -13,13 +14,13 @@ namespace osu.Game.Online.Solo { public class CreateSoloScoreRequest : APIRequest { - private readonly int beatmapId; + private readonly BeatmapInfo beatmapInfo; private readonly int rulesetId; private readonly string versionHash; - public CreateSoloScoreRequest(int beatmapId, int rulesetId, string versionHash) + public CreateSoloScoreRequest(BeatmapInfo beatmapInfo, int rulesetId, string versionHash) { - this.beatmapId = beatmapId; + this.beatmapInfo = beatmapInfo; this.rulesetId = rulesetId; this.versionHash = versionHash; } @@ -29,10 +30,11 @@ namespace osu.Game.Online.Solo var req = base.CreateWebRequest(); req.Method = HttpMethod.Post; req.AddParameter("version_hash", versionHash); + req.AddParameter("beatmap_hash", beatmapInfo.MD5Hash); req.AddParameter("ruleset_id", rulesetId.ToString(CultureInfo.InvariantCulture)); return req; } - protected override string Target => $@"beatmaps/{beatmapId}/solo/scores"; + protected override string Target => $@"beatmaps/{beatmapInfo.OnlineID}/solo/scores"; } } diff --git a/osu.Game/Screens/Play/SoloPlayer.cs b/osu.Game/Screens/Play/SoloPlayer.cs index b65602e7a8..565f256277 100644 --- a/osu.Game/Screens/Play/SoloPlayer.cs +++ b/osu.Game/Screens/Play/SoloPlayer.cs @@ -37,7 +37,7 @@ namespace osu.Game.Screens.Play if (!Ruleset.Value.IsLegacyRuleset()) return null; - return new CreateSoloScoreRequest(beatmapId, rulesetId, Game.VersionHash); + return new CreateSoloScoreRequest(Beatmap.Value.BeatmapInfo, rulesetId, Game.VersionHash); } protected override bool HandleTokenRetrievalFailure(Exception exception) => false; From 4fd47b5fa0fffdc882779ac11a78b7bbc0f492b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Jul 2022 12:35:29 +0900 Subject: [PATCH 2022/2328] Add more verbose logging to realm blocking process --- osu.Game.Tests/Database/GeneralUsageTests.cs | 8 ++++---- osu.Game.Tests/Database/RealmLiveTests.cs | 2 +- .../Database/RealmSubscriptionRegistrationTests.cs | 12 ++++++------ osu.Game/Database/EFToRealmMigrator.cs | 2 +- osu.Game/Database/RealmAccess.cs | 11 ++++++++--- osu.Game/OsuGameBase.cs | 2 +- .../Sections/DebugSettings/MemorySettings.cs | 4 ++-- 7 files changed, 23 insertions(+), 18 deletions(-) diff --git a/osu.Game.Tests/Database/GeneralUsageTests.cs b/osu.Game.Tests/Database/GeneralUsageTests.cs index 5b6f7a0a53..fd0b391d0d 100644 --- a/osu.Game.Tests/Database/GeneralUsageTests.cs +++ b/osu.Game.Tests/Database/GeneralUsageTests.cs @@ -30,7 +30,7 @@ namespace osu.Game.Tests.Database { RunTestWithRealm((realm, _) => { - using (realm.BlockAllOperations()) + using (realm.BlockAllOperations("testing")) { } }); @@ -56,7 +56,7 @@ namespace osu.Game.Tests.Database { Task writeTask; - using (realm.BlockAllOperations()) + using (realm.BlockAllOperations("testing")) { writeTask = realm.WriteAsync(r => r.Add(TestResources.CreateTestBeatmapSetInfo())); Thread.Sleep(100); @@ -169,7 +169,7 @@ namespace osu.Game.Tests.Database Assert.Throws(() => { - using (realm.BlockAllOperations()) + using (realm.BlockAllOperations("testing")) { } }); @@ -177,7 +177,7 @@ namespace osu.Game.Tests.Database stopThreadedUsage.Set(); // Ensure we can block a second time after the usage has ended. - using (realm.BlockAllOperations()) + using (realm.BlockAllOperations("testing")) { } }); diff --git a/osu.Game.Tests/Database/RealmLiveTests.cs b/osu.Game.Tests/Database/RealmLiveTests.cs index fd1f564f59..a50eb22c67 100644 --- a/osu.Game.Tests/Database/RealmLiveTests.cs +++ b/osu.Game.Tests/Database/RealmLiveTests.cs @@ -49,7 +49,7 @@ namespace osu.Game.Tests.Database { migratedStorage.DeleteDirectory(string.Empty); - using (realm.BlockAllOperations()) + using (realm.BlockAllOperations("testing")) { storage.Migrate(migratedStorage); } diff --git a/osu.Game.Tests/Database/RealmSubscriptionRegistrationTests.cs b/osu.Game.Tests/Database/RealmSubscriptionRegistrationTests.cs index c74341b5c9..4ee302bbd0 100644 --- a/osu.Game.Tests/Database/RealmSubscriptionRegistrationTests.cs +++ b/osu.Game.Tests/Database/RealmSubscriptionRegistrationTests.cs @@ -136,7 +136,7 @@ namespace osu.Game.Tests.Database resolvedItems = null; lastChanges = null; - using (realm.BlockAllOperations()) + using (realm.BlockAllOperations("testing")) Assert.That(resolvedItems, Is.Empty); realm.Write(r => r.Add(TestResources.CreateTestBeatmapSetInfo())); @@ -154,7 +154,7 @@ namespace osu.Game.Tests.Database testEventsArriving(false); // And make sure even after another context loss we don't get firings. - using (realm.BlockAllOperations()) + using (realm.BlockAllOperations("testing")) Assert.That(resolvedItems, Is.Null); realm.Write(r => r.Add(TestResources.CreateTestBeatmapSetInfo())); @@ -212,7 +212,7 @@ namespace osu.Game.Tests.Database Assert.That(beatmapSetInfo, Is.Not.Null); - using (realm.BlockAllOperations()) + using (realm.BlockAllOperations("testing")) { // custom disposal action fired when context lost. Assert.That(beatmapSetInfo, Is.Null); @@ -226,7 +226,7 @@ namespace osu.Game.Tests.Database Assert.That(beatmapSetInfo, Is.Null); - using (realm.BlockAllOperations()) + using (realm.BlockAllOperations("testing")) Assert.That(beatmapSetInfo, Is.Null); realm.Run(r => r.Refresh()); @@ -251,7 +251,7 @@ namespace osu.Game.Tests.Database Assert.That(receivedValue, Is.Not.Null); receivedValue = null; - using (realm.BlockAllOperations()) + using (realm.BlockAllOperations("testing")) { } @@ -262,7 +262,7 @@ namespace osu.Game.Tests.Database subscription.Dispose(); receivedValue = null; - using (realm.BlockAllOperations()) + using (realm.BlockAllOperations("testing")) Assert.That(receivedValue, Is.Null); realm.Run(r => r.Refresh()); diff --git a/osu.Game/Database/EFToRealmMigrator.cs b/osu.Game/Database/EFToRealmMigrator.cs index 896d111989..8f2ff600d8 100644 --- a/osu.Game/Database/EFToRealmMigrator.cs +++ b/osu.Game/Database/EFToRealmMigrator.cs @@ -126,7 +126,7 @@ namespace osu.Game.Database string backupSuffix = $"before_final_migration_{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}"; // required for initial backup. - var realmBlockOperations = realm.BlockAllOperations(); + var realmBlockOperations = realm.BlockAllOperations("EF migration"); Task.Factory.StartNew(() => { diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 8cf9bb4a47..9c7ecd8a03 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -780,7 +780,7 @@ namespace osu.Game.Database public void CreateBackup(string backupFilename, IDisposable? blockAllOperations = null) { - using (blockAllOperations ?? BlockAllOperations()) + using (blockAllOperations ?? BlockAllOperations("creating backup")) { Logger.Log($"Creating full realm database backup at {backupFilename}", LoggingTarget.Database); @@ -811,9 +811,12 @@ namespace osu.Game.Database /// This should be used in places we need to ensure no ongoing reads/writes are occurring with realm. /// ie. to move the realm backing file to a new location. /// + /// The reason for blocking. Used for logging purposes. /// An which should be disposed to end the blocking section. - public IDisposable BlockAllOperations() + public IDisposable BlockAllOperations(string reason) { + Logger.Log($@"Attempting to block all realm operations for {reason}.", LoggingTarget.Database); + if (!ThreadSafety.IsUpdateThread) throw new InvalidOperationException(@$"{nameof(BlockAllOperations)} must be called from the update thread."); @@ -843,7 +846,7 @@ namespace osu.Game.Database updateRealm = null; } - Logger.Log(@"Blocking realm operations.", LoggingTarget.Database); + Logger.Log(@"Lock acquired for blocking operations", LoggingTarget.Database); const int sleep_length = 200; int timeout = 5000; @@ -867,6 +870,8 @@ namespace osu.Game.Database Logger.Log($"Realm compact failed with error {e}", LoggingTarget.Database); } + Logger.Log(@"Realm usage isolated via compact", LoggingTarget.Database); + // In order to ensure events arrive in the correct order, these *must* be fired post disposal of the update realm, // and must be posted to the synchronization context. // This is because realm may fire event callbacks between the `unregisterAllSubscriptions` and `updateRealm.Dispose` diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 9a001c92cd..ead3eeb0dc 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -446,7 +446,7 @@ namespace osu.Game Scheduler.Add(() => { - realmBlocker = realm.BlockAllOperations(); + realmBlocker = realm.BlockAllOperations("migration"); readyToRun.Set(); }, false); diff --git a/osu.Game/Overlays/Settings/Sections/DebugSettings/MemorySettings.cs b/osu.Game/Overlays/Settings/Sections/DebugSettings/MemorySettings.cs index 77eede0e46..42ac4adb34 100644 --- a/osu.Game/Overlays/Settings/Sections/DebugSettings/MemorySettings.cs +++ b/osu.Game/Overlays/Settings/Sections/DebugSettings/MemorySettings.cs @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings Action = () => { // Blocking operations implicitly causes a Compact(). - using (realm.BlockAllOperations()) + using (realm.BlockAllOperations("compact")) { } } @@ -58,7 +58,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings { try { - var token = realm.BlockAllOperations(); + var token = realm.BlockAllOperations("maintenance"); blockAction.Enabled.Value = false; From 1fd9c6480394798d4b0fb814fbed9a3b067db2c4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Jul 2022 12:48:33 +0900 Subject: [PATCH 2023/2328] Change song select `FooterButton` sound --- osu.Game/Screens/Select/FooterButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index c251e94ef2..6c9032f5d8 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Select private readonly Box light; public FooterButton() - : base(HoverSampleSet.Toolbar) + : base(HoverSampleSet.Default) { AutoSizeAxes = Axes.Both; Shear = SHEAR; From 426c53fe65e07b39e3aadb09c478d94f67d2ad57 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Jul 2022 12:50:28 +0900 Subject: [PATCH 2024/2328] Fix potential null being sent to extension method which doesn't support it --- osu.Game/Skinning/DefaultSkin.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Skinning/DefaultSkin.cs b/osu.Game/Skinning/DefaultSkin.cs index 2467b7d039..5267861e3e 100644 --- a/osu.Game/Skinning/DefaultSkin.cs +++ b/osu.Game/Skinning/DefaultSkin.cs @@ -113,12 +113,12 @@ namespace osu.Game.Skinning accuracy.Position = new Vector2(-accuracy.ScreenSpaceDeltaToParentSpace(score.ScreenSpaceDrawQuad.Size).X / 2 - horizontal_padding, vertical_offset + 5); accuracy.Origin = Anchor.TopRight; accuracy.Anchor = Anchor.TopCentre; - } - if (combo != null) - { - combo.Position = new Vector2(accuracy.ScreenSpaceDeltaToParentSpace(score.ScreenSpaceDrawQuad.Size).X / 2 + horizontal_padding, vertical_offset + 5); - combo.Anchor = Anchor.TopCentre; + if (combo != null) + { + combo.Position = new Vector2(accuracy.ScreenSpaceDeltaToParentSpace(score.ScreenSpaceDrawQuad.Size).X / 2 + horizontal_padding, vertical_offset + 5); + combo.Anchor = Anchor.TopCentre; + } } var hitError = container.OfType().FirstOrDefault(); From a03abc747b9ff4042d1be6117f7de620884da249 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Jul 2022 12:58:34 +0900 Subject: [PATCH 2025/2328] Tidy up comments and simplify bounding box centre logic --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 5 ++--- osu.Game/Screens/Select/FooterButton.cs | 10 ++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index bf5200902c..04c424461e 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -471,12 +471,11 @@ namespace osu.Game.Overlays.Mods var channel = columnAppearSample?.GetChannel(); if (channel == null) return; - // don't play sample if column isn't visible, but try to play it at least 5 times (assuming there's at least 5 visible columns in `columnFlow`) + // Still play sound effects for off-screen columns up to a certain point. if (columnNumber > 5 && !column.Active.Value) return; // use X position of the column on screen as a basis for panning the sample - var bounds = column.Parent.BoundingBox; - float balance = (bounds.TopLeft.X + bounds.Width / 2) / RelativeToAbsoluteFactor.X; + float balance = column.Parent.BoundingBox.Centre.X / RelativeToAbsoluteFactor.X; // dip frequency and ramp volume of sample over the first 5 displayed columns float progress = Math.Min(1, columnNumber / 5f); diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 6c9032f5d8..3f8cf2e13a 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -4,19 +4,18 @@ #nullable disable using System; -using osuTK; -using osuTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Framework.Localisation; -using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; using osu.Game.Input.Bindings; -using osu.Framework.Input.Bindings; -using osu.Game.Graphics.UserInterface; +using osuTK; +using osuTK.Graphics; namespace osu.Game.Screens.Select { @@ -68,7 +67,6 @@ namespace osu.Game.Screens.Select private readonly Box light; public FooterButton() - : base(HoverSampleSet.Default) { AutoSizeAxes = Axes.Both; Shear = SHEAR; From 1a14808c396856cabe0048a7d0c0b89b4752cec2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Jul 2022 13:03:13 +0900 Subject: [PATCH 2026/2328] Fix `BeatmapInfoWedge` test potentially failing due to quick initial load Was doing a comparison of previous vs new content after explicitly doing a load in a previous step. --- .../Visual/SongSelect/TestSceneBeatmapInfoWedge.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs index f9d18f4236..a144111fd3 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs @@ -53,13 +53,8 @@ namespace osu.Game.Tests.Visual.SongSelect Margin = new MarginPadding { Top = 20 } }); - AddStep("show", () => - { - infoWedge.Show(); - infoWedge.Beatmap = Beatmap.Value; - }); + AddStep("show", () => infoWedge.Show()); - // select part is redundant, but wait for load isn't selectBeatmap(Beatmap.Value.Beatmap); AddWaitStep("wait for select", 3); From 2352636bf2455b8f8e111df0aadc6c2858a7f427 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Jul 2022 13:11:49 +0900 Subject: [PATCH 2027/2328] Fix ID clash with announce and PM channels in chat overlay tests Yet Another Issue. https://github.com/ppy/osu/runs/7159306924?check_suite_focus=true Not sure why announce channel was using a user id for its channel ID. Bad copy paste? --- osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs index 247ea52648..0b982a5745 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs @@ -576,12 +576,13 @@ namespace osu.Game.Tests.Visual.Online private Channel createAnnounceChannel() { - int id = RNG.Next(0, DummyAPIAccess.DUMMY_USER_ID - 1); + const int announce_channel_id = 133337; + return new Channel { - Name = $"Announce {id}", + Name = $"Announce {announce_channel_id}", Type = ChannelType.Announce, - Id = id, + Id = announce_channel_id, }; } From 2e3ff2c7e0a86b1d9e03859fa6f83bc057d9d962 Mon Sep 17 00:00:00 2001 From: goodtrailer Date: Fri, 1 Jul 2022 21:12:36 -0700 Subject: [PATCH 2028/2328] Prefer [Resolved] and LoadComplete --- .../Skinning/Legacy/LegacySliderBall.cs | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs index f3be52b227..fdf7f18bb9 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs @@ -1,14 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Allocation; +using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Skinning; using osuTK.Graphics; @@ -20,10 +18,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy private readonly ISkin skin; - private DrawableSlider slider; + [Resolved(canBeNull: true)] + private DrawableHitObject? drawableObject { get; set; } - private Sprite layerNd; - private Sprite layerSpec; + private Sprite layerNd = null!; + private Sprite layerSpec = null!; public LegacySliderBall(Drawable animationContent, ISkin skin) { @@ -36,8 +35,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy [BackgroundDependencyLoader] private void load(DrawableHitObject dho) { - slider = (DrawableSlider)dho; - var ballColour = skin.GetConfig(OsuSkinColour.SliderBall)?.Value ?? Color4.White; InternalChildren = new[] @@ -62,8 +59,17 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy Blending = BlendingParameters.Additive, }, }; + } - slider.ApplyCustomUpdateState += updateStateTransforms; + protected override void LoadComplete() + { + base.LoadComplete(); + + if (drawableObject != null) + { + drawableObject.ApplyCustomUpdateState += updateStateTransforms; + updateStateTransforms(drawableObject, drawableObject.State.Value); + } } protected override void UpdateAfterChildren() @@ -79,13 +85,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy private void updateStateTransforms(DrawableHitObject obj, ArmedState _) { - if (obj is not DrawableSlider) - return; - - using (BeginAbsoluteSequence(slider.StateUpdateTime)) + using (BeginAbsoluteSequence(drawableObject.AsNonNull().StateUpdateTime)) this.FadeIn(); - using (BeginAbsoluteSequence(slider.HitStateUpdateTime)) + using (BeginAbsoluteSequence(drawableObject.AsNonNull().HitStateUpdateTime)) this.FadeOut(); } @@ -93,8 +96,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy { base.Dispose(isDisposing); - if (slider != null) - slider.ApplyCustomUpdateState -= updateStateTransforms; + if (drawableObject != null) + drawableObject.ApplyCustomUpdateState -= updateStateTransforms; } } } From 6d6ffd35d01c9ffb8d40943fa50776ef3974a2be Mon Sep 17 00:00:00 2001 From: goodtrailer Date: Fri, 1 Jul 2022 21:14:53 -0700 Subject: [PATCH 2029/2328] Remove unused parameter --- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs index fdf7f18bb9..57422e3709 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy } [BackgroundDependencyLoader] - private void load(DrawableHitObject dho) + private void load() { var ballColour = skin.GetConfig(OsuSkinColour.SliderBall)?.Value ?? Color4.White; From 471b64bd20619ff1124193cde8bc9621bce4d476 Mon Sep 17 00:00:00 2001 From: goodtrailer Date: Fri, 1 Jul 2022 21:19:54 -0700 Subject: [PATCH 2030/2328] Reinstate early return with comment Whoops, didn't read the reply until after I pushed... --- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs index 57422e3709..e9fa5cbe43 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Skinning; using osuTK.Graphics; @@ -85,6 +86,12 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy private void updateStateTransforms(DrawableHitObject obj, ArmedState _) { + // Gets called by slider ticks, tails, etc., leading to duplicated + // animations which in this case have no visual impact (due to + // instant fade) but may negatively affect performance + if (obj is not DrawableSlider) + return; + using (BeginAbsoluteSequence(drawableObject.AsNonNull().StateUpdateTime)) this.FadeIn(); From f2141715b8c6f22eba91df5f98d1f1eb91017c35 Mon Sep 17 00:00:00 2001 From: goodtrailer Date: Fri, 1 Jul 2022 21:22:48 -0700 Subject: [PATCH 2031/2328] Replace AsNonNull() with Assert() --- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs index e9fa5cbe43..d0745450da 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs @@ -1,8 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Diagnostics; using osu.Framework.Allocation; -using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -92,10 +92,12 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy if (obj is not DrawableSlider) return; - using (BeginAbsoluteSequence(drawableObject.AsNonNull().StateUpdateTime)) + Debug.Assert(drawableObject != null); + + using (BeginAbsoluteSequence(drawableObject.StateUpdateTime)) this.FadeIn(); - using (BeginAbsoluteSequence(drawableObject.AsNonNull().HitStateUpdateTime)) + using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime)) this.FadeOut(); } From 9a5431d93f2688a01249729619d9154af84f2f9e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Jul 2022 13:36:41 +0900 Subject: [PATCH 2032/2328] Minor renaming / refactoring to use local parameter rather than DI'd object --- .../Skinning/Legacy/LegacySliderBall.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs index d0745450da..414879f42d 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -20,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy private readonly ISkin skin; [Resolved(canBeNull: true)] - private DrawableHitObject? drawableObject { get; set; } + private DrawableHitObject? parentObject { get; set; } private Sprite layerNd = null!; private Sprite layerSpec = null!; @@ -66,10 +65,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy { base.LoadComplete(); - if (drawableObject != null) + if (parentObject != null) { - drawableObject.ApplyCustomUpdateState += updateStateTransforms; - updateStateTransforms(drawableObject, drawableObject.State.Value); + parentObject.ApplyCustomUpdateState += updateStateTransforms; + updateStateTransforms(parentObject, parentObject.State.Value); } } @@ -84,16 +83,14 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy layerSpec.Rotation = -appliedRotation; } - private void updateStateTransforms(DrawableHitObject obj, ArmedState _) + private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState _) { // Gets called by slider ticks, tails, etc., leading to duplicated // animations which in this case have no visual impact (due to // instant fade) but may negatively affect performance - if (obj is not DrawableSlider) + if (drawableObject is not DrawableSlider) return; - Debug.Assert(drawableObject != null); - using (BeginAbsoluteSequence(drawableObject.StateUpdateTime)) this.FadeIn(); @@ -105,8 +102,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy { base.Dispose(isDisposing); - if (drawableObject != null) - drawableObject.ApplyCustomUpdateState -= updateStateTransforms; + if (parentObject != null) + parentObject.ApplyCustomUpdateState -= updateStateTransforms; } } } From fa5f7c1a00e084eb4498c99228408f17f6172de4 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 2 Jul 2022 13:03:01 +0800 Subject: [PATCH 2033/2328] Remove the nullable disable annotation in the Replays namespace. --- osu.Game/Replays/Legacy/LegacyReplayFrame.cs | 2 -- osu.Game/Replays/Legacy/ReplayButtonState.cs | 2 -- osu.Game/Replays/Replay.cs | 2 -- 3 files changed, 6 deletions(-) diff --git a/osu.Game/Replays/Legacy/LegacyReplayFrame.cs b/osu.Game/Replays/Legacy/LegacyReplayFrame.cs index d0574d65ab..f6abf259e8 100644 --- a/osu.Game/Replays/Legacy/LegacyReplayFrame.cs +++ b/osu.Game/Replays/Legacy/LegacyReplayFrame.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using MessagePack; using Newtonsoft.Json; using osu.Framework.Extensions.EnumExtensions; diff --git a/osu.Game/Replays/Legacy/ReplayButtonState.cs b/osu.Game/Replays/Legacy/ReplayButtonState.cs index 7788918ba9..4b02cf2cd5 100644 --- a/osu.Game/Replays/Legacy/ReplayButtonState.cs +++ b/osu.Game/Replays/Legacy/ReplayButtonState.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; namespace osu.Game.Replays.Legacy diff --git a/osu.Game/Replays/Replay.cs b/osu.Game/Replays/Replay.cs index 4903f8c47f..30e176b5c7 100644 --- a/osu.Game/Replays/Replay.cs +++ b/osu.Game/Replays/Replay.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using System.Linq; using osu.Game.Rulesets.Replays; From ea573f314e9db529e163aef109f5f3b3c163df6f Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 2 Jul 2022 13:08:25 +0800 Subject: [PATCH 2034/2328] Remove the nullable disable annotation in the Rulesets.Replays namespace in the osu.game project. --- osu.Game/Rulesets/Replays/AutoGenerator.cs | 8 ++------ .../Rulesets/Replays/Types/IConvertibleReplayFrame.cs | 4 +--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/osu.Game/Rulesets/Replays/AutoGenerator.cs b/osu.Game/Rulesets/Replays/AutoGenerator.cs index 7fab84eba8..f4b96b3884 100644 --- a/osu.Game/Rulesets/Replays/AutoGenerator.cs +++ b/osu.Game/Rulesets/Replays/AutoGenerator.cs @@ -1,11 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using System.Linq; -using JetBrains.Annotations; using osu.Game.Beatmaps; using osu.Game.Replays; using osu.Game.Rulesets.Objects; @@ -34,7 +31,7 @@ namespace osu.Game.Rulesets.Replays /// public abstract Replay Generate(); - protected virtual HitObject GetNextObject(int currentIndex) + protected virtual HitObject? GetNextObject(int currentIndex) { if (currentIndex >= Beatmap.HitObjects.Count - 1) return null; @@ -51,8 +48,7 @@ namespace osu.Game.Rulesets.Replays /// protected readonly List Frames = new List(); - [CanBeNull] - protected TFrame LastFrame => Frames.Count == 0 ? null : Frames[^1]; + protected TFrame? LastFrame => Frames.Count == 0 ? null : Frames[^1]; protected AutoGenerator(IBeatmap beatmap) : base(beatmap) diff --git a/osu.Game/Rulesets/Replays/Types/IConvertibleReplayFrame.cs b/osu.Game/Rulesets/Replays/Types/IConvertibleReplayFrame.cs index 6753a23bca..9a4af9e4ee 100644 --- a/osu.Game/Rulesets/Replays/Types/IConvertibleReplayFrame.cs +++ b/osu.Game/Rulesets/Replays/Types/IConvertibleReplayFrame.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Game.Beatmaps; using osu.Game.Replays.Legacy; @@ -19,7 +17,7 @@ namespace osu.Game.Rulesets.Replays.Types /// The to extract values from. /// The beatmap. /// The last post-conversion , used to fill in missing delta information. May be null. - void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame lastFrame = null); + void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame? lastFrame = null); /// /// Populates this using values from a . From c6d0f0f81b11389c817306e534bbcc9b1629bc02 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 2 Jul 2022 13:20:46 +0800 Subject: [PATCH 2035/2328] pretend that the beatmap property will not be null. Not really throw exception will be the better way? --- osu.Game/Online/Spectator/SpectatorClient.cs | 2 +- osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/Spectator/SpectatorClient.cs b/osu.Game/Online/Spectator/SpectatorClient.cs index 08e1e78d86..46e58217c5 100644 --- a/osu.Game/Online/Spectator/SpectatorClient.cs +++ b/osu.Game/Online/Spectator/SpectatorClient.cs @@ -188,7 +188,7 @@ namespace osu.Game.Online.Spectator } if (frame is IConvertibleReplayFrame convertible) - pendingFrames.Enqueue(convertible.ToLegacy(currentBeatmap)); + pendingFrames.Enqueue(convertible.ToLegacy(currentBeatmap!)); if (pendingFrames.Count > max_pending_frames) purgePendingFrames(); diff --git a/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs b/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs index 85cf463a13..4b1931e7d1 100644 --- a/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs +++ b/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs @@ -143,7 +143,7 @@ namespace osu.Game.Scoring.Legacy return legacyFrame; case IConvertibleReplayFrame convertibleFrame: - return convertibleFrame.ToLegacy(beatmap); + return convertibleFrame.ToLegacy(beatmap!); default: throw new ArgumentException(@"Frame could not be converted to legacy frames", nameof(replayFrame)); From 19721a9bbbff59ca99f19989404885ed0e50d322 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 2 Jul 2022 13:33:05 +0800 Subject: [PATCH 2036/2328] Remove the nullable disable annotation and fix the breaking api. --- osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs | 2 -- .../Replays/CatchFramedReplayInputHandler.cs | 2 -- osu.Game.Rulesets.Catch/Replays/CatchReplayFrame.cs | 6 ++---- osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs | 6 ++---- .../Replays/ManiaFramedReplayInputHandler.cs | 2 -- osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs | 4 +--- osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs | 6 ++---- osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs | 2 -- .../Replays/OsuFramedReplayInputHandler.cs | 2 -- osu.Game.Rulesets.Osu/Replays/OsuReplayFrame.cs | 4 +--- osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs | 2 -- .../Replays/TaikoFramedReplayInputHandler.cs | 2 -- osu.Game.Rulesets.Taiko/Replays/TaikoReplayFrame.cs | 4 +--- 13 files changed, 9 insertions(+), 35 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs index 86c249a7c1..7c84cb24f3 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Linq; using osu.Framework.Utils; diff --git a/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs b/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs index 64a573149f..b6af88a771 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using System.Linq; using osu.Framework.Input.StateChanges; diff --git a/osu.Game.Rulesets.Catch/Replays/CatchReplayFrame.cs b/osu.Game.Rulesets.Catch/Replays/CatchReplayFrame.cs index 5cf03e4706..e30e535e9b 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchReplayFrame.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchReplayFrame.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Replays.Legacy; @@ -22,7 +20,7 @@ namespace osu.Game.Rulesets.Catch.Replays { } - public CatchReplayFrame(double time, float? position = null, bool dashing = false, CatchReplayFrame lastFrame = null) + public CatchReplayFrame(double time, float? position = null, bool dashing = false, CatchReplayFrame? lastFrame = null) : base(time) { Position = position ?? -1; @@ -40,7 +38,7 @@ namespace osu.Game.Rulesets.Catch.Replays } } - public void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame lastFrame = null) + public void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame? lastFrame = null) { Position = currentFrame.Position.X; Dashing = currentFrame.ButtonState == ReplayButtonState.Left1; diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs index 26572de412..ba4dfc7ab0 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using System.Linq; using osu.Game.Rulesets.Mania.Beatmaps; @@ -85,7 +83,7 @@ namespace osu.Game.Rulesets.Mania.Replays } } - private double calculateReleaseTime(HitObject currentObject, HitObject nextObject) + private double calculateReleaseTime(HitObject currentObject, HitObject? nextObject) { double endTime = currentObject.GetEndTime(); @@ -99,7 +97,7 @@ namespace osu.Game.Rulesets.Mania.Replays return endTime + (canDelayKeyUpFully ? RELEASE_DELAY : (nextObject.StartTime - endTime) * 0.9); } - protected override HitObject GetNextObject(int currentIndex) + protected override HitObject? GetNextObject(int currentIndex) { int desiredColumn = Beatmap.HitObjects[currentIndex].Column; diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs b/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs index c786e1db61..aa164f95da 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using System.Linq; using osu.Framework.Input.StateChanges; diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs index 66edc87992..29249ba474 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; using osu.Game.Beatmaps; @@ -27,7 +25,7 @@ namespace osu.Game.Rulesets.Mania.Replays Actions.AddRange(actions); } - public void FromLegacy(LegacyReplayFrame legacyFrame, IBeatmap beatmap, ReplayFrame lastFrame = null) + public void FromLegacy(LegacyReplayFrame legacyFrame, IBeatmap beatmap, ReplayFrame? lastFrame = null) { var maniaBeatmap = (ManiaBeatmap)beatmap; diff --git a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs index b0155c02cf..5a3d882ef0 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osuTK; using osu.Framework.Utils; using osu.Game.Beatmaps; @@ -95,7 +93,7 @@ namespace osu.Game.Rulesets.Osu.Replays { double endTime = prev.GetEndTime(); - HitWindows hitWindows = null; + HitWindows? hitWindows = null; switch (h) { @@ -245,7 +243,7 @@ namespace osu.Game.Rulesets.Osu.Replays } double timeDifference = ApplyModsToTimeDelta(lastFrame.Time, h.StartTime); - OsuReplayFrame lastLastFrame = Frames.Count >= 2 ? (OsuReplayFrame)Frames[^2] : null; + OsuReplayFrame? lastLastFrame = Frames.Count >= 2 ? (OsuReplayFrame)Frames[^2] : null; if (timeDifference > 0) { diff --git a/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs b/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs index b41d123380..1cb3208c30 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osuTK; using osu.Game.Beatmaps; using System; diff --git a/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs b/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs index 8857bfa32d..ea36ecc399 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using System.Linq; using osu.Framework.Input.StateChanges; diff --git a/osu.Game.Rulesets.Osu/Replays/OsuReplayFrame.cs b/osu.Game.Rulesets.Osu/Replays/OsuReplayFrame.cs index 019d8035ed..85060261fe 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuReplayFrame.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuReplayFrame.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Replays.Legacy; @@ -28,7 +26,7 @@ namespace osu.Game.Rulesets.Osu.Replays Actions.AddRange(actions); } - public void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame lastFrame = null) + public void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame? lastFrame = null) { Position = currentFrame.Position; if (currentFrame.MouseLeft) Actions.Add(OsuAction.LeftButton); diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs index f7f72df023..5fd281f9fa 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Linq; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs index 0090409443..2f9b6c7f60 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Game.Rulesets.Replays; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoReplayFrame.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoReplayFrame.cs index d8f88785db..a0a687dca6 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoReplayFrame.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoReplayFrame.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Replays.Legacy; @@ -25,7 +23,7 @@ namespace osu.Game.Rulesets.Taiko.Replays Actions.AddRange(actions); } - public void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame lastFrame = null) + public void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame? lastFrame = null) { if (currentFrame.MouseRight1) Actions.Add(TaikoAction.LeftRim); if (currentFrame.MouseRight2) Actions.Add(TaikoAction.RightRim); From 59c83a34235c8fd37a6c8a1fca14b0bbe9f4b2a1 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 2 Jul 2022 13:33:51 +0800 Subject: [PATCH 2037/2328] Mark as non-null because next object in here will always has value. --- osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs | 2 +- osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs index ba4dfc7ab0..77ca7ab6b8 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs @@ -94,7 +94,7 @@ namespace osu.Game.Rulesets.Mania.Replays bool canDelayKeyUpFully = nextObject == null || nextObject.StartTime > endTime + RELEASE_DELAY; - return endTime + (canDelayKeyUpFully ? RELEASE_DELAY : (nextObject.StartTime - endTime) * 0.9); + return endTime + (canDelayKeyUpFully ? RELEASE_DELAY : (nextObject!.StartTime - endTime) * 0.9); } protected override HitObject? GetNextObject(int currentIndex) diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs index 5fd281f9fa..44c68e6af1 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs @@ -117,7 +117,7 @@ namespace osu.Game.Rulesets.Taiko.Replays var nextHitObject = GetNextObject(i); // Get the next object that requires pressing the same button bool canDelayKeyUp = nextHitObject == null || nextHitObject.StartTime > endTime + KEY_UP_DELAY; - double calculatedDelay = canDelayKeyUp ? KEY_UP_DELAY : (nextHitObject.StartTime - endTime) * 0.9; + double calculatedDelay = canDelayKeyUp ? KEY_UP_DELAY : (nextHitObject!.StartTime - endTime) * 0.9; Frames.Add(new TaikoReplayFrame(endTime + calculatedDelay)); hitButton = !hitButton; From 19d300e311438668fea18237a99bf9134a86f4a5 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 2 Jul 2022 09:17:38 +0300 Subject: [PATCH 2038/2328] Fix player loader not accepting star difficulty updates after display --- .../Screens/Play/BeatmapMetadataDisplay.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs index dca9401872..0e56cafaaa 100644 --- a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs +++ b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs @@ -197,21 +197,19 @@ namespace osu.Game.Screens.Play starRatingDisplay.Show(); } else - { starRatingDisplay.Hide(); - starDifficulty.ValueChanged += d => - { - Debug.Assert(d.NewValue != null); + starDifficulty.ValueChanged += d => + { + Debug.Assert(d.NewValue != null); - starRatingDisplay.Current.Value = d.NewValue.Value; + starRatingDisplay.Current.Value = d.NewValue.Value; - versionFlow.AutoSizeDuration = 300; - versionFlow.AutoSizeEasing = Easing.OutQuint; + versionFlow.AutoSizeDuration = 300; + versionFlow.AutoSizeEasing = Easing.OutQuint; - starRatingDisplay.FadeIn(300, Easing.InQuint); - }; - } + starRatingDisplay.FadeIn(300, Easing.InQuint); + }; } private class MetadataLineLabel : OsuSpriteText From 93809a92d4d9fdf2e355fc81e03c65c783c2958b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Jul 2022 16:30:04 +0900 Subject: [PATCH 2039/2328] Fix clashing error messaging during realm block operations --- osu.Game/Database/RealmAccess.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 9c7ecd8a03..cfb0280d2d 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -860,7 +860,7 @@ namespace osu.Game.Database timeout -= sleep_length; if (timeout < 0) - throw new TimeoutException(@"Took too long to acquire lock"); + throw new TimeoutException($@"Realm compact failed after {timeout / sleep_length} attempts over {timeout / 1000} seconds"); } } catch (RealmException e) From e28ee8bc7a7bc6ce7628cc1ee9e50a1c8e783719 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 2 Jul 2022 10:46:52 +0300 Subject: [PATCH 2040/2328] Count time spent upwards to display attempts correctly --- osu.Game/Database/RealmAccess.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index cfb0280d2d..ed56049064 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -849,7 +849,7 @@ namespace osu.Game.Database Logger.Log(@"Lock acquired for blocking operations", LoggingTarget.Database); const int sleep_length = 200; - int timeout = 5000; + int timeSpent = 0; try { @@ -857,10 +857,10 @@ namespace osu.Game.Database while (!Compact()) { Thread.Sleep(sleep_length); - timeout -= sleep_length; + timeSpent += sleep_length; - if (timeout < 0) - throw new TimeoutException($@"Realm compact failed after {timeout / sleep_length} attempts over {timeout / 1000} seconds"); + if (timeSpent > 5000) + throw new TimeoutException($@"Realm compact failed after {timeSpent / sleep_length} attempts over {timeSpent / 1000} seconds"); } } catch (RealmException e) From 24cd845d1b9f69b24a23f4bcc53cb4d4b4c83933 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Jul 2022 17:18:50 +0900 Subject: [PATCH 2041/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 86f4337521..ceea60a1c1 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 40c22c1b21..560f7409ff 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 09ae70a01f..0133c6334c 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From b626135940eb728c64acc49dd0facc98f7e8b10b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Jun 2022 04:39:59 +0900 Subject: [PATCH 2042/2328] Fix dragging slider bars on nub not performing correctly relative movement --- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 3356153e17..7cd89e5b87 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -165,6 +165,9 @@ namespace osu.Game.Graphics.UserInterface base.OnHoverLost(e); } + protected override bool ShouldHandleAsRelativeDrag(MouseDownEvent e) + => Nub.ReceivePositionalInputAt(e.ScreenSpaceMouseDownPosition); + protected override void OnDragEnd(DragEndEvent e) { updateGlow(); From 0a1543c6e8b143c7f3db436c0a0517c93331668d Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 2 Jul 2022 19:48:32 +0800 Subject: [PATCH 2043/2328] Use `AsNonNull()` instead. --- osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs | 3 ++- osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs | 3 ++- osu.Game/Online/Spectator/SpectatorClient.cs | 3 ++- osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs index 77ca7ab6b8..7c8afdff12 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; +using osu.Framework.Extensions.ObjectExtensions; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Objects; @@ -94,7 +95,7 @@ namespace osu.Game.Rulesets.Mania.Replays bool canDelayKeyUpFully = nextObject == null || nextObject.StartTime > endTime + RELEASE_DELAY; - return endTime + (canDelayKeyUpFully ? RELEASE_DELAY : (nextObject!.StartTime - endTime) * 0.9); + return endTime + (canDelayKeyUpFully ? RELEASE_DELAY : (nextObject.AsNonNull().StartTime - endTime) * 0.9); } protected override HitObject? GetNextObject(int currentIndex) diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs index 44c68e6af1..11136ad695 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs @@ -3,6 +3,7 @@ using System; using System.Linq; +using osu.Framework.Extensions.ObjectExtensions; using osu.Game.Beatmaps; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Replays; @@ -117,7 +118,7 @@ namespace osu.Game.Rulesets.Taiko.Replays var nextHitObject = GetNextObject(i); // Get the next object that requires pressing the same button bool canDelayKeyUp = nextHitObject == null || nextHitObject.StartTime > endTime + KEY_UP_DELAY; - double calculatedDelay = canDelayKeyUp ? KEY_UP_DELAY : (nextHitObject!.StartTime - endTime) * 0.9; + double calculatedDelay = canDelayKeyUp ? KEY_UP_DELAY : (nextHitObject.AsNonNull().StartTime - endTime) * 0.9; Frames.Add(new TaikoReplayFrame(endTime + calculatedDelay)); hitButton = !hitButton; diff --git a/osu.Game/Online/Spectator/SpectatorClient.cs b/osu.Game/Online/Spectator/SpectatorClient.cs index 46e58217c5..28aa81c9ee 100644 --- a/osu.Game/Online/Spectator/SpectatorClient.cs +++ b/osu.Game/Online/Spectator/SpectatorClient.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Development; +using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; using osu.Framework.Logging; using osu.Game.Beatmaps; @@ -188,7 +189,7 @@ namespace osu.Game.Online.Spectator } if (frame is IConvertibleReplayFrame convertible) - pendingFrames.Enqueue(convertible.ToLegacy(currentBeatmap!)); + pendingFrames.Enqueue(convertible.ToLegacy(currentBeatmap.AsNonNull())); if (pendingFrames.Count > max_pending_frames) purgePendingFrames(); diff --git a/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs b/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs index 4b1931e7d1..44ffe6b6ad 100644 --- a/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs +++ b/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs @@ -6,6 +6,7 @@ using System.IO; using System.Linq; using System.Text; using osu.Framework.Extensions; +using osu.Framework.Extensions.ObjectExtensions; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Formats; using osu.Game.Extensions; @@ -143,7 +144,7 @@ namespace osu.Game.Scoring.Legacy return legacyFrame; case IConvertibleReplayFrame convertibleFrame: - return convertibleFrame.ToLegacy(beatmap!); + return convertibleFrame.ToLegacy(beatmap.AsNonNull()); default: throw new ArgumentException(@"Frame could not be converted to legacy frames", nameof(replayFrame)); From 7d8ea5e286fca76aba8b7d8202cee750d8bb1404 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 3 Jul 2022 02:59:10 +0900 Subject: [PATCH 2044/2328] Remove unnecessary proxying --- .../Select/DifficultyRangeFilterControl.cs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs b/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs index 7115c59ebf..ac30cc5491 100644 --- a/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs +++ b/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs @@ -23,37 +23,32 @@ namespace osu.Game.Screens.Select private Bindable lowerStars; private Bindable upperStars; - private StarsSlider lowerSlider; - private MaximumStarsSlider upperSlider; - [BackgroundDependencyLoader] private void load(OsuConfigManager config) { const float vertical_offset = 13; - InternalChildren = new[] + InternalChildren = new Drawable[] { new OsuSpriteText { Text = "Difficulty range", Font = OsuFont.GetFont(size: 14), }, - upperSlider = new MaximumStarsSlider + new MaximumStarsSlider { Current = config.GetBindable(OsuSetting.DisplayStarsMaximum), KeyboardStep = 0.1f, RelativeSizeAxes = Axes.X, Y = vertical_offset, }, - lowerSlider = new MinimumStarsSlider + new MinimumStarsSlider { Current = config.GetBindable(OsuSetting.DisplayStarsMinimum), KeyboardStep = 0.1f, RelativeSizeAxes = Axes.X, Y = vertical_offset, - }, - upperSlider.Nub.CreateProxy(), - lowerSlider.Nub.CreateProxy(), + } }; lowerStars = config.GetBindable(OsuSetting.DisplayStarsMinimum); @@ -107,8 +102,6 @@ namespace osu.Game.Screens.Select ? UserInterfaceStrings.NoLimit : Current.Value.ToString(@"0.## stars"); - public new Nub Nub => base.Nub; - protected override void LoadComplete() { base.LoadComplete(); From 052a786eff3233fc8fb04750099705da9033007e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 3 Jul 2022 03:06:03 +0900 Subject: [PATCH 2045/2328] Only show hover effect on one nub at a time --- osu.Game/Screens/Select/DifficultyRangeFilterControl.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs b/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs index ac30cc5491..2884211df3 100644 --- a/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs +++ b/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs @@ -7,6 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Configuration; using osu.Game.Graphics; @@ -102,6 +103,12 @@ namespace osu.Game.Screens.Select ? UserInterfaceStrings.NoLimit : Current.Value.ToString(@"0.## stars"); + protected override bool OnHover(HoverEvent e) + { + base.OnHover(e); + return true; // Make sure only one nub shows hover effect at once. + } + protected override void LoadComplete() { base.LoadComplete(); From 8c2f4b48fc4420e5d0992d0e1a4383dedc711bbd Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 3 Jul 2022 19:27:56 +0800 Subject: [PATCH 2046/2328] Use debug.assert for better readable. --- osu.Game/Online/Spectator/SpectatorClient.cs | 6 ++++-- osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Online/Spectator/SpectatorClient.cs b/osu.Game/Online/Spectator/SpectatorClient.cs index 28aa81c9ee..68c8b57019 100644 --- a/osu.Game/Online/Spectator/SpectatorClient.cs +++ b/osu.Game/Online/Spectator/SpectatorClient.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Development; -using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; using osu.Framework.Logging; using osu.Game.Beatmaps; @@ -189,7 +188,10 @@ namespace osu.Game.Online.Spectator } if (frame is IConvertibleReplayFrame convertible) - pendingFrames.Enqueue(convertible.ToLegacy(currentBeatmap.AsNonNull())); + { + Debug.Assert(currentBeatmap != null); + pendingFrames.Enqueue(convertible.ToLegacy(currentBeatmap)); + } if (pendingFrames.Count > max_pending_frames) purgePendingFrames(); diff --git a/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs b/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs index 44ffe6b6ad..750bb50be3 100644 --- a/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs +++ b/osu.Game/Scoring/Legacy/LegacyScoreEncoder.cs @@ -2,11 +2,11 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using osu.Framework.Extensions; -using osu.Framework.Extensions.ObjectExtensions; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Formats; using osu.Game.Extensions; @@ -144,7 +144,8 @@ namespace osu.Game.Scoring.Legacy return legacyFrame; case IConvertibleReplayFrame convertibleFrame: - return convertibleFrame.ToLegacy(beatmap.AsNonNull()); + Debug.Assert(beatmap != null); + return convertibleFrame.ToLegacy(beatmap); default: throw new ArgumentException(@"Frame could not be converted to legacy frames", nameof(replayFrame)); From 724fd19038851078034c5253d64b669fa2d10eee Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sun, 3 Jul 2022 21:15:13 +0900 Subject: [PATCH 2047/2328] Remove nullable disables --- .../SongSelect/TestSceneDifficultyRangeFilterControl.cs | 1 - osu.Game/Screens/Select/DifficultyRangeFilterControl.cs | 9 ++++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneDifficultyRangeFilterControl.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneDifficultyRangeFilterControl.cs index ffad15287b..7ae2c6e5e2 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneDifficultyRangeFilterControl.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneDifficultyRangeFilterControl.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Screens.Select; diff --git a/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs b/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs index 2884211df3..a82c969805 100644 --- a/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs +++ b/osu.Game/Screens/Select/DifficultyRangeFilterControl.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable using System; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -21,8 +20,8 @@ namespace osu.Game.Screens.Select { internal class DifficultyRangeFilterControl : CompositeDrawable { - private Bindable lowerStars; - private Bindable upperStars; + private Bindable lowerStars = null!; + private Bindable upperStars = null!; [BackgroundDependencyLoader] private void load(OsuConfigManager config) @@ -97,8 +96,6 @@ namespace osu.Game.Screens.Select private class StarsSlider : OsuSliderBar { - private OsuSpriteText currentDisplay; - public override LocalisableString TooltipText => Current.IsDefault ? UserInterfaceStrings.NoLimit : Current.Value.ToString(@"0.## stars"); @@ -115,6 +112,8 @@ namespace osu.Game.Screens.Select Nub.Width = Nub.HEIGHT; RangePadding = Nub.Width / 2; + OsuSpriteText currentDisplay; + Nub.Add(currentDisplay = new OsuSpriteText { Anchor = Anchor.Centre, From 59e3d4b9e571cf46abd21e520ba316d4c3bff056 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 3 Jul 2022 21:00:54 +0800 Subject: [PATCH 2048/2328] Remove the nullable disable annotation in the Ruleset.Filter namespace. --- osu.Game/Rulesets/Filter/IRulesetFilterCriteria.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Rulesets/Filter/IRulesetFilterCriteria.cs b/osu.Game/Rulesets/Filter/IRulesetFilterCriteria.cs index fa44f81df3..dd2ad2cbfa 100644 --- a/osu.Game/Rulesets/Filter/IRulesetFilterCriteria.cs +++ b/osu.Game/Rulesets/Filter/IRulesetFilterCriteria.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Game.Beatmaps; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Filter; From a7bcc32cc21151ff4817e260b73c8f1d1a75b185 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 3 Jul 2022 21:04:39 +0800 Subject: [PATCH 2049/2328] Remove the nullable disable annotation in the mania ruleset. --- osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs b/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs index 58aef4dbf8..c8832dfdfb 100644 --- a/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs +++ b/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Game.Beatmaps; using osu.Game.Rulesets.Filter; using osu.Game.Rulesets.Mania.Beatmaps; From 14ef7712903145d55ec0c6f0ca01f1bc980c2fd2 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 3 Jul 2022 21:05:14 +0800 Subject: [PATCH 2050/2328] Remove the nullable disable annotation in the test case. --- osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs | 2 -- osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs b/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs index 2657468b03..33204d33a7 100644 --- a/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs +++ b/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets; diff --git a/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs b/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs index 500f3159e2..bd0617515b 100644 --- a/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs +++ b/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using NUnit.Framework; using osu.Game.Beatmaps; @@ -256,7 +254,7 @@ namespace osu.Game.Tests.NonVisual.Filtering private class CustomFilterCriteria : IRulesetFilterCriteria { - public string CustomValue { get; set; } + public string? CustomValue { get; set; } public bool Matches(BeatmapInfo beatmapInfo) => true; From e4bf2224c6d1493d54154b72ece66215be5892b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 3 Jul 2022 23:16:51 +0900 Subject: [PATCH 2051/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index ceea60a1c1..550088cbfa 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 560f7409ff..d428139343 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 0133c6334c..e3e8aecbbe 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From df152421a8e5b75ab2af2d522343828bce780328 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Sun, 3 Jul 2022 10:23:17 -0700 Subject: [PATCH 2052/2328] Fix personal best score showing delete option on context menu --- osu.Game/Online/Leaderboards/LeaderboardScore.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index e32bc63aa1..62827f50aa 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -426,10 +426,10 @@ namespace osu.Game.Online.Leaderboards items.Add(new OsuMenuItem("Use these mods", MenuItemType.Highlighted, () => songSelect.Mods.Value = Score.Mods)); if (Score.Files.Count > 0) + { items.Add(new OsuMenuItem("Export", MenuItemType.Standard, () => new LegacyScoreExporter(storage).Export(Score))); - - if (!isOnlineScope) items.Add(new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, () => dialogOverlay?.Push(new LocalScoreDeleteDialog(Score)))); + } return items.ToArray(); } From e6a05ce3e2d8312581dd660ec9518bebee4b230f Mon Sep 17 00:00:00 2001 From: goodtrailer Date: Sun, 3 Jul 2022 13:51:30 -0700 Subject: [PATCH 2053/2328] Slow down legacy followcircle animations --- .../Objects/Drawables/DrawableSlider.cs | 4 -- .../Objects/Drawables/DrawableSliderBall.cs | 11 ++-- .../Skinning/Default/DefaultFollowCircle.cs | 50 ++++++++++++++ .../Skinning/Default/DefaultSliderBall.cs | 63 ++++++++++++++++-- .../Skinning/Legacy/LegacyFollowCircle.cs | 65 +++++++++++++++++++ 5 files changed, 175 insertions(+), 18 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 91bb7f95f6..d83f5df7a3 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -319,13 +319,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables const float fade_out_time = 450; - // intentionally pile on an extra FadeOut to make it happen much faster. - Ball.FadeOut(fade_out_time / 4, Easing.Out); - switch (state) { case ArmedState.Hit: - Ball.ScaleTo(HitObject.Scale * 1.4f, fade_out_time, Easing.Out); if (SliderBody?.SnakingOut.Value == true) Body.FadeOut(40); // short fade to allow for any body colour to smoothly disappear. break; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderBall.cs index 7bde60b39d..6bfb4e8aae 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderBall.cs @@ -23,6 +23,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSliderBall : CircularContainer, ISliderProgress, IRequireHighFrequencyMousePosition, IHasAccentColour { + public const float FOLLOW_AREA = 2.4f; + public Func GetInitialHitAction; public Color4 AccentColour @@ -31,7 +33,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables set => ball.Colour = value; } - private Drawable followCircle; private Drawable followCircleReceptor; private DrawableSlider drawableSlider; private Drawable ball; @@ -47,12 +48,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Children = new[] { - followCircle = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SliderFollowCircle), _ => new DefaultFollowCircle()) + new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SliderFollowCircle), _ => new DefaultFollowCircle()) { Origin = Anchor.Centre, Anchor = Anchor.Centre, RelativeSizeAxes = Axes.Both, - Alpha = 0, }, followCircleReceptor = new CircularContainer { @@ -103,10 +103,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables tracking = value; - followCircleReceptor.Scale = new Vector2(tracking ? 2.4f : 1f); - - followCircle.ScaleTo(tracking ? 2.4f : 1f, 300, Easing.OutQuint); - followCircle.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint); + followCircleReceptor.Scale = new Vector2(tracking ? FOLLOW_AREA : 1f); } } diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs index 8211448705..c39a07da4e 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs @@ -1,17 +1,25 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables; using osuTK.Graphics; namespace osu.Game.Rulesets.Osu.Skinning.Default { public class DefaultFollowCircle : CompositeDrawable { + [Resolved(canBeNull: true)] + private DrawableHitObject? parentObject { get; set; } + public DefaultFollowCircle() { + Alpha = 0f; RelativeSizeAxes = Axes.Both; InternalChild = new CircularContainer @@ -29,5 +37,47 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default } }; } + + [BackgroundDependencyLoader] + private void load() + { + if (parentObject != null) + { + var slider = (DrawableSlider)parentObject; + slider.Tracking.BindValueChanged(trackingChanged, true); + } + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + if (parentObject != null) + { + parentObject.ApplyCustomUpdateState += updateStateTransforms; + updateStateTransforms(parentObject, parentObject.State.Value); + } + } + + private void trackingChanged(ValueChangedEvent tracking) + { + const float scale_duration = 300f; + const float fade_duration = 300f; + + this.ScaleTo(tracking.NewValue ? DrawableSliderBall.FOLLOW_AREA : 1f, scale_duration, Easing.OutQuint) + .FadeTo(tracking.NewValue ? 1f : 0, fade_duration, Easing.OutQuint); + } + + private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state) + { + if (drawableObject is not DrawableSlider) + return; + + const float fade_time = 450f; + + using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime)) + // intentionally pile on an extra FadeOut to make it happen much faster. + this.FadeOut(fade_time / 4, Easing.Out); + } } } diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs index 47308375e6..3c7dd7ba5d 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -19,13 +17,14 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default { public class DefaultSliderBall : CompositeDrawable { - private Box box; + private Box box = null!; + + [Resolved(canBeNull: true)] + private DrawableHitObject? parentObject { get; set; } [BackgroundDependencyLoader] - private void load(DrawableHitObject drawableObject, ISkinSource skin) + private void load(ISkinSource skin) { - var slider = (DrawableSlider)drawableObject; - RelativeSizeAxes = Axes.Both; float radius = skin.GetConfig(OsuSkinConfiguration.SliderPathRadius)?.Value ?? OsuHitObject.OBJECT_RADIUS; @@ -51,10 +50,60 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default } }; - slider.Tracking.BindValueChanged(trackingChanged, true); + if (parentObject != null) + { + var slider = (DrawableSlider)parentObject; + slider.Tracking.BindValueChanged(trackingChanged, true); + } + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + if (parentObject != null) + { + parentObject.ApplyCustomUpdateState += updateStateTransforms; + updateStateTransforms(parentObject, parentObject.State.Value); + } } private void trackingChanged(ValueChangedEvent tracking) => box.FadeTo(tracking.NewValue ? 0.3f : 0.05f, 200, Easing.OutQuint); + + private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state) + { + if (drawableObject is not DrawableSlider) + return; + + const float fade_out_time = 450f; + + using (BeginAbsoluteSequence(drawableObject.StateUpdateTime)) + { + this.ScaleTo(1f) + .FadeIn(); + } + + using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime)) + { + // intentionally pile on an extra FadeOut to make it happen much faster + this.FadeOut(fade_out_time / 4, Easing.Out); + + switch (state) + { + case ArmedState.Hit: + this.ScaleTo(1.4f, fade_out_time, Easing.Out); + break; + } + } + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + if (parentObject != null) + parentObject.ApplyCustomUpdateState -= updateStateTransforms; + } } } diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs index b8a559ce07..df33180c7b 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs @@ -1,13 +1,21 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Diagnostics; +using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables; namespace osu.Game.Rulesets.Osu.Skinning.Legacy { public class LegacyFollowCircle : CompositeDrawable { + [Resolved(canBeNull: true)] + private DrawableHitObject? parentObject { get; set; } + public LegacyFollowCircle(Drawable animationContent) { // follow circles are 2x the hitcircle resolution in legacy skins (since they are scaled down from >1x @@ -15,8 +23,65 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy animationContent.Anchor = Anchor.Centre; animationContent.Origin = Anchor.Centre; + Alpha = 0f; RelativeSizeAxes = Axes.Both; InternalChild = animationContent; } + + [BackgroundDependencyLoader] + private void load() + { + if (parentObject != null) + { + var slider = (DrawableSlider)parentObject; + slider.Tracking.BindValueChanged(trackingChanged, true); + } + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + if (parentObject != null) + { + parentObject.ApplyCustomUpdateState += updateStateTransforms; + updateStateTransforms(parentObject, parentObject.State.Value); + } + } + + private void trackingChanged(ValueChangedEvent tracking) + { + Debug.Assert(parentObject != null); + + if (parentObject.Judged) + return; + + const float scale_duration = 180f; + const float fade_duration = 90f; + + double maxScaleDuration = parentObject.HitStateUpdateTime - Time.Current; + double realScaleDuration = scale_duration; + if (tracking.NewValue && maxScaleDuration < realScaleDuration) + realScaleDuration = maxScaleDuration; + double realFadeDuration = fade_duration * realScaleDuration / fade_duration; + + this.ScaleTo(tracking.NewValue ? DrawableSliderBall.FOLLOW_AREA : 1f, realScaleDuration, Easing.OutQuad) + .FadeTo(tracking.NewValue ? 1f : 0f, realFadeDuration, Easing.OutQuad); + } + + private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state) + { + if (drawableObject is not DrawableSlider) + return; + + const float shrink_duration = 200f; + const float fade_duration = 240f; + + using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime)) + { + this.ScaleTo(DrawableSliderBall.FOLLOW_AREA * 0.8f, shrink_duration, Easing.OutQuint) + .FadeOut(fade_duration, Easing.InQuint); + } + } } } From 925d7b1fdc10018436071cdae8b0fc654440d0d4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Jul 2022 15:01:01 +0900 Subject: [PATCH 2054/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 550088cbfa..398c1d91dd 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index d428139343..ed6577651a 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index e3e8aecbbe..7d70b96f62 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 64edc6888d84fc5a6b7e179a8a968c685ef5b19e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Jul 2022 16:45:21 +0900 Subject: [PATCH 2055/2328] Add test coverage of corrupt realm creating backup --- .../Collections/IO/ImportCollectionsTest.cs | 2 +- .../NonVisual/CustomDataDirectoryTest.cs | 22 +++++++++++++++- osu.Game/Tests/CleanRunHeadlessGameHost.cs | 26 ++++++++++++------- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs b/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs index c31aafa67f..9a8f29647d 100644 --- a/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs +++ b/osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs @@ -138,7 +138,7 @@ namespace osu.Game.Tests.Collections.IO { string firstRunName; - using (var host = new CleanRunHeadlessGameHost(bypassCleanup: true)) + using (var host = new CleanRunHeadlessGameHost(bypassCleanupOnDispose: true)) { firstRunName = host.Name; diff --git a/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs b/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs index 216bd0fd3c..216db2121c 100644 --- a/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs +++ b/osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs @@ -315,6 +315,26 @@ namespace osu.Game.Tests.NonVisual } } + [Test] + public void TestBackupCreatedOnCorruptRealm() + { + using (var host = new CustomTestHeadlessGameHost()) + { + try + { + File.WriteAllText(host.InitialStorage.GetFullPath(OsuGameBase.CLIENT_DATABASE_FILENAME, true), "i am definitely not a realm file"); + + LoadOsuIntoHost(host); + + Assert.That(host.InitialStorage.GetFiles(string.Empty, "*_corrupt.realm"), Has.One.Items); + } + finally + { + host.Exit(); + } + } + } + private static string getDefaultLocationFor(CustomTestHeadlessGameHost host) { string path = Path.Combine(TestRunHeadlessGameHost.TemporaryTestDirectory, host.Name); @@ -347,7 +367,7 @@ namespace osu.Game.Tests.NonVisual public Storage InitialStorage { get; } public CustomTestHeadlessGameHost([CallerMemberName] string callingMethodName = @"") - : base(callingMethodName: callingMethodName) + : base(callingMethodName: callingMethodName, bypassCleanupOnSetup: true) { string defaultStorageLocation = getDefaultLocationFor(this); diff --git a/osu.Game/Tests/CleanRunHeadlessGameHost.cs b/osu.Game/Tests/CleanRunHeadlessGameHost.cs index d36168d3dd..02d67de5a5 100644 --- a/osu.Game/Tests/CleanRunHeadlessGameHost.cs +++ b/osu.Game/Tests/CleanRunHeadlessGameHost.cs @@ -15,30 +15,38 @@ namespace osu.Game.Tests /// public class CleanRunHeadlessGameHost : TestRunHeadlessGameHost { + private readonly bool bypassCleanupOnSetup; + /// /// Create a new instance. /// /// Whether to bind IPC channels. /// Whether the host should be forced to run in realtime, rather than accelerated test time. - /// Whether to bypass directory cleanup on host disposal. Should be used only if a subsequent test relies on the files still existing. + /// Whether to bypass directory cleanup on . + /// Whether to bypass directory cleanup on host disposal. Should be used only if a subsequent test relies on the files still existing. /// The name of the calling method, used for test file isolation and clean-up. - public CleanRunHeadlessGameHost(bool bindIPC = false, bool realtime = true, bool bypassCleanup = false, [CallerMemberName] string callingMethodName = @"") + public CleanRunHeadlessGameHost(bool bindIPC = false, bool realtime = true, bool bypassCleanupOnSetup = false, bool bypassCleanupOnDispose = false, + [CallerMemberName] string callingMethodName = @"") : base($"{callingMethodName}-{Guid.NewGuid()}", new HostOptions { BindIPC = bindIPC, - }, bypassCleanup: bypassCleanup, realtime: realtime) + }, bypassCleanup: bypassCleanupOnDispose, realtime: realtime) { + this.bypassCleanupOnSetup = bypassCleanupOnSetup; } protected override void SetupForRun() { - try + if (!bypassCleanupOnSetup) { - Storage.DeleteDirectory(string.Empty); - } - catch - { - // May fail if a logging target has already been set via OsuStorage.ChangeTargetStorage. + try + { + Storage.DeleteDirectory(string.Empty); + } + catch + { + // May fail if a logging target has already been set via OsuStorage.ChangeTargetStorage. + } } // base call needs to be run *after* storage is emptied, as it updates the (static) logger's storage and may start writing From 506409a9c471246dc37fee8ad52fd2634c1d6d19 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Jul 2022 16:27:49 +0900 Subject: [PATCH 2056/2328] Fix realm backup creation failing when run from `RealmAccess` constructor At the point of construction, we are not on the update thread, but it doesn't really matter at this point because there's no other usages. --- osu.Game/Database/EFToRealmMigrator.cs | 5 ++- osu.Game/Database/RealmAccess.cs | 53 +++++++++++++++----------- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/osu.Game/Database/EFToRealmMigrator.cs b/osu.Game/Database/EFToRealmMigrator.cs index 8f2ff600d8..3b5424b3fb 100644 --- a/osu.Game/Database/EFToRealmMigrator.cs +++ b/osu.Game/Database/EFToRealmMigrator.cs @@ -132,11 +132,12 @@ namespace osu.Game.Database { try { - realm.CreateBackup(Path.Combine(backup_folder, $"client.{backupSuffix}.realm"), realmBlockOperations); + realm.CreateBackup(Path.Combine(backup_folder, $"client.{backupSuffix}.realm")); } finally { - // Above call will dispose of the blocking token when done. + // Once the backup is created, we need to stop blocking operations so the migration can complete. + realmBlockOperations.Dispose(); // Clean up here so we don't accidentally dispose twice. realmBlockOperations = null; } diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index ed56049064..00218e4fe3 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -184,14 +184,14 @@ namespace osu.Game.Database // If a newer version database already exists, don't backup again. We can presume that the first backup is the one we care about. if (!storage.Exists(newerVersionFilename)) - CreateBackup(newerVersionFilename); + createBackup(newerVersionFilename); storage.Delete(Filename); } else { Logger.Error(e, "Realm startup failed with unrecoverable error; starting with a fresh database. A backup of your database has been made."); - CreateBackup($"{Filename.Replace(realm_extension, string.Empty)}_{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}_corrupt{realm_extension}"); + createBackup($"{Filename.Replace(realm_extension, string.Empty)}_{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}_corrupt{realm_extension}"); storage.Delete(Filename); } @@ -236,7 +236,7 @@ namespace osu.Game.Database } // For extra safety, also store the temporarily-used database which we are about to replace. - CreateBackup($"{Filename.Replace(realm_extension, string.Empty)}_{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}_newer_version_before_recovery{realm_extension}"); + createBackup($"{Filename.Replace(realm_extension, string.Empty)}_{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}_newer_version_before_recovery{realm_extension}"); storage.Delete(Filename); @@ -778,28 +778,37 @@ namespace osu.Game.Database private string? getRulesetShortNameFromLegacyID(long rulesetId) => efContextFactory?.Get().RulesetInfo.FirstOrDefault(r => r.ID == rulesetId)?.ShortName; - public void CreateBackup(string backupFilename, IDisposable? blockAllOperations = null) + /// + /// Create a full realm backup. + /// + /// The filename for the backup. + public void CreateBackup(string backupFilename) { - using (blockAllOperations ?? BlockAllOperations("creating backup")) + if (realmRetrievalLock.CurrentCount != 0) + throw new InvalidOperationException($"Call {nameof(BlockAllOperations)} before creating a backup."); + + createBackup(backupFilename); + } + + private void createBackup(string backupFilename) + { + Logger.Log($"Creating full realm database backup at {backupFilename}", LoggingTarget.Database); + + int attempts = 10; + + while (attempts-- > 0) { - Logger.Log($"Creating full realm database backup at {backupFilename}", LoggingTarget.Database); - - int attempts = 10; - - while (attempts-- > 0) + try { - try - { - using (var source = storage.GetStream(Filename, mode: FileMode.Open)) - using (var destination = storage.GetStream(backupFilename, FileAccess.Write, FileMode.CreateNew)) - source.CopyTo(destination); - return; - } - catch (IOException) - { - // file may be locked during use. - Thread.Sleep(500); - } + using (var source = storage.GetStream(Filename, mode: FileMode.Open)) + using (var destination = storage.GetStream(backupFilename, FileAccess.Write, FileMode.CreateNew)) + source.CopyTo(destination); + return; + } + catch (IOException) + { + // file may be locked during use. + Thread.Sleep(500); } } } From f1b55d743cdc4e99a5efce22481d87e155e36945 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Mon, 4 Jul 2022 11:04:20 -0700 Subject: [PATCH 2057/2328] Fix delete local score test having no files --- .../Visual/UserInterface/TestSceneDeleteLocalScore.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index 31406af87a..cee917f6cf 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -18,6 +18,7 @@ using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; +using osu.Game.Models; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Leaderboards; using osu.Game.Overlays; @@ -100,6 +101,7 @@ namespace osu.Game.Tests.Visual.UserInterface Rank = ScoreRank.XH, User = new APIUser { Username = "TestUser" }, Ruleset = new OsuRuleset().RulesetInfo, + Files = { new RealmNamedFileUsage(new RealmFile { Hash = $"{i}" }, string.Empty) } }; importedScores.Add(scoreManager.Import(score).Value); From bb0f2124480ef35736b3aef4a5562e7058260991 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Tue, 5 Jul 2022 00:38:18 +0200 Subject: [PATCH 2058/2328] Trigger the initial cookie with midi and joysticks --- osu.Game/Screens/Menu/ButtonSystem.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 74be02728f..fadc80277a 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -205,6 +205,28 @@ namespace osu.Game.Screens.Menu return base.OnKeyDown(e); } + protected override bool OnJoystickPress(JoystickPressEvent e) + { + if (State == ButtonSystemState.Initial) + { + logo?.TriggerClick(); + return true; + } + + return base.OnJoystickPress(e); + } + + protected override bool OnMidiDown(MidiDownEvent e) + { + if (State == ButtonSystemState.Initial) + { + logo?.TriggerClick(); + return true; + } + + return base.OnMidiDown(e); + } + public bool OnPressed(KeyBindingPressEvent e) { if (e.Repeat) From 1b98936328df8261bb5c2b1586d794c41f0edc20 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Jul 2022 14:59:44 +0900 Subject: [PATCH 2059/2328] Rename realm `ThreadLocal` to better convey what it's doing Every time I looked at this code I have to re-learn what it's doing. Changing these variable names should help quite a bit. --- osu.Game/Database/RealmAccess.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 00218e4fe3..7ba599bfed 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -66,7 +66,10 @@ namespace osu.Game.Database /// private readonly SemaphoreSlim realmRetrievalLock = new SemaphoreSlim(1); - private readonly ThreadLocal currentThreadCanCreateRealmInstances = new ThreadLocal(); + /// + /// true when the current thread has already entered the . + /// + private readonly ThreadLocal currentThreadHasRealmRetrievalLock = new ThreadLocal(); /// /// Holds a map of functions registered via and and a coinciding action which when triggered, @@ -584,10 +587,11 @@ namespace osu.Game.Database try { - if (!currentThreadCanCreateRealmInstances.Value) + // Ensure that the thread that currently has the `realmRetrievalLock` can retrieve nested contexts and not deadlock on itself. + if (!currentThreadHasRealmRetrievalLock.Value) { realmRetrievalLock.Wait(); - currentThreadCanCreateRealmInstances.Value = true; + currentThreadHasRealmRetrievalLock.Value = true; tookSemaphoreLock = true; } else @@ -611,7 +615,7 @@ namespace osu.Game.Database if (tookSemaphoreLock) { realmRetrievalLock.Release(); - currentThreadCanCreateRealmInstances.Value = false; + currentThreadHasRealmRetrievalLock.Value = false; } } } From 5adec2c7382245ddd0debadaef706876acaf01a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Jul 2022 00:27:38 +0900 Subject: [PATCH 2060/2328] Ensure blocking restoration only completes after update callback work is completed --- osu.Game/Database/RealmAccess.cs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 7ba599bfed..7dd03d5ce7 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -923,13 +923,34 @@ namespace osu.Game.Database Logger.Log(@"Restoring realm operations.", LoggingTarget.Database); realmRetrievalLock.Release(); + if (syncContext == null) return; + + ManualResetEventSlim updateRealmReestablished = new ManualResetEventSlim(); + // Post back to the update thread to revive any subscriptions. // In the case we are on the update thread, let's also require this to run synchronously. // This requirement is mostly due to test coverage, but shouldn't cause any harm. if (ThreadSafety.IsUpdateThread) - syncContext?.Send(_ => ensureUpdateRealm(), null); + { + syncContext.Send(_ => + { + ensureUpdateRealm(); + updateRealmReestablished.Set(); + }, null); + } else - syncContext?.Post(_ => ensureUpdateRealm(), null); + { + syncContext.Post(_ => + { + ensureUpdateRealm(); + updateRealmReestablished.Set(); + }, null); + } + + // Wait for the post to complete to ensure a second `Migrate` operation doesn't start in the mean time. + // This is important to ensure `ensureUpdateRealm` is run before another blocking migration operation starts. + if (!updateRealmReestablished.Wait(10000)) + throw new TimeoutException(@"Reestablishing update realm after block took too long"); } } From 1e6def8209ddadbebbf9541bc5fb3aeb6683bd29 Mon Sep 17 00:00:00 2001 From: goodtrailer Date: Mon, 4 Jul 2022 22:58:41 -0700 Subject: [PATCH 2061/2328] Fix spinner accent animation on rewind --- .../Skinning/Default/DefaultSpinnerDisc.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinnerDisc.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinnerDisc.cs index ab14f939d4..03db76336c 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinnerDisc.cs @@ -137,6 +137,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default this.ScaleTo(initial_scale); this.RotateTo(0); + updateComplete(false, 0); + using (BeginDelayedSequence(spinner.TimePreempt / 2)) { // constant ambient rotation to give the spinner "spinning" character. @@ -177,9 +179,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default } } - // transforms we have from completing the spinner will be rolled back, so reapply immediately. - using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimePreempt)) - updateComplete(state == ArmedState.Hit, 0); + if (drawableSpinner.Result?.TimeCompleted is double completionTime) + { + using (BeginAbsoluteSequence(completionTime)) + updateComplete(true, 200); + } } private void updateComplete(bool complete, double duration) From 33db5083013bd2433fd16d646bd5dfa8477fa212 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Jul 2022 16:23:10 +0900 Subject: [PATCH 2062/2328] Add note regarding why the `realmRetrievalLock` return is done on the async thread --- osu.Game/Database/RealmAccess.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 7dd03d5ce7..8cf57b802b 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -920,6 +920,8 @@ namespace osu.Game.Database void restoreOperation() { + // Release of lock needs to happen here rather than on the update thread, as there may be another + // operation already blocking the update thread waiting for the blocking operation to complete. Logger.Log(@"Restoring realm operations.", LoggingTarget.Database); realmRetrievalLock.Release(); From 4c3789ec5d67422459154fc452d2a320706ee793 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Tue, 5 Jul 2022 11:15:37 +0200 Subject: [PATCH 2063/2328] Split into a function --- osu.Game/Screens/Menu/ButtonSystem.cs | 30 ++++++++++++++++----------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index fadc80277a..04bffda81b 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -191,38 +191,44 @@ namespace osu.Game.Screens.Menu State = ButtonSystemState.Initial; } - protected override bool OnKeyDown(KeyDownEvent e) + /// + /// Triggers the if the current is . + /// + /// true if the was triggered, false otherwise. + private bool triggerInitialOsuLogo() { - if (e.Repeat || e.ControlPressed || e.ShiftPressed || e.AltPressed || e.SuperPressed) - return false; - if (State == ButtonSystemState.Initial) { logo?.TriggerClick(); return true; } + return false; + } + + protected override bool OnKeyDown(KeyDownEvent e) + { + if (e.Repeat || e.ControlPressed || e.ShiftPressed || e.AltPressed || e.SuperPressed) + return false; + + if (triggerInitialOsuLogo()) + return true; + return base.OnKeyDown(e); } protected override bool OnJoystickPress(JoystickPressEvent e) { - if (State == ButtonSystemState.Initial) - { - logo?.TriggerClick(); + if (triggerInitialOsuLogo()) return true; - } return base.OnJoystickPress(e); } protected override bool OnMidiDown(MidiDownEvent e) { - if (State == ButtonSystemState.Initial) - { - logo?.TriggerClick(); + if (triggerInitialOsuLogo()) return true; - } return base.OnMidiDown(e); } From d217d668526745e63e8f0c3c08139e2f997a2c9e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Jul 2022 17:18:33 +0900 Subject: [PATCH 2064/2328] Add `OnlineMetadataClient` --- osu.Game/Online/EndpointConfiguration.cs | 5 ++ osu.Game/Online/Metadata/BeatmapUpdates.cs | 28 +++++++++ osu.Game/Online/Metadata/IMetadataClient.cs | 12 ++++ osu.Game/Online/Metadata/IMetadataServer.cs | 21 +++++++ osu.Game/Online/Metadata/MetadataClient.cs | 15 +++++ .../Online/Metadata/OnlineMetadataClient.cs | 61 +++++++++++++++++++ osu.Game/OsuGameBase.cs | 8 ++- 7 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Online/Metadata/BeatmapUpdates.cs create mode 100644 osu.Game/Online/Metadata/IMetadataClient.cs create mode 100644 osu.Game/Online/Metadata/IMetadataServer.cs create mode 100644 osu.Game/Online/Metadata/MetadataClient.cs create mode 100644 osu.Game/Online/Metadata/OnlineMetadataClient.cs diff --git a/osu.Game/Online/EndpointConfiguration.cs b/osu.Game/Online/EndpointConfiguration.cs index af4e88a05c..f3bcced630 100644 --- a/osu.Game/Online/EndpointConfiguration.cs +++ b/osu.Game/Online/EndpointConfiguration.cs @@ -39,5 +39,10 @@ namespace osu.Game.Online /// The endpoint for the SignalR multiplayer server. /// public string MultiplayerEndpointUrl { get; set; } + + /// + /// The endpoint for the SignalR metadata server. + /// + public string MetadataEndpointUrl { get; set; } } } diff --git a/osu.Game/Online/Metadata/BeatmapUpdates.cs b/osu.Game/Online/Metadata/BeatmapUpdates.cs new file mode 100644 index 0000000000..8814e35e1f --- /dev/null +++ b/osu.Game/Online/Metadata/BeatmapUpdates.cs @@ -0,0 +1,28 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using MessagePack; + +namespace osu.Game.Online.Metadata +{ + /// + /// Describes a set of beatmaps which have been updated in some way. + /// + [MessagePackObject] + [Serializable] + public class BeatmapUpdates + { + [Key(0)] + public int[] BeatmapSetIDs { get; set; } + + [Key(1)] + public uint LastProcessedQueueID { get; set; } + + public BeatmapUpdates(int[] beatmapSetIDs, uint lastProcessedQueueID) + { + BeatmapSetIDs = beatmapSetIDs; + LastProcessedQueueID = lastProcessedQueueID; + } + } +} diff --git a/osu.Game/Online/Metadata/IMetadataClient.cs b/osu.Game/Online/Metadata/IMetadataClient.cs new file mode 100644 index 0000000000..ad1e7ebbaf --- /dev/null +++ b/osu.Game/Online/Metadata/IMetadataClient.cs @@ -0,0 +1,12 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Threading.Tasks; + +namespace osu.Game.Online.Metadata +{ + public interface IMetadataClient + { + Task BeatmapSetsUpdated(BeatmapUpdates updates); + } +} diff --git a/osu.Game/Online/Metadata/IMetadataServer.cs b/osu.Game/Online/Metadata/IMetadataServer.cs new file mode 100644 index 0000000000..edf288b6cf --- /dev/null +++ b/osu.Game/Online/Metadata/IMetadataServer.cs @@ -0,0 +1,21 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Threading.Tasks; + +namespace osu.Game.Online.Metadata +{ + /// + /// Metadata server is responsible for keeping the osu! client up-to-date with any changes. + /// + public interface IMetadataServer + { + /// + /// Get any changes since a specific point in the queue. + /// Should be used to allow the client to catch up with any changes after being closed or disconnected. + /// + /// The last processed queue ID. + /// + Task GetChangesSince(uint queueId); + } +} diff --git a/osu.Game/Online/Metadata/MetadataClient.cs b/osu.Game/Online/Metadata/MetadataClient.cs new file mode 100644 index 0000000000..65817b3152 --- /dev/null +++ b/osu.Game/Online/Metadata/MetadataClient.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 System.Threading.Tasks; +using osu.Framework.Graphics; + +namespace osu.Game.Online.Metadata +{ + public abstract class MetadataClient : Component, IMetadataClient, IMetadataServer + { + public abstract Task BeatmapSetsUpdated(BeatmapUpdates updates); + + public abstract Task GetChangesSince(uint queueId); + } +} diff --git a/osu.Game/Online/Metadata/OnlineMetadataClient.cs b/osu.Game/Online/Metadata/OnlineMetadataClient.cs new file mode 100644 index 0000000000..cfcebf73d3 --- /dev/null +++ b/osu.Game/Online/Metadata/OnlineMetadataClient.cs @@ -0,0 +1,61 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.SignalR.Client; +using osu.Framework.Allocation; +using osu.Framework.Logging; +using osu.Game.Online.API; + +namespace osu.Game.Online.Metadata +{ + public class OnlineMetadataClient : MetadataClient + { + private readonly string endpoint; + + private IHubClientConnector? connector; + + private HubConnection? connection => connector?.CurrentConnection; + + public OnlineMetadataClient(EndpointConfiguration endpoints) + { + endpoint = endpoints.MetadataEndpointUrl; + } + + [BackgroundDependencyLoader] + private void load(IAPIProvider api) + { + // Importantly, we are intentionally not using MessagePack here to correctly support derived class serialization. + // More information on the limitations / reasoning can be found in osu-server-spectator's initialisation code. + connector = api.GetHubConnector(nameof(OnlineMetadataClient), endpoint); + + if (connector != null) + { + connector.ConfigureConnection = connection => + { + // this is kind of SILLY + // https://github.com/dotnet/aspnetcore/issues/15198 + connection.On(nameof(IMetadataClient.BeatmapSetsUpdated), ((IMetadataClient)this).BeatmapSetsUpdated); + }; + } + } + + public override Task BeatmapSetsUpdated(BeatmapUpdates updates) + { + Logger.Log($"Received beatmap updates {updates.BeatmapSetIDs.Length} updates with last id {updates.LastProcessedQueueID}"); + return Task.CompletedTask; + } + + public override Task GetChangesSince(uint queueId) + { + throw new NotImplementedException(); + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + connector?.Dispose(); + } + } +} diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index ead3eeb0dc..bf3cc16728 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Reflection; using System.Threading; @@ -41,6 +40,7 @@ using osu.Game.IO; using osu.Game.Online; using osu.Game.Online.API; using osu.Game.Online.Chat; +using osu.Game.Online.Metadata; using osu.Game.Online.Multiplayer; using osu.Game.Online.Spectator; using osu.Game.Overlays; @@ -52,6 +52,7 @@ using osu.Game.Rulesets.Mods; using osu.Game.Scoring; using osu.Game.Skinning; using osu.Game.Utils; +using File = System.IO.File; using RuntimeInfo = osu.Framework.RuntimeInfo; namespace osu.Game @@ -180,6 +181,8 @@ namespace osu.Game private MultiplayerClient multiplayerClient; + private MetadataClient metadataClient; + private RealmAccess realm; protected override Container Content => content; @@ -265,6 +268,7 @@ namespace osu.Game dependencies.CacheAs(spectatorClient = new OnlineSpectatorClient(endpoints)); dependencies.CacheAs(multiplayerClient = new OnlineMultiplayerClient(endpoints)); + dependencies.CacheAs(metadataClient = new OnlineMetadataClient(endpoints)); var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures); @@ -316,8 +320,10 @@ namespace osu.Game // add api components to hierarchy. if (API is APIAccess apiAccess) AddInternal(apiAccess); + AddInternal(spectatorClient); AddInternal(multiplayerClient); + AddInternal(metadataClient); AddInternal(rulesetConfigCache); From b0d4f7aff6f26724e4a59464db4998e672b78a33 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Jul 2022 17:49:08 +0900 Subject: [PATCH 2065/2328] Add recovery logic after disconnection --- .../Online/Metadata/OnlineMetadataClient.cs | 69 ++++++++++++++++++- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/Metadata/OnlineMetadataClient.cs b/osu.Game/Online/Metadata/OnlineMetadataClient.cs index cfcebf73d3..0d31060a8b 100644 --- a/osu.Game/Online/Metadata/OnlineMetadataClient.cs +++ b/osu.Game/Online/Metadata/OnlineMetadataClient.cs @@ -1,10 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; +using System.Diagnostics; using System.Threading.Tasks; using Microsoft.AspNetCore.SignalR.Client; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Logging; using osu.Game.Online.API; @@ -16,6 +17,8 @@ namespace osu.Game.Online.Metadata private IHubClientConnector? connector; + private uint? lastQueueId; + private HubConnection? connection => connector?.CurrentConnection; public OnlineMetadataClient(EndpointConfiguration endpoints) @@ -38,18 +41,78 @@ namespace osu.Game.Online.Metadata // https://github.com/dotnet/aspnetcore/issues/15198 connection.On(nameof(IMetadataClient.BeatmapSetsUpdated), ((IMetadataClient)this).BeatmapSetsUpdated); }; + + connector.IsConnected.BindValueChanged(isConnectedChanged, true); } } - public override Task BeatmapSetsUpdated(BeatmapUpdates updates) + private bool catchingUp; + + private void isConnectedChanged(ValueChangedEvent connected) + { + if (!connected.NewValue) + return; + + if (lastQueueId != null) + { + catchingUp = true; + + Task.Run(async () => + { + try + { + while (true) + { + Logger.Log($"Requesting catch-up from {lastQueueId.Value}"); + var catchUpChanges = await GetChangesSince(lastQueueId.Value); + + lastQueueId = catchUpChanges.LastProcessedQueueID; + + if (catchUpChanges.BeatmapSetIDs.Length == 0) + { + Logger.Log($"Catch-up complete at {lastQueueId.Value}"); + break; + } + + await ProcessChanges(catchUpChanges.BeatmapSetIDs); + } + } + finally + { + catchingUp = false; + } + }); + } + } + + public override async Task BeatmapSetsUpdated(BeatmapUpdates updates) { Logger.Log($"Received beatmap updates {updates.BeatmapSetIDs.Length} updates with last id {updates.LastProcessedQueueID}"); + + // If we're still catching up, avoid updating the last ID as it will interfere with catch-up efforts. + if (!catchingUp) + lastQueueId = updates.LastProcessedQueueID; + + await ProcessChanges(updates.BeatmapSetIDs); + } + + protected Task ProcessChanges(int[] beatmapSetIDs) + { + foreach (int id in beatmapSetIDs) + Logger.Log($"Processing {id}..."); return Task.CompletedTask; } public override Task GetChangesSince(uint queueId) { - throw new NotImplementedException(); + if (connector?.IsConnected.Value != true) + return Task.FromCanceled(default); + + Logger.Log($"Requesting any changes since last known queue id {queueId}"); + + Debug.Assert(connection != null); + + return connection.InvokeAsync(nameof(IMetadataServer.GetChangesSince), queueId); } protected override void Dispose(bool isDisposing) From 59d0bac728546fbc5f018b8b94d89aae87f0d333 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Jul 2022 18:13:53 +0900 Subject: [PATCH 2066/2328] Hook up update flow to metadata stream --- ...eneOnlinePlayBeatmapAvailabilityTracker.cs | 8 +++---- osu.Game/Beatmaps/BeatmapImporter.cs | 7 +++--- osu.Game/Beatmaps/BeatmapManager.cs | 24 ++++++------------- osu.Game/Beatmaps/BeatmapUpdater.cs | 16 ++++++++++++- .../Online/Metadata/OnlineMetadataClient.cs | 9 ++++++- osu.Game/OsuGameBase.cs | 18 ++++++++++---- 6 files changed, 50 insertions(+), 32 deletions(-) diff --git a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs index 0bf47141e4..fcf69bf6f2 100644 --- a/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs +++ b/osu.Game.Tests/Online/TestSceneOnlinePlayBeatmapAvailabilityTracker.cs @@ -212,17 +212,17 @@ namespace osu.Game.Tests.Online { } - protected override BeatmapImporter CreateBeatmapImporter(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapUpdater beatmapUpdater) + protected override BeatmapImporter CreateBeatmapImporter(Storage storage, RealmAccess realm) { - return new TestBeatmapImporter(this, storage, realm, beatmapUpdater); + return new TestBeatmapImporter(this, storage, realm); } internal class TestBeatmapImporter : BeatmapImporter { private readonly TestBeatmapManager testBeatmapManager; - public TestBeatmapImporter(TestBeatmapManager testBeatmapManager, Storage storage, RealmAccess databaseAccess, BeatmapUpdater beatmapUpdater) - : base(storage, databaseAccess, beatmapUpdater) + public TestBeatmapImporter(TestBeatmapManager testBeatmapManager, Storage storage, RealmAccess databaseAccess) + : base(storage, databaseAccess) { this.testBeatmapManager = testBeatmapManager; } diff --git a/osu.Game/Beatmaps/BeatmapImporter.cs b/osu.Game/Beatmaps/BeatmapImporter.cs index 5382b98c22..92f1fc17d5 100644 --- a/osu.Game/Beatmaps/BeatmapImporter.cs +++ b/osu.Game/Beatmaps/BeatmapImporter.cs @@ -31,12 +31,11 @@ namespace osu.Game.Beatmaps protected override string[] HashableFileTypes => new[] { ".osu" }; - private readonly BeatmapUpdater? beatmapUpdater; + public Action? ProcessBeatmap { private get; set; } - public BeatmapImporter(Storage storage, RealmAccess realm, BeatmapUpdater? beatmapUpdater = null) + public BeatmapImporter(Storage storage, RealmAccess realm) : base(storage, realm) { - this.beatmapUpdater = beatmapUpdater; } protected override bool ShouldDeleteArchive(string path) => Path.GetExtension(path).ToLowerInvariant() == ".osz"; @@ -100,7 +99,7 @@ namespace osu.Game.Beatmaps { base.PostImport(model, realm); - beatmapUpdater?.Process(model); + ProcessBeatmap?.Invoke(model); } private void validateOnlineIds(BeatmapSetInfo beatmapSet, Realm realm) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index e16a87eb50..b1acf78ec6 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -34,14 +34,15 @@ namespace osu.Game.Beatmaps /// Handles general operations related to global beatmap management. /// [ExcludeFromDynamicCompile] - public class BeatmapManager : ModelManager, IModelImporter, IWorkingBeatmapCache, IDisposable + public class BeatmapManager : ModelManager, IModelImporter, IWorkingBeatmapCache { public ITrackStore BeatmapTrackStore { get; } private readonly BeatmapImporter beatmapImporter; private readonly WorkingBeatmapCache workingBeatmapCache; - private readonly BeatmapUpdater? beatmapUpdater; + + public Action? ProcessBeatmap { private get; set; } public BeatmapManager(Storage storage, RealmAccess realm, RulesetStore rulesets, IAPIProvider? api, AudioManager audioManager, IResourceStore gameResources, GameHost? host = null, WorkingBeatmap? defaultBeatmap = null, BeatmapDifficultyCache? difficultyCache = null, bool performOnlineLookups = false) @@ -54,15 +55,14 @@ namespace osu.Game.Beatmaps if (difficultyCache == null) throw new ArgumentNullException(nameof(difficultyCache), "Difficulty cache must be provided if online lookups are required."); - - beatmapUpdater = new BeatmapUpdater(this, difficultyCache, api, storage); } var userResources = new RealmFileStore(realm, storage).Store; BeatmapTrackStore = audioManager.GetTrackStore(userResources); - beatmapImporter = CreateBeatmapImporter(storage, realm, rulesets, beatmapUpdater); + beatmapImporter = CreateBeatmapImporter(storage, realm); + beatmapImporter.ProcessBeatmap = obj => ProcessBeatmap?.Invoke(obj); beatmapImporter.PostNotification = obj => PostNotification?.Invoke(obj); workingBeatmapCache = CreateWorkingBeatmapCache(audioManager, gameResources, userResources, defaultBeatmap, host); @@ -74,8 +74,7 @@ namespace osu.Game.Beatmaps return new WorkingBeatmapCache(BeatmapTrackStore, audioManager, resources, storage, defaultBeatmap, host); } - protected virtual BeatmapImporter CreateBeatmapImporter(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapUpdater? beatmapUpdater) => - new BeatmapImporter(storage, realm, beatmapUpdater); + protected virtual BeatmapImporter CreateBeatmapImporter(Storage storage, RealmAccess realm) => new BeatmapImporter(storage, realm); /// /// Create a new beatmap set, backed by a model, @@ -323,7 +322,7 @@ namespace osu.Game.Beatmaps setInfo.CopyChangesToRealm(liveBeatmapSet); - beatmapUpdater?.Process(liveBeatmapSet, r); + ProcessBeatmap?.Invoke(liveBeatmapSet); }); } @@ -468,15 +467,6 @@ namespace osu.Game.Beatmaps #endregion - #region Implementation of IDisposable - - public void Dispose() - { - beatmapUpdater?.Dispose(); - } - - #endregion - #region Implementation of IPostImports public Action>>? PresentImport diff --git a/osu.Game/Beatmaps/BeatmapUpdater.cs b/osu.Game/Beatmaps/BeatmapUpdater.cs index d800b09a2b..d0ec44a034 100644 --- a/osu.Game/Beatmaps/BeatmapUpdater.cs +++ b/osu.Game/Beatmaps/BeatmapUpdater.cs @@ -31,6 +31,14 @@ namespace osu.Game.Beatmaps onlineLookupQueue = new BeatmapOnlineLookupQueue(api, storage); } + /// + /// Queue a beatmap for background processing. + /// + public void Queue(int beatmapSetId) + { + // TODO: implement + } + /// /// Queue a beatmap for background processing. /// @@ -44,7 +52,13 @@ namespace osu.Game.Beatmaps /// /// Run all processing on a beatmap immediately. /// - public void Process(BeatmapSetInfo beatmapSet) => beatmapSet.Realm.Write(r => Process(beatmapSet, r)); + public void Process(BeatmapSetInfo beatmapSet) + { + if (beatmapSet.Realm.IsInTransaction) + Process(beatmapSet, beatmapSet.Realm); + else + beatmapSet.Realm.Write(r => Process(beatmapSet, r)); + } public void Process(BeatmapSetInfo beatmapSet, Realm realm) { diff --git a/osu.Game/Online/Metadata/OnlineMetadataClient.cs b/osu.Game/Online/Metadata/OnlineMetadataClient.cs index 0d31060a8b..b05efd5311 100644 --- a/osu.Game/Online/Metadata/OnlineMetadataClient.cs +++ b/osu.Game/Online/Metadata/OnlineMetadataClient.cs @@ -7,12 +7,14 @@ using Microsoft.AspNetCore.SignalR.Client; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Logging; +using osu.Game.Beatmaps; using osu.Game.Online.API; namespace osu.Game.Online.Metadata { public class OnlineMetadataClient : MetadataClient { + private readonly BeatmapUpdater beatmapUpdater; private readonly string endpoint; private IHubClientConnector? connector; @@ -21,8 +23,9 @@ namespace osu.Game.Online.Metadata private HubConnection? connection => connector?.CurrentConnection; - public OnlineMetadataClient(EndpointConfiguration endpoints) + public OnlineMetadataClient(EndpointConfiguration endpoints, BeatmapUpdater beatmapUpdater) { + this.beatmapUpdater = beatmapUpdater; endpoint = endpoints.MetadataEndpointUrl; } @@ -99,7 +102,11 @@ namespace osu.Game.Online.Metadata protected Task ProcessChanges(int[] beatmapSetIDs) { foreach (int id in beatmapSetIDs) + { Logger.Log($"Processing {id}..."); + beatmapUpdater.Queue(id); + } + return Task.CompletedTask; } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index bf3cc16728..356013a410 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -171,6 +171,7 @@ namespace osu.Game public readonly Bindable>> AvailableMods = new Bindable>>(new Dictionary>()); private BeatmapDifficultyCache difficultyCache; + private BeatmapUpdater beatmapUpdater; private UserLookupCache userCache; private BeatmapLookupCache beatmapCache; @@ -266,16 +267,13 @@ namespace osu.Game dependencies.CacheAs(API ??= new APIAccess(LocalConfig, endpoints, VersionHash)); - dependencies.CacheAs(spectatorClient = new OnlineSpectatorClient(endpoints)); - dependencies.CacheAs(multiplayerClient = new OnlineMultiplayerClient(endpoints)); - dependencies.CacheAs(metadataClient = new OnlineMetadataClient(endpoints)); - var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures); dependencies.Cache(difficultyCache = new BeatmapDifficultyCache()); // ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup() dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, realm, Scheduler, difficultyCache, LocalConfig)); + dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, realm, RulesetStore, API, Audio, Resources, Host, defaultBeatmap, difficultyCache, performOnlineLookups: true)); dependencies.Cache(BeatmapDownloader = new BeatmapModelDownloader(BeatmapManager, API)); @@ -284,6 +282,15 @@ namespace osu.Game // Add after all the above cache operations as it depends on them. AddInternal(difficultyCache); + // TODO: OsuGame or OsuGameBase? + beatmapUpdater = new BeatmapUpdater(BeatmapManager, difficultyCache, API, Storage); + + dependencies.CacheAs(spectatorClient = new OnlineSpectatorClient(endpoints)); + dependencies.CacheAs(multiplayerClient = new OnlineMultiplayerClient(endpoints)); + dependencies.CacheAs(metadataClient = new OnlineMetadataClient(endpoints, beatmapUpdater)); + + BeatmapManager.ProcessBeatmap = set => beatmapUpdater.Process(set); + dependencies.Cache(userCache = new UserLookupCache()); AddInternal(userCache); @@ -580,9 +587,10 @@ namespace osu.Game base.Dispose(isDisposing); RulesetStore?.Dispose(); - BeatmapManager?.Dispose(); LocalConfig?.Dispose(); + beatmapUpdater?.Dispose(); + realm?.Dispose(); if (Host != null) From bdd1bf4da00d8d8de36370c2054c6d93b7ba562b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Jul 2022 21:42:35 +0900 Subject: [PATCH 2067/2328] Save last processed id to config for now --- osu.Game/Configuration/OsuConfigManager.cs | 3 +++ osu.Game/Online/Metadata/BeatmapUpdates.cs | 4 ++-- osu.Game/Online/Metadata/IMetadataServer.cs | 2 +- osu.Game/Online/Metadata/MetadataClient.cs | 2 +- osu.Game/Online/Metadata/OnlineMetadataClient.cs | 15 +++++++++------ 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 713166a9a0..a523507205 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -167,6 +167,8 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.DiscordRichPresence, DiscordRichPresenceMode.Full); SetDefault(OsuSetting.EditorWaveformOpacity, 0.25f); + + SetDefault(OsuSetting.LastProcessedMetadataId, -1); } public IDictionary GetLoggableState() => @@ -363,5 +365,6 @@ namespace osu.Game.Configuration DiscordRichPresence, AutomaticallyDownloadWhenSpectating, ShowOnlineExplicitContent, + LastProcessedMetadataId } } diff --git a/osu.Game/Online/Metadata/BeatmapUpdates.cs b/osu.Game/Online/Metadata/BeatmapUpdates.cs index 8814e35e1f..a0cf616c70 100644 --- a/osu.Game/Online/Metadata/BeatmapUpdates.cs +++ b/osu.Game/Online/Metadata/BeatmapUpdates.cs @@ -17,9 +17,9 @@ namespace osu.Game.Online.Metadata public int[] BeatmapSetIDs { get; set; } [Key(1)] - public uint LastProcessedQueueID { get; set; } + public int LastProcessedQueueID { get; set; } - public BeatmapUpdates(int[] beatmapSetIDs, uint lastProcessedQueueID) + public BeatmapUpdates(int[] beatmapSetIDs, int lastProcessedQueueID) { BeatmapSetIDs = beatmapSetIDs; LastProcessedQueueID = lastProcessedQueueID; diff --git a/osu.Game/Online/Metadata/IMetadataServer.cs b/osu.Game/Online/Metadata/IMetadataServer.cs index edf288b6cf..994f60f877 100644 --- a/osu.Game/Online/Metadata/IMetadataServer.cs +++ b/osu.Game/Online/Metadata/IMetadataServer.cs @@ -16,6 +16,6 @@ namespace osu.Game.Online.Metadata /// /// The last processed queue ID. /// - Task GetChangesSince(uint queueId); + Task GetChangesSince(int queueId); } } diff --git a/osu.Game/Online/Metadata/MetadataClient.cs b/osu.Game/Online/Metadata/MetadataClient.cs index 65817b3152..1e5eeb4eb0 100644 --- a/osu.Game/Online/Metadata/MetadataClient.cs +++ b/osu.Game/Online/Metadata/MetadataClient.cs @@ -10,6 +10,6 @@ namespace osu.Game.Online.Metadata { public abstract Task BeatmapSetsUpdated(BeatmapUpdates updates); - public abstract Task GetChangesSince(uint queueId); + public abstract Task GetChangesSince(int queueId); } } diff --git a/osu.Game/Online/Metadata/OnlineMetadataClient.cs b/osu.Game/Online/Metadata/OnlineMetadataClient.cs index b05efd5311..1b0d1884dc 100644 --- a/osu.Game/Online/Metadata/OnlineMetadataClient.cs +++ b/osu.Game/Online/Metadata/OnlineMetadataClient.cs @@ -8,6 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Logging; using osu.Game.Beatmaps; +using osu.Game.Configuration; using osu.Game.Online.API; namespace osu.Game.Online.Metadata @@ -19,7 +20,7 @@ namespace osu.Game.Online.Metadata private IHubClientConnector? connector; - private uint? lastQueueId; + private Bindable lastQueueId = null!; private HubConnection? connection => connector?.CurrentConnection; @@ -30,7 +31,7 @@ namespace osu.Game.Online.Metadata } [BackgroundDependencyLoader] - private void load(IAPIProvider api) + private void load(IAPIProvider api, OsuConfigManager config) { // Importantly, we are intentionally not using MessagePack here to correctly support derived class serialization. // More information on the limitations / reasoning can be found in osu-server-spectator's initialisation code. @@ -47,6 +48,8 @@ namespace osu.Game.Online.Metadata connector.IsConnected.BindValueChanged(isConnectedChanged, true); } + + lastQueueId = config.GetBindable(OsuSetting.LastProcessedMetadataId); } private bool catchingUp; @@ -56,7 +59,7 @@ namespace osu.Game.Online.Metadata if (!connected.NewValue) return; - if (lastQueueId != null) + if (lastQueueId.Value >= 0) { catchingUp = true; @@ -69,7 +72,7 @@ namespace osu.Game.Online.Metadata Logger.Log($"Requesting catch-up from {lastQueueId.Value}"); var catchUpChanges = await GetChangesSince(lastQueueId.Value); - lastQueueId = catchUpChanges.LastProcessedQueueID; + lastQueueId.Value = catchUpChanges.LastProcessedQueueID; if (catchUpChanges.BeatmapSetIDs.Length == 0) { @@ -94,7 +97,7 @@ namespace osu.Game.Online.Metadata // If we're still catching up, avoid updating the last ID as it will interfere with catch-up efforts. if (!catchingUp) - lastQueueId = updates.LastProcessedQueueID; + lastQueueId.Value = updates.LastProcessedQueueID; await ProcessChanges(updates.BeatmapSetIDs); } @@ -110,7 +113,7 @@ namespace osu.Game.Online.Metadata return Task.CompletedTask; } - public override Task GetChangesSince(uint queueId) + public override Task GetChangesSince(int queueId) { if (connector?.IsConnected.Value != true) return Task.FromCanceled(default); From 99afbc7b73d76c68a41d96fd4fa1b5efe69d9ec5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Jul 2022 22:15:52 +0900 Subject: [PATCH 2068/2328] Add missing endpoint URLs --- osu.Game/Online/DevelopmentEndpointConfiguration.cs | 1 + osu.Game/Online/ProductionEndpointConfiguration.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/osu.Game/Online/DevelopmentEndpointConfiguration.cs b/osu.Game/Online/DevelopmentEndpointConfiguration.cs index 83fd02512b..3171d15fc2 100644 --- a/osu.Game/Online/DevelopmentEndpointConfiguration.cs +++ b/osu.Game/Online/DevelopmentEndpointConfiguration.cs @@ -14,6 +14,7 @@ namespace osu.Game.Online APIClientID = "5"; SpectatorEndpointUrl = $"{APIEndpointUrl}/spectator"; MultiplayerEndpointUrl = $"{APIEndpointUrl}/multiplayer"; + MetadataEndpointUrl = $"{APIEndpointUrl}/metadata"; } } } diff --git a/osu.Game/Online/ProductionEndpointConfiguration.cs b/osu.Game/Online/ProductionEndpointConfiguration.cs index f431beac1c..316452280d 100644 --- a/osu.Game/Online/ProductionEndpointConfiguration.cs +++ b/osu.Game/Online/ProductionEndpointConfiguration.cs @@ -14,6 +14,7 @@ namespace osu.Game.Online APIClientID = "5"; SpectatorEndpointUrl = "https://spectator.ppy.sh/spectator"; MultiplayerEndpointUrl = "https://spectator.ppy.sh/multiplayer"; + MetadataEndpointUrl = "https://spectator.ppy.sh/metadata"; } } } From 3a68f386a8e7230ece6c402b0d98c9b8a3de24cc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Jul 2022 01:25:04 +0900 Subject: [PATCH 2069/2328] Add forgotten password link to login form --- osu.Game/Overlays/Login/LoginForm.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game/Overlays/Login/LoginForm.cs b/osu.Game/Overlays/Login/LoginForm.cs index f545e2892f..b3e120f443 100644 --- a/osu.Game/Overlays/Login/LoginForm.cs +++ b/osu.Game/Overlays/Login/LoginForm.cs @@ -49,6 +49,7 @@ namespace osu.Game.Overlays.Login RelativeSizeAxes = Axes.X; ErrorTextFlowContainer errorText; + LinkFlowContainer forgottenPaswordLink; Children = new Drawable[] { @@ -80,6 +81,12 @@ namespace osu.Game.Overlays.Login LabelText = "Stay signed in", Current = config.GetBindable(OsuSetting.SavePassword), }, + forgottenPaswordLink = new LinkFlowContainer + { + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + }, new Container { RelativeSizeAxes = Axes.X, @@ -109,6 +116,8 @@ namespace osu.Game.Overlays.Login } }; + forgottenPaswordLink.AddLink(LayoutStrings.PopupLoginLoginForgot, "https://osu.ppy.sh/home/password-reset"); + password.OnCommit += (_, _) => performLogin(); if (api?.LastLoginError?.Message is string error) From 6fb00d84f997cfa318ae81636c064b8498d822b7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Jul 2022 01:29:00 +0900 Subject: [PATCH 2070/2328] Apply NRT to `LoginForm` and remove nullability of `IAPIProvider` --- osu.Game/Overlays/Login/LoginForm.cs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Login/LoginForm.cs b/osu.Game/Overlays/Login/LoginForm.cs index b3e120f443..0042f4607d 100644 --- a/osu.Game/Overlays/Login/LoginForm.cs +++ b/osu.Game/Overlays/Login/LoginForm.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using osu.Framework.Allocation; using osu.Framework.Extensions.LocalisationExtensions; @@ -23,19 +21,19 @@ namespace osu.Game.Overlays.Login { public class LoginForm : FillFlowContainer { - private TextBox username; - private TextBox password; - private ShakeContainer shakeSignIn; + private TextBox username = null!; + private TextBox password = null!; + private ShakeContainer shakeSignIn = null!; - [Resolved(CanBeNull = true)] - private IAPIProvider api { get; set; } + [Resolved] + private IAPIProvider api { get; set; } = null!; - public Action RequestHide; + public Action? RequestHide; private void performLogin() { if (!string.IsNullOrEmpty(username.Text) && !string.IsNullOrEmpty(password.Text)) - api?.Login(username.Text, password.Text); + api.Login(username.Text, password.Text); else shakeSignIn.Shake(); } @@ -57,7 +55,7 @@ namespace osu.Game.Overlays.Login { PlaceholderText = UsersStrings.LoginUsername.ToLower(), RelativeSizeAxes = Axes.X, - Text = api?.ProvidedUsername ?? string.Empty, + Text = api.ProvidedUsername, TabbableContentContainer = this }, password = new OsuPasswordTextBox @@ -110,17 +108,17 @@ namespace osu.Game.Overlays.Login Text = "Register", Action = () => { - RequestHide(); + RequestHide?.Invoke(); accountCreation.Show(); } } }; - forgottenPaswordLink.AddLink(LayoutStrings.PopupLoginLoginForgot, "https://osu.ppy.sh/home/password-reset"); + forgottenPaswordLink.AddLink(LayoutStrings.PopupLoginLoginForgot, $"{api.WebsiteRootUrl}/home/password-reset"); password.OnCommit += (_, _) => performLogin(); - if (api?.LastLoginError?.Message is string error) + if (api.LastLoginError?.Message is string error) errorText.AddErrors(new[] { error }); } From 72fb1ae892e71424a45b383b684f791802444fdf Mon Sep 17 00:00:00 2001 From: goodtrailer Date: Tue, 5 Jul 2022 21:04:13 -0700 Subject: [PATCH 2071/2328] Add forgotten unsubscribes --- .../Skinning/Default/DefaultFollowCircle.cs | 17 ++++++++-- .../Skinning/Default/DefaultSliderBall.cs | 11 +++--- .../Skinning/Legacy/LegacyFollowCircle.cs | 34 ++++++++++++++++--- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs index c39a07da4e..7dd45c295d 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs @@ -1,11 +1,13 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Logging; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables; using osuTK.Graphics; @@ -70,14 +72,23 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state) { + // see comment in LegacySliderBall.updateStateTransforms if (drawableObject is not DrawableSlider) return; - const float fade_time = 450f; + const float fade_duration = 450f; + // intentionally pile on an extra FadeOut to make it happen much faster using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime)) - // intentionally pile on an extra FadeOut to make it happen much faster. - this.FadeOut(fade_time / 4, Easing.Out); + this.FadeOut(fade_duration / 4, Easing.Out); + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + if (parentObject != null) + parentObject.ApplyCustomUpdateState -= updateStateTransforms; } } } diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs index 3c7dd7ba5d..37e5e150bd 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs @@ -73,26 +73,27 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state) { + // see comment in LegacySliderBall.updateStateTransforms if (drawableObject is not DrawableSlider) return; - const float fade_out_time = 450f; + const float fade_duration = 450f; using (BeginAbsoluteSequence(drawableObject.StateUpdateTime)) { - this.ScaleTo(1f) - .FadeIn(); + this.FadeIn() + .ScaleTo(1f); } using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime)) { // intentionally pile on an extra FadeOut to make it happen much faster - this.FadeOut(fade_out_time / 4, Easing.Out); + this.FadeOut(fade_duration / 4, Easing.Out); switch (state) { case ArmedState.Hit: - this.ScaleTo(1.4f, fade_out_time, Easing.Out); + this.ScaleTo(1.4f, fade_duration, Easing.Out); break; } } diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs index df33180c7b..dc44c86de0 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs @@ -1,13 +1,17 @@ // 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.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Transforms; +using osu.Framework.Logging; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables; +using osuTK; namespace osu.Game.Rulesets.Osu.Skinning.Legacy { @@ -23,7 +27,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy animationContent.Anchor = Anchor.Centre; animationContent.Origin = Anchor.Centre; - Alpha = 0f; RelativeSizeAxes = Axes.Both; InternalChild = animationContent; } @@ -44,6 +47,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy if (parentObject != null) { + parentObject.HitObjectApplied += onHitObjectApplied; + onHitObjectApplied(parentObject); + parentObject.ApplyCustomUpdateState += updateStateTransforms; updateStateTransforms(parentObject, parentObject.State.Value); } @@ -69,18 +75,38 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy .FadeTo(tracking.NewValue ? 1f : 0f, realFadeDuration, Easing.OutQuad); } + private void onHitObjectApplied(DrawableHitObject drawableObject) + { + this.ScaleTo(1f) + .FadeOut(); + } + private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state) { + // see comment in LegacySliderBall.updateStateTransforms if (drawableObject is not DrawableSlider) return; const float shrink_duration = 200f; - const float fade_duration = 240f; + const float fade_delay = 175f; + const float fade_duration = 35f; using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime)) { - this.ScaleTo(DrawableSliderBall.FOLLOW_AREA * 0.8f, shrink_duration, Easing.OutQuint) - .FadeOut(fade_duration, Easing.InQuint); + this.ScaleTo(DrawableSliderBall.FOLLOW_AREA * 0.75f, shrink_duration, Easing.OutQuad) + .Delay(fade_delay) + .FadeOut(fade_duration); + } + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + if (parentObject != null) + { + parentObject.HitObjectApplied -= onHitObjectApplied; + parentObject.ApplyCustomUpdateState -= updateStateTransforms; } } } From c95eb2d2c1c6b93e89e2a11755fe2895f583b611 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Jul 2022 14:28:47 +0900 Subject: [PATCH 2072/2328] Fix incorrect case in `CatcherArea` parameter --- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index a0279b5c83..7a29ba9801 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -120,10 +120,10 @@ namespace osu.Game.Rulesets.Catch.UI lastHyperDashState = Catcher.HyperDashing; } - public void SetCatcherPosition(float X) + public void SetCatcherPosition(float x) { float lastPosition = Catcher.X; - float newPosition = Math.Clamp(X, 0, CatchPlayfield.WIDTH); + float newPosition = Math.Clamp(x, 0, CatchPlayfield.WIDTH); Catcher.X = newPosition; From a52ea3cabe34c6e1c90a6126ab5a506151ca6362 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Jul 2022 14:29:55 +0900 Subject: [PATCH 2073/2328] Enable NRT and simplify `LineBufferedReader` --- .../Beatmaps/IO/LineBufferedReaderTest.cs | 12 ++--- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 +- osu.Game/IO/LineBufferedReader.cs | 48 ++++++++----------- 3 files changed, 23 insertions(+), 39 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs index 8f20fd7a68..14fbcb6176 100644 --- a/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs @@ -108,19 +108,13 @@ namespace osu.Game.Tests.Beatmaps.IO [Test] public void TestReadToEndAfterReadsAndPeeks() { - const string contents = "this line is gone\rthis one shouldn't be\r\nthese ones\ndefinitely not"; + const string contents = "first line\r\nsecond line"; using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(contents))) using (var bufferedReader = new LineBufferedReader(stream)) { - Assert.AreEqual("this line is gone", bufferedReader.ReadLine()); - Assert.AreEqual("this one shouldn't be", bufferedReader.PeekLine()); - - string[] endingLines = bufferedReader.ReadToEnd().Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); - Assert.AreEqual(3, endingLines.Length); - Assert.AreEqual("this one shouldn't be", endingLines[0]); - Assert.AreEqual("these ones", endingLines[1]); - Assert.AreEqual("definitely not", endingLines[2]); + bufferedReader.PeekLine(); + Assert.Throws(() => bufferedReader.ReadToEnd()); } } } diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index a5e6ac0a1c..52e760a068 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -29,7 +29,7 @@ namespace osu.Game.Beatmaps.Formats { Section section = Section.General; - string line; + string? line; while ((line = stream.ReadLine()) != null) { diff --git a/osu.Game/IO/LineBufferedReader.cs b/osu.Game/IO/LineBufferedReader.cs index db435576bf..1e329c786f 100644 --- a/osu.Game/IO/LineBufferedReader.cs +++ b/osu.Game/IO/LineBufferedReader.cs @@ -1,10 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; -using System.Collections.Generic; using System.IO; using System.Text; @@ -17,58 +14,51 @@ namespace osu.Game.IO public class LineBufferedReader : IDisposable { private readonly StreamReader streamReader; - private readonly Queue lineBuffer; + + private string? peekedLine; public LineBufferedReader(Stream stream, bool leaveOpen = false) { streamReader = new StreamReader(stream, Encoding.UTF8, true, 1024, leaveOpen); - lineBuffer = new Queue(); } /// /// Reads the next line from the stream without consuming it. /// Subsequent calls to without a will return the same string. /// - public string PeekLine() - { - if (lineBuffer.Count > 0) - return lineBuffer.Peek(); - - string line = streamReader.ReadLine(); - if (line != null) - lineBuffer.Enqueue(line); - return line; - } + public string? PeekLine() => peekedLine ??= streamReader.ReadLine(); /// /// Reads the next line from the stream and consumes it. /// If a line was peeked, that same line will then be consumed and returned. /// - public string ReadLine() => lineBuffer.Count > 0 ? lineBuffer.Dequeue() : streamReader.ReadLine(); + public string? ReadLine() + { + try + { + return peekedLine ?? streamReader.ReadLine(); + } + finally + { + peekedLine = null; + } + } /// /// Reads the stream to its end and returns the text read. - /// This includes any peeked but unconsumed lines. + /// Not compatible with calls to . /// public string ReadToEnd() { - string remainingText = streamReader.ReadToEnd(); - if (lineBuffer.Count == 0) - return remainingText; + if (peekedLine != null) + throw new InvalidOperationException($"Do not use {nameof(ReadToEnd)} when also peeking for lines."); - var builder = new StringBuilder(); - - // this might not be completely correct due to varying platform line endings - while (lineBuffer.Count > 0) - builder.AppendLine(lineBuffer.Dequeue()); - builder.Append(remainingText); - - return builder.ToString(); + return streamReader.ReadToEnd(); } public void Dispose() { - streamReader?.Dispose(); + streamReader.Dispose(); } } } From ae49aafde215e65f19db42b2a73d2848a509ed0e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Jul 2022 14:50:30 +0900 Subject: [PATCH 2074/2328] Fix `BeatSyncedContainer` unintentionally blocking on beatmap load --- osu.Game/Graphics/Containers/BeatSyncedContainer.cs | 2 +- osu.Game/OsuGameBase.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index 45a935d165..4b40add87f 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -86,7 +86,7 @@ namespace osu.Game.Graphics.Containers TimingControlPoint timingPoint; EffectControlPoint effectPoint; - IsBeatSyncedWithTrack = BeatSyncSource.Clock?.IsRunning == true; + IsBeatSyncedWithTrack = BeatSyncSource.Clock?.IsRunning == true && BeatSyncSource.ControlPoints != null; double currentTrackTime; diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index ead3eeb0dc..c6a32e1d5b 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -583,7 +583,7 @@ namespace osu.Game Host.ExceptionThrown -= onExceptionThrown; } - ControlPointInfo IBeatSyncProvider.ControlPoints => Beatmap.Value.Beatmap.ControlPointInfo; + ControlPointInfo IBeatSyncProvider.ControlPoints => Beatmap.Value.BeatmapLoaded ? Beatmap.Value.Beatmap.ControlPointInfo : null; IClock IBeatSyncProvider.Clock => Beatmap.Value.TrackLoaded ? Beatmap.Value.Track : (IClock)null; ChannelAmplitudes? IBeatSyncProvider.Amplitudes => Beatmap.Value.TrackLoaded ? Beatmap.Value.Track.CurrentAmplitudes : null; } From 12d396a51359dcec41f24a34aa8424f43d5acc2f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Jul 2022 15:43:35 +0900 Subject: [PATCH 2075/2328] Use `-1` to specify default buffer size --- osu.Game/IO/LineBufferedReader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/IO/LineBufferedReader.cs b/osu.Game/IO/LineBufferedReader.cs index 1e329c786f..0210d7207e 100644 --- a/osu.Game/IO/LineBufferedReader.cs +++ b/osu.Game/IO/LineBufferedReader.cs @@ -19,7 +19,7 @@ namespace osu.Game.IO public LineBufferedReader(Stream stream, bool leaveOpen = false) { - streamReader = new StreamReader(stream, Encoding.UTF8, true, 1024, leaveOpen); + streamReader = new StreamReader(stream, Encoding.UTF8, true, -1, leaveOpen); } /// From a1b6ec60c899fe564e563b45b712fec9616876ac Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Jul 2022 18:38:39 +0900 Subject: [PATCH 2076/2328] Add statistics display for `MemoryCachingComponent`s Never sure if these are working as they should (or how well they are working). This helps quite a bit. --- osu.Game/Database/MemoryCachingComponent.cs | 46 +++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/osu.Game/Database/MemoryCachingComponent.cs b/osu.Game/Database/MemoryCachingComponent.cs index 104943bbae..571a9ccc7c 100644 --- a/osu.Game/Database/MemoryCachingComponent.cs +++ b/osu.Game/Database/MemoryCachingComponent.cs @@ -8,7 +8,9 @@ using System.Collections.Concurrent; using System.Threading; using System.Threading.Tasks; using JetBrains.Annotations; +using osu.Framework.Extensions.TypeExtensions; using osu.Framework.Graphics; +using osu.Framework.Statistics; namespace osu.Game.Database { @@ -20,8 +22,16 @@ namespace osu.Game.Database { private readonly ConcurrentDictionary cache = new ConcurrentDictionary(); + private readonly GlobalStatistic statistics; + protected virtual bool CacheNullValues => true; + protected MemoryCachingComponent() + { + statistics = GlobalStatistics.Get(nameof(MemoryCachingComponent), GetType().ReadableName()); + statistics.Value = new MemoryCachingStatistics(); + } + /// /// Retrieve the cached value for the given lookup. /// @@ -30,12 +40,20 @@ namespace osu.Game.Database protected async Task GetAsync([NotNull] TLookup lookup, CancellationToken token = default) { if (CheckExists(lookup, out TValue performance)) + { + statistics.Value.HitCount++; return performance; + } var computed = await ComputeValueAsync(lookup, token).ConfigureAwait(false); + statistics.Value.MissCount++; + if (computed != null || CacheNullValues) + { cache[lookup] = computed; + statistics.Value.Usage = cache.Count; + } return computed; } @@ -51,6 +69,8 @@ namespace osu.Game.Database if (matchKeyPredicate(kvp.Key)) cache.TryRemove(kvp.Key, out _); } + + statistics.Value.Usage = cache.Count; } protected bool CheckExists([NotNull] TLookup lookup, out TValue value) => @@ -63,5 +83,31 @@ namespace osu.Game.Database /// An optional to cancel the operation. /// The computed value. protected abstract Task ComputeValueAsync(TLookup lookup, CancellationToken token = default); + + private class MemoryCachingStatistics + { + /// + /// Total number of cache hits. + /// + public int HitCount; + + /// + /// Total number of cache misses. + /// + public int MissCount; + + /// + /// Total number of cached entities. + /// + public int Usage; + + public override string ToString() + { + int totalAccesses = HitCount + MissCount; + double hitRate = totalAccesses == 0 ? 0 : (double)HitCount / totalAccesses; + + return $"i:{Usage} h:{HitCount} m:{MissCount} {hitRate:0%}"; + } + } } } From 01bc6e5cb7ef98d26e001b8f89bef14fd1ddabd7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Jul 2022 19:53:19 +0900 Subject: [PATCH 2077/2328] Revert old behaviour of `ReadToEnd` --- .../Beatmaps/IO/LineBufferedReaderTest.cs | 12 +++++++++--- osu.Game/IO/LineBufferedReader.cs | 15 +++++++++++---- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs index 14fbcb6176..8f20fd7a68 100644 --- a/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/LineBufferedReaderTest.cs @@ -108,13 +108,19 @@ namespace osu.Game.Tests.Beatmaps.IO [Test] public void TestReadToEndAfterReadsAndPeeks() { - const string contents = "first line\r\nsecond line"; + const string contents = "this line is gone\rthis one shouldn't be\r\nthese ones\ndefinitely not"; using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(contents))) using (var bufferedReader = new LineBufferedReader(stream)) { - bufferedReader.PeekLine(); - Assert.Throws(() => bufferedReader.ReadToEnd()); + Assert.AreEqual("this line is gone", bufferedReader.ReadLine()); + Assert.AreEqual("this one shouldn't be", bufferedReader.PeekLine()); + + string[] endingLines = bufferedReader.ReadToEnd().Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); + Assert.AreEqual(3, endingLines.Length); + Assert.AreEqual("this one shouldn't be", endingLines[0]); + Assert.AreEqual("these ones", endingLines[1]); + Assert.AreEqual("definitely not", endingLines[2]); } } } diff --git a/osu.Game/IO/LineBufferedReader.cs b/osu.Game/IO/LineBufferedReader.cs index 0210d7207e..6fcea08990 100644 --- a/osu.Game/IO/LineBufferedReader.cs +++ b/osu.Game/IO/LineBufferedReader.cs @@ -46,14 +46,21 @@ namespace osu.Game.IO /// /// Reads the stream to its end and returns the text read. - /// Not compatible with calls to . + /// This includes any peeked but unconsumed lines. /// public string ReadToEnd() { - if (peekedLine != null) - throw new InvalidOperationException($"Do not use {nameof(ReadToEnd)} when also peeking for lines."); + string remainingText = streamReader.ReadToEnd(); + if (peekedLine == null) + return remainingText; - return streamReader.ReadToEnd(); + var builder = new StringBuilder(); + + // this might not be completely correct due to varying platform line endings + builder.AppendLine(peekedLine); + builder.Append(remainingText); + + return builder.ToString(); } public void Dispose() From c2f106907364de79167a92cf8e0f2f1930168449 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Jul 2022 19:55:43 +0900 Subject: [PATCH 2078/2328] Avoid usage of `finally` in potentially hot path --- osu.Game/IO/LineBufferedReader.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/osu.Game/IO/LineBufferedReader.cs b/osu.Game/IO/LineBufferedReader.cs index 6fcea08990..93e554b43d 100644 --- a/osu.Game/IO/LineBufferedReader.cs +++ b/osu.Game/IO/LineBufferedReader.cs @@ -34,14 +34,10 @@ namespace osu.Game.IO /// public string? ReadLine() { - try - { - return peekedLine ?? streamReader.ReadLine(); - } - finally - { - peekedLine = null; - } + string? line = peekedLine ?? streamReader.ReadLine(); + + peekedLine = null; + return line; } /// From 0281bf672c42d5cedf8a7ac607dec280ad4acbdd Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Wed, 6 Jul 2022 15:58:25 -0400 Subject: [PATCH 2079/2328] operate on vectors instead of vector components --- osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs index 052c7128f6..ad3a54c630 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs @@ -51,24 +51,19 @@ namespace osu.Game.Rulesets.Osu.Mods foreach (var drawable in playfield.HitObjectContainer.AliveObjects) { - float x = Math.Clamp(2 * drawable.X - cursorPos.X, 0, OsuPlayfield.BASE_SIZE.X); - float y = Math.Clamp(2 * drawable.Y - cursorPos.Y, 0, OsuPlayfield.BASE_SIZE.Y); + var destination = Vector2.Clamp(2 * drawable.Position - cursorPos, Vector2.Zero, OsuPlayfield.BASE_SIZE); if (drawable.HitObject is Slider thisSlider) { var possibleMovementBounds = OsuHitObjectGenerationUtils.CalculatePossibleMovementBounds(thisSlider); - x = possibleMovementBounds.Width < 0 - ? x - : Math.Clamp(x, possibleMovementBounds.Left, possibleMovementBounds.Right); - - y = possibleMovementBounds.Height < 0 - ? y - : Math.Clamp(y, possibleMovementBounds.Top, possibleMovementBounds.Bottom); + destination = Vector2.Clamp( + destination, + new Vector2(possibleMovementBounds.Left, possibleMovementBounds.Top), + new Vector2(possibleMovementBounds.Right, possibleMovementBounds.Bottom) + ); } - var destination = new Vector2(x, y); - switch (drawable) { case DrawableHitCircle circle: From 40e98f84f304c6288c2decbecda614f5d8b1042d Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Wed, 6 Jul 2022 16:01:08 -0400 Subject: [PATCH 2080/2328] change default strength back to 0.5 --- osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs index ad3a54c630..c53ac58752 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Mods private IFrameStableClock gameplayClock; [SettingSource("Repulsion strength", "How strong the repulsion is.", 0)] - public BindableFloat RepulsionStrength { get; } = new BindableFloat(0.6f) + public BindableFloat RepulsionStrength { get; } = new BindableFloat(0.5f) { Precision = 0.05f, MinValue = 0.05f, From 7f94405c9e4ea5bc81416b270cb9cce22a1cc4b8 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 6 Jul 2022 23:38:11 +0300 Subject: [PATCH 2081/2328] Rename method and make duration optional --- .../Skinning/Default/DefaultSpinnerDisc.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinnerDisc.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinnerDisc.cs index 03db76336c..60489c1b22 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinnerDisc.cs @@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default { base.LoadComplete(); - complete.BindValueChanged(complete => updateComplete(complete.NewValue, 200)); + complete.BindValueChanged(complete => updateDiscColour(complete.NewValue, 200)); drawableSpinner.ApplyCustomUpdateState += updateStateTransforms; updateStateTransforms(drawableSpinner, drawableSpinner.State.Value); @@ -137,7 +137,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default this.ScaleTo(initial_scale); this.RotateTo(0); - updateComplete(false, 0); + updateDiscColour(false); using (BeginDelayedSequence(spinner.TimePreempt / 2)) { @@ -182,11 +182,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default if (drawableSpinner.Result?.TimeCompleted is double completionTime) { using (BeginAbsoluteSequence(completionTime)) - updateComplete(true, 200); + updateDiscColour(true, 200); } } - private void updateComplete(bool complete, double duration) + private void updateDiscColour(bool complete, double duration = 0) { var colour = complete ? completeColour : normalColour; From d5b4d146708a5d712924d02a479f8063e152ab5a Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Wed, 6 Jul 2022 17:01:14 -0400 Subject: [PATCH 2082/2328] modify damp length to effectively invert repulsion strength --- osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs index c53ac58752..0aab019d73 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs @@ -84,7 +84,7 @@ namespace osu.Game.Rulesets.Osu.Mods private void easeTo(DrawableHitObject hitObject, Vector2 destination) { - double dampLength = Interpolation.Lerp(3000, 40, 0.8 * RepulsionStrength.Value); + double dampLength = Vector2.Distance(hitObject.Position, destination) / (0.04 * RepulsionStrength.Value + 0.04); float x = (float)Interpolation.DampContinuously(hitObject.X, destination.X, dampLength, gameplayClock.ElapsedFrameTime); float y = (float)Interpolation.DampContinuously(hitObject.Y, destination.Y, dampLength, gameplayClock.ElapsedFrameTime); From 62beae4063846c0022930925506d48435985d756 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Wed, 6 Jul 2022 17:18:21 -0400 Subject: [PATCH 2083/2328] add nullable directive --- osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs index 0aab019d73..1cb5bf31a4 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +#nullable disable + using System; using osu.Framework.Bindables; using osu.Framework.Utils; From a5b01b89201ef4ba5db1fa64f370d180aa80d567 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 7 Jul 2022 01:00:42 +0300 Subject: [PATCH 2084/2328] Improve asserts in `TestSeekPerformsInGameplayTime` to be more descriptive --- .../Gameplay/TestSceneMasterGameplayClockContainer.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs b/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs index ae431e77ae..0395ae9d99 100644 --- a/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs +++ b/osu.Game.Tests/Gameplay/TestSceneMasterGameplayClockContainer.cs @@ -9,7 +9,6 @@ using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Testing; using osu.Framework.Timing; -using osu.Framework.Utils; using osu.Game.Configuration; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Play; @@ -116,10 +115,10 @@ namespace osu.Game.Tests.Gameplay AddStep($"set audio offset to {userOffset}", () => localConfig.SetValue(OsuSetting.AudioOffset, userOffset)); AddStep("seek to 2500", () => gameplayClockContainer.Seek(2500)); - AddAssert("gameplay clock time = 2500", () => Precision.AlmostEquals(gameplayClockContainer.CurrentTime, 2500, 10f)); + AddStep("gameplay clock time = 2500", () => Assert.AreEqual(gameplayClockContainer.CurrentTime, 2500, 10f)); AddStep("seek to 10000", () => gameplayClockContainer.Seek(10000)); - AddAssert("gameplay clock time = 10000", () => Precision.AlmostEquals(gameplayClockContainer.CurrentTime, 10000, 10f)); + AddStep("gameplay clock time = 10000", () => Assert.AreEqual(gameplayClockContainer.CurrentTime, 10000, 10f)); } protected override void Dispose(bool isDisposing) From 911507291788745f1fc90f4824455b2698408186 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 7 Jul 2022 04:24:10 +0300 Subject: [PATCH 2085/2328] Fix flaky tests not running at all with environment variable set --- osu.Game/Tests/FlakyTestAttribute.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Tests/FlakyTestAttribute.cs b/osu.Game/Tests/FlakyTestAttribute.cs index 299dbb89a2..c61ce80bf5 100644 --- a/osu.Game/Tests/FlakyTestAttribute.cs +++ b/osu.Game/Tests/FlakyTestAttribute.cs @@ -18,7 +18,7 @@ namespace osu.Game.Tests } public FlakyTestAttribute(int tryCount) - : base(Environment.GetEnvironmentVariable("OSU_TESTS_FAIL_FLAKY") == "1" ? 0 : tryCount) + : base(Environment.GetEnvironmentVariable("OSU_TESTS_FAIL_FLAKY") == "1" ? 1 : tryCount) { } } From c4b6893709c15ca2aace28c40697a3ed30555911 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 14:29:15 +0900 Subject: [PATCH 2086/2328] Add local handling of cases where a beatmap's file cannot be found on disk --- osu.Game/Beatmaps/WorkingBeatmapCache.cs | 76 ++++++++++++++++++++---- 1 file changed, 65 insertions(+), 11 deletions(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmapCache.cs b/osu.Game/Beatmaps/WorkingBeatmapCache.cs index 9d31c58709..088cbd9d60 100644 --- a/osu.Game/Beatmaps/WorkingBeatmapCache.cs +++ b/osu.Game/Beatmaps/WorkingBeatmapCache.cs @@ -137,8 +137,17 @@ namespace osu.Game.Beatmaps try { - using (var stream = new LineBufferedReader(GetStream(BeatmapSetInfo.GetPathForFile(BeatmapInfo.Path)))) - return Decoder.GetDecoder(stream).Decode(stream); + string fileStorePath = BeatmapSetInfo.GetPathForFile(BeatmapInfo.Path); + var stream = GetStream(fileStorePath); + + if (stream == null) + { + Logger.Log($"Beatmap failed to load (file {BeatmapInfo.Path} not found on disk at expected location {fileStorePath}).", level: LogLevel.Error); + return null; + } + + using (var reader = new LineBufferedReader(stream)) + return Decoder.GetDecoder(reader).Decode(reader); } catch (Exception e) { @@ -154,7 +163,16 @@ namespace osu.Game.Beatmaps try { - return resources.LargeTextureStore.Get(BeatmapSetInfo.GetPathForFile(Metadata.BackgroundFile)); + string fileStorePath = BeatmapSetInfo.GetPathForFile(Metadata.BackgroundFile); + var texture = resources.LargeTextureStore.Get(fileStorePath); + + if (texture == null) + { + Logger.Log($"Beatmap background failed to load (file {Metadata.BackgroundFile} not found on disk at expected location {fileStorePath}).", level: LogLevel.Error); + return null; + } + + return texture; } catch (Exception e) { @@ -173,7 +191,16 @@ namespace osu.Game.Beatmaps try { - return resources.Tracks.Get(BeatmapSetInfo.GetPathForFile(Metadata.AudioFile)); + string fileStorePath = BeatmapSetInfo.GetPathForFile(Metadata.AudioFile); + var track = resources.Tracks.Get(fileStorePath); + + if (track == null) + { + Logger.Log($"Beatmap failed to load (file {Metadata.AudioFile} not found on disk at expected location {fileStorePath}).", level: LogLevel.Error); + return null; + } + + return track; } catch (Exception e) { @@ -192,8 +219,17 @@ namespace osu.Game.Beatmaps try { - var trackData = GetStream(BeatmapSetInfo.GetPathForFile(Metadata.AudioFile)); - return trackData == null ? null : new Waveform(trackData); + string fileStorePath = BeatmapSetInfo.GetPathForFile(Metadata.AudioFile); + + var trackData = GetStream(fileStorePath); + + if (trackData == null) + { + Logger.Log($"Beatmap waveform failed to load (file {Metadata.AudioFile} not found on disk at expected location {fileStorePath}).", level: LogLevel.Error); + return null; + } + + return new Waveform(trackData); } catch (Exception e) { @@ -211,19 +247,37 @@ namespace osu.Game.Beatmaps try { - using (var stream = new LineBufferedReader(GetStream(BeatmapSetInfo.GetPathForFile(BeatmapInfo.Path)))) + string fileStorePath = BeatmapSetInfo.GetPathForFile(BeatmapInfo.Path); + var stream = GetStream(fileStorePath); + + if (stream == null) { - var decoder = Decoder.GetDecoder(stream); + Logger.Log($"Beatmap failed to load (file {BeatmapInfo.Path} not found on disk at expected location {fileStorePath})", level: LogLevel.Error); + return null; + } + + using (var reader = new LineBufferedReader(stream)) + { + var decoder = Decoder.GetDecoder(reader); string storyboardFilename = BeatmapSetInfo?.Files.FirstOrDefault(f => f.Filename.EndsWith(".osb", StringComparison.OrdinalIgnoreCase))?.Filename; // todo: support loading from both set-wide storyboard *and* beatmap specific. if (string.IsNullOrEmpty(storyboardFilename)) - storyboard = decoder.Decode(stream); + storyboard = decoder.Decode(reader); else { - using (var secondaryStream = new LineBufferedReader(GetStream(BeatmapSetInfo.GetPathForFile(storyboardFilename)))) - storyboard = decoder.Decode(stream, secondaryStream); + string storyboardFileStorePath = BeatmapSetInfo.GetPathForFile(storyboardFilename); + var secondaryStream = GetStream(storyboardFileStorePath); + + if (secondaryStream == null) + { + Logger.Log($"Storyboard failed to load (file {storyboardFilename} not found on disk at expected location {fileStorePath})", level: LogLevel.Error); + return null; + } + + using (var secondaryReader = new LineBufferedReader(secondaryStream)) + storyboard = decoder.Decode(reader, secondaryReader); } } } From e81cebf27d4a5030cce1d2550e9895515b9acfdc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 14:33:17 +0900 Subject: [PATCH 2087/2328] Change storyboard parsing logic to not completely fail if only `.osb` read fails Changes to allow the storyboard to exist if only the `.osu` is available. Reads better IMO. --- osu.Game/Beatmaps/WorkingBeatmapCache.cs | 32 ++++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmapCache.cs b/osu.Game/Beatmaps/WorkingBeatmapCache.cs index 088cbd9d60..ce883a7092 100644 --- a/osu.Game/Beatmaps/WorkingBeatmapCache.cs +++ b/osu.Game/Beatmaps/WorkingBeatmapCache.cs @@ -248,37 +248,37 @@ namespace osu.Game.Beatmaps try { string fileStorePath = BeatmapSetInfo.GetPathForFile(BeatmapInfo.Path); - var stream = GetStream(fileStorePath); + var beatmapFileStream = GetStream(fileStorePath); - if (stream == null) + if (beatmapFileStream == null) { Logger.Log($"Beatmap failed to load (file {BeatmapInfo.Path} not found on disk at expected location {fileStorePath})", level: LogLevel.Error); return null; } - using (var reader = new LineBufferedReader(stream)) + using (var reader = new LineBufferedReader(beatmapFileStream)) { var decoder = Decoder.GetDecoder(reader); - string storyboardFilename = BeatmapSetInfo?.Files.FirstOrDefault(f => f.Filename.EndsWith(".osb", StringComparison.OrdinalIgnoreCase))?.Filename; + Stream storyboardFileStream = null; - // todo: support loading from both set-wide storyboard *and* beatmap specific. - if (string.IsNullOrEmpty(storyboardFilename)) - storyboard = decoder.Decode(reader); - else + if (BeatmapSetInfo?.Files.FirstOrDefault(f => f.Filename.EndsWith(".osb", StringComparison.OrdinalIgnoreCase))?.Filename is string storyboardFilename) { - string storyboardFileStorePath = BeatmapSetInfo.GetPathForFile(storyboardFilename); - var secondaryStream = GetStream(storyboardFileStorePath); + string storyboardFileStorePath = BeatmapSetInfo?.GetPathForFile(storyboardFilename); + storyboardFileStream = GetStream(storyboardFileStorePath); - if (secondaryStream == null) - { - Logger.Log($"Storyboard failed to load (file {storyboardFilename} not found on disk at expected location {fileStorePath})", level: LogLevel.Error); - return null; - } + if (storyboardFileStream == null) + Logger.Log($"Storyboard failed to load (file {storyboardFilename} not found on disk at expected location {storyboardFileStorePath})", level: LogLevel.Error); + } - using (var secondaryReader = new LineBufferedReader(secondaryStream)) + if (storyboardFileStream != null) + { + // Stand-alone storyboard was found, so parse in addition to the beatmap's local storyboard. + using (var secondaryReader = new LineBufferedReader(storyboardFileStream)) storyboard = decoder.Decode(reader, secondaryReader); } + else + storyboard = decoder.Decode(reader); } } catch (Exception e) From e1b434b5dc3b685dc55b2d806fa8fb72fd852ee7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 14:46:51 +0900 Subject: [PATCH 2088/2328] Fix song select placeholder not showing convert hint for custom rulesets --- osu.Game/Screens/Select/NoResultsPlaceholder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/NoResultsPlaceholder.cs b/osu.Game/Screens/Select/NoResultsPlaceholder.cs index 5d5eafd2e6..b8b589ff99 100644 --- a/osu.Game/Screens/Select/NoResultsPlaceholder.cs +++ b/osu.Game/Screens/Select/NoResultsPlaceholder.cs @@ -135,7 +135,7 @@ namespace osu.Game.Screens.Select // TODO: Add realm queries to hint at which ruleset results are available in (and allow clicking to switch). // TODO: Make this message more certain by ensuring the osu! beatmaps exist before suggesting. - if (filter?.Ruleset?.OnlineID > 0 && !filter.AllowConvertedBeatmaps) + if (filter?.Ruleset?.OnlineID != 0 && filter?.AllowConvertedBeatmaps == false) { textFlow.AddParagraph("- Try"); textFlow.AddLink(" enabling ", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, true)); From 9d730f84400b236e0cabd8a8f01dc4fd6e78d09c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 14:49:22 +0900 Subject: [PATCH 2089/2328] Fix custom rulesets not importing scores at all Replaces the error with the ability to import, minus replays. Closes https://github.com/ppy/osu/issues/17350 (arguably, but let's go with it for now). --- osu.Game/Screens/Play/Player.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 4040adc48d..b4016fc1cf 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -22,6 +22,7 @@ using osu.Framework.Threading; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Configuration; +using osu.Game.Extensions; using osu.Game.Graphics.Containers; using osu.Game.IO.Archives; using osu.Game.Online.API; @@ -1064,12 +1065,15 @@ namespace osu.Game.Screens.Play if (DrawableRuleset.ReplayScore != null) return Task.CompletedTask; - LegacyByteArrayReader replayReader; + LegacyByteArrayReader replayReader = null; - using (var stream = new MemoryStream()) + if (score.ScoreInfo.Ruleset.IsLegacyRuleset()) { - new LegacyScoreEncoder(score, GameplayState.Beatmap).Encode(stream); - replayReader = new LegacyByteArrayReader(stream.ToArray(), "replay.osr"); + using (var stream = new MemoryStream()) + { + new LegacyScoreEncoder(score, GameplayState.Beatmap).Encode(stream); + replayReader = new LegacyByteArrayReader(stream.ToArray(), "replay.osr"); + } } // the import process will re-attach managed beatmap/rulesets to this score. we don't want this for now, so create a temporary copy to import. From f88e2aa025e676ad2f3d82c459fd3b25420f1a24 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 15:02:03 +0900 Subject: [PATCH 2090/2328] Remove EF test workaround --- .../Gameplay/TestScenePlayerScoreSubmission.cs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs index e0c8989389..501ad9bd28 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs @@ -363,23 +363,9 @@ namespace osu.Game.Tests.Visual.Gameplay await AllowImportCompletion.WaitAsync().ConfigureAwait(false); - ImportedScore = score; + await base.ImportScore(score); - // It was discovered that Score members could sometimes be half-populated. - // In particular, the RulesetID property could be set to 0 even on non-osu! maps. - // We want to test that the state of that property is consistent in this test. - // EF makes this impossible. - // - // First off, because of the EF navigational property-explicit foreign key field duality, - // it can happen that - for example - the Ruleset navigational property is correctly initialised to mania, - // but the RulesetID foreign key property is not initialised and remains 0. - // EF silently bypasses this by prioritising the Ruleset navigational property over the RulesetID foreign key one. - // - // Additionally, adding an entity to an EF DbSet CAUSES SIDE EFFECTS with regard to the foreign key property. - // In the above instance, if a ScoreInfo with Ruleset = {mania} and RulesetID = 0 is attached to an EF context, - // RulesetID WILL BE SILENTLY SET TO THE CORRECT VALUE of 3. - // - // For the above reasons, actual importing is disabled in this test. + ImportedScore = score; } } } From 1a41d3ef209302df0976302c15f96b5604272615 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 16:42:36 +0900 Subject: [PATCH 2091/2328] Allow `PlayerTestScene` to import the beatmap it's using --- osu.Game/Tests/Visual/PlayerTestScene.cs | 27 +++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/osu.Game/Tests/Visual/PlayerTestScene.cs b/osu.Game/Tests/Visual/PlayerTestScene.cs index e1714299b6..036ac8a639 100644 --- a/osu.Game/Tests/Visual/PlayerTestScene.cs +++ b/osu.Game/Tests/Visual/PlayerTestScene.cs @@ -4,12 +4,15 @@ #nullable disable using System; +using System.Diagnostics; using System.Linq; using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Testing; +using osu.Game.Beatmaps; using osu.Game.Configuration; +using osu.Game.Database; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; @@ -22,6 +25,11 @@ namespace osu.Game.Tests.Visual /// protected virtual bool HasCustomSteps => false; + /// + /// WARNING: ONLY WORKS IF RUN HEADLESS because reasons. + /// + protected virtual bool ImportBeatmapToDatabase => false; + protected TestPlayer Player; protected OsuConfigManager LocalConfig; @@ -49,7 +57,7 @@ namespace osu.Game.Tests.Visual action?.Invoke(); - AddStep(CreatePlayerRuleset().Description, LoadPlayer); + AddStep($"Load player for {CreatePlayerRuleset().Description}", LoadPlayer); AddUntilStep("player loaded", () => Player.IsLoaded && Player.Alpha == 1); } @@ -57,6 +65,9 @@ namespace osu.Game.Tests.Visual protected virtual bool Autoplay => false; + [Resolved] + private BeatmapManager beatmaps { get; set; } + protected void LoadPlayer() { var ruleset = CreatePlayerRuleset(); @@ -64,6 +75,20 @@ namespace osu.Game.Tests.Visual var beatmap = CreateBeatmap(ruleset.RulesetInfo); + if (ImportBeatmapToDatabase) + { + Debug.Assert(beatmap.BeatmapInfo.BeatmapSet != null); + + var imported = beatmaps.Import(beatmap.BeatmapInfo.BeatmapSet); + + Debug.Assert(imported != null); + + beatmap.BeatmapInfo = null; + beatmap.Difficulty = null; + + beatmap.BeatmapInfo = imported.Value.Detach().Beatmaps.First(); + } + Beatmap.Value = CreateWorkingBeatmap(beatmap); SelectedMods.Value = Array.Empty(); From 461d133c1f0a9a736bfa265e5c7dd060d6dd68b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 16:42:48 +0900 Subject: [PATCH 2092/2328] Add test coverage of score importing --- .../TestScenePlayerLocalScoreImport.cs | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs new file mode 100644 index 0000000000..61f0483c86 --- /dev/null +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs @@ -0,0 +1,72 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using NUnit.Framework; +using osu.Framework.Screens; +using osu.Framework.Testing; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu; +using osu.Game.Scoring; +using osu.Game.Screens.Ranking; + +namespace osu.Game.Tests.Visual.Gameplay +{ + [HeadlessTest] // Importing rulesets doesn't work in interactive flows. + public class TestScenePlayerLocalScoreImport : PlayerTestScene + { + private Ruleset? customRuleset; + + protected override bool ImportBeatmapToDatabase => true; + + protected override Ruleset CreatePlayerRuleset() => customRuleset ?? new OsuRuleset(); + + protected override TestPlayer CreatePlayer(Ruleset ruleset) => new TestPlayer(false); + + protected override bool HasCustomSteps => true; + + protected override bool AllowFail => false; + + [Test] + public void TestScoreStoredLocally() + { + AddStep("set no custom ruleset", () => customRuleset = null); + + CreateTest(); + + AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning); + + AddStep("seek to completion", () => Player.GameplayClockContainer.Seek(Player.DrawableRuleset.Objects.Last().GetEndTime())); + + AddUntilStep("results displayed", () => Player.GetChildScreen() is ResultsScreen); + AddUntilStep("score in database", () => Realm.Run(r => r.Find(Player.Score.ScoreInfo.ID) != null)); + } + + [Test] + public void TestScoreStoredLocallyCustomRuleset() + { + Ruleset createCustomRuleset() => new OsuRuleset + { + RulesetInfo = + { + Name = "custom", + ShortName = "custom", + OnlineID = -1 + } + }; + + AddStep("import custom ruleset", () => Realm.Write(r => r.Add(createCustomRuleset().RulesetInfo))); + AddStep("set custom ruleset", () => customRuleset = createCustomRuleset()); + + CreateTest(); + + AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning); + + AddStep("seek to completion", () => Player.GameplayClockContainer.Seek(Player.DrawableRuleset.Objects.Last().GetEndTime())); + + AddUntilStep("results displayed", () => Player.GetChildScreen() is ResultsScreen); + AddUntilStep("score in database", () => Realm.Run(r => r.All().Count() == 1)); + } + } +} From b663986b9fd2922ca3a29e4de95af012c04f30a6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Apr 2022 16:12:06 +0900 Subject: [PATCH 2093/2328] Add test coverage of locally available without replay button handling --- .../Gameplay/TestSceneReplayDownloadButton.cs | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs index 10a6b196b0..c259d5f0a8 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs @@ -142,6 +142,28 @@ namespace osu.Game.Tests.Visual.Gameplay AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType().First().Enabled.Value); } + [Test] + public void TestLocallyAvailableWithoutReplay() + { + Live imported = null; + + AddStep("import score", () => imported = scoreManager.Import(getScoreInfo(false, false))); + + AddStep("create button without replay", () => + { + Child = downloadButton = new TestReplayDownloadButton(imported.Value) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }; + }); + + AddUntilStep("wait for load", () => downloadButton.IsLoaded); + + AddUntilStep("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded); + AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType().First().Enabled.Value); + } + [Test] public void TestScoreImportThenDelete() { @@ -189,11 +211,11 @@ namespace osu.Game.Tests.Visual.Gameplay AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType().First().Enabled.Value); } - private ScoreInfo getScoreInfo(bool replayAvailable) + private ScoreInfo getScoreInfo(bool replayAvailable, bool hasOnlineId = true) { return new APIScore { - OnlineID = online_score_id, + OnlineID = hasOnlineId ? online_score_id : 0, RulesetID = 0, Beatmap = CreateAPIBeatmapSet(new OsuRuleset().RulesetInfo).Beatmaps.First(), HasReplay = replayAvailable, From 45c5b7e7dd4061157195b9f4f5a1a5fb388467f1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 17:13:16 +0900 Subject: [PATCH 2094/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 398c1d91dd..8c15ed7949 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index ed6577651a..06b022ea44 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 7d70b96f62..9085205bbc 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 7ef03dd2cbe7b723d09ae898f8bced3d13812d2b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Jul 2022 16:32:53 +0900 Subject: [PATCH 2095/2328] Use fire-and-forget async operations on global track This avoids any blocking overhead caused by a backlogged audio thread. Test seem to pass so might be okay? Note that order is still guaranteed due to the `ensureUpdateThread` queueing system framework-side. --- osu.Game/Overlays/MusicController.cs | 8 ++++---- osu.Game/Tests/Visual/OsuTestScene.cs | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 4a10f30a7a..8af295dfe8 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -133,9 +133,9 @@ namespace osu.Game.Overlays UserPauseRequested = false; if (restart) - CurrentTrack.Restart(); + CurrentTrack.RestartAsync(); else if (!IsPlaying) - CurrentTrack.Start(); + CurrentTrack.StartAsync(); return true; } @@ -152,7 +152,7 @@ namespace osu.Game.Overlays { UserPauseRequested |= requestedByUser; if (CurrentTrack.IsRunning) - CurrentTrack.Stop(); + CurrentTrack.StopAsync(); } /// @@ -250,7 +250,7 @@ namespace osu.Game.Overlays { // if not scheduled, the previously track will be stopped one frame later (see ScheduleAfterChildren logic in GameBase). // we probably want to move this to a central method for switching to a new working beatmap in the future. - Schedule(() => CurrentTrack.Restart()); + Schedule(() => CurrentTrack.RestartAsync()); } private WorkingBeatmap current; diff --git a/osu.Game/Tests/Visual/OsuTestScene.cs b/osu.Game/Tests/Visual/OsuTestScene.cs index c13cdff820..012c512266 100644 --- a/osu.Game/Tests/Visual/OsuTestScene.cs +++ b/osu.Game/Tests/Visual/OsuTestScene.cs @@ -430,11 +430,19 @@ namespace osu.Game.Tests.Visual return accumulated == seek; } + public override Task SeekAsync(double seek) => Task.FromResult(Seek(seek)); + public override void Start() { running = true; } + public override Task StartAsync() + { + Start(); + return Task.CompletedTask; + } + public override void Reset() { Seek(0); @@ -450,6 +458,12 @@ namespace osu.Game.Tests.Visual } } + public override Task StopAsync() + { + Stop(); + return Task.CompletedTask; + } + public override bool IsRunning => running; private double? lastReferenceTime; From 5197d0fa9e1afbc25f004b56413121a9637b386a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 17:32:48 +0900 Subject: [PATCH 2096/2328] Add automatic transaction handling to realm helper methods --- osu.Game.Tests/Database/RealmLiveTests.cs | 19 ++++++++++++ osu.Game/Database/RealmExtensions.cs | 35 ++++++++++++++++++++--- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Database/RealmLiveTests.cs b/osu.Game.Tests/Database/RealmLiveTests.cs index a50eb22c67..d15e038723 100644 --- a/osu.Game.Tests/Database/RealmLiveTests.cs +++ b/osu.Game.Tests/Database/RealmLiveTests.cs @@ -59,6 +59,25 @@ namespace osu.Game.Tests.Database }); } + [Test] + public void TestNestedWriteCalls() + { + RunTestWithRealm((realm, _) => + { + var beatmap = new BeatmapInfo(CreateRuleset(), new BeatmapDifficulty(), new BeatmapMetadata()); + + var liveBeatmap = beatmap.ToLive(realm); + + realm.Run(r => + r.Write(_ => + r.Write(_ => + r.Add(beatmap))) + ); + + Assert.IsFalse(liveBeatmap.PerformRead(l => l.Hidden)); + }); + } + [Test] public void TestAccessAfterAttach() { diff --git a/osu.Game/Database/RealmExtensions.cs b/osu.Game/Database/RealmExtensions.cs index 73e9f16d33..2cd81b6af1 100644 --- a/osu.Game/Database/RealmExtensions.cs +++ b/osu.Game/Database/RealmExtensions.cs @@ -8,18 +8,45 @@ namespace osu.Game.Database { public static class RealmExtensions { + /// + /// Perform a write operation against the provided realm instance. + /// + /// + /// This will automatically start a transaction if not already in one. + /// + /// The realm to operate on. + /// The write operation to run. public static void Write(this Realm realm, Action function) { - using var transaction = realm.BeginWrite(); + Transaction? transaction = null; + + if (!realm.IsInTransaction) + transaction = realm.BeginWrite(); + function(realm); - transaction.Commit(); + + transaction?.Commit(); } + /// + /// Perform a write operation against the provided realm instance. + /// + /// + /// This will automatically start a transaction if not already in one. + /// + /// The realm to operate on. + /// The write operation to run. public static T Write(this Realm realm, Func function) { - using var transaction = realm.BeginWrite(); + Transaction? transaction = null; + + if (!realm.IsInTransaction) + transaction = realm.BeginWrite(); + var result = function(realm); - transaction.Commit(); + + transaction?.Commit(); + return result; } From e2c4c94993e61234c42b08d359681ce12df39fa0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 17:37:46 +0900 Subject: [PATCH 2097/2328] Simplify `BeatmapUpdater` transaction handling using nested transaction support --- osu.Game/Beatmaps/BeatmapUpdater.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapUpdater.cs b/osu.Game/Beatmaps/BeatmapUpdater.cs index d0ec44a034..978c6de35c 100644 --- a/osu.Game/Beatmaps/BeatmapUpdater.cs +++ b/osu.Game/Beatmaps/BeatmapUpdater.cs @@ -52,15 +52,7 @@ namespace osu.Game.Beatmaps /// /// Run all processing on a beatmap immediately. /// - public void Process(BeatmapSetInfo beatmapSet) - { - if (beatmapSet.Realm.IsInTransaction) - Process(beatmapSet, beatmapSet.Realm); - else - beatmapSet.Realm.Write(r => Process(beatmapSet, r)); - } - - public void Process(BeatmapSetInfo beatmapSet, Realm realm) + public void Process(BeatmapSetInfo beatmapSet) => beatmapSet.Realm.Write(r => { // Before we use below, we want to invalidate. workingBeatmapCache.Invalidate(beatmapSet); @@ -85,7 +77,7 @@ namespace osu.Game.Beatmaps // And invalidate again afterwards as re-fetching the most up-to-date database metadata will be required. workingBeatmapCache.Invalidate(beatmapSet); - } + }); private double calculateLength(IBeatmap b) { From 57b2f8189c4bdd3dd91bf00b035c3810ec44cb19 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 17:40:47 +0900 Subject: [PATCH 2098/2328] Add back test workaround for `TestScenePlayerScoreSubmission` with updated explanation This reverts commit f88e2aa025e676ad2f3d82c459fd3b25420f1a24. --- .../Visual/Gameplay/TestScenePlayerScoreSubmission.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs index 501ad9bd28..96efca6b65 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs @@ -363,9 +363,11 @@ namespace osu.Game.Tests.Visual.Gameplay await AllowImportCompletion.WaitAsync().ConfigureAwait(false); - await base.ImportScore(score); - ImportedScore = score; + + // Calling base.ImportScore is omitted as it will fail for the test method which uses a custom ruleset. + // This can be resolved by doing something similar to what TestScenePlayerLocalScoreImport is doing, + // but requires a bit of restructuring. } } } From dd5b127fb5e3e742053ff17b3965b4ecabd1bcc6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 17:51:49 +0900 Subject: [PATCH 2099/2328] Update various tests to enable NRT to avoid new inspection failures --- .../Visual/Editing/TestSceneComposeScreen.cs | 4 +-- .../Editing/TestSceneEditorBeatmapCreation.cs | 34 +++++++++---------- .../TestSceneMultiSpectatorScreen.cs | 21 ++++++------ .../Multiplayer/TestSceneMultiplayer.cs | 24 ++++++------- .../TestSceneMultiplayerParticipantsList.cs | 10 +++--- .../Online/TestSceneLeaderboardModSelector.cs | 4 +-- 6 files changed, 44 insertions(+), 53 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs b/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs index 6b5d9af7af..291630fa3a 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneComposeScreen.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Linq; using NUnit.Framework; @@ -24,7 +22,7 @@ namespace osu.Game.Tests.Visual.Editing [TestFixture] public class TestSceneComposeScreen : EditorClockTestScene { - private EditorBeatmap editorBeatmap; + private EditorBeatmap editorBeatmap = null!; [Cached] private EditorClipboard clipboard = new EditorClipboard(); diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs index 2707682b4c..f565ca3ef4 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.IO; using System.Linq; @@ -39,7 +37,9 @@ namespace osu.Game.Tests.Visual.Editing protected override bool IsolateSavingFromDatabase => false; [Resolved] - private BeatmapManager beatmapManager { get; set; } + private BeatmapManager beatmapManager { get; set; } = null!; + + private Guid currentBeatmapSetID => EditorBeatmap.BeatmapInfo.BeatmapSet?.ID ?? Guid.Empty; public override void SetUpSteps() { @@ -50,19 +50,19 @@ namespace osu.Game.Tests.Visual.Editing AddStep("make new beatmap unique", () => EditorBeatmap.Metadata.Title = Guid.NewGuid().ToString()); } - protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null) => new DummyWorkingBeatmap(Audio, null); + protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard? storyboard = null) => new DummyWorkingBeatmap(Audio, null); [Test] public void TestCreateNewBeatmap() { AddStep("save beatmap", () => Editor.Save()); - AddAssert("new beatmap in database", () => beatmapManager.QueryBeatmapSet(s => s.ID == EditorBeatmap.BeatmapInfo.BeatmapSet.ID)?.Value.DeletePending == false); + AddAssert("new beatmap in database", () => beatmapManager.QueryBeatmapSet(s => s.ID == currentBeatmapSetID)?.Value.DeletePending == false); } [Test] public void TestExitWithoutSave() { - EditorBeatmap editorBeatmap = null; + EditorBeatmap editorBeatmap = null!; AddStep("store editor beatmap", () => editorBeatmap = EditorBeatmap); @@ -78,7 +78,7 @@ namespace osu.Game.Tests.Visual.Editing AddUntilStep("wait for exit", () => !Editor.IsCurrentScreen()); AddStep("release", () => InputManager.ReleaseButton(MouseButton.Left)); - AddAssert("new beatmap not persisted", () => beatmapManager.QueryBeatmapSet(s => s.ID == editorBeatmap.BeatmapInfo.BeatmapSet.ID)?.Value.DeletePending == true); + AddAssert("new beatmap not persisted", () => beatmapManager.QueryBeatmapSet(s => s.ID == editorBeatmap.BeatmapInfo.BeatmapSet.AsNonNull().ID)?.Value.DeletePending == true); } [Test] @@ -160,7 +160,7 @@ namespace osu.Game.Tests.Visual.Editing AddAssert("new beatmap persisted", () => { var beatmap = beatmapManager.QueryBeatmap(b => b.DifficultyName == firstDifficultyName); - var set = beatmapManager.QueryBeatmapSet(s => s.ID == EditorBeatmap.BeatmapInfo.BeatmapSet.ID); + var set = beatmapManager.QueryBeatmapSet(s => s.ID == currentBeatmapSetID); return beatmap != null && beatmap.DifficultyName == firstDifficultyName @@ -179,7 +179,7 @@ namespace osu.Game.Tests.Visual.Editing AddUntilStep("wait for created", () => { - string difficultyName = Editor.ChildrenOfType().SingleOrDefault()?.BeatmapInfo.DifficultyName; + string? difficultyName = Editor.ChildrenOfType().SingleOrDefault()?.BeatmapInfo.DifficultyName; return difficultyName != null && difficultyName != firstDifficultyName; }); @@ -195,7 +195,7 @@ namespace osu.Game.Tests.Visual.Editing AddAssert("new beatmap persisted", () => { var beatmap = beatmapManager.QueryBeatmap(b => b.DifficultyName == secondDifficultyName); - var set = beatmapManager.QueryBeatmapSet(s => s.ID == EditorBeatmap.BeatmapInfo.BeatmapSet.ID); + var set = beatmapManager.QueryBeatmapSet(s => s.ID == currentBeatmapSetID); return beatmap != null && beatmap.DifficultyName == secondDifficultyName @@ -246,7 +246,7 @@ namespace osu.Game.Tests.Visual.Editing AddAssert("new beatmap persisted", () => { var beatmap = beatmapManager.QueryBeatmap(b => b.DifficultyName == originalDifficultyName); - var set = beatmapManager.QueryBeatmapSet(s => s.ID == EditorBeatmap.BeatmapInfo.BeatmapSet.ID); + var set = beatmapManager.QueryBeatmapSet(s => s.ID == currentBeatmapSetID); return beatmap != null && beatmap.DifficultyName == originalDifficultyName @@ -262,7 +262,7 @@ namespace osu.Game.Tests.Visual.Editing AddUntilStep("wait for created", () => { - string difficultyName = Editor.ChildrenOfType().SingleOrDefault()?.BeatmapInfo.DifficultyName; + string? difficultyName = Editor.ChildrenOfType().SingleOrDefault()?.BeatmapInfo.DifficultyName; return difficultyName != null && difficultyName != originalDifficultyName; }); @@ -281,13 +281,13 @@ namespace osu.Game.Tests.Visual.Editing AddStep("save beatmap", () => Editor.Save()); - BeatmapInfo refetchedBeatmap = null; - Live refetchedBeatmapSet = null; + BeatmapInfo? refetchedBeatmap = null; + Live? refetchedBeatmapSet = null; AddStep("refetch from database", () => { refetchedBeatmap = beatmapManager.QueryBeatmap(b => b.DifficultyName == copyDifficultyName); - refetchedBeatmapSet = beatmapManager.QueryBeatmapSet(s => s.ID == EditorBeatmap.BeatmapInfo.BeatmapSet.ID); + refetchedBeatmapSet = beatmapManager.QueryBeatmapSet(s => s.ID == currentBeatmapSetID); }); AddAssert("new beatmap persisted", () => @@ -323,7 +323,7 @@ namespace osu.Game.Tests.Visual.Editing AddUntilStep("wait for created", () => { - string difficultyName = Editor.ChildrenOfType().SingleOrDefault()?.BeatmapInfo.DifficultyName; + string? difficultyName = Editor.ChildrenOfType().SingleOrDefault()?.BeatmapInfo.DifficultyName; return difficultyName != null && difficultyName != "New Difficulty"; }); AddAssert("new difficulty has correct name", () => EditorBeatmap.BeatmapInfo.DifficultyName == "New Difficulty (1)"); @@ -359,7 +359,7 @@ namespace osu.Game.Tests.Visual.Editing AddUntilStep("wait for created", () => { - string difficultyName = Editor.ChildrenOfType().SingleOrDefault()?.BeatmapInfo.DifficultyName; + string? difficultyName = Editor.ChildrenOfType().SingleOrDefault()?.BeatmapInfo.DifficultyName; return difficultyName != null && difficultyName != duplicate_difficulty_name; }); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs index 877c986d61..7df68392cf 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; using System.Linq; @@ -33,20 +31,21 @@ namespace osu.Game.Tests.Visual.Multiplayer public class TestSceneMultiSpectatorScreen : MultiplayerTestScene { [Resolved] - private OsuGameBase game { get; set; } + private OsuGameBase game { get; set; } = null!; [Resolved] - private OsuConfigManager config { get; set; } + private OsuConfigManager config { get; set; } = null!; [Resolved] - private BeatmapManager beatmapManager { get; set; } + private BeatmapManager beatmapManager { get; set; } = null!; - private MultiSpectatorScreen spectatorScreen; + private MultiSpectatorScreen spectatorScreen = null!; private readonly List playingUsers = new List(); - private BeatmapSetInfo importedSet; - private BeatmapInfo importedBeatmap; + private BeatmapSetInfo importedSet = null!; + private BeatmapInfo importedBeatmap = null!; + private int importedBeatmapId; [BackgroundDependencyLoader] @@ -340,7 +339,7 @@ namespace osu.Game.Tests.Visual.Multiplayer sendFrames(getPlayerIds(count), 300); } - Player player = null; + Player? player = null; AddStep($"get {PLAYER_1_ID} player instance", () => player = getInstance(PLAYER_1_ID).ChildrenOfType().Single()); @@ -369,7 +368,7 @@ namespace osu.Game.Tests.Visual.Multiplayer b.Storyboard.GetLayer("Background").Add(sprite); }); - private void testLeadIn(Action applyToBeatmap = null) + private void testLeadIn(Action? applyToBeatmap = null) { start(PLAYER_1_ID); @@ -387,7 +386,7 @@ namespace osu.Game.Tests.Visual.Multiplayer assertRunning(PLAYER_1_ID); } - private void loadSpectateScreen(bool waitForPlayerLoad = true, Action applyToBeatmap = null) + private void loadSpectateScreen(bool waitForPlayerLoad = true, Action? applyToBeatmap = null) { AddStep("load screen", () => { diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs index da48fb7332..a2793acba7 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Diagnostics; using System.Linq; @@ -51,17 +49,17 @@ namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneMultiplayer : ScreenTestScene { - private BeatmapManager beatmaps; - private RulesetStore rulesets; - private BeatmapSetInfo importedSet; + private BeatmapManager beatmaps = null!; + private RulesetStore rulesets = null!; + private BeatmapSetInfo importedSet = null!; - private TestMultiplayerComponents multiplayerComponents; + private TestMultiplayerComponents multiplayerComponents = null!; private TestMultiplayerClient multiplayerClient => multiplayerComponents.MultiplayerClient; private TestMultiplayerRoomManager roomManager => multiplayerComponents.RoomManager; [Resolved] - private OsuConfigManager config { get; set; } + private OsuConfigManager config { get; set; } = null!; [BackgroundDependencyLoader] private void load(GameHost host, AudioManager audio) @@ -146,7 +144,7 @@ namespace osu.Game.Tests.Visual.Multiplayer private void removeLastUser() { - APIUser lastUser = multiplayerClient.ServerRoom?.Users.Last().User; + APIUser? lastUser = multiplayerClient.ServerRoom?.Users.Last().User; if (lastUser == null || lastUser == multiplayerClient.LocalUser?.User) return; @@ -156,7 +154,7 @@ namespace osu.Game.Tests.Visual.Multiplayer private void kickLastUser() { - APIUser lastUser = multiplayerClient.ServerRoom?.Users.Last().User; + APIUser? lastUser = multiplayerClient.ServerRoom?.Users.Last().User; if (lastUser == null || lastUser == multiplayerClient.LocalUser?.User) return; @@ -351,7 +349,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("select room", () => InputManager.Key(Key.Down)); AddStep("join room", () => InputManager.Key(Key.Enter)); - DrawableLoungeRoom.PasswordEntryPopover passwordEntryPopover = null; + DrawableLoungeRoom.PasswordEntryPopover? passwordEntryPopover = null; AddUntilStep("password prompt appeared", () => (passwordEntryPopover = InputManager.ChildrenOfType().FirstOrDefault()) != null); AddStep("enter password in text box", () => passwordEntryPopover.ChildrenOfType().First().Text = "password"); AddStep("press join room button", () => passwordEntryPopover.ChildrenOfType().First().TriggerClick()); @@ -678,7 +676,7 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestGameplayExitFlow() { - Bindable holdDelay = null; + Bindable? holdDelay = null; AddStep("Set hold delay to zero", () => { @@ -709,7 +707,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("wait for lounge", () => multiplayerComponents.CurrentScreen is Screens.OnlinePlay.Multiplayer.Multiplayer); AddStep("stop holding", () => InputManager.ReleaseKey(Key.Escape)); - AddStep("set hold delay to default", () => holdDelay.SetDefault()); + AddStep("set hold delay to default", () => holdDelay?.SetDefault()); } [Test] @@ -992,7 +990,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddUntilStep("wait for ready button to be enabled", () => readyButton.Enabled.Value); MultiplayerUserState lastState = MultiplayerUserState.Idle; - MultiplayerRoomUser user = null; + MultiplayerRoomUser? user = null; AddStep("click ready button", () => { diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs index 7db18d1127..a70dfd78c5 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using System.Linq; using NUnit.Framework; @@ -66,7 +64,7 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestRemoveUser() { - APIUser secondUser = null; + APIUser? secondUser = null; AddStep("add a user", () => { @@ -80,7 +78,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("remove host", () => MultiplayerClient.RemoveUser(API.LocalUser.Value)); - AddAssert("single panel is for second user", () => this.ChildrenOfType().Single().User.UserID == secondUser.Id); + AddAssert("single panel is for second user", () => this.ChildrenOfType().Single().User.UserID == secondUser?.Id); } [Test] @@ -368,7 +366,7 @@ namespace osu.Game.Tests.Visual.Multiplayer private void createNewParticipantsList() { - ParticipantsList participantsList = null; + ParticipantsList? participantsList = null; AddStep("create new list", () => Child = participantsList = new ParticipantsList { @@ -378,7 +376,7 @@ namespace osu.Game.Tests.Visual.Multiplayer Size = new Vector2(380, 0.7f) }); - AddUntilStep("wait for list to load", () => participantsList.IsLoaded); + AddUntilStep("wait for list to load", () => participantsList?.IsLoaded == true); } private void checkProgressBarVisibility(bool visible) => diff --git a/osu.Game.Tests/Visual/Online/TestSceneLeaderboardModSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneLeaderboardModSelector.cs index 8ab8276b9c..10d9a5664e 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneLeaderboardModSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneLeaderboardModSelector.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Game.Overlays.BeatmapSet; using System.Collections.Specialized; using System.Linq; @@ -29,7 +27,7 @@ namespace osu.Game.Tests.Visual.Online LeaderboardModSelector modSelector; FillFlowContainer selectedMods; - var ruleset = new Bindable(); + var ruleset = new Bindable(); Add(selectedMods = new FillFlowContainer { From b5c703b62cb409adb2dad3adba5e751af4f8a965 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 17:59:55 +0900 Subject: [PATCH 2100/2328] Remove unused using statement --- osu.Game/Beatmaps/BeatmapUpdater.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapUpdater.cs b/osu.Game/Beatmaps/BeatmapUpdater.cs index 978c6de35c..20fa0bc7c6 100644 --- a/osu.Game/Beatmaps/BeatmapUpdater.cs +++ b/osu.Game/Beatmaps/BeatmapUpdater.cs @@ -10,7 +10,6 @@ using osu.Framework.Platform; using osu.Game.Database; using osu.Game.Online.API; using osu.Game.Rulesets.Objects; -using Realms; namespace osu.Game.Beatmaps { From ac216d94a81db5e896b13cebf997b0d00d50c986 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 18:15:15 +0900 Subject: [PATCH 2101/2328] Fix transaction not being disposed --- osu.Game.Tests/Database/RealmLiveTests.cs | 18 +++++++++++++ osu.Game/Database/RealmExtensions.cs | 32 ++++++++++++++++------- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Database/RealmLiveTests.cs b/osu.Game.Tests/Database/RealmLiveTests.cs index d15e038723..aec8c0b1e1 100644 --- a/osu.Game.Tests/Database/RealmLiveTests.cs +++ b/osu.Game.Tests/Database/RealmLiveTests.cs @@ -59,6 +59,24 @@ namespace osu.Game.Tests.Database }); } + [Test] + public void TestFailedWritePerformsRollback() + { + RunTestWithRealm((realm, _) => + { + Assert.Throws(() => + { + realm.Write(r => + { + r.Add(new BeatmapInfo(CreateRuleset(), new BeatmapDifficulty(), new BeatmapMetadata())); + throw new InvalidOperationException(); + }); + }); + + Assert.That(realm.Run(r => r.All()), Is.Empty); + }); + } + [Test] public void TestNestedWriteCalls() { diff --git a/osu.Game/Database/RealmExtensions.cs b/osu.Game/Database/RealmExtensions.cs index 2cd81b6af1..13c4defb83 100644 --- a/osu.Game/Database/RealmExtensions.cs +++ b/osu.Game/Database/RealmExtensions.cs @@ -20,12 +20,19 @@ namespace osu.Game.Database { Transaction? transaction = null; - if (!realm.IsInTransaction) - transaction = realm.BeginWrite(); + try + { + if (!realm.IsInTransaction) + transaction = realm.BeginWrite(); - function(realm); + function(realm); - transaction?.Commit(); + transaction?.Commit(); + } + finally + { + transaction?.Dispose(); + } } /// @@ -40,14 +47,21 @@ namespace osu.Game.Database { Transaction? transaction = null; - if (!realm.IsInTransaction) - transaction = realm.BeginWrite(); + try + { + if (!realm.IsInTransaction) + transaction = realm.BeginWrite(); - var result = function(realm); + var result = function(realm); - transaction?.Commit(); + transaction?.Commit(); - return result; + return result; + } + finally + { + transaction?.Dispose(); + } } /// From bf10f2db2ed2148ba47e6652c467e4c341a6d654 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 18:19:01 +0900 Subject: [PATCH 2102/2328] Add test coverage of nested rollback for good measure --- osu.Game.Tests/Database/RealmLiveTests.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/osu.Game.Tests/Database/RealmLiveTests.cs b/osu.Game.Tests/Database/RealmLiveTests.cs index aec8c0b1e1..3615cebe6a 100644 --- a/osu.Game.Tests/Database/RealmLiveTests.cs +++ b/osu.Game.Tests/Database/RealmLiveTests.cs @@ -77,6 +77,27 @@ namespace osu.Game.Tests.Database }); } + [Test] + public void TestFailedNestedWritePerformsRollback() + { + RunTestWithRealm((realm, _) => + { + Assert.Throws(() => + { + realm.Write(r => + { + realm.Write(_ => + { + r.Add(new BeatmapInfo(CreateRuleset(), new BeatmapDifficulty(), new BeatmapMetadata())); + throw new InvalidOperationException(); + }); + }); + }); + + Assert.That(realm.Run(r => r.All()), Is.Empty); + }); + } + [Test] public void TestNestedWriteCalls() { From d88fd8a5b08201ffd44cd1349302bb850b69789c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 18:26:04 +0900 Subject: [PATCH 2103/2328] Allow searching for "skins" to find current skin setting --- osu.Game/Overlays/Settings/Sections/SkinSection.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index 741b6b5815..d23ef7e3e7 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -62,7 +62,8 @@ namespace osu.Game.Overlays.Settings.Sections { skinDropdown = new SkinSettingsDropdown { - LabelText = SkinSettingsStrings.CurrentSkin + LabelText = SkinSettingsStrings.CurrentSkin, + Keywords = new[] { @"skins" } }, new SettingsButton { From cf1da1dd18bc7d9e3824acae4c94b53f45eebd4a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Jul 2022 22:38:54 +0900 Subject: [PATCH 2104/2328] Fix skins potentially being duplicated on batch import Resolves https://github.com/ppy/osu/discussions/19024#discussioncomment-3099200 --- osu.Game/Database/RealmArchiveModelImporter.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Database/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs index 76f6db1384..ce3d0652b3 100644 --- a/osu.Game/Database/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -258,15 +258,13 @@ namespace osu.Game.Database { cancellationToken.ThrowIfCancellationRequested(); - bool checkedExisting = false; - TModel? existing = null; + TModel? existing; if (batchImport && archive != null) { // this is a fast bail condition to improve large import performance. item.Hash = computeHashFast(archive); - checkedExisting = true; existing = CheckForExisting(item, realm); if (existing != null) @@ -311,8 +309,12 @@ namespace osu.Game.Database // TODO: we may want to run this outside of the transaction. Populate(item, archive, realm, cancellationToken); - if (!checkedExisting) - existing = CheckForExisting(item, realm); + // Populate() may have adjusted file content (see SkinImporter.updateSkinIniMetadata), so regardless of whether a fast check was done earlier, let's + // check for existing items a second time. + // + // If this is ever a performance issue, the fast-check hash can be compared and trigger a skip of this second check if it still matches. + // I don't think it is a huge deal doing a second indexed check, though. + existing = CheckForExisting(item, realm); if (existing != null) { From cd4755fbd9151bde922444827d63550cdfe7b9bd Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 7 Jul 2022 18:06:32 +0300 Subject: [PATCH 2105/2328] Add test coverage for batch-import path --- osu.Game.Tests/Skins/IO/ImportSkinTest.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Skins/IO/ImportSkinTest.cs b/osu.Game.Tests/Skins/IO/ImportSkinTest.cs index 8b7fcae1a9..c3c10215a5 100644 --- a/osu.Game.Tests/Skins/IO/ImportSkinTest.cs +++ b/osu.Game.Tests/Skins/IO/ImportSkinTest.cs @@ -83,20 +83,20 @@ namespace osu.Game.Tests.Skins.IO #region Cases where imports should match existing [Test] - public Task TestImportTwiceWithSameMetadataAndFilename() => runSkinTest(async osu => + public Task TestImportTwiceWithSameMetadataAndFilename([Values] bool batchImport) => runSkinTest(async osu => { - var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("test skin", "skinner"), "skin.osk")); - var import2 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("test skin", "skinner"), "skin.osk")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("test skin", "skinner"), "skin.osk"), batchImport); + var import2 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("test skin", "skinner"), "skin.osk"), batchImport); assertImportedOnce(import1, import2); }); [Test] - public Task TestImportTwiceWithNoMetadataSameDownloadFilename() => runSkinTest(async osu => + public Task TestImportTwiceWithNoMetadataSameDownloadFilename([Values] bool batchImport) => runSkinTest(async osu => { // if a user downloads two skins that do have skin.ini files but don't have any creator metadata in the skin.ini, they should both import separately just for safety. - var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni(string.Empty, string.Empty), "download.osk")); - var import2 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni(string.Empty, string.Empty), "download.osk")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni(string.Empty, string.Empty), "download.osk"), batchImport); + var import2 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni(string.Empty, string.Empty), "download.osk"), batchImport); assertImportedOnce(import1, import2); }); @@ -134,10 +134,10 @@ namespace osu.Game.Tests.Skins.IO }); [Test] - public Task TestSameMetadataNameSameFolderName() => runSkinTest(async osu => + public Task TestSameMetadataNameSameFolderName([Values] bool batchImport) => runSkinTest(async osu => { - var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("name 1", "author 1"), "my custom skin 1")); - var import2 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("name 1", "author 1"), "my custom skin 1")); + var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("name 1", "author 1"), "my custom skin 1"), batchImport); + var import2 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("name 1", "author 1"), "my custom skin 1"), batchImport); assertImportedOnce(import1, import2); assertCorrectMetadata(import1, "name 1 [my custom skin 1]", "author 1", osu); @@ -357,10 +357,10 @@ namespace osu.Game.Tests.Skins.IO } } - private async Task> loadSkinIntoOsu(OsuGameBase osu, ImportTask import) + private async Task> loadSkinIntoOsu(OsuGameBase osu, ImportTask import, bool batchImport = false) { var skinManager = osu.Dependencies.Get(); - return await skinManager.Import(import); + return await skinManager.Import(import, batchImport); } } } From f500d5ade6d613376502ade4bee55fa179301092 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Jul 2022 01:06:39 +0900 Subject: [PATCH 2106/2328] Simplify error output when hub cannot connect Full call stack is useless in these cases. Before: ```csharp [network] 2022-07-07 16:05:31 [verbose]: OnlineMetadataClient connection error: System.Net.Http.HttpRequestException: Response status code does not indicate success: 403 (Forbidden). [network] 2022-07-07 16:05:31 [verbose]: at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode() [network] 2022-07-07 16:05:31 [verbose]: at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.NegotiateAsync(Uri url, HttpClient httpClient, ILogger logger, CancellationToken cancellationToken) [network] 2022-07-07 16:05:31 [verbose]: at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.GetNegotiationResponseAsync(Uri uri, CancellationToken cancellationToken) [network] 2022-07-07 16:05:31 [verbose]: at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.SelectAndStartTransport(TransferFormat transferFormat, CancellationToken cancellationToken) [network] 2022-07-07 16:05:31 [verbose]: at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsyncCore(TransferFormat transferFormat, CancellationToken cancellationToken) [network] 2022-07-07 16:05:31 [verbose]: at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsync(TransferFormat transferFormat, CancellationToken cancellationToken) [network] 2022-07-07 16:05:31 [verbose]: at Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionFactory.ConnectAsync(EndPoint endPoint, CancellationToken cancellationToken) [network] 2022-07-07 16:05:31 [verbose]: at Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionFactory.ConnectAsync(EndPoint endPoint, CancellationToken cancellationToken) [network] 2022-07-07 16:05:31 [verbose]: at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncCore(CancellationToken cancellationToken) [network] 2022-07-07 16:05:31 [verbose]: at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncInner(CancellationToken cancellationToken) [network] 2022-07-07 16:05:31 [verbose]: at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsync(CancellationToken cancellationToken) [network] 2022-07-07 16:05:31 [verbose]: at osu.Game.Online.HubClientConnector.connect() in /Users/dean/Projects/osu/osu.Game/Online/HubClientConnector.cs:line 119 ``` After: ```csharp [network] 2022-07-07 16:06:59 [verbose]: OnlineMetadataClient connecting... [network] 2022-07-07 16:06:59 [verbose]: OnlineMetadataClient connect attempt failed: Response status code does not indicate success: 403 (Forbidden). ``` --- osu.Game/Online/HubClientConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/HubClientConnector.cs b/osu.Game/Online/HubClientConnector.cs index 61e9eaa8c0..01f0f3a902 100644 --- a/osu.Game/Online/HubClientConnector.cs +++ b/osu.Game/Online/HubClientConnector.cs @@ -144,7 +144,7 @@ namespace osu.Game.Online /// private async Task handleErrorAndDelay(Exception exception, CancellationToken cancellationToken) { - Logger.Log($"{clientName} connection error: {exception}", LoggingTarget.Network); + Logger.Log($"{clientName} connect attempt failed: {exception.Message}", LoggingTarget.Network); await Task.Delay(5000, cancellationToken).ConfigureAwait(false); } From b83073c2e91b482a035705faf4d7d397330215e0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Jul 2022 01:37:43 +0900 Subject: [PATCH 2107/2328] Fix `SeasonalBackgroundLoader` triggering a background reload when not providing backgrounds --- osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs b/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs index f2caf10e91..bfea3a722c 100644 --- a/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs +++ b/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs @@ -41,7 +41,11 @@ namespace osu.Game.Graphics.Backgrounds seasonalBackgroundMode.BindValueChanged(_ => SeasonalBackgroundChanged?.Invoke()); seasonalBackgrounds = sessionStatics.GetBindable(Static.SeasonalBackgrounds); - seasonalBackgrounds.BindValueChanged(_ => SeasonalBackgroundChanged?.Invoke()); + seasonalBackgrounds.BindValueChanged(response => + { + if (response.NewValue?.Backgrounds?.Count > 0) + SeasonalBackgroundChanged?.Invoke(); + }); apiState.BindTo(api.State); apiState.BindValueChanged(fetchSeasonalBackgrounds, true); From 789904ccd1cddc31fcf650f3793248f3533520c1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Jul 2022 01:39:09 +0900 Subject: [PATCH 2108/2328] Avoid reloading background unnecessariyl when not yet loaded --- .../Backgrounds/BackgroundScreenDefault.cs | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 95bcb2ab29..6f133bcb67 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -7,6 +7,7 @@ using System.Threading; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Logging; using osu.Framework.Threading; using osu.Framework.Utils; using osu.Game.Beatmaps; @@ -26,7 +27,7 @@ namespace osu.Game.Screens.Backgrounds private const int background_count = 7; private IBindable user; private Bindable skin; - private Bindable mode; + private Bindable source; private Bindable introSequence; private readonly SeasonalBackgroundLoader seasonalBackgroundLoader = new SeasonalBackgroundLoader(); @@ -45,14 +46,14 @@ namespace osu.Game.Screens.Backgrounds { user = api.LocalUser.GetBoundCopy(); skin = skinManager.CurrentSkin.GetBoundCopy(); - mode = config.GetBindable(OsuSetting.MenuBackgroundSource); + source = config.GetBindable(OsuSetting.MenuBackgroundSource); introSequence = config.GetBindable(OsuSetting.IntroSequence); AddInternal(seasonalBackgroundLoader); user.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired); skin.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired); - mode.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired); + source.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired); beatmap.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired); introSequence.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired); seasonalBackgroundLoader.SeasonalBackgroundChanged += () => Scheduler.AddOnce(loadNextIfRequired); @@ -62,7 +63,13 @@ namespace osu.Game.Screens.Backgrounds Next(); // helper function required for AddOnce usage. - void loadNextIfRequired() => Next(); + void loadNextIfRequired() + { + if (!IsLoaded) + return; + + Next(); + } } private ScheduledDelegate nextTask; @@ -80,6 +87,8 @@ namespace osu.Game.Screens.Backgrounds if (nextBackground == background) return false; + Logger.Log("🌅 Background change queued"); + cancellationTokenSource?.Cancel(); cancellationTokenSource = new CancellationTokenSource(); @@ -108,12 +117,12 @@ namespace osu.Game.Screens.Backgrounds if (newBackground == null && user.Value?.IsSupporter == true) { - switch (mode.Value) + switch (source.Value) { case BackgroundSource.Beatmap: case BackgroundSource.BeatmapWithStoryboard: { - if (mode.Value == BackgroundSource.BeatmapWithStoryboard && AllowStoryboardBackground) + if (source.Value == BackgroundSource.BeatmapWithStoryboard && AllowStoryboardBackground) newBackground = new BeatmapBackgroundWithStoryboard(beatmap.Value, getBackgroundTextureName()); newBackground ??= new BeatmapBackground(beatmap.Value, getBackgroundTextureName()); From 216150b52dab2cdf04df29fbf087221e144c64c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Jul 2022 02:00:02 +0900 Subject: [PATCH 2109/2328] Avoid always loading new background at `MainMenu` This was meant to be an optimisation to allow the background to load while the intro is playing, but as the current default intro loads a background itself, this was rarely the case and also counter-productive as it would bypass the equality check and start a second load sequence. --- osu.Game/Screens/Menu/MainMenu.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index ba63902b46..066a37055c 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -65,9 +65,7 @@ namespace osu.Game.Screens.Menu [Resolved(canBeNull: true)] private IDialogOverlay dialogOverlay { get; set; } - private BackgroundScreenDefault background; - - protected override BackgroundScreen CreateBackground() => background; + protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(); protected override bool PlayExitSound => false; @@ -148,7 +146,6 @@ namespace osu.Game.Screens.Menu Buttons.OnSettings = () => settings?.ToggleVisibility(); Buttons.OnBeatmapListing = () => beatmapListing?.ToggleVisibility(); - LoadComponentAsync(background = new BackgroundScreenDefault()); preloadSongSelect(); } From 15d070668d6401a166abcac63750268c0ea4a8e9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Jul 2022 02:01:51 +0900 Subject: [PATCH 2110/2328] Move intro screen background to base implementation and use colour fading --- osu.Game/Screens/Menu/IntroScreen.cs | 20 ++++++++++++++-- osu.Game/Screens/Menu/IntroTriangles.cs | 32 ++++++------------------- osu.Game/Screens/Menu/IntroWelcome.cs | 19 ++------------- 3 files changed, 27 insertions(+), 44 deletions(-) diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs index c81195bbd3..e4cf26f2ce 100644 --- a/osu.Game/Screens/Menu/IntroScreen.cs +++ b/osu.Game/Screens/Menu/IntroScreen.cs @@ -88,6 +88,11 @@ namespace osu.Game.Screens.Menu /// protected bool UsingThemedIntro { get; private set; } + protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(false) + { + Colour = Color4.Black + }; + protected IntroScreen([CanBeNull] Func createNextScreen = null) { this.createNextScreen = createNextScreen; @@ -201,6 +206,8 @@ namespace osu.Game.Screens.Menu { this.FadeIn(300); + ApplyToBackground(b => b.FadeColour(Color4.Black)); + double fadeOutTime = exit_delay; var track = musicController.CurrentTrack; @@ -243,13 +250,22 @@ namespace osu.Game.Screens.Menu base.OnResuming(e); } + private bool backgroundFaded; + + protected void FadeInBackground(float fadeInTime) + { + backgroundFaded = true; + ApplyToBackground(b => b.FadeColour(Color4.White, fadeInTime)); + } + public override void OnSuspending(ScreenTransitionEvent e) { base.OnSuspending(e); initialBeatmap = null; - } - protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack(); + if (!backgroundFaded) + FadeInBackground(200); + } protected virtual void StartTrack() { diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index ad098ae8df..7a5d970ef6 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -8,19 +8,18 @@ using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Textures; using osu.Framework.Logging; -using osu.Framework.Utils; +using osu.Framework.Screens; using osu.Framework.Timing; +using osu.Framework.Utils; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets; -using osu.Game.Screens.Backgrounds; using osuTK; using osuTK.Graphics; @@ -32,16 +31,9 @@ namespace osu.Game.Screens.Menu protected override string BeatmapFile => "triangles.osz"; - protected override BackgroundScreen CreateBackground() => background = new BackgroundScreenDefault(false) - { - Alpha = 0, - }; - [Resolved] private AudioManager audio { get; set; } - private BackgroundScreenDefault background; - private Sample welcome; private DecoupleableInterpolatingFramedClock decoupledClock; @@ -75,7 +67,7 @@ namespace osu.Game.Screens.Menu if (UsingThemedIntro) decoupledClock.ChangeSource(Track); - LoadComponentAsync(intro = new TrianglesIntroSequence(logo, background) + LoadComponentAsync(intro = new TrianglesIntroSequence(logo, () => FadeInBackground(0)) { RelativeSizeAxes = Axes.Both, Clock = decoupledClock, @@ -95,19 +87,10 @@ namespace osu.Game.Screens.Menu { base.OnSuspending(e); - // ensure the background is shown, even if the TriangleIntroSequence failed to do so. - background.ApplyToBackground(b => b.Show()); - // important as there is a clock attached to a track which will likely be disposed before returning to this screen. intro.Expire(); } - public override void OnResuming(ScreenTransitionEvent e) - { - base.OnResuming(e); - background.FadeOut(100); - } - protected override void StartTrack() { decoupledClock.Start(); @@ -116,7 +99,7 @@ namespace osu.Game.Screens.Menu private class TrianglesIntroSequence : CompositeDrawable { private readonly OsuLogo logo; - private readonly BackgroundScreenDefault background; + private readonly Action showBackgroundAction; private OsuSpriteText welcomeText; private RulesetFlow rulesets; @@ -128,10 +111,10 @@ namespace osu.Game.Screens.Menu public Action LoadMenu; - public TrianglesIntroSequence(OsuLogo logo, BackgroundScreenDefault background) + public TrianglesIntroSequence(OsuLogo logo, Action showBackgroundAction) { this.logo = logo; - this.background = background; + this.showBackgroundAction = showBackgroundAction; } [Resolved] @@ -205,7 +188,6 @@ namespace osu.Game.Screens.Menu rulesets.Hide(); lazerLogo.Hide(); - background.ApplyToBackground(b => b.Hide()); using (BeginAbsoluteSequence(0)) { @@ -267,7 +249,7 @@ namespace osu.Game.Screens.Menu logo.FadeIn(); - background.ApplyToBackground(b => b.Show()); + showBackgroundAction(); game.Add(new GameWideFlash()); diff --git a/osu.Game/Screens/Menu/IntroWelcome.cs b/osu.Game/Screens/Menu/IntroWelcome.cs index 031c8d7902..9e56a3a0b7 100644 --- a/osu.Game/Screens/Menu/IntroWelcome.cs +++ b/osu.Game/Screens/Menu/IntroWelcome.cs @@ -5,11 +5,9 @@ using System; using JetBrains.Annotations; -using osuTK; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -17,8 +15,8 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Audio; using osu.Game.Online.API; -using osu.Game.Screens.Backgrounds; using osu.Game.Skinning; +using osuTK; using osuTK.Graphics; namespace osu.Game.Screens.Menu @@ -35,13 +33,6 @@ namespace osu.Game.Screens.Menu private ISample pianoReverb; protected override string SeeyaSampleName => "Intro/Welcome/seeya"; - protected override BackgroundScreen CreateBackground() => background = new BackgroundScreenDefault(false) - { - Alpha = 0, - }; - - private BackgroundScreenDefault background; - public IntroWelcome([CanBeNull] Func createNextScreen = null) : base(createNextScreen) { @@ -100,7 +91,7 @@ namespace osu.Game.Screens.Menu logo.ScaleTo(1); logo.FadeIn(fade_in_time); - background.FadeIn(fade_in_time); + FadeInBackground(fade_in_time); LoadMenu(); }, delay_step_two); @@ -108,12 +99,6 @@ namespace osu.Game.Screens.Menu } } - public override void OnResuming(ScreenTransitionEvent e) - { - base.OnResuming(e); - background.FadeOut(100); - } - private class WelcomeIntroSequence : Container { private Drawable welcomeText; From c53dd4a70315775e603f6806322ffa7e9346c07e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Jul 2022 02:31:33 +0900 Subject: [PATCH 2111/2328] Fix editor saving not updating `BeatmapSetInfo`'s hash --- osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs | 2 ++ osu.Game/Beatmaps/BeatmapManager.cs | 2 ++ osu.Game/Database/RealmArchiveModelImporter.cs | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs index bcf02cd814..8e325838ff 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs @@ -40,6 +40,8 @@ namespace osu.Game.Tests.Visual.Editing SaveEditor(); + AddAssert("Hash updated", () => !string.IsNullOrEmpty(EditorBeatmap.BeatmapInfo.BeatmapSet?.Hash)); + AddAssert("Beatmap has correct metadata", () => EditorBeatmap.BeatmapInfo.Metadata.Artist == "artist" && EditorBeatmap.BeatmapInfo.Metadata.Title == "title"); AddAssert("Beatmap has correct author", () => EditorBeatmap.BeatmapInfo.Metadata.Author.Username == "author"); AddAssert("Beatmap has correct difficulty name", () => EditorBeatmap.BeatmapInfo.DifficultyName == "difficulty"); diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index b1acf78ec6..30456afd2f 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -316,6 +316,8 @@ namespace osu.Game.Beatmaps AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo)); + setInfo.Hash = beatmapImporter.ComputeHash(setInfo); + Realm.Write(r => { var liveBeatmapSet = r.Find(setInfo.ID); diff --git a/osu.Game/Database/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs index 76f6db1384..27cd565d90 100644 --- a/osu.Game/Database/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -386,7 +386,7 @@ namespace osu.Game.Database /// /// In the case of no matching files, a hash will be generated from the passed archive's . /// - protected string ComputeHash(TModel item) + public string ComputeHash(TModel item) { // for now, concatenate all hashable files in the set to create a unique hash. MemoryStream hashable = new MemoryStream(); From 07a08d28c635110b9cc25c1c4ed253c3dfa49e10 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 7 Jul 2022 23:31:04 +0300 Subject: [PATCH 2112/2328] Rename parameter and default to 0 --- osu.Game/Screens/Menu/IntroScreen.cs | 4 ++-- osu.Game/Screens/Menu/IntroTriangles.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs index e4cf26f2ce..25d577afb5 100644 --- a/osu.Game/Screens/Menu/IntroScreen.cs +++ b/osu.Game/Screens/Menu/IntroScreen.cs @@ -252,10 +252,10 @@ namespace osu.Game.Screens.Menu private bool backgroundFaded; - protected void FadeInBackground(float fadeInTime) + protected void FadeInBackground(float duration = 0) { + ApplyToBackground(b => b.FadeColour(Color4.White, duration)); backgroundFaded = true; - ApplyToBackground(b => b.FadeColour(Color4.White, fadeInTime)); } public override void OnSuspending(ScreenTransitionEvent e) diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index 7a5d970ef6..3cdf51a87c 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -67,7 +67,7 @@ namespace osu.Game.Screens.Menu if (UsingThemedIntro) decoupledClock.ChangeSource(Track); - LoadComponentAsync(intro = new TrianglesIntroSequence(logo, () => FadeInBackground(0)) + LoadComponentAsync(intro = new TrianglesIntroSequence(logo, () => FadeInBackground()) { RelativeSizeAxes = Axes.Both, Clock = decoupledClock, From a94fb62be380cdfc2e6af8475f1baf4ee881c482 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 8 Jul 2022 01:39:43 +0300 Subject: [PATCH 2113/2328] Split collection toggle menu item to own class --- .../Collections/CollectionToggleMenuItem.cs | 20 +++++++++++++++++++ .../Carousel/DrawableCarouselBeatmap.cs | 16 +-------------- 2 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 osu.Game/Collections/CollectionToggleMenuItem.cs diff --git a/osu.Game/Collections/CollectionToggleMenuItem.cs b/osu.Game/Collections/CollectionToggleMenuItem.cs new file mode 100644 index 0000000000..34f749c9f8 --- /dev/null +++ b/osu.Game/Collections/CollectionToggleMenuItem.cs @@ -0,0 +1,20 @@ +using osu.Game.Beatmaps; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Collections +{ + public class CollectionToggleMenuItem : ToggleMenuItem + { + public CollectionToggleMenuItem(BeatmapCollection collection, IBeatmapInfo beatmap) + : base(collection.Name.Value, MenuItemType.Standard, s => + { + if (s) + collection.BeatmapHashes.Add(beatmap.MD5Hash); + else + collection.BeatmapHashes.Remove(beatmap.MD5Hash); + }) + { + State.Value = collection.BeatmapHashes.Contains(beatmap.MD5Hash); + } + } +} diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 1b3cab20e8..a6532ee145 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -244,7 +244,7 @@ namespace osu.Game.Screens.Select.Carousel if (collectionManager != null) { - var collectionItems = collectionManager.Collections.Select(createCollectionMenuItem).ToList(); + var collectionItems = collectionManager.Collections.Select(c => new CollectionToggleMenuItem(c, beatmapInfo)).Cast().ToList(); if (manageCollectionsDialog != null) collectionItems.Add(new OsuMenuItem("Manage...", MenuItemType.Standard, manageCollectionsDialog.Show)); @@ -258,20 +258,6 @@ namespace osu.Game.Screens.Select.Carousel } } - private MenuItem createCollectionMenuItem(BeatmapCollection collection) - { - return new ToggleMenuItem(collection.Name.Value, MenuItemType.Standard, s => - { - if (s) - collection.BeatmapHashes.Add(beatmapInfo.MD5Hash); - else - collection.BeatmapHashes.Remove(beatmapInfo.MD5Hash); - }) - { - State = { Value = collection.BeatmapHashes.Contains(beatmapInfo.MD5Hash) } - }; - } - protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); From 1d0f2e359a5925b4e672202266a99ff32f4e265d Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 8 Jul 2022 01:40:11 +0300 Subject: [PATCH 2114/2328] Add collection context menu to room playlist items --- .../OnlinePlay/DrawableRoomPlaylistItem.cs | 48 ++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs index a3a176477e..455e1f3481 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; @@ -15,11 +16,13 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Framework.Logging; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; +using osu.Game.Collections; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -38,7 +41,7 @@ using osuTK.Graphics; namespace osu.Game.Screens.OnlinePlay { - public class DrawableRoomPlaylistItem : OsuRearrangeableListItem + public class DrawableRoomPlaylistItem : OsuRearrangeableListItem, IHasContextMenu { public const float HEIGHT = 50; @@ -90,6 +93,8 @@ namespace osu.Game.Screens.OnlinePlay private PanelBackground panelBackground; private FillFlowContainer mainFillFlow; + private BeatmapDownloadTracker downloadTracker; + [Resolved] private RulesetStore rulesets { get; set; } @@ -102,6 +107,12 @@ namespace osu.Game.Screens.OnlinePlay [Resolved] private BeatmapLookupCache beatmapLookupCache { get; set; } + [Resolved(CanBeNull = true)] + private CollectionManager collectionManager { get; set; } + + [Resolved(CanBeNull = true)] + private ManageCollectionsDialog manageCollectionsDialog { get; set; } + protected override bool ShouldBeConsideredForInput(Drawable child) => AllowReordering || AllowDeletion || !AllowSelection || SelectedItem.Value == Model; public DrawableRoomPlaylistItem(PlaylistItem item) @@ -304,6 +315,15 @@ namespace osu.Game.Screens.OnlinePlay difficultyIconContainer.FadeInFromZero(500, Easing.OutQuint); mainFillFlow.FadeInFromZero(500, Easing.OutQuint); + + downloadTracker?.RemoveAndDisposeImmediately(); + + if (beatmap != null) + { + Debug.Assert(beatmap.BeatmapSet != null); + downloadTracker = new BeatmapDownloadTracker(beatmap.BeatmapSet); + AddInternal(downloadTracker); + } } protected override Drawable CreateContent() @@ -433,7 +453,7 @@ namespace osu.Game.Screens.OnlinePlay } } }, - } + }, }; } @@ -470,6 +490,30 @@ namespace osu.Game.Screens.OnlinePlay return true; } + public MenuItem[] ContextMenuItems + { + get + { + List items = new List(); + + if (beatmap != null && collectionManager != null) + { + if (downloadTracker.State.Value == DownloadState.LocallyAvailable) + { + var collectionItems = collectionManager.Collections.Select(c => new CollectionToggleMenuItem(c, beatmap)).Cast().ToList(); + if (manageCollectionsDialog != null) + collectionItems.Add(new OsuMenuItem("Manage...", MenuItemType.Standard, manageCollectionsDialog.Show)); + + items.Add(new OsuMenuItem("Collections") { Items = collectionItems }); + } + else + items.Add(new OsuMenuItem("Download to add to collection") { Action = { Disabled = true } }); + } + + return items.ToArray(); + } + } + public class PlaylistEditButton : GrayButton { public PlaylistEditButton() From 7b08501eafb31c76cec7842a4f87e35f28c81cee Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 8 Jul 2022 01:42:11 +0300 Subject: [PATCH 2115/2328] Cover online-play room screens with context menu containers --- .../Multiplayer/MultiplayerMatchSubScreen.cs | 227 ++++++++-------- .../Playlists/PlaylistsRoomSubScreen.cs | 247 +++++++++--------- 2 files changed, 242 insertions(+), 232 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs index 869548c948..4eb16a854b 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs @@ -15,6 +15,7 @@ using osu.Framework.Screens; using osu.Framework.Threading; using osu.Game.Beatmaps; using osu.Game.Configuration; +using osu.Game.Graphics.Cursor; using osu.Game.Online; using osu.Game.Online.Multiplayer; using osu.Game.Online.Rooms; @@ -81,134 +82,138 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Horizontal = 5, Vertical = 10 }, - Child = new GridContainer + Child = new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, - ColumnDimensions = new[] + Child = new GridContainer { - new Dimension(), - new Dimension(GridSizeMode.Absolute, 10), - new Dimension(), - new Dimension(GridSizeMode.Absolute, 10), - new Dimension(), - }, - Content = new[] - { - new Drawable[] + RelativeSizeAxes = Axes.Both, + ColumnDimensions = new[] { - // Participants column - new GridContainer + new Dimension(), + new Dimension(GridSizeMode.Absolute, 10), + new Dimension(), + new Dimension(GridSizeMode.Absolute, 10), + new Dimension(), + }, + Content = new[] + { + new Drawable[] { - RelativeSizeAxes = Axes.Both, - RowDimensions = new[] + // Participants column + new GridContainer { - new Dimension(GridSizeMode.AutoSize) - }, - Content = new[] - { - new Drawable[] { new ParticipantsListHeader() }, - new Drawable[] + RelativeSizeAxes = Axes.Both, + RowDimensions = new[] { - new ParticipantsList - { - RelativeSizeAxes = Axes.Both - }, - } - } - }, - // Spacer - null, - // Beatmap column - new GridContainer - { - RelativeSizeAxes = Axes.Both, - Content = new[] - { - new Drawable[] { new OverlinedHeader("Beatmap") }, - new Drawable[] - { - addItemButton = new AddItemButton - { - RelativeSizeAxes = Axes.X, - Height = 40, - Text = "Add item", - Action = () => OpenSongSelection() - }, + new Dimension(GridSizeMode.AutoSize) }, - null, - new Drawable[] + Content = new[] { - new MultiplayerPlaylist + new Drawable[] { new ParticipantsListHeader() }, + new Drawable[] { - RelativeSizeAxes = Axes.Both, - RequestEdit = item => OpenSongSelection(item.ID) - } - }, - new[] - { - UserModsSection = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Margin = new MarginPadding { Top = 10 }, - Alpha = 0, - Children = new Drawable[] + new ParticipantsList { - new OverlinedHeader("Extra mods"), - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(10, 0), - Children = new Drawable[] - { - new UserModSelectButton - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Width = 90, - Text = "Select", - Action = ShowUserModSelect, - }, - new ModDisplay - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Current = UserMods, - Scale = new Vector2(0.8f), - }, - } - }, + RelativeSizeAxes = Axes.Both + }, + } + } + }, + // Spacer + null, + // Beatmap column + new GridContainer + { + RelativeSizeAxes = Axes.Both, + Content = new[] + { + new Drawable[] { new OverlinedHeader("Beatmap") }, + new Drawable[] + { + addItemButton = new AddItemButton + { + RelativeSizeAxes = Axes.X, + Height = 40, + Text = "Add item", + Action = () => OpenSongSelection() + }, + }, + null, + new Drawable[] + { + new MultiplayerPlaylist + { + RelativeSizeAxes = Axes.Both, + RequestEdit = item => OpenSongSelection(item.ID) } }, + new[] + { + UserModsSection = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Margin = new MarginPadding { Top = 10 }, + Alpha = 0, + Children = new Drawable[] + { + new OverlinedHeader("Extra mods"), + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(10, 0), + Children = new Drawable[] + { + new UserModSelectButton + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Width = 90, + Text = "Select", + Action = ShowUserModSelect, + }, + new ModDisplay + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Current = UserMods, + Scale = new Vector2(0.8f), + }, + } + }, + } + }, + }, }, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.Absolute, 5), + new Dimension(), + new Dimension(GridSizeMode.AutoSize), + } }, - RowDimensions = new[] + // Spacer + null, + // Main right column + new GridContainer { - new Dimension(GridSizeMode.AutoSize), - new Dimension(GridSizeMode.AutoSize), - new Dimension(GridSizeMode.Absolute, 5), - new Dimension(), - new Dimension(GridSizeMode.AutoSize), - } - }, - // Spacer - null, - // Main right column - new GridContainer - { - RelativeSizeAxes = Axes.Both, - Content = new[] - { - new Drawable[] { new OverlinedHeader("Chat") }, - new Drawable[] { new MatchChatDisplay(Room) { RelativeSizeAxes = Axes.Both } } + RelativeSizeAxes = Axes.Both, + Content = new[] + { + new Drawable[] { new OverlinedHeader("Chat") }, + new Drawable[] { new MatchChatDisplay(Room) { RelativeSizeAxes = Axes.Both } } + }, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize), + new Dimension(), + } }, - RowDimensions = new[] - { - new Dimension(GridSizeMode.AutoSize), - new Dimension(), - } - }, + } } } } diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSubScreen.cs index 8a9c4db6ad..228ecd4bf3 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSubScreen.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Logging; using osu.Framework.Screens; +using osu.Game.Graphics.Cursor; using osu.Game.Input; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Components; @@ -75,151 +76,155 @@ namespace osu.Game.Screens.OnlinePlay.Playlists { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Horizontal = 5, Vertical = 10 }, - Child = new GridContainer + Child = new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, - ColumnDimensions = new[] + Child = new GridContainer { - new Dimension(), - new Dimension(GridSizeMode.Absolute, 10), - new Dimension(), - new Dimension(GridSizeMode.Absolute, 10), - new Dimension(), - }, - Content = new[] - { - new Drawable[] + RelativeSizeAxes = Axes.Both, + ColumnDimensions = new[] { - // Playlist items column - new Container + new Dimension(), + new Dimension(GridSizeMode.Absolute, 10), + new Dimension(), + new Dimension(GridSizeMode.Absolute, 10), + new Dimension(), + }, + Content = new[] + { + new Drawable[] { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Right = 5 }, - Child = new GridContainer + // Playlist items column + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Right = 5 }, + Child = new GridContainer + { + RelativeSizeAxes = Axes.Both, + Content = new[] + { + new Drawable[] { new OverlinedPlaylistHeader(), }, + new Drawable[] + { + new DrawableRoomPlaylist + { + RelativeSizeAxes = Axes.Both, + Items = { BindTarget = Room.Playlist }, + SelectedItem = { BindTarget = SelectedItem }, + AllowSelection = true, + AllowShowingResults = true, + RequestResults = item => + { + Debug.Assert(RoomId.Value != null); + ParentScreen?.Push(new PlaylistsResultsScreen(null, RoomId.Value.Value, item, false)); + } + } + }, + }, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize), + new Dimension(), + } + } + }, + // Spacer + null, + // Middle column (mods and leaderboard) + new GridContainer { RelativeSizeAxes = Axes.Both, Content = new[] { - new Drawable[] { new OverlinedPlaylistHeader(), }, + new[] + { + UserModsSection = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Alpha = 0, + Margin = new MarginPadding { Bottom = 10 }, + Children = new Drawable[] + { + new OverlinedHeader("Extra mods"), + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(10, 0), + Children = new Drawable[] + { + new UserModSelectButton + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Width = 90, + Text = "Select", + Action = ShowUserModSelect, + }, + new ModDisplay + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Current = UserMods, + Scale = new Vector2(0.8f), + }, + } + } + } + }, + }, new Drawable[] { - new DrawableRoomPlaylist + progressSection = new FillFlowContainer { - RelativeSizeAxes = Axes.Both, - Items = { BindTarget = Room.Playlist }, - SelectedItem = { BindTarget = SelectedItem }, - AllowSelection = true, - AllowShowingResults = true, - RequestResults = item => + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Alpha = 0, + Margin = new MarginPadding { Bottom = 10 }, + Direction = FillDirection.Vertical, + Children = new Drawable[] { - Debug.Assert(RoomId.Value != null); - ParentScreen?.Push(new PlaylistsResultsScreen(null, RoomId.Value.Value, item, false)); + new OverlinedHeader("Progress"), + new RoomLocalUserInfo(), } - } + }, }, + new Drawable[] + { + new OverlinedHeader("Leaderboard") + }, + new Drawable[] { leaderboard = new MatchLeaderboard { RelativeSizeAxes = Axes.Both }, }, + }, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.AutoSize), + new Dimension(), + } + }, + // Spacer + null, + // Main right column + new GridContainer + { + RelativeSizeAxes = Axes.Both, + Content = new[] + { + new Drawable[] { new OverlinedHeader("Chat") }, + new Drawable[] { new MatchChatDisplay(Room) { RelativeSizeAxes = Axes.Both } } }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(), } - } - }, - // Spacer - null, - // Middle column (mods and leaderboard) - new GridContainer - { - RelativeSizeAxes = Axes.Both, - Content = new[] - { - new[] - { - UserModsSection = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Alpha = 0, - Margin = new MarginPadding { Bottom = 10 }, - Children = new Drawable[] - { - new OverlinedHeader("Extra mods"), - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(10, 0), - Children = new Drawable[] - { - new UserModSelectButton - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Width = 90, - Text = "Select", - Action = ShowUserModSelect, - }, - new ModDisplay - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Current = UserMods, - Scale = new Vector2(0.8f), - }, - } - } - } - }, - }, - new Drawable[] - { - progressSection = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Alpha = 0, - Margin = new MarginPadding { Bottom = 10 }, - Direction = FillDirection.Vertical, - Children = new Drawable[] - { - new OverlinedHeader("Progress"), - new RoomLocalUserInfo(), - } - }, - }, - new Drawable[] - { - new OverlinedHeader("Leaderboard") - }, - new Drawable[] { leaderboard = new MatchLeaderboard { RelativeSizeAxes = Axes.Both }, }, }, - RowDimensions = new[] - { - new Dimension(GridSizeMode.AutoSize), - new Dimension(GridSizeMode.AutoSize), - new Dimension(GridSizeMode.AutoSize), - new Dimension(), - } - }, - // Spacer - null, - // Main right column - new GridContainer - { - RelativeSizeAxes = Axes.Both, - Content = new[] - { - new Drawable[] { new OverlinedHeader("Chat") }, - new Drawable[] { new MatchChatDisplay(Room) { RelativeSizeAxes = Axes.Both } } - }, - RowDimensions = new[] - { - new Dimension(GridSizeMode.AutoSize), - new Dimension(), - } }, }, - }, + } } }; From 67fa15f231d543b342bdd8be22c53b85ce8c8b1a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 8 Jul 2022 01:42:55 +0300 Subject: [PATCH 2116/2328] Remove no longer required context menu container in `ParticipantsList` --- .../TestSceneMultiplayerParticipantsList.cs | 15 ++++++++++----- .../Participants/ParticipantsList.cs | 19 +++++++------------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs index 7db18d1127..7a64e75644 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Testing; using osu.Framework.Utils; +using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; using osu.Game.Online; using osu.Game.Online.API.Requests.Responses; @@ -370,12 +371,16 @@ namespace osu.Game.Tests.Visual.Multiplayer { ParticipantsList participantsList = null; - AddStep("create new list", () => Child = participantsList = new ParticipantsList + AddStep("create new list", () => Child = new OsuContextMenuContainer { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Y, - Size = new Vector2(380, 0.7f) + RelativeSizeAxes = Axes.Both, + Child = participantsList = new ParticipantsList + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Y, + Size = new Vector2(380, 0.7f) + } }); AddUntilStep("wait for list to load", () => participantsList.IsLoaded); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsList.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsList.cs index cda86c74bf..7c93c6084e 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsList.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsList.cs @@ -9,7 +9,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Cursor; using osuTK; namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants @@ -24,20 +23,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants [BackgroundDependencyLoader] private void load() { - InternalChild = new OsuContextMenuContainer + InternalChild = new OsuScrollContainer { RelativeSizeAxes = Axes.Both, - Child = new OsuScrollContainer + ScrollbarVisible = false, + Child = panels = new FillFlowContainer { - RelativeSizeAxes = Axes.Both, - ScrollbarVisible = false, - Child = panels = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 2) - } + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 2) } }; } From 63a06afab220c116928299a18582e4117c7be3e2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 8 Jul 2022 01:59:27 +0300 Subject: [PATCH 2117/2328] Add missing license header --- osu.Game/Collections/CollectionToggleMenuItem.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Collections/CollectionToggleMenuItem.cs b/osu.Game/Collections/CollectionToggleMenuItem.cs index 34f749c9f8..fbc935d19a 100644 --- a/osu.Game/Collections/CollectionToggleMenuItem.cs +++ b/osu.Game/Collections/CollectionToggleMenuItem.cs @@ -1,3 +1,6 @@ +// 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; using osu.Game.Graphics.UserInterface; From 1e159eb328ffa3b1aac1dba9217d5c722e344052 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Jul 2022 10:43:50 +0900 Subject: [PATCH 2118/2328] Add back fade to black duration Co-authored-by: Salman Ahmed --- osu.Game/Screens/Menu/IntroScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs index 25d577afb5..c1621ce78f 100644 --- a/osu.Game/Screens/Menu/IntroScreen.cs +++ b/osu.Game/Screens/Menu/IntroScreen.cs @@ -206,7 +206,7 @@ namespace osu.Game.Screens.Menu { this.FadeIn(300); - ApplyToBackground(b => b.FadeColour(Color4.Black)); + ApplyToBackground(b => b.FadeColour(Color4.Black, 100)); double fadeOutTime = exit_delay; From 89f1c75f7ad0cdea5e23240eeb4580c1cc0a066b Mon Sep 17 00:00:00 2001 From: Adam Baker Date: Thu, 7 Jul 2022 21:57:18 -0500 Subject: [PATCH 2119/2328] Update mod icon colors --- osu.Game/Rulesets/UI/ModIcon.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 0f21a497b0..f32c298571 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -127,33 +127,33 @@ namespace osu.Game.Rulesets.UI { default: case ModType.DifficultyIncrease: - backgroundColour = colours.Yellow; - highlightedColour = colours.YellowLight; + backgroundColour = colours.Red1; + highlightedColour = colours.Red0; break; case ModType.DifficultyReduction: - backgroundColour = colours.Green; - highlightedColour = colours.GreenLight; + backgroundColour = colours.Lime1; + highlightedColour = colours.Lime0; break; case ModType.Automation: - backgroundColour = colours.Blue; - highlightedColour = colours.BlueLight; + backgroundColour = colours.Blue1; + highlightedColour = colours.Blue0; break; case ModType.Conversion: - backgroundColour = colours.Purple; - highlightedColour = colours.PurpleLight; + backgroundColour = colours.Purple1; + highlightedColour = colours.Purple0; break; case ModType.Fun: - backgroundColour = colours.Pink; - highlightedColour = colours.PinkLight; + backgroundColour = colours.Pink1; + highlightedColour = colours.Pink0; break; case ModType.System: - backgroundColour = colours.Gray6; - highlightedColour = colours.Gray7; + backgroundColour = colours.Gray7; + highlightedColour = colours.Gray8; modIcon.Colour = colours.Yellow; break; } From 84dcd042f42267acae6271996235c76eda670521 Mon Sep 17 00:00:00 2001 From: goodtrailer Date: Thu, 7 Jul 2022 20:30:31 -0700 Subject: [PATCH 2120/2328] Protect duration calculations against unstable fps --- .../Skinning/Default/DefaultFollowCircle.cs | 2 -- .../Skinning/Legacy/LegacyFollowCircle.cs | 8 +++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs index 7dd45c295d..8bb36f8c39 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs @@ -1,13 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Logging; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables; using osuTK.Graphics; diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs index dc44c86de0..26d3f053ff 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs @@ -1,17 +1,13 @@ // 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.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Transforms; -using osu.Framework.Logging; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables; -using osuTK; namespace osu.Game.Rulesets.Osu.Skinning.Legacy { @@ -67,7 +63,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy double maxScaleDuration = parentObject.HitStateUpdateTime - Time.Current; double realScaleDuration = scale_duration; - if (tracking.NewValue && maxScaleDuration < realScaleDuration) + if (tracking.NewValue && maxScaleDuration < realScaleDuration && maxScaleDuration >= 0) realScaleDuration = maxScaleDuration; double realFadeDuration = fade_duration * realScaleDuration / fade_duration; @@ -77,6 +73,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy private void onHitObjectApplied(DrawableHitObject drawableObject) { + ClearTransformsAfter(double.MinValue); + this.ScaleTo(1f) .FadeOut(); } From 26d88aa3263c677c28e92844a8a5d4d8b40ba043 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 8 Jul 2022 14:29:15 +0900 Subject: [PATCH 2121/2328] Fix intermittent MusicController tests --- osu.Game.Tests/Visual/Menus/TestSceneMusicActionHandling.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Menus/TestSceneMusicActionHandling.cs b/osu.Game.Tests/Visual/Menus/TestSceneMusicActionHandling.cs index 14b2593fa7..720e32a242 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneMusicActionHandling.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneMusicActionHandling.cs @@ -24,10 +24,11 @@ namespace osu.Game.Tests.Visual.Menus public void TestMusicPlayAction() { AddStep("ensure playing something", () => Game.MusicController.EnsurePlayingSomething()); + AddUntilStep("music playing", () => Game.MusicController.IsPlaying); AddStep("toggle playback", () => globalActionContainer.TriggerPressed(GlobalAction.MusicPlay)); - AddAssert("music paused", () => !Game.MusicController.IsPlaying && Game.MusicController.UserPauseRequested); + AddUntilStep("music paused", () => !Game.MusicController.IsPlaying && Game.MusicController.UserPauseRequested); AddStep("toggle playback", () => globalActionContainer.TriggerPressed(GlobalAction.MusicPlay)); - AddAssert("music resumed", () => Game.MusicController.IsPlaying && !Game.MusicController.UserPauseRequested); + AddUntilStep("music resumed", () => Game.MusicController.IsPlaying && !Game.MusicController.UserPauseRequested); } [Test] From 32c77ddf717842f33a143310ce951d9ffbd014da Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Jul 2022 15:07:30 +0900 Subject: [PATCH 2122/2328] Avoid triggering `SeasonalBackgroundChanged` unless actually required --- .../Backgrounds/SeasonalBackgroundLoader.cs | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs b/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs index bfea3a722c..99af95b5fe 100644 --- a/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs +++ b/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs @@ -38,19 +38,21 @@ namespace osu.Game.Graphics.Backgrounds private void load(OsuConfigManager config, SessionStatics sessionStatics) { seasonalBackgroundMode = config.GetBindable(OsuSetting.SeasonalBackgroundMode); - seasonalBackgroundMode.BindValueChanged(_ => SeasonalBackgroundChanged?.Invoke()); + seasonalBackgroundMode.BindValueChanged(_ => triggerSeasonalBackgroundChanged()); seasonalBackgrounds = sessionStatics.GetBindable(Static.SeasonalBackgrounds); - seasonalBackgrounds.BindValueChanged(response => - { - if (response.NewValue?.Backgrounds?.Count > 0) - SeasonalBackgroundChanged?.Invoke(); - }); + seasonalBackgrounds.BindValueChanged(_ => triggerSeasonalBackgroundChanged()); apiState.BindTo(api.State); apiState.BindValueChanged(fetchSeasonalBackgrounds, true); } + private void triggerSeasonalBackgroundChanged() + { + if (shouldShowSeasonal) + SeasonalBackgroundChanged?.Invoke(); + } + private void fetchSeasonalBackgrounds(ValueChangedEvent stateChanged) { if (seasonalBackgrounds.Value != null || stateChanged.NewValue != APIState.Online) @@ -68,15 +70,10 @@ namespace osu.Game.Graphics.Backgrounds public SeasonalBackground LoadNextBackground() { - if (seasonalBackgroundMode.Value == SeasonalBackgroundMode.Never - || (seasonalBackgroundMode.Value == SeasonalBackgroundMode.Sometimes && !isInSeason)) - { + if (!shouldShowSeasonal) return null; - } - var backgrounds = seasonalBackgrounds.Value?.Backgrounds; - if (backgrounds == null || !backgrounds.Any()) - return null; + var backgrounds = seasonalBackgrounds.Value.Backgrounds; current = (current + 1) % backgrounds.Count; string url = backgrounds[current].Url; @@ -84,6 +81,20 @@ namespace osu.Game.Graphics.Backgrounds return new SeasonalBackground(url); } + private bool shouldShowSeasonal + { + get + { + if (seasonalBackgroundMode.Value == SeasonalBackgroundMode.Never) + return false; + + if (seasonalBackgroundMode.Value == SeasonalBackgroundMode.Sometimes && !isInSeason) + return false; + + return seasonalBackgrounds.Value?.Backgrounds?.Any() == true; + } + } + private bool isInSeason => seasonalBackgrounds.Value != null && DateTimeOffset.Now < seasonalBackgrounds.Value.EndDate; } From eab3eba70e9c97c79f8ed67ee16e2734ef2f1cff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Jul 2022 15:09:16 +0900 Subject: [PATCH 2123/2328] Move event handlers to `LoadComplete` --- .../Backgrounds/BackgroundScreenDefault.cs | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 6f133bcb67..c794c768c6 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -51,25 +51,24 @@ namespace osu.Game.Screens.Backgrounds AddInternal(seasonalBackgroundLoader); - user.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired); - skin.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired); - source.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired); - beatmap.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired); - introSequence.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired); - seasonalBackgroundLoader.SeasonalBackgroundChanged += () => Scheduler.AddOnce(loadNextIfRequired); - + // Load first background asynchronously as part of BDL load. currentDisplay = RNG.Next(0, background_count); - Next(); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + user.ValueChanged += _ => Scheduler.AddOnce(next); + skin.ValueChanged += _ => Scheduler.AddOnce(next); + source.ValueChanged += _ => Scheduler.AddOnce(next); + beatmap.ValueChanged += _ => Scheduler.AddOnce(next); + introSequence.ValueChanged += _ => Scheduler.AddOnce(next); + seasonalBackgroundLoader.SeasonalBackgroundChanged += () => Scheduler.AddOnce(next); // helper function required for AddOnce usage. - void loadNextIfRequired() - { - if (!IsLoaded) - return; - - Next(); - } + void next() => Next(); } private ScheduledDelegate nextTask; From e64b2b1682602020a3bd68f3af3f45c44f95d832 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Jul 2022 15:45:01 +0900 Subject: [PATCH 2124/2328] Assert that test is run headless when required --- osu.Game/Tests/Visual/PlayerTestScene.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Tests/Visual/PlayerTestScene.cs b/osu.Game/Tests/Visual/PlayerTestScene.cs index 036ac8a639..5b4d4d5c2c 100644 --- a/osu.Game/Tests/Visual/PlayerTestScene.cs +++ b/osu.Game/Tests/Visual/PlayerTestScene.cs @@ -8,6 +8,7 @@ using System.Diagnostics; using System.Linq; using JetBrains.Annotations; using osu.Framework.Allocation; +using osu.Framework.Development; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Testing; using osu.Game.Beatmaps; @@ -26,8 +27,12 @@ namespace osu.Game.Tests.Visual protected virtual bool HasCustomSteps => false; /// - /// WARNING: ONLY WORKS IF RUN HEADLESS because reasons. + /// Import the beatmap to the database before starting gameplay. Handy for testing local score storage and the likes. /// + /// + /// Only works under headless operation currently due to realm isolation difficulties. + /// If this is ever needed to change, consideration needs to be given to the fact that BeatmapManager is attached to the global realm. + /// protected virtual bool ImportBeatmapToDatabase => false; protected TestPlayer Player; @@ -77,6 +82,8 @@ namespace osu.Game.Tests.Visual if (ImportBeatmapToDatabase) { + Debug.Assert(DebugUtils.IsNUnitRunning, $@"Importing beatmaps in {nameof(PlayerTestScene)} requires headless environment."); + Debug.Assert(beatmap.BeatmapInfo.BeatmapSet != null); var imported = beatmaps.Import(beatmap.BeatmapInfo.BeatmapSet); From 7ced84b7ef1ab6735ef42ab2c9a8f066008b8d8f Mon Sep 17 00:00:00 2001 From: Adam Baker Date: Fri, 8 Jul 2022 03:23:58 -0500 Subject: [PATCH 2125/2328] Replace switch statement with ForModType In order to make `highlightedColour` dependent on the mod type color, the color is converted to an `osu.Framework.Graphics.Colour4` and calls `Lighten`. --- osu.Game/Rulesets/UI/ModIcon.cs | 38 +++++---------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index f32c298571..308122b71c 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -123,40 +123,12 @@ namespace osu.Game.Rulesets.UI modAcronym.FadeOut(); } - switch (value.Type) - { - default: - case ModType.DifficultyIncrease: - backgroundColour = colours.Red1; - highlightedColour = colours.Red0; - break; + Color4 typeColour = colours.ForModType(value.Type); + backgroundColour = typeColour; + highlightedColour = ((Colour4)typeColour).Lighten(.2f); - case ModType.DifficultyReduction: - backgroundColour = colours.Lime1; - highlightedColour = colours.Lime0; - break; - - case ModType.Automation: - backgroundColour = colours.Blue1; - highlightedColour = colours.Blue0; - break; - - case ModType.Conversion: - backgroundColour = colours.Purple1; - highlightedColour = colours.Purple0; - break; - - case ModType.Fun: - backgroundColour = colours.Pink1; - highlightedColour = colours.Pink0; - break; - - case ModType.System: - backgroundColour = colours.Gray7; - highlightedColour = colours.Gray8; - modIcon.Colour = colours.Yellow; - break; - } + if (value.Type == ModType.System) + modIcon.Colour = colours.Yellow; updateColour(); } From e4ebab92c6792253adf14d5aa0dd08b3c6bca44b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Jul 2022 18:36:46 +0900 Subject: [PATCH 2126/2328] Rename lots of weird variables --- osu.Game/Screens/Play/FailOverlay.cs | 1 + osu.Game/Screens/Play/SaveFailedScoreButton.cs | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 75b06f859d..2af5102369 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -21,6 +21,7 @@ namespace osu.Game.Screens.Play public class FailOverlay : GameplayMenuOverlay { public Func> SaveReplay; + public override string Header => "failed"; public override string Description => "you're dead, try again?"; diff --git a/osu.Game/Screens/Play/SaveFailedScoreButton.cs b/osu.Game/Screens/Play/SaveFailedScoreButton.cs index 9a30e23ddd..29d2d0df24 100644 --- a/osu.Game/Screens/Play/SaveFailedScoreButton.cs +++ b/osu.Game/Screens/Play/SaveFailedScoreButton.cs @@ -20,8 +20,8 @@ namespace osu.Game.Screens.Play { public class SaveFailedScoreButton : CompositeDrawable { - public Func> SaveReplay; - private Task saveReplayAsync; + public Func> ImportFailedScore; + private Task saveFailedScoreTask; private ScoreInfo score; private ScheduledDelegate saveScoreDelegate; @@ -31,10 +31,10 @@ namespace osu.Game.Screens.Play private DownloadButton button; private ShakeContainer shakeContainer; - public SaveFailedScoreButton(Func> sr) + public SaveFailedScoreButton(Func> requestImportFailedScore) { Size = new Vector2(50, 30); - SaveReplay = sr; + ImportFailedScore = requestImportFailedScore; } [BackgroundDependencyLoader(true)] @@ -89,17 +89,18 @@ namespace osu.Game.Screens.Play private void saveScore() { State.Value = ImportState.Importing; - saveReplayAsync = Task.Run(SaveReplay); + + saveFailedScoreTask = Task.Run(ImportFailedScore); saveScoreDelegate = new ScheduledDelegate(() => { - if (saveReplayAsync?.IsCompleted != true) + if (saveFailedScoreTask?.IsCompleted != true) // If the asynchronous preparation has not completed, keep repeating this delegate. return; saveScoreDelegate?.Cancel(); - score = saveReplayAsync.GetAwaiter().GetResult(); + score = saveFailedScoreTask.GetAwaiter().GetResult(); State.Value = score != null ? ImportState.Imported : ImportState.Failed; }, Time.Current, 50); From 13e16530a6d90c4fa341a2b3a3b7bec6e055eac4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Jul 2022 18:44:50 +0900 Subject: [PATCH 2127/2328] Revert most changes to `PlayerTestScene` --- osu.Game/Tests/Visual/PlayerTestScene.cs | 32 ------------------------ 1 file changed, 32 deletions(-) diff --git a/osu.Game/Tests/Visual/PlayerTestScene.cs b/osu.Game/Tests/Visual/PlayerTestScene.cs index 5b4d4d5c2c..a9decbae57 100644 --- a/osu.Game/Tests/Visual/PlayerTestScene.cs +++ b/osu.Game/Tests/Visual/PlayerTestScene.cs @@ -4,16 +4,12 @@ #nullable disable using System; -using System.Diagnostics; using System.Linq; using JetBrains.Annotations; using osu.Framework.Allocation; -using osu.Framework.Development; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Testing; -using osu.Game.Beatmaps; using osu.Game.Configuration; -using osu.Game.Database; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; @@ -26,15 +22,6 @@ namespace osu.Game.Tests.Visual /// protected virtual bool HasCustomSteps => false; - /// - /// Import the beatmap to the database before starting gameplay. Handy for testing local score storage and the likes. - /// - /// - /// Only works under headless operation currently due to realm isolation difficulties. - /// If this is ever needed to change, consideration needs to be given to the fact that BeatmapManager is attached to the global realm. - /// - protected virtual bool ImportBeatmapToDatabase => false; - protected TestPlayer Player; protected OsuConfigManager LocalConfig; @@ -70,9 +57,6 @@ namespace osu.Game.Tests.Visual protected virtual bool Autoplay => false; - [Resolved] - private BeatmapManager beatmaps { get; set; } - protected void LoadPlayer() { var ruleset = CreatePlayerRuleset(); @@ -80,22 +64,6 @@ namespace osu.Game.Tests.Visual var beatmap = CreateBeatmap(ruleset.RulesetInfo); - if (ImportBeatmapToDatabase) - { - Debug.Assert(DebugUtils.IsNUnitRunning, $@"Importing beatmaps in {nameof(PlayerTestScene)} requires headless environment."); - - Debug.Assert(beatmap.BeatmapInfo.BeatmapSet != null); - - var imported = beatmaps.Import(beatmap.BeatmapInfo.BeatmapSet); - - Debug.Assert(imported != null); - - beatmap.BeatmapInfo = null; - beatmap.Difficulty = null; - - beatmap.BeatmapInfo = imported.Value.Detach().Beatmaps.First(); - } - Beatmap.Value = CreateWorkingBeatmap(beatmap); SelectedMods.Value = Array.Empty(); From 3c8f06403cbe814f3f356e24f3bf055e2b275807 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Jul 2022 18:59:08 +0900 Subject: [PATCH 2128/2328] Make test work properly --- .../TestScenePlayerLocalScoreImport.cs | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs index 61f0483c86..a75d527a69 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs @@ -3,22 +3,51 @@ using System.Linq; using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Extensions; +using osu.Framework.Platform; using osu.Framework.Screens; -using osu.Framework.Testing; +using osu.Game.Beatmaps; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu; using osu.Game.Scoring; using osu.Game.Screens.Ranking; +using osu.Game.Tests.Resources; namespace osu.Game.Tests.Visual.Gameplay { - [HeadlessTest] // Importing rulesets doesn't work in interactive flows. public class TestScenePlayerLocalScoreImport : PlayerTestScene { - private Ruleset? customRuleset; + private BeatmapManager beatmaps = null!; + private RulesetStore rulesets = null!; - protected override bool ImportBeatmapToDatabase => true; + private BeatmapSetInfo? importedSet; + + [BackgroundDependencyLoader] + private void load(GameHost host, AudioManager audio) + { + Dependencies.Cache(rulesets = new RealmRulesetStore(Realm)); + Dependencies.Cache(beatmaps = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default)); + Dependencies.Cache(new ScoreManager(rulesets, () => beatmaps, LocalStorage, Realm, Scheduler)); + Dependencies.Cache(Realm); + } + + public override void SetUpSteps() + { + base.SetUpSteps(); + + AddStep("import beatmap", () => + { + beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely(); + importedSet = beatmaps.GetAllUsableBeatmapSets().First(); + }); + } + + protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => beatmaps.GetWorkingBeatmap(importedSet?.Beatmaps.First()).Beatmap; + + private Ruleset? customRuleset; protected override Ruleset CreatePlayerRuleset() => customRuleset ?? new OsuRuleset(); @@ -66,7 +95,7 @@ namespace osu.Game.Tests.Visual.Gameplay AddStep("seek to completion", () => Player.GameplayClockContainer.Seek(Player.DrawableRuleset.Objects.Last().GetEndTime())); AddUntilStep("results displayed", () => Player.GetChildScreen() is ResultsScreen); - AddUntilStep("score in database", () => Realm.Run(r => r.All().Count() == 1)); + AddUntilStep("score in database", () => Realm.Run(r => r.Find(Player.Score.ScoreInfo.ID) != null)); } } } From ac3cdf103a61bb3dced7b49c6c9f5dd0c357537c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Jul 2022 19:17:51 +0900 Subject: [PATCH 2129/2328] Fix test not failing against `master` --- .../TestScenePlayerLocalScoreImport.cs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs index a75d527a69..96b7da9c9c 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs @@ -12,6 +12,7 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu; +using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; using osu.Game.Screens.Ranking; using osu.Game.Tests.Resources; @@ -75,15 +76,7 @@ namespace osu.Game.Tests.Visual.Gameplay [Test] public void TestScoreStoredLocallyCustomRuleset() { - Ruleset createCustomRuleset() => new OsuRuleset - { - RulesetInfo = - { - Name = "custom", - ShortName = "custom", - OnlineID = -1 - } - }; + Ruleset createCustomRuleset() => new CustomRuleset(); AddStep("import custom ruleset", () => Realm.Write(r => r.Add(createCustomRuleset().RulesetInfo))); AddStep("set custom ruleset", () => customRuleset = createCustomRuleset()); @@ -97,5 +90,15 @@ namespace osu.Game.Tests.Visual.Gameplay AddUntilStep("results displayed", () => Player.GetChildScreen() is ResultsScreen); AddUntilStep("score in database", () => Realm.Run(r => r.Find(Player.Score.ScoreInfo.ID) != null)); } + + private class CustomRuleset : OsuRuleset, ILegacyRuleset + { + public override string Description => "custom"; + public override string ShortName => "custom"; + + public new int LegacyID => -1; + + public override ScoreProcessor CreateScoreProcessor() => new ScoreProcessor(this); + } } } From a38c6704c2c44ba77d88e1e263ea327082c37274 Mon Sep 17 00:00:00 2001 From: cdwcgt Date: Fri, 8 Jul 2022 21:31:35 +0900 Subject: [PATCH 2130/2328] Use ContinueWith, Check is Task empty --- .../Screens/Play/SaveFailedScoreButton.cs | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/osu.Game/Screens/Play/SaveFailedScoreButton.cs b/osu.Game/Screens/Play/SaveFailedScoreButton.cs index 29d2d0df24..98f81863d5 100644 --- a/osu.Game/Screens/Play/SaveFailedScoreButton.cs +++ b/osu.Game/Screens/Play/SaveFailedScoreButton.cs @@ -9,7 +9,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Threading; using osu.Game.Scoring; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -24,8 +23,6 @@ namespace osu.Game.Screens.Play private Task saveFailedScoreTask; private ScoreInfo score; - private ScheduledDelegate saveScoreDelegate; - protected readonly Bindable State = new Bindable(); private DownloadButton button; @@ -88,24 +85,19 @@ namespace osu.Game.Screens.Play private void saveScore() { + if (saveFailedScoreTask != null) + { + return; + } + State.Value = ImportState.Importing; saveFailedScoreTask = Task.Run(ImportFailedScore); - - saveScoreDelegate = new ScheduledDelegate(() => + saveFailedScoreTask.ContinueWith(s => Schedule(() => { - if (saveFailedScoreTask?.IsCompleted != true) - // If the asynchronous preparation has not completed, keep repeating this delegate. - return; - - saveScoreDelegate?.Cancel(); - - score = saveFailedScoreTask.GetAwaiter().GetResult(); - + score = s.GetAwaiter().GetResult(); State.Value = score != null ? ImportState.Imported : ImportState.Failed; - }, Time.Current, 50); - - Scheduler.Add(saveScoreDelegate); + })); } private void updateTooltip(ValueChangedEvent state) From 91f471ebe0747356b0f0224d703520510d9d035a Mon Sep 17 00:00:00 2001 From: cdwcgt Date: Fri, 8 Jul 2022 21:42:34 +0900 Subject: [PATCH 2131/2328] disabled button instead of shake removed `ShakeContainer` --- osu.Game/Screens/Play/SaveFailedScoreButton.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Play/SaveFailedScoreButton.cs b/osu.Game/Screens/Play/SaveFailedScoreButton.cs index 98f81863d5..bbe26ca7da 100644 --- a/osu.Game/Screens/Play/SaveFailedScoreButton.cs +++ b/osu.Game/Screens/Play/SaveFailedScoreButton.cs @@ -10,7 +10,6 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Scoring; -using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Online; using osuTK; @@ -26,7 +25,6 @@ namespace osu.Game.Screens.Play protected readonly Bindable State = new Bindable(); private DownloadButton button; - private ShakeContainer shakeContainer; public SaveFailedScoreButton(Func> requestImportFailedScore) { @@ -37,13 +35,9 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader(true)] private void load(OsuGame game) { - InternalChild = shakeContainer = new ShakeContainer + InternalChild = button = new DownloadButton { RelativeSizeAxes = Axes.Both, - Child = button = new DownloadButton - { - RelativeSizeAxes = Axes.Both, - } }; button.Action = () => @@ -55,7 +49,6 @@ namespace osu.Game.Screens.Play break; case ImportState.Importing: - shakeContainer.Shake(); break; default: @@ -106,18 +99,22 @@ namespace osu.Game.Screens.Play { case ImportState.Imported: button.TooltipText = @"Watch replay"; + button.Enabled.Value = true; break; case ImportState.Importing: button.TooltipText = @"Importing score"; + button.Enabled.Value = false; break; case ImportState.Failed: button.TooltipText = @"Import failed, click button to re-import"; + button.Enabled.Value = true; break; default: button.TooltipText = @"Save score"; + button.Enabled.Value = true; break; } } From d2406242ae12c124aaa9e9f0c35c65e7fb90b7c1 Mon Sep 17 00:00:00 2001 From: cdwcgt Date: Sat, 9 Jul 2022 00:25:11 +0900 Subject: [PATCH 2132/2328] rename updateTooltip to updateState --- osu.Game/Screens/Play/SaveFailedScoreButton.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/SaveFailedScoreButton.cs b/osu.Game/Screens/Play/SaveFailedScoreButton.cs index bbe26ca7da..256228a1cb 100644 --- a/osu.Game/Screens/Play/SaveFailedScoreButton.cs +++ b/osu.Game/Screens/Play/SaveFailedScoreButton.cs @@ -73,7 +73,7 @@ namespace osu.Game.Screens.Play break; } }, true); - State.BindValueChanged(updateTooltip, true); + State.BindValueChanged(updateState, true); } private void saveScore() @@ -93,7 +93,7 @@ namespace osu.Game.Screens.Play })); } - private void updateTooltip(ValueChangedEvent state) + private void updateState(ValueChangedEvent state) { switch (state.NewValue) { From a606d545c193d2da6ac187b71fa0d461144d7468 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Fri, 8 Jul 2022 12:00:07 -0400 Subject: [PATCH 2133/2328] update new usage of CalculatePossibleMovementBounds --- .../Utils/OsuHitObjectGenerationUtils_Reposition.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs index 436d71fda2..a9ae313a31 100644 --- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs +++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs @@ -214,7 +214,7 @@ namespace osu.Game.Rulesets.Osu.Utils RotateSlider(slider, workingObject.RotationOriginal + MathF.PI - getSliderRotation(slider)); } - possibleMovementBounds = calculatePossibleMovementBounds(slider); + possibleMovementBounds = CalculatePossibleMovementBounds(slider); } var previousPosition = workingObject.PositionModified; From 8c7aabccb074070961b1d84a129277add1126eb2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 8 Jul 2022 19:01:21 +0300 Subject: [PATCH 2134/2328] Fix custom legacy ID in test scene not overriding base value --- .../Visual/Gameplay/TestScenePlayerLocalScoreImport.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs index 96b7da9c9c..dc0a14ad9b 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs @@ -96,7 +96,7 @@ namespace osu.Game.Tests.Visual.Gameplay public override string Description => "custom"; public override string ShortName => "custom"; - public new int LegacyID => -1; + int ILegacyRuleset.LegacyID => -1; public override ScoreProcessor CreateScoreProcessor() => new ScoreProcessor(this); } From 667b1d795d6a7f9a58b9123ec397c60127a9de3a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 8 Jul 2022 19:02:46 +0300 Subject: [PATCH 2135/2328] Ensure score has custom ruleset --- .../Visual/Gameplay/TestScenePlayerLocalScoreImport.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs index dc0a14ad9b..3011515b62 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs @@ -6,6 +6,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Extensions; +using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Platform; using osu.Framework.Screens; using osu.Game.Beatmaps; @@ -83,6 +84,8 @@ namespace osu.Game.Tests.Visual.Gameplay CreateTest(); + AddAssert("score has custom ruleset", () => Player.Score.ScoreInfo.Ruleset.Equals(customRuleset.AsNonNull().RulesetInfo)); + AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning); AddStep("seek to completion", () => Player.GameplayClockContainer.Seek(Player.DrawableRuleset.Objects.Last().GetEndTime())); From 66f314915dc3f2ed4a5d47857af5ee133b72d255 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 9 Jul 2022 06:01:22 +0900 Subject: [PATCH 2136/2328] Fix crash on mobile releases when attempting to read any file --- osu.Game/IO/LineBufferedReader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/IO/LineBufferedReader.cs b/osu.Game/IO/LineBufferedReader.cs index 93e554b43d..da1cdba73b 100644 --- a/osu.Game/IO/LineBufferedReader.cs +++ b/osu.Game/IO/LineBufferedReader.cs @@ -19,7 +19,7 @@ namespace osu.Game.IO public LineBufferedReader(Stream stream, bool leaveOpen = false) { - streamReader = new StreamReader(stream, Encoding.UTF8, true, -1, leaveOpen); + streamReader = new StreamReader(stream, Encoding.UTF8, true, 1024, leaveOpen); } /// From 086388ec4ea2723fbd7e40719d9fa517503631c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=82=BA=E4=BB=80=E9=BA=BC?= Date: Sat, 9 Jul 2022 21:06:47 +0800 Subject: [PATCH 2137/2328] Remove nullable disable annotation in the benchmark project. --- osu.Game.Benchmarks/BenchmarkBeatmapParsing.cs | 2 -- osu.Game.Benchmarks/BenchmarkMod.cs | 2 -- osu.Game.Benchmarks/BenchmarkRealmReads.cs | 2 -- osu.Game.Benchmarks/BenchmarkRuleset.cs | 2 -- osu.Game.Benchmarks/BenchmarkTest.cs | 2 -- osu.Game.Benchmarks/Program.cs | 2 -- 6 files changed, 12 deletions(-) diff --git a/osu.Game.Benchmarks/BenchmarkBeatmapParsing.cs b/osu.Game.Benchmarks/BenchmarkBeatmapParsing.cs index 07ffda4030..1d207d04c7 100644 --- a/osu.Game.Benchmarks/BenchmarkBeatmapParsing.cs +++ b/osu.Game.Benchmarks/BenchmarkBeatmapParsing.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.IO; using BenchmarkDotNet.Attributes; using osu.Framework.IO.Stores; diff --git a/osu.Game.Benchmarks/BenchmarkMod.cs b/osu.Game.Benchmarks/BenchmarkMod.cs index a1d92d9a67..c5375e9f09 100644 --- a/osu.Game.Benchmarks/BenchmarkMod.cs +++ b/osu.Game.Benchmarks/BenchmarkMod.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using BenchmarkDotNet.Attributes; using osu.Game.Rulesets.Osu.Mods; diff --git a/osu.Game.Benchmarks/BenchmarkRealmReads.cs b/osu.Game.Benchmarks/BenchmarkRealmReads.cs index 5ffda6504e..2277f4e85c 100644 --- a/osu.Game.Benchmarks/BenchmarkRealmReads.cs +++ b/osu.Game.Benchmarks/BenchmarkRealmReads.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Linq; using System.Threading; using BenchmarkDotNet.Attributes; diff --git a/osu.Game.Benchmarks/BenchmarkRuleset.cs b/osu.Game.Benchmarks/BenchmarkRuleset.cs index de8cb13773..2835ec9499 100644 --- a/osu.Game.Benchmarks/BenchmarkRuleset.cs +++ b/osu.Game.Benchmarks/BenchmarkRuleset.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Engines; using osu.Game.Online.API; diff --git a/osu.Game.Benchmarks/BenchmarkTest.cs b/osu.Game.Benchmarks/BenchmarkTest.cs index 140696e4a4..34f5edd084 100644 --- a/osu.Game.Benchmarks/BenchmarkTest.cs +++ b/osu.Game.Benchmarks/BenchmarkTest.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Running; using NUnit.Framework; diff --git a/osu.Game.Benchmarks/Program.cs b/osu.Game.Benchmarks/Program.cs index 603d8aa1b9..439ced53ab 100644 --- a/osu.Game.Benchmarks/Program.cs +++ b/osu.Game.Benchmarks/Program.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using BenchmarkDotNet.Configs; using BenchmarkDotNet.Running; From 8fcc33936c799b49ac4c3350ff84757a1c5d32a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=82=BA=E4=BB=80=E9=BA=BC?= Date: Sat, 9 Jul 2022 21:07:47 +0800 Subject: [PATCH 2138/2328] Mark the parameter as non-nullable. --- osu.Game.Benchmarks/BenchmarkMod.cs | 2 +- osu.Game.Benchmarks/BenchmarkRealmReads.cs | 6 +++--- osu.Game.Benchmarks/BenchmarkRuleset.cs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Benchmarks/BenchmarkMod.cs b/osu.Game.Benchmarks/BenchmarkMod.cs index c5375e9f09..994300df36 100644 --- a/osu.Game.Benchmarks/BenchmarkMod.cs +++ b/osu.Game.Benchmarks/BenchmarkMod.cs @@ -9,7 +9,7 @@ namespace osu.Game.Benchmarks { public class BenchmarkMod : BenchmarkTest { - private OsuModDoubleTime mod; + private OsuModDoubleTime mod = null!; [Params(1, 10, 100)] public int Times { get; set; } diff --git a/osu.Game.Benchmarks/BenchmarkRealmReads.cs b/osu.Game.Benchmarks/BenchmarkRealmReads.cs index 2277f4e85c..082eb5e51b 100644 --- a/osu.Game.Benchmarks/BenchmarkRealmReads.cs +++ b/osu.Game.Benchmarks/BenchmarkRealmReads.cs @@ -15,9 +15,9 @@ namespace osu.Game.Benchmarks { public class BenchmarkRealmReads : BenchmarkTest { - private TemporaryNativeStorage storage; - private RealmAccess realm; - private UpdateThread updateThread; + private TemporaryNativeStorage storage = null!; + private RealmAccess realm = null!; + private UpdateThread updateThread = null!; [Params(1, 100, 1000)] public int ReadsPerFetch { get; set; } diff --git a/osu.Game.Benchmarks/BenchmarkRuleset.cs b/osu.Game.Benchmarks/BenchmarkRuleset.cs index 2835ec9499..7d318e043b 100644 --- a/osu.Game.Benchmarks/BenchmarkRuleset.cs +++ b/osu.Game.Benchmarks/BenchmarkRuleset.cs @@ -11,9 +11,9 @@ namespace osu.Game.Benchmarks { public class BenchmarkRuleset : BenchmarkTest { - private OsuRuleset ruleset; - private APIMod apiModDoubleTime; - private APIMod apiModDifficultyAdjust; + private OsuRuleset ruleset = null!; + private APIMod apiModDoubleTime = null!; + private APIMod apiModDifficultyAdjust = null!; public override void SetUp() { From 378be99fe1cc9d2608ed4e0901e8bfd3164518e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=82=BA=E4=BB=80=E9=BA=BC?= Date: Sat, 9 Jul 2022 21:12:35 +0800 Subject: [PATCH 2139/2328] Remove un-need null check. --- osu.Game.Benchmarks/BenchmarkRealmReads.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Benchmarks/BenchmarkRealmReads.cs b/osu.Game.Benchmarks/BenchmarkRealmReads.cs index 082eb5e51b..1df77320d2 100644 --- a/osu.Game.Benchmarks/BenchmarkRealmReads.cs +++ b/osu.Game.Benchmarks/BenchmarkRealmReads.cs @@ -133,9 +133,9 @@ namespace osu.Game.Benchmarks [GlobalCleanup] public void Cleanup() { - realm?.Dispose(); - storage?.Dispose(); - updateThread?.Exit(); + realm.Dispose(); + storage.Dispose(); + updateThread.Exit(); } } } From 5fcc4bf713937e1edbcae416532b3a29f43844dd Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Sat, 9 Jul 2022 12:10:18 -0700 Subject: [PATCH 2140/2328] Add failing sample playback disabled check --- osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs index 8e325838ff..ff985de70e 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs @@ -24,6 +24,7 @@ namespace osu.Game.Tests.Visual.Editing public void TestCantExitWithoutSaving() { AddRepeatStep("Exit", () => InputManager.Key(Key.Escape), 10); + AddAssert("Sample playback disabled", () => Editor.SamplePlaybackDisabled.Value); AddAssert("Editor is still active screen", () => Game.ScreenStack.CurrentScreen is Editor); } From 834bb1f187a268f25be9b031cfc2319b7c56e13c Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Sat, 9 Jul 2022 12:14:39 -0700 Subject: [PATCH 2141/2328] Fix editor playing object samples while paused after cancelling exit --- osu.Game/Screens/Edit/Editor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 6ec9ff4e89..2b763415cd 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -921,7 +921,7 @@ namespace osu.Game.Screens.Edit private void cancelExit() { - samplePlaybackDisabled.Value = false; + updateSampleDisabledState(); loader?.CancelPendingDifficultySwitch(); } From 52aef09cd6528bc8541f3d77305053dbce3da769 Mon Sep 17 00:00:00 2001 From: Ludio235 <94078268+Ludio235@users.noreply.github.com> Date: Sun, 10 Jul 2022 02:05:40 +0000 Subject: [PATCH 2142/2328] Update PlaylistsRoomSettingsOverlay.cs --- .../OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs index 1e565e298e..9c6a2a5e0b 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs @@ -140,9 +140,14 @@ namespace osu.Game.Screens.OnlinePlay.Playlists }, new Section("Duration") { - Child = DurationField = new DurationDropdown + Child = new Container { RelativeSizeAxes = Axes.X, + Height = 40, + Child = DurationField = new DurationDropdown + { + RelativeSizeAxes = Axes.X + } } }, new Section("Allowed attempts (across all playlist items)") From 6443338251e5c392ae71b3d4ee5410ddc6b36463 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Sun, 10 Jul 2022 01:22:22 -0400 Subject: [PATCH 2143/2328] use cursor position instead of destination for dampLength calculation the destination vector is clamped within playfield borders, we want dampLength to be based on distance from the cursor. --- osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs index 1cb5bf31a4..17bbba4ba7 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs @@ -69,24 +69,24 @@ namespace osu.Game.Rulesets.Osu.Mods switch (drawable) { case DrawableHitCircle circle: - easeTo(circle, destination); + easeTo(circle, destination, cursorPos); break; case DrawableSlider slider: if (!slider.HeadCircle.Result.HasResult) - easeTo(slider, destination); + easeTo(slider, destination, cursorPos); else - easeTo(slider, destination - slider.Ball.DrawPosition); + easeTo(slider, destination - slider.Ball.DrawPosition, cursorPos); break; } } } - private void easeTo(DrawableHitObject hitObject, Vector2 destination) + private void easeTo(DrawableHitObject hitObject, Vector2 destination, Vector2 cursorPos) { - double dampLength = Vector2.Distance(hitObject.Position, destination) / (0.04 * RepulsionStrength.Value + 0.04); + double dampLength = Vector2.Distance(hitObject.Position, cursorPos) / (0.04 * RepulsionStrength.Value + 0.04); float x = (float)Interpolation.DampContinuously(hitObject.X, destination.X, dampLength, gameplayClock.ElapsedFrameTime); float y = (float)Interpolation.DampContinuously(hitObject.Y, destination.Y, dampLength, gameplayClock.ElapsedFrameTime); From 8116a4b6f6a2779d74172c168afeee2f593d0bed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 10 Jul 2022 23:53:06 +0900 Subject: [PATCH 2144/2328] Fix multiplayer spectator crash due to track potentially not being loaded in time --- osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs index bae25dc9f8..f5af110372 100644 --- a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs @@ -314,6 +314,9 @@ namespace osu.Game.Screens.OnlinePlay.Match public override void OnSuspending(ScreenTransitionEvent e) { + // Should be a noop in most cases, but let's ensure beyond doubt that the beatmap is in a correct state. + updateWorkingBeatmap(); + onLeaving(); base.OnSuspending(e); } From 8b6665cb5b211c06e24f9d3e9bf210480bc08760 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Jul 2022 02:51:54 +0900 Subject: [PATCH 2145/2328] Ensure initial beatmap processing is done inside the import transaction --- osu.Game/Database/RealmArchiveModelImporter.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Database/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs index 6cea92f1d9..aa7fac07a8 100644 --- a/osu.Game/Database/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -338,11 +338,11 @@ namespace osu.Game.Database // import to store realm.Add(item); + PostImport(item, realm); + transaction.Commit(); } - PostImport(item, realm); - LogForModel(item, @"Import successfully completed!"); } catch (Exception e) @@ -479,7 +479,7 @@ namespace osu.Game.Database } /// - /// Perform any final actions after the import has been committed to the database. + /// Perform any final actions before the import has been committed to the database. /// /// The model prepared for import. /// The current realm context. From 0434c1091472e1582aa144e9f1ec77059acad4e4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Jul 2022 02:57:44 +0900 Subject: [PATCH 2146/2328] Use global `WorkingBeatmap` in `PlayerArea` for the time being --- .../Screens/OnlinePlay/Multiplayer/Spectate/PlayerArea.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerArea.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerArea.cs index 5bae4f9ea5..302d04b531 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerArea.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerArea.cs @@ -53,9 +53,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate [CanBeNull] public Score Score { get; private set; } - [Resolved] - private BeatmapManager beatmapManager { get; set; } - private readonly BindableDouble volumeAdjustment = new BindableDouble(); private readonly Container gameplayContent; private readonly LoadingLayer loadingLayer; @@ -84,6 +81,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate GameplayClock.Source = masterClock; } + [Resolved] + private IBindable beatmap { get; set; } + public void LoadScore([NotNull] Score score) { if (Score != null) @@ -91,7 +91,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate Score = score; - gameplayContent.Child = new PlayerIsolationContainer(beatmapManager.GetWorkingBeatmap(Score.ScoreInfo.BeatmapInfo), Score.ScoreInfo.Ruleset, Score.ScoreInfo.Mods) + gameplayContent.Child = new PlayerIsolationContainer(beatmap.Value, Score.ScoreInfo.Ruleset, Score.ScoreInfo.Mods) { RelativeSizeAxes = Axes.Both, Child = stack = new OsuScreenStack From 48911b956af8bbb1835fbd73de06572846b4f2bf Mon Sep 17 00:00:00 2001 From: Alden Wu Date: Sun, 10 Jul 2022 17:07:21 -0700 Subject: [PATCH 2147/2328] Remove ClearTransformsAfter call A bit weird only having one call on its own; probably deserves an entire PR dedicated to adding ClearTransformsAfter calls --- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs index 26d3f053ff..f18c4529ab 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs @@ -73,8 +73,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy private void onHitObjectApplied(DrawableHitObject drawableObject) { - ClearTransformsAfter(double.MinValue); - this.ScaleTo(1f) .FadeOut(); } From 958c0fb390ea04ac37f11e6547b8bb95ce9b31a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Jul 2022 15:01:16 +0900 Subject: [PATCH 2148/2328] Remove `Appveyor.TestLogger` --- .../osu.Game.Rulesets.EmptyFreeform.Tests.csproj | 1 - .../osu.Game.Rulesets.Pippidon.Tests.csproj | 1 - .../osu.Game.Rulesets.EmptyScrolling.Tests.csproj | 1 - .../osu.Game.Rulesets.Pippidon.Tests.csproj | 1 - .../osu.Game.Rulesets.Catch.Tests.csproj | 1 - .../osu.Game.Rulesets.Mania.Tests.csproj | 1 - osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj | 1 - .../osu.Game.Rulesets.Taiko.Tests.csproj | 1 - osu.Game.Tests/osu.Game.Tests.csproj | 1 - osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj | 1 - 10 files changed, 10 deletions(-) diff --git a/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform.Tests/osu.Game.Rulesets.EmptyFreeform.Tests.csproj b/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform.Tests/osu.Game.Rulesets.EmptyFreeform.Tests.csproj index bc285dbe11..011a37cbdc 100644 --- a/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform.Tests/osu.Game.Rulesets.EmptyFreeform.Tests.csproj +++ b/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform.Tests/osu.Game.Rulesets.EmptyFreeform.Tests.csproj @@ -9,7 +9,6 @@ false - diff --git a/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj b/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj index 718ada1905..c04f6132f3 100644 --- a/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj +++ b/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj @@ -9,7 +9,6 @@ false - diff --git a/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling.Tests/osu.Game.Rulesets.EmptyScrolling.Tests.csproj b/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling.Tests/osu.Game.Rulesets.EmptyScrolling.Tests.csproj index 6b9c3f4d63..529054fd4f 100644 --- a/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling.Tests/osu.Game.Rulesets.EmptyScrolling.Tests.csproj +++ b/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling.Tests/osu.Game.Rulesets.EmptyScrolling.Tests.csproj @@ -9,7 +9,6 @@ false - diff --git a/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj b/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj index 718ada1905..c04f6132f3 100644 --- a/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj +++ b/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj @@ -9,7 +9,6 @@ false - diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj index b957ade952..3ac1491946 100644 --- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj +++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj @@ -1,7 +1,6 @@  - diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index d3b4b378c0..d07df75864 100644 --- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj +++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj @@ -1,7 +1,6 @@  - diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj index 2c0d3fd937..402cf3ad41 100644 --- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj +++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj @@ -1,7 +1,6 @@  - diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj index ce468d399b..51d4bbc630 100644 --- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj +++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj @@ -1,7 +1,6 @@  - diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index a1eef4ce47..02fd6ccd16 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -1,7 +1,6 @@  - diff --git a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj index 6fd53d923b..5512b26863 100644 --- a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj +++ b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj @@ -4,7 +4,6 @@ osu.Game.Tournament.Tests.TournamentTestRunner - From 22a51fdc50f8444034049eca370c0aaaf19fc83f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Jul 2022 15:35:00 +0900 Subject: [PATCH 2149/2328] Add support for a drawings screen video background --- osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index 32da4d1b36..0df6386dae 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -97,6 +97,11 @@ namespace osu.Game.Tournament.Screens.Drawings FillMode = FillMode.Fill, Texture = textures.Get(@"Backgrounds/Drawings/background.png") }, + new TourneyVideo("drawings") + { + Loop = true, + RelativeSizeAxes = Axes.Both, + }, // Visualiser new VisualiserContainer { From 10d6027c8921937c2b8e100239174d87b0bee188 Mon Sep 17 00:00:00 2001 From: Andrew Hong <35881688+novialriptide@users.noreply.github.com> Date: Thu, 7 Jul 2022 23:16:06 -0400 Subject: [PATCH 2150/2328] Assign missing UserID to RealmUser --- osu.Game/OsuGameBase.cs | 2 +- osu.Game/Scoring/ScoreImporter.cs | 28 +++++++++++++++++++++++++++- osu.Game/Scoring/ScoreManager.cs | 5 +++-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index a16252ac89..4b5c9c0815 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -272,7 +272,7 @@ namespace osu.Game dependencies.Cache(difficultyCache = new BeatmapDifficultyCache()); // ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup() - dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, realm, Scheduler, difficultyCache, LocalConfig)); + dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, realm, Scheduler, API, difficultyCache, LocalConfig)); dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, realm, RulesetStore, API, Audio, Resources, Host, defaultBeatmap, difficultyCache, performOnlineLookups: true)); diff --git a/osu.Game/Scoring/ScoreImporter.cs b/osu.Game/Scoring/ScoreImporter.cs index f59ffc7c94..7494914625 100644 --- a/osu.Game/Scoring/ScoreImporter.cs +++ b/osu.Game/Scoring/ScoreImporter.cs @@ -8,11 +8,15 @@ using System.Threading; using Newtonsoft.Json; using osu.Framework.Logging; using osu.Framework.Platform; +using osu.Game.Models; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.IO.Archives; using osu.Game.Rulesets; using osu.Game.Scoring.Legacy; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; using Realms; namespace osu.Game.Scoring @@ -26,11 +30,14 @@ namespace osu.Game.Scoring private readonly RulesetStore rulesets; private readonly Func beatmaps; - public ScoreImporter(RulesetStore rulesets, Func beatmaps, Storage storage, RealmAccess realm) + private readonly IAPIProvider api; + + public ScoreImporter(RulesetStore rulesets, Func beatmaps, Storage storage, RealmAccess realm, IAPIProvider api) : base(storage, realm) { this.rulesets = rulesets; this.beatmaps = beatmaps; + this.api = api; } protected override ScoreInfo? CreateModel(ArchiveReader archive) @@ -68,5 +75,24 @@ namespace osu.Game.Scoring if (string.IsNullOrEmpty(model.StatisticsJson)) model.StatisticsJson = JsonConvert.SerializeObject(model.Statistics); } + + protected override void PostImport(ScoreInfo model, Realm realm) + { + base.PostImport(model, realm); + + var userRequest = new GetUserRequest(model.User.Username); + api.Perform(userRequest); + APIUser userReq = userRequest.Response; + + if (!(userReq is null)) { + Logger.Log($"Assignning UserID to RealmUser"); + var user = new RealmUser + { + OnlineID = userReq.Id, + Username = model.User.Username + }; + model.RealmUser = user; + } + } } } diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 6ee1d11f83..9aed8904e6 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -21,6 +21,7 @@ using osu.Game.IO.Archives; using osu.Game.Overlays.Notifications; using osu.Game.Rulesets; using osu.Game.Rulesets.Scoring; +using osu.Game.Online.API; namespace osu.Game.Scoring { @@ -31,7 +32,7 @@ namespace osu.Game.Scoring private readonly OsuConfigManager configManager; private readonly ScoreImporter scoreImporter; - public ScoreManager(RulesetStore rulesets, Func beatmaps, Storage storage, RealmAccess realm, Scheduler scheduler, + public ScoreManager(RulesetStore rulesets, Func beatmaps, Storage storage, RealmAccess realm, Scheduler scheduler, IAPIProvider api, BeatmapDifficultyCache difficultyCache = null, OsuConfigManager configManager = null) : base(storage, realm) { @@ -39,7 +40,7 @@ namespace osu.Game.Scoring this.difficultyCache = difficultyCache; this.configManager = configManager; - scoreImporter = new ScoreImporter(rulesets, beatmaps, storage, realm) + scoreImporter = new ScoreImporter(rulesets, beatmaps, storage, realm, api) { PostNotification = obj => PostNotification?.Invoke(obj) }; From 56896e8b415a7b9622a99561a98d48d001d52602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrew=20Hong=20=28=ED=99=8D=EC=A4=80=EC=9B=90=29?= <35881688+novialriptide@users.noreply.github.com> Date: Mon, 11 Jul 2022 02:20:39 -0400 Subject: [PATCH 2151/2328] Move PostImport() --- osu.Game/Database/RealmArchiveModelImporter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/RealmArchiveModelImporter.cs b/osu.Game/Database/RealmArchiveModelImporter.cs index 6cea92f1d9..c143c51c6d 100644 --- a/osu.Game/Database/RealmArchiveModelImporter.cs +++ b/osu.Game/Database/RealmArchiveModelImporter.cs @@ -338,11 +338,11 @@ namespace osu.Game.Database // import to store realm.Add(item); + PostImport(item, realm); + transaction.Commit(); } - PostImport(item, realm); - LogForModel(item, @"Import successfully completed!"); } catch (Exception e) From 6220650ea3228930ebd27a46b9e4c8c3824abc73 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Mon, 11 Jul 2022 02:29:56 -0700 Subject: [PATCH 2152/2328] Fix dialog overlay not loading in time for headless test --- osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs index ff985de70e..d7e9cc1bc0 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs @@ -6,11 +6,13 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Framework.Screens; using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Overlays; using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Compose.Components.Timeline; using osu.Game.Screens.Select; @@ -23,6 +25,7 @@ namespace osu.Game.Tests.Visual.Editing [Test] public void TestCantExitWithoutSaving() { + AddUntilStep("Wait for dialog overlay load", () => ((Drawable)Game.Dependencies.Get()).IsLoaded); AddRepeatStep("Exit", () => InputManager.Key(Key.Escape), 10); AddAssert("Sample playback disabled", () => Editor.SamplePlaybackDisabled.Value); AddAssert("Editor is still active screen", () => Game.ScreenStack.CurrentScreen is Editor); From 44d2e001ed4d80674beb281e32a69241294364fe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Jul 2022 20:15:29 +0900 Subject: [PATCH 2153/2328] Update various dependencies --- osu.Desktop/osu.Desktop.csproj | 2 +- .../osu.Game.Rulesets.Osu.Tests.csproj | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 2 +- osu.Game/osu.Game.csproj | 14 +++++++------- osu.iOS.props | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index a4f9e2671b..c67017f175 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -24,7 +24,7 @@ - + diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj index 402cf3ad41..4349d25cb3 100644 --- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj +++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj @@ -2,7 +2,7 @@ - + diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 02fd6ccd16..7615b3e8be 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -7,7 +7,7 @@ - + WinExe diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 06b022ea44..1251ab800b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -20,12 +20,12 @@ - + - - - - + + + + @@ -38,8 +38,8 @@ - - + + diff --git a/osu.iOS.props b/osu.iOS.props index 9085205bbc..c38bb548bf 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -85,7 +85,7 @@ - + From 00c7101f540329333442390719113c3fedb25628 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Jul 2022 20:36:05 +0900 Subject: [PATCH 2154/2328] Remove `DrawingsScreen` world map completely --- .../Screens/Drawings/DrawingsScreen.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index 0df6386dae..85afb9b2d0 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -12,8 +12,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Graphics; @@ -26,7 +24,7 @@ using osuTK.Graphics; namespace osu.Game.Tournament.Screens.Drawings { - public class DrawingsScreen : TournamentScreen + public class DrawingsScreen : TournamentScreen, IProvideVideo { private const string results_filename = "drawings_results.txt"; @@ -45,7 +43,7 @@ namespace osu.Game.Tournament.Screens.Drawings public ITeamList TeamList; [BackgroundDependencyLoader] - private void load(TextureStore textures, Storage storage) + private void load(Storage storage) { RelativeSizeAxes = Axes.Both; @@ -91,12 +89,6 @@ namespace osu.Game.Tournament.Screens.Drawings RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new Sprite - { - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fill, - Texture = textures.Get(@"Backgrounds/Drawings/background.png") - }, new TourneyVideo("drawings") { Loop = true, From 73e924479fb6db7b5e57413ef08663c068805f3c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Jul 2022 20:42:04 +0900 Subject: [PATCH 2155/2328] Find video by recursive check rather than marker interface Seems a lot more reliable, and allows falling back to the "main" video in cases which didn't support this previously. A next step may be to allow every screen to support a video based on its screen name, rather than specifying the local `TourneyVideo` every time. --- osu.Game.Tournament/Components/TourneyVideo.cs | 2 ++ .../Screens/Drawings/DrawingsScreen.cs | 2 +- .../Screens/Editors/TournamentEditorScreen.cs | 2 +- .../Screens/Gameplay/GameplayScreen.cs | 2 +- osu.Game.Tournament/Screens/IProvideVideo.cs | 14 -------------- osu.Game.Tournament/Screens/Ladder/LadderScreen.cs | 2 +- .../Screens/Schedule/ScheduleScreen.cs | 2 +- osu.Game.Tournament/Screens/Setup/SetupScreen.cs | 2 +- .../Screens/Showcase/ShowcaseScreen.cs | 2 +- .../Screens/TeamIntro/SeedingScreen.cs | 2 +- .../Screens/TeamIntro/TeamIntroScreen.cs | 2 +- .../Screens/TeamWin/TeamWinScreen.cs | 2 +- osu.Game.Tournament/TournamentSceneManager.cs | 3 ++- 13 files changed, 14 insertions(+), 25 deletions(-) delete mode 100644 osu.Game.Tournament/Screens/IProvideVideo.cs diff --git a/osu.Game.Tournament/Components/TourneyVideo.cs b/osu.Game.Tournament/Components/TourneyVideo.cs index c6bbb54f9a..2e79998e66 100644 --- a/osu.Game.Tournament/Components/TourneyVideo.cs +++ b/osu.Game.Tournament/Components/TourneyVideo.cs @@ -22,6 +22,8 @@ namespace osu.Game.Tournament.Components private Video video; private ManualClock manualClock; + public bool VideoAvailable => video != null; + public TourneyVideo(string filename, bool drawFallbackGradient = false) { this.filename = filename; diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index 85afb9b2d0..5ac25f97b5 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -24,7 +24,7 @@ using osuTK.Graphics; namespace osu.Game.Tournament.Screens.Drawings { - public class DrawingsScreen : TournamentScreen, IProvideVideo + public class DrawingsScreen : TournamentScreen { private const string results_filename = "drawings_results.txt"; diff --git a/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs index 8af5bbe513..0fefe6f780 100644 --- a/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs @@ -20,7 +20,7 @@ using osuTK; namespace osu.Game.Tournament.Screens.Editors { - public abstract class TournamentEditorScreen : TournamentScreen, IProvideVideo + public abstract class TournamentEditorScreen : TournamentScreen where TDrawable : Drawable, IModelBacked where TModel : class, new() { diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 86b2c2a4e9..54ae4c0366 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -21,7 +21,7 @@ using osuTK.Graphics; namespace osu.Game.Tournament.Screens.Gameplay { - public class GameplayScreen : BeatmapInfoScreen, IProvideVideo + public class GameplayScreen : BeatmapInfoScreen { private readonly BindableBool warmup = new BindableBool(); diff --git a/osu.Game.Tournament/Screens/IProvideVideo.cs b/osu.Game.Tournament/Screens/IProvideVideo.cs deleted file mode 100644 index aa67a5211f..0000000000 --- a/osu.Game.Tournament/Screens/IProvideVideo.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -#nullable disable - -namespace osu.Game.Tournament.Screens -{ - /// - /// Marker interface for a screen which provides its own local video background. - /// - public interface IProvideVideo - { - } -} diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index 23bfa84afc..7ad7e76a1f 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -19,7 +19,7 @@ using osuTK.Graphics; namespace osu.Game.Tournament.Screens.Ladder { - public class LadderScreen : TournamentScreen, IProvideVideo + public class LadderScreen : TournamentScreen { protected Container MatchesContainer; private Container paths; diff --git a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs index 7a11e26794..0827cbae69 100644 --- a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs +++ b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs @@ -19,7 +19,7 @@ using osuTK.Graphics; namespace osu.Game.Tournament.Screens.Schedule { - public class ScheduleScreen : TournamentScreen // IProvidesVideo + public class ScheduleScreen : TournamentScreen { private readonly Bindable currentMatch = new Bindable(); private Container mainContainer; diff --git a/osu.Game.Tournament/Screens/Setup/SetupScreen.cs b/osu.Game.Tournament/Screens/Setup/SetupScreen.cs index 42eff3565f..f472541d59 100644 --- a/osu.Game.Tournament/Screens/Setup/SetupScreen.cs +++ b/osu.Game.Tournament/Screens/Setup/SetupScreen.cs @@ -19,7 +19,7 @@ using osuTK; namespace osu.Game.Tournament.Screens.Setup { - public class SetupScreen : TournamentScreen, IProvideVideo + public class SetupScreen : TournamentScreen { private FillFlowContainer fillFlow; diff --git a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs index 082aa99b0e..a7a175ceba 100644 --- a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs +++ b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs @@ -14,7 +14,7 @@ using osuTK.Graphics; namespace osu.Game.Tournament.Screens.Showcase { - public class ShowcaseScreen : BeatmapInfoScreen // IProvideVideo + public class ShowcaseScreen : BeatmapInfoScreen { [BackgroundDependencyLoader] private void load() diff --git a/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs index 925c697346..719e0384d3 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs @@ -19,7 +19,7 @@ using osuTK; namespace osu.Game.Tournament.Screens.TeamIntro { - public class SeedingScreen : TournamentMatchScreen, IProvideVideo + public class SeedingScreen : TournamentMatchScreen { private Container mainContainer; diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index 98dfaa7487..08c9a7a897 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -13,7 +13,7 @@ using osuTK; namespace osu.Game.Tournament.Screens.TeamIntro { - public class TeamIntroScreen : TournamentMatchScreen, IProvideVideo + public class TeamIntroScreen : TournamentMatchScreen { private Container mainContainer; diff --git a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs index 50207547cd..07557674e8 100644 --- a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs +++ b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs @@ -14,7 +14,7 @@ using osuTK; namespace osu.Game.Tournament.Screens.TeamWin { - public class TeamWinScreen : TournamentMatchScreen, IProvideVideo + public class TeamWinScreen : TournamentMatchScreen { private Container mainContainer; diff --git a/osu.Game.Tournament/TournamentSceneManager.cs b/osu.Game.Tournament/TournamentSceneManager.cs index 296b259d72..a12dbb4740 100644 --- a/osu.Game.Tournament/TournamentSceneManager.cs +++ b/osu.Game.Tournament/TournamentSceneManager.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; +using osu.Framework.Testing; using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -186,7 +187,7 @@ namespace osu.Game.Tournament var lastScreen = currentScreen; currentScreen = target; - if (currentScreen is IProvideVideo) + if (currentScreen.ChildrenOfType().FirstOrDefault()?.VideoAvailable == true) { video.FadeOut(200); From 09bfca4e4ad59da7574c8212c08f729b404aef10 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 11 Jul 2022 21:45:39 +0300 Subject: [PATCH 2156/2328] Fix build failing on tests --- .../Visual/Gameplay/TestScenePlayerLocalScoreImport.cs | 2 +- osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs | 2 +- osu.Game.Tests/Visual/SongSelect/TestSceneTopLocalRank.cs | 2 +- .../Visual/UserInterface/TestSceneDeleteLocalScore.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs index 3011515b62..bfc06c0ee0 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs @@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.Gameplay { Dependencies.Cache(rulesets = new RealmRulesetStore(Realm)); Dependencies.Cache(beatmaps = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default)); - Dependencies.Cache(new ScoreManager(rulesets, () => beatmaps, LocalStorage, Realm, Scheduler)); + Dependencies.Cache(new ScoreManager(rulesets, () => beatmaps, LocalStorage, Realm, Scheduler, API)); Dependencies.Cache(Realm); } diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs index 1b9b59676b..ef0c7d7d4d 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs @@ -47,7 +47,7 @@ namespace osu.Game.Tests.Visual.SongSelect dependencies.Cache(rulesetStore = new RealmRulesetStore(Realm)); dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, Realm, rulesetStore, null, dependencies.Get(), Resources, dependencies.Get(), Beatmap.Default)); - dependencies.Cache(scoreManager = new ScoreManager(rulesetStore, () => beatmapManager, LocalStorage, Realm, Scheduler)); + dependencies.Cache(scoreManager = new ScoreManager(rulesetStore, () => beatmapManager, LocalStorage, Realm, Scheduler, API)); Dependencies.Cache(Realm); return dependencies; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneTopLocalRank.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneTopLocalRank.cs index 8f890b2383..05b5c5c0cd 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneTopLocalRank.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneTopLocalRank.cs @@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Dependencies.Cache(rulesets = new RealmRulesetStore(Realm)); Dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default)); - Dependencies.Cache(scoreManager = new ScoreManager(rulesets, () => beatmapManager, LocalStorage, Realm, Scheduler)); + Dependencies.Cache(scoreManager = new ScoreManager(rulesets, () => beatmapManager, LocalStorage, Realm, Scheduler, API)); Dependencies.Cache(Realm); beatmapManager.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely(); diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index cee917f6cf..e59914f69a 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -74,7 +74,7 @@ namespace osu.Game.Tests.Visual.UserInterface dependencies.Cache(rulesetStore = new RealmRulesetStore(Realm)); dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, Realm, rulesetStore, null, dependencies.Get(), Resources, dependencies.Get(), Beatmap.Default)); - dependencies.Cache(scoreManager = new ScoreManager(dependencies.Get(), () => beatmapManager, LocalStorage, Realm, Scheduler)); + dependencies.Cache(scoreManager = new ScoreManager(dependencies.Get(), () => beatmapManager, LocalStorage, Realm, Scheduler, API)); Dependencies.Cache(Realm); return dependencies; From 4f009419b8d8402550a40664ae5dead774a6bd2c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 11 Jul 2022 21:46:42 +0300 Subject: [PATCH 2157/2328] Simplify population logic and match code style --- osu.Game/Scoring/ScoreImporter.cs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/osu.Game/Scoring/ScoreImporter.cs b/osu.Game/Scoring/ScoreImporter.cs index 7494914625..53dd511d57 100644 --- a/osu.Game/Scoring/ScoreImporter.cs +++ b/osu.Game/Scoring/ScoreImporter.cs @@ -8,7 +8,6 @@ using System.Threading; using Newtonsoft.Json; using osu.Framework.Logging; using osu.Framework.Platform; -using osu.Game.Models; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.IO.Archives; @@ -80,19 +79,12 @@ namespace osu.Game.Scoring { base.PostImport(model, realm); - var userRequest = new GetUserRequest(model.User.Username); - api.Perform(userRequest); - APIUser userReq = userRequest.Response; + var userRequest = new GetUserRequest(model.RealmUser.Username); - if (!(userReq is null)) { - Logger.Log($"Assignning UserID to RealmUser"); - var user = new RealmUser - { - OnlineID = userReq.Id, - Username = model.User.Username - }; - model.RealmUser = user; - } + api.Perform(userRequest); + + if (userRequest.Response is APIUser user) + model.RealmUser.OnlineID = user.Id; } } } From 54fe84350cfba996d83e81b150bd19df0e63d0e5 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Mon, 11 Jul 2022 17:23:32 -0400 Subject: [PATCH 2158/2328] reciprocate mod incompatibility --- osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs index 4c9418726c..a3f6448457 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Automation; public override string Description => @"Automatic cursor movement - just follow the rhythm."; public override double ScoreMultiplier => 1; - public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModFailCondition), typeof(ModNoFail), typeof(ModAutoplay), typeof(OsuModMagnetised) }; + public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModFailCondition), typeof(ModNoFail), typeof(ModAutoplay), typeof(OsuModMagnetised), typeof(OsuModRepel) }; public bool PerformFail() => false; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 5a08df3803..84906f6eed 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Fun; public override string Description => "Everything rotates. EVERYTHING."; public override double ScoreMultiplier => 1; - public override Type[] IncompatibleMods => new[] { typeof(OsuModWiggle), typeof(OsuModMagnetised) }; + public override Type[] IncompatibleMods => new[] { typeof(OsuModWiggle), typeof(OsuModMagnetised), typeof(OsuModRepel) }; private float theta; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index 3fba2cefd2..8acd4fc422 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Fun; public override string Description => "They just won't stay still..."; public override double ScoreMultiplier => 1; - public override Type[] IncompatibleMods => new[] { typeof(OsuModTransform), typeof(OsuModMagnetised) }; + public override Type[] IncompatibleMods => new[] { typeof(OsuModTransform), typeof(OsuModMagnetised), typeof(OsuModRepel) }; private const int wiggle_duration = 90; // (ms) Higher = fewer wiggles private const int wiggle_strength = 10; // Higher = stronger wiggles From 28278e2554246fa49764457bfdb09f33799f9289 Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Mon, 11 Jul 2022 17:27:25 -0400 Subject: [PATCH 2159/2328] enable NRT again --- osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs index 17bbba4ba7..211987ee32 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRepel.cs @@ -1,9 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; +using System.Diagnostics; using osu.Framework.Bindables; using osu.Framework.Utils; using osu.Game.Configuration; @@ -27,7 +26,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override double ScoreMultiplier => 1; public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay), typeof(OsuModMagnetised) }; - private IFrameStableClock gameplayClock; + private IFrameStableClock? gameplayClock; [SettingSource("Repulsion strength", "How strong the repulsion is.", 0)] public BindableFloat RepulsionStrength { get; } = new BindableFloat(0.5f) @@ -86,6 +85,8 @@ namespace osu.Game.Rulesets.Osu.Mods private void easeTo(DrawableHitObject hitObject, Vector2 destination, Vector2 cursorPos) { + Debug.Assert(gameplayClock != null); + double dampLength = Vector2.Distance(hitObject.Position, cursorPos) / (0.04 * RepulsionStrength.Value + 0.04); float x = (float)Interpolation.DampContinuously(hitObject.X, destination.X, dampLength, gameplayClock.ElapsedFrameTime); From 76be9a829c3df4a39c1070203dab99e13216e4a7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Jul 2022 12:59:55 +0900 Subject: [PATCH 2160/2328] Fix mutation after disposal in `TeamEditorScreen` --- osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs index 11db37c8b7..111893d18c 100644 --- a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs @@ -298,10 +298,10 @@ namespace osu.Game.Tournament.Screens.Editors }, true); } - private void updatePanel() + private void updatePanel() => Scheduler.AddOnce(() => { drawableContainer.Child = new UserGridPanel(user.ToAPIUser()) { Width = 300 }; - } + }); } } } From bae314a254b1c93aac01f9889bb0c34b8ce443b5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Jul 2022 13:03:43 +0900 Subject: [PATCH 2161/2328] Add background on `SetupScreen` to hide video --- .../Screens/Setup/SetupScreen.cs | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tournament/Screens/Setup/SetupScreen.cs b/osu.Game.Tournament/Screens/Setup/SetupScreen.cs index f472541d59..2b2dce3664 100644 --- a/osu.Game.Tournament/Screens/Setup/SetupScreen.cs +++ b/osu.Game.Tournament/Screens/Setup/SetupScreen.cs @@ -9,6 +9,8 @@ using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Online.API; using osu.Game.Overlays; @@ -48,13 +50,21 @@ namespace osu.Game.Tournament.Screens.Setup { windowSize = frameworkConfig.GetBindable(FrameworkSetting.WindowedSize); - InternalChild = fillFlow = new FillFlowContainer + InternalChildren = new Drawable[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Padding = new MarginPadding(10), - Spacing = new Vector2(10), + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(0.2f), + }, + fillFlow = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Padding = new MarginPadding(10), + Spacing = new Vector2(10), + } }; api.LocalUser.BindValueChanged(_ => Schedule(reload)); @@ -74,7 +84,8 @@ namespace osu.Game.Tournament.Screens.Setup Action = () => sceneManager?.SetScreen(new StablePathSelectScreen()), Value = fileBasedIpc?.IPCStorage?.GetFullPath(string.Empty) ?? "Not found", Failing = fileBasedIpc?.IPCStorage == null, - Description = "The osu!stable installation which is currently being used as a data source. If a source is not found, make sure you have created an empty ipc.txt in your stable cutting-edge installation." + Description = + "The osu!stable installation which is currently being used as a data source. If a source is not found, make sure you have created an empty ipc.txt in your stable cutting-edge installation." }, new ActionableInfo { From 90fecbc9c7435ff5c2f3077b8fdebb96ff3d6c52 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Jul 2022 14:32:39 +0900 Subject: [PATCH 2162/2328] Add test showing all mod icons for reference --- .../Visual/UserInterface/TestSceneModIcon.cs | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModIcon.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModIcon.cs index 0a0415789a..ce9aa682d1 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModIcon.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModIcon.cs @@ -1,10 +1,10 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Linq; using NUnit.Framework; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.UI; @@ -13,10 +13,24 @@ namespace osu.Game.Tests.Visual.UserInterface { public class TestSceneModIcon : OsuTestScene { + [Test] + public void TestShowAllMods() + { + AddStep("create mod icons", () => + { + Child = new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Direction = FillDirection.Full, + ChildrenEnumerable = Ruleset.Value.CreateInstance().CreateAllMods().Select(m => new ModIcon(m)), + }; + }); + } + [Test] public void TestChangeModType() { - ModIcon icon = null; + ModIcon icon = null!; AddStep("create mod icon", () => Child = icon = new ModIcon(new OsuModDoubleTime())); AddStep("change mod", () => icon.Mod = new OsuModEasy()); @@ -25,7 +39,7 @@ namespace osu.Game.Tests.Visual.UserInterface [Test] public void TestInterfaceModType() { - ModIcon icon = null; + ModIcon icon = null!; var ruleset = new OsuRuleset(); From 8dbe24fd7c05d8f30cf500b8d77dfa17094c2320 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Jul 2022 14:36:50 +0900 Subject: [PATCH 2163/2328] Simplify colour assigning logic and remove system mod colour for now --- osu.Game/Rulesets/UI/ModIcon.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 308122b71c..b1f355a789 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -15,6 +15,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Mods; using osuTK; using osu.Framework.Bindables; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Localisation; namespace osu.Game.Rulesets.UI @@ -53,7 +54,6 @@ namespace osu.Game.Rulesets.UI private OsuColour colours { get; set; } private Color4 backgroundColour; - private Color4 highlightedColour; /// /// Construct a new instance. @@ -123,19 +123,13 @@ namespace osu.Game.Rulesets.UI modAcronym.FadeOut(); } - Color4 typeColour = colours.ForModType(value.Type); - backgroundColour = typeColour; - highlightedColour = ((Colour4)typeColour).Lighten(.2f); - - if (value.Type == ModType.System) - modIcon.Colour = colours.Yellow; - + backgroundColour = colours.ForModType(value.Type); updateColour(); } private void updateColour() { - background.Colour = Selected.Value ? highlightedColour : backgroundColour; + background.Colour = Selected.Value ? backgroundColour.Lighten(0.2f) : backgroundColour; } } } From b52ea161336ce148e1d511dbb9111289ad9f2972 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Jul 2022 15:10:59 +0900 Subject: [PATCH 2164/2328] Show basic error message when score submission fails --- osu.Game/Screens/Play/SubmittingPlayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/SubmittingPlayer.cs b/osu.Game/Screens/Play/SubmittingPlayer.cs index 1cc0d1853d..c916791eaa 100644 --- a/osu.Game/Screens/Play/SubmittingPlayer.cs +++ b/osu.Game/Screens/Play/SubmittingPlayer.cs @@ -168,7 +168,7 @@ namespace osu.Game.Screens.Play request.Failure += e => { - Logger.Error(e, "Failed to submit score"); + Logger.Error(e, $"Failed to submit score ({e.Message})"); scoreSubmissionSource.SetResult(false); }; From fa626a82b3448b8da0130cadff09e240e236ba39 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Jul 2022 15:18:52 +0900 Subject: [PATCH 2165/2328] Add missed incompatilibity rules --- osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs index d562c37541..490b5b7a9d 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public class OsuModAutoplay : ModAutoplay { - public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModMagnetised), typeof(OsuModAutopilot), typeof(OsuModSpunOut), typeof(OsuModAlternate) }).ToArray(); + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModMagnetised), typeof(OsuModRepel), typeof(OsuModAutopilot), typeof(OsuModSpunOut), typeof(OsuModAlternate) }).ToArray(); public override ModReplayData CreateReplayData(IBeatmap beatmap, IReadOnlyList mods) => new ModReplayData(new OsuAutoGenerator(beatmap, mods).Generate(), new ModCreatedUser { Username = "Autoplay" }); diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index 2cf8c278ca..5c1de83972 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Mods public class OsuModRelax : ModRelax, IUpdatableByPlayfield, IApplicableToDrawableRuleset, IApplicableToPlayer { public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things."; - public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot), typeof(OsuModMagnetised), typeof(OsuModAlternate) }).ToArray(); + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot), typeof(OsuModMagnetised), typeof(OsuModRepel), typeof(OsuModAlternate) }).ToArray(); /// /// How early before a hitobject's start time to trigger a hit. From cafe30fc4dc0d21dc885dd224568b88f6b4f545a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Jul 2022 14:54:45 +0900 Subject: [PATCH 2166/2328] Fix potential crash during shutdown sequence if intro playback was aborted Fixes one of the audio related `ObjectDisposedException`s (https://sentry.ppy.sh/organizations/ppy/issues/92/events/12f282f048cb4a4fae85810e8a70b68d/?project=2&query=is%3Aunresolved&sort=freq&statsPeriod=7d). Ran into this while testing locally. See `IntroScreen.ensureEventuallyArrivingAtMenu` for the related cause of this happening (forced continuing to next screen if the intro doesn't load in time). --- osu.Game/Screens/Menu/IntroTriangles.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index 3cdf51a87c..c228faae58 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -72,9 +72,16 @@ namespace osu.Game.Screens.Menu RelativeSizeAxes = Axes.Both, Clock = decoupledClock, LoadMenu = LoadMenu - }, t => + }, _ => { - AddInternal(t); + AddInternal(intro); + + // There is a chance that the intro timed out before being displayed, and this scheduled callback could + // happen during the outro rather than intro. In such a scenario the game may already be in a disposing state + // which will trigger errors during attempted audio playback. + if (DidLoadMenu) + return; + if (!UsingThemedIntro) welcome?.Play(); From 10a14f39ed3ead07664dcf24edc0b70dc469c717 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Jul 2022 15:42:20 +0900 Subject: [PATCH 2167/2328] Show an error message on startup when attempting to run on an unsupported version of windows A lot of sentry error reports are coming from realm / EF failures due to the host operating system being too old. Let's give the user some proper feedback rather than a silent crash and error report hitting our logging. --- osu.Desktop/Program.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 712f300671..da2a580086 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -14,6 +14,7 @@ using osu.Framework.Platform; using osu.Game; using osu.Game.IPC; using osu.Game.Tournament; +using SDL2; using Squirrel; namespace osu.Desktop @@ -29,7 +30,19 @@ namespace osu.Desktop { // run Squirrel first, as the app may exit after these run if (OperatingSystem.IsWindows()) + { + var windowsVersion = Environment.OSVersion.Version; + + if (windowsVersion.Major < 6 || (windowsVersion.Major == 6 && windowsVersion.Minor <= 1)) + { + SDL.SDL_ShowSimpleMessageBox(SDL.SDL_MessageBoxFlags.SDL_MESSAGEBOX_ERROR, + "Your operating system is too old to run osu!", + "This version of osu! requires at least Windows 8 to run.\nPlease upgrade your operating system or consider using an older version of osu!.", IntPtr.Zero); + return; + } + setupSquirrel(); + } // Back up the cwd before DesktopGameHost changes it string cwd = Environment.CurrentDirectory; From a36f7867250558ceebcb947ee489564401601b81 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Jul 2022 16:16:46 +0900 Subject: [PATCH 2168/2328] Change minimum version to Windows 8.1 instead of Windows 8 --- osu.Desktop/Program.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index da2a580086..66b361cb73 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -33,7 +33,9 @@ namespace osu.Desktop { var windowsVersion = Environment.OSVersion.Version; - if (windowsVersion.Major < 6 || (windowsVersion.Major == 6 && windowsVersion.Minor <= 1)) + // While .NET 6 still supports Windows 7 and above, we are limited by realm currently, as they choose to only support 8.1 and higher. + // See https://www.mongodb.com/docs/realm/sdk/dotnet/#supported-platforms + if (windowsVersion.Major < 6 || (windowsVersion.Major == 6 && windowsVersion.Minor <= 2)) { SDL.SDL_ShowSimpleMessageBox(SDL.SDL_MessageBoxFlags.SDL_MESSAGEBOX_ERROR, "Your operating system is too old to run osu!", From cad18ebc5844277bad61c50cac8a40c429c5da80 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Jul 2022 16:46:19 +0900 Subject: [PATCH 2169/2328] Reword comment to better explain what we are guarding against --- osu.Game/Screens/Menu/IntroTriangles.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index c228faae58..6ad0350e43 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -77,8 +77,9 @@ namespace osu.Game.Screens.Menu AddInternal(intro); // There is a chance that the intro timed out before being displayed, and this scheduled callback could - // happen during the outro rather than intro. In such a scenario the game may already be in a disposing state - // which will trigger errors during attempted audio playback. + // happen during the outro rather than intro. + // In such a scenario, we don't want to play the intro sample, nor attempt to start the intro track + // (that may have already been since disposed by MusicController). if (DidLoadMenu) return; From 1bef2d7b3946d6856da6574aa1cbaed244547755 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Jul 2022 04:04:21 +0900 Subject: [PATCH 2170/2328] Add and consume `SoloScoreInfo` --- osu.Game/Online/API/APIAccess.cs | 2 +- .../Responses/APIScoreWithPosition.cs | 4 +- .../Requests/Responses/APIScoresCollection.cs | 2 +- .../API/Requests/Responses/SoloScoreInfo.cs | 124 ++++++++++++++++++ .../BeatmapSet/Scores/ScoresContainer.cs | 2 +- 5 files changed, 129 insertions(+), 5 deletions(-) create mode 100644 osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 088dc56701..43cea7fb97 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -38,7 +38,7 @@ namespace osu.Game.Online.API public string WebsiteRootUrl { get; } - public int APIVersion => 20220217; // We may want to pull this from the game version eventually. + public int APIVersion => 20220705; // We may want to pull this from the game version eventually. public Exception LastLoginError { get; private set; } diff --git a/osu.Game/Online/API/Requests/Responses/APIScoreWithPosition.cs b/osu.Game/Online/API/Requests/Responses/APIScoreWithPosition.cs index 8bd54f889d..494826f534 100644 --- a/osu.Game/Online/API/Requests/Responses/APIScoreWithPosition.cs +++ b/osu.Game/Online/API/Requests/Responses/APIScoreWithPosition.cs @@ -16,11 +16,11 @@ namespace osu.Game.Online.API.Requests.Responses public int? Position; [JsonProperty(@"score")] - public APIScore Score; + public SoloScoreInfo Score; public ScoreInfo CreateScoreInfo(RulesetStore rulesets, BeatmapInfo beatmap = null) { - var score = Score.CreateScoreInfo(rulesets, beatmap); + var score = Score.ToScoreInfo(rulesets, beatmap); score.Position = Position; return score; } diff --git a/osu.Game/Online/API/Requests/Responses/APIScoresCollection.cs b/osu.Game/Online/API/Requests/Responses/APIScoresCollection.cs index 9c8a38c63a..38c67d92f4 100644 --- a/osu.Game/Online/API/Requests/Responses/APIScoresCollection.cs +++ b/osu.Game/Online/API/Requests/Responses/APIScoresCollection.cs @@ -11,7 +11,7 @@ namespace osu.Game.Online.API.Requests.Responses public class APIScoresCollection { [JsonProperty(@"scores")] - public List Scores; + public List Scores; [JsonProperty(@"userScore")] public APIScoreWithPosition UserScore; diff --git a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs new file mode 100644 index 0000000000..71479d2867 --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs @@ -0,0 +1,124 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using osu.Game.Beatmaps; +using osu.Game.Database; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Scoring; +using osu.Game.Scoring; + +namespace osu.Game.Online.API.Requests.Responses +{ + [SuppressMessage("ReSharper", "InconsistentNaming")] + [Serializable] + public class SoloScoreInfo : IHasOnlineID + { + [JsonIgnore] + public long id { get; set; } + + public int user_id { get; set; } + + public int beatmap_id { get; set; } + + public int ruleset_id { get; set; } + + public int? build_id { get; set; } + + public bool passed { get; set; } + + public int total_score { get; set; } + + public double accuracy { get; set; } + + public APIUser user { get; set; } + + // TODO: probably want to update this column to match user stats (short)? + public int max_combo { get; set; } + + [JsonConverter(typeof(StringEnumConverter))] + public ScoreRank rank { get; set; } + + public DateTimeOffset? started_at { get; set; } + + public DateTimeOffset? ended_at { get; set; } + + public List mods { get; set; } = new List(); + + [JsonProperty("statistics")] + public Dictionary Statistics { get; set; } = new Dictionary(); + + public override string ToString() => $"score_id: {id} user_id: {user_id}"; + + [JsonIgnore] + public DateTimeOffset created_at { get; set; } + + [JsonIgnore] + public DateTimeOffset updated_at { get; set; } + + [JsonIgnore] + public DateTimeOffset? deleted_at { get; set; } + + /// + /// Create a from an API score instance. + /// + /// A ruleset store, used to populate a ruleset instance in the returned score. + /// An optional beatmap, copied into the returned score (for cases where the API does not populate the beatmap). + /// + public ScoreInfo CreateScoreInfo(RulesetStore rulesets, BeatmapInfo beatmap = null) + { + var ruleset = rulesets.GetRuleset(ruleset_id) ?? throw new InvalidOperationException($"Ruleset with ID of {ruleset_id} not found locally"); + + var rulesetInstance = ruleset.CreateInstance(); + + var modInstances = mods.Select(apiMod => rulesetInstance.CreateModFromAcronym(apiMod.Acronym)).Where(m => m != null).ToArray(); + + // all API scores provided by this class are considered to be legacy. + modInstances = modInstances.Append(rulesetInstance.CreateMod()).ToArray(); + + var scoreInfo = new ScoreInfo + { + User = user ?? new APIUser { Id = user_id }, + BeatmapInfo = beatmap ?? new BeatmapInfo { OnlineID = beatmap_id }, + Passed = passed, + TotalScore = total_score, + Accuracy = accuracy, + MaxCombo = max_combo, + Rank = rank, + Statistics = Statistics, + OnlineID = OnlineID, + Date = ended_at ?? DateTimeOffset.Now, + // PP = + Hash = "online", // TODO: temporary? + Ruleset = ruleset, + Mods = modInstances, + }; + + return scoreInfo; + } + + public ScoreInfo CreateScoreInfo(Mod[] mods) => new ScoreInfo + { + OnlineID = id, + User = new APIUser { Id = user_id }, + BeatmapInfo = new BeatmapInfo { OnlineID = beatmap_id }, + Ruleset = new RulesetInfo { OnlineID = ruleset_id }, + Passed = passed, + TotalScore = total_score, + Accuracy = accuracy, + MaxCombo = max_combo, + Rank = rank, + Mods = mods, + Statistics = Statistics + }; + + public long OnlineID => id; + } +} diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index c2e54d0d7b..98202ba7c0 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -101,7 +101,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores scoreTable.Show(); var userScore = value.UserScore; - var userScoreInfo = userScore?.Score.CreateScoreInfo(rulesets, beatmapInfo); + var userScoreInfo = userScore?.Score.ToScoreInfo(rulesets, beatmapInfo); topScoresContainer.Add(new DrawableTopScore(topScore)); From 900e0ace8ed24edf99b47748b00217e3dfe642ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Jul 2022 16:59:56 +0900 Subject: [PATCH 2171/2328] Standardise naming and enable NRT --- .../API/Requests/Responses/SoloScoreInfo.cs | 124 ++++++++++-------- 1 file changed, 71 insertions(+), 53 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs index 71479d2867..5dce2db6ed 100644 --- a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs @@ -1,10 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable using System; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using System.Linq; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -17,54 +15,73 @@ using osu.Game.Scoring; namespace osu.Game.Online.API.Requests.Responses { - [SuppressMessage("ReSharper", "InconsistentNaming")] [Serializable] public class SoloScoreInfo : IHasOnlineID { [JsonIgnore] - public long id { get; set; } + [JsonProperty(" ")] + public long ID { get; set; } - public int user_id { get; set; } + [JsonProperty("beatmap_id")] + public int BeatmapID { get; set; } - public int beatmap_id { get; set; } + [JsonProperty("ruleset_id")] + public int RulesetID { get; set; } - public int ruleset_id { get; set; } + [JsonProperty("build_id")] + public int? BuildID { get; set; } - public int? build_id { get; set; } + [JsonProperty("passed")] + public bool Passed { get; set; } - public bool passed { get; set; } + [JsonProperty("total_score")] + public int TotalScore { get; set; } - public int total_score { get; set; } + [JsonProperty("accuracy")] + public double Accuracy { get; set; } - public double accuracy { get; set; } + [JsonProperty("user_id")] + public int UserID { get; set; } - public APIUser user { get; set; } + /// + /// User may be provided via an osu-web response, but will not be present from raw database json. + /// + [JsonProperty("user")] + public APIUser? User { get; set; } // TODO: probably want to update this column to match user stats (short)? - public int max_combo { get; set; } + [JsonProperty("max_combo")] + public int MaxCombo { get; set; } [JsonConverter(typeof(StringEnumConverter))] - public ScoreRank rank { get; set; } + [JsonProperty("rank")] + public ScoreRank Rank { get; set; } - public DateTimeOffset? started_at { get; set; } + [JsonProperty("started_at")] + public DateTimeOffset? StartedAt { get; set; } - public DateTimeOffset? ended_at { get; set; } + [JsonProperty("ended_at")] + public DateTimeOffset? EndedAt { get; set; } - public List mods { get; set; } = new List(); + [JsonProperty("mods")] + public List Mods { get; set; } = new List(); + + [JsonIgnore] + [JsonProperty("created_at")] + public DateTimeOffset CreatedAt { get; set; } + + [JsonIgnore] + [JsonProperty("updated_at")] + public DateTimeOffset UpdatedAt { get; set; } + + [JsonIgnore] + [JsonProperty("deleted_at")] + public DateTimeOffset? DeletedAt { get; set; } [JsonProperty("statistics")] public Dictionary Statistics { get; set; } = new Dictionary(); - public override string ToString() => $"score_id: {id} user_id: {user_id}"; - - [JsonIgnore] - public DateTimeOffset created_at { get; set; } - - [JsonIgnore] - public DateTimeOffset updated_at { get; set; } - - [JsonIgnore] - public DateTimeOffset? deleted_at { get; set; } + public override string ToString() => $"score_id: {ID} user_id: {UserID}"; /// /// Create a from an API score instance. @@ -72,53 +89,54 @@ namespace osu.Game.Online.API.Requests.Responses /// A ruleset store, used to populate a ruleset instance in the returned score. /// An optional beatmap, copied into the returned score (for cases where the API does not populate the beatmap). /// - public ScoreInfo CreateScoreInfo(RulesetStore rulesets, BeatmapInfo beatmap = null) + public ScoreInfo CreateScoreInfo(RulesetStore rulesets, BeatmapInfo? beatmap = null) { - var ruleset = rulesets.GetRuleset(ruleset_id) ?? throw new InvalidOperationException($"Ruleset with ID of {ruleset_id} not found locally"); + var ruleset = rulesets.GetRuleset(RulesetID) ?? throw new InvalidOperationException($"Ruleset with ID of {RulesetID} not found locally"); var rulesetInstance = ruleset.CreateInstance(); - var modInstances = mods.Select(apiMod => rulesetInstance.CreateModFromAcronym(apiMod.Acronym)).Where(m => m != null).ToArray(); + var modInstances = Mods.Select(apiMod => rulesetInstance.CreateModFromAcronym(apiMod.Acronym)).Where(m => m != null).ToArray(); // all API scores provided by this class are considered to be legacy. modInstances = modInstances.Append(rulesetInstance.CreateMod()).ToArray(); var scoreInfo = new ScoreInfo { - User = user ?? new APIUser { Id = user_id }, - BeatmapInfo = beatmap ?? new BeatmapInfo { OnlineID = beatmap_id }, - Passed = passed, - TotalScore = total_score, - Accuracy = accuracy, - MaxCombo = max_combo, - Rank = rank, - Statistics = Statistics, OnlineID = OnlineID, - Date = ended_at ?? DateTimeOffset.Now, - // PP = - Hash = "online", // TODO: temporary? + User = User ?? new APIUser { Id = UserID }, + BeatmapInfo = beatmap ?? new BeatmapInfo { OnlineID = BeatmapID }, Ruleset = ruleset, + Passed = Passed, + TotalScore = TotalScore, + Accuracy = Accuracy, + MaxCombo = MaxCombo, + Rank = Rank, + Statistics = Statistics, + Date = EndedAt ?? DateTimeOffset.Now, + Hash = "online", // TODO: temporary? Mods = modInstances, }; return scoreInfo; } - public ScoreInfo CreateScoreInfo(Mod[] mods) => new ScoreInfo + public ScoreInfo ToScoreInfo(Mod[] mods) => new ScoreInfo { - OnlineID = id, - User = new APIUser { Id = user_id }, - BeatmapInfo = new BeatmapInfo { OnlineID = beatmap_id }, - Ruleset = new RulesetInfo { OnlineID = ruleset_id }, - Passed = passed, - TotalScore = total_score, - Accuracy = accuracy, - MaxCombo = max_combo, - Rank = rank, + OnlineID = ID, + User = new APIUser { Id = UserID }, + BeatmapInfo = new BeatmapInfo { OnlineID = BeatmapID }, + Ruleset = new RulesetInfo { OnlineID = RulesetID }, + Passed = Passed, + TotalScore = TotalScore, + Accuracy = Accuracy, + MaxCombo = MaxCombo, + Rank = Rank, + Statistics = Statistics, + Date = EndedAt ?? DateTimeOffset.Now, + Hash = "online", // TODO: temporary? Mods = mods, - Statistics = Statistics }; - public long OnlineID => id; + public long OnlineID => ID; } } From f956955d4d66a6955cafdf066d1c4034b46c64ec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Jul 2022 17:14:31 +0900 Subject: [PATCH 2172/2328] Combine `ScoreInfo` construction helper methods --- .../API/Requests/Responses/SoloScoreInfo.cs | 33 ++++++++----------- .../BeatmapSet/Scores/ScoresContainer.cs | 2 +- osu.Game/Screens/Ranking/SoloResultsScreen.cs | 2 +- .../Select/Leaderboards/BeatmapLeaderboard.cs | 2 +- 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs index 5dce2db6ed..71c6c3adab 100644 --- a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs @@ -89,40 +89,33 @@ namespace osu.Game.Online.API.Requests.Responses /// A ruleset store, used to populate a ruleset instance in the returned score. /// An optional beatmap, copied into the returned score (for cases where the API does not populate the beatmap). /// - public ScoreInfo CreateScoreInfo(RulesetStore rulesets, BeatmapInfo? beatmap = null) + public ScoreInfo ToScoreInfo(RulesetStore rulesets, BeatmapInfo? beatmap = null) { var ruleset = rulesets.GetRuleset(RulesetID) ?? throw new InvalidOperationException($"Ruleset with ID of {RulesetID} not found locally"); var rulesetInstance = ruleset.CreateInstance(); - var modInstances = Mods.Select(apiMod => rulesetInstance.CreateModFromAcronym(apiMod.Acronym)).Where(m => m != null).ToArray(); + var mods = Mods.Select(apiMod => rulesetInstance.CreateModFromAcronym(apiMod.Acronym)).Where(m => m != null).ToArray(); // all API scores provided by this class are considered to be legacy. - modInstances = modInstances.Append(rulesetInstance.CreateMod()).ToArray(); + mods = mods.Append(rulesetInstance.CreateMod()).ToArray(); - var scoreInfo = new ScoreInfo - { - OnlineID = OnlineID, - User = User ?? new APIUser { Id = UserID }, - BeatmapInfo = beatmap ?? new BeatmapInfo { OnlineID = BeatmapID }, - Ruleset = ruleset, - Passed = Passed, - TotalScore = TotalScore, - Accuracy = Accuracy, - MaxCombo = MaxCombo, - Rank = Rank, - Statistics = Statistics, - Date = EndedAt ?? DateTimeOffset.Now, - Hash = "online", // TODO: temporary? - Mods = modInstances, - }; + var scoreInfo = ToScoreInfo(mods); + + scoreInfo.Ruleset = ruleset; + if (beatmap != null) scoreInfo.BeatmapInfo = beatmap; return scoreInfo; } + /// + /// Create a from an API score instance. + /// + /// The mod instances, resolved from a ruleset. + /// public ScoreInfo ToScoreInfo(Mod[] mods) => new ScoreInfo { - OnlineID = ID, + OnlineID = OnlineID, User = new APIUser { Id = UserID }, BeatmapInfo = new BeatmapInfo { OnlineID = BeatmapID }, Ruleset = new RulesetInfo { OnlineID = RulesetID }, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index 98202ba7c0..e50fc356eb 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -87,7 +87,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores MD5Hash = apiBeatmap.MD5Hash }; - scoreManager.OrderByTotalScoreAsync(value.Scores.Select(s => s.CreateScoreInfo(rulesets, beatmapInfo)).ToArray(), loadCancellationSource.Token) + scoreManager.OrderByTotalScoreAsync(value.Scores.Select(s => s.ToScoreInfo(rulesets, beatmapInfo)).ToArray(), loadCancellationSource.Token) .ContinueWith(task => Schedule(() => { if (loadCancellationSource.IsCancellationRequested) diff --git a/osu.Game/Screens/Ranking/SoloResultsScreen.cs b/osu.Game/Screens/Ranking/SoloResultsScreen.cs index 4813cd65db..4312c9528f 100644 --- a/osu.Game/Screens/Ranking/SoloResultsScreen.cs +++ b/osu.Game/Screens/Ranking/SoloResultsScreen.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Ranking return null; getScoreRequest = new GetScoresRequest(Score.BeatmapInfo, Score.Ruleset); - getScoreRequest.Success += r => scoresCallback?.Invoke(r.Scores.Where(s => s.OnlineID != Score.OnlineID).Select(s => s.CreateScoreInfo(rulesets, Beatmap.Value.BeatmapInfo))); + getScoreRequest.Success += r => scoresCallback?.Invoke(r.Scores.Where(s => s.OnlineID != Score.OnlineID).Select(s => s.ToScoreInfo(rulesets, Beatmap.Value.BeatmapInfo))); return getScoreRequest; } diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index 43eaff56b3..b497943dfa 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -152,7 +152,7 @@ namespace osu.Game.Screens.Select.Leaderboards req.Success += r => { - scoreManager.OrderByTotalScoreAsync(r.Scores.Select(s => s.CreateScoreInfo(rulesets, fetchBeatmapInfo)).ToArray(), cancellationToken) + scoreManager.OrderByTotalScoreAsync(r.Scores.Select(s => s.ToScoreInfo(rulesets, fetchBeatmapInfo)).ToArray(), cancellationToken) .ContinueWith(task => Schedule(() => { if (cancellationToken.IsCancellationRequested) From 12a56e36bd69d5ad5a4a90db476cab75f5eefacb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Jul 2022 17:46:58 +0900 Subject: [PATCH 2173/2328] Fix `ID` mapping and move osu-web additions to region to identify them clearly --- .../API/Requests/Responses/SoloScoreInfo.cs | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs index 71c6c3adab..dea0de4608 100644 --- a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs @@ -18,9 +18,8 @@ namespace osu.Game.Online.API.Requests.Responses [Serializable] public class SoloScoreInfo : IHasOnlineID { - [JsonIgnore] - [JsonProperty(" ")] - public long ID { get; set; } + [JsonProperty("replay")] + public bool HasReplay { get; set; } [JsonProperty("beatmap_id")] public int BeatmapID { get; set; } @@ -43,12 +42,6 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty("user_id")] public int UserID { get; set; } - /// - /// User may be provided via an osu-web response, but will not be present from raw database json. - /// - [JsonProperty("user")] - public APIUser? User { get; set; } - // TODO: probably want to update this column to match user stats (short)? [JsonProperty("max_combo")] public int MaxCombo { get; set; } @@ -81,6 +74,19 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty("statistics")] public Dictionary Statistics { get; set; } = new Dictionary(); + #region osu-web API additions (not stored to database). + + [JsonProperty("id")] + public long? ID { get; set; } + + [JsonProperty("user")] + public APIUser? User { get; set; } + + [JsonProperty("pp")] + public double? PP { get; set; } + + #endregion + public override string ToString() => $"score_id: {ID} user_id: {UserID}"; /// @@ -116,7 +122,7 @@ namespace osu.Game.Online.API.Requests.Responses public ScoreInfo ToScoreInfo(Mod[] mods) => new ScoreInfo { OnlineID = OnlineID, - User = new APIUser { Id = UserID }, + User = User ?? new APIUser { Id = UserID }, BeatmapInfo = new BeatmapInfo { OnlineID = BeatmapID }, Ruleset = new RulesetInfo { OnlineID = RulesetID }, Passed = Passed, @@ -127,9 +133,11 @@ namespace osu.Game.Online.API.Requests.Responses Statistics = Statistics, Date = EndedAt ?? DateTimeOffset.Now, Hash = "online", // TODO: temporary? + HasReplay = HasReplay, Mods = mods, + PP = PP, }; - public long OnlineID => ID; + public long OnlineID => ID ?? -1; } } From 0fe3bac1739b2f5961489292a5702783d39dad38 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 12 Jul 2022 17:51:20 +0900 Subject: [PATCH 2174/2328] Store mods to array and update test scenes --- .../Visual/Online/TestSceneScoresContainer.cs | 49 ++++++++++--------- .../API/Requests/Responses/SoloScoreInfo.cs | 2 +- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs index 16a34e996f..b772a28194 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs @@ -18,6 +18,7 @@ using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.BeatmapSet.Scores; using osu.Game.Rulesets.Osu.Mods; +using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; using osu.Game.Users; using osuTK.Graphics; @@ -146,12 +147,12 @@ namespace osu.Game.Tests.Visual.Online { var scores = new APIScoresCollection { - Scores = new List + Scores = new List { - new APIScore + new SoloScoreInfo { - Date = DateTimeOffset.Now, - OnlineID = onlineID++, + EndedAt = DateTimeOffset.Now, + ID = onlineID++, User = new APIUser { Id = 6602580, @@ -175,10 +176,10 @@ namespace osu.Game.Tests.Visual.Online TotalScore = 1234567890, Accuracy = 1, }, - new APIScore + new SoloScoreInfo { - Date = DateTimeOffset.Now, - OnlineID = onlineID++, + EndedAt = DateTimeOffset.Now, + ID = onlineID++, User = new APIUser { Id = 4608074, @@ -201,10 +202,10 @@ namespace osu.Game.Tests.Visual.Online TotalScore = 1234789, Accuracy = 0.9997, }, - new APIScore + new SoloScoreInfo { - Date = DateTimeOffset.Now, - OnlineID = onlineID++, + EndedAt = DateTimeOffset.Now, + ID = onlineID++, User = new APIUser { Id = 1014222, @@ -226,10 +227,10 @@ namespace osu.Game.Tests.Visual.Online TotalScore = 12345678, Accuracy = 0.9854, }, - new APIScore + new SoloScoreInfo { - Date = DateTimeOffset.Now, - OnlineID = onlineID++, + EndedAt = DateTimeOffset.Now, + ID = onlineID++, User = new APIUser { Id = 1541390, @@ -250,10 +251,10 @@ namespace osu.Game.Tests.Visual.Online TotalScore = 1234567, Accuracy = 0.8765, }, - new APIScore + new SoloScoreInfo { - Date = DateTimeOffset.Now, - OnlineID = onlineID++, + EndedAt = DateTimeOffset.Now, + ID = onlineID++, User = new APIUser { Id = 7151382, @@ -275,12 +276,12 @@ namespace osu.Game.Tests.Visual.Online foreach (var s in scores.Scores) { - s.Statistics = new Dictionary + s.Statistics = new Dictionary { - { "count_300", RNG.Next(2000) }, - { "count_100", RNG.Next(2000) }, - { "count_50", RNG.Next(2000) }, - { "count_miss", RNG.Next(2000) } + { HitResult.Great, RNG.Next(2000) }, + { HitResult.Good, RNG.Next(2000) }, + { HitResult.Meh, RNG.Next(2000) }, + { HitResult.Miss, RNG.Next(2000) } }; } @@ -289,10 +290,10 @@ namespace osu.Game.Tests.Visual.Online private APIScoreWithPosition createUserBest() => new APIScoreWithPosition { - Score = new APIScore + Score = new SoloScoreInfo { - Date = DateTimeOffset.Now, - OnlineID = onlineID++, + EndedAt = DateTimeOffset.Now, + ID = onlineID++, User = new APIUser { Id = 7151382, diff --git a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs index dea0de4608..b70da194a5 100644 --- a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs @@ -57,7 +57,7 @@ namespace osu.Game.Online.API.Requests.Responses public DateTimeOffset? EndedAt { get; set; } [JsonProperty("mods")] - public List Mods { get; set; } = new List(); + public APIMod[] Mods { get; set; } = Array.Empty(); [JsonIgnore] [JsonProperty("created_at")] From 363e23c2518b9c8bf21f99beec65ddbbc894e062 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 12 Jul 2022 18:47:43 +0900 Subject: [PATCH 2175/2328] Use correct HitResult in test --- osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs index b772a28194..be03328caa 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs @@ -279,7 +279,7 @@ namespace osu.Game.Tests.Visual.Online s.Statistics = new Dictionary { { HitResult.Great, RNG.Next(2000) }, - { HitResult.Good, RNG.Next(2000) }, + { HitResult.Ok, RNG.Next(2000) }, { HitResult.Meh, RNG.Next(2000) }, { HitResult.Miss, RNG.Next(2000) } }; From b96734e31a9184b2a636b5435d122d7d5b3d32df Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Tue, 12 Jul 2022 08:43:48 -0400 Subject: [PATCH 2176/2328] fix mod incompatibility between repel and relax --- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index 5c1de83972..2cf8c278ca 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Mods public class OsuModRelax : ModRelax, IUpdatableByPlayfield, IApplicableToDrawableRuleset, IApplicableToPlayer { public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things."; - public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot), typeof(OsuModMagnetised), typeof(OsuModRepel), typeof(OsuModAlternate) }).ToArray(); + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot), typeof(OsuModMagnetised), typeof(OsuModAlternate) }).ToArray(); /// /// How early before a hitobject's start time to trigger a hit. From c04658584285fb302d8df96e56279ba1fe59a806 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 12 Jul 2022 18:29:17 +0300 Subject: [PATCH 2177/2328] Fix unsupported OS message stating Windows 8 to be supported --- osu.Desktop/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 66b361cb73..cebbcb40b7 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -39,7 +39,7 @@ namespace osu.Desktop { SDL.SDL_ShowSimpleMessageBox(SDL.SDL_MessageBoxFlags.SDL_MESSAGEBOX_ERROR, "Your operating system is too old to run osu!", - "This version of osu! requires at least Windows 8 to run.\nPlease upgrade your operating system or consider using an older version of osu!.", IntPtr.Zero); + "This version of osu! requires at least Windows 8.1 to run.\nPlease upgrade your operating system or consider using an older version of osu!.", IntPtr.Zero); return; } From f90f93a43cb8110f1b4555af4416ff165cf0bdde Mon Sep 17 00:00:00 2001 From: James <51536154+tsunyoku@users.noreply.github.com> Date: Tue, 12 Jul 2022 23:07:10 +0100 Subject: [PATCH 2178/2328] abstract OsuModAlternate into InputBlockingMod --- .../Mods/InputBlockingMod.cs | 106 ++++++++++++++++++ osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs | 97 +--------------- 2 files changed, 112 insertions(+), 91 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs diff --git a/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs new file mode 100644 index 0000000000..b86e06ec5e --- /dev/null +++ b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs @@ -0,0 +1,106 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using osu.Framework.Graphics; +using osu.Framework.Input.Bindings; +using osu.Framework.Input.Events; +using osu.Game.Beatmaps.Timing; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; +using osu.Game.Screens.Play; +using osu.Game.Utils; + +namespace osu.Game.Rulesets.Osu.Mods +{ + public abstract class InputBlockingMod : Mod, IApplicableToDrawableRuleset + { + public override double ScoreMultiplier => 1.0; + public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModRelax) }; + public override ModType Type => ModType.Conversion; + + protected const double FLASH_DURATION = 1000; + + /// + /// A tracker for periods where alternate should not be forced (i.e. non-gameplay periods). + /// + /// + /// This is different from in that the periods here end strictly at the first object after the break, rather than the break's end time. + /// + protected PeriodTracker NonGameplayPeriods; + + protected OsuAction? LastActionPressed; + protected DrawableRuleset Ruleset; + + protected IFrameStableClock GameplayClock; + + public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) + { + Ruleset = drawableRuleset; + drawableRuleset.KeyBindingInputManager.Add(new InputInterceptor(this)); + + var periods = new List(); + + if (drawableRuleset.Objects.Any()) + { + periods.Add(new Period(int.MinValue, getValidJudgementTime(Ruleset.Objects.First()) - 1)); + + foreach (BreakPeriod b in drawableRuleset.Beatmap.Breaks) + periods.Add(new Period(b.StartTime, getValidJudgementTime(Ruleset.Objects.First(h => h.StartTime >= b.EndTime)) - 1)); + + static double getValidJudgementTime(HitObject hitObject) => hitObject.StartTime - hitObject.HitWindows.WindowFor(HitResult.Meh); + } + + NonGameplayPeriods = new PeriodTracker(periods); + + GameplayClock = drawableRuleset.FrameStableClock; + } + + protected virtual bool CheckCorrectAction(OsuAction action) + { + if (NonGameplayPeriods.IsInAny(GameplayClock.CurrentTime)) + { + LastActionPressed = null; + return true; + } + + switch (action) + { + case OsuAction.LeftButton: + case OsuAction.RightButton: + break; + + // Any action which is not left or right button should be ignored. + default: + return true; + } + + return false; + } + + private class InputInterceptor : Component, IKeyBindingHandler + { + private readonly InputBlockingMod mod; + + public InputInterceptor(InputBlockingMod mod) + { + this.mod = mod; + } + + public bool OnPressed(KeyBindingPressEvent e) + // if the pressed action is incorrect, block it from reaching gameplay. + => !mod.CheckCorrectAction(e.Action); + + public void OnReleased(KeyBindingReleaseEvent e) + { + } + } + } +} diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs index 622d2df432..2ad9789799 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs @@ -3,117 +3,32 @@ #nullable disable -using System; -using System.Collections.Generic; -using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.Bindings; -using osu.Framework.Input.Events; -using osu.Game.Beatmaps.Timing; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Objects; -using osu.Game.Rulesets.Osu.Objects; -using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.UI; -using osu.Game.Screens.Play; -using osu.Game.Utils; namespace osu.Game.Rulesets.Osu.Mods { - public class OsuModAlternate : Mod, IApplicableToDrawableRuleset + public class OsuModAlternate : InputBlockingMod { public override string Name => @"Alternate"; public override string Acronym => @"AL"; public override string Description => @"Don't use the same key twice in a row!"; - public override double ScoreMultiplier => 1.0; - public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModRelax) }; - public override ModType Type => ModType.Conversion; public override IconUsage? Icon => FontAwesome.Solid.Keyboard; - private const double flash_duration = 1000; - - /// - /// A tracker for periods where alternate should not be forced (i.e. non-gameplay periods). - /// - /// - /// This is different from in that the periods here end strictly at the first object after the break, rather than the break's end time. - /// - private PeriodTracker nonGameplayPeriods; - - private OsuAction? lastActionPressed; - private DrawableRuleset ruleset; - - private IFrameStableClock gameplayClock; - - public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) + protected override bool CheckCorrectAction(OsuAction action) { - ruleset = drawableRuleset; - drawableRuleset.KeyBindingInputManager.Add(new InputInterceptor(this)); - - var periods = new List(); - - if (drawableRuleset.Objects.Any()) - { - periods.Add(new Period(int.MinValue, getValidJudgementTime(ruleset.Objects.First()) - 1)); - - foreach (BreakPeriod b in drawableRuleset.Beatmap.Breaks) - periods.Add(new Period(b.StartTime, getValidJudgementTime(ruleset.Objects.First(h => h.StartTime >= b.EndTime)) - 1)); - - static double getValidJudgementTime(HitObject hitObject) => hitObject.StartTime - hitObject.HitWindows.WindowFor(HitResult.Meh); - } - - nonGameplayPeriods = new PeriodTracker(periods); - - gameplayClock = drawableRuleset.FrameStableClock; - } - - private bool checkCorrectAction(OsuAction action) - { - if (nonGameplayPeriods.IsInAny(gameplayClock.CurrentTime)) - { - lastActionPressed = null; + if (base.CheckCorrectAction(action)) return true; - } - switch (action) - { - case OsuAction.LeftButton: - case OsuAction.RightButton: - break; - - // Any action which is not left or right button should be ignored. - default: - return true; - } - - if (lastActionPressed != action) + if (LastActionPressed != action) { // User alternated correctly. - lastActionPressed = action; + LastActionPressed = action; return true; } - ruleset.Cursor.FlashColour(Colour4.Red, flash_duration, Easing.OutQuint); + Ruleset.Cursor.FlashColour(Colour4.Red, FLASH_DURATION, Easing.OutQuint); return false; } - - private class InputInterceptor : Component, IKeyBindingHandler - { - private readonly OsuModAlternate mod; - - public InputInterceptor(OsuModAlternate mod) - { - this.mod = mod; - } - - public bool OnPressed(KeyBindingPressEvent e) - // if the pressed action is incorrect, block it from reaching gameplay. - => !mod.checkCorrectAction(e.Action); - - public void OnReleased(KeyBindingReleaseEvent e) - { - } - } } } From c05263c3c39e5828d320ba5d11bac9b2ec1436d1 Mon Sep 17 00:00:00 2001 From: James <51536154+tsunyoku@users.noreply.github.com> Date: Tue, 12 Jul 2022 23:07:26 +0100 Subject: [PATCH 2179/2328] add Single Tap mod --- osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs | 38 +++++++++++++++++++ osu.Game.Rulesets.Osu/OsuRuleset.cs | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs b/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs new file mode 100644 index 0000000000..22211b70c1 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs @@ -0,0 +1,38 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable + +using osu.Framework.Graphics; + +namespace osu.Game.Rulesets.Osu.Mods +{ + public class OsuModSingleTap : InputBlockingMod + { + public override string Name => @"Single Tap"; + public override string Acronym => @"ST"; + public override string Description => @"You must only use one key!"; + + protected override bool CheckCorrectAction(OsuAction action) + { + if (base.CheckCorrectAction(action)) + return true; + + if (LastActionPressed == null) + { + // First keypress, store the expected action. + LastActionPressed = action; + return true; + } + + if (LastActionPressed == action) + { + // User singletapped correctly. + return true; + } + + Ruleset.Cursor.FlashColour(Colour4.Red, FLASH_DURATION, Easing.OutQuint); + return false; + } + } +} diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index ba0ef9ec3a..302194e91a 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -172,7 +172,7 @@ namespace osu.Game.Rulesets.Osu new OsuModClassic(), new OsuModRandom(), new OsuModMirror(), - new OsuModAlternate(), + new MultiMod(new OsuModAlternate(), new OsuModSingleTap()) }; case ModType.Automation: From 20d2b8619327632c76fc8fc7b654a0b2a3e12c27 Mon Sep 17 00:00:00 2001 From: James <51536154+tsunyoku@users.noreply.github.com> Date: Tue, 12 Jul 2022 23:07:41 +0100 Subject: [PATCH 2180/2328] make Single Tap incompatible with Autoplay, Cinema and Relax --- osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs index 490b5b7a9d..c4de77b8a3 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public class OsuModAutoplay : ModAutoplay { - public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModMagnetised), typeof(OsuModRepel), typeof(OsuModAutopilot), typeof(OsuModSpunOut), typeof(OsuModAlternate) }).ToArray(); + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModMagnetised), typeof(OsuModRepel), typeof(OsuModAutopilot), typeof(OsuModSpunOut), typeof(OsuModAlternate), typeof(OsuModSingleTap) }).ToArray(); public override ModReplayData CreateReplayData(IBeatmap beatmap, IReadOnlyList mods) => new ModReplayData(new OsuAutoGenerator(beatmap, mods).Generate(), new ModCreatedUser { Username = "Autoplay" }); diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs b/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs index 656cf95e77..704b922ee5 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public class OsuModCinema : ModCinema { - public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModMagnetised), typeof(OsuModAutopilot), typeof(OsuModSpunOut), typeof(OsuModAlternate) }).ToArray(); + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModMagnetised), typeof(OsuModAutopilot), typeof(OsuModSpunOut), typeof(OsuModAlternate), typeof(OsuModSingleTap) }).ToArray(); public override ModReplayData CreateReplayData(IBeatmap beatmap, IReadOnlyList mods) => new ModReplayData(new OsuAutoGenerator(beatmap, mods).Generate(), new ModCreatedUser { Username = "Autoplay" }); diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index 2cf8c278ca..2030156f2e 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Mods public class OsuModRelax : ModRelax, IUpdatableByPlayfield, IApplicableToDrawableRuleset, IApplicableToPlayer { public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things."; - public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot), typeof(OsuModMagnetised), typeof(OsuModAlternate) }).ToArray(); + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot), typeof(OsuModMagnetised), typeof(OsuModAlternate), typeof(OsuModSingleTap) }).ToArray(); /// /// How early before a hitobject's start time to trigger a hit. From 886efbcbdfb06cde32eedcd277dca18b11a874bf Mon Sep 17 00:00:00 2001 From: James <51536154+tsunyoku@users.noreply.github.com> Date: Tue, 12 Jul 2022 23:08:00 +0100 Subject: [PATCH 2181/2328] add test scene for Single Tap mod --- .../Mods/TestSceneOsuModSingleTap.cs | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSingleTap.cs diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSingleTap.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSingleTap.cs new file mode 100644 index 0000000000..0fe35fac0b --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSingleTap.cs @@ -0,0 +1,177 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable + +using System.Collections.Generic; +using NUnit.Framework; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Timing; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu.Mods; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Replays; +using osu.Game.Rulesets.Replays; +using osuTK; + +namespace osu.Game.Rulesets.Osu.Tests.Mods +{ + public class TestSceneOsuModSingleTap : OsuModTestScene + { + [Test] + public void TestInputSingular() => CreateModTest(new ModTestData + { + Mod = new OsuModSingleTap(), + PassCondition = () => Player.ScoreProcessor.Combo.Value == 2, + Autoplay = false, + Beatmap = new Beatmap + { + HitObjects = new List + { + new HitCircle + { + StartTime = 500, + Position = new Vector2(100), + }, + new HitCircle + { + StartTime = 1000, + Position = new Vector2(200, 100), + }, + new HitCircle + { + StartTime = 1500, + Position = new Vector2(300, 100), + }, + new HitCircle + { + StartTime = 2000, + Position = new Vector2(400, 100), + }, + }, + }, + ReplayFrames = new List + { + new OsuReplayFrame(500, new Vector2(100), OsuAction.LeftButton), + new OsuReplayFrame(501, new Vector2(100)), + new OsuReplayFrame(1000, new Vector2(200, 100), OsuAction.LeftButton), + } + }); + + [Test] + public void TestInputAlternating() => CreateModTest(new ModTestData + { + Mod = new OsuModSingleTap(), + PassCondition = () => Player.ScoreProcessor.Combo.Value == 0 && Player.ScoreProcessor.HighestCombo.Value == 1, + Autoplay = false, + Beatmap = new Beatmap + { + HitObjects = new List + { + new HitCircle + { + StartTime = 500, + Position = new Vector2(100), + }, + new HitCircle + { + StartTime = 1000, + Position = new Vector2(200, 100), + }, + }, + }, + ReplayFrames = new List + { + new OsuReplayFrame(500, new Vector2(100), OsuAction.LeftButton), + new OsuReplayFrame(501, new Vector2(100)), + new OsuReplayFrame(1000, new Vector2(200, 100), OsuAction.RightButton), + new OsuReplayFrame(1001, new Vector2(200, 100)), + new OsuReplayFrame(1500, new Vector2(300, 100), OsuAction.LeftButton), + new OsuReplayFrame(1501, new Vector2(300, 100)), + new OsuReplayFrame(2000, new Vector2(400, 100), OsuAction.RightButton), + new OsuReplayFrame(2001, new Vector2(400, 100)), + } + }); + + /// + /// Ensures singletapping is reset before the first hitobject after intro. + /// + [Test] + public void TestInputAlternatingAtIntro() => CreateModTest(new ModTestData + { + Mod = new OsuModSingleTap(), + PassCondition = () => Player.ScoreProcessor.Combo.Value == 1, + Autoplay = false, + Beatmap = new Beatmap + { + HitObjects = new List + { + new HitCircle + { + StartTime = 1000, + Position = new Vector2(100), + }, + }, + }, + ReplayFrames = new List + { + // first press during intro. + new OsuReplayFrame(500, new Vector2(200), OsuAction.LeftButton), + new OsuReplayFrame(501, new Vector2(200)), + // press different key at hitobject and ensure it has been hit. + new OsuReplayFrame(1000, new Vector2(100), OsuAction.RightButton), + } + }); + + /// + /// Ensures singletapping is reset before the first hitobject after a break. + /// + [Test] + public void TestInputAlternatingWithBreak() => CreateModTest(new ModTestData + { + Mod = new OsuModSingleTap(), + PassCondition = () => Player.ScoreProcessor.Combo.Value == 0 && Player.ScoreProcessor.HighestCombo.Value == 2, + Autoplay = false, + Beatmap = new Beatmap + { + Breaks = new List + { + new BreakPeriod(500, 2000), + }, + HitObjects = new List + { + new HitCircle + { + StartTime = 500, + Position = new Vector2(100), + }, + new HitCircle + { + StartTime = 2500, + Position = new Vector2(500, 100), + }, + new HitCircle + { + StartTime = 3000, + Position = new Vector2(500, 100), + }, + } + }, + ReplayFrames = new List + { + // first press to start singletap lock. + new OsuReplayFrame(500, new Vector2(100), OsuAction.LeftButton), + new OsuReplayFrame(501, new Vector2(100)), + // press different key after break but before hit object. + new OsuReplayFrame(2250, new Vector2(300, 100), OsuAction.RightButton), + new OsuReplayFrame(2251, new Vector2(300, 100)), + // press same key at second hitobject and ensure it has been hit. + new OsuReplayFrame(2500, new Vector2(500, 100), OsuAction.LeftButton), + new OsuReplayFrame(2501, new Vector2(500, 100)), + // press different key at third hitobject and ensure it has been missed. + new OsuReplayFrame(3000, new Vector2(500, 100), OsuAction.RightButton), + new OsuReplayFrame(3001, new Vector2(500, 100)), + } + }); + } +} From e9b0a3e4fafeb42d3dc45afc07b8afc5fc7a8d75 Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Wed, 13 Jul 2022 07:35:53 +0100 Subject: [PATCH 2182/2328] make alternate and singletap incompatible with eachother --- osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs | 3 +++ osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs index 2ad9789799..cc4591562e 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs @@ -3,6 +3,8 @@ #nullable disable +using System; +using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; @@ -14,6 +16,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Acronym => @"AL"; public override string Description => @"Don't use the same key twice in a row!"; public override IconUsage? Icon => FontAwesome.Solid.Keyboard; + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModSingleTap) }).ToArray(); protected override bool CheckCorrectAction(OsuAction action) { diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs b/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs index 22211b70c1..b2b6e11f48 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs @@ -3,6 +3,8 @@ #nullable disable +using System; +using System.Linq; using osu.Framework.Graphics; namespace osu.Game.Rulesets.Osu.Mods @@ -12,6 +14,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Name => @"Single Tap"; public override string Acronym => @"ST"; public override string Description => @"You must only use one key!"; + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAlternate) }).ToArray(); protected override bool CheckCorrectAction(OsuAction action) { From 6755a771b4adab14885aa9e2cf3fc1ffcaaf59a5 Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Wed, 13 Jul 2022 07:49:08 +0100 Subject: [PATCH 2183/2328] make Cinema incompatible with InputBlockingMod --- osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs index b86e06ec5e..ee6f072c4b 100644 --- a/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Mods public abstract class InputBlockingMod : Mod, IApplicableToDrawableRuleset { public override double ScoreMultiplier => 1.0; - public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModRelax) }; + public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModRelax), typeof(OsuModCinema) }; public override ModType Type => ModType.Conversion; protected const double FLASH_DURATION = 1000; From 27ef7fc78eda72a56fda70003f5f60e7d51430b4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 16:22:50 +0900 Subject: [PATCH 2184/2328] Add log output for custom storage usage Sometimes I am not sure where my osu! is reading files from. This should help somewhat. ```csharp /Users/dean/Projects/osu/osu.Desktop/bin/Debug/net6.0/osu! [runtime] 2022-07-13 07:22:03 [verbose]: Starting legacy IPC provider... [runtime] 2022-07-13 07:22:03 [verbose]: Attempting to use custom storage location /Users/dean/Games/osu-lazer-2 [runtime] 2022-07-13 07:22:03 [verbose]: Storage successfully changed to /Users/dean/Games/osu-lazer-2. [runtime] 2022-07-13 07:22:05 [verbose]: GL Initialized ``` --- osu.Game/IO/OsuStorage.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/IO/OsuStorage.cs b/osu.Game/IO/OsuStorage.cs index 89bdd09f0d..368ac56850 100644 --- a/osu.Game/IO/OsuStorage.cs +++ b/osu.Game/IO/OsuStorage.cs @@ -94,6 +94,8 @@ namespace osu.Game.IO error = OsuStorageError.None; Storage lastStorage = UnderlyingStorage; + Logger.Log($"Attempting to use custom storage location {CustomStoragePath}"); + try { Storage userStorage = host.GetStorage(CustomStoragePath); @@ -102,6 +104,7 @@ namespace osu.Game.IO error = OsuStorageError.AccessibleButEmpty; ChangeTargetStorage(userStorage); + Logger.Log($"Storage successfully changed to {CustomStoragePath}."); } catch { @@ -109,6 +112,9 @@ namespace osu.Game.IO ChangeTargetStorage(lastStorage); } + if (error != OsuStorageError.None) + Logger.Log($"Custom storage location could not be used ({error})."); + return error == OsuStorageError.None; } From 8820ea4006b1bd2119071a51fa5d1c786ff26014 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 16:36:43 +0900 Subject: [PATCH 2185/2328] Add last played date to `BeatmapInfo` --- osu.Game/Beatmaps/BeatmapInfo.cs | 5 +++++ osu.Game/Database/RealmAccess.cs | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 346bf86818..3b851e05c0 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -110,6 +110,11 @@ namespace osu.Game.Beatmaps public bool SamplesMatchPlaybackRate { get; set; } = true; + /// + /// The time at which this beatmap was last played by the local user. + /// + public DateTimeOffset? LastPlayed { get; set; } + /// /// The ratio of distance travelled per time unit. /// Generally used to decouple the spacing between hit objects from the enforced "velocity" of the beatmap (see ). diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 8cf57b802b..02b5a51f1f 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -58,8 +58,9 @@ namespace osu.Game.Database /// 12 2021-11-24 Add Status to RealmBeatmapSet. /// 13 2022-01-13 Final migration of beatmaps and scores to realm (multiple new storage fields). /// 14 2022-03-01 Added BeatmapUserSettings to BeatmapInfo. + /// 15 2022-07-13 Added LastPlayed to BeatmapInfo. /// - private const int schema_version = 14; + private const int schema_version = 15; /// /// Lock object which is held during sections, blocking realm retrieval during blocking periods. From 4b96d74b0cd7d800b0e6cdbe9caffc00a8e3ec6c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 16:43:39 +0900 Subject: [PATCH 2186/2328] Add test coverage of `LastPlayed` updating --- .../Gameplay/TestScenePlayerLocalScoreImport.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs index bfc06c0ee0..5ec9e88728 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; @@ -59,6 +60,20 @@ namespace osu.Game.Tests.Visual.Gameplay protected override bool AllowFail => false; + [Test] + public void TestLastPlayedUpdated() + { + DateTimeOffset? getLastPlayed() => Realm.Run(r => r.Find(Beatmap.Value.BeatmapInfo.ID)?.LastPlayed); + + AddStep("set no custom ruleset", () => customRuleset = null); + AddAssert("last played is null", () => getLastPlayed() == null); + + CreateTest(); + + AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning); + AddUntilStep("wait for last played to update", () => getLastPlayed() != null); + } + [Test] public void TestScoreStoredLocally() { From ab3ec80159f6b20e9eb0c470287fb1562267f971 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 16:36:55 +0900 Subject: [PATCH 2187/2328] Update `LastPlayed` on gameplay starting in a `SubmittingPlayer` --- osu.Game/Screens/Play/SubmittingPlayer.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/osu.Game/Screens/Play/SubmittingPlayer.cs b/osu.Game/Screens/Play/SubmittingPlayer.cs index c916791eaa..f3bc0ea798 100644 --- a/osu.Game/Screens/Play/SubmittingPlayer.cs +++ b/osu.Game/Screens/Play/SubmittingPlayer.cs @@ -11,6 +11,8 @@ using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Logging; using osu.Framework.Screens; +using osu.Game.Beatmaps; +using osu.Game.Database; using osu.Game.Online.API; using osu.Game.Online.Rooms; using osu.Game.Rulesets.Scoring; @@ -117,6 +119,23 @@ namespace osu.Game.Screens.Play await submitScore(score).ConfigureAwait(false); } + [Resolved] + private RealmAccess realm { get; set; } + + protected override void StartGameplay() + { + base.StartGameplay(); + + // User expectation is that last played should be updated when entering the gameplay loop + // from multiplayer / playlists / solo, even when using autoplay mod. + realm.WriteAsync(r => + { + var realmBeatmap = r.Find(Beatmap.Value.BeatmapInfo.ID); + if (realmBeatmap != null) + realmBeatmap.LastPlayed = DateTimeOffset.Now; + }); + } + public override bool OnExiting(ScreenExitEvent e) { bool exiting = base.OnExiting(e); From fc274629f8e574ac70dcc0895e6762b67a4a418a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 16:37:05 +0900 Subject: [PATCH 2188/2328] Add "last played" sort mode to song select Note that this will consider the most recent play of any beatmap in beatmap set groups for now, similar to other sort methods. --- osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs | 3 +++ osu.Game/Screens/Select/Filter/SortMode.cs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs index 36ec536780..94d911692c 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs @@ -81,6 +81,9 @@ namespace osu.Game.Screens.Select.Carousel case SortMode.DateAdded: return otherSet.BeatmapSet.DateAdded.CompareTo(BeatmapSet.DateAdded); + case SortMode.LastPlayed: + return -compareUsingAggregateMax(otherSet, b => (b.LastPlayed ?? DateTimeOffset.MinValue).ToUnixTimeSeconds()); + case SortMode.BPM: return compareUsingAggregateMax(otherSet, b => b.BPM); diff --git a/osu.Game/Screens/Select/Filter/SortMode.cs b/osu.Game/Screens/Select/Filter/SortMode.cs index 48f774393e..4227114618 100644 --- a/osu.Game/Screens/Select/Filter/SortMode.cs +++ b/osu.Game/Screens/Select/Filter/SortMode.cs @@ -23,6 +23,9 @@ namespace osu.Game.Screens.Select.Filter [Description("Date Added")] DateAdded, + [Description("Last Played")] + LastPlayed, + [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingDifficulty))] Difficulty, From 11c8a2c16e1e79737308731a519e44b0c978cd67 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 17:34:33 +0900 Subject: [PATCH 2189/2328] Disable tournament client "save changes" button when there's no changes to save --- osu.Game.Tournament/SaveChangesOverlay.cs | 101 ++++++++++++++++++++++ osu.Game.Tournament/TournamentGame.cs | 37 +------- osu.Game.Tournament/TournamentGameBase.cs | 17 ++-- osu.Game.Tournament/TourneyButton.cs | 3 + 4 files changed, 117 insertions(+), 41 deletions(-) create mode 100644 osu.Game.Tournament/SaveChangesOverlay.cs diff --git a/osu.Game.Tournament/SaveChangesOverlay.cs b/osu.Game.Tournament/SaveChangesOverlay.cs new file mode 100644 index 0000000000..03a3f2d3a4 --- /dev/null +++ b/osu.Game.Tournament/SaveChangesOverlay.cs @@ -0,0 +1,101 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable +using System.Threading.Tasks; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Online.Multiplayer; +using osuTK; + +namespace osu.Game.Tournament +{ + internal class SaveChangesOverlay : CompositeDrawable + { + [Resolved] + private TournamentGame tournamentGame { get; set; } + + private string lastSerialisedLadder; + private readonly TourneyButton saveChangesButton; + + public SaveChangesOverlay() + { + RelativeSizeAxes = Axes.Both; + + InternalChild = new Container + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Position = new Vector2(5), + CornerRadius = 10, + Masking = true, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + new Box + { + Colour = OsuColour.Gray(0.2f), + RelativeSizeAxes = Axes.Both, + }, + saveChangesButton = new TourneyButton + { + Text = "Save Changes", + Width = 140, + Height = 50, + Padding = new MarginPadding + { + Top = 10, + Left = 10, + }, + Margin = new MarginPadding + { + Right = 10, + Bottom = 10, + }, + Action = saveChanges, + }, + } + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + scheduleNextCheck(); + } + + private async Task checkForChanges() + { + string serialisedLadder = await Task.Run(() => tournamentGame.GetSerialisedLadder()); + + // If a save hasn't been triggered by the user yet, populate the initial value + lastSerialisedLadder ??= serialisedLadder; + + if (lastSerialisedLadder != serialisedLadder && !saveChangesButton.Enabled.Value) + { + saveChangesButton.Enabled.Value = true; + saveChangesButton.Background + .FadeColour(saveChangesButton.BackgroundColour.Lighten(0.5f), 500, Easing.In).Then() + .FadeColour(saveChangesButton.BackgroundColour, 500, Easing.Out) + .Loop(); + } + + scheduleNextCheck(); + } + + private void scheduleNextCheck() => Scheduler.AddDelayed(() => checkForChanges().FireAndForget(), 1000); + + private void saveChanges() + { + tournamentGame.SaveChanges(); + lastSerialisedLadder = tournamentGame.GetSerialisedLadder(); + + saveChangesButton.Enabled.Value = false; + saveChangesButton.Background.FadeColour(saveChangesButton.BackgroundColour, 500); + } + } +} diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index 537fbfc038..7d67bfa759 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -11,8 +11,6 @@ using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Handlers.Mouse; using osu.Framework.Logging; using osu.Framework.Platform; @@ -20,11 +18,11 @@ using osu.Game.Graphics; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Models; -using osuTK; using osuTK.Graphics; namespace osu.Game.Tournament { + [Cached] public class TournamentGame : TournamentGameBase { public static ColourInfo GetTeamColour(TeamColour teamColour) => teamColour == TeamColour.Red ? COLOUR_RED : COLOUR_BLUE; @@ -78,40 +76,9 @@ namespace osu.Game.Tournament LoadComponentsAsync(new[] { - new Container + new SaveChangesOverlay { - CornerRadius = 10, Depth = float.MinValue, - Position = new Vector2(5), - Masking = true, - AutoSizeAxes = Axes.Both, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Children = new Drawable[] - { - new Box - { - Colour = OsuColour.Gray(0.2f), - RelativeSizeAxes = Axes.Both, - }, - new TourneyButton - { - Text = "Save Changes", - Width = 140, - Height = 50, - Padding = new MarginPadding - { - Top = 10, - Left = 10, - }, - Margin = new MarginPadding - { - Right = 10, - Bottom = 10, - }, - Action = SaveChanges, - }, - } }, heightWarning = new WarningBox("Please make the window wider") { diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 75c9f17d4c..f2a35ea5b3 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -295,7 +295,7 @@ namespace osu.Game.Tournament } } - protected virtual void SaveChanges() + public void SaveChanges() { if (!bracketLoadTaskCompletionSource.Task.IsCompletedSuccessfully) { @@ -311,7 +311,16 @@ namespace osu.Game.Tournament .ToList(); // Serialise before opening stream for writing, so if there's a failure it will leave the file in the previous state. - string serialisedLadder = JsonConvert.SerializeObject(ladder, + string serialisedLadder = GetSerialisedLadder(); + + using (var stream = storage.CreateFileSafely(BRACKET_FILENAME)) + using (var sw = new StreamWriter(stream)) + sw.Write(serialisedLadder); + } + + public string GetSerialisedLadder() + { + return JsonConvert.SerializeObject(ladder, new JsonSerializerSettings { Formatting = Formatting.Indented, @@ -319,10 +328,6 @@ namespace osu.Game.Tournament DefaultValueHandling = DefaultValueHandling.Ignore, Converters = new JsonConverter[] { new JsonPointConverter() } }); - - using (var stream = storage.CreateFileSafely(BRACKET_FILENAME)) - using (var sw = new StreamWriter(stream)) - sw.Write(serialisedLadder); } protected override UserInputManager CreateUserInputManager() => new TournamentInputManager(); diff --git a/osu.Game.Tournament/TourneyButton.cs b/osu.Game.Tournament/TourneyButton.cs index f5a82771f5..f1b14df783 100644 --- a/osu.Game.Tournament/TourneyButton.cs +++ b/osu.Game.Tournament/TourneyButton.cs @@ -3,12 +3,15 @@ #nullable disable +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.UserInterface; namespace osu.Game.Tournament { public class TourneyButton : OsuButton { + public new Box Background => base.Background; + public TourneyButton() : base(null) { From b9ad90ce54ecf92709de51df29642d38a0bc6783 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 17:57:45 +0900 Subject: [PATCH 2190/2328] Switch `TeamWinScreen` scheduling to `AddOnce` --- osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs index 07557674e8..ac54ff58f5 100644 --- a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs +++ b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs @@ -66,7 +66,7 @@ namespace osu.Game.Tournament.Screens.TeamWin private bool firstDisplay = true; - private void update() => Schedule(() => + private void update() => Scheduler.AddOnce(() => { var match = CurrentMatch.Value; From 4dff999ce665b20cd87b1fdb7064863fe8da6286 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 18:09:54 +0900 Subject: [PATCH 2191/2328] Fix potential null referenced in `SeedingScreen` Also ensure that any update operations only occur when the seeding screen is displayed. They were running in the background until now. --- osu.Game.Tournament/Models/SeedingBeatmap.cs | 4 +--- .../Screens/TeamIntro/SeedingScreen.cs | 13 ++++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tournament/Models/SeedingBeatmap.cs b/osu.Game.Tournament/Models/SeedingBeatmap.cs index 03beb7ca9a..fb0e20556c 100644 --- a/osu.Game.Tournament/Models/SeedingBeatmap.cs +++ b/osu.Game.Tournament/Models/SeedingBeatmap.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using Newtonsoft.Json; using osu.Framework.Bindables; @@ -13,7 +11,7 @@ namespace osu.Game.Tournament.Models public int ID; [JsonProperty("BeatmapInfo")] - public TournamentBeatmap Beatmap; + public TournamentBeatmap? Beatmap; public long Score; diff --git a/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs index 719e0384d3..4970d520af 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs @@ -69,7 +69,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro currentTeam.BindValueChanged(teamChanged, true); } - private void teamChanged(ValueChangedEvent team) + private void teamChanged(ValueChangedEvent team) => Scheduler.AddOnce(() => { if (team.NewValue == null) { @@ -78,7 +78,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro } showTeam(team.NewValue); - } + }); protected override void CurrentMatchChanged(ValueChangedEvent match) { @@ -120,8 +120,14 @@ namespace osu.Game.Tournament.Screens.TeamIntro foreach (var seeding in team.SeedingResults) { fill.Add(new ModRow(seeding.Mod.Value, seeding.Seed.Value)); + foreach (var beatmap in seeding.Beatmaps) + { + if (beatmap.Beatmap == null) + continue; + fill.Add(new BeatmapScoreRow(beatmap)); + } } } @@ -157,7 +163,8 @@ namespace osu.Game.Tournament.Screens.TeamIntro Children = new Drawable[] { new TournamentSpriteText { Text = beatmap.Score.ToString("#,0"), Colour = TournamentGame.TEXT_COLOUR, Width = 80 }, - new TournamentSpriteText { Text = "#" + beatmap.Seed.Value.ToString("#,0"), Colour = TournamentGame.TEXT_COLOUR, Font = OsuFont.Torus.With(weight: FontWeight.Regular) }, + new TournamentSpriteText + { Text = "#" + beatmap.Seed.Value.ToString("#,0"), Colour = TournamentGame.TEXT_COLOUR, Font = OsuFont.Torus.With(weight: FontWeight.Regular) }, } }, }; From 1516756d8bfa3de7a26966be4ad083b5b800768c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 18:10:27 +0900 Subject: [PATCH 2192/2328] Fix team name not updating on `TeamDisplay` immediately --- .../Components/TournamentSpriteTextWithBackground.cs | 3 ++- .../Screens/Gameplay/Components/TeamDisplay.cs | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Components/TournamentSpriteTextWithBackground.cs b/osu.Game.Tournament/Components/TournamentSpriteTextWithBackground.cs index 0fc3646585..b088670caa 100644 --- a/osu.Game.Tournament/Components/TournamentSpriteTextWithBackground.cs +++ b/osu.Game.Tournament/Components/TournamentSpriteTextWithBackground.cs @@ -12,7 +12,8 @@ namespace osu.Game.Tournament.Components { public class TournamentSpriteTextWithBackground : CompositeDrawable { - protected readonly TournamentSpriteText Text; + public readonly TournamentSpriteText Text; + protected readonly Box Background; public TournamentSpriteTextWithBackground(string text = "") diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/TeamDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/TeamDisplay.cs index bb187c9e67..1eceddd871 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/TeamDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/TeamDisplay.cs @@ -16,6 +16,10 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components { private readonly TeamScore score; + private readonly TournamentSpriteTextWithBackground teamText; + + private readonly Bindable teamName = new Bindable("???"); + private bool showScore; public bool ShowScore @@ -93,7 +97,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components } } }, - new TournamentSpriteTextWithBackground(team?.FullName.Value ?? "???") + teamText = new TournamentSpriteTextWithBackground { Scale = new Vector2(0.5f), Origin = anchor, @@ -113,6 +117,11 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components updateDisplay(); FinishTransforms(true); + + if (Team != null) + teamName.BindTo(Team.FullName); + + teamName.BindValueChanged(name => teamText.Text.Text = name.NewValue, true); } private void updateDisplay() From 5c6fa2341f8fe3bcfdc02df08652538fd82fd3d1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 18:15:59 +0900 Subject: [PATCH 2193/2328] Fix `TeamScoreDisplay` not tracking team changes properly --- .../Screens/Gameplay/Components/TeamScoreDisplay.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/TeamScoreDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/TeamScoreDisplay.cs index ed11f097ed..5ee57e9271 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/TeamScoreDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/TeamScoreDisplay.cs @@ -42,6 +42,8 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components currentMatch.BindTo(ladder.CurrentMatch); currentMatch.BindValueChanged(matchChanged); + currentTeam.BindValueChanged(teamChanged); + updateMatch(); } @@ -67,7 +69,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components // team may change to same team, which means score is not in a good state. // thus we handle this manually. - teamChanged(currentTeam.Value); + currentTeam.TriggerChange(); } protected override bool OnMouseDown(MouseDownEvent e) @@ -88,11 +90,11 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components return base.OnMouseDown(e); } - private void teamChanged(TournamentTeam team) + private void teamChanged(ValueChangedEvent team) { InternalChildren = new Drawable[] { - teamDisplay = new TeamDisplay(team, teamColour, currentTeamScore, currentMatch.Value?.PointsToWin ?? 0), + teamDisplay = new TeamDisplay(team.NewValue, teamColour, currentTeamScore, currentMatch.Value?.PointsToWin ?? 0), }; } } From 214351a87e3022eed3e929cd866ef4e1511ac553 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 18:32:47 +0900 Subject: [PATCH 2194/2328] Ensure any changes are committed before changing `LadderEditorSettings`'s target match --- .../Screens/Ladder/Components/LadderEditorSettings.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index f0eda5672a..1fdf616e34 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -53,6 +53,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components editorInfo.Selected.ValueChanged += selection => { + // ensure any ongoing edits are committed out to the *current* selection before changing to a new one. + GetContainingInputManager().TriggerFocusContention(null); + roundDropdown.Current = selection.NewValue?.Round; losersCheckbox.Current = selection.NewValue?.Losers; dateTimeBox.Current = selection.NewValue?.Date; From 467f83b603dcdba943c3d2f9e8341eaa55127186 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 18:48:12 +0900 Subject: [PATCH 2195/2328] Add non-null assertion missing in `BeatmapScoreRow` --- osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs index 4970d520af..9262cab098 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs @@ -3,6 +3,7 @@ #nullable disable +using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -135,6 +136,8 @@ namespace osu.Game.Tournament.Screens.TeamIntro { public BeatmapScoreRow(SeedingBeatmap beatmap) { + Debug.Assert(beatmap.Beatmap != null); + RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; From 952d97c66e98de0f5e90cc285b329b2abf26463b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 19:02:21 +0900 Subject: [PATCH 2196/2328] Update comment regarding `LoadTrack` safety --- osu.Game/Screens/Edit/Editor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 2b763415cd..48576b81e2 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -186,7 +186,7 @@ namespace osu.Game.Screens.Edit loadableBeatmap = beatmapManager.CreateNew(Ruleset.Value, api.LocalUser.Value); // required so we can get the track length in EditorClock. - // this is safe as nothing has yet got a reference to this new beatmap. + // this is ONLY safe because the track being provided is a `TrackVirtual` which we don't really care about disposing. loadableBeatmap.LoadTrack(); // this is a bit haphazard, but guards against setting the lease Beatmap bindable if From 6950223a7dd12a3ce84daf2ef48d9ee1e9a07784 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 19:18:38 +0900 Subject: [PATCH 2197/2328] Fix drawable mutation from disposal thread --- osu.Game/Screens/Select/FooterButtonMods.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/FooterButtonMods.cs b/osu.Game/Screens/Select/FooterButtonMods.cs index 2732b5baa8..c938f58984 100644 --- a/osu.Game/Screens/Select/FooterButtonMods.cs +++ b/osu.Game/Screens/Select/FooterButtonMods.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Select Current.BindValueChanged(_ => updateMultiplierText(), true); } - private void updateMultiplierText() + private void updateMultiplierText() => Schedule(() => { double multiplier = Current.Value?.Aggregate(1.0, (current, mod) => current * mod.ScoreMultiplier) ?? 1; @@ -85,6 +85,6 @@ namespace osu.Game.Screens.Select modDisplay.FadeIn(); else modDisplay.FadeOut(); - } + }); } } From c6b6f41b717be33f1595b9effe4a6a4f8845d038 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 19:40:57 +0900 Subject: [PATCH 2198/2328] Add test coverage of `AudioEquals` --- .../NonVisual/BeatmapSetInfoEqualityTest.cs | 44 +++++++++++++++++++ osu.Game.Tests/Resources/TestResources.cs | 1 + 2 files changed, 45 insertions(+) diff --git a/osu.Game.Tests/NonVisual/BeatmapSetInfoEqualityTest.cs b/osu.Game.Tests/NonVisual/BeatmapSetInfoEqualityTest.cs index de23b012c1..c887105da6 100644 --- a/osu.Game.Tests/NonVisual/BeatmapSetInfoEqualityTest.cs +++ b/osu.Game.Tests/NonVisual/BeatmapSetInfoEqualityTest.cs @@ -4,9 +4,12 @@ #nullable disable using System; +using System.Linq; using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Extensions; +using osu.Game.Models; +using osu.Game.Tests.Resources; namespace osu.Game.Tests.NonVisual { @@ -23,6 +26,47 @@ namespace osu.Game.Tests.NonVisual Assert.IsTrue(ourInfo.MatchesOnlineID(otherInfo)); } + [Test] + public void TestAudioEqualityNoFile() + { + var beatmapSetA = TestResources.CreateTestBeatmapSetInfo(1); + var beatmapSetB = TestResources.CreateTestBeatmapSetInfo(1); + + Assert.AreNotEqual(beatmapSetA, beatmapSetB); + Assert.IsTrue(beatmapSetA.Beatmaps.Single().AudioEquals(beatmapSetB.Beatmaps.Single())); + } + + [Test] + public void TestAudioEqualitySameHash() + { + var beatmapSetA = TestResources.CreateTestBeatmapSetInfo(1); + var beatmapSetB = TestResources.CreateTestBeatmapSetInfo(1); + + addAudioFile(beatmapSetA, "abc"); + addAudioFile(beatmapSetB, "abc"); + + Assert.AreNotEqual(beatmapSetA, beatmapSetB); + Assert.IsTrue(beatmapSetA.Beatmaps.Single().AudioEquals(beatmapSetB.Beatmaps.Single())); + } + + [Test] + public void TestAudioEqualityDifferentHash() + { + var beatmapSetA = TestResources.CreateTestBeatmapSetInfo(1); + var beatmapSetB = TestResources.CreateTestBeatmapSetInfo(1); + + addAudioFile(beatmapSetA); + addAudioFile(beatmapSetB); + + Assert.AreNotEqual(beatmapSetA, beatmapSetB); + Assert.IsTrue(beatmapSetA.Beatmaps.Single().AudioEquals(beatmapSetB.Beatmaps.Single())); + } + + private static void addAudioFile(BeatmapSetInfo beatmapSetInfo, string hash = null) + { + beatmapSetInfo.Files.Add(new RealmNamedFileUsage(new RealmFile { Hash = hash ?? Guid.NewGuid().ToString() }, "audio.mp3")); + } + [Test] public void TestDatabasedWithDatabased() { diff --git a/osu.Game.Tests/Resources/TestResources.cs b/osu.Game.Tests/Resources/TestResources.cs index 91d4eb70e8..41404b2636 100644 --- a/osu.Game.Tests/Resources/TestResources.cs +++ b/osu.Game.Tests/Resources/TestResources.cs @@ -134,6 +134,7 @@ namespace osu.Game.Tests.Resources DifficultyName = $"{version} {beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})", StarRating = diff, Length = length, + BeatmapSet = beatmapSet, BPM = bpm, Hash = Guid.NewGuid().ToString().ComputeMD5Hash(), Ruleset = rulesetInfo, From 1cfdea911b7aec4ce7a354480b1818d61a5cbd33 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 19:13:18 +0900 Subject: [PATCH 2199/2328] Fix audio and background file equality incorrectly comparing `BeatmapSet.Hash` --- osu.Game/Beatmaps/BeatmapInfo.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 346bf86818..531dc7deca 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Diagnostics; using System.Linq; using JetBrains.Annotations; using Newtonsoft.Json; @@ -151,14 +152,23 @@ namespace osu.Game.Beatmaps public bool AudioEquals(BeatmapInfo? other) => other != null && BeatmapSet != null && other.BeatmapSet != null - && BeatmapSet.Hash == other.BeatmapSet.Hash - && Metadata.AudioFile == other.Metadata.AudioFile; + && compareFiles(this, other, m => m.AudioFile); public bool BackgroundEquals(BeatmapInfo? other) => other != null && BeatmapSet != null && other.BeatmapSet != null - && BeatmapSet.Hash == other.BeatmapSet.Hash - && Metadata.BackgroundFile == other.Metadata.BackgroundFile; + && compareFiles(this, other, m => m.BackgroundFile); + + private static bool compareFiles(BeatmapInfo x, BeatmapInfo y, Func getFilename) + { + Debug.Assert(x.BeatmapSet != null); + Debug.Assert(y.BeatmapSet != null); + + string? fileHashX = x.BeatmapSet.Files.FirstOrDefault(f => f.Filename == getFilename(x.BeatmapSet.Metadata))?.File.Hash; + string? fileHashY = y.BeatmapSet.Files.FirstOrDefault(f => f.Filename == getFilename(y.BeatmapSet.Metadata))?.File.Hash; + + return fileHashX == fileHashY; + } IBeatmapMetadataInfo IBeatmapInfo.Metadata => Metadata; IBeatmapSetInfo? IBeatmapInfo.BeatmapSet => BeatmapSet; From 2e86e7ccee2e802c01e17182f15145ec436988e6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 19:31:53 +0900 Subject: [PATCH 2200/2328] Add extra steps to `TestExitWithoutSave` to guarantee track type --- .../Visual/Editing/TestSceneEditorBeatmapCreation.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs index f565ca3ef4..6ad6f0b299 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs @@ -6,6 +6,7 @@ using System.IO; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Audio.Track; using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; using osu.Framework.Screens; @@ -103,6 +104,8 @@ namespace osu.Game.Tests.Visual.Editing */ public void TestAddAudioTrack() { + AddAssert("track is virtual", () => Beatmap.Value.Track is TrackVirtual); + AddAssert("switch track to real track", () => { var setup = Editor.ChildrenOfType().First(); @@ -131,6 +134,7 @@ namespace osu.Game.Tests.Visual.Editing } }); + AddAssert("track is not virtual", () => Beatmap.Value.Track is not TrackVirtual); AddAssert("track length changed", () => Beatmap.Value.Track.Length > 60000); } From 5e6b9b96b01944becc8ae25210fd4348a8d31d4a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 22:02:46 +0900 Subject: [PATCH 2201/2328] Apply NRT to new `InputBlockingMod` class --- osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs index ee6f072c4b..40c621a4be 100644 --- a/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; using System.Linq; @@ -34,12 +32,13 @@ namespace osu.Game.Rulesets.Osu.Mods /// /// This is different from in that the periods here end strictly at the first object after the break, rather than the break's end time. /// - protected PeriodTracker NonGameplayPeriods; + protected PeriodTracker NonGameplayPeriods = null!; + + protected DrawableRuleset Ruleset = null!; + + protected IFrameStableClock GameplayClock = null!; protected OsuAction? LastActionPressed; - protected DrawableRuleset Ruleset; - - protected IFrameStableClock GameplayClock; public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) { From 33dd9562cc1fe03f3f0b625f6b62a9a630072044 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 22:04:57 +0900 Subject: [PATCH 2202/2328] Privatise some fields --- osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs index 40c621a4be..4541d33579 100644 --- a/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs @@ -26,19 +26,19 @@ namespace osu.Game.Rulesets.Osu.Mods protected const double FLASH_DURATION = 1000; + protected DrawableRuleset Ruleset = null!; + + protected OsuAction? LastActionPressed; + /// /// A tracker for periods where alternate should not be forced (i.e. non-gameplay periods). /// /// /// This is different from in that the periods here end strictly at the first object after the break, rather than the break's end time. /// - protected PeriodTracker NonGameplayPeriods = null!; + private PeriodTracker nonGameplayPeriods = null!; - protected DrawableRuleset Ruleset = null!; - - protected IFrameStableClock GameplayClock = null!; - - protected OsuAction? LastActionPressed; + private IFrameStableClock gameplayClock = null!; public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) { @@ -57,14 +57,14 @@ namespace osu.Game.Rulesets.Osu.Mods static double getValidJudgementTime(HitObject hitObject) => hitObject.StartTime - hitObject.HitWindows.WindowFor(HitResult.Meh); } - NonGameplayPeriods = new PeriodTracker(periods); + nonGameplayPeriods = new PeriodTracker(periods); - GameplayClock = drawableRuleset.FrameStableClock; + gameplayClock = drawableRuleset.FrameStableClock; } protected virtual bool CheckCorrectAction(OsuAction action) { - if (NonGameplayPeriods.IsInAny(GameplayClock.CurrentTime)) + if (nonGameplayPeriods.IsInAny(gameplayClock.CurrentTime)) { LastActionPressed = null; return true; From be3187c3a44282e0e9f5ce0a705739b1e1c9fa76 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 22:05:56 +0900 Subject: [PATCH 2203/2328] Remove remnant nullable disables --- osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSingleTap.cs | 2 -- osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs | 2 -- osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs | 2 -- 3 files changed, 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSingleTap.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSingleTap.cs index 0fe35fac0b..1aed84be10 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSingleTap.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSingleTap.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using NUnit.Framework; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs index cc4591562e..e1be8288e3 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Linq; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs b/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs index b2b6e11f48..2000adc7d9 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Linq; using osu.Framework.Graphics; From 0da1bd393c48b4514071df474e57de6a90dc369b Mon Sep 17 00:00:00 2001 From: James <51536154+tsunyoku@users.noreply.github.com> Date: Wed, 13 Jul 2022 14:26:44 +0100 Subject: [PATCH 2204/2328] privatise checkCorrectAction, add abstract CheckValidNewAction function --- .../Mods/InputBlockingMod.cs | 13 +++++++++-- osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs | 17 +------------- osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs | 23 +------------------ 3 files changed, 13 insertions(+), 40 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs index 4541d33579..40d05b9475 100644 --- a/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs @@ -62,7 +62,9 @@ namespace osu.Game.Rulesets.Osu.Mods gameplayClock = drawableRuleset.FrameStableClock; } - protected virtual bool CheckCorrectAction(OsuAction action) + protected abstract bool CheckValidNewAction(OsuAction action); + + private bool checkCorrectAction(OsuAction action) { if (nonGameplayPeriods.IsInAny(gameplayClock.CurrentTime)) { @@ -81,6 +83,13 @@ namespace osu.Game.Rulesets.Osu.Mods return true; } + if (CheckValidNewAction(action)) + { + LastActionPressed = action; + return true; + } + + ruleset.Cursor.FlashColour(Colour4.Red, flash_duration, Easing.OutQuint); return false; } @@ -95,7 +104,7 @@ namespace osu.Game.Rulesets.Osu.Mods public bool OnPressed(KeyBindingPressEvent e) // if the pressed action is incorrect, block it from reaching gameplay. - => !mod.CheckCorrectAction(e.Action); + => !mod.checkCorrectAction(e.Action); public void OnReleased(KeyBindingReleaseEvent e) { diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs index e1be8288e3..9bc401de67 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs @@ -3,7 +3,6 @@ using System; using System.Linq; -using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; namespace osu.Game.Rulesets.Osu.Mods @@ -16,20 +15,6 @@ namespace osu.Game.Rulesets.Osu.Mods public override IconUsage? Icon => FontAwesome.Solid.Keyboard; public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModSingleTap) }).ToArray(); - protected override bool CheckCorrectAction(OsuAction action) - { - if (base.CheckCorrectAction(action)) - return true; - - if (LastActionPressed != action) - { - // User alternated correctly. - LastActionPressed = action; - return true; - } - - Ruleset.Cursor.FlashColour(Colour4.Red, FLASH_DURATION, Easing.OutQuint); - return false; - } + protected override bool CheckValidNewAction(OsuAction action) => LastActionPressed != action; } } diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs b/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs index 2000adc7d9..95b798c39e 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs @@ -3,7 +3,6 @@ using System; using System.Linq; -using osu.Framework.Graphics; namespace osu.Game.Rulesets.Osu.Mods { @@ -14,26 +13,6 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => @"You must only use one key!"; public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAlternate) }).ToArray(); - protected override bool CheckCorrectAction(OsuAction action) - { - if (base.CheckCorrectAction(action)) - return true; - - if (LastActionPressed == null) - { - // First keypress, store the expected action. - LastActionPressed = action; - return true; - } - - if (LastActionPressed == action) - { - // User singletapped correctly. - return true; - } - - Ruleset.Cursor.FlashColour(Colour4.Red, FLASH_DURATION, Easing.OutQuint); - return false; - } + protected override bool CheckValidNewAction(OsuAction action) => LastActionPressed == null || LastActionPressed == action; } } From af0300249590b2ef395375b567cfd8e2b88489e5 Mon Sep 17 00:00:00 2001 From: James <51536154+tsunyoku@users.noreply.github.com> Date: Wed, 13 Jul 2022 14:31:09 +0100 Subject: [PATCH 2205/2328] make flash duration and ruleset private --- osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs index 40d05b9475..e3bb5f17e9 100644 --- a/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs @@ -24,9 +24,9 @@ namespace osu.Game.Rulesets.Osu.Mods public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModRelax), typeof(OsuModCinema) }; public override ModType Type => ModType.Conversion; - protected const double FLASH_DURATION = 1000; + private const double flash_duration = 1000; - protected DrawableRuleset Ruleset = null!; + private DrawableRuleset ruleset = null!; protected OsuAction? LastActionPressed; @@ -42,17 +42,17 @@ namespace osu.Game.Rulesets.Osu.Mods public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) { - Ruleset = drawableRuleset; + ruleset = drawableRuleset; drawableRuleset.KeyBindingInputManager.Add(new InputInterceptor(this)); var periods = new List(); if (drawableRuleset.Objects.Any()) { - periods.Add(new Period(int.MinValue, getValidJudgementTime(Ruleset.Objects.First()) - 1)); + periods.Add(new Period(int.MinValue, getValidJudgementTime(ruleset.Objects.First()) - 1)); foreach (BreakPeriod b in drawableRuleset.Beatmap.Breaks) - periods.Add(new Period(b.StartTime, getValidJudgementTime(Ruleset.Objects.First(h => h.StartTime >= b.EndTime)) - 1)); + periods.Add(new Period(b.StartTime, getValidJudgementTime(ruleset.Objects.First(h => h.StartTime >= b.EndTime)) - 1)); static double getValidJudgementTime(HitObject hitObject) => hitObject.StartTime - hitObject.HitWindows.WindowFor(HitResult.Meh); } From 937692604edbc919e6a55d6499ca6a0e72bc69c5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 22:37:20 +0900 Subject: [PATCH 2206/2328] Remove mention of autoplay mod for now --- osu.Game/Screens/Play/SubmittingPlayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/SubmittingPlayer.cs b/osu.Game/Screens/Play/SubmittingPlayer.cs index f3bc0ea798..ad63925b93 100644 --- a/osu.Game/Screens/Play/SubmittingPlayer.cs +++ b/osu.Game/Screens/Play/SubmittingPlayer.cs @@ -127,7 +127,7 @@ namespace osu.Game.Screens.Play base.StartGameplay(); // User expectation is that last played should be updated when entering the gameplay loop - // from multiplayer / playlists / solo, even when using autoplay mod. + // from multiplayer / playlists / solo. realm.WriteAsync(r => { var realmBeatmap = r.Find(Beatmap.Value.BeatmapInfo.ID); From 4d9494d3b317a50ec50ed045845bce55203fd560 Mon Sep 17 00:00:00 2001 From: James <51536154+tsunyoku@users.noreply.github.com> Date: Wed, 13 Jul 2022 14:42:45 +0100 Subject: [PATCH 2207/2328] change LastPressedAction to have a private setter --- osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs index e3bb5f17e9..daae67c3a0 100644 --- a/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Mods private DrawableRuleset ruleset = null!; - protected OsuAction? LastActionPressed; + protected OsuAction? LastActionPressed { get; private set; } /// /// A tracker for periods where alternate should not be forced (i.e. non-gameplay periods). From 0db1caf591e53b275cd14df4d83cd0ea663a9ca0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 23:15:25 +0900 Subject: [PATCH 2208/2328] Add language selection to first run overlay --- .../Overlays/FirstRunSetup/ScreenWelcome.cs | 137 +++++++++++++++++- 1 file changed, 135 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs index 20ff8f21c8..ca1c02d53e 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs @@ -1,14 +1,23 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - +using System; +using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Configuration; +using osu.Framework.Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; using osu.Framework.Localisation; +using osu.Game.Extensions; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; using osu.Game.Localisation; +using osuTK; namespace osu.Game.Overlays.FirstRunSetup { @@ -26,7 +35,131 @@ namespace osu.Game.Overlays.FirstRunSetup RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, + new LanguageSelectionFlow + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + } }; } + + private class LanguageSelectionFlow : FillFlowContainer + { + private Bindable frameworkLocale = null!; + + [BackgroundDependencyLoader] + private void load(FrameworkConfigManager frameworkConfig) + { + Direction = FillDirection.Full; + Spacing = new Vector2(5); + + ChildrenEnumerable = Enum.GetValues(typeof(Language)) + .Cast() + .Select(l => new LanguageButton(l) + { + Action = () => frameworkLocale.Value = l.ToCultureCode() + }); + + frameworkLocale = frameworkConfig.GetBindable(FrameworkSetting.Locale); + frameworkLocale.BindValueChanged(locale => + { + if (!LanguageExtensions.TryParseCultureCode(frameworkLocale.Value, out var language)) + language = Language.en; + + foreach (var c in Children.OfType()) + c.Selected = c.Language == language; + }, true); + } + + private class LanguageButton : OsuClickableContainer + { + public readonly Language Language; + + private Box backgroundBox = null!; + + private OsuSpriteText text = null!; + + [Resolved] + private OverlayColourProvider colourProvider { get; set; } = null!; + + private bool selected; + + public bool Selected + { + get => selected; + set + { + if (selected == value) + return; + + selected = value; + + updateState(); + } + } + + public LanguageButton(Language language) + { + Language = language; + + Size = new Vector2(160, 50); + Masking = true; + CornerRadius = 10; + } + + [BackgroundDependencyLoader] + private void load() + { + InternalChildren = new Drawable[] + { + backgroundBox = new Box + { + Alpha = 0, + Colour = colourProvider.Background5, + RelativeSizeAxes = Axes.Both, + }, + text = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Colour = colourProvider.Light1, + Text = Language.GetDescription(), + } + }; + } + + protected override bool OnHover(HoverEvent e) + { + if (!selected) + updateState(); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + if (!selected) + updateState(); + base.OnHoverLost(e); + } + + private void updateState() + { + const double duration = 1000; + + if (selected) + { + backgroundBox.FadeTo(1, duration, Easing.OutQuint); + text.FadeColour(colourProvider.Content1, duration, Easing.OutQuint); + text.ScaleTo(1.2f, duration, Easing.OutQuint); + } + else + { + backgroundBox.FadeTo(IsHovered ? 0.4f : 0, duration / 2, Easing.OutQuint); + text.ScaleTo(1, duration / 2, Easing.OutQuint); + text.FadeColour(colourProvider.Light1, duration / 2, Easing.OutQuint); + } + } + } + } } } From 3b554140db559d9c1a1eab8ad01d7f7aab2eb04c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 23:22:50 +0900 Subject: [PATCH 2209/2328] Use grid container to avoid layout changes when changing language --- .../Overlays/FirstRunSetup/ScreenWelcome.cs | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs index ca1c02d53e..ec074bcd04 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs @@ -29,11 +29,27 @@ namespace osu.Game.Overlays.FirstRunSetup { Content.Children = new Drawable[] { - new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) + new GridContainer { - Text = FirstRunSetupOverlayStrings.WelcomeDescription, RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y + AutoSizeAxes = Axes.Y, + RowDimensions = new[] + { + // Avoid height changes when changing language. + new Dimension(GridSizeMode.AutoSize, minSize: 100), + }, + Content = new[] + { + new Drawable[] + { + new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) + { + Text = FirstRunSetupOverlayStrings.WelcomeDescription, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + }, + }, + } }, new LanguageSelectionFlow { From 31e1e963642b9ea4ee5e2c06cd4ba4fbefa7b4b5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Jul 2022 23:25:32 +0900 Subject: [PATCH 2210/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 8c15ed7949..caaa83bff4 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 1251ab800b..355fd5f458 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index c38bb548bf..fcf71f3ab0 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From 7ac04d04782837946bf6247434d8303d99e1760a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Jul 2022 00:58:32 +0900 Subject: [PATCH 2211/2328] Fix potential crash when exiting editor test mode --- osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs b/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs index 87e640badc..fd230a97bc 100644 --- a/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs +++ b/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs @@ -35,7 +35,13 @@ namespace osu.Game.Screens.Edit.GameplayTest ScoreProcessor.HasCompleted.BindValueChanged(completed => { if (completed.NewValue) - Scheduler.AddDelayed(this.Exit, RESULTS_DISPLAY_DELAY); + { + Scheduler.AddDelayed(() => + { + if (this.IsCurrentScreen()) + this.Exit(); + }, RESULTS_DISPLAY_DELAY); + } }); } From e2f2d5f79469f0a06ae7fd3e839f68d2f698fb29 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Jul 2022 01:40:44 +0900 Subject: [PATCH 2212/2328] Rename last action to better represent that it is only captured actions --- osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs | 6 +++--- osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs index daae67c3a0..a7aca8257b 100644 --- a/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/InputBlockingMod.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Mods private DrawableRuleset ruleset = null!; - protected OsuAction? LastActionPressed { get; private set; } + protected OsuAction? LastAcceptedAction { get; private set; } /// /// A tracker for periods where alternate should not be forced (i.e. non-gameplay periods). @@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.Mods { if (nonGameplayPeriods.IsInAny(gameplayClock.CurrentTime)) { - LastActionPressed = null; + LastAcceptedAction = null; return true; } @@ -85,7 +85,7 @@ namespace osu.Game.Rulesets.Osu.Mods if (CheckValidNewAction(action)) { - LastActionPressed = action; + LastAcceptedAction = action; return true; } diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs index 9bc401de67..d88cb17e84 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs @@ -15,6 +15,6 @@ namespace osu.Game.Rulesets.Osu.Mods public override IconUsage? Icon => FontAwesome.Solid.Keyboard; public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModSingleTap) }).ToArray(); - protected override bool CheckValidNewAction(OsuAction action) => LastActionPressed != action; + protected override bool CheckValidNewAction(OsuAction action) => LastAcceptedAction != action; } } diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs b/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs index 95b798c39e..051ceb968c 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs @@ -13,6 +13,6 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => @"You must only use one key!"; public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAlternate) }).ToArray(); - protected override bool CheckValidNewAction(OsuAction action) => LastActionPressed == null || LastActionPressed == action; + protected override bool CheckValidNewAction(OsuAction action) => LastAcceptedAction == null || LastAcceptedAction == action; } } From 099a7e90d624ec69192aafd242334b109b0033f6 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Jul 2022 02:19:23 +0300 Subject: [PATCH 2213/2328] Centralise creation of playlist in test scene --- .../TestSceneDrawableRoomPlaylist.cs | 107 ++++++++---------- 1 file changed, 46 insertions(+), 61 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs index 757dfff2b7..542762af97 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs @@ -245,40 +245,35 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestExpiredItems() { - AddStep("create playlist", () => + createPlaylist(p => { - Child = playlist = new TestPlaylist + p.Items.Clear(); + p.Items.AddRange(new[] { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(500, 300), - Items = + new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo) { - new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo) + ID = 0, + RulesetID = new OsuRuleset().RulesetInfo.OnlineID, + Expired = true, + RequiredMods = new[] { - ID = 0, - RulesetID = new OsuRuleset().RulesetInfo.OnlineID, - Expired = true, - RequiredMods = new[] - { - new APIMod(new OsuModHardRock()), - new APIMod(new OsuModDoubleTime()), - new APIMod(new OsuModAutoplay()) - } - }, - new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo) + new APIMod(new OsuModHardRock()), + new APIMod(new OsuModDoubleTime()), + new APIMod(new OsuModAutoplay()) + } + }, + new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo) + { + ID = 1, + RulesetID = new OsuRuleset().RulesetInfo.OnlineID, + RequiredMods = new[] { - ID = 1, - RulesetID = new OsuRuleset().RulesetInfo.OnlineID, - RequiredMods = new[] - { - new APIMod(new OsuModHardRock()), - new APIMod(new OsuModDoubleTime()), - new APIMod(new OsuModAutoplay()) - } + new APIMod(new OsuModHardRock()), + new APIMod(new OsuModDoubleTime()), + new APIMod(new OsuModAutoplay()) } } - }; + }); }); AddUntilStep("wait for items to load", () => playlist.ItemMap.Values.All(i => i.IsLoaded)); @@ -321,6 +316,29 @@ namespace osu.Game.Tests.Visual.Multiplayer => AddAssert($"delete button {index} {(visible ? "is" : "is not")} visible", () => (playlist.ChildrenOfType().ElementAt(2 + index * 2).Alpha > 0) == visible); + private void createPlaylistWithBeatmaps(Func> beatmaps) => createPlaylist(p => + { + int index = 0; + + p.Items.Clear(); + + foreach (var b in beatmaps()) + { + p.Items.Add(new PlaylistItem(b) + { + ID = index++, + OwnerID = 2, + RulesetID = new OsuRuleset().RulesetInfo.OnlineID, + RequiredMods = new[] + { + new APIMod(new OsuModHardRock()), + new APIMod(new OsuModDoubleTime()), + new APIMod(new OsuModAutoplay()) + } + }); + } + }); + private void createPlaylist(Action setupPlaylist = null) { AddStep("create playlist", () => @@ -332,8 +350,6 @@ namespace osu.Game.Tests.Visual.Multiplayer Size = new Vector2(500, 300) }; - setupPlaylist?.Invoke(playlist); - for (int i = 0; i < 20; i++) { playlist.Items.Add(new PlaylistItem(i % 2 == 1 @@ -360,39 +376,8 @@ namespace osu.Game.Tests.Visual.Multiplayer } }); } - }); - AddUntilStep("wait for items to load", () => playlist.ItemMap.Values.All(i => i.IsLoaded)); - } - - private void createPlaylistWithBeatmaps(Func> beatmaps) - { - AddStep("create playlist", () => - { - Child = playlist = new TestPlaylist - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(500, 300) - }; - - int index = 0; - - foreach (var b in beatmaps()) - { - playlist.Items.Add(new PlaylistItem(b) - { - ID = index++, - OwnerID = 2, - RulesetID = new OsuRuleset().RulesetInfo.OnlineID, - RequiredMods = new[] - { - new APIMod(new OsuModHardRock()), - new APIMod(new OsuModDoubleTime()), - new APIMod(new OsuModAutoplay()) - } - }); - } + setupPlaylist?.Invoke(playlist); }); AddUntilStep("wait for items to load", () => playlist.ItemMap.Values.All(i => i.IsLoaded)); From 728487b7fbd58c743e9d94d271af6a68d66650a2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Jul 2022 02:31:37 +0300 Subject: [PATCH 2214/2328] Handle `GetBeatmapSetRequest` on test room requests handler Required for `BeatmapSetOverlay` lookups to work under dummy API. Not 100% sure about it, but works for now. --- .../OnlinePlay/TestRoomRequestsHandler.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs b/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs index e7c83ca1f9..fa7ade2c07 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs @@ -136,6 +136,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay return true; case GetBeatmapsRequest getBeatmapsRequest: + { var result = new List(); foreach (int id in getBeatmapsRequest.BeatmapIds) @@ -154,6 +155,24 @@ namespace osu.Game.Tests.Visual.OnlinePlay getBeatmapsRequest.TriggerSuccess(new GetBeatmapsResponse { Beatmaps = result }); return true; + } + + case GetBeatmapSetRequest getBeatmapSetRequest: + { + var baseBeatmap = getBeatmapSetRequest.Type == BeatmapSetLookupType.BeatmapId + ? beatmapManager.QueryBeatmap(b => b.OnlineID == getBeatmapSetRequest.ID) + : beatmapManager.QueryBeatmap(b => b.BeatmapSet.OnlineID == getBeatmapSetRequest.ID); + + if (baseBeatmap == null) + { + baseBeatmap = new TestBeatmap(new RulesetInfo { OnlineID = 0 }).BeatmapInfo; + baseBeatmap.OnlineID = getBeatmapSetRequest.ID; + baseBeatmap.BeatmapSet!.OnlineID = getBeatmapSetRequest.ID; + } + + getBeatmapSetRequest.TriggerSuccess(OsuTestScene.CreateAPIBeatmapSet(baseBeatmap)); + return true; + } } return false; From 036e64382fced24200435df4c8a519086b0fd61a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Jul 2022 02:45:31 +0300 Subject: [PATCH 2215/2328] Add beatmap details menu item to playlist items --- .../OnlinePlay/DrawableRoomPlaylistItem.cs | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs index 455e1f3481..e68634f4c6 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs @@ -30,6 +30,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Online; using osu.Game.Online.Chat; using osu.Game.Online.Rooms; +using osu.Game.Overlays; using osu.Game.Overlays.BeatmapSet; using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets; @@ -107,6 +108,9 @@ namespace osu.Game.Screens.OnlinePlay [Resolved] private BeatmapLookupCache beatmapLookupCache { get; set; } + [Resolved(CanBeNull = true)] + private BeatmapSetOverlay beatmapOverlay { get; set; } + [Resolved(CanBeNull = true)] private CollectionManager collectionManager { get; set; } @@ -496,18 +500,16 @@ namespace osu.Game.Screens.OnlinePlay { List items = new List(); - if (beatmap != null && collectionManager != null) - { - if (downloadTracker.State.Value == DownloadState.LocallyAvailable) - { - var collectionItems = collectionManager.Collections.Select(c => new CollectionToggleMenuItem(c, beatmap)).Cast().ToList(); - if (manageCollectionsDialog != null) - collectionItems.Add(new OsuMenuItem("Manage...", MenuItemType.Standard, manageCollectionsDialog.Show)); + if (beatmapOverlay != null) + items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(Item.Beatmap.OnlineID))); - items.Add(new OsuMenuItem("Collections") { Items = collectionItems }); - } - else - items.Add(new OsuMenuItem("Download to add to collection") { Action = { Disabled = true } }); + if (beatmap != null && collectionManager != null && downloadTracker.State.Value == DownloadState.LocallyAvailable) + { + var collectionItems = collectionManager.Collections.Select(c => new CollectionToggleMenuItem(c, beatmap)).Cast().ToList(); + if (manageCollectionsDialog != null) + collectionItems.Add(new OsuMenuItem("Manage...", MenuItemType.Standard, manageCollectionsDialog.Show)); + + items.Add(new OsuMenuItem("Collections") { Items = collectionItems }); } return items.ToArray(); From 9ec4fbb86dfb8a4446733ca0ac676719cfeb724b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Jul 2022 02:45:38 +0300 Subject: [PATCH 2216/2328] Add test coverage for details item --- .../TestSceneDrawableRoomPlaylist.cs | 49 +++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs index 542762af97..6d8aaa6f6f 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs @@ -12,15 +12,19 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Platform; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Database; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Cursor; +using osu.Game.Graphics.UserInterface; using osu.Game.Models; using osu.Game.Online.API; using osu.Game.Online.Rooms; +using osu.Game.Overlays; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; @@ -299,6 +303,25 @@ namespace osu.Game.Tests.Visual.Multiplayer }); } + [Test] + public void TestContextMenuDetails() + { + OsuContextMenu contextMenu = null; + + createPlaylist(); + + moveToItem(0); + AddStep("right click", () => InputManager.Click(MouseButton.Right)); + AddAssert("context menu open", () => (contextMenu = this.ChildrenOfType().SingleOrDefault())?.State == MenuState.Open); + + AddStep("click details", () => + { + InputManager.MoveMouseTo(contextMenu.ChildrenOfType().First()); + InputManager.Click(MouseButton.Left); + }); + AddAssert("beatmap overlay visible", () => this.ChildrenOfType().Single().State.Value == Visibility.Visible); + } + private void moveToItem(int index, Vector2? offset = null) => AddStep($"move mouse to item {index}", () => InputManager.MoveMouseTo(playlist.ChildrenOfType().ElementAt(index), offset)); @@ -343,11 +366,29 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("create playlist", () => { - Child = playlist = new TestPlaylist + BeatmapSetOverlay beatmapOverlay; + + Child = new DependencyProvidingContainer { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(500, 300) + RelativeSizeAxes = Axes.Both, + CachedDependencies = new (Type, object)[] + { + (typeof(BeatmapSetOverlay), beatmapOverlay = new BeatmapSetOverlay()), + }, + Children = new Drawable[] + { + new OsuContextMenuContainer + { + RelativeSizeAxes = Axes.Both, + Child = playlist = new TestPlaylist + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(500, 300), + }, + }, + beatmapOverlay, + }, }; for (int i = 0; i < 20; i++) From cb2f0b8c67c57e8231661424bcc232d91cbf4254 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Jul 2022 03:12:48 +0300 Subject: [PATCH 2217/2328] Add test coverage for collection items --- .../TestSceneDrawableRoomPlaylist.cs | 108 +++++++++++++++++- 1 file changed, 102 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs index 6d8aaa6f6f..ce36ae7827 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs @@ -17,6 +17,7 @@ using osu.Framework.Platform; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; +using osu.Game.Collections; using osu.Game.Database; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Cursor; @@ -42,6 +43,10 @@ namespace osu.Game.Tests.Visual.Multiplayer private BeatmapManager manager; private RulesetStore rulesets; + private CollectionManager collections; + + private BeatmapSetOverlay beatmapOverlay; + private ManageCollectionsDialog manageCollectionsDialog; [BackgroundDependencyLoader] private void load(GameHost host, AudioManager audio) @@ -199,12 +204,15 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestDownloadButtonHiddenWhenBeatmapExists() { - var beatmap = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo; Live imported = null; - Debug.Assert(beatmap.BeatmapSet != null); + AddStep("import beatmap", () => + { + var beatmap = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo; - AddStep("import beatmap", () => imported = manager.Import(beatmap.BeatmapSet)); + Debug.Assert(beatmap.BeatmapSet != null); + imported = manager.Import(beatmap.BeatmapSet); + }); createPlaylistWithBeatmaps(() => imported.PerformRead(s => s.Beatmaps.Detach())); @@ -310,6 +318,8 @@ namespace osu.Game.Tests.Visual.Multiplayer createPlaylist(); + AddAssert("beatmap overlay hidden", () => beatmapOverlay.State.Value == Visibility.Hidden); + moveToItem(0); AddStep("right click", () => InputManager.Click(MouseButton.Right)); AddAssert("context menu open", () => (contextMenu = this.ChildrenOfType().SingleOrDefault())?.State == MenuState.Open); @@ -319,7 +329,91 @@ namespace osu.Game.Tests.Visual.Multiplayer InputManager.MoveMouseTo(contextMenu.ChildrenOfType().First()); InputManager.Click(MouseButton.Left); }); - AddAssert("beatmap overlay visible", () => this.ChildrenOfType().Single().State.Value == Visibility.Visible); + AddAssert("beatmap overlay visible", () => beatmapOverlay.State.Value == Visibility.Visible); + } + + [Test] + public void TestContextMenuCollection() + { + OsuContextMenu contextMenu = null; + BeatmapInfo beatmap = null; + Live imported = null; + + AddStep("import beatmap", () => + { + beatmap = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo; + + Debug.Assert(beatmap.BeatmapSet != null); + imported = manager.Import(beatmap.BeatmapSet); + }); + + createPlaylistWithBeatmaps(() => imported.PerformRead(s => s.Beatmaps.Detach())); + + AddStep("add two collections", () => + { + collections.Collections.Clear(); + collections.Collections.AddRange(new[] + { + new BeatmapCollection { Name = { Value = "Collection #1" }, BeatmapHashes = { beatmap.MD5Hash } }, + new BeatmapCollection { Name = { Value = "Collection #2" } }, + }); + }); + + moveToItem(0); + AddStep("right click", () => InputManager.Click(MouseButton.Right)); + AddAssert("context menu open", () => (contextMenu = this.ChildrenOfType().SingleOrDefault())?.State == MenuState.Open); + + AddStep("select collections", () => InputManager.MoveMouseTo(contextMenu.ChildrenOfType().ElementAt(1))); + AddAssert("collection 1 present and beatmap added", () => + { + var item = (ToggleMenuItem)contextMenu.Items[1].Items[0]; + return item.Text.Value == "Collection #1" && item.State.Value; + }); + AddAssert("collection 2 present", () => + { + var item = (ToggleMenuItem)contextMenu.Items[1].Items[1]; + return item.Text.Value == "Collection #2" && !item.State.Value; + }); + + AddStep("select second collection", () => + { + InputManager.MoveMouseTo(contextMenu.ChildrenOfType().ElementAt(1)); + InputManager.Click(MouseButton.Left); + }); + AddAssert("beatmap added to second collection", () => collections.Collections[1].BeatmapHashes.Contains(beatmap.MD5Hash)); + AddAssert("item state updated", () => ((ToggleMenuItem)contextMenu.Items[1].Items[1]).State.Value); + } + + [Test] + public void TestContextMenuManageCollections() + { + OsuContextMenu contextMenu = null; + Live imported = null; + + AddStep("import beatmap", () => + { + var beatmap = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo; + + Debug.Assert(beatmap.BeatmapSet != null); + imported = manager.Import(beatmap.BeatmapSet); + }); + + createPlaylistWithBeatmaps(() => imported.PerformRead(s => s.Beatmaps.Detach())); + + AddStep("clear collections", () => collections.Collections.Clear()); + AddAssert("manage collections dialog hidden", () => manageCollectionsDialog.State.Value == Visibility.Hidden); + + moveToItem(0); + AddStep("right click", () => InputManager.Click(MouseButton.Right)); + AddAssert("context menu open", () => (contextMenu = this.ChildrenOfType().SingleOrDefault())?.State == MenuState.Open); + + AddStep("select collections", () => InputManager.MoveMouseTo(contextMenu.ChildrenOfType().ElementAt(1))); + AddStep("click manage", () => + { + InputManager.MoveMouseTo(contextMenu.ChildrenOfType().ElementAt(1).ChildrenOfType().Single()); + InputManager.Click(MouseButton.Left); + }); + AddAssert("manage collections dialog open", () => manageCollectionsDialog.State.Value == Visibility.Visible); } private void moveToItem(int index, Vector2? offset = null) @@ -366,17 +460,18 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("create playlist", () => { - BeatmapSetOverlay beatmapOverlay; - Child = new DependencyProvidingContainer { RelativeSizeAxes = Axes.Both, CachedDependencies = new (Type, object)[] { (typeof(BeatmapSetOverlay), beatmapOverlay = new BeatmapSetOverlay()), + (typeof(CollectionManager), collections = new CollectionManager(LocalStorage)), + (typeof(ManageCollectionsDialog), manageCollectionsDialog = new ManageCollectionsDialog()), }, Children = new Drawable[] { + collections, new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, @@ -388,6 +483,7 @@ namespace osu.Game.Tests.Visual.Multiplayer }, }, beatmapOverlay, + manageCollectionsDialog, }, }; From 776d9551e2d93745653609fbfd6b4461a7cc8569 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Jul 2022 04:16:25 +0300 Subject: [PATCH 2218/2328] Disable "save changes" button by default --- osu.Game.Tournament/SaveChangesOverlay.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tournament/SaveChangesOverlay.cs b/osu.Game.Tournament/SaveChangesOverlay.cs index 03a3f2d3a4..c03afb2eab 100644 --- a/osu.Game.Tournament/SaveChangesOverlay.cs +++ b/osu.Game.Tournament/SaveChangesOverlay.cs @@ -57,6 +57,7 @@ namespace osu.Game.Tournament Bottom = 10, }, Action = saveChanges, + Enabled = { Value = false }, }, } }; From 24df8f6a0dfe41ec28a8562077ed94a7afba7754 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Jul 2022 04:33:07 +0300 Subject: [PATCH 2219/2328] Enable NRT on save changes button --- osu.Game.Tournament/SaveChangesOverlay.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tournament/SaveChangesOverlay.cs b/osu.Game.Tournament/SaveChangesOverlay.cs index c03afb2eab..b5e08fc005 100644 --- a/osu.Game.Tournament/SaveChangesOverlay.cs +++ b/osu.Game.Tournament/SaveChangesOverlay.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; @@ -17,9 +16,9 @@ namespace osu.Game.Tournament internal class SaveChangesOverlay : CompositeDrawable { [Resolved] - private TournamentGame tournamentGame { get; set; } + private TournamentGame tournamentGame { get; set; } = null!; - private string lastSerialisedLadder; + private string? lastSerialisedLadder; private readonly TourneyButton saveChangesButton; public SaveChangesOverlay() @@ -57,7 +56,7 @@ namespace osu.Game.Tournament Bottom = 10, }, Action = saveChanges, - Enabled = { Value = false }, + // Enabled = { Value = false }, }, } }; From a85a70c47249eb9685ea8072cc1885fccb3b5337 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Jul 2022 05:01:18 +0300 Subject: [PATCH 2220/2328] Fix potential nullref in `ContextMenuItems` --- osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs index e68634f4c6..d89816d3c7 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -94,6 +95,7 @@ namespace osu.Game.Screens.OnlinePlay private PanelBackground panelBackground; private FillFlowContainer mainFillFlow; + [CanBeNull] private BeatmapDownloadTracker downloadTracker; [Resolved] @@ -503,7 +505,7 @@ namespace osu.Game.Screens.OnlinePlay if (beatmapOverlay != null) items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(Item.Beatmap.OnlineID))); - if (beatmap != null && collectionManager != null && downloadTracker.State.Value == DownloadState.LocallyAvailable) + if (beatmap != null && collectionManager != null && downloadTracker?.State.Value == DownloadState.LocallyAvailable) { var collectionItems = collectionManager.Collections.Select(c => new CollectionToggleMenuItem(c, beatmap)).Cast().ToList(); if (manageCollectionsDialog != null) From f83d413b33d000a3cbdaf3783dc96df3478a1ca4 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Jul 2022 06:05:03 +0300 Subject: [PATCH 2221/2328] Fix dialog overlay potentially pushing dialog while not loaded --- osu.Game/Overlays/DialogOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index a07cf1608d..7f2db9f03f 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -65,7 +65,7 @@ namespace osu.Game.Overlays dialogContainer.Add(dialog); Show(); - }, false); + }, !IsLoaded); } public override bool IsPresent => Scheduler.HasPendingTasks || dialogContainer.Children.Count > 0; From 3def8428aa368b13387da6c026270e77802f2a42 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Jul 2022 06:06:56 +0300 Subject: [PATCH 2222/2328] Make scheduling more legible --- osu.Game/Overlays/DialogOverlay.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 7f2db9f03f..259c6068e0 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -57,7 +57,12 @@ namespace osu.Game.Overlays // a DialogOverlay instance has finished loading. CurrentDialog = dialog; - Scheduler.Add(() => + if (IsLoaded) + Scheduler.Add(pushDialog, false); + else + Schedule(pushDialog); + + void pushDialog() { // if any existing dialog is being displayed, dismiss it before showing a new one. lastDialog?.Hide(); @@ -65,7 +70,7 @@ namespace osu.Game.Overlays dialogContainer.Add(dialog); Show(); - }, !IsLoaded); + } } public override bool IsPresent => Scheduler.HasPendingTasks || dialogContainer.Children.Count > 0; From be69514002b62a6d4fd0728923577a5a639d7664 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Jul 2022 06:21:03 +0300 Subject: [PATCH 2223/2328] Fix `CollectionManager` opening file multiple times across test scene --- .../Multiplayer/TestSceneDrawableRoomPlaylist.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs index ce36ae7827..599a28f913 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs @@ -39,6 +39,8 @@ namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneDrawableRoomPlaylist : MultiplayerTestScene { + protected override Container Content { get; } = new Container { RelativeSizeAxes = Axes.Both }; + private TestPlaylist playlist; private BeatmapManager manager; @@ -54,6 +56,14 @@ namespace osu.Game.Tests.Visual.Multiplayer Dependencies.Cache(rulesets = new RealmRulesetStore(Realm)); Dependencies.Cache(manager = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default)); Dependencies.Cache(Realm); + + base.Content.AddRange(new Drawable[] + { + collections = new CollectionManager(LocalStorage), + Content + }); + + Dependencies.Cache(collections); } [Test] @@ -466,12 +476,10 @@ namespace osu.Game.Tests.Visual.Multiplayer CachedDependencies = new (Type, object)[] { (typeof(BeatmapSetOverlay), beatmapOverlay = new BeatmapSetOverlay()), - (typeof(CollectionManager), collections = new CollectionManager(LocalStorage)), (typeof(ManageCollectionsDialog), manageCollectionsDialog = new ManageCollectionsDialog()), }, Children = new Drawable[] { - collections, new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, From 12221235413416a956b5630ed32362c2e2321e3b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Jul 2022 07:04:46 +0300 Subject: [PATCH 2224/2328] Rename method and parameter --- osu.Game/Overlays/DialogOverlay.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 259c6068e0..83a563beba 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -66,7 +66,8 @@ namespace osu.Game.Overlays { // if any existing dialog is being displayed, dismiss it before showing a new one. lastDialog?.Hide(); - dialog.State.ValueChanged += state => onDialogOnStateChanged(dialog, state.NewValue); + + dialog.State.ValueChanged += state => onDialogStateChanged(dialog, state.NewValue), true); dialogContainer.Add(dialog); Show(); @@ -77,9 +78,9 @@ namespace osu.Game.Overlays protected override bool BlockNonPositionalInput => true; - private void onDialogOnStateChanged(VisibilityContainer dialog, Visibility v) + private void onDialogStateChanged(VisibilityContainer dialog, Visibility newState) { - if (v != Visibility.Hidden) return; + if (newState != Visibility.Hidden) return; // handle the dialog being dismissed. dialog.Delay(PopupDialog.EXIT_DURATION).Expire(); From c59784c49f31265d96f53caf04cdfd5794b776fc Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Jul 2022 07:06:03 +0300 Subject: [PATCH 2225/2328] Always schedule popup dialog push --- osu.Game/Overlays/DialogOverlay.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 83a563beba..5e082acb23 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -57,12 +57,7 @@ namespace osu.Game.Overlays // a DialogOverlay instance has finished loading. CurrentDialog = dialog; - if (IsLoaded) - Scheduler.Add(pushDialog, false); - else - Schedule(pushDialog); - - void pushDialog() + Schedule(() => { // if any existing dialog is being displayed, dismiss it before showing a new one. lastDialog?.Hide(); @@ -71,7 +66,7 @@ namespace osu.Game.Overlays dialogContainer.Add(dialog); Show(); - } + }); } public override bool IsPresent => Scheduler.HasPendingTasks || dialogContainer.Children.Count > 0; From b96faedbe6de41b984a4725c18d64b45e736fb4b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Jul 2022 07:06:57 +0300 Subject: [PATCH 2226/2328] Fix dialog overlay hiding early-pushed dialog on initial `PopOut` call --- osu.Game/Overlays/DialogOverlay.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 5e082acb23..6f88564119 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -98,7 +98,8 @@ namespace osu.Game.Overlays base.PopOut(); lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF, 100, Easing.InCubic); - if (CurrentDialog?.State.Value == Visibility.Visible) + // PopOut gets called initially, but we only want to hide dialog when we have been loaded and are present. + if (IsLoaded && CurrentDialog?.State.Value == Visibility.Visible) CurrentDialog.Hide(); } From dccd81dbc7dad3fdc308bff7aa2dd07b6ef92c9c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 14 Jul 2022 07:07:32 +0300 Subject: [PATCH 2227/2328] Use `BindValueChanged` to handle changes between push time and schedule execution --- osu.Game/Overlays/DialogOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 6f88564119..2024eca707 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -62,7 +62,7 @@ namespace osu.Game.Overlays // if any existing dialog is being displayed, dismiss it before showing a new one. lastDialog?.Hide(); - dialog.State.ValueChanged += state => onDialogStateChanged(dialog, state.NewValue), true); + dialog.State.BindValueChanged(state => onDialogStateChanged(dialog, state.NewValue), true); dialogContainer.Add(dialog); Show(); From 227871e8dffa1a1be9ca3669f6e829fc0d0a163f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Jul 2022 14:00:33 +0900 Subject: [PATCH 2228/2328] Refactor hide logic a touch for better readability --- osu.Game/Overlays/DialogOverlay.cs | 48 ++++++++++++++++++------------ 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 2024eca707..dfc6a0010a 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -49,12 +49,11 @@ namespace osu.Game.Overlays public void Push(PopupDialog dialog) { - if (dialog == CurrentDialog || dialog.State.Value != Visibility.Visible) return; - - var lastDialog = CurrentDialog; + if (dialog == CurrentDialog || dialog.State.Value == Visibility.Hidden) return; // Immediately update the externally accessible property as this may be used for checks even before // a DialogOverlay instance has finished loading. + var lastDialog = CurrentDialog; CurrentDialog = dialog; Schedule(() => @@ -62,31 +61,42 @@ namespace osu.Game.Overlays // if any existing dialog is being displayed, dismiss it before showing a new one. lastDialog?.Hide(); - dialog.State.BindValueChanged(state => onDialogStateChanged(dialog, state.NewValue), true); - dialogContainer.Add(dialog); + // is the new dialog is hidden before added to the dialogContainer, bypass any further operations. + if (dialog.State.Value == Visibility.Hidden) + { + dismiss(); + return; + } + dialogContainer.Add(dialog); Show(); + + dialog.State.BindValueChanged(state => + { + if (state.NewValue != Visibility.Hidden) return; + + // Trigger the demise of the dialog as soon as it hides. + dialog.Delay(PopupDialog.EXIT_DURATION).Expire(); + + dismiss(); + }); }); + + void dismiss() + { + if (dialog != CurrentDialog) return; + + // Handle the case where the dialog is the currently displayed dialog. + // In this scenario, the overlay itself should also be hidden. + Hide(); + CurrentDialog = null; + } } public override bool IsPresent => Scheduler.HasPendingTasks || dialogContainer.Children.Count > 0; protected override bool BlockNonPositionalInput => true; - private void onDialogStateChanged(VisibilityContainer dialog, Visibility newState) - { - if (newState != Visibility.Hidden) return; - - // handle the dialog being dismissed. - dialog.Delay(PopupDialog.EXIT_DURATION).Expire(); - - if (dialog == CurrentDialog) - { - Hide(); - CurrentDialog = null; - } - } - protected override void PopIn() { base.PopIn(); From 5c6b4e498dfda0910beea0847cc19ff586d9ad07 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Jul 2022 14:31:59 +0900 Subject: [PATCH 2229/2328] Protect against a potential early call to `LanguageButton.Selected` --- osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs index ec074bcd04..f195fa82c0 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs @@ -79,7 +79,7 @@ namespace osu.Game.Overlays.FirstRunSetup frameworkLocale = frameworkConfig.GetBindable(FrameworkSetting.Locale); frameworkLocale.BindValueChanged(locale => { - if (!LanguageExtensions.TryParseCultureCode(frameworkLocale.Value, out var language)) + if (!LanguageExtensions.TryParseCultureCode(locale.NewValue, out var language)) language = Language.en; foreach (var c in Children.OfType()) @@ -110,7 +110,8 @@ namespace osu.Game.Overlays.FirstRunSetup selected = value; - updateState(); + if (IsLoaded) + updateState(); } } @@ -144,6 +145,12 @@ namespace osu.Game.Overlays.FirstRunSetup }; } + protected override void LoadComplete() + { + base.LoadComplete(); + updateState(); + } + protected override bool OnHover(HoverEvent e) { if (!selected) From 5dff48a1e02a4ed260d6709e46d084b41fef38a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Jul 2022 14:40:25 +0900 Subject: [PATCH 2230/2328] Fix button selection animation not playing smoothly when new glyphs are loaded --- osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs index f195fa82c0..29aa23ebab 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Framework.Localisation; +using osu.Framework.Threading; using osu.Game.Extensions; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -63,6 +64,8 @@ namespace osu.Game.Overlays.FirstRunSetup { private Bindable frameworkLocale = null!; + private ScheduledDelegate? updateSelectedDelegate; + [BackgroundDependencyLoader] private void load(FrameworkConfigManager frameworkConfig) { @@ -82,11 +85,20 @@ namespace osu.Game.Overlays.FirstRunSetup if (!LanguageExtensions.TryParseCultureCode(locale.NewValue, out var language)) language = Language.en; - foreach (var c in Children.OfType()) - c.Selected = c.Language == language; + // Changing language may cause a short period of blocking the UI thread while the new glyphs are loaded. + // Scheduling ensures the button animation plays smoothly after any blocking operation completes. + // Note that a delay is required (the alternative would be a double-schedule; delay feels better). + updateSelectedDelegate?.Cancel(); + updateSelectedDelegate = Scheduler.AddDelayed(() => updateSelectedStates(language), 50); }, true); } + private void updateSelectedStates(Language language) + { + foreach (var c in Children.OfType()) + c.Selected = c.Language == language; + } + private class LanguageButton : OsuClickableContainer { public readonly Language Language; From 08396ba48631a23b04f0aeb4d58bbfa3ba35d519 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Jul 2022 14:47:25 +0900 Subject: [PATCH 2231/2328] Adjust colouring to avoid weird banding during transition period --- .../Overlays/FirstRunSetup/ScreenWelcome.cs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs index 29aa23ebab..cb1e96d2f2 100644 --- a/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs +++ b/osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs @@ -179,19 +179,23 @@ namespace osu.Game.Overlays.FirstRunSetup private void updateState() { - const double duration = 1000; - if (selected) { - backgroundBox.FadeTo(1, duration, Easing.OutQuint); - text.FadeColour(colourProvider.Content1, duration, Easing.OutQuint); - text.ScaleTo(1.2f, duration, Easing.OutQuint); + const double selected_duration = 1000; + + backgroundBox.FadeTo(1, selected_duration, Easing.OutQuint); + backgroundBox.FadeColour(colourProvider.Background2, selected_duration, Easing.OutQuint); + text.FadeColour(colourProvider.Content1, selected_duration, Easing.OutQuint); + text.ScaleTo(1.2f, selected_duration, Easing.OutQuint); } else { - backgroundBox.FadeTo(IsHovered ? 0.4f : 0, duration / 2, Easing.OutQuint); - text.ScaleTo(1, duration / 2, Easing.OutQuint); - text.FadeColour(colourProvider.Light1, duration / 2, Easing.OutQuint); + const double duration = 500; + + backgroundBox.FadeTo(IsHovered ? 1 : 0, duration, Easing.OutQuint); + backgroundBox.FadeColour(colourProvider.Background5, duration, Easing.OutQuint); + text.FadeColour(colourProvider.Light1, duration, Easing.OutQuint); + text.ScaleTo(1, duration, Easing.OutQuint); } } } From ebe0cfefd87acbae75789d721c1ff612761f0029 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Jul 2022 17:04:00 +0900 Subject: [PATCH 2232/2328] Ensure that multiple `BeatmapSetInfo` already in realm don't cause import failures Really this shouldn't happen but I managed to make it happen. Until this comes up again in a way that matters, let's just fix the LINQ crash from `SingleOrDefault`. I've tested this to work as expected in the broken scenario. --- osu.Game/Beatmaps/BeatmapImporter.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapImporter.cs b/osu.Game/Beatmaps/BeatmapImporter.cs index 92f1fc17d5..3e4d01a9a3 100644 --- a/osu.Game/Beatmaps/BeatmapImporter.cs +++ b/osu.Game/Beatmaps/BeatmapImporter.cs @@ -80,9 +80,8 @@ namespace osu.Game.Beatmaps if (beatmapSet.OnlineID > 0) { - var existingSetWithSameOnlineID = realm.All().SingleOrDefault(b => b.OnlineID == beatmapSet.OnlineID); - - if (existingSetWithSameOnlineID != null) + // OnlineID should really be unique, but to avoid catastrophic failure let's iterate just to be sure. + foreach (var existingSetWithSameOnlineID in realm.All().Where(b => b.OnlineID == beatmapSet.OnlineID)) { existingSetWithSameOnlineID.DeletePending = true; existingSetWithSameOnlineID.OnlineID = -1; @@ -90,7 +89,7 @@ namespace osu.Game.Beatmaps foreach (var b in existingSetWithSameOnlineID.Beatmaps) b.OnlineID = -1; - LogForModel(beatmapSet, $"Found existing beatmap set with same OnlineID ({beatmapSet.OnlineID}). It will be deleted."); + LogForModel(beatmapSet, $"Found existing beatmap set with same OnlineID ({beatmapSet.OnlineID}). It will be disassociated and marked for deletion."); } } } From 66932f1af6979ddd254231b27a27b981eeef97d3 Mon Sep 17 00:00:00 2001 From: Alden Wu Date: Thu, 14 Jul 2022 16:52:45 -0700 Subject: [PATCH 2233/2328] Move shared followcircle code into abstract base class --- .../Skinning/Default/DefaultFollowCircle.cs | 50 +----------- .../Skinning/FollowCircle.cs | 79 +++++++++++++++++++ .../Skinning/Legacy/LegacyFollowCircle.cs | 72 +++-------------- 3 files changed, 92 insertions(+), 109 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Skinning/FollowCircle.cs diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs index 8bb36f8c39..254e220996 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultFollowCircle.cs @@ -1,27 +1,19 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables; using osuTK.Graphics; namespace osu.Game.Rulesets.Osu.Skinning.Default { - public class DefaultFollowCircle : CompositeDrawable + public class DefaultFollowCircle : FollowCircle { - [Resolved(canBeNull: true)] - private DrawableHitObject? parentObject { get; set; } - public DefaultFollowCircle() { - Alpha = 0f; - RelativeSizeAxes = Axes.Both; - InternalChild = new CircularContainer { RelativeSizeAxes = Axes.Both, @@ -38,28 +30,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default }; } - [BackgroundDependencyLoader] - private void load() - { - if (parentObject != null) - { - var slider = (DrawableSlider)parentObject; - slider.Tracking.BindValueChanged(trackingChanged, true); - } - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - if (parentObject != null) - { - parentObject.ApplyCustomUpdateState += updateStateTransforms; - updateStateTransforms(parentObject, parentObject.State.Value); - } - } - - private void trackingChanged(ValueChangedEvent tracking) + protected override void OnTrackingChanged(ValueChangedEvent tracking) { const float scale_duration = 300f; const float fade_duration = 300f; @@ -68,25 +39,12 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default .FadeTo(tracking.NewValue ? 1f : 0, fade_duration, Easing.OutQuint); } - private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state) + protected override void OnSliderEnd() { - // see comment in LegacySliderBall.updateStateTransforms - if (drawableObject is not DrawableSlider) - return; - const float fade_duration = 450f; // intentionally pile on an extra FadeOut to make it happen much faster - using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime)) - this.FadeOut(fade_duration / 4, Easing.Out); - } - - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - - if (parentObject != null) - parentObject.ApplyCustomUpdateState -= updateStateTransforms; + this.FadeOut(fade_duration / 4, Easing.Out); } } } diff --git a/osu.Game.Rulesets.Osu/Skinning/FollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/FollowCircle.cs new file mode 100644 index 0000000000..e1e792b89e --- /dev/null +++ b/osu.Game.Rulesets.Osu/Skinning/FollowCircle.cs @@ -0,0 +1,79 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables; + +namespace osu.Game.Rulesets.Osu.Skinning +{ + public abstract class FollowCircle : CompositeDrawable + { + [Resolved(canBeNull: true)] + protected DrawableHitObject? ParentObject { get; private set; } + + public FollowCircle() + { + RelativeSizeAxes = Axes.Both; + } + + [BackgroundDependencyLoader] + private void load() + { + if (ParentObject != null) + { + var slider = (DrawableSlider)ParentObject; + slider.Tracking.BindValueChanged(OnTrackingChanged, true); + } + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + if (ParentObject != null) + { + ParentObject.HitObjectApplied += onHitObjectApplied; + onHitObjectApplied(ParentObject); + + ParentObject.ApplyCustomUpdateState += updateStateTransforms; + updateStateTransforms(ParentObject, ParentObject.State.Value); + } + } + + private void onHitObjectApplied(DrawableHitObject drawableObject) + { + this.ScaleTo(1f) + .FadeOut(); + } + + private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state) + { + // Gets called by slider ticks, tails, etc., leading to duplicated + // animations which may negatively affect performance + if (drawableObject is not DrawableSlider) + return; + + using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime)) + OnSliderEnd(); + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + if (ParentObject != null) + { + ParentObject.HitObjectApplied -= onHitObjectApplied; + ParentObject.ApplyCustomUpdateState -= updateStateTransforms; + } + } + + protected abstract void OnTrackingChanged(ValueChangedEvent tracking); + + protected abstract void OnSliderEnd(); + } +} diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs index f18c4529ab..38e2e74349 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs @@ -2,20 +2,14 @@ // See the LICENCE file in the repository root for full licence text. using System.Diagnostics; -using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables; namespace osu.Game.Rulesets.Osu.Skinning.Legacy { - public class LegacyFollowCircle : CompositeDrawable + public class LegacyFollowCircle : FollowCircle { - [Resolved(canBeNull: true)] - private DrawableHitObject? parentObject { get; set; } - public LegacyFollowCircle(Drawable animationContent) { // follow circles are 2x the hitcircle resolution in legacy skins (since they are scaled down from >1x @@ -27,41 +21,17 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy InternalChild = animationContent; } - [BackgroundDependencyLoader] - private void load() + protected override void OnTrackingChanged(ValueChangedEvent tracking) { - if (parentObject != null) - { - var slider = (DrawableSlider)parentObject; - slider.Tracking.BindValueChanged(trackingChanged, true); - } - } + Debug.Assert(ParentObject != null); - protected override void LoadComplete() - { - base.LoadComplete(); - - if (parentObject != null) - { - parentObject.HitObjectApplied += onHitObjectApplied; - onHitObjectApplied(parentObject); - - parentObject.ApplyCustomUpdateState += updateStateTransforms; - updateStateTransforms(parentObject, parentObject.State.Value); - } - } - - private void trackingChanged(ValueChangedEvent tracking) - { - Debug.Assert(parentObject != null); - - if (parentObject.Judged) + if (ParentObject.Judged) return; const float scale_duration = 180f; const float fade_duration = 90f; - double maxScaleDuration = parentObject.HitStateUpdateTime - Time.Current; + double maxScaleDuration = ParentObject.HitStateUpdateTime - Time.Current; double realScaleDuration = scale_duration; if (tracking.NewValue && maxScaleDuration < realScaleDuration && maxScaleDuration >= 0) realScaleDuration = maxScaleDuration; @@ -71,39 +41,15 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy .FadeTo(tracking.NewValue ? 1f : 0f, realFadeDuration, Easing.OutQuad); } - private void onHitObjectApplied(DrawableHitObject drawableObject) + protected override void OnSliderEnd() { - this.ScaleTo(1f) - .FadeOut(); - } - - private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state) - { - // see comment in LegacySliderBall.updateStateTransforms - if (drawableObject is not DrawableSlider) - return; - const float shrink_duration = 200f; const float fade_delay = 175f; const float fade_duration = 35f; - using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime)) - { - this.ScaleTo(DrawableSliderBall.FOLLOW_AREA * 0.75f, shrink_duration, Easing.OutQuad) - .Delay(fade_delay) - .FadeOut(fade_duration); - } - } - - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - - if (parentObject != null) - { - parentObject.HitObjectApplied -= onHitObjectApplied; - parentObject.ApplyCustomUpdateState -= updateStateTransforms; - } + this.ScaleTo(DrawableSliderBall.FOLLOW_AREA * 0.75f, shrink_duration, Easing.OutQuad) + .Delay(fade_delay) + .FadeOut(fade_duration); } } } From 4453b0b3e831a9619213aa33a42376eea0f43598 Mon Sep 17 00:00:00 2001 From: Alden Wu Date: Thu, 14 Jul 2022 16:53:51 -0700 Subject: [PATCH 2234/2328] Replace comment pointer with actual comment --- osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs index 37e5e150bd..97bb4a3697 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBall.cs @@ -73,7 +73,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state) { - // see comment in LegacySliderBall.updateStateTransforms + // Gets called by slider ticks, tails, etc., leading to duplicated + // animations which may negatively affect performance if (drawableObject is not DrawableSlider) return; From 1581f1a0ff8a0570d684a2e02bc58417003aeded Mon Sep 17 00:00:00 2001 From: Alden Wu Date: Thu, 14 Jul 2022 17:08:52 -0700 Subject: [PATCH 2235/2328] Convert constructor in abstract class to protected --- osu.Game.Rulesets.Osu/Skinning/FollowCircle.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/FollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/FollowCircle.cs index e1e792b89e..943b7d3b4f 100644 --- a/osu.Game.Rulesets.Osu/Skinning/FollowCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/FollowCircle.cs @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Osu.Skinning [Resolved(canBeNull: true)] protected DrawableHitObject? ParentObject { get; private set; } - public FollowCircle() + protected FollowCircle() { RelativeSizeAxes = Axes.Both; } From 0bafafd63b4ab42462158af4f67d68cc7eb2fbbe Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 15 Jul 2022 03:19:50 +0300 Subject: [PATCH 2236/2328] Remove unnecessary test coverage RIP hours. --- .../TestSceneDrawableRoomPlaylist.cs | 149 +----------------- 1 file changed, 6 insertions(+), 143 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs index 599a28f913..1797c82fb9 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs @@ -12,20 +12,16 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.UserInterface; using osu.Framework.Platform; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; -using osu.Game.Collections; using osu.Game.Database; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Cursor; -using osu.Game.Graphics.UserInterface; using osu.Game.Models; using osu.Game.Online.API; using osu.Game.Online.Rooms; -using osu.Game.Overlays; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; @@ -39,16 +35,10 @@ namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneDrawableRoomPlaylist : MultiplayerTestScene { - protected override Container Content { get; } = new Container { RelativeSizeAxes = Axes.Both }; - private TestPlaylist playlist; private BeatmapManager manager; private RulesetStore rulesets; - private CollectionManager collections; - - private BeatmapSetOverlay beatmapOverlay; - private ManageCollectionsDialog manageCollectionsDialog; [BackgroundDependencyLoader] private void load(GameHost host, AudioManager audio) @@ -56,14 +46,6 @@ namespace osu.Game.Tests.Visual.Multiplayer Dependencies.Cache(rulesets = new RealmRulesetStore(Realm)); Dependencies.Cache(manager = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default)); Dependencies.Cache(Realm); - - base.Content.AddRange(new Drawable[] - { - collections = new CollectionManager(LocalStorage), - Content - }); - - Dependencies.Cache(collections); } [Test] @@ -321,111 +303,6 @@ namespace osu.Game.Tests.Visual.Multiplayer }); } - [Test] - public void TestContextMenuDetails() - { - OsuContextMenu contextMenu = null; - - createPlaylist(); - - AddAssert("beatmap overlay hidden", () => beatmapOverlay.State.Value == Visibility.Hidden); - - moveToItem(0); - AddStep("right click", () => InputManager.Click(MouseButton.Right)); - AddAssert("context menu open", () => (contextMenu = this.ChildrenOfType().SingleOrDefault())?.State == MenuState.Open); - - AddStep("click details", () => - { - InputManager.MoveMouseTo(contextMenu.ChildrenOfType().First()); - InputManager.Click(MouseButton.Left); - }); - AddAssert("beatmap overlay visible", () => beatmapOverlay.State.Value == Visibility.Visible); - } - - [Test] - public void TestContextMenuCollection() - { - OsuContextMenu contextMenu = null; - BeatmapInfo beatmap = null; - Live imported = null; - - AddStep("import beatmap", () => - { - beatmap = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo; - - Debug.Assert(beatmap.BeatmapSet != null); - imported = manager.Import(beatmap.BeatmapSet); - }); - - createPlaylistWithBeatmaps(() => imported.PerformRead(s => s.Beatmaps.Detach())); - - AddStep("add two collections", () => - { - collections.Collections.Clear(); - collections.Collections.AddRange(new[] - { - new BeatmapCollection { Name = { Value = "Collection #1" }, BeatmapHashes = { beatmap.MD5Hash } }, - new BeatmapCollection { Name = { Value = "Collection #2" } }, - }); - }); - - moveToItem(0); - AddStep("right click", () => InputManager.Click(MouseButton.Right)); - AddAssert("context menu open", () => (contextMenu = this.ChildrenOfType().SingleOrDefault())?.State == MenuState.Open); - - AddStep("select collections", () => InputManager.MoveMouseTo(contextMenu.ChildrenOfType().ElementAt(1))); - AddAssert("collection 1 present and beatmap added", () => - { - var item = (ToggleMenuItem)contextMenu.Items[1].Items[0]; - return item.Text.Value == "Collection #1" && item.State.Value; - }); - AddAssert("collection 2 present", () => - { - var item = (ToggleMenuItem)contextMenu.Items[1].Items[1]; - return item.Text.Value == "Collection #2" && !item.State.Value; - }); - - AddStep("select second collection", () => - { - InputManager.MoveMouseTo(contextMenu.ChildrenOfType().ElementAt(1)); - InputManager.Click(MouseButton.Left); - }); - AddAssert("beatmap added to second collection", () => collections.Collections[1].BeatmapHashes.Contains(beatmap.MD5Hash)); - AddAssert("item state updated", () => ((ToggleMenuItem)contextMenu.Items[1].Items[1]).State.Value); - } - - [Test] - public void TestContextMenuManageCollections() - { - OsuContextMenu contextMenu = null; - Live imported = null; - - AddStep("import beatmap", () => - { - var beatmap = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo; - - Debug.Assert(beatmap.BeatmapSet != null); - imported = manager.Import(beatmap.BeatmapSet); - }); - - createPlaylistWithBeatmaps(() => imported.PerformRead(s => s.Beatmaps.Detach())); - - AddStep("clear collections", () => collections.Collections.Clear()); - AddAssert("manage collections dialog hidden", () => manageCollectionsDialog.State.Value == Visibility.Hidden); - - moveToItem(0); - AddStep("right click", () => InputManager.Click(MouseButton.Right)); - AddAssert("context menu open", () => (contextMenu = this.ChildrenOfType().SingleOrDefault())?.State == MenuState.Open); - - AddStep("select collections", () => InputManager.MoveMouseTo(contextMenu.ChildrenOfType().ElementAt(1))); - AddStep("click manage", () => - { - InputManager.MoveMouseTo(contextMenu.ChildrenOfType().ElementAt(1).ChildrenOfType().Single()); - InputManager.Click(MouseButton.Left); - }); - AddAssert("manage collections dialog open", () => manageCollectionsDialog.State.Value == Visibility.Visible); - } - private void moveToItem(int index, Vector2? offset = null) => AddStep($"move mouse to item {index}", () => InputManager.MoveMouseTo(playlist.ChildrenOfType().ElementAt(index), offset)); @@ -470,29 +347,15 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("create playlist", () => { - Child = new DependencyProvidingContainer + Child = new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, - CachedDependencies = new (Type, object)[] + Child = playlist = new TestPlaylist { - (typeof(BeatmapSetOverlay), beatmapOverlay = new BeatmapSetOverlay()), - (typeof(ManageCollectionsDialog), manageCollectionsDialog = new ManageCollectionsDialog()), - }, - Children = new Drawable[] - { - new OsuContextMenuContainer - { - RelativeSizeAxes = Axes.Both, - Child = playlist = new TestPlaylist - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(500, 300), - }, - }, - beatmapOverlay, - manageCollectionsDialog, - }, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(500, 300) + } }; for (int i = 0; i < 20; i++) From aea786ea0c2f5e7df04911a37dac0f0f855316db Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 15 Jul 2022 05:56:49 +0300 Subject: [PATCH 2237/2328] Fix minor typo --- osu.Game/Overlays/DialogOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index dfc6a0010a..493cd66258 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -61,7 +61,7 @@ namespace osu.Game.Overlays // if any existing dialog is being displayed, dismiss it before showing a new one. lastDialog?.Hide(); - // is the new dialog is hidden before added to the dialogContainer, bypass any further operations. + // if the new dialog is hidden before added to the dialogContainer, bypass any further operations. if (dialog.State.Value == Visibility.Hidden) { dismiss(); From eafa11555af3e83c6b79b4503f9904e7306bab7c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 15 Jul 2022 06:41:03 +0300 Subject: [PATCH 2238/2328] Allow specifying custom search action to metadata sections --- .../Overlays/BeatmapSet/MetadataSection.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/MetadataSection.cs b/osu.Game/Overlays/BeatmapSet/MetadataSection.cs index c6bf94f507..317b369d8f 100644 --- a/osu.Game/Overlays/BeatmapSet/MetadataSection.cs +++ b/osu.Game/Overlays/BeatmapSet/MetadataSection.cs @@ -3,6 +3,7 @@ #nullable disable +using System; using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -22,11 +23,14 @@ namespace osu.Game.Overlays.BeatmapSet private readonly MetadataType type; private TextFlowContainer textFlow; + private readonly Action searchAction; + private const float transition_duration = 250; - public MetadataSection(MetadataType type) + public MetadataSection(MetadataType type, Action searchAction = null) { this.type = type; + this.searchAction = searchAction; Alpha = 0; @@ -91,7 +95,12 @@ namespace osu.Game.Overlays.BeatmapSet for (int i = 0; i <= tags.Length - 1; i++) { - loaded.AddLink(tags[i], LinkAction.SearchBeatmapSet, tags[i]); + string tag = tags[i]; + + if (searchAction != null) + loaded.AddLink(tag, () => searchAction(tag)); + else + loaded.AddLink(tag, LinkAction.SearchBeatmapSet, tag); if (i != tags.Length - 1) loaded.AddText(" "); @@ -100,7 +109,11 @@ namespace osu.Game.Overlays.BeatmapSet break; case MetadataType.Source: - loaded.AddLink(text, LinkAction.SearchBeatmapSet, text); + if (searchAction != null) + loaded.AddLink(text, () => searchAction(text)); + else + loaded.AddLink(text, LinkAction.SearchBeatmapSet, text); + break; default: From 97c3eea3aaa939ad9b0d23862a6ab0434bc4bf3f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 15 Jul 2022 06:41:49 +0300 Subject: [PATCH 2239/2328] Fix beatmap details source and tags not filtering on song select --- osu.Game/Screens/Select/BeatmapDetails.cs | 15 ++++++++++++--- osu.Game/Screens/Select/FilterControl.cs | 21 +++++++++++---------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 2fe62c4a4e..a877dc4863 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -40,6 +40,9 @@ namespace osu.Game.Screens.Select [Resolved] private IAPIProvider api { get; set; } + [Resolved(canBeNull: true)] + private SongSelect songSelect { get; set; } + private IBeatmapInfo beatmapInfo; private APIFailTimes failTimes; @@ -140,9 +143,9 @@ namespace osu.Game.Screens.Select LayoutEasing = Easing.OutQuad, Children = new[] { - description = new MetadataSection(MetadataType.Description), - source = new MetadataSection(MetadataType.Source), - tags = new MetadataSection(MetadataType.Tags), + description = new MetadataSection(MetadataType.Description, searchOnSongSelect), + source = new MetadataSection(MetadataType.Source, searchOnSongSelect), + tags = new MetadataSection(MetadataType.Tags, searchOnSongSelect), }, }, }, @@ -175,6 +178,12 @@ namespace osu.Game.Screens.Select }, loading = new LoadingLayer(true) }; + + void searchOnSongSelect(string text) + { + if (songSelect != null) + songSelect.FilterControl.SearchTextBox.Text = text; + } } private void updateStatistics() diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index a92b631100..fe8369ed0c 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -39,7 +39,7 @@ namespace osu.Game.Screens.Select public FilterCriteria CreateCriteria() { - string query = searchTextBox.Text; + string query = SearchTextBox.Text; var criteria = new FilterCriteria { @@ -62,7 +62,8 @@ namespace osu.Game.Screens.Select return criteria; } - private SeekLimitedSearchTextBox searchTextBox; + public SeekLimitedSearchTextBox SearchTextBox { get; private set; } + private CollectionFilterDropdown collectionDropdown; public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => @@ -103,7 +104,7 @@ namespace osu.Game.Screens.Select Height = 60, Children = new Drawable[] { - searchTextBox = new SeekLimitedSearchTextBox { RelativeSizeAxes = Axes.X }, + SearchTextBox = new SeekLimitedSearchTextBox { RelativeSizeAxes = Axes.X }, new Box { RelativeSizeAxes = Axes.X, @@ -204,23 +205,23 @@ namespace osu.Game.Screens.Select updateCriteria(); }; - searchTextBox.Current.ValueChanged += _ => updateCriteria(); + SearchTextBox.Current.ValueChanged += _ => updateCriteria(); updateCriteria(); } public void Deactivate() { - searchTextBox.ReadOnly = true; - searchTextBox.HoldFocus = false; - if (searchTextBox.HasFocus) - GetContainingInputManager().ChangeFocus(searchTextBox); + SearchTextBox.ReadOnly = true; + SearchTextBox.HoldFocus = false; + if (SearchTextBox.HasFocus) + GetContainingInputManager().ChangeFocus(SearchTextBox); } public void Activate() { - searchTextBox.ReadOnly = false; - searchTextBox.HoldFocus = true; + SearchTextBox.ReadOnly = false; + SearchTextBox.HoldFocus = true; } private readonly IBindable ruleset = new Bindable(); From 86d019c2b236e29dbba86f1db034837f0e28bea1 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 15 Jul 2022 06:52:06 +0300 Subject: [PATCH 2240/2328] Enable NRT on `BeatmapDetails` --- osu.Game/Screens/Select/BeatmapDetails.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index a877dc4863..80721d14ae 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; @@ -38,18 +36,18 @@ namespace osu.Game.Screens.Select private readonly LoadingLayer loading; [Resolved] - private IAPIProvider api { get; set; } + private IAPIProvider api { get; set; } = null!; - [Resolved(canBeNull: true)] - private SongSelect songSelect { get; set; } + [Resolved] + private SongSelect? songSelect { get; set; } - private IBeatmapInfo beatmapInfo; + private IBeatmapInfo? beatmapInfo; - private APIFailTimes failTimes; + private APIFailTimes? failTimes; - private int[] ratings; + private int[]? ratings; - public IBeatmapInfo BeatmapInfo + public IBeatmapInfo? BeatmapInfo { get => beatmapInfo; set @@ -59,7 +57,7 @@ namespace osu.Game.Screens.Select beatmapInfo = value; var onlineInfo = beatmapInfo as IBeatmapOnlineInfo; - var onlineSetInfo = beatmapInfo.BeatmapSet as IBeatmapSetOnlineInfo; + var onlineSetInfo = beatmapInfo?.BeatmapSet as IBeatmapSetOnlineInfo; failTimes = onlineInfo?.FailTimes; ratings = onlineSetInfo?.Ratings; From 254d22de1c94ec53347dc597a3cdca70f8c219e5 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 15 Jul 2022 07:44:56 +0300 Subject: [PATCH 2241/2328] Use proper variable name --- osu.Game/Collections/CollectionToggleMenuItem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Collections/CollectionToggleMenuItem.cs b/osu.Game/Collections/CollectionToggleMenuItem.cs index fbc935d19a..f2b10305b8 100644 --- a/osu.Game/Collections/CollectionToggleMenuItem.cs +++ b/osu.Game/Collections/CollectionToggleMenuItem.cs @@ -9,9 +9,9 @@ namespace osu.Game.Collections public class CollectionToggleMenuItem : ToggleMenuItem { public CollectionToggleMenuItem(BeatmapCollection collection, IBeatmapInfo beatmap) - : base(collection.Name.Value, MenuItemType.Standard, s => + : base(collection.Name.Value, MenuItemType.Standard, state => { - if (s) + if (state) collection.BeatmapHashes.Add(beatmap.MD5Hash); else collection.BeatmapHashes.Remove(beatmap.MD5Hash); From 7e80a710204074a1011eb66f664b7061f734e9fa Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 15 Jul 2022 08:16:36 +0300 Subject: [PATCH 2242/2328] Replace download tracker with local querying --- .../OnlinePlay/DrawableRoomPlaylistItem.cs | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs index d89816d3c7..f38077a9a7 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs @@ -5,12 +5,11 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Threading.Tasks; -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; @@ -95,12 +94,12 @@ namespace osu.Game.Screens.OnlinePlay private PanelBackground panelBackground; private FillFlowContainer mainFillFlow; - [CanBeNull] - private BeatmapDownloadTracker downloadTracker; - [Resolved] private RulesetStore rulesets { get; set; } + [Resolved] + private BeatmapManager beatmaps { get; set; } + [Resolved] private OsuColour colours { get; set; } @@ -321,15 +320,6 @@ namespace osu.Game.Screens.OnlinePlay difficultyIconContainer.FadeInFromZero(500, Easing.OutQuint); mainFillFlow.FadeInFromZero(500, Easing.OutQuint); - - downloadTracker?.RemoveAndDisposeImmediately(); - - if (beatmap != null) - { - Debug.Assert(beatmap.BeatmapSet != null); - downloadTracker = new BeatmapDownloadTracker(beatmap.BeatmapSet); - AddInternal(downloadTracker); - } } protected override Drawable CreateContent() @@ -505,13 +495,16 @@ namespace osu.Game.Screens.OnlinePlay if (beatmapOverlay != null) items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(Item.Beatmap.OnlineID))); - if (beatmap != null && collectionManager != null && downloadTracker?.State.Value == DownloadState.LocallyAvailable) + if (collectionManager != null && beatmap != null) { - var collectionItems = collectionManager.Collections.Select(c => new CollectionToggleMenuItem(c, beatmap)).Cast().ToList(); - if (manageCollectionsDialog != null) - collectionItems.Add(new OsuMenuItem("Manage...", MenuItemType.Standard, manageCollectionsDialog.Show)); + if (beatmaps.QueryBeatmap(b => b.OnlineID == beatmap.OnlineID) is BeatmapInfo local && !local.BeatmapSet.AsNonNull().DeletePending) + { + var collectionItems = collectionManager.Collections.Select(c => new CollectionToggleMenuItem(c, beatmap)).Cast().ToList(); + if (manageCollectionsDialog != null) + collectionItems.Add(new OsuMenuItem("Manage...", MenuItemType.Standard, manageCollectionsDialog.Show)); - items.Add(new OsuMenuItem("Collections") { Items = collectionItems }); + items.Add(new OsuMenuItem("Collections") { Items = collectionItems }); + } } return items.ToArray(); From 966882013df529b3662f8b594a7fe7dccd240906 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 15:47:05 +0900 Subject: [PATCH 2243/2328] Remove classic mod attribution to `SoloScoreInfo` conversion path --- osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs index b70da194a5..d139718a3c 100644 --- a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs @@ -103,9 +103,6 @@ namespace osu.Game.Online.API.Requests.Responses var mods = Mods.Select(apiMod => rulesetInstance.CreateModFromAcronym(apiMod.Acronym)).Where(m => m != null).ToArray(); - // all API scores provided by this class are considered to be legacy. - mods = mods.Append(rulesetInstance.CreateMod()).ToArray(); - var scoreInfo = ToScoreInfo(mods); scoreInfo.Ruleset = ruleset; From 688fcb256f41e5ad0fe96ee3fe2b9d2f82b5b960 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 15:47:25 +0900 Subject: [PATCH 2244/2328] Update score retrieval endpoint to access new storage --- osu.Game/Online/API/Requests/GetScoresRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/GetScoresRequest.cs b/osu.Game/Online/API/Requests/GetScoresRequest.cs index a6cd9a52c7..966e69938c 100644 --- a/osu.Game/Online/API/Requests/GetScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetScoresRequest.cs @@ -35,7 +35,7 @@ namespace osu.Game.Online.API.Requests this.mods = mods ?? Array.Empty(); } - protected override string Target => $@"beatmaps/{beatmapInfo.OnlineID}/scores{createQueryParameters()}"; + protected override string Target => $@"beatmaps/{beatmapInfo.OnlineID}/solo-scores{createQueryParameters()}"; private string createQueryParameters() { From 6122d2a52553a473f8a64fbb09bc78081d1740a5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 15:58:52 +0900 Subject: [PATCH 2245/2328] Add "F" `ScoreRank` to handle old scores which have this specified Not sure on the future of this, but given it is used in the save-failed-reply pull request (#18785) I think it's fine to add back for now. Without this, JSON parsing of older scores in server-side storage will fail on missing enum type. --- osu.Game/Scoring/ScoreRank.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Scoring/ScoreRank.cs b/osu.Game/Scoring/ScoreRank.cs index 9de8561b4a..a1916953c4 100644 --- a/osu.Game/Scoring/ScoreRank.cs +++ b/osu.Game/Scoring/ScoreRank.cs @@ -11,6 +11,10 @@ namespace osu.Game.Scoring { public enum ScoreRank { + // TODO: Localisable? + [Description(@"F")] + F = -1, + [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.RankD))] [Description(@"D")] D, From c8c79d2185d38b2cd440ed79e2448804ca74bd07 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 16:11:11 +0900 Subject: [PATCH 2246/2328] Standardise `HasReplay` implementation (and remove from persisting to realm) --- osu.Game/Database/EFToRealmMigrator.cs | 1 - osu.Game/Database/RealmAccess.cs | 3 ++- osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs | 3 +-- osu.Game/Scoring/ScoreInfo.cs | 2 +- osu.Game/Screens/Ranking/ReplayDownloadButton.cs | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game/Database/EFToRealmMigrator.cs b/osu.Game/Database/EFToRealmMigrator.cs index 3b5424b3fb..294a8cd3ed 100644 --- a/osu.Game/Database/EFToRealmMigrator.cs +++ b/osu.Game/Database/EFToRealmMigrator.cs @@ -443,7 +443,6 @@ namespace osu.Game.Database TotalScore = score.TotalScore, MaxCombo = score.MaxCombo, Accuracy = score.Accuracy, - HasReplay = ((IScoreInfo)score).HasReplay, Date = score.Date, PP = score.PP, Rank = score.Rank, diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 02b5a51f1f..bebc101b13 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -59,8 +59,9 @@ namespace osu.Game.Database /// 13 2022-01-13 Final migration of beatmaps and scores to realm (multiple new storage fields). /// 14 2022-03-01 Added BeatmapUserSettings to BeatmapInfo. /// 15 2022-07-13 Added LastPlayed to BeatmapInfo. + /// 16 2022-07-15 Removed HasReplay from ScoreInfo. /// - private const int schema_version = 15; + private const int schema_version = 16; /// /// Lock object which is held during sections, blocking realm retrieval during blocking periods. diff --git a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs index d139718a3c..6c48c7883f 100644 --- a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs @@ -129,8 +129,7 @@ namespace osu.Game.Online.API.Requests.Responses Rank = Rank, Statistics = Statistics, Date = EndedAt ?? DateTimeOffset.Now, - Hash = "online", // TODO: temporary? - HasReplay = HasReplay, + Hash = HasReplay ? "online" : string.Empty, // TODO: temporary? Mods = mods, PP = PP, }; diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index cbe9615380..81ca5f0300 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -45,7 +45,7 @@ namespace osu.Game.Scoring public double Accuracy { get; set; } - public bool HasReplay { get; set; } + public bool HasReplay => !string.IsNullOrEmpty(Hash); public DateTimeOffset Date { get; set; } diff --git a/osu.Game/Screens/Ranking/ReplayDownloadButton.cs b/osu.Game/Screens/Ranking/ReplayDownloadButton.cs index 954a5159b9..7081a0156e 100644 --- a/osu.Game/Screens/Ranking/ReplayDownloadButton.cs +++ b/osu.Game/Screens/Ranking/ReplayDownloadButton.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Ranking if (State.Value == DownloadState.LocallyAvailable) return ReplayAvailability.Local; - if (!string.IsNullOrEmpty(Score.Value?.Hash)) + if (Score.Value?.HasReplay == true) return ReplayAvailability.Online; return ReplayAvailability.NotAvailable; From 0ade8db550cf193b7093d5d42658f690bbba2a38 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 16:40:48 +0900 Subject: [PATCH 2247/2328] Tidy up nullability and casting --- osu.Game.Rulesets.Osu/Skinning/FollowCircle.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/FollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/FollowCircle.cs index 943b7d3b4f..321705d25e 100644 --- a/osu.Game.Rulesets.Osu/Skinning/FollowCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/FollowCircle.cs @@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Skinning { public abstract class FollowCircle : CompositeDrawable { - [Resolved(canBeNull: true)] + [Resolved] protected DrawableHitObject? ParentObject { get; private set; } protected FollowCircle() @@ -23,11 +23,7 @@ namespace osu.Game.Rulesets.Osu.Skinning [BackgroundDependencyLoader] private void load() { - if (ParentObject != null) - { - var slider = (DrawableSlider)ParentObject; - slider.Tracking.BindValueChanged(OnTrackingChanged, true); - } + ((DrawableSlider?)ParentObject)?.Tracking.BindValueChanged(OnTrackingChanged, true); } protected override void LoadComplete() From 7ed4eb5815cc682567da35177f5d7f774a406cad Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 17:01:01 +0900 Subject: [PATCH 2248/2328] Adjust transform logic to match osu-stable (and add TODOs for remaining oversights) --- .../Skinning/Legacy/LegacyFollowCircle.cs | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs index 38e2e74349..324f2525bc 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs @@ -1,10 +1,10 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Diagnostics; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Game.Rulesets.Osu.Objects.Drawables; namespace osu.Game.Rulesets.Osu.Skinning.Legacy { @@ -28,28 +28,28 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy if (ParentObject.Judged) return; - const float scale_duration = 180f; - const float fade_duration = 90f; + double remainingTime = ParentObject.HitStateUpdateTime - Time.Current; - double maxScaleDuration = ParentObject.HitStateUpdateTime - Time.Current; - double realScaleDuration = scale_duration; - if (tracking.NewValue && maxScaleDuration < realScaleDuration && maxScaleDuration >= 0) - realScaleDuration = maxScaleDuration; - double realFadeDuration = fade_duration * realScaleDuration / fade_duration; - - this.ScaleTo(tracking.NewValue ? DrawableSliderBall.FOLLOW_AREA : 1f, realScaleDuration, Easing.OutQuad) - .FadeTo(tracking.NewValue ? 1f : 0f, realFadeDuration, Easing.OutQuad); + // Note that the scale adjust here is 2 instead of DrawableSliderBall.FOLLOW_AREA to match legacy behaviour. + // This means the actual tracking area for gameplay purposes is larger than the sprite (but skins may be accounting for this). + if (tracking.NewValue) + { + // TODO: Follow circle should bounce on each slider tick. + this.ScaleTo(0.5f).ScaleTo(2f, Math.Min(180f, remainingTime), Easing.Out) + .FadeTo(0).FadeTo(1f, Math.Min(60f, remainingTime)); + } + else + { + // TODO: Should animate only at the next slider tick if we want to match stable perfectly. + this.ScaleTo(4f, 100) + .FadeTo(0f, 100); + } } protected override void OnSliderEnd() { - const float shrink_duration = 200f; - const float fade_delay = 175f; - const float fade_duration = 35f; - - this.ScaleTo(DrawableSliderBall.FOLLOW_AREA * 0.75f, shrink_duration, Easing.OutQuad) - .Delay(fade_delay) - .FadeOut(fade_duration); + this.ScaleTo(1.6f, 200, Easing.Out) + .FadeOut(200, Easing.In); } } } From 4b253f83c3ca9c1795494ae2b6e48ce2b4ef2b32 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 17:39:08 +0900 Subject: [PATCH 2249/2328] Fix intermittent test failures due to randomised score statistics --- .../Visual/Online/TestSceneScoresContainer.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs index be03328caa..6ef87f762c 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs @@ -274,14 +274,18 @@ namespace osu.Game.Tests.Visual.Online } }; + const int initial_great_count = 2000; + + int greatCount = initial_great_count; + foreach (var s in scores.Scores) { s.Statistics = new Dictionary { - { HitResult.Great, RNG.Next(2000) }, - { HitResult.Ok, RNG.Next(2000) }, - { HitResult.Meh, RNG.Next(2000) }, - { HitResult.Miss, RNG.Next(2000) } + { HitResult.Great, greatCount -= 100 }, + { HitResult.Ok, RNG.Next(100) }, + { HitResult.Meh, RNG.Next(100) }, + { HitResult.Miss, initial_great_count - greatCount } }; } From ba0a1587402ebd9fc6fd8d18743b093c8933b5cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 17:50:10 +0900 Subject: [PATCH 2250/2328] Show search online prompt even when no beatmaps are available locally --- osu.Game/Screens/Select/NoResultsPlaceholder.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Select/NoResultsPlaceholder.cs b/osu.Game/Screens/Select/NoResultsPlaceholder.cs index b8b589ff99..f3c3fb4d87 100644 --- a/osu.Game/Screens/Select/NoResultsPlaceholder.cs +++ b/osu.Game/Screens/Select/NoResultsPlaceholder.cs @@ -109,7 +109,7 @@ namespace osu.Game.Screens.Select textFlow.AddParagraph("No beatmaps found!"); textFlow.AddParagraph(string.Empty); - textFlow.AddParagraph("Consider using the \""); + textFlow.AddParagraph("- Consider running the \""); textFlow.AddLink(FirstRunSetupOverlayStrings.FirstRunSetupTitle, () => firstRunSetupOverlay?.Show()); textFlow.AddText("\" to download or import some beatmaps!"); } @@ -141,15 +141,14 @@ namespace osu.Game.Screens.Select textFlow.AddLink(" enabling ", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, true)); textFlow.AddText("automatic conversion!"); } - - if (!string.IsNullOrEmpty(filter?.SearchText)) - { - textFlow.AddParagraph("- Try "); - textFlow.AddLink("searching online", LinkAction.SearchBeatmapSet, filter.SearchText); - textFlow.AddText($" for \"{filter.SearchText}\"."); - } } + if (!string.IsNullOrEmpty(filter?.SearchText)) + { + textFlow.AddParagraph("- Try "); + textFlow.AddLink("searching online", LinkAction.SearchBeatmapSet, filter.SearchText); + textFlow.AddText($" for \"{filter.SearchText}\"."); + } // TODO: add clickable link to reset criteria. } } From 437e01427c56c01a0aa262dcf6834c582c42236b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 17:53:44 +0900 Subject: [PATCH 2251/2328] Fix beatmap listing not entering correct search mode when arriving before `LoadComplete` --- osu.Game/Overlays/BeatmapListing/BeatmapListingFilterControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapListingFilterControl.cs b/osu.Game/Overlays/BeatmapListing/BeatmapListingFilterControl.cs index 767b8646e3..2ca369d459 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapListingFilterControl.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapListingFilterControl.cs @@ -143,7 +143,7 @@ namespace osu.Game.Overlays.BeatmapListing } public void Search(string query) - => searchControl.Query.Value = query; + => Schedule(() => searchControl.Query.Value = query); protected override void LoadComplete() { From 105ffdbbdd200991de8a0961db6431dd90272578 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 17:57:14 +0900 Subject: [PATCH 2252/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index caaa83bff4..d5390e6a3d 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 355fd5f458..61fcf2e375 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index fcf71f3ab0..8843b5c831 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - + From e12e4803939cd3058bffac6c83262fc8916aa352 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 18:01:35 +0900 Subject: [PATCH 2253/2328] Only expose bindable string rather than full textbox --- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 80721d14ae..90418efe15 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -180,7 +180,7 @@ namespace osu.Game.Screens.Select void searchOnSongSelect(string text) { if (songSelect != null) - songSelect.FilterControl.SearchTextBox.Text = text; + songSelect.FilterControl.CurrentTextSearch.Value = text; } } diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index fe8369ed0c..e43261f374 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -31,6 +31,8 @@ namespace osu.Game.Screens.Select public Action FilterChanged; + public Bindable CurrentTextSearch => searchTextBox.Current; + private OsuTabControl sortTabs; private Bindable sortMode; @@ -39,7 +41,7 @@ namespace osu.Game.Screens.Select public FilterCriteria CreateCriteria() { - string query = SearchTextBox.Text; + string query = searchTextBox.Text; var criteria = new FilterCriteria { @@ -62,7 +64,7 @@ namespace osu.Game.Screens.Select return criteria; } - public SeekLimitedSearchTextBox SearchTextBox { get; private set; } + private SeekLimitedSearchTextBox searchTextBox; private CollectionFilterDropdown collectionDropdown; @@ -104,7 +106,7 @@ namespace osu.Game.Screens.Select Height = 60, Children = new Drawable[] { - SearchTextBox = new SeekLimitedSearchTextBox { RelativeSizeAxes = Axes.X }, + searchTextBox = new SeekLimitedSearchTextBox { RelativeSizeAxes = Axes.X }, new Box { RelativeSizeAxes = Axes.X, @@ -205,23 +207,23 @@ namespace osu.Game.Screens.Select updateCriteria(); }; - SearchTextBox.Current.ValueChanged += _ => updateCriteria(); + searchTextBox.Current.ValueChanged += _ => updateCriteria(); updateCriteria(); } public void Deactivate() { - SearchTextBox.ReadOnly = true; - SearchTextBox.HoldFocus = false; - if (SearchTextBox.HasFocus) - GetContainingInputManager().ChangeFocus(SearchTextBox); + searchTextBox.ReadOnly = true; + searchTextBox.HoldFocus = false; + if (searchTextBox.HasFocus) + GetContainingInputManager().ChangeFocus(searchTextBox); } public void Activate() { - SearchTextBox.ReadOnly = false; - SearchTextBox.HoldFocus = true; + searchTextBox.ReadOnly = false; + searchTextBox.HoldFocus = true; } private readonly IBindable ruleset = new Bindable(); From cb1d60cd3634234a1ceef318f70ab29266a5b9dc Mon Sep 17 00:00:00 2001 From: Susko3 Date: Fri, 15 Jul 2022 11:57:05 +0200 Subject: [PATCH 2254/2328] Include new file in compile --- osu.Android/osu.Android.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Android/osu.Android.csproj b/osu.Android/osu.Android.csproj index 90b02c527b..004cc8c39c 100644 --- a/osu.Android/osu.Android.csproj +++ b/osu.Android/osu.Android.csproj @@ -26,6 +26,7 @@ true + From 8a48cb701dc416ad9ad19ef4ad4d9e27799b2ceb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 18:54:19 +0900 Subject: [PATCH 2255/2328] Tidy up implementation and remove unnecessary enum --- osu.Game/Online/DownloadState.cs | 2 - .../Screens/Play/SaveFailedScoreButton.cs | 61 ++++++++----------- 2 files changed, 24 insertions(+), 39 deletions(-) diff --git a/osu.Game/Online/DownloadState.cs b/osu.Game/Online/DownloadState.cs index 3d389d45f9..a58c40d16a 100644 --- a/osu.Game/Online/DownloadState.cs +++ b/osu.Game/Online/DownloadState.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - namespace osu.Game.Online { public enum DownloadState diff --git a/osu.Game/Screens/Play/SaveFailedScoreButton.cs b/osu.Game/Screens/Play/SaveFailedScoreButton.cs index 256228a1cb..6dfceec9f3 100644 --- a/osu.Game/Screens/Play/SaveFailedScoreButton.cs +++ b/osu.Game/Screens/Play/SaveFailedScoreButton.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Threading.Tasks; using osu.Framework.Allocation; @@ -18,22 +16,24 @@ namespace osu.Game.Screens.Play { public class SaveFailedScoreButton : CompositeDrawable { - public Func> ImportFailedScore; - private Task saveFailedScoreTask; - private ScoreInfo score; + private readonly Bindable state = new Bindable(); - protected readonly Bindable State = new Bindable(); + private readonly Func> importFailedScore; - private DownloadButton button; + private Task? saveFailedScoreTask; + + private ScoreInfo? score; + + private DownloadButton button = null!; public SaveFailedScoreButton(Func> requestImportFailedScore) { Size = new Vector2(50, 30); - ImportFailedScore = requestImportFailedScore; + importFailedScore = requestImportFailedScore; } - [BackgroundDependencyLoader(true)] - private void load(OsuGame game) + [BackgroundDependencyLoader] + private void load(OsuGame? game) { InternalChild = button = new DownloadButton { @@ -42,13 +42,13 @@ namespace osu.Game.Screens.Play button.Action = () => { - switch (State.Value) + switch (state.Value) { - case ImportState.Imported: + case DownloadState.LocallyAvailable: game?.PresentScore(score, ScorePresentType.Gameplay); break; - case ImportState.Importing: + case DownloadState.Importing: break; default: @@ -56,24 +56,24 @@ namespace osu.Game.Screens.Play break; } }; - State.BindValueChanged(state => + state.BindValueChanged(state => { switch (state.NewValue) { - case ImportState.Imported: + case DownloadState.LocallyAvailable: button.State.Value = DownloadState.LocallyAvailable; break; - case ImportState.Importing: + case DownloadState.Importing: button.State.Value = DownloadState.Importing; break; - case ImportState.Failed: + case DownloadState.NotDownloaded: button.State.Value = DownloadState.NotDownloaded; break; } }, true); - State.BindValueChanged(updateState, true); + state.BindValueChanged(updateState, true); } private void saveScore() @@ -83,48 +83,35 @@ namespace osu.Game.Screens.Play return; } - State.Value = ImportState.Importing; + state.Value = DownloadState.Importing; - saveFailedScoreTask = Task.Run(ImportFailedScore); + saveFailedScoreTask = Task.Run(importFailedScore); saveFailedScoreTask.ContinueWith(s => Schedule(() => { score = s.GetAwaiter().GetResult(); - State.Value = score != null ? ImportState.Imported : ImportState.Failed; + state.Value = score != null ? DownloadState.LocallyAvailable : DownloadState.NotDownloaded; })); } - private void updateState(ValueChangedEvent state) + private void updateState(ValueChangedEvent state) { switch (state.NewValue) { - case ImportState.Imported: + case DownloadState.LocallyAvailable: button.TooltipText = @"Watch replay"; button.Enabled.Value = true; break; - case ImportState.Importing: + case DownloadState.Importing: button.TooltipText = @"Importing score"; button.Enabled.Value = false; break; - case ImportState.Failed: - button.TooltipText = @"Import failed, click button to re-import"; - button.Enabled.Value = true; - break; - default: button.TooltipText = @"Save score"; button.Enabled.Value = true; break; } } - - public enum ImportState - { - NotImported, - Failed, - Importing, - Imported - } } } From 0e788ac7147c8c01f1cc72c6db6a74d0a072e33d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 19:02:12 +0900 Subject: [PATCH 2256/2328] Simplify bindable logic greatly --- .../Screens/Play/SaveFailedScoreButton.cs | 88 ++++++------------- 1 file changed, 28 insertions(+), 60 deletions(-) diff --git a/osu.Game/Screens/Play/SaveFailedScoreButton.cs b/osu.Game/Screens/Play/SaveFailedScoreButton.cs index 6dfceec9f3..ed4aa96977 100644 --- a/osu.Game/Screens/Play/SaveFailedScoreButton.cs +++ b/osu.Game/Screens/Play/SaveFailedScoreButton.cs @@ -5,6 +5,7 @@ using System; using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Scoring; @@ -20,16 +21,15 @@ namespace osu.Game.Screens.Play private readonly Func> importFailedScore; - private Task? saveFailedScoreTask; - private ScoreInfo? score; private DownloadButton button = null!; - public SaveFailedScoreButton(Func> requestImportFailedScore) + public SaveFailedScoreButton(Func> importFailedScore) { Size = new Vector2(50, 30); - importFailedScore = requestImportFailedScore; + + this.importFailedScore = importFailedScore; } [BackgroundDependencyLoader] @@ -38,80 +38,48 @@ namespace osu.Game.Screens.Play InternalChild = button = new DownloadButton { RelativeSizeAxes = Axes.Both, - }; - - button.Action = () => - { - switch (state.Value) + State = { BindTarget = state }, + Action = () => { - case DownloadState.LocallyAvailable: - game?.PresentScore(score, ScorePresentType.Gameplay); - break; + switch (state.Value) + { + case DownloadState.LocallyAvailable: + game?.PresentScore(score, ScorePresentType.Gameplay); + break; - case DownloadState.Importing: - break; + case DownloadState.NotDownloaded: + state.Value = DownloadState.Importing; - default: - saveScore(); - break; + Task.Run(importFailedScore).ContinueWith(result => Schedule(() => + { + score = result.GetResultSafely(); + state.Value = score != null ? DownloadState.LocallyAvailable : DownloadState.NotDownloaded; + })); + break; + } } }; + state.BindValueChanged(state => { switch (state.NewValue) { case DownloadState.LocallyAvailable: - button.State.Value = DownloadState.LocallyAvailable; + button.TooltipText = @"watch replay"; + button.Enabled.Value = true; break; case DownloadState.Importing: - button.State.Value = DownloadState.Importing; + button.TooltipText = @"importing score"; + button.Enabled.Value = false; break; - case DownloadState.NotDownloaded: - button.State.Value = DownloadState.NotDownloaded; + default: + button.TooltipText = @"save score"; + button.Enabled.Value = true; break; } }, true); - state.BindValueChanged(updateState, true); - } - - private void saveScore() - { - if (saveFailedScoreTask != null) - { - return; - } - - state.Value = DownloadState.Importing; - - saveFailedScoreTask = Task.Run(importFailedScore); - saveFailedScoreTask.ContinueWith(s => Schedule(() => - { - score = s.GetAwaiter().GetResult(); - state.Value = score != null ? DownloadState.LocallyAvailable : DownloadState.NotDownloaded; - })); - } - - private void updateState(ValueChangedEvent state) - { - switch (state.NewValue) - { - case DownloadState.LocallyAvailable: - button.TooltipText = @"Watch replay"; - button.Enabled.Value = true; - break; - - case DownloadState.Importing: - button.TooltipText = @"Importing score"; - button.Enabled.Value = false; - break; - - default: - button.TooltipText = @"Save score"; - button.Enabled.Value = true; - break; - } } } } From 0200ef1d481dde0070c1d39109162892e98863e3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 19:06:44 +0900 Subject: [PATCH 2257/2328] Make delegate firing more safe to being set later than BDL --- osu.Game/Screens/Play/FailOverlay.cs | 2 +- osu.Game/Screens/Play/Player.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 2af5102369..76cd030a8f 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Play Direction = FillDirection.Horizontal, Children = new Drawable[] { - new SaveFailedScoreButton(SaveReplay) + new SaveFailedScoreButton(() => SaveReplay()) { Width = 300 }, diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 19f0c90341..17ab8f6710 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -1048,6 +1048,7 @@ namespace osu.Game.Screens.Play { Score.ScoreInfo.Passed = false; Score.ScoreInfo.Rank = ScoreRank.F; + var scoreCopy = Score.DeepClone(); try From 775c6c83748df35e1ac23869124f461589b31ea6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 19:29:37 +0900 Subject: [PATCH 2258/2328] Fix potential crash in editor from transform time going below zero --- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs index 324f2525bc..5b7da5a1ba 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyFollowCircle.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy if (ParentObject.Judged) return; - double remainingTime = ParentObject.HitStateUpdateTime - Time.Current; + double remainingTime = Math.Max(0, ParentObject.HitStateUpdateTime - Time.Current); // Note that the scale adjust here is 2 instead of DrawableSliderBall.FOLLOW_AREA to match legacy behaviour. // This means the actual tracking area for gameplay purposes is larger than the sprite (but skins may be accounting for this). From 21433d4ecbfde8ca42cf95f8697fcc1ad4ace81b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 20:14:58 +0900 Subject: [PATCH 2259/2328] Add test coverage of saving a failed score --- .../TestScenePlayerLocalScoreImport.cs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs index 5ec9e88728..113a0874ce 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs @@ -8,14 +8,18 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Extensions; using osu.Framework.Extensions.ObjectExtensions; +using osu.Framework.Graphics.Containers; using osu.Framework.Platform; using osu.Framework.Screens; +using osu.Framework.Testing; using osu.Game.Beatmaps; +using osu.Game.Graphics.Containers; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; +using osu.Game.Screens.Play; using osu.Game.Screens.Ranking; using osu.Game.Tests.Resources; @@ -58,13 +62,30 @@ namespace osu.Game.Tests.Visual.Gameplay protected override bool HasCustomSteps => true; - protected override bool AllowFail => false; + protected override bool AllowFail => allowFail; + + private bool allowFail; + + [Test] + public void TestSaveFailedReplay() + { + AddStep("set fail", () => allowFail = true); + AddStep("set no custom ruleset", () => customRuleset = null); + + CreateTest(); + + AddUntilStep("fail screen displayed", () => Player.ChildrenOfType().First().State.Value == Visibility.Visible); + AddUntilStep("score not in database", () => Realm.Run(r => r.Find(Player.Score.ScoreInfo.ID) == null)); + AddStep("click save button", () => Player.ChildrenOfType().First().ChildrenOfType().First().TriggerClick()); + AddUntilStep("score not in database", () => Realm.Run(r => r.Find(Player.Score.ScoreInfo.ID) != null)); + } [Test] public void TestLastPlayedUpdated() { DateTimeOffset? getLastPlayed() => Realm.Run(r => r.Find(Beatmap.Value.BeatmapInfo.ID)?.LastPlayed); + AddStep("set no fail", () => allowFail = false); AddStep("set no custom ruleset", () => customRuleset = null); AddAssert("last played is null", () => getLastPlayed() == null); @@ -77,6 +98,7 @@ namespace osu.Game.Tests.Visual.Gameplay [Test] public void TestScoreStoredLocally() { + AddStep("set no fail", () => allowFail = false); AddStep("set no custom ruleset", () => customRuleset = null); CreateTest(); @@ -94,6 +116,7 @@ namespace osu.Game.Tests.Visual.Gameplay { Ruleset createCustomRuleset() => new CustomRuleset(); + AddStep("set no fail", () => allowFail = false); AddStep("import custom ruleset", () => Realm.Write(r => r.Add(createCustomRuleset().RulesetInfo))); AddStep("set custom ruleset", () => customRuleset = createCustomRuleset()); From d325c534ab60b0b58bc36015e5e3f32915016c8e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 20:45:37 +0900 Subject: [PATCH 2260/2328] Check whether score is already imported and show correct state for save button --- osu.Game/Screens/Play/SaveFailedScoreButton.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/SaveFailedScoreButton.cs b/osu.Game/Screens/Play/SaveFailedScoreButton.cs index ed4aa96977..7eed2086ae 100644 --- a/osu.Game/Screens/Play/SaveFailedScoreButton.cs +++ b/osu.Game/Screens/Play/SaveFailedScoreButton.cs @@ -8,6 +8,7 @@ using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Database; using osu.Game.Scoring; using osu.Game.Graphics.UserInterface; using osu.Game.Online; @@ -33,7 +34,7 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader] - private void load(OsuGame? game) + private void load(OsuGame? game, Player? player, RealmAccess realm) { InternalChild = button = new DownloadButton { @@ -60,6 +61,13 @@ namespace osu.Game.Screens.Play } }; + if (player != null) + { + score = realm.Run(r => r.Find(player.Score.ScoreInfo.ID)?.Detach()); + if (score != null) + state.Value = DownloadState.LocallyAvailable; + } + state.BindValueChanged(state => { switch (state.NewValue) From 2beed6d7b77b9c2ecad01cda12befbacf5422d0c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Jul 2022 20:45:48 +0900 Subject: [PATCH 2261/2328] Allow failed scores to fail in replay playback --- osu.Game/Screens/Play/ReplayPlayer.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/ReplayPlayer.cs b/osu.Game/Screens/Play/ReplayPlayer.cs index 64b4853a67..e82238945b 100644 --- a/osu.Game/Screens/Play/ReplayPlayer.cs +++ b/osu.Game/Screens/Play/ReplayPlayer.cs @@ -22,12 +22,21 @@ namespace osu.Game.Screens.Play { private readonly Func, Score> createScore; + private readonly bool replayIsFailedScore; + // Disallow replays from failing. (see https://github.com/ppy/osu/issues/6108) - protected override bool CheckModsAllowFailure() => false; + protected override bool CheckModsAllowFailure() + { + if (!replayIsFailedScore) + return false; + + return base.CheckModsAllowFailure(); + } public ReplayPlayer(Score score, PlayerConfiguration configuration = null) : this((_, _) => score, configuration) { + replayIsFailedScore = score.ScoreInfo.Rank == ScoreRank.F; } public ReplayPlayer(Func, Score> createScore, PlayerConfiguration configuration = null) From c64b5cc48bd49bd2db62f62a5d2c88eae77556c9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 16 Jul 2022 02:47:08 +0900 Subject: [PATCH 2262/2328] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index d5390e6a3d..04b16c5b0f 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 61fcf2e375..1d3cd39cf3 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -37,7 +37,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 8843b5c831..dfd229755f 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -62,7 +62,7 @@ - + From 68afb65affc2bd3313100eba9192ff7d7183ebc1 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 15 Jul 2022 22:09:54 +0300 Subject: [PATCH 2263/2328] Move default state steps to `SetUp` rather than duplicating per test case --- .../Gameplay/TestScenePlayerLocalScoreImport.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs index 113a0874ce..6491987abe 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs @@ -66,11 +66,17 @@ namespace osu.Game.Tests.Visual.Gameplay private bool allowFail; + [SetUp] + public void SetUp() + { + allowFail = false; + customRuleset = null; + } + [Test] public void TestSaveFailedReplay() { - AddStep("set fail", () => allowFail = true); - AddStep("set no custom ruleset", () => customRuleset = null); + AddStep("allow fail", () => allowFail = true); CreateTest(); @@ -85,8 +91,6 @@ namespace osu.Game.Tests.Visual.Gameplay { DateTimeOffset? getLastPlayed() => Realm.Run(r => r.Find(Beatmap.Value.BeatmapInfo.ID)?.LastPlayed); - AddStep("set no fail", () => allowFail = false); - AddStep("set no custom ruleset", () => customRuleset = null); AddAssert("last played is null", () => getLastPlayed() == null); CreateTest(); @@ -98,9 +102,6 @@ namespace osu.Game.Tests.Visual.Gameplay [Test] public void TestScoreStoredLocally() { - AddStep("set no fail", () => allowFail = false); - AddStep("set no custom ruleset", () => customRuleset = null); - CreateTest(); AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning); @@ -116,7 +117,6 @@ namespace osu.Game.Tests.Visual.Gameplay { Ruleset createCustomRuleset() => new CustomRuleset(); - AddStep("set no fail", () => allowFail = false); AddStep("import custom ruleset", () => Realm.Write(r => r.Add(createCustomRuleset().RulesetInfo))); AddStep("set custom ruleset", () => customRuleset = createCustomRuleset()); From 6285442b7d997f9da0de8d2600310176b252b4fb Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 15 Jul 2022 22:28:09 +0300 Subject: [PATCH 2264/2328] Fix failed scores not prepared before import --- osu.Game/Screens/Play/Player.cs | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 17ab8f6710..516364e13a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -267,7 +267,12 @@ namespace osu.Game.Screens.Play }, FailOverlay = new FailOverlay { - SaveReplay = saveFailedReplay, + SaveReplay = () => + { + Score.ScoreInfo.Passed = false; + Score.ScoreInfo.Rank = ScoreRank.F; + return prepareAndImportScore(); + }, OnRetry = Restart, OnQuit = () => PerformExit(true), }, @@ -721,7 +726,7 @@ namespace osu.Game.Screens.Play if (!Configuration.ShowResults) return; - prepareScoreForDisplayTask ??= Task.Run(prepareScoreForResults); + prepareScoreForDisplayTask ??= Task.Run(prepareAndImportScore); bool storyboardHasOutro = DimmableStoryboard.ContentDisplayed && !DimmableStoryboard.HasStoryboardEnded.Value; @@ -740,7 +745,7 @@ namespace osu.Game.Screens.Play /// Asynchronously run score preparation operations (database import, online submission etc.). /// /// The final score. - private async Task prepareScoreForResults() + private async Task prepareAndImportScore() { var scoreCopy = Score.DeepClone(); @@ -1044,26 +1049,6 @@ namespace osu.Game.Screens.Play return base.OnExiting(e); } - private async Task saveFailedReplay() - { - Score.ScoreInfo.Passed = false; - Score.ScoreInfo.Rank = ScoreRank.F; - - var scoreCopy = Score.DeepClone(); - - try - { - await ImportScore(scoreCopy); - } - catch (Exception ex) - { - Logger.Error(ex, @"Score import failed!"); - return null; - } - - return scoreCopy.ScoreInfo; - } - /// /// Creates the player's . /// From e6236ba088fddfceafacfae9df40a57b2cd833e5 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 15 Jul 2022 23:39:04 +0300 Subject: [PATCH 2265/2328] Update save score button to check availability after import Previously was relying on whether `SaveReplay` returns null, but since I've changed it to use the standard "prepare score for import" path, the button has to check for local availability after import since that path doesn't return null on fail. --- osu.Game/Screens/Play/FailOverlay.cs | 2 +- osu.Game/Screens/Play/SaveFailedScoreButton.cs | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 76cd030a8f..2af5102369 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Play Direction = FillDirection.Horizontal, Children = new Drawable[] { - new SaveFailedScoreButton(() => SaveReplay()) + new SaveFailedScoreButton(SaveReplay) { Width = 300 }, diff --git a/osu.Game/Screens/Play/SaveFailedScoreButton.cs b/osu.Game/Screens/Play/SaveFailedScoreButton.cs index 7eed2086ae..3f6e741dff 100644 --- a/osu.Game/Screens/Play/SaveFailedScoreButton.cs +++ b/osu.Game/Screens/Play/SaveFailedScoreButton.cs @@ -22,7 +22,7 @@ namespace osu.Game.Screens.Play private readonly Func> importFailedScore; - private ScoreInfo? score; + private ScoreInfo? importedScore; private DownloadButton button = null!; @@ -45,17 +45,16 @@ namespace osu.Game.Screens.Play switch (state.Value) { case DownloadState.LocallyAvailable: - game?.PresentScore(score, ScorePresentType.Gameplay); + game?.PresentScore(importedScore, ScorePresentType.Gameplay); break; case DownloadState.NotDownloaded: state.Value = DownloadState.Importing; - - Task.Run(importFailedScore).ContinueWith(result => Schedule(() => + Task.Run(importFailedScore).ContinueWith(t => { - score = result.GetResultSafely(); - state.Value = score != null ? DownloadState.LocallyAvailable : DownloadState.NotDownloaded; - })); + importedScore = realm.Run(r => r.Find(t.GetResultSafely().ID)?.Detach()); + Schedule(() => state.Value = importedScore != null ? DownloadState.LocallyAvailable : DownloadState.NotDownloaded); + }); break; } } @@ -63,8 +62,8 @@ namespace osu.Game.Screens.Play if (player != null) { - score = realm.Run(r => r.Find(player.Score.ScoreInfo.ID)?.Detach()); - if (score != null) + importedScore = realm.Run(r => r.Find(player.Score.ScoreInfo.ID)?.Detach()); + if (importedScore != null) state.Value = DownloadState.LocallyAvailable; } From b42f49aeaaf7d7a58b5ad08eb8c14067980bc8ac Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 16 Jul 2022 00:34:21 +0300 Subject: [PATCH 2266/2328] Handle `APIException` from user request during logging in --- osu.Game/Online/API/APIAccess.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 43cea7fb97..7af19f6dd1 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -163,7 +163,13 @@ namespace osu.Game.Online.API userReq.Failure += ex => { - if (ex is WebException webException && webException.Message == @"Unauthorized") + if (ex is APIException) + { + LastLoginError = ex; + log.Add("Login failed on local user retrieval!"); + Logout(); + } + else if (ex is WebException webException && webException.Message == @"Unauthorized") { log.Add(@"Login no longer valid"); Logout(); From 4ea8fd75cc4277833efca0df2b64f51bd30a8381 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 16 Jul 2022 04:05:07 +0300 Subject: [PATCH 2267/2328] Replace `Country` class with enumeration --- osu.Game/Users/Country.cs | 770 +++++++++++++++++++++++++++++++++++++- 1 file changed, 755 insertions(+), 15 deletions(-) diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index b38600fa1b..d1f33627c1 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -1,27 +1,767 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - -using System; +using System.ComponentModel; +using JetBrains.Annotations; using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace osu.Game.Users { - public class Country : IEquatable + [JsonConverter(typeof(StringEnumConverter))] + public enum Country { - /// - /// The name of this country. - /// - [JsonProperty(@"name")] - public string FullName; + [Description("Alien")] + XX = 0, - /// - /// Two-letter flag acronym (ISO 3166 standard) - /// - [JsonProperty(@"code")] - public string FlagName; + [Description("Bangladesh")] + BD, - public bool Equals(Country other) => FlagName == other?.FlagName; + [Description("Belgium")] + BE, + + [Description("Burkina Faso")] + BF, + + [Description("Bulgaria")] + BG, + + [Description("Bosnia and Herzegovina")] + BA, + + [Description("Barbados")] + BB, + + [Description("Wallis and Futuna")] + WF, + + [Description("Saint Barthelemy")] + BL, + + [Description("Bermuda")] + BM, + + [Description("Brunei")] + BN, + + [Description("Bolivia")] + BO, + + [Description("Bahrain")] + BH, + + [Description("Burundi")] + BI, + + [Description("Benin")] + BJ, + + [Description("Bhutan")] + BT, + + [Description("Jamaica")] + JM, + + [Description("Bouvet Island")] + BV, + + [Description("Botswana")] + BW, + + [Description("Samoa")] + WS, + + [Description("Bonaire, Saint Eustatius and Saba")] + BQ, + + [Description("Brazil")] + BR, + + [Description("Bahamas")] + BS, + + [Description("Jersey")] + JE, + + [Description("Belarus")] + BY, + + [Description("Belize")] + BZ, + + [Description("Russia")] + RU, + + [Description("Rwanda")] + RW, + + [Description("Serbia")] + RS, + + [Description("East Timor")] + TL, + + [Description("Reunion")] + RE, + + [Description("Turkmenistan")] + TM, + + [Description("Tajikistan")] + TJ, + + [Description("Romania")] + RO, + + [Description("Tokelau")] + TK, + + [Description("Guinea-Bissau")] + GW, + + [Description("Guam")] + GU, + + [Description("Guatemala")] + GT, + + [Description("South Georgia and the South Sandwich Islands")] + GS, + + [Description("Greece")] + GR, + + [Description("Equatorial Guinea")] + GQ, + + [Description("Guadeloupe")] + GP, + + [Description("Japan")] + JP, + + [Description("Guyana")] + GY, + + [Description("Guernsey")] + GG, + + [Description("French Guiana")] + GF, + + [Description("Georgia")] + GE, + + [Description("Grenada")] + GD, + + [Description("United Kingdom")] + GB, + + [Description("Gabon")] + GA, + + [Description("El Salvador")] + SV, + + [Description("Guinea")] + GN, + + [Description("Gambia")] + GM, + + [Description("Greenland")] + GL, + + [Description("Gibraltar")] + GI, + + [Description("Ghana")] + GH, + + [Description("Oman")] + OM, + + [Description("Tunisia")] + TN, + + [Description("Jordan")] + JO, + + [Description("Croatia")] + HR, + + [Description("Haiti")] + HT, + + [Description("Hungary")] + HU, + + [Description("Hong Kong")] + HK, + + [Description("Honduras")] + HN, + + [Description("Heard Island and McDonald Islands")] + HM, + + [Description("Venezuela")] + VE, + + [Description("Puerto Rico")] + PR, + + [Description("Palestinian Territory")] + PS, + + [Description("Palau")] + PW, + + [Description("Portugal")] + PT, + + [Description("Svalbard and Jan Mayen")] + SJ, + + [Description("Paraguay")] + PY, + + [Description("Iraq")] + IQ, + + [Description("Panama")] + PA, + + [Description("French Polynesia")] + PF, + + [Description("Papua New Guinea")] + PG, + + [Description("Peru")] + PE, + + [Description("Pakistan")] + PK, + + [Description("Philippines")] + PH, + + [Description("Pitcairn")] + PN, + + [Description("Poland")] + PL, + + [Description("Saint Pierre and Miquelon")] + PM, + + [Description("Zambia")] + ZM, + + [Description("Western Sahara")] + EH, + + [Description("Estonia")] + EE, + + [Description("Egypt")] + EG, + + [Description("South Africa")] + ZA, + + [Description("Ecuador")] + EC, + + [Description("Italy")] + IT, + + [Description("Vietnam")] + VN, + + [Description("Solomon Islands")] + SB, + + [Description("Ethiopia")] + ET, + + [Description("Somalia")] + SO, + + [Description("Zimbabwe")] + ZW, + + [Description("Saudi Arabia")] + SA, + + [Description("Spain")] + ES, + + [Description("Eritrea")] + ER, + + [Description("Montenegro")] + ME, + + [Description("Moldova")] + MD, + + [Description("Madagascar")] + MG, + + [Description("Saint Martin")] + MF, + + [Description("Morocco")] + MA, + + [Description("Monaco")] + MC, + + [Description("Uzbekistan")] + UZ, + + [Description("Myanmar")] + MM, + + [Description("Mali")] + ML, + + [Description("Macao")] + MO, + + [Description("Mongolia")] + MN, + + [Description("Marshall Islands")] + MH, + + [Description("North Macedonia")] + MK, + + [Description("Mauritius")] + MU, + + [Description("Malta")] + MT, + + [Description("Malawi")] + MW, + + [Description("Maldives")] + MV, + + [Description("Martinique")] + MQ, + + [Description("Northern Mariana Islands")] + MP, + + [Description("Montserrat")] + MS, + + [Description("Mauritania")] + MR, + + [Description("Isle of Man")] + IM, + + [Description("Uganda")] + UG, + + [Description("Tanzania")] + TZ, + + [Description("Malaysia")] + MY, + + [Description("Mexico")] + MX, + + [Description("Israel")] + IL, + + [Description("France")] + FR, + + [Description("British Indian Ocean Territory")] + IO, + + [Description("Saint Helena")] + SH, + + [Description("Finland")] + FI, + + [Description("Fiji")] + FJ, + + [Description("Falkland Islands")] + FK, + + [Description("Micronesia")] + FM, + + [Description("Faroe Islands")] + FO, + + [Description("Nicaragua")] + NI, + + [Description("Netherlands")] + NL, + + [Description("Norway")] + NO, + + [Description("Namibia")] + NA, + + [Description("Vanuatu")] + VU, + + [Description("New Caledonia")] + NC, + + [Description("Niger")] + NE, + + [Description("Norfolk Island")] + NF, + + [Description("Nigeria")] + NG, + + [Description("New Zealand")] + NZ, + + [Description("Nepal")] + NP, + + [Description("Nauru")] + NR, + + [Description("Niue")] + NU, + + [Description("Cook Islands")] + CK, + + [Description("Kosovo")] + XK, + + [Description("Ivory Coast")] + CI, + + [Description("Switzerland")] + CH, + + [Description("Colombia")] + CO, + + [Description("China")] + CN, + + [Description("Cameroon")] + CM, + + [Description("Chile")] + CL, + + [Description("Cocos Islands")] + CC, + + [Description("Canada")] + CA, + + [Description("Republic of the Congo")] + CG, + + [Description("Central African Republic")] + CF, + + [Description("Democratic Republic of the Congo")] + CD, + + [Description("Czech Republic")] + CZ, + + [Description("Cyprus")] + CY, + + [Description("Christmas Island")] + CX, + + [Description("Costa Rica")] + CR, + + [Description("Curacao")] + CW, + + [Description("Cabo Verde")] + CV, + + [Description("Cuba")] + CU, + + [Description("Eswatini")] + SZ, + + [Description("Syria")] + SY, + + [Description("Sint Maarten")] + SX, + + [Description("Kyrgyzstan")] + KG, + + [Description("Kenya")] + KE, + + [Description("South Sudan")] + SS, + + [Description("Suriname")] + SR, + + [Description("Kiribati")] + KI, + + [Description("Cambodia")] + KH, + + [Description("Saint Kitts and Nevis")] + KN, + + [Description("Comoros")] + KM, + + [Description("Sao Tome and Principe")] + ST, + + [Description("Slovakia")] + SK, + + [Description("South Korea")] + KR, + + [Description("Slovenia")] + SI, + + [Description("North Korea")] + KP, + + [Description("Kuwait")] + KW, + + [Description("Senegal")] + SN, + + [Description("San Marino")] + SM, + + [Description("Sierra Leone")] + SL, + + [Description("Seychelles")] + SC, + + [Description("Kazakhstan")] + KZ, + + [Description("Cayman Islands")] + KY, + + [Description("Singapore")] + SG, + + [Description("Sweden")] + SE, + + [Description("Sudan")] + SD, + + [Description("Dominican Republic")] + DO, + + [Description("Dominica")] + DM, + + [Description("Djibouti")] + DJ, + + [Description("Denmark")] + DK, + + [Description("British Virgin Islands")] + VG, + + [Description("Germany")] + DE, + + [Description("Yemen")] + YE, + + [Description("Algeria")] + DZ, + + [Description("United States")] + US, + + [Description("Uruguay")] + UY, + + [Description("Mayotte")] + YT, + + [Description("United States Minor Outlying Islands")] + UM, + + [Description("Lebanon")] + LB, + + [Description("Saint Lucia")] + LC, + + [Description("Laos")] + LA, + + [Description("Tuvalu")] + TV, + + [Description("Taiwan")] + TW, + + [Description("Trinidad and Tobago")] + TT, + + [Description("Turkey")] + TR, + + [Description("Sri Lanka")] + LK, + + [Description("Liechtenstein")] + LI, + + [Description("Latvia")] + LV, + + [Description("Tonga")] + TO, + + [Description("Lithuania")] + LT, + + [Description("Luxembourg")] + LU, + + [Description("Liberia")] + LR, + + [Description("Lesotho")] + LS, + + [Description("Thailand")] + TH, + + [Description("French Southern Territories")] + TF, + + [Description("Togo")] + TG, + + [Description("Chad")] + TD, + + [Description("Turks and Caicos Islands")] + TC, + + [Description("Libya")] + LY, + + [Description("Vatican")] + VA, + + [Description("Saint Vincent and the Grenadines")] + VC, + + [Description("United Arab Emirates")] + AE, + + [Description("Andorra")] + AD, + + [Description("Antigua and Barbuda")] + AG, + + [Description("Afghanistan")] + AF, + + [Description("Anguilla")] + AI, + + [Description("U.S. Virgin Islands")] + VI, + + [Description("Iceland")] + IS, + + [Description("Iran")] + IR, + + [Description("Armenia")] + AM, + + [Description("Albania")] + AL, + + [Description("Angola")] + AO, + + [Description("Antarctica")] + AQ, + + [Description("American Samoa")] + AS, + + [Description("Argentina")] + AR, + + [Description("Australia")] + AU, + + [Description("Austria")] + AT, + + [Description("Aruba")] + AW, + + [Description("India")] + IN, + + [Description("Aland Islands")] + AX, + + [Description("Azerbaijan")] + AZ, + + [Description("Ireland")] + IE, + + [Description("Indonesia")] + ID, + + [Description("Ukraine")] + UA, + + [Description("Qatar")] + QA, + + [Description("Mozambique")] + MZ, } } From 00f4c8052e569ba71a819259a0aff47553add330 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 16 Jul 2022 04:06:25 +0300 Subject: [PATCH 2268/2328] Update `APIUser` to provide enum from serialised country code --- .../Online/API/Requests/Responses/APIUser.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIUser.cs b/osu.Game/Online/API/Requests/Responses/APIUser.cs index 63aaa9b90e..1a2a38e789 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUser.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUser.cs @@ -34,8 +34,24 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"previous_usernames")] public string[] PreviousUsernames; + private Country? country; + + public Country Country + { + get => country ??= (Enum.TryParse(userCountry.Code, out Country result) ? result : default); + set => country = value; + } + +#pragma warning disable 649 [JsonProperty(@"country")] - public Country Country; + private UserCountry userCountry; + + private class UserCountry + { + [JsonProperty(@"code")] + public string Code; + } +#pragma warning restore 649 public readonly Bindable Status = new Bindable(); From 1b2b42bb8a7cc2d3b510ef9d45ef075187b832c0 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 16 Jul 2022 04:13:04 +0300 Subject: [PATCH 2269/2328] Update `CountryStatistics` to use `code` for country enum --- osu.Game/Users/CountryStatistics.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/Users/CountryStatistics.cs b/osu.Game/Users/CountryStatistics.cs index e784630d56..eaee13a37b 100644 --- a/osu.Game/Users/CountryStatistics.cs +++ b/osu.Game/Users/CountryStatistics.cs @@ -9,11 +9,8 @@ namespace osu.Game.Users { public class CountryStatistics { - [JsonProperty] - public Country Country; - [JsonProperty(@"code")] - public string FlagName; + public Country Country; [JsonProperty(@"active_users")] public long ActiveUsers; From b2b2a4adafab9d6b1dd1d10675b78a629acd0d49 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 16 Jul 2022 04:06:48 +0300 Subject: [PATCH 2270/2328] Update tournament migration logic to check for null `Country` --- osu.Game.Tournament/Models/TournamentUser.cs | 3 ++- osu.Game.Tournament/TournamentGameBase.cs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Models/TournamentUser.cs b/osu.Game.Tournament/Models/TournamentUser.cs index 80e58538e5..7faf6d1798 100644 --- a/osu.Game.Tournament/Models/TournamentUser.cs +++ b/osu.Game.Tournament/Models/TournamentUser.cs @@ -22,7 +22,8 @@ namespace osu.Game.Tournament.Models /// /// The player's country. /// - public Country? Country { get; set; } + [JsonProperty("country_code")] + public Country Country { get; set; } /// /// The player's global rank, or null if not available. diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index f2a35ea5b3..853ccec83c 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -186,7 +186,9 @@ namespace osu.Game.Tournament { var playersRequiringPopulation = ladder.Teams .SelectMany(t => t.Players) - .Where(p => string.IsNullOrEmpty(p.Username) || p.Rank == null).ToList(); + .Where(p => string.IsNullOrEmpty(p.Username) + || p.Country == default + || p.Rank == null).ToList(); if (playersRequiringPopulation.Count == 0) return false; From e62049f4a94ec526c81eb0ae61d5b02bbd6b083c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 16 Jul 2022 04:40:37 +0300 Subject: [PATCH 2271/2328] Update various usages of `Country` inline with new enum --- .../Visual/Online/TestSceneFriendDisplay.cs | 6 +- .../Online/TestSceneRankingsCountryFilter.cs | 16 +--- .../Visual/Online/TestSceneRankingsHeader.cs | 15 +--- .../Visual/Online/TestSceneRankingsOverlay.cs | 12 +-- .../Visual/Online/TestSceneRankingsTables.cs | 12 ++- .../Visual/Online/TestSceneScoresContainer.cs | 36 ++------- .../Visual/Online/TestSceneUserPanel.cs | 6 +- .../Online/TestSceneUserProfileOverlay.cs | 8 +- .../SongSelect/TestSceneBeatmapLeaderboard.cs | 74 ++++--------------- .../TestSceneUserTopScoreContainer.cs | 18 +---- .../API/Requests/GetUserRankingsRequest.cs | 9 ++- .../Profile/Header/TopHeaderContainer.cs | 5 +- osu.Game/Overlays/Rankings/CountryFilter.cs | 2 +- osu.Game/Overlays/Rankings/CountryPill.cs | 7 +- .../Rankings/Tables/CountriesTable.cs | 5 +- osu.Game/Overlays/RankingsOverlay.cs | 8 +- .../Participants/ParticipantPanel.cs | 2 +- osu.Game/Users/Drawables/DrawableFlag.cs | 6 +- osu.Game/Users/Drawables/UpdateableFlag.cs | 4 +- 19 files changed, 74 insertions(+), 177 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs b/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs index c5c61cdd72..43d41e9fb9 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs @@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual.Online Id = 3103765, IsOnline = true, Statistics = new UserStatistics { GlobalRank = 1111 }, - Country = new Country { FlagName = "JP" }, + Country = Country.JP, CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" }, new APIUser @@ -64,7 +64,7 @@ namespace osu.Game.Tests.Visual.Online Id = 2, IsOnline = false, Statistics = new UserStatistics { GlobalRank = 2222 }, - Country = new Country { FlagName = "AU" }, + Country = Country.AU, CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", IsSupporter = true, SupportLevel = 3, @@ -73,7 +73,7 @@ namespace osu.Game.Tests.Visual.Online { Username = "Evast", Id = 8195163, - Country = new Country { FlagName = "BY" }, + Country = Country.BY, CoverUrl = "https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg", IsOnline = false, LastVisit = DateTimeOffset.Now diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs index e7d799222a..ce0ca0b6c9 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs @@ -56,20 +56,12 @@ namespace osu.Game.Tests.Visual.Online } }); - var country = new Country - { - FlagName = "BY", - FullName = "Belarus" - }; - var unknownCountry = new Country - { - FlagName = "CK", - FullName = "Cook Islands" - }; + const Country country = Country.BY; + const Country unknown_country = Country.CK; AddStep("Set country", () => countryBindable.Value = country); - AddStep("Set null country", () => countryBindable.Value = null); - AddStep("Set country with no flag", () => countryBindable.Value = unknownCountry); + AddStep("Set default country", () => countryBindable.Value = default); + AddStep("Set country with no flag", () => countryBindable.Value = unknown_country); } } } diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs index c8f08d70be..9aedfb0a14 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs @@ -30,21 +30,12 @@ namespace osu.Game.Tests.Visual.Online Ruleset = { BindTarget = ruleset } }); - var country = new Country - { - FlagName = "BY", - FullName = "Belarus" - }; - - var unknownCountry = new Country - { - FlagName = "CK", - FullName = "Cook Islands" - }; + const Country country = Country.BY; + const Country unknown_country = Country.CK; AddStep("Set country", () => countryBindable.Value = country); AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score); - AddStep("Set country with no flag", () => countryBindable.Value = unknownCountry); + AddStep("Set country with no flag", () => countryBindable.Value = unknown_country); } } } diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs index 62dad7b458..ea7eb14c8e 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs @@ -48,15 +48,15 @@ namespace osu.Game.Tests.Visual.Online public void TestFlagScopeDependency() { AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score); - AddAssert("Check country is Null", () => countryBindable.Value == null); - AddStep("Set country", () => countryBindable.Value = us_country); + AddAssert("Check country is default", () => countryBindable.Value == default); + AddStep("Set country", () => countryBindable.Value = Country.US); AddAssert("Check scope is Performance", () => scope.Value == RankingsScope.Performance); } [Test] public void TestShowCountry() { - AddStep("Show US", () => rankingsOverlay.ShowCountry(us_country)); + AddStep("Show US", () => rankingsOverlay.ShowCountry(Country.US)); } private void loadRankingsOverlay() @@ -69,12 +69,6 @@ namespace osu.Game.Tests.Visual.Online }; } - private static readonly Country us_country = new Country - { - FlagName = "US", - FullName = "United States" - }; - private class TestRankingsOverlay : RankingsOverlay { public new Bindable Country => base.Country; diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs index e357b0fffc..f889e3f7dd 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs @@ -57,8 +57,7 @@ namespace osu.Game.Tests.Visual.Online { new CountryStatistics { - Country = new Country { FlagName = "US", FullName = "United States" }, - FlagName = "US", + Country = Country.US, ActiveUsers = 2_972_623, PlayCount = 3_086_515_743, RankedScore = 449_407_643_332_546, @@ -66,8 +65,7 @@ namespace osu.Game.Tests.Visual.Online }, new CountryStatistics { - Country = new Country { FlagName = "RU", FullName = "Russian Federation" }, - FlagName = "RU", + Country = Country.RU, ActiveUsers = 1_609_989, PlayCount = 1_637_052_841, RankedScore = 221_660_827_473_004, @@ -86,7 +84,7 @@ namespace osu.Game.Tests.Visual.Online User = new APIUser { Username = "first active user", - Country = new Country { FlagName = "JP" }, + Country = Country.JP, Active = true, }, Accuracy = 0.9972, @@ -106,7 +104,7 @@ namespace osu.Game.Tests.Visual.Online User = new APIUser { Username = "inactive user", - Country = new Country { FlagName = "AU" }, + Country = Country.AU, Active = false, }, Accuracy = 0.9831, @@ -126,7 +124,7 @@ namespace osu.Game.Tests.Visual.Online User = new APIUser { Username = "second active user", - Country = new Country { FlagName = "PL" }, + Country = Country.PL, Active = true, }, Accuracy = 0.9584, diff --git a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs index 6ef87f762c..6ac3d5cb86 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs @@ -157,11 +157,7 @@ namespace osu.Game.Tests.Visual.Online { Id = 6602580, Username = @"waaiiru", - Country = new Country - { - FullName = @"Spain", - FlagName = @"ES", - }, + Country = Country.ES, }, Mods = new[] { @@ -184,11 +180,7 @@ namespace osu.Game.Tests.Visual.Online { Id = 4608074, Username = @"Skycries", - Country = new Country - { - FullName = @"Brazil", - FlagName = @"BR", - }, + Country = Country.BR, }, Mods = new[] { @@ -210,11 +202,7 @@ namespace osu.Game.Tests.Visual.Online { Id = 1014222, Username = @"eLy", - Country = new Country - { - FullName = @"Japan", - FlagName = @"JP", - }, + Country = Country.JP, }, Mods = new[] { @@ -235,11 +223,7 @@ namespace osu.Game.Tests.Visual.Online { Id = 1541390, Username = @"Toukai", - Country = new Country - { - FullName = @"Canada", - FlagName = @"CA", - }, + Country = Country.CA, }, Mods = new[] { @@ -259,11 +243,7 @@ namespace osu.Game.Tests.Visual.Online { Id = 7151382, Username = @"Mayuri Hana", - Country = new Country - { - FullName = @"Thailand", - FlagName = @"TH", - }, + Country = Country.TH, }, Rank = ScoreRank.D, PP = 160, @@ -302,11 +282,7 @@ namespace osu.Game.Tests.Visual.Online { Id = 7151382, Username = @"Mayuri Hana", - Country = new Country - { - FullName = @"Thailand", - FlagName = @"TH", - }, + Country = Country.TH, }, Rank = ScoreRank.D, PP = 160, diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs index fff40b3c74..addcf799e3 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs @@ -60,7 +60,7 @@ namespace osu.Game.Tests.Visual.Online { Username = @"flyte", Id = 3103765, - Country = new Country { FlagName = @"JP" }, + Country = Country.JP, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg", Status = { Value = new UserStatusOnline() } }) { Width = 300 }, @@ -68,7 +68,7 @@ namespace osu.Game.Tests.Visual.Online { Username = @"peppy", Id = 2, - Country = new Country { FlagName = @"AU" }, + Country = Country.AU, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", IsSupporter = true, SupportLevel = 3, @@ -77,7 +77,7 @@ namespace osu.Game.Tests.Visual.Online { Username = @"Evast", Id = 8195163, - Country = new Country { FlagName = @"BY" }, + Country = Country.BY, CoverUrl = @"https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg", IsOnline = false, LastVisit = DateTimeOffset.Now diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs index ad3215b1ef..dd6b022624 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Online { Username = @"Somebody", Id = 1, - Country = new Country { FullName = @"Alien" }, + Country = Country.XX, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg", JoinDate = DateTimeOffset.Now.AddDays(-1), LastVisit = DateTimeOffset.Now, @@ -82,7 +82,7 @@ namespace osu.Game.Tests.Visual.Online Username = @"peppy", Id = 2, IsSupporter = true, - Country = new Country { FullName = @"Australia", FlagName = @"AU" }, + Country = Country.AU, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg" })); @@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual.Online { Username = @"flyte", Id = 3103765, - Country = new Country { FullName = @"Japan", FlagName = @"JP" }, + Country = Country.JP, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" })); @@ -99,7 +99,7 @@ namespace osu.Game.Tests.Visual.Online Username = @"BanchoBot", Id = 3, IsBot = true, - Country = new Country { FullName = @"Saint Helena", FlagName = @"SH" }, + Country = Country.SH, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c4.jpg" })); diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs index ef0c7d7d4d..48fdf671f1 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs @@ -140,11 +140,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 6602580, Username = @"waaiiru", - Country = new Country - { - FullName = @"Spain", - FlagName = @"ES", - }, + Country = Country.ES, }, }); } @@ -164,12 +160,8 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 6602580, Username = @"waaiiru", - Country = new Country - { - FullName = @"Spain", - FlagName = @"ES", - }, - }, + Country = Country.ES, + } }); } @@ -225,11 +217,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 6602580, Username = @"waaiiru", - Country = new Country - { - FullName = @"Spain", - FlagName = @"ES", - }, + Country = Country.ES, }, }, new ScoreInfo @@ -246,11 +234,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 4608074, Username = @"Skycries", - Country = new Country - { - FullName = @"Brazil", - FlagName = @"BR", - }, + Country = Country.BR, }, }, new ScoreInfo @@ -268,11 +252,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 1014222, Username = @"eLy", - Country = new Country - { - FullName = @"Japan", - FlagName = @"JP", - }, + Country = Country.JP, }, }, new ScoreInfo @@ -290,11 +270,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 1541390, Username = @"Toukai", - Country = new Country - { - FullName = @"Canada", - FlagName = @"CA", - }, + Country = Country.CA, }, }, new ScoreInfo @@ -312,11 +288,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 2243452, Username = @"Satoruu", - Country = new Country - { - FullName = @"Venezuela", - FlagName = @"VE", - }, + Country = Country.VE, }, }, new ScoreInfo @@ -334,11 +306,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 2705430, Username = @"Mooha", - Country = new Country - { - FullName = @"France", - FlagName = @"FR", - }, + Country = Country.FR, }, }, new ScoreInfo @@ -356,11 +324,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 7151382, Username = @"Mayuri Hana", - Country = new Country - { - FullName = @"Thailand", - FlagName = @"TH", - }, + Country = Country.TH, }, }, new ScoreInfo @@ -378,11 +342,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 2051389, Username = @"FunOrange", - Country = new Country - { - FullName = @"Canada", - FlagName = @"CA", - }, + Country = Country.CA, }, }, new ScoreInfo @@ -400,11 +360,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 6169483, Username = @"-Hebel-", - Country = new Country - { - FullName = @"Mexico", - FlagName = @"MX", - }, + Country = Country.MX, }, }, new ScoreInfo @@ -422,11 +378,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 6702666, Username = @"prhtnsm", - Country = new Country - { - FullName = @"Germany", - FlagName = @"DE", - }, + Country = Country.DE, }, }, }; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs index 16966e489a..5356e74eae 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs @@ -69,11 +69,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 6602580, Username = @"waaiiru", - Country = new Country - { - FullName = @"Spain", - FlagName = @"ES", - }, + Country = Country.ES, }, }, new ScoreInfo @@ -88,11 +84,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 4608074, Username = @"Skycries", - Country = new Country - { - FullName = @"Brazil", - FlagName = @"BR", - }, + Country = Country.BR, }, }, new ScoreInfo @@ -107,11 +99,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 1541390, Username = @"Toukai", - Country = new Country - { - FullName = @"Canada", - FlagName = @"CA", - }, + Country = Country.CA, }, } }; diff --git a/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs b/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs index ab0cc3a56d..75088675bd 100644 --- a/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs @@ -5,6 +5,7 @@ using osu.Framework.IO.Network; using osu.Game.Rulesets; +using osu.Game.Users; namespace osu.Game.Online.API.Requests { @@ -12,9 +13,9 @@ namespace osu.Game.Online.API.Requests { public readonly UserRankingsType Type; - private readonly string country; + private readonly Country country; - public GetUserRankingsRequest(RulesetInfo ruleset, UserRankingsType type = UserRankingsType.Performance, int page = 1, string country = null) + public GetUserRankingsRequest(RulesetInfo ruleset, UserRankingsType type = UserRankingsType.Performance, int page = 1, Country country = default) : base(ruleset, page) { Type = type; @@ -25,8 +26,8 @@ namespace osu.Game.Online.API.Requests { var req = base.CreateWebRequest(); - if (country != null) - req.AddParameter("country", country); + if (country != default) + req.AddParameter("country", country.ToString()); return req; } diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index 9c957e387a..818a84b9aa 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; @@ -174,8 +175,8 @@ namespace osu.Game.Overlays.Profile.Header avatar.User = user; usernameText.Text = user?.Username ?? string.Empty; openUserExternally.Link = $@"{api.WebsiteRootUrl}/users/{user?.Id ?? 0}"; - userFlag.Country = user?.Country; - userCountryText.Text = user?.Country?.FullName ?? "Alien"; + userFlag.Country = user?.Country ?? default; + userCountryText.Text = (user?.Country ?? default).GetDescription(); supporterTag.SupportLevel = user?.SupportLevel ?? 0; titleText.Text = user?.Title ?? string.Empty; titleText.Colour = Color4Extensions.FromHex(user?.Colour ?? "fff"); diff --git a/osu.Game/Overlays/Rankings/CountryFilter.cs b/osu.Game/Overlays/Rankings/CountryFilter.cs index 9ba2018522..469d92a771 100644 --- a/osu.Game/Overlays/Rankings/CountryFilter.cs +++ b/osu.Game/Overlays/Rankings/CountryFilter.cs @@ -91,7 +91,7 @@ namespace osu.Game.Overlays.Rankings private void onCountryChanged(ValueChangedEvent country) { - if (country.NewValue == null) + if (country.NewValue == default) { countryPill.Collapse(); this.ResizeHeightTo(0, duration, Easing.OutQuint); diff --git a/osu.Game/Overlays/Rankings/CountryPill.cs b/osu.Game/Overlays/Rankings/CountryPill.cs index 90f8c85557..96d677611e 100644 --- a/osu.Game/Overlays/Rankings/CountryPill.cs +++ b/osu.Game/Overlays/Rankings/CountryPill.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -93,7 +94,7 @@ namespace osu.Game.Overlays.Rankings { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Action = () => Current.Value = null + Action = Current.SetDefault, } } } @@ -132,11 +133,11 @@ namespace osu.Game.Overlays.Rankings private void onCountryChanged(ValueChangedEvent country) { - if (country.NewValue == null) + if (country.NewValue == default) return; flag.Country = country.NewValue; - countryName.Text = country.NewValue.FullName; + countryName.Text = country.NewValue.GetDescription(); } private class CloseButton : OsuHoverContainer diff --git a/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs b/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs index 53d10b3e53..27d4a6b6d3 100644 --- a/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs @@ -11,6 +11,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using System.Collections.Generic; using osu.Framework.Allocation; +using osu.Framework.Extensions; using osu.Framework.Extensions.LocalisationExtensions; using osu.Game.Resources.Localisation.Web; @@ -77,8 +78,8 @@ namespace osu.Game.Overlays.Rankings.Tables RelativeSizeAxes = Axes.Y; TextAnchor = Anchor.CentreLeft; - if (!string.IsNullOrEmpty(country.FullName)) - AddLink(country.FullName, () => rankings?.ShowCountry(country)); + if (country != default) + AddLink(country.GetDescription(), () => rankings?.ShowCountry(country)); } } } diff --git a/osu.Game/Overlays/RankingsOverlay.cs b/osu.Game/Overlays/RankingsOverlay.cs index a66b8cf2ba..9894df1c9d 100644 --- a/osu.Game/Overlays/RankingsOverlay.cs +++ b/osu.Game/Overlays/RankingsOverlay.cs @@ -44,7 +44,7 @@ namespace osu.Game.Overlays Country.BindValueChanged(_ => { // if a country is requested, force performance scope. - if (Country.Value != null) + if (!Country.IsDefault) Header.Current.Value = RankingsScope.Performance; Scheduler.AddOnce(triggerTabChanged); @@ -76,7 +76,7 @@ namespace osu.Game.Overlays { // country filtering is only valid for performance scope. if (Header.Current.Value != RankingsScope.Performance) - Country.Value = null; + Country.SetDefault(); Scheduler.AddOnce(triggerTabChanged); } @@ -87,7 +87,7 @@ namespace osu.Game.Overlays public void ShowCountry(Country requested) { - if (requested == null) + if (requested == default) return; Show(); @@ -128,7 +128,7 @@ namespace osu.Game.Overlays switch (Header.Current.Value) { case RankingsScope.Performance: - return new GetUserRankingsRequest(ruleset.Value, country: Country.Value?.FlagName); + return new GetUserRankingsRequest(ruleset.Value, country: Country.Value); case RankingsScope.Country: return new GetCountryRankingsRequest(ruleset.Value); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs index f632951f41..652a832689 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs @@ -128,7 +128,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Size = new Vector2(28, 20), - Country = user?.Country + Country = user?.Country ?? default }, new OsuSpriteText { diff --git a/osu.Game/Users/Drawables/DrawableFlag.cs b/osu.Game/Users/Drawables/DrawableFlag.cs index e5ac8fa257..84b56a8d16 100644 --- a/osu.Game/Users/Drawables/DrawableFlag.cs +++ b/osu.Game/Users/Drawables/DrawableFlag.cs @@ -5,6 +5,7 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Extensions; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; @@ -16,7 +17,7 @@ namespace osu.Game.Users.Drawables { private readonly Country country; - public LocalisableString TooltipText => country?.FullName; + public LocalisableString TooltipText => country == default ? string.Empty : country.GetDescription(); public DrawableFlag(Country country) { @@ -29,7 +30,8 @@ namespace osu.Game.Users.Drawables if (ts == null) throw new ArgumentNullException(nameof(ts)); - Texture = ts.Get($@"Flags/{country?.FlagName ?? @"__"}") ?? ts.Get(@"Flags/__"); + string textureName = country == default ? "__" : country.ToString(); + Texture = ts.Get($@"Flags/{textureName}") ?? ts.Get(@"Flags/__"); } } } diff --git a/osu.Game/Users/Drawables/UpdateableFlag.cs b/osu.Game/Users/Drawables/UpdateableFlag.cs index fd59bf305d..2f08f1c787 100644 --- a/osu.Game/Users/Drawables/UpdateableFlag.cs +++ b/osu.Game/Users/Drawables/UpdateableFlag.cs @@ -32,14 +32,14 @@ namespace osu.Game.Users.Drawables /// public Action Action; - public UpdateableFlag(Country country = null) + public UpdateableFlag(Country country = default) { Country = country; } protected override Drawable CreateDrawable(Country country) { - if (country == null && !ShowPlaceholderOnNull) + if (country == default && !ShowPlaceholderOnNull) return null; return new Container From 08f1280aa8df25140ef4b189fe39b146b94a3e64 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 16 Jul 2022 04:42:33 +0300 Subject: [PATCH 2272/2328] Add `UsedImplicitly` specification to silence unused member inspection Also applied to `Language` while at it. --- osu.Game/Localisation/Language.cs | 2 ++ osu.Game/Users/Country.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/osu.Game/Localisation/Language.cs b/osu.Game/Localisation/Language.cs index c13a1a10cb..6a4e5110e6 100644 --- a/osu.Game/Localisation/Language.cs +++ b/osu.Game/Localisation/Language.cs @@ -2,9 +2,11 @@ // See the LICENCE file in the repository root for full licence text. using System.ComponentModel; +using JetBrains.Annotations; namespace osu.Game.Localisation { + [UsedImplicitly(ImplicitUseTargetFlags.WithMembers)] public enum Language { [Description(@"English")] diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index d1f33627c1..e96b96e57c 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -9,6 +9,7 @@ using Newtonsoft.Json.Converters; namespace osu.Game.Users { [JsonConverter(typeof(StringEnumConverter))] + [UsedImplicitly(ImplicitUseTargetFlags.WithMembers)] public enum Country { [Description("Alien")] From 7c6f4b798bc66d5936e689ab6d7b4d26005db91a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 16 Jul 2022 05:16:59 +0300 Subject: [PATCH 2273/2328] Replace `countries.json` with country enum and acronym extension --- osu.Game.Tournament/CountryExtensions.cs | 770 ++++++++++ osu.Game.Tournament/Resources/countries.json | 1252 ----------------- .../Screens/Editors/TeamEditorScreen.cs | 18 +- 3 files changed, 782 insertions(+), 1258 deletions(-) create mode 100644 osu.Game.Tournament/CountryExtensions.cs delete mode 100644 osu.Game.Tournament/Resources/countries.json diff --git a/osu.Game.Tournament/CountryExtensions.cs b/osu.Game.Tournament/CountryExtensions.cs new file mode 100644 index 0000000000..180c7a96af --- /dev/null +++ b/osu.Game.Tournament/CountryExtensions.cs @@ -0,0 +1,770 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Game.Users; + +namespace osu.Game.Tournament +{ + public static class CountryExtensions + { + public static string GetAcronym(this Country country) + { + switch (country) + { + case Country.BD: + return "BGD"; + + case Country.BE: + return "BEL"; + + case Country.BF: + return "BFA"; + + case Country.BG: + return "BGR"; + + case Country.BA: + return "BIH"; + + case Country.BB: + return "BRB"; + + case Country.WF: + return "WLF"; + + case Country.BL: + return "BLM"; + + case Country.BM: + return "BMU"; + + case Country.BN: + return "BRN"; + + case Country.BO: + return "BOL"; + + case Country.BH: + return "BHR"; + + case Country.BI: + return "BDI"; + + case Country.BJ: + return "BEN"; + + case Country.BT: + return "BTN"; + + case Country.JM: + return "JAM"; + + case Country.BV: + return "BVT"; + + case Country.BW: + return "BWA"; + + case Country.WS: + return "WSM"; + + case Country.BQ: + return "BES"; + + case Country.BR: + return "BRA"; + + case Country.BS: + return "BHS"; + + case Country.JE: + return "JEY"; + + case Country.BY: + return "BLR"; + + case Country.BZ: + return "BLZ"; + + case Country.RU: + return "RUS"; + + case Country.RW: + return "RWA"; + + case Country.RS: + return "SRB"; + + case Country.TL: + return "TLS"; + + case Country.RE: + return "REU"; + + case Country.TM: + return "TKM"; + + case Country.TJ: + return "TJK"; + + case Country.RO: + return "ROU"; + + case Country.TK: + return "TKL"; + + case Country.GW: + return "GNB"; + + case Country.GU: + return "GUM"; + + case Country.GT: + return "GTM"; + + case Country.GS: + return "SGS"; + + case Country.GR: + return "GRC"; + + case Country.GQ: + return "GNQ"; + + case Country.GP: + return "GLP"; + + case Country.JP: + return "JPN"; + + case Country.GY: + return "GUY"; + + case Country.GG: + return "GGY"; + + case Country.GF: + return "GUF"; + + case Country.GE: + return "GEO"; + + case Country.GD: + return "GRD"; + + case Country.GB: + return "GBR"; + + case Country.GA: + return "GAB"; + + case Country.SV: + return "SLV"; + + case Country.GN: + return "GIN"; + + case Country.GM: + return "GMB"; + + case Country.GL: + return "GRL"; + + case Country.GI: + return "GIB"; + + case Country.GH: + return "GHA"; + + case Country.OM: + return "OMN"; + + case Country.TN: + return "TUN"; + + case Country.JO: + return "JOR"; + + case Country.HR: + return "HRV"; + + case Country.HT: + return "HTI"; + + case Country.HU: + return "HUN"; + + case Country.HK: + return "HKG"; + + case Country.HN: + return "HND"; + + case Country.HM: + return "HMD"; + + case Country.VE: + return "VEN"; + + case Country.PR: + return "PRI"; + + case Country.PS: + return "PSE"; + + case Country.PW: + return "PLW"; + + case Country.PT: + return "PRT"; + + case Country.SJ: + return "SJM"; + + case Country.PY: + return "PRY"; + + case Country.IQ: + return "IRQ"; + + case Country.PA: + return "PAN"; + + case Country.PF: + return "PYF"; + + case Country.PG: + return "PNG"; + + case Country.PE: + return "PER"; + + case Country.PK: + return "PAK"; + + case Country.PH: + return "PHL"; + + case Country.PN: + return "PCN"; + + case Country.PL: + return "POL"; + + case Country.PM: + return "SPM"; + + case Country.ZM: + return "ZMB"; + + case Country.EH: + return "ESH"; + + case Country.EE: + return "EST"; + + case Country.EG: + return "EGY"; + + case Country.ZA: + return "ZAF"; + + case Country.EC: + return "ECU"; + + case Country.IT: + return "ITA"; + + case Country.VN: + return "VNM"; + + case Country.SB: + return "SLB"; + + case Country.ET: + return "ETH"; + + case Country.SO: + return "SOM"; + + case Country.ZW: + return "ZWE"; + + case Country.SA: + return "SAU"; + + case Country.ES: + return "ESP"; + + case Country.ER: + return "ERI"; + + case Country.ME: + return "MNE"; + + case Country.MD: + return "MDA"; + + case Country.MG: + return "MDG"; + + case Country.MF: + return "MAF"; + + case Country.MA: + return "MAR"; + + case Country.MC: + return "MCO"; + + case Country.UZ: + return "UZB"; + + case Country.MM: + return "MMR"; + + case Country.ML: + return "MLI"; + + case Country.MO: + return "MAC"; + + case Country.MN: + return "MNG"; + + case Country.MH: + return "MHL"; + + case Country.MK: + return "MKD"; + + case Country.MU: + return "MUS"; + + case Country.MT: + return "MLT"; + + case Country.MW: + return "MWI"; + + case Country.MV: + return "MDV"; + + case Country.MQ: + return "MTQ"; + + case Country.MP: + return "MNP"; + + case Country.MS: + return "MSR"; + + case Country.MR: + return "MRT"; + + case Country.IM: + return "IMN"; + + case Country.UG: + return "UGA"; + + case Country.TZ: + return "TZA"; + + case Country.MY: + return "MYS"; + + case Country.MX: + return "MEX"; + + case Country.IL: + return "ISR"; + + case Country.FR: + return "FRA"; + + case Country.IO: + return "IOT"; + + case Country.SH: + return "SHN"; + + case Country.FI: + return "FIN"; + + case Country.FJ: + return "FJI"; + + case Country.FK: + return "FLK"; + + case Country.FM: + return "FSM"; + + case Country.FO: + return "FRO"; + + case Country.NI: + return "NIC"; + + case Country.NL: + return "NLD"; + + case Country.NO: + return "NOR"; + + case Country.NA: + return "NAM"; + + case Country.VU: + return "VUT"; + + case Country.NC: + return "NCL"; + + case Country.NE: + return "NER"; + + case Country.NF: + return "NFK"; + + case Country.NG: + return "NGA"; + + case Country.NZ: + return "NZL"; + + case Country.NP: + return "NPL"; + + case Country.NR: + return "NRU"; + + case Country.NU: + return "NIU"; + + case Country.CK: + return "COK"; + + case Country.XK: + return "XKX"; + + case Country.CI: + return "CIV"; + + case Country.CH: + return "CHE"; + + case Country.CO: + return "COL"; + + case Country.CN: + return "CHN"; + + case Country.CM: + return "CMR"; + + case Country.CL: + return "CHL"; + + case Country.CC: + return "CCK"; + + case Country.CA: + return "CAN"; + + case Country.CG: + return "COG"; + + case Country.CF: + return "CAF"; + + case Country.CD: + return "COD"; + + case Country.CZ: + return "CZE"; + + case Country.CY: + return "CYP"; + + case Country.CX: + return "CXR"; + + case Country.CR: + return "CRI"; + + case Country.CW: + return "CUW"; + + case Country.CV: + return "CPV"; + + case Country.CU: + return "CUB"; + + case Country.SZ: + return "SWZ"; + + case Country.SY: + return "SYR"; + + case Country.SX: + return "SXM"; + + case Country.KG: + return "KGZ"; + + case Country.KE: + return "KEN"; + + case Country.SS: + return "SSD"; + + case Country.SR: + return "SUR"; + + case Country.KI: + return "KIR"; + + case Country.KH: + return "KHM"; + + case Country.KN: + return "KNA"; + + case Country.KM: + return "COM"; + + case Country.ST: + return "STP"; + + case Country.SK: + return "SVK"; + + case Country.KR: + return "KOR"; + + case Country.SI: + return "SVN"; + + case Country.KP: + return "PRK"; + + case Country.KW: + return "KWT"; + + case Country.SN: + return "SEN"; + + case Country.SM: + return "SMR"; + + case Country.SL: + return "SLE"; + + case Country.SC: + return "SYC"; + + case Country.KZ: + return "KAZ"; + + case Country.KY: + return "CYM"; + + case Country.SG: + return "SGP"; + + case Country.SE: + return "SWE"; + + case Country.SD: + return "SDN"; + + case Country.DO: + return "DOM"; + + case Country.DM: + return "DMA"; + + case Country.DJ: + return "DJI"; + + case Country.DK: + return "DNK"; + + case Country.VG: + return "VGB"; + + case Country.DE: + return "DEU"; + + case Country.YE: + return "YEM"; + + case Country.DZ: + return "DZA"; + + case Country.US: + return "USA"; + + case Country.UY: + return "URY"; + + case Country.YT: + return "MYT"; + + case Country.UM: + return "UMI"; + + case Country.LB: + return "LBN"; + + case Country.LC: + return "LCA"; + + case Country.LA: + return "LAO"; + + case Country.TV: + return "TUV"; + + case Country.TW: + return "TWN"; + + case Country.TT: + return "TTO"; + + case Country.TR: + return "TUR"; + + case Country.LK: + return "LKA"; + + case Country.LI: + return "LIE"; + + case Country.LV: + return "LVA"; + + case Country.TO: + return "TON"; + + case Country.LT: + return "LTU"; + + case Country.LU: + return "LUX"; + + case Country.LR: + return "LBR"; + + case Country.LS: + return "LSO"; + + case Country.TH: + return "THA"; + + case Country.TF: + return "ATF"; + + case Country.TG: + return "TGO"; + + case Country.TD: + return "TCD"; + + case Country.TC: + return "TCA"; + + case Country.LY: + return "LBY"; + + case Country.VA: + return "VAT"; + + case Country.VC: + return "VCT"; + + case Country.AE: + return "ARE"; + + case Country.AD: + return "AND"; + + case Country.AG: + return "ATG"; + + case Country.AF: + return "AFG"; + + case Country.AI: + return "AIA"; + + case Country.VI: + return "VIR"; + + case Country.IS: + return "ISL"; + + case Country.IR: + return "IRN"; + + case Country.AM: + return "ARM"; + + case Country.AL: + return "ALB"; + + case Country.AO: + return "AGO"; + + case Country.AQ: + return "ATA"; + + case Country.AS: + return "ASM"; + + case Country.AR: + return "ARG"; + + case Country.AU: + return "AUS"; + + case Country.AT: + return "AUT"; + + case Country.AW: + return "ABW"; + + case Country.IN: + return "IND"; + + case Country.AX: + return "ALA"; + + case Country.AZ: + return "AZE"; + + case Country.IE: + return "IRL"; + + case Country.ID: + return "IDN"; + + case Country.UA: + return "UKR"; + + case Country.QA: + return "QAT"; + + case Country.MZ: + return "MOZ"; + + default: + throw new ArgumentOutOfRangeException(nameof(country)); + } + } + } +} diff --git a/osu.Game.Tournament/Resources/countries.json b/osu.Game.Tournament/Resources/countries.json deleted file mode 100644 index 7306a8bec5..0000000000 --- a/osu.Game.Tournament/Resources/countries.json +++ /dev/null @@ -1,1252 +0,0 @@ -[ - { - "FlagName": "BD", - "FullName": "Bangladesh", - "Acronym": "BGD" - }, - { - "FlagName": "BE", - "FullName": "Belgium", - "Acronym": "BEL" - }, - { - "FlagName": "BF", - "FullName": "Burkina Faso", - "Acronym": "BFA" - }, - { - "FlagName": "BG", - "FullName": "Bulgaria", - "Acronym": "BGR" - }, - { - "FlagName": "BA", - "FullName": "Bosnia and Herzegovina", - "Acronym": "BIH" - }, - { - "FlagName": "BB", - "FullName": "Barbados", - "Acronym": "BRB" - }, - { - "FlagName": "WF", - "FullName": "Wallis and Futuna", - "Acronym": "WLF" - }, - { - "FlagName": "BL", - "FullName": "Saint Barthelemy", - "Acronym": "BLM" - }, - { - "FlagName": "BM", - "FullName": "Bermuda", - "Acronym": "BMU" - }, - { - "FlagName": "BN", - "FullName": "Brunei", - "Acronym": "BRN" - }, - { - "FlagName": "BO", - "FullName": "Bolivia", - "Acronym": "BOL" - }, - { - "FlagName": "BH", - "FullName": "Bahrain", - "Acronym": "BHR" - }, - { - "FlagName": "BI", - "FullName": "Burundi", - "Acronym": "BDI" - }, - { - "FlagName": "BJ", - "FullName": "Benin", - "Acronym": "BEN" - }, - { - "FlagName": "BT", - "FullName": "Bhutan", - "Acronym": "BTN" - }, - { - "FlagName": "JM", - "FullName": "Jamaica", - "Acronym": "JAM" - }, - { - "FlagName": "BV", - "FullName": "Bouvet Island", - "Acronym": "BVT" - }, - { - "FlagName": "BW", - "FullName": "Botswana", - "Acronym": "BWA" - }, - { - "FlagName": "WS", - "FullName": "Samoa", - "Acronym": "WSM" - }, - { - "FlagName": "BQ", - "FullName": "Bonaire, Saint Eustatius and Saba", - "Acronym": "BES" - }, - { - "FlagName": "BR", - "FullName": "Brazil", - "Acronym": "BRA" - }, - { - "FlagName": "BS", - "FullName": "Bahamas", - "Acronym": "BHS" - }, - { - "FlagName": "JE", - "FullName": "Jersey", - "Acronym": "JEY" - }, - { - "FlagName": "BY", - "FullName": "Belarus", - "Acronym": "BLR" - }, - { - "FlagName": "BZ", - "FullName": "Belize", - "Acronym": "BLZ" - }, - { - "FlagName": "RU", - "FullName": "Russia", - "Acronym": "RUS" - }, - { - "FlagName": "RW", - "FullName": "Rwanda", - "Acronym": "RWA" - }, - { - "FlagName": "RS", - "FullName": "Serbia", - "Acronym": "SRB" - }, - { - "FlagName": "TL", - "FullName": "East Timor", - "Acronym": "TLS" - }, - { - "FlagName": "RE", - "FullName": "Reunion", - "Acronym": "REU" - }, - { - "FlagName": "TM", - "FullName": "Turkmenistan", - "Acronym": "TKM" - }, - { - "FlagName": "TJ", - "FullName": "Tajikistan", - "Acronym": "TJK" - }, - { - "FlagName": "RO", - "FullName": "Romania", - "Acronym": "ROU" - }, - { - "FlagName": "TK", - "FullName": "Tokelau", - "Acronym": "TKL" - }, - { - "FlagName": "GW", - "FullName": "Guinea-Bissau", - "Acronym": "GNB" - }, - { - "FlagName": "GU", - "FullName": "Guam", - "Acronym": "GUM" - }, - { - "FlagName": "GT", - "FullName": "Guatemala", - "Acronym": "GTM" - }, - { - "FlagName": "GS", - "FullName": "South Georgia and the South Sandwich Islands", - "Acronym": "SGS" - }, - { - "FlagName": "GR", - "FullName": "Greece", - "Acronym": "GRC" - }, - { - "FlagName": "GQ", - "FullName": "Equatorial Guinea", - "Acronym": "GNQ" - }, - { - "FlagName": "GP", - "FullName": "Guadeloupe", - "Acronym": "GLP" - }, - { - "FlagName": "JP", - "FullName": "Japan", - "Acronym": "JPN" - }, - { - "FlagName": "GY", - "FullName": "Guyana", - "Acronym": "GUY" - }, - { - "FlagName": "GG", - "FullName": "Guernsey", - "Acronym": "GGY" - }, - { - "FlagName": "GF", - "FullName": "French Guiana", - "Acronym": "GUF" - }, - { - "FlagName": "GE", - "FullName": "Georgia", - "Acronym": "GEO" - }, - { - "FlagName": "GD", - "FullName": "Grenada", - "Acronym": "GRD" - }, - { - "FlagName": "GB", - "FullName": "United Kingdom", - "Acronym": "GBR" - }, - { - "FlagName": "GA", - "FullName": "Gabon", - "Acronym": "GAB" - }, - { - "FlagName": "SV", - "FullName": "El Salvador", - "Acronym": "SLV" - }, - { - "FlagName": "GN", - "FullName": "Guinea", - "Acronym": "GIN" - }, - { - "FlagName": "GM", - "FullName": "Gambia", - "Acronym": "GMB" - }, - { - "FlagName": "GL", - "FullName": "Greenland", - "Acronym": "GRL" - }, - { - "FlagName": "GI", - "FullName": "Gibraltar", - "Acronym": "GIB" - }, - { - "FlagName": "GH", - "FullName": "Ghana", - "Acronym": "GHA" - }, - { - "FlagName": "OM", - "FullName": "Oman", - "Acronym": "OMN" - }, - { - "FlagName": "TN", - "FullName": "Tunisia", - "Acronym": "TUN" - }, - { - "FlagName": "JO", - "FullName": "Jordan", - "Acronym": "JOR" - }, - { - "FlagName": "HR", - "FullName": "Croatia", - "Acronym": "HRV" - }, - { - "FlagName": "HT", - "FullName": "Haiti", - "Acronym": "HTI" - }, - { - "FlagName": "HU", - "FullName": "Hungary", - "Acronym": "HUN" - }, - { - "FlagName": "HK", - "FullName": "Hong Kong", - "Acronym": "HKG" - }, - { - "FlagName": "HN", - "FullName": "Honduras", - "Acronym": "HND" - }, - { - "FlagName": "HM", - "FullName": "Heard Island and McDonald Islands", - "Acronym": "HMD" - }, - { - "FlagName": "VE", - "FullName": "Venezuela", - "Acronym": "VEN" - }, - { - "FlagName": "PR", - "FullName": "Puerto Rico", - "Acronym": "PRI" - }, - { - "FlagName": "PS", - "FullName": "Palestinian Territory", - "Acronym": "PSE" - }, - { - "FlagName": "PW", - "FullName": "Palau", - "Acronym": "PLW" - }, - { - "FlagName": "PT", - "FullName": "Portugal", - "Acronym": "PRT" - }, - { - "FlagName": "SJ", - "FullName": "Svalbard and Jan Mayen", - "Acronym": "SJM" - }, - { - "FlagName": "PY", - "FullName": "Paraguay", - "Acronym": "PRY" - }, - { - "FlagName": "IQ", - "FullName": "Iraq", - "Acronym": "IRQ" - }, - { - "FlagName": "PA", - "FullName": "Panama", - "Acronym": "PAN" - }, - { - "FlagName": "PF", - "FullName": "French Polynesia", - "Acronym": "PYF" - }, - { - "FlagName": "PG", - "FullName": "Papua New Guinea", - "Acronym": "PNG" - }, - { - "FlagName": "PE", - "FullName": "Peru", - "Acronym": "PER" - }, - { - "FlagName": "PK", - "FullName": "Pakistan", - "Acronym": "PAK" - }, - { - "FlagName": "PH", - "FullName": "Philippines", - "Acronym": "PHL" - }, - { - "FlagName": "PN", - "FullName": "Pitcairn", - "Acronym": "PCN" - }, - { - "FlagName": "PL", - "FullName": "Poland", - "Acronym": "POL" - }, - { - "FlagName": "PM", - "FullName": "Saint Pierre and Miquelon", - "Acronym": "SPM" - }, - { - "FlagName": "ZM", - "FullName": "Zambia", - "Acronym": "ZMB" - }, - { - "FlagName": "EH", - "FullName": "Western Sahara", - "Acronym": "ESH" - }, - { - "FlagName": "EE", - "FullName": "Estonia", - "Acronym": "EST" - }, - { - "FlagName": "EG", - "FullName": "Egypt", - "Acronym": "EGY" - }, - { - "FlagName": "ZA", - "FullName": "South Africa", - "Acronym": "ZAF" - }, - { - "FlagName": "EC", - "FullName": "Ecuador", - "Acronym": "ECU" - }, - { - "FlagName": "IT", - "FullName": "Italy", - "Acronym": "ITA" - }, - { - "FlagName": "VN", - "FullName": "Vietnam", - "Acronym": "VNM" - }, - { - "FlagName": "SB", - "FullName": "Solomon Islands", - "Acronym": "SLB" - }, - { - "FlagName": "ET", - "FullName": "Ethiopia", - "Acronym": "ETH" - }, - { - "FlagName": "SO", - "FullName": "Somalia", - "Acronym": "SOM" - }, - { - "FlagName": "ZW", - "FullName": "Zimbabwe", - "Acronym": "ZWE" - }, - { - "FlagName": "SA", - "FullName": "Saudi Arabia", - "Acronym": "SAU" - }, - { - "FlagName": "ES", - "FullName": "Spain", - "Acronym": "ESP" - }, - { - "FlagName": "ER", - "FullName": "Eritrea", - "Acronym": "ERI" - }, - { - "FlagName": "ME", - "FullName": "Montenegro", - "Acronym": "MNE" - }, - { - "FlagName": "MD", - "FullName": "Moldova", - "Acronym": "MDA" - }, - { - "FlagName": "MG", - "FullName": "Madagascar", - "Acronym": "MDG" - }, - { - "FlagName": "MF", - "FullName": "Saint Martin", - "Acronym": "MAF" - }, - { - "FlagName": "MA", - "FullName": "Morocco", - "Acronym": "MAR" - }, - { - "FlagName": "MC", - "FullName": "Monaco", - "Acronym": "MCO" - }, - { - "FlagName": "UZ", - "FullName": "Uzbekistan", - "Acronym": "UZB" - }, - { - "FlagName": "MM", - "FullName": "Myanmar", - "Acronym": "MMR" - }, - { - "FlagName": "ML", - "FullName": "Mali", - "Acronym": "MLI" - }, - { - "FlagName": "MO", - "FullName": "Macao", - "Acronym": "MAC" - }, - { - "FlagName": "MN", - "FullName": "Mongolia", - "Acronym": "MNG" - }, - { - "FlagName": "MH", - "FullName": "Marshall Islands", - "Acronym": "MHL" - }, - { - "FlagName": "MK", - "FullName": "North Macedonia", - "Acronym": "MKD" - }, - { - "FlagName": "MU", - "FullName": "Mauritius", - "Acronym": "MUS" - }, - { - "FlagName": "MT", - "FullName": "Malta", - "Acronym": "MLT" - }, - { - "FlagName": "MW", - "FullName": "Malawi", - "Acronym": "MWI" - }, - { - "FlagName": "MV", - "FullName": "Maldives", - "Acronym": "MDV" - }, - { - "FlagName": "MQ", - "FullName": "Martinique", - "Acronym": "MTQ" - }, - { - "FlagName": "MP", - "FullName": "Northern Mariana Islands", - "Acronym": "MNP" - }, - { - "FlagName": "MS", - "FullName": "Montserrat", - "Acronym": "MSR" - }, - { - "FlagName": "MR", - "FullName": "Mauritania", - "Acronym": "MRT" - }, - { - "FlagName": "IM", - "FullName": "Isle of Man", - "Acronym": "IMN" - }, - { - "FlagName": "UG", - "FullName": "Uganda", - "Acronym": "UGA" - }, - { - "FlagName": "TZ", - "FullName": "Tanzania", - "Acronym": "TZA" - }, - { - "FlagName": "MY", - "FullName": "Malaysia", - "Acronym": "MYS" - }, - { - "FlagName": "MX", - "FullName": "Mexico", - "Acronym": "MEX" - }, - { - "FlagName": "IL", - "FullName": "Israel", - "Acronym": "ISR" - }, - { - "FlagName": "FR", - "FullName": "France", - "Acronym": "FRA" - }, - { - "FlagName": "IO", - "FullName": "British Indian Ocean Territory", - "Acronym": "IOT" - }, - { - "FlagName": "SH", - "FullName": "Saint Helena", - "Acronym": "SHN" - }, - { - "FlagName": "FI", - "FullName": "Finland", - "Acronym": "FIN" - }, - { - "FlagName": "FJ", - "FullName": "Fiji", - "Acronym": "FJI" - }, - { - "FlagName": "FK", - "FullName": "Falkland Islands", - "Acronym": "FLK" - }, - { - "FlagName": "FM", - "FullName": "Micronesia", - "Acronym": "FSM" - }, - { - "FlagName": "FO", - "FullName": "Faroe Islands", - "Acronym": "FRO" - }, - { - "FlagName": "NI", - "FullName": "Nicaragua", - "Acronym": "NIC" - }, - { - "FlagName": "NL", - "FullName": "Netherlands", - "Acronym": "NLD" - }, - { - "FlagName": "NO", - "FullName": "Norway", - "Acronym": "NOR" - }, - { - "FlagName": "NA", - "FullName": "Namibia", - "Acronym": "NAM" - }, - { - "FlagName": "VU", - "FullName": "Vanuatu", - "Acronym": "VUT" - }, - { - "FlagName": "NC", - "FullName": "New Caledonia", - "Acronym": "NCL" - }, - { - "FlagName": "NE", - "FullName": "Niger", - "Acronym": "NER" - }, - { - "FlagName": "NF", - "FullName": "Norfolk Island", - "Acronym": "NFK" - }, - { - "FlagName": "NG", - "FullName": "Nigeria", - "Acronym": "NGA" - }, - { - "FlagName": "NZ", - "FullName": "New Zealand", - "Acronym": "NZL" - }, - { - "FlagName": "NP", - "FullName": "Nepal", - "Acronym": "NPL" - }, - { - "FlagName": "NR", - "FullName": "Nauru", - "Acronym": "NRU" - }, - { - "FlagName": "NU", - "FullName": "Niue", - "Acronym": "NIU" - }, - { - "FlagName": "CK", - "FullName": "Cook Islands", - "Acronym": "COK" - }, - { - "FlagName": "XK", - "FullName": "Kosovo", - "Acronym": "XKX" - }, - { - "FlagName": "CI", - "FullName": "Ivory Coast", - "Acronym": "CIV" - }, - { - "FlagName": "CH", - "FullName": "Switzerland", - "Acronym": "CHE" - }, - { - "FlagName": "CO", - "FullName": "Colombia", - "Acronym": "COL" - }, - { - "FlagName": "CN", - "FullName": "China", - "Acronym": "CHN" - }, - { - "FlagName": "CM", - "FullName": "Cameroon", - "Acronym": "CMR" - }, - { - "FlagName": "CL", - "FullName": "Chile", - "Acronym": "CHL" - }, - { - "FlagName": "CC", - "FullName": "Cocos Islands", - "Acronym": "CCK" - }, - { - "FlagName": "CA", - "FullName": "Canada", - "Acronym": "CAN" - }, - { - "FlagName": "CG", - "FullName": "Republic of the Congo", - "Acronym": "COG" - }, - { - "FlagName": "CF", - "FullName": "Central African Republic", - "Acronym": "CAF" - }, - { - "FlagName": "CD", - "FullName": "Democratic Republic of the Congo", - "Acronym": "COD" - }, - { - "FlagName": "CZ", - "FullName": "Czech Republic", - "Acronym": "CZE" - }, - { - "FlagName": "CY", - "FullName": "Cyprus", - "Acronym": "CYP" - }, - { - "FlagName": "CX", - "FullName": "Christmas Island", - "Acronym": "CXR" - }, - { - "FlagName": "CR", - "FullName": "Costa Rica", - "Acronym": "CRI" - }, - { - "FlagName": "CW", - "FullName": "Curacao", - "Acronym": "CUW" - }, - { - "FlagName": "CV", - "FullName": "Cabo Verde", - "Acronym": "CPV" - }, - { - "FlagName": "CU", - "FullName": "Cuba", - "Acronym": "CUB" - }, - { - "FlagName": "SZ", - "FullName": "Eswatini", - "Acronym": "SWZ" - }, - { - "FlagName": "SY", - "FullName": "Syria", - "Acronym": "SYR" - }, - { - "FlagName": "SX", - "FullName": "Sint Maarten", - "Acronym": "SXM" - }, - { - "FlagName": "KG", - "FullName": "Kyrgyzstan", - "Acronym": "KGZ" - }, - { - "FlagName": "KE", - "FullName": "Kenya", - "Acronym": "KEN" - }, - { - "FlagName": "SS", - "FullName": "South Sudan", - "Acronym": "SSD" - }, - { - "FlagName": "SR", - "FullName": "Suriname", - "Acronym": "SUR" - }, - { - "FlagName": "KI", - "FullName": "Kiribati", - "Acronym": "KIR" - }, - { - "FlagName": "KH", - "FullName": "Cambodia", - "Acronym": "KHM" - }, - { - "FlagName": "KN", - "FullName": "Saint Kitts and Nevis", - "Acronym": "KNA" - }, - { - "FlagName": "KM", - "FullName": "Comoros", - "Acronym": "COM" - }, - { - "FlagName": "ST", - "FullName": "Sao Tome and Principe", - "Acronym": "STP" - }, - { - "FlagName": "SK", - "FullName": "Slovakia", - "Acronym": "SVK" - }, - { - "FlagName": "KR", - "FullName": "South Korea", - "Acronym": "KOR" - }, - { - "FlagName": "SI", - "FullName": "Slovenia", - "Acronym": "SVN" - }, - { - "FlagName": "KP", - "FullName": "North Korea", - "Acronym": "PRK" - }, - { - "FlagName": "KW", - "FullName": "Kuwait", - "Acronym": "KWT" - }, - { - "FlagName": "SN", - "FullName": "Senegal", - "Acronym": "SEN" - }, - { - "FlagName": "SM", - "FullName": "San Marino", - "Acronym": "SMR" - }, - { - "FlagName": "SL", - "FullName": "Sierra Leone", - "Acronym": "SLE" - }, - { - "FlagName": "SC", - "FullName": "Seychelles", - "Acronym": "SYC" - }, - { - "FlagName": "KZ", - "FullName": "Kazakhstan", - "Acronym": "KAZ" - }, - { - "FlagName": "KY", - "FullName": "Cayman Islands", - "Acronym": "CYM" - }, - { - "FlagName": "SG", - "FullName": "Singapore", - "Acronym": "SGP" - }, - { - "FlagName": "SE", - "FullName": "Sweden", - "Acronym": "SWE" - }, - { - "FlagName": "SD", - "FullName": "Sudan", - "Acronym": "SDN" - }, - { - "FlagName": "DO", - "FullName": "Dominican Republic", - "Acronym": "DOM" - }, - { - "FlagName": "DM", - "FullName": "Dominica", - "Acronym": "DMA" - }, - { - "FlagName": "DJ", - "FullName": "Djibouti", - "Acronym": "DJI" - }, - { - "FlagName": "DK", - "FullName": "Denmark", - "Acronym": "DNK" - }, - { - "FlagName": "VG", - "FullName": "British Virgin Islands", - "Acronym": "VGB" - }, - { - "FlagName": "DE", - "FullName": "Germany", - "Acronym": "DEU" - }, - { - "FlagName": "YE", - "FullName": "Yemen", - "Acronym": "YEM" - }, - { - "FlagName": "DZ", - "FullName": "Algeria", - "Acronym": "DZA" - }, - { - "FlagName": "US", - "FullName": "United States", - "Acronym": "USA" - }, - { - "FlagName": "UY", - "FullName": "Uruguay", - "Acronym": "URY" - }, - { - "FlagName": "YT", - "FullName": "Mayotte", - "Acronym": "MYT" - }, - { - "FlagName": "UM", - "FullName": "United States Minor Outlying Islands", - "Acronym": "UMI" - }, - { - "FlagName": "LB", - "FullName": "Lebanon", - "Acronym": "LBN" - }, - { - "FlagName": "LC", - "FullName": "Saint Lucia", - "Acronym": "LCA" - }, - { - "FlagName": "LA", - "FullName": "Laos", - "Acronym": "LAO" - }, - { - "FlagName": "TV", - "FullName": "Tuvalu", - "Acronym": "TUV" - }, - { - "FlagName": "TW", - "FullName": "Taiwan", - "Acronym": "TWN" - }, - { - "FlagName": "TT", - "FullName": "Trinidad and Tobago", - "Acronym": "TTO" - }, - { - "FlagName": "TR", - "FullName": "Turkey", - "Acronym": "TUR" - }, - { - "FlagName": "LK", - "FullName": "Sri Lanka", - "Acronym": "LKA" - }, - { - "FlagName": "LI", - "FullName": "Liechtenstein", - "Acronym": "LIE" - }, - { - "FlagName": "LV", - "FullName": "Latvia", - "Acronym": "LVA" - }, - { - "FlagName": "TO", - "FullName": "Tonga", - "Acronym": "TON" - }, - { - "FlagName": "LT", - "FullName": "Lithuania", - "Acronym": "LTU" - }, - { - "FlagName": "LU", - "FullName": "Luxembourg", - "Acronym": "LUX" - }, - { - "FlagName": "LR", - "FullName": "Liberia", - "Acronym": "LBR" - }, - { - "FlagName": "LS", - "FullName": "Lesotho", - "Acronym": "LSO" - }, - { - "FlagName": "TH", - "FullName": "Thailand", - "Acronym": "THA" - }, - { - "FlagName": "TF", - "FullName": "French Southern Territories", - "Acronym": "ATF" - }, - { - "FlagName": "TG", - "FullName": "Togo", - "Acronym": "TGO" - }, - { - "FlagName": "TD", - "FullName": "Chad", - "Acronym": "TCD" - }, - { - "FlagName": "TC", - "FullName": "Turks and Caicos Islands", - "Acronym": "TCA" - }, - { - "FlagName": "LY", - "FullName": "Libya", - "Acronym": "LBY" - }, - { - "FlagName": "VA", - "FullName": "Vatican", - "Acronym": "VAT" - }, - { - "FlagName": "VC", - "FullName": "Saint Vincent and the Grenadines", - "Acronym": "VCT" - }, - { - "FlagName": "AE", - "FullName": "United Arab Emirates", - "Acronym": "ARE" - }, - { - "FlagName": "AD", - "FullName": "Andorra", - "Acronym": "AND" - }, - { - "FlagName": "AG", - "FullName": "Antigua and Barbuda", - "Acronym": "ATG" - }, - { - "FlagName": "AF", - "FullName": "Afghanistan", - "Acronym": "AFG" - }, - { - "FlagName": "AI", - "FullName": "Anguilla", - "Acronym": "AIA" - }, - { - "FlagName": "VI", - "FullName": "U.S. Virgin Islands", - "Acronym": "VIR" - }, - { - "FlagName": "IS", - "FullName": "Iceland", - "Acronym": "ISL" - }, - { - "FlagName": "IR", - "FullName": "Iran", - "Acronym": "IRN" - }, - { - "FlagName": "AM", - "FullName": "Armenia", - "Acronym": "ARM" - }, - { - "FlagName": "AL", - "FullName": "Albania", - "Acronym": "ALB" - }, - { - "FlagName": "AO", - "FullName": "Angola", - "Acronym": "AGO" - }, - { - "FlagName": "AQ", - "FullName": "Antarctica", - "Acronym": "ATA" - }, - { - "FlagName": "AS", - "FullName": "American Samoa", - "Acronym": "ASM" - }, - { - "FlagName": "AR", - "FullName": "Argentina", - "Acronym": "ARG" - }, - { - "FlagName": "AU", - "FullName": "Australia", - "Acronym": "AUS" - }, - { - "FlagName": "AT", - "FullName": "Austria", - "Acronym": "AUT" - }, - { - "FlagName": "AW", - "FullName": "Aruba", - "Acronym": "ABW" - }, - { - "FlagName": "IN", - "FullName": "India", - "Acronym": "IND" - }, - { - "FlagName": "AX", - "FullName": "Aland Islands", - "Acronym": "ALA" - }, - { - "FlagName": "AZ", - "FullName": "Azerbaijan", - "Acronym": "AZE" - }, - { - "FlagName": "IE", - "FullName": "Ireland", - "Acronym": "IRL" - }, - { - "FlagName": "ID", - "FullName": "Indonesia", - "Acronym": "IDN" - }, - { - "FlagName": "UA", - "FullName": "Ukraine", - "Acronym": "UKR" - }, - { - "FlagName": "QA", - "FullName": "Qatar", - "Acronym": "QAT" - }, - { - "FlagName": "MZ", - "FullName": "Mozambique", - "Acronym": "MOZ" - } -] \ No newline at end of file diff --git a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs index 111893d18c..02c0a0d7e1 100644 --- a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs @@ -3,13 +3,13 @@ #nullable disable +using System; using System.Collections.Generic; using System.Diagnostics; -using System.IO; using System.Linq; -using Newtonsoft.Json; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -45,11 +45,17 @@ namespace osu.Game.Tournament.Screens.Editors private void addAllCountries() { - List countries; + var countries = new List(); - using (Stream stream = game.Resources.GetStream("Resources/countries.json")) - using (var sr = new StreamReader(stream)) - countries = JsonConvert.DeserializeObject>(sr.ReadToEnd()); + foreach (var country in Enum.GetValues(typeof(Country)).Cast().Skip(1)) + { + countries.Add(new TournamentTeam + { + FlagName = { Value = country.ToString() }, + FullName = { Value = country.GetDescription() }, + Acronym = { Value = country.GetAcronym() }, + }); + } Debug.Assert(countries != null); From 9c81241f4ce0abf7e77621f8cf048076446d9cc6 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 16 Jul 2022 06:02:04 +0300 Subject: [PATCH 2274/2328] Fix potential nullref on `APIUser.Country` We need NRT sooner than later... --- osu.Game/Online/API/Requests/Responses/APIUser.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIUser.cs b/osu.Game/Online/API/Requests/Responses/APIUser.cs index 1a2a38e789..e2e1288b8c 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUser.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUser.cs @@ -38,11 +38,12 @@ namespace osu.Game.Online.API.Requests.Responses public Country Country { - get => country ??= (Enum.TryParse(userCountry.Code, out Country result) ? result : default); + get => country ??= (Enum.TryParse(userCountry?.Code, out Country result) ? result : default); set => country = value; } #pragma warning disable 649 + [CanBeNull] [JsonProperty(@"country")] private UserCountry userCountry; From 4968859e694770186cf5e09a88ee2d91195efc44 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 16 Jul 2022 06:07:53 +0300 Subject: [PATCH 2275/2328] Rename placeholder display flag property to make sense --- osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs | 2 +- osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs | 2 +- osu.Game/Overlays/Rankings/Tables/RankingsTable.cs | 2 +- osu.Game/Users/Drawables/UpdateableFlag.cs | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index b2e5be6601..669b701d1d 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -168,7 +168,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores new UpdateableFlag(score.User.Country) { Size = new Vector2(19, 14), - ShowPlaceholderOnNull = false, + ShowPlaceholderOnUnknown = false, }, username, new OsuSpriteText diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs index f093c6b53f..85c8f92a76 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs @@ -120,7 +120,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Origin = Anchor.CentreLeft, Size = new Vector2(19, 14), Margin = new MarginPadding { Top = 3 }, // makes spacing look more even - ShowPlaceholderOnNull = false, + ShowPlaceholderOnUnknown = false, }, } } diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index 818a84b9aa..a213f99701 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -137,7 +137,7 @@ namespace osu.Game.Overlays.Profile.Header userFlag = new UpdateableFlag { Size = new Vector2(28, 20), - ShowPlaceholderOnNull = false, + ShowPlaceholderOnUnknown = false, }, userCountryText = new OsuSpriteText { diff --git a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs index 56e318637a..1e33b96ef1 100644 --- a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs @@ -100,7 +100,7 @@ namespace osu.Game.Overlays.Rankings.Tables new UpdateableFlag(GetCountry(item)) { Size = new Vector2(28, 20), - ShowPlaceholderOnNull = false, + ShowPlaceholderOnUnknown = false, }, CreateFlagContent(item) } diff --git a/osu.Game/Users/Drawables/UpdateableFlag.cs b/osu.Game/Users/Drawables/UpdateableFlag.cs index 2f08f1c787..88c08d4bb1 100644 --- a/osu.Game/Users/Drawables/UpdateableFlag.cs +++ b/osu.Game/Users/Drawables/UpdateableFlag.cs @@ -22,9 +22,9 @@ namespace osu.Game.Users.Drawables } /// - /// Whether to show a place holder on null country. + /// Whether to show a place holder on unknown country. /// - public bool ShowPlaceholderOnNull = true; + public bool ShowPlaceholderOnUnknown = true; /// /// Perform an action in addition to showing the country ranking. @@ -39,7 +39,7 @@ namespace osu.Game.Users.Drawables protected override Drawable CreateDrawable(Country country) { - if (country == default && !ShowPlaceholderOnNull) + if (country == default && !ShowPlaceholderOnUnknown) return null; return new Container From 4e7156cee8f66d057cacc7caf812518fcd7b3587 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 16 Jul 2022 06:30:25 +0300 Subject: [PATCH 2276/2328] Store user country on databased scores --- osu.Game/Database/RealmAccess.cs | 3 ++- osu.Game/Models/RealmUser.cs | 12 ++++++++++-- osu.Game/Rulesets/Mods/ICreateReplayData.cs | 1 + osu.Game/Scoring/ScoreInfo.cs | 7 +++++-- osu.Game/Users/IUser.cs | 2 ++ 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index bebc101b13..0c44436ec8 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -60,8 +60,9 @@ namespace osu.Game.Database /// 14 2022-03-01 Added BeatmapUserSettings to BeatmapInfo. /// 15 2022-07-13 Added LastPlayed to BeatmapInfo. /// 16 2022-07-15 Removed HasReplay from ScoreInfo. + /// 17 2022-07-16 Added Country to RealmUser. /// - private const int schema_version = 16; + private const int schema_version = 17; /// /// Lock object which is held during sections, blocking realm retrieval during blocking periods. diff --git a/osu.Game/Models/RealmUser.cs b/osu.Game/Models/RealmUser.cs index 58fd7ff2a3..1668739bb5 100644 --- a/osu.Game/Models/RealmUser.cs +++ b/osu.Game/Models/RealmUser.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using osu.Game.Database; using osu.Game.Users; @@ -17,6 +15,16 @@ namespace osu.Game.Models public string Username { get; set; } = string.Empty; + [Ignored] + public Country Country + { + get => Enum.TryParse(CountryString, out Country country) ? country : default; + set => CountryString = value.ToString(); + } + + [MapTo(nameof(Country))] + public string CountryString { get; set; } = default(Country).ToString(); + public bool IsBot => false; public bool Equals(RealmUser other) diff --git a/osu.Game/Rulesets/Mods/ICreateReplayData.cs b/osu.Game/Rulesets/Mods/ICreateReplayData.cs index 6058380eb3..6c195f623c 100644 --- a/osu.Game/Rulesets/Mods/ICreateReplayData.cs +++ b/osu.Game/Rulesets/Mods/ICreateReplayData.cs @@ -58,6 +58,7 @@ namespace osu.Game.Rulesets.Mods public class ModCreatedUser : IUser { public int OnlineID => APIUser.SYSTEM_USER_ID; + public Country Country => default; public bool IsBot => true; public string Username { get; set; } = string.Empty; diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index 81ca5f0300..f5942e4639 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -85,8 +85,9 @@ namespace osu.Game.Scoring { get => user ??= new APIUser { - Username = RealmUser.Username, Id = RealmUser.OnlineID, + Username = RealmUser.Username, + Country = RealmUser.Country, }; set { @@ -95,7 +96,8 @@ namespace osu.Game.Scoring RealmUser = new RealmUser { OnlineID = user.OnlineID, - Username = user.Username + Username = user.Username, + Country = user.Country, }; } } @@ -135,6 +137,7 @@ namespace osu.Game.Scoring { OnlineID = RealmUser.OnlineID, Username = RealmUser.Username, + Country = RealmUser.Country, }; return clone; diff --git a/osu.Game/Users/IUser.cs b/osu.Game/Users/IUser.cs index 7a233b5d8b..a520660c4d 100644 --- a/osu.Game/Users/IUser.cs +++ b/osu.Game/Users/IUser.cs @@ -10,6 +10,8 @@ namespace osu.Game.Users { string Username { get; } + Country Country { get; } + bool IsBot { get; } bool IEquatable.Equals(IUser? other) From d0fe4fe15aa7270d678a674f9d8fd2735d5507ea Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 16 Jul 2022 06:31:01 +0300 Subject: [PATCH 2277/2328] Fix user population logic not including country --- osu.Game/Scoring/ScoreImporter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Scoring/ScoreImporter.cs b/osu.Game/Scoring/ScoreImporter.cs index 53dd511d57..4107c66dfe 100644 --- a/osu.Game/Scoring/ScoreImporter.cs +++ b/osu.Game/Scoring/ScoreImporter.cs @@ -84,7 +84,7 @@ namespace osu.Game.Scoring api.Perform(userRequest); if (userRequest.Response is APIUser user) - model.RealmUser.OnlineID = user.Id; + model.User = user; } } } From 69d967172ac3a11e34c5ea499f64dba6fd78676d Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 16 Jul 2022 06:32:25 +0300 Subject: [PATCH 2278/2328] Remove unencessary null coalesce --- osu.Game/Skinning/LegacyBeatmapSkin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Skinning/LegacyBeatmapSkin.cs b/osu.Game/Skinning/LegacyBeatmapSkin.cs index 43ae0a2252..e8414b4c11 100644 --- a/osu.Game/Skinning/LegacyBeatmapSkin.cs +++ b/osu.Game/Skinning/LegacyBeatmapSkin.cs @@ -96,7 +96,7 @@ namespace osu.Game.Skinning new SkinInfo { Name = beatmapInfo.ToString(), - Creator = beatmapInfo.Metadata.Author.Username ?? string.Empty + Creator = beatmapInfo.Metadata.Author.Username }; } } From a10c398cd58516ce85dbc4e7072047f392b48272 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 16 Jul 2022 06:40:53 +0300 Subject: [PATCH 2279/2328] Remove no longer necessary DI --- osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs index 02c0a0d7e1..0f806a2403 100644 --- a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs @@ -25,9 +25,6 @@ namespace osu.Game.Tournament.Screens.Editors { public class TeamEditorScreen : TournamentEditorScreen { - [Resolved] - private TournamentGameBase game { get; set; } - protected override BindableList Storage => LadderInfo.Teams; [BackgroundDependencyLoader] From 9e945197dce72e6827e67fedf41e1048d843a608 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 16 Jul 2022 14:49:14 +0900 Subject: [PATCH 2280/2328] Use "Unknown" instead of "Alient" for unknown countries --- osu.Game/Users/Country.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index e96b96e57c..2070bcab39 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -12,7 +12,7 @@ namespace osu.Game.Users [UsedImplicitly(ImplicitUseTargetFlags.WithMembers)] public enum Country { - [Description("Alien")] + [Description("Unknown")] XX = 0, [Description("Bangladesh")] From acd5254f51a37ac519e5c70debd0c6c08f02952b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 16 Jul 2022 17:18:22 +0900 Subject: [PATCH 2281/2328] Add test coverage ensuring unique acronyms --- .../TestSceneNoConflictingModAcronyms.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 osu.Game.Tests/Visual/Gameplay/TestSceneNoConflictingModAcronyms.cs diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneNoConflictingModAcronyms.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneNoConflictingModAcronyms.cs new file mode 100644 index 0000000000..b2ba3d99ad --- /dev/null +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneNoConflictingModAcronyms.cs @@ -0,0 +1,27 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using osu.Framework.Testing; + +namespace osu.Game.Tests.Visual.Gameplay +{ + [HeadlessTest] + public class TestSceneNoConflictingModAcronyms : TestSceneAllRulesetPlayers + { + protected override void AddCheckSteps() + { + AddStep("Check all mod acronyms are unique", () => + { + var mods = Ruleset.Value.CreateInstance().AllMods; + + IEnumerable acronyms = mods.Select(m => m.Acronym); + + Assert.That(acronyms, Is.Unique); + }); + } + } +} From b93b6ba2ca215fac5a66e224695a908ff57925e9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 16 Jul 2022 17:07:55 +0900 Subject: [PATCH 2282/2328] Change "single tap" mod acronym to not conflict with "strict tracking" --- osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs b/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs index 051ceb968c..b170d30448 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Osu.Mods public class OsuModSingleTap : InputBlockingMod { public override string Name => @"Single Tap"; - public override string Acronym => @"ST"; + public override string Acronym => @"SG"; public override string Description => @"You must only use one key!"; public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAlternate) }).ToArray(); From cf7af0061c606a737d6411a96f46c131668d3574 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 16 Jul 2022 15:20:15 +0200 Subject: [PATCH 2283/2328] Add Touch input handler settings section --- osu.Desktop/OsuGameDesktop.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 314a03a73e..524436235e 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -22,10 +22,12 @@ using osu.Framework.Input.Handlers; using osu.Framework.Input.Handlers.Joystick; using osu.Framework.Input.Handlers.Mouse; using osu.Framework.Input.Handlers.Tablet; +using osu.Framework.Input.Handlers.Touch; using osu.Framework.Threading; using osu.Game.IO; using osu.Game.IPC; using osu.Game.Overlays.Settings; +using osu.Game.Overlays.Settings.Sections; using osu.Game.Overlays.Settings.Sections.Input; namespace osu.Desktop @@ -156,6 +158,9 @@ namespace osu.Desktop case JoystickHandler jh: return new JoystickSettings(jh); + case TouchHandler th: + return new InputSection.HandlerSection(th); + default: return base.CreateSettingsSubsectionFor(handler); } From bbb2398a8b4cee039a96883f4fa7a0ed9e18f92d Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 00:46:29 +0100 Subject: [PATCH 2284/2328] change retry button icon from ArrowCircleLeft to Redo --- osu.Game/Screens/Ranking/RetryButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/RetryButton.cs b/osu.Game/Screens/Ranking/RetryButton.cs index a0ddc98943..c56f364ae8 100644 --- a/osu.Game/Screens/Ranking/RetryButton.cs +++ b/osu.Game/Screens/Ranking/RetryButton.cs @@ -37,7 +37,7 @@ namespace osu.Game.Screens.Ranking Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(13), - Icon = FontAwesome.Solid.ArrowCircleLeft, + Icon = FontAwesome.Solid.Redo, }, }; From 6636e462dc925f70c368ab60b5fdff3640dff331 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 17 Jul 2022 06:18:59 +0300 Subject: [PATCH 2285/2328] Fix `SoloScoreInfo` not carrying mod settings in conversion methods --- osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs index 6c48c7883f..cf7aa599f3 100644 --- a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs @@ -101,7 +101,7 @@ namespace osu.Game.Online.API.Requests.Responses var rulesetInstance = ruleset.CreateInstance(); - var mods = Mods.Select(apiMod => rulesetInstance.CreateModFromAcronym(apiMod.Acronym)).Where(m => m != null).ToArray(); + var mods = Mods.Select(apiMod => apiMod.ToMod(rulesetInstance)).ToArray(); var scoreInfo = ToScoreInfo(mods); From 9382636da987c101ea0c8b90b31ce048063e7bc2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 17 Jul 2022 06:19:34 +0300 Subject: [PATCH 2286/2328] Catch and log exceptions from mod setting copy failure --- osu.Game/Online/API/APIMod.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/API/APIMod.cs b/osu.Game/Online/API/APIMod.cs index dc1db08174..8346300767 100644 --- a/osu.Game/Online/API/APIMod.cs +++ b/osu.Game/Online/API/APIMod.cs @@ -65,7 +65,14 @@ namespace osu.Game.Online.API if (!Settings.TryGetValue(property.Name.Underscore(), out object settingValue)) continue; - resultMod.CopyAdjustedSetting((IBindable)property.GetValue(resultMod), settingValue); + try + { + resultMod.CopyAdjustedSetting((IBindable)property.GetValue(resultMod), settingValue); + } + catch (Exception ex) + { + Logger.Log($"Failed to copy mod setting value '{settingValue ?? "null"}' to \"{property.Name}\": {ex.Message}"); + } } } From 8e7e1e6b516bf7dcf1a3088fef794bd116226bf4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 17 Jul 2022 05:20:05 +0900 Subject: [PATCH 2287/2328] Fix spectator client not correctly reconnecting after shutdown --- osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs | 1 + osu.Game/Online/Spectator/OnlineSpectatorClient.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs index c061398209..4e6ea997c1 100644 --- a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs @@ -80,6 +80,7 @@ namespace osu.Game.Online.Multiplayer try { + // Importantly, use Invoke rather than Send to capture exceptions. return await connection.InvokeAsync(nameof(IMultiplayerServer.JoinRoomWithPassword), roomId, password ?? string.Empty); } catch (HubException exception) diff --git a/osu.Game/Online/Spectator/OnlineSpectatorClient.cs b/osu.Game/Online/Spectator/OnlineSpectatorClient.cs index cd9f5233a2..1ed7819b05 100644 --- a/osu.Game/Online/Spectator/OnlineSpectatorClient.cs +++ b/osu.Game/Online/Spectator/OnlineSpectatorClient.cs @@ -56,7 +56,8 @@ namespace osu.Game.Online.Spectator try { - await connection.SendAsync(nameof(ISpectatorServer.BeginPlaySession), state); + // Importantly, use Invoke rather than Send to capture exceptions. + await connection.InvokeAsync(nameof(ISpectatorServer.BeginPlaySession), state); } catch (HubException exception) { From 51071be3152de31ca5f793262f4dae17487df793 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 17 Jul 2022 21:20:50 +0900 Subject: [PATCH 2288/2328] Don't show "missing background" messages to user Bit of an oversight. As reported on [twitter](https://twitter.com/emyl___/status/1548627793075998720) and somewhere else i forgot. --- osu.Game/Beatmaps/WorkingBeatmapCache.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmapCache.cs b/osu.Game/Beatmaps/WorkingBeatmapCache.cs index ce883a7092..df44f01629 100644 --- a/osu.Game/Beatmaps/WorkingBeatmapCache.cs +++ b/osu.Game/Beatmaps/WorkingBeatmapCache.cs @@ -168,7 +168,7 @@ namespace osu.Game.Beatmaps if (texture == null) { - Logger.Log($"Beatmap background failed to load (file {Metadata.BackgroundFile} not found on disk at expected location {fileStorePath}).", level: LogLevel.Error); + Logger.Log($"Beatmap background failed to load (file {Metadata.BackgroundFile} not found on disk at expected location {fileStorePath})."); return null; } From 1f288157f491bafd470388c47f65e43c896ff008 Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 14:07:05 +0100 Subject: [PATCH 2289/2328] change `GetUserScoresRequest` to return `SoloScoreInfo` instead of `APIScore` --- osu.Game/Online/API/Requests/GetUserScoresRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs index 9bd78b7be1..8ef797f799 100644 --- a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs @@ -10,7 +10,7 @@ using osu.Game.Rulesets; namespace osu.Game.Online.API.Requests { - public class GetUserScoresRequest : PaginatedAPIRequest> + public class GetUserScoresRequest : PaginatedAPIRequest> { private readonly long userId; private readonly ScoreType type; From e8d88e29c6331d73e9041efefbdb705cbf93bd0c Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 14:08:04 +0100 Subject: [PATCH 2290/2328] change `DrawableProfileScore` and `DrawableProfileWeightedScore` to take `SoloScoreInfo` and `APIBeatmap` instead of `APIScore` --- .../Profile/Sections/Ranks/DrawableProfileScore.cs | 12 +++++++----- .../Sections/Ranks/DrawableProfileWeightedScore.cs | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs index 90a357a281..1ff1e0e842 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs @@ -31,7 +31,8 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks private const float performance_background_shear = 0.45f; - protected readonly APIScore Score; + protected readonly SoloScoreInfo Score; + protected readonly APIBeatmap Beatmap; [Resolved] private OsuColour colours { get; set; } @@ -39,9 +40,10 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks [Resolved] private OverlayColourProvider colourProvider { get; set; } - public DrawableProfileScore(APIScore score) + public DrawableProfileScore(SoloScoreInfo score, APIBeatmap beatmap) { Score = score; + Beatmap = beatmap; RelativeSizeAxes = Axes.X; Height = height; @@ -84,7 +86,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks Spacing = new Vector2(0, 2), Children = new Drawable[] { - new ScoreBeatmapMetadataContainer(Score.Beatmap), + new ScoreBeatmapMetadataContainer(Beatmap), new FillFlowContainer { AutoSizeAxes = Axes.Both, @@ -94,11 +96,11 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks { new OsuSpriteText { - Text = $"{Score.Beatmap?.DifficultyName}", + Text = $"{Beatmap.DifficultyName}", Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular), Colour = colours.Yellow }, - new DrawableDate(Score.Date, 12) + new DrawableDate(Score.EndedAt ?? DateTimeOffset.Now, 12) { Colour = colourProvider.Foreground1 } diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileWeightedScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileWeightedScore.cs index f8f83883fc..8d0a41ec48 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileWeightedScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileWeightedScore.cs @@ -18,8 +18,8 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks { private readonly double weight; - public DrawableProfileWeightedScore(APIScore score, double weight) - : base(score) + public DrawableProfileWeightedScore(SoloScoreInfo score, APIBeatmap beatmap, double weight) + : base(score, beatmap) { this.weight = weight; } From ef4237c4ac8bf32d5a0b8bb51662aa6e3100b9ef Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 14:08:31 +0100 Subject: [PATCH 2291/2328] create special subsection class for paginated profile scores --- .../PaginatedProfileScoreSubsection.cs | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 osu.Game/Overlays/Profile/Sections/PaginatedProfileScoreSubsection.cs diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedProfileScoreSubsection.cs b/osu.Game/Overlays/Profile/Sections/PaginatedProfileScoreSubsection.cs new file mode 100644 index 0000000000..408d4a96bf --- /dev/null +++ b/osu.Game/Overlays/Profile/Sections/PaginatedProfileScoreSubsection.cs @@ -0,0 +1,193 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Localisation; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API; +using osu.Game.Graphics.Containers; +using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; +using osuTK; + +namespace osu.Game.Overlays.Profile.Sections +{ + public abstract class PaginatedProfileScoreSubsection : ProfileSubsection + { + /// + /// The number of items displayed per page. + /// + protected virtual int ItemsPerPage => 50; + + /// + /// The number of items displayed initially. + /// + protected virtual int InitialItemsCount => 5; + + [Resolved] + private IAPIProvider api { get; set; } + + protected PaginationParameters? CurrentPage { get; private set; } + + protected ReverseChildIDFillFlowContainer ItemsContainer { get; private set; } + + private APIRequest> scoreRetrievalRequest; + private APIRequest beatmapRetrievalRequest; + private CancellationTokenSource loadCancellation; + + protected List CurrentScores { get; private set; } = new List(); + + private ShowMoreButton moreButton; + private OsuSpriteText missing; + private readonly LocalisableString? missingText; + + protected PaginatedProfileScoreSubsection(Bindable user, LocalisableString? headerText = null, LocalisableString? missingText = null) + : base(user, headerText, CounterVisibilityState.AlwaysVisible) + { + this.missingText = missingText; + } + + protected override Drawable CreateContent() => new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + // reverse ID flow is required for correct Z-ordering of the items (last item should be front-most). + // particularly important in PaginatedBeatmapContainer, as it uses beatmap cards, which have expandable overhanging content. + ItemsContainer = new ReverseChildIDFillFlowContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Spacing = new Vector2(0, 2), + // ensure the container and its contents are in front of the "more" button. + Depth = float.MinValue + }, + moreButton = new ShowMoreButton + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Alpha = 0, + Margin = new MarginPadding { Top = 10 }, + Action = showMore, + }, + missing = new OsuSpriteText + { + Font = OsuFont.GetFont(size: 15), + Text = missingText ?? string.Empty, + Alpha = 0, + } + } + }; + + protected override void LoadComplete() + { + base.LoadComplete(); + User.BindValueChanged(onUserChanged, true); + } + + private void onUserChanged(ValueChangedEvent e) + { + loadCancellation?.Cancel(); + scoreRetrievalRequest?.Cancel(); + beatmapRetrievalRequest?.Cancel(); + + CurrentPage = null; + ItemsContainer.Clear(); + CurrentScores.Clear(); + + if (e.NewValue != null) + { + showMore(); + SetCount(GetCount(e.NewValue)); + } + } + + private void showMore() + { + loadCancellation = new CancellationTokenSource(); + + CurrentPage = CurrentPage?.TakeNext(ItemsPerPage) ?? new PaginationParameters(InitialItemsCount); + + scoreRetrievalRequest = CreateScoreRequest(CurrentPage.Value); + scoreRetrievalRequest.Success += requestBeatmaps; + + api.Queue(scoreRetrievalRequest); + } + + private void requestBeatmaps(List items) + { + CurrentScores = items; + + beatmapRetrievalRequest = CreateBeatmapsRequest(items); + beatmapRetrievalRequest.Success += UpdateItems; + + api.Queue(beatmapRetrievalRequest); + } + + protected virtual APIRequest CreateBeatmapsRequest(List items) => new GetBeatmapsRequest(items.Select(i => i.BeatmapID).ToArray()); + + protected virtual void UpdateItems(GetBeatmapsResponse beatmaps) => Schedule(() => + { + var scoreBeatmapPairs = new List>(); + + foreach (var score in CurrentScores) + { + var beatmap = beatmaps.Beatmaps.Find(m => m.OnlineID == score.BeatmapID); + scoreBeatmapPairs.Add(new Tuple(score, beatmap)); + } + + OnItemsReceived(scoreBeatmapPairs); + + if (!scoreBeatmapPairs.Any() && CurrentPage?.Offset == 0) + { + moreButton.Hide(); + moreButton.IsLoading = false; + + if (missingText.HasValue) + missing.Show(); + + return; + } + + LoadComponentsAsync(scoreBeatmapPairs.Select(CreateDrawableItem).Where(d => d != null), drawables => + { + missing.Hide(); + + moreButton.FadeTo(scoreBeatmapPairs.Count == CurrentPage?.Limit ? 1 : 0); + moreButton.IsLoading = false; + + ItemsContainer.AddRange(drawables); + }, loadCancellation.Token); + }); + + protected virtual int GetCount(APIUser user) => 0; + + protected virtual void OnItemsReceived(List> scoreBeatmapPairs) + { + } + + protected abstract APIRequest> CreateScoreRequest(PaginationParameters pagination); + + protected abstract Drawable CreateDrawableItem(Tuple scoreBeatmapPair); + + protected override void Dispose(bool isDisposing) + { + scoreRetrievalRequest?.Cancel(); + loadCancellation?.Cancel(); + base.Dispose(isDisposing); + } + } +} From 71a4b8843ffc52602f1fa5e3620da84b7bb0958e Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 14:08:44 +0100 Subject: [PATCH 2292/2328] update tests to new profile score format --- .../Online/TestSceneUserProfileScores.cs | 104 +++++++++--------- 1 file changed, 54 insertions(+), 50 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs index fa28df3061..33ddf4a3a9 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs @@ -21,20 +21,12 @@ namespace osu.Game.Tests.Visual.Online { public TestSceneUserProfileScores() { - var firstScore = new APIScore + var firstScore = new SoloScoreInfo { PP = 1047.21, Rank = ScoreRank.SH, - Beatmap = new APIBeatmap - { - BeatmapSet = new APIBeatmapSet - { - Title = "JUSTadICE (TV Size)", - Artist = "Oomori Seiko", - }, - DifficultyName = "Extreme" - }, - Date = DateTimeOffset.Now, + BeatmapID = 2058788, + EndedAt = DateTimeOffset.Now, Mods = new[] { new APIMod { Acronym = new OsuModHidden().Acronym }, @@ -43,21 +35,22 @@ namespace osu.Game.Tests.Visual.Online }, Accuracy = 0.9813 }; + var firstBeatmap = new APIBeatmap + { + BeatmapSet = new APIBeatmapSet() + { + Title = "JUSTadICE (TV Size)", + Artist = "Oomori Seiko", + }, + DifficultyName = "Extreme" + }; - var secondScore = new APIScore + var secondScore = new SoloScoreInfo { PP = 134.32, Rank = ScoreRank.A, - Beatmap = new APIBeatmap - { - BeatmapSet = new APIBeatmapSet - { - Title = "Triumph & Regret", - Artist = "typeMARS", - }, - DifficultyName = "[4K] Regret" - }, - Date = DateTimeOffset.Now, + BeatmapID = 767046, + EndedAt = DateTimeOffset.Now, Mods = new[] { new APIMod { Acronym = new OsuModHardRock().Acronym }, @@ -65,39 +58,50 @@ namespace osu.Game.Tests.Visual.Online }, Accuracy = 0.998546 }; + var secondBeatmap = new APIBeatmap + { + BeatmapSet = new APIBeatmapSet() + { + Title = "Triumph & Regret", + Artist = "typeMARS", + }, + DifficultyName = "[4K] Regret" + }; - var thirdScore = new APIScore + var thirdScore = new SoloScoreInfo { PP = 96.83, Rank = ScoreRank.S, - Beatmap = new APIBeatmap - { - BeatmapSet = new APIBeatmapSet - { - Title = "Idolize", - Artist = "Creo", - }, - DifficultyName = "Insane" - }, - Date = DateTimeOffset.Now, + BeatmapID = 2134713, + EndedAt = DateTimeOffset.Now, Accuracy = 0.9726 }; + var thirdBeatmap = new APIBeatmap + { + BeatmapSet = new APIBeatmapSet() + { + Title = "Idolize", + Artist = "Creo", + }, + DifficultyName = "Insane" + }; - var noPPScore = new APIScore + var noPPScore = new SoloScoreInfo { Rank = ScoreRank.B, - Beatmap = new APIBeatmap - { - BeatmapSet = new APIBeatmapSet - { - Title = "C18H27NO3(extend)", - Artist = "Team Grimoire", - }, - DifficultyName = "[4K] Cataclysmic Hypernova" - }, - Date = DateTimeOffset.Now, + BeatmapID = 992512, + EndedAt = DateTimeOffset.Now, Accuracy = 0.55879 }; + var noPPBeatmap = new APIBeatmap + { + BeatmapSet = new APIBeatmapSet() + { + Title = "Galaxy Collapse", + Artist = "Kurokotei", + }, + DifficultyName = "[4K] Cataclysmic Hypernova" + }; Add(new FillFlowContainer { @@ -109,12 +113,12 @@ namespace osu.Game.Tests.Visual.Online Spacing = new Vector2(0, 10), Children = new[] { - new ColourProvidedContainer(OverlayColourScheme.Green, new DrawableProfileScore(firstScore)), - new ColourProvidedContainer(OverlayColourScheme.Green, new DrawableProfileScore(secondScore)), - new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileScore(noPPScore)), - new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(firstScore, 0.97)), - new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(secondScore, 0.85)), - new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(thirdScore, 0.66)), + new ColourProvidedContainer(OverlayColourScheme.Green, new DrawableProfileScore(firstScore, firstBeatmap)), + new ColourProvidedContainer(OverlayColourScheme.Green, new DrawableProfileScore(secondScore, secondBeatmap)), + new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileScore(noPPScore, noPPBeatmap)), + new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(firstScore, firstBeatmap, 0.97)), + new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(secondScore, secondBeatmap, 0.85)), + new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(thirdScore, thirdBeatmap, 0.66)), } }); } From 3a8b5d48b9d4a3c93f83a42734a69a7cb05d6d63 Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 14:09:14 +0100 Subject: [PATCH 2293/2328] update `PaginatedScoreContainer` to use new class and format --- .../Sections/Ranks/PaginatedScoreContainer.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index 15c7b8f042..9af7d59d53 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -17,7 +17,7 @@ using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Overlays.Profile.Sections.Ranks { - public class PaginatedScoreContainer : PaginatedProfileSubsection + public class PaginatedScoreContainer : PaginatedProfileScoreSubsection { private readonly ScoreType type; @@ -54,28 +54,28 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks } } - protected override void OnItemsReceived(List items) + protected override void OnItemsReceived(List> scoreBeatmapPairs) { if (CurrentPage == null || CurrentPage?.Offset == 0) drawableItemIndex = 0; - base.OnItemsReceived(items); + base.OnItemsReceived(scoreBeatmapPairs); } - protected override APIRequest> CreateRequest(PaginationParameters pagination) => + protected override APIRequest> CreateScoreRequest(PaginationParameters pagination) => new GetUserScoresRequest(User.Value.Id, type, pagination); private int drawableItemIndex; - protected override Drawable CreateDrawableItem(APIScore model) + protected override Drawable CreateDrawableItem(Tuple scoreBeatmapPair) { switch (type) { default: - return new DrawableProfileScore(model); + return new DrawableProfileScore(scoreBeatmapPair.Item1, scoreBeatmapPair.Item2); case ScoreType.Best: - return new DrawableProfileWeightedScore(model, Math.Pow(0.95, drawableItemIndex++)); + return new DrawableProfileWeightedScore(scoreBeatmapPair.Item1, scoreBeatmapPair.Item2, Math.Pow(0.95, drawableItemIndex++)); } } } From c2277031f0b7b728d5d6dbdea0dac31f53c9d7e3 Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 14:21:55 +0100 Subject: [PATCH 2294/2328] add `Beatmap` to SoloScoreInfo --- osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs index 6c48c7883f..963b2975d2 100644 --- a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs @@ -82,6 +82,9 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty("user")] public APIUser? User { get; set; } + [JsonProperty("beatmap")] + public APIBeatmap? Beatmap { get; set; } + [JsonProperty("pp")] public double? PP { get; set; } From 7135329c8c3339e3b95861d0311c497d58a843ad Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 14:22:27 +0100 Subject: [PATCH 2295/2328] remove `PaginatedProfileScoreSubsectio, revert profile score drawables --- .../PaginatedProfileScoreSubsection.cs | 193 ------------------ .../Sections/Ranks/DrawableProfileScore.cs | 8 +- .../Ranks/DrawableProfileWeightedScore.cs | 4 +- .../Sections/Ranks/PaginatedScoreContainer.cs | 14 +- 4 files changed, 12 insertions(+), 207 deletions(-) delete mode 100644 osu.Game/Overlays/Profile/Sections/PaginatedProfileScoreSubsection.cs diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedProfileScoreSubsection.cs b/osu.Game/Overlays/Profile/Sections/PaginatedProfileScoreSubsection.cs deleted file mode 100644 index 408d4a96bf..0000000000 --- a/osu.Game/Overlays/Profile/Sections/PaginatedProfileScoreSubsection.cs +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Localisation; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; -using osu.Game.Online.API; -using osu.Game.Graphics.Containers; -using osu.Game.Online.API.Requests; -using osu.Game.Online.API.Requests.Responses; -using osuTK; - -namespace osu.Game.Overlays.Profile.Sections -{ - public abstract class PaginatedProfileScoreSubsection : ProfileSubsection - { - /// - /// The number of items displayed per page. - /// - protected virtual int ItemsPerPage => 50; - - /// - /// The number of items displayed initially. - /// - protected virtual int InitialItemsCount => 5; - - [Resolved] - private IAPIProvider api { get; set; } - - protected PaginationParameters? CurrentPage { get; private set; } - - protected ReverseChildIDFillFlowContainer ItemsContainer { get; private set; } - - private APIRequest> scoreRetrievalRequest; - private APIRequest beatmapRetrievalRequest; - private CancellationTokenSource loadCancellation; - - protected List CurrentScores { get; private set; } = new List(); - - private ShowMoreButton moreButton; - private OsuSpriteText missing; - private readonly LocalisableString? missingText; - - protected PaginatedProfileScoreSubsection(Bindable user, LocalisableString? headerText = null, LocalisableString? missingText = null) - : base(user, headerText, CounterVisibilityState.AlwaysVisible) - { - this.missingText = missingText; - } - - protected override Drawable CreateContent() => new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Children = new Drawable[] - { - // reverse ID flow is required for correct Z-ordering of the items (last item should be front-most). - // particularly important in PaginatedBeatmapContainer, as it uses beatmap cards, which have expandable overhanging content. - ItemsContainer = new ReverseChildIDFillFlowContainer - { - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Spacing = new Vector2(0, 2), - // ensure the container and its contents are in front of the "more" button. - Depth = float.MinValue - }, - moreButton = new ShowMoreButton - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Alpha = 0, - Margin = new MarginPadding { Top = 10 }, - Action = showMore, - }, - missing = new OsuSpriteText - { - Font = OsuFont.GetFont(size: 15), - Text = missingText ?? string.Empty, - Alpha = 0, - } - } - }; - - protected override void LoadComplete() - { - base.LoadComplete(); - User.BindValueChanged(onUserChanged, true); - } - - private void onUserChanged(ValueChangedEvent e) - { - loadCancellation?.Cancel(); - scoreRetrievalRequest?.Cancel(); - beatmapRetrievalRequest?.Cancel(); - - CurrentPage = null; - ItemsContainer.Clear(); - CurrentScores.Clear(); - - if (e.NewValue != null) - { - showMore(); - SetCount(GetCount(e.NewValue)); - } - } - - private void showMore() - { - loadCancellation = new CancellationTokenSource(); - - CurrentPage = CurrentPage?.TakeNext(ItemsPerPage) ?? new PaginationParameters(InitialItemsCount); - - scoreRetrievalRequest = CreateScoreRequest(CurrentPage.Value); - scoreRetrievalRequest.Success += requestBeatmaps; - - api.Queue(scoreRetrievalRequest); - } - - private void requestBeatmaps(List items) - { - CurrentScores = items; - - beatmapRetrievalRequest = CreateBeatmapsRequest(items); - beatmapRetrievalRequest.Success += UpdateItems; - - api.Queue(beatmapRetrievalRequest); - } - - protected virtual APIRequest CreateBeatmapsRequest(List items) => new GetBeatmapsRequest(items.Select(i => i.BeatmapID).ToArray()); - - protected virtual void UpdateItems(GetBeatmapsResponse beatmaps) => Schedule(() => - { - var scoreBeatmapPairs = new List>(); - - foreach (var score in CurrentScores) - { - var beatmap = beatmaps.Beatmaps.Find(m => m.OnlineID == score.BeatmapID); - scoreBeatmapPairs.Add(new Tuple(score, beatmap)); - } - - OnItemsReceived(scoreBeatmapPairs); - - if (!scoreBeatmapPairs.Any() && CurrentPage?.Offset == 0) - { - moreButton.Hide(); - moreButton.IsLoading = false; - - if (missingText.HasValue) - missing.Show(); - - return; - } - - LoadComponentsAsync(scoreBeatmapPairs.Select(CreateDrawableItem).Where(d => d != null), drawables => - { - missing.Hide(); - - moreButton.FadeTo(scoreBeatmapPairs.Count == CurrentPage?.Limit ? 1 : 0); - moreButton.IsLoading = false; - - ItemsContainer.AddRange(drawables); - }, loadCancellation.Token); - }); - - protected virtual int GetCount(APIUser user) => 0; - - protected virtual void OnItemsReceived(List> scoreBeatmapPairs) - { - } - - protected abstract APIRequest> CreateScoreRequest(PaginationParameters pagination); - - protected abstract Drawable CreateDrawableItem(Tuple scoreBeatmapPair); - - protected override void Dispose(bool isDisposing) - { - scoreRetrievalRequest?.Cancel(); - loadCancellation?.Cancel(); - base.Dispose(isDisposing); - } - } -} diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs index 1ff1e0e842..26181e7b40 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs @@ -32,7 +32,6 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks private const float performance_background_shear = 0.45f; protected readonly SoloScoreInfo Score; - protected readonly APIBeatmap Beatmap; [Resolved] private OsuColour colours { get; set; } @@ -40,10 +39,9 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks [Resolved] private OverlayColourProvider colourProvider { get; set; } - public DrawableProfileScore(SoloScoreInfo score, APIBeatmap beatmap) + public DrawableProfileScore(SoloScoreInfo score) { Score = score; - Beatmap = beatmap; RelativeSizeAxes = Axes.X; Height = height; @@ -86,7 +84,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks Spacing = new Vector2(0, 2), Children = new Drawable[] { - new ScoreBeatmapMetadataContainer(Beatmap), + new ScoreBeatmapMetadataContainer(Score.Beatmap), new FillFlowContainer { AutoSizeAxes = Axes.Both, @@ -96,7 +94,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks { new OsuSpriteText { - Text = $"{Beatmap.DifficultyName}", + Text = $"{Score.Beatmap?.DifficultyName}", Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular), Colour = colours.Yellow }, diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileWeightedScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileWeightedScore.cs index 8d0a41ec48..94d95dc27e 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileWeightedScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileWeightedScore.cs @@ -18,8 +18,8 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks { private readonly double weight; - public DrawableProfileWeightedScore(SoloScoreInfo score, APIBeatmap beatmap, double weight) - : base(score, beatmap) + public DrawableProfileWeightedScore(SoloScoreInfo score, double weight) + : base(score) { this.weight = weight; } diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index 9af7d59d53..8378d61119 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -17,7 +17,7 @@ using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Overlays.Profile.Sections.Ranks { - public class PaginatedScoreContainer : PaginatedProfileScoreSubsection + public class PaginatedScoreContainer : PaginatedProfileSubsection { private readonly ScoreType type; @@ -54,28 +54,28 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks } } - protected override void OnItemsReceived(List> scoreBeatmapPairs) + protected override void OnItemsReceived(List items) { if (CurrentPage == null || CurrentPage?.Offset == 0) drawableItemIndex = 0; - base.OnItemsReceived(scoreBeatmapPairs); + base.OnItemsReceived(items); } - protected override APIRequest> CreateScoreRequest(PaginationParameters pagination) => + protected override APIRequest> CreateRequest(PaginationParameters pagination) => new GetUserScoresRequest(User.Value.Id, type, pagination); private int drawableItemIndex; - protected override Drawable CreateDrawableItem(Tuple scoreBeatmapPair) + protected override Drawable CreateDrawableItem(SoloScoreInfo item) { switch (type) { default: - return new DrawableProfileScore(scoreBeatmapPair.Item1, scoreBeatmapPair.Item2); + return new DrawableProfileScore(item); case ScoreType.Best: - return new DrawableProfileWeightedScore(scoreBeatmapPair.Item1, scoreBeatmapPair.Item2, Math.Pow(0.95, drawableItemIndex++)); + return new DrawableProfileWeightedScore(item, Math.Pow(0.95, drawableItemIndex++)); } } } From 14ae183c700b18188f2d00288b4f5c405f21493c Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 14:22:46 +0100 Subject: [PATCH 2296/2328] update tests to match `SoloScoreInfo` --- .../Online/TestSceneUserProfileScores.cs | 88 +++++++++---------- 1 file changed, 42 insertions(+), 46 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs index 33ddf4a3a9..0eb6ec3c04 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs @@ -25,7 +25,15 @@ namespace osu.Game.Tests.Visual.Online { PP = 1047.21, Rank = ScoreRank.SH, - BeatmapID = 2058788, + Beatmap = new APIBeatmap + { + BeatmapSet = new APIBeatmapSet + { + Title = "JUSTadICE (TV Size)", + Artist = "Oomori Seiko", + }, + DifficultyName = "Extreme" + }, EndedAt = DateTimeOffset.Now, Mods = new[] { @@ -35,21 +43,20 @@ namespace osu.Game.Tests.Visual.Online }, Accuracy = 0.9813 }; - var firstBeatmap = new APIBeatmap - { - BeatmapSet = new APIBeatmapSet() - { - Title = "JUSTadICE (TV Size)", - Artist = "Oomori Seiko", - }, - DifficultyName = "Extreme" - }; var secondScore = new SoloScoreInfo { PP = 134.32, Rank = ScoreRank.A, - BeatmapID = 767046, + Beatmap = new APIBeatmap + { + BeatmapSet = new APIBeatmapSet + { + Title = "Triumph & Regret", + Artist = "typeMARS", + }, + DifficultyName = "[4K] Regret" + }, EndedAt = DateTimeOffset.Now, Mods = new[] { @@ -58,50 +65,39 @@ namespace osu.Game.Tests.Visual.Online }, Accuracy = 0.998546 }; - var secondBeatmap = new APIBeatmap - { - BeatmapSet = new APIBeatmapSet() - { - Title = "Triumph & Regret", - Artist = "typeMARS", - }, - DifficultyName = "[4K] Regret" - }; var thirdScore = new SoloScoreInfo { PP = 96.83, Rank = ScoreRank.S, - BeatmapID = 2134713, + Beatmap = new APIBeatmap + { + BeatmapSet = new APIBeatmapSet + { + Title = "Idolize", + Artist = "Creo", + }, + DifficultyName = "Insane" + }, EndedAt = DateTimeOffset.Now, Accuracy = 0.9726 }; - var thirdBeatmap = new APIBeatmap - { - BeatmapSet = new APIBeatmapSet() - { - Title = "Idolize", - Artist = "Creo", - }, - DifficultyName = "Insane" - }; var noPPScore = new SoloScoreInfo { Rank = ScoreRank.B, - BeatmapID = 992512, + Beatmap = new APIBeatmap + { + BeatmapSet = new APIBeatmapSet + { + Title = "C18H27NO3(extend)", + Artist = "Team Grimoire", + }, + DifficultyName = "[4K] Cataclysmic Hypernova" + }, EndedAt = DateTimeOffset.Now, Accuracy = 0.55879 }; - var noPPBeatmap = new APIBeatmap - { - BeatmapSet = new APIBeatmapSet() - { - Title = "Galaxy Collapse", - Artist = "Kurokotei", - }, - DifficultyName = "[4K] Cataclysmic Hypernova" - }; Add(new FillFlowContainer { @@ -113,12 +109,12 @@ namespace osu.Game.Tests.Visual.Online Spacing = new Vector2(0, 10), Children = new[] { - new ColourProvidedContainer(OverlayColourScheme.Green, new DrawableProfileScore(firstScore, firstBeatmap)), - new ColourProvidedContainer(OverlayColourScheme.Green, new DrawableProfileScore(secondScore, secondBeatmap)), - new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileScore(noPPScore, noPPBeatmap)), - new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(firstScore, firstBeatmap, 0.97)), - new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(secondScore, secondBeatmap, 0.85)), - new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(thirdScore, thirdBeatmap, 0.66)), + new ColourProvidedContainer(OverlayColourScheme.Green, new DrawableProfileScore(firstScore)), + new ColourProvidedContainer(OverlayColourScheme.Green, new DrawableProfileScore(secondScore)), + new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileScore(noPPScore)), + new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(firstScore, 0.97)), + new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(secondScore, 0.85)), + new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(thirdScore, 0.66)), } }); } From c73eff7c890014fbec8a30a1304eb424216bd7d2 Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 14:46:22 +0100 Subject: [PATCH 2297/2328] add `BeatmapSet` to `SoloScoreInfo` --- osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs index 963b2975d2..e7abb28286 100644 --- a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs @@ -85,6 +85,9 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty("beatmap")] public APIBeatmap? Beatmap { get; set; } + [JsonProperty("beatmapset")] + public APIBeatmapSet? BeatmapSet { get; set; } + [JsonProperty("pp")] public double? PP { get; set; } From 486fbd25315c56835a1dd3ce67f2fef503aaa6cf Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 14:47:04 +0100 Subject: [PATCH 2298/2328] create instance of `BeatmapInfo` for use in `ScoreBeatmapMetadataContainer` --- .../Sections/Ranks/DrawableProfileScore.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs index 26181e7b40..c11a99808e 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs @@ -50,6 +50,24 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks [BackgroundDependencyLoader] private void load(RulesetStore rulesets) { + var beatmapSet = Score.BeatmapSet ?? Score.Beatmap?.BeatmapSet; + var beatmapInfo = new BeatmapInfo(); + + if (beatmapSet != null) + { + var beatmapMetadata = new BeatmapMetadata + { + Artist = beatmapSet.Artist, + ArtistUnicode = beatmapSet.ArtistUnicode, + Title = beatmapSet.Title, + TitleUnicode = beatmapSet.TitleUnicode, + }; + + beatmapInfo.Metadata = beatmapMetadata; + if (Score.Beatmap?.DifficultyName != null) + beatmapInfo.DifficultyName = Score.Beatmap.DifficultyName; + } + AddInternal(new ProfileItemContainer { Children = new Drawable[] @@ -84,7 +102,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks Spacing = new Vector2(0, 2), Children = new Drawable[] { - new ScoreBeatmapMetadataContainer(Score.Beatmap), + new ScoreBeatmapMetadataContainer(beatmapInfo), new FillFlowContainer { AutoSizeAxes = Axes.Both, From 7a6666996fef438427666806bbfbffe9b934d872 Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 14:50:53 +0100 Subject: [PATCH 2299/2328] rename `item` to `model` in `CreateDrawableItem` --- .../Profile/Sections/Ranks/PaginatedScoreContainer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index 8378d61119..2564692c87 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -67,15 +67,15 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks private int drawableItemIndex; - protected override Drawable CreateDrawableItem(SoloScoreInfo item) + protected override Drawable CreateDrawableItem(SoloScoreInfo model) { switch (type) { default: - return new DrawableProfileScore(item); + return new DrawableProfileScore(model); case ScoreType.Best: - return new DrawableProfileWeightedScore(item, Math.Pow(0.95, drawableItemIndex++)); + return new DrawableProfileWeightedScore(model, Math.Pow(0.95, drawableItemIndex++)); } } } From 1caab78bdc38dcc512831a88809749db334837f7 Mon Sep 17 00:00:00 2001 From: NotGumballer91 <64581009+NotGumballer91@users.noreply.github.com> Date: Mon, 18 Jul 2022 00:09:31 +0800 Subject: [PATCH 2300/2328] Update ModAutoplay.cs --- osu.Game/Rulesets/Mods/ModAutoplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Mods/ModAutoplay.cs b/osu.Game/Rulesets/Mods/ModAutoplay.cs index 6d786fc8e2..b4ab0500c7 100644 --- a/osu.Game/Rulesets/Mods/ModAutoplay.cs +++ b/osu.Game/Rulesets/Mods/ModAutoplay.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mods public override bool ValidForMultiplayer => false; public override bool ValidForMultiplayerAsFreeMod => false; - public override Type[] IncompatibleMods => new[] { typeof(ModCinema), typeof(ModRelax), typeof(ModFailCondition), typeof(ModNoFail) }; + public override Type[] IncompatibleMods => new[] { typeof(ModCinema), typeof(ModRelax), typeof(ModFailCondition), typeof(ModNoFail), typeof(ModAdaptiveSpeed) }; public override bool HasImplementation => GetType().GenericTypeArguments.Length == 0; From 028653eb97ef47051b6c21dc7156ecbb45a24eed Mon Sep 17 00:00:00 2001 From: NotGumballer91 <64581009+NotGumballer91@users.noreply.github.com> Date: Mon, 18 Jul 2022 00:10:49 +0800 Subject: [PATCH 2301/2328] Update ModAdaptiveSpeed.cs --- osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs index aea6e12a07..eab0f8dc26 100644 --- a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs +++ b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Mods public override bool ValidForMultiplayer => false; public override bool ValidForMultiplayerAsFreeMod => false; - public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModTimeRamp) }; + public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModTimeRamp), typeof(ModAutoplay) }; [SettingSource("Initial rate", "The starting speed of the track")] public BindableNumber InitialRate { get; } = new BindableDouble From 4e8bf1da52b2c410bd5739a8b14eb0926cf9b7e3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Jul 2022 01:23:46 +0900 Subject: [PATCH 2302/2328] Don't sent ruleset configuration failures to sentry --- osu.Game/Overlays/Settings/Sections/RulesetSection.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/RulesetSection.cs b/osu.Game/Overlays/Settings/Sections/RulesetSection.cs index 2368459b4e..a5f5810214 100644 --- a/osu.Game/Overlays/Settings/Sections/RulesetSection.cs +++ b/osu.Game/Overlays/Settings/Sections/RulesetSection.cs @@ -1,17 +1,14 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - -using System; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Framework.Logging; -using osu.Game.Rulesets; using osu.Game.Localisation; +using osu.Game.Rulesets; namespace osu.Game.Overlays.Settings.Sections { @@ -36,9 +33,9 @@ namespace osu.Game.Overlays.Settings.Sections if (section != null) Add(section); } - catch (Exception e) + catch { - Logger.Error(e, "Failed to load ruleset settings"); + Logger.Log($"Failed to load ruleset settings for {ruleset.RulesetInfo.Name}. Please check for an update from the developer.", level: LogLevel.Error); } } } From 8791edf84c1ca5b2500dcb7b80ddcd058b952f69 Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 18:10:33 +0100 Subject: [PATCH 2303/2328] set `Beatmap.BeatmapSet` to `BeatmapSet` property in `SoloScoreInfo` --- .../API/Requests/Responses/SoloScoreInfo.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs index e7abb28286..d8adbbb9ad 100644 --- a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using JetBrains.Annotations; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using osu.Game.Beatmaps; @@ -86,7 +87,19 @@ namespace osu.Game.Online.API.Requests.Responses public APIBeatmap? Beatmap { get; set; } [JsonProperty("beatmapset")] - public APIBeatmapSet? BeatmapSet { get; set; } + [CanBeNull] + public APIBeatmapSet BeatmapSet + { + set + { + // in the deserialisation case we need to ferry this data across. + // the order of properties returned by the API guarantees that the beatmap is populated by this point. + if (!(Beatmap is APIBeatmap apiBeatmap)) + throw new InvalidOperationException("Beatmap set metadata arrived before beatmap metadata in response"); + + apiBeatmap.BeatmapSet = value; + } + } [JsonProperty("pp")] public double? PP { get; set; } From a5d7075ef171b2d0ba50a9ac6b6c3f4e3c48331b Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 18:10:47 +0100 Subject: [PATCH 2304/2328] simplify beatmap metadata logic in `DrawableProfileScore` --- .../Sections/Ranks/DrawableProfileScore.cs | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs index c11a99808e..26181e7b40 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs @@ -50,24 +50,6 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks [BackgroundDependencyLoader] private void load(RulesetStore rulesets) { - var beatmapSet = Score.BeatmapSet ?? Score.Beatmap?.BeatmapSet; - var beatmapInfo = new BeatmapInfo(); - - if (beatmapSet != null) - { - var beatmapMetadata = new BeatmapMetadata - { - Artist = beatmapSet.Artist, - ArtistUnicode = beatmapSet.ArtistUnicode, - Title = beatmapSet.Title, - TitleUnicode = beatmapSet.TitleUnicode, - }; - - beatmapInfo.Metadata = beatmapMetadata; - if (Score.Beatmap?.DifficultyName != null) - beatmapInfo.DifficultyName = Score.Beatmap.DifficultyName; - } - AddInternal(new ProfileItemContainer { Children = new Drawable[] @@ -102,7 +84,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks Spacing = new Vector2(0, 2), Children = new Drawable[] { - new ScoreBeatmapMetadataContainer(beatmapInfo), + new ScoreBeatmapMetadataContainer(Score.Beatmap), new FillFlowContainer { AutoSizeAxes = Axes.Both, From 032cc6c670869cf2414f398c9ed1d8cdda4c3eac Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 18:15:36 +0100 Subject: [PATCH 2305/2328] use type annotation for nullable `BeatmapSet` --- osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs index d8adbbb9ad..21443280b6 100644 --- a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs @@ -87,8 +87,7 @@ namespace osu.Game.Online.API.Requests.Responses public APIBeatmap? Beatmap { get; set; } [JsonProperty("beatmapset")] - [CanBeNull] - public APIBeatmapSet BeatmapSet + public APIBeatmapSet? BeatmapSet { set { From 5875f53e07198ec5b367e0325a6ad0cd092b991e Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 18:16:30 +0100 Subject: [PATCH 2306/2328] remove unused import --- osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs index 21443280b6..393597dbfe 100644 --- a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using JetBrains.Annotations; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using osu.Game.Beatmaps; From e13c1254e5211c459c00a4a84a4a63151d66035a Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 20:41:43 +0100 Subject: [PATCH 2307/2328] make perfect incompatible with autopilot --- osu.Game.Rulesets.Osu/Mods/OsuModPerfect.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModPerfect.cs b/osu.Game.Rulesets.Osu/Mods/OsuModPerfect.cs index c5795177d0..1b12aab150 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModPerfect.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModPerfect.cs @@ -3,11 +3,14 @@ #nullable disable +using System; +using System.Linq; using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Osu.Mods { public class OsuModPerfect : ModPerfect { + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new Type[] { typeof(OsuModAutopilot) }).ToArray(); } } From 491558261f4163f1f06e0b16f7cffe7a255e9af1 Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 20:44:06 +0100 Subject: [PATCH 2308/2328] remove unnecessary type-specification --- osu.Game.Rulesets.Osu/Mods/OsuModPerfect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModPerfect.cs b/osu.Game.Rulesets.Osu/Mods/OsuModPerfect.cs index 1b12aab150..bde7718da5 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModPerfect.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModPerfect.cs @@ -11,6 +11,6 @@ namespace osu.Game.Rulesets.Osu.Mods { public class OsuModPerfect : ModPerfect { - public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new Type[] { typeof(OsuModAutopilot) }).ToArray(); + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray(); } } From 83429d2f221567198f19b1a618f785a260ad578f Mon Sep 17 00:00:00 2001 From: tsunyoku Date: Sun, 17 Jul 2022 20:45:17 +0100 Subject: [PATCH 2309/2328] make cinema incompatible with repel --- osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs b/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs index 704b922ee5..d5096619b9 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public class OsuModCinema : ModCinema { - public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModMagnetised), typeof(OsuModAutopilot), typeof(OsuModSpunOut), typeof(OsuModAlternate), typeof(OsuModSingleTap) }).ToArray(); + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModMagnetised), typeof(OsuModAutopilot), typeof(OsuModSpunOut), typeof(OsuModAlternate), typeof(OsuModSingleTap), typeof(OsuModRepel) }).ToArray(); public override ModReplayData CreateReplayData(IBeatmap beatmap, IReadOnlyList mods) => new ModReplayData(new OsuAutoGenerator(beatmap, mods).Generate(), new ModCreatedUser { Username = "Autoplay" }); From 7e4ce899814167ee3dee340597b28e49b881c201 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Jul 2022 04:03:18 +0300 Subject: [PATCH 2310/2328] Include mod settings in profile score mod icons --- .../Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs index 26181e7b40..c5e2b6df0c 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs @@ -138,7 +138,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks { var ruleset = rulesets.GetRuleset(Score.RulesetID) ?? throw new InvalidOperationException($"Ruleset with ID of {Score.RulesetID} not found locally"); - return new ModIcon(ruleset.CreateInstance().CreateModFromAcronym(mod.Acronym)) + return new ModIcon(mod.ToMod(ruleset.CreateInstance())) { Scale = new Vector2(0.35f) }; From b33f8aa0fcdb3d4ace4d3054d4811c86e1f72aec Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Jul 2022 06:45:00 +0300 Subject: [PATCH 2311/2328] Fix "Start Chat" on multiplayer/playlist chat not opening overlay --- osu.Game/Overlays/Chat/ChatLine.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index 5961298485..4c425d3d4c 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -257,10 +257,14 @@ namespace osu.Game.Overlays.Chat } [BackgroundDependencyLoader] - private void load(UserProfileOverlay? profile, ChannelManager? chatManager) + private void load(UserProfileOverlay? profile, ChannelManager? chatManager, ChatOverlay? chatOverlay) { Action = () => profile?.ShowUser(sender); - startChatAction = () => chatManager?.OpenPrivateChannel(sender); + startChatAction = () => + { + chatManager?.OpenPrivateChannel(sender); + chatOverlay?.Show(); + }; } public MenuItem[] ContextMenuItems From 6ad7723d60700ee25c95113f6f806caaf29bdc67 Mon Sep 17 00:00:00 2001 From: Fyra Tedja Date: Sun, 17 Jul 2022 22:13:08 -0600 Subject: [PATCH 2312/2328] Make sure stats name are title-cased when score panel is contracted --- .../Screens/Ranking/Contracted/ContractedPanelMiddleContent.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/Contracted/ContractedPanelMiddleContent.cs b/osu.Game/Screens/Ranking/Contracted/ContractedPanelMiddleContent.cs index 7b8b4ce608..3e67868f34 100644 --- a/osu.Game/Screens/Ranking/Contracted/ContractedPanelMiddleContent.cs +++ b/osu.Game/Screens/Ranking/Contracted/ContractedPanelMiddleContent.cs @@ -6,6 +6,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; @@ -214,7 +215,7 @@ namespace osu.Game.Screens.Ranking.Contracted { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Text = key, + Text = key.ToTitle(), Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold) }, new OsuSpriteText From 0533249d11ac220e223369f774fafcabc3f30c51 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Jul 2022 14:34:02 +0900 Subject: [PATCH 2313/2328] Update all `OnlineSpectatorCalls` to `InvokeAsync` --- osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs | 1 - osu.Game/Online/Spectator/OnlineSpectatorClient.cs | 9 ++++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs index 4e6ea997c1..c061398209 100644 --- a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs @@ -80,7 +80,6 @@ namespace osu.Game.Online.Multiplayer try { - // Importantly, use Invoke rather than Send to capture exceptions. return await connection.InvokeAsync(nameof(IMultiplayerServer.JoinRoomWithPassword), roomId, password ?? string.Empty); } catch (HubException exception) diff --git a/osu.Game/Online/Spectator/OnlineSpectatorClient.cs b/osu.Game/Online/Spectator/OnlineSpectatorClient.cs index 1ed7819b05..2a05fb1bc0 100644 --- a/osu.Game/Online/Spectator/OnlineSpectatorClient.cs +++ b/osu.Game/Online/Spectator/OnlineSpectatorClient.cs @@ -56,7 +56,6 @@ namespace osu.Game.Online.Spectator try { - // Importantly, use Invoke rather than Send to capture exceptions. await connection.InvokeAsync(nameof(ISpectatorServer.BeginPlaySession), state); } catch (HubException exception) @@ -74,7 +73,7 @@ namespace osu.Game.Online.Spectator Debug.Assert(connection != null); - return connection.SendAsync(nameof(ISpectatorServer.SendFrameData), bundle); + return connection.InvokeAsync(nameof(ISpectatorServer.SendFrameData), bundle); } protected override Task EndPlayingInternal(SpectatorState state) @@ -84,7 +83,7 @@ namespace osu.Game.Online.Spectator Debug.Assert(connection != null); - return connection.SendAsync(nameof(ISpectatorServer.EndPlaySession), state); + return connection.InvokeAsync(nameof(ISpectatorServer.EndPlaySession), state); } protected override Task WatchUserInternal(int userId) @@ -94,7 +93,7 @@ namespace osu.Game.Online.Spectator Debug.Assert(connection != null); - return connection.SendAsync(nameof(ISpectatorServer.StartWatchingUser), userId); + return connection.InvokeAsync(nameof(ISpectatorServer.StartWatchingUser), userId); } protected override Task StopWatchingUserInternal(int userId) @@ -104,7 +103,7 @@ namespace osu.Game.Online.Spectator Debug.Assert(connection != null); - return connection.SendAsync(nameof(ISpectatorServer.EndWatchingUser), userId); + return connection.InvokeAsync(nameof(ISpectatorServer.EndWatchingUser), userId); } } } From 100c53f9ef24e2fd66743aa81dcc0624ae5f23df Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Jul 2022 08:40:34 +0300 Subject: [PATCH 2314/2328] `Country` -> `CountryCode` --- .../Visual/Online/TestSceneFriendDisplay.cs | 6 ++--- .../Online/TestSceneRankingsCountryFilter.cs | 6 ++--- .../Visual/Online/TestSceneRankingsHeader.cs | 6 ++--- .../Visual/Online/TestSceneRankingsOverlay.cs | 8 +++---- .../Visual/Online/TestSceneRankingsTables.cs | 10 ++++---- .../Visual/Online/TestSceneScoresContainer.cs | 12 +++++----- .../Visual/Online/TestSceneUserPanel.cs | 6 ++--- .../Online/TestSceneUserProfileOverlay.cs | 8 +++---- .../SongSelect/TestSceneBeatmapLeaderboard.cs | 24 +++++++++---------- .../TestSceneUserTopScoreContainer.cs | 6 ++--- osu.Game.Tournament/Models/TournamentUser.cs | 4 ++-- osu.Game.Tournament/TournamentGameBase.cs | 4 ++-- .../API/Requests/GetUserRankingsRequest.cs | 10 ++++---- .../Online/Leaderboards/LeaderboardScore.cs | 2 +- .../Overlays/BeatmapSet/Scores/ScoreTable.cs | 2 +- .../BeatmapSet/Scores/TopScoreUserSection.cs | 2 +- .../Profile/Header/TopHeaderContainer.cs | 4 ++-- osu.Game/Overlays/Rankings/CountryFilter.cs | 8 +++---- osu.Game/Overlays/Rankings/CountryPill.cs | 10 ++++---- .../Rankings/RankingsOverlayHeader.cs | 2 +- .../Rankings/Tables/CountriesTable.cs | 10 ++++---- .../Overlays/Rankings/Tables/RankingsTable.cs | 4 ++-- .../Rankings/Tables/UserBasedTable.cs | 2 +- osu.Game/Overlays/RankingsOverlay.cs | 6 ++--- .../Participants/ParticipantPanel.cs | 2 +- osu.Game/Users/{Country.cs => CountryCode.cs} | 2 +- osu.Game/Users/CountryStatistics.cs | 2 +- osu.Game/Users/Drawables/DrawableFlag.cs | 10 ++++---- osu.Game/Users/Drawables/UpdateableFlag.cs | 16 ++++++------- osu.Game/Users/ExtendedUserPanel.cs | 2 +- 30 files changed, 98 insertions(+), 98 deletions(-) rename osu.Game/Users/{Country.cs => CountryCode.cs} (99%) diff --git a/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs b/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs index 43d41e9fb9..5454c87dff 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs @@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual.Online Id = 3103765, IsOnline = true, Statistics = new UserStatistics { GlobalRank = 1111 }, - Country = Country.JP, + CountryCode = CountryCode.JP, CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" }, new APIUser @@ -64,7 +64,7 @@ namespace osu.Game.Tests.Visual.Online Id = 2, IsOnline = false, Statistics = new UserStatistics { GlobalRank = 2222 }, - Country = Country.AU, + CountryCode = CountryCode.AU, CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", IsSupporter = true, SupportLevel = 3, @@ -73,7 +73,7 @@ namespace osu.Game.Tests.Visual.Online { Username = "Evast", Id = 8195163, - Country = Country.BY, + CountryCode = CountryCode.BY, CoverUrl = "https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg", IsOnline = false, LastVisit = DateTimeOffset.Now diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs index ce0ca0b6c9..6a39db4870 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs @@ -23,7 +23,7 @@ namespace osu.Game.Tests.Visual.Online public TestSceneRankingsCountryFilter() { - var countryBindable = new Bindable(); + var countryBindable = new Bindable(); AddRange(new Drawable[] { @@ -56,8 +56,8 @@ namespace osu.Game.Tests.Visual.Online } }); - const Country country = Country.BY; - const Country unknown_country = Country.CK; + const CountryCode country = CountryCode.BY; + const CountryCode unknown_country = CountryCode.CK; AddStep("Set country", () => countryBindable.Value = country); AddStep("Set default country", () => countryBindable.Value = default); diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs index 9aedfb0a14..c776cfe377 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs @@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.Online public TestSceneRankingsHeader() { - var countryBindable = new Bindable(); + var countryBindable = new Bindable(); var ruleset = new Bindable(); var scope = new Bindable(); @@ -30,8 +30,8 @@ namespace osu.Game.Tests.Visual.Online Ruleset = { BindTarget = ruleset } }); - const Country country = Country.BY; - const Country unknown_country = Country.CK; + const CountryCode country = CountryCode.BY; + const CountryCode unknown_country = CountryCode.CK; AddStep("Set country", () => countryBindable.Value = country); AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score); diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs index ea7eb14c8e..7f4b1284a0 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs @@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual.Online private TestRankingsOverlay rankingsOverlay; - private readonly Bindable countryBindable = new Bindable(); + private readonly Bindable countryBindable = new Bindable(); private readonly Bindable scope = new Bindable(); [SetUp] @@ -49,14 +49,14 @@ namespace osu.Game.Tests.Visual.Online { AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score); AddAssert("Check country is default", () => countryBindable.Value == default); - AddStep("Set country", () => countryBindable.Value = Country.US); + AddStep("Set country", () => countryBindable.Value = CountryCode.US); AddAssert("Check scope is Performance", () => scope.Value == RankingsScope.Performance); } [Test] public void TestShowCountry() { - AddStep("Show US", () => rankingsOverlay.ShowCountry(Country.US)); + AddStep("Show US", () => rankingsOverlay.ShowCountry(CountryCode.US)); } private void loadRankingsOverlay() @@ -71,7 +71,7 @@ namespace osu.Game.Tests.Visual.Online private class TestRankingsOverlay : RankingsOverlay { - public new Bindable Country => base.Country; + public new Bindable Country => base.Country; } } } diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs index f889e3f7dd..81b76d19ac 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs @@ -57,7 +57,7 @@ namespace osu.Game.Tests.Visual.Online { new CountryStatistics { - Country = Country.US, + Code = CountryCode.US, ActiveUsers = 2_972_623, PlayCount = 3_086_515_743, RankedScore = 449_407_643_332_546, @@ -65,7 +65,7 @@ namespace osu.Game.Tests.Visual.Online }, new CountryStatistics { - Country = Country.RU, + Code = CountryCode.RU, ActiveUsers = 1_609_989, PlayCount = 1_637_052_841, RankedScore = 221_660_827_473_004, @@ -84,7 +84,7 @@ namespace osu.Game.Tests.Visual.Online User = new APIUser { Username = "first active user", - Country = Country.JP, + CountryCode = CountryCode.JP, Active = true, }, Accuracy = 0.9972, @@ -104,7 +104,7 @@ namespace osu.Game.Tests.Visual.Online User = new APIUser { Username = "inactive user", - Country = Country.AU, + CountryCode = CountryCode.AU, Active = false, }, Accuracy = 0.9831, @@ -124,7 +124,7 @@ namespace osu.Game.Tests.Visual.Online User = new APIUser { Username = "second active user", - Country = Country.PL, + CountryCode = CountryCode.PL, Active = true, }, Accuracy = 0.9584, diff --git a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs index 6ac3d5cb86..beca3a8700 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs @@ -157,7 +157,7 @@ namespace osu.Game.Tests.Visual.Online { Id = 6602580, Username = @"waaiiru", - Country = Country.ES, + CountryCode = CountryCode.ES, }, Mods = new[] { @@ -180,7 +180,7 @@ namespace osu.Game.Tests.Visual.Online { Id = 4608074, Username = @"Skycries", - Country = Country.BR, + CountryCode = CountryCode.BR, }, Mods = new[] { @@ -202,7 +202,7 @@ namespace osu.Game.Tests.Visual.Online { Id = 1014222, Username = @"eLy", - Country = Country.JP, + CountryCode = CountryCode.JP, }, Mods = new[] { @@ -223,7 +223,7 @@ namespace osu.Game.Tests.Visual.Online { Id = 1541390, Username = @"Toukai", - Country = Country.CA, + CountryCode = CountryCode.CA, }, Mods = new[] { @@ -243,7 +243,7 @@ namespace osu.Game.Tests.Visual.Online { Id = 7151382, Username = @"Mayuri Hana", - Country = Country.TH, + CountryCode = CountryCode.TH, }, Rank = ScoreRank.D, PP = 160, @@ -282,7 +282,7 @@ namespace osu.Game.Tests.Visual.Online { Id = 7151382, Username = @"Mayuri Hana", - Country = Country.TH, + CountryCode = CountryCode.TH, }, Rank = ScoreRank.D, PP = 160, diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs index addcf799e3..2a70fd7df3 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs @@ -60,7 +60,7 @@ namespace osu.Game.Tests.Visual.Online { Username = @"flyte", Id = 3103765, - Country = Country.JP, + CountryCode = CountryCode.JP, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg", Status = { Value = new UserStatusOnline() } }) { Width = 300 }, @@ -68,7 +68,7 @@ namespace osu.Game.Tests.Visual.Online { Username = @"peppy", Id = 2, - Country = Country.AU, + CountryCode = CountryCode.AU, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", IsSupporter = true, SupportLevel = 3, @@ -77,7 +77,7 @@ namespace osu.Game.Tests.Visual.Online { Username = @"Evast", Id = 8195163, - Country = Country.BY, + CountryCode = CountryCode.BY, CoverUrl = @"https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg", IsOnline = false, LastVisit = DateTimeOffset.Now diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs index dd6b022624..c2766e2142 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Online { Username = @"Somebody", Id = 1, - Country = Country.XX, + CountryCode = CountryCode.XX, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg", JoinDate = DateTimeOffset.Now.AddDays(-1), LastVisit = DateTimeOffset.Now, @@ -82,7 +82,7 @@ namespace osu.Game.Tests.Visual.Online Username = @"peppy", Id = 2, IsSupporter = true, - Country = Country.AU, + CountryCode = CountryCode.AU, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg" })); @@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual.Online { Username = @"flyte", Id = 3103765, - Country = Country.JP, + CountryCode = CountryCode.JP, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" })); @@ -99,7 +99,7 @@ namespace osu.Game.Tests.Visual.Online Username = @"BanchoBot", Id = 3, IsBot = true, - Country = Country.SH, + CountryCode = CountryCode.SH, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c4.jpg" })); diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs index 48fdf671f1..abcb888cd4 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs @@ -140,7 +140,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 6602580, Username = @"waaiiru", - Country = Country.ES, + CountryCode = CountryCode.ES, }, }); } @@ -160,7 +160,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 6602580, Username = @"waaiiru", - Country = Country.ES, + CountryCode = CountryCode.ES, } }); } @@ -217,7 +217,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 6602580, Username = @"waaiiru", - Country = Country.ES, + CountryCode = CountryCode.ES, }, }, new ScoreInfo @@ -234,7 +234,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 4608074, Username = @"Skycries", - Country = Country.BR, + CountryCode = CountryCode.BR, }, }, new ScoreInfo @@ -252,7 +252,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 1014222, Username = @"eLy", - Country = Country.JP, + CountryCode = CountryCode.JP, }, }, new ScoreInfo @@ -270,7 +270,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 1541390, Username = @"Toukai", - Country = Country.CA, + CountryCode = CountryCode.CA, }, }, new ScoreInfo @@ -288,7 +288,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 2243452, Username = @"Satoruu", - Country = Country.VE, + CountryCode = CountryCode.VE, }, }, new ScoreInfo @@ -306,7 +306,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 2705430, Username = @"Mooha", - Country = Country.FR, + CountryCode = CountryCode.FR, }, }, new ScoreInfo @@ -324,7 +324,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 7151382, Username = @"Mayuri Hana", - Country = Country.TH, + CountryCode = CountryCode.TH, }, }, new ScoreInfo @@ -342,7 +342,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 2051389, Username = @"FunOrange", - Country = Country.CA, + CountryCode = CountryCode.CA, }, }, new ScoreInfo @@ -360,7 +360,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 6169483, Username = @"-Hebel-", - Country = Country.MX, + CountryCode = CountryCode.MX, }, }, new ScoreInfo @@ -378,7 +378,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 6702666, Username = @"prhtnsm", - Country = Country.DE, + CountryCode = CountryCode.DE, }, }, }; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs index 5356e74eae..39fd9fda2b 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs @@ -69,7 +69,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 6602580, Username = @"waaiiru", - Country = Country.ES, + CountryCode = CountryCode.ES, }, }, new ScoreInfo @@ -84,7 +84,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 4608074, Username = @"Skycries", - Country = Country.BR, + CountryCode = CountryCode.BR, }, }, new ScoreInfo @@ -99,7 +99,7 @@ namespace osu.Game.Tests.Visual.SongSelect { Id = 1541390, Username = @"Toukai", - Country = Country.CA, + CountryCode = CountryCode.CA, }, } }; diff --git a/osu.Game.Tournament/Models/TournamentUser.cs b/osu.Game.Tournament/Models/TournamentUser.cs index 7faf6d1798..78ca014860 100644 --- a/osu.Game.Tournament/Models/TournamentUser.cs +++ b/osu.Game.Tournament/Models/TournamentUser.cs @@ -23,7 +23,7 @@ namespace osu.Game.Tournament.Models /// The player's country. /// [JsonProperty("country_code")] - public Country Country { get; set; } + public CountryCode CountryCode { get; set; } /// /// The player's global rank, or null if not available. @@ -41,7 +41,7 @@ namespace osu.Game.Tournament.Models { Id = OnlineID, Username = Username, - Country = Country, + CountryCode = CountryCode, CoverUrl = CoverUrl, }; diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 853ccec83c..afeb58fde8 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -187,7 +187,7 @@ namespace osu.Game.Tournament var playersRequiringPopulation = ladder.Teams .SelectMany(t => t.Players) .Where(p => string.IsNullOrEmpty(p.Username) - || p.Country == default + || p.CountryCode == default || p.Rank == null).ToList(); if (playersRequiringPopulation.Count == 0) @@ -290,7 +290,7 @@ namespace osu.Game.Tournament user.Username = res.Username; user.CoverUrl = res.CoverUrl; - user.Country = res.Country; + user.CountryCode = res.CountryCode; user.Rank = res.Statistics?.GlobalRank; success?.Invoke(); diff --git a/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs b/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs index 75088675bd..c55e7d65b6 100644 --- a/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs @@ -13,21 +13,21 @@ namespace osu.Game.Online.API.Requests { public readonly UserRankingsType Type; - private readonly Country country; + private readonly CountryCode countryCode; - public GetUserRankingsRequest(RulesetInfo ruleset, UserRankingsType type = UserRankingsType.Performance, int page = 1, Country country = default) + public GetUserRankingsRequest(RulesetInfo ruleset, UserRankingsType type = UserRankingsType.Performance, int page = 1, CountryCode countryCode = default) : base(ruleset, page) { Type = type; - this.country = country; + this.countryCode = countryCode; } protected override WebRequest CreateWebRequest() { var req = base.CreateWebRequest(); - if (country != default) - req.AddParameter("country", country.ToString()); + if (countryCode != default) + req.AddParameter("country", countryCode.ToString()); return req; } diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index 62827f50aa..a7b6bd044d 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -181,7 +181,7 @@ namespace osu.Game.Online.Leaderboards Masking = true, Children = new Drawable[] { - new UpdateableFlag(user.Country) + new UpdateableFlag(user.CountryCode) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 669b701d1d..6acc9bf002 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -165,7 +165,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Font = OsuFont.GetFont(size: text_size), Colour = score.Accuracy == 1 ? highAccuracyColour : Color4.White }, - new UpdateableFlag(score.User.Country) + new UpdateableFlag(score.User.CountryCode) { Size = new Vector2(19, 14), ShowPlaceholderOnUnknown = false, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs index 85c8f92a76..2eaa03a05d 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs @@ -141,7 +141,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores set { avatar.User = value.User; - flag.Country = value.User.Country; + flag.CountryCode = value.User.CountryCode; achievedOn.Date = value.Date; usernameText.Clear(); diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index a213f99701..7e079c8341 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -175,8 +175,8 @@ namespace osu.Game.Overlays.Profile.Header avatar.User = user; usernameText.Text = user?.Username ?? string.Empty; openUserExternally.Link = $@"{api.WebsiteRootUrl}/users/{user?.Id ?? 0}"; - userFlag.Country = user?.Country ?? default; - userCountryText.Text = (user?.Country ?? default).GetDescription(); + userFlag.CountryCode = user?.CountryCode ?? default; + userCountryText.Text = (user?.CountryCode ?? default).GetDescription(); supporterTag.SupportLevel = user?.SupportLevel ?? 0; titleText.Text = user?.Title ?? string.Empty; titleText.Colour = Color4Extensions.FromHex(user?.Colour ?? "fff"); diff --git a/osu.Game/Overlays/Rankings/CountryFilter.cs b/osu.Game/Overlays/Rankings/CountryFilter.cs index 469d92a771..3ad677e976 100644 --- a/osu.Game/Overlays/Rankings/CountryFilter.cs +++ b/osu.Game/Overlays/Rankings/CountryFilter.cs @@ -16,14 +16,14 @@ using osuTK; namespace osu.Game.Overlays.Rankings { - public class CountryFilter : CompositeDrawable, IHasCurrentValue + public class CountryFilter : CompositeDrawable, IHasCurrentValue { private const int duration = 200; private const int height = 70; - private readonly BindableWithCurrent current = new BindableWithCurrent(); + private readonly BindableWithCurrent current = new BindableWithCurrent(); - public Bindable Current + public Bindable Current { get => current.Current; set => current.Current = value; @@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Rankings Current.BindValueChanged(onCountryChanged, true); } - private void onCountryChanged(ValueChangedEvent country) + private void onCountryChanged(ValueChangedEvent country) { if (country.NewValue == default) { diff --git a/osu.Game/Overlays/Rankings/CountryPill.cs b/osu.Game/Overlays/Rankings/CountryPill.cs index 96d677611e..610efbcc60 100644 --- a/osu.Game/Overlays/Rankings/CountryPill.cs +++ b/osu.Game/Overlays/Rankings/CountryPill.cs @@ -22,13 +22,13 @@ using osuTK.Graphics; namespace osu.Game.Overlays.Rankings { - public class CountryPill : CompositeDrawable, IHasCurrentValue + public class CountryPill : CompositeDrawable, IHasCurrentValue { private const int duration = 200; - private readonly BindableWithCurrent current = new BindableWithCurrent(); + private readonly BindableWithCurrent current = new BindableWithCurrent(); - public Bindable Current + public Bindable Current { get => current.Current; set => current.Current = value; @@ -131,12 +131,12 @@ namespace osu.Game.Overlays.Rankings this.FadeOut(duration, Easing.OutQuint); } - private void onCountryChanged(ValueChangedEvent country) + private void onCountryChanged(ValueChangedEvent country) { if (country.NewValue == default) return; - flag.Country = country.NewValue; + flag.CountryCode = country.NewValue; countryName.Text = country.NewValue.GetDescription(); } diff --git a/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs b/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs index 9b0b75f663..936545bd49 100644 --- a/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs +++ b/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Rankings { public Bindable Ruleset => rulesetSelector.Current; - public Bindable Country => countryFilter.Current; + public Bindable Country => countryFilter.Current; private OverlayRulesetSelector rulesetSelector; private CountryFilter countryFilter; diff --git a/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs b/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs index 27d4a6b6d3..d00a3680d8 100644 --- a/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs @@ -34,9 +34,9 @@ namespace osu.Game.Overlays.Rankings.Tables new RankingsTableColumn(RankingsStrings.StatAveragePerformance, Anchor.Centre, new Dimension(GridSizeMode.AutoSize)), }; - protected override Country GetCountry(CountryStatistics item) => item.Country; + protected override CountryCode GetCountryCode(CountryStatistics item) => item.Code; - protected override Drawable CreateFlagContent(CountryStatistics item) => new CountryName(item.Country); + protected override Drawable CreateFlagContent(CountryStatistics item) => new CountryName(item.Code); protected override Drawable[] CreateAdditionalContent(CountryStatistics item) => new Drawable[] { @@ -71,15 +71,15 @@ namespace osu.Game.Overlays.Rankings.Tables [Resolved(canBeNull: true)] private RankingsOverlay rankings { get; set; } - public CountryName(Country country) + public CountryName(CountryCode countryCode) : base(t => t.Font = OsuFont.GetFont(size: 12)) { AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; TextAnchor = Anchor.CentreLeft; - if (country != default) - AddLink(country.GetDescription(), () => rankings?.ShowCountry(country)); + if (countryCode != default) + AddLink(countryCode.GetDescription(), () => rankings?.ShowCountry(countryCode)); } } } diff --git a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs index 1e33b96ef1..073bf86a7a 100644 --- a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs @@ -79,7 +79,7 @@ namespace osu.Game.Overlays.Rankings.Tables protected sealed override Drawable CreateHeader(int index, TableColumn column) => (column as RankingsTableColumn)?.CreateHeaderText() ?? new HeaderText(column?.Header ?? default, false); - protected abstract Country GetCountry(TModel item); + protected abstract CountryCode GetCountryCode(TModel item); protected abstract Drawable CreateFlagContent(TModel item); @@ -97,7 +97,7 @@ namespace osu.Game.Overlays.Rankings.Tables Margin = new MarginPadding { Bottom = row_spacing }, Children = new[] { - new UpdateableFlag(GetCountry(item)) + new UpdateableFlag(GetCountryCode(item)) { Size = new Vector2(28, 20), ShowPlaceholderOnUnknown = false, diff --git a/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs b/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs index 2edd1b21ba..48185e6083 100644 --- a/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs @@ -59,7 +59,7 @@ namespace osu.Game.Overlays.Rankings.Tables .Concat(GradeColumns.Select(grade => new GradeTableColumn(grade, Anchor.Centre, new Dimension(GridSizeMode.AutoSize)))) .ToArray(); - protected sealed override Country GetCountry(UserStatistics item) => item.User.Country; + protected sealed override CountryCode GetCountryCode(UserStatistics item) => item.User.CountryCode; protected sealed override Drawable CreateFlagContent(UserStatistics item) { diff --git a/osu.Game/Overlays/RankingsOverlay.cs b/osu.Game/Overlays/RankingsOverlay.cs index 9894df1c9d..586b883604 100644 --- a/osu.Game/Overlays/RankingsOverlay.cs +++ b/osu.Game/Overlays/RankingsOverlay.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays { public class RankingsOverlay : TabbableOnlineOverlay { - protected Bindable Country => Header.Country; + protected Bindable Country => Header.Country; private APIRequest lastRequest; @@ -85,7 +85,7 @@ namespace osu.Game.Overlays protected override RankingsOverlayHeader CreateHeader() => new RankingsOverlayHeader(); - public void ShowCountry(Country requested) + public void ShowCountry(CountryCode requested) { if (requested == default) return; @@ -128,7 +128,7 @@ namespace osu.Game.Overlays switch (Header.Current.Value) { case RankingsScope.Performance: - return new GetUserRankingsRequest(ruleset.Value, country: Country.Value); + return new GetUserRankingsRequest(ruleset.Value, countryCode: Country.Value); case RankingsScope.Country: return new GetCountryRankingsRequest(ruleset.Value); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs index 652a832689..592be2ebac 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs @@ -128,7 +128,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Size = new Vector2(28, 20), - Country = user?.Country ?? default + CountryCode = user?.CountryCode ?? default }, new OsuSpriteText { diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/CountryCode.cs similarity index 99% rename from osu.Game/Users/Country.cs rename to osu.Game/Users/CountryCode.cs index 2070bcab39..11e9806ec5 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/CountryCode.cs @@ -10,7 +10,7 @@ namespace osu.Game.Users { [JsonConverter(typeof(StringEnumConverter))] [UsedImplicitly(ImplicitUseTargetFlags.WithMembers)] - public enum Country + public enum CountryCode { [Description("Unknown")] XX = 0, diff --git a/osu.Game/Users/CountryStatistics.cs b/osu.Game/Users/CountryStatistics.cs index eaee13a37b..03d455bc04 100644 --- a/osu.Game/Users/CountryStatistics.cs +++ b/osu.Game/Users/CountryStatistics.cs @@ -10,7 +10,7 @@ namespace osu.Game.Users public class CountryStatistics { [JsonProperty(@"code")] - public Country Country; + public CountryCode Code; [JsonProperty(@"active_users")] public long ActiveUsers; diff --git a/osu.Game/Users/Drawables/DrawableFlag.cs b/osu.Game/Users/Drawables/DrawableFlag.cs index 84b56a8d16..f7718c4f63 100644 --- a/osu.Game/Users/Drawables/DrawableFlag.cs +++ b/osu.Game/Users/Drawables/DrawableFlag.cs @@ -15,13 +15,13 @@ namespace osu.Game.Users.Drawables { public class DrawableFlag : Sprite, IHasTooltip { - private readonly Country country; + private readonly CountryCode countryCode; - public LocalisableString TooltipText => country == default ? string.Empty : country.GetDescription(); + public LocalisableString TooltipText => countryCode == default ? string.Empty : countryCode.GetDescription(); - public DrawableFlag(Country country) + public DrawableFlag(CountryCode countryCode) { - this.country = country; + this.countryCode = countryCode; } [BackgroundDependencyLoader] @@ -30,7 +30,7 @@ namespace osu.Game.Users.Drawables if (ts == null) throw new ArgumentNullException(nameof(ts)); - string textureName = country == default ? "__" : country.ToString(); + string textureName = countryCode == default ? "__" : countryCode.ToString(); Texture = ts.Get($@"Flags/{textureName}") ?? ts.Get(@"Flags/__"); } } diff --git a/osu.Game/Users/Drawables/UpdateableFlag.cs b/osu.Game/Users/Drawables/UpdateableFlag.cs index 88c08d4bb1..808bfad565 100644 --- a/osu.Game/Users/Drawables/UpdateableFlag.cs +++ b/osu.Game/Users/Drawables/UpdateableFlag.cs @@ -13,9 +13,9 @@ using osu.Game.Overlays; namespace osu.Game.Users.Drawables { - public class UpdateableFlag : ModelBackedDrawable + public class UpdateableFlag : ModelBackedDrawable { - public Country Country + public CountryCode CountryCode { get => Model; set => Model = value; @@ -32,14 +32,14 @@ namespace osu.Game.Users.Drawables /// public Action Action; - public UpdateableFlag(Country country = default) + public UpdateableFlag(CountryCode countryCode = default) { - Country = country; + CountryCode = countryCode; } - protected override Drawable CreateDrawable(Country country) + protected override Drawable CreateDrawable(CountryCode countryCode) { - if (country == default && !ShowPlaceholderOnUnknown) + if (countryCode == default && !ShowPlaceholderOnUnknown) return null; return new Container @@ -47,7 +47,7 @@ namespace osu.Game.Users.Drawables RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new DrawableFlag(country) + new DrawableFlag(countryCode) { RelativeSizeAxes = Axes.Both }, @@ -62,7 +62,7 @@ namespace osu.Game.Users.Drawables protected override bool OnClick(ClickEvent e) { Action?.Invoke(); - rankingsOverlay?.ShowCountry(Country); + rankingsOverlay?.ShowCountry(CountryCode); return true; } } diff --git a/osu.Game/Users/ExtendedUserPanel.cs b/osu.Game/Users/ExtendedUserPanel.cs index 7d475c545a..a4cba8b920 100644 --- a/osu.Game/Users/ExtendedUserPanel.cs +++ b/osu.Game/Users/ExtendedUserPanel.cs @@ -53,7 +53,7 @@ namespace osu.Game.Users protected UpdateableAvatar CreateAvatar() => new UpdateableAvatar(User, false); - protected UpdateableFlag CreateFlag() => new UpdateableFlag(User.Country) + protected UpdateableFlag CreateFlag() => new UpdateableFlag(User.CountryCode) { Size = new Vector2(36, 26), Action = Action, From ef6e16b1cb668451d03962ae42b3d3d17d745efc Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Jul 2022 08:40:43 +0300 Subject: [PATCH 2315/2328] `UserCountry` -> `Country` --- osu.Game/Online/API/Requests/Responses/APIUser.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIUser.cs b/osu.Game/Online/API/Requests/Responses/APIUser.cs index e2e1288b8c..6901b4595e 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUser.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUser.cs @@ -34,20 +34,20 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"previous_usernames")] public string[] PreviousUsernames; - private Country? country; + private CountryCode? countryCode; - public Country Country + public CountryCode CountryCode { - get => country ??= (Enum.TryParse(userCountry?.Code, out Country result) ? result : default); - set => country = value; + get => countryCode ??= (Enum.TryParse(country?.Code, out CountryCode result) ? result : default); + set => countryCode = value; } #pragma warning disable 649 [CanBeNull] [JsonProperty(@"country")] - private UserCountry userCountry; + private Country country; - private class UserCountry + private class Country { [JsonProperty(@"code")] public string Code; From 566bad0b5f4a73291628d07ebc9c2ac067b48eab Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Jul 2022 14:42:41 +0900 Subject: [PATCH 2316/2328] Make `SoloScoreInfo.EndedAt` non-null Seems to already be the case for databased scores. Will be assured by https://github.com/ppy/osu-web/issues/9116. I've updated the `osu-score-statistics-processor` with this consideration. --- osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs index cf7aa599f3..d46869c9f5 100644 --- a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs @@ -54,7 +54,7 @@ namespace osu.Game.Online.API.Requests.Responses public DateTimeOffset? StartedAt { get; set; } [JsonProperty("ended_at")] - public DateTimeOffset? EndedAt { get; set; } + public DateTimeOffset EndedAt { get; set; } [JsonProperty("mods")] public APIMod[] Mods { get; set; } = Array.Empty(); @@ -128,7 +128,7 @@ namespace osu.Game.Online.API.Requests.Responses MaxCombo = MaxCombo, Rank = Rank, Statistics = Statistics, - Date = EndedAt ?? DateTimeOffset.Now, + Date = EndedAt, Hash = HasReplay ? "online" : string.Empty, // TODO: temporary? Mods = mods, PP = PP, From 05d692bd5539e6d7ab5da778cb48a97ae7908c3e Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Jul 2022 08:43:41 +0300 Subject: [PATCH 2317/2328] Move `Country` to end of class --- osu.Game/Online/API/Requests/Responses/APIUser.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIUser.cs b/osu.Game/Online/API/Requests/Responses/APIUser.cs index 6901b4595e..5f843e9a7b 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUser.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUser.cs @@ -46,12 +46,6 @@ namespace osu.Game.Online.API.Requests.Responses [CanBeNull] [JsonProperty(@"country")] private Country country; - - private class Country - { - [JsonProperty(@"code")] - public string Code; - } #pragma warning restore 649 public readonly Bindable Status = new Bindable(); @@ -273,5 +267,13 @@ namespace osu.Game.Online.API.Requests.Responses public int OnlineID => Id; public bool Equals(APIUser other) => this.MatchesOnlineID(other); + +#pragma warning disable 649 + private class Country + { + [JsonProperty(@"code")] + public string Code; + } +#pragma warning restore 649 } } From cf99849478b644360afacb0dcf87bb380ae204a7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Jul 2022 08:45:54 +0300 Subject: [PATCH 2318/2328] `CountryCode.XX` -> `CountryCode.Unknown` --- osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs | 2 +- osu.Game/Users/CountryCode.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs index c2766e2142..caa2d2571d 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Online { Username = @"Somebody", Id = 1, - CountryCode = CountryCode.XX, + CountryCode = CountryCode.Unknown, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg", JoinDate = DateTimeOffset.Now.AddDays(-1), LastVisit = DateTimeOffset.Now, diff --git a/osu.Game/Users/CountryCode.cs b/osu.Game/Users/CountryCode.cs index 11e9806ec5..775de2bcf5 100644 --- a/osu.Game/Users/CountryCode.cs +++ b/osu.Game/Users/CountryCode.cs @@ -13,7 +13,7 @@ namespace osu.Game.Users public enum CountryCode { [Description("Unknown")] - XX = 0, + Unknown = 0, [Description("Bangladesh")] BD, From 018da74fe804928e83e249919ef3ed998e0d4854 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Jul 2022 08:54:35 +0300 Subject: [PATCH 2319/2328] Replace `default` with `CountryCode.Unknown` --- osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs | 2 +- osu.Game.Tournament/TournamentGameBase.cs | 3 ++- osu.Game/Online/API/Requests/GetUserRankingsRequest.cs | 4 ++-- osu.Game/Overlays/Rankings/CountryFilter.cs | 2 +- osu.Game/Overlays/Rankings/CountryPill.cs | 2 +- osu.Game/Overlays/Rankings/Tables/CountriesTable.cs | 2 +- osu.Game/Users/Drawables/DrawableFlag.cs | 4 ++-- osu.Game/Users/Drawables/UpdateableFlag.cs | 4 ++-- 8 files changed, 12 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs index 7f4b1284a0..5476049882 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs @@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual.Online public void TestFlagScopeDependency() { AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score); - AddAssert("Check country is default", () => countryBindable.Value == default); + AddAssert("Check country is default", () => countryBindable.IsDefault); AddStep("Set country", () => countryBindable.Value = CountryCode.US); AddAssert("Check scope is Performance", () => scope.Value == RankingsScope.Performance); } diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index afeb58fde8..063b62bf08 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -21,6 +21,7 @@ using osu.Game.Online.API.Requests.Responses; using osu.Game.Tournament.IO; using osu.Game.Tournament.IPC; using osu.Game.Tournament.Models; +using osu.Game.Users; using osuTK.Input; namespace osu.Game.Tournament @@ -187,7 +188,7 @@ namespace osu.Game.Tournament var playersRequiringPopulation = ladder.Teams .SelectMany(t => t.Players) .Where(p => string.IsNullOrEmpty(p.Username) - || p.CountryCode == default + || p.CountryCode == CountryCode.Unknown || p.Rank == null).ToList(); if (playersRequiringPopulation.Count == 0) diff --git a/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs b/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs index c55e7d65b6..c27a83b695 100644 --- a/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRankingsRequest.cs @@ -15,7 +15,7 @@ namespace osu.Game.Online.API.Requests private readonly CountryCode countryCode; - public GetUserRankingsRequest(RulesetInfo ruleset, UserRankingsType type = UserRankingsType.Performance, int page = 1, CountryCode countryCode = default) + public GetUserRankingsRequest(RulesetInfo ruleset, UserRankingsType type = UserRankingsType.Performance, int page = 1, CountryCode countryCode = CountryCode.Unknown) : base(ruleset, page) { Type = type; @@ -26,7 +26,7 @@ namespace osu.Game.Online.API.Requests { var req = base.CreateWebRequest(); - if (countryCode != default) + if (countryCode != CountryCode.Unknown) req.AddParameter("country", countryCode.ToString()); return req; diff --git a/osu.Game/Overlays/Rankings/CountryFilter.cs b/osu.Game/Overlays/Rankings/CountryFilter.cs index 3ad677e976..9376bafdff 100644 --- a/osu.Game/Overlays/Rankings/CountryFilter.cs +++ b/osu.Game/Overlays/Rankings/CountryFilter.cs @@ -91,7 +91,7 @@ namespace osu.Game.Overlays.Rankings private void onCountryChanged(ValueChangedEvent country) { - if (country.NewValue == default) + if (Current.Value == CountryCode.Unknown) { countryPill.Collapse(); this.ResizeHeightTo(0, duration, Easing.OutQuint); diff --git a/osu.Game/Overlays/Rankings/CountryPill.cs b/osu.Game/Overlays/Rankings/CountryPill.cs index 610efbcc60..ee4c4f08af 100644 --- a/osu.Game/Overlays/Rankings/CountryPill.cs +++ b/osu.Game/Overlays/Rankings/CountryPill.cs @@ -133,7 +133,7 @@ namespace osu.Game.Overlays.Rankings private void onCountryChanged(ValueChangedEvent country) { - if (country.NewValue == default) + if (Current.Value == CountryCode.Unknown) return; flag.CountryCode = country.NewValue; diff --git a/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs b/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs index d00a3680d8..a6f0c7a123 100644 --- a/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/CountriesTable.cs @@ -78,7 +78,7 @@ namespace osu.Game.Overlays.Rankings.Tables RelativeSizeAxes = Axes.Y; TextAnchor = Anchor.CentreLeft; - if (countryCode != default) + if (countryCode != CountryCode.Unknown) AddLink(countryCode.GetDescription(), () => rankings?.ShowCountry(countryCode)); } } diff --git a/osu.Game/Users/Drawables/DrawableFlag.cs b/osu.Game/Users/Drawables/DrawableFlag.cs index f7718c4f63..253835b415 100644 --- a/osu.Game/Users/Drawables/DrawableFlag.cs +++ b/osu.Game/Users/Drawables/DrawableFlag.cs @@ -17,7 +17,7 @@ namespace osu.Game.Users.Drawables { private readonly CountryCode countryCode; - public LocalisableString TooltipText => countryCode == default ? string.Empty : countryCode.GetDescription(); + public LocalisableString TooltipText => countryCode == CountryCode.Unknown ? string.Empty : countryCode.GetDescription(); public DrawableFlag(CountryCode countryCode) { @@ -30,7 +30,7 @@ namespace osu.Game.Users.Drawables if (ts == null) throw new ArgumentNullException(nameof(ts)); - string textureName = countryCode == default ? "__" : countryCode.ToString(); + string textureName = countryCode == CountryCode.Unknown ? "__" : countryCode.ToString(); Texture = ts.Get($@"Flags/{textureName}") ?? ts.Get(@"Flags/__"); } } diff --git a/osu.Game/Users/Drawables/UpdateableFlag.cs b/osu.Game/Users/Drawables/UpdateableFlag.cs index 808bfad565..9b101131b3 100644 --- a/osu.Game/Users/Drawables/UpdateableFlag.cs +++ b/osu.Game/Users/Drawables/UpdateableFlag.cs @@ -32,14 +32,14 @@ namespace osu.Game.Users.Drawables /// public Action Action; - public UpdateableFlag(CountryCode countryCode = default) + public UpdateableFlag(CountryCode countryCode = CountryCode.Unknown) { CountryCode = countryCode; } protected override Drawable CreateDrawable(CountryCode countryCode) { - if (countryCode == default && !ShowPlaceholderOnUnknown) + if (countryCode == CountryCode.Unknown && !ShowPlaceholderOnUnknown) return null; return new Container From 21bf7ee448bcbc328707a049292630dcfde1c731 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Jul 2022 15:27:55 +0900 Subject: [PATCH 2320/2328] Turn on nullability in `ParticipantPanel` --- osu.Game/Online/API/APIMod.cs | 3 ++- .../Participants/ParticipantPanel.cs | 22 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/osu.Game/Online/API/APIMod.cs b/osu.Game/Online/API/APIMod.cs index 8346300767..3bd0c91f8e 100644 --- a/osu.Game/Online/API/APIMod.cs +++ b/osu.Game/Online/API/APIMod.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using Humanizer; using MessagePack; @@ -48,7 +49,7 @@ namespace osu.Game.Online.API } } - public Mod ToMod(Ruleset ruleset) + public Mod ToMod([NotNull] Ruleset ruleset) { Mod resultMod = ruleset.CreateModFromAcronym(Acronym); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs index f632951f41..539502e631 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; @@ -35,18 +33,18 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants public readonly MultiplayerRoomUser User; [Resolved] - private IAPIProvider api { get; set; } + private IAPIProvider api { get; set; } = null!; [Resolved] - private IRulesetStore rulesets { get; set; } + private IRulesetStore rulesets { get; set; } = null!; - private SpriteIcon crown; + private SpriteIcon crown = null!; - private OsuSpriteText userRankText; - private ModDisplay userModsDisplay; - private StateDisplay userStateDisplay; + private OsuSpriteText userRankText = null!; + private ModDisplay userModsDisplay = null!; + private StateDisplay userStateDisplay = null!; - private IconButton kickButton; + private IconButton kickButton = null!; public ParticipantPanel(MultiplayerRoomUser user) { @@ -135,7 +133,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18), - Text = user?.Username + Text = user?.Username ?? string.Empty }, userRankText = new OsuSpriteText { @@ -188,7 +186,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants const double fade_time = 50; var currentItem = Playlist.GetCurrentItem(); - var ruleset = currentItem != null ? rulesets.GetRuleset(currentItem.RulesetID)?.CreateInstance() : null; + Ruleset? ruleset = currentItem != null ? rulesets.GetRuleset(currentItem.RulesetID)?.CreateInstance() : null; int? currentModeRank = ruleset != null ? User.User?.RulesetsStatistics?.GetValueOrDefault(ruleset.ShortName)?.GlobalRank : null; userRankText.Text = currentModeRank != null ? $"#{currentModeRank.Value:N0}" : string.Empty; @@ -208,7 +206,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants Schedule(() => userModsDisplay.Current.Value = User.Mods.Select(m => m.ToMod(ruleset)).ToList()); } - public MenuItem[] ContextMenuItems + public MenuItem[]? ContextMenuItems { get { From a036632c8be8c61ff496e732d0c8bd2ef1667bde Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Jul 2022 15:30:21 +0900 Subject: [PATCH 2321/2328] Fix potential crash when attempting to create mod display using null ruleset --- .../Multiplayer/Participants/ParticipantPanel.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs index 539502e631..e3a20cd652 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; @@ -20,6 +21,7 @@ using osu.Game.Online.API; using osu.Game.Online.Multiplayer; using osu.Game.Online.Rooms; using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; using osu.Game.Screens.Play.HUD; using osu.Game.Users; using osu.Game.Users.Drawables; @@ -203,7 +205,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants // If the mods are updated at the end of the frame, the flow container will skip a reflow cycle: https://github.com/ppy/osu-framework/issues/4187 // This looks particularly jarring here, so re-schedule the update to that start of our frame as a fix. - Schedule(() => userModsDisplay.Current.Value = User.Mods.Select(m => m.ToMod(ruleset)).ToList()); + Schedule(() => + { + userModsDisplay.Current.Value = ruleset != null ? User.Mods.Select(m => m.ToMod(ruleset)).ToList() : Array.Empty(); + }); } public MenuItem[]? ContextMenuItems From e4d11febc538d046d8194f9853127af7d820af74 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 18 Jul 2022 09:47:40 +0300 Subject: [PATCH 2322/2328] Remove no longer necessary fallback --- .../Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs index c5e2b6df0c..5d8f8c8326 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs @@ -98,7 +98,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular), Colour = colours.Yellow }, - new DrawableDate(Score.EndedAt ?? DateTimeOffset.Now, 12) + new DrawableDate(Score.EndedAt, 12) { Colour = colourProvider.Foreground1 } From 51f91fe62e37ebc2ebcb28af62a8b7e82569b979 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Jul 2022 16:16:59 +0900 Subject: [PATCH 2323/2328] Update naming --- osu.Game/Database/RealmAccess.cs | 2 +- osu.Game/Models/RealmUser.cs | 8 ++++---- osu.Game/Rulesets/Mods/ICreateReplayData.cs | 2 +- osu.Game/Scoring/ScoreInfo.cs | 6 +++--- osu.Game/Users/IUser.cs | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index 0c44436ec8..c4d65f4f10 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -60,7 +60,7 @@ namespace osu.Game.Database /// 14 2022-03-01 Added BeatmapUserSettings to BeatmapInfo. /// 15 2022-07-13 Added LastPlayed to BeatmapInfo. /// 16 2022-07-15 Removed HasReplay from ScoreInfo. - /// 17 2022-07-16 Added Country to RealmUser. + /// 17 2022-07-16 Added CountryCode to RealmUser. /// private const int schema_version = 17; diff --git a/osu.Game/Models/RealmUser.cs b/osu.Game/Models/RealmUser.cs index 1668739bb5..4b9269a922 100644 --- a/osu.Game/Models/RealmUser.cs +++ b/osu.Game/Models/RealmUser.cs @@ -16,14 +16,14 @@ namespace osu.Game.Models public string Username { get; set; } = string.Empty; [Ignored] - public Country Country + public CountryCode CountryCode { - get => Enum.TryParse(CountryString, out Country country) ? country : default; + get => Enum.TryParse(CountryString, out CountryCode country) ? country : default; set => CountryString = value.ToString(); } - [MapTo(nameof(Country))] - public string CountryString { get; set; } = default(Country).ToString(); + [MapTo(nameof(CountryCode))] + public string CountryString { get; set; } = default(CountryCode).ToString(); public bool IsBot => false; diff --git a/osu.Game/Rulesets/Mods/ICreateReplayData.cs b/osu.Game/Rulesets/Mods/ICreateReplayData.cs index 6c195f623c..3ed5c2b7f8 100644 --- a/osu.Game/Rulesets/Mods/ICreateReplayData.cs +++ b/osu.Game/Rulesets/Mods/ICreateReplayData.cs @@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Mods public class ModCreatedUser : IUser { public int OnlineID => APIUser.SYSTEM_USER_ID; - public Country Country => default; + public CountryCode CountryCode => default; public bool IsBot => true; public string Username { get; set; } = string.Empty; diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index f5942e4639..d32d611a27 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -87,7 +87,7 @@ namespace osu.Game.Scoring { Id = RealmUser.OnlineID, Username = RealmUser.Username, - Country = RealmUser.Country, + CountryCode = RealmUser.CountryCode, }; set { @@ -97,7 +97,7 @@ namespace osu.Game.Scoring { OnlineID = user.OnlineID, Username = user.Username, - Country = user.Country, + CountryCode = user.CountryCode, }; } } @@ -137,7 +137,7 @@ namespace osu.Game.Scoring { OnlineID = RealmUser.OnlineID, Username = RealmUser.Username, - Country = RealmUser.Country, + CountryCode = RealmUser.CountryCode, }; return clone; diff --git a/osu.Game/Users/IUser.cs b/osu.Game/Users/IUser.cs index a520660c4d..b7f545f68b 100644 --- a/osu.Game/Users/IUser.cs +++ b/osu.Game/Users/IUser.cs @@ -10,7 +10,7 @@ namespace osu.Game.Users { string Username { get; } - Country Country { get; } + CountryCode CountryCode { get; } bool IsBot { get; } From 1e151baae8cbf2e0c6dc60e20aa8dd90658a290f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Jul 2022 16:24:08 +0900 Subject: [PATCH 2324/2328] Use `Unknown` instead of `default` --- osu.Game/Models/RealmUser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Models/RealmUser.cs b/osu.Game/Models/RealmUser.cs index 4b9269a922..e20ffc0808 100644 --- a/osu.Game/Models/RealmUser.cs +++ b/osu.Game/Models/RealmUser.cs @@ -18,7 +18,7 @@ namespace osu.Game.Models [Ignored] public CountryCode CountryCode { - get => Enum.TryParse(CountryString, out CountryCode country) ? country : default; + get => Enum.TryParse(CountryString, out CountryCode country) ? country : CountryCode.Unknown; set => CountryString = value.ToString(); } From caa44ce01e6ac413a0366b0ab22e1cce363de791 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Jul 2022 16:40:11 +0900 Subject: [PATCH 2325/2328] Update naming --- osu.Game.Tournament/CountryExtensions.cs | 502 +++++++++--------- .../Screens/Editors/TeamEditorScreen.cs | 2 +- 2 files changed, 252 insertions(+), 252 deletions(-) diff --git a/osu.Game.Tournament/CountryExtensions.cs b/osu.Game.Tournament/CountryExtensions.cs index 180c7a96af..f2a583c8a5 100644 --- a/osu.Game.Tournament/CountryExtensions.cs +++ b/osu.Game.Tournament/CountryExtensions.cs @@ -8,758 +8,758 @@ namespace osu.Game.Tournament { public static class CountryExtensions { - public static string GetAcronym(this Country country) + public static string GetAcronym(this CountryCode country) { switch (country) { - case Country.BD: + case CountryCode.BD: return "BGD"; - case Country.BE: + case CountryCode.BE: return "BEL"; - case Country.BF: + case CountryCode.BF: return "BFA"; - case Country.BG: + case CountryCode.BG: return "BGR"; - case Country.BA: + case CountryCode.BA: return "BIH"; - case Country.BB: + case CountryCode.BB: return "BRB"; - case Country.WF: + case CountryCode.WF: return "WLF"; - case Country.BL: + case CountryCode.BL: return "BLM"; - case Country.BM: + case CountryCode.BM: return "BMU"; - case Country.BN: + case CountryCode.BN: return "BRN"; - case Country.BO: + case CountryCode.BO: return "BOL"; - case Country.BH: + case CountryCode.BH: return "BHR"; - case Country.BI: + case CountryCode.BI: return "BDI"; - case Country.BJ: + case CountryCode.BJ: return "BEN"; - case Country.BT: + case CountryCode.BT: return "BTN"; - case Country.JM: + case CountryCode.JM: return "JAM"; - case Country.BV: + case CountryCode.BV: return "BVT"; - case Country.BW: + case CountryCode.BW: return "BWA"; - case Country.WS: + case CountryCode.WS: return "WSM"; - case Country.BQ: + case CountryCode.BQ: return "BES"; - case Country.BR: + case CountryCode.BR: return "BRA"; - case Country.BS: + case CountryCode.BS: return "BHS"; - case Country.JE: + case CountryCode.JE: return "JEY"; - case Country.BY: + case CountryCode.BY: return "BLR"; - case Country.BZ: + case CountryCode.BZ: return "BLZ"; - case Country.RU: + case CountryCode.RU: return "RUS"; - case Country.RW: + case CountryCode.RW: return "RWA"; - case Country.RS: + case CountryCode.RS: return "SRB"; - case Country.TL: + case CountryCode.TL: return "TLS"; - case Country.RE: + case CountryCode.RE: return "REU"; - case Country.TM: + case CountryCode.TM: return "TKM"; - case Country.TJ: + case CountryCode.TJ: return "TJK"; - case Country.RO: + case CountryCode.RO: return "ROU"; - case Country.TK: + case CountryCode.TK: return "TKL"; - case Country.GW: + case CountryCode.GW: return "GNB"; - case Country.GU: + case CountryCode.GU: return "GUM"; - case Country.GT: + case CountryCode.GT: return "GTM"; - case Country.GS: + case CountryCode.GS: return "SGS"; - case Country.GR: + case CountryCode.GR: return "GRC"; - case Country.GQ: + case CountryCode.GQ: return "GNQ"; - case Country.GP: + case CountryCode.GP: return "GLP"; - case Country.JP: + case CountryCode.JP: return "JPN"; - case Country.GY: + case CountryCode.GY: return "GUY"; - case Country.GG: + case CountryCode.GG: return "GGY"; - case Country.GF: + case CountryCode.GF: return "GUF"; - case Country.GE: + case CountryCode.GE: return "GEO"; - case Country.GD: + case CountryCode.GD: return "GRD"; - case Country.GB: + case CountryCode.GB: return "GBR"; - case Country.GA: + case CountryCode.GA: return "GAB"; - case Country.SV: + case CountryCode.SV: return "SLV"; - case Country.GN: + case CountryCode.GN: return "GIN"; - case Country.GM: + case CountryCode.GM: return "GMB"; - case Country.GL: + case CountryCode.GL: return "GRL"; - case Country.GI: + case CountryCode.GI: return "GIB"; - case Country.GH: + case CountryCode.GH: return "GHA"; - case Country.OM: + case CountryCode.OM: return "OMN"; - case Country.TN: + case CountryCode.TN: return "TUN"; - case Country.JO: + case CountryCode.JO: return "JOR"; - case Country.HR: + case CountryCode.HR: return "HRV"; - case Country.HT: + case CountryCode.HT: return "HTI"; - case Country.HU: + case CountryCode.HU: return "HUN"; - case Country.HK: + case CountryCode.HK: return "HKG"; - case Country.HN: + case CountryCode.HN: return "HND"; - case Country.HM: + case CountryCode.HM: return "HMD"; - case Country.VE: + case CountryCode.VE: return "VEN"; - case Country.PR: + case CountryCode.PR: return "PRI"; - case Country.PS: + case CountryCode.PS: return "PSE"; - case Country.PW: + case CountryCode.PW: return "PLW"; - case Country.PT: + case CountryCode.PT: return "PRT"; - case Country.SJ: + case CountryCode.SJ: return "SJM"; - case Country.PY: + case CountryCode.PY: return "PRY"; - case Country.IQ: + case CountryCode.IQ: return "IRQ"; - case Country.PA: + case CountryCode.PA: return "PAN"; - case Country.PF: + case CountryCode.PF: return "PYF"; - case Country.PG: + case CountryCode.PG: return "PNG"; - case Country.PE: + case CountryCode.PE: return "PER"; - case Country.PK: + case CountryCode.PK: return "PAK"; - case Country.PH: + case CountryCode.PH: return "PHL"; - case Country.PN: + case CountryCode.PN: return "PCN"; - case Country.PL: + case CountryCode.PL: return "POL"; - case Country.PM: + case CountryCode.PM: return "SPM"; - case Country.ZM: + case CountryCode.ZM: return "ZMB"; - case Country.EH: + case CountryCode.EH: return "ESH"; - case Country.EE: + case CountryCode.EE: return "EST"; - case Country.EG: + case CountryCode.EG: return "EGY"; - case Country.ZA: + case CountryCode.ZA: return "ZAF"; - case Country.EC: + case CountryCode.EC: return "ECU"; - case Country.IT: + case CountryCode.IT: return "ITA"; - case Country.VN: + case CountryCode.VN: return "VNM"; - case Country.SB: + case CountryCode.SB: return "SLB"; - case Country.ET: + case CountryCode.ET: return "ETH"; - case Country.SO: + case CountryCode.SO: return "SOM"; - case Country.ZW: + case CountryCode.ZW: return "ZWE"; - case Country.SA: + case CountryCode.SA: return "SAU"; - case Country.ES: + case CountryCode.ES: return "ESP"; - case Country.ER: + case CountryCode.ER: return "ERI"; - case Country.ME: + case CountryCode.ME: return "MNE"; - case Country.MD: + case CountryCode.MD: return "MDA"; - case Country.MG: + case CountryCode.MG: return "MDG"; - case Country.MF: + case CountryCode.MF: return "MAF"; - case Country.MA: + case CountryCode.MA: return "MAR"; - case Country.MC: + case CountryCode.MC: return "MCO"; - case Country.UZ: + case CountryCode.UZ: return "UZB"; - case Country.MM: + case CountryCode.MM: return "MMR"; - case Country.ML: + case CountryCode.ML: return "MLI"; - case Country.MO: + case CountryCode.MO: return "MAC"; - case Country.MN: + case CountryCode.MN: return "MNG"; - case Country.MH: + case CountryCode.MH: return "MHL"; - case Country.MK: + case CountryCode.MK: return "MKD"; - case Country.MU: + case CountryCode.MU: return "MUS"; - case Country.MT: + case CountryCode.MT: return "MLT"; - case Country.MW: + case CountryCode.MW: return "MWI"; - case Country.MV: + case CountryCode.MV: return "MDV"; - case Country.MQ: + case CountryCode.MQ: return "MTQ"; - case Country.MP: + case CountryCode.MP: return "MNP"; - case Country.MS: + case CountryCode.MS: return "MSR"; - case Country.MR: + case CountryCode.MR: return "MRT"; - case Country.IM: + case CountryCode.IM: return "IMN"; - case Country.UG: + case CountryCode.UG: return "UGA"; - case Country.TZ: + case CountryCode.TZ: return "TZA"; - case Country.MY: + case CountryCode.MY: return "MYS"; - case Country.MX: + case CountryCode.MX: return "MEX"; - case Country.IL: + case CountryCode.IL: return "ISR"; - case Country.FR: + case CountryCode.FR: return "FRA"; - case Country.IO: + case CountryCode.IO: return "IOT"; - case Country.SH: + case CountryCode.SH: return "SHN"; - case Country.FI: + case CountryCode.FI: return "FIN"; - case Country.FJ: + case CountryCode.FJ: return "FJI"; - case Country.FK: + case CountryCode.FK: return "FLK"; - case Country.FM: + case CountryCode.FM: return "FSM"; - case Country.FO: + case CountryCode.FO: return "FRO"; - case Country.NI: + case CountryCode.NI: return "NIC"; - case Country.NL: + case CountryCode.NL: return "NLD"; - case Country.NO: + case CountryCode.NO: return "NOR"; - case Country.NA: + case CountryCode.NA: return "NAM"; - case Country.VU: + case CountryCode.VU: return "VUT"; - case Country.NC: + case CountryCode.NC: return "NCL"; - case Country.NE: + case CountryCode.NE: return "NER"; - case Country.NF: + case CountryCode.NF: return "NFK"; - case Country.NG: + case CountryCode.NG: return "NGA"; - case Country.NZ: + case CountryCode.NZ: return "NZL"; - case Country.NP: + case CountryCode.NP: return "NPL"; - case Country.NR: + case CountryCode.NR: return "NRU"; - case Country.NU: + case CountryCode.NU: return "NIU"; - case Country.CK: + case CountryCode.CK: return "COK"; - case Country.XK: + case CountryCode.XK: return "XKX"; - case Country.CI: + case CountryCode.CI: return "CIV"; - case Country.CH: + case CountryCode.CH: return "CHE"; - case Country.CO: + case CountryCode.CO: return "COL"; - case Country.CN: + case CountryCode.CN: return "CHN"; - case Country.CM: + case CountryCode.CM: return "CMR"; - case Country.CL: + case CountryCode.CL: return "CHL"; - case Country.CC: + case CountryCode.CC: return "CCK"; - case Country.CA: + case CountryCode.CA: return "CAN"; - case Country.CG: + case CountryCode.CG: return "COG"; - case Country.CF: + case CountryCode.CF: return "CAF"; - case Country.CD: + case CountryCode.CD: return "COD"; - case Country.CZ: + case CountryCode.CZ: return "CZE"; - case Country.CY: + case CountryCode.CY: return "CYP"; - case Country.CX: + case CountryCode.CX: return "CXR"; - case Country.CR: + case CountryCode.CR: return "CRI"; - case Country.CW: + case CountryCode.CW: return "CUW"; - case Country.CV: + case CountryCode.CV: return "CPV"; - case Country.CU: + case CountryCode.CU: return "CUB"; - case Country.SZ: + case CountryCode.SZ: return "SWZ"; - case Country.SY: + case CountryCode.SY: return "SYR"; - case Country.SX: + case CountryCode.SX: return "SXM"; - case Country.KG: + case CountryCode.KG: return "KGZ"; - case Country.KE: + case CountryCode.KE: return "KEN"; - case Country.SS: + case CountryCode.SS: return "SSD"; - case Country.SR: + case CountryCode.SR: return "SUR"; - case Country.KI: + case CountryCode.KI: return "KIR"; - case Country.KH: + case CountryCode.KH: return "KHM"; - case Country.KN: + case CountryCode.KN: return "KNA"; - case Country.KM: + case CountryCode.KM: return "COM"; - case Country.ST: + case CountryCode.ST: return "STP"; - case Country.SK: + case CountryCode.SK: return "SVK"; - case Country.KR: + case CountryCode.KR: return "KOR"; - case Country.SI: + case CountryCode.SI: return "SVN"; - case Country.KP: + case CountryCode.KP: return "PRK"; - case Country.KW: + case CountryCode.KW: return "KWT"; - case Country.SN: + case CountryCode.SN: return "SEN"; - case Country.SM: + case CountryCode.SM: return "SMR"; - case Country.SL: + case CountryCode.SL: return "SLE"; - case Country.SC: + case CountryCode.SC: return "SYC"; - case Country.KZ: + case CountryCode.KZ: return "KAZ"; - case Country.KY: + case CountryCode.KY: return "CYM"; - case Country.SG: + case CountryCode.SG: return "SGP"; - case Country.SE: + case CountryCode.SE: return "SWE"; - case Country.SD: + case CountryCode.SD: return "SDN"; - case Country.DO: + case CountryCode.DO: return "DOM"; - case Country.DM: + case CountryCode.DM: return "DMA"; - case Country.DJ: + case CountryCode.DJ: return "DJI"; - case Country.DK: + case CountryCode.DK: return "DNK"; - case Country.VG: + case CountryCode.VG: return "VGB"; - case Country.DE: + case CountryCode.DE: return "DEU"; - case Country.YE: + case CountryCode.YE: return "YEM"; - case Country.DZ: + case CountryCode.DZ: return "DZA"; - case Country.US: + case CountryCode.US: return "USA"; - case Country.UY: + case CountryCode.UY: return "URY"; - case Country.YT: + case CountryCode.YT: return "MYT"; - case Country.UM: + case CountryCode.UM: return "UMI"; - case Country.LB: + case CountryCode.LB: return "LBN"; - case Country.LC: + case CountryCode.LC: return "LCA"; - case Country.LA: + case CountryCode.LA: return "LAO"; - case Country.TV: + case CountryCode.TV: return "TUV"; - case Country.TW: + case CountryCode.TW: return "TWN"; - case Country.TT: + case CountryCode.TT: return "TTO"; - case Country.TR: + case CountryCode.TR: return "TUR"; - case Country.LK: + case CountryCode.LK: return "LKA"; - case Country.LI: + case CountryCode.LI: return "LIE"; - case Country.LV: + case CountryCode.LV: return "LVA"; - case Country.TO: + case CountryCode.TO: return "TON"; - case Country.LT: + case CountryCode.LT: return "LTU"; - case Country.LU: + case CountryCode.LU: return "LUX"; - case Country.LR: + case CountryCode.LR: return "LBR"; - case Country.LS: + case CountryCode.LS: return "LSO"; - case Country.TH: + case CountryCode.TH: return "THA"; - case Country.TF: + case CountryCode.TF: return "ATF"; - case Country.TG: + case CountryCode.TG: return "TGO"; - case Country.TD: + case CountryCode.TD: return "TCD"; - case Country.TC: + case CountryCode.TC: return "TCA"; - case Country.LY: + case CountryCode.LY: return "LBY"; - case Country.VA: + case CountryCode.VA: return "VAT"; - case Country.VC: + case CountryCode.VC: return "VCT"; - case Country.AE: + case CountryCode.AE: return "ARE"; - case Country.AD: + case CountryCode.AD: return "AND"; - case Country.AG: + case CountryCode.AG: return "ATG"; - case Country.AF: + case CountryCode.AF: return "AFG"; - case Country.AI: + case CountryCode.AI: return "AIA"; - case Country.VI: + case CountryCode.VI: return "VIR"; - case Country.IS: + case CountryCode.IS: return "ISL"; - case Country.IR: + case CountryCode.IR: return "IRN"; - case Country.AM: + case CountryCode.AM: return "ARM"; - case Country.AL: + case CountryCode.AL: return "ALB"; - case Country.AO: + case CountryCode.AO: return "AGO"; - case Country.AQ: + case CountryCode.AQ: return "ATA"; - case Country.AS: + case CountryCode.AS: return "ASM"; - case Country.AR: + case CountryCode.AR: return "ARG"; - case Country.AU: + case CountryCode.AU: return "AUS"; - case Country.AT: + case CountryCode.AT: return "AUT"; - case Country.AW: + case CountryCode.AW: return "ABW"; - case Country.IN: + case CountryCode.IN: return "IND"; - case Country.AX: + case CountryCode.AX: return "ALA"; - case Country.AZ: + case CountryCode.AZ: return "AZE"; - case Country.IE: + case CountryCode.IE: return "IRL"; - case Country.ID: + case CountryCode.ID: return "IDN"; - case Country.UA: + case CountryCode.UA: return "UKR"; - case Country.QA: + case CountryCode.QA: return "QAT"; - case Country.MZ: + case CountryCode.MZ: return "MOZ"; default: diff --git a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs index 0f806a2403..da27c09e01 100644 --- a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs @@ -44,7 +44,7 @@ namespace osu.Game.Tournament.Screens.Editors { var countries = new List(); - foreach (var country in Enum.GetValues(typeof(Country)).Cast().Skip(1)) + foreach (var country in Enum.GetValues(typeof(CountryCode)).Cast().Skip(1)) { countries.Add(new TournamentTeam { From 18da9ddfbfc5343f37e8bf69be7ef5617c0e389b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Jul 2022 17:01:45 +0900 Subject: [PATCH 2326/2328] Add test coverage of two beatmaps in same set with different audio files --- .../NonVisual/BeatmapSetInfoEqualityTest.cs | 40 ++++++++++++++++++- osu.Game.Tests/Resources/TestResources.cs | 2 +- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/NonVisual/BeatmapSetInfoEqualityTest.cs b/osu.Game.Tests/NonVisual/BeatmapSetInfoEqualityTest.cs index c887105da6..461102124a 100644 --- a/osu.Game.Tests/NonVisual/BeatmapSetInfoEqualityTest.cs +++ b/osu.Game.Tests/NonVisual/BeatmapSetInfoEqualityTest.cs @@ -62,9 +62,45 @@ namespace osu.Game.Tests.NonVisual Assert.IsTrue(beatmapSetA.Beatmaps.Single().AudioEquals(beatmapSetB.Beatmaps.Single())); } - private static void addAudioFile(BeatmapSetInfo beatmapSetInfo, string hash = null) + [Test] + public void TestAudioEqualityBeatmapInfoSameHash() { - beatmapSetInfo.Files.Add(new RealmNamedFileUsage(new RealmFile { Hash = hash ?? Guid.NewGuid().ToString() }, "audio.mp3")); + var beatmapSet = TestResources.CreateTestBeatmapSetInfo(2); + + addAudioFile(beatmapSet); + + var beatmap1 = beatmapSet.Beatmaps.First(); + var beatmap2 = beatmapSet.Beatmaps.Last(); + + Assert.AreNotEqual(beatmap1, beatmap2); + Assert.IsTrue(beatmap1.AudioEquals(beatmap2)); + } + + [Test] + public void TestAudioEqualityBeatmapInfoDifferentHash() + { + var beatmapSet = TestResources.CreateTestBeatmapSetInfo(2); + + const string filename1 = "audio1.mp3"; + const string filename2 = "audio2.mp3"; + + addAudioFile(beatmapSet, filename: filename1); + addAudioFile(beatmapSet, filename: filename2); + + var beatmap1 = beatmapSet.Beatmaps.First(); + var beatmap2 = beatmapSet.Beatmaps.Last(); + + Assert.AreNotEqual(beatmap1, beatmap2); + + beatmap1.Metadata.AudioFile = filename1; + beatmap2.Metadata.AudioFile = filename2; + + Assert.IsFalse(beatmap1.AudioEquals(beatmap2)); + } + + private static void addAudioFile(BeatmapSetInfo beatmapSetInfo, string hash = null, string filename = null) + { + beatmapSetInfo.Files.Add(new RealmNamedFileUsage(new RealmFile { Hash = hash ?? Guid.NewGuid().ToString() }, filename ?? "audio.mp3")); } [Test] diff --git a/osu.Game.Tests/Resources/TestResources.cs b/osu.Game.Tests/Resources/TestResources.cs index 41404b2636..ee29cc8644 100644 --- a/osu.Game.Tests/Resources/TestResources.cs +++ b/osu.Game.Tests/Resources/TestResources.cs @@ -138,7 +138,7 @@ namespace osu.Game.Tests.Resources BPM = bpm, Hash = Guid.NewGuid().ToString().ComputeMD5Hash(), Ruleset = rulesetInfo, - Metadata = metadata, + Metadata = metadata.DeepClone(), Difficulty = new BeatmapDifficulty { OverallDifficulty = diff, From 22a9e7e2753c5e09aad0fcdecba470f913ef5a82 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Jul 2022 16:56:08 +0900 Subject: [PATCH 2327/2328] Fix audio/background equality not correctly using `BeatmapInfo` local filenames --- osu.Game/Beatmaps/BeatmapInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 45d76259fc..41e89d864e 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -169,8 +169,8 @@ namespace osu.Game.Beatmaps Debug.Assert(x.BeatmapSet != null); Debug.Assert(y.BeatmapSet != null); - string? fileHashX = x.BeatmapSet.Files.FirstOrDefault(f => f.Filename == getFilename(x.BeatmapSet.Metadata))?.File.Hash; - string? fileHashY = y.BeatmapSet.Files.FirstOrDefault(f => f.Filename == getFilename(y.BeatmapSet.Metadata))?.File.Hash; + string? fileHashX = x.BeatmapSet.Files.FirstOrDefault(f => f.Filename == getFilename(x.Metadata))?.File.Hash; + string? fileHashY = y.BeatmapSet.Files.FirstOrDefault(f => f.Filename == getFilename(y.Metadata))?.File.Hash; return fileHashX == fileHashY; } From afa831f6fef58e984fecc568378ca88759daa47a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Jul 2022 01:14:53 +0900 Subject: [PATCH 2328/2328] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 04b16c5b0f..3b14d85e53 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 1d3cd39cf3..6120d3d600 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index dfd229755f..8a36ad6e3d 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - +